PublicKeyCredential.getClientExtensionResults()
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) でのみ利用できます。
getClientExtensionResults()
は PublicKeyCredential
インターフェイスのメソッドであり、 ArrayBuffer
の形で拡張機能の識別子と、クライアントが処理した後の結果の対応表を返します。
PublicKeyCredential
の生成または読み出し中 (それぞれ navigator.credentials.create()
および navigator.credentials.get()
で実施) に、それぞれ PublicKeyCredentialCreationOptions.extensions
および PublicKeyCredentialRequestOptions.extensions
によって与えられる別々の拡張機能のために、クライアントが処理する「専用の」処理を持つことができます。
メモ: 拡張機能はオプションであり、ブラウザーによって認識する拡張機能は異なります。すべての拡張機能はクライアントが処理することはオプションです。ブラウザーが指定された拡張機能を知らない場合、失敗としてはいけません。
メモ: このプロパティは最上位のコンテキストでしか使えない可能性があり、例えば <iframe>
の中では利用できません。
構文
mapArrayBuffer = publicKeyCredential.getClientExtensionResults()
引数
なし。
返値
ArrayBuffer
の形で、クライアントが様々な拡張機能を処理した結果です。拡張子の識別子と、クライアントが処理した後の結果の対応表を返します。このオブジェクトには拡張機能の識別子と処理の結果の対応表が入っています。
警告: 2019 年 3 月時点で、 appId
(PublicKeyCredentialRequestOptions.extensions
の生成の間に使用される) のみ、 Chrome および Edge が対応しています。 Firefox はどの拡張機能にも対応していないようです。
例
var publicKey = { // Here are the extensions (as "inputs") extensions: { loc: true, // This extension has been defined to include location information in attestation uvi: true, // user verification index: how the user was verified }, challenge: new Uint8Array(16) /* from the server */, rp: { name: "Example CORP", id: "login.example.com", }, user: { id: new Uint8Array(16) /* from the server */, name: "jdoe@example.com", displayName: "John Doe", }, pubKeyCredParams: [ { type: "public-key", alg: -7, }, ], }; navigator.credentials .create({ publicKey }) .then(function (newCredentialInfo) { var myBuffer = newCredentialInfo.getClientExtensionResults(); // myBuffer will contain the result of any of the processing of the "loc" and "uvi" extensions }) .catch(function (err) { console.error(err); });
仕様書
Specification |
---|
Web Authentication: An API for accessing Public Key Credentials - Level 3> # dom-publickeycredential-getclientextensionresults> |
ブラウザーの互換性
Loading…
関連情報
- 現在定義されている拡張機能の一覧
AuthenticatorAssertionResponse.authenticatorData
: 認証者の実行処理の結果が入るPublicKeyCredentialCreationOptions.extensions
: 認証情報を作成するためのクライアント拡張機能の入力値が入るPublicKeyCredentialRequestOptions.extensions
: 認証情報を受け取るクライアント拡張機能の入力値が入る