Skip to content

Commit 70d2618

Browse files
test(webauthn): add explicit short-input JSON parse test for PRF
1 parent 48cbbc3 commit 70d2618

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

libwebauthn/src/ops/webauthn/get_assertion.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,17 @@ mod tests {
777777
}
778778
}
779779

780+
#[test]
781+
fn test_prf_input_short_via_json() {
782+
// Regression test for #209: a sub-32-byte salt encoded in the JSON IDL
783+
// must round-trip through GetAssertionRequest::from_json into a
784+
// PrfInputValue with the expected bytes.
785+
let prf = parse_prf(r#"{"prf":{"eval":{"first":"aGk"}}}"#); // base64url "aGk" -> b"hi"
786+
let eval = prf.eval.expect("eval");
787+
assert_eq!(eval.first, b"hi");
788+
assert!(eval.second.is_none());
789+
}
790+
780791
#[test]
781792
fn test_prf_input_empty_allowed() {
782793
// §10.1.4 says "of any length" with no lower bound; empty must parse.

0 commit comments

Comments
 (0)