Skip to main content

WebAuthnServerConfig

WebAuthnServerConfig is the object you pass to the WebAuthnServer constructor. This page is the field-by-field type reference; the Configuration guide explains the choices in prose.

Required fields

FieldTypeDescription
rpNamestringHuman-readable relying party name.
rpIDstringRelying party ID (registrable domain).
originstring | string[]Expected origin(s).
encryptionSecretstringSession-key secret; >= 32 characters.

Optional fields

FieldTypeDefaultDescription
storageAdapterStorageAdapterPersistence for users/credentials/challenges/sessions.
sessionDurationnumber86400000Session lifetime (ms).
attestationTypeAttestationConveyancePreference'none'Attestation preference.
enableMobileAttestationbooleanfalseOpt-in non-standard JSON attestation path.
enforceChallengeStorebooleantrueEnforce + consume the stored challenge once.
allowCrossOriginIframebooleanfalseAllow cross-origin iframe ceremonies.
originVerifier(origin: string) => booleanCustom origin matcher.
userVerificationUserVerificationRequirement'preferred'UV policy.
authenticatorSelectionAuthenticatorSelectionCriteria{ residentKey: 'preferred', userVerification: <userVerification> }Authenticator preferences.
supportedAlgorithmsCOSEAlgorithmIdentifier[][ES256, RS256]Allowed COSE algorithms.
challengeSizenumber32Challenge size in bytes (16–64).
timeoutnumber60000Ceremony timeout (ms, min 10000).
preferredAuthenticatorTypePreferredAuthenticatorType'securityKey' | 'localDevice' | 'remoteDevice'.
metadataServiceMetadataServiceFIDO MDS trust-anchor provider.
requireTrustedAttestationbooleanfalseReject non-trust-anchored attestation.
rpIconstringDeprecated (WebAuthn L3).
debugbooleanfalseEnable debug logging via logger.
logger(level, message, data?) => voidCustom logging function.

Validation

The constructor throws ConfigurationError when:

  • rpName, rpID, origin, or encryptionSecret is missing;
  • encryptionSecret.length < 32;
  • challengeSize is set and outside 1664;
  • timeout is set and below 10000.
  • PreferredAuthenticatorType = 'securityKey' | 'localDevice' | 'remoteDevice'
  • UserVerificationRequirement = 'required' | 'preferred' | 'discouraged'
  • AttestationConveyancePreference = 'none' | 'indirect' | 'direct' | 'enterprise'

See the Types & Errors reference for the complete exported type list.