diff options
| author | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-22 15:13:24 +0000 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-29 10:51:49 +0000 |
| commit | 2ed34859b6d90bffe7c2c6b39668b1dace41c292 (patch) | |
| tree | b528036538acadccc31cd5ea600f05b7f4a39dcb /api/auth/_generateAuthenticationOptions.ts | |
| parent | 19b4835bea200099bae15bc02edd5e4cafa2c46c (diff) | |
Fixes api/auth/_verifyAuthenticationResponse
Diffstat (limited to 'api/auth/_generateAuthenticationOptions.ts')
| -rw-r--r-- | api/auth/_generateAuthenticationOptions.ts | 10 |
1 files changed, 2 insertions, 8 deletions
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; } |
