pub struct Key { /* private fields */ }Expand description
Key used to store key and nonce
The key field used to store bytes that defined by
chacha20poly1305 key properties which is an alias of
GenericArray<u8, U32>
The nonce field used when encrypt and decrypt given message
which is an alias of GenericArray<u8, <A as AeadCore>::NonceSize>
taken from aead crate
Both of these properties grouped into this single object to simplify the API library
Implementations§
Source§impl Key
impl Key
pub fn new(key: KeyEncryption, nonce: KeyNonce) -> Self
pub fn get_key_bytes(&self) -> Result<[u8; 32], CommonError>
pub fn get_nonce_bytes(&self) -> Result<[u8; 24], CommonError>
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