Struct passkey_client::Client
source · pub struct Client<S, U, P>where
S: CredentialStore + Sync,
U: UserValidationMethod + Sync,
P: EffectiveTLDProvider + Sync + 'static,
Passkey: TryFrom<<S as CredentialStore>::PasskeyItem>,{ /* private fields */ }Expand description
A Client represents a Webauthn client. Users of this struct should supply a
CredentialStore, a UserValidationMethod and, optionally, an implementation of
public_suffix::EffectiveTLDProvider.
The tld_provider is used to verify effective Top-Level Domains for request origins presented
to the client. Most applications can use the new() function, which creates a Client with a
default provider implementation. Use new_with_custom_tld_provider() to provide a custom
EffectiveTLDProvider if your application needs to interpret eTLDs differently from the Mozilla
Public Suffix List.
Implementations§
source§impl<S, U> Client<S, U, PublicSuffixList>where
S: CredentialStore + Sync,
U: UserValidationMethod + Sync,
Passkey: TryFrom<<S as CredentialStore>::PasskeyItem>,
impl<S, U> Client<S, U, PublicSuffixList>where
S: CredentialStore + Sync,
U: UserValidationMethod + Sync,
Passkey: TryFrom<<S as CredentialStore>::PasskeyItem>,
sourcepub fn new(authenticator: Authenticator<S, U>) -> Self
pub fn new(authenticator: Authenticator<S, U>) -> Self
Create a Client with a given Authenticator that uses the default
TLD verifier provided by [public_suffix].
source§impl<S, U, P> Client<S, U, P>where
S: CredentialStore + Sync,
U: UserValidationMethod + Sync,
P: EffectiveTLDProvider + Sync + 'static,
Passkey: TryFrom<<S as CredentialStore>::PasskeyItem>,
impl<S, U, P> Client<S, U, P>where
S: CredentialStore + Sync,
U: UserValidationMethod + Sync,
P: EffectiveTLDProvider + Sync + 'static,
Passkey: TryFrom<<S as CredentialStore>::PasskeyItem>,
sourcepub fn new_with_custom_tld_provider(
authenticator: Authenticator<S, U>,
custom_provider: P
) -> Self
pub fn new_with_custom_tld_provider( authenticator: Authenticator<S, U>, custom_provider: P ) -> Self
Create a Client with a given Authenticator and a custom TLD provider
that implements [public_suffix::EffectiveTLDProvider].
sourcepub fn allows_insecure_localhost(self, is_allowed: bool) -> Self
pub fn allows_insecure_localhost(self, is_allowed: bool) -> Self
Allows the internal RpIdVerifier to pass through localhost requests.
sourcepub fn authenticator(&self) -> &Authenticator<S, U>
pub fn authenticator(&self) -> &Authenticator<S, U>
Read access to the Client’s Authenticator.
sourcepub fn authenticator_mut(&mut self) -> &mut Authenticator<S, U>
pub fn authenticator_mut(&mut self) -> &mut Authenticator<S, U>
Write access to the Client’s Authenticator.
sourcepub async fn register(
&mut self,
origin: &Url,
request: CredentialCreationOptions,
client_data_hash: Option<Vec<u8>>
) -> Result<CreatedPublicKeyCredential, WebauthnError>
pub async fn register( &mut self, origin: &Url, request: CredentialCreationOptions, client_data_hash: Option<Vec<u8>> ) -> Result<CreatedPublicKeyCredential, WebauthnError>
Register a webauthn request from the given origin.
Returns either a webauthn::CreatedPublicKeyCredential on success or some WebauthnError
sourcepub async fn authenticate(
&self,
origin: &Url,
request: CredentialRequestOptions,
client_data_hash: Option<Vec<u8>>
) -> Result<AuthenticatedPublicKeyCredential, WebauthnError>
pub async fn authenticate( &self, origin: &Url, request: CredentialRequestOptions, client_data_hash: Option<Vec<u8>> ) -> Result<AuthenticatedPublicKeyCredential, WebauthnError>
Authenticate a Webauthn request.
Returns either an webauthn::AuthenticatedPublicKeyCredential on success or some WebauthnError.