Struct crypto::voice::GroupKeys
zaun_community_protocol::crypto::voice::GroupKeys · Struct
pub struct GroupKeys { … }A participant’s key state for one voice session.
Methods
Section titled “Methods”pub fn new(member_key: &SecretKey, community_id: CommunityId, channel_id: ChannelId, member_id: MemberId, min_suite: u8, created_at: u64) -> Result<Self, VoiceError>Starts a voice session: a fresh voice session id and X-Wing key pair, and the key
package signed by member_key.
Errors
Section titled “Errors”VoiceError::Rng or VoiceError::Signed.
voice_session
Section titled “voice_session”pub const fn voice_session(&self) -> VoiceSessionIdThis participant’s voice session.
key_package
Section titled “key_package”pub const fn key_package(&self) -> &SignedKeyPackageThis participant’s signed key package (send its SignedKeyPackage::to_wire).
needs_rekey
Section titled “needs_rekey”pub const fn needs_rekey(&self) -> boolWhether the peer set changed since the last Self::rekey.
pub fn peers(&self) -> impl Iterator<Item = (VoiceSessionId, MemberId)> + '_The voice sessions of the current peers.
add_peer
Section titled “add_peer”pub fn add_peer(&mut self, member_id: MemberId, member_key: &PublicKey, package_wire: &[u8]) -> Result<VoiceSessionId, VoiceError>Verifies and adds a peer’s key package. member_key is the roster’s key for
member_id. Re-adding the same package is a no-op.
Errors
Section titled “Errors”As KeyPackage::verify; VoiceError::Recipients beyond MAX_RECIPIENTS peers;
VoiceError::KidCollision when its KID tag equals another participant’s (the newer
participant rejoins with a new voice session); VoiceError::Mismatch for a different
package under a known session.
remove_peer
Section titled “remove_peer”pub fn remove_peer(&mut self, session: &VoiceSessionId) -> boolForgets a peer and its keys. Returns whether it was known.
pub fn rekey(&mut self, member_key: &SecretKey, created_at: u64) -> Result<Rekey, VoiceError>Makes the next epoch: a fresh base key wrapped to every current peer and the signed
sender-keys message. The new key seals only after Self::activate.
Errors
Section titled “Errors”VoiceError::Exhausted after 2^32 epochs; VoiceError::Rng; HPKE or signing
failures.
activate
Section titled “activate”pub fn activate(&mut self) -> boolSwitches sealing to the newest epoch. Returns whether there was one waiting.
pub fn seal(&mut self, metadata: &[u8], frame: &[u8]) -> Result<Vec<u8>, VoiceError>Seals one of this participant’s frames under the active epoch.
Errors
Section titled “Errors”VoiceError::NoSenderKey before the first activation; VoiceError::Exhausted.
accept_sender_keys
Section titled “accept_sender_keys”pub fn accept_sender_keys(&mut self, from: &VoiceSessionId, sender_keys_wire: &[u8], wrapped: &[u8]) -> Result<u32, VoiceError>Installs a peer’s epoch key: verifies the sender-keys message under the peer’s member
key, checks that wrapped is the key it signed for this participant, opens it, and
keeps the peer’s previous epoch for frames still in flight.
Errors
Section titled “Errors”VoiceError::UnknownPeer, verification errors, VoiceError::NotARecipient,
VoiceError::WrappedHash, VoiceError::StaleEpoch or VoiceError::Unwrap.
pub fn open(&mut self, metadata: &[u8], frame: &[u8]) -> Result<(VoiceSessionId, Vec<u8>), VoiceError>Opens a frame from whichever peer’s KID it carries.
Errors
Section titled “Errors”VoiceError::Header, VoiceError::UnknownKid, VoiceError::Replay or
VoiceError::Open.
open_from
Section titled “open_from”pub fn open_from(&mut self, from: &VoiceSessionId, metadata: &[u8], frame: &[u8]) -> Result<Vec<u8>, VoiceError>Opens a frame that the transport says came from from; another peer’s KID is refused.
Errors
Section titled “Errors”As Self::open, and VoiceError::UnknownPeer.
Trait implementations
Section titled “Trait implementations”Debug