aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js')
-rw-r--r--tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js b/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js
new file mode 100644
index 00000000000..8ca5b99c861
--- /dev/null
+++ b/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js
@@ -0,0 +1,59 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+// META: script=helpers.js
+
+// https://w3c.github.io/webauthn/
+
+'use strict';
+
+promise_test(() => {
+ const execute_test = () => idl_test(
+ ['webauthn'],
+ ['credential-management'],
+ idlArray => {
+ idlArray.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
+ idlArray.add_objects({
+ WebAuthentication: ['navigator.authentication'],
+ PublicKeyCredential: ['cred'],
+ AuthenticatorAssertionResponse: ['assertionResponse']
+ });
+ },
+ 'WebAuthn interfaces.'
+ );
+
+ let challengeBytes = new Uint8Array(16);
+ window.crypto.getRandomValues(challengeBytes);
+
+ return createCredential({
+ options: {
+ publicKey: {
+ timeout: 3000,
+ user: {
+ id: new Uint8Array(16),
+ },
+ }
+ }
+ })
+ .then(cred => {
+ self.cred = cred;
+ return navigator.credentials.get({
+ publicKey: {
+ timeout: 3000,
+ allowCredentials: [{
+ id: cred.rawId,
+ transports: ["usb", "nfc", "ble"],
+ type: "public-key"
+ }],
+ challenge: challengeBytes,
+ }
+ });
+ })
+ .then(assertion => {
+ self.assertionResponse = assertion.response;
+ })
+ .then(execute_test)
+ .catch(reason => {
+ execute_test();
+ return Promise.reject(reason);
+ });
+});