mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-07-07 19:21:39 +00:00
Compare commits
3 Commits
v0.13.3
...
tmp-use-pe
Author | SHA1 | Date | |
---|---|---|---|
04c3e3d68a | |||
4d5bb2cfff | |||
a2ac32ac0f |
16
README.md
16
README.md
@ -213,10 +213,24 @@ Returns an `obj` of the form
|
|||||||
- `obj.pubKey: String` - The public key in protobuf format, encoded in 'base64'
|
- `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'
|
- `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.
|
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()`
|
### `toPrint()`
|
||||||
|
|
||||||
Returns the Peer ID as a printable string without the `Qm` prefix.
|
Returns the Peer ID as a printable string without the `Qm` prefix.
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"class-is": "^1.1.0",
|
"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",
|
"multihashes": "~0.4.15",
|
||||||
"protons": "^1.0.1"
|
"protons": "^1.0.1"
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user