Struct crypto::voice::SenderKey
zaun_community_protocol::crypto::voice::SenderKey · Struct
pub struct SenderKey(…)An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped.
Methods
Section titled “Methods”generate
Section titled “generate”pub fn generate() -> Result<Self, VoiceError>A fresh base key from the OS CSPRNG.
Errors
Section titled “Errors”VoiceError::Rng when the CSPRNG fails.
from_bytes
Section titled “from_bytes”pub fn from_bytes(bytes: &[u8; 32]) -> SelfWraps raw bytes. Tests only; real keys come from Self::generate or Self::unwrap.
wrap_for
Section titled “wrap_for”pub fn wrap_for(&self, ctx: &WrapContext, recipient: &SignedKeyPackage) -> Result<WrappedKey, VoiceError>Wraps this key to recipient’s verified key package.
Errors
Section titled “Errors”VoiceError::Mismatch when the package is for another community or channel,
VoiceError::Rng, or VoiceError::Unwrap if HPKE fails.
unwrap
Section titled “unwrap”pub fn unwrap(identity: &VoiceIdentity, ctx: &WrapContext, own: &SignedKeyPackage, wrapped: &WrappedKey) -> Result<Self, VoiceError>Opens a key wrapped to own (this participant’s package) with identity.
The caller must already have checked the wrapped key against a verified
SignedSenderKeys (SignedSenderKeys::entry_for); super::GroupKeys does both.
Errors
Section titled “Errors”VoiceError::Unwrap when the key was not made for this package and context.
Trait implementations
Section titled “Trait implementations”Debug