@waku/rln 0.1.8-e224c05.0 → 0.1.8-e800af3.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/bundle/_virtual/utils.js +2 -2
- package/bundle/_virtual/utils2.js +2 -2
- package/bundle/index.js +6 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/_sha2.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/hmac.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/pbkdf2.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/scrypt.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha256.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha512.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/utils.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
- package/bundle/node_modules/@chainsafe/is-ip/lib/is-ip.js +12 -0
- package/bundle/node_modules/@chainsafe/is-ip/lib/parse.js +26 -0
- package/bundle/node_modules/@chainsafe/is-ip/lib/parser.js +202 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/constants.js +43 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/errors.js +17 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/registry.js +245 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/utils.js +191 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/validation.js +30 -0
- package/bundle/node_modules/@noble/hashes/esm/hmac.js +88 -0
- package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
- package/bundle/node_modules/@noble/hashes/esm/utils.js +8 -1
- package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +517 -255
- package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base10.js +3 -1
- package/bundle/node_modules/multiformats/dist/src/bases/base16.js +4 -2
- package/bundle/node_modules/multiformats/dist/src/bases/base2.js +3 -1
- package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +3 -1
- package/bundle/node_modules/multiformats/dist/src/bases/base32.js +11 -9
- package/bundle/node_modules/multiformats/dist/src/bases/base36.js +4 -2
- package/bundle/node_modules/multiformats/dist/src/bases/base58.js +4 -2
- package/bundle/node_modules/multiformats/dist/src/bases/base64.js +6 -4
- package/bundle/node_modules/multiformats/dist/src/bases/base8.js +3 -1
- package/bundle/node_modules/multiformats/dist/src/bases/identity.js +3 -1
- package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
- package/bundle/node_modules/multiformats/dist/src/bytes.js +15 -1
- package/bundle/node_modules/multiformats/dist/src/cid.js +371 -0
- package/bundle/node_modules/multiformats/dist/src/hashes/digest.js +62 -0
- package/bundle/node_modules/multiformats/dist/src/varint.js +15 -0
- package/bundle/node_modules/multiformats/dist/src/vendor/varint.js +78 -0
- package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
- package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
- package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
- package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
- package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
- package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
- package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
- package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
- package/bundle/node_modules/uint8arrays/dist/src/concat.js +20 -0
- package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
- package/bundle/node_modules/uint8arrays/dist/src/to-string.js +19 -0
- package/bundle/node_modules/uint8arrays/dist/src/util/as-uint8array.js +9 -0
- package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
- package/bundle/packages/core/dist/lib/connection_manager/connection_limiter.js +18 -0
- package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +24 -0
- package/bundle/packages/core/dist/lib/connection_manager/dialer.js +14 -0
- package/bundle/packages/core/dist/lib/connection_manager/discovery_dialer.js +14 -0
- package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +15 -0
- package/bundle/packages/core/dist/lib/connection_manager/shard_reader.js +14 -0
- package/bundle/packages/core/dist/lib/filter/filter.js +28 -0
- package/bundle/packages/core/dist/lib/light_push/light_push.js +28 -0
- package/bundle/packages/core/dist/lib/message/version_0.js +172 -0
- package/bundle/packages/core/dist/lib/metadata/metadata.js +28 -0
- package/bundle/packages/core/dist/lib/store/store.js +24 -0
- package/bundle/packages/interfaces/dist/connection_manager.js +9 -0
- package/bundle/packages/interfaces/dist/health_status.js +17 -0
- package/bundle/packages/interfaces/dist/protocols.js +92 -0
- package/bundle/packages/interfaces/dist/waku.js +7 -0
- package/bundle/packages/proto/dist/generated/filter.js +447 -0
- package/bundle/packages/proto/dist/generated/filter_v2.js +426 -0
- package/bundle/packages/proto/dist/generated/light_push.js +550 -0
- package/bundle/packages/proto/dist/generated/message.js +215 -0
- package/bundle/packages/proto/dist/generated/metadata.js +132 -0
- package/bundle/packages/proto/dist/generated/peer_exchange.js +211 -0
- package/bundle/packages/proto/dist/generated/sds_message.js +172 -0
- package/bundle/packages/proto/dist/generated/store_v3.js +492 -0
- package/bundle/packages/proto/dist/generated/topic_only_message.js +63 -0
- package/bundle/packages/rln/dist/codec.js +92 -0
- package/bundle/packages/rln/dist/contract/constants.js +14 -7
- package/bundle/packages/rln/dist/contract/rln_base_contract.js +2 -1
- package/bundle/packages/rln/dist/contract/rln_contract.js +109 -0
- package/bundle/packages/rln/dist/credentials_manager.js +45 -4
- package/bundle/packages/rln/dist/identity.js +2 -1
- package/bundle/packages/rln/dist/keystore/keystore.js +30 -9
- package/bundle/packages/rln/dist/message.js +59 -0
- package/bundle/packages/rln/dist/proof.js +54 -0
- package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
- package/bundle/packages/rln/dist/resources/witness_calculator.js +1 -1
- package/bundle/packages/rln/dist/rln.js +36 -4
- package/bundle/packages/rln/dist/root_tracker.js +76 -0
- package/bundle/packages/rln/dist/utils/bytes.js +70 -31
- package/bundle/packages/rln/dist/utils/epoch.js +23 -1
- package/bundle/packages/rln/dist/utils/hash.js +10 -0
- package/bundle/packages/rln/dist/zerokit.js +99 -2
- package/bundle/packages/utils/dist/bytes/index.js +31 -0
- package/bundle/resources/rln.wasm +0 -0
- package/bundle/resources/rln_final.zkey +0 -0
- package/bundle/resources/verification_key.d.ts +13 -0
- package/bundle/resources/verification_key.js +112 -0
- package/bundle/resources/witness_calculator.d.ts +7 -21
- package/bundle/resources/witness_calculator.js +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/codec.d.ts +40 -0
- package/dist/codec.js +79 -0
- package/dist/codec.js.map +1 -0
- package/dist/codec.test-utils.d.ts +37 -0
- package/dist/codec.test-utils.js +61 -0
- package/dist/codec.test-utils.js.map +1 -0
- package/dist/contract/constants.d.ts +10 -3
- package/dist/contract/constants.js +13 -6
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1 -0
- package/dist/contract/index.js.map +1 -1
- package/dist/contract/rln_base_contract.js +2 -1
- package/dist/contract/rln_base_contract.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +17 -0
- package/dist/contract/rln_contract.js +107 -0
- package/dist/contract/rln_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/credentials_manager.d.ts +14 -2
- package/dist/credentials_manager.js +45 -4
- package/dist/credentials_manager.js.map +1 -1
- package/dist/identity.js +2 -1
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/keystore/keystore.js +30 -9
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/message.d.ts +19 -0
- package/dist/message.js +51 -0
- package/dist/message.js.map +1 -0
- package/dist/proof.d.ts +21 -0
- package/dist/proof.js +50 -0
- package/dist/proof.js.map +1 -0
- package/dist/resources/rln.wasm +0 -0
- package/dist/resources/rln_final.zkey +0 -0
- package/dist/resources/verification_key.d.ts +13 -0
- package/dist/resources/verification_key.js +112 -0
- package/dist/resources/witness_calculator.d.ts +7 -21
- package/dist/resources/witness_calculator.js +1 -1
- package/dist/rln.d.ts +9 -0
- package/dist/rln.js +32 -4
- package/dist/rln.js.map +1 -1
- package/dist/root_tracker.d.ts +10 -0
- package/dist/root_tracker.js +75 -0
- package/dist/root_tracker.js.map +1 -0
- package/dist/utils/bytes.d.ts +31 -9
- package/dist/utils/bytes.js +70 -31
- package/dist/utils/bytes.js.map +1 -1
- package/dist/zerokit.d.ts +11 -0
- package/dist/zerokit.js +97 -1
- package/dist/zerokit.js.map +1 -1
- package/package.json +1 -1
- package/src/codec.test-utils.ts +88 -0
- package/src/codec.ts +138 -0
- package/src/contract/constants.ts +16 -6
- package/src/contract/index.ts +1 -0
- package/src/contract/rln_base_contract.ts +2 -1
- package/src/contract/rln_contract.ts +147 -0
- package/src/contract/test_setup.ts +86 -0
- package/src/contract/test_utils.ts +179 -0
- package/src/credentials_manager.ts +72 -8
- package/src/identity.ts +2 -1
- package/src/index.ts +11 -1
- package/src/keystore/keystore.ts +32 -9
- package/src/message.ts +73 -0
- package/src/proof.ts +69 -0
- package/src/resources/verification_key.d.ts +13 -0
- package/src/resources/witness_calculator.d.ts +7 -21
- package/src/rln.ts +65 -5
- package/src/root_tracker.ts +92 -0
- package/src/utils/bytes.ts +73 -36
- package/src/zerokit.ts +217 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
|
2
|
+
import '../../../../interfaces/dist/waku.js';
|
|
3
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
|
4
|
+
import '../../../../interfaces/dist/health_status.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
15
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
16
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
17
|
+
|
|
18
|
+
new Logger("connection-limiter");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
2
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
3
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
12
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
13
|
+
import './connection_limiter.js';
|
|
14
|
+
import './dialer.js';
|
|
15
|
+
import './discovery_dialer.js';
|
|
16
|
+
import './keep_alive_manager.js';
|
|
17
|
+
import '../../../../interfaces/dist/protocols.js';
|
|
18
|
+
import '../../../../interfaces/dist/waku.js';
|
|
19
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
|
20
|
+
import '../../../../interfaces/dist/health_status.js';
|
|
21
|
+
import './shard_reader.js';
|
|
22
|
+
import '../../../../../node_modules/@multiformats/multiaddr/dist/src/registry.js';
|
|
23
|
+
|
|
24
|
+
new Logger("connection-manager");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
2
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
3
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
12
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
13
|
+
|
|
14
|
+
new Logger("dialer");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
2
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
3
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
12
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
13
|
+
|
|
14
|
+
new Logger("discovery-dialer");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
2
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
3
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
12
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
13
|
+
import '../message/version_0.js';
|
|
14
|
+
|
|
15
|
+
new Logger("keep-alive");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
2
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
3
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
12
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
13
|
+
|
|
14
|
+
new Logger("shard-reader");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
|
2
|
+
import '../../../../interfaces/dist/waku.js';
|
|
3
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
|
4
|
+
import '../../../../interfaces/dist/health_status.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
15
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
16
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
17
|
+
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
|
18
|
+
import '../../../../proto/dist/generated/message.js';
|
|
19
|
+
import '../../../../proto/dist/generated/filter.js';
|
|
20
|
+
import '../../../../proto/dist/generated/topic_only_message.js';
|
|
21
|
+
import '../../../../proto/dist/generated/filter_v2.js';
|
|
22
|
+
import '../../../../proto/dist/generated/light_push.js';
|
|
23
|
+
import '../../../../proto/dist/generated/store_v3.js';
|
|
24
|
+
import '../../../../proto/dist/generated/peer_exchange.js';
|
|
25
|
+
import '../../../../proto/dist/generated/metadata.js';
|
|
26
|
+
import '../../../../proto/dist/generated/sds_message.js';
|
|
27
|
+
|
|
28
|
+
new Logger("filter-core");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
|
2
|
+
import '../../../../interfaces/dist/waku.js';
|
|
3
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
|
4
|
+
import '../../../../interfaces/dist/health_status.js';
|
|
5
|
+
import '../../../../proto/dist/generated/message.js';
|
|
6
|
+
import '../../../../proto/dist/generated/filter.js';
|
|
7
|
+
import '../../../../proto/dist/generated/topic_only_message.js';
|
|
8
|
+
import '../../../../proto/dist/generated/filter_v2.js';
|
|
9
|
+
export { PushResponse } from '../../../../proto/dist/generated/light_push.js';
|
|
10
|
+
import '../../../../proto/dist/generated/store_v3.js';
|
|
11
|
+
import '../../../../proto/dist/generated/peer_exchange.js';
|
|
12
|
+
import '../../../../proto/dist/generated/metadata.js';
|
|
13
|
+
import '../../../../proto/dist/generated/sds_message.js';
|
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
15
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
16
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
17
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
18
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
19
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
20
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
21
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
22
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
23
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
24
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
25
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
26
|
+
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
|
27
|
+
|
|
28
|
+
new Logger("light-push");
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { WakuMessage } from '../../../../proto/dist/generated/message.js';
|
|
2
|
+
import '../../../../proto/dist/generated/filter.js';
|
|
3
|
+
import '../../../../proto/dist/generated/topic_only_message.js';
|
|
4
|
+
import '../../../../proto/dist/generated/filter_v2.js';
|
|
5
|
+
import '../../../../proto/dist/generated/light_push.js';
|
|
6
|
+
import '../../../../proto/dist/generated/store_v3.js';
|
|
7
|
+
import '../../../../proto/dist/generated/peer_exchange.js';
|
|
8
|
+
import '../../../../proto/dist/generated/metadata.js';
|
|
9
|
+
import '../../../../proto/dist/generated/sds_message.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
15
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
16
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
17
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
18
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
19
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
20
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
21
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
22
|
+
|
|
23
|
+
const log = new Logger("message:version-0");
|
|
24
|
+
const OneMillion = BigInt(1_000_000);
|
|
25
|
+
const Version = 0;
|
|
26
|
+
class DecodedMessage {
|
|
27
|
+
pubsubTopic;
|
|
28
|
+
proto;
|
|
29
|
+
constructor(pubsubTopic, proto) {
|
|
30
|
+
this.pubsubTopic = pubsubTopic;
|
|
31
|
+
this.proto = proto;
|
|
32
|
+
}
|
|
33
|
+
get ephemeral() {
|
|
34
|
+
return Boolean(this.proto.ephemeral);
|
|
35
|
+
}
|
|
36
|
+
get payload() {
|
|
37
|
+
return this.proto.payload;
|
|
38
|
+
}
|
|
39
|
+
get contentTopic() {
|
|
40
|
+
return this.proto.contentTopic;
|
|
41
|
+
}
|
|
42
|
+
get timestamp() {
|
|
43
|
+
// In the case we receive a value that is bigger than JS's max number,
|
|
44
|
+
// we catch the error and return undefined.
|
|
45
|
+
try {
|
|
46
|
+
if (this.proto.timestamp) {
|
|
47
|
+
// nanoseconds 10^-9 to milliseconds 10^-3
|
|
48
|
+
const timestamp = this.proto.timestamp / OneMillion;
|
|
49
|
+
return new Date(Number(timestamp));
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
get meta() {
|
|
58
|
+
return this.proto.meta;
|
|
59
|
+
}
|
|
60
|
+
get version() {
|
|
61
|
+
// https://rfc.vac.dev/spec/14/
|
|
62
|
+
// > If omitted, the value SHOULD be interpreted as version 0.
|
|
63
|
+
return this.proto.version ?? Version;
|
|
64
|
+
}
|
|
65
|
+
get rateLimitProof() {
|
|
66
|
+
return this.proto.rateLimitProof;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
class Encoder {
|
|
70
|
+
contentTopic;
|
|
71
|
+
ephemeral;
|
|
72
|
+
routingInfo;
|
|
73
|
+
metaSetter;
|
|
74
|
+
constructor(contentTopic, ephemeral = false, routingInfo, metaSetter) {
|
|
75
|
+
this.contentTopic = contentTopic;
|
|
76
|
+
this.ephemeral = ephemeral;
|
|
77
|
+
this.routingInfo = routingInfo;
|
|
78
|
+
this.metaSetter = metaSetter;
|
|
79
|
+
if (!contentTopic || contentTopic === "") {
|
|
80
|
+
throw new Error("Content topic must be specified");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
get pubsubTopic() {
|
|
84
|
+
return this.routingInfo.pubsubTopic;
|
|
85
|
+
}
|
|
86
|
+
async toWire(message) {
|
|
87
|
+
return WakuMessage.encode(await this.toProtoObj(message));
|
|
88
|
+
}
|
|
89
|
+
async toProtoObj(message) {
|
|
90
|
+
const timestamp = message.timestamp ?? new Date();
|
|
91
|
+
const protoMessage = {
|
|
92
|
+
payload: message.payload,
|
|
93
|
+
version: Version,
|
|
94
|
+
contentTopic: this.contentTopic,
|
|
95
|
+
timestamp: BigInt(timestamp.valueOf()) * OneMillion,
|
|
96
|
+
meta: undefined,
|
|
97
|
+
rateLimitProof: message.rateLimitProof,
|
|
98
|
+
ephemeral: this.ephemeral
|
|
99
|
+
};
|
|
100
|
+
if (this.metaSetter) {
|
|
101
|
+
const meta = this.metaSetter(protoMessage);
|
|
102
|
+
return { ...protoMessage, meta };
|
|
103
|
+
}
|
|
104
|
+
return protoMessage;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates an encoder that encode messages without Waku level encryption or signature.
|
|
109
|
+
*
|
|
110
|
+
* An encoder is used to encode messages in the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
|
|
111
|
+
* format to be sent over the Waku network. The resulting encoder can then be
|
|
112
|
+
* pass to { @link @waku/interfaces!ISender.send } to automatically encode outgoing
|
|
113
|
+
* messages.
|
|
114
|
+
*
|
|
115
|
+
* Note that a routing info may be tied to a given content topic, this is not checked by the encoder.
|
|
116
|
+
*/
|
|
117
|
+
function createEncoder({ contentTopic, routingInfo, ephemeral, metaSetter }) {
|
|
118
|
+
return new Encoder(contentTopic, ephemeral, routingInfo, metaSetter);
|
|
119
|
+
}
|
|
120
|
+
class Decoder {
|
|
121
|
+
contentTopic;
|
|
122
|
+
routingInfo;
|
|
123
|
+
constructor(contentTopic, routingInfo) {
|
|
124
|
+
this.contentTopic = contentTopic;
|
|
125
|
+
this.routingInfo = routingInfo;
|
|
126
|
+
if (!contentTopic || contentTopic === "") {
|
|
127
|
+
throw new Error("Content topic must be specified");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
get pubsubTopic() {
|
|
131
|
+
return this.routingInfo.pubsubTopic;
|
|
132
|
+
}
|
|
133
|
+
fromWireToProtoObj(bytes) {
|
|
134
|
+
const protoMessage = WakuMessage.decode(bytes);
|
|
135
|
+
return Promise.resolve({
|
|
136
|
+
payload: protoMessage.payload,
|
|
137
|
+
contentTopic: protoMessage.contentTopic,
|
|
138
|
+
version: protoMessage.version ?? undefined,
|
|
139
|
+
timestamp: protoMessage.timestamp ?? undefined,
|
|
140
|
+
meta: protoMessage.meta ?? undefined,
|
|
141
|
+
rateLimitProof: protoMessage.rateLimitProof ?? undefined,
|
|
142
|
+
ephemeral: protoMessage.ephemeral ?? false
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async fromProtoObj(pubsubTopic, proto) {
|
|
146
|
+
// https://rfc.vac.dev/spec/14/
|
|
147
|
+
// > If omitted, the value SHOULD be interpreted as version 0.
|
|
148
|
+
if (proto.version ?? 0 !== Version) {
|
|
149
|
+
log.error("Failed to decode due to incorrect version, expected:", Version, ", actual:", proto.version);
|
|
150
|
+
return Promise.resolve(undefined);
|
|
151
|
+
}
|
|
152
|
+
return new DecodedMessage(pubsubTopic, proto);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Creates a decoder that decode messages without Waku level encryption.
|
|
157
|
+
*
|
|
158
|
+
* A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
|
|
159
|
+
* format when received from the Waku network. The resulting decoder can then be
|
|
160
|
+
* pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decode incoming
|
|
161
|
+
* messages.
|
|
162
|
+
*
|
|
163
|
+
* @param contentTopic The resulting decoder will only decode messages with this content topic.
|
|
164
|
+
* @param routingInfo Routing information such as cluster id and shard id on which the message is expected to be received.
|
|
165
|
+
*
|
|
166
|
+
* Note that a routing info may be tied to a given content topic, this is not checked by the encoder.
|
|
167
|
+
*/
|
|
168
|
+
function createDecoder(contentTopic, routingInfo) {
|
|
169
|
+
return new Decoder(contentTopic, routingInfo);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { DecodedMessage, Decoder, Encoder, Version, createDecoder, createEncoder };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
|
2
|
+
import '../../../../interfaces/dist/waku.js';
|
|
3
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
|
4
|
+
import '../../../../interfaces/dist/health_status.js';
|
|
5
|
+
import '../../../../proto/dist/generated/message.js';
|
|
6
|
+
import '../../../../proto/dist/generated/filter.js';
|
|
7
|
+
import '../../../../proto/dist/generated/topic_only_message.js';
|
|
8
|
+
import '../../../../proto/dist/generated/filter_v2.js';
|
|
9
|
+
import '../../../../proto/dist/generated/light_push.js';
|
|
10
|
+
import '../../../../proto/dist/generated/store_v3.js';
|
|
11
|
+
import '../../../../proto/dist/generated/peer_exchange.js';
|
|
12
|
+
import '../../../../proto/dist/generated/metadata.js';
|
|
13
|
+
import '../../../../proto/dist/generated/sds_message.js';
|
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
15
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
16
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
17
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
18
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
19
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
20
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
21
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
22
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
23
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
24
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
25
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
26
|
+
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
|
27
|
+
|
|
28
|
+
new Logger("metadata");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
|
2
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
|
3
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
|
12
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
|
13
|
+
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
|
14
|
+
import '../../../../proto/dist/generated/message.js';
|
|
15
|
+
import '../../../../proto/dist/generated/filter.js';
|
|
16
|
+
import '../../../../proto/dist/generated/topic_only_message.js';
|
|
17
|
+
import '../../../../proto/dist/generated/filter_v2.js';
|
|
18
|
+
import '../../../../proto/dist/generated/light_push.js';
|
|
19
|
+
import '../../../../proto/dist/generated/store_v3.js';
|
|
20
|
+
import '../../../../proto/dist/generated/peer_exchange.js';
|
|
21
|
+
import '../../../../proto/dist/generated/metadata.js';
|
|
22
|
+
import '../../../../proto/dist/generated/sds_message.js';
|
|
23
|
+
|
|
24
|
+
new Logger("store");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var HealthStatus;
|
|
2
|
+
(function (HealthStatus) {
|
|
3
|
+
/**
|
|
4
|
+
* No peer connections
|
|
5
|
+
*/
|
|
6
|
+
HealthStatus["Unhealthy"] = "Unhealthy";
|
|
7
|
+
/**
|
|
8
|
+
* At least 1 peer supporting both Filter and LightPush protocols
|
|
9
|
+
*/
|
|
10
|
+
HealthStatus["MinimallyHealthy"] = "MinimallyHealthy";
|
|
11
|
+
/**
|
|
12
|
+
* At least 2 peers supporting both Filter and LightPush protocols
|
|
13
|
+
*/
|
|
14
|
+
HealthStatus["SufficientlyHealthy"] = "SufficientlyHealthy";
|
|
15
|
+
})(HealthStatus || (HealthStatus = {}));
|
|
16
|
+
|
|
17
|
+
export { HealthStatus };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var Protocols;
|
|
2
|
+
(function (Protocols) {
|
|
3
|
+
Protocols["Relay"] = "relay";
|
|
4
|
+
Protocols["Store"] = "store";
|
|
5
|
+
Protocols["LightPush"] = "lightpush";
|
|
6
|
+
Protocols["Filter"] = "filter";
|
|
7
|
+
})(Protocols || (Protocols = {}));
|
|
8
|
+
var ProtocolError;
|
|
9
|
+
(function (ProtocolError) {
|
|
10
|
+
//
|
|
11
|
+
// GENERAL ERRORS SECTION
|
|
12
|
+
//
|
|
13
|
+
/**
|
|
14
|
+
* Could not determine the origin of the fault. Best to check connectivity and try again
|
|
15
|
+
* */
|
|
16
|
+
ProtocolError["GENERIC_FAIL"] = "Generic error";
|
|
17
|
+
/**
|
|
18
|
+
* The remote peer rejected the message. Information provided by the remote peer
|
|
19
|
+
* is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`
|
|
20
|
+
* or `DECODE_FAILED` can be used.
|
|
21
|
+
*/
|
|
22
|
+
ProtocolError["REMOTE_PEER_REJECTED"] = "Remote peer rejected";
|
|
23
|
+
/**
|
|
24
|
+
* Failure to protobuf decode the message. May be due to a remote peer issue,
|
|
25
|
+
* ensuring that messages are sent via several peer enable mitigation of this error.
|
|
26
|
+
*/
|
|
27
|
+
ProtocolError["DECODE_FAILED"] = "Failed to decode";
|
|
28
|
+
/**
|
|
29
|
+
* Failure to find a peer with suitable protocols. This may due to a connection issue.
|
|
30
|
+
* Mitigation can be: retrying after a given time period, display connectivity issue
|
|
31
|
+
* to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`
|
|
32
|
+
* on the connection manager before retrying.
|
|
33
|
+
*/
|
|
34
|
+
ProtocolError["NO_PEER_AVAILABLE"] = "No peer available";
|
|
35
|
+
/**
|
|
36
|
+
* Failure to find a stream to the peer. This may be because the connection with the peer is not still alive.
|
|
37
|
+
* Mitigation can be: retrying after a given time period, or mitigation for `NO_PEER_AVAILABLE` can be used.
|
|
38
|
+
*/
|
|
39
|
+
ProtocolError["NO_STREAM_AVAILABLE"] = "No stream available";
|
|
40
|
+
/**
|
|
41
|
+
* The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`
|
|
42
|
+
* or `DECODE_FAILED` can be used.
|
|
43
|
+
*/
|
|
44
|
+
ProtocolError["NO_RESPONSE"] = "No response received";
|
|
45
|
+
//
|
|
46
|
+
// SEND ERRORS SECTION
|
|
47
|
+
//
|
|
48
|
+
/**
|
|
49
|
+
* Failure to protobuf encode the message. This is not recoverable and needs
|
|
50
|
+
* further investigation.
|
|
51
|
+
*/
|
|
52
|
+
ProtocolError["ENCODE_FAILED"] = "Failed to encode";
|
|
53
|
+
/**
|
|
54
|
+
* The message payload is empty, making the message invalid. Ensure that a non-empty
|
|
55
|
+
* payload is set on the outgoing message.
|
|
56
|
+
*/
|
|
57
|
+
ProtocolError["EMPTY_PAYLOAD"] = "Payload is empty";
|
|
58
|
+
/**
|
|
59
|
+
* The message size is above the maximum message size allowed on the Waku Network.
|
|
60
|
+
* Compressing the message or using an alternative strategy for large messages is recommended.
|
|
61
|
+
*/
|
|
62
|
+
ProtocolError["SIZE_TOO_BIG"] = "Size is too big";
|
|
63
|
+
/**
|
|
64
|
+
* The PubsubTopic passed to the send function is not configured on the Waku node.
|
|
65
|
+
* Please ensure that the PubsubTopic is used when initializing the Waku node.
|
|
66
|
+
*/
|
|
67
|
+
ProtocolError["TOPIC_NOT_CONFIGURED"] = "Topic not configured";
|
|
68
|
+
/**
|
|
69
|
+
* Fails when
|
|
70
|
+
*/
|
|
71
|
+
ProtocolError["STREAM_ABORTED"] = "Stream aborted";
|
|
72
|
+
/**
|
|
73
|
+
* General proof generation error message.
|
|
74
|
+
* nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L201C19-L201C42
|
|
75
|
+
*/
|
|
76
|
+
ProtocolError["RLN_PROOF_GENERATION"] = "Proof generation failed";
|
|
77
|
+
//
|
|
78
|
+
// RECEIVE ERRORS SECTION
|
|
79
|
+
//
|
|
80
|
+
/**
|
|
81
|
+
* The pubsub topic configured on the decoder does not match the pubsub topic setup on the protocol.
|
|
82
|
+
* Ensure that the pubsub topic used for decoder creation is the same as the one used for protocol.
|
|
83
|
+
*/
|
|
84
|
+
ProtocolError["TOPIC_DECODER_MISMATCH"] = "Topic decoder mismatch";
|
|
85
|
+
/**
|
|
86
|
+
* The topics passed in the decoders do not match each other, or don't exist at all.
|
|
87
|
+
* Ensure that all the pubsub topics used in the decoders are valid and match each other.
|
|
88
|
+
*/
|
|
89
|
+
ProtocolError["INVALID_DECODER_TOPICS"] = "Invalid decoder topics";
|
|
90
|
+
})(ProtocolError || (ProtocolError = {}));
|
|
91
|
+
|
|
92
|
+
export { ProtocolError, Protocols };
|