Skip to main content

ExternalBreezSigner

Trait ExternalBreezSigner 

Source
pub trait ExternalBreezSigner: Send + Sync {
    // Required methods
    fn derive_public_key<'life0, 'async_trait>(
        &'life0 self,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<PublicKeyBytes, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_ecdsa<'life0, 'async_trait>(
        &'life0 self,
        message: MessageBytes,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<EcdsaSignatureBytes, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_ecdsa_recoverable<'life0, 'async_trait>(
        &'life0 self,
        message: MessageBytes,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<RecoverableEcdsaSignatureBytes, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn encrypt_ecies<'life0, 'async_trait>(
        &'life0 self,
        message: Vec<u8>,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn decrypt_ecies<'life0, 'async_trait>(
        &'life0 self,
        message: Vec<u8>,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_hash_schnorr<'life0, 'async_trait>(
        &'life0 self,
        hash: Vec<u8>,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<SchnorrSignatureBytes, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn hmac_sha256<'life0, 'async_trait>(
        &'life0 self,
        message: Vec<u8>,
        path: String,
    ) -> Pin<Box<dyn Future<Output = Result<HashedMessageBytes, SignerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

External signer trait that can be implemented by users and passed to the SDK.

This trait mirrors the BreezSigner trait but uses FFI-compatible types (bytes, strings) instead of Rust-specific types. This allows it to be exposed through FFI and WASM bindings.

All methods accept and return simple types:

  • Derivation paths as strings (e.g., “m/44’/0’/0’”)
  • Public keys, signatures, and other crypto primitives as Vec
  • Spark-specific types as serialized representations

Errors are returned as SignerError for FFI compatibility.

Required Methods§

Source

fn derive_public_key<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<PublicKeyBytes, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Derives a public key for the given BIP32 derivation path.

§Arguments
  • path - BIP32 derivation path as a string (e.g., “m/44’/0’/0’/0/0”)
§Returns

The derived public key as 33 bytes, or a SignerError

See also: JavaScript getPublicKeyFromDerivation

Source

fn sign_ecdsa<'life0, 'async_trait>( &'life0 self, message: MessageBytes, path: String, ) -> Pin<Box<dyn Future<Output = Result<EcdsaSignatureBytes, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signs a message using ECDSA at the given derivation path.

The message should be a 32-byte digest (typically a hash of the original data).

§Arguments
  • message - The 32-byte message digest to sign
  • path - BIP32 derivation path as a string
§Returns

64-byte compact ECDSA signature, or a SignerError

Source

fn sign_ecdsa_recoverable<'life0, 'async_trait>( &'life0 self, message: MessageBytes, path: String, ) -> Pin<Box<dyn Future<Output = Result<RecoverableEcdsaSignatureBytes, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signs a message using recoverable ECDSA at the given derivation path.

The message should be a 32-byte digest (typically a hash of the original data).

§Arguments
  • message - The 32-byte message digest to sign
  • path - BIP32 derivation path as a string
§Returns

65 bytes: recovery ID (31 + recovery_id) + 64-byte signature, or a SignerError

Source

fn encrypt_ecies<'life0, 'async_trait>( &'life0 self, message: Vec<u8>, path: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Encrypts a message using ECIES at the given derivation path.

§Arguments
  • message - The message to encrypt
  • path - BIP32 derivation path for the encryption key
§Returns

Encrypted data, or a SignerError

Source

fn decrypt_ecies<'life0, 'async_trait>( &'life0 self, message: Vec<u8>, path: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Decrypts a message using ECIES at the given derivation path.

§Arguments
  • message - The encrypted message
  • path - BIP32 derivation path for the decryption key
§Returns

Decrypted data, or a SignerError

See also: JavaScript decryptEcies

Source

fn sign_hash_schnorr<'life0, 'async_trait>( &'life0 self, hash: Vec<u8>, path: String, ) -> Pin<Box<dyn Future<Output = Result<SchnorrSignatureBytes, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signs a hash using Schnorr signature at the given derivation path.

§Arguments
  • hash - The 32-byte hash to sign (must be 32 bytes)
  • path - BIP32 derivation path as a string
§Returns

64-byte Schnorr signature, or a SignerError

Source

fn hmac_sha256<'life0, 'async_trait>( &'life0 self, message: Vec<u8>, path: String, ) -> Pin<Box<dyn Future<Output = Result<HashedMessageBytes, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

HMAC-SHA256 of a message at the given derivation path.

§Arguments
  • message - The message to hash
  • path - BIP32 derivation path as a string
§Returns

32-byte HMAC-SHA256, or a SignerError

See also: JavaScript htlcHMAC

Implementors§