PublicKeyCredentialRequestOptions.extensions - Web APIs 编辑
Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
extensions
, an optional property of the PublicKeyCredentialRequestOptions
dictionary, is an object providing the client extensions and their input values.
Extensions are values requesting additional processing by the client and by the authenticator. For instance, extensions may be used for:
- backward compatibility with the legacy FIDO JS API,
- knowing the user verification process,
- etc.
Note: An analogous option exists for the creation operation (navigators.credentials.create()
), see PublicKeyCredentialCreationOptions.extensions
.
Syntax
extensions = publicKeyCredentialRequestOptions.extensions
Value
An object with various keys and values.
Here is the current (as of March 2019) list of potential extensions which may be used during the registration operation.
Warning! As of June 2020, only appid
is supported by Chrome and Edge. Firefox does not seem to support any extension. Also Chrome doesn't plan to support any other extension in future
Extension identifier | Type | Description |
---|---|---|
appid | USVString | FIDO appID. An appID which was used with legacy FIDO JS APIs to identify the current relying party. |
txAuthSimple | USVString | Simple transaction authorization. This text is displayed on a prompt of the authenticator before verifying the user or testing their presence. The client outputs a USVString which is the text as it was displayed (line breaks may have been added). |
txAuthGeneric | An object with two properties:
| Generic transaction authorization. This is used to display an image or some non-textual content on the authenticator before verifying the user or testing their presence. The contentType gives the MIME type of the resource to be displayed while content gives its actual content. The client outputs the hash of the content which was displayed (hashing with the same algorithm which is used for the signature). |
uvi | Boolean | User verification index. If true , the client outputs an ArrayBuffer which contains a value uniquely identifying a user verification data record. In other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. |
loc | Boolean | Location. If true , the client outputs a Coordinates object representing the geolocation of the authenticator. |
uvm | Boolean | User verification method. If true , the client outputs an array of arrays with 3 values containing information about how the user was verified (e.g. fingerprint, pin, pattern), how the key is protected, how the matcher (tool used for the authentication operation) is protected. |
Note: 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 a given extension, that will not cause any failure, the extension will not be processed.
Examples
var options = {
extensions: {
uvm: true,
loc: false,
txAuthSimple: "Could you please verify yourself?"
},
challenge: new Uint8Array([/* bytes sent from the server */])
};
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);
});
Specifications
Specification | Status | Comment |
---|---|---|
Web Authentication: An API for accessing Public Key Credentials Level 1 The definition of 'extensions' in that specification. | Recommendation | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
PublicKeyCredential.getClientExtensionResults()
- The list of all of the extensions defined in the specification
PublicKeyCredentialCreationOptions.extensions
, the analogous option property used when creating a credential
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论