Friedel Ziegelmayer 3ef704ba32 use static keyword
2016-12-05 20:48:29 +01:00
2016-12-05 20:48:29 +01:00
2016-11-03 07:51:29 +00:00
2016-12-02 15:08:51 +01:00
2016-04-12 21:09:41 +01:00
2016-11-03 07:51:29 +00:00
2016-04-15 13:20:05 +02:00
2016-12-02 15:08:51 +01:00
2016-12-02 16:02:04 +01:00
2015-07-08 14:50:37 -07:00
2016-12-02 15:08:51 +01:00
2016-12-02 15:08:51 +01:00

peer-id

Build Status Coverage Status Dependency Status js-standard-style

Sauce Test Status

IPFS Peer ID implementation in JavaScript.

Description

Generate, import, and export PeerIDs, for use with IPFS.

A Peer ID is the SHA-256 multihash of a public key.

The public key is a base64 encoded string of a protobuf containing an RSA DER buffer. This uses a node buffer to pass the base64 encoded public key protobuf to the multihash for ID generation.

Example

var PeerId = require('peer-id')

PeerId.create({ bits: 1024 }, (err, id) => {
  console.log(JSON.stringify(id.toJSON(), null, 2)
})
{
  "id": "Qma9T5YraSnpRDZqRR4krcSJabThc8nwZuJV3LercPHufi",
  "privKey": "CAAS4AQwggJcAgEAAoGBAMBgbIqyOL26oV3nGPBYrdpbv..",
  "pubKey": "CAASogEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMBgbIqyOL26oV3nGPBYrdpbvzCY..."
}

Installation

npm

> npm i peer-id

Setup

Node.js

var PeerId = require('peer-id')

Browser: Browserify, Webpack, other bundlers

The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.

var PeerId = require('peer-id')

Browser: <script> Tag

Loading this module through a script tag will make the PeerId obj available in the global namespace.

<script src="https://unpkg.com/peer-id/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/peer-id/dist/index.js"></script>

API

License

MIT

Description
No description provided
Readme 2.4 MiB
Languages
JavaScript 100%