pub struct Passkey { /* private fields */ }
Expand description

A Passkey for a user. A passkey is a term that covers all possible authenticators that may exist. These could be roaming credentials such as Apple’s Account back passkeys, they could be a users Yubikey, a Windows Hello TPM, or even a password manager softtoken.

Passkeys may opportunistically have some properties such as discoverability (residence). This is not a guarantee since enforcing residence on devices like yubikeys that have limited storage and no administration of resident keys may break the device.

These can be safely serialised and deserialised from a database for persistance.

Implementations§

source§

impl Passkey

source

pub fn cred_id(&self) -> &CredentialID

Retrieve a reference to this Pass Key’s credential ID.

source

pub fn cred_algorithm(&self) -> &COSEAlgorithm

Retrieve the type of cryptographic algorithm used by this key

source

pub fn get_public_key(&self) -> &COSEKey

Retrieve a reference to this Passkey’s credential public key.

source

pub fn update_credential(&mut self, res: &AuthenticationResult) -> Option<bool>

Post authentication, update this credentials properties.

To determine if this is required, you can inspect the result of authentication_result.needs_update(). Counter intuitively, most passkeys will never need their properties updated! This is because many passkeys lack an internal device activation counter (due to their synchronisation), and the backup-state flags are rarely if ever changed.

If the credential_id does not match, None is returned. If the cred id matches and the credential is updated, Some(true) is returned. If the cred id matches, but the credential is not changed, Some(false) is returned.

Trait Implementations§

source§

impl Clone for Passkey

source§

fn clone(&self) -> Passkey

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Passkey

source§

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

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

impl<'de> Deserialize<'de> for Passkey

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 From<Credential> for Passkey

Available on crate feature danger-credential-internals only.
source§

fn from(cred: Credential) -> Self

Convert a generic webauthn credential into a Passkey

source§

impl From<Passkey> for Credential

Available on crate feature danger-credential-internals only.
source§

fn from(pk: Passkey) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Passkey

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Passkey

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
§

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

§

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

§

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

§

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

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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,

§

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>,

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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