Compare commits

...

18 Commits

Author SHA1 Message Date
5e9bf9837d Release v0.3.4. 2015-10-28 22:06:37 +00:00
f82d0d6ac5 Merge pull request #1 from diasdavid/rn
update README and package.json
2015-10-28 22:05:12 +00:00
0b30a0964c update README and package.json 2015-10-28 22:04:55 +00:00
9b2cb012e9 Release v0.3.3. 2015-09-15 17:18:08 +01:00
35102b4ad5 Release v0.3.2. 2015-09-15 17:17:59 +01:00
192c65f09a update readme 2015-09-15 17:17:50 +01:00
dda0204ec0 merge package.json conflict 2015-09-15 17:16:09 +01:00
1096d15a16 Rename 2015-09-15 17:14:48 +01:00
615a966d6a Release v0.3.2. 2015-09-14 11:58:41 +01:00
171a561537 to v4! 2015-09-14 11:58:33 +01:00
fa62838777 Release v0.3.1. 2015-08-25 10:39:44 +01:00
bb2f23633d replace precommit 2015-08-25 10:39:15 +01:00
d472664924 add badges and travis 2015-08-25 10:38:32 +01:00
2cc1a8ac59 Release v0.3.0. 2015-07-19 14:21:56 -07:00
220355fb25 Release v0.2.0. 2015-07-17 08:15:11 -07:00
a0dbc2ced8 fix args order 2015-07-17 08:14:44 -07:00
6415a13714 update multihashing dep 2015-07-10 11:50:58 -07:00
4185ff1be6 add link to freenode#ipfs badge 2015-07-08 15:38:30 -07:00
4 changed files with 37 additions and 20 deletions

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
language: node_js
node_js:
- "4.0"
branches:
only:
- master
before_install:
- npm i -g npm
# Workaround for a permissions issue with Travis virtual machine images
script:
- npm test

View File

@ -1,7 +1,7 @@
ipfs-peer-id Node.js implementation
===================================
peer-id JavaScript implementation
==============================
![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [[![](https://img.shields.io/badge/freejs-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) ![Build Status](https://travis-ci.org/diasdavid/js-peer-id.svg?style=flat-square)](https://travis-ci.org/diasdavid/js-peer-id) ![](https://img.shields.io/badge/coverage-%3F-yellow.svg?style=flat-square) [![Dependency Status](https://david-dm.org/diasdavid/js-peer-id.svg?style=flat-square)](https://david-dm.org/diasdavid/js-peer-id) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](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

View File

@ -1,12 +1,14 @@
{
"name": "ipfs-peer-id",
"version": "0.1.0",
"name": "peer-id",
"version": "0.3.4",
"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"
@ -17,18 +19,21 @@
"codestyle",
"test"
],
"bugs": {
"url": "https://github.com/diasdavid/node-ipfs-peer-id/issues"
"engines": {
"node": "^4.0.0"
},
"homepage": "https://github.com/diasdavid/node-ipfs-peer-id",
"bugs": {
"url": "https://github.com/diasdavid/js-peer-id/issues"
},
"homepage": "https://github.com/diasdavid/js-peer-id",
"devDependencies": {
"code": "^1.4.1",
"lab": "^5.13.0",
"precommit-hook": "^3.0.0",
"pre-commit": "^1.1.1",
"standard": "^4.5.2"
},
"dependencies": {
"bs58": "^2.0.1",
"multihashing": "^0.1.2"
"multihashing": "^0.1.3"
}
}

View File

@ -8,7 +8,7 @@ var crypto = require('crypto')
exports = module.exports = Id
function Id (id, pubKey, privKey) {
function Id (id, privKey, pubKey) {
var self = this
if (!(self instanceof Id)) {
@ -70,7 +70,6 @@ exports.createFromB58String = function (str) {
exports.createFromPubKey = function (pubKey) {
var mhId = multihashing(pubKey, 'sha2-256')
return new Id(mhId, null, pubKey)
}