pub struct SerializablePinState {
pub pin_hash: Option<Vec<u8>>,
pub retries: u8,
pub uv_retries: u8,
pub min_pin_length: u8,
pub version: u64,
pub force_pin_change: bool,
pub credential_wrapping_generation: u64,
pub locked_until: Option<u64>,
}Expand description
Serializable PIN state for storage (legacy, single-file format)
This struct represents the PIN state in a format suitable for serialization to JSON or other formats. It contains the PIN hash as raw bytes (if set), retry counters, and configuration.
Fields§
§pin_hash: Option<Vec<u8>>PIN hash as raw bytes (None if no PIN set)
retries: u8Remaining PIN retry attempts (0-8)
uv_retries: u8Remaining UV retry attempts
The serde default of 3 maintains backward compatibility with existing stored state.
The actual maximum is enforced by the configured pin.max_uv_retries value.
min_pin_length: u8Minimum PIN length (4-63)
version: u64State version for rollback detection
force_pin_change: boolForce PIN change flag
credential_wrapping_generation: u64Credential wrapping generation, incremented on reset to invalidate wrapped credentials
locked_until: Option<u64>Auto-lock timestamp in milliseconds since Unix epoch (None = not locked)
Implementations§
Source§impl SerializablePinState
impl SerializablePinState
Sourcepub fn to_json_bytes(&self) -> Result<Vec<u8>, StatusCode>
pub fn to_json_bytes(&self) -> Result<Vec<u8>, StatusCode>
Convert to JSON bytes
Sourcepub fn from_json_bytes(bytes: &[u8]) -> Result<Self, StatusCode>
pub fn from_json_bytes(bytes: &[u8]) -> Result<Self, StatusCode>
Convert from JSON bytes
Sourcepub fn from_parts(
config: &SerializablePinConfig,
retries: &SerializablePinRetries,
) -> Self
pub fn from_parts( config: &SerializablePinConfig, retries: &SerializablePinRetries, ) -> Self
Create from config and retries parts
Trait Implementations§
Source§impl Clone for SerializablePinState
impl Clone for SerializablePinState
Source§fn clone(&self) -> SerializablePinState
fn clone(&self) -> SerializablePinState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more