createcredential-extensions.https.html (2019B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>WebAuthn navigator.credentials.create() extensions Tests</title> 4 <meta name="timeout" content="long"> 5 <link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org"> 6 <link rel="help" href="https://w3c.github.io/webauthn/#iface-credential"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 <script src=helpers.js></script> 12 <body></body> 13 <script> 14 standardSetup(function() { 15 "use strict"; 16 17 var dummyExtension = { 18 foo: true, 19 bar: "yup" 20 }; 21 22 // bad extension values 23 new CreateCredentialsTest("options.publicKey.extensions", "hi mom").runTest("Bad extensions: extensions is string", TypeError); 24 25 // phony extensions 26 var randomExtId = {}; 27 randomExtId[createRandomString(64)] = dummyExtension; 28 new CreateCredentialsTest("options.publicKey.extensions", {foo: JSON.stringify(randomExtId)}).runTest("extensions is a nonsensical JSON string"); 29 30 // appid 31 new CreateCredentialsTest("options.publicKey.extensions", {appid: ""}).runTest("empty appid in create request", "NotSupportedError"); 32 new CreateCredentialsTest("options.publicKey.extensions", {appid: null}).runTest("null appid in create request", "NotSupportedError"); 33 new CreateCredentialsTest("options.publicKey.extensions", {appid: "anything"}).runTest("appid in create request", "NotSupportedError"); 34 35 promise_test(async t => { 36 const credential = await createCredential({ 37 options: { 38 publicKey: { 39 extensions: { 40 prf: {}, 41 }, 42 }, 43 }, 44 }); 45 assert_false(credential.getClientExtensionResults().prf.enabled); 46 }, "navigator.credentials.create() with prf requested but no support in authenticator"); 47 }); 48 49 /* JSHINT */ 50 /* globals standardSetup, CreateCredentialsTest, createRandomString */ 51 </script>