@waku/rln 0.1.1-5d7f77f → 0.1.1-891ee34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waku/rln",
3
- "version": "0.1.1-5d7f77f",
3
+ "version": "0.1.1-891ee34",
4
4
  "description": "Rate Limit Nullifier for js-waku",
5
5
  "types": "./dist/index.d.ts",
6
6
  "module": "./dist/index.js",
@@ -24,6 +24,7 @@
24
24
  "scripts": {
25
25
  "prepare": "husky install",
26
26
  "build": "run-s build:**",
27
+ "build:codegen": "node ./scripts/schema_validator_codegen.js",
27
28
  "build:tsc": "tsc",
28
29
  "build:bundle": "rollup --config rollup.config.js",
29
30
  "size": "npm run build && size-limit",
@@ -45,7 +46,7 @@
45
46
  "crypto": false
46
47
  },
47
48
  "engines": {
48
- "node": ">=16"
49
+ "node": ">=18"
49
50
  },
50
51
  "publishConfig": {
51
52
  "access": "public",
@@ -59,19 +60,31 @@
59
60
  "@size-limit/preset-big-lib": "^8.0.0",
60
61
  "@types/app-root-path": "^1.2.4",
61
62
  "@types/chai": "^4.2.15",
63
+ "@types/chai-as-promised": "^7.1.6",
62
64
  "@types/chai-spies": "^1.0.3",
65
+ "@types/chai-subset": "^1.3.3",
63
66
  "@types/debug": "^4.1.7",
67
+ "@types/deep-equal-in-any-order": "^1.0.1",
68
+ "@types/lodash": "^4.14.199",
64
69
  "@types/mocha": "^9.1.0",
65
70
  "@types/node": "^17.0.6",
66
71
  "@types/tail": "^2.0.0",
67
72
  "@types/uuid": "^8.3.0",
68
73
  "@typescript-eslint/eslint-plugin": "^5.8.1",
69
74
  "@typescript-eslint/parser": "^5.8.1",
75
+ "@waku/core": "^0.0.18",
76
+ "@waku/interfaces": "^0.0.13",
77
+ "@waku/message-encryption": "^0.0.16",
70
78
  "@web/rollup-plugin-import-meta-assets": "^1.0.7",
79
+ "ajv": "^8.12.0",
80
+ "ajv-formats": "^2.1.1",
71
81
  "app-root-path": "^3.0.0",
72
82
  "chai": "^4.3.4",
83
+ "chai-as-promised": "^7.1.1",
73
84
  "chai-spies": "^1.0.0",
85
+ "chai-subset": "^1.6.0",
74
86
  "cspell": "^5.14.0",
87
+ "deep-equal-in-any-order": "^2.0.6",
75
88
  "eslint": "^8.6.0",
76
89
  "eslint-config-prettier": "^8.3.0",
77
90
  "eslint-plugin-eslint-comments": "^3.2.0",
@@ -83,9 +96,6 @@
83
96
  "husky": "^7.0.4",
84
97
  "ignore-loader": "^0.1.2",
85
98
  "isomorphic-fetch": "^3.0.0",
86
- "@waku/interfaces": "^0.0.13",
87
- "@waku/message-encryption": "^0.0.16",
88
- "@waku/core": "^0.0.18",
89
99
  "jsdom": "^19.0.0",
90
100
  "jsdom-global": "^3.0.2",
91
101
  "karma": "^6.3.12",
@@ -129,8 +139,13 @@
129
139
  ]
130
140
  },
131
141
  "dependencies": {
132
- "@waku/utils": "^0.0.6",
142
+ "@chainsafe/bls-keystore": "^3.0.0",
143
+ "@waku/utils": "^0.0.11",
133
144
  "@waku/zerokit-rln-wasm": "^0.0.10",
134
- "ethers": "^5.7.2"
145
+ "ethereum-cryptography": "^2.1.2",
146
+ "ethers": "^5.7.2",
147
+ "lodash": "^4.17.21",
148
+ "rlnjs": "^3.2.3",
149
+ "uuid": "^9.0.1"
135
150
  }
136
151
  }
package/src/byte_utils.ts CHANGED
@@ -37,3 +37,13 @@ export function writeUIntLE(
37
37
 
38
38
  return buf;
39
39
  }
40
+
41
+ /**
42
+ * Transforms Uint8Array into BigInt
43
+ * @param array: Uint8Array
44
+ * @returns BigInt
45
+ */
46
+ export function buildBigIntFromUint8Array(array: Uint8Array): bigint {
47
+ const dataView = new DataView(array.buffer);
48
+ return dataView.getBigUint64(0, true);
49
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { RLNDecoder, RLNEncoder } from "./codec.js";
2
2
  import { RLN_ABI, SEPOLIA_CONTRACT } from "./constants.js";
3
+ import { Keystore } from "./keystore/index.js";
3
4
  import {
4
5
  IdentityCredential,
5
6
  Proof,
@@ -19,6 +20,7 @@ export async function create(): Promise<RLNInstance> {
19
20
  }
20
21
 
21
22
  export {
23
+ Keystore,
22
24
  RLNInstance,
23
25
  IdentityCredential,
24
26
  Proof,
package/src/rln.ts CHANGED
@@ -2,7 +2,7 @@ import type { IRateLimitProof } from "@waku/interfaces";
2
2
  import { default as init } from "@waku/zerokit-rln-wasm";
3
3
  import * as zerokitRLN from "@waku/zerokit-rln-wasm";
4
4
 
5
- import { writeUIntLE } from "./byte_utils.js";
5
+ import { buildBigIntFromUint8Array, writeUIntLE } from "./byte_utils.js";
6
6
  import { dateToEpoch, epochIntToBytes } from "./epoch.js";
7
7
  import verificationKey from "./resources/verification_key.js";
8
8
  import * as wc from "./witness_calculator.js";
@@ -27,16 +27,6 @@ function concatenate(...input: Uint8Array[]): Uint8Array {
27
27
  return result;
28
28
  }
29
29
 
30
- /**
31
- * Transforms Uint8Array into BigInt
32
- * @param array: Uint8Array
33
- * @returns BigInt
34
- */
35
- function buildBigIntFromUint8Array(array: Uint8Array): bigint {
36
- const dataView = new DataView(array.buffer);
37
- return dataView.getBigUint64(0, true);
38
- }
39
-
40
30
  const stringEncoder = new TextEncoder();
41
31
 
42
32
  const DEPTH = 20;