Trait ProtocolParticipant

Source
pub trait ProtocolParticipant {
    type MessageSignature: SignatureEncoding;
    type MessageSigner: Signer<Self::MessageSignature>;
    type MessageVerifier: Verifier<Self::MessageSignature> + AsRef<[u8]>;

    // Required methods
    fn total_participants(&self) -> usize;
    fn verifier(&self, index: usize) -> &Self::MessageVerifier;
    fn signer(&self) -> &Self::MessageSigner;
    fn participant_index(&self) -> usize;
    fn instance_id(&self) -> &InstanceId;
    fn message_ttl(&self) -> Duration;

    // Provided methods
    fn participant_verifier(&self) -> &Self::MessageVerifier { ... }
    fn all_other_parties(&self) -> AllOtherParties  { ... }
    fn msg_id(&self, receiver: Option<usize>, tag: MessageTag) -> MsgId { ... }
    fn msg_id_from(
        &self,
        sender: usize,
        receiver: Option<usize>,
        tag: MessageTag,
    ) -> MsgId { ... }
}
Expand description

Type that provides a protocol participant details.

Required Associated Types§

Source

type MessageSignature: SignatureEncoding

Type of a signature, added at end of all broadcast messages passed between participants.

Source

type MessageSigner: Signer<Self::MessageSignature>

Type to sign broadcast messages, some kind of SecretKey.

Source

type MessageVerifier: Verifier<Self::MessageSignature> + AsRef<[u8]>

Type to verify signed message, a verifying key. AsRef<u8> is used to get external representation of the key to derive message ID.

Required Methods§

Source

fn total_participants(&self) -> usize

Return total number of participants of a distributed protocol.

Source

fn verifier(&self, index: usize) -> &Self::MessageVerifier

Return a verifying key for a messages from a participant with given index.

Source

fn signer(&self) -> &Self::MessageSigner

A signer to sign messages from the participant.

Source

fn participant_index(&self) -> usize

Return an index of the participant in a protocol. This is a value in range 0..self.total_participants()

Source

fn instance_id(&self) -> &InstanceId

Each execution of a distributed protocol requires a unique instance id to derive all IDs of messages.

Source

fn message_ttl(&self) -> Duration

Return message Time To Live.

Provided Methods§

Source

fn participant_verifier(&self) -> &Self::MessageVerifier

Return reference to participant’s own verifier

Source

fn all_other_parties(&self) -> AllOtherParties

Return iterator of all participant’s indexes except own one.

Source

fn msg_id(&self, receiver: Option<usize>, tag: MessageTag) -> MsgId

Generate ID of a message from this party to some other (or broadcast) if passed receiver is None.

Source

fn msg_id_from( &self, sender: usize, receiver: Option<usize>, tag: MessageTag, ) -> MsgId

Generate ID of a message from given sender to a given receiver. Receiver is designed by its index and is None for a broadcase message.

Implementations on Foreign Types§

Source§

impl<M: ProtocolParticipant> ProtocolParticipant for &M

Implementors§

Source§

impl<SK, VK, MS> ProtocolParticipant for KeyExportReceiver<SK, VK, MS>
where SK: Signer<MS>, MS: SignatureEncoding, VK: AsRef<[u8]> + Verifier<MS>,

Source§

impl<SK, VK, MS> ProtocolParticipant for dkls23::setup::keygen::SetupMessage<SK, VK, MS>
where SK: Signer<MS>, MS: SignatureEncoding, VK: AsRef<[u8]> + Verifier<MS>,

Source§

impl<SK, VK, MS, KS> ProtocolParticipant for KeyExporter<SK, VK, MS, KS>
where SK: Signer<MS>, MS: SignatureEncoding, VK: AsRef<[u8]> + Verifier<MS>,

Source§

impl<SK, VK, MS, KS> ProtocolParticipant for dkls23::setup::sign::SetupMessage<SK, VK, MS, KS>
where SK: Signer<MS>, MS: SignatureEncoding, VK: AsRef<[u8]> + Verifier<MS>,

Source§

impl<SK, VK, MS, KS, PK> ProtocolParticipant for dkls23::setup::quorum_change::SetupMessage<SK, VK, MS, KS, PK>
where SK: Signer<MS>, MS: SignatureEncoding, VK: AsRef<[u8]> + Verifier<MS>,

Source§

impl<SK, VK, MS, PS> ProtocolParticipant for dkls23::setup::finish::SetupMessage<SK, VK, MS, PS>
where SK: Signer<MS>, MS: SignatureEncoding, VK: AsRef<[u8]> + Verifier<MS>,