--- title: PublicKeyCredentialCreationOptions.authenticatorSelection slug: Web/API/CredentialsContainer/create tags: - API - Property - PublicKeyCredentialCreationOptions - Reference - Web Authentication API - WebAuthn translation_of: Web/API/PublicKeyCredentialCreationOptions/authenticatorSelection original_slug: Web/API/PublicKeyCredentialCreationOptions/authenticatorSelection ---
authenticatorSelection
は {{domxref("PublicKeyCredentialCreationOptions")}} 辞書の任意のプロパティであり、生成操作に使用される認証機器をフィルタリングする条件を指定するオブジェクトです。
authenticatorSelection = publicKeyCredentialCreationOptions.authenticatorSelection
以下のプロパティを持つオブジェクトです。
authenticatorAttachment
{{optional_inline}}platform
" または "cross-platform
" のどちらかです。前者は認証機器がクライアントに接続されており、通常は取り外し不可能であることを示します。後者は機器が異なるプラットフォームをまたがって使用される可能性があることを示します (USB や NFC 端末など)。requireResidentKey
{{optional_inline}}false
です。userVerification
{{optional_inline}}required
": user verification is required, the operation will fail if the {{domxref("AuthenticatorAttestationResponse","response","",1)}} does not have the UV flag (as part of the authenticatorData
property of {{domxref("AuthenticatorAttestationResponse.attestationObject")}})preferred
": user verification is prefered, the operation will not fail if the {{domxref("AuthenticatorAttestationResponse","response","",1)}} does not have the UV flag (as part of the authenticatorData
property of {{domxref("AuthenticatorAttestationResponse.attestationObject")}})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 {{domxref("PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()")}} 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); });
仕様書 | 状態 | 備考 |
---|---|---|
{{SpecName('WebAuthn','#dom-publickeycredentialcreationoptions-authenticatorselection','authenticatorSelection')}} | {{Spec2('WebAuthn')}} | 初回定義 |
{{Compat("api.PublicKeyCredentialCreationOptions.excludeCredentials")}}