pub struct DefaultSigner {
pub derivation_index: Arc<RwLock<u32>>,
pub nonce_commitments: Arc<RwLock<HashbrownMap<String, String>>>,
pub public_keys_to_secret_keys: Arc<RwLock<HashbrownMap<String, String>>>,
pub network: SparkNetwork,
/* private fields */
}Expand description
A default, in-memory signer for Spark v1. Depending on the feature flags, it may store either a master seed (for self-signing) or remote wallet connection details (for third-party signing).
- If the
self-signingfeature is enabled, this signer keeps amaster_seedand derives keypairs to carry out signing operations. - If the
self-signingfeature is not enabled, this signer relies on a remote wallet by storing a connection URL and an API key. - Keys are held in memory and not persisted unless a future update is made to store them to disk.
- Nonce commitments for each signing round remain ephemeral in memory, which is typically sufficient for short-lived signing sessions.
Fields§
§derivation_index: Arc<RwLock<u32>>Index used for deriving new keypairs. The signer increments this after each derived keypair to ensure unique keys.
nonce_commitments: Arc<RwLock<HashbrownMap<String, String>>>A map of references to nonce commitments, stored as strings. These are used per signing round and can remain in memory until the round completes.
public_keys_to_secret_keys: Arc<RwLock<HashbrownMap<String, String>>>A map from public keys to secret keys, stored in memory only. This is necessary for self-signing or for local caching if not using remote keys.
network: SparkNetworkThe network that the signer is operating on.
Trait Implementations§
Source§impl Clone for DefaultSigner
impl Clone for DefaultSigner
Source§fn clone(&self) -> DefaultSigner
fn clone(&self) -> DefaultSigner
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl SparkSigner for DefaultSigner
impl SparkSigner for DefaultSigner
Source§fn from_mnemonic<'life0, 'async_trait>(
mnemonic: &'life0 str,
network: SparkNetwork,
) -> Pin<Box<dyn Future<Output = Result<Self::WrappedSigner, SparkSdkError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn from_mnemonic<'life0, 'async_trait>(
mnemonic: &'life0 str,
network: SparkNetwork,
) -> Pin<Box<dyn Future<Output = Result<Self::WrappedSigner, SparkSdkError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a new wallet from a mnemonic (BIP-39).
- Converts the mnemonic to a 64-byte seed
- Calls
from_seedto do the rest
Source§type WrappedSigner = Arc<DefaultSigner>
type WrappedSigner = Arc<DefaultSigner>
Source§fn from_master_seed<'life0, 'async_trait>(
master_seed: &'life0 [u8],
network: SparkNetwork,
) -> Pin<Box<dyn Future<Output = Result<Self::WrappedSigner, SparkSdkError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn from_master_seed<'life0, 'async_trait>(
master_seed: &'life0 [u8],
network: SparkNetwork,
) -> Pin<Box<dyn Future<Output = Result<Self::WrappedSigner, SparkSdkError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn derive_signing_key_from_leaf(
&self,
leaf_id: Uuid,
) -> Result<Vec<u8>, SparkSdkError>
fn derive_signing_key_from_leaf( &self, leaf_id: Uuid, ) -> Result<Vec<u8>, SparkSdkError>
Source§impl SparkSignerEcdsa for DefaultSigner
impl SparkSignerEcdsa for DefaultSigner
Source§impl SparkSignerEcies for DefaultSigner
impl SparkSignerEcies for DefaultSigner
Source§fn encrypt_secret_key_with_ecies<T, U>(
&self,
receiver_public_key: T,
pubkey_for_sk_to_encrypt: U,
) -> Result<Vec<u8>, SparkSdkError>
fn encrypt_secret_key_with_ecies<T, U>( &self, receiver_public_key: T, pubkey_for_sk_to_encrypt: U, ) -> Result<Vec<u8>, SparkSdkError>
Source§fn decrypt_secret_key_with_ecies<T>(
&self,
ciphertext: T,
) -> Result<Vec<u8>, SparkSdkError>
fn decrypt_secret_key_with_ecies<T>( &self, ciphertext: T, ) -> Result<Vec<u8>, SparkSdkError>
Source§impl SparkSignerFrost for DefaultSigner
impl SparkSignerFrost for DefaultSigner
Source§fn new_frost_signing_noncepair(
&self,
) -> Result<FrostSigningCommitments, SparkSdkError>
fn new_frost_signing_noncepair( &self, ) -> Result<FrostSigningCommitments, SparkSdkError>
Source§fn sensitive_expose_nonces_from_commitments<T>(
&self,
signing_commitments: &T,
) -> Result<FrostSigningNonces, SparkSdkError>
fn sensitive_expose_nonces_from_commitments<T>( &self, signing_commitments: &T, ) -> Result<FrostSigningNonces, SparkSdkError>
Source§fn sensitive_create_if_not_found_expose_nonces_from_commitments(
&self,
signing_commitments: Option<&[u8]>,
) -> Result<FrostSigningNonces, SparkSdkError>
fn sensitive_create_if_not_found_expose_nonces_from_commitments( &self, signing_commitments: Option<&[u8]>, ) -> Result<FrostSigningNonces, SparkSdkError>
sensitive_expose_nonces_from_commitments, but if the commitments are not found, it generates them.Source§impl SparkSignerFrostSigning for DefaultSigner
impl SparkSignerFrostSigning for DefaultSigner
Source§fn sign_frost(
&self,
signing_jobs: Vec<FrostSigningJob>,
) -> Result<SignFrostResponse, SparkSdkError>
fn sign_frost( &self, signing_jobs: Vec<FrostSigningJob>, ) -> Result<SignFrostResponse, SparkSdkError>
Source§fn aggregate_frost(
&self,
request: AggregateFrostRequest,
) -> Result<AggregateFrostResponse, SparkSdkError>
fn aggregate_frost( &self, request: AggregateFrostRequest, ) -> Result<AggregateFrostResponse, SparkSdkError>
fn sign_created_tree_in_bfs_order( &self, tx: Transaction, vout: u32, internal_tree_root: Arc<RwLock<DepositAddressTree>>, request_tree_root: CreationNode, creation_result_tree_root: CreationResponseNode, ) -> Result<(Vec<NodeSignatures>, Vec<Vec<u8>>), SparkSdkError>
fn sign_transfer_refunds( &self, leaf_data_map: &HashMap<String, LeafRefundSigningData>, operator_signing_results: &Vec<LeafRefundTxSigningResult>, adaptor_public_key: Vec<u8>, ) -> Result<Vec<NodeSignatures>, SparkSdkError>
fn sign_for_lightning_swap( &self, leaves: &Vec<LeafKeyTweak>, signing_commitments: &Vec<RequestedSigningCommitments>, receiver_identity_pubkey: PublicKey, ) -> Result<(SignFrostResponse, Vec<Vec<u8>>, Vec<ProtoSigningCommitments>), SparkSdkError>
Source§impl SparkSignerSecp256k1 for DefaultSigner
impl SparkSignerSecp256k1 for DefaultSigner
Source§fn get_identity_public_key(&self) -> Result<Vec<u8>, SparkSdkError>
fn get_identity_public_key(&self) -> Result<Vec<u8>, SparkSdkError>
Source§fn new_secp256k1_keypair(
&self,
keygen_method: KeygenMethod,
) -> Result<Vec<u8>, SparkSdkError>
fn new_secp256k1_keypair( &self, keygen_method: KeygenMethod, ) -> Result<Vec<u8>, SparkSdkError>
Source§fn insert_secp256k1_keypair_from_secret_key<T: AsRef<[u8]>>(
&self,
secret_key_bytes: T,
) -> Result<Vec<u8>, SparkSdkError>
fn insert_secp256k1_keypair_from_secret_key<T: AsRef<[u8]>>( &self, secret_key_bytes: T, ) -> Result<Vec<u8>, SparkSdkError>
Source§fn subtract_secret_keys_given_pubkeys<T: AsRef<[u8]>, U: AsRef<[u8]>>(
&self,
target_pubkey: T,
source_pubkey: U,
save_new_key: bool,
) -> Result<Vec<u8>, SparkSdkError>
fn subtract_secret_keys_given_pubkeys<T: AsRef<[u8]>, U: AsRef<[u8]>>( &self, target_pubkey: T, source_pubkey: U, save_new_key: bool, ) -> Result<Vec<u8>, SparkSdkError>
Source§fn sensitive_expose_secret_key_from_pubkey<T: AsRef<[u8]>>(
&self,
public_key: T,
delete_after_exposing: bool,
) -> Result<Vec<u8>, SparkSdkError>
fn sensitive_expose_secret_key_from_pubkey<T: AsRef<[u8]>>( &self, public_key: T, delete_after_exposing: bool, ) -> Result<Vec<u8>, SparkSdkError>
Source§impl SparkSignerShamir for DefaultSigner
impl SparkSignerShamir for DefaultSigner
fn split_with_verifiable_secret_sharing( &self, message: Vec<u8>, threshold: usize, num_shares: usize, ) -> Result<Vec<VerifiableSecretShare>, SparkSdkError>
fn split_from_public_key_with_verifiable_secret_sharing( &self, public_key: Vec<u8>, threshold: usize, num_shares: usize, ) -> Result<Vec<VerifiableSecretShare>, SparkSdkError>
Auto Trait Implementations§
impl Freeze for DefaultSigner
impl !RefUnwindSafe for DefaultSigner
impl Send for DefaultSigner
impl Sync for DefaultSigner
impl Unpin for DefaultSigner
impl !UnwindSafe for DefaultSigner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 56 bytes