pub enum ProtectionTier {
Hardware(HardwareKind),
Software(DegradeReason),
}Expand description
What actually protects a keystore’s wrapping key, reported truthfully.
Total by construction: there is no third “unknown” state and no Option
wrapper, so a caller can always ask is_hardware_bound
and get a real answer.
Deliberately not #[non_exhaustive], unlike the enums it is built from.
The point of this type is that exactly two outcomes exist and a consumer must
handle both; allowing a wildcard arm would let the software case be swept into
a catch-all, which is precisely the mistake the type exists to prevent. New
nuance belongs in DegradeReason or HardwareKind, both of which ARE
non-exhaustive.
Variants§
Hardware(HardwareKind)
The wrapping key lives in the named hardware component and is non-exportable: the sealed blob cannot be opened on another machine.
Software(DegradeReason)
The wrapping key is the passphrase-derived software envelope
(AES-256-GCM + Argon2id) — the floor, never a bare file. The
DegradeReason says why hardware is not in use.
Implementations§
Source§impl ProtectionTier
impl ProtectionTier
Sourcepub const fn is_hardware_bound(&self) -> bool
pub const fn is_hardware_bound(&self) -> bool
Whether the key material is genuinely bound to hardware.
The one question a UI must ask before claiming hardware protection.
Sourcepub const fn hardware_kind(&self) -> Option<HardwareKind>
pub const fn hardware_kind(&self) -> Option<HardwareKind>
The hardware component in use, or None when software-wrapped.
Sourcepub const fn degrade_reason(&self) -> Option<&DegradeReason>
pub const fn degrade_reason(&self) -> Option<&DegradeReason>
Why this keystore is software-wrapped, or None when hardware-bound.
Trait Implementations§
Source§impl Clone for ProtectionTier
impl Clone for ProtectionTier
Source§fn clone(&self) -> ProtectionTier
fn clone(&self) -> ProtectionTier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more