Socket
Socket
Sign inDemoInstall

peer-id

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peer-id - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

2

package.json
{
"name": "peer-id",
"version": "0.6.2",
"version": "0.6.3",
"description": "IPFS Peer Id implementation in Node.js",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -16,37 +16,38 @@ peer-id JavaScript implementation

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.
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.
# Installation
# Usage
## npm
### In Node.js through npm
```bash
> npm install --save peer-id
```sh
> npm i peer-id
```
```javascript
const PeerId = require('peer-id')
## Use in Node.js
```JavaScript
var PeerId = require('peer-id')
```
### In the Browser through Webpack
## Use in a browser with browserify, webpack or any other bundler
Follow our [webpack config](/webpack.config.js) example.
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.
### In the Browser through browserify
```JavaScript
var PeerId = require('peer-id')
```
> **WIP** Doesn't work out yet
## Use in a browser Using a script tag
### In the Browser through `<script>` tag
Loading this module through a script tag will make the `PeerId` obj available in the global namespace.
Make the [peer-id.js](/dist/peer-id.js) available through your server and load it using a normal `<script>` tag, this will export the `PeerId` object, such that:
```JavaScript
const Id = PeerId
```html
<script src="https://npmcdn.com/peer-id/dist/index.min.js"></script>
<!-- OR -->
<script src="https://npmcdn.com/peer-id/dist/index.js"></script>
```
#### Gotchas
# Usage
You will need to use Node.js `Buffer` API compatible, if you are running inside the browser, you can access it by `PeerId.Buffer` or you can install Feross's [Buffer](https://github.com/feross/buffer).
### Creating a new Id

@@ -53,0 +54,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc