Skip to content

Commit

Permalink
webauthn: support hints
Browse files Browse the repository at this point in the history
See https://w3c.github.io/webauthn/#enum-hints. This change adds support
for RP hints on desktop, and disabled by default behind a flag.

Bug: 1510305
Change-Id: I8aa4c31b644b02533778e5ed69c44bdaafaf0c14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5108243
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Mike Taylor <miketaylr@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Adam Langley <agl@chromium.org>
Reviewed-by: Nina Satragno <nsatragno@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237771}
  • Loading branch information
Adam Langley authored and chromium-wpt-export-bot committed Dec 14, 2023
1 parent 43f51a2 commit 9cc0bbf
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
38 changes: 38 additions & 0 deletions webauthn/createcredential-hints.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebAuthn createWithHints</title>
<meta name="timeout" content="long">
<link rel="help" href="https://w3c.github.io/webauthn/#sctn-public-key-easy">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="helpers.js"></script>
<script src="resources/utils.js"></script>
<script>
function testCreateWithHints() {
"use strict";

// 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.
standardSetup(function() {
promise_test(async t => {
return createCredential({
options: {
publicKey: {
hints: ["not-a-defined-value"],
},
},
});
});
});
}

testCreateWithHints();
</script>
</head>
<body></body>
</html>
24 changes: 24 additions & 0 deletions webauthn/getcredential-hints.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>navigator.credentials.get() with hints</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src=helpers.js></script>
<body></body>
<script>
standardSetup(async function() {
"use strict";

const credPromise = createCredential();

// 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"])
.addCredential(credPromise)
.runTest("navigator.credentials.get with hints");
}, {});
</script>

0 comments on commit 9cc0bbf

Please sign in to comment.