Unmarshal and verify a signed peer record, extract the multiaddrs and overwrite the stored addresses for the peer.
Optionally pass an expected PeerId to verify that the peer record was signed by that peer.
await peerStore.consumePeerRecord(buf, expectedPeer)
Optional
expectedPeer: PeerIdDelete all data stored for the passed peer
await peerStore.addressBook.set(peerId, multiaddrs)
await peerStore.addressBook.get(peerId)
// multiaddrs[]
await peerStore.delete(peerId)
await peerStore.addressBook.get(peerId)
// []
Loop over every peer - the looping is async because we read from a datastore but the peer operation is sync, this is to prevent long-lived peer operations causing deadlocks over the datastore which can happen if they try to access the peer store during the loop
await peerStore.forEach(peer => {
// ...
})
Returns all peers in the peer store.
Example