pub struct Share { /* private fields */ }Expand description
A party’s share of a distributed secret.
scheme ties the share to the scheme that produced it (e.g.
"FROST-ed25519"). bytes is the scheme-specific encoding of the
share; the framework never inspects or reinterprets it.
The secret bytes field is zeroized on drop.
Implementations§
pub fn new(scheme: impl Into<String>, bytes: impl Into<Vec<u8>>) -> Self
pub fn scheme(&self) -> &str
pub fn bytes(&self) -> &[u8] ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn assert_scheme(&self, expected: &str) -> Result<()>
pub fn assert_scheme(&self, expected: &str) -> Result<()>
Reject a share whose scheme doesn’t match the session’s scheme.
Used by crate::session::Session::create when a pre-existing
share is supplied as input.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serialize into the (scheme_len: u32 BE | scheme_utf8 | bytes)
framing used by Share::from_bytes. The scheme name is the
canonical identifier; bytes is the scheme-specific payload.
This is the only (de)serialization the framework needs — share
persistence goes through [crate::store] using this encoding.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
pub fn from_bytes(data: &[u8]) -> Result<Self>
Parse the framing produced by Share::to_bytes.