pub struct ShareEnvelope {
pub version: u8,
pub scheme: String,
pub quorum_id: String,
pub party_idx: u32,
pub threshold: u32,
pub party_count: u32,
pub share_data: Vec<u8>,
pub integrity_tag: [u8; 32],
}Expand description
A versioned, integrity-protected threshold share envelope.
Fields§
§version: u8Envelope format version (currently 1).
scheme: StringThreshold scheme (e.g., “CMP20”, “FROST-P256”, “GG18”).
quorum_id: StringQuorum identifier this share belongs to.
party_idx: u32Party index (1-based, per DKG convention).
threshold: u32Threshold T.
party_count: u32Total party count N.
Scheme-specific share bytes (opaque to the envelope).
integrity_tag: [u8; 32]HMAC-SHA256 of all the above fields (keyed with the master key).
Implementations§
Sourcepub fn wrap(
scheme: &str,
quorum_id: &str,
party_idx: u32,
threshold: u32,
party_count: u32,
share_data: Vec<u8>,
integrity_key: &[u8],
) -> Result<Self, EnvelopeError>
pub fn wrap( scheme: &str, quorum_id: &str, party_idx: u32, threshold: u32, party_count: u32, share_data: Vec<u8>, integrity_key: &[u8], ) -> Result<Self, EnvelopeError>
Wrap scheme-specific share bytes into a versioned envelope.
Sourcepub fn verify(&self, integrity_key: &[u8]) -> Result<(), EnvelopeError>
pub fn verify(&self, integrity_key: &[u8]) -> Result<(), EnvelopeError>
Verify the integrity tag matches the envelope contents. Uses constant-time comparison to prevent timing side-channels.
Sourcepub fn unwrap(&self, integrity_key: &[u8]) -> Result<Vec<u8>, EnvelopeError>
pub fn unwrap(&self, integrity_key: &[u8]) -> Result<Vec<u8>, EnvelopeError>
Extract the share data (after verifying integrity).
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, EnvelopeError>
pub fn from_bytes(data: &[u8]) -> Result<Self, EnvelopeError>
Deserialize from JSON bytes.
Trait Implementations§
Source§fn clone(&self) -> ShareEnvelope
fn clone(&self) -> ShareEnvelope
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more