From f1a1ca29708ae33ef068fd9aea7b88dd1171411d Mon Sep 17 00:00:00 2001 From: mhchia Date: Wed, 16 Aug 2023 17:14:32 +0800 Subject: [PATCH 1/3] fix: calculateIdentityCommitment -> calculateIdentitySecret --- src/common.ts | 2 +- src/rln.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.ts b/src/common.ts index 4def8970..c4b5272b 100644 --- a/src/common.ts +++ b/src/common.ts @@ -18,7 +18,7 @@ export const Fq = new ZqField(SNARK_FIELD_SIZE) export const DEFAULT_MERKLE_TREE_DEPTH = 20 -export function calculateIdentityCommitment(identity: Identity): bigint { +export function calculateIdentitySecret(identity: Identity): bigint { return poseidon([ identity.getNullifier(), identity.getTrapdoor(), diff --git a/src/rln.ts b/src/rln.ts index c0ff6866..210d6407 100644 --- a/src/rln.ts +++ b/src/rln.ts @@ -1,6 +1,6 @@ import { Identity } from '@semaphore-protocol/identity' import { VerificationKey } from './types' -import { DEFAULT_MERKLE_TREE_DEPTH, calculateIdentityCommitment, calculateSignalHash } from './common' +import { DEFAULT_MERKLE_TREE_DEPTH, calculateIdentitySecret, calculateSignalHash } from './common' import { IRLNRegistry, ContractRLNRegistry } from './registry' import { MemoryCache, EvaluatedProof, ICache, Status } from './cache' import { IMessageIDCounter, MemoryMessageIDCounter } from './message-id-counter' @@ -349,7 +349,7 @@ export class RLN implements IRLN { } private get identitySecret(): bigint { - return calculateIdentityCommitment(this.identity) + return calculateIdentitySecret(this.identity) } /** From 1db1949695402fc1d0c7d4d01b181be67ce95222 Mon Sep 17 00:00:00 2001 From: mhchia Date: Wed, 16 Aug 2023 17:21:59 +0800 Subject: [PATCH 2/3] feat: expose more helper functions --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index 93f1075a..1db9cc02 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,5 +4,7 @@ export { CachedProof, ICache, MemoryCache, Status } from './cache' export { IMessageIDCounter } from './message-id-counter' export * from './types' +// Expose helpers +export { calculateExternalNullifier, calculateRateCommitment, calculateSignalHash, shamirRecovery } from "./common" export { RLNFullProof, RLNSNARKProof, RLNWitness, RLNPublicSignals, RLNProver, RLNVerifier, WithdrawProver } from './circuit-wrapper' From be430b46c9a039cfe99226ae7943eadf43e4081d Mon Sep 17 00:00:00 2001 From: mhchia Date: Wed, 16 Aug 2023 17:28:42 +0800 Subject: [PATCH 3/3] feat: export more helper functions --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 1db9cc02..9ace515c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,6 @@ export { IMessageIDCounter } from './message-id-counter' export * from './types' // Expose helpers -export { calculateExternalNullifier, calculateRateCommitment, calculateSignalHash, shamirRecovery } from "./common" +export { calculateExternalNullifier, calculateRateCommitment, calculateSignalHash, shamirRecovery } from './common' export { RLNFullProof, RLNSNARKProof, RLNWitness, RLNPublicSignals, RLNProver, RLNVerifier, WithdrawProver } from './circuit-wrapper'