[−][src]Struct hbbft::sync_key_gen::SyncKeyGen
A synchronous algorithm for dealerless distributed key generation.
It requires that all nodes handle all messages in the exact same order.
Methods
impl<N: NodeIdT> SyncKeyGen<N>
[src]
pub fn new<R: Rng>(
our_id: N,
sec_key: SecretKey,
pub_keys: BTreeMap<N, PublicKey>,
threshold: usize,
rng: &mut R
) -> Result<(SyncKeyGen<N>, Option<Part>), Error>
[src]
our_id: N,
sec_key: SecretKey,
pub_keys: BTreeMap<N, PublicKey>,
threshold: usize,
rng: &mut R
) -> Result<(SyncKeyGen<N>, Option<Part>), Error>
Creates a new SyncKeyGen
instance, together with the Part
message that should be
multicast to all nodes.
If we are not a validator but only an observer, no Part
message is produced and no
messages need to be sent.
pub fn public_keys(&self) -> &BTreeMap<N, PublicKey>
[src]
Returns the map of participating nodes and their public keys.
pub fn handle_part<R: Rng>(
&mut self,
sender_id: &N,
part: Part,
rng: &mut R
) -> Result<PartOutcome, Error>
[src]
&mut self,
sender_id: &N,
part: Part,
rng: &mut R
) -> Result<PartOutcome, Error>
Handles a Part
message. If it is valid, returns an Ack
message to be broadcast.
If we are only an observer, None
is returned instead and no messages need to be sent.
All participating nodes must handle the exact same sequence of messages.
Note that handle_part
also needs to explicitly be called with this instance's own Part
.
pub fn handle_ack(
&mut self,
sender_id: &N,
ack: Ack
) -> Result<AckOutcome, Error>
[src]
&mut self,
sender_id: &N,
ack: Ack
) -> Result<AckOutcome, Error>
Handles an Ack
message.
All participating nodes must handle the exact same sequence of messages.
Note that handle_ack
also needs to explicitly be called with this instance's own Ack
s.
pub fn count_complete(&self) -> usize
[src]
Returns the number of complete parts. If this is at least threshold + 1
, the keys can
be generated, but it is possible to wait for more to increase security.
pub fn is_node_ready(&self, proposer_id: &N) -> bool
[src]
Returns true
if the part of the given node is complete.
pub fn is_ready(&self) -> bool
[src]
Returns true
if enough parts are complete to safely generate the new key.
pub fn generate(&self) -> Result<(PublicKeySet, Option<SecretKeyShare>), Error>
[src]
Returns the new secret key share and the public key set.
These are only secure if is_ready
returned true
. Otherwise it is not guaranteed that
none of the nodes knows the secret master key.
If we are only an observer node, no secret key share is returned.
All participating nodes must have handled the exact same sequence of Part
and Ack
messages before calling this method. Otherwise their key shares will not match.
pub fn into_network_info(self) -> Result<NetworkInfo<N>, Error>
[src]
Consumes the instance, generates the key set and returns a new NetworkInfo
with the new
keys.
All participating nodes must have handled the exact same sequence of Part
and Ack
messages before calling this method. Otherwise their key shares will not match.
pub fn num_nodes(&self) -> usize
[src]
Returns the number of nodes participating in the key generation.
Trait Implementations
Auto Trait Implementations
impl<N> Send for SyncKeyGen<N> where
N: Send,
N: Send,
impl<N> Sync for SyncKeyGen<N> where
N: Sync,
N: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,