@waku/rln 0.1.5-ea6daae.0 → 0.1.5-ff0222a.0
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/README.md +5 -0
- package/bundle/_virtual/index2.js +1 -1
- package/bundle/_virtual/utils.js +2 -2
- package/bundle/_virtual/utils2.js +2 -2
- package/bundle/index.js +3 -1
- package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +1 -1
- package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +1 -1
- package/bundle/node_modules/{js-sha3 → @ethersproject/keccak256/node_modules/js-sha3}/src/sha3.js +2 -2
- package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +1 -19
- package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +10 -58
- package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +1 -1
- package/bundle/packages/rln/dist/contract/abi.js +502 -248
- package/bundle/packages/rln/dist/contract/constants.js +4 -4
- package/bundle/packages/rln/dist/contract/rln_contract.js +124 -40
- package/bundle/packages/rln/dist/contract/rln_light_contract.js +477 -0
- package/bundle/packages/rln/dist/identity.js +9 -0
- package/bundle/packages/rln/dist/keystore/cipher.js +3 -3
- package/bundle/packages/rln/dist/keystore/keystore.js +16 -25
- package/bundle/packages/rln/dist/rln.js +8 -8
- package/bundle/packages/rln/dist/rln_light.js +149 -0
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/checksum.js +3 -3
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/cipher.js +4 -4
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/class.js +7 -7
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/functional.js +7 -7
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/index.js +6 -6
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/kdf.js +5 -5
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/password.js +1 -1
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1 -1
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/schema-validation.js +2 -2
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/lib/types.js +1 -1
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +3 -3
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +7 -7
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +3 -3
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +3 -3
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +3 -3
- package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +7 -7
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/_assert.js +1 -1
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/_sha2.js +3 -3
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/_u64.js +1 -1
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/cryptoBrowser.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/esm/_assert.js +43 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/esm/_sha2.js +116 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/esm/hmac.js +79 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/esm/sha256.js +126 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/esm/utils.js +43 -0
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/hmac.js +3 -3
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/pbkdf2.js +4 -4
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/scrypt.js +5 -5
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/sha256.js +3 -3
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/sha512.js +4 -4
- package/bundle/{node_modules/@chainsafe/bls-keystore → packages/rln}/node_modules/@noble/hashes/utils.js +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/codec.test-utils.d.ts +36 -0
- package/dist/codec.test-utils.js +56 -0
- package/dist/codec.test-utils.js.map +1 -0
- package/dist/contract/abi.d.ts +21 -17
- package/dist/contract/abi.js +502 -248
- package/dist/contract/abi.js.map +1 -1
- package/dist/contract/constants.d.ts +23 -19
- package/dist/contract/constants.js +3 -3
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +10 -3
- package/dist/contract/rln_contract.js +124 -40
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/contract/rln_light_contract.d.ts +124 -0
- package/dist/contract/rln_light_contract.js +460 -0
- package/dist/contract/rln_light_contract.js.map +1 -0
- package/dist/contract/test-setup.d.ts +26 -0
- package/dist/contract/test-setup.js +56 -0
- package/dist/contract/test-setup.js.map +1 -0
- package/dist/contract/test-utils.d.ts +39 -0
- package/dist/contract/test-utils.js +118 -0
- package/dist/contract/test-utils.js.map +1 -0
- package/dist/identity.d.ts +1 -0
- package/dist/identity.js +9 -0
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/keystore/keystore.d.ts +0 -1
- package/dist/keystore/keystore.js +15 -24
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/keystore/types.d.ts +2 -1
- package/dist/rln.d.ts +1 -1
- package/dist/rln.js +8 -8
- package/dist/rln.js.map +1 -1
- package/dist/rln_light.d.ts +64 -0
- package/dist/rln_light.js +144 -0
- package/dist/rln_light.js.map +1 -0
- package/package.json +1 -1
- package/src/codec.test-utils.ts +80 -0
- package/src/contract/abi.ts +502 -248
- package/src/contract/constants.ts +3 -3
- package/src/contract/rln_contract.ts +162 -50
- package/src/contract/rln_light_contract.ts +725 -0
- package/src/contract/test-setup.ts +86 -0
- package/src/contract/test-utils.ts +179 -0
- package/src/identity.ts +10 -0
- package/src/index.ts +17 -2
- package/src/keystore/keystore.ts +27 -42
- package/src/keystore/types.ts +2 -1
- package/src/rln.ts +9 -9
- package/src/rln_light.ts +235 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +0 -0
- /package/bundle/{node_modules → packages/rln/node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +0 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import { createRLN } from "./create.js";
|
3
|
+
export const TEST_CONSTANTS = {
|
4
|
+
contentTopic: "/test/1/waku-message/utf8",
|
5
|
+
emptyPubsubTopic: "",
|
6
|
+
defaultIndex: 0,
|
7
|
+
defaultPayload: new Uint8Array([1, 2, 3, 4, 5])
|
8
|
+
};
|
9
|
+
export const EMPTY_PROTO_MESSAGE = {
|
10
|
+
timestamp: undefined,
|
11
|
+
contentTopic: "",
|
12
|
+
ephemeral: undefined,
|
13
|
+
meta: undefined,
|
14
|
+
rateLimitProof: undefined,
|
15
|
+
version: undefined
|
16
|
+
};
|
17
|
+
/**
|
18
|
+
* Creates a basic RLN setup for codec tests
|
19
|
+
*/
|
20
|
+
export async function createTestRLNCodecSetup() {
|
21
|
+
const rlnInstance = await createRLN();
|
22
|
+
const credential = rlnInstance.zerokit.generateIdentityCredentials();
|
23
|
+
rlnInstance.zerokit.insertMember(credential.IDCommitment);
|
24
|
+
return {
|
25
|
+
rlnInstance,
|
26
|
+
credential,
|
27
|
+
index: TEST_CONSTANTS.defaultIndex,
|
28
|
+
payload: TEST_CONSTANTS.defaultPayload
|
29
|
+
};
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Creates a meta setter function for testing
|
33
|
+
*/
|
34
|
+
export function createTestMetaSetter() {
|
35
|
+
return (msg) => {
|
36
|
+
const buffer = new ArrayBuffer(4);
|
37
|
+
const view = new DataView(buffer);
|
38
|
+
view.setUint32(0, msg.payload.length, false);
|
39
|
+
return new Uint8Array(buffer);
|
40
|
+
};
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Verifies common RLN message properties
|
44
|
+
*/
|
45
|
+
export function verifyRLNMessage(msg, payload, contentTopic, version, rlnInstance) {
|
46
|
+
expect(msg.rateLimitProof).to.not.be.undefined;
|
47
|
+
expect(msg.verify([rlnInstance.zerokit.getMerkleRoot()])).to.be.true;
|
48
|
+
expect(msg.verifyNoRoot()).to.be.true;
|
49
|
+
expect(msg.epoch).to.not.be.undefined;
|
50
|
+
expect(msg.epoch).to.be.gt(0);
|
51
|
+
expect(msg.contentTopic).to.eq(contentTopic);
|
52
|
+
expect(msg.msg.version).to.eq(version);
|
53
|
+
expect(msg.payload).to.deep.eq(payload);
|
54
|
+
expect(msg.timestamp).to.not.be.undefined;
|
55
|
+
}
|
56
|
+
//# sourceMappingURL=codec.test-utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"codec.test-utils.js","sourceRoot":"","sources":["../src/codec.test-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY,EAAE,2BAA2B;IACzC,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CACvC,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,EAAE;IAChB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,SAAS;IACf,cAAc,EAAE,SAAS;IACzB,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,MAAM,WAAW,GAAG,MAAM,SAAS,EAAE,CAAC;IACtC,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC;IACrE,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAE1D,OAAO;QACL,WAAW;QACX,UAAU;QACV,KAAK,EAAE,cAAc,CAAC,YAAY;QAClC,OAAO,EAAE,cAAc,CAAC,cAAc;KACvC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAGlC,OAAO,CAAC,GAAwC,EAAc,EAAE;QAC9D,MAAM,M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GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;AAC5C,CAAC"}
|
package/dist/contract/abi.d.ts
CHANGED
@@ -1,42 +1,46 @@
|
|
1
1
|
export declare const RLN_ABI: ({
|
2
|
-
type: string;
|
3
2
|
inputs: never[];
|
4
3
|
stateMutability: string;
|
4
|
+
type: string;
|
5
5
|
name?: undefined;
|
6
|
-
outputs?: undefined;
|
7
6
|
anonymous?: undefined;
|
7
|
+
outputs?: undefined;
|
8
8
|
} | {
|
9
|
-
type: string;
|
10
|
-
name: string;
|
11
9
|
inputs: {
|
10
|
+
internalType: string;
|
12
11
|
name: string;
|
13
12
|
type: string;
|
14
13
|
}[];
|
14
|
+
name: string;
|
15
|
+
type: string;
|
15
16
|
stateMutability?: undefined;
|
16
|
-
outputs?: undefined;
|
17
17
|
anonymous?: undefined;
|
18
|
+
outputs?: undefined;
|
18
19
|
} | {
|
19
|
-
|
20
|
-
name: string;
|
20
|
+
anonymous: boolean;
|
21
21
|
inputs: {
|
22
|
+
indexed: boolean;
|
23
|
+
internalType: string;
|
22
24
|
name: string;
|
23
25
|
type: string;
|
24
26
|
}[];
|
25
|
-
|
27
|
+
name: string;
|
28
|
+
type: string;
|
29
|
+
stateMutability?: undefined;
|
30
|
+
outputs?: undefined;
|
31
|
+
} | {
|
32
|
+
inputs: {
|
33
|
+
internalType: string;
|
26
34
|
name: string;
|
27
35
|
type: string;
|
28
36
|
}[];
|
29
|
-
stateMutability: string;
|
30
|
-
anonymous?: undefined;
|
31
|
-
} | {
|
32
|
-
type: string;
|
33
37
|
name: string;
|
34
|
-
|
38
|
+
outputs: {
|
39
|
+
internalType: string;
|
35
40
|
name: string;
|
36
41
|
type: string;
|
37
|
-
indexed: boolean;
|
38
42
|
}[];
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
stateMutability: string;
|
44
|
+
type: string;
|
45
|
+
anonymous?: undefined;
|
42
46
|
})[];
|