webauthn api の趣味のプロジェクトを作成しようとしています。資格情報を作成するページがあり、(正しく) セキュリティ キーを使用するように求められます。touchid (samsung s9 の場合) または Mac の touchid を使用して資格情報を作成したい (うまくいかないようです)。タッチIDで動作させるために何か特別なことをする必要がありますか?
以下は、資格情報を作成するためのコードです (ドメイン名を変更しました)。
<script type="text/javascript">
let randomStringFromServer = `sdflksdf934mnsdfsdfimlsndfbop1asd239dsfsdfkllkjsdf`;
const publicKeyCredentialCreationOptions = {
challenge: Uint8Array.from(randomStringFromServer, c =>
c.charCodeAt(0)
),
rp: {
name: "Mr Tom",
id: "helloworld.com"
},
user: {
id: Uint8Array.from("UZSL85T9AFC", c => c.charCodeAt(0)),
name: "hello@world.com",
displayName: "MrTom"
},
pubKeyCredParams: [{ alg: -7, type: "public-key" }],
authenticatorSelection: {
authenticatorAttachment: "cross-platform"
},
timeout: 60000,
attestation: "direct"
};
const credential = await navigator.credentials.create({
publicKey: publicKeyCredentialCreationOptions
});
console.log(credential);
</script>