pub enum Protection {
WhenUnlocked,
AfterFirstUnlock,
UserPresence,
}Expand description
When an item may be read.
Variants§
WhenUnlocked
While the device is unlocked, which is whenever the app’s UI is on screen. The default, and right for a session token. Apple keeps the item unreadable while the device is locked; HarmonyOS likewise (the ECE storage level); the other platforms keep it readable whenever the app runs, since their keystores unlock with the first sign-in.
AfterFirstUnlock
From the first unlock after boot until the next reboot, locked screen included. For work the
app does in the background (a sync, a notification handler) that needs the secret while the
screen is locked. Apple and HarmonyOS (the CE storage level) distinguish this from
WhenUnlocked; the other platforms treat the two alike.
UserPresence
Only after the device verifies the person, every time: a biometric or the device credential
in the OS’s own dialog (get_async). Writing needs no dialog. Where the OS can bind the
item to the check it does (Apple, Android, HarmonyOS: the key that decrypts the item is
usable only after the check), and where it cannot (Windows) the check gates the read and
protection_support says Emulated. The device must have a passcode, PIN or password;
without one set fails with KeychainError::PasscodeNotSet. Not available on Linux.
Trait Implementations§
Source§impl Clone for Protection
impl Clone for Protection
Source§fn clone(&self) -> Protection
fn clone(&self) -> Protection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more