summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2024-04-12 14:07:38 -0700
committerGitHub <noreply@github.com>2024-04-12 14:07:38 -0700
commit9340662a8400cadcb73c5f0c5fbb7aa5e4a635c1 (patch)
tree22fdfe6de58508c8351ea80901c33b95f970fa36 /packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts
parent59fde2895d337d46e0b0d978913015a01ed7975b (diff)
parentfe3bf5a9954718b1abe921f79118ac2de32c96dd (diff)
Merge pull request #557 from MasterKale/fix/544-ensure-webauthn-available-autofill-feature-check
fix/544-ensure-webauthn-available-autofill-feature-check
Diffstat (limited to 'packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts')
-rw-r--r--packages/browser/src/helpers/browserSupportsWebAuthnAutofill.ts6
1 files changed, 6 insertions, 0 deletions
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<boolean> {
+ 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