ExternalSigner

Trait ExternalSigner 

Source
pub trait ExternalSigner: Send + Sync {
Show 19 methods // Required methods fn identity_public_key(&self) -> Result<PublicKeyBytes, SignerError>; 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: Vec<u8>, 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: Vec<u8>, path: String, ) -> Pin<Box<dyn Future<Output = Result<RecoverableEcdsaSignatureBytes, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn ecies_encrypt<'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 ecies_decrypt<'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 generate_frost_signing_commitments<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ExternalFrostCommitments, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_public_key_for_node<'life0, 'async_trait>( &'life0 self, id: ExternalTreeNodeId, ) -> Pin<Box<dyn Future<Output = Result<PublicKeyBytes, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn generate_random_key<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ExternalPrivateKeySource, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_static_deposit_private_key_source<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<ExternalPrivateKeySource, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_static_deposit_private_key<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<PrivateKeyBytes, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_static_deposit_public_key<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<PublicKeyBytes, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subtract_private_keys<'life0, 'async_trait>( &'life0 self, signing_key: ExternalPrivateKeySource, new_signing_key: ExternalPrivateKeySource, ) -> Pin<Box<dyn Future<Output = Result<ExternalPrivateKeySource, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn split_secret<'life0, 'async_trait>( &'life0 self, secret: ExternalSecretToSplit, threshold: u32, num_shares: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalVerifiableSecretShare>, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn encrypt_private_key_for_receiver<'life0, 'async_trait>( &'life0 self, private_key: ExternalEncryptedPrivateKey, receiver_public_key: PublicKeyBytes, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_public_key_from_private_key_source<'life0, 'async_trait>( &'life0 self, private_key: ExternalPrivateKeySource, ) -> Pin<Box<dyn Future<Output = Result<PublicKeyBytes, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sign_frost<'life0, 'async_trait>( &'life0 self, request: ExternalSignFrostRequest, ) -> Pin<Box<dyn Future<Output = Result<ExternalFrostSignatureShare, SignerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn aggregate_frost_signatures<'life0, 'async_trait>( &'life0 self, request: ExternalAggregateFrostRequest, ) -> Pin<Box<dyn Future<Output = Result<ExternalFrostSignature, 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 identity_public_key(&self) -> Result<PublicKeyBytes, SignerError>

Returns the identity public key as 33 bytes (compressed secp256k1 key).

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

Source

fn sign_ecdsa<'life0, 'async_trait>( &'life0 self, message: Vec<u8>, 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.

§Arguments
  • message - The message 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: Vec<u8>, 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.

§Arguments
  • message - The message to sign (will be double-SHA256 hashed)
  • path - BIP32 derivation path as a string
§Returns

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

Source

fn ecies_encrypt<'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 ecies_decrypt<'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

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 generate_frost_signing_commitments<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ExternalFrostCommitments, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generates Frost signing commitments for multi-party signing.

§Returns

Frost commitments with nonces, or a SignerError

Source

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

Gets the public key for a specific tree node in the Spark wallet.

§Arguments
  • id - The tree node identifier
§Returns

The public key for the node, or an error string

Source

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

Generates a random private key.

§Returns

A randomly generated private key source, or an error string

Source

fn get_static_deposit_private_key_source<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<ExternalPrivateKeySource, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a static deposit private key source by index.

§Arguments
  • index - The index of the static deposit key
§Returns

The private key source, or an error string

Source

fn get_static_deposit_private_key<'life0, 'async_trait>( &'life0 self, index: u32, ) -> Pin<Box<dyn Future<Output = Result<PrivateKeyBytes, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a static deposit private key by index.

§Arguments
  • index - The index of the static deposit key
§Returns

The 32-byte private key, or an error string

Source

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

Gets a static deposit public key by index.

§Arguments
  • index - The index of the static deposit key
§Returns

The 33-byte public key, or an error string

Source

fn subtract_private_keys<'life0, 'async_trait>( &'life0 self, signing_key: ExternalPrivateKeySource, new_signing_key: ExternalPrivateKeySource, ) -> Pin<Box<dyn Future<Output = Result<ExternalPrivateKeySource, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subtracts one private key from another.

§Arguments
  • signing_key - The first private key source
  • new_signing_key - The second private key source to subtract
§Returns

The resulting private key source, or an error string

Source

fn split_secret<'life0, 'async_trait>( &'life0 self, secret: ExternalSecretToSplit, threshold: u32, num_shares: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalVerifiableSecretShare>, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Splits a secret with proofs using Shamir’s Secret Sharing.

§Arguments
  • secret - The secret to split
  • threshold - Minimum number of shares needed to reconstruct
  • num_shares - Total number of shares to create
§Returns

Vector of verifiable secret shares, or an error string

Source

fn encrypt_private_key_for_receiver<'life0, 'async_trait>( &'life0 self, private_key: ExternalEncryptedPrivateKey, receiver_public_key: PublicKeyBytes, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Encrypts a private key for a specific receiver’s public key.

§Arguments
  • private_key - The encrypted private key to re-encrypt
  • receiver_public_key - The receiver’s 33-byte public key
§Returns

Encrypted data for the receiver, or an error string

Source

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

Gets the public key from a private key source.

§Arguments
  • private_key - The private key source
§Returns

The corresponding 33-byte public key, or an error string

Source

fn sign_frost<'life0, 'async_trait>( &'life0 self, request: ExternalSignFrostRequest, ) -> Pin<Box<dyn Future<Output = Result<ExternalFrostSignatureShare, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signs using Frost protocol (multi-party signing).

§Arguments
  • request - The Frost signing request
§Returns

A signature share, or an error string

Source

fn aggregate_frost_signatures<'life0, 'async_trait>( &'life0 self, request: ExternalAggregateFrostRequest, ) -> Pin<Box<dyn Future<Output = Result<ExternalFrostSignature, SignerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Aggregates Frost signature shares into a final signature.

§Arguments
  • request - The Frost aggregation request
§Returns

The aggregated Frost signature, or an error string

Implementors§