pub struct PinState {
pub pin_hash: Option<SecPinHash>,
pub retries: u8,
pub uv_retries: u8,
pub min_pin_length: u8,
pub version: u64,
pub force_pin_change: bool,
}Expand description
Persistent PIN state for secure storage
Fields§
§pin_hash: Option<SecPinHash>SHA-256 hash of the PIN (None if no PIN set)
retries: u8Remaining PIN retry attempts (0-8)
uv_retries: u8Remaining UV retry attempts (0-3)
This is persisted to prevent brute-force bypass via device restart. Uses serde default for backwards compatibility with existing stored state.
min_pin_length: u8Minimum PIN length in Unicode code points (4-63)
version: u64State version for rollback detection
force_pin_change: boolForce PIN change flag
Implementations§
Source§impl PinState
impl PinState
Sourcepub fn is_pin_set(&self) -> bool
pub fn is_pin_set(&self) -> bool
Check if a PIN has been set
Sourcepub fn is_blocked(&self) -> bool
pub fn is_blocked(&self) -> bool
Check if PIN is blocked (no retries remaining)
Sourcepub fn is_uv_blocked(&self) -> bool
pub fn is_uv_blocked(&self) -> bool
Check if UV is blocked (no UV retries remaining)
Sourcepub fn increment_version(&mut self)
pub fn increment_version(&mut self)
Increment version for state change
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PinState
impl<'de> Deserialize<'de> for PinState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PinState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PinState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PinState
impl Serialize for PinState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for PinState
impl RefUnwindSafe for PinState
impl Send for PinState
impl Sync for PinState
impl Unpin for PinState
impl UnwindSafe for PinState
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