mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-07-04 09:21:35 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
9b2cb012e9 | |||
35102b4ad5 | |||
192c65f09a | |||
dda0204ec0 | |||
1096d15a16 |
20
README.md
20
README.md
@ -1,7 +1,7 @@
|
||||
ipfs-peer-id Node.js implementation
|
||||
===================================
|
||||
peer-id Node.js implementation
|
||||
==============================
|
||||
|
||||
[](http://ipn.io) [[](http://webchat.freenode.net/?channels=%23ipfs) ](https://travis-ci.org/diasdavid/node-ipfs-peer-id)  [](https://david-dm.org/diasdavid/node-ipfs-peer-id) [](https://github.com/feross/standard)
|
||||
[](http://ipn.io) [[](http://webchat.freenode.net/?channels=%23ipfs) ](https://travis-ci.org/diasdavid/node-peer-id)  [](https://david-dm.org/diasdavid/node-peer-id) [](https://github.com/feross/standard)
|
||||
|
||||
> IPFS Peer Id implementation in Node.js
|
||||
|
||||
@ -14,7 +14,7 @@ A IPFS Peer Id is based on a sha256 has of the peer public key, using [multihash
|
||||
### Installing
|
||||
|
||||
```
|
||||
$ npm install ipfs-peer-id
|
||||
$ npm install peer-id
|
||||
```
|
||||
|
||||
### Creating a new Id
|
||||
@ -23,22 +23,22 @@ $ npm install ipfs-peer-id
|
||||
var PeerId = require('ipfs-peer')
|
||||
|
||||
// Create a new Id
|
||||
var id = new Id.create()
|
||||
var id = new PeerId.create()
|
||||
|
||||
// Recreate an Id from Hex string
|
||||
var id = new Id.createFromHexString(str)
|
||||
var id = new PeerId.createFromHexString(str)
|
||||
|
||||
// Recreate an Id from a Buffer
|
||||
var id = new Id.createFromBytes(buf)
|
||||
var id = new PeerId.createFromBytes(buf)
|
||||
|
||||
// Recreate an B58 String
|
||||
var id = new Id.createFromB58String(str)
|
||||
var id = new PeerId.createFromB58String(str)
|
||||
|
||||
// Recreate from a Public Key
|
||||
var id = new Id.createFromPubKey(pubKey)
|
||||
var id = new PeerId.createFromPubKey(pubKey)
|
||||
|
||||
// Recreate from a Private Key
|
||||
var id = new Id.createFromPrivKey(privKey)
|
||||
var id = new PeerId.createFromPrivKey(privKey)
|
||||
```
|
||||
|
||||
### Exporting an Id
|
||||
|
12
package.json
12
package.json
@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "ipfs-peer-id",
|
||||
"version": "0.3.2",
|
||||
"name": "peer-id",
|
||||
"version": "0.3.3",
|
||||
"description": "IPFS Peer Id implementation in Node.js",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/lab tests/*-test.js",
|
||||
"coverage": "./node_modules/.bin/lab -t 100 tests/*-test.js",
|
||||
"codestyle": "./node_modules/.bin/standard --format"
|
||||
"codestyle": "./node_modules/.bin/standard --format",
|
||||
"lint": "jshint .",
|
||||
"validate": "npm ls"
|
||||
},
|
||||
"keywords": [
|
||||
"IPFS"
|
||||
@ -21,9 +23,9 @@
|
||||
"node": "^4.0.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/diasdavid/node-ipfs-peer-id/issues"
|
||||
"url": "https://github.com/diasdavid/node-peer-id/issues"
|
||||
},
|
||||
"homepage": "https://github.com/diasdavid/node-ipfs-peer-id",
|
||||
"homepage": "https://github.com/diasdavid/node-peer-id",
|
||||
"devDependencies": {
|
||||
"code": "^1.4.1",
|
||||
"lab": "^5.13.0",
|
||||
|
Reference in New Issue
Block a user