Closed jordanbtucker closed 1 year ago
I do understand that the spec says that challenges should be randomly generated to prevent relay attacks and should "store the challenge temporarily". My use case would be to create a challenge that is a signed JWT that includes a user ID, expiration, and randomly generated nonce, effectively allowing it to be both randomly generated and temporarily stored without hitting the database.
@jordanbtucker This is now available in @simplewebauthn/server@8.1.0 ✌️
Describe the issue
verifyAuthenticationResponse
andverifyRegistrationResponse
allow users to provide a function as the value of theexpectedChallenge
property of theiroptions
parameter. However, this function does not allow for returning a promise, even though bothverifyAuthenticationResponse
andverifyRegistrationResponse
are async.If these functions allowed
expectedChallenge
to return a promise, users could perform async validation ofchallenges
(e.g. the challenge is asynchronously retrieved from the database, or the challenge included a signature that could be verified bycrypto.subtle.verify
in Deno). Currenlty, only sync validation is possible.I recommend changing the signature for
expectedChallenge
inVerifyAuthenticationResponseOpts
andVerifyRegistrationResponseOpts
to be:Then
verifyAuthenticationResponse
andverifyRegistrationResponse
can performawait expectedChallenge(challenge)
if it's a function.