Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const tape = require('tape')
const bls = require('bls-wasm')
const threshold = 4
const dkg = require('../')
bls.init().then(() => {
tape('dkg', t => {
// create the ids
const ids = [0, 1, 2, 3, 4, 5, 6].map(id => {
const sk = new bls.SecretKey()
sk.setHashOf(Buffer.from([id]))
return sk
})
// this stores an array of verifcation vectors. One for each ID
const vvecs = []
// this stores an array of secertKey contrubutions. One for each ID
const skContributions = []
// setup
ids.forEach(id => {
const {verificationVector, secretKeyContribution} = dkg.generateContribution(bls, ids, threshold)