bpstd

Trait Sign

Source
pub trait Sign {
    // Required methods
    fn sign_ecdsa(
        &self,
        message: Sighash,
        pk: LegacyPk,
        origin: Option<&KeyOrigin>,
    ) -> Option<Signature>;
    fn sign_bip340_key_only(
        &self,
        message: TapSighash,
        pk: InternalPk,
        origin: Option<&KeyOrigin>,
        merkle_root: Option<TapNodeHash>,
    ) -> Option<Signature>;
    fn sign_bip340_script_path(
        &self,
        message: TapSighash,
        pk: XOnlyPk,
        origin: Option<&KeyOrigin>,
    ) -> Option<Signature>;
    fn should_sign_script_path(
        &self,
        index: usize,
        merkle_path: &TapMerklePath,
        leaf: TapLeafHash,
    ) -> bool;
    fn should_sign_key_path(&self, index: usize) -> bool;
}
Expand description

Trait used for signing transactions.

Required Methods§

Source

fn sign_ecdsa( &self, message: Sighash, pk: LegacyPk, origin: Option<&KeyOrigin>, ) -> Option<Signature>

Create signature with a given key for inputs requiring ECDSA signatures (bare, pre-segwit and segwit v0).

Source

fn sign_bip340_key_only( &self, message: TapSighash, pk: InternalPk, origin: Option<&KeyOrigin>, merkle_root: Option<TapNodeHash>, ) -> Option<Signature>

Create signature with a given internal key using Schnorr signatures with BIP-340 signing scheme (taproot).

Source

fn sign_bip340_script_path( &self, message: TapSighash, pk: XOnlyPk, origin: Option<&KeyOrigin>, ) -> Option<Signature>

Create signature with a given script path and x-only public key using Schnorr signatures with BIP-340 signing scheme (taproot).

Source

fn should_sign_script_path( &self, index: usize, merkle_path: &TapMerklePath, leaf: TapLeafHash, ) -> bool

Detect whether a given taproot script spending path should be signed for a given input index.

Source

fn should_sign_key_path(&self, index: usize) -> bool

Detect whether taproot key spending path should be signed for a given input index.

Implementors§