【发布时间】:2022-12-08 06:33:45
【问题描述】:
我试图在我这边实施 Webauthn 并想要 largeBlob 扩展。 Chrome 和 Safari 完全忽略了该选项及其参数。我在 Chromes Webauthn 调试器中创建了一个支持 largeBlob 的模拟验证器,一个不支持,但两者的行为方式完全相同。
这是基本的示例代码,大部分直接取自 w3c 文档:
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Page Title</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
<script>
var publicKey = {
// Here are the extensions (as "inputs")
extensions: {
largeBlob: {
support: "required",
},
},
authenticatorSelection: {
requireResidentKey: true,
},
challenge: new Uint8Array(16) /* from the server */,
rp: {
name: "Example CORP",
id: "localhost"
},
user: {
id: new Uint8Array(16) /* from the server */,
name: "jdoe@example.com",
displayName: "John Doe"
},
pubKeyCredParams: [
{
type: "public-key",
alg: -7
}
]
};
function auth() {
navigator.credentials.create({ publicKey })
.then(function (newCredentialInfo) {
var myBuffer = newCredentialInfo.getClientExtensionResults();
console.log(myBuffer);
// myBuffer will contain the result of any of the processing of the "loc" and "uvi" extensions
}).catch(function (err) {
console.error(err);
});
}
</script>
</head>
<body>
<button onclick="auth()">Auth</button>
</body>
</html>
我将代码分解为最小的可重现示例,在多个浏览器和不同的包装器库中进行了尝试。
根据 official spec,当没有支持 largeBlob 的验证器可用时,该过程应该抛出。相反,它只是继续,创建没有扩展名的凭证,并且不返回 appropriate result
【问题讨论】:
-
我不相信任何主流浏览器目前都支持 largeBlob
-
@蒂姆真的吗?它说 here 它应该在 chrome 的 88 版本中发布,我们现在是 108。
标签: javascript html webauthn