pub struct Authentication<const USER_LEN: usize, const DISCOVERABLE: bool> { /* private fields */ }Expand description
PublicKeyCredential for authentication ceremonies.
Implementations§
Source§impl<const USER_LEN: usize, const DISCOVERABLE: bool> Authentication<USER_LEN, DISCOVERABLE>
impl<const USER_LEN: usize, const DISCOVERABLE: bool> Authentication<USER_LEN, DISCOVERABLE>
Sourcepub fn raw_id(&self) -> CredentialId<&[u8]>
pub fn raw_id(&self) -> CredentialId<&[u8]>
Sourcepub const fn response(&self) -> &AuthenticatorAssertion<USER_LEN, DISCOVERABLE>
pub const fn response(&self) -> &AuthenticatorAssertion<USER_LEN, DISCOVERABLE>
Sourcepub const fn authenticator_attachment(&self) -> AuthenticatorAttachment
pub const fn authenticator_attachment(&self) -> AuthenticatorAttachment
Sourcepub const fn new(
raw_id: CredentialId<Box<[u8]>>,
response: AuthenticatorAssertion<USER_LEN, DISCOVERABLE>,
authenticator_attachment: AuthenticatorAttachment,
) -> Self
Available on crate feature custom only.
pub const fn new( raw_id: CredentialId<Box<[u8]>>, response: AuthenticatorAssertion<USER_LEN, DISCOVERABLE>, authenticator_attachment: AuthenticatorAttachment, ) -> Self
custom only.Constructs an Authentication.
Sourcepub fn challenge(&self) -> Result<SentChallenge, CollectedClientDataErr>
pub fn challenge(&self) -> Result<SentChallenge, CollectedClientDataErr>
Returns the associated SentChallenge.
This is useful when wanting to extract the corresponding DiscoverableAuthenticationServerState
or NonDiscoverableAuthenticationServerState from an in-memory collection (e.g., MaxLenHashSet) or
storage.
Note if CollectedClientData::from_client_data_json returns Ok, then this will return Ok
containing the same value as CollectedClientData::challenge; however the converse is not true.
This is because this function parses the minimal amount of data possible.
§Errors
Errors iff AuthenticatorAssertion::client_data_json does not contain a base64url-encoded
Challenge in the required position.
Sourcepub fn challenge_relaxed(&self) -> Result<SentChallenge, SerdeJsonErr>
Available on crate feature serde_relaxed only.
pub fn challenge_relaxed(&self) -> Result<SentChallenge, SerdeJsonErr>
serde_relaxed only.Returns the associated SentChallenge.
This is useful when wanting to extract the corresponding DiscoverableAuthenticationServerState
or NonDiscoverableAuthenticationServerState from an in-memory collection (e.g.,
MaxLenHashSet) or storage.
Note if CollectedClientData::from_client_data_json_relaxed returns Ok, then this will return
Ok containing the same value as CollectedClientData::challenge; however the converse
is not true. This is because this function attempts to reduce the amount of data parsed.
§Errors
Errors iff AuthenticatorAssertion::client_data_json is invalid JSON after ignoring
a leading U+FEFF and replacing any sequences of invalid UTF-8 code units with U+FFFD or
challenge does not exist
or is not a base64url-encoded Challenge.
Sourcepub fn from_json_relaxed<'a>(json: &'a [u8]) -> Result<Self, SerdeJsonErr>where
UserHandle<USER_LEN>: Deserialize<'a>,
Available on crate feature serde_relaxed only.
pub fn from_json_relaxed<'a>(json: &'a [u8]) -> Result<Self, SerdeJsonErr>where
UserHandle<USER_LEN>: Deserialize<'a>,
serde_relaxed only.Convenience function for AuthenticationRelaxed::deserialize.
§Errors
Errors iff AuthenticationRelaxed::deserialize does.
Sourcepub fn from_json_custom<'a>(json: &'a [u8]) -> Result<Self, SerdeJsonErr>where
UserHandle<USER_LEN>: Deserialize<'a>,
Available on crate feature serde_relaxed only.
pub fn from_json_custom<'a>(json: &'a [u8]) -> Result<Self, SerdeJsonErr>where
UserHandle<USER_LEN>: Deserialize<'a>,
serde_relaxed only.Convenience function for CustomAuthentication::deserialize.
§Errors
Errors iff CustomAuthentication::deserialize does.
Trait Implementations§
Source§impl<const USER_LEN: usize, const DISCOVERABLE: bool> Debug for Authentication<USER_LEN, DISCOVERABLE>
impl<const USER_LEN: usize, const DISCOVERABLE: bool> Debug for Authentication<USER_LEN, DISCOVERABLE>
Source§impl<'de, const USER_LEN: usize, const DISCOVERABLE: bool> Deserialize<'de> for Authentication<USER_LEN, DISCOVERABLE>where
UserHandle<USER_LEN>: Deserialize<'de>,
Available on crate feature serde only.
impl<'de, const USER_LEN: usize, const DISCOVERABLE: bool> Deserialize<'de> for Authentication<USER_LEN, DISCOVERABLE>where
UserHandle<USER_LEN>: Deserialize<'de>,
serde only.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>,
Deserializes a struct based on
AuthenticationResponseJSON.
Note that unknown and duplicate keys are forbidden;
id and
rawId are deserialized
via CredentialId::deserialize;
response is deserialized
via AuthenticatorAssertion::deserialize;
authenticatorAttachment
is null or deserialized via AuthenticatorAttachment::deserialize;
clientExtensionResults
is deserialized such that it is an empty map or a map that only contains
prf which additionally must be
null or an
AuthenticationExtensionsPRFOutputs
such that unknown and duplicate keys are forbidden,
enabled
is forbidden (including being assigned null),
results must not exist,
be null, or be an
AuthenticationExtensionsPRFValues
with no unknown or duplicate keys,
first must exist but be
null, and
second can exist but
must be null if so; all required fields in the AuthenticationResponseJSON Web IDL dictionary exist
(and are not null); type is
"public-key"; and the decoded id and decoded rawId are the same.