安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

getClientExtensionResults() is a method of the PublicKeyCredential interface that returns an ArrayBuffer which contains a map between the extensions identifiers and their results after having being processed by the client.

During the creation or fetching of a PublicKeyCredential (respectively via navigator.credentials.create() and navigator.credentials.get() ), it is possible to have "custom" processing by the client for different extensions which are respectively given by PublicKeyCredentialCreationOptions.extensions and PublicKeyCredentialRequestOptions.extensions .

注意: Extensions are optional and different browsers may recognize different extensions. All extensions are optional for the client to process them: if a browser does not know of a given extension, that will not cause any failure.

注意: This method may only be used in top-level contexts and will not be available in an <iframe> 例如。

句法

mapArrayBuffer = publicKeyCredential.getClientExtensionResults()
					

参数

None.

返回值

ArrayBuffer containing the result of the processing of the different extensions by the client. This object contains a map between the extensions' identifiers and their results from the processing.

Warning! As of March 2019, only appId (used during creation with PublicKeyCredentialRequestOptions.extensions ) is supported by Chrome and Edge . Firefox does not seem to support any extension .

范例

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);
  });
					

规范

规范 状态 注释
Web Authentication: An API for accessing Public Key Credentials Level 1
The definition of 'getClientExtensionResults()' in that specification.
推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
getClientExtensionResults Chrome 67
67
65 Disabled
Only supports USB U2F tokens.
Disabled ). To change preferences in Chrome, visit
Edge 18 Firefox 60
60
Only supports USB U2F tokens.
IE No Opera No Safari 13 WebView Android 70 Chrome Android 70 Firefox Android 60
60
Only supports USB U2F tokens.
Opera Android No Safari iOS 13.3 Samsung Internet Android No

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

用户必须明确启用此特征。

用户必须明确启用此特征。

另请参阅

元数据

  • 最后修改:
  1. Web 身份验证 API
  2. PublicKeyCredential
  3. 特性
    1. id
    2. rawId
    3. response
  4. 方法
    1. getClientExtensionResults()
    2. isUserVerifyingPlatformAuthenticatorAvailable()
  5. Related pages for Web Authentication API
    1. AuthenticatorAssertionResponse
    2. AuthenticatorAttestationResponse
    3. AuthenticatorResponse
    4. CredentialsContainer

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1