@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,426 @@
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 { enumeration } from '../../../../node_modules/protons-runtime/dist/src/codecs/enum.js';
4
+ import { message } from '../../../../node_modules/protons-runtime/dist/src/codecs/message.js';
5
+ import { encodeMessage } from '../../../../node_modules/protons-runtime/dist/src/encode.js';
6
+ import { decodeMessage } from '../../../../node_modules/protons-runtime/dist/src/decode.js';
7
+
8
+ /* eslint-disable import/export */
9
+ /* eslint-disable complexity */
10
+ /* eslint-disable @typescript-eslint/no-namespace */
11
+ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
12
+ /* eslint-disable @typescript-eslint/no-empty-interface */
13
+ /* eslint-disable import/consistent-type-specifier-style */
14
+ /* eslint-disable @typescript-eslint/no-unused-vars */
15
+ var FilterSubscribeRequest;
16
+ (function (FilterSubscribeRequest) {
17
+ let FilterSubscribeType;
18
+ (function (FilterSubscribeType) {
19
+ FilterSubscribeType["SUBSCRIBER_PING"] = "SUBSCRIBER_PING";
20
+ FilterSubscribeType["SUBSCRIBE"] = "SUBSCRIBE";
21
+ FilterSubscribeType["UNSUBSCRIBE"] = "UNSUBSCRIBE";
22
+ FilterSubscribeType["UNSUBSCRIBE_ALL"] = "UNSUBSCRIBE_ALL";
23
+ })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));
24
+ let __FilterSubscribeTypeValues;
25
+ (function (__FilterSubscribeTypeValues) {
26
+ __FilterSubscribeTypeValues[__FilterSubscribeTypeValues["SUBSCRIBER_PING"] = 0] = "SUBSCRIBER_PING";
27
+ __FilterSubscribeTypeValues[__FilterSubscribeTypeValues["SUBSCRIBE"] = 1] = "SUBSCRIBE";
28
+ __FilterSubscribeTypeValues[__FilterSubscribeTypeValues["UNSUBSCRIBE"] = 2] = "UNSUBSCRIBE";
29
+ __FilterSubscribeTypeValues[__FilterSubscribeTypeValues["UNSUBSCRIBE_ALL"] = 3] = "UNSUBSCRIBE_ALL";
30
+ })(__FilterSubscribeTypeValues || (__FilterSubscribeTypeValues = {}));
31
+ (function (FilterSubscribeType) {
32
+ FilterSubscribeType.codec = () => {
33
+ return enumeration(__FilterSubscribeTypeValues);
34
+ };
35
+ })(FilterSubscribeType = FilterSubscribeRequest.FilterSubscribeType || (FilterSubscribeRequest.FilterSubscribeType = {}));
36
+ let _codec;
37
+ FilterSubscribeRequest.codec = () => {
38
+ if (_codec == null) {
39
+ _codec = message((obj, w, opts = {}) => {
40
+ if (opts.lengthDelimited !== false) {
41
+ w.fork();
42
+ }
43
+ if ((obj.requestId != null && obj.requestId !== '')) {
44
+ w.uint32(10);
45
+ w.string(obj.requestId);
46
+ }
47
+ if (obj.filterSubscribeType != null && __FilterSubscribeTypeValues[obj.filterSubscribeType] !== 0) {
48
+ w.uint32(16);
49
+ FilterSubscribeRequest.FilterSubscribeType.codec().encode(obj.filterSubscribeType, w);
50
+ }
51
+ if (obj.pubsubTopic != null) {
52
+ w.uint32(82);
53
+ w.string(obj.pubsubTopic);
54
+ }
55
+ if (obj.contentTopics != null) {
56
+ for (const value of obj.contentTopics) {
57
+ w.uint32(90);
58
+ w.string(value);
59
+ }
60
+ }
61
+ if (opts.lengthDelimited !== false) {
62
+ w.ldelim();
63
+ }
64
+ }, (reader, length, opts = {}) => {
65
+ const obj = {
66
+ requestId: '',
67
+ filterSubscribeType: FilterSubscribeType.SUBSCRIBER_PING,
68
+ contentTopics: []
69
+ };
70
+ const end = length == null ? reader.len : reader.pos + length;
71
+ while (reader.pos < end) {
72
+ const tag = reader.uint32();
73
+ switch (tag >>> 3) {
74
+ case 1: {
75
+ obj.requestId = reader.string();
76
+ break;
77
+ }
78
+ case 2: {
79
+ obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader);
80
+ break;
81
+ }
82
+ case 10: {
83
+ obj.pubsubTopic = reader.string();
84
+ break;
85
+ }
86
+ case 11: {
87
+ if (opts.limits?.contentTopics != null && obj.contentTopics.length === opts.limits.contentTopics) {
88
+ throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');
89
+ }
90
+ obj.contentTopics.push(reader.string());
91
+ break;
92
+ }
93
+ default: {
94
+ reader.skipType(tag & 7);
95
+ break;
96
+ }
97
+ }
98
+ }
99
+ return obj;
100
+ });
101
+ }
102
+ return _codec;
103
+ };
104
+ FilterSubscribeRequest.encode = (obj) => {
105
+ return encodeMessage(obj, FilterSubscribeRequest.codec());
106
+ };
107
+ FilterSubscribeRequest.decode = (buf, opts) => {
108
+ return decodeMessage(buf, FilterSubscribeRequest.codec(), opts);
109
+ };
110
+ })(FilterSubscribeRequest || (FilterSubscribeRequest = {}));
111
+ var FilterSubscribeResponse$1;
112
+ (function (FilterSubscribeResponse) {
113
+ let _codec;
114
+ FilterSubscribeResponse.codec = () => {
115
+ if (_codec == null) {
116
+ _codec = message((obj, w, opts = {}) => {
117
+ if (opts.lengthDelimited !== false) {
118
+ w.fork();
119
+ }
120
+ if ((obj.requestId != null && obj.requestId !== '')) {
121
+ w.uint32(10);
122
+ w.string(obj.requestId);
123
+ }
124
+ if ((obj.statusCode != null && obj.statusCode !== 0)) {
125
+ w.uint32(80);
126
+ w.uint32(obj.statusCode);
127
+ }
128
+ if (obj.statusDesc != null) {
129
+ w.uint32(90);
130
+ w.string(obj.statusDesc);
131
+ }
132
+ if (opts.lengthDelimited !== false) {
133
+ w.ldelim();
134
+ }
135
+ }, (reader, length, opts = {}) => {
136
+ const obj = {
137
+ requestId: '',
138
+ statusCode: 0
139
+ };
140
+ const end = length == null ? reader.len : reader.pos + length;
141
+ while (reader.pos < end) {
142
+ const tag = reader.uint32();
143
+ switch (tag >>> 3) {
144
+ case 1: {
145
+ obj.requestId = reader.string();
146
+ break;
147
+ }
148
+ case 10: {
149
+ obj.statusCode = reader.uint32();
150
+ break;
151
+ }
152
+ case 11: {
153
+ obj.statusDesc = reader.string();
154
+ break;
155
+ }
156
+ default: {
157
+ reader.skipType(tag & 7);
158
+ break;
159
+ }
160
+ }
161
+ }
162
+ return obj;
163
+ });
164
+ }
165
+ return _codec;
166
+ };
167
+ FilterSubscribeResponse.encode = (obj) => {
168
+ return encodeMessage(obj, FilterSubscribeResponse.codec());
169
+ };
170
+ FilterSubscribeResponse.decode = (buf, opts) => {
171
+ return decodeMessage(buf, FilterSubscribeResponse.codec(), opts);
172
+ };
173
+ })(FilterSubscribeResponse$1 || (FilterSubscribeResponse$1 = {}));
174
+ var MessagePush;
175
+ (function (MessagePush) {
176
+ let _codec;
177
+ MessagePush.codec = () => {
178
+ if (_codec == null) {
179
+ _codec = message((obj, w, opts = {}) => {
180
+ if (opts.lengthDelimited !== false) {
181
+ w.fork();
182
+ }
183
+ if (obj.wakuMessage != null) {
184
+ w.uint32(10);
185
+ WakuMessage.codec().encode(obj.wakuMessage, w);
186
+ }
187
+ if (obj.pubsubTopic != null) {
188
+ w.uint32(18);
189
+ w.string(obj.pubsubTopic);
190
+ }
191
+ if (opts.lengthDelimited !== false) {
192
+ w.ldelim();
193
+ }
194
+ }, (reader, length, opts = {}) => {
195
+ const obj = {};
196
+ const end = length == null ? reader.len : reader.pos + length;
197
+ while (reader.pos < end) {
198
+ const tag = reader.uint32();
199
+ switch (tag >>> 3) {
200
+ case 1: {
201
+ obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32(), {
202
+ limits: opts.limits?.wakuMessage
203
+ });
204
+ break;
205
+ }
206
+ case 2: {
207
+ obj.pubsubTopic = reader.string();
208
+ break;
209
+ }
210
+ default: {
211
+ reader.skipType(tag & 7);
212
+ break;
213
+ }
214
+ }
215
+ }
216
+ return obj;
217
+ });
218
+ }
219
+ return _codec;
220
+ };
221
+ MessagePush.encode = (obj) => {
222
+ return encodeMessage(obj, MessagePush.codec());
223
+ };
224
+ MessagePush.decode = (buf, opts) => {
225
+ return decodeMessage(buf, MessagePush.codec(), opts);
226
+ };
227
+ })(MessagePush || (MessagePush = {}));
228
+ var RateLimitProof;
229
+ (function (RateLimitProof) {
230
+ let _codec;
231
+ RateLimitProof.codec = () => {
232
+ if (_codec == null) {
233
+ _codec = message((obj, w, opts = {}) => {
234
+ if (opts.lengthDelimited !== false) {
235
+ w.fork();
236
+ }
237
+ if ((obj.proof != null && obj.proof.byteLength > 0)) {
238
+ w.uint32(10);
239
+ w.bytes(obj.proof);
240
+ }
241
+ if ((obj.merkleRoot != null && obj.merkleRoot.byteLength > 0)) {
242
+ w.uint32(18);
243
+ w.bytes(obj.merkleRoot);
244
+ }
245
+ if ((obj.epoch != null && obj.epoch.byteLength > 0)) {
246
+ w.uint32(26);
247
+ w.bytes(obj.epoch);
248
+ }
249
+ if ((obj.shareX != null && obj.shareX.byteLength > 0)) {
250
+ w.uint32(34);
251
+ w.bytes(obj.shareX);
252
+ }
253
+ if ((obj.shareY != null && obj.shareY.byteLength > 0)) {
254
+ w.uint32(42);
255
+ w.bytes(obj.shareY);
256
+ }
257
+ if ((obj.nullifier != null && obj.nullifier.byteLength > 0)) {
258
+ w.uint32(50);
259
+ w.bytes(obj.nullifier);
260
+ }
261
+ if ((obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0)) {
262
+ w.uint32(58);
263
+ w.bytes(obj.rlnIdentifier);
264
+ }
265
+ if (opts.lengthDelimited !== false) {
266
+ w.ldelim();
267
+ }
268
+ }, (reader, length, opts = {}) => {
269
+ const obj = {
270
+ proof: alloc(0),
271
+ merkleRoot: alloc(0),
272
+ epoch: alloc(0),
273
+ shareX: alloc(0),
274
+ shareY: alloc(0),
275
+ nullifier: alloc(0),
276
+ rlnIdentifier: alloc(0)
277
+ };
278
+ const end = length == null ? reader.len : reader.pos + length;
279
+ while (reader.pos < end) {
280
+ const tag = reader.uint32();
281
+ switch (tag >>> 3) {
282
+ case 1: {
283
+ obj.proof = reader.bytes();
284
+ break;
285
+ }
286
+ case 2: {
287
+ obj.merkleRoot = reader.bytes();
288
+ break;
289
+ }
290
+ case 3: {
291
+ obj.epoch = reader.bytes();
292
+ break;
293
+ }
294
+ case 4: {
295
+ obj.shareX = reader.bytes();
296
+ break;
297
+ }
298
+ case 5: {
299
+ obj.shareY = reader.bytes();
300
+ break;
301
+ }
302
+ case 6: {
303
+ obj.nullifier = reader.bytes();
304
+ break;
305
+ }
306
+ case 7: {
307
+ obj.rlnIdentifier = reader.bytes();
308
+ break;
309
+ }
310
+ default: {
311
+ reader.skipType(tag & 7);
312
+ break;
313
+ }
314
+ }
315
+ }
316
+ return obj;
317
+ });
318
+ }
319
+ return _codec;
320
+ };
321
+ RateLimitProof.encode = (obj) => {
322
+ return encodeMessage(obj, RateLimitProof.codec());
323
+ };
324
+ RateLimitProof.decode = (buf, opts) => {
325
+ return decodeMessage(buf, RateLimitProof.codec(), opts);
326
+ };
327
+ })(RateLimitProof || (RateLimitProof = {}));
328
+ var WakuMessage;
329
+ (function (WakuMessage) {
330
+ let _codec;
331
+ WakuMessage.codec = () => {
332
+ if (_codec == null) {
333
+ _codec = message((obj, w, opts = {}) => {
334
+ if (opts.lengthDelimited !== false) {
335
+ w.fork();
336
+ }
337
+ if ((obj.payload != null && obj.payload.byteLength > 0)) {
338
+ w.uint32(10);
339
+ w.bytes(obj.payload);
340
+ }
341
+ if ((obj.contentTopic != null && obj.contentTopic !== '')) {
342
+ w.uint32(18);
343
+ w.string(obj.contentTopic);
344
+ }
345
+ if (obj.version != null) {
346
+ w.uint32(24);
347
+ w.uint32(obj.version);
348
+ }
349
+ if (obj.timestamp != null) {
350
+ w.uint32(80);
351
+ w.sint64(obj.timestamp);
352
+ }
353
+ if (obj.meta != null) {
354
+ w.uint32(90);
355
+ w.bytes(obj.meta);
356
+ }
357
+ if (obj.rateLimitProof != null) {
358
+ w.uint32(170);
359
+ RateLimitProof.codec().encode(obj.rateLimitProof, w);
360
+ }
361
+ if (obj.ephemeral != null) {
362
+ w.uint32(248);
363
+ w.bool(obj.ephemeral);
364
+ }
365
+ if (opts.lengthDelimited !== false) {
366
+ w.ldelim();
367
+ }
368
+ }, (reader, length, opts = {}) => {
369
+ const obj = {
370
+ payload: alloc(0),
371
+ contentTopic: ''
372
+ };
373
+ const end = length == null ? reader.len : reader.pos + length;
374
+ while (reader.pos < end) {
375
+ const tag = reader.uint32();
376
+ switch (tag >>> 3) {
377
+ case 1: {
378
+ obj.payload = reader.bytes();
379
+ break;
380
+ }
381
+ case 2: {
382
+ obj.contentTopic = reader.string();
383
+ break;
384
+ }
385
+ case 3: {
386
+ obj.version = reader.uint32();
387
+ break;
388
+ }
389
+ case 10: {
390
+ obj.timestamp = reader.sint64();
391
+ break;
392
+ }
393
+ case 11: {
394
+ obj.meta = reader.bytes();
395
+ break;
396
+ }
397
+ case 21: {
398
+ obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32(), {
399
+ limits: opts.limits?.rateLimitProof
400
+ });
401
+ break;
402
+ }
403
+ case 31: {
404
+ obj.ephemeral = reader.bool();
405
+ break;
406
+ }
407
+ default: {
408
+ reader.skipType(tag & 7);
409
+ break;
410
+ }
411
+ }
412
+ }
413
+ return obj;
414
+ });
415
+ }
416
+ return _codec;
417
+ };
418
+ WakuMessage.encode = (obj) => {
419
+ return encodeMessage(obj, WakuMessage.codec());
420
+ };
421
+ WakuMessage.decode = (buf, opts) => {
422
+ return decodeMessage(buf, WakuMessage.codec(), opts);
423
+ };
424
+ })(WakuMessage || (WakuMessage = {}));
425
+
426
+ export { FilterSubscribeRequest, FilterSubscribeResponse$1 as FilterSubscribeResponse, MessagePush, RateLimitProof, WakuMessage };