Skip to main content

Credential

Struct Credential 

Source
pub struct Credential {
    pub id: Vec<u8>,
    pub public_key: PublicKey,
    pub sign_count: u32,
    pub user_id: Vec<u8>,
    pub rp_id: String,
    pub created_at: SystemTime,
    pub backup_eligible: bool,
    pub backup_state: bool,
}
Expand description

A registered credential persisted on the relying-party side after a successful registration ceremony.

The caller is responsible for storing this in a durable, server-side store keyed by id (the credential ID) and associated with user_id.

Fields§

§id: Vec<u8>

Opaque byte string that uniquely identifies this credential. Produced by the authenticator during registration.

§public_key: PublicKey

The authenticator’s public key in the format signalled during registration.

§sign_count: u32

Monotonically increasing counter maintained by the authenticator. Used to detect cloned authenticators.

§user_id: Vec<u8>

Application-defined identifier for the user this credential belongs to.

§rp_id: String

Relying party ID (e.g. "example.com"). Stored so authentication can verify the credential is bound to this RP.

§created_at: SystemTime

When this credential was first registered.

§backup_eligible: bool

Whether this credential is eligible for backup to a platform sync service (BE flag, §6.1 bit 3).

This value is immutable per spec — the authenticator sets it once at registration and it must not change in subsequent ceremonies. A change in backup_eligible between registration and authentication is treated as a credential substitution attempt and rejected with crate::error::WebAuthnError::BackupEligibilityChanged.

§backup_state: bool

Whether this credential is currently backed up (BS flag, §6.1 bit 4).

This value may change between ceremonies as the user’s backup state varies. After a successful authentication ceremony, update this field to AuthenticationResult.backup_state before persisting the credential.

Trait Implementations§

Source§

impl Clone for Credential

Source§

fn clone(&self) -> Credential

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 Credential

Source§

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

Formats the value using the given formatter. 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<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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.