Skip to content

Commit c926647

Browse files
committed
fix: more descriptive error for epoch and id secret params
1 parent cf75ed5 commit c926647

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/rln/src/zerokit.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ export class Zerokit {
9797
epoch = epochIntToBytes(dateToEpoch(epoch));
9898
}
9999

100-
if (epoch.length !== 32) throw new Error("invalid epoch");
101-
if (idSecretHash.length !== 32) throw new Error("invalid id secret hash");
100+
if (epoch.length !== 32)
101+
throw new Error(`Epoch must be 32 bytes, got ${epoch.length}`);
102+
if (idSecretHash.length !== 32)
103+
throw new Error(
104+
`ID secret hash must be 32 bytes, got ${idSecretHash.length}`
105+
);
102106
if (index < 0) throw new Error("index must be >= 0");
103107
if (
104108
rateLimit < RATE_LIMIT_PARAMS.MIN_RATE ||

0 commit comments

Comments
 (0)