3aa2cc496067263ae53fc7ef2e0804e903e31f58
[WebKit-https.git] / LayoutTests / http / tests / webauthn / resources / last-layer-frame.https.html
1 <html>
2 <head>
3     <script src="/js-test-resources/js-test.js"></script>
4     <script src="util.js"></script>
5     <script>
6     function messageToTop(messagePrefix) {
7         top.postMessage(messagePrefix, "https://127.0.0.1:8443");
8     }
9
10     const options = {
11         publicKey: {
12             rp: {
13                 name: "example.com"
14             },
15             user: {
16                 name: "John Appleseed",
17                 id: asciiToUint8Array("123456"),
18                 displayName: "John",
19             },
20             challenge: asciiToUint8Array("123456"),
21             pubKeyCredParams: [{ type: "public-key", alg: -7 }]
22         }
23     };
24     navigator.credentials.create(options).then(
25         function(value) {
26             messageToTop("Access granted. " + value);
27         },
28         function(exception) {
29             if (exception.name == "NotAllowedError")
30                 messageToTop("PASS Throw NotAllowedError.");
31             else
32                 messageToTop("Throw " + exception.name  + ".");
33         }
34     );
35     </script>
36 </head>
37 </html>