Struct Authenticator

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

Source

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>

Source

pub async fn get_info(&self) -> Response

Using this method, the host can request that the authenticator report a list of all supported protocol versions, supported extensions, AAGUID of the device, and its capabilities.

Source§

impl<S, U> Authenticator<S, U>

Source

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>

Source

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.

Source

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.

Source

pub fn make_credentials_with_signature_counter(&self) -> bool

Get whether the authenticator will save new credentials with a signature counter.

Source

pub fn set_make_credential_id_length(&mut self, length: CredentialIdLength)

Set the length of credentialId to generate when creating a new credential.

Source

pub fn make_credential_id_length(&self) -> CredentialIdLength

Get the current length of credential that will be generated when making a new credential.

Source

pub fn store(&self) -> &S

Access the CredentialStore to look into what is stored.

Source

pub fn store_mut(&mut self) -> &mut S

Exclusively access the CredentialStore to look into what is stored and modify it if needed.

Source

pub fn aaguid(&self) -> &Aaguid

Access the authenticator’s Aaguid

Source

pub fn attachment_type(&self) -> AuthenticatorAttachment

Return the current attachment type for this authenticator.

Source

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.

Source

pub fn transports(self, transports: Vec<AuthenticatorTransport>) -> Self

Builder method for overwriting the authenticator’s supported transports.

Source

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>

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,

Request to get the information of the authenticator and see what it supports.
Source§

fn make_credential<'life0, 'async_trait>( &'life0 mut self, request: Request, ) -> Pin<Box<dyn Future<Output = Result<Response, StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Request to create and save a new credential in the authenticator.
Source§

fn get_assertion<'life0, 'async_trait>( &'life0 self, request: Request, ) -> Pin<Box<dyn Future<Output = Result<Response, StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Request to assert a user’s existing credential that might exist in the authenticator.
Source§

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,

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,

Apply an authentication request with the appropriate response

Auto Trait Implementations§

§

impl<S, U> Freeze for Authenticator<S, U>
where S: Freeze, U: Freeze,

§

impl<S, U> RefUnwindSafe for Authenticator<S, U>

§

impl<S, U> Send for Authenticator<S, U>
where S: Send, U: Send,

§

impl<S, U> Sync for Authenticator<S, U>
where S: Sync, U: Sync,

§

impl<S, U> Unpin for Authenticator<S, U>
where S: Unpin, U: Unpin,

§

impl<S, U> UnwindSafe for Authenticator<S, U>
where S: UnwindSafe, U: UnwindSafe,

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
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, 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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

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

Source§

fn vzip(self) -> V