Skip to main content

Reconstructible

Trait Reconstructible 

Source
pub trait Reconstructible: Sized {
    type Secret: Serialize + DeserializeOwned + Clone + PartialEq + Send + Sync + 'static;
    type Opening: Serialize + DeserializeOwned + Clone + Send + Sync + 'static;

    // Required methods
    fn open_to(
        &self,
        peer_index: PeerIndex,
    ) -> Result<Self::Opening, PrimitiveError>;
    fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = Self::Opening>;
    fn reconstruct(
        &self,
        openings: &[Self::Opening],
    ) -> Result<Self::Secret, PrimitiveError>;

    // Provided method
    fn reconstruct_all<T: Borrow<Self>>(
        shares: &[T],
    ) -> Result<Self::Secret, PrimitiveError> { ... }
}
Expand description

Reconstructs a secret from a collection of openings and a local share.

Required Associated Types§

Source

type Secret: Serialize + DeserializeOwned + Clone + PartialEq + Send + Sync + 'static

The type of the reconstructed value.

Source

type Opening: Serialize + DeserializeOwned + Clone + Send + Sync + 'static

The type that is sent to / received from other peers.

Required Methods§

Source

fn open_to( &self, peer_index: PeerIndex, ) -> Result<Self::Opening, PrimitiveError>

Open the share towards another peer.

Source

fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = Self::Opening>

Open the share towards all other peers. Returns an iterator with either one opening for each peer or a single opening for all peers.

Source

fn reconstruct( &self, openings: &[Self::Opening], ) -> Result<Self::Secret, PrimitiveError>

Reconstruct a secret from openings coming from all other parties.

Provided Methods§

Source

fn reconstruct_all<T: Borrow<Self>>( shares: &[T], ) -> Result<Self::Secret, PrimitiveError>

Reconstruct a secret from a collection of shares, by opening each share towards all other peers, reconstructing n secrets from the openings and checking that they are all equal.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Reconstructible<Opening: Clone>> Reconstructible for Arc<[T]>

Source§

type Opening = Arc<[<T as Reconstructible>::Opening]>

Source§

type Secret = Arc<[<T as Reconstructible>::Secret]>

Source§

fn open_to( &self, peer_index: PeerIndex, ) -> Result<Self::Opening, PrimitiveError>

Source§

fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = Self::Opening>

Source§

fn reconstruct( &self, openings: &[Self::Opening], ) -> Result<Self::Secret, PrimitiveError>

Source§

impl<T: Reconstructible<Opening: Clone>> Reconstructible for Vec<T>

Source§

type Opening = Vec<<T as Reconstructible>::Opening>

Source§

type Secret = Vec<<T as Reconstructible>::Secret>

Source§

fn open_to( &self, peer_index: PeerIndex, ) -> Result<Self::Opening, PrimitiveError>

Source§

fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = Self::Opening>

Source§

fn reconstruct( &self, openings: &[Self::Opening], ) -> Result<Self::Secret, PrimitiveError>

Source§

impl<T: Reconstructible, S: Reconstructible> Reconstructible for (T, S)

Source§

type Opening = (<T as Reconstructible>::Opening, <S as Reconstructible>::Opening)

Source§

type Secret = (<T as Reconstructible>::Secret, <S as Reconstructible>::Secret)

Source§

fn open_to( &self, peer_index: PeerIndex, ) -> Result<Self::Opening, PrimitiveError>

Source§

fn open_to_all_others(&self) -> impl ExactSizeIterator<Item = Self::Opening>

Source§

fn reconstruct( &self, openings: &[Self::Opening], ) -> Result<Self::Secret, PrimitiveError>

Implementors§