安全上下文
此特征只可用于
安全上下文
(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. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getClientExtensionResults
|
Chrome
67
|
Edge 18 |
Firefox
60
|
IE No | Opera No | Safari 13 | WebView Android 70 | Chrome Android 70 |
Firefox Android
60
|
Opera Android No | Safari iOS 13.3 | Samsung Internet Android No |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
AuthenticatorAssertionResponse.authenticatorData
which contains the result of the authenticator's extensions processing
PublicKeyCredentialCreationOptions.extensions
which contains the client extensions' input values for the creation of the credential
PublicKeyCredentialRequestOptions.extensions
which contains the client extensions' input values for the retrieval of the credential
PublicKeyCredential
getClientExtensionResults()
isUserVerifyingPlatformAuthenticatorAvailable()