getcredential-attachment.https.html (2657B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <meta name="timeout" content="long"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <script src=helpers.js></script> 9 <body></body> 10 <script> 11 "use strict"; 12 // usb transport 13 virtualAuthenticatorPromiseTest(async function() { 14 const assertion = await navigator.credentials.get({publicKey: { 15 challenge: new Uint8Array(), 16 allowCredentials: [{ 17 id: (await createCredential()).rawId, 18 type: "public-key", 19 }], 20 }}); 21 assert_equals(assertion.authenticatorAttachment, "cross-platform"); 22 }, { 23 protocol: "ctap2", 24 transport: "usb" 25 }, "navigator.credentials.get() with usb authenticator, attachment as cross-platform"); 26 27 // ble transport 28 virtualAuthenticatorPromiseTest(async function() { 29 const assertion = await navigator.credentials.get({publicKey: { 30 challenge: new Uint8Array(), 31 allowCredentials: [{ 32 id: (await createCredential()).rawId, 33 type: "public-key", 34 }], 35 }}); 36 assert_equals(assertion.authenticatorAttachment, "cross-platform"); 37 }, { 38 protocol: "ctap2", 39 transport: "ble" 40 }, "navigator.credentials.get() with ble authenticator, attachment as cross-platform"); 41 42 // nfc transport 43 virtualAuthenticatorPromiseTest(async function() { 44 const assertion = await navigator.credentials.get({publicKey: { 45 challenge: new Uint8Array(), 46 allowCredentials: [{ 47 id: (await createCredential()).rawId, 48 type: "public-key", 49 }], 50 }}); 51 assert_equals(assertion.authenticatorAttachment, "cross-platform"); 52 }, { 53 protocol: "ctap2", 54 transport: "nfc" 55 }, "navigator.credentials.get() with nfc authenticator, attachment as cross-platform"); 56 57 // internal transport 58 virtualAuthenticatorPromiseTest(async function() { 59 const assertion = await navigator.credentials.get({publicKey: { 60 challenge: new Uint8Array(), 61 allowCredentials: [{ 62 id: (await createCredential()).rawId, 63 type: "public-key", 64 }], 65 }}); 66 assert_equals(assertion.authenticatorAttachment, "platform"); 67 }, { 68 protocol: "ctap2", 69 transport: "internal" 70 }, "navigator.credentials.get() with internal authenticator, attachment as platform"); 71 </script>