05/18 Enhanced codes and functionalities 11
This commit is contained in:
@@ -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(() => ({}));
|
||||
|
||||
Reference in New Issue
Block a user