pub struct Player<V: Variant, S: Signer> { /* private fields */ }Expand description
Represents a player in the DKG / reshare process.
The player is attempting to get a share of the key.
They need not have participated in prior rounds.
Implementations§
Source§impl<V: Variant, S: Signer> Player<V, S>
impl<V: Variant, S: Signer> Player<V, S>
Sourcepub fn new(info: Info<V, S::PublicKey>, me: S) -> Result<Self, Error>
pub fn new(info: Info<V, S::PublicKey>, me: S) -> Result<Self, Error>
Create a new Player.
We need the player’s private key in order to sign messages.
Sourcepub fn dealer_message(
&mut self,
dealer: S::PublicKey,
pub_msg: DealerPubMsg<V>,
priv_msg: DealerPrivMsg,
) -> Option<PlayerAck<S::PublicKey>>
pub fn dealer_message( &mut self, dealer: S::PublicKey, pub_msg: DealerPubMsg<V>, priv_msg: DealerPrivMsg, ) -> Option<PlayerAck<S::PublicKey>>
Process a message from a dealer.
It’s important that nobody can impersonate the dealer, and that the private message was not exposed to anyone else. A convenient way to provide this is by using an authenticated channel, e.g. via crate::handshake, or commonware-p2p.
Sourcepub fn finalize(
self,
logs: BTreeMap<S::PublicKey, DealerLog<V, S::PublicKey>>,
concurrency: usize,
) -> Result<(Output<V, S::PublicKey>, Share), Error>
pub fn finalize( self, logs: BTreeMap<S::PublicKey, DealerLog<V, S::PublicKey>>, concurrency: usize, ) -> Result<(Output<V, S::PublicKey>, Share), Error>
Finalize the player, producing an output, and a share.
This should agree with observe, in terms of Ok vs Err and the
public output, so long as the logs agree. It’s crucial that the players
come to agreement, in some way, on exactly which logs they need to use
for finalize.
This will only ever return Error::DkgFailed.
Auto Trait Implementations§
impl<V, S> Freeze for Player<V, S>
impl<V, S> RefUnwindSafe for Player<V, S>where
S: RefUnwindSafe,
<S as Signer>::PublicKey: RefUnwindSafe,
<V as Variant>::Public: RefUnwindSafe + UnwindSafe,
impl<V, S> Send for Player<V, S>
impl<V, S> Sync for Player<V, S>
impl<V, S> Unpin for Player<V, S>
impl<V, S> UnwindSafe for Player<V, S>where
S: UnwindSafe,
<S as Signer>::PublicKey: UnwindSafe + RefUnwindSafe,
<V as Variant>::Public: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more