pub struct UnlockClient {
pub(crate) client: Client,
}Expand description
Client for minting session keys and unlocking the vault with one.
Fields§
§client: ClientImplementations§
Source§impl UnlockClient
impl UnlockClient
pub(crate) fn new(client: Client) -> Self
Sourcepub async fn generate_session_key(&self) -> Result<SessionKey, UnlockError>
pub async fn generate_session_key(&self) -> Result<SessionKey, UnlockError>
Mint a new session key and persist the user key wrapped by it.
Requires the client to be unlocked (the user key must be present in the
key store). The returned SessionKey should be stored outside the SDK
by the caller and provided back to UnlockClient::unlock on the next
rehydrated client.
Sourcepub async fn unlock(&self, unlock: UnlockMethod) -> Result<(), UnlockError>
pub async fn unlock(&self, unlock: UnlockMethod) -> Result<(), UnlockError>
Unlock a rehydrated client using the supplied unlock factor.
Reads [SESSION_PROTECTED_USER_KEY] and [ACCOUNT_CRYPTO_STATE] from
the state registry, unwraps the user key, initializes the user’s crypto
state, and restores any persisted organization keys.
Sourcepub async fn invalidate_session_key(&self) -> Result<(), SettingsError>
pub async fn invalidate_session_key(&self) -> Result<(), SettingsError>
Invalidate the persisted session key, locking the vault for future invocations.
Removes [SESSION_PROTECTED_USER_KEY] from the database. Distinct from
lock() on long-lived clients (mobile, desktop), which clears keys from memory: the
CLI process exits between invocations, so locking must delete the persisted session
key rather than mutate in-memory state.
Trait Implementations§
Source§impl Clone for UnlockClient
impl Clone for UnlockClient
Source§fn clone(&self) -> UnlockClient
fn clone(&self) -> UnlockClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for UnlockClient
impl !RefUnwindSafe for UnlockClient
impl Send for UnlockClient
impl Sync for UnlockClient
impl Unpin for UnlockClient
impl UnsafeUnpin for UnlockClient
impl !UnwindSafe for UnlockClient
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more