pub struct AuthHandle { /* private fields */ }Expand description
Handle to the platform authentication subsystem.
Obtained from create_auth().
Implementations§
Source§impl AuthHandle
impl AuthHandle
Sourcepub fn capabilities(&self) -> AuthCapabilities
pub fn capabilities(&self) -> AuthCapabilities
Return the platform’s authentication capabilities. Equivalent to
platform_auth_capabilities().
Sourcepub fn request_presence(&self, reason: &str) -> Result<()>
pub fn request_presence(&self, reason: &str) -> Result<()>
Request user-presence verification. Returns Ok(()) if the user
authenticated successfully.
Platform behavior:
- macOS: Fires the Touch ID / passcode dialog synchronously via
LAContext.evaluatePolicy(.deviceOwnerAuthentication). Blocks until the user responds. ReturnsErr(PresenceNotAvailable)if no biometric or passcode is enrolled, orErr(UserCancelled)if the user dismisses the prompt. - Windows: Calls
UserConsentVerifier.RequestVerificationAsync(reason). Falls back to a password gate when Windows Hello is not enrolled. Gracefully degrades toOk(())on headless sessions where neither Hello nor a verifiable password is available (credentials remain TPM-encrypted regardless). - Linux / other: Always returns
Err(PresenceNotAvailable).
Sourcepub fn evict_presence_cache(&self)
pub fn evict_presence_cache(&self)
Evict any cached presence token, forcing re-authentication on the next signing or decryption operation that uses a cached presence mode.
Platform behavior:
- macOS: Clears all cached
LAContexthandles from the global registry. The nextsign_with_presence(Cached, ...)call will fire a fresh Touch ID prompt. - Windows: Clears all Windows Hello verifications cached in this
AuthHandle. The sign/decrypt paths manage their ownHelloGatestate and are unaffected. - Linux / other: No-op.
Sourcepub fn backend_kind(&self) -> BackendKind
pub fn backend_kind(&self) -> BackendKind
Which hardware security backend this handle targets.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthHandle
impl RefUnwindSafe for AuthHandle
impl Send for AuthHandle
impl Sync for AuthHandle
impl Unpin for AuthHandle
impl UnsafeUnpin for AuthHandle
impl UnwindSafe for AuthHandle
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