Skip to main content

PublicKeyCredentialRequestOptions

Struct PublicKeyCredentialRequestOptions 

Source
pub struct PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second> {
    pub challenge: Challenge,
    pub timeout: NonZeroU32,
    pub rp_id: &'rp_id RpId,
    pub user_verification: UserVerificationRequirement,
    pub hints: Hints,
    pub extensions: Extension<'prf_first, 'prf_second>,
}
Expand description

The PublicKeyCredentialRequestOptions to send to the client when authenticating a credential.

This does not contain allowCredentials.

Fields§

§challenge: Challenge§timeout: NonZeroU32

timeout.

Note we require a positive value despite the spec allowing an optional nonnegative value. This jives with the fact that in-memory storage is required when serializable_server_state is not enabled when authenticating credentials as no timeout would make out-of-memory (OOM) conditions more likely.

§rp_id: &'rp_id RpId

rpId.

This MUST be the same as the PublicKeyCredentialCreationOptions::rp_id used when the credential was registered.

§user_verification: UserVerificationRequirement§hints: Hints§extensions: Extension<'prf_first, 'prf_second>

Implementations§

Source§

impl<'rp_id> PublicKeyCredentialRequestOptions<'rp_id, '_, '_>

Source

pub fn passkey<'a: 'rp_id>(rp_id: &'a RpId) -> Self

Creates a PublicKeyCredentialRequestOptions with Self::user_verification set to UserVerificationRequirement::Required and Self::timeout set to FIVE_MINUTES.

Note rp_id must be the same as the PublicKeyCredentialCreationOptions::rp_id when the credential was registered.

§Examples
assert!(matches!(
    PublicKeyCredentialRequestOptions::passkey(&RpId::Domain(AsciiDomain::try_from("example.com".to_owned())?)).user_verification,
    UserVerificationRequirement::Required
));
Source

pub fn second_factor<'a: 'rp_id>(rp_id: &'a RpId) -> Self

Creates a PublicKeyCredentialRequestOptions with Self::user_verification set to UserVerificationRequirement::Discouraged and Self::timeout set to FIVE_MINUTES.

Note rp_id must be the same as the PublicKeyCredentialCreationOptions::rp_id when the credentials were registered.

§Examples
assert!(matches!(
    PublicKeyCredentialRequestOptions::second_factor(&RpId::Domain(AsciiDomain::try_from("example.com".to_owned())?)).user_verification,
    UserVerificationRequirement::Discouraged
));

Trait Implementations§

Source§

impl<'rp_id, 'prf_first, 'prf_second> Debug for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'rp_id, 'prf_first, 'prf_second> Freeze for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

§

impl<'rp_id, 'prf_first, 'prf_second> RefUnwindSafe for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

§

impl<'rp_id, 'prf_first, 'prf_second> Send for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

§

impl<'rp_id, 'prf_first, 'prf_second> Sync for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

§

impl<'rp_id, 'prf_first, 'prf_second> Unpin for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

§

impl<'rp_id, 'prf_first, 'prf_second> UnsafeUnpin for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

§

impl<'rp_id, 'prf_first, 'prf_second> UnwindSafe for PublicKeyCredentialRequestOptions<'rp_id, 'prf_first, 'prf_second>

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.