Skip to content

rework-add-db#7

Open
Nityam573 wants to merge 3 commits intomainfrom
fix/database-integration
Open

rework-add-db#7
Nityam573 wants to merge 3 commits intomainfrom
fix/database-integration

Conversation

@Nityam573
Copy link

Added database configuration for anti-replay checks

Copy link
Contributor

@ilya-korotya ilya-korotya left a comment

Choose a reason for hiding this comment

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

The solution will not work:

  1. 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
  2. It’s also very complex code for such a simple example
  3. You can still use memory storage just add async-mutex to show sequential access to verifications

@Nityam573 Nityam573 removed the request for review from 0xpulkit March 17, 2026 09:36
Nityam Tripathi added 2 commits March 18, 2026 14:07
Copy link
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Verification callback should return status 200 only

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

delete it


module.exports = {
async claimNullifier(nullifierHash) {
const release = await nullifierMutex.acquire();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, but left comment why we have the mutex here.

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.

2 participants