@waku/rln 0.1.6-6d86b6f.0 → 0.1.6-76fb1ea.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 (33) hide show
  1. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +1 -0
  2. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +1 -0
  3. package/bundle/packages/core/dist/lib/filter/filter.js +3 -0
  4. package/bundle/packages/core/dist/lib/light_push/light_push.js +3 -0
  5. package/bundle/packages/core/dist/lib/light_push/light_push_v3.js +31 -0
  6. package/bundle/packages/core/dist/lib/light_push/status_codes.js +26 -0
  7. package/bundle/packages/core/dist/lib/light_push/status_codes_v3.js +17 -0
  8. package/bundle/packages/core/dist/lib/message/version_0.js +3 -4
  9. package/bundle/packages/core/dist/lib/metadata/metadata.js +3 -0
  10. package/bundle/packages/core/dist/lib/store/store.js +3 -0
  11. package/bundle/packages/interfaces/dist/light_push_v3.js +16 -0
  12. package/bundle/packages/proto/dist/generated/light_push.js +28 -22
  13. package/bundle/packages/proto/dist/generated/light_push_v2.js +389 -0
  14. package/bundle/packages/proto/dist/generated/light_push_v3.js +348 -0
  15. package/bundle/packages/rln/dist/codec.js +1 -0
  16. package/bundle/packages/rln/dist/contract/rln_base_contract.js +3 -2
  17. package/bundle/packages/rln/dist/contract/rln_contract.js +1 -0
  18. package/bundle/packages/rln/dist/credentials_manager.js +1 -0
  19. package/bundle/packages/rln/dist/keystore/keystore.js +1 -0
  20. package/bundle/packages/rln/dist/message.js +26 -0
  21. package/bundle/packages/rln/dist/rln.js +15 -0
  22. package/bundle/packages/rln/dist/utils/epoch.js +1 -0
  23. package/bundle/packages/utils/dist/common/sharding/index.js +1 -0
  24. package/dist/.tsbuildinfo +1 -1
  25. package/dist/contract/rln_base_contract.d.ts +1 -1
  26. package/dist/contract/rln_base_contract.js +2 -2
  27. package/dist/contract/rln_base_contract.js.map +1 -1
  28. package/dist/message.d.ts +5 -4
  29. package/dist/message.js +2 -0
  30. package/dist/message.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/contract/rln_base_contract.ts +2 -2
  33. package/src/message.ts +7 -4
@@ -12,6 +12,7 @@ import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
12
12
  import '../../../../../node_modules/@multiformats/multiaddr/dist/src/convert.js';
13
13
  import '../../../../../node_modules/@multiformats/multiaddr/dist/src/protocols-table.js';
14
14
  import '../../../../../node_modules/@multiformats/multiaddr/dist/src/multiaddr.js';
15
+ import '../../../../interfaces/dist/light_push_v3.js';
15
16
  import '../../../../interfaces/dist/protocols.js';
16
17
  import '../../../../interfaces/dist/connection_manager.js';
17
18
  import '../../../../interfaces/dist/health_indicator.js';
@@ -1,3 +1,4 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
1
2
  import '../../../../interfaces/dist/protocols.js';
2
3
  import '../../../../interfaces/dist/connection_manager.js';
3
4
  import '../../../../interfaces/dist/health_indicator.js';
@@ -1,3 +1,4 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
1
2
  import '../../../../interfaces/dist/protocols.js';
2
3
  import '../../../../interfaces/dist/connection_manager.js';
3
4
  import '../../../../interfaces/dist/health_indicator.js';
@@ -19,6 +20,8 @@ import '../../../../proto/dist/generated/filter.js';
19
20
  import '../../../../proto/dist/generated/topic_only_message.js';
20
21
  import '../../../../proto/dist/generated/filter_v2.js';
21
22
  import '../../../../proto/dist/generated/light_push.js';
