Skip to content

Commit

Permalink
test(core): fix failed tests for webauthn (#10281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThangHuuVu committed Mar 11, 2024
1 parent 6cd0fe8 commit 9a5416b
Show file tree
Hide file tree
Showing 2 changed files with 551 additions and 297 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/lib/utils/webauthn-utils.ts
Expand Up @@ -218,7 +218,7 @@ export async function verifyAuthenticate(
!("id" in data) ||
typeof data.id !== "string"
) {
throw new AuthError("Invalid WebAuthn Authentication response.")
throw new AuthError("Invalid WebAuthn Authentication response")
}

// Reset the ID so we smooth out implementation differences
Expand Down Expand Up @@ -335,15 +335,15 @@ export async function verifyRegister(
!("id" in data) ||
typeof data.id !== "string"
) {
throw new AuthError("Invalid WebAuthn Registration response.")
throw new AuthError("Invalid WebAuthn Registration response")
}

// Get challenge from request cookies
const { challenge: expectedChallenge, registerData: user } =
await webauthnChallenge.use(options, request.cookies, resCookies)
if (!user) {
throw new AuthError(
"Missing user registration data in WebAuthn challenge cookie."
"Missing user registration data in WebAuthn challenge cookie"
)
}

Expand All @@ -365,7 +365,7 @@ export async function verifyRegister(
// Make sure the response was verified
if (!verification.verified || !verification.registrationInfo) {
throw new WebAuthnVerificationError(
"WebAuthn registration response could not be verified."
"WebAuthn registration response could not be verified"
)
}

Expand Down

0 comments on commit 9a5416b

Please sign in to comment.