Struct webauthn_rs::prelude::Passkey
source · 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
impl Passkey
sourcepub fn cred_id(&self) -> &CredentialID
pub fn cred_id(&self) -> &CredentialID
Retrieve a reference to this Pass Key’s credential ID.
sourcepub fn cred_algorithm(&self) -> &COSEAlgorithm
pub fn cred_algorithm(&self) -> &COSEAlgorithm
Retrieve the type of cryptographic algorithm used by this key
sourcepub fn get_public_key(&self) -> &COSEKey
pub fn get_public_key(&self) -> &COSEKey
Retrieve a reference to this Passkey’s credential public key.
sourcepub fn update_credential(&mut self, res: &AuthenticationResult) -> Option<bool>
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<'de> Deserialize<'de> for Passkey
impl<'de> Deserialize<'de> for Passkey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<Credential> for Passkey
Available on crate feature danger-credential-internals
only.
impl From<Credential> for Passkey
danger-credential-internals
only.source§fn from(cred: Credential) -> Self
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.
impl From<Passkey> for Credential
danger-credential-internals
only.