-
Notifications
You must be signed in to change notification settings - Fork 511
feat: keybook #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: keybook #626
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,9 @@ | |
| * [`peerStore.addressBook.get`](#peerstoreaddressbookget) | ||
| * [`peerStore.addressBook.getMultiaddrsForPeer`](#peerstoreaddressbookgetmultiaddrsforpeer) | ||
| * [`peerStore.addressBook.set`](#peerstoreaddressbookset) | ||
| * [`peerStore.keyBook.delete`](#peerstorekeybookdelete) | ||
| * [`peerStore.keyBook.get`](#peerstorekeybookget) | ||
| * [`peerStore.keyBook.set`](#peerstorekeybookset) | ||
| * [`peerStore.protoBook.add`](#peerstoreprotobookadd) | ||
| * [`peerStore.protoBook.delete`](#peerstoreprotobookdelete) | ||
| * [`peerStore.protoBook.get`](#peerstoreprotobookget) | ||
|
|
@@ -811,6 +814,89 @@ Add known `protocols` of a given peer. | |
| peerStore.protoBook.add(peerId, protocols) | ||
| ``` | ||
|
|
||
| * [`peerStore.keyBook.get`](#peerstorekeybookget) | ||
| * [`peerStore.keyBook.set`](#peerstorekeybookset) | ||
|
|
||
| ### peerStore.keyBook.delete | ||
|
|
||
| Delete the provided peer from the book. | ||
|
|
||
| `peerStore.keyBook.delete(peerId)` | ||
|
|
||
| #### Parameters | ||
|
|
||
| | Name | Type | Description | | ||
| |------|------|-------------| | ||
| | peerId | [`PeerId`][peer-id] | peerId to remove | | ||
|
|
||
| #### Returns | ||
|
|
||
| | Type | Description | | ||
| |------|-------------| | ||
| | `boolean` | true if found and removed | | ||
|
|
||
| #### Example | ||
|
|
||
| ```js | ||
| peerStore.keyBook.delete(peerId) | ||
| // false | ||
| peerStore.keyBook.set(peerId) | ||
| peerStore.keyBook.delete(peerId) | ||
| // true | ||
| ``` | ||
|
|
||
| ### peerStore.keyBook.get | ||
|
|
||
| Get the known `PublicKey` of a provided peer. | ||
|
|
||
| `peerStore.keyBook.get(peerId)` | ||
|
|
||
| #### Parameters | ||
|
|
||
| | Name | Type | Description | | ||
| |------|------|-------------| | ||
| | peerId | [`PeerId`][peer-id] | peerId to get | | ||
|
|
||
| #### Returns | ||
|
|
||
| | Type | Description | | ||
| |------|-------------| | ||
| | `RsaPublicKey|Ed25519PublicKey|Secp256k1PublicKey` | Peer PublicKey | | ||
|
|
||
| #### Example | ||
|
|
||
| ```js | ||
| peerStore.keyBook.get(peerId) | ||
| // undefined | ||
| peerStore.keyBook.set(peerId) // with inline public key | ||
| peerStore.keyBook.get(peerId) | ||
| // PublicKey | ||
| ``` | ||
|
|
||
| ### peerStore.keyBook.set | ||
|
|
||
| Set known `peerId`. This can include its Public Key. | ||
|
|
||
| `peerStore.keyBook.set(peerId)` | ||
|
||
|
|
||
| #### Parameters | ||
|
|
||
| | Name | Type | Description | | ||
| |------|------|-------------| | ||
| | peerId | [`PeerId`][peer-id] | peerId to set | | ||
|
|
||
| #### Returns | ||
|
|
||
| | Type | Description | | ||
| |------|-------------| | ||
| | `KeyBook` | Returns the Key Book component | | ||
|
|
||
| #### Example | ||
|
|
||
| ```js | ||
| peerStore.keyBook.set(peerId) | ||
| ``` | ||
|
|
||
| ### peerStore.protoBook.delete | ||
|
|
||
| Delete the provided peer from the book. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.