libp2p 0.33.0 → 0.35.2

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 (74) hide show
  1. package/dist/src/circuit/index.d.ts +2 -2
  2. package/dist/src/circuit/index.d.ts.map +1 -1
  3. package/dist/src/circuit/transport.d.ts +1 -1
  4. package/dist/src/circuit/transport.d.ts.map +1 -1
  5. package/dist/src/config.d.ts +0 -1
  6. package/dist/src/connection-manager/auto-dialler.d.ts +56 -0
  7. package/dist/src/connection-manager/auto-dialler.d.ts.map +1 -0
  8. package/dist/src/connection-manager/index.d.ts +0 -10
  9. package/dist/src/connection-manager/index.d.ts.map +1 -1
  10. package/dist/src/content-routing/index.d.ts +4 -2
  11. package/dist/src/content-routing/index.d.ts.map +1 -1
  12. package/dist/src/dht/dht-content-routing.d.ts +30 -0
  13. package/dist/src/dht/dht-content-routing.d.ts.map +1 -0
  14. package/dist/src/dht/dht-peer-routing.d.ts +29 -0
  15. package/dist/src/dht/dht-peer-routing.d.ts.map +1 -0
  16. package/dist/src/dialer/dial-request.d.ts +4 -4
  17. package/dist/src/dialer/dial-request.d.ts.map +1 -1
  18. package/dist/src/dialer/index.d.ts +2 -3
  19. package/dist/src/dialer/index.d.ts.map +1 -1
  20. package/dist/src/errors.d.ts +2 -0
  21. package/dist/src/identify/index.d.ts +1 -1
  22. package/dist/src/identify/index.d.ts.map +1 -1
  23. package/dist/src/index.d.ts +3 -2
  24. package/dist/src/index.d.ts.map +1 -1
  25. package/dist/src/metrics/stats.d.ts +0 -1
  26. package/dist/src/metrics/stats.d.ts.map +1 -1
  27. package/dist/src/nat-manager.d.ts.map +1 -1
  28. package/dist/src/peer-routing.d.ts +8 -1
  29. package/dist/src/peer-routing.d.ts.map +1 -1
  30. package/dist/src/peer-store/address-book.d.ts +1 -1
  31. package/dist/src/peer-store/address-book.d.ts.map +1 -1
  32. package/dist/src/peer-store/index.d.ts +37 -24
  33. package/dist/src/peer-store/index.d.ts.map +1 -1
  34. package/dist/src/peer-store/metadata-book.d.ts +3 -2
  35. package/dist/src/peer-store/metadata-book.d.ts.map +1 -1
  36. package/dist/src/peer-store/persistent/index.d.ts +0 -1
  37. package/dist/src/record/envelope/index.d.ts +23 -0
  38. package/dist/src/record/envelope/index.d.ts.map +1 -1
  39. package/dist/src/record/peer-record/index.d.ts +6 -0
  40. package/dist/src/record/peer-record/index.d.ts.map +1 -1
  41. package/dist/src/registrar.d.ts +1 -1
  42. package/dist/src/registrar.d.ts.map +1 -1
  43. package/dist/src/upgrader.d.ts +1 -1
  44. package/dist/src/upgrader.d.ts.map +1 -1
  45. package/package.json +30 -25
  46. package/src/circuit/auto-relay.js +4 -4
  47. package/src/circuit/circuit/hop.js +2 -2
  48. package/src/circuit/circuit/stop.js +1 -1
  49. package/src/circuit/circuit/utils.js +2 -2
  50. package/src/circuit/index.js +1 -1
  51. package/src/circuit/transport.js +1 -1
  52. package/src/connection-manager/auto-dialler.js +118 -0
  53. package/src/connection-manager/index.js +0 -52
  54. package/src/content-routing/index.js +35 -9
  55. package/src/dht/dht-content-routing.js +44 -0
  56. package/src/dht/dht-peer-routing.js +51 -0
  57. package/src/dialer/dial-request.js +8 -2
  58. package/src/dialer/index.js +3 -4
  59. package/src/errors.js +3 -1
  60. package/src/get-peer.js +1 -1
  61. package/src/identify/index.js +8 -8
  62. package/src/index.js +16 -14
  63. package/src/insecure/plaintext.js +1 -1
  64. package/src/keychain/cms.js +2 -2
  65. package/src/keychain/index.js +9 -9
  66. package/src/nat-manager.js +2 -2
  67. package/src/peer-routing.js +12 -4
  68. package/src/peer-store/address-book.js +1 -1
  69. package/src/peer-store/metadata-book.js +2 -1
  70. package/src/peer-store/persistent/index.js +5 -5
  71. package/src/pnet/crypto.js +1 -1
  72. package/src/pnet/key-generator.js +1 -1
  73. package/src/transport-manager.js +1 -1
  74. package/src/upgrader.js +9 -9
