pub enum CtapAuthenticator<'a, T: Token, U: UiCallback> {
Fido20(Ctap20Authenticator<'a, T, U>),
Fido21Pre(Ctap21PreAuthenticator<'a, T, U>),
Fido21(Ctap21Authenticator<'a, T, U>),
}
ctap2
only.Expand description
Abstraction for different versions of the CTAP2 protocol.
All tokens can Deref into Ctap20Authenticator.
Variants§
Fido20(Ctap20Authenticator<'a, T, U>)
Interface for CTAP 2.0 tokens.
Fido21Pre(Ctap21PreAuthenticator<'a, T, U>)
Interface for CTAP 2.1-PRE tokens.
Fido21(Ctap21Authenticator<'a, T, U>)
Interface for CTAP 2.1 tokens.
Implementations§
Source§impl<'a, T: Token, U: UiCallback> CtapAuthenticator<'a, T, U>
impl<'a, T: Token, U: UiCallback> CtapAuthenticator<'a, T, U>
Sourcepub async fn new(
token: T,
ui_callback: &'a U,
) -> Option<CtapAuthenticator<'a, T, U>>
pub async fn new( token: T, ui_callback: &'a U, ) -> Option<CtapAuthenticator<'a, T, U>>
Initialises the token, and gets a reference to the highest supported FIDO version.
Returns None
if we don’t support any version of CTAP which the token supports.
Sourcepub fn supports_biometrics(&self) -> bool
pub fn supports_biometrics(&self) -> bool
Returns true
if the token supports biometric commands.
Sourcepub fn configured_biometrics(&self) -> bool
pub fn configured_biometrics(&self) -> bool
Returns true
if the token has configured biometric authentication.
Sourcepub fn bio(&mut self) -> Option<&mut dyn BiometricAuthenticator>
Available on crate feature ctap2-management
only.
pub fn bio(&mut self) -> Option<&mut dyn BiometricAuthenticator>
ctap2-management
only.Gets a mutable reference to a BiometricAuthenticator trait for the token, if it supports biometric commands.
Returns None
if the token does not support biometrics.
Sourcepub fn supports_credential_management(&self) -> bool
pub fn supports_credential_management(&self) -> bool
Returns true
if the token supports credential management.
Sourcepub fn credential_management(
&mut self,
) -> Option<&mut dyn CredentialManagementAuthenticator>
Available on crate feature ctap2-management
only.
pub fn credential_management( &mut self, ) -> Option<&mut dyn CredentialManagementAuthenticator>
ctap2-management
only.Gets a mutable reference to a CredentialManagementAuthenticator trait for the token, if it supports credential management commands.
Returns None
if the token does not support credential management.
Methods from Deref<Target = Ctap20Authenticator<'a, T, U>>§
Sourcepub fn get_info(&self) -> &GetInfoResponse
pub fn get_info(&self) -> &GetInfoResponse
Gets cached information about the authenticator.
This does not transmit to the token.
Sourcepub async fn factory_reset(&mut self) -> Result<(), WebauthnCError>
Available on crate feature ctap2-management
only.
pub async fn factory_reset(&mut self) -> Result<(), WebauthnCError>
ctap2-management
only.Perform a factory reset of the token, deleting all data.
Sourcepub fn validate_pin(&self, pin: &str) -> Result<String, WebauthnCError>
Available on crate feature ctap2-management
only.
pub fn validate_pin(&self, pin: &str) -> Result<String, WebauthnCError>
ctap2-management
only.Checks whether a provided PIN follows the rules defined by the authenticator. This does not share the PIN with the authenticator.
Sourcepub async fn set_new_pin(&mut self, pin: &str) -> Result<(), WebauthnCError>
Available on crate feature ctap2-management
only.
pub async fn set_new_pin(&mut self, pin: &str) -> Result<(), WebauthnCError>
ctap2-management
only.Sets a PIN on a device which does not already have one.
To change a PIN, use change_pin()
.
Sourcepub async fn change_pin(
&mut self,
old_pin: &str,
new_pin: &str,
) -> Result<(), WebauthnCError>
Available on crate feature ctap2-management
only.
pub async fn change_pin( &mut self, old_pin: &str, new_pin: &str, ) -> Result<(), WebauthnCError>
ctap2-management
only.Changes a PIN on a device.
To set a PIN for the first time, use set_new_pin()
.
Sourcepub async fn selection(&mut self) -> Result<(), WebauthnCError>
pub async fn selection(&mut self) -> Result<(), WebauthnCError>
Prompt for user presence on an authenticator.
On CTAP 2.1 authenticators, this sends a SelectionRequest.
On CTAP 2.0 and 2.1-PRE authenticators (where there is no SelectionRequest), this performs a MakeCredentialRequest with invalid PIN/UV auth parameters, using the process described in CTAP 2.1 § 6.1.2 authenticatorMakeCredential Algorithm step 1.
While this shouldn’t result in an authenticator lock-out (according to
the spec), it has been observed that some authenticators will decrement
their pinAttempts
counter.
§References
- CTAP 2.1 §6.1.2 authenticatorMakeCredential Algorithm, step 1.
Trait Implementations§
Source§impl<'a, T: Token, U: UiCallback> AuthenticatorBackendHashedClientData for CtapAuthenticator<'a, T, U>
Wrapper for Ctap20Authenticator’s implementation of
AuthenticatorBackendHashedClientData.
impl<'a, T: Token, U: UiCallback> AuthenticatorBackendHashedClientData for CtapAuthenticator<'a, T, U>
Wrapper for Ctap20Authenticator’s implementation of AuthenticatorBackendHashedClientData.
fn perform_register( &mut self, client_data_hash: Vec<u8>, options: PublicKeyCredentialCreationOptions, timeout_ms: u32, ) -> Result<RegisterPublicKeyCredential, WebauthnCError>
fn perform_auth( &mut self, client_data_hash: Vec<u8>, options: PublicKeyCredentialRequestOptions, timeout_ms: u32, ) -> Result<PublicKeyCredential, WebauthnCError>
Source§impl<'a, T: Debug + Token, U: Debug + UiCallback> Debug for CtapAuthenticator<'a, T, U>
impl<'a, T: Debug + Token, U: Debug + UiCallback> Debug for CtapAuthenticator<'a, T, U>
Source§impl<'a, T: Token, U: UiCallback> Deref for CtapAuthenticator<'a, T, U>
Gets a reference to a CTAP 2.0 compatible interface.
impl<'a, T: Token, U: UiCallback> Deref for CtapAuthenticator<'a, T, U>
Gets a reference to a CTAP 2.0 compatible interface.
All CTAP2 tokens support these base commands.
Source§impl<T: Token, U: UiCallback> DerefMut for CtapAuthenticator<'_, T, U>
Gets a mutable reference to a
CTAP 2.0 compatible interface.
impl<T: Token, U: UiCallback> DerefMut for CtapAuthenticator<'_, T, U>
Gets a mutable reference to a CTAP 2.0 compatible interface.
All CTAP2 tokens support these base commands.