pub struct Signer<SignerType: SignerTrait> {Show 23 fields
pub dkg_id: u64,
pub sign_id: u64,
pub sign_iter_id: u64,
pub threshold: u32,
pub dkg_threshold: u32,
pub total_signers: u32,
pub total_keys: u32,
pub signer: SignerType,
pub signer_id: u32,
pub state: State,
pub commitments: HashMap<u32, PolyCommitment>,
pub decrypted_shares: HashMap<u32, HashMap<u32, Scalar>>,
pub decryption_keys: HashMap<u32, (u32, Point)>,
pub invalid_private_shares: HashMap<u32, BadPrivateShare>,
pub public_nonces: Vec<PublicNonce>,
pub network_private_key: Scalar,
pub public_keys: PublicKeys,
pub dkg_public_shares: BTreeMap<u32, DkgPublicShares>,
pub dkg_private_shares: BTreeMap<u32, DkgPrivateShares>,
pub dkg_private_begin_msg: Option<DkgPrivateBegin>,
pub dkg_end_begin_msg: Option<DkgEndBegin>,
pub verify_packet_sigs: bool,
pub coordinator_public_key: Option<PublicKey>,
/* private fields */
}Expand description
A state machine for a signing round
Fields§
§dkg_id: u64current DKG round ID
sign_id: u64current signing round ID
sign_iter_id: u64current signing iteration ID
threshold: u32the threshold of the keys needed for a valid signature
dkg_threshold: u32the threshold of the keys needed for a valid DKG
total_signers: u32the total number of signers
total_keys: u32the total number of keys
signer: SignerTypethe Signer object
signer_id: u32the Signer ID
state: Statethe current state
commitments: HashMap<u32, PolyCommitment>map of polynomial commitments for each party party_id => PolyCommitment
map of decrypted DKG private shares src_party_id => (dst_key_id => private_share)
decryption_keys: HashMap<u32, (u32, Point)>shared secrets used to decrypt private shares src_party_id => (signer_id, dh shared key)
invalid private shares signer_id => {shared_key, tuple_proof}
public_nonces: Vec<PublicNonce>public nonces for this signing round
network_private_key: Scalarthe private key used to sign messages sent over the network
public_keys: PublicKeysthe public keys for all signers and coordinator
the DKG public shares received in this round
the DKG private shares received in this round
dkg_private_begin_msg: Option<DkgPrivateBegin>the DKG private begin message received in this round
dkg_end_begin_msg: Option<DkgEndBegin>the DKG end begin message received in this round
verify_packet_sigs: boolwhether to verify the signature on Packets
coordinator_public_key: Option<PublicKey>coordinator public key
Implementations§
Source§impl<SignerType: SignerTrait> Signer<SignerType>
impl<SignerType: SignerTrait> Signer<SignerType>
Sourcepub fn new<R: RngCore + CryptoRng>(
threshold: u32,
dkg_threshold: u32,
total_signers: u32,
total_keys: u32,
signer_id: u32,
key_ids: Vec<u32>,
network_private_key: Scalar,
public_keys: PublicKeys,
rng: &mut R,
) -> Result<Self, Error>
pub fn new<R: RngCore + CryptoRng>( threshold: u32, dkg_threshold: u32, total_signers: u32, total_keys: u32, signer_id: u32, key_ids: Vec<u32>, network_private_key: Scalar, public_keys: PublicKeys, rng: &mut R, ) -> Result<Self, Error>
create a Signer
Sourcepub fn load(state: &SavedState) -> Self
pub fn load(state: &SavedState) -> Self
Load a coordinator from the previously saved state
Sourcepub fn save(&self) -> SavedState
pub fn save(&self) -> SavedState
Save the state required to reconstruct the coordinator
Sourcepub fn process<R: RngCore + CryptoRng>(
&mut self,
packet: &Packet,
rng: &mut R,
) -> Result<Vec<Message>, Error>
pub fn process<R: RngCore + CryptoRng>( &mut self, packet: &Packet, rng: &mut R, ) -> Result<Vec<Message>, Error>
process the passed incoming message, and return any outgoing messages needed in response
Sourcepub fn dkg_ended<R: RngCore + CryptoRng>(
&mut self,
rng: &mut R,
) -> Result<Message, Error>
pub fn dkg_ended<R: RngCore + CryptoRng>( &mut self, rng: &mut R, ) -> Result<Message, Error>
DKG is done so compute secrets
do we have all DkgPublicShares?
Sourcepub fn can_dkg_end(&self) -> bool
pub fn can_dkg_end(&self) -> bool
do we have all DkgPublicShares and DkgPrivateShares?
Sourcepub fn dkg_end_begin(
&mut self,
dkg_end_begin: &DkgEndBegin,
) -> Result<Vec<Message>, Error>
pub fn dkg_end_begin( &mut self, dkg_end_begin: &DkgEndBegin, ) -> Result<Vec<Message>, Error>
handle incoming DkgEndBegin
handle incoming DkgPublicShares
handle incoming DkgPrivateShares
Trait Implementations§
Source§impl<SignerType: SignerTrait> Debug for Signer<SignerType>
impl<SignerType: SignerTrait> Debug for Signer<SignerType>
Source§impl<SignerType: SignerTrait> StateMachine<State, Error> for Signer<SignerType>
impl<SignerType: SignerTrait> StateMachine<State, Error> for Signer<SignerType>
impl<SignerType: SignerTrait> StructuralPartialEq for Signer<SignerType>
Auto Trait Implementations§
impl<SignerType> Freeze for Signer<SignerType>where
SignerType: Freeze,
impl<SignerType> RefUnwindSafe for Signer<SignerType>where
SignerType: RefUnwindSafe,
impl<SignerType> Send for Signer<SignerType>where
SignerType: Send,
impl<SignerType> Sync for Signer<SignerType>where
SignerType: Sync,
impl<SignerType> Unpin for Signer<SignerType>where
SignerType: Unpin,
impl<SignerType> UnwindSafe for Signer<SignerType>where
SignerType: UnwindSafe,
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> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.