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 ofparse_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— Whentrue, reject any response withcrossOrigin: truein the client data (§7.1 step 10 / §7.2 step 12).
§Errors
WebAuthnError::InvalidClientData— type field does not match.WebAuthnError::ChallengeMismatch— challenge bytes do not match.WebAuthnError::OriginMismatch— origin is not in the allowed list.WebAuthnError::CrossOriginNotAllowed— cross-origin flag set and RP rejects it.