Document peer dependency in README
This commit is contained in:
parent
0e69b819e0
commit
591105c553
20
README.md
20
README.md
|
@ -10,6 +10,12 @@ Javascript library for BLS (Boneh-Lynn-Shacham) signatures and signature aggrega
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn add @chainsafe/bls
|
||||||
|
```
|
||||||
|
|
||||||
|
You must initialize the library once in your application before using it. The result is cached and use across all your imports
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import bls, {init} from "@chainsafe/bls";
|
import bls, {init} from "@chainsafe/bls";
|
||||||
|
|
||||||
|
@ -27,7 +33,7 @@ import bls, {init} from "@chainsafe/bls";
|
||||||
|
|
||||||
### Browser
|
### Browser
|
||||||
|
|
||||||
If you are in the browser, import from `/browser`
|
If you are in the browser, import from `/browser` to import directly the WASM version
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import bls from "@chainsafe/bls/browser";
|
import bls from "@chainsafe/bls/browser";
|
||||||
|
@ -35,7 +41,11 @@ import bls from "@chainsafe/bls/browser";
|
||||||
|
|
||||||
### Native bindings only
|
### Native bindings only
|
||||||
|
|
||||||
If you are in NodeJS, import from `/node` to skip browser specific code
|
If you are in NodeJS, import from `/node` to skip browser specific code. Also install peer dependency `@chainsafe/blst` which has the native bindings
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn add @chainsafe/bls @chainsafe/blst
|
||||||
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import bls from "@chainsafe/bls/node";
|
import bls from "@chainsafe/bls/node";
|
||||||
|
@ -43,7 +53,11 @@ import bls from "@chainsafe/bls/node";
|
||||||
|
|
||||||
### Native bindings + WASM fallback
|
### Native bindings + WASM fallback
|
||||||
|
|
||||||
If you want to offer a fallback in NodeJS, first try to load native bindings and then fallback to WASM
|
If you want to offer a fallback in NodeJS, first try to load native bindings and then fallback to WASM. Also install peer dependency `@chainsafe/blst` which has the native bindings
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn add @chainsafe/bls @chainsafe/blst
|
||||||
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import bls from "@chainsafe/bls";
|
import bls from "@chainsafe/bls";
|
||||||
|
|
Reference in New Issue