This commit is contained in:
Girish Ramakrishnan
2026-02-17 19:30:33 +01:00
parent 3ef990b0bf
commit 319360f8d0
5 changed files with 68 additions and 101 deletions
+4 -4
View File
@@ -235,7 +235,7 @@ async function destroyUserSession(req, res, next) {
async function getPasskey(req, res, next) {
assert.strictEqual(typeof req.user, 'object');
const [error, result] = await safe(passkeys.list(req.user.id));
const [error, result] = await safe(passkeys.listByUserId(req.user.id));
if (error) return next(BoxError.toHttpError(error));
// Only one passkey per user - return first one or null
@@ -246,7 +246,7 @@ async function getPasskey(req, res, next) {
async function getPasskeyRegistrationOptions(req, res, next) {
assert.strictEqual(typeof req.user, 'object');
const [error, options] = await safe(passkeys.generateRegistrationOptions(req.user));
const [error, options] = await safe(passkeys.getRegistrationOptions(req.user));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, options));
@@ -271,12 +271,12 @@ async function deletePasskey(req, res, next) {
assert.strictEqual(typeof req.user, 'object');
// Get the user's passkey (only one allowed)
const [listError, result] = await safe(passkeys.list(req.user.id));
const [listError, result] = await safe(passkeys.listByUserId(req.user.id));
if (listError) return next(BoxError.toHttpError(listError));
if (result.length === 0) return next(new HttpError(404, 'No passkey registered'));
const [error] = await safe(passkeys.del(result[0].id, req.user.id));
const [error] = await safe(passkeys.del(result[0].id));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(204));