From 2ed34859b6d90bffe7c2c6b39668b1dace41c292 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Mon, 22 Jan 2024 15:13:24 +0000 Subject: Fixes api/auth/_verifyAuthenticationResponse --- api/auth/_generateAuthenticationOptions.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'api/auth/_generateAuthenticationOptions.ts') diff --git a/api/auth/_generateAuthenticationOptions.ts b/api/auth/_generateAuthenticationOptions.ts index 562c50a..88237ac 100644 --- a/api/auth/_generateAuthenticationOptions.ts +++ b/api/auth/_generateAuthenticationOptions.ts @@ -25,23 +25,17 @@ export default async function generateAuthenticationOptions(userId: string) { } const userAuthenticators = await getAuthenticators(userId, ['id', 'transports', 'type']); - const textEncoder = new TextEncoder(); const options = await simplewebauthn.generateAuthenticationOptions({ rpID: RELYING_PARTY.id, // Users must use one of the authenticators they've already registered - allowCredentials: userAuthenticators.map((authenticator) => { - return { - ...authenticator, - id: textEncoder.encode(authenticator.id), - }; - }), + allowCredentials: userAuthenticators, userVerification: 'preferred', }); - setCurrentChallenge(userId, options.challenge); + await setCurrentChallenge(userId, options.challenge); return options; } -- cgit v1.2.3