23
+ import '../../../../proto/dist/generated/light_push_v2.js';
24
+ import '../../../../proto/dist/generated/light_push_v3.js';
22
25
  import '../../../../proto/dist/generated/store_v3.js';
23
26
  import '../../../../proto/dist/generated/peer_exchange.js';
24
27
  import '../../../../proto/dist/generated/metadata.js';
@@ -1,3 +1,4 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
1
2
  import '../../../../interfaces/dist/protocols.js';
2
3
  import '../../../../interfaces/dist/connection_manager.js';
3
4
  import '../../../../interfaces/dist/health_indicator.js';
@@ -6,6 +7,8 @@ import '../../../../proto/dist/generated/filter.js';
6
7
  import '../../../../proto/dist/generated/topic_only_message.js';
7
8
  import '../../../../proto/dist/generated/filter_v2.js';
8
9
  export { PushResponse } from '../../../../proto/dist/generated/light_push.js';
10
+ import '../../../../proto/dist/generated/light_push_v2.js';
11
+ import '../../../../proto/dist/generated/light_push_v3.js';
9
12
  import '../../../../proto/dist/generated/store_v3.js';
10
13
  import '../../../../proto/dist/generated/peer_exchange.js';
11
14
  import '../../../../proto/dist/generated/metadata.js';
@@ -0,0 +1,31 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
2
+ import '../../../../interfaces/dist/protocols.js';
3
+ import '../../../../interfaces/dist/connection_manager.js';
4
+ import '../../../../interfaces/dist/health_indicator.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/light_push_v2.js';
11
+ import '../../../../proto/dist/generated/light_push_v3.js';
12
+ import '../../../../proto/dist/generated/store_v3.js';
13
+ import '../../../../proto/dist/generated/peer_exchange.js';
14
+ import '../../../../proto/dist/generated/metadata.js';
15
+ import '../../../../proto/dist/generated/sds_message.js';
16
+ import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
17
+ import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
18
+ import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
19
+ import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
20
+ import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
21
+ import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
22
+ import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
23
+ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
24
+ import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
25
+ import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
26
+ import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
27
+ import { Logger } from '../../../../utils/dist/logger/index.js';
28
+ import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
29
+ import './status_codes_v3.js';
30
+
31
+ new Logger("light-push-v3");
@@ -0,0 +1,26 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
2
+ import '../../../../interfaces/dist/protocols.js';
3
+ import '../../../../interfaces/dist/connection_manager.js';
4
+ import '../../../../interfaces/dist/health_indicator.js';
5
+
6
+ var LightPushStatusCode;
7
+ (function (LightPushStatusCode) {
8
+ LightPushStatusCode[LightPushStatusCode["SUCCESS"] = 200] = "SUCCESS";
9
+ LightPushStatusCode[LightPushStatusCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
10
+ LightPushStatusCode[LightPushStatusCode["UNSUPPORTED_PUBSUB_TOPIC"] = 404] = "UNSUPPORTED_PUBSUB_TOPIC";
11
+ LightPushStatusCode[LightPushStatusCode["REQUEST_TOO_LARGE"] = 413] = "REQUEST_TOO_LARGE";
12
+ LightPushStatusCode[LightPushStatusCode["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
13
+ LightPushStatusCode[LightPushStatusCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
14
+ LightPushStatusCode[LightPushStatusCode["NO_PEERS_TO_RELAY"] = 503] = "NO_PEERS_TO_RELAY";
15
+ })(LightPushStatusCode || (LightPushStatusCode = {}));
16
+ ({
17
+ [LightPushStatusCode.SUCCESS]: "Message pushed successfully",
18
+ [LightPushStatusCode.BAD_REQUEST]: "Invalid request format or missing required fields",
19
+ [LightPushStatusCode.UNSUPPORTED_PUBSUB_TOPIC]: "The specified pubsub topic is not supported",
20
+ [LightPushStatusCode.REQUEST_TOO_LARGE]: "Message size exceeds maximum allowed size",
21
+ [LightPushStatusCode.TOO_MANY_REQUESTS]: "Rate limit exceeded, too many requests",
22
+ [LightPushStatusCode.INTERNAL_SERVER_ERROR]: "Internal server error occurred",
23
+ [LightPushStatusCode.NO_PEERS_TO_RELAY]: "No relay peers available to forward the message"
24
+ });
25
+
26
+ export { LightPushStatusCode };
@@ -0,0 +1,17 @@
1
+ import { LightPushStatusCodeV3 } from '../../../../interfaces/dist/light_push_v3.js';
2
+ import '../../../../interfaces/dist/protocols.js';
3
+ import '../../../../interfaces/dist/connection_manager.js';
4
+ import '../../../../interfaces/dist/health_indicator.js';
5
+
6
+ ({
7
+ [LightPushStatusCodeV3.SUCCESS]: "Message sent successfully",
8
+ [LightPushStatusCodeV3.BAD_REQUEST]: "Bad request format",
9
+ [LightPushStatusCodeV3.PAYLOAD_TOO_LARGE]: "Message payload exceeds maximum size",
10
+ [LightPushStatusCodeV3.INVALID_MESSAGE_ERROR]: "Message validation failed",
11
+ [LightPushStatusCodeV3.UNSUPPORTED_PUBSUB_TOPIC]: "Unsupported pubsub topic",
12
+ [LightPushStatusCodeV3.TOO_MANY_REQUESTS]: "Rate limit exceeded",
13
+ [LightPushStatusCodeV3.INTERNAL_SERVER_ERROR]: "Internal server error",
14
+ [LightPushStatusCodeV3.SERVICE_NOT_AVAILABLE]: "Service temporarily unavailable",
15
+ [LightPushStatusCodeV3.OUT_OF_RLN_PROOF]: "RLN proof generation failed",
16
+ [LightPushStatusCodeV3.NO_PEERS_TO_RELAY]: "No relay peers available"
17
+ });
@@ -3,6 +3,8 @@ import '../../../../proto/dist/generated/filter.js';
3
3
  import '../../../../proto/dist/generated/topic_only_message.js';
4
4
  import '../../../../proto/dist/generated/filter_v2.js';
5
5
  import '../../../../proto/dist/generated/light_push.js';
6
+ import '../../../../proto/dist/generated/light_push_v2.js';
7
+ import '../../../../proto/dist/generated/light_push_v3.js';
6
8
  import '../../../../proto/dist/generated/store_v3.js';
7
9
  import '../../../../proto/dist/generated/peer_exchange.js';
8
10
  import '../../../../proto/dist/generated/metadata.js';
@@ -29,9 +31,6 @@ class DecodedMessage {
29
31
  get contentTopic() {
30
32
  return this.proto.contentTopic;
31
33
  }
32
- get _rawTimestamp() {
33
- return this.proto.timestamp;
34
- }
35
34
  get timestamp() {
36
35
  // In the case we receive a value that is bigger than JS's max number,
37
36
  // we catch the error and return undefined.
@@ -53,7 +52,7 @@ class DecodedMessage {
53
52
  get version() {
54
53
  // https://rfc.vac.dev/spec/14/
55
54
  // > If omitted, the value SHOULD be interpreted as version 0.
56
- return this.proto.version ?? 0;
55
+ return this.proto.version ?? Version;
57
56
  }
58
57
  get rateLimitProof() {
59
58
  return this.proto.rateLimitProof;
@@ -1,3 +1,4 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
1
2
  import '../../../../interfaces/dist/protocols.js';
2
3
  import '../../../../interfaces/dist/connection_manager.js';
3
4
  import '../../../../interfaces/dist/health_indicator.js';
@@ -6,6 +7,8 @@ import '../../../../proto/dist/generated/filter.js';
6
7
  import '../../../../proto/dist/generated/topic_only_message.js';
7
8
  import '../../../../proto/dist/generated/filter_v2.js';
8
9
  import '../../../../proto/dist/generated/light_push.js';
10
+ import '../../../../proto/dist/generated/light_push_v2.js';
11
+ import '../../../../proto/dist/generated/light_push_v3.js';
9
12
  import '../../../../proto/dist/generated/store_v3.js';
10
13
  import '../../../../proto/dist/generated/peer_exchange.js';
11
14
  import '../../../../proto/dist/generated/metadata.js';
@@ -1,3 +1,4 @@
1
+ import '../../../../interfaces/dist/light_push_v3.js';
1
2
  import '../../../../interfaces/dist/protocols.js';
2
3
  import '../../../../interfaces/dist/connection_manager.js';
3
4
  import '../../../../interfaces/dist/health_indicator.js';
@@ -19,6 +20,8 @@ import '../../../../proto/dist/generated/filter.js';
19
20
  import '../../../../proto/dist/generated/topic_only_message.js';
20
21
  import '../../../../proto/dist/generated/filter_v2.js';
21
22
  import '../../../../proto/dist/generated/light_push.js';
23
+ import '../../../../proto/dist/generated/light_push_v2.js';
24
+ import '../../../../proto/dist/generated/light_push_v3.js';
22
25
  import '../../../../proto/dist/generated/store_v3.js';
23
26
  import '../../../../proto/dist/generated/peer_exchange.js';
24
27
  import '../../../../proto/dist/generated/metadata.js';
@@ -0,0 +1,16 @@
1
+ // Light Push V3 Protocol Types and Constants
2
+ var LightPushStatusCodeV3;
3
+ (function (LightPushStatusCodeV3) {
4
+ LightPushStatusCodeV3[LightPushStatusCodeV3["SUCCESS"] = 200] = "SUCCESS";
5
+ LightPushStatusCodeV3[LightPushStatusCodeV3["BAD_REQUEST"] = 400] = "BAD_REQUEST";
6
+ LightPushStatusCodeV3[LightPushStatusCodeV3["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
7
+ LightPushStatusCodeV3[LightPushStatusCodeV3["INVALID_MESSAGE_ERROR"] = 420] = "INVALID_MESSAGE_ERROR";
8
+ LightPushStatusCodeV3[LightPushStatusCodeV3["UNSUPPORTED_PUBSUB_TOPIC"] = 421] = "UNSUPPORTED_PUBSUB_TOPIC";
9
+ LightPushStatusCodeV3[LightPushStatusCodeV3["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
10
+ LightPushStatusCodeV3[LightPushStatusCodeV3["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
11
+ LightPushStatusCodeV3[LightPushStatusCodeV3["SERVICE_NOT_AVAILABLE"] = 503] = "SERVICE_NOT_AVAILABLE";
12
+ LightPushStatusCodeV3[LightPushStatusCodeV3["OUT_OF_RLN_PROOF"] = 504] = "OUT_OF_RLN_PROOF";
13
+ LightPushStatusCodeV3[LightPushStatusCodeV3["NO_PEERS_TO_RELAY"] = 505] = "NO_PEERS_TO_RELAY";
14
+ })(LightPushStatusCodeV3 || (LightPushStatusCodeV3 = {}));
15
+
16
+ export { LightPushStatusCodeV3 };
@@ -21,30 +21,28 @@ var PushRequest;
21
21
  if (opts.lengthDelimited !== false) {
22
22
  w.fork();
23
23
  }
24
- if ((obj.pubsubTopic != null && obj.pubsubTopic !== '')) {
25
- w.uint32(10);
24
+ if (obj.pubsubTopic != null) {
25
+ w.uint32(162);
26
26
  w.string(obj.pubsubTopic);
27
27
  }
28
28
  if (obj.message != null) {
29
- w.uint32(18);
29
+ w.uint32(170);
30
30
  WakuMessage.codec().encode(obj.message, w);
31
31
  }
32
32
  if (opts.lengthDelimited !== false) {
33
33
  w.ldelim();
34
34
  }
35
35
  }, (reader, length, opts = {}) => {
36
- const obj = {
37
- pubsubTopic: ''
38
- };
36
+ const obj = {};
39
37
  const end = length == null ? reader.len : reader.pos + length;
40
38
  while (reader.pos < end) {
41
39
  const tag = reader.uint32();
42
40
  switch (tag >>> 3) {
43
- case 1: {
41
+ case 20: {
44
42
  obj.pubsubTopic = reader.string();
45
43
  break;
46
44
  }
47
- case 2: {
45
+ case 21: {
48
46
  obj.message = WakuMessage.codec().decode(reader, reader.uint32(), {
49
47
  limits: opts.limits?.message
50
48
  });
@@ -77,31 +75,39 @@ var PushResponse;
77
75
  if (opts.lengthDelimited !== false) {
78
76
  w.fork();
79
77
  }
80
- if ((obj.isSuccess != null && obj.isSuccess !== false)) {
81
- w.uint32(8);
82
- w.bool(obj.isSuccess);
78
+ if ((obj.statusCode != null && obj.statusCode !== 0)) {
79
+ w.uint32(160);
80
+ w.uint32(obj.statusCode);
83
81
  }
84
- if (obj.info != null) {
85
- w.uint32(18);
86
- w.string(obj.info);
82
+ if (obj.statusDesc != null) {
83
+ w.uint32(242);
84
+ w.string(obj.statusDesc);
85
+ }
86
+ if (obj.relayPeerCount != null) {
87
+ w.uint32(320);
88
+ w.uint32(obj.relayPeerCount);
87
89
  }
88
90
  if (opts.lengthDelimited !== false) {
89
91
  w.ldelim();
90
92
  }
91
93
  }, (reader, length, opts = {}) => {
92
94
  const obj = {
93
- isSuccess: false
95
+ statusCode: 0
94
96
  };
95
97
  const end = length == null ? reader.len : reader.pos + length;
96
98
  while (reader.pos < end) {
97
99
  const tag = reader.uint32();
98
100
  switch (tag >>> 3) {
99
- case 1: {
100
- obj.isSuccess = reader.bool();
101
+ case 20: {
102
+ obj.statusCode = reader.uint32();
101
103
  break;
102
104
  }
103
- case 2: {
104
- obj.info = reader.string();
105
+ case 30: {
106
+ obj.statusDesc = reader.string();
107
+ break;
108
+ }
109
+ case 40: {
110
+ obj.relayPeerCount = reader.uint32();
105
111
  break;
106
112
  }
107
113
  default: {
@@ -122,7 +128,7 @@ var PushResponse;
122
128
  return decodeMessage(buf, PushResponse.codec(), opts);
123
129
  };
124
130
  })(PushResponse || (PushResponse = {}));
125
- var PushRpc$1;
131
+ var PushRpc;
126
132
  (function (PushRpc) {
127
133
  let _codec;
128
134
  PushRpc.codec = () => {
@@ -187,7 +193,7 @@ var PushRpc$1;
187
193
  PushRpc.decode = (buf, opts) => {
188
194
  return decodeMessage(buf, PushRpc.codec(), opts);
189
195
  };
190
- })(PushRpc$1 || (PushRpc$1 = {}));
196
+ })(PushRpc || (PushRpc = {}));
191
197
  var RateLimitProof;
192
198
  (function (RateLimitProof) {
193
199
  let _codec;
@@ -386,4 +392,4 @@ var WakuMessage;
386
392
  };
387
393
  })(WakuMessage || (WakuMessage = {}));
388
394
 
389
- export { PushRequest, PushResponse, PushRpc$1 as PushRpc, RateLimitProof, WakuMessage };
395
+ export { PushRequest, PushResponse, PushRpc, RateLimitProof, WakuMessage };