1.3.1 • Published 28 days ago

@mattrglobal/bbs-signatures v1.3.1

Weekly downloads
346
License
Apache-2.0
Repository
github
Last release
28 days ago

Mattr logo

bbs-signatures

npm-version npm-unstable-version Master Release codecov

This repository is the home to a performant multi-message digital signature algorithm implementation which supports deriving zero knowledge proofs that enable selective disclosure from the originally signed message set.

BBS+ Signatures are a digital signature algorithm originally born from the work on Short group signatures by Boneh, Boyen, and Shachum which was later improved on in Constant-Size Dynamic k-TAA as BBS+ and touched on again in section 4.3 in Anonymous Attestation Using the Strong Diffie Hellman Assumption Revisited .

BBS+ signatures require a pairing-friendly curve, this library includes support for BLS12-381.

BBS+ Signatures allow for multi-message signing whilst producing a single output signature. With a BBS signature, a proof of knowledge based proof can be produced where only some of the originally signed messages are revealed at the discretion of the prover.

For more details on the signature algorithm please refer to here

Note the performance of this library in node environments is significantly different than with a native node module, for those requiring the highest level of performance we recommend using node-bbs-signatures.

Getting started

To use this package within your project simply run

npm install @mattrglobal/bbs-signatures

Or with Yarn

yarn add @mattrglobal/bbs-signatures

Using via CDN in browser

To use this library in browser via the unpkg CDN, include the following script element in your HTML

<script type="text/javascript" src="https://unpkg.com/@mattrglobal/bbs-signatures/dist/bbs-signatures.min.js"></script></body>

React Native Support

Support is still in-progress

Currently WASM support in react native is not official although there are experimentations underway.

There are several different ways in which support can be accomplished

  1. Injecting a polyfill of the Web Assembly tool chain such as WebAssemblyJS, however experimentation with this library yielded the same issue as seen in here.
  2. A shim that trees down on to the native WebAssembly implementation provided by the OS, an example of the approach is captured here
  3. Compiling the wasm back into asm.js using the wasm2js from binaryen, note this is currently the preferred option and will be pursued for this library in the short term.

Element Size

Within a digital signature there are several elements for which it is useful to know the size, the following table outlines the general equation for calculating element sizes in relation to BBS+ signatures as it is dependent on the pairing friendly curve used.

ElementSize Equation
Private KeyF
Public KeyG2
SignatureG1 + 2*F
Proof5G1 + (4 + no_of_hidden_messages)F
  • F A field element
  • G1 A point in the field of G1
  • G2 A point in the field of G2
  • no_of_hidden_messages The number of the hidden messages

This library includes specific support for BLS12-381 keys with BBS+ signatures and hence gives rise to the following concrete sizes

ElementSize with BLS12-381
Private Key32 Bytes
Public Key96 Bytes
Signature112 Bytes
Proof368 + (no_of_hidden_messages)*32 Bytes

Getting started as a contributor

The following describes how to get started as a contributor to this project

Prerequisites

The following is a list of dependencies you must install to build and contribute to this project

For more details see our contribution guidelines

Install

To install the package dependencies run:

yarn install --frozen-lockfile

Build

To build the project run:

yarn build

Test

To run the all test in the project run:

yarn test

To run just the tests for a node environment run:

yarn test:node

To run just the tests for a browser environment run:

yarn test:browser

Benchmark

To benchmark the implementation locally in a node environment run:

yarn benchmark:node

Dependencies

This library uses the bbs rust crate for the implementation of BBS+ signatures and BLS12-381 which is then wrapped and exposed in javascript/typescript using Web Assembly.

Relevant References

For those interested in more details, you might find the following resources helpful

1.2.0

8 months ago

1.3.1

7 months ago

1.3.0

7 months ago

1.1.0

2 years ago

1.0.0

2 years ago

0.7.0

2 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago