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§
Sourcefn 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 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
Sourcefn 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<'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,
Sourcefn 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 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 signpath- BIP32 derivation path as a string
§Returns
65 bytes: recovery ID (31 + recovery_id) + 64-byte signature, or a SignerError
Sourcefn 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 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,
Sourcefn 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 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 messagepath- BIP32 derivation path for the decryption key
§Returns
Decrypted data, or a SignerError
See also: JavaScript decryptEcies
Sourcefn 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 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,
Sourcefn 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,
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 hashpath- BIP32 derivation path as a string
§Returns
32-byte HMAC-SHA256, or a SignerError
See also: JavaScript htlcHMAC