pub struct PinLockSystem<'a> {
client: &'a Client,
}Expand description
Provides PIN-based unlock functionality. This includes enrolling into PIN-based unlock, unlocking using the PIN and handling necessary operations (PIN envelope refreshing when transitioning to after-first-unlock mode).
Fields§
§client: &'a ClientImplementations§
Source§impl PinLockSystem<'_>
impl PinLockSystem<'_>
fn key_store(&self) -> &KeyStore<KeySlotIds>
Sourcepub fn with_client(client: &Client) -> PinLockSystem<'_>
pub fn with_client(client: &Client) -> PinLockSystem<'_>
Creates a PIN lock system view for a client instance.
Sourceasync fn get_active_pin_envelope(&self) -> Option<PasswordProtectedKeyEnvelope>
async fn get_active_pin_envelope(&self) -> Option<PasswordProtectedKeyEnvelope>
Retrieves the currently active PIN envelope.
If both envelopes are present, the ephemeral envelope is preferred.
Sourcepub(crate) async fn unlock(&self, pin: &str) -> Result<(), UnlockError>
pub(crate) async fn unlock(&self, pin: &str) -> Result<(), UnlockError>
Attempts to unlock the user key using pin.
Returns UnlockError::NoPinSet if no PIN is configured,
UnlockError::PinWrong if pin is incorrect, and
UnlockError::InternalError for other failures.
Sourcepub(crate) async fn on_unlock(&self)
pub(crate) async fn on_unlock(&self)
Refreshes in-memory PIN unlock material after a successful non-PIN unlock.
This recreates the ephemeral PIN envelope from the encrypted PIN, when available.
Sourcepub async fn set_pin(
&self,
pin: String,
lock_type: PinLockType,
) -> Result<(), ()>
pub async fn set_pin( &self, pin: String, lock_type: PinLockType, ) -> Result<(), ()>
Sets the PIN and stores the generated envelope according to the lock type.
Sourcepub async fn get_pin_lock_type(&self) -> Option<PinLockType>
pub async fn get_pin_lock_type(&self) -> Option<PinLockType>
Returns the lock type for the currently configured PIN.
Sourcepub async fn get_pin_status(&self) -> PinUnlockStatus
pub async fn get_pin_status(&self) -> PinUnlockStatus
Returns the current PIN unlock status.
If a lock type is configured but no ephemeral envelope is currently present,
the status is PinUnlockStatus::NeedsUnlock.
Sourcepub async fn get_pin(&self) -> Option<String>
pub async fn get_pin(&self) -> Option<String>
Returns the configured PIN, if an encrypted PIN is available and decryptable.
Sourcepub async fn validate_pin(&self, pin: String) -> bool
pub async fn validate_pin(&self, pin: String) -> bool
Validates that the provided PIN can decrypt the stored PIN envelope.
Auto Trait Implementations§
impl<'a> Freeze for PinLockSystem<'a>
impl<'a> !RefUnwindSafe for PinLockSystem<'a>
impl<'a> Send for PinLockSystem<'a>
impl<'a> Sync for PinLockSystem<'a>
impl<'a> Unpin for PinLockSystem<'a>
impl<'a> UnsafeUnpin for PinLockSystem<'a>
impl<'a> !UnwindSafe for PinLockSystem<'a>
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
§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