Struct distant_net::SecretKey
source · [−]pub struct SecretKey<const N: usize>(_);
Expand description
Represents a secret key used with transport encryption and authentication
Implementations
sourceimpl<const N: usize> SecretKey<N>
impl<const N: usize> SecretKey<N>
sourcepub fn unprotected_as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn unprotected_as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [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 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
sourceimpl From<SecretKey<32>> for XChaCha20Poly1305Codec
impl From<SecretKey<32>> for XChaCha20Poly1305Codec
sourcefn from(secret_key: SecretKey32) -> Self
fn from(secret_key: SecretKey32) -> Self
Create a new XChaCha20Poly1305 codec with a 32-byte key
sourceimpl<const N: usize> PartialEq<SecretKey<N>> for SecretKey<N>
impl<const N: usize> PartialEq<SecretKey<N>> for SecretKey<N>
impl<const N: usize> Eq for SecretKey<N>
impl<const N: usize> StructuralEq for SecretKey<N>
impl<const N: usize> StructuralPartialEq for SecretKey<N>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more