spark_rust/signer/traits/frost.rs
1use frost_secp256k1_tr_unofficial::round1::{SigningCommitments, SigningNonces};
2
3use crate::error::SparkSdkError;
4
5pub trait SparkSignerFrost {
6 /// Generates a (commitments, nonces) pair for a FROST signing round. Stores the pair in the signer space.
7 ///
8 /// # Returns
9 /// The FROST nonces
10 fn new_frost_signing_noncepair(&self) -> Result<SigningCommitments, SparkSdkError>;
11
12 /// Exposes the nonces from the commitments. This is a **highly sensitive**
13 /// operation from a security perspective because it reveals confidential material.
14 /// Use it **only** when absolutely necessary, and handle the returned nonces with caution.
15 ///
16 /// # Returns
17 /// The FROST nonces for the given commitments
18 fn sensitive_expose_nonces_from_commitments<T>(
19 &self,
20 signing_commitments: &T,
21 ) -> Result<SigningNonces, SparkSdkError>
22 where
23 T: AsRef<[u8]>;
24
25 /// Same as `sensitive_expose_nonces_from_commitments`, but if the commitments are not found, it generates them.
26 fn sensitive_create_if_not_found_expose_nonces_from_commitments(
27 &self,
28 signing_commitments: Option<&[u8]>,
29 ) -> Result<SigningNonces, SparkSdkError>;
30}