2015-07-08 15:34:49 -07:00
2015-07-08 14:51:49 -07:00
2015-07-08 15:34:34 -07:00
2015-07-08 14:50:37 -07:00
2015-07-08 15:34:34 -07:00
2015-07-08 15:34:34 -07:00
2015-07-08 14:50:37 -07:00
2015-07-08 15:34:49 -07:00
2015-07-08 15:34:34 -07:00

ipfs-peer-id Node.js implementation

IPFS Peer Id implementation in Node.js

Description

A IPFS Peer Id is based on a sha256 has of the peer public key, using multihash

Usage

Installing

$ npm install ipfs-peer-id

Creating a new Id

var PeerId = require('ipfs-peer')

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

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

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

// Recreate an B58 String
var id = new Id.createFromB58String(str)

// Recreate from a Public Key
var id = new Id.createFromPubKey(pubKey)

// Recreate from a Private Key
var id = new Id.createFromPrivKey(privKey)

Exporting an Id

// Print friendly format
id.toPrint() // returns an object with id, privKey and pubKey in hex format

// Export to an hex string
id.toHexString()

// Export to Buffer
id.toBytes() (same as id.id)

// Export to a B58 string
id.toB58String()

Id format

id.pubKey   // Buffer containing the Public Key
id.privKey  // Buffer containing the Private Key
id.id       // Buffer containing the multihash
Description
No description provided
Readme 2.4 MiB
Languages
JavaScript 100%