@libp2p/pubsub 0.0.0 → 0.2.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 (76) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +35 -0
  3. package/dist/src/errors.d.ts +39 -0
  4. package/dist/src/errors.d.ts.map +1 -0
  5. package/dist/src/errors.js +41 -0
  6. package/dist/src/errors.js.map +1 -0
  7. package/dist/src/index.d.ts +180 -0
  8. package/dist/src/index.d.ts.map +1 -0
  9. package/dist/src/index.js +467 -0
  10. package/dist/src/index.js.map +1 -0
  11. package/dist/src/message/rpc.d.ts +258 -0
  12. package/dist/src/message/rpc.js +699 -0
  13. package/dist/src/message/sign.d.ts +17 -0
  14. package/dist/src/message/sign.d.ts.map +1 -0
  15. package/dist/src/message/sign.js +84 -0
  16. package/dist/src/message/sign.js.map +1 -0
  17. package/dist/src/message/topic-descriptor.d.ts +254 -0
  18. package/dist/src/message/topic-descriptor.js +647 -0
  19. package/dist/src/peer-streams.d.ts +67 -0
  20. package/dist/src/peer-streams.d.ts.map +1 -0
  21. package/dist/src/peer-streams.js +112 -0
  22. package/dist/src/peer-streams.js.map +1 -0
  23. package/dist/src/utils.d.ts +29 -0
  24. package/dist/src/utils.d.ts.map +1 -0
  25. package/dist/src/utils.js +80 -0
  26. package/dist/src/utils.js.map +1 -0
  27. package/dist/test/emit-self.spec.d.ts +2 -0
  28. package/dist/test/emit-self.spec.d.ts.map +1 -0
  29. package/dist/test/emit-self.spec.js +63 -0
  30. package/dist/test/emit-self.spec.js.map +1 -0
  31. package/dist/test/instance.spec.d.ts +2 -0
  32. package/dist/test/instance.spec.d.ts.map +1 -0
  33. package/dist/test/instance.spec.js +50 -0
  34. package/dist/test/instance.spec.js.map +1 -0
  35. package/dist/test/lifesycle.spec.d.ts +2 -0
  36. package/dist/test/lifesycle.spec.d.ts.map +1 -0
  37. package/dist/test/lifesycle.spec.js +192 -0
  38. package/dist/test/lifesycle.spec.js.map +1 -0
  39. package/dist/test/message.spec.d.ts +2 -0
  40. package/dist/test/message.spec.d.ts.map +1 -0
  41. package/dist/test/message.spec.js +83 -0
  42. package/dist/test/message.spec.js.map +1 -0
  43. package/dist/test/pubsub.spec.d.ts +2 -0
  44. package/dist/test/pubsub.spec.d.ts.map +1 -0
  45. package/dist/test/pubsub.spec.js +310 -0
  46. package/dist/test/pubsub.spec.js.map +1 -0
  47. package/dist/test/sign.spec.d.ts +2 -0
  48. package/dist/test/sign.spec.d.ts.map +1 -0
  49. package/dist/test/sign.spec.js +93 -0
  50. package/dist/test/sign.spec.js.map +1 -0
  51. package/dist/test/topic-validators.spec.d.ts +2 -0
  52. package/dist/test/topic-validators.spec.d.ts.map +1 -0
  53. package/dist/test/topic-validators.spec.js +86 -0
  54. package/dist/test/topic-validators.spec.js.map +1 -0
  55. package/dist/test/utils/index.d.ts +22 -0
  56. package/dist/test/utils/index.d.ts.map +1 -0
  57. package/dist/test/utils/index.js +86 -0
  58. package/dist/test/utils/index.js.map +1 -0
  59. package/dist/test/utils.spec.d.ts +2 -0
  60. package/dist/test/utils.spec.d.ts.map +1 -0
  61. package/dist/test/utils.spec.js +53 -0
  62. package/dist/test/utils.spec.js.map +1 -0
  63. package/dist/tsconfig.tsbuildinfo +1 -0
  64. package/package.json +109 -4
  65. package/src/README.md +251 -0
  66. package/src/errors.ts +45 -0
  67. package/src/index.ts +610 -0
  68. package/src/message/rpc.d.ts +258 -0
  69. package/src/message/rpc.js +699 -0
  70. package/src/message/rpc.proto +20 -0
  71. package/src/message/sign.ts +101 -0
  72. package/src/message/topic-descriptor.d.ts +254 -0
  73. package/src/message/topic-descriptor.js +647 -0
  74. package/src/message/topic-descriptor.proto +30 -0
  75. package/src/peer-streams.ts +169 -0
  76. package/src/utils.ts +93 -0
