Struct lock_keeper::crypto::arbitrary_secret::Secret
source · pub struct Secret(pub(super) Secret);
Expand description
An arbitrary secret.
This is generated by the client and should never be revealed to the server.
Tuple Fields§
§0: Secret
Implementations§
source§impl Secret
impl Secret
sourcepub fn create_and_encrypt(
rng: &mut (impl CryptoRng + RngCore),
storage_key: &StorageKey,
user_id: &UserId,
key_id: &KeyId
) -> Result<(Self, Encrypted<Self>), LockKeeperError>
pub fn create_and_encrypt( rng: &mut (impl CryptoRng + RngCore), storage_key: &StorageKey, user_id: &UserId, key_id: &KeyId ) -> Result<(Self, Encrypted<Self>), LockKeeperError>
Create and encrypt a new secret. This is part of the generate a new secret flow.
This must be run by the client. It takes the following steps:
- Generates a new secret
- Encrypt it under the
StorageKey
, using an AEAD scheme
sourcepub fn import_and_encrypt(
secret_material: &[u8],
rng: &mut (impl CryptoRng + RngCore),
storage_key: &StorageKey,
user_id: &UserId,
key_id: &KeyId
) -> Result<(Self, Encrypted<Self>), LockKeeperError>
pub fn import_and_encrypt( secret_material: &[u8], rng: &mut (impl CryptoRng + RngCore), storage_key: &StorageKey, user_id: &UserId, key_id: &KeyId ) -> Result<(Self, Encrypted<Self>), LockKeeperError>
Create a Secret
from an imported key and encrypt it for
storage at a server, under a key known only to the client.
This is part of the local import with remote backup flow and must be run by the client.
sourcefn context(&self) -> &AssociatedData
fn context(&self) -> &AssociatedData
Retrieve the context for the secret.
This is only used in testing right now, but it would be fine to make it public.
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 Display for Secret
impl Display for Secret
Allow secret to be displayed for demo purposes. Note we do not expose the internal type representation of the secret.
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