Struct lock_keeper::crypto::generic::Secret
source · pub(super) struct Secret {
material: Vec<u8>,
context: AssociatedData,
}
Expand description
A generic secret.
This type isn’t public – it holds generic secret material and associated data, but does not enforce any properties on the key material.
Fields§
§material: Vec<u8>
The actual bytes of secret material.
context: AssociatedData
Additional context about the secret.
Implementations§
source§impl Secret
impl Secret
sourcepub(super) fn generate(
rng: &mut (impl CryptoRng + RngCore),
len: usize,
context: AssociatedData
) -> Self
pub(super) fn generate( rng: &mut (impl CryptoRng + RngCore), len: usize, context: AssociatedData ) -> Self
Generate a new secret of length len
(in bytes).
sourcepub(super) fn from_parts(
secret_material: Vec<u8>,
context: AssociatedData
) -> Self
pub(super) fn from_parts( secret_material: Vec<u8>, context: AssociatedData ) -> Self
Create a new secret from its constituent parts. This is unchecked; use with care.
sourcepub(super) fn context(&self) -> &AssociatedData
pub(super) fn context(&self) -> &AssociatedData
Retrieve the context for this secret.
This is currently only used in testing, but it is fine to make it publicly accessible if necessary.
sourcepub(super) fn borrow_material(&self) -> &[u8] ⓘ
pub(super) fn borrow_material(&self) -> &[u8] ⓘ
Retrieve key material.
Return a reference to the underlying bytes of the secret. This should only be used to print the secret.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Secret
impl<'de> Deserialize<'de> for Secret
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Secret
impl PartialEq for Secret
impl Eq for Secret
impl StructuralPartialEq for Secret
Auto Trait Implementations§
impl Freeze for Secret
impl RefUnwindSafe for Secret
impl Send for Secret
impl Sync for Secret
impl Unpin for Secret
impl UnwindSafe for Secret
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
source§impl<T> ConvertMessage for Twhere
T: for<'a> Deserialize<'a> + Serialize,
impl<T> ConvertMessage for Twhere
T: for<'a> Deserialize<'a> + Serialize,
fn from_message(value: Message) -> Result<Self, LockKeeperError>
fn to_message(self) -> Result<Message, LockKeeperError>
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request