Compare commits

..

3 Commits

2 changed files with 16 additions and 2 deletions

View File

@ -213,10 +213,24 @@ Returns an `obj` of the form
- `obj.pubKey: String` - The public key in protobuf format, encoded in 'base64'
- `obj.privKey: String` - The private key in protobuf format, encoded in 'base 64'
### `marshal(excludePrivatKey)`
### `marshal(excludePrivateKey)`
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.

View File

@ -41,7 +41,7 @@
},
"dependencies": {
"class-is": "^1.1.0",
"libp2p-crypto": "~0.17.0",
"libp2p-crypto": "github:libp2p/js-libp2p-crypto#feat/rsa-enc-dec",
"multihashes": "~0.4.15",
"protons": "^1.0.1"
},