@@ -64,6 +64,8 @@ declare class Relay {
64
64
  declare namespace Relay {
65
65
  export { Libp2p, RelayAdvertiseOptions, HopOptions, AutoRelayOptions };
66
66
  }
67
+ import AutoRelay = require("./auto-relay");
68
+ type Libp2p = import('../');
67
69
  type RelayAdvertiseOptions = {
68
70
  bootDelay?: number | undefined;
69
71
  enabled?: boolean | undefined;
@@ -80,6 +82,4 @@ type AutoRelayOptions = {
80
82
  maxListeners?: number | undefined;
81
83
  enabled?: boolean | undefined;
82
84
  };
83
- import AutoRelay = require("./auto-relay");
84
- type Libp2p = import('../');
85
85
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/circuit/index.js"],"names":[],"mappings":";AAmBA;;;;;;;;;;;;;;;GAeG;AAEH;IACE;;;;;OAKG;IACH,oBAFW,MAAM,EAYhB;IATC,uBAAqB;IACrB;;;;;;;;;;;;;;;MAEC;IAGD,8BAA0G;IA8B5G;;;;OAIG;IACH,qBAFa,QAAQ,IAAI,CAAC,CAezB;IA3CD;;;;OAIG;IACH,SAFa,IAAI,CAWhB;IAJG,cAEC;IAIL;;;;OAIG;IACH,QAFa,IAAI,CAIhB;CAqBF;;;;;;;;;;;;;;;;;;;;;cA/EY,OAAO,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/circuit/index.js"],"names":[],"mappings":";AAmBA;;;;;;;;;;;;;;;GAeG;AAEH;IACE;;;;;OAKG;IACH,oBAFW,MAAM,EAYhB;IATC,uBAAqB;IACrB;;;;;;;;;;;;;;;MAEC;IAGD,8BAA0G;IA8B5G;;;;OAIG;IACH,qBAFa,QAAQ,IAAI,CAAC,CAezB;IA3CD;;;;OAIG;IACH,SAFa,IAAI,CAWhB;IAJG,cAEC;IAIL;;;;OAIG;IACH,QAFa,IAAI,CAIhB;CAqBF;;;;;cA/EY,OAAO,KAAK,CAAC"}
@@ -10,7 +10,7 @@ declare class Circuit {
10
10
  * @param {any} other
11
11
  * @returns {other is Transport}
12
12
  */
13
- static isTransport(other: any): other is Transport;
13
+ static isTransport(other: any): other is any;
14
14
  /**
15
15
  * Creates an instance of the Circuit Transport.
16
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/circuit/transport.js"],"names":[],"mappings":";AAwBA;;;GAGG;AAEH;IA4LE;;;;;OAKG;IACH,0BAHW,GAAG,sBAKb;IAnMD;;;;;;;OAOG;IACH;QAHkC,MAAM,EAA7B,OAAO,KAAK,CAAC;QACkB,QAAQ,EAAvC,OAAO,aAAa,CAAC;OAY/B;IATC,6BAA4B;IAC5B,mCAAkC;IAClC,oDAAkD;IAClD,iCAAyB;IACzB;;;;;;;;;;;;;;;mCAAoC;IACpC,uBAAqB;IACrB,eAA2B;IAK7B;;;;OAIG;IACH;QAH6B,UAAU,EAA5B,UAAU;QACS,MAAM,EAAzB,WAAW;sBA6DrB;IAED;;;;;;;OAOG;IACH,SALW,SAAS;QAEa,MAAM;QAC1B,QAAQ,UAAU,CAAC,CAwD/B;IAED;;;;;;OAMG;IACH,wBAJW,GAAG,sBAED,OAAO,uCAAuC,EAAE,QAAQ,CAYpE;IAHC,8BAAsB;IAKxB;;;;;OAKG;IACH,mBAHW,SAAS,EAAE,GACT,SAAS,EAAE,CAQvB;IAED,mCAEC;CAWF;;;;;;mBAxMY,OAAO,0CAA0C,EAAE,WAAW"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/circuit/transport.js"],"names":[],"mappings":";AAwBA;;;GAGG;AAEH;IA4LE;;;;;OAKG;IACH,0BAHW,GAAG,gBAKb;IAnMD;;;;;;;OAOG;IACH;QAHkC,MAAM,EAA7B,OAAO,KAAK,CAAC;QACkB,QAAQ,EAAvC,OAAO,aAAa,CAAC;OAY/B;IATC,6BAA4B;IAC5B,mCAAkC;IAClC,oDAAkD;IAClD,iCAAyB;IACzB;;;;;;;;;;;;;;;mCAAoC;IACpC,uBAAqB;IACrB,eAA2B;IAK7B;;;;OAIG;IACH;QAH6B,UAAU,EAA5B,UAAU;QACS,MAAM,EAAzB,WAAW;sBA6DrB;IAED;;;;;;;OAOG;IACH,SALW,SAAS;QAEa,MAAM;QAC1B,QAAQ,UAAU,CAAC,CAwD/B;IAED;;;;;;OAMG;IACH,wBAJW,GAAG,sBAED,OAAO,uCAAuC,EAAE,QAAQ,CAYpE;IAHC,8BAAsB;IAKxB;;;;;OAKG;IACH,mBAHW,SAAS,EAAE,GACT,SAAS,EAAE,CAQvB;IAED,mCAEC;CAWF;;;;;;mBAxMY,OAAO,0CAA0C,EAAE,WAAW"}
@@ -87,5 +87,4 @@ export function validate(opts: Libp2pOptions): {
87
87
  export type Multiaddr = import('multiaddr').Multiaddr;
88
88
  export type Libp2pOptions = import('.').Libp2pOptions;
89
89
  export type constructorOptions = import('.').constructorOptions;
90
- import { publicAddressesFirst } from "libp2p-utils/src/address-sort";
91
90
  //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,56 @@
1
+ export = AutoDialler;
2
+ /**
3
+ * @typedef {import('../index')} Libp2p
4
+ * @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
5
+ */
6
+ /**
7
+ * @typedef {Object} AutoDiallerOptions
8
+ * @property {boolean} [enabled = true] - Should preemptively guarantee connections are above the low watermark
9
+ * @property {number} [minConnections = 0] - The minimum number of connections to avoid pruning
10
+ * @property {number} [autoDialInterval = 10000] - How often, in milliseconds, it should preemptively guarantee connections are above the low watermark
11
+ */
12
+ declare class AutoDialler {
13
+ /**
14
+ * Proactively tries to connect to known peers stored in the PeerStore.
15
+ * It will keep the number of connections below the upper limit and sort
16
+ * the peers to connect based on wether we know their keys and protocols.
17
+ *
18
+ * @class
19
+ * @param {Libp2p} libp2p
20
+ * @param {AutoDiallerOptions} options
21
+ */
22
+ constructor(libp2p: Libp2p, options?: AutoDiallerOptions);
23
+ _options: any;
24
+ _libp2p: import("../index");
25
+ _running: boolean;
26
+ _autoDialTimeout: any;
27
+ _autoDial(): Promise<void>;
28
+ /**
29
+ * Starts the auto dialer
30
+ */
31
+ start(): void;
32
+ /**
33
+ * Stops the auto dialler
34
+ */
35
+ stop(): Promise<void>;
36
+ }
37
+ declare namespace AutoDialler {
38
+ export { Libp2p, Connection, AutoDiallerOptions };
39
+ }
40
+ type Libp2p = import('../index');
41
+ type AutoDiallerOptions = {
42
+ /**
43
+ * - Should preemptively guarantee connections are above the low watermark
44
+ */
45
+ enabled?: boolean | undefined;
46
+ /**
47
+ * - The minimum number of connections to avoid pruning
48
+ */
49
+ minConnections?: number | undefined;
50
+ /**
51
+ * - How often, in milliseconds, it should preemptively guarantee connections are above the low watermark
52
+ */
53
+ autoDialInterval?: number | undefined;
54
+ };
55
+ type Connection = import("libp2p-interfaces/src/connection/connection");
56
+ //# sourceMappingURL=auto-dialler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-dialler.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/auto-dialler.js"],"names":[],"mappings":";AAiBA;;;GAGG;AAEH;;;;;GAKG;AAEH;IACE;;;;;;;;OAQG;IACH,oBAHW,MAAM,YACN,kBAAkB,EAU5B;IAPC,cAAqF;IACrF,4BAAqB;IACrB,kBAAqB;IACrB,sBAA4B;IAkC9B,2BAqCC;IAjED;;OAEG;IACH,cASC;IAED;;OAEG;IACH,sBASC;CAwCF;;;;cAjGY,OAAO,UAAU,CAAC"}
@@ -48,7 +48,6 @@ declare class ConnectionManager extends EventEmitter {
48
48
  connections: Map<string, Connection[]>;
49
49
  _started: boolean;
50
50
  _timer: any;
51
- _autoDialTimeout: any;
52
51
  /**
53
52
  * Checks the libp2p metrics to determine if any values have exceeded
54
53
  * the configured maximums.
@@ -56,15 +55,6 @@ declare class ConnectionManager extends EventEmitter {
56
55
  * @private
57
56
  */
58
57
  private _checkMetrics;
59
- /**
60
- * Proactively tries to connect to known peers stored in the PeerStore.
61
- * It will keep the number of connections below the upper limit and sort
62
- * the peers to connect based on wether we know their keys and protocols.
63
- *
64
- * @async
65
- * @private
66
- */
67
- private _autoDial;
68
58
  _latencyMonitor: LatencyMonitor;
69
59
  /**
70
60
  * Get current number of open connections.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,oBAHW,MAAM,YACN,wBAAwB,EAuClC;IAlCC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,CAED;IAE5B;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,CAEP;IAE5B,kBAAqB;IACrB,YAAkB;IAClB,sBAA4B;IAwF9B;;;;;OAKG;IACH,sBAcC;IA8GD;;;;;;;OAOG;IACH,kBAqCC;IAnQC,gCAGE;IAGJ;;OAEG;IACH,mBAGC;IAED;;;OAGG;IACH,cAcC;IA4JD;;;;;OAKG;IACH,0BAEC;IAlKD;;;;OAIG;IACH,sBAUC;IAED;;;;OAIG;IACH,wBAWC;IAED;;;;;;;OAOG;IACH,qBAJW,MAAM,SACN,MAAM,GACJ,IAAI,CAOhB;IAwBD;;;;;OAKG;IACH,sBAHW,UAAU,GACR,IAAI,CAqBhB;IAED;;;;;OAKG;IACH,yBAHW,UAAU,GACR,IAAI,CAchB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,UAAU,GAAC,IAAI,CAQ3B;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,UAAU,EAAE,CAexB;IAYD;;;;;;OAMG;IACH,uBAOC;IAiDD;;;;;OAKG;IACH,4BAiBC;CACF;;;;;;;;cA9VY,OAAO,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,oBAHW,MAAM,YACN,wBAAwB,EAqClC;IAhCC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,CAED;IAE5B;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,CAEP;IAE5B,kBAAqB;IACrB,YAAkB;IAoFpB;;;;;OAKG;IACH,sBAcC;IArGC,gCAGE;IAGJ;;OAEG;IACH,mBAGC;IAED;;;OAGG;IACH,cAYC;IA2JD;;;;;OAKG;IACH,0BAEC;IAjKD;;;;OAIG;IACH,sBASC;IAED;;;;OAIG;IACH,wBAWC;IAED;;;;;;;OAOG;IACH,qBAJW,MAAM,SACN,MAAM,GACJ,IAAI,CAOhB;IAwBD;;;;;OAKG;IACH,sBAHW,UAAU,GACR,IAAI,CAqBhB;IAED;;;;;OAKG;IACH,yBAHW,UAAU,GACR,IAAI,CAchB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,UAAU,GAAC,IAAI,CAQ3B;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,UAAU,EAAE,CAexB;IAYD;;;;;;OAMG;IACH,uBAOC;IAED;;;;;OAKG;IACH,4BAiBC;CACF;;;;;;;;cA1SY,OAAO,KAAK,CAAC"}
@@ -75,11 +75,13 @@ declare class ContentRouting {
75
75
  * @param {number} nVals
76
76
  * @param {Object} [options] - get options
77
77
  * @param {number} [options.timeout] - optional timeout (default: 60000)
78
- * @returns {Promise<GetData[]>}
79
78
  */
80
79
  getMany(key: Uint8Array, nVals: number, options?: {
81
80
  timeout?: number | undefined;
82
- } | undefined): Promise<GetData[]>;
81
+ } | undefined): AsyncGenerator<{
82
+ from: any;
83
+ val: any;
84
+ }, void, unknown>;
83
85
  }
84
86
  declare namespace ContentRouting {
85
87
  export { PeerId, Multiaddr, CID, ContentRoutingModule, GetData };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-routing/index.js"],"names":[],"mappings":";AAcA;;;;;GAKG;AAEH;;;;GAIG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAYtB;IATC,qBAAoB;IACpB,qCAAqC;IACrC,SADW,oBAAoB,EAAE,CACkB;IACnD,SAAsB;IAQxB;;;;;;;;OAQG;IACH,mBANW,GAAG;;;oBAID,cAAc;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CAgBlE;IAED;;;;;;OAMG;IACH,aAHW,GAAG,GACD,QAAQ,IAAI,CAAC,CAQzB;IAED;;;;;;;;OAQG;IACH,SANW,UAAU,SACV,UAAU;;oBAGR,QAAQ,IAAI,CAAC,CAQzB;IAED;;;;;;;;OAQG;IACH,SALW,UAAU;;oBAGR,QAAQ,OAAO,CAAC,CAQ5B;IAED;;;;;;;;OAQG;IACH,aANW,UAAU,SACV,MAAM;;oBAGJ,QAAQ,OAAO,EAAE,CAAC,CAQ9B;CACF;;;;4BApHY,OAAO,6CAA6C,EAAE,cAAc;WADpE,OAAO,kBAAkB,EAAE,GAAG;cAF9B,OAAO,SAAS,CAAC;iBACjB,OAAO,WAAW,EAAE,SAAS;;UAO5B,MAAM;SACN,UAAU"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-routing/index.js"],"names":[],"mappings":";AAeA;;;;;GAKG;AAEH;;;;GAIG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAYtB;IATC,qBAAoB;IACpB,qCAAqC;IACrC,SADW,oBAAoB,EAAE,CACkB;IACnD,SAAsB;IAQxB;;;;;;;;OAQG;IACH,mBANW,GAAG;;;oBAID,cAAc;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CAgBlE;IAED;;;;;;OAMG;IACH,aAHW,GAAG,GACD,QAAQ,IAAI,CAAC,CAQzB;IAED;;;;;;;;OAQG;IACH,SANW,UAAU,SACV,UAAU;;oBAGR,QAAQ,IAAI,CAAC,CAQzB;IAED;;;;;;;;OAQG;IACH,SALW,UAAU;;oBAGR,QAAQ,OAAO,CAAC,CAc5B;IAED;;;;;;;OAOG;IACH,aALW,UAAU,SACV,MAAM;;;;;sBA8BhB;CACF;;;;4BA7IY,OAAO,6CAA6C,EAAE,cAAc;WADpE,OAAO,kBAAkB,EAAE,GAAG;cAF9B,OAAO,SAAS,CAAC;iBACjB,OAAO,WAAW,EAAE,SAAS;;UAO5B,MAAM;SACN,UAAU"}
