| <!DOCTYPE html> |
| <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock hid authenticator.</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="./resources/util.js"></script> |
| <script> |
| promise_test(function(t) { |
| const options = { |
| publicKey: { |
| challenge: asciiToUint8Array("123456"), |
| timeout: 10 |
| } |
| }; |
| |
| if (window.internals) |
| internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } }); |
| return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); |
| }, "PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator."); |
| |
| promise_test(function(t) { |
| const options = { |
| publicKey: { |
| challenge: asciiToUint8Array("123456"), |
| userVerification: "required", |
| timeout: 10 |
| } |
| }; |
| |
| if (window.internals) |
| internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); |
| return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); |
| }, "PublicKeyCredential's [[get]] with unsupported options in a mock hid authenticator."); |
| |
| promise_test(function(t) { |
| const options = { |
| publicKey: { |
| challenge: asciiToUint8Array("123456"), |
| timeout: 10 |
| } |
| }; |
| |
| if (window.internals) |
| internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); |
| return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); |
| }, "PublicKeyCredential's [[get]] with invalid credential in a mock hid authenticator."); |
| |
| promise_test(function(t) { |
| const options = { |
| publicKey: { |
| challenge: asciiToUint8Array("123456"), |
| timeout: 10 |
| } |
| }; |
| |
| if (window.internals) |
| internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); |
| return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); |
| }, "PublicKeyCredential's [[get]] with authenticator downgrade in a mock hid authenticator."); |
| |
| promise_test(function(t) { |
| const options = { |
| publicKey: { |
| challenge: asciiToUint8Array("123456"), |
| extensions: { appid: "" }, |
| timeout: 10 |
| } |
| }; |
| |
| if (window.internals) |
| internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); |
| return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); |
| }, "PublicKeyCredential's [[get]] with authenticator downgrade in a mock hid authenticator. 2"); |
| </script> |