PublicKeyCredentialRequestOptions

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

PublicKeyCredentialRequestOptionsWeb Authentication API の辞書で、 navigator.credentials.get() (en-US) で指定された PublicKeyCredential を読み取るために渡されるオプションを保持します。

プロパティ

PublicKeyCredentialRequestOptions.challenge (en-US)

BufferSource 型で、証明書利用者のサーバーによって生成され、暗号チャレンジとして使用されるものです。この値は認証プロバイダーによって署名され、署名は AuthenticatorAssertionResponse.signature (en-US) の一部として送り返されます。

PublicKeyCredentialRequestOptions.timeout (en-US) 省略可

数値のヒントで、取得操作が完了するまで呼び出し元が待機する時間をミリ秒単位で表します。このヒントは、ブラウザーによって上書きされる場合があります。

PublicKeyCredentialRequestOptions.rpId (en-US) 省略可

USVString で、信頼する利用者の識別子 (例: "login.example.org") を示します。このオプションが指定されていない場合、クライアントは現在のオリジンのドメインを使用します。

PublicKeyCredentialRequestOptions.allowCredentials (en-US) 省略可

Array 型で、取得で利用できる既存の資格情報を制限する資格情報記述子の配列です。

PublicKeyCredentialRequestOptions.userVerification (en-US) 省略可

文字列で、認証プロセスにどのようにユーザー認証を組み込むかを説明します。

PublicKeyCredentialRequestOptions.extensions (en-US) 省略可

複数のクライアント拡張機能の入力を持つオブジェクトです。これらの拡張機能は、追加の処理を要求するために使用されます (例えば、従来の FIDO API 資格情報を処理、認証端末上でのテキストの要求など)。

メソッド

なし。

var options = {
  challenge: new Uint8Array([/* bytes sent from the server */]),
  rpId: "example.com" /* will only work if the current domain
                         is something like foo.example.com */
  userVerification: "preferred",
  timeout: 60000,     // Wait for a minute
  allowCredentials: [
    {
      transports: "usb",
      type: "public-key",
      id: new Uint8Array(26) // actually provided by the server
    },
    {
      transports: "internal",
      type: "public-key",
      id: new Uint8Array(26) // actually provided by the server
    }
  ],
  extensions: {
    uvm: true,  // RP wants to know how the user was verified
    loc: false,
    txAuthSimple: "Could you please verify yourself?"
  }
};

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

仕様書

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

ブラウザーの互換性

BCD tables only load in the browser

関連情報