Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* along with semaphorejs. If not, see .
*/
const crypto = require('crypto');
const path = require('path');
const {unstringifyBigInts, stringifyBigInts} = require('websnark/tools/stringifybigint.js');
const chai = require('chai');
const assert = chai.assert;
const snarkjs = require('snarkjs');
const circomlib = require('circomlib');
const bigInt = snarkjs.bigInt;
const eddsa = circomlib.eddsa;
const mimcsponge = circomlib.mimcsponge;
const proof_util = require('../util');
const fetch = require('node-fetch');
const Web3 = require('web3');
const ethers = require('ethers');
let logger;
/* uint8array to hex */
function hex(byteArray) {
return Array.prototype.map.call(byteArray, function(byte) {
const chai = require('chai');
const path = require('path');
const snarkjs = require('snarkjs');
const compiler = require('circom');
const fs = require('fs');
const circomlib = require('circomlib');
const test_util = require('../../src/test_util');
const build_merkle_tree_example = test_util.build_merkle_tree_example;
const assert = chai.assert;
const bigInt = snarkjs.bigInt;
const eddsa = circomlib.eddsa;
const mimc7 = circomlib.mimc7;
describe('circuit test', function () {
let circuit;
this.timeout(100000);
before( async () => {
const cirDef = JSON.parse(fs.readFileSync(path.join(__dirname,'../../build/circuit.json')).toString());
circuit = new snarkjs.Circuit(cirDef);
console.log('NConstrains Semaphore: ' + circuit.nConstraints);
});
it('does it', () => {
const prvKey = Buffer.from('0001020304050607080900010203040506070809000102030405060708090001', 'hex');
const BN = require('bn.js');
const chai = require('chai');
const crypto = require('crypto');
const fs = require('fs');
const del = require('del');
const path = require('path');
const snarkjs = require('snarkjs');
const circomlib = require('circomlib');
const test_util = require('../../src/test_util');
const bigInt = snarkjs.bigInt;
const eddsa = circomlib.eddsa;
const mimc7 = circomlib.mimc7;
const groth = snarkjs.groth;
const {unstringifyBigInts} = require('snarkjs/src/stringifybigint.js');
const assert = chai.assert;
const Semaphore = artifacts.require('Semaphore');
const RocksDb = require('../../../sbmtjs/src/storage/rocksdb');
const MerkleTree = require('../../../sbmtjs/src/tree');
const Mimc7Hasher = require('../../../sbmtjs/src/hasher/mimc7');
beBuff2int = function(buff) {
let res = bigInt.zero;
for (let i=0; i
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const {unstringifyBigInts, stringifyBigInts} = require('snarkjs/src/stringifybigint.js');
const chai = require('chai');
const assert = chai.assert;
const snarkjs = require('snarkjs');
const circomlib = require('circomlib');
const bigInt = snarkjs.bigInt;
const eddsa = circomlib.eddsa;
const groth = snarkjs.groth;
const fetch = require("node-fetch");
const Web3 = require('web3');
const winston = require('winston');
const BASE_DIR = process.env.BASE_DIR || process.cwd();
const SemaphoreABI = require(BASE_DIR + '/build/contracts/Semaphore.json');
const SemaphoreModules = require('./semaphore.js');
const SemaphoreClient = SemaphoreModules.client;
const generate_identity = SemaphoreModules.generate_identity;