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_idmust be the registrable domain suffix shared by all origins that may performWebAuthnceremonies. It is hashed (SHA-256) and compared against therpIdHashembedded in authenticator data; a wrong value fails every verification.- Every entry in
rp_originsis an exact-match allow-list entry. Origins are compared byte-for-byte againstclientDataJSON.origin; scheme, host, and port must all match. List only origins you fully trust. allowed_algorithmscontrols 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 withcrate::WebauthnError::UnsupportedAlgorithmregardless of this setting. For server-side enforcement of the advertised set (rejecting credentials with other algorithms), setcredential_policy.allowed_algorithms— advertising alone is not enforcement.attestationgoverns attestation statement verification during registration; seeAttestationPolicyfor the trust implications of emptytrust_anchorsandallow_unknown_formats.credential_policyis enforced server-side bycrate::verify_registration/crate::verify_authentication; theresident_key/attestation_conveyance/ advertised-algorithm settings are preferences conveyed to the client and cannot be relied on for enforcement.
Fields§
§rp_id: StringRelying party ID (effective domain, e.g. "example.com").
Must NOT include scheme or port. See struct-level security notes.
rp_name: StringHuman-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: u64Challenge freshness window in seconds (default 300 = 5 minutes).
Challenges older than this are rejected on consumption.
attestation: AttestationPolicyAttestation verification policy applied by
crate::verify_registration (default: strict — unknown formats
rejected, no trust anchors configured).
credential_policy: CredentialPolicyServer-side credential policy enforced during both ceremonies
(default: permissive — UV reported, syncable credentials allowed, no
algorithm allowlist). See CredentialPolicy.
resident_key: ResidentKeyPolicyDiscoverable-credential preference conveyed in registration options
(default: ResidentKeyPolicy::Preferred).
attestation_conveyance: AttestationConveyanceAttestation conveyance preference conveyed in registration options
(default: AttestationConveyance::None).