Open
Conversation
ilya-korotya
requested changes
Mar 17, 2026
Contributor
ilya-korotya
left a comment
There was a problem hiding this comment.
The solution will not work:
- Access to the database is concurrent. Therefore, if a user sends multiple requests at the same time, race conditions may occur. It is essential that the verification and update operations are performed as part of a single transaction
- It’s also very complex code for such a simple example
- You can still use memory storage just add async-mutex to show sequential access to verifications
added 2 commits
March 18, 2026 14:07
Contributor
There was a problem hiding this comment.
it should be simple example. remove logs
| logger.logVerification(sessionId, 'success', authResponse.from); | ||
| logger.logRequest(req, res, Date.now() - startTime); | ||
|
|
||
| return res.status(200).set("Content-Type", "application/json").send(authResponse); |
Contributor
There was a problem hiding this comment.
Verification callback should return status 200 only
Contributor
There was a problem hiding this comment.
This is very complex code. You are making a lot of assumptions: body size, cors, etc. Keep the file as simple as possible, as each team has their own tools for logging, cors, query validation. Our goal in this example is to show integration with our stack, not how to write a production solution.
|
|
||
| module.exports = { | ||
| async claimNullifier(nullifierHash) { | ||
| const release = await nullifierMutex.acquire(); |
Contributor
There was a problem hiding this comment.
Nice, but left comment why we have the mutex here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added database configuration for anti-replay checks