# bls-lib

> this library provides primitives for creating and verifying BLS threshold signatures

Latest version **0.3.4** (published 2018-04-17) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install bls-lib
pnpm add bls-lib
yarn add bls-lib
bun add bls-lib
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2018-04-17 |
| First published | 2017-09-16 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Maintainers | null_radix |
| Keywords | bls, wasm, crypto |

## Links

- npm: https://www.npmjs.com/package/bls-lib
- Repository: https://github.com/dfinity/js-bls-lib
- Issues: https://github.com/dfinity/js-bls-lib/issues
- npm.io page: https://npm.io/package/bls-lib

## Dependencies (2)

- [nop](https://npm.io/package/nop.md) ^1.0.0
- [safe-buffer](https://npm.io/package/safe-buffer.md) ^5.1.1

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.3.4 (latest) — 2018-04-17
- 0.3.3 — 2018-04-12
- 0.3.0 — 2017-10-08
- 0.2.0 — 2017-10-07
- 0.1.0 — 2017-10-07
- 0.0.2 — 2017-10-03
- 0.0.1 — 2017-09-24
- 0.0.0 — 2017-09-16

## README

[![NPM Package](https://img.shields.io/npm/v/bls-lib.svg?style=flat-square)](https://www.npmjs.org/package/bls-lib)
[![Build Status](https://img.shields.io/travis/dfinity/js-bls-lib.svg?branch=master&style=flat-square)](https://travis-ci.org/dfinity/js-bls-lib)
[![Coverage Status](https://img.shields.io/coveralls/dfinity/js-bls-lib.svg?style=flat-square)](https://coveralls.io/r/dfinity/js-bls-lib)


[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

# Synopsis

This libary provides primitives for creating and verifying [BLS threshold signatures](https://en.wikipedia.org/wiki/Boneh–Lynn–Shacham) in Webassembly with a JS API. All the hard work is done by [herumi/bls](https://github.com/herumi/bls). This wraps the bls C++ code which is compiled to Webassembly for easier use.

## Installation
`npm install bls-lib`

## Usage

```javascript

const bls = require('bls-lib')
bls.onModuleInit(() => {
  bls.init()

  const sec = bls.secretKey()
  const pub = bls.publicKey()
  const sig = bls.signature()

  bls.secretKeySetByCSPRNG(sec)
  const msg = 'hello world'
  bls.sign(sig, sec, msg)

  bls.getPublicKey(pub, sec)

  const v = bls.verify(sig, pub, msg)
  // v === true

  bls.free(sec)
  bls.free(sig)
  bls.free(pub)
})
```

# Examples
[./examples/](./examples/)

# API
[./docs/](./docs/index.md)

# Dependents
* [verifiable secret sharing](https://github.com/dfinity/vss)
* [distributed key generation](https://github.com/dfinity/dkg)

# Building

First install the dependencies [emscripten](https://github.com/kripken/emscripten) and [ninja](ninja-build.org)

```
 git clone --recursive https://github.com/dfinity/js-bls-lib.git
 cd js-bls-lib/build
 ninja
```

## License

[**(C) 2017 DFINITY STIFTUNG**](http://dfinity.network)

[MPL-2.0][LICENSE]

[LICENSE]: https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)

![image](https://user-images.githubusercontent.com/6457089/32753794-10f4cbc2-c883-11e7-8dcf-ff8088b38f9f.png)

---
_Source: https://npm.io/package/bls-lib · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
