@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.
Files changed (187) hide show
  1. package/bundle/_virtual/utils.js +2 -2
  2. package/bundle/_virtual/utils2.js +2 -2
  3. package/bundle/index.js +6 -1
  4. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/_sha2.js +1 -1
  5. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/hmac.js +1 -1
  6. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/pbkdf2.js +1 -1
  7. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/scrypt.js +1 -1
  8. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha256.js +1 -1
  9. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha512.js +1 -1
  10. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/utils.js +1 -1
  11. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
  12. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
  13. package/bundle/node_modules/@chainsafe/is-ip/lib/is-ip.js +12 -0
  14. package/bundle/node_modules/@chainsafe/is-ip/lib/parse.js +26 -0
  15. package/bundle/node_modules/@chainsafe/is-ip/lib/parser.js +202 -0
  16. package/bundle/node_modules/@multiformats/multiaddr/dist/src/constants.js +43 -0
  17. package/bundle/node_modules/@multiformats/multiaddr/dist/src/errors.js +17 -0
  18. package/bundle/node_modules/@multiformats/multiaddr/dist/src/registry.js +245 -0
  19. package/bundle/node_modules/@multiformats/multiaddr/dist/src/utils.js +191 -0
  20. package/bundle/node_modules/@multiformats/multiaddr/dist/src/validation.js +30 -0
  21. package/bundle/node_modules/@noble/hashes/esm/hmac.js +88 -0
  22. package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
  23. package/bundle/node_modules/@noble/hashes/esm/utils.js +8 -1
  24. package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +517 -255
  25. package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
  26. package/bundle/node_modules/multiformats/dist/src/bases/base10.js +3 -1
  27. package/bundle/node_modules/multiformats/dist/src/bases/base16.js +4 -2
  28. package/bundle/node_modules/multiformats/dist/src/bases/base2.js +3 -1
  29. package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +3 -1
  30. package/bundle/node_modules/multiformats/dist/src/bases/base32.js +11 -9
  31. package/bundle/node_modules/multiformats/dist/src/bases/base36.js +4 -2
  32. package/bundle/node_modules/multiformats/dist/src/bases/base58.js +4 -2
  33. package/bundle/node_modules/multiformats/dist/src/bases/base64.js +6 -4
  34. package/bundle/node_modules/multiformats/dist/src/bases/base8.js +3 -1
  35. package/bundle/node_modules/multiformats/dist/src/bases/identity.js +3 -1
  36. package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
  37. package/bundle/node_modules/multiformats/dist/src/bytes.js +15 -1
  38. package/bundle/node_modules/multiformats/dist/src/cid.js +371 -0
  39. package/bundle/node_modules/multiformats/dist/src/hashes/digest.js +62 -0
  40. package/bundle/node_modules/multiformats/dist/src/varint.js +15 -0
  41. package/bundle/node_modules/multiformats/dist/src/vendor/varint.js +78 -0
  42. package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
  43. package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
  44. package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
  45. package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
  46. package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
  47. package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
  48. package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
  49. package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
  50. package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
  51. package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
  52. package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
  53. package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
  54. package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
  55. package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
  56. package/bundle/node_modules/uint8arrays/dist/src/concat.js +20 -0
  57. package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
  58. package/bundle/node_modules/uint8arrays/dist/src/to-string.js +19 -0
  59. package/bundle/node_modules/uint8arrays/dist/src/util/as-uint8array.js +9 -0
  60. package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
  61. package/bundle/packages/core/dist/lib/connection_manager/connection_limiter.js +18 -0
  62. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +24 -0
  63. package/bundle/packages/core/dist/lib/connection_manager/dialer.js +14 -0
  64. package/bundle/packages/core/dist/lib/connection_manager/discovery_dialer.js +14 -0
  65. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +15 -0
  66. package/bundle/packages/core/dist/lib/connection_manager/shard_reader.js +14 -0
  67. package/bundle/packages/core/dist/lib/filter/filter.js +28 -0
  68. package/bundle/packages/core/dist/lib/light_push/light_push.js +28 -0
  69. package/bundle/packages/core/dist/lib/message/version_0.js +172 -0
  70. package/bundle/packages/core/dist/lib/metadata/metadata.js +28 -0
  71. package/bundle/packages/core/dist/lib/store/store.js +24 -0
  72. package/bundle/packages/interfaces/dist/connection_manager.js +9 -0
  73. package/bundle/packages/interfaces/dist/health_status.js +17 -0
  74. package/bundle/packages/interfaces/dist/protocols.js +92 -0
  75. package/bundle/packages/interfaces/dist/waku.js +7 -0
  76. package/bundle/packages/proto/dist/generated/filter.js +447 -0
  77. package/bundle/packages/proto/dist/generated/filter_v2.js +426 -0
  78. package/bundle/packages/proto/dist/generated/light_push.js +550 -0
  79. package/bundle/packages/proto/dist/generated/message.js +215 -0
  80. package/bundle/packages/proto/dist/generated/metadata.js +132 -0
  81. package/bundle/packages/proto/dist/generated/peer_exchange.js +211 -0
  82. package/bundle/packages/proto/dist/generated/sds_message.js +172 -0
  83. package/bundle/packages/proto/dist/generated/store_v3.js +492 -0
  84. package/bundle/packages/proto/dist/generated/topic_only_message.js +63 -0
  85. package/bundle/packages/rln/dist/codec.js +92 -0
  86. package/bundle/packages/rln/dist/contract/constants.js +14 -7
  87. package/bundle/packages/rln/dist/contract/rln_base_contract.js +2 -1
  88. package/bundle/packages/rln/dist/contract/rln_contract.js +109 -0
  89. package/bundle/packages/rln/dist/credentials_manager.js +45 -4
  90. package/bundle/packages/rln/dist/identity.js +2 -1
  91. package/bundle/packages/rln/dist/keystore/keystore.js +30 -9
  92. package/bundle/packages/rln/dist/message.js +59 -0
  93. package/bundle/packages/rln/dist/proof.js +54 -0
  94. package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
  95. package/bundle/packages/rln/dist/resources/witness_calculator.js +1 -1
  96. package/bundle/packages/rln/dist/rln.js +36 -4
  97. package/bundle/packages/rln/dist/root_tracker.js +76 -0
  98. package/bundle/packages/rln/dist/utils/bytes.js +70 -31
  99. package/bundle/packages/rln/dist/utils/epoch.js +23 -1
  100. package/bundle/packages/rln/dist/utils/hash.js +10 -0
  101. package/bundle/packages/rln/dist/zerokit.js +99 -2
  102. package/bundle/packages/utils/dist/bytes/index.js +31 -0
  103. package/bundle/resources/rln.wasm +0 -0
  104. package/bundle/resources/rln_final.zkey +0 -0
  105. package/bundle/resources/verification_key.d.ts +13 -0
  106. package/bundle/resources/verification_key.js +112 -0
  107. package/bundle/resources/witness_calculator.d.ts +7 -21
  108. package/bundle/resources/witness_calculator.js +1 -1
  109. package/dist/.tsbuildinfo +1 -1
  110. package/dist/codec.d.ts +40 -0
  111. package/dist/codec.js +79 -0
  112. package/dist/codec.js.map +1 -0
  113. package/dist/codec.test-utils.d.ts +37 -0
  114. package/dist/codec.test-utils.js +61 -0
  115. package/dist/codec.test-utils.js.map +1 -0
  116. package/dist/contract/constants.d.ts +10 -3
  117. package/dist/contract/constants.js +13 -6
  118. package/dist/contract/constants.js.map +1 -1
  119. package/dist/contract/index.d.ts +1 -0
  120. package/dist/contract/index.js +1 -0
  121. package/dist/contract/index.js.map +1 -1
  122. package/dist/contract/rln_base_contract.js +2 -1
  123. package/dist/contract/rln_base_contract.js.map +1 -1
  124. package/dist/contract/rln_contract.d.ts +17 -0
  125. package/dist/contract/rln_contract.js +107 -0
  126. package/dist/contract/rln_contract.js.map +1 -0
  127. package/dist/contract/test_setup.d.ts +26 -0
  128. package/dist/contract/test_setup.js +56 -0
  129. package/dist/contract/test_setup.js.map +1 -0
  130. package/dist/contract/test_utils.d.ts +39 -0
  131. package/dist/contract/test_utils.js +118 -0
  132. package/dist/contract/test_utils.js.map +1 -0
  133. package/dist/credentials_manager.d.ts +14 -2
  134. package/dist/credentials_manager.js +45 -4
  135. package/dist/credentials_manager.js.map +1 -1
  136. package/dist/identity.js +2 -1
  137. package/dist/identity.js.map +1 -1
  138. package/dist/index.d.ts +6 -2
  139. package/dist/index.js +6 -2
  140. package/dist/index.js.map +1 -1
  141. package/dist/keystore/keystore.js +30 -9
  142. package/dist/keystore/keystore.js.map +1 -1
  143. package/dist/message.d.ts +19 -0
  144. package/dist/message.js +51 -0
  145. package/dist/message.js.map +1 -0
  146. package/dist/proof.d.ts +21 -0
  147. package/dist/proof.js +50 -0
  148. package/dist/proof.js.map +1 -0
  149. package/dist/resources/rln.wasm +0 -0
  150. package/dist/resources/rln_final.zkey +0 -0
  151. package/dist/resources/verification_key.d.ts +13 -0
  152. package/dist/resources/verification_key.js +112 -0
  153. package/dist/resources/witness_calculator.d.ts +7 -21
  154. package/dist/resources/witness_calculator.js +1 -1
  155. package/dist/rln.d.ts +9 -0
  156. package/dist/rln.js +32 -4
  157. package/dist/rln.js.map +1 -1
  158. package/dist/root_tracker.d.ts +10 -0
  159. package/dist/root_tracker.js +75 -0
  160. package/dist/root_tracker.js.map +1 -0
  161. package/dist/utils/bytes.d.ts +31 -9
  162. package/dist/utils/bytes.js +70 -31
  163. package/dist/utils/bytes.js.map +1 -1
  164. package/dist/zerokit.d.ts +11 -0
  165. package/dist/zerokit.js +97 -1
  166. package/dist/zerokit.js.map +1 -1
  167. package/package.json +1 -1
  168. package/src/codec.test-utils.ts +88 -0
  169. package/src/codec.ts +138 -0
  170. package/src/contract/constants.ts +16 -6
  171. package/src/contract/index.ts +1 -0
  172. package/src/contract/rln_base_contract.ts +2 -1
  173. package/src/contract/rln_contract.ts +147 -0
  174. package/src/contract/test_setup.ts +86 -0
  175. package/src/contract/test_utils.ts +179 -0
  176. package/src/credentials_manager.ts +72 -8
  177. package/src/identity.ts +2 -1
  178. package/src/index.ts +11 -1
  179. package/src/keystore/keystore.ts +32 -9
  180. package/src/message.ts +73 -0
  181. package/src/proof.ts +69 -0
  182. package/src/resources/verification_key.d.ts +13 -0
  183. package/src/resources/witness_calculator.d.ts +7 -21
  184. package/src/rln.ts +65 -5
  185. package/src/root_tracker.ts +92 -0
  186. package/src/utils/bytes.ts +73 -36
  187. package/src/zerokit.ts +217 -1
