このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

AuthenticatorResponse

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2021年9月⁩.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

AuthenticatorResponseWeb Authentication API のインターフェイスで、キーペアを信頼する暗号化ルートを提供するインターフェイスの基本インターフェイスです。子インターフェイスでは、チャレンジのオリジンなどのブラウザーからの情報を含み、 PublicKeyCredential.response から返されることがあります。

AuthenticatorResponse に基づくインターフェイス

以下のインターフェイスは AuthenticatorResponse インターフェイスに基づいています。

プロパティ

AuthenticatorResponse.clientDataJSON

JSON 文字列が入った ArrayBuffer で、 CredentialsContainer.create() または CredentialsContainer.get() に渡されたクライアントデータを表します。

メソッド

なし。

AuthenticatorAssertionResponse の取得

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

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

AuthenticatorAttestationResponse の取得

js
var publicKey = {
  challenge: /* from 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(function (newCredentialInfo) {
    var attestationResponse = newCredentialInfo.response;
  }).catch(function (err) {
     console.error(err);
  });

仕様書

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

ブラウザーの互換性

関連情報