PublicKeyCredentialCreationOptions.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 PublicKeyCredentialCreationOptions 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 fetching operation (navigators.credentials.get()), see PublicKeyCredentialRequestOptions.extensions.

Syntax

extensions = publicKeyCredentialCreationOptions.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 (used during creation with PublicKeyCredentialRequestOptions.extensions) 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 identifierTypeDescription
authnSelArray of BufferSourceAuthenticator selection. Restricts the list of authenticator models which may be used. If no matching authenticator is available, the credential is still generated with another available authenticator.
extsBooleanSupported extensions. If true, the client outputs an array of strings containing the extensions which are supported by the authenticator.
uviBooleanUser 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.
locBooleanLocation. If true, the client outputs a Coordinates object representing the geolocation of the authenticator.
uvmBooleanUser 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.
biometricPerfBoundsObject with two numerical properties: FAR and FRRBiometric authenticator performance bounds. The client must not use any authenticator with false acceptance rate (FAR) and false rejection rate (FRR) below the inputs. The client outputs true if this was taken into account.

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 publicKey = {
  extensions:{
    uvi: true,
    loc: false,
    uvm: false,
    exts: true
  },
  challenge: new Uint8Array(26) /* this actually is given from the server */,
  rp: {
    name: "Example CORP",
    id  : "login.example.com"
  },
  user: {
    id: new Uint8Array(26), /* To be changed for each user */
    name: "jdoe@example.com",
    displayName: "John Doe",
  },
  pubKeyCredParams: [ {
    type: "public-key",
    alg: -7 } ]
};

navigator.credentials.create({ publicKey })
  .then(function (newCredentialInfo) {
    // myBuffer will contain the result of any of the processing of the extensions
    var myBuffer = newCredentialInfo.getClientExtensionResults();

    // send attestation response and client extensions
    // to the server to proceed with the registration
    // of the credential
  }).catch(function (err) {
     console.error(err);
  });

Specifications

SpecificationStatusComment
Web Authentication: An API for accessing Public Key Credentials Level 1
The definition of 'extensions' in that specification.
RecommendationInitial definition.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:106 次

字数:7461

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文