pub struct SenderKey(/* private fields */);Expand description
An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped.
Implementations§
Source§impl SenderKey
impl SenderKey
Sourcepub fn generate() -> Result<Self, VoiceError>
pub fn generate() -> Result<Self, VoiceError>
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Self
pub fn from_bytes(bytes: &[u8; 32]) -> Self
Wraps raw bytes. Tests only; real keys come from Self::generate or Self::unwrap.
Sourcepub fn wrap_for(
&self,
ctx: &WrapContext,
recipient: &SignedKeyPackage,
) -> Result<WrappedKey, VoiceError>
pub fn wrap_for( &self, ctx: &WrapContext, recipient: &SignedKeyPackage, ) -> Result<WrappedKey, VoiceError>
Wraps this key to recipient’s verified key package.
§Errors
VoiceError::Mismatch when the package is for another community or channel,
VoiceError::Rng, or VoiceError::Unwrap if HPKE fails.
Sourcepub fn unwrap(
identity: &VoiceIdentity,
ctx: &WrapContext,
own: &SignedKeyPackage,
wrapped: &WrappedKey,
) -> Result<Self, VoiceError>
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
VoiceError::Unwrap when the key was not made for this package and context.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SenderKey
impl RefUnwindSafe for SenderKey
impl Send for SenderKey
impl Sync for SenderKey
impl Unpin for SenderKey
impl UnsafeUnpin for SenderKey
impl UnwindSafe for SenderKey
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