Skip to main content

WebauthnConfig

Struct WebauthnConfig 

Source
pub struct WebauthnConfig {
    pub rp_id: String,
    pub rp_name: String,
    pub rp_origins: Vec<String>,
    pub allowed_algorithms: Vec<i32>,
    pub challenge_timeout_secs: u64,
    pub attestation: AttestationPolicy,
    pub credential_policy: CredentialPolicy,
    pub resident_key: ResidentKeyPolicy,
    pub attestation_conveyance: AttestationConveyance,
}
Expand description

WebAuthn relying party configuration.

This is the kit-local replacement for any application-specific auth config struct: it carries everything the protocol layer needs and nothing else. Application concerns (feature flags, storage, session handling) are deliberately excluded.

§Security notes

  • rp_id must be the registrable domain suffix shared by all origins that may perform WebAuthn ceremonies. It is hashed (SHA-256) and compared against the rpIdHash embedded in authenticator data; a wrong value fails every verification.
  • Every entry in rp_origins is an exact-match allow-list entry. Origins are compared byte-for-byte against clientDataJSON.origin; scheme, host, and port must all match. List only origins you fully trust.
  • allowed_algorithms controls which COSE algorithms are advertised to authenticators in registration options. Runtime verification implements ES256 (-7), ES384 (-35), EdDSA (-8), and RS256 (-257); anything else is rejected with crate::WebauthnError::UnsupportedAlgorithm regardless of this setting. For server-side enforcement of the advertised set (rejecting credentials with other algorithms), set credential_policy.allowed_algorithms — advertising alone is not enforcement.
  • attestation governs attestation statement verification during registration; see AttestationPolicy for the trust implications of empty trust_anchors and allow_unknown_formats.
  • credential_policy is enforced server-side by crate::verify_registration / crate::verify_authentication; the resident_key / attestation_conveyance / advertised-algorithm settings are preferences conveyed to the client and cannot be relied on for enforcement.

Fields§

§rp_id: String

Relying party ID (effective domain, e.g. "example.com").

Must NOT include scheme or port. See struct-level security notes.

§rp_name: String

Human-readable relying party name (advertised in registration options).

§rp_origins: Vec<String>

Allowed origins for WebAuthn ceremonies (exact match, e.g. "https://example.com").

§allowed_algorithms: Vec<i32>

COSE algorithm identifiers advertised for registration.

Defaults to [-7 (ES256), -35 (ES384), -257 (RS256)].

§challenge_timeout_secs: u64

Challenge freshness window in seconds (default 300 = 5 minutes).

Challenges older than this are rejected on consumption.

§attestation: AttestationPolicy

Attestation verification policy applied by crate::verify_registration (default: strict — unknown formats rejected, no trust anchors configured).

§credential_policy: CredentialPolicy

Server-side credential policy enforced during both ceremonies (default: permissive — UV reported, syncable credentials allowed, no algorithm allowlist). See CredentialPolicy.

§resident_key: ResidentKeyPolicy

Discoverable-credential preference conveyed in registration options (default: ResidentKeyPolicy::Preferred).

§attestation_conveyance: AttestationConveyance

Attestation conveyance preference conveyed in registration options (default: AttestationConveyance::None).

Trait Implementations§

Source§

impl Clone for WebauthnConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WebauthnConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for WebauthnConfig

Source§

fn default() -> Self

Sensible development defaults (localhost RP).

Do not use Default::default() in production; set rp_id and rp_origins to your real domain and HTTPS origin.

Auto Trait Implementations§

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.