@@ -0,0 +1,447 @@
1
+ import { MaxLengthError } from '../../../../node_modules/protons-runtime/dist/src/index.js';
2
+ import { alloc } from '../../../../node_modules/uint8arrays/dist/src/alloc.js';
3
+ import { message } from '../../../../node_modules/protons-runtime/dist/src/codecs/message.js';
4
+ import { encodeMessage } from '../../../../node_modules/protons-runtime/dist/src/encode.js';
5
+ import { decodeMessage } from '../../../../node_modules/protons-runtime/dist/src/decode.js';
6
+
7
+ /* eslint-disable import/export */
8
+ /* eslint-disable complexity */
9
+ /* eslint-disable @typescript-eslint/no-namespace */
10
+ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
11
+ /* eslint-disable @typescript-eslint/no-empty-interface */
12
+ /* eslint-disable import/consistent-type-specifier-style */
13
+ /* eslint-disable @typescript-eslint/no-unused-vars */
14
+ var FilterRequest;
15
+ (function (FilterRequest) {
16
+ (function (ContentFilter) {
17
+ let _codec;
18
+ ContentFilter.codec = () => {
19
+ if (_codec == null) {
20
+ _codec = message((obj, w, opts = {}) => {
21
+ if (opts.lengthDelimited !== false) {
22
+ w.fork();
23
+ }
24
+ if ((obj.contentTopic != null && obj.contentTopic !== '')) {
25
+ w.uint32(10);
26
+ w.string(obj.contentTopic);
27
+ }
28
+ if (opts.lengthDelimited !== false) {
29
+ w.ldelim();
30
+ }
31
+ }, (reader, length, opts = {}) => {
32
+ const obj = {
33
+ contentTopic: ''
34
+ };
35
+ const end = length == null ? reader.len : reader.pos + length;
36
+ while (reader.pos < end) {
37
+ const tag = reader.uint32();
38
+ switch (tag >>> 3) {
39
+ case 1: {
40
+ obj.contentTopic = reader.string();
41
+ break;
42
+ }
43
+ default: {
44
+ reader.skipType(tag & 7);
45
+ break;
46
+ }
47
+ }
48
+ }
49
+ return obj;
50
+ });
51
+ }
52
+ return _codec;
53
+ };
54
+ ContentFilter.encode = (obj) => {
55
+ return encodeMessage(obj, ContentFilter.codec());
56
+ };
57
+ ContentFilter.decode = (buf, opts) => {
58
+ return decodeMessage(buf, ContentFilter.codec(), opts);
59
+ };
60
+ })(FilterRequest.ContentFilter || (FilterRequest.ContentFilter = {}));
61
+ let _codec;
62
+ FilterRequest.codec = () => {
63
+ if (_codec == null) {
64
+ _codec = message((obj, w, opts = {}) => {
65
+ if (opts.lengthDelimited !== false) {
66
+ w.fork();
67
+ }
68
+ if ((obj.subscribe != null && obj.subscribe !== false)) {
69
+ w.uint32(8);
70
+ w.bool(obj.subscribe);
71
+ }
72
+ if ((obj.topic != null && obj.topic !== '')) {
73
+ w.uint32(18);
74
+ w.string(obj.topic);
75
+ }
76
+ if (obj.contentFilters != null) {
77
+ for (const value of obj.contentFilters) {
78
+ w.uint32(26);
79
+ FilterRequest.ContentFilter.codec().encode(value, w);
80
+ }
81
+ }
82
+ if (opts.lengthDelimited !== false) {
83
+ w.ldelim();
84
+ }
85
+ }, (reader, length, opts = {}) => {
86
+ const obj = {
87
+ subscribe: false,
88
+ topic: '',
89
+ contentFilters: []
90
+ };
91
+ const end = length == null ? reader.len : reader.pos + length;
92
+ while (reader.pos < end) {
93
+ const tag = reader.uint32();
94
+ switch (tag >>> 3) {
95
+ case 1: {
96
+ obj.subscribe = reader.bool();
97
+ break;
98
+ }
99
+ case 2: {
100
+ obj.topic = reader.string();
101
+ break;
102
+ }
103
+ case 3: {
104
+ if (opts.limits?.contentFilters != null && obj.contentFilters.length === opts.limits.contentFilters) {
105
+ throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');
106
+ }
107
+ obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32(), {
108
+ limits: opts.limits?.contentFilters$
109
+ }));
110
+ break;
111
+ }
112
+ default: {
113
+ reader.skipType(tag & 7);
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ return obj;
119
+ });
120
+ }
121
+ return _codec;
122
+ };
123
+ FilterRequest.encode = (obj) => {
124
+ return encodeMessage(obj, FilterRequest.codec());
125
+ };
126
+ FilterRequest.decode = (buf, opts) => {
127
+ return decodeMessage(buf, FilterRequest.codec(), opts);
128
+ };
129
+ })(FilterRequest || (FilterRequest = {}));
130
+ var MessagePush;
131
+ (function (MessagePush) {
132
+ let _codec;
133
+ MessagePush.codec = () => {
134
+ if (_codec == null) {
135
+ _codec = message((obj, w, opts = {}) => {
136
+ if (opts.lengthDelimited !== false) {
137
+ w.fork();
138
+ }
139
+ if (obj.messages != null) {
140
+ for (const value of obj.messages) {
141
+ w.uint32(10);
142
+ WakuMessage.codec().encode(value, w);
143
+ }
144
+ }
145
+ if (opts.lengthDelimited !== false) {
146
+ w.ldelim();
147
+ }
148
+ }, (reader, length, opts = {}) => {
149
+ const obj = {
150
+ messages: []
151
+ };
152
+ const end = length == null ? reader.len : reader.pos + length;
153
+ while (reader.pos < end) {
154
+ const tag = reader.uint32();
155
+ switch (tag >>> 3) {
156
+ case 1: {
157
+ if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {
158
+ throw new MaxLengthError('Decode error - map field "messages" had too many elements');
159
+ }
160
+ obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32(), {
161
+ limits: opts.limits?.messages$
162
+ }));
163
+ break;
164
+ }
165
+ default: {
166
+ reader.skipType(tag & 7);
167
+ break;
168
+ }
169
+ }
170
+ }
171
+ return obj;
172
+ });
173
+ }
174
+ return _codec;
175
+ };
176
+ MessagePush.encode = (obj) => {
177
+ return encodeMessage(obj, MessagePush.codec());
178
+ };
179
+ MessagePush.decode = (buf, opts) => {
180
+ return decodeMessage(buf, MessagePush.codec(), opts);
181
+ };
182
+ })(MessagePush || (MessagePush = {}));
183
+ var FilterRpc;
184
+ (function (FilterRpc) {
185
+ let _codec;
186
+ FilterRpc.codec = () => {
187
+ if (_codec == null) {
188
+ _codec = message((obj, w, opts = {}) => {
189
+ if (opts.lengthDelimited !== false) {
190
+ w.fork();
191
+ }
192
+ if ((obj.requestId != null && obj.requestId !== '')) {
193
+ w.uint32(10);
194
+ w.string(obj.requestId);
195
+ }
196
+ if (obj.request != null) {
197
+ w.uint32(18);
198
+ FilterRequest.codec().encode(obj.request, w);
199
+ }
200
+ if (obj.push != null) {
201
+ w.uint32(26);
202
+ MessagePush.codec().encode(obj.push, w);
203
+ }
204
+ if (opts.lengthDelimited !== false) {
205
+ w.ldelim();
206
+ }
207
+ }, (reader, length, opts = {}) => {
208
+ const obj = {
209
+ requestId: ''
210
+ };
211
+ const end = length == null ? reader.len : reader.pos + length;
212
+ while (reader.pos < end) {
213
+ const tag = reader.uint32();
214
+ switch (tag >>> 3) {
215
+ case 1: {
216
+ obj.requestId = reader.string();
217
+ break;
218
+ }
219
+ case 2: {
220
+ obj.request = FilterRequest.codec().decode(reader, reader.uint32(), {
221
+ limits: opts.limits?.request
222
+ });
223
+ break;
224
+ }
225
+ case 3: {
226
+ obj.push = MessagePush.codec().decode(reader, reader.uint32(), {
227
+ limits: opts.limits?.push
228
+ });
229
+ break;
230
+ }
231
+ default: {
232
+ reader.skipType(tag & 7);
233
+ break;
234
+ }
235
+ }
236
+ }
237
+ return obj;
238
+ });
239
+ }
240
+ return _codec;
241
+ };
242
+ FilterRpc.encode = (obj) => {
243
+ return encodeMessage(obj, FilterRpc.codec());
244
+ };
245
+ FilterRpc.decode = (buf, opts) => {
246
+ return decodeMessage(buf, FilterRpc.codec(), opts);
247
+ };
248
+ })(FilterRpc || (FilterRpc = {}));
249
+ var RateLimitProof;
250
+ (function (RateLimitProof) {
251
+ let _codec;
252
+ RateLimitProof.codec = () => {
253
+ if (_codec == null) {
254
+ _codec = message((obj, w, opts = {}) => {
255
+ if (opts.lengthDelimited !== false) {
256
+ w.fork();
257
+ }
258
+ if ((obj.proof != null && obj.proof.byteLength > 0)) {
259
+ w.uint32(10);
260
+ w.bytes(obj.proof);
261
+ }
262
+ if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
263
+ w.uint32(18);
264
+ w.bytes(obj.merkleRoot);
265
+ }
266
+ if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
267
+ w.uint32(26);
268
+ w.bytes(obj.epoch);
269
+ }
270
+ if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
271
+ w.uint32(34);
272
+ w.bytes(obj.shareX);
273
+ }
274
+ if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
275
+ w.uint32(42);
276
+ w.bytes(obj.shareY);
277
+ }
278
+ if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
279
+ w.uint32(50);
280
+ w.bytes(obj.nullifier);
281
+ }
282
+ if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
283
+ w.uint32(58);
284
+ w.bytes(obj.rlnIdentifier);
285
+ }
286
+ if (opts.lengthDelimited !== false) {
287
+ w.ldelim();
288
+ }
289
+ }, (reader, length, opts = {}) => {
290
+ const obj = {
291
+ proof: alloc(0),
292
+ merkleRoot: alloc(0),
293
+ epoch: alloc(0),
294
+ shareX: alloc(0),
295
+ shareY: alloc(0),
296
+ nullifier: alloc(0),
297
+ rlnIdentifier: alloc(0)
298
+ };
299
+ const end = length == null ? reader.len : reader.pos + length;
300
+ while (reader.pos < end) {
301
+ const tag = reader.uint32();
302
+ switch (tag >>> 3) {
303
+ case 1: {
304
+ obj.proof = reader.bytes();
305
+ break;
306
+ }
307
+ case 2: {
308
+ obj.merkleRoot = reader.bytes();
309
+ break;
310
+ }
311
+ case 3: {
312
+ obj.epoch = reader.bytes();
313
+ break;
314
+ }
315
+ case 4: {
316
+ obj.shareX = reader.bytes();
317
+ break;
318
+ }
319
+ case 5: {
320
+ obj.shareY = reader.bytes();
321
+ break;
322
+ }
323
+ case 6: {
324
+ obj.nullifier = reader.bytes();
325
+ break;
326
+ }
327
+ case 7: {
328
+ obj.rlnIdentifier = reader.bytes();
329
+ break;
330
+ }
331
+ default: {
332
+ reader.skipType(tag & 7);
333
+ break;
334
+ }
335
+ }
336
+ }
337
+ return obj;
338
+ });
339
+ }
340
+ return _codec;
341
+ };
342
+ RateLimitProof.encode = (obj) => {
343
+ return encodeMessage(obj, RateLimitProof.codec());
344
+ };
345
+ RateLimitProof.decode = (buf, opts) => {
346
+ return decodeMessage(buf, RateLimitProof.codec(), opts);
347
+ };
348
+ })(RateLimitProof || (RateLimitProof = {}));
349
+ var WakuMessage;
350
+ (function (WakuMessage) {
351
+ let _codec;
352
+ WakuMessage.codec = () => {
353
+ if (_codec == null) {
354
+ _codec = message((obj, w, opts = {}) => {
355
+ if (opts.lengthDelimited !== false) {
356
+ w.fork();
357
+ }
358
+ if ((obj.payload != null && obj.payload.byteLength > 0)) {
359
+ w.uint32(10);
360
+ w.bytes(obj.payload);
361
+ }
362
+ if ((obj.contentTopic != null && obj.contentTopic !== '')) {
363
+ w.uint32(18);
364
+ w.string(obj.contentTopic);
365
+ }
366
+ if (obj.version != null) {
367
+ w.uint32(24);
368
+ w.uint32(obj.version);
369
+ }
370
+ if (obj.timestamp != null) {
371
+ w.uint32(80);
372
+ w.sint64(obj.timestamp);
373
+ }
374
+ if (obj.meta != null) {
375
+ w.uint32(90);
376
+ w.bytes(obj.meta);
377
+ }
378
+ if (obj.rateLimitProof != null) {
379
+ w.uint32(170);
380
+ RateLimitProof.codec().encode(obj.rateLimitProof, w);
381
+ }
382
+ if (obj.ephemeral != null) {
383
+ w.uint32(248);
384
+ w.bool(obj.ephemeral);
385
+ }
386
+ if (opts.lengthDelimited !== false) {
387
+ w.ldelim();
388
+ }
389
+ }, (reader, length, opts = {}) => {
390
+ const obj = {
391
+ payload: alloc(0),
392
+ contentTopic: ''
393
+ };
394
+ const end = length == null ? reader.len : reader.pos + length;
395
+ while (reader.pos < end) {
396
+ const tag = reader.uint32();
397
+ switch (tag >>> 3) {
398
+ case 1: {
399
+ obj.payload = reader.bytes();
400
+ break;
401
+ }
402
+ case 2: {
403
+ obj.contentTopic = reader.string();
404
+ break;
405
+ }
406
+ case 3: {
407
+ obj.version = reader.uint32();
408
+ break;
409
+ }
410
+ case 10: {
411
+ obj.timestamp = reader.sint64();
412
+ break;
413
+ }
414
+ case 11: {
415
+ obj.meta = reader.bytes();
416
+ break;
417
+ }
418
+ case 21: {
419
+ obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {
420
+ limits: opts.limits?.rateLimitProof
421
+ });
422
+ break;
423
+ }
424
+ case 31: {
425
+ obj.ephemeral = reader.bool();
426
+ break;
427
+ }
428
+ default: {
429
+ reader.skipType(tag & 7);
430
+ break;
431
+ }
432
+ }
433
+ }
434
+ return obj;
435
+ });
436
+ }
437
+ return _codec;
438
+ };
439
+ WakuMessage.encode = (obj) => {
440
+ return encodeMessage(obj, WakuMessage.codec());
441
+ };
442
+ WakuMessage.decode = (buf, opts) => {
443
+ return decodeMessage(buf, WakuMessage.codec(), opts);
444
+ };
445
+ })(WakuMessage || (WakuMessage = {}));
446
+
447
+ export { FilterRequest, FilterRpc, MessagePush, RateLimitProof, WakuMessage };