Add PublicKeyCredential guard for passkey registration
Deploy Dashboard / deploy (push) Successful in 35s

This commit is contained in:
Gan, Jimmy
2026-02-22 11:44:02 +08:00
parent 9683cd3165
commit 888d3e5c49
@@ -40,6 +40,9 @@
passkeyLoading = true; passkeyLoading = true;
passkeyMsg = ""; passkeyErr = ""; passkeyMsg = ""; passkeyErr = "";
try { try {
if (!window.PublicKeyCredential) {
throw new Error("Passkeys are not supported in this browser or context");
}
const opts = await post("/auth/passkey/register/options"); const opts = await post("/auth/passkey/register/options");
opts.challenge = base64urlToBuffer(opts.challenge); opts.challenge = base64urlToBuffer(opts.challenge);
opts.user.id = base64urlToBuffer(opts.user.id); opts.user.id = base64urlToBuffer(opts.user.id);