Skip to content

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.

pub fn generate() -> Result<Self, VoiceError>

A fresh base key from the OS CSPRNG.

VoiceError::Rng when the CSPRNG fails.

pub fn from_bytes(bytes: &[u8; 32]) -> Self

Wraps raw bytes. Tests only; real keys come from Self::generate or Self::unwrap.

pub fn wrap_for(&self, ctx: &WrapContext, recipient: &SignedKeyPackage) -> Result<WrappedKey, VoiceError>

Wraps this key to recipient’s verified key package.

VoiceError::Mismatch when the package is for another community or channel, VoiceError::Rng, or VoiceError::Unwrap if HPKE fails.

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.

VoiceError::Unwrap when the key was not made for this package and context.

Debug

Full rustdoc page