@libp2p/peer-store 1.0.16 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,44 +1,205 @@
1
- # libp2p-tracked-map <!-- omit in toc -->
1
+ # @libp2p/peer-store <!-- omit in toc -->
2
2
 
3
- > allows tracking metrics in libp2p
3
+ [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
4
+ [![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
5
+ [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
6
+ [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-peer-store.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-peer-store)
7
+ [![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-interfaces/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-peer-store/actions/workflows/js-test-and-release.yml)
4
8
 
5
- ## Table of Contents <!-- omit in toc -->
9
+ > Stores information about peers libp2p knows on the network
6
10
 
11
+ ## Table of contents <!-- omit in toc -->
12
+
13
+ - [Install](#install)
7
14
  - [Description](#description)
8
- - [Example](#example)
9
- - [Installation](#installation)
15
+ - [Submitting records to the PeerStore](#submitting-records-to-the-peerstore)
16
+ - [Identify](#identify)
17
+ - [Peer Discovery](#peer-discovery)
18
+ - [Dialer](#dialer)
19
+ - [DHT](#dht)
20
+ - [Retrieving records from the PeerStore](#retrieving-records-from-the-peerstore)
21
+ - [Peer](#peer)
22
+ - [Protocols](#protocols)
23
+ - [Multiaddrs](#multiaddrs)
24
+ - [PeerStore implementation](#peerstore-implementation)
25
+ - [Components](#components)
26
+ - [Address Book](#address-book)
27
+ - [Key Book](#key-book)
28
+ - [Protocol Book](#protocol-book)
29
+ - [Metadata Book](#metadata-book)
30
+ - [API](#api)
31
+ - [Events](#events)
32
+ - [Data Persistence](#data-persistence)
33
+ - [Future Considerations](#future-considerations)
10
34
  - [License](#license)
11
- - [Contribution](#contribution)
35
+ - [Contribution](#contribution)
36
+
37
+ ## Install
38
+
39
+ ```console
40
+ $ npm i @libp2p/peer-store
41
+ ```
12
42
 
13
43
  ## Description
14
44
 
15
- A map that reports it's size to the libp2p [Metrics](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/metrics#readme) system.
45
+ Libp2p's PeerStore is responsible for keeping an updated register with the relevant information of the known peers. It should be the single source of truth for all peer data, where a subsystem can learn about peers' data and where someone can listen for updates. The PeerStore comprises four main components: `addressBook`, `keyBook`, `protocolBook` and `metadataBook`.
16
46
 
17
- If metrics are disabled a regular map is used.
47
+ The PeerStore manages the high level operations on its inner books. Moreover, the PeerStore should be responsible for notifying interested parties of relevant events, through its Event Emitter.
18
48
 
19
- ## Example
49
+ ### Submitting records to the PeerStore
20
50
 
21
- ```JavaScript
22
- import { trackedMap } from '@libp2p/tracked-map'
51
+ Several libp2p subsystems will perform operations that might gather relevant information about peers.
23
52
 
24
- const map = trackedMap<string, string>({ metrics })
53
+ #### Identify
25
54
 
26
- map.set('key', 'value')
27
- ```
55
+ - The Identify protocol automatically runs on every connection when multiplexing is enabled. The protocol will put the multiaddrs and protocols provided by the peer to the PeerStore.
56
+ - In the background, the Identify Service is also waiting for protocol change notifications of peers via the IdentifyPush protocol. Peers may leverage the `identify-push` message to communicate protocol changes to all connected peers, so that their PeerStore can be updated with the updated protocols.
57
+ - While it is currently not supported in js-libp2p, future iterations may also support the [IdentifyDelta protocol](https://github.com/libp2p/specs/pull/176).
58
+ - Taking into account that the Identify protocol records are directly from the peer, they should be considered the source of truth and weighted accordingly.
28
59
 
29
- ## Installation
60
+ #### Peer Discovery
30
61
 
31
- ```console
32
- $ npm i @libp2p/tracked-map
62
+ - Libp2p discovery protocols aim to discover new peers in the network. In a typical discovery protocol, addresses of the peer are discovered along with its peer id. Once this happens, a libp2p discovery protocol should emit a `peer` event with the information of the discovered peer and this information will be added to the PeerStore by libp2p.
63
+
64
+ #### Dialer
65
+
66
+ - Libp2p API supports dialing a peer given a `multiaddr`, and no prior knowledge of the peer. If the node is able to establish a connection with the peer, it and its multiaddr is added to the PeerStore.
67
+ - When a connection is being upgraded, more precisely after its encryption, or even in a discovery protocol, a libp2p node can get to know other parties public keys. In this scenario, libp2p will add the peer's public key to its `KeyBook`.
68
+
69
+ #### DHT
70
+
71
+ - On some DHT operations, such as finding providers for a given CID, nodes may exchange peer data as part of the query. This passive peer discovery should result in the DHT emitting the `peer` event in the same way [Peer Discovery](#peerdiscovery) does.
72
+
73
+ ### Retrieving records from the PeerStore
74
+
75
+ When data in the PeerStore is updated the PeerStore will emit events based on the changes, to allow applications and other subsystems to take action on those changes. Any subsystem interested in these notifications should subscribe the [`PeerStore events`][peer-store-events].
76
+
77
+ #### Peer
78
+
79
+ - Each time a new peer is discovered, the PeerStore should emit a [`peer` event][peer-store-events], so that interested parties can leverage this peer and establish a connection with it.
80
+
81
+ #### Protocols
82
+
83
+ - When the known protocols of a peer change, the PeerStore emits a [`change:protocols` event][peer-store-events].
84
+
85
+ #### Multiaddrs
86
+
87
+ - When the known listening `multiaddrs` of a peer change, the PeerStore emits a [`change:multiaddrs` event][peer-store-events].
88
+
89
+ ### PeerStore implementation
90
+
91
+ The PeerStore wraps four main components: `addressBook`, `keyBook`, `protocolBook` and `metadataBook`. Moreover, it provides a high level API for those components, as well as data events.
92
+
93
+ ### Components
94
+
95
+ #### Address Book
96
+
97
+ The `addressBook` keeps the known multiaddrs of a peer. The multiaddrs of each peer may change over time and the Address Book must account for this.
98
+
99
+ `Map<string, Address>`
100
+
101
+ A `peerId.toString()` identifier mapping to a `Address` object, which should have the following structure:
102
+
103
+ ```js
104
+ {
105
+ multiaddr: <Multiaddr>
106
+ }
33
107
  ```
34
108
 
109
+ #### Key Book
110
+
111
+ The `keyBook` tracks the public keys of the peers by keeping their [`PeerId`][peer-id].
112
+
113
+ `Map<string, PeerId`
114
+
115
+ A `peerId.toString()` identifier mapping to a `PeerId` of the peer. This instance contains the peer public key.
116
+
117
+ #### Protocol Book
118
+
119
+ The `protoBook` holds the identifiers of the protocols supported by each peer. The protocols supported by each peer are dynamic and will change over time.
120
+
121
+ `Map<string, Set<string>>`
122
+
123
+ A `peerId.toString()` identifier mapping to a `Set` of protocol identifier strings.
124
+
125
+ #### Metadata Book
126
+
127
+ The `metadataBook` keeps track of the known metadata of a peer. Its metadata is stored in a key value fashion, where a key identifier (`string`) represents a metadata value (`Uint8Array`).
128
+
129
+ `Map<string, Map<string, Uint8Array>>`
130
+
131
+ A `peerId.toString()` identifier mapping to the peer metadata Map.
132
+
133
+ ### API
134
+
135
+ For the complete API documentation, you should check the [API.md](../../doc/API.md).
136
+
137
+ Access to its underlying books:
138
+
139
+ - `peerStore.addressBook.*`
140
+ - `peerStore.keyBook.*`
141
+ - `peerStore.metadataBook.*`
142
+ - `peerStore.protoBook.*`
143
+
144
+ ### Events
145
+
146
+ - `peer` - emitted when a new peer is added.
147
+ - `change:multiaadrs` - emitted when a known peer has a different set of multiaddrs.
148
+ - `change:protocols` - emitted when a known peer supports a different set of protocols.
149
+ - `change:pubkey` - emitted when a peer's public key is known.
150
+ - `change:metadata` - emitted when known metadata of a peer changes.
151
+
152
+ ## Data Persistence
153
+
154
+ The data stored in the PeerStore can be persisted if configured appropriately. Keeping a record of the peers already discovered by the peer, as well as their known data aims to improve the efficiency of peers joining the network after being offline.
155
+
156
+ The libp2p node will need to receive a [datastore](https://github.com/ipfs/interface-datastore), in order to persist this data across restarts. A [datastore](https://github.com/ipfs/interface-datastore) stores its data in a key-value fashion. As a result, we need coherent keys so that we do not overwrite data.
157
+
158
+ The PeerStore should not continuously update the datastore whenever data is changed. Instead, it should only store new data after reaching a certain threshold of "dirty" peers, as well as when the node is stopped, in order to batch writes to the datastore.
159
+
160
+ The peer id will be appended to the datastore key for each data namespace. The namespaces were defined as follows:
161
+
162
+ **AddressBook**
163
+
164
+ All the known peer addresses are stored with a key pattern as follows:
165
+
166
+ `/peers/addrs/<b32 peer id no padding>`
167
+
168
+ **ProtoBook**
169
+
170
+ All the known peer protocols are stored with a key pattern as follows:
171
+
172
+ `/peers/protos/<b32 peer id no padding>`
173
+
174
+ **KeyBook**
175
+
176
+ All public keys are stored under the following pattern:
177
+
178
+ ` /peers/keys/<b32 peer id no padding>`
179
+
180
+ **MetadataBook**
181
+
182
+ Metadata is stored under the following key pattern:
183
+
184
+ `/peers/metadata/<b32 peer id no padding>/<key>`
185
+
186
+ ## Future Considerations
187
+
188
+ - If multiaddr TTLs are added, the PeerStore may schedule jobs to delete all addresses that exceed the TTL to prevent AddressBook bloating
189
+ - Further API methods will probably need to be added in the context of multiaddr validity and confidence.
190
+ - When improving libp2p configuration for specific runtimes, we should take into account the PeerStore recommended datastore.
191
+ - When improving libp2p configuration, we should think about a possible way of allowing the configuration of Bootstrap to be influenced by the persisted peers, as a way to decrease the load on Bootstrap nodes.
192
+
35
193
  ## License
36
194
 
37
195
  Licensed under either of
38
196
 
39
- * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
40
- * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
197
+ - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
198
+ - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
41
199
 
42
- ### Contribution
200
+ ## Contribution
43
201
 
44
202
  Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
203
+
204
+ [peer-id]: https://github.com/libp2p/js-peer-id
205
+ [peer-store-events]: [https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#libp2ppeerStore]
@@ -1,9 +1,9 @@
1
1
  import { Multiaddr } from '@multiformats/multiaddr';
2
2
  import { RecordEnvelope } from '@libp2p/peer-record';
3
- import type { AddressFilter, PeerStore } from '@libp2p/interfaces/peer-store';
3
+ import type { AddressFilter, PeerStore } from '@libp2p/interface-peer-store';
4
4
  import type { Store } from './store.js';
5
- import type { Envelope } from '@libp2p/interfaces/record';
6
- import type { PeerId } from '@libp2p/interfaces/peer-id';
5
+ import type { Envelope } from '@libp2p/interface-record';
6
+ import type { PeerId } from '@libp2p/interface-peer-id';
7
7
  export declare class PeerStoreAddressBook {
8
8
  private readonly dispatchEvent;
9
9
  private readonly store;
@@ -21,7 +21,7 @@ export declare class PeerStoreAddressBook {
21
21
  * Returns undefined if no record exists.
22
22
  */
23
23
  getPeerRecord(peerId: PeerId): Promise<RecordEnvelope | undefined>;
24
- get(peerId: PeerId): Promise<import("@libp2p/interfaces/peer-store").Address[]>;
24
+ get(peerId: PeerId): Promise<import("@libp2p/interface-peer-store").Address[]>;
25
25
  set(peerId: PeerId, multiaddrs: Multiaddr[]): Promise<void>;
26
26
  add(peerId: PeerId, multiaddrs: Multiaddr[]): Promise<void>;
27
27
  delete(peerId: PeerId): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../src/address-book.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAc,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAQhE,OAAO,KAAK,EAAE,aAAa,EAAkC,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC7G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAUxD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OA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G;IACG,iBAAiB,CAAE,QAAQ,EAAE,QAAQ;IAyErC,cAAc,CAAE,MAAM,EAAE,MAAM;IAmBpC;;;OAGG;IACG,aAAa,CAAE,MAAM,EAAE,MAAM;IAU7B,GAAG,CAAE,MAAM,EAAE,MAAM;IAuBnB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE;IAsE5C,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE;IAoE5C,MAAM,CAAE,MAAM,EAAE,MAAM;CAoC7B"}
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from '@libp2p/interfaces/events';
2
- import type { PeerStore, AddressBook, KeyBook, MetadataBook, ProtoBook, PeerStoreEvents, PeerStoreInit, Peer } from '@libp2p/interfaces/peer-store';
3
- import type { PeerId } from '@libp2p/interfaces/peer-id';
4
- import { Components, Initializable } from '@libp2p/interfaces/components';
2
+ import type { PeerStore, AddressBook, KeyBook, MetadataBook, ProtoBook, PeerStoreEvents, PeerStoreInit, Peer } from '@libp2p/interface-peer-store';
3
+ import type { PeerId } from '@libp2p/interface-peer-id';
4
+ import { Components, Initializable } from '@libp2p/components';
5
5
  /**
6
6
  * An implementation of PeerStore that stores data in a Datastore
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAMxD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACnJ,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAIzE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY,CAAC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,CAAO;gBAEhB,IAAI,GAAE,aAAkB;IAUrC,IAAI,CAAE,UAAU,EAAE,UAAU;IAKtB,OAAO,CAAE,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAoBjC,GAAG,IAAK,OAAO,CAAC,IAAI,EAAE,CAAC;IAU7B;;OAEG;IACG,MAAM,CAAE,MAAM,EAAE,MAAM;IAa5B;;OAEG;IACG,GAAG,CAAE,MAAM,EAAE,MAAM;IAazB;;OAEG;IACG,GAAG,CAAE,MAAM,EAAE,MAAM;CAY1B"}
package/dist/src/index.js CHANGED
@@ -5,7 +5,7 @@ import { PeerStoreKeyBook } from './key-book.js';
5
5
  import { PeerStoreMetadataBook } from './metadata-book.js';
6
6
  import { PeerStoreProtoBook } from './proto-book.js';
7
7
  import { PersistentStore } from './store.js';
8
- import { Components } from '@libp2p/interfaces/components';
8
+ import { Components } from '@libp2p/components';
9
9
  const log = logger('libp2p:peer-store');
10
10
  /**
11
11
  * An implementation of PeerStore that stores data in a Datastore
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAS,MAAM,YAAY,CAAA;AAGnD,OAAO,EAAE,UAAU,EAAiB,MAAM,+BAA+B,CAAA;AAEzE,MAAM,GAAG,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAA;AAEvC;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAA6B;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,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;QAChD,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAE9B,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;SACpC;gBAAS;YACR,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;YAClC,OAAO,EAAE,CAAA;SACV;IACH,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
1
  import type { Store } from './store.js';
2
- import type { PeerStore, KeyBook } from '@libp2p/interfaces/peer-store';
3
- import type { PeerId } from '@libp2p/interfaces/peer-id';
2
+ import type { PeerStore, KeyBook } from '@libp2p/interface-peer-store';
3
+ import type { PeerId } from '@libp2p/interface-peer-id';
4
4
  export declare class PeerStoreKeyBook implements KeyBook {
5
5
  private readonly dispatchEvent;
6
6
  private readonly store;
@@ -1 +1 @@
1
- {"version":3,"file":"key-book.d.ts","sourceRoot":"","sources":["../../src/key-book.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAiC,MAAM,+BAA+B,CAAA;AACtG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAMxD,qBAAa,gBAAiB,YAAW,OAAO;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAE7B;;OAEG;gBACU,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK;IAKpE;;OAEG;IACG,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;IAgDhD;;OAEG;IACG,GAAG,CAAE,MAAM,EAAE,MAAM;IAqBnB,MAAM,CAAE,MAAM,EAAE,MAAM;CAsC7B"}
1
+ {"version":3,"file":"key-book.d.ts","sourceRoot":"","sources":["../../src/key-book.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAiC,MAAM,8BAA8B,CAAA;AACrG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAMvD,qBAAa,gBAAiB,YAAW,OAAO;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAE7B;;OAEG;gBACU,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK;IAKpE;;OAEG;IACG,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;IAgDhD;;OAEG;IACG,GAAG,CAAE,MAAM,EAAE,MAAM;IAqBnB,MAAM,CAAE,MAAM,EAAE,MAAM;CAsC7B"}
@@ -1,6 +1,6 @@
1
1
  import type { Store } from './store.js';
2
- import type { PeerStore, MetadataBook } from '@libp2p/interfaces/peer-store';
3
- import type { PeerId } from '@libp2p/interfaces/peer-id';
2
+ import type { PeerStore, MetadataBook } from '@libp2p/interface-peer-store';
3
+ import type { PeerId } from '@libp2p/interface-peer-id';
4
4
  export declare class PeerStoreMetadataBook implements MetadataBook {
5
5
  private readonly dispatchEvent;
6
6
  private readonly store;
@@ -1 +1 @@
1
- {"version":3,"file":"metadata-book.d.ts","sourceRoot":"","sources":["../../src/metadata-book.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAgC,MAAM,+BAA+B,CAAA;AAC1G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAMxD,qBAAa,qBAAsB,YAAW,YAAY;IACxD,OAAO,CAAC,QAAQ,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,MAAM,EAAE,UAAU,CAAC;IAwC5D;;OAEG;IACG,QAAQ,CAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU;IA8CxD,MAAM,CAAE,MAAM,EAAE,MAAM;IAuCtB,WAAW,CAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAsC/C"}
@@ -1,6 +1,6 @@
1
1
  import type { Store } from './store.js';
2
- import type { PeerStore, ProtoBook } from '@libp2p/interfaces/peer-store';
3
- import type { PeerId } from '@libp2p/interfaces/peer-id';
2
+ import type { PeerStore, ProtoBook } from '@libp2p/interface-peer-store';
3
+ import type { PeerId } from '@libp2p/interface-peer-id';
4
4
  export declare class PeerStoreProtoBook implements ProtoBook {
5
5
  private readonly dispatchEvent;
6
6
  private readonly store;
@@ -1 +1 @@
1
- {"version":3,"file":"proto-book.d.ts","sourceRoot":"","sources":["../../src/proto-book.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAiC,SAAS,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACxG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAMxD,qBAAa,kBAAmB,YAAW,SAAS;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAE7B;;;OAGG;gBACU,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK;IAK9D,GAAG,CAAE,MAAM,EAAE,MAAM;IAqBnB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;IAiDxC,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;IAkDxC,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;IAoD3C,MAAM,CAAE,MAAM,EAAE,MAAM;CAmC7B"}
1
+ {"version":3,"file":"proto-book.d.ts","sourceRoot":"","sources":["../../src/proto-book.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAiC,SAAS,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACvG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAMvD,qBAAa,kBAAmB,YAAW,SAAS;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAE7B;;;OAGG;gBACU,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK;IAK9D,GAAG,CAAE,MAAM,EAAE,MAAM;IAqBnB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;IAiDxC,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;IAkDxC,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;IAoD3C,MAAM,CAAE,MAAM,EAAE,MAAM;CAmC7B"}
@@ -1,7 +1,7 @@
1
1
  import { Key } from 'interface-datastore/key';
2
- import type { Peer } from '@libp2p/interfaces/peer-store';
3
- import type { PeerId } from '@libp2p/interfaces/peer-id';
4
- import { Components } from '@libp2p/interfaces/components';
2
+ import type { Peer } from '@libp2p/interface-peer-store';
3
+ import type { PeerId } from '@libp2p/interface-peer-id';
4
+ import { Components } from '@libp2p/components';
5
5
  export interface Store {
6
6
  has: (peerId: PeerId) => Promise<boolean>;
7
7
  save: (peer: Peer) => Promise<Peer>;
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,y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CAAC,IAAI,CAAC;IAwBpC,IAAI,CAAE,IAAI,EAAE,IAAI;IAgDhB,KAAK,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;IAM1C,aAAa,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;IAgBlD,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI;IAQvD,KAAK,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;IAM1C,aAAa,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;IAiBlD,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI;IAuCrD,GAAG;CAWZ"}
package/dist/src/store.js CHANGED
@@ -8,7 +8,7 @@ import { Multiaddr } from '@multiformats/multiaddr';
8
8
  import { Peer as PeerPB } from './pb/peer.js';
9
9
  import mortice from 'mortice';
10
10
  import { equals as uint8arrayEquals } from 'uint8arrays/equals';
11
- import { Components } from '@libp2p/interfaces/components';
11
+ import { Components } from '@libp2p/components';
12
12
  const log = logger('libp2p:peer-store:store');
13
13
  const NAMESPACE_COMMON = '/peers/';
14
14
  export class PersistentStore {
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,EAA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C,EAAE;YACF,wDAAwD;YACxD,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YAEpC,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAA;SACtC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@libp2p/peer-store",
3
- "version": "1.0.16",
3
+ "version": "3.0.0",
4
4
  "description": "Stores information about peers libp2p knows on the network",
5
5
  "license": "Apache-2.0 OR MIT",
6
- "homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-peer-store#readme",
6
+ "homepage": "https://github.com/libp2p/js-libp2p-peer-store#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
9
+ "url": "git+https://github.com/libp2p/js-libp2p-peer-store.git"
10
10
  },
11
11
  "bugs": {
12
- "url": "https://github.com/libp2p/js-libp2p-interfaces/issues"
12
+ "url": "https://github.com/libp2p/js-libp2p-peer-store/issues"
13
13
  },
14
14
  "keywords": [
15
15
  "IPFS"
@@ -28,6 +28,7 @@
28
28
  ],
29
29
  "exports": {
30
30
  ".": {
31
+ "types": "./src/index.d.ts",
31
32
  "import": "./dist/src/index.js"
32
33
  }
33
34
  },
@@ -138,11 +139,16 @@
138
139
  "release": "aegir release"
139
140
  },
140
141
  "dependencies": {
141
- "@libp2p/interfaces": "^2.0.0",
142
- "@libp2p/logger": "^1.1.0",
142
+ "@libp2p/components": "^2.0.0",
143
+ "@libp2p/interface-peer-id": "^1.0.2",
144
+ "@libp2p/interface-peer-info": "^1.0.1",
145
+ "@libp2p/interface-peer-store": "^1.0.0",
146
+ "@libp2p/interface-record": "^1.0.1",
147
+ "@libp2p/interfaces": "^3.0.2",
148
+ "@libp2p/logger": "^2.0.0",
143
149
  "@libp2p/peer-id": "^1.1.0",
144
- "@libp2p/peer-record": "^1.0.0",
145
- "@multiformats/multiaddr": "^10.1.5",
150
+ "@libp2p/peer-record": "^2.0.0",
151
+ "@multiformats/multiaddr": "^10.2.0",
146
152
  "err-code": "^3.0.1",
147
153
  "interface-datastore": "^6.1.0",
148
154
  "it-all": "^1.0.6",
@@ -156,10 +162,10 @@
156
162
  "uint8arrays": "^3.0.0"
157
163
  },
158
164
  "devDependencies": {
159
- "@libp2p/interface-compliance-tests": "^2.0.0",
165
+ "@libp2p/interface-compliance-tests": "^3.0.1",
160
166
  "@libp2p/peer-id-factory": "^1.0.0",
161
- "@libp2p/utils": "^1.0.9",
162
- "aegir": "^37.0.7",
167
+ "@libp2p/utils": "^2.0.0",
168
+ "aegir": "^37.3.0",
163
169
  "datastore-core": "^7.0.1",
164
170
  "p-defer": "^4.0.0",
165
171
  "p-wait-for": "^4.1.0",
@@ -10,11 +10,11 @@ import map from 'it-map'
10
10
  import each from 'it-foreach'
11
11
  import { peerIdFromPeerId } from '@libp2p/peer-id'
12
12
  import { CustomEvent } from '@libp2p/interfaces/events'
13
- import type { AddressFilter, Peer, PeerMultiaddrsChangeData, PeerStore } from '@libp2p/interfaces/peer-store'
13
+ import type { AddressFilter, Peer, PeerMultiaddrsChangeData, PeerStore } from '@libp2p/interface-peer-store'
14
14
  import type { Store } from './store.js'
15
- import type { Envelope } from '@libp2p/interfaces/record'
16
- import type { PeerId } from '@libp2p/interfaces/peer-id'
17
- import type { PeerInfo } from '@libp2p/interfaces/peer-info'
15
+ import type { Envelope } from '@libp2p/interface-record'
16
+ import type { PeerId } from '@libp2p/interface-peer-id'
17
+ import type { PeerInfo } from '@libp2p/interface-peer-info'
18
18
 
19
19
  const log = logger('libp2p:peer-store:address-book')
20
20
  const EVENT_NAME = 'change:multiaddrs'
package/src/index.ts CHANGED
@@ -5,9 +5,9 @@ import { PeerStoreKeyBook } from './key-book.js'
5
5
  import { PeerStoreMetadataBook } from './metadata-book.js'
6
6
  import { PeerStoreProtoBook } from './proto-book.js'
7
7
  import { PersistentStore, Store } from './store.js'
8
- import type { PeerStore, AddressBook, KeyBook, MetadataBook, ProtoBook, PeerStoreEvents, PeerStoreInit, Peer } from '@libp2p/interfaces/peer-store'
9
- import type { PeerId } from '@libp2p/interfaces/peer-id'
10
- import { Components, Initializable } from '@libp2p/interfaces/components'
8
+ import type { PeerStore, AddressBook, KeyBook, MetadataBook, ProtoBook, PeerStoreEvents, PeerStoreInit, Peer } from '@libp2p/interface-peer-store'
9
+ import type { PeerId } from '@libp2p/interface-peer-id'
10
+ import { Components, Initializable } from '@libp2p/components'
11
11
 
12
12
  const log = logger('libp2p:peer-store')
13
13
 
package/src/key-book.ts CHANGED
@@ -5,8 +5,8 @@ import { peerIdFromPeerId } from '@libp2p/peer-id'
5
5
  import { equals as uint8arrayEquals } from 'uint8arrays/equals'
6
6
  import { CustomEvent } from '@libp2p/interfaces/events'
7
7
  import type { Store } from './store.js'
8
- import type { PeerStore, KeyBook, PeerPublicKeyChangeData, Peer } from '@libp2p/interfaces/peer-store'
9
- import type { PeerId } from '@libp2p/interfaces/peer-id'
8
+ import type { PeerStore, KeyBook, PeerPublicKeyChangeData, Peer } from '@libp2p/interface-peer-store'
9
+ import type { PeerId } from '@libp2p/interface-peer-id'
10
10
 
11
11
  const log = logger('libp2p:peer-store:key-book')
12
12
 
@@ -5,8 +5,8 @@ import { peerIdFromPeerId } from '@libp2p/peer-id'
5
5
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
6
6
  import { CustomEvent } from '@libp2p/interfaces/events'
7
7
  import type { Store } from './store.js'
8
- import type { PeerStore, MetadataBook, PeerMetadataChangeData, Peer } from '@libp2p/interfaces/peer-store'
9
- import type { PeerId } from '@libp2p/interfaces/peer-id'
8
+ import type { PeerStore, MetadataBook, PeerMetadataChangeData, Peer } from '@libp2p/interface-peer-store'
9
+ import type { PeerId } from '@libp2p/interface-peer-id'
10
10
 
11
11
  const log = logger('libp2p:peer-store:metadata-book')
12
12
 
package/src/proto-book.ts CHANGED
@@ -4,8 +4,8 @@ import { codes } from './errors.js'
4
4
  import { peerIdFromPeerId } from '@libp2p/peer-id'
5
5
  import { CustomEvent } from '@libp2p/interfaces/events'
6
6
  import type { Store } from './store.js'
7
- import type { Peer, PeerProtocolsChangeData, PeerStore, ProtoBook } from '@libp2p/interfaces/peer-store'
8
- import type { PeerId } from '@libp2p/interfaces/peer-id'
7
+ import type { Peer, PeerProtocolsChangeData, PeerStore, ProtoBook } from '@libp2p/interface-peer-store'
8
+ import type { PeerId } from '@libp2p/interface-peer-id'
9
9
 
10
10
  const log = logger('libp2p:peer-store:proto-book')
11
11
 
package/src/store.ts CHANGED
@@ -8,9 +8,9 @@ import { Multiaddr } from '@multiformats/multiaddr'
8
8
  import { Metadata, Peer as PeerPB } from './pb/peer.js'
9
9
  import mortice from 'mortice'
10
10
  import { equals as uint8arrayEquals } from 'uint8arrays/equals'
11
- import type { Peer } from '@libp2p/interfaces/peer-store'
12
- import type { PeerId } from '@libp2p/interfaces/peer-id'
13
- import { Components } from '@libp2p/interfaces/components'
11
+ import type { Peer } from '@libp2p/interface-peer-store'
12
+ import type { PeerId } from '@libp2p/interface-peer-id'
13
+ import { Components } from '@libp2p/components'
14
14
 
15
15
  const log = logger('libp2p:peer-store:store')
16
16
 
package/src/README.md DELETED
@@ -1,145 +0,0 @@
1
- # PeerStore
2
-
3
- Libp2p's PeerStore is responsible for keeping an updated register with the relevant information of the known peers. It should be the single source of truth for all peer data, where a subsystem can learn about peers' data and where someone can listen for updates. The PeerStore comprises four main components: `addressBook`, `keyBook`, `protocolBook` and `metadataBook`.
4
-
5
- The PeerStore manages the high level operations on its inner books. Moreover, the PeerStore should be responsible for notifying interested parties of relevant events, through its Event Emitter.
6
-
7
- ## Submitting records to the PeerStore
8
-
9
- Several libp2p subsystems will perform operations that might gather relevant information about peers.
10
-
11
- ### Identify
12
- - The Identify protocol automatically runs on every connection when multiplexing is enabled. The protocol will put the multiaddrs and protocols provided by the peer to the PeerStore.
13
- - In the background, the Identify Service is also waiting for protocol change notifications of peers via the IdentifyPush protocol. Peers may leverage the `identify-push` message to communicate protocol changes to all connected peers, so that their PeerStore can be updated with the updated protocols.
14
- - While it is currently not supported in js-libp2p, future iterations may also support the [IdentifyDelta protocol](https://github.com/libp2p/specs/pull/176).
15
- - Taking into account that the Identify protocol records are directly from the peer, they should be considered the source of truth and weighted accordingly.
16
-
17
- ### Peer Discovery
18
- - Libp2p discovery protocols aim to discover new peers in the network. In a typical discovery protocol, addresses of the peer are discovered along with its peer id. Once this happens, a libp2p discovery protocol should emit a `peer` event with the information of the discovered peer and this information will be added to the PeerStore by libp2p.
19
-
20
- ### Dialer
21
- - Libp2p API supports dialing a peer given a `multiaddr`, and no prior knowledge of the peer. If the node is able to establish a connection with the peer, it and its multiaddr is added to the PeerStore.
22
- - When a connection is being upgraded, more precisely after its encryption, or even in a discovery protocol, a libp2p node can get to know other parties public keys. In this scenario, libp2p will add the peer's public key to its `KeyBook`.
23
-
24
- ### DHT
25
- - On some DHT operations, such as finding providers for a given CID, nodes may exchange peer data as part of the query. This passive peer discovery should result in the DHT emitting the `peer` event in the same way [Peer Discovery](#peerdiscovery) does.
26
-
27
- ## Retrieving records from the PeerStore
28
-
29
- When data in the PeerStore is updated the PeerStore will emit events based on the changes, to allow applications and other subsystems to take action on those changes. Any subsystem interested in these notifications should subscribe the [`PeerStore events`][peer-store-events].
30
-
31
- ### Peer
32
- - Each time a new peer is discovered, the PeerStore should emit a [`peer` event][peer-store-events], so that interested parties can leverage this peer and establish a connection with it.
33
-
34
- ### Protocols
35
- - When the known protocols of a peer change, the PeerStore emits a [`change:protocols` event][peer-store-events].
36
-
37
- ### Multiaddrs
38
- - When the known listening `multiaddrs` of a peer change, the PeerStore emits a [`change:multiaddrs` event][peer-store-events].
39
-
40
- ## PeerStore implementation
41
-
42
- The PeerStore wraps four main components: `addressBook`, `keyBook`, `protocolBook` and `metadataBook`. Moreover, it provides a high level API for those components, as well as data events.
43
-
44
- ### Components
45
-
46
- #### Address Book
47
-
48
- The `addressBook` keeps the known multiaddrs of a peer. The multiaddrs of each peer may change over time and the Address Book must account for this.
49
-
50
- `Map<string, Address>`
51
-
52
- A `peerId.toString()` identifier mapping to a `Address` object, which should have the following structure:
53
-
54
- ```js
55
- {
56
- multiaddr: <Multiaddr>
57
- }
58
- ```
59
-
60
- #### Key Book
61
-
62
- The `keyBook` tracks the public keys of the peers by keeping their [`PeerId`][peer-id].
63
-
64
- `Map<string, PeerId`
65
-
66
- A `peerId.toString()` identifier mapping to a `PeerId` of the peer. This instance contains the peer public key.
67
-
68
- #### Protocol Book
69
-
70
- The `protoBook` holds the identifiers of the protocols supported by each peer. The protocols supported by each peer are dynamic and will change over time.
71
-
72
- `Map<string, Set<string>>`
73
-
74
- A `peerId.toString()` identifier mapping to a `Set` of protocol identifier strings.
75
-
76
- #### Metadata Book
77
-
78
- The `metadataBook` keeps track of the known metadata of a peer. Its metadata is stored in a key value fashion, where a key identifier (`string`) represents a metadata value (`Uint8Array`).
79
-
80
- `Map<string, Map<string, Uint8Array>>`
81
-
82
- A `peerId.toString()` identifier mapping to the peer metadata Map.
83
-
84
- ### API
85
-
86
- For the complete API documentation, you should check the [API.md](../../doc/API.md).
87
-
88
- Access to its underlying books:
89
-
90
- - `peerStore.addressBook.*`
91
- - `peerStore.keyBook.*`
92
- - `peerStore.metadataBook.*`
93
- - `peerStore.protoBook.*`
94
-
95
- ### Events
96
-
97
- - `peer` - emitted when a new peer is added.
98
- - `change:multiaadrs` - emitted when a known peer has a different set of multiaddrs.
99
- - `change:protocols` - emitted when a known peer supports a different set of protocols.
100
- - `change:pubkey` - emitted when a peer's public key is known.
101
- - `change:metadata` - emitted when known metadata of a peer changes.
102
-
103
- ## Data Persistence
104
-
105
- The data stored in the PeerStore can be persisted if configured appropriately. Keeping a record of the peers already discovered by the peer, as well as their known data aims to improve the efficiency of peers joining the network after being offline.
106
-
107
- The libp2p node will need to receive a [datastore](https://github.com/ipfs/interface-datastore), in order to persist this data across restarts. A [datastore](https://github.com/ipfs/interface-datastore) stores its data in a key-value fashion. As a result, we need coherent keys so that we do not overwrite data.
108
-
109
- The PeerStore should not continuously update the datastore whenever data is changed. Instead, it should only store new data after reaching a certain threshold of "dirty" peers, as well as when the node is stopped, in order to batch writes to the datastore.
110
-
111
- The peer id will be appended to the datastore key for each data namespace. The namespaces were defined as follows:
112
-
113
- **AddressBook**
114
-
115
- All the known peer addresses are stored with a key pattern as follows:
116
-
117
- `/peers/addrs/<b32 peer id no padding>`
118
-
119
- **ProtoBook**
120
-
121
- All the known peer protocols are stored with a key pattern as follows:
122
-
123
- `/peers/protos/<b32 peer id no padding>`
124
-
125
- **KeyBook**
126
-
127
- All public keys are stored under the following pattern:
128
-
129
- ` /peers/keys/<b32 peer id no padding>`
130
-
131
- **MetadataBook**
132
-
133
- Metadata is stored under the following key pattern:
134
-
135
- `/peers/metadata/<b32 peer id no padding>/<key>`
136
-
137
- ## Future Considerations
138
-
139
- - If multiaddr TTLs are added, the PeerStore may schedule jobs to delete all addresses that exceed the TTL to prevent AddressBook bloating
140
- - Further API methods will probably need to be added in the context of multiaddr validity and confidence.
141
- - When improving libp2p configuration for specific runtimes, we should take into account the PeerStore recommended datastore.
142
- - When improving libp2p configuration, we should think about a possible way of allowing the configuration of Bootstrap to be influenced by the persisted peers, as a way to decrease the load on Bootstrap nodes.
143
-
144
- [peer-id]: https://github.com/libp2p/js-peer-id
145
- [peer-store-events]: ../../doc/API.md#libp2ppeerstore