diff options
author | Matthew Miller <matthew@millerti.me> | 2022-06-17 22:46:03 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2022-06-17 22:46:03 -0700 |
commit | 0c62c20f32514079e904f2925d73bf46d670cf20 (patch) | |
tree | b6a4c27f8523686b84c1ea6e5adbc82172750b2f /packages/browser/src/helpers | |
parent | d11de5a7240cd81739d6f3deae25ec9966cde90c (diff) |
Configure options for conditional UI
Diffstat (limited to 'packages/browser/src/helpers')
-rw-r--r-- | packages/browser/src/helpers/browserSupportsConditionalMediation.ts | 15 |
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() + ); +} |