Struct webauthn_rs::prelude::SecurityKey
source · pub struct SecurityKey { /* private fields */ }
Expand description
A Security Key for a user. These are the legacy “second factor” method of security tokens.
You should avoid this type in favour of Passkey or [AttestedPasskey]
These can be safely serialised and deserialised from a database for use.
Implementations§
source§impl SecurityKey
impl SecurityKey
sourcepub fn cred_id(&self) -> &CredentialID
pub fn cred_id(&self) -> &CredentialID
Retrieve a reference to this Security 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 attestation(&self) -> &ParsedAttestation
pub fn attestation(&self) -> &ParsedAttestation
Retrieve a reference to the attestation used during this Credential
’s
registration. This can tell you information about the manufacterer and
what type of credential it is.
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()
. Generally this will always
be true as this class of key will maintain an activation counter which
allows (limited) protection against device cloning.
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 SecurityKey
impl Clone for SecurityKey
source§fn clone(&self) -> SecurityKey
fn clone(&self) -> SecurityKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SecurityKey
impl Debug for SecurityKey
source§impl<'de> Deserialize<'de> for SecurityKey
impl<'de> Deserialize<'de> for SecurityKey
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 SecurityKey
Available on crate feature danger-credential-internals
only.
impl From<Credential> for SecurityKey
danger-credential-internals
only.source§fn from(cred: Credential) -> Self
fn from(cred: Credential) -> Self
Convert a generic webauthn credential into a security key
source§impl From<SecurityKey> for Credential
Available on crate feature danger-credential-internals
only.
impl From<SecurityKey> for Credential
danger-credential-internals
only.