ad2bcbfd72447adbda81c0185d397505eab64063
[WebKit-https.git] / LayoutTests / http / wpt / webauthn / idl.https.html
1 <!doctype html>
2 <html>
3 <head>
4     <meta charset=utf-8>
5     <title>IDL check of WebAuthN</title>
6     <link rel="help" href="https://www.w3.org/TR/webauthn/#idl-index">
7     <script src=/resources/testharness.js></script>
8     <script src=/resources/testharnessreport.js></script>
9     <script src=/resources/WebIDLParser.js></script>
10     <script src=/resources/idlharness.js></script>
11     <script src="./resources/util.js"></script>
12 </head>
13 <body>
14
15 <h1 class="instructions">Description</h1>
16
17 <p class="instructions">This test verifies that the implementations of the WebAuthN API match with its WebIDL definition.</p>
18
19 <div id='log'></div>
20
21 <script>
22 promise_test(async () => {
23     const idlURL = ["WebAuthN.idl"];
24     const idlArray = new IdlArray();
25     const idlText = await fetch(idlURL).then(r => r.text());
26
27     idlArray.add_untested_idls("interface ArrayBuffer {};");
28
29     idlArray.add_idls(`
30         [Exposed=Window, SecureContext]
31         interface Credential {
32             readonly attribute USVString id;
33             readonly attribute DOMString type;
34         };
35     `);
36     idlArray.add_idls(idlText);
37
38     const options = {
39         publicKey: {
40             rp: {
41                 name: "localhost",
42             },
43             user: {
44                 name: "John Appleseed",
45                 id: asciiToUint8Array("123456"),
46                 displayName: "Appleseed",
47             },
48             challenge: Base64URL.parse("MTIzNDU2"),
49             pubKeyCredParams: [{ type: "public-key", alg: -7 }],
50         }
51     };
52     credential = await navigator.credentials.create(options);
53
54     idlArray.add_objects({"PublicKeyCredential": ["credential"], "AuthenticatorAttestationResponse": ["credential.response"]});
55     idlArray.test();
56 }, "Setup for WebAuthN API IDL tests.");
57 </script>