Skip to main content

WebauthnCredential

Struct WebauthnCredential 

Source
pub struct WebauthnCredential {
    pub credential_id: String,
    pub public_key_cose: Vec<u8>,
    pub sign_count: u32,
    pub device_name: String,
    pub registered_at: i64,
    pub last_used_at: i64,
    pub attestation_format: String,
    pub user_verified: bool,
    pub backup_eligible: bool,
    pub backup_state: bool,
}
Expand description

A registered WebAuthn credential.

The integrator persists one record per credential. WebauthnCredential::sign_count is security-relevant state: after every successful crate::verify_authentication, the caller must atomically persist AuthenticationResult::new_sign_count (monotonic counter used for authenticator-clone detection).

§Security note

public_key_cose is parsed and signature-checked on every authentication, but the bytes stored at registration time should be treated as trusted only because they were validated by crate::verify_registration before persisting. Never accept a credential record whose provenance you cannot establish.

Fields§

§credential_id: String

Base64url-encoded credential ID.

§public_key_cose: Vec<u8>

COSE public key bytes (CBOR-encoded).

§sign_count: u32

Counter to prevent replay/clone attacks. Persist the updated value returned by crate::verify_authentication after each login.

§device_name: String

Human-readable device name (e.g. “YubiKey 5 NFC”).

§registered_at: i64

Registration timestamp (Unix seconds).

§last_used_at: i64

Last authentication timestamp (Unix seconds).

§attestation_format: String

Attestation format (e.g. “none”, “packed”, “fido-u2f”, “android-key”).

Raw informational string; see the registration result’s crate::attestation::AttestationResult for the verified trust level.

§user_verified: bool

Whether user verification (biometrics/PIN) was performed at registration.

§backup_eligible: bool

Backup eligibility (BE) flag at registration: true when the credential is a multi-device/syncable credential. Immutable for the lifetime of the credential — persist and keep for policy decisions.

§Security note

BE=1 means account recovery follows the user’s cloud account rules, not this credential’s confinement to one device. See crate::policy::BackupPolicy for the trade-offs.

§backup_state: bool

Backup state (BS) flag at registration: whether the credential was backed up at ceremony time. Volatile — superseded by the BS flag reported on every AuthenticationResult.

Trait Implementations§

Source§

impl Clone for WebauthnCredential

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WebauthnCredential

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for WebauthnCredential

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for WebauthnCredential

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.