PublicKeyCredentialCreationOptions.authenticatorSelection
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
authenticatorSelection
は PublicKeyCredentialCreationOptions
辞書の任意のプロパティであり、生成操作に使用される認証機器をフィルタリングする条件を指定するオブジェクトです。
構文
authenticatorSelection = publicKeyCredentialCreationOptions.authenticatorSelection
値
以下のプロパティを持つオブジェクトです。
authenticatorAttachment
省略可- 文字列で、 "
platform
" または "cross-platform
" のどちらかです。前者は認証機器がクライアントに接続されており、通常は取り外し不可能であることを示します。後者は機器が異なるプラットフォームをまたがって使用される可能性があることを示します (USB や NFC 端末など)。 requireResidentKey
省略可- 論理値で、認証情報の秘密鍵を認証機器、クライアント、クライアント端末の中に格納する必要があるのか、どうかを示します。既定値は
false
です。 userVerification
省略可- A string qualifying how the user verification should be part of the authentication process. The values may be:
- "
required
": user verification is required, the operation will fail if the response does not have the UV flag (as part of theauthenticatorData
property ofAuthenticatorAttestationResponse.attestationObject
(en-US)) - "
preferred
": user verification is prefered, the operation will not fail if the response does not have the UV flag (as part of theauthenticatorData
property ofAuthenticatorAttestationResponse.attestationObject
(en-US)) - "
discouraged
": user verification should not be employed as to minimize the user interaction during the process.
preferred
". - "
The authenticator used for the creation of the public key credential must comply with the requirements.
Note: See PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
(en-US) which resolves to true
when a user-verifiying platform authenticator is available.
例
var publicKey = {
authenticatorSelection:{
authenticatorAttachment: "cross-platform",
requireResidentKey: true,
userVerification: "required"
},
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) {
// send attestation response and client extensions
// to the server to proceed with the registration
// of the credential
}).catch(function (err) {
console.error(err);
});
仕様書
ブラウザーの互換性
No compatibility data found for api.PublicKeyCredentialCreationOptions.excludeCredentials
.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.
See also
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
(en-US)AuthenticatorAssertionResponse.authenticatorData
(en-US) whose structure contains the UV flag (please note that for the creation operation,AuthenticatorAttestationResponse.attestationObject
(en-US) only contains a CBOR encoded version of this data and does not give an immediate access to the flag).