@@ -0,0 +1,22 @@
1
+ import { PubsubBaseProtocol } from '../../src/index.js';
2
+ import { RPC, IRPC } from '../../src/message/rpc.js';
3
+ import type { Registrar } from '@libp2p/interfaces/registrar';
4
+ export declare const createPeerId: () => Promise<import("@libp2p/peer-id").Ed25519PeerId>;
5
+ export declare class PubsubImplementation extends PubsubBaseProtocol {
6
+ _publish(): Promise<void>;
7
+ _decodeRpc(bytes: Uint8Array): RPC;
8
+ _encodeRpc(rpc: IRPC): Uint8Array;
9
+ }
10
+ export declare const mockRegistrar: {
11
+ handle: () => void;
12
+ register: () => void;
13
+ unregister: () => void;
14
+ };
15
+ export declare const createMockRegistrar: (registrarRecord: Map<string, Record<string, any>>) => Registrar;
16
+ export declare const ConnectionPair: () => {
17
+ stream: any;
18
+ newStream: () => Promise<{
19
+ stream: any;
20
+ }>;
21
+ }[];
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../test/utils/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAG7D,eAAO,MAAM,YAAY,wDAIxB,CAAA;AAED,qBAAa,oBAAqB,SAAQ,kBAAkB;IACpD,QAAQ;IAId,UAAU,CAAE,KAAK,EAAE,UAAU;IAI7B,UAAU,CAAE,GAAG,EAAE,IAAI;CAGtB;AAED,eAAO,MAAM,aAAa;;;;CAIzB,CAAA;AAED,eAAO,MAAM,mBAAmB,oBAAqB,IAAI,MAAM,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC,cAqDpF,CAAA;AAED,eAAO,MAAM,cAAc;;;;;GAa1B,CAAA"}
@@ -0,0 +1,86 @@
1
+ // @ts-expect-error no types
2
+ import DuplexPair from 'it-pair/duplex.js';
3
+ import * as PeerIdFactory from '@libp2p/peer-id-factory';
4
+ import { PubsubBaseProtocol } from '../../src/index.js';
5
+ import { RPC } from '../../src/message/rpc.js';
6
+ export const createPeerId = async () => {
7
+ const peerId = await PeerIdFactory.createEd25519PeerId();
8
+ return peerId;
9
+ };
10
+ export class PubsubImplementation extends PubsubBaseProtocol {
11
+ async _publish() {
12
+ // ...
13
+ }
14
+ _decodeRpc(bytes) {
15
+ return RPC.decode(bytes);
16
+ }
17
+ _encodeRpc(rpc) {
18
+ return RPC.encode(rpc).finish();
19
+ }
20
+ }
21
+ export const mockRegistrar = {
22
+ handle: () => { },
23
+ register: () => { },
24
+ unregister: () => { }
25
+ };
26
+ export const createMockRegistrar = (registrarRecord) => {
27
+ const registrar = {
28
+ handle: (multicodecs, handler) => {
29
+ const rec = registrarRecord.get(multicodecs[0]) ?? {};
30
+ registrarRecord.set(multicodecs[0], {
31
+ ...rec,
32
+ handler
33
+ });
34
+ },
35
+ register: (topology) => {
36
+ const { multicodecs } = topology;
37
+ const rec = registrarRecord.get(multicodecs[0]) ?? {};
38
+ registrarRecord.set(multicodecs[0], {
39
+ ...rec,
40
+ onConnect: topology._onConnect,
41
+ onDisconnect: topology._onDisconnect
42
+ });
43
+ return multicodecs[0];
44
+ },
45
+ unregister: (id) => {
46
+ registrarRecord.delete(id);
47
+ },
48
+ getConnection(peerId) {
49
+ throw new Error('Not implemented');
50
+ },
51
+ peerStore: {
52
+ on: () => {
53
+ throw new Error('Not implemented');
54
+ },
55
+ protoBook: {
56
+ get: () => {
57
+ throw new Error('Not implemented');
58
+ }
59
+ },
60
+ peers: new Map(),
61
+ get: (peerId) => {
62
+ throw new Error('Not implemented');
63
+ }
64
+ },
65
+ connectionManager: {
66
+ on: () => {
67
+ throw new Error('Not implemented');
68
+ }
69
+ }
70
+ };
71
+ return registrar;
72
+ };
73
+ export const ConnectionPair = () => {
74
+ const [d0, d1] = DuplexPair();
75
+ return [
76
+ {
77
+ stream: d0,
78
+ newStream: async () => await Promise.resolve({ stream: d0 })
79
+ },
80
+ {
81
+ stream: d1,
82
+ newStream: async () => await Promise.resolve({ stream: d1 })
83
+ }
84
+ ];
85
+ };
86
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M,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,EAAE,CAAA;IAE7B,OAAO;QACL;YACE,MAAM,EAAE,EAAE;YACV,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;SAC7D;QACD;YACE,MAAM,EAAE,EAAE;YACV,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;SAC7D;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../../test/utils.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ import { expect } from 'aegir/utils/chai.js';
2
+ import * as utils from '../src/utils.js';
3
+ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
4
+ describe('utils', () => {
5
+ it('randomSeqno', () => {
6
+ const first = utils.randomSeqno();
7
+ const second = utils.randomSeqno();
8
+ expect(first).to.have.length(8);
9
+ expect(second).to.have.length(8);
10
+ expect(first).to.not.eql(second);
11
+ });
12
+ it('msgId should not generate same ID for two different Uint8Arrays', () => {
13
+ const peerId = 'QmPNdSYk5Rfpo5euNqwtyizzmKXMNHdXeLjTQhcN4yfX22';
14
+ const msgId0 = utils.msgId(peerId, uint8ArrayFromString('15603533e990dfde', 'base16'));
15
+ const msgId1 = utils.msgId(peerId, uint8ArrayFromString('15603533e990dfe0', 'base16'));
16
+ expect(msgId0).to.not.deep.equal(msgId1);
17
+ });
18
+ it('anyMatch', () => {
19
+ [
20
+ { a: [1, 2, 3], b: [4, 5, 6], result: false },
21
+ { a: [1, 2], b: [1, 2], result: true },
22
+ { a: [1, 2, 3], b: [4, 5, 1], result: true },
23
+ { a: [5, 6, 1], b: [1, 2, 3], result: true },
24
+ { a: [], b: [], result: false },
25
+ { a: [1], b: [2], result: false }
26
+ ].forEach((test) => {
27
+ expect(utils.anyMatch(new Set(test.a), new Set(test.b))).to.equal(test.result);
28
+ expect(utils.anyMatch(new Set(test.a), test.b)).to.equal(test.result);
29
+ });
30
+ });
31
+ it('ensureArray', () => {
32
+ expect(utils.ensureArray('hello')).to.be.eql(['hello']);
33
+ expect(utils.ensureArray([1, 2])).to.be.eql([1, 2]);
34
+ });
35
+ it('converts an OUT msg.from to binary', () => {
36
+ const binaryId = uint8ArrayFromString('1220e2187eb3e6c4fb3e7ff9ad4658610624a6315e0240fc6f37130eedb661e939cc', 'base16');
37
+ const stringId = 'QmdZEWgtaWAxBh93fELFT298La1rsZfhiC2pqwMVwy3jZM';
38
+ const m = [{
39
+ from: binaryId
40
+ }, {
41
+ from: stringId
42
+ }];
43
+ const expected = [
44
+ { from: binaryId },
45
+ { from: binaryId }
46
+ ];
47
+ for (let i = 0; i < m.length; i++) {
48
+ // @ts-expect-error some Message fields are missing from m
49
+ expect(utils.normalizeOutRpcMessage(m[i])).to.deep.equal(expected[i]);
50
+ }
51
+ });
52
+ });
53
+ //# sourceMappingURL=utils.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../test/utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAE5E,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,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C,EAAE,GAAG,EAAE;QAC5C,MAAM,QAAQ,GAAG,oBAAoB,CAAC,sEAAsE,EAAE,QAAQ,CAAC,CAAA;QACvH,MAAM,QAAQ,GAAG,gDAAgD,CAAA;QACjE,MAAM,CAAC,GAAG,CAAC;gBACT,IAAI,EAAE,QAAQ;aACf,EAAE;gBACD,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG;YACf,EAAE,IAAI,EAAE,QAAQ,EAAE;YAClB,EAAE,IAAI,EAAE,QAAQ,EAAE;SACnB,CAAA;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACjC,0DAA0D;YAC1D,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;SACtE;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../src/errors.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/err-code/dist/index.d.ts","../../../node_modules/it-pipe/index.d.ts","../../../node_modules/eventemitter3/index.d.ts","../node_modules/p-queue/dist/queue.d.ts","../node_modules/p-queue/dist/options.d.ts","../node_modules/p-queue/dist/priority-queue.d.ts","../node_modules/p-queue/dist/index.d.ts","../../../node_modules/multiformats/types/bases/interface.d.ts","../../../node_modules/multiformats/types/hashes/interface.d.ts","../../../node_modules/multiformats/types/cid.d.ts","../../libp2p-interfaces/dist/src/peer-id/index.d.ts","../../../node_modules/@multiformats/multiaddr/dist/src/protocols-table.d.ts","../../../node_modules/@multiformats/multiaddr/dist/src/index.d.ts","../../libp2p-interfaces/dist/src/stream-muxer/index.d.ts","../../libp2p-interfaces/dist/src/connection/status.d.ts","../../libp2p-interfaces/dist/src/connection/index.d.ts","../../libp2p-interfaces/dist/src/topology/index.d.ts","../../libp2p-interfaces/dist/src/peer-data/index.d.ts","../../libp2p-interfaces/dist/src/registrar/index.d.ts","../../libp2p-topology/dist/src/index.d.ts","../../libp2p-topology/dist/src/multicodec-topology.d.ts","../../../node_modules/protobufjs/index.d.ts","../src/message/rpc.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/bl/bufferlist.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/it-length-prefixed/dist/src/types.d.ts","../../../node_modules/it-length-prefixed/dist/src/encode.d.ts","../../../node_modules/it-length-prefixed/dist/src/decode.d.ts","../../../node_modules/it-length-prefixed/dist/src/index.d.ts","../../../node_modules/it-pushable/index.d.ts","../../../node_modules/abortable-iterator/index.d.ts","../../../node_modules/event-target-shim/index.d.ts","../../../node_modules/abort-controller/dist/abort-controller.d.ts","../src/peer-streams.ts","../../../node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/iso-random-stream/dist/src/index.d.ts","../../../node_modules/multiformats/types/bases/base.d.ts","../../../node_modules/uint8arrays/types/src/util/bases.d.ts","../../../node_modules/uint8arrays/types/src/from-string.d.ts","../../libp2p-peer-id/dist/src/index.d.ts","../../../node_modules/multiformats/types/hashes/digest.d.ts","../../../node_modules/multiformats/types/hashes/hasher.d.ts","../../../node_modules/multiformats/types/hashes/sha2.d.ts","../../libp2p-interfaces/dist/src/pubsub/index.d.ts","../src/utils.ts","../../../node_modules/@types/bl/index.d.ts","../../libp2p-interfaces/dist/src/keys/index.d.ts","../../libp2p-peer-id-factory/dist/src/index.d.ts","../../../node_modules/uint8arrays/types/src/concat.d.ts","../../../node_modules/@libp2p/crypto/dist/src/hmac/index.d.ts","../../../node_modules/@libp2p/crypto/dist/src/aes/index.d.ts","../../../node_modules/protobufjs/minimal.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/keys.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/key-stretcher.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/interface.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/ecdh.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/ephemeral-keys.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/rsa-class.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/ed25519-class.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/secp256k1-class.d.ts","../../../node_modules/@libp2p/crypto/dist/src/keys/index.d.ts","../../../node_modules/@libp2p/crypto/dist/src/random-bytes.d.ts","../../../node_modules/@libp2p/crypto/dist/src/pbkdf2.d.ts","../../../node_modules/@libp2p/crypto/dist/src/index.d.ts","../src/message/sign.ts","../../libp2p-interfaces/dist/src/index.d.ts","../src/index.ts","../src/message/topic-descriptor.d.ts","../../../node_modules/@types/chai/index.d.ts","../../../node_modules/@types/chai-as-promised/index.d.ts","../../../node_modules/chai-parentheses/index.d.ts","../../../node_modules/@types/chai-subset/index.d.ts","../../../node_modules/chai-bites/index.d.ts","../../../node_modules/@types/chai-string/index.d.ts","../../../node_modules/aegir/dist/utils/chai.d.ts","../test/utils/index.ts","../../../node_modules/delay/index.d.ts","../test/emit-self.spec.ts","../test/instance.spec.ts","../../../node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts","../../../node_modules/@types/sinon/index.d.ts","../test/lifesycle.spec.ts","../test/message.spec.ts","../../../node_modules/p-wait-for/node_modules/p-timeout/index.d.ts","../../../node_modules/p-wait-for/index.d.ts","../test/pubsub.spec.ts","../test/sign.spec.ts","../../../node_modules/uint8arrays/types/src/equals.d.ts","../test/topic-validators.spec.ts","../test/utils.spec.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/long/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/minimist/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"e34eb9339171ec45da2801c1967e4d378bd61a1dceaa1b1b4e1b6d28cb9ca962","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"460951c84c7acc70c678d57681b00fad096fc7b71427348967c0e79ba44e8ff5","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","a02a19deaa2c497d36c136459dd2561b57ebb22075ac0d6aad176430a8639aa1","b413b4ac5cc2c9ffeb8d6b9141abf53568e79751f705886a8c34a6ecf1814da1","b80c780c52524beb13488942543972c8b0e54400e8b59cee0169f38d0fabb968","a0a118c9a66853bb5ec086c878963b5d178ecb3eec72d75dc553d86adef67801","900fda07b414a316563f34af1618da8405ae031d7b783a22c99b87e98506c075","16948966490e3a773fa3ce4394aadad693862daed736137222ab6012db3c5e60","c29bc1f96f8c282756232746e5e1ddca817e6d5f27bfe2b3e75fd4bca91a7152","930446bf32192f698b78f8ea4b309d8c2cfe02ab5ad78e4db907417405ebf5e7","a5de53bdfcdca7af39e735be7bbd736c38b1e34eeec36bd6a835a0e37ba23705","ef706b4970dd8bf7ab414bb981993d4f379845f3592622237bad1b3332fde794","254c3d289f204ba745b8353d4530566df1adcf7666ba29294f733a2e1b3cdf77","dcaaf86cdcf77baf88172a23d27df51c284afd72935bd1d57c7a9edd2f4f6007","6a30d3048a516174263bd3b4d916ed87cd418a67226d08f5cb4e128819d047f4","5fb8b088382f73d2ff63558d14494c5defd5fa783adbff4b72f3cfb02ee9fba6","6666d48a46dbfd565490e7f8789093e2392c5bdcc3a380dfdd91c77237e43101","ecbf5c1c87fe17bc253621fee49d2378b947c1a5d6aaa726efebf9df099e0da5","2302819f22093fec391514218a8dc5ee75a51d9f39aff36f8853d1e038badadf","bbdb6e600e97a92cac817097543d0c7e1b8fc8c29bc4eb22dc7299dbc3dcf3d9","d0f98ba0d85a72e83f6d613b5f5f98715aa8bc82303c562ac6aca2f04cd22933","a934c9796262f578e0f435fb90a556b98d31b762ef3c3f60c55dd832fc3e7cf9","323413273c64329a18044f4b68d885aadd597a66de7ceb38071896d31c16d83f","1558c642e03689d42843e7b047b9c20e77ee09ab388ff854484db5dcfbed11da","9f95c458c387b79111aad37f45dd1a704563bef59207ad2129cb14799a8183ea","0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"c2ab70bbc7a24c42a790890739dd8a0ba9d2e15038b40dff8163a97a5d148c00","affectsGlobalScope":true},"422dbb183fdced59425ca072c8bd09efaa77ce4e2ab928ec0d8a1ce062d2a45a",{"version":"2a801b0322994c3dd7f0ef30265d19b3dd3bae6d793596879166ed6219c3da68","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","bcc8caf03ee65fe8610d258752f255fbdddbb2e4de7b6c5628956a5a0d859ec8","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","cc0b61316c4f37393f1f9595e93b673f4184e9d07f4c127165a490ec4a928668","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"c28e5baab1b53377c90d12970e207a2644bc3627840066449e37e2a59125d07e","affectsGlobalScope":true},"7a5459efa09ea82088234e6533a203d528c594b01787fb90fba148885a36e8b6","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","fce6a1a1553ff7d54ffb8bb3ae488c9cb5f2f4f4e52212c1abe40f544819ef35","ad41bb744149e92adb06eb953da195115620a3f2ad48e7d3ae04d10762dae197","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"5d0a9ea09d990b5788f867f1c79d4878f86f7384cb7dab38eecbf22f9efd063d","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"bd1a08e30569b0fb2f0b21035eb9b039871f68faa9b98accf847e9c878c5e0a9","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"cfe724f7c694aab65a9bdd1acb05997848c504548c9d4c71645c187a091cfa2a","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"3345c276cab0e76dda86c0fb79104ff915a4580ba0f3e440870e183b1baec476","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","e383ff72aabf294913f8c346f5da1445ae6ad525836d28efd52cbadc01a361a6","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7","1835259a20b9fa6b1882931375b69ae5978195f2b139b4e0db51ec8319261649","b52cd693219a63dd21282ac99a7bf55f77cbe8a91f097968856419cc2e05f017","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"267af67ea520cabd16402522756b19ac63d9e2c1c86e7c4d1ddeb991c32e12c9","9bba2209d41d622d34c30c36ea1f5ab13f10fc69dd7933918dce353dc4376703","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","19268f157a78d6040d07356daa38fb5f2c5696b7bd622128e8eb9b06abb2d6de","e393f682a59c4cef27ce03d37d888becfa705582cc0239a529ddaf5ae1d275a8","a438dadad94d5dccfd3a68c46a1e1f6df6ccec701f5d3b134e3e36abd2f0627a","561515e21dc78b22d78e2ef6db9bc8cea39597964c8370488105f4f65960b442","f9c5e7bae060d2f1cb622b3d0192ca87fcbb29daf0f92d5ed62a63ce6f079354","f1304f38533801f935674f1f096ccd8d12e98e1daeb7ad7582103e5d704c0a42","2859adaa4f2db3d4f0fc37ad86f056045341496b58fba0dbc16a222f9d5d55b1","655ed305e8f4cb95d3f578040301a4e4d6ace112b1bd8824cd32bda66c3677d1","c52594a37b2ad8bf760ba2415e2484b293407b68eb513bf123201d3234f8b6b7","5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","dd978a63c94ab731a6544f57b3bf105b191b613b46cea6d40adafdc7e99c2e71","9ec4f7b64a4efdae7039397c79e6826d29284bf91e7fc63574c65881f68cee3c","a9fa925f15fdd7529fefd4fb81c43dde5db0db2fd1694ef4709c193f01d78046","e47d9ea931ddade1deee3946884e8dc7aafbf4af74f9ecb85ef77c895100bd39","0841c3aed9354ad025302d5c7cde53916825047646e559d918b62a31500aebe7","b507f8cf1c28bb4d42cd28fda5b450da2fd7a603e669ff16c9f334b5529aa32e","853c5447ea8851049c1d008e130d23030d9fe3b5a8405a0ae7e55b00e173692d","fbb30441703cfccfe241fbdb604f01e1e5ac558eec5d3f04fd32281dc9b3cdb9","2f686fbec43c87bc9b9c3d0e237f780e0e822d2c3a9a25fc99a16030a294b764","e41f0fdc6e47f79d12f6b6f5d379824f553f510ca6079074b95bc5d10edface0","8976b61efb75d99ab21de533960f69bf9638abc356a5cd39cec7d11d69e45860","e92e5257d413d87d2367f0ddc723c6d2d95ef47fee8ab3be5073542e0aa2e59b","0e4c4e3b7f9bddce2bfa2d4536da74ee8c9579ef0ef654e975d44ded342201a2","1b752a578f800c10001b02fc557efe5b98cf90513c7dd082b1d8e8463f594123","4e37a214f2cd5a350affba5580d1d7c01ca83da6393ef2c13a66d74fc7b95eac","f83554a38826cfd54e6831fbd50de2af0fe02b233e6a439a709a810e1a6c3c8c","c41f936b7b28954b2ca854b1064a4d7dc99e072a60ec86a2d28fddecc4b08775","932cade1c5802123b5831f332ad8a6297f0f7d14d0ee04f5a774408f393e2200","ea1c876c91e42bd8b634103177c2c1ba1efa336292b88074b3352c2518f8f2d9","497d1f3c7d054758c6829d262027e5d02efcba61f974e931bc37e9691ae4c31a","860508f4db04e456707d42165c83f297b590ec47cdacfb29a1f9c373554f7aeb","aaf4673898dca18c059997aae0e8ae725215c8ee0998e9d4a6fd173384276748","b90473059128d1a4c028852a710058a3a8944835188672f5846deba05a1e778e","3923eec89864566caeb9e51fb6014aaa57d3f2cda6b2559b4be7d10a73af440c","7cd16bc7b353bc5bc92c2797d40e04b345e73b37ac0e604a46c55e0a9eeccca4","faf83f7fe8705f95957460ea041cb0ff69a37632e005f4439a3fab3a41e1ebdd","99a84d180bd07d67ba6faa0612d5735fd89dbdccc8dbed288cd3078e382838b3","bac8538f264c701ff678ee83ca643abb330533bfe595438318147416fb1d213d","2c37b4438e0f6fac413797aa10f575c413d21ba66b71fa5c4dcf4147a26665cf","44c5fe99a681f8baa206a77b294dc36ff5aa527743270eb622aecd5e2cfdcaaa","bfa4a04debd5da0bbbafef6068c2b7cfea145fd1ed635033d8b850cf9ac614ee","ce76ac1c5c57e5c082967bd7734e32b4c30efd28c5ea828da241ad8059cef072","4ef4bcb473c8692d7d6278e4f2a2951e8cc88215dce561268eeef32ee8f275b5","c2d84628c98f006ca5fffd8022b3de5f122d3e38c33bf97ff8e1157114d21825",{"version":"c8747693e5872ad5ef3aa016731a06915e1c34dae987829d9aa5bd40c7a2c54b","affectsGlobalScope":true},{"version":"f6ae17283c6912c202004178339d6d22f8c9edfe4e335f9f11b555c631633daf","affectsGlobalScope":true},{"version":"c1f79c6d85cd84518fd7349588b3c61bdc189f58e3866f925cbf4631c81e31f9","affectsGlobalScope":true},{"version":"f4c0db3a49cea9babd5d224ba14243a6a6119bf65a65198994033aaea3a60a71","affectsGlobalScope":true},{"version":"42f28f4cfca4a70bd89c1d55d76c7978275030b894f6793f36890265c11a83a4","affectsGlobalScope":true},{"version":"41071d2f1a39386d10bf36d1ba4712ad42a900047f16a109936df9e48f13673e","affectsGlobalScope":true},"61f705a779045717e1a18c75456c2a7ca52eb50e0694a3da86fddfe67503bff6","764bbd233f2ad90270c122974bc2a10e905fb5c542b2401959edc973d64fc287","4c7fb1f4c57f3cd9d571c5e4cae33503530273a45579fa0babaf36b64a776eaa","64f7321742688a44f736050fd7110e439343bd0277ba53ee9dea9bdb2ffeb02d","58e5d9e9d5271392be19bdb8fbe9595cb4bb7bb904af6e77e9100704c51df503","6b40029289530423f407a22755c85b81740f9acfd88d2b53564f8c1657c26660","50a5b297e6c91df4f6068d98467a5e7ba4eeb888b9376757734dd4b1dfcdacd4","75e2b391615acc6753a370839522c6f0d096d1ec4c9f5c477904aa6d04367f5f","724fda2159c5c94acc3a04a8c3267a8152bddf3944bb4776b1777b2400d3ff9c","c2f2e0d6fd83e551d0203b770d250c7def6a64bdee7159445c2d259ba51ba826","f97c1b3e3466f02248c74ede5c3d5008017d5a1e045c5a2c466726af6e7635f8","841bb9802d407bb60c60837ca3978205866c9dc3295516915b74803d68075586","2709b476a9c55713173b86f83ca68c176a37497bfb94137c3a42eea750201e8a","3157fa89ebde7e5d5499da49d8ae13e523c1de12d5c1285251c17b7672887b1e","2ee807a3bf31da2b4ff27fbe8fdf797f5b23a8da81d097f669fb26e20dd9420b","b9d080cd3a1e0bfd4899d03b569c985422cebe6536c67c60cdac163fae4e39ad","8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","0359682c54e487c4cab2b53b2b4d35cc8dea4d9914bc6abcdb5701f8b8e745a4","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","e8465811693dfe4e96ef2b3dffda539d6edfe896961b7af37b44db2c0e48532b","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05",{"version":"e8bf92aabac2b11e1bf60a0161039cd6f5f0cd9713863ca2289dd7b10eddece8","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","58a3914b1cce4560d9ad6eee2b716caaa030eda0a90b21ca2457ea9e2783eaa3","f7e133b20ee2669b6c0e5d7f0cd510868c57cd64b283e68c7f598e30ce9d76d2","45627c7d24633686b0274d9402652930ba2e4fe74df04f114393ae121d1e8afe","b2d70a269840a9528db473ac7565442434333a05c1f66801a7a672e82beb903e"],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":false,"esModuleInterop":true,"importsNotUsedAsValues":2,"module":6,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitReturns":false,"noUnusedLocals":true,"noUnusedParameters":false,"outDir":"./","removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"stripInternal":true,"target":7},"fileIdsList":[[110],[110,145,146,156,157,158],[110,150],[110,132],[110,151],[110,148,149,152,153,154,155],[110,147],[110,117],[55,110],[110,117,118,130],[110,164],[42,110],[67,110],[70,110],[71,76,110],[72,82,83,90,99,109,110],[72,73,82,90,110],[74,110],[75,76,83,91,110],[76,99,106,110],[77,79,82,90,110],[78,110],[79,80,110],[81,82,110],[82,110],[82,83,84,99,109,110],[82,83,84,99,110],[85,90,99,109,110],[82,83,85,86,90,99,106,109,110],[85,87,99,106,109,110],[67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116],[82,88,110],[89,109,110],[79,82,90,99,110],[91,110],[92,110],[70,93,110],[94,108,110,114],[95,110],[96,110],[82,97,110],[97,98,110,112],[82,99,100,101,110],[99,101,110],[99,100,110],[102,110],[103,110],[82,104,105,110],[104,105,110],[76,90,99,106,110],[107,110],[90,108,110],[71,85,96,109,110],[76,110],[99,110,111],[110,112],[110,113],[71,76,82,84,93,99,109,110,112,114],[99,110,115],[110,117,129],[110,175],[110,196],[82,99,110,117],[110,126],[110,164,165,166,167,168,169],[110,164,165],[110,130],[110,118,120],[71,110,117,118,120],[110,120,121,122],[110,117,118],[51,110],[51,52,110],[52,110],[52,110,136],[110,137],[110,179],[65,110],[110,133],[51,110,132],[54,56,57,58,110],[54,56,110],[51,52,53,110],[54,62,82,110,117,124],[54,57,59,61,110],[54,59,110],[110,135,142],[46,47,48,49,110],[47,110],[47,48,110],[41,43,44,45,50,54,59,62,64,66,82,110,128,139,140,141,160,161],[66,110,134,135,139,140,143,144,159],[43,45,54,57,82,110,123,124,125,127],[66,110,131,134,135,138,139],[110,134,170,171,172],[54,110,139,162,170,171],[54,62,110,139,162,170,171,176],[54,110,134,139,162,170,171,176],[54,110,128,134,170,171,176,180],[54,66,110,134,139,140,143,144,159,160,170],[44,110,128,134,143,170,171,176,180,183],[110,134,140,170],[54,62,66,110,143,162],[54,60,62,110],[54,59,60,61,62,63,110]],"referencedMap":[[146,1],[145,1],[159,2],[151,3],[154,4],[152,5],[156,6],[150,1],[149,1],[148,7],[153,8],[155,4],[158,1],[157,1],[56,9],[55,1],[175,1],[118,8],[141,10],[165,11],[169,11],[167,11],[164,1],[43,12],[186,1],[187,1],[188,1],[189,1],[190,1],[191,1],[192,1],[42,1],[67,13],[68,13],[70,14],[71,15],[72,16],[73,17],[74,18],[75,19],[76,20],[77,21],[78,22],[79,23],[80,23],[81,24],[82,25],[83,26],[84,27],[69,1],[116,1],[85,28],[86,29],[87,30],[117,31],[88,32],[89,33],[90,34],[91,35],[92,36],[93,37],[94,38],[95,39],[96,40],[97,41],[98,42],[99,43],[101,44],[100,45],[102,46],[103,47],[104,48],[105,49],[106,50],[107,51],[108,52],[109,53],[110,54],[111,55],[112,56],[113,57],[114,58],[115,59],[193,1],[194,1],[130,60],[195,1],[176,61],[196,1],[197,62],[198,63],[127,64],[125,1],[170,65],[119,1],[168,11],[166,66],[172,1],[44,1],[126,1],[46,1],[131,67],[122,68],[121,69],[123,70],[120,71],[45,1],[124,1],[132,72],[51,1],[53,73],[136,74],[137,75],[52,1],[138,76],[180,77],[179,1],[65,1],[147,78],[129,1],[8,1],[9,1],[11,1],[10,1],[2,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[3,1],[4,1],[23,1],[20,1],[21,1],[22,1],[24,1],[25,1],[26,1],[5,1],[27,1],[28,1],[29,1],[30,1],[6,1],[31,1],[32,1],[33,1],[34,1],[7,1],[39,1],[35,1],[36,1],[37,1],[38,1],[1,1],[40,1],[144,1],[183,1],[134,79],[133,80],[59,81],[58,1],[161,1],[142,1],[61,82],[54,83],[139,84],[62,85],[57,1],[60,86],[143,87],[135,83],[50,88],[48,89],[49,90],[47,1],[41,1],[162,91],[66,78],[160,92],[163,78],[128,93],[140,94],[173,95],[174,96],[177,97],[178,98],[181,99],[182,100],[184,101],[185,102],[171,103],[63,104],[64,105]],"exportedModulesMap":[[146,1],[145,1],[159,2],[151,3],[154,4],[152,5],[156,6],[150,1],[149,1],[148,7],[153,8],[155,4],[158,1],[157,1],[56,9],[55,1],[175,1],[118,8],[141,10],[165,11],[169,11],[167,11],[164,1],[43,12],[186,1],[187,1],[188,1],[189,1],[190,1],[191,1],[192,1],[42,1],[67,13],[68,13],[70,14],[71,15],[72,16],[73,17],[74,18],[75,19],[76,20],[77,21],[78,22],[79,23],[80,23],[81,24],[82,25],[83,26],[84,27],[69,1],[116,1],[85,28],[86,29],[87,30],[117,31],[88,32],[89,33],[90,34],[91,35],[92,36],[93,37],[94,38],[95,39],[96,40],[97,41],[98,42],[99,43],[101,44],[100,45],[102,46],[103,47],[104,48],[105,49],[106,50],[107,51],[108,52],[109,53],[110,54],[111,55],[112,56],[113,57],[114,58],[115,59],[193,1],[194,1],[130,60],[195,1],[176,61],[196,1],[197,62],[198,63],[127,64],[125,1],[170,65],[119,1],[168,11],[166,66],[172,1],[44,1],[126,1],[46,1],[131,67],[122,68],[121,69],[123,70],[120,71],[45,1],[124,1],[132,72],[51,1],[53,73],[136,74],[137,75],[52,1],[138,76],[180,77],[179,1],[65,1],[147,78],[129,1],[8,1],[9,1],[11,1],[10,1],[2,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[3,1],[4,1],[23,1],[20,1],[21,1],[22,1],[24,1],[25,1],[26,1],[5,1],[27,1],[28,1],[29,1],[30,1],[6,1],[31,1],[32,1],[33,1],[34,1],[7,1],[39,1],[35,1],[36,1],[37,1],[38,1],[1,1],[40,1],[144,1],[183,1],[134,79],[133,80],[59,81],[58,1],[161,1],[142,1],[61,82],[54,83],[139,84],[62,85],[57,1],[60,86],[143,87],[135,83],[50,88],[48,89],[49,90],[47,1],[41,1],[162,91],[66,78],[160,92],[163,78],[128,93],[140,94],[173,95],[174,96],[177,97],[178,98],[181,99],[182,100],[184,101],[185,102],[171,103],[63,104],[64,105]],"semanticDiagnosticsPerFile":[146,145,159,151,154,152,156,150,149,148,153,155,158,157,56,55,175,118,141,165,169,167,164,43,186,187,188,189,190,191,192,42,67,68,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,69,116,85,86,87,117,88,89,90,91,92,93,94,95,96,97,98,99,101,100,102,103,104,105,106,107,108,109,110,111,112,113,114,115,193,194,130,195,176,196,197,198,127,125,170,119,168,166,172,44,126,46,131,122,121,123,120,45,124,132,51,53,136,137,52,138,180,179,65,147,129,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,39,35,36,37,38,1,40,144,183,134,133,59,58,161,142,61,54,139,62,57,60,143,135,50,48,49,47,41,162,66,160,163,128,140,173,174,177,178,181,182,184,185,171,63,64]},"version":"4.4.4"}
package/package.json CHANGED
@@ -1,7 +1,112 @@
1
1
  {
2
2
  "name": "@libp2p/pubsub",
3
- "version": "0.0.0",
4
- "description": "",
5
- "main": "index.js",
6
- "license": "(Apache-2.0 OR MIT)"
3
+ "version": "0.2.0",
4
+ "description": "libp2p pubsub base class",
5
+ "type": "module",
6
+ "files": [
7
+ "src",
8
+ "dist"
9
+ ],
10
+ "types": "dist/src/index.d.ts",
11
+ "typesVersions": {
12
+ "*": {
13
+ "*": [
14
+ "dist/src/*",
15
+ "dist/src/*/index"
16
+ ]
17
+ }
18
+ },
19
+ "eslintConfig": {
20
+ "extends": "ipfs",
21
+ "ignorePatterns": [
22
+ "src/message/*.d.ts",
23
+ "src/message/*.js"
24
+ ]
25
+ },
26
+ "scripts": {
27
+ "lint": "aegir lint",
28
+ "dep-check": "aegir dep-check dist/src/**/*.js",
29
+ "build": "npm run build:types && npm run build:copy-proto-files",
30
+ "build:types": "tsc",
31
+ "build:proto": "npm run build:proto:rpc && npm run build:proto:topic-descriptor",
32
+ "build:proto:rpc": "pbjs -t static-module -w es6 -r libp2p-pubsub-rpc --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/rpc.js ./src/message/rpc.proto",
33
+ "build:proto:topic-descriptor": "pbjs -t static-module -w es6 -r libp2p-pubsub-topic-descriptor --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/topic-descriptor.js ./src/message/topic-descriptor.proto",
34
+ "build:proto-types": "npm run build:proto-types:rpc && npm run build:proto-types:topic-descriptor",
35
+ "build:proto-types:rpc": "pbts -o src/message/rpc.d.ts src/message/rpc.js",
36
+ "build:proto-types:topic-descriptor": "pbts -o src/message/topic-descriptor.d.ts src/message/topic-descriptor.js",
37
+ "build:copy-proto-files": "cp src/message/*.js dist/src/message && cp src/message/*.d.ts dist/src/message",
38
+ "pretest": "npm run build",
39
+ "test": "aegir test -f ./dist/test/**/*.js",
40
+ "test:browser": "aegir test -t browser -f ./dist/test/**/*.js",
41
+ "test:node": "aegir test -t node -f ./dist/test/**/*.js",
42
+ "test:electron-main": "aegir test -t electron-main -f ./dist/test/**/*.js"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
47
+ },
48
+ "keywords": [
49
+ "libp2p",
50
+ "interface"
51
+ ],
52
+ "author": "",
53
+ "license": "(Apache-2.0 OR MIT)",
54
+ "bugs": {
55
+ "url": "https://github.com/libp2p/js-libp2p-interfaces/issues"
56
+ },
57
+ "homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-pubsub#readme",
58
+ "dependencies": {
59
+ "@libp2p/crypto": "^0.22.2",
60
+ "@libp2p/interfaces": "^0.2.0",
61
+ "@libp2p/peer-id": "^0.2.0",
62
+ "@libp2p/peer-id-factory": "^0.2.0",
63
+ "@libp2p/topology": "^0.2.0",
64
+ "@multiformats/multiaddr": "^10.1.1",
65
+ "debug": "^4.3.2",
66
+ "err-code": "^3.0.1",
67
+ "iso-random-stream": "^2.0.0",
68
+ "it-length-prefixed": "^5.0.3",
69
+ "it-pipe": "^1.1.0",
70
+ "multiformats": "^9.4.10",
71
+ "p-queue": "^7.1.0",
72
+ "uint8arrays": "^3.0.0"
73
+ },
74
+ "devDependencies": {
75
+ "@types/bl": "^5.0.2",
76
+ "@types/debug": "^4.1.7",
77
+ "aegir": "^36.0.0",
78
+ "protobufjs": "^6.10.2",
79
+ "util": "^0.12.4"
80
+ },
81
+ "exports": {
82
+ ".": {
83
+ "import": "./dist/src/index.js",
84
+ "types": "./dist/src/index.d.ts"
85
+ },
86
+ "./errors": {
87
+ "import": "./dist/src/errors.js",
88
+ "types": "./dist/src/errors.d.ts"
89
+ },
90
+ "./peer-streams": {
91
+ "import": "./dist/src/peer-streams.js",
92
+ "types": "./dist/src/peer-streams.d.ts"
93
+ },
94
+ "./signature-policy": {
95
+ "import": "./dist/src/signature-policy.js",
96
+ "types": "./dist/src/signature-policy.d.ts"
97
+ },
98
+ "./utils": {
99
+ "import": "./dist/src/utils.js",
100
+ "types": "./dist/src/utils.d.ts"
101
+ },
102
+ "./message/rpc": {
103
+ "import": "./dist/src/message/rpc.js",
104
+ "types": "./dist/src/message/rpc.d.ts"
105
+ },
106
+ "./message/topic-descriptor": {
107
+ "import": "./dist/src/message/topic-descriptor.js",
108
+ "types": "./dist/src/message/topic-descriptor.d.ts"
109
+ }
110
+ },
111
+ "gitHead": "899cb6a9390c748bccf9b6404f104efb011a0c9c"
7
112
  }
