1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-05 03:03:26 +00:00

[PM-1722] gracefully fail if site prompts user for passkey on load (#6089)

* added error logic to look for options.mediation in page-script

* moved the options mediation logic into the try catch. changed error to FallbackRequestedError
This commit is contained in:
Jason Ng
2023-09-08 09:28:41 -04:00
committed by GitHub
parent f35b25649a
commit d081cffbd7

View File

@@ -1,3 +1,5 @@
import { FallbackRequestedError } from "@bitwarden/common/vault/abstractions/fido2/fido2-client.service.abstraction";
import { WebauthnUtils } from "../../../browser/webauthn-utils";
import { MessageType } from "./messaging/message";
@@ -95,7 +97,12 @@ navigator.credentials.get = async (
abortController?: AbortController
): Promise<Credential> => {
const fallbackSupported = browserNativeWebauthnSupport;
try {
if (options?.mediation && options.mediation !== "optional") {
throw new FallbackRequestedError();
}
const response = await messenger.request(
{
type: MessageType.CredentialGetRequest,