pub struct Client<S, U, P, F>where
S: CredentialStore + Sync,
U: UserValidationMethod + Sync,
P: EffectiveTLDProvider + Sync + 'static,{ /* 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, F> Client<S, U, P, F>where
S: CredentialStore + Sync,
U: UserValidationMethod<PasskeyItem = <S as CredentialStore>::PasskeyItem> + Sync,
P: EffectiveTLDProvider + Sync + 'static,
F: Fetcher + Sync,
impl<S, U, P, F> Client<S, U, P, F>where
S: CredentialStore + Sync,
U: UserValidationMethod<PasskeyItem = <S as CredentialStore>::PasskeyItem> + Sync,
P: EffectiveTLDProvider + Sync + 'static,
F: Fetcher + Sync,
Sourcepub fn new_with_custom_tld_provider(
authenticator: Authenticator<S, U>,
custom_provider: P,
fetcher: Option<F>,
) -> Self
pub fn new_with_custom_tld_provider( authenticator: Authenticator<S, U>, custom_provider: P, fetcher: Option<F>, ) -> 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<D: ClientData<E>, E: Serialize + Clone>(
&mut self,
origin: impl Into<Origin<'_>>,
request: CredentialCreationOptions,
client_data: D,
) -> Result<CreatedPublicKeyCredential, WebauthnError>
pub async fn register<D: ClientData<E>, E: Serialize + Clone>( &mut self, origin: impl Into<Origin<'_>>, request: CredentialCreationOptions, client_data: D, ) -> 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<D: ClientData<E>, E: Serialize + Clone>(
&mut self,
origin: impl Into<Origin<'_>>,
request: CredentialRequestOptions,
client_data: D,
) -> Result<AuthenticatedPublicKeyCredential, WebauthnError>
pub async fn authenticate<D: ClientData<E>, E: Serialize + Clone>( &mut self, origin: impl Into<Origin<'_>>, request: CredentialRequestOptions, client_data: D, ) -> Result<AuthenticatedPublicKeyCredential, WebauthnError>
Authenticate a Webauthn request.
Returns either an webauthn::AuthenticatedPublicKeyCredential on success or some WebauthnError.
Auto Trait Implementations§
impl<S, U, P, F> Freeze for Client<S, U, P, F>
impl<S, U, P, F> RefUnwindSafe for Client<S, U, P, F>
impl<S, U, P, F> Send for Client<S, U, P, F>
impl<S, U, P, F> Sync for Client<S, U, P, F>where
F: Sync,
impl<S, U, P, F> Unpin for Client<S, U, P, F>
impl<S, U, P, F> UnwindSafe for Client<S, U, P, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more