From 549b3ef736260f03b17e70d033d6565b40cbbafb Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 12 Apr 2024 14:05:01 -0700 Subject: Ensure Conditional UI has WebAuthn available --- packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts') diff --git a/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts b/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts index 1ac861a..b1312ab 100644 --- a/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts +++ b/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts @@ -1,10 +1,16 @@ import { PublicKeyCredentialFuture } from '@simplewebauthn/types'; +import { browserSupportsWebAuthn } from './browserSupportsWebAuthn'; + /** * Determine if the browser supports conditional UI, so that WebAuthn credentials can * be shown to the user in the browser's typical password autofill popup. */ export function browserSupportsWebAuthnAutofill(): Promise { + if (!browserSupportsWebAuthn()) { + return new Promise((resolve) => resolve(false)); + } + /** * I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in * TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I -- cgit v1.2.3