Skip to content

Commit

Permalink
chore: include marshalPubKey and example (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
npfoss authored and vasco-santos committed Sep 29, 2019
1 parent a2ac32a commit 4d5bb2c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ Returns an `obj` of the form

Returns a protocol-buffers encoded version of the id, public key and, if `excludePrivateKey` is not set, the private key.

### `marshalPubKey()`

Returns a protobuf of just the public key, compatible with `libp2p-crypto` (unlike `marshal` above).

For example:
```js
const crypto = require('libp2p-crypto')

PeerId.create({ bits: 256, keyType: 'ed25519' }).then( pid => {
let pk = crypto.keys.unmarshalPublicKey(pid.marshalPubKey())
// your code here
}
```
### `toPrint()`
Returns the Peer ID as a printable string without the `Qm` prefix.
Expand Down

0 comments on commit 4d5bb2c

Please sign in to comment.