Skip to content

dfinity-side-projects/vss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SYNOPSIS

Build Status Coverage Status

js-standard-style

This implements verifiable secret sharing on top of bls-lib. Its is based on Shamir's scheme but has the added benefit that ths recipients can verify their shares against a verifcation vector. This insures that dealer cannot hand out invalid shares.

INSTALL

npm install vss

USAGE

const vss = require('vss')
const bls = require('bls-lib')

bls.onModuleInit(() => {
  bls.init()
  const threshold = 5
  const numOfPlayers = 7
  const setup = vss.createShare(bls, numOfPlayers, threshold)
  
  // use `setup.secret` to encrypt something, it is a random 32 byte Uint8Array
  // post `setup.verificationVector` somewhere public
  // then send each share in `setup.shares` to someone

  // when the recipients recieve thier share they can verify that it was created
  // corectly with the verifcationVector
  setup.shares.forEach(share => {
    const verified = vss.verifyShare(bls, share, setup.verifcationVector)
    console.log(verified)
  })

  // when `threshold` number of recipients combine their shares the secert key
  // can be recovered
  const secret = vss.recoverSecret(bls, setup.shares.slice(0, threshold))
  // secret === setup.secret
})

API

./docs/

LICENSE

MPL-2.0

About

this implements verifiable secret sharing

Resources

License

Stars

Watchers

Forks

Packages

No packages published