summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/browserSupportsConditionalMediation.ts
blob: e3fbceafc40f63977bfcba11da7056b62fe174fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()
  );
}