mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-05 23:23:12 +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 idNullifier = memKeys.subarray(32, 64);
|
||||||
const idSecretHash = memKeys.subarray(64, 96);
|
const idSecretHash = memKeys.subarray(64, 96);
|
||||||
const idCommitment = memKeys.subarray(96);
|
const idCommitment = memKeys.subarray(96);
|
||||||
const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment);
|
const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment, 96);
|
||||||
|
|
||||||
return new IdentityCredential(
|
return new IdentityCredential(
|
||||||
idTrapdoor,
|
idTrapdoor,
|
||||||
|
|||||||
@ -61,9 +61,12 @@ export function writeUIntLE(
|
|||||||
* @param array: Uint8Array
|
* @param array: Uint8Array
|
||||||
* @returns BigInt
|
* @returns BigInt
|
||||||
*/
|
*/
|
||||||
export function buildBigIntFromUint8Array(array: Uint8Array): bigint {
|
export function buildBigIntFromUint8Array(
|
||||||
|
array: Uint8Array,
|
||||||
|
byteOffset: number = 0
|
||||||
|
): bigint {
|
||||||
const dataView = new DataView(array.buffer);
|
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