我目前能够使用以下方法创建publicKeyCredentials:
navigator.credentials.create({
challenge: Uint8Array.from('CCCCCCCCCCCCCCCCCCCCCC', c => c.charCodeAt(0)),
rp: {
id,
name: 'rpName'
},
user: {
id: Uint8Array.from('userHandleId', c => c.charCodeAt(0)),
name: 'userName',
displayName: 'DisplayName'
},
pubKeyCredParams: [{alg: -7, type: 'public-key'}],
authenticatorSelection: {
userVerification: 'discouraged',
authenticatorAttachment: 'platform',
requireResidentKey: true, // don't seem to do anything with android-saftynet
residentKey: 'required' // don't seem to do anything with android-saftynet
},
timeout: 60000,
attestation: 'direct'
})然后使用以下方法检索凭据:
navigator.credentials.get({
publicKey: {
challenge: generateChallenge(),
allowCredentials: [{
id: decodeArray(id),
type: 'public-key'
}],
timeout: 60000,
transport: ['internal'],
userVerification: 'discouraged'
},
})这一流程适用于我所有的苹果设备,然而,在安卓上,认证的'fmt‘是’Android‘,似乎不支持userHandles。
有什么格式我可以强制在安卓系统,我可以保存userHandles?还是用publicKeyCredential存储信息的另一种方式,允许我支持用户无名的webauthn流?
编辑:看起来android不支持userHandle。有没有人知道是否有一个支持userHandle的Android身份验证程序流?(除了USB / auth流)
发布于 2022-01-19 17:47:29
认证(具有各种格式,如android-safetynet)和匿名流是两个完全独立的概念。您可以拥有不需要认证(格式为none)的匿名流。
认证允许您验证身份验证器本身--验证者实际上是iPhone、Yubikey还是(非根) Android设备,以及诸如密钥存储方式或指纹扫描仪的假阳性率等属性。有关详细信息,请参阅https://fidoalliance.org/fido-technotes-the-truth-about-attestation/和https://medium.com/webauthnworks/webauthn-fido2-demystifying-attestation-and-mds-efc3b3cb3651
在WebAuthn级别1中,即使用户代理不支持这一点,用户匿名注册(使用requireResidentKey: true)也可以继续进行(参见操作步骤20)。在第2级中,有几件事情发生了变化:
requireResidentKey布尔值被更改为residentKey枚举,但支持向后兼容性,authenticatorMakeCredential操作以返回步骤4中的错误,在编写本报告时,没有用户名的身份验证(带有空的allowCredentials数组)在使用Chrome 97的Android上不受支持。这是一个已知问题有一段时间了。
发布于 2022-01-19 17:12:11
这一流程适用于我所有的苹果设备,然而,在安卓上,认证的'fmt‘是’Android‘,似乎不支持userHandles。
为了澄清这一点,认证语句的格式对身份验证者从userHandle返回navigator.credentials.get()的能力没有影响。根据规范或者不是。
有什么格式我可以强制在安卓系统,我可以保存userHandles?
WebAuthn不为RP (依赖方,即您的服务器)提供任何方法来要求特定的认证格式,所以您要么必须支持它们(为此我非常鼓励您使用使用现有的库),要么选择和拒绝注册您不想支持的声明的凭据。
还是用publicKeyCredential存储信息的另一种方式,允许我支持用户无名的webauthn流?
如果我错了,我会纠正这一点,但我不认为您需要userHandle来实现用户名。您应该能够获取从navigator.credentials.get()获得的凭据ID,并首先将其与已注册凭据列表相匹配,然后从您自己的内部记录中提取相应的用户ID,记录哪个凭据属于哪个用户。
所有这些都可以说,安卓系统上的FIDO2支持有点不稳定。最后,我检查了这个平台上基本上不支持可发现的凭据,这意味着Android设备上的匿名支持目前几乎是不可能的。
https://stackoverflow.com/questions/70773179
复制相似问题