Signer

Trait Signer 

Source
pub trait Signer:
    Clone
    + Debug
    + PartialEq {
Show 17 methods // Required methods fn new<RNG: RngCore + CryptoRng>( party_id: u32, key_ids: &[u32], num_signers: u32, num_keys: u32, threshold: u32, rng: &mut RNG, ) -> Self; fn load(state: &SignerState) -> Self; fn save(&self) -> SignerState; fn get_id(&self) -> u32; fn get_key_ids(&self) -> Vec<u32>; fn get_num_parties(&self) -> u32; fn get_poly_commitments<RNG: RngCore + CryptoRng>( &self, ctx: &[u8], rng: &mut RNG, ) -> Vec<PolyCommitment>; fn reset_polys<RNG: RngCore + CryptoRng>(&mut self, rng: &mut RNG); fn clear_polys(&mut self); fn get_shares(&self) -> HashMap<u32, HashMap<u32, Scalar>>; fn compute_secrets( &mut self, shares: &HashMap<u32, HashMap<u32, Scalar>>, polys: &HashMap<u32, PolyCommitment>, ctx: &[u8], ) -> Result<(), HashMap<u32, DkgError>>; fn gen_nonces<RNG: RngCore + CryptoRng>( &mut self, secret_key: &Scalar, rng: &mut RNG, ) -> Vec<PublicNonce>; fn compute_intermediate( msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], ) -> (Vec<Point>, Point); fn validate_party_id( signer_id: u32, party_id: u32, signer_key_ids: &HashMap<u32, HashSet<u32>>, ) -> bool; fn sign( &self, msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], ) -> Vec<SignatureShare>; fn sign_schnorr( &self, msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], ) -> Vec<SignatureShare>; fn sign_taproot( &self, msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], merkle_root: Option<MerkleRoot>, ) -> Vec<SignatureShare>;
}
Expand description

A trait which provides a common Signer interface for v1 and v2

Required Methods§

Source

fn new<RNG: RngCore + CryptoRng>( party_id: u32, key_ids: &[u32], num_signers: u32, num_keys: u32, threshold: u32, rng: &mut RNG, ) -> Self

Create a new Signer

Source

fn load(state: &SignerState) -> Self

Load a signer from the previously saved state

Source

fn save(&self) -> SignerState

Save the state required to reconstruct the party

Source

fn get_id(&self) -> u32

Get the signer ID for this signer

Source

fn get_key_ids(&self) -> Vec<u32>

Get all key IDs for this signer

Source

fn get_num_parties(&self) -> u32

Get the total number of parties

Source

fn get_poly_commitments<RNG: RngCore + CryptoRng>( &self, ctx: &[u8], rng: &mut RNG, ) -> Vec<PolyCommitment>

Get all poly commitments for this signer and the passed context

Source

fn reset_polys<RNG: RngCore + CryptoRng>(&mut self, rng: &mut RNG)

Reset all polynomials for this signer

Source

fn clear_polys(&mut self)

Clear all polynomials for this signer

Source

fn get_shares(&self) -> HashMap<u32, HashMap<u32, Scalar>>

Get all private shares for this signer

Source

fn compute_secrets( &mut self, shares: &HashMap<u32, HashMap<u32, Scalar>>, polys: &HashMap<u32, PolyCommitment>, ctx: &[u8], ) -> Result<(), HashMap<u32, DkgError>>

Compute all secrets for this signer

Source

fn gen_nonces<RNG: RngCore + CryptoRng>( &mut self, secret_key: &Scalar, rng: &mut RNG, ) -> Vec<PublicNonce>

Generate all nonces for this signer

Source

fn compute_intermediate( msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], ) -> (Vec<Point>, Point)

Compute intermediate values

Source

fn validate_party_id( signer_id: u32, party_id: u32, signer_key_ids: &HashMap<u32, HashSet<u32>>, ) -> bool

Validate that signer_id owns party_id

Source

fn sign( &self, msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], ) -> Vec<SignatureShare>

Sign msg using all this signer’s keys

Source

fn sign_schnorr( &self, msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], ) -> Vec<SignatureShare>

Sign msg using all this signer’s keys

Source

fn sign_taproot( &self, msg: &[u8], signer_ids: &[u32], key_ids: &[u32], nonces: &[PublicNonce], merkle_root: Option<MerkleRoot>, ) -> Vec<SignatureShare>

Sign msg using all this signer’s keys and a tweaked public key

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§