Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
const provingKey = require('../circuits/proving_key.json')
const verificationKey = require('../circuits/verification_key.json')
const circuitDef = require('../circuits/circuit.json')
const { eddsa, mimc7 } = require('circomlib')
const { Circuit } = require('snarkjs')
const zkSnark = require('snarkjs').original
const { unstringifyBigInts } = require('snarkjs/src/stringifybigint')
const alicePrvKey = Buffer.from('1'.toString().padStart(64, '0'), 'hex')
const alicePubKey = eddsa.prv2pub(alicePrvKey)
const bobPrvKey = Buffer.from('2'.toString().padStart(64, '0'), 'hex')
const bobPubKey = eddsa.prv2pub(bobPrvKey)
// accounts (1 = Yes, 0 = No)
const Alice = {
pubkey: alicePubKey,
detail: 1
}
const aliceHash = mimc7.multiHash(
[Alice.pubkey[0], Alice.pubkey[1], BigInt(Alice.detail)]
)
const Bob = {
pubkey: bobPubKey,
detail: 0
// @flow
const provingKey = require('../circuits/proving_key.json')
const verificationKey = require('../circuits/verification_key.json')
const circuitDef = require('../circuits/circuit.json')
const { eddsa, mimc7 } = require('circomlib')
const { Circuit } = require('snarkjs')
const zkSnark = require('snarkjs').original
const { unstringifyBigInts } = require('snarkjs/src/stringifybigint')
const alicePrvKey = Buffer.from('1'.toString().padStart(64, '0'), 'hex')
const alicePubKey = eddsa.prv2pub(alicePrvKey)
const bobPrvKey = Buffer.from('2'.toString().padStart(64, '0'), 'hex')
const bobPubKey = eddsa.prv2pub(bobPrvKey)
// accounts (1 = Yes, 0 = No)
const Alice = {
pubkey: alicePubKey,
detail: 1
}
const aliceHash = mimc7.multiHash(
[Alice.pubkey[0], Alice.pubkey[1], BigInt(Alice.detail)]
)
const Bob = {
pubkey: bobPubKey,
detail: 0
}
const bobHash = mimc7.multiHash(
public(): PublicKey {
return new PublicKey(eddsa.prv2pub(this.sk));
}