getcredential-large-blob-supported.https.html (2997B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>navigator.credentials.get() largeBlob extension tests with authenticator support</title> 4 <meta name="timeout" content="long"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <script src=helpers.js></script> 10 <body></body> 11 <script> 12 standardSetup(async function(authenticator) { 13 "use strict"; 14 15 const credential = createCredential({ 16 options: { 17 publicKey: { 18 authenticatorSelection: { 19 requireResidentKey: true, 20 }, 21 extensions: { 22 largeBlob: { 23 support: "required", 24 }, 25 }, 26 }, 27 }, 28 }); 29 30 promise_test(async t => { 31 const assertion = await navigator.credentials.get({publicKey: { 32 challenge: new Uint8Array(), 33 allowCredentials: [{ 34 id: (await credential).rawId, 35 type: "public-key", 36 }], 37 extensions: { 38 largeBlob: { 39 read: true, 40 }, 41 }, 42 }}); 43 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "supported"); 44 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "blob"); 45 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "written"); 46 }, "navigator.credentials.get() with largeBlob.read set with no blob on authenticator"); 47 48 promise_test(async t => { 49 const blob = new TextEncoder().encode("According to all known laws of aviation, " 50 + "there is no way a bee should be able to fly"); 51 let assertion = await navigator.credentials.get({publicKey: { 52 challenge: new Uint8Array(), 53 allowCredentials: [{ 54 id: (await credential).rawId, 55 type: "public-key", 56 }], 57 extensions: { 58 largeBlob: { 59 write: blob, 60 }, 61 }, 62 }}); 63 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "blob"); 64 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "supported"); 65 assert_true(assertion.getClientExtensionResults().largeBlob.written); 66 67 assertion = await navigator.credentials.get({publicKey: { 68 challenge: new Uint8Array(), 69 allowCredentials: [{ 70 id: (await credential).rawId, 71 type: "public-key", 72 }], 73 extensions: { 74 largeBlob: { 75 read: true, 76 }, 77 }, 78 }}); 79 assert_array_equals(new Uint8Array(assertion.getClientExtensionResults().largeBlob.blob), blob); 80 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "supported"); 81 assert_not_own_property(assertion.getClientExtensionResults().largeBlob, "written"); 82 }, "navigator.credentials.get() read and write blob"); 83 }, { 84 protocol: "ctap2_1", 85 hasResidentKey: true, 86 hasUserVerification: true, 87 extensions: ["largeBlob"], 88 isUserVerified: true, 89 }); 90 </script>