AuthenticatorResponse

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.

Das AuthenticatorResponse-Interface der Web Authentication API ist das Basis-Interface für Interfaces, die eine kryptografische Vertrauensbasis für ein Schlüsselpaar bereitstellen. Die untergeordneten Schnittstellen enthalten Informationen vom Browser, wie z. B. den Ursprung der Herausforderung, und können entweder von PublicKeyCredential.response zurückgegeben werden.

Auf dem AuthenticatorResponse basierende Schnittstellen

Im Folgenden finden Sie eine Liste von Schnittstellen, die auf dem AuthenticatorResponse-Interface basieren.

Instanzeigenschaften

AuthenticatorResponse.clientDataJSON

Ein JSON-String in einem ArrayBuffer, der die Client-Daten repräsentiert, die an CredentialsContainer.create() oder CredentialsContainer.get() übergeben wurden.

Instanzmethoden

Keine.

Beispiele

Abrufen einer AuthenticatorAssertionResponse

js
const options = {
  challenge: new Uint8Array([
    /* bytes sent from the server */
  ]),
};

navigator.credentials
  .get({ publicKey: options })
  .then((credentialInfoAssertion) => {
    const assertionResponse = credentialInfoAssertion.response;
    // send assertion response back to the server
    // to proceed with the control of the credential
  })
  .catch((err) => console.error(err));

Abrufen einer AuthenticatorAttestationResponse

js
const publicKey = {
  challenge: new Uint8Array([
    21, 31, 105 /* 29 more random bytes generated by the server */,
  ]),
  rp: {
    name: "Example CORP",
    id: "login.example.com",
  },
  user: {
    id: new Uint8Array(16),
    name: "jdoe@example.com",
    displayName: "John Doe",
  },
  pubKeyCredParams: [
    {
      type: "public-key",
      alg: -7,
    },
  ],
};

navigator.credentials
  .create({ publicKey })
  .then((newCredentialInfo) => {
    const attestationResponse = newCredentialInfo.response;
  })
  .catch((err) => console.error(err));

Spezifikationen

Specification
Web Authentication: An API for accessing Public Key Credentials - Level 3
# authenticatorresponse

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
AuthenticatorResponse
clientDataJSON

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