mirror of
https://github.com/personaelabs/spartan-ecdsa.git
synced 2026-01-11 06:57:53 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63f534a23a | ||
|
|
4d7c3c73df |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@personaelabs/spartan-ecdsa",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"main": "./build/lib.js",
|
||||
"types": "./build/lib.d.ts",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
export class MembershipProver extends Profiler implements IProver {
|
||||
circuit: string;
|
||||
witnessGenWasm: string;
|
||||
useRemoteCircuit: boolean;
|
||||
|
||||
constructor(options: ProverConfig) {
|
||||
super({ enabled: options?.enableProfiler });
|
||||
@@ -37,21 +38,9 @@ export class MembershipProver extends Profiler implements IProver {
|
||||
`);
|
||||
}
|
||||
|
||||
const isNode = typeof window === "undefined";
|
||||
if (isNode) {
|
||||
if (
|
||||
options.circuit.includes("http") ||
|
||||
options.witnessGenWasm.includes("http")
|
||||
) {
|
||||
throw new Error(
|
||||
`An URL was given for circuit/witnessGenWasm in Node.js environment. Please specify a local path.
|
||||
`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.circuit = options.circuit;
|
||||
this.witnessGenWasm = options.witnessGenWasm;
|
||||
this.useRemoteCircuit = options.useRemoteCircuit ?? false;
|
||||
}
|
||||
|
||||
async initWasm() {
|
||||
@@ -90,7 +79,8 @@ export class MembershipProver extends Profiler implements IProver {
|
||||
this.timeEnd("Generate witness");
|
||||
|
||||
this.time("Load circuit");
|
||||
const useRemoteCircuit = typeof window !== "undefined";
|
||||
const useRemoteCircuit =
|
||||
this.useRemoteCircuit ?? typeof window !== "undefined";
|
||||
const circuitBin = await loadCircuit(this.circuit, useRemoteCircuit);
|
||||
this.timeEnd("Load circuit");
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ export interface ProverConfig {
|
||||
witnessGenWasm: string;
|
||||
circuit: string;
|
||||
enableProfiler?: boolean;
|
||||
useRemoteCircuit?: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyConfig {
|
||||
|
||||
Reference in New Issue
Block a user