Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

came to fix a square bracket, ended up touch a bunch of other things :) #6

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
peer-id JavaScript implementation
==============================
=================================

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [[![](https://img.shields.io/badge/freenode-%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-95%25-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)
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [[![](https://img.shields.io/badge/freenode-%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-95%25-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 JavaScript

# Description
Expand All @@ -16,11 +20,11 @@ The public key is a base64 encoded string of a protobuf containing an RSA DER bu
### In Node.js through npm

```bash
$ npm install --save peer-id
> npm install --save peer-id
```

```javascript
var PeerId = require('peer-id')
const PeerId = require('peer-id')
```

### In the Browser through browserify
Expand All @@ -32,7 +36,7 @@ Same as in Node.js, you just have to [browserify](https://github.com/substack/no
Make the [peer-id.min.js](/dist/peer-id.min.js) available through your server and load it using a normal `<script>` tag, this will export the `peerId` constructor on the `window` object, such that:

```JavaScript
var PeerId = window.PeerId
const PeerId = window.PeerId
```

#### Gotchas
Expand All @@ -42,25 +46,25 @@ You will need to use Node.js `Buffer` API compatible, if you are running inside
### Creating a new Id

```
var PeerId = require('ipfs-peer')
const PeerId = require('ipfs-peer')

// Create a new Id
var id = PeerId.create()
const id = PeerId.create()

// Recreate an Id from Hex string
var id = PeerId.createFromHexString(str)
const id = PeerId.createFromHexString(str)

// Recreate an Id from a Buffer
var id = PeerId.createFromBytes(buf)
const id = PeerId.createFromBytes(buf)

// Recreate an B58 String
var id = PeerId.createFromB58String(str)
const id = PeerId.createFromB58String(str)

// Recreate from a Public Key
var id = PeerId.createFromPubKey(pubKey)
const id = PeerId.createFromPubKey(pubKey)

// Recreate from a Private Key
var id = PeerId.createFromPrivKey(privKey)
const id = PeerId.createFromPrivKey(privKey)
```

### Exporting an Id
Expand Down
Loading