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.
The function that converts a
Uint8Array
tobigint
was using aDataView
to access the underlying buffer representing the credentials generated from zerokit. By accessing the buffer of asubarray
directly without specifying the offset, it reads bytes from the beginning of the buffer, which results in thebigint
representation ofIdTrapdoor
NOTIdCommitment
. 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
.