pub struct SecretKey<const N: usize>(/* private fields */);
Expand description
Represents a secret key used with transport encryption and authentication
Implementations§
Source§impl<const N: usize> SecretKey<N>
impl<const N: usize> SecretKey<N>
Sourcepub fn unprotected_as_bytes(&self) -> &[u8] ⓘ
pub fn unprotected_as_bytes(&self) -> &[u8] ⓘ
Returns byte slice to the key’s bytes
Sourcepub fn unprotected_as_byte_array(&self) -> &[u8; N]
pub fn unprotected_as_byte_array(&self) -> &[u8; N]
Returns reference to array of key’s bytes
Sourcepub fn unprotected_into_byte_array(self) -> [u8; N]
pub fn unprotected_into_byte_array(self) -> [u8; N]
Consumes the secret key and returns the array of key’s bytes
Sourcepub fn into_heap_secret_key(self) -> HeapSecretKey
pub fn into_heap_secret_key(self) -> HeapSecretKey
Consumes the secret key and returns the key’s bytes as a HeapSecretKey
Sourcepub fn generate() -> Result<Self, SecretKeyError>
pub fn generate() -> Result<Self, SecretKeyError>
Generates a new secret key, returning success if key created or
failing if the desired key length is not between 1 and isize::MAX
Sourcepub fn from_slice(slice: &[u8]) -> Result<Self, SecretKeyError>
pub fn from_slice(slice: &[u8]) -> Result<Self, SecretKeyError>
Creates the key from the given byte slice, returning success if key created or failing if the byte slice does not match the desired key length
Trait Implementations§
impl<const N: usize> Eq for SecretKey<N>
impl<const N: usize> StructuralPartialEq for SecretKey<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for SecretKey<N>
impl<const N: usize> RefUnwindSafe for SecretKey<N>
impl<const N: usize> Send for SecretKey<N>
impl<const N: usize> Sync for SecretKey<N>
impl<const N: usize> Unpin for SecretKey<N>
impl<const N: usize> UnwindSafe for SecretKey<N>
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