Struct SetupMessage

Source
pub struct SetupMessage<SK = NoSigningKey, VK = NoVerifyingKey, MS = NoSignature, KS = Keyshare, PK = ProjectivePoint> { /* private fields */ }
Expand description

A message used for setting up quorum changes in a multi-party computation protocol.

This struct encapsulates all necessary information for changing the quorum of participants, including old and new participant information, cryptographic keys, and protocol parameters.

§Type Parameters

  • SK - The type of signing key used for message signatures
  • VK - The type of verifying key used to verify message signatures
  • MS - The type of message signature
  • KS - The type of keyshare used in the protocol
  • PK - The type of public key used in the protocol

Implementations§

Source§

impl<SK, VK, MS, KS, PK> SetupMessage<SK, VK, MS, KS, PK>

Source

pub fn new( instance: InstanceId, this_party: usize, old_parties: &[usize], new_parties: &[(usize, u8)], new_t: usize, sk: SK, vk: Vec<VK>, public_key: PK, ) -> Self

Creates a new setup message for quorum changes.

§Arguments
  • instance - Instance identifier for the protocol
  • this_party - ID of the current party
  • old_parties - Indices of old participants
  • new_parties - Pairs of (index, rank) for new participants
  • new_t - New threshold value
  • sk - Signing key for the current party
  • vk - Vector of verifying keys for all participants
  • public_key - Public key for the protocol
§Panics

Panics if:

  • this_party is not less than the total number of parties
  • Any old party index is not less than the total number of parties
  • Any new party index is not less than the total number of parties
  • new_t is greater than the number of new parties
Source

pub fn with_ttl(self, ttl: Duration) -> Self

Sets a custom time-to-live duration for messages.

§Arguments
  • ttl - The new time-to-live duration
§Returns

The modified SetupMessage instance

Source

pub fn with_keyshare_opt(self, keyshare: Option<Arc<KS>>) -> Self

Sets an optional keyshare for the protocol.

§Arguments
  • keyshare - Optional reference to the keyshare
§Returns

The modified SetupMessage instance

Source

pub fn with_keyshare(self, keyshare: Arc<KS>) -> Self

Sets a keyshare for the protocol.

§Arguments
  • keyshare - Reference to the keyshare
§Returns

The modified SetupMessage instance

Trait Implementations§

Source§

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

Source§

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

Returns the signing key for the current participant.

Source§

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

Returns the verifying key for a specific participant.

§Arguments
  • index - The index of the participant
§Returns

A reference to the verifying key

Source§

fn instance_id(&self) -> &InstanceId

Returns the instance identifier for the protocol.

Source§

fn message_ttl(&self) -> Duration

Returns the time-to-live duration for messages.

Source§

fn participant_index(&self) -> usize

Returns the index of the current participant.

Source§

fn total_participants(&self) -> usize

Returns the total number of participants in the protocol.

Source§

type MessageSignature = MS

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

type MessageSigner = SK

Type to sign broadcast messages, some kind of SecretKey.
Source§

type MessageVerifier = VK

Type to verify signed message, a verifying key. AsRef<u8> is used to get external representation of the key to derive message ID.
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.
Source§

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

Source§

fn old_keyshare(&self) -> Option<&KS>

Returns a reference to the old keyshare if it exists.

Source§

fn new_threshold(&self) -> u8

Returns the new threshold value for the protocol.

Source§

fn new_participant_rank(&self, party_id: u8) -> u8

Returns the rank of a specific participant in the new quorum.

§Arguments
  • party_id - The ID of the participant
§Returns

The rank of the participant

Source§

fn expected_public_key(&self) -> &PK

Returns the expected public key for the protocol.

Source§

fn old_party_indices(&self) -> &[usize]

Returns the indices of the old participants.

Source§

fn new_party_indices(&self) -> &[usize]

Returns the indices of the new participants.

Source§

fn derive_key_id(&self, public_key: &[u8]) -> [u8; 32]

Derives a key identifier from a public key.

This is a trivial implementation that takes the first 32 bytes of the public key.

§Arguments
  • public_key - The public key to derive the identifier from
§Returns

A 32-byte key identifier

Source§

fn new_party_id(&self, index: usize) -> Option<u8>

return new_party_id by party_index
Source§

fn keyshare_extra(&self) -> &[u8]

Additional data to incorpatate into resulting Keyshare.

Auto Trait Implementations§

§

impl<SK, VK, MS, KS, PK> Freeze for SetupMessage<SK, VK, MS, KS, PK>
where SK: Freeze, PK: Freeze,

§

impl<SK, VK, MS, KS, PK> RefUnwindSafe for SetupMessage<SK, VK, MS, KS, PK>

§

impl<SK, VK, MS, KS, PK> Send for SetupMessage<SK, VK, MS, KS, PK>
where SK: Send, PK: Send, MS: Send, KS: Sync + Send, VK: Send,

§

impl<SK, VK, MS, KS, PK> Sync for SetupMessage<SK, VK, MS, KS, PK>
where SK: Sync, PK: Sync, MS: Sync, KS: Sync + Send, VK: Sync,

§

impl<SK, VK, MS, KS, PK> Unpin for SetupMessage<SK, VK, MS, KS, PK>
where SK: Unpin, PK: Unpin, MS: Unpin, VK: Unpin,

§

impl<SK, VK, MS, KS, PK> UnwindSafe for SetupMessage<SK, VK, MS, KS, PK>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more