breez_sdk_liquid::model

Trait Signer

source
pub trait Signer: Send + Sync {
    // Required methods
    fn xpub(&self) -> Result<Vec<u8>, SignerError>;
    fn derive_xpub(
        &self,
        derivation_path: String,
    ) -> Result<Vec<u8>, SignerError>;
    fn sign_ecdsa(
        &self,
        msg: Vec<u8>,
        derivation_path: String,
    ) -> Result<Vec<u8>, SignerError>;
    fn sign_ecdsa_recoverable(
        &self,
        msg: Vec<u8>,
    ) -> Result<Vec<u8>, SignerError>;
    fn slip77_master_blinding_key(&self) -> Result<Vec<u8>, SignerError>;
    fn hmac_sha256(
        &self,
        msg: Vec<u8>,
        derivation_path: String,
    ) -> Result<Vec<u8>, SignerError>;
}
Expand description

A trait that can be used to sign messages and verify signatures. The sdk user can implement this trait to use their own signer.

Required Methods§

source

fn xpub(&self) -> Result<Vec<u8>, SignerError>

The master xpub encoded as 78 bytes length as defined in bip32 specification. For reference: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#user-content-Serialization_format

source

fn derive_xpub(&self, derivation_path: String) -> Result<Vec<u8>, SignerError>

The derived xpub encoded as 78 bytes length as defined in bip32 specification. The derivation path is a string represents the shorter notation of the key tree to derive. For example: m/49’/1’/0’/0/0 m/48’/1’/0’/0/0 For reference: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#user-content-The_key_tree

source

fn sign_ecdsa( &self, msg: Vec<u8>, derivation_path: String, ) -> Result<Vec<u8>, SignerError>

Sign an ECDSA message using the private key derived from the given derivation path

source

fn sign_ecdsa_recoverable(&self, msg: Vec<u8>) -> Result<Vec<u8>, SignerError>

Sign an ECDSA message using the private key derived from the master key

source

fn slip77_master_blinding_key(&self) -> Result<Vec<u8>, SignerError>

Return the master blinding key for SLIP77: https://github.com/satoshilabs/slips/blob/master/slip-0077.md

source

fn hmac_sha256( &self, msg: Vec<u8>, derivation_path: String, ) -> Result<Vec<u8>, SignerError>

HMAC-SHA256 using the private key derived from the given derivation path This is used to calculate the linking key of lnurl-auth specification: https://github.com/lnurl/luds/blob/luds/05.md

Implementors§