mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-11 02:03:10 +00:00
chore: validate idcommitment against Q
This commit is contained in:
parent
f911bf8cfa
commit
10590dad85
@ -268,7 +268,14 @@ export class RLNCredentialsManager {
|
||||
const idCommitment = sha256(idSecretHash);
|
||||
|
||||
// Convert IDCommitment to BigInt
|
||||
const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment);
|
||||
let idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment);
|
||||
const Q = BigInt(
|
||||
"21888242871839275222246405745257275088548364400416034343698204186575808495617"
|
||||
);
|
||||
if (idCommitmentBigInt >= Q) {
|
||||
log.warn("IDCommitment is greater than Q, truncating");
|
||||
idCommitmentBigInt = idCommitmentBigInt % Q;
|
||||
}
|
||||
|
||||
log.info("Successfully generated identity credential");
|
||||
return new IdentityCredential(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user