[][src]Struct hbbft::threshold_decrypt::ThresholdDecrypt

pub struct ThresholdDecrypt<N> { /* fields omitted */ }

A Threshold Decrypt algorithm instance. If every node inputs the same data, encrypted to the network's public key, every node will output the decrypted data.

Methods

impl<N: NodeIdT> ThresholdDecrypt<N>[src]

pub fn new(netinfo: Arc<NetworkInfo<N>>) -> Self[src]

Creates a new Threshold Decrypt instance.

pub fn new_with_ciphertext(
    netinfo: Arc<NetworkInfo<N>>,
    ct: Ciphertext
) -> Result<Self>
[src]

Creates a new instance of ThresholdDecrypt, including setting the ciphertext to decrypt.

pub fn set_ciphertext(&mut self, ct: Ciphertext) -> Result<()>[src]

Sets the ciphertext, sends the decryption share, and tries to decrypt it. This must be called exactly once, with the same ciphertext in all participating nodes. If we have enough shares, outputs the plaintext.

pub fn start_decryption(&mut self) -> Result<Step<N>>[src]

Sends our decryption shares to peers, and if we have collected enough, returns the decrypted message. Returns an error if the ciphertext hasn't been received yet.

pub fn sender_ids(&self) -> impl Iterator<Item = &N>[src]

Returns an iterator over the IDs of all nodes who sent a share.

pub fn handle_message(
    &mut self,
    sender_id: &N,
    message: Message
) -> Result<Step<N>>
[src]

Handles a message with a decryption share received from sender_id.

This must be called with every message we receive from another node.

If we have collected enough, returns the decrypted message.

Trait Implementations

impl<N: NodeIdT> ConsensusProtocol for ThresholdDecrypt<N>[src]

type NodeId = N

Unique node identifier.

type Input = ()

The input provided by the user.

type Output = Vec<u8>

The output type. Some algorithms return an output exactly once, others return multiple times. Read more

type Message = Message

The messages that need to be exchanged between the instances in the participating nodes.

type Error = Error

The errors that can occur during execution.

type FaultKind = FaultKind

The kinds of message faults that can be detected during execution.

impl<N: Debug> Debug for ThresholdDecrypt<N>[src]

Auto Trait Implementations

impl<N> Send for ThresholdDecrypt<N> where
    N: Send + Sync

impl<N> Sync for ThresholdDecrypt<N> where
    N: Send + Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.