Skip to main content

validate_client_data

Function validate_client_data 

Source
pub fn validate_client_data(
    parsed: &ParsedClientData,
    expected_type: &str,
    expected_challenge: &[u8],
    allowed_origins: &[String],
    reject_cross_origin: bool,
) -> Result<()>
Expand description

Validate the parsed client data against the expected ceremony parameters.

Checks (in order): ceremony type, challenge bytes, origin, cross-origin. Returns the first mismatch found so the caller receives the most specific error available.

§Arguments

  • parsed — Output of parse_client_data.
  • expected_type"webauthn.create" or "webauthn.get".
  • expected_challenge — The raw challenge bytes the relying party issued.
  • allowed_origins — All origins this RP accepts. The client-supplied origin must equal at least one entry exactly.
  • reject_cross_origin — When true, reject any response with crossOrigin: true in the client data (§7.1 step 10 / §7.2 step 12).

§Errors