Skip to content
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

fix: use correct offset when converting commitment to bigint #103

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

adklempner
Copy link
Member

The function that converts a Uint8Array to bigint was using a DataView to access the underlying buffer representing the credentials generated from zerokit. By accessing the buffer of a subarray directly without specifying the offset, it reads bytes from the beginning of the buffer, which results in the bigint representation of IdTrapdoor NOT IdCommitment. Applications using the library to generate credentials would end up sending the wrong value to the RLN smart contract.

Fix is to add the correct offset to the DataView.

@adklempner adklempner requested a review from weboko March 22, 2024 03:53
@weboko
Copy link
Contributor

weboko commented Mar 22, 2024

Can you introduce unit test for identity and util function, please? Can be done as follow up, @adklempner

@weboko weboko merged commit 126bce3 into master Mar 22, 2024
4 of 5 checks passed
@weboko weboko deleted the fix/id-commitment-offset branch March 22, 2024 12:11
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