05/18 Enhanced codes and functionalities 11

This commit is contained in:
2026-05-18 22:00:42 -04:00
parent 78a96e092f
commit 6177b72ef8
5 changed files with 54 additions and 9 deletions
+4 -2
View File
@@ -523,9 +523,10 @@ const PasskeyAuth = (() => {
/**
* Register a new passkey for the currently logged-in user.
* Requires an active access_token in sessionStorage (set by vault.js on login).
* @param {string} name User-friendly name for the passkey (e.g. "iPhone 15").
* @param {string} name User-friendly name (e.g. "iPhone 15").
* @param {string} attachment "platform" (default) | "cross-platform"
*/
async function registerPasskey(name) {
async function registerPasskey(name, attachment = "platform") {
if (!window.PublicKeyCredential) {
return { error: 'Passkeys are not supported in this browser.' };
}
@@ -540,6 +541,7 @@ const PasskeyAuth = (() => {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ attachment }),
});
if (!beginRes.ok) {
const d = await beginRes.json().catch(() => ({}));