Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pubGuessC: testCase.guess[2],
pubGuessD: testCase.guess[3],
privSolnA: testCase.soln[0],
privSolnB: testCase.soln[1],
privSolnC: testCase.soln[2],
privSolnD: testCase.soln[3],
}
try {
console.log('The codemaster calculates the witness')
const witness = circuit.calculateWitness(testInput)
console.log('The codemaster generates a proof', new Date())
// Codemaster generates the proof and public signals
const { proof, publicSignals } = snarkjs.genProof(provingKey, witness);
// Save to file
writeFileSync(
PROOF_AND_SIGNALS_DIR + '/' + i.toString() + '.json',
JSON.stringify(
stringifyBigInts({ proof, publicSignals }),
),
'utf8'
)
console.log('Verifying proof', new Date())
const isValid: boolean = snarkjs.isValid(verifyingKey, proof, publicSignals)
if (!isValid) {
throw new Error('Invalid proof')
} else {