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 moreSource§impl Debug for ProtectionTier
impl Debug for ProtectionTier
Source§impl Display for ProtectionTier
impl Display for ProtectionTier
impl Eq for ProtectionTier
Source§impl PartialEq for ProtectionTier
impl PartialEq for ProtectionTier
impl StructuralPartialEq for ProtectionTier
Auto Trait Implementations§
impl Freeze for ProtectionTier
impl RefUnwindSafe for ProtectionTier
impl Send for ProtectionTier
impl Sync for ProtectionTier
impl Unpin for ProtectionTier
impl UnsafeUnpin for ProtectionTier
impl UnwindSafe for ProtectionTier
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,
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