From 5cb71428245f8d945f334448e242d07304a64e99 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Mon, 24 Jun 2024 16:06:03 +0200 Subject: [PATCH] fix(api): :bug: patch passkey counter update --- routes/api/webauthn/login/[step].ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/routes/api/webauthn/login/[step].ts b/routes/api/webauthn/login/[step].ts index d5b70bf..2c95765 100644 --- a/routes/api/webauthn/login/[step].ts +++ b/routes/api/webauthn/login/[step].ts @@ -118,8 +118,7 @@ export const handler: SessionHandlers = { } const { newCounter } = authenticationInfo - - passkey.counter = newCounter + const newPasskey = { ...passkey, counter: newCounter } // Update credential store const [credential] = await db.ressource.credential.list( @@ -133,7 +132,7 @@ export const handler: SessionHandlers = { // Save credential to db await db.ressource.credential.set([ - credential.update({ store: passkey }), + credential.update({ store: newPasskey }), ]) // log user