Skip to content

Commit

Permalink
Add tests of duplicate PublicKeyCredentialHint values
Browse files Browse the repository at this point in the history
This relates to WebAuthn PR web-platform-tests#2145: w3c/webauthn#2145

And in turn WebAuthn issue web-platform-tests#2134: "Clarify behaviour of duplicate hints"
w3c/webauthn#2135
  • Loading branch information
emlun committed Sep 11, 2024
1 parent 49e4115 commit b1e783b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion webauthn/createcredential-hints.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
return createCredential({
options: {
publicKey: {
hints: ["not-a-defined-value"],
hints: ["duplicated-value", "not-a-defined-value", "duplicated-value"],
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion webauthn/getcredential-hints.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// The 'hints' parameter affects UI, which cannot be tested with WPTs.
// However, we can check that unknown values are ignored, as they
// should be, and don't trigger an error.
new GetCredentialsTest("options.publicKey.hints", ["not-a-defined-value"])
new GetCredentialsTest("options.publicKey.hints", ["duplicated-value", "not-a-defined-value", "duplicated-value"])
.addCredential(credPromise)
.runTest("navigator.credentials.get with hints");
}, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test(() => {
alg: -7,
},
],
hints: ["duplicated-value", "duplicated-value"]
});
let expected = {
rp: {
Expand All @@ -45,7 +46,7 @@ test(() => {
],
// The spec defaults the following fields:
attestation: "none",
hints: [],
hints: ["duplicated-value", "duplicated-value"]
};

assertJsonEquals(actual.rp, expected.rp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test(() => {
{ type: "public-key", id: test_b64 },
],
userVerification: "required",
hints: ["hybrid", "security-key"],
hints: ["hybrid", "security-key", "hybrid"],
});
let expected = {
challenge: test_bytes,
Expand All @@ -26,7 +26,7 @@ test(() => {
{ type: "public-key", id: test_bytes },
],
userVerification: "required",
hints: ["hybrid", "security-key"],
hints: ["hybrid", "security-key", "hybrid"],
};

assert_equals(actual.rpId, expected.rpId);
Expand Down

0 comments on commit b1e783b

Please sign in to comment.