diff options
author | Matthew Miller <matthew@millerti.me> | 2023-08-30 18:14:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 18:14:59 -0700 |
commit | a106671b4a05eedee6ac925209365c68688e1fad (patch) | |
tree | 3fab7c8134e779e9677c4534e5958dc1dfaea570 /packages/server/src/authentication/verifyAuthenticationResponse.ts | |
parent | 0d9eda359379d8704eeda1995607bbd27de4ebe2 (diff) | |
parent | ab1a3e42dfd14301b278d86a677f73b0cb7cf37a (diff) |
Merge pull request #432 from jordanbtucker/promise
Allow expectedChallenge to return a Promise
Diffstat (limited to 'packages/server/src/authentication/verifyAuthenticationResponse.ts')
-rw-r--r-- | packages/server/src/authentication/verifyAuthenticationResponse.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/server/src/authentication/verifyAuthenticationResponse.ts b/packages/server/src/authentication/verifyAuthenticationResponse.ts index d3c2484..41370a0 100644 --- a/packages/server/src/authentication/verifyAuthenticationResponse.ts +++ b/packages/server/src/authentication/verifyAuthenticationResponse.ts @@ -15,7 +15,7 @@ import { isoBase64URL, isoUint8Array } from '../helpers/iso/index.ts'; export type VerifyAuthenticationResponseOpts = { response: AuthenticationResponseJSON; - expectedChallenge: string | ((challenge: string) => boolean); + expectedChallenge: string | ((challenge: string) => boolean | Promise<boolean>); expectedOrigin: string | string[]; expectedRPID: string | string[]; authenticator: AuthenticatorDevice; @@ -94,7 +94,7 @@ export async function verifyAuthenticationResponse( // Ensure the device provided the challenge we gave it if (typeof expectedChallenge === 'function') { - if (!expectedChallenge(challenge)) { + if (!(await expectedChallenge(challenge))) { throw new Error( `Custom challenge verifier returned false for registration response challenge "${challenge}"`, ); |