Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const groupsVvec = dkg.addVerificationVectors(vvecs)
// derive the public key for each id from there secert key share
const groupsPks = []
ids.forEach((id, i) => {
const pk = new bls.PublicKey()
pk.share(groupsVvec, id)
groupsPks.push(pk)
const sk = groupsSks[i]
const pk2 = sk.getPublicKey()
const equal = pk.isEqual(pk2)
t.true(equal, 'public key derived from groups vvec should equal pk from secert share')
})
const groupsPk = new bls.PublicKey()
groupsPk.recover(groupsPks.slice(0, threshold), ids.slice(0, threshold))
const equal = groupsPk.isEqual(groupsVvec[0])
t.true(equal, 'groups public key should equal pk derived from pk shares')
t.end()
})
})
ids.forEach((id, i) => {
const pk = new bls.PublicKey()
pk.share(groupsVvec, id)
groupsPks.push(pk)
const sk = groupsSks[i]
const pk2 = sk.getPublicKey()
const equal = pk.isEqual(pk2)
t.true(equal, 'public key derived from groups vvec should equal pk from secert share')
})