@@ -0,0 +1,30 @@
1
+ export type PeerId = import('peer-id');
2
+ export type ContentRoutingModule = import('libp2p-interfaces/src/content-routing/types').ContentRouting;
3
+ export type CID = import('multiformats/cid').CID;
4
+ /**
5
+ * @typedef {import('peer-id')} PeerId
6
+ * @typedef {import('libp2p-interfaces/src/content-routing/types').ContentRouting} ContentRoutingModule
7
+ * @typedef {import('multiformats/cid').CID} CID
8
+ */
9
+ /**
10
+ * Wrapper class to convert events into returned values
11
+ *
12
+ * @implements {ContentRoutingModule}
13
+ */
14
+ export class DHTContentRouting implements ContentRoutingModule {
15
+ /**
16
+ * @param {import('libp2p-kad-dht').DHT} dht
17
+ */
18
+ constructor(dht: import('libp2p-kad-dht').DHT);
19
+ _dht: import("libp2p-kad-dht/dist/src/types").DHT;
20
+ /**
21
+ * @param {CID} cid
22
+ */
23
+ provide(cid: CID): Promise<void>;
24
+ /**
25
+ * @param {CID} cid
26
+ * @param {*} options
27
+ */
28
+ findProviders(cid: CID, options: any): AsyncGenerator<import("libp2p-kad-dht/dist/src/types").PeerData, void, undefined>;
29
+ }
30
+ //# sourceMappingURL=dht-content-routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dht-content-routing.d.ts","sourceRoot":"","sources":["../../../src/dht/dht-content-routing.js"],"names":[],"mappings":"qBAKa,OAAO,SAAS,CAAC;mCACjB,OAAO,6CAA6C,EAAE,cAAc;kBACpE,OAAO,kBAAkB,EAAE,GAAG;AAH3C;;;;GAIG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,iBAFW,OAAO,gBAAgB,EAAE,GAAG,EAItC;IADC,kDAAe;IAGjB;;OAEG;IACH,aAFW,GAAG,iBAIb;IAED;;;OAGG;IACH,mBAHW,GAAG,mGASb;CACF"}
@@ -0,0 +1,29 @@
1
+ export type PeerId = import('peer-id');
2
+ export type PeerRoutingModule = import('libp2p-interfaces/src/peer-routing/types').PeerRouting;
3
+ /**
4
+ * @typedef {import('peer-id')} PeerId
5
+ * @typedef {import('libp2p-interfaces/src/peer-routing/types').PeerRouting} PeerRoutingModule
6
+ */
7
+ /**
8
+ * Wrapper class to convert events into returned values
9
+ *
10
+ * @implements {PeerRoutingModule}
11
+ */
12
+ export class DHTPeerRouting implements PeerRoutingModule {
13
+ /**
14
+ * @param {import('libp2p-kad-dht').DHT} dht
15
+ */
16
+ constructor(dht: import('libp2p-kad-dht').DHT);
17
+ _dht: import("libp2p-kad-dht/dist/src/types").DHT;
18
+ /**
19
+ * @param {PeerId} peerId
20
+ * @param {any} options
21
+ */
22
+ findPeer(peerId: PeerId, options?: any): Promise<import("libp2p-kad-dht/dist/src/types").PeerData>;
23
+ /**
24
+ * @param {Uint8Array} key
25
+ * @param {any} options
26
+ */
27
+ getClosestPeers(key: Uint8Array, options?: any): AsyncGenerator<import("libp2p-kad-dht/dist/src/types").PeerData, void, undefined>;
28
+ }
29
+ //# sourceMappingURL=dht-peer-routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dht-peer-routing.d.ts","sourceRoot":"","sources":["../../../src/dht/dht-peer-routing.js"],"names":[],"mappings":"qBAMa,OAAO,SAAS,CAAC;gCACjB,OAAO,0CAA0C,EAAE,WAAW;AAF3E;;;GAGG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,iBAFW,OAAO,gBAAgB,EAAE,GAAG,EAItC;IADC,kDAAe;IAGjB;;;OAGG;IACH,iBAHW,MAAM,YACN,GAAG,6DAUb;IAED;;;OAGG;IACH,qBAHW,UAAU,YACV,GAAG,qFAQb;CACF"}
@@ -41,10 +41,6 @@ declare class DialRequest {
41
41
  declare namespace DialRequest {
42
42
  export { Connection, Dialer, Multiaddr, DialOptions, DialRequestOptions };
43
43
  }
44
- type Multiaddr = import('multiaddr').Multiaddr;
45
- type DialOptions = {
46
- signal: AbortSignal;
47
- };
48
44
  type Connection = import("libp2p-interfaces/src/connection/connection");
49
45
  type DialRequestOptions = {
50
46
  addrs: Multiaddr[];
@@ -52,4 +48,8 @@ type DialRequestOptions = {
52
48
  dialer: Dialer;
53
49
  };
54
50
  type Dialer = import('./');
51
+ type Multiaddr = import('multiaddr').Multiaddr;
52
+ type DialOptions = {
53
+ signal: AbortSignal;
54
+ };
55
55
  //# sourceMappingURL=dial-request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dial-request.d.ts","sourceRoot":"","sources":["../../../src/dialer/dial-request.js"],"names":[],"mappings":";AASA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACE;;;;;;;;;OASG;IACH,2CAFW,kBAAkB,EAU5B;IAHC,uCAAkB;IAClB,qBAAoB;IACpB,gBAtBc,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC,CAsBzC;IAG9B;;;;;OAKG;IACH;;oBAFa,QAAQ,UAAU,CAAC,CAuC/B;CACF;;;;iBA9EY,OAAO,WAAW,EAAE,SAAS;;YAK5B,WAAW;;;;WAGX,SAAS,EAAE;oBACP,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC;YAC3D,MAAM;;cAXP,OAAO,IAAI,CAAC"}
1
+ {"version":3,"file":"dial-request.d.ts","sourceRoot":"","sources":["../../../src/dialer/dial-request.js"],"names":[],"mappings":";AAUA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACE;;;;;;;;;OASG;IACH,2CAFW,kBAAkB,EAU5B;IAHC,uCAAkB;IAClB,qBAAoB;IACpB,gBAtBc,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC,CAsBzC;IAG9B;;;;;OAKG;IACH;;oBAFa,QAAQ,UAAU,CAAC,CA4C/B;CACF;;;;;;WA3Ea,SAAS,EAAE;oBACP,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC;YAC3D,MAAM;;cAXP,OAAO,IAAI,CAAC;iBACZ,OAAO,WAAW,EAAE,SAAS;;YAK5B,WAAW"}
@@ -120,7 +120,6 @@ declare class Dialer {
120
120
  declare namespace Dialer {
121
121
  export { Connection, PeerId, PeerStore, Address, TransportManager, DialerProperties, Resolver, DialerOptions, DialTarget, PendingDial };
122
122
  }
123
- type Address = import('../peer-store/address-book').Address;
124
123
  type PeerId = import('peer-id');
125
124
  import { Multiaddr } from "multiaddr";
126
125
  type Connection = import("libp2p-interfaces/src/connection/connection");
@@ -159,13 +158,13 @@ type DialerOptions = {
159
158
  resolvers?: Record<string, Resolver> | undefined;
160
159
  };
161
160
  type PeerStore = import('../peer-store');
161
+ type Address = import('../peer-store/address-book').Address;
162
162
  type TransportManager = import('../transport-manager');
163
163
  type Resolver = (addr: Multiaddr) => Promise<string[]>;
164
164
  type PendingDial = {
165
165
  dialRequest: DialRequest;
166
- controller: any;
166
+ controller: TimeoutController;
167
167
  promise: Promise<Connection>;
168
168
  destroy: () => void;
169
169
  };
170
- import DialRequest = require("./dial-request");
171
170
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dialer/index.js"],"names":[],"mappings":";AAyBA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;IACE;;;OAGG;IACH,uIAFW,gBAAgB,GAAG,aAAa,EA0B1C;IAdC,iDAAwC;IACxC,mCAA0B;IAC1B,2BAnCsB,OAAO,EAAE,KAAK,OAAO,EAAE,CAmCX;IAClC,yBAAwC;IACxC,uBA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AAoC;IACpC,gBAA0B;IAC1B,wBAAsC;IACtC,iBAAuE;IACvE,6BAA8B;IAC9B,mCAAoC;IAOtC;;OAEG;IACH,gBAcC;IAED;;;;;;;;;OASG;IACH,oBALW,MAAM,GAAC,SAAS,GAAC,MAAM;;oBAGrB,QAAQ,UAAU,CAAC,CAwB/B;IAED;;;;;;;OAOG;IACH,mCAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,UAAU,CAAC,CAiB/B;IAED;;;;;;;;;OASG;IACH,0BAmCC;IAED;;;;;;;;OAQG;IACH,2BAiCC;IAED;;OAEG;IACH,eAFW,MAAM,YAOhB;IAED;;OAEG;IACH,oBAFW,MAAM,QAOhB;IAED;;;;;OAKG;IACH,aAHW,SAAS,GACP,QAAQ,SAAS,EAAE,CAAC,CAwBhC;IAED;;;;;OAKG;IACH,mBAHW,SAAS,GACP,QAAQ,SAAS,EAAE,CAAC,CAWhC;CACF;;;;cA1SY,OAAO,SAAS,CAAC;;;;QAsBhB,MAAM;WACN,SAAS,EAAE;;;eAfX,SAAS;sBACT,gBAAgB;;;;;;iCAKJ,OAAO,EAAE,KAAK,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;iBAbpC,OAAO,eAAe,CAAC;eACvB,OAAO,4BAA4B,EAAE,OAAO;wBAC5C,OAAO,sBAAsB,CAAC;uBAQxB,SAAS,KAAK,QAAQ,MAAM,EAAE,CAAC;;iBAepC,WAAW;gBACX,iBAAiB;aACjB,QAAQ,UAAU,CAAC;mBACR,IAAI"}
@@ -2,6 +2,7 @@ export namespace messages {
2
2
  const NOT_STARTED_YET: string;
3
3
  const DHT_DISABLED: string;
4
4
  const CONN_ENCRYPTION_REQUIRED: string;
5
+ const NOT_FOUND: string;
5
6
  }
6
7
  export namespace codes {
7
8
  const DHT_DISABLED_1: string;
@@ -28,6 +29,7 @@ export namespace codes {
28
29
  export const ERR_INVALID_PARAMETERS: string;
29
30
  export const ERR_INVALID_PEER: string;
30
31
  export const ERR_MUXER_UNAVAILABLE: string;
32
+ export const ERR_NOT_FOUND: string;
31
33
  export const ERR_TIMEOUT: string;
32
34
  export const ERR_TRANSPORT_UNAVAILABLE: string;
33
35
  export const ERR_TRANSPORT_DIAL_FAILED: string;
@@ -105,13 +105,13 @@ declare namespace IdentifyService {
105
105
  }
106
106
  import PeerId = require("peer-id");
107
107
  type Connection = import("libp2p-interfaces/src/connection/connection");
108
- type MuxedStream = import('libp2p-interfaces/src/stream-muxer/types').MuxedStream;
109
108
  import { Multiaddr } from "multiaddr";
110
109
  declare namespace multicodecs {
111
110
  export { MULTICODEC_IDENTIFY as IDENTIFY };
112
111
  export { MULTICODEC_IDENTIFY_PUSH as IDENTIFY_PUSH };
113
112
  }
114
113
  import Message = require("./message");
114
+ type MuxedStream = import('libp2p-interfaces/src/stream-muxer/types').MuxedStream;
115
115
  type HostProperties = {
116
116
  agentVersion: string;
117
117
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identify/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;GAGG;AAEH;IACE;;OAEG;IACH,8BAFW,OAAO,KAAK,CAAC;;;MAOvB;IAkSD;;;;;OAKG;IACH,+BAHW,UAAU,GAAG,MAAM,GACjB,SAAS,GAAC,IAAI,CAW1B;IA/SD;;;;OAIG;IACH;QAFkC,MAAM,EAA7B,OAAO,KAAK,CAAC;OAyCvB;IAtCC,uBAAqB;IACrB,mCAAiC;IACjC,6CAA2C;IAC3C,mDAAiD;IACjD,eAA2B;IAwK7B;;;;;;;;OAQG;IACH;oBALW,UAAU;gBACV,WAAW;kBACX,MAAM;QACJ,QAAQ,IAAI,CAAC,GAAC,SAAS,CAWnC;IArLC,4BAA0D;IAC1D,gCAAkE;IAGlE;sBAjCU,MAAM;;MAoCf;IAwBH;;;;;OAKG;IACH,kBAHW,UAAU,EAAE,GACV,QAAQ,IAAI,EAAE,CAAC,CA4B3B;IAED;;;;OAIG;IACH,mBAFa,IAAI,CAiBhB;IAED;;;;;;;;OAQG;IACH,qBAHW,UAAU,GACR,QAAQ,IAAI,CAAC,CAmEzB;IAsBD;;;;;;;;;OASG;IACH,wBA6BC;IAED;;;;;;;;OAQG;IACH,oBAsCC;CAkBF;;;;;;mBAnUY,OAAO,0CAA0C,EAAE,WAAW;;;;;;;;kBAK7D,MAAM"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identify/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;GAGG;AAEH;IACE;;OAEG;IACH,8BAFW,OAAO,KAAK,CAAC;;;MAOvB;IAkSD;;;;;OAKG;IACH,+BAHW,UAAU,GAAG,MAAM,GACjB,SAAS,GAAC,IAAI,CAW1B;IA/SD;;;;OAIG;IACH;QAFkC,MAAM,EAA7B,OAAO,KAAK,CAAC;OAyCvB;IAtCC,uBAAqB;IACrB,mCAAiC;IACjC,6CAA2C;IAC3C,mDAAiD;IACjD,eAA2B;IAwK7B;;;;;;;;OAQG;IACH;oBALW,UAAU;gBACV,WAAW;kBACX,MAAM;QACJ,QAAQ,IAAI,CAAC,GAAC,SAAS,CAWnC;IArLC,4BAA0D;IAC1D,gCAAkE;IAGlE;sBAjCU,MAAM;;MAoCf;IAwBH;;;;;OAKG;IACH,kBAHW,UAAU,EAAE,GACV,QAAQ,IAAI,EAAE,CAAC,CA4B3B;IAED;;;;OAIG;IACH,mBAFa,IAAI,CAiBhB;IAED;;;;;;;;OAQG;IACH,qBAHW,UAAU,GACR,QAAQ,IAAI,CAAC,CAmEzB;IAsBD;;;;;;;;;OASG;IACH,wBA6BC;IAED;;;;;;;;OAQG;IACH,oBAsCC;CAkBF;;;;;;;;;;;;mBAnUY,OAAO,0CAA0C,EAAE,WAAW;;kBAK7D,MAAM"}
@@ -257,6 +257,7 @@ declare class Libp2p extends EventEmitter {
257
257
  _transport: any[];
258
258
  _discovery: Map<any, any>;
259
259
  connectionManager: ConnectionManager;
260
+ _autodialler: AutoDialler;
260
261
  metrics: Metrics | undefined;
261
262
  keychain: Keychain | undefined;
262
263
  upgrader: Upgrader;
@@ -412,7 +413,6 @@ declare namespace Libp2p {
412
413
  export { Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, HandlerProps, RandomWalkOptions, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions };
413
414
  }
414
415
  import { EventEmitter } from "events";
415
- import { Multiaddr } from "multiaddr";
416
416
  type Libp2pOptions = {
417
417
  /**
418
418
  * libp2p modules to use
@@ -468,6 +468,7 @@ type Libp2pConfig = {
468
468
  transport?: Record<string, Object> | undefined;
469
469
  };
470
470
  import ConnectionManager = require("./connection-manager");
471
+ import AutoDialler = require("./connection-manager/auto-dialler");
471
472
  import Metrics = require("./metrics");
472
473
  import Keychain = require("./keychain");
473
474
  import Upgrader = require("./upgrader");
@@ -484,6 +485,7 @@ import Relay = require("./circuit");
484
485
  import IdentifyService = require("./identify");
485
486
  import PeerRouting = require("./peer-routing");
486
487
  import ContentRouting = require("./content-routing");
488
+ import { Multiaddr } from "multiaddr";
487
489
  type Connection = import("libp2p-interfaces/src/connection/connection");
488
490
  type CreateOptions = {
489
491
  peerId?: PeerId | undefined;
@@ -531,5 +533,4 @@ type RelayOptions = {
531
533
  hop?: Relay.HopOptions | undefined;
532
534
  autoRelay?: Relay.AutoRelayOptions | undefined;
533
535
  };
534
- import PersistentPeerStore = require("./peer-store/persistent");
535
536
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";AAoCA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAQ,CAAC;;;;;;;;;;;;;;;;;;;iBA2Bf,OAAO;;;aAGP,OAAO;;;aAGP,OAAO"}
@@ -133,6 +133,5 @@ declare namespace Stats {
133
133
  export { IMovingAverage };
134
134
  }
135
135
  import { EventEmitter } from "events";
136
- import { BigNumber as Big } from "bignumber.js";
137
136
  type IMovingAverage = import('@vascosantos/moving-average').IMovingAverage;
138
137
  //# sourceMappingURL=stats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/metrics/stats.js"],"names":[],"mappings":";AAQA;;GAEG;AAEH;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,EAAE,WACR,GAAG,EAkCb;IA7BC,cAAuB;IACvB,cAAgB;IAEhB,mDAAmD;IACnD;sBAD2B,GAAG;kBAAY,GAAG;MAI5C;IAED,2BAAoC;IACpC,2BAAgC;IAEhC,6EAA6E;IAC7E;sBAD2B,cAAc,EAAE;kBAAY,cAAc,EAAE;MAC9C;IAwH3B;;;;;;;;;;OAUG;IACH,gBAaC;IA9HD;;;;;;OAMG;IACH,SAFa,IAAI,CAMhB;IAED;;;;;OAKG;IACH,QAFa,IAAI,CAOhB;IAFG,cAAoB;IAIxB;;OAEG;IACH;sBAzD6B,GAAG;kBAAY,GAAG;MA2D9C;IAED;;OAEG;IACH;sBAvD6B,cAAc,EAAE;kBAAY,cAAc,EAAE;MAyDxE;IAED;;;;OAIG;IACH,cAkBC;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,OACN,MAAM,GACJ,IAAI,CAKhB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,qBAKC;IA4BD;;;;;;;;OAQG;IACH,yBAQC;IAED;;;;;;;;;OASG;IACH,4BAsBC;IAED;;;;;;;;OAQG;IACH,iBAqBC;CACF;;;;;;sBAjQY,OAAO,6BAA6B,EAAE,cAAc"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/metrics/stats.js"],"names":[],"mappings":";AAQA;;GAEG;AAEH;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,EAAE,WACR,GAAG,EAkCb;IA7BC,cAAuB;IACvB,cAAgB;IAEhB,mDAAmD;IACnD;sBAD2B,GAAG;kBAAY,GAAG;MAI5C;IAED,2BAAoC;IACpC,2BAAgC;IAEhC,6EAA6E;IAC7E;sBAD2B,cAAc,EAAE;kBAAY,cAAc,EAAE;MAC9C;IAwH3B;;;;;;;;;;OAUG;IACH,gBAaC;IA9HD;;;;;;OAMG;IACH,SAFa,IAAI,CAMhB;IAED;;;;;OAKG;IACH,QAFa,IAAI,CAOhB;IAFG,cAAoB;IAIxB;;OAEG;IACH;sBAzD6B,GAAG;kBAAY,GAAG;MA2D9C;IAED;;OAEG;IACH;sBAvD6B,cAAc,EAAE;kBAAY,cAAc,EAAE;MAyDxE;IAED;;;;OAIG;IACH,cAkBC;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,OACN,MAAM,GACJ,IAAI,CAKhB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,qBAKC;IA4BD;;;;;;;;OAQG;IACH,yBAQC;IAED;;;;;;;;;OASG;IACH,4BAsBC;IAED;;;;;;;;OAQG;IACH,iBAqBC;CACF;;;;;sBAjQY,OAAO,6BAA6B,EAAE,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"nat-manager.d.ts","sourceRoot":"","sources":["../../src/nat-manager.js"],"names":[],"mappings":";AAkDA;IACE;;;OAGG;IACH,sEAFW,oBAAoB,GAAG,iBAAiB,EAoBlD;IAjBC,2BAAqB;IACrB,6CAAqC;IACrC,iDAAyC;IAEzC,kBAA+B;IAC/B,gCAAqC;IACrC;;;;;;MAMC;IAOH;;OAEG;IACH,cAUC;IAED,wBA+CC;IAED;QAgBI;;;WAGG;uBAFY,GAAG,OACL,QAAQ,IAAI,CAAC;QAI1B;;;WAGG;2BAFY,GAAG,OACL,QAAQ,IAAI,CAAC;QAI1B;;;WAGG;8BAFY,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,CAAC;sBAC7B,OAAO,mBAAmB,CAAC"}
@@ -9,6 +9,7 @@ export = PeerRouting;
9
9
  * @property {boolean} [enabled = true] - Whether to enable the Refresh manager
10
10
  * @property {number} [bootDelay = 6e5] - Boot delay to start the Refresh Manager (in ms)
11
11
  * @property {number} [interval = 10e3] - Interval between each Refresh Manager run (in ms)
12
+ * @property {number} [timeout = 10e3] - How long to let each refresh run (in ms)
12
13
  *
13
14
  * @typedef {Object} PeerRoutingOptions
14
15
  * @property {RefreshManagerOptions} [refreshManager]
@@ -60,11 +61,13 @@ declare class PeerRouting {
60
61
  *
61
62
  * @param {Uint8Array} key - A CID like key
62
63
  * @param {Object} [options]
63
- * @param {number} [options.timeout=30e3] - How long the query can take.
64
+ * @param {number} [options.timeout=30e3] - How long the query can take
65
+ * @param {AbortSignal} [options.signal] - An AbortSignal to abort the request
64
66
  * @returns {AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>}
65
67
  */
66
68
  getClosestPeers(key: Uint8Array, options?: {
67
69
  timeout?: number | undefined;
70
+ signal?: AbortSignal | undefined;
68
71
  } | undefined): AsyncIterable<{
69
72
  id: PeerId;
70
73
  multiaddrs: Multiaddr[];
@@ -87,6 +90,10 @@ type RefreshManagerOptions = {
87
90
  * - Interval between each Refresh Manager run (in ms)
88
91
  */
89
92
  interval?: number | undefined;
93
+ /**
94
+ * - How long to let each refresh run (in ms)
95
+ */
96
+ timeout?: number | undefined;
90
97
  };
91
98
  type PeerId = import('peer-id');
92
99
  type Multiaddr = import('multiaddr').Multiaddr;
@@ -1 +1 @@
1
- {"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.js"],"names":[],"mappings":";AAwBA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAgBtB;IAbC,2BAA4B;IAC5B,mCAAkC;IAClC,kCAAkC;IAClC,UADW,iBAAiB,EAAE,CACmB;IAOjD;;;;8BA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AAS"}
@@ -87,6 +87,7 @@ import Book = require("./book");
87
87
  import Envelope = require("../record/envelope");
88
88
  import PeerId = require("peer-id");
89
89
  import { Multiaddr } from "multiaddr";
90
+ type PeerStore = import('./');
90
91
  type Address = {
91
92
  /**
92
93
  * peer multiaddr.
@@ -97,7 +98,6 @@ type Address = {
97
98
  */
98
99
  isCertified: boolean;
99
100
  };
100
- type PeerStore = import('./');
101
101
  type CertifiedRecord = {
102
102
  /**
103
103
  * raw envelope.
@@ -1 +1 @@
1
- {"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/address-book.js"],"names":[],"mappings":";AAmBA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH;IACE;;;;;OAKG;IACH,uBAFW,SAAS,EA0BnB;IAED;;;;;;;OAOG;IACH,4BAHW,QAAQ,GACN,OAAO,CA8CnB;IAED;;;;;;OAMG;IACH,uBAHW,MAAM,GACJ,UAAU,GAAC,SAAS,CAUhC;IAED;;;;;;OAMG;IACH,sBAHW,MAAM,GACJ,QAAQ,QAAQ,GAAC,IAAI,CAAC,GAAC,SAAS,CAU5C;IAuDD;;;;;;;OAOG;IACH,YAJW,MAAM,cACN,SAAS,EAAE,GACT,WAAW,CA+CvB;IAmBD;;;;;;;OAOG;IACH,qBAyBC;IAED;;;;;;;;OAQG;IACH,6BAJW,MAAM,+BACM,OAAO,EAAE,KAAK,OAAO,EAAE,gBACjC,SAAS,EAAE,GAAC,SAAS,CAsBjC;CACF;;;;;;;;;;;;eAtUa,SAAS;;;;iBACT,OAAO;;iBANR,OAAO,IAAI,CAAC;;;;;SASX,UAAU;;;;eACV,MAAM;;;;;;eAGN,OAAO,EAAE;;;;YACT,eAAe"}
1
+ {"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/address-book.js"],"names":[],"mappings":";AAmBA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH;IACE;;;;;OAKG;IACH,uBAFW,SAAS,EA0BnB;IAED;;;;;;;OAOG;IACH,4BAHW,QAAQ,GACN,OAAO,CA8CnB;IAED;;;;;;OAMG;IACH,uBAHW,MAAM,GACJ,UAAU,GAAC,SAAS,CAUhC;IAED;;;;;;OAMG;IACH,sBAHW,MAAM,GACJ,QAAQ,QAAQ,GAAC,IAAI,CAAC,GAAC,SAAS,CAU5C;IAuDD;;;;;;;OAOG;IACH,YAJW,MAAM,cACN,SAAS,EAAE,GACT,WAAW,CA+CvB;IAmBD;;;;;;;OAOG;IACH,qBAyBC;IAED;;;;;;;;OAQG;IACH,6BAJW,MAAM,+BACM,OAAO,EAAE,KAAK,OAAO,EAAE,gBACjC,SAAS,EAAE,GAAC,SAAS,CAsBjC;CACF;;;;;;;;iBA3UY,OAAO,IAAI,CAAC;;;;;eAKX,SAAS;;;;iBACT,OAAO;;;;;;SAGP,UAAU;;;;eACV,MAAM;;;;;;eAGN,OAAO,EAAE;;;;YACT,eAAe"}
@@ -61,7 +61,24 @@ declare class PeerStore extends EventEmitter {
61
61
  *
62
62
  * @returns {Map<string, Peer>}
63
63
  */
64
- get peers(): Map<string, Peer>;
64
+ get peers(): Map<string, {
65
+ /**
66
+ * peer's peer-id instance.
67
+ */
68
+ id: PeerId;
69
+ /**
70
+ * peer's addresses containing its multiaddrs and metadata.
71
+ */
72
+ addresses: Address[];
73
+ /**
74
+ * peer's supported protocols.
75
+ */
76
+ protocols: string[];
77
+ /**
78
+ * peer's metadata map.
79
+ */
80
+ metadata: Map<string, Uint8Array> | undefined;
81
+ }>;
65
82
  /**
66
83
  * Delete the information of the given peer in every book.
67
84
  *
@@ -75,10 +92,27 @@ declare class PeerStore extends EventEmitter {
75
92
  * @param {PeerId} peerId
76
93
  * @returns {Peer|undefined}
77
94
  */
78
- get(peerId: PeerId): Peer | undefined;
95
+ get(peerId: PeerId): {
96
+ /**
97
+ * peer's peer-id instance.
98
+ */
99
+ id: PeerId;
100
+ /**
101
+ * peer's addresses containing its multiaddrs and metadata.
102
+ */
103
+ addresses: Address[];
104
+ /**
105
+ * peer's supported protocols.
106
+ */
107
+ protocols: string[];
108
+ /**
109
+ * peer's metadata map.
110
+ */
111
+ metadata: Map<string, Uint8Array> | undefined;
112
+ } | undefined;
79
113
  }
80
114
  declare namespace PeerStore {
81
- export { Peer, Address };
115
+ export { Address };
82
116
  }
83
117
  import { EventEmitter } from "events";
84
118
  import PeerId = require("peer-id");
@@ -86,26 +120,5 @@ import AddressBook = require("./address-book");
86
120
  import KeyBook = require("./key-book");
87
121
  import MetadataBook = require("./metadata-book");
88
122
  import ProtoBook = require("./proto-book");
89
- /**
90
- * Peer object
91
- */
92
- type Peer = {
93
- /**
94
- * peer's peer-id instance.
95
- */
96
- id: PeerId;
97
- /**
98
- * peer's addresses containing its multiaddrs and metadata.
99
- */
100
- addresses: Address[];
101
- /**
102
- * peer's supported protocols.
103
- */
104
- protocols: string[];
105
- /**
106
- * peer's metadata map.
107
- */
108
- metadata: Map<string, Uint8Array> | undefined;
109
- };
110
123
  type Address = import('./address-book').Address;
111
124
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-store/index.js"],"names":[],"mappings":";AAgBA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IAEH;;;;;;OAMG;IACH;QAH2B,MAAM,EAAtB,MAAM;OA2BhB;IArBC,gBAAqB;IAErB;;OAEG;IACH,yBAAwC;IAExC;;OAEG;IACH,iBAAgC;IAEhC;;OAEG;IACH,2BAA0C;IAE1C;;OAEG;IACH,qBAAoC;IAGtC;;OAEG;IACH,cAAW;IAEX;;OAEG;IACH,aAAU;IAEV;;;;OAIG;IACH,+BAiBC;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,OAAO,CASnB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,IAAI,GAAC,SAAS,CAsB1B;CACF;;;;;;;;;;;;;;;;;QAnHe,MAAM;;;;eACN,OAAO,EAAE;;;;eACT,MAAM,EAAE;;;;cACR,IAAI,MAAM,EAAE,UAAU,CAAC,GAAC,SAAS;;eApBpC,OAAO,gBAAgB,EAAE,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-store/index.js"],"names":[],"mappings":";AAgBA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IAEH;;;;;;OAMG;IACH;QAH2B,MAAM,EAAtB,MAAM;OA2BhB;IArBC,gBAAqB;IAErB;;OAEG;IACH,yBAAwC;IAExC;;OAEG;IACH,iBAAgC;IAEhC;;OAEG;IACH,2BAA0C;IAE1C;;OAEG;IACH,qBAAoC;IAGtC;;OAEG;IACH,cAAW;IAEX;;OAEG;IACH,aAAU;IAEV;;;;OAIG;IACH;;;;YAtDc,MAAM;;;;mBACN,OAAO,EAAE;;;;mBACT,MAAM,EAAE;;;;kBACR,IAAI,MAAM,EAAE,UAAU,CAAC,GAAC,SAAS;OAoE9C;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,OAAO,CASnB;IAED;;;;;OAKG;IACH,YAHW,MAAM;;;;YA3FH,MAAM;;;;mBACN,OAAO,EAAE;;;;mBACT,MAAM,EAAE;;;;kBACR,IAAI,MAAM,EAAE,UAAU,CAAC,GAAC,SAAS;kBA+G9C;CACF;;;;;;;;;;eApIY,OAAO,gBAAgB,EAAE,OAAO"}
@@ -19,14 +19,15 @@ declare class MetadataBook extends Book {
19
19
  /**
20
20
  * Set data into the datastructure
21
21
  *
22
- * @override
23
22
  * @param {PeerId} peerId
24
23
  * @param {string} key
25
24
  * @param {Uint8Array} value
25
+ * @param {object} [opts]
26
+ * @param {boolean} [opts.emit]
26
27
  */
27
28
  _setValue(peerId: PeerId, key: string, value: Uint8Array, { emit }?: {
28
29
  emit?: boolean | undefined;
29
- }): void;
30
+ } | undefined): void;
30
31
  /**
31
32
  * Get specific metadata value, if it exists
32
33
  *
@@ -1 +1 @@
1
- {"version":3,"file":"metadata-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/metadata-book.js"],"names":[],"mappings":";AAiBA;;GAEG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,uBAFW,SAAS,EAmBnB;IA4BD;;;;;;;OAOG;IACH,kBAJW,MAAM,OACN,MAAM,SACN,UAAU;;aAiBpB;IAgBD;;;;;;OAMG;IACH,iBAJW,MAAM,OACN,MAAM,GACJ,UAAU,GAAG,SAAS,CASlC;IAsBD;;;;;;OAMG;IACH,oBAJW,MAAM,OACN,MAAM,GACJ,OAAO,CAgBnB;CACF;;;;;;iBA9JY,OAAO,IAAI,CAAC"}
1
+ {"version":3,"file":"metadata-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/metadata-book.js"],"names":[],"mappings":";AAiBA;;GAEG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,uBAFW,SAAS,EAmBnB;IA4BD;;;;;;;;OAQG;IACH,kBANW,MAAM,OACN,MAAM,SACN,UAAU;;yBAmBpB;IAgBD;;;;;;OAMG;IACH,iBAJW,MAAM,OACN,MAAM,GACJ,UAAU,GAAG,SAAS,CASlC;IAsBD;;;;;;OAMG;IACH,oBAJW,MAAM,OACN,MAAM,GACJ,OAAO,CAgBnB;CACF;;;;;;iBA/JY,OAAO,IAAI,CAAC"}
@@ -126,5 +126,4 @@ type PersistentPeerStoreOptions = {
126
126
  };
127
127
  type Batch = import('interface-datastore').Batch;
128
128
  type Address = import('../address-book.js').Address;
129
- import PeerId = require("peer-id");
130
129
  //# sourceMappingURL=index.d.ts.map
@@ -50,8 +50,31 @@ declare namespace Envelope {
50
50
  export { createFromProtobuf, seal, openAndCertify, Record };
51
51
  }
52
52
  import PeerId = require("peer-id");
53
+ /**
54
+ * Unmarshal a serialized Envelope protobuf message.
55
+ *
56
+ * @param {Uint8Array} data
57
+ * @returns {Promise<Envelope>}
58
+ */
53
59
  declare function createFromProtobuf(data: Uint8Array): Promise<Envelope>;
60
+ /**
61
+ * Seal marshals the given Record, places the marshaled bytes inside an Envelope
62
+ * and signs it with the given peerId's private key.
63
+ *
64
+ * @async
65
+ * @param {Record} record
66
+ * @param {PeerId} peerId
67
+ * @returns {Promise<Envelope>}
68
+ */
54
69
  declare function seal(record: Record, peerId: PeerId): Promise<Envelope>;
70
+ /**
71
+ * Open and certify a given marshalled envelope.
72
+ * Data is unmarshalled and the signature validated for the given domain.
73
+ *
74
+ * @param {Uint8Array} data
75
+ * @param {string} domain
76
+ * @returns {Promise<Envelope>}
77
+ */
55
78
  declare function openAndCertify(data: Uint8Array, domain: string): Promise<Envelope>;
56
79
  type Record = import('libp2p-interfaces/src/record/types').Record;
57
80
  //# sourceMappingURL=index.d.ts.map