package/src/README.md ADDED
@@ -0,0 +1,251 @@
1
+ # libp2p-pubsub <!-- omit in toc -->
2
+
3
+ This module contains a base implementation for a libp2p pubsub router implementation. It should be extended to implement a pubsub router compatible with libp2p.
4
+
5
+ ## Table of Contents <!-- omit in toc -->
6
+
7
+ - [Implementations using this interface](#implementations-using-this-interface)
8
+ - [Interface usage](#interface-usage)
9
+ - [Extend interface](#extend-interface)
10
+ - [Example](#example)
11
+ - [API](#api)
12
+ - [Constructor](#constructor)
13
+ - [`new Pubsub({options})`](#new-pubsuboptions)
14
+ - [Parameters](#parameters)
15
+ - [Start](#start)
16
+ - [`pubsub.start()`](#pubsubstart)
17
+ - [Stop](#stop)
18
+ - [`pubsub.stop()`](#pubsubstop)
19
+ - [Publish](#publish)
20
+ - [`pubsub.publish(topic, message)`](#pubsubpublishtopic-message)
21
+ - [Parameters](#parameters-1)
22
+ - [Returns](#returns)
23
+ - [Subscribe](#subscribe)
24
+ - [`pubsub.subscribe(topic)`](#pubsubsubscribetopic)
25
+ - [Parameters](#parameters-2)
26
+ - [Unsubscribe](#unsubscribe)
27
+ - [`pubsub.unsubscribe(topic)`](#pubsubunsubscribetopic)
28
+ - [Parameters](#parameters-3)
29
+ - [Get Topics](#get-topics)
30
+ - [`pubsub.getTopics()`](#pubsubgettopics)
31
+ - [Returns](#returns-1)
32
+ - [Get Peers Subscribed to a topic](#get-peers-subscribed-to-a-topic)
33
+ - [`pubsub.getSubscribers(topic)`](#pubsubgetsubscriberstopic)
34
+ - [Parameters](#parameters-4)
35
+ - [Returns](#returns-2)
36
+ - [Validate](#validate)
37
+ - [`pubsub.validate(message)`](#pubsubvalidatemessage)
38
+ - [Parameters](#parameters-5)
39
+ - [Returns](#returns-3)
40
+ - [Test suite usage](#test-suite-usage)
41
+
42
+ ## Implementations using this interface
43
+
44
+ You can check the following implementations as examples for building your own pubsub router.
45
+
46
+ - [libp2p/js-libp2p-floodsub](https://github.com/libp2p/js-libp2p-floodsub)
47
+ - [ChainSafe/js-libp2p-gossipsub](https://github.com/ChainSafe/js-libp2p-gossipsub)
48
+
49
+ ## Interface usage
50
+
51
+ `interface-pubsub` abstracts the implementation protocol registration within `libp2p` and takes care of all the protocol connections and streams, as well as the subscription management and the features describe in the libp2p [pubsub specs](https://github.com/libp2p/specs/tree/master/pubsub). This way, a pubsub implementation can focus on its message routing algorithm, instead of also needing to create the setup for it.
52
+
53
+ ### Extend interface
54
+
55
+ A pubsub router implementation should start by extending the `interface-pubsub` class and **MUST** override the `_publish` function, according to the router algorithms. This function is responsible for forwarding publish messages to other peers, as well as forwarding received messages if the router provides the `canRelayMessage` option to the base implementation.
56
+
57
+ Other functions, such as `start`, `stop`, `subscribe`, `unsubscribe`, `_encodeRpc`, `_decodeRpc`, `_processRpcMessage`, `_addPeer` and `_removePeer` may be overwritten if the pubsub implementation needs to customize their logic. Implementations overriding these functions **MUST** call `super`.
58
+
59
+ The `start` and `stop` functions are responsible for the registration of the pubsub protocol with libp2p. The `stop` function also guarantees that the open streams in the protocol are properly closed.
60
+
61
+ The `subscribe` and `unsubscribe` functions take care of the subscription management and its inherent message propagation.
62
+
63
+ When using a custom protobuf definition for message marshalling, you should override `_encodeRpc` and `_decodeRpc` to use the new protobuf instead of the default one.
64
+
65
+ `_processRpcMessage` is responsible for handling messages received from other peers. This should be extended if further operations/validations are needed by the router.
66
+
67
+ The `_addPeer` and `_removePeer` functions are called when new peers running the pubsub router protocol establish a connection with the peer. They are used for tracking the open streams between the peers.
68
+
69
+ All the remaining functions **MUST NOT** be overwritten.
70
+
71
+ ### Example
72
+
73
+ The following example aims to show how to create your pubsub implementation extending this base protocol. The pubsub implementation will handle the subscriptions logic.
74
+
75
+ ```JavaScript
76
+ const Pubsub = require('libp2p-interfaces/src/pubsub')
77
+
78
+ class PubsubImplementation extends Pubsub {
79
+ constructor({ libp2p, options })
80
+ super({
81
+ debugName: 'libp2p:pubsub',
82
+ multicodecs: '/pubsub-implementation/1.0.0',
83
+ libp2p,
84
+ globalSigningPolicy: options.globalSigningPolicy
85
+ })
86
+ }
87
+
88
+ _publish (message) {
89
+ // Required to be implemented by the subclass
90
+ // Routing logic for the message
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## API
96
+
97
+ The interface aims to specify a common interface that all pubsub router implementation should follow. A pubsub router implementation should extend the [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter). When peers receive pubsub messages, these messages will be emitted by the event emitter where the `eventName` will be the `topic` associated with the message.
98
+
99
+ ### Constructor
100
+
101
+ The base class constructor configures the pubsub instance for use with a libp2p instance. It includes settings for logging, signature policies, etc.
102
+
103
+ #### `new Pubsub({options})`
104
+
105
+ ##### Parameters
106
+
107
+ | Name | Type | Description | Default |
108
+ |------|------|-------------|---------|
109
+ | options.libp2p | `Libp2p` | libp2p instance | required, no default |
110
+ | options.debugName | `string` | log namespace | required, no default |
111
+ | options.multicodecs | `string \| Array<string>` | protocol identifier(s) | required, no default |
112
+ | options.globalSignaturePolicy | `'StrictSign' \| 'StrictNoSign'` | signature policy to be globally applied | `'StrictSign'` |
113
+ | options.canRelayMessage | `boolean` | if can relay messages if not subscribed | `false` |
114
+ | options.emitSelf | `boolean` | if `publish` should emit to self, if subscribed | `false` |
115
+
116
+ ### Start
117
+
118
+ Starts the pubsub subsystem. The protocol will be registered to `libp2p`, which will result in pubsub being notified when peers who support the protocol connect/disconnect to `libp2p`.
119
+
120
+ #### `pubsub.start()`
121
+
122
+ ### Stop
123
+
124
+ Stops the pubsub subsystem. The protocol will be unregistered from `libp2p`, which will remove all listeners for the protocol and the established connections will be closed.
125
+
126
+ #### `pubsub.stop()`
127
+
128
+ ### Publish
129
+
130
+ Publish data message to pubsub topics.
131
+
132
+ #### `pubsub.publish(topic, message)`
133
+
134
+ ##### Parameters
135
+
136
+ | Name | Type | Description |
137
+ |------|------|-------------|
138
+ | topic | `string` | pubsub topic |
139
+ | message | `Uint8Array` | message to publish |
140
+
141
+ ##### Returns
142
+
143
+ | Type | Description |
144
+ |------|-------------|
145
+ | `Promise<void>` | resolves once the message is published to the network |
146
+
147
+ ### Subscribe
148
+
149
+ Subscribe to the given topic.
150
+
151
+ #### `pubsub.subscribe(topic)`
152
+
153
+ ##### Parameters
154
+
155
+ | Name | Type | Description |
156
+ |------|------|-------------|
157
+ | topic | `string` | pubsub topic |
158
+
159
+ ### Unsubscribe
160
+
161
+ Unsubscribe from the given topic.
162
+
163
+ #### `pubsub.unsubscribe(topic)`
164
+
165
+ ##### Parameters
166
+
167
+ | Name | Type | Description |
168
+ |------|------|-------------|
169
+ | topic | `string` | pubsub topic |
170
+
171
+ ### Get Topics
172
+
173
+ Get the list of topics which the peer is subscribed to.
174
+
175
+ #### `pubsub.getTopics()`
176
+
177
+ ##### Returns
178
+
179
+ | Type | Description |
180
+ |------|-------------|
181
+ | `Array<String>` | Array of subscribed topics |
182
+
183
+ ### Get Peers Subscribed to a topic
184
+
185
+ Get a list of the [PeerId](https://github.com/libp2p/js-peer-id) strings that are subscribed to one topic.
186
+
187
+ #### `pubsub.getSubscribers(topic)`
188
+
189
+ ##### Parameters
190
+
191
+ | Name | Type | Description |
192
+ |------|------|-------------|
193
+ | topic | `string` | pubsub topic |
194
+
195
+ ##### Returns
196
+
197
+ | Type | Description |
198
+ |------|-------------|
199
+ | `Array<string>` | Array of base-58 PeerId's |
200
+
201
+ ### Validate
202
+
203
+ Validates a message according to the signature policy and topic-specific validation function.
204
+
205
+ #### `pubsub.validate(message)`
206
+
207
+ ##### Parameters
208
+
209
+ | Name | Type | Description |
210
+ |------|------|-------------|
211
+ | message | `Message` | a pubsub message |
212
+
213
+ #### Returns
214
+
215
+ | Type | Description |
216
+ |------|-------------|
217
+ | `Promise<void>` | resolves if the message is valid |
218
+
219
+ ## Test suite usage
220
+
221
+ ```js
222
+ 'use strict'
223
+
224
+ const tests = require('libp2p-interfaces-compliance-tests/pubsub')
225
+ const YourPubsubRouter = require('../src')
226
+
227
+ describe('compliance', () => {
228
+ let peers
229
+ let pubsubNodes = []
230
+
231
+ tests({
232
+ async setup (number = 1, options = {}) {
233
+ // Create number pubsub nodes with libp2p
234
+ peers = await createPeers({ number })
235
+
236
+ peers.forEach((peer) => {
237
+ const ps = new YourPubsubRouter(peer, options)
238
+
239
+ pubsubNodes.push(ps)
240
+ })
241
+
242
+ return pubsubNodes
243
+ },
244
+ async teardown () {
245
+ // Clean up any resources created by setup()
246
+ await Promise.all(pubsubNodes.map(ps => ps.stop()))
247
+ peers.length && await Promise.all(peers.map(peer => peer.stop()))
248
+ }
249
+ })
250
+ })
251
+ ```