pub struct Authenticator<S, U> { /* private fields */ }
Expand description
A virtual authenticator with all the necessary state and information.
Implementations§
Source§impl<S, U> Authenticator<S, U>where
S: CredentialStore + Sync,
U: UserValidationMethod<PasskeyItem = <S as CredentialStore>::PasskeyItem> + Sync,
impl<S, U> Authenticator<S, U>where
S: CredentialStore + Sync,
U: UserValidationMethod<PasskeyItem = <S as CredentialStore>::PasskeyItem> + Sync,
Sourcepub async fn get_assertion(
&mut self,
input: Request,
) -> Result<Response, StatusCode>
pub async fn get_assertion( &mut self, input: Request, ) -> Result<Response, StatusCode>
This method is used by a host to request cryptographic proof of user authentication as well as user consent to a given transaction, using a previously generated credential that is bound to the authenticator and relying party identifier.
Source§impl<S: CredentialStore, U: UserValidationMethod> Authenticator<S, U>
impl<S: CredentialStore, U: UserValidationMethod> Authenticator<S, U>
Source§impl<S, U> Authenticator<S, U>
impl<S, U> Authenticator<S, U>
Sourcepub async fn make_credential(
&mut self,
input: Request,
) -> Result<Response, StatusCode>
pub async fn make_credential( &mut self, input: Request, ) -> Result<Response, StatusCode>
This method is invoked by the host to request generation of a new credential in the authenticator.
Source§impl<S, U> Authenticator<S, U>where
S: CredentialStore,
U: UserValidationMethod,
impl<S, U> Authenticator<S, U>where
S: CredentialStore,
U: UserValidationMethod,
Sourcepub fn new(aaguid: Aaguid, store: S, user: U) -> Self
pub fn new(aaguid: Aaguid, store: S, user: U) -> Self
Create an authenticator with a known aaguid, a backing storage and a User verification system.
Sourcepub fn set_make_credentials_with_signature_counter(&mut self, value: bool)
pub fn set_make_credentials_with_signature_counter(&mut self, value: bool)
Set whether the authenticator should save new credentials with a signature counter.
NOTE: Using a counter with a credential that will sync is not recommended and can cause friction with the distributed nature of synced keys. It can also cause issues with backup and restore functionality.
Sourcepub fn make_credentials_with_signature_counter(&self) -> bool
pub fn make_credentials_with_signature_counter(&self) -> bool
Get whether the authenticator will save new credentials with a signature counter.
Sourcepub fn set_make_credential_id_length(&mut self, length: CredentialIdLength)
pub fn set_make_credential_id_length(&mut self, length: CredentialIdLength)
Set the length of credentialId to generate when creating a new credential.
Sourcepub fn make_credential_id_length(&self) -> CredentialIdLength
pub fn make_credential_id_length(&self) -> CredentialIdLength
Get the current length of credential that will be generated when making a new credential.
Sourcepub fn store(&self) -> &S
pub fn store(&self) -> &S
Access the CredentialStore
to look into what is stored.
Sourcepub fn store_mut(&mut self) -> &mut S
pub fn store_mut(&mut self) -> &mut S
Exclusively access the CredentialStore
to look into what is stored and modify it if needed.
Sourcepub fn attachment_type(&self) -> AuthenticatorAttachment
pub fn attachment_type(&self) -> AuthenticatorAttachment
Return the current attachment type for this authenticator.
Sourcepub fn choose_algorithm(
&self,
params: &[PublicKeyCredentialParameters],
) -> Result<Algorithm, Ctap2Error>
pub fn choose_algorithm( &self, params: &[PublicKeyCredentialParameters], ) -> Result<Algorithm, Ctap2Error>
Validate params
with the following steps
1. For each element of params
:
1-2: Handled during deserialization
3. If the element specifies an algorithm that is supported by the authenticator, and
no algorithm has yet been chosen by this loop, then let the algorithm specified by
the current element be the chosen algorithm.
2. If the loop completes and no algorithm was chosen then return Ctap2Error::UnsupportedAlgorithm
.
Note: This loop chooses the first occurrence of an algorithm identifier supported by this
authenticator but always iterates over every element of params
to validate them.
Sourcepub fn transports(self, transports: Vec<AuthenticatorTransport>) -> Self
pub fn transports(self, transports: Vec<AuthenticatorTransport>) -> Self
Builder method for overwriting the authenticator’s supported transports.
Sourcepub fn hmac_secret(self, ext: HmacSecretConfig) -> Self
pub fn hmac_secret(self, ext: HmacSecretConfig) -> Self
Set the hmac-secret extension as a supported extension
Trait Implementations§
Source§impl<S, U> Ctap2Api for Authenticator<S, U>
impl<S, U> Ctap2Api for Authenticator<S, U>
Source§fn get_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<S: CredentialStore + Sync + Send, U: UserValidationMethod + Sync + Send> U2fApi for Authenticator<S, U>
impl<S: CredentialStore + Sync + Send, U: UserValidationMethod + Sync + Send> U2fApi for Authenticator<S, U>
Source§fn register<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: RegisterRequest,
handle: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<RegisterResponse, U2FError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: RegisterRequest,
handle: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<RegisterResponse, U2FError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Apply a register request and create a credential and respond with the public key of said credential.
Source§fn authenticate<'life0, 'async_trait>(
&'life0 self,
request: AuthenticationRequest,
counter: u32,
user_presence: Flags,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResponse, U2FError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate<'life0, 'async_trait>(
&'life0 self,
request: AuthenticationRequest,
counter: u32,
user_presence: Flags,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResponse, U2FError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Apply an authentication request with the appropriate response