我嘗試創建一個基本的 webauthn 實作,使用“Web Authentication API”來使用用戶的生物特征。
有一件事我沒有得到,也沒有在網上找到答案,那就是:為什么我會得到一個格式設定為“ packed ”而不是“ fido-u2f ”的證明?我究竟做錯了什么 ?
這是我在用戶要求注冊時回傳給用戶的“挑戰”:
{
challenge: randomBase64URLBuffer(32),
rp: {
name: "Fido"
},
user: {
id: id,
name: username,
displayName: displayName
},
attestation: 'direct',
pubKeyCredParams: [
{ type: "public-key", alg: -7 },
{ type: "public-key", alg: -257 }
]
}
然后在格式化回應客戶端后,我將它navigator.credentials.create({ publicKey })作為 publicKey 傳遞給它。
一旦它被發送回 api 以確認注冊,我將它解碼,cbor.decodeAllSync(myAttestationBuffer)但我得到的只是一個fmt設定為的憑證回應packed。
我是這方面的初學者,所以請隨時糾正我:) 有沒有辦法指定我想要的證明格式?我可能錯過了一些東西......
謝謝你的幫助 !
uj5u.com熱心網友回復:
證明格式取決于您的瀏覽器和身份驗證器支持的內容 - 您不能請求特定格式。
在撰寫本文時,Firefox 101.0.1fido-u2f在與我的 FIDO2 兼容 Yubikey 一起使用時會回傳認證,因為它使用舊的 U2F 協議進行通信。為此, Firefox 在后臺使用https://github.com/mozilla/authenticator-rs。packed相同的密鑰使用 Chrome 102.0.5005.115回傳較新的證明格式。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/491116.html
標籤:javascript 验证 网络认证 菲多 fido-u2f
