summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'packages/browser/src/helpers')
-rw-r--r--packages/browser/src/helpers/browserSupportsConditionalMediation.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/browserSupportsConditionalMediation.ts b/packages/browser/src/helpers/browserSupportsConditionalMediation.ts
new file mode 100644
index 0000000..e3fbcea
--- /dev/null
+++ b/packages/browser/src/helpers/browserSupportsConditionalMediation.ts
@@ -0,0 +1,15 @@
+/* eslint-disable @typescript-eslint/ban-ts-comment */
+export async function browserSupportsWebAuthnAutofill(): Promise<boolean> {
+ // Just for Chrome Canary right now; the PublicKeyCredential logic below is the real API
+ // @ts-ignore
+ if (navigator.credentials.conditionalMediationSupported) {
+ return true;
+ }
+
+ return (
+ // @ts-ignore
+ PublicKeyCredential.isConditionalMediationAvailable
+ // @ts-ignore
+ && PublicKeyCredential.isConditionalMediationAvailable()
+ );
+}