summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts
blob: 269789cdeddcf88e27a0db0932b64cd06a3ad5c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { browserSupportsWebAuthn } from './browserSupportsWebAuthn';

/**
 * Determine whether the browser can communicate with a built-in authenticator, like
 * Touch ID, Android fingerprint scanner, or Windows Hello.
 *
 * This method will _not_ be able to tell you the name of the platform authenticator.
 */
export function platformAuthenticatorIsAvailable(): Promise<boolean> {
  if (!browserSupportsWebAuthn()) {
    return new Promise((resolve) => resolve(false));
  }

  return PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();
}