@smithii_io/mixoor 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/index.js
CHANGED
|
@@ -5,8 +5,10 @@ var circomlibjs = require('circomlibjs');
|
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var snarkjs = require('snarkjs');
|
|
8
|
+
var url = require('url');
|
|
8
9
|
var crypto = require('crypto');
|
|
9
10
|
|
|
11
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
12
|
function _interopNamespace(e) {
|
|
11
13
|
if (e && e.__esModule) return e;
|
|
12
14
|
var n = Object.create(null);
|
|
@@ -1189,6 +1191,13 @@ async function generateProof(input) {
|
|
|
1189
1191
|
pathIndices: input.pathIndices,
|
|
1190
1192
|
amount: BigInt(input.amount).toString()
|
|
1191
1193
|
};
|
|
1194
|
+
let __dirname;
|
|
1195
|
+
if (typeof __filename !== "undefined") {
|
|
1196
|
+
__dirname = path__namespace.dirname(__filename);
|
|
1197
|
+
} else {
|
|
1198
|
+
const __filename_esm = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
1199
|
+
__dirname = path__namespace.dirname(__filename_esm);
|
|
1200
|
+
}
|
|
1192
1201
|
const packageRoot = path__namespace.join(__dirname, "../..");
|
|
1193
1202
|
const wasmPath = path__namespace.join(
|
|
1194
1203
|
packageRoot,
|
|
@@ -1198,11 +1207,7 @@ async function generateProof(input) {
|
|
|
1198
1207
|
const { proof, publicSignals } = await snarkjs.groth16.fullProve(
|
|
1199
1208
|
circuitInputs,
|
|
1200
1209
|
wasmPath,
|
|
1201
|
-
zkeyPath
|
|
1202
|
-
void 0,
|
|
1203
|
-
void 0,
|
|
1204
|
-
{ singleThread: true }
|
|
1205
|
-
// ! does this impact performance
|
|
1210
|
+
zkeyPath
|
|
1206
1211
|
);
|
|
1207
1212
|
const vKeyPath = path__namespace.join(packageRoot, "circuits/verification_key.json");
|
|
1208
1213
|
const isValid = await snarkjs.groth16.verify(
|