Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
[ ](https://travis-ci.org/diasdavid/js-peer-id)
IPFS Peer Id implementation in Node.js
A IPFS Peer Id is based on a sha256 has of the peer public key, using multihash
$ npm install peer-id
var PeerId = require('ipfs-peer')
// Create a new Id
var id = new PeerId.create()
// Recreate an Id from Hex string
var id = new PeerId.createFromHexString(str)
// Recreate an Id from a Buffer
var id = new PeerId.createFromBytes(buf)
// Recreate an B58 String
var id = new PeerId.createFromB58String(str)
// Recreate from a Public Key
var id = new PeerId.createFromPubKey(pubKey)
// Recreate from a Private Key
var id = new PeerId.createFromPrivKey(privKey)
// 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.pubKey // Buffer containing the Public Key
id.privKey // Buffer containing the Private Key
id.id // Buffer containing the multihash
0.3.4 (2015-10-28)
<a name="0.3.3"></a>
FAQs
IPFS Peer Id implementation in Node.js
The npm package peer-id receives a total of 0 weekly downloads. As such, peer-id popularity was classified as not popular.
We found that peer-id demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.