spark_sdk/signer/traits/
mod.rs1use crate::error::SparkSdkError;
2
3use crate::signer::traits::ecdsa::SparkSignerEcdsa;
5use crate::signer::traits::ecies::SparkSignerEcies;
6use crate::signer::traits::frost::SparkSignerFrost;
7use crate::signer::traits::frost_signing::SparkSignerFrostSigning;
8use crate::signer::traits::secp256k1::SparkSignerSecp256k1;
9use crate::signer::traits::shamir::SparkSignerShamir;
10
11use crate::SparkNetwork;
12
13use tonic::async_trait;
14use uuid::Uuid;
15
16pub mod ecdsa;
17pub mod ecies;
18pub mod frost;
19pub mod frost_signing;
20pub mod secp256k1;
21pub mod shamir;
22
23#[async_trait]
24pub trait SparkSigner:
25 SparkSignerShamir
26 + SparkSignerEcdsa
27 + SparkSignerEcies
28 + SparkSignerFrost
29 + SparkSignerSecp256k1
30 + SparkSignerFrostSigning
31{
32 type WrappedSigner: Sized;
34
35 #[cfg(feature = "self-signing")]
43 async fn from_mnemonic(
44 mnemonic: &str,
45 network: SparkNetwork,
46 ) -> Result<Self::WrappedSigner, SparkSdkError>;
47
48 #[cfg(feature = "self-signing")]
56 async fn from_master_seed(
57 master_seed: &[u8],
58 network: SparkNetwork,
59 ) -> Result<Self::WrappedSigner, SparkSdkError>;
60
61 #[cfg(not(feature = "self-signing"))]
66 async fn new_remote(
67 signer_url: &str,
68 wallet_id: &str,
69 user_public_key_hex: &str,
70 ) -> Result<Self::WrappedSigner, SparkSdkError>;
71
72 fn derive_signing_key_from_leaf(&self, leaf_id: Uuid) -> Result<Vec<u8>, SparkSdkError>;
80}