From 555c132fe1f1e475cb170c4e69f98ac61352cbc7 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Fri, 16 Dec 2022 15:15:41 +0100 Subject: [PATCH] [EC-598] feat: transparent passthrough of platform authenticators --- apps/browser/src/content/webauthn/page-script.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/content/webauthn/page-script.ts b/apps/browser/src/content/webauthn/page-script.ts index bc214784069..291bf950884 100644 --- a/apps/browser/src/content/webauthn/page-script.ts +++ b/apps/browser/src/content/webauthn/page-script.ts @@ -14,6 +14,10 @@ const browserCredentials = { const messenger = Messenger.forDOMCommunication(window); navigator.credentials.create = async (options?: CredentialCreationOptions): Promise => { + if (options.publicKey?.authenticatorSelection?.authenticatorAttachment === "platform") { + return await browserCredentials.create(options); + } + const response = await messenger.request({ type: MessageType.CredentialCreationRequest, data: WebauthnUtils.mapCredentialCreationOptions(options, window.location.origin), @@ -45,7 +49,7 @@ navigator.credentials.get = async (options?: CredentialRequestOptions): Promise< } if (response.error && response.error.fallbackRequested) { - return await browserCredentials.create(options); + return await browserCredentials.get(options); } if (response.error) {