mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-19 00:40:40 +02:00
enhance WebAuthn implementation and error handling.
This commit is contained in:
parent
1559a2a943
commit
bf8078ed66
1 changed files with 3 additions and 3 deletions
|
@ -55,7 +55,7 @@ setInterval(async () => {
|
||||||
|
|
||||||
// Helper functions for challenge management
|
// Helper functions for challenge management
|
||||||
async function storeChallenge(sessionId: string, challenge: string, passkeyName?: string, userId?: string) {
|
async function storeChallenge(sessionId: string, challenge: string, passkeyName?: string, userId?: string) {
|
||||||
const expiresAt = Date.now() + (10 * 60 * 1000); // 10 minutes
|
const expiresAt = Date.now() + (5 * 60 * 1000); // 5 minutes
|
||||||
|
|
||||||
// Delete any existing challenge for this session
|
// Delete any existing challenge for this session
|
||||||
await db.delete(webauthnChallenge).where(eq(webauthnChallenge.sessionId, sessionId));
|
await db.delete(webauthnChallenge).where(eq(webauthnChallenge.sessionId, sessionId));
|
||||||
|
@ -458,7 +458,7 @@ export async function startAuthentication(
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
HttpCode.BAD_REQUEST,
|
HttpCode.BAD_REQUEST,
|
||||||
"No passkeys available for this user"
|
"Invalid credentials"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ export async function verifyAuthentication(
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
HttpCode.BAD_REQUEST,
|
HttpCode.BAD_REQUEST,
|
||||||
"Passkey not found"
|
"We couldn't find this security key. Please make sure you're using a security key that was previously registered with this account. If you're having trouble, try registering a new security key or contact support."
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue