chore: passkey perf

This commit is contained in:
xiaojunnuo
2026-03-17 19:16:11 +08:00
parent 6d43623f45
commit 0ddcb9c00a
2 changed files with 29 additions and 19 deletions
@@ -278,20 +278,22 @@ async function doRegisterPasskey(deviceName: string) {
// type: "public-key",
// }));
const credential = await (navigator.credentials as any).create({
publicKey: {
challenge: Uint8Array.from(atob(options.challenge.replace(/-/g, "+").replace(/_/g, "/")), c => c.charCodeAt(0)),
rp: options.rp,
pubKeyCredParams: options.pubKeyCredParams,
timeout: options.timeout || 60000,
attestation: options.attestation,
// excludeCredentials: excludeCredentials,
user: {
id: new TextEncoder().encode(options.userId + ""),
name: userInfo.value.username,
displayName: deviceName,
},
const publicKey = {
challenge: Uint8Array.from(atob(options.challenge.replace(/-/g, "+").replace(/_/g, "/")), c => c.charCodeAt(0)),
rp: options.rp,
pubKeyCredParams: options.pubKeyCredParams,
timeout: options.timeout || 60000,
attestation: options.attestation,
// excludeCredentials: excludeCredentials,
user: {
id: new TextEncoder().encode(options.userId + ""),
name: userInfo.value.username,
displayName: deviceName,
},
};
console.log("passkey register publicKey:", publicKey);
const credential = await (navigator.credentials as any).create({
publicKey,
});
if (!credential) {