summaryrefslogtreecommitdiff
path: root/api/auth
diff options
context:
space:
mode:
Diffstat (limited to 'api/auth')
-rw-r--r--api/auth/_generateAuthenticationOptions.ts10
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;
}