UNPKG

zk-threshold-proof

Version:

A lightweight SDK to generate and verify ZK proofs that assert a private value is greater than or equal to a threshold.

15 lines (11 loc) 413 B
const snarkjs = require('snarkjs'); const fs = require('fs'); const path = require('path'); const basePath = path.join(__dirname, '../circuits/ageVerifier'); async function verifyProof(proof, publicSignals) { const vKey = JSON.parse( fs.readFileSync(path.join(basePath, 'verification_key.json')) ); return await snarkjs.groth16.verify(vKey, publicSignals, proof); } module.exports = { verifyProof };