Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
fix: expose peerstore consume peer record method (#398)
Browse files Browse the repository at this point in the history
This method lets gossipsub consume a peer record.
  • Loading branch information
achingbrain authored May 10, 2023
1 parent 6998722 commit 80222b8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/interface-peer-store/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,19 @@ export interface PeerStore {
* ```
*/
merge: (id: PeerId, data: PeerData) => Promise<Peer>

/**
* 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.
*
* @example
*
* ```js
* await peerStore.consumePeerRecord(buf, expectedPeer)
* ```
*/
consumePeerRecord: (buf: Uint8Array, expectedPeer?: PeerId) => Promise<boolean>
}

0 comments on commit 80222b8

Please sign in to comment.