mirror of https://github.com/waku-org/js-rln.git
fix: use correct offset when converting commitment to bigint (#103)
This commit is contained in:
parent
3dc59084c9
commit
126bce32f7
|
@ -14,7 +14,7 @@ export class IdentityCredential {
|
|||
const idNullifier = memKeys.subarray(32, 64);
|
||||
const idSecretHash = memKeys.subarray(64, 96);
|
||||
const idCommitment = memKeys.subarray(96);
|
||||
const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment);
|
||||
const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment, 96);
|
||||
|
||||
return new IdentityCredential(
|
||||
idTrapdoor,
|
||||
|
|
|
@ -61,9 +61,12 @@ export function writeUIntLE(
|
|||
* @param array: Uint8Array
|
||||
* @returns BigInt
|
||||
*/
|
||||
export function buildBigIntFromUint8Array(array: Uint8Array): bigint {
|
||||
export function buildBigIntFromUint8Array(
|
||||
array: Uint8Array,
|
||||
byteOffset: number = 0
|
||||
): bigint {
|
||||
const dataView = new DataView(array.buffer);
|
||||
return dataView.getBigUint64(0, true);
|
||||
return dataView.getBigUint64(byteOffset, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue