@waku/core 0.0.23 → 0.0.25-a42b7be.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/CHANGELOG.md +34 -0
- package/bundle/{base_protocol-84d9b670.js → base_protocol-4bcf7514.js} +194 -134
- package/bundle/{browser-bde977a3.js → browser-90197c87.js} +26 -1
- package/bundle/index-27b91e3b.js +31 -0
- package/bundle/index.js +19384 -2421
- package/bundle/lib/base_protocol.js +3 -2
- package/bundle/lib/message/version_0.js +3 -2
- package/bundle/lib/predefined_bootstrap_nodes.js +2 -0
- package/bundle/{version_0-74b4b9db.js → version_0-2f1176e3.js} +36 -24
- package/dist/.tsbuildinfo +1 -1
- package/dist/lib/connection_manager.d.ts +17 -4
- package/dist/lib/connection_manager.js +111 -45
- package/dist/lib/connection_manager.js.map +1 -1
- package/dist/lib/filter/index.js +53 -37
- package/dist/lib/filter/index.js.map +1 -1
- package/dist/lib/keep_alive_manager.d.ts +1 -0
- package/dist/lib/keep_alive_manager.js +42 -18
- package/dist/lib/keep_alive_manager.js.map +1 -1
- package/dist/lib/light_push/index.js +60 -38
- package/dist/lib/light_push/index.js.map +1 -1
- package/dist/lib/light_push/push_rpc.d.ts +1 -1
- package/dist/lib/light_push/push_rpc.js +2 -2
- package/dist/lib/message/version_0.d.ts +13 -13
- package/dist/lib/message/version_0.js +22 -20
- package/dist/lib/message/version_0.js.map +1 -1
- package/dist/lib/store/history_rpc.d.ts +1 -1
- package/dist/lib/store/history_rpc.js +1 -1
- package/dist/lib/store/index.d.ts +1 -1
- package/dist/lib/store/index.js +43 -17
- package/dist/lib/store/index.js.map +1 -1
- package/dist/lib/stream_manager.d.ts +1 -1
- package/dist/lib/stream_manager.js +8 -5
- package/dist/lib/stream_manager.js.map +1 -1
- package/dist/lib/wait_for_remote_peer.d.ts +2 -2
- package/dist/lib/wait_for_remote_peer.js +13 -11
- package/dist/lib/wait_for_remote_peer.js.map +1 -1
- package/dist/lib/waku.d.ts +4 -3
- package/dist/lib/waku.js +13 -11
- package/dist/lib/waku.js.map +1 -1
- package/package.json +1 -137
- package/src/lib/connection_manager.ts +156 -51
- package/src/lib/filter/index.ts +76 -40
- package/src/lib/keep_alive_manager.ts +53 -20
- package/src/lib/light_push/index.ts +74 -38
- package/src/lib/light_push/push_rpc.ts +2 -2
- package/src/lib/message/version_0.ts +25 -17
- package/src/lib/store/history_rpc.ts +2 -2
- package/src/lib/store/index.ts +60 -23
- package/src/lib/stream_manager.ts +12 -7
- package/src/lib/wait_for_remote_peer.ts +13 -11
- package/src/lib/waku.ts +12 -9
- package/dist/lib/push_or_init_map.d.ts +0 -1
- package/dist/lib/push_or_init_map.js +0 -9
- package/dist/lib/push_or_init_map.js.map +0 -1
- package/src/lib/push_or_init_map.ts +0 -13
@@ -1,8 +1,8 @@
|
|
1
|
+
import { Logger } from "@waku/utils";
|
1
2
|
import { utf8ToBytes } from "@waku/utils/bytes";
|
2
|
-
import debug from "debug";
|
3
3
|
import { createEncoder } from "./message/version_0.js";
|
4
4
|
export const RelayPingContentTopic = "/relay-ping/1/ping/null";
|
5
|
-
const log =
|
5
|
+
const log = new Logger("keep-alive");
|
6
6
|
export class KeepAliveManager {
|
7
7
|
pingKeepAliveTimers;
|
8
8
|
relayKeepAliveTimers;
|
@@ -19,14 +19,25 @@ export class KeepAliveManager {
|
|
19
19
|
this.stop(peerId);
|
20
20
|
const { pingKeepAlive: pingPeriodSecs, relayKeepAlive: relayPeriodSecs } = this.options;
|
21
21
|
const peerIdStr = peerId.toString();
|
22
|
+
// Ping the peer every pingPeriodSecs seconds
|
23
|
+
// if pingPeriodSecs is 0, don't ping the peer
|
22
24
|
if (pingPeriodSecs !== 0) {
|
23
25
|
const interval = setInterval(() => {
|
24
26
|
void (async () => {
|
27
|
+
let ping;
|
25
28
|
try {
|
26
29
|
// ping the peer for keep alive
|
27
30
|
// also update the peer store with the latency
|
28
|
-
|
29
|
-
|
31
|
+
try {
|
32
|
+
ping = await libp2pPing.ping(peerId);
|
33
|
+
log.info(`Ping succeeded (${peerIdStr})`, ping);
|
34
|
+
}
|
35
|
+
catch (error) {
|
36
|
+
log.error(`Ping failed for peer (${peerIdStr}).
|
37
|
+
Next ping will be attempted in ${pingPeriodSecs} seconds.
|
38
|
+
`);
|
39
|
+
return;
|
40
|
+
}
|
30
41
|
try {
|
31
42
|
await peerStore.patch(peerId, {
|
32
43
|
metadata: {
|
@@ -35,11 +46,11 @@ export class KeepAliveManager {
|
|
35
46
|
});
|
36
47
|
}
|
37
48
|
catch (e) {
|
38
|
-
log("Failed to update ping", e);
|
49
|
+
log.error("Failed to update ping", e);
|
39
50
|
}
|
40
51
|
}
|
41
52
|
catch (e) {
|
42
|
-
log(`Ping failed (${peerIdStr})`, e);
|
53
|
+
log.error(`Ping failed (${peerIdStr})`, e);
|
43
54
|
}
|
44
55
|
})();
|
45
56
|
}, pingPeriodSecs * 1000);
|
@@ -47,17 +58,8 @@ export class KeepAliveManager {
|
|
47
58
|
}
|
48
59
|
const relay = this.relay;
|
49
60
|
if (relay && relayPeriodSecs !== 0) {
|
50
|
-
const
|
51
|
-
|
52
|
-
ephemeral: true
|
53
|
-
});
|
54
|
-
const interval = setInterval(() => {
|
55
|
-
log("Sending Waku Relay ping message");
|
56
|
-
relay
|
57
|
-
.send(encoder, { payload: new Uint8Array([1]) })
|
58
|
-
.catch((e) => log("Failed to send relay ping", e));
|
59
|
-
}, relayPeriodSecs * 1000);
|
60
|
-
this.relayKeepAliveTimers.set(peerId, interval);
|
61
|
+
const intervals = this.scheduleRelayPings(relay, relayPeriodSecs, peerId.toString());
|
62
|
+
this.relayKeepAliveTimers.set(peerId, intervals);
|
61
63
|
}
|
62
64
|
}
|
63
65
|
stop(peerId) {
|
@@ -67,7 +69,7 @@ export class KeepAliveManager {
|
|
67
69
|
this.pingKeepAliveTimers.delete(peerIdStr);
|
68
70
|
}
|
69
71
|
if (this.relayKeepAliveTimers.has(peerId)) {
|
70
|
-
|
72
|
+
this.relayKeepAliveTimers.get(peerId)?.map(clearInterval);
|
71
73
|
this.relayKeepAliveTimers.delete(peerId);
|
72
74
|
}
|
73
75
|
}
|
@@ -81,5 +83,27 @@ export class KeepAliveManager {
|
|
81
83
|
this.pingKeepAliveTimers.clear();
|
82
84
|
this.relayKeepAliveTimers.clear();
|
83
85
|
}
|
86
|
+
scheduleRelayPings(relay, relayPeriodSecs, peerIdStr) {
|
87
|
+
// send a ping message to each PubSubTopic the peer is part of
|
88
|
+
const intervals = [];
|
89
|
+
for (const topic of relay.pubsubTopics) {
|
90
|
+
const meshPeers = relay.getMeshPeers(topic);
|
91
|
+
if (!meshPeers.includes(peerIdStr))
|
92
|
+
continue;
|
93
|
+
const encoder = createEncoder({
|
94
|
+
pubsubTopic: topic,
|
95
|
+
contentTopic: RelayPingContentTopic,
|
96
|
+
ephemeral: true
|
97
|
+
});
|
98
|
+
const interval = setInterval(() => {
|
99
|
+
log.info("Sending Waku Relay ping message");
|
100
|
+
relay
|
101
|
+
.send(encoder, { payload: new Uint8Array([1]) })
|
102
|
+
.catch((e) => log.error("Failed to send relay ping", e));
|
103
|
+
}, relayPeriodSecs * 1000);
|
104
|
+
intervals.push(interval);
|
105
|
+
}
|
106
|
+
return intervals;
|
107
|
+
}
|
84
108
|
}
|
85
109
|
//# sourceMappingURL=keep_alive_manager.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keep_alive_manager.js","sourceRoot":"","sources":["../../src/lib/keep_alive_manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"keep_alive_manager.js","sourceRoot":"","sources":["../../src/lib/keep_alive_manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,y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GAAG,IAAI,CAAC,CAAC;YAC3B,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { SendError } from "@waku/interfaces";
|
2
2
|
import { PushResponse } from "@waku/proto";
|
3
|
-
import {
|
4
|
-
import
|
3
|
+
import { ensurePubsubTopicIsConfigured, isMessageSizeUnderCap } from "@waku/utils";
|
4
|
+
import { Logger } from "@waku/utils";
|
5
5
|
import all from "it-all";
|
6
6
|
import * as lp from "it-length-prefixed";
|
7
7
|
import { pipe } from "it-pipe";
|
@@ -9,38 +9,42 @@ import { Uint8ArrayList } from "uint8arraylist";
|
|
9
9
|
import { BaseProtocol } from "../base_protocol.js";
|
10
10
|
import { DefaultPubSubTopic } from "../constants.js";
|
11
11
|
import { PushRpc } from "./push_rpc.js";
|
12
|
-
const log =
|
12
|
+
const log = new Logger("light-push");
|
13
13
|
export const LightPushCodec = "/vac/waku/lightpush/2.0.0-beta1";
|
14
14
|
export { PushResponse };
|
15
15
|
/**
|
16
16
|
* Implements the [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/).
|
17
17
|
*/
|
18
18
|
class LightPush extends BaseProtocol {
|
19
|
-
|
19
|
+
pubsubTopics;
|
20
20
|
NUM_PEERS_PROTOCOL = 1;
|
21
21
|
constructor(libp2p, options) {
|
22
22
|
super(LightPushCodec, libp2p.components);
|
23
|
-
this.
|
23
|
+
this.pubsubTopics = options?.pubsubTopics ?? [DefaultPubSubTopic];
|
24
24
|
}
|
25
|
-
async preparePushMessage(encoder, message,
|
25
|
+
async preparePushMessage(encoder, message, pubsubTopic) {
|
26
26
|
try {
|
27
|
-
if (!
|
28
|
-
log("Failed to send waku light push:
|
27
|
+
if (!message.payload || message.payload.length === 0) {
|
28
|
+
log.error("Failed to send waku light push: payload is empty");
|
29
|
+
return { query: null, error: SendError.EMPTY_PAYLOAD };
|
30
|
+
}
|
31
|
+
if (!(await isMessageSizeUnderCap(encoder, message))) {
|
32
|
+
log.error("Failed to send waku light push: message is bigger than 1MB");
|
29
33
|
return { query: null, error: SendError.SIZE_TOO_BIG };
|
30
34
|
}
|
31
35
|
const protoMessage = await encoder.toProtoObj(message);
|
32
36
|
if (!protoMessage) {
|
33
|
-
log("Failed to encode to protoMessage, aborting push");
|
37
|
+
log.error("Failed to encode to protoMessage, aborting push");
|
34
38
|
return {
|
35
39
|
query: null,
|
36
40
|
error: SendError.ENCODE_FAILED
|
37
41
|
};
|
38
42
|
}
|
39
|
-
const query = PushRpc.createRequest(protoMessage,
|
43
|
+
const query = PushRpc.createRequest(protoMessage, pubsubTopic);
|
40
44
|
return { query, error: null };
|
41
45
|
}
|
42
46
|
catch (error) {
|
43
|
-
log("Failed to prepare push message", error);
|
47
|
+
log.error("Failed to prepare push message", error);
|
44
48
|
return {
|
45
49
|
query: null,
|
46
50
|
error: SendError.GENERIC_FAIL
|
@@ -48,49 +52,67 @@ class LightPush extends BaseProtocol {
|
|
48
52
|
}
|
49
53
|
}
|
50
54
|
async send(encoder, message) {
|
51
|
-
const {
|
55
|
+
const { pubsubTopic } = encoder;
|
56
|
+
ensurePubsubTopicIsConfigured(pubsubTopic, this.pubsubTopics);
|
52
57
|
const recipients = [];
|
53
|
-
const { query, error: preparationError } = await this.preparePushMessage(encoder, message,
|
58
|
+
const { query, error: preparationError } = await this.preparePushMessage(encoder, message, pubsubTopic);
|
54
59
|
if (preparationError || !query) {
|
55
60
|
return {
|
56
61
|
recipients,
|
57
62
|
errors: [preparationError]
|
58
63
|
};
|
59
64
|
}
|
65
|
+
//TODO: get a relevant peer for the topic/shard
|
60
66
|
const peers = await this.getPeers({
|
61
67
|
maxBootstrapPeers: 1,
|
62
68
|
numPeers: this.NUM_PEERS_PROTOCOL
|
63
69
|
});
|
70
|
+
if (!peers.length) {
|
71
|
+
return {
|
72
|
+
recipients,
|
73
|
+
errors: [SendError.NO_PEER_AVAILABLE]
|
74
|
+
};
|
75
|
+
}
|
64
76
|
const promises = peers.map(async (peer) => {
|
65
|
-
let
|
66
|
-
const stream = await this.getStream(peer);
|
77
|
+
let stream;
|
67
78
|
try {
|
68
|
-
|
69
|
-
try {
|
70
|
-
const bytes = new Uint8ArrayList();
|
71
|
-
res.forEach((chunk) => {
|
72
|
-
bytes.append(chunk);
|
73
|
-
});
|
74
|
-
const response = PushRpc.decode(bytes).response;
|
75
|
-
if (response?.isSuccess) {
|
76
|
-
recipients.some((recipient) => recipient.equals(peer.id)) ||
|
77
|
-
recipients.push(peer.id);
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
log("No response in PushRPC");
|
81
|
-
error = SendError.NO_RPC_RESPONSE;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
catch (err) {
|
85
|
-
log("Failed to decode push reply", err);
|
86
|
-
error = SendError.DECODE_FAILED;
|
87
|
-
}
|
79
|
+
stream = await this.getStream(peer);
|
88
80
|
}
|
89
81
|
catch (err) {
|
90
|
-
log(
|
91
|
-
error
|
82
|
+
log.error(`Failed to get a stream for remote peer${peer.id.toString()}`, err);
|
83
|
+
return { recipients, error: SendError.REMOTE_PEER_FAULT };
|
84
|
+
}
|
85
|
+
let res;
|
86
|
+
try {
|
87
|
+
res = await pipe([query.encode()], lp.encode, stream, lp.decode, async (source) => await all(source));
|
88
|
+
}
|
89
|
+
catch (err) {
|
90
|
+
log.error("Failed to send waku light push request", err);
|
91
|
+
return { recipients, error: SendError.GENERIC_FAIL };
|
92
|
+
}
|
93
|
+
const bytes = new Uint8ArrayList();
|
94
|
+
res.forEach((chunk) => {
|
95
|
+
bytes.append(chunk);
|
96
|
+
});
|
97
|
+
let response;
|
98
|
+
try {
|
99
|
+
response = PushRpc.decode(bytes).response;
|
100
|
+
}
|
101
|
+
catch (err) {
|
102
|
+
log.error("Failed to decode push reply", err);
|
103
|
+
return { recipients, error: SendError.DECODE_FAILED };
|
104
|
+
}
|
105
|
+
if (!response) {
|
106
|
+
log.error("Remote peer fault: No response in PushRPC");
|
107
|
+
return { recipients, error: SendError.REMOTE_PEER_FAULT };
|
108
|
+
}
|
109
|
+
if (!response.isSuccess) {
|
110
|
+
log.error("Remote peer rejected the message: ", response.info);
|
111
|
+
return { recipients, error: SendError.REMOTE_PEER_REJECTED };
|
92
112
|
}
|
93
|
-
|
113
|
+
recipients.some((recipient) => recipient.equals(peer.id)) ||
|
114
|
+
recipients.push(peer.id);
|
115
|
+
return { recipients };
|
94
116
|
});
|
95
117
|
const results = await Promise.allSettled(promises);
|
96
118
|
const errors = results
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/light_push/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/light_push/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,SAAS,EAEV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,CAAC;AAYxB;;GAEG;AACH,MAAM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,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,oBAAoB,EAAE,CAAC;aAC9D;YAED,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACvD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAE3B,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,OAAO;aACnB,MAAM,CACL,CACE,MAAM,EAIL,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CACpC;aACA,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;aACnC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAgB,CAAC;QAEzD,OAAO;YACL,UAAU;YACV,MAAM;SACP,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,aAAa,CAC3B,OAAuC,EAAE;IAEzC,OAAO,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC"}
|
@@ -3,7 +3,7 @@ import type { Uint8ArrayList } from "uint8arraylist";
|
|
3
3
|
export declare class PushRpc {
|
4
4
|
proto: proto.PushRpc;
|
5
5
|
constructor(proto: proto.PushRpc);
|
6
|
-
static createRequest(message: proto.WakuMessage,
|
6
|
+
static createRequest(message: proto.WakuMessage, pubsubTopic: string): PushRpc;
|
7
7
|
static decode(bytes: Uint8ArrayList): PushRpc;
|
8
8
|
encode(): Uint8Array;
|
9
9
|
get query(): proto.PushRequest | undefined;
|
@@ -5,12 +5,12 @@ export class PushRpc {
|
|
5
5
|
constructor(proto) {
|
6
6
|
this.proto = proto;
|
7
7
|
}
|
8
|
-
static createRequest(message,
|
8
|
+
static createRequest(message, pubsubTopic) {
|
9
9
|
return new PushRpc({
|
10
10
|
requestId: uuid(),
|
11
11
|
request: {
|
12
12
|
message: message,
|
13
|
-
pubsubTopic:
|
13
|
+
pubsubTopic: pubsubTopic
|
14
14
|
},
|
15
15
|
response: undefined
|
16
16
|
});
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import type { EncoderOptions, IDecodedMessage, IDecoder, IEncoder, IMessage, IMetaSetter, IProtoMessage, IRateLimitProof } from "@waku/interfaces";
|
1
|
+
import type { EncoderOptions, IDecodedMessage, IDecoder, IEncoder, IMessage, IMetaSetter, IProtoMessage, IRateLimitProof, PubSubTopic } from "@waku/interfaces";
|
2
2
|
import { proto_message as proto } from "@waku/proto";
|
3
3
|
export declare const Version = 0;
|
4
4
|
export { proto };
|
5
5
|
export declare class DecodedMessage implements IDecodedMessage {
|
6
|
-
|
6
|
+
pubsubTopic: string;
|
7
7
|
protected proto: proto.WakuMessage;
|
8
|
-
constructor(
|
8
|
+
constructor(pubsubTopic: string, proto: proto.WakuMessage);
|
9
9
|
get ephemeral(): boolean;
|
10
10
|
get payload(): Uint8Array;
|
11
11
|
get contentTopic(): string;
|
@@ -18,36 +18,36 @@ export declare class DecodedMessage implements IDecodedMessage {
|
|
18
18
|
export declare class Encoder implements IEncoder {
|
19
19
|
contentTopic: string;
|
20
20
|
ephemeral: boolean;
|
21
|
+
pubsubTopic: PubSubTopic;
|
21
22
|
metaSetter?: IMetaSetter | undefined;
|
22
|
-
constructor(contentTopic: string, ephemeral
|
23
|
+
constructor(contentTopic: string, ephemeral: boolean, pubsubTopic: PubSubTopic, metaSetter?: IMetaSetter | undefined);
|
23
24
|
toWire(message: IMessage): Promise<Uint8Array>;
|
24
25
|
toProtoObj(message: IMessage): Promise<IProtoMessage>;
|
25
26
|
}
|
26
27
|
/**
|
27
28
|
* Creates an encoder that encode messages without Waku level encryption or signature.
|
28
29
|
*
|
29
|
-
* An encoder is used to encode messages in the [
|
30
|
+
* An encoder is used to encode messages in the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
|
30
31
|
* format to be sent over the Waku network. The resulting encoder can then be
|
31
|
-
* pass to { @link @waku/interfaces.
|
32
|
-
* { @link @waku/interfaces.Relay.send } to automatically encode outgoing
|
32
|
+
* pass to { @link @waku/interfaces!ISender.send } to automatically encode outgoing
|
33
33
|
* messages.
|
34
34
|
*/
|
35
|
-
export declare function createEncoder({ contentTopic, ephemeral, metaSetter }: EncoderOptions): Encoder;
|
35
|
+
export declare function createEncoder({ pubsubTopic, contentTopic, ephemeral, metaSetter }: EncoderOptions): Encoder;
|
36
36
|
export declare class Decoder implements IDecoder<DecodedMessage> {
|
37
|
+
pubsubTopic: PubSubTopic;
|
37
38
|
contentTopic: string;
|
38
|
-
constructor(contentTopic: string);
|
39
|
+
constructor(pubsubTopic: PubSubTopic, contentTopic: string);
|
39
40
|
fromWireToProtoObj(bytes: Uint8Array): Promise<IProtoMessage | undefined>;
|
40
|
-
fromProtoObj(
|
41
|
+
fromProtoObj(pubsubTopic: string, proto: IProtoMessage): Promise<DecodedMessage | undefined>;
|
41
42
|
}
|
42
43
|
/**
|
43
44
|
* Creates a decoder that decode messages without Waku level encryption.
|
44
45
|
*
|
45
46
|
* A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
|
46
47
|
* format when received from the Waku network. The resulting decoder can then be
|
47
|
-
* pass to { @link @waku/interfaces.
|
48
|
-
* { @link @waku/interfaces.Relay.subscribe } to automatically decode incoming
|
48
|
+
* pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decode incoming
|
49
49
|
* messages.
|
50
50
|
*
|
51
51
|
* @param contentTopic The resulting decoder will only decode messages with this content topic.
|
52
52
|
*/
|
53
|
-
export declare function createDecoder(contentTopic: string): Decoder;
|
53
|
+
export declare function createDecoder(contentTopic: string, pubsubTopic?: PubSubTopic): Decoder;
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import { proto_message as proto } from "@waku/proto";
|
2
|
-
import
|
3
|
-
|
2
|
+
import { Logger } from "@waku/utils";
|
3
|
+
import { DefaultPubSubTopic } from "../constants.js";
|
4
|
+
const log = new Logger("message:version-0");
|
4
5
|
const OneMillion = BigInt(1000000);
|
5
6
|
export const Version = 0;
|
6
7
|
export { proto };
|
7
8
|
export class DecodedMessage {
|
8
|
-
|
9
|
+
pubsubTopic;
|
9
10
|
proto;
|
10
|
-
constructor(
|
11
|
-
this.
|
11
|
+
constructor(pubsubTopic, proto) {
|
12
|
+
this.pubsubTopic = pubsubTopic;
|
12
13
|
this.proto = proto;
|
13
14
|
}
|
14
15
|
get ephemeral() {
|
@@ -53,10 +54,12 @@ export class DecodedMessage {
|
|
53
54
|
export class Encoder {
|
54
55
|
contentTopic;
|
55
56
|
ephemeral;
|
57
|
+
pubsubTopic;
|
56
58
|
metaSetter;
|
57
|
-
constructor(contentTopic, ephemeral = false, metaSetter) {
|
59
|
+
constructor(contentTopic, ephemeral = false, pubsubTopic, metaSetter) {
|
58
60
|
this.contentTopic = contentTopic;
|
59
61
|
this.ephemeral = ephemeral;
|
62
|
+
this.pubsubTopic = pubsubTopic;
|
60
63
|
this.metaSetter = metaSetter;
|
61
64
|
if (!contentTopic || contentTopic === "") {
|
62
65
|
throw new Error("Content topic must be specified");
|
@@ -86,18 +89,19 @@ export class Encoder {
|
|
86
89
|
/**
|
87
90
|
* Creates an encoder that encode messages without Waku level encryption or signature.
|
88
91
|
*
|
89
|
-
* An encoder is used to encode messages in the [
|
92
|
+
* An encoder is used to encode messages in the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
|
90
93
|
* format to be sent over the Waku network. The resulting encoder can then be
|
91
|
-
* pass to { @link @waku/interfaces.
|
92
|
-
* { @link @waku/interfaces.Relay.send } to automatically encode outgoing
|
94
|
+
* pass to { @link @waku/interfaces!ISender.send } to automatically encode outgoing
|
93
95
|
* messages.
|
94
96
|
*/
|
95
|
-
export function createEncoder({ contentTopic, ephemeral, metaSetter }) {
|
96
|
-
return new Encoder(contentTopic, ephemeral, metaSetter);
|
97
|
+
export function createEncoder({ pubsubTopic = DefaultPubSubTopic, contentTopic, ephemeral, metaSetter }) {
|
98
|
+
return new Encoder(contentTopic, ephemeral, pubsubTopic, metaSetter);
|
97
99
|
}
|
98
100
|
export class Decoder {
|
101
|
+
pubsubTopic;
|
99
102
|
contentTopic;
|
100
|
-
constructor(contentTopic) {
|
103
|
+
constructor(pubsubTopic, contentTopic) {
|
104
|
+
this.pubsubTopic = pubsubTopic;
|
101
105
|
this.contentTopic = contentTopic;
|
102
106
|
if (!contentTopic || contentTopic === "") {
|
103
107
|
throw new Error("Content topic must be specified");
|
@@ -105,7 +109,6 @@ export class Decoder {
|
|
105
109
|
}
|
106
110
|
fromWireToProtoObj(bytes) {
|
107
111
|
const protoMessage = proto.WakuMessage.decode(bytes);
|
108
|
-
log("Message decoded", protoMessage);
|
109
112
|
return Promise.resolve({
|
110
113
|
payload: protoMessage.payload,
|
111
114
|
contentTopic: protoMessage.contentTopic,
|
@@ -116,14 +119,14 @@ export class Decoder {
|
|
116
119
|
ephemeral: protoMessage.ephemeral ?? false
|
117
120
|
});
|
118
121
|
}
|
119
|
-
async fromProtoObj(
|
122
|
+
async fromProtoObj(pubsubTopic, proto) {
|
120
123
|
// https://rfc.vac.dev/spec/14/
|
121
124
|
// > If omitted, the value SHOULD be interpreted as version 0.
|
122
125
|
if (proto.version ?? 0 !== Version) {
|
123
|
-
log("Failed to decode due to incorrect version, expected:", Version, ", actual:", proto.version);
|
126
|
+
log.error("Failed to decode due to incorrect version, expected:", Version, ", actual:", proto.version);
|
124
127
|
return Promise.resolve(undefined);
|
125
128
|
}
|
126
|
-
return new DecodedMessage(
|
129
|
+
return new DecodedMessage(pubsubTopic, proto);
|
127
130
|
}
|
128
131
|
}
|
129
132
|
/**
|
@@ -131,13 +134,12 @@ export class Decoder {
|
|
131
134
|
*
|
132
135
|
* A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
|
133
136
|
* format when received from the Waku network. The resulting decoder can then be
|
134
|
-
* pass to { @link @waku/interfaces.
|
135
|
-
* { @link @waku/interfaces.Relay.subscribe } to automatically decode incoming
|
137
|
+
* pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decode incoming
|
136
138
|
* messages.
|
137
139
|
*
|
138
140
|
* @param contentTopic The resulting decoder will only decode messages with this content topic.
|
139
141
|
*/
|
140
|
-
export function createDecoder(contentTopic) {
|
141
|
-
return new Decoder(contentTopic);
|
142
|
+
export function createDecoder(contentTopic, pubsubTopic = DefaultPubSubTopic) {
|
143
|
+
return new Decoder(pubsubTopic, contentTopic);
|
142
144
|
}
|
143
145
|
//# sourceMappingURL=version_0.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version_0.js","sourceRoot":"","sources":["../../../src/lib/message/version_0.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"version_0.js","sourceRoot":"","sources":["../../../src/lib/message/version_0.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAS,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,MAAM,OAAO,cAAc;IAEhB;IACG;IAFZ,YACS,WAAmB,EAChB,KAAwB;QAD3B,gBAAW,GAAX,WAAW,CAAQ;QAChB,UAAK,GAAL,KAAK,CAAmB;IACjC,CAAC;IAEJ,IAAI,SAAS;QACX,OA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C,CAAC,CAAC;SACpD;IACH,CAAC;IAED,kBAAkB,CAAC,KAAiB;QAClC,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,YAAY,EAAE,YAAY,CAAC,YAAY;YACvC,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,SAAS;YAC1C,SAAS,EAAE,YAAY,CAAC,SAAS,IAAI,SAAS;YAC9C,IAAI,EAAE,YAAY,CAAC,IAAI,IAAI,SAAS;YACpC,cAAc,EAAE,YAAY,CAAC,cAAc,IAAI,SAAS;YACxD,SAAS,EAAE,YAAY,CAAC,SAAS,IAAI,KAAK;SAC3C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,WAAmB,EACnB,KAAoB;QAEpB,+BAA+B;QAC/B,8DAA8D;QAC9D,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,OAAO,EAAE;YAClC,GAAG,CAAC,KAAK,CACP,sDAAsD,EACtD,OAAO,EACP,WAAW,EACX,KAAK,CAAC,OAAO,CACd,CAAC;YACF,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACnC;QAED,OAAO,IAAI,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,YAAoB,EACpB,cAA2B,kBAAkB;IAE7C,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC"}
|
@@ -36,5 +36,5 @@ export interface QueryOptions {
|
|
36
36
|
*/
|
37
37
|
cursor?: Cursor;
|
38
38
|
}
|
39
|
-
export declare function createCursor(message: IDecodedMessage
|
39
|
+
export declare function createCursor(message: IDecodedMessage): Promise<Cursor>;
|
40
40
|
export declare function wakuStore(init?: Partial<ProtocolCreateOptions>): (libp2p: Libp2p) => IStore;
|