Skip to content

Commit

Permalink
Merge pull request #59 from Baw-Appie/main
Browse files Browse the repository at this point in the history
chore: Refactor signin.ts for improved passkey support
  • Loading branch information
Alex4386 authored Sep 3, 2024
2 parents 959615e + 6df91a1 commit ceab694
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/v1/meiling/signin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,16 @@ please request this endpoint without challengeResponse field to request challeng

const id = Buffer.from(idRaw, 'base64url').toString('base64');

const userIds = targetUsers.filter((n) => n !== undefined).map((n) => (n as UserModel).id);
if (userIds.length === 0 && challengeResponse.response?.userHandle) {
const userHandle = Buffer.from(challengeResponse.response.userHandle, 'base64').toString('utf-8');
userIds.push(userHandle);
}
const webauthn = await getPrismaClient().authentication.findFirst({
where: {
user: {
id: {
in: targetUsers.filter((n) => n !== undefined).map((n) => (n as UserModel).id),
in: userIds,
},
},
method: 'WEBAUTHN',
Expand Down

0 comments on commit ceab694

Please sign in to comment.