pub enum PresenceMode {
Cached,
Strict,
None,
}Expand description
User-presence prompt cadence for sign operations.
Orthogonal to AccessPolicy: AccessPolicy says what counts as
authentication (e.g. fingerprint vs. passcode); PresenceMode says how
often the user must reproduce it.
On macOS the choice is implemented by passing (or omitting) a long-lived
LAContext to CryptoKit’s SecureEnclave.P256.Signing.PrivateKey.
Other platforms do not have an analogous cached-context concept and treat all variants identically:
- Windows TPM (CNG): The hardware enforces
NCRYPT_UI_POLICYper sign, so every signature triggers a fresh Windows Hello prompt. - Linux TPM and software / keyring backends: No gate at all.
AccessPolicyis stored in metadata but is not consulted at sign or decrypt time, so allPresenceModevariants behave the same asPresenceMode::None. See the “Linux TPM backend” section ofTHREAT_MODEL.md.
Variants§
Cached
User-presence prompt batched within a TTL window. The first sign
after the cache is cold prompts; subsequent signs within the cache
TTL reuse the same LAContext and are silent. This is the default
for any new key created with user-presence enabled.
Strict
User-presence prompt on every sign. The agent does not pass a
long-lived LAContext, so the SEP enforces a fresh authentication
per signature.
None
No user-presence prompt. The key has AccessPolicy::None (or its
platform equivalent) and signs silently regardless of cache state.
Implementations§
Source§impl PresenceMode
impl PresenceMode
Sourcepub fn migration_default(policy: AccessPolicy) -> Self
pub fn migration_default(policy: AccessPolicy) -> Self
Migration default for keys whose .meta predates presence_mode:
historically, a key with any access policy other than None
effectively had Strict semantics (one prompt per sign), and a
key with None was silent. Use this when reading a legacy
.meta file with no presence_mode field.
Trait Implementations§
Source§impl Clone for PresenceMode
impl Clone for PresenceMode
Source§fn clone(&self) -> PresenceMode
fn clone(&self) -> PresenceMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PresenceMode
Source§impl Debug for PresenceMode
impl Debug for PresenceMode
Source§impl Default for PresenceMode
impl Default for PresenceMode
Source§fn default() -> PresenceMode
fn default() -> PresenceMode
Source§impl<'de> Deserialize<'de> for PresenceMode
impl<'de> Deserialize<'de> for PresenceMode
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>,
impl Eq for PresenceMode
Source§impl PartialEq for PresenceMode
impl PartialEq for PresenceMode
Source§fn eq(&self, other: &PresenceMode) -> bool
fn eq(&self, other: &PresenceMode) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PresenceMode
impl Serialize for PresenceMode
impl StructuralPartialEq for PresenceMode
Auto Trait Implementations§
impl Freeze for PresenceMode
impl RefUnwindSafe for PresenceMode
impl Send for PresenceMode
impl Sync for PresenceMode
impl Unpin for PresenceMode
impl UnsafeUnpin for PresenceMode
impl UnwindSafe for PresenceMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.