Skip to content

Allow expectedChallenge to return a Promise #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

jordanbtucker
Copy link
Contributor

This PR allows verifyAuthenticationResponse and verifyRegistrationResponse to accept expectedChallenge properties of their options parameter to be Promise returning functions. This allows code like this:

async function customAsyncVerification(challenge: string): Promise<boolean> {
   ...
}

const isVerified = await verifyAuthenticationResponse({
  ...
  expectedChallenge: customAsyncVerification,
  ...
});

Three tests per verification function have been added:

  1. Checks for Promises that resolve with true.
  2. Checks for Promises that resolve with false.
  3. Checks for Promises that reject.

Fixes #431

Copy link
Owner

@MasterKale MasterKale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @jordanbtucker, thank you for the contribution. This looks good to me.

@MasterKale MasterKale merged commit a106671 into MasterKale:master Aug 31, 2023
@MasterKale MasterKale added this to the v8.1.0 milestone Aug 31, 2023
@jordanbtucker jordanbtucker deleted the promise branch August 31, 2023 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow expectedChallenge to return a promise
2 participants