Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mattrglobal/node-bbs-signatures

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mattrglobal/node-bbs-signatures

An implementation of BBS+ signatures using rust and typescript for node.js

  • 0.0.2-unstable.305cd0e
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.8K
decreased by-9.41%
Maintainers
1
Weekly downloads
 
Created
Source

Node BBS Signatures

Master Release

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

Getting started

To use this package within your project simply run

npm install @mattrglobal/node-bbs-signatures

Or with Yarn

yarn add @mattrglobal/node-bbs-signatures

Usage

The following is a short sample on how to use the API

import {
  generateBls12381KeyPair,
  blsSign,
  blsVerify,
  blsCreateProof,
  blsVerifyProof,
} from "@mattrglobal/node-bbs-signatures";

//Generate a new key pair
const keyPair = generateBls12381KeyPair();

//Set of messages we wish to sign
const messages = ["message1", "message2"];

//Create the signature
const signature = blsSign({
  keyPair,
  messages: messages,
});

//Verify the signature
const isVerified = blsVerify({
  publicKey: keyPair.publicKey,
  messages: messages,
  signature,
});

//Derive a proof from the signature revealing the first message
const proof = blsCreateProof({
  signature,
  publicKey: keyPair.publicKey,
  messages,
  nonce: "nonce",
  revealed: [0],
});

//Verify the created proof
const isProofVerified = blsVerifyProof({
  proof,
  publicKey: keyPair.publicKey,
  messageCount: messages.length,
  messages: messages.slice(0, 1),
  nonce: "nonce",
  revealed: [0],
});

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
Proof5*G1 + (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 test in the project run:

yarn test
Benchmark

To benchmark the implementation locally run:

yarn benchmark

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 neon-bindings.

Relevant References

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

FAQs

Package last updated on 26 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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