pub struct Dealer<V: Variant, S: Signer> { /* private fields */ }Implementations§
Source§impl<V: Variant, S: Signer> Dealer<V, S>
impl<V: Variant, S: Signer> Dealer<V, S>
Sourcepub fn start(
rng: impl CryptoRngCore,
info: Info<V, S::PublicKey>,
me: S,
share: Option<Share>,
) -> Result<(Self, DealerPubMsg<V>, Vec<(S::PublicKey, DealerPrivMsg)>), Error>
pub fn start( rng: impl CryptoRngCore, info: Info<V, S::PublicKey>, me: S, share: Option<Share>, ) -> Result<(Self, DealerPubMsg<V>, Vec<(S::PublicKey, DealerPrivMsg)>), Error>
Create a Dealer.
This needs randomness, to generate a dealing.
We also need the dealer’s private key, in order to produce the SignedDealerLog.
If we’re doing a reshare, the dealer should have a share from the previous round.
This will produce the Dealer, a DealerPubMsg to send to every player,
and a list of DealerPrivMsgs, along with which players those need to
be sent to.
The public message can be sent in the clear, but it’s important that players know which dealer sent what public message. You MUST ensure that dealers cannot impersonate each-other when sending this message.
The private message MUST be sent encrypted (or, in some other way, privately) to the target player. Similarly, that player MUST be convinced that this dealer sent it that message, without any possibility of impersonation. A simple way to provide both guarantees is through an authenticated channel, e.g. via crate::handshake, or commonware-p2p.
Sourcepub fn receive_player_ack(
&mut self,
player: S::PublicKey,
ack: PlayerAck<S::PublicKey>,
) -> Result<(), Error>
pub fn receive_player_ack( &mut self, player: S::PublicKey, ack: PlayerAck<S::PublicKey>, ) -> Result<(), Error>
Process an acknowledgement from a player.
Acknowledgements should really only be processed once per player, but this method is idempotent nonetheless.
Sourcepub fn finalize(self) -> SignedDealerLog<V, S>
pub fn finalize(self) -> SignedDealerLog<V, S>
Finalize the dealer, producing a signed log.
This should be called at the point where no more acks will be processed.
Auto Trait Implementations§
impl<V, S> Freeze for Dealer<V, S>where
S: Freeze,
impl<V, S> RefUnwindSafe for Dealer<V, S>where
S: RefUnwindSafe,
<S as Signer>::PublicKey: RefUnwindSafe,
<V as Variant>::Public: RefUnwindSafe + UnwindSafe,
<S as Signer>::Signature: RefUnwindSafe,
impl<V, S> Send for Dealer<V, S>
impl<V, S> Sync for Dealer<V, S>
impl<V, S> Unpin for Dealer<V, S>
impl<V, S> UnwindSafe for Dealer<V, S>where
S: UnwindSafe,
<S as Signer>::PublicKey: UnwindSafe,
<V as Variant>::Public: UnwindSafe + RefUnwindSafe,
<S as Signer>::Signature: 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