6de3a943504bf4ff9923f7846add87543468d0cd
[WebKit-https.git] / LayoutTests / http / wpt / webauthn / resources / public-key-credential-ip-address.https.html
1 <!DOCTYPE html>
2 <title>Web Authentication API: Invoke PublicKeyCredential in ip addresses.</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script src="util.js"></script>
6 <script>
7     // Default mock configuration. Tests need to override if they need different configuration.
8     if (window.testRunner)
9         testRunner.setWebAuthenticationMockConfiguration({ });
10
11     promise_test(function(t) {
12         const options = {
13             publicKey: {
14                 rp: {
15                     name: "example.com",
16                 },
17                 user: {
18                     name: "John Appleseed",
19                     id: asciiToUint8Array("123456"),
20                     displayName: "John",
21                 },
22                 challenge: asciiToUint8Array("123456"),
23                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
24             }
25         };
26
27         return promiseRejects(t, "SecurityError",
28             navigator.credentials.create(options), "The effective domain of the document is not a valid domain.");
29     }, "PublicKeyCredential's [[create]] with ip addresses.");
30
31     promise_test(t => {
32         const options = {
33             publicKey: {
34                 challenge: asciiToUint8Array("123456")
35             }
36         };
37
38         return promiseRejects(t, "SecurityError",
39             navigator.credentials.get(options), "The effective domain of the document is not a valid domain.");
40     }, "PublicKeyCredential's [[get]] with ip addresses.");
41 </script>