pub struct Key(/* private fields */);Expand description
A crypto_auth key. Always exactly 32 bytes - Kupyna256Kmac’s fixed MAC/key length (see
the module doc).
Implementations§
Source§impl Key
impl Key
Sourcepub fn generate() -> Result<Self, RandomError>
pub fn generate() -> Result<Self, RandomError>
Generates a fresh key from the OS CSPRNG - libsodium’s crypto_auth_keygen equivalent.
§Errors
Returns crate::randombytes::RandomError if the OS CSPRNG fails.
pub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn as_bytes(&self) -> &[u8; 32]
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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