| <!DOCTYPE html> |
| <title>Web Authentication API: PublicKeyCredential's [[get]] success cases.</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="./resources/util.js"></script> |
| <script> |
| // The following test is specifically tuned for current dummy authenticator. |
| promise_test(function(t) { |
| const options = { |
| publicKey: { |
| challenge: Base64URL.parse("MTIzNDU2"), |
| } |
| }; |
| // A mock assertion return bundle. |
| internals.mockCredentialsMessenger.setAssertionReturnBundle(hexStringToUint8Array('00'), hexStringToUint8Array('01'), hexStringToUint8Array('02'), hexStringToUint8Array('03')); |
| |
| return navigator.credentials.get(options).then(function(credential) { |
| assert_equals(credential.id, 'AA'); |
| assert_equals(credential.type, 'public-key'); |
| assert_equals(bytesToHexString(credential.rawId), '00'); |
| assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.get","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}'); |
| assert_equals(bytesToHexString(credential.response.authenticatorData), '01'); |
| assert_equals(bytesToHexString(credential.response.signature), '02'); |
| assert_equals(bytesToHexString(credential.response.userHandle), '03'); |
| try { |
| assert_throws("NotSupportedError", credential.getClientExtensionResults()); |
| } catch(error) { } |
| }); |
| }, "PublicKeyCredential's [[get]] with minimum options"); |
| </script> |