Comparing version 0.6.2 to 0.6.3
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5249957
99
0