mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-02 13:43:06 +00:00
fix: use correct offset when converting commitment to bigint
This commit is contained in:
parent
3dc59084c9
commit
10d463a512
@ -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…
x
Reference in New Issue
Block a user