PublicKeyCredential: isUserVerifyingPlatformAuthenticatorAvailable() statische Methode

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.

Sicherer Kontext: Diese Funktion ist nur in sicheren Kontexten (HTTPS) in einigen oder allen unterstützenden Browsern verfügbar.

Die statische Methode isUserVerifyingPlatformAuthenticatorAvailable() der PublicKeyCredential-Schnittstelle gibt ein Promise zurück, das zu true aufgelöst wird, wenn ein Nutzer-verifizierender Plattform-Authenticator vorhanden ist.

Ein Nutzer-verifizierender Plattform-Authenticator ist eine Art Multi-Faktor-Authenticator, der Teil des Client-Geräts ist (in der Regel nicht abnehmbar) und eine Aktion des Nutzers erfordert, um ihn zu identifizieren. Häufige Nutzer-verifizierende Plattform-Authentifikatoren sind:

  • Touch ID oder Face ID (macOS und iOS)
  • Windows Hello (Windows)
  • Gerätesperre (Fingerabdruck, Gesichtserkennung, PIN usw.) auf Android

Hinweis: Diese Methode kann nur in obersten Kontexten verwendet werden und wird beispielsweise in einem <iframe> nicht verfügbar sein.

Syntax

js
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()

Parameter

Keine.

Rückgabewert

Ein Promise, das zu einem booleschen Wert aufgelöst wird, der angibt, ob ein Nutzer-verifizierender Plattform-Authenticator verfügbar ist oder nicht.

Hinweis: In früheren Versionen der Spezifikation drückte der boolesche Wert auch die Zustimmung des Nutzers aus, einen solchen Authenticator offenzulegen.

Beispiele

js
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
  .then((available) => {
    if (available) {
      // We can proceed with the creation of a PublicKeyCredential
      // with this authenticator
    } else {
      // Use another kind of authenticator or a classical login/password
      // workflow
    }
  })
  .catch((err) => {
    // Something went wrong
    console.error(err);
  });

Spezifikationen

Specification
Web Authentication: An API for accessing Public Key Credentials - Level 3
# dom-publickeycredential-isuserverifyingplatformauthenticatoravailable

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
isUserVerifyingPlatformAuthenticatorAvailable() static method

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Has more compatibility info.

Siehe auch