22 Commits
v2.1.2 ... main

Author SHA1 Message Date
Daniel Tehrani
4bf236a1a5 Merge pull request #45 from 0xisk/main
refactor: minor enhancements on the lib package
2023-12-05 14:12:43 -08:00
Daniel Tehrani
ede2b29cac fix: use tsconfig.build.json so vscode can annotate test files as well 2023-12-02 08:45:37 +09:00
0xisk
cb273002c0 refactor: destructure params, update package metadata, enhance file naming and structure. 2023-11-29 20:41:48 +01:00
Daniel Tehrani
a08876d1ff Merge pull request #44 from 0xisk/main
chore: refactor lib package exports to named for clarity
2023-11-25 13:42:03 +09:00
isk
8b0529f868 chore: refactor lib exports to named for clarity 2023-11-24 11:40:18 +01:00
Daniel Tehrani
3827e5de67 v2.3.1 2023-10-11 16:33:48 +09:00
Daniel Tehrani
53049c8cbe fix: this lead to the unintentional breaking change 2023-10-11 16:32:19 +09:00
Daniel Tehrani
2fab170a15 Merge pull request #41 from AtHeartEngineer/patch-1
Update package.json
2023-10-11 11:27:15 +09:00
Daniel Tehrani
82518aabc3 Remove unused snarkjs installations 2023-10-11 11:22:57 +09:00
Daniel Tehrani
e8c95a975b Update yarn.lock 2023-10-11 11:10:44 +09:00
AtHeartEngineer
4cf4b36efd Update package.json
Bump snarkjs version to get rid of vulnerability warning, even though it doesn't effect this project since spartan-ecdsa is only using the witness generation
2023-10-10 21:18:56 -04:00
Daniel Tehrani
63f534a23a v2.3.0 2023-10-05 19:24:51 +09:00
Daniel Tehrani
4d7c3c73df feat: allow specifying using a remote circuit for the prover 2023-10-05 19:13:59 +09:00
Daniel Tehrani
baedc727fb v2.2.0 2023-09-21 14:58:58 +09:00
Daniel Tehrani
eeb704a7d1 feat: allow specifying using the remote circuit 2023-09-21 14:53:35 +09:00
Dan Tehrani
5dae5e1aa4 Update README.md 2023-06-24 00:34:04 +09:00
Daniel Tehrani
3386b30d9b v2.1.4 2023-05-29 12:17:16 +02:00
Daniel Tehrani
19e1ddd4ef Add method verifyProof to Tree 2023-05-29 12:14:23 +02:00
Daniel Tehrani
85fc788204 Remove multi threading config (not doing multi threading at this moment) 2023-05-26 16:01:57 +02:00
Daniel Tehrani
5fa21ec9c3 Commit lock file 2023-05-12 16:17:33 +02:00
Daniel Tehrani
f05b40e7f3 v2.1.3 2023-05-12 13:36:30 +02:00
Daniel Tehrani
adb73907fd Fix WebAssembly instantiation 2023-05-12 13:34:38 +02:00
31 changed files with 1877 additions and 359 deletions

View File

@@ -1,5 +1,5 @@
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals", "-C", "link-arg=--max-memory=4294967296"]
rustflags = ["-C", "link-arg=--max-memory=4294967296"]
[unstable]
build-std = ["panic_abort", "std"]

6
.gitignore vendored
View File

@@ -2,9 +2,6 @@
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
@@ -26,6 +23,7 @@ circom_witness.wtns
*.ptau
build/
dist/
*.r1cs
*.sym
@@ -36,7 +34,7 @@ packages/prover/test_circuit/test_circuit_js/
packages/prover/test_circuit/*.json
wasm_bytes.ts
wasmBytes.ts
**/sage/*.sage.py
packages/lib/src/circuits/

1398
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,9 @@ git clone https://github.com/DanTehrani/circom-secq
cd circom-secq && cargo build --release && cargo install --path circom
```
2. Install dependencies & Build all packages
2. Install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)
4. Install dependencies & Build all packages
```jsx
yarn && yarn build

View File

@@ -16,8 +16,7 @@
"eslint-plugin-react": "7.32.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-security": "1.7.0",
"lerna": "^6.4.0",
"snarkjs": "^0.5.0"
"lerna": "^6.4.0"
},
"workspaces": [
"packages/lib",

View File

@@ -8,7 +8,7 @@
},
"dependencies": {
"@ethereumjs/util": "^8.0.3",
"@personaelabs/spartan-ecdsa": "*"
"@personaelabs/spartan-ecdsa": "file:./../../lib"
},
"devDependencies": {
"ts-node": "^10.9.1",

View File

@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@personaelabs/spartan-ecdsa": "*",
"@personaelabs/spartan-ecdsa": "file:./../../lib",
"@ethereumjs/util": "^8.0.3",
"comlink": "^4.3.1",
"elliptic": "^6.5.4",
@@ -17,8 +17,7 @@
"next": "13.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"readline": "^1.3.0",
"snarkjs": "^0.5.0"
"readline": "^1.3.0"
},
"devDependencies": {
"@types/node": "18.11.7",

View File

@@ -12,7 +12,7 @@ const embedWasmBytes = async () => {
export const wasmBytes = new Uint8Array([${bytes.toString()}]);
`;
fs.writeFileSync("./src/wasm/wasm_bytes.ts", file);
fs.writeFileSync("./src/wasm/wasmBytes.ts", file);
};
embedWasmBytes();

View File

@@ -3,7 +3,10 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
"^.+\\.js?$": "ts-jest"
"^.+\\.(ts|js)?$": "ts-jest"
},
moduleNameMapper: {
"@src/(.*)$": "<rootDir>/src/$1",
},
testTimeout: 600000,
};

View File

@@ -1,17 +1,32 @@
{
"name": "@personaelabs/spartan-ecdsa",
"version": "2.1.2",
"main": "./build/lib.js",
"types": "./build/lib.d.ts",
"version": "2.3.1",
"description": "Spartan-ecdsa (which to our knowledge) is the fastest open-source method to verify ECDSA (secp256k1) signatures in zero-knowledge.",
"keywords": [
"spartan",
"spartan-ecdsa",
"zk",
"efficient-ecdsa"
],
"author": "Personae Labs",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"bugs": {
"url": "https://github.com/personaelabs/spartan-ecdsa/issues/new"
},
"homepage": "https://github.com/personaelabs/spartan-ecdsa",
"publishConfig": {
"access": "public"
},
"files": [
"build/**/*"
"dist/**/*"
],
"scripts": {
"build": "rm -rf ./build && yarn embedWasmBytes && tsc",
"build": "rm -rf ./dist && yarn embedWasmBytes && tsc --project tsconfig.build.json",
"prepublishOnly": "yarn build",
"prepare": "yarn embedWasmBytes",
"embedWasmBytes": "ts-node ./embed_wasm_bytes.ts",
"embedWasmBytes": "ts-node ./embedWasmBytes.ts",
"test": "jest"
},
"devDependencies": {
@@ -25,6 +40,6 @@
"@ethereumjs/util": "^8.0.3",
"@zk-kit/incremental-merkle-tree": "^1.0.0",
"elliptic": "^6.5.4",
"snarkjs": "^0.5.0"
"snarkjs": "^0.7.1"
}
}
}

View File

@@ -1,25 +0,0 @@
import { ProverConfig, VerifyConfig } from "./types";
// Default configs for pubkey membership proving/verifying
export const defaultPubkeyMembershipPConfig: ProverConfig = {
witnessGenWasm:
"https://storage.googleapis.com/personae-proving-keys/membership/pubkey_membership.wasm",
circuit:
"https://storage.googleapis.com/personae-proving-keys/membership/pubkey_membership.circuit"
};
export const defaultPubkeyMembershipVConfig: VerifyConfig = {
circuit: defaultPubkeyMembershipPConfig.circuit
};
// Default configs for address membership proving/verifyign
export const defaultAddressMembershipPConfig: ProverConfig = {
witnessGenWasm:
"https://storage.googleapis.com/personae-proving-keys/membership/addr_membership.wasm",
circuit:
"https://storage.googleapis.com/personae-proving-keys/membership/addr_membership.circuit"
};
export const defaultAddressMembershipVConfig: VerifyConfig = {
circuit: defaultAddressMembershipPConfig.circuit
};

View File

@@ -0,0 +1,25 @@
import { ProverConfig, VerifyConfig } from "@src/types";
// Default configs for pubkey membership proving/verifying
export const defaultPubkeyProverConfig: ProverConfig = {
witnessGenWasm:
"https://storage.googleapis.com/personae-proving-keys/membership/pubkey_membership.wasm",
circuit:
"https://storage.googleapis.com/personae-proving-keys/membership/pubkey_membership.circuit"
};
export const defaultPubkeyVerifierConfig: VerifyConfig = {
circuit: defaultPubkeyProverConfig.circuit
};
// Default configs for address membership proving/verifyign
export const defaultAddressProverConfig: ProverConfig = {
witnessGenWasm:
"https://storage.googleapis.com/personae-proving-keys/membership/addr_membership.wasm",
circuit:
"https://storage.googleapis.com/personae-proving-keys/membership/addr_membership.circuit"
};
export const defaultAddressVerifierConfig: VerifyConfig = {
circuit: defaultAddressProverConfig.circuit
};

View File

@@ -1,16 +1,16 @@
import { Profiler } from "../helpers/profiler";
import { IProver, MerkleProof, NIZK, ProverConfig } from "../types";
import { loadCircuit, fromSig, snarkJsWitnessGen } from "../helpers/utils";
import { Profiler } from "@src/helpers/profiler";
import { IProver, MerkleProof, NIZK, ProveArgs, ProverConfig } from "@src/types";
import { loadCircuit, fromSig, snarkJsWitnessGen } from "@src/helpers/utils";
import {
PublicInput,
computeEffEcdsaPubInput,
CircuitPubInput
} from "../helpers/public_input";
import wasm, { init } from "../wasm";
} from "@src/helpers/publicInputs";
import { init, wasm } from "@src/wasm";
import {
defaultPubkeyMembershipPConfig,
defaultAddressMembershipPConfig
} from "../config";
defaultPubkeyProverConfig,
defaultAddressProverConfig
} from "@src/config";
/**
* ECDSA Membership Prover
@@ -18,16 +18,22 @@ import {
export class MembershipProver extends Profiler implements IProver {
circuit: string;
witnessGenWasm: string;
useRemoteCircuit: boolean;
constructor(options: ProverConfig) {
super({ enabled: options?.enableProfiler });
constructor({
enableProfiler,
circuit,
witnessGenWasm,
useRemoteCircuit
}: ProverConfig) {
super({ enabled: enableProfiler });
if (
options.circuit === defaultPubkeyMembershipPConfig.circuit ||
options.witnessGenWasm ===
defaultPubkeyMembershipPConfig.witnessGenWasm ||
options.circuit === defaultAddressMembershipPConfig.circuit ||
options.witnessGenWasm === defaultAddressMembershipPConfig.witnessGenWasm
circuit === defaultPubkeyProverConfig.circuit ||
witnessGenWasm ===
defaultPubkeyProverConfig.witnessGenWasm ||
circuit === defaultAddressProverConfig.circuit ||
witnessGenWasm === defaultAddressProverConfig.witnessGenWasm
) {
console.warn(`
Spartan-ecdsa default config warning:
@@ -37,33 +43,16 @@ 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.circuit = circuit;
this.witnessGenWasm = witnessGenWasm;
this.useRemoteCircuit = useRemoteCircuit ?? false;
}
async initWasm() {
await init();
}
// @ts-ignore
async prove(
sig: string,
msgHash: Buffer,
merkleProof: MerkleProof
): Promise<NIZK> {
async prove({ sig, msgHash, merkleProof }: ProveArgs): Promise<NIZK> {
const { r, s, v } = fromSig(sig);
const effEcdsaPubInput = computeEffEcdsaPubInput(r, v, msgHash);
@@ -90,7 +79,9 @@ export class MembershipProver extends Profiler implements IProver {
this.timeEnd("Generate witness");
this.time("Load circuit");
const circuitBin = await loadCircuit(this.circuit);
const useRemoteCircuit =
this.useRemoteCircuit || typeof window !== "undefined";
const circuitBin = await loadCircuit(this.circuit, useRemoteCircuit);
this.timeEnd("Load circuit");
// Get the public input in bytes

View File

@@ -1,25 +1,30 @@
import {
defaultAddressMembershipVConfig,
defaultPubkeyMembershipVConfig
} from "../config";
import { Profiler } from "../helpers/profiler";
import { loadCircuit } from "../helpers/utils";
import { IVerifier, VerifyConfig } from "../types";
import wasm, { init } from "../wasm";
import { PublicInput, verifyEffEcdsaPubInput } from "../helpers/public_input";
defaultAddressVerifierConfig,
defaultPubkeyVerifierConfig
} from "@src/config";
import { Profiler } from "@src/helpers/profiler";
import { loadCircuit } from "@src/helpers/utils";
import { IVerifier, VerifyArgs, VerifyConfig } from "@src/types";
import { init, wasm } from "@src/wasm";
import { PublicInput, verifyEffEcdsaPubInput } from "@src/helpers/publicInputs";
/**
* ECDSA Membership Verifier
*/
export class MembershipVerifier extends Profiler implements IVerifier {
circuit: string;
useRemoteCircuit: boolean;
constructor(options: VerifyConfig) {
super({ enabled: options?.enableProfiler });
constructor({
circuit,
enableProfiler,
useRemoteCircuit
}: VerifyConfig) {
super({ enabled: enableProfiler });
if (
options.circuit === defaultAddressMembershipVConfig.circuit ||
options.circuit === defaultPubkeyMembershipVConfig.circuit
circuit === defaultAddressVerifierConfig.circuit ||
circuit === defaultPubkeyVerifierConfig.circuit
) {
console.warn(`
Spartan-ecdsa default config warning:
@@ -29,19 +34,18 @@ export class MembershipVerifier extends Profiler implements IVerifier {
`);
}
this.circuit = options.circuit;
this.circuit = circuit;
this.useRemoteCircuit =
useRemoteCircuit || typeof window !== "undefined";
}
async initWasm() {
await init();
}
async verify(
proof: Uint8Array,
publicInputSer: Uint8Array
): Promise<boolean> {
async verify({ proof, publicInputSer }: VerifyArgs): Promise<boolean> {
this.time("Load circuit");
const circuitBin = await loadCircuit(this.circuit);
const circuitBin = await loadCircuit(this.circuit, this.useRemoteCircuit);
this.timeEnd("Load circuit");
this.time("Verify public input");

View File

@@ -1,5 +1,5 @@
import { init, wasm } from "@src/wasm";
import { bigIntToLeBytes, bytesLeToBigInt } from "./utils";
import wasm, { init } from "../wasm";
export class Poseidon {
hash(inputs: bigint[]): bigint {

View File

@@ -1,8 +1,8 @@
var EC = require("elliptic").ec;
const BN = require("bn.js");
import { EffECDSAPubInput } from "@src/types";
import { bytesToBigInt, bigIntToBytes } from "./utils";
import { EffECDSAPubInput } from "../types";
const ec = new EC("secp256k1");
@@ -144,15 +144,18 @@ export const computeEffEcdsaPubInput = (
/**
* Verify the public values of the efficient ECDSA circuit
*/
export const verifyEffEcdsaPubInput = (pubInput: PublicInput): boolean => {
export const verifyEffEcdsaPubInput = ({
r,
rV,
msgHash,
circuitPubInput
}: PublicInput): boolean => {
const expectedCircuitInput = computeEffEcdsaPubInput(
pubInput.r,
pubInput.rV,
pubInput.msgHash
r,
rV,
msgHash
);
const circuitPubInput = pubInput.circuitPubInput;
const isValid =
expectedCircuitInput.Tx === circuitPubInput.Tx &&
expectedCircuitInput.Ty === circuitPubInput.Ty &&

View File

@@ -1,7 +1,6 @@
import { IncrementalMerkleTree } from "@zk-kit/incremental-merkle-tree";
import { Poseidon } from "./poseidon";
import { MerkleProof } from "../types";
import { bytesToBigInt } from "./utils";
export class Tree {
depth: number;
@@ -38,17 +37,14 @@ export class Tree {
createProof(index: number): MerkleProof {
const proof = this.treeInner.createProof(index);
const siblings = proof.siblings.map(s =>
typeof s[0] === "bigint" ? s : bytesToBigInt(s[0])
);
return {
siblings,
siblings: proof.siblings,
pathIndices: proof.pathIndices,
root: proof.root
};
}
// TODO: Add more functions that expose the IncrementalMerkleTree API
verifyProof(proof: MerkleProof, leaf: bigint): boolean {
return this.treeInner.verifyProof({ ...proof, leaf });
}
}

View File

@@ -18,9 +18,11 @@ export const snarkJsWitnessGen = async (input: any, wasmFile: string) => {
/**
* Load a circuit from a file or URL
*/
export const loadCircuit = async (pathOrUrl: string): Promise<Uint8Array> => {
const isWeb = typeof window !== "undefined";
if (isWeb) {
export const loadCircuit = async (
pathOrUrl: string,
useRemoteCircuit: boolean
): Promise<Uint8Array> => {
if (useRemoteCircuit) {
return await fetchCircuit(pathOrUrl);
} else {
return await readCircuitFromFs(pathOrUrl);

View File

@@ -0,0 +1,8 @@
export { MembershipProver } from "@src/core/prover";
export { MembershipVerifier } from "@src/core/verifier";
export { CircuitPubInput, PublicInput, computeEffEcdsaPubInput, verifyEffEcdsaPubInput } from "@src/helpers/publicInputs";
export { Tree } from "@src/helpers/tree";
export { Poseidon } from "@src/helpers/poseidon";
export { init, wasm } from "@src/wasm/index";
export { defaultPubkeyProverConfig as defaultPubkeyMembershipPConfig, defaultPubkeyVerifierConfig as defaultPubkeyMembershipVConfig, defaultAddressProverConfig as defaultAddressMembershipPConfig, defaultAddressVerifierConfig as defaultAddressMembershipVConfig } from "@src/config";
export type { MerkleProof, EffECDSAPubInput, NIZK, ProverConfig, VerifyConfig, IProver, IVerifier } from "@src/types";

View File

@@ -1,8 +0,0 @@
export * from "./types";
export * from "./helpers/public_input";
export * from "./core/membership_prover";
export * from "./core/membership_verifier";
export * from "./helpers/tree";
export * from "./helpers/poseidon";
export * from "./wasm/index";
export * from "./config";

View File

@@ -1,45 +0,0 @@
import { PublicInput } from "./helpers/public_input";
// The same structure as MerkleProof in @zk-kit/incremental-merkle-tree.
// Not directly using MerkleProof defined in @zk-kit/incremental-merkle-tree so
// library users can choose whatever merkle tree management method they want.
export interface MerkleProof {
root: bigint;
siblings: bigint[];
pathIndices: number[];
}
export interface EffECDSAPubInput {
Tx: bigint;
Ty: bigint;
Ux: bigint;
Uy: bigint;
}
export interface NIZK {
proof: Uint8Array;
publicInput: PublicInput;
}
export interface ProverConfig {
witnessGenWasm: string;
circuit: string;
enableProfiler?: boolean;
}
export interface VerifyConfig {
circuit: string; // Path to circuit file compiled by Nova-Scotia
enableProfiler?: boolean;
}
export interface IProver {
circuit: string; // Path to circuit file compiled by Nova-Scotia
witnessGenWasm: string; // Path to witness generator wasm file generated by Circom
prove(...args: any): Promise<NIZK>;
}
export interface IVerifier {
circuit: string; // Path to circuit file compiled by Nova-Scotia
verify(proof: Uint8Array, publicInput: Uint8Array): Promise<boolean>;
}

View File

@@ -0,0 +1,58 @@
import { PublicInput } from "@src/helpers/publicInputs";
// The same structure as MerkleProof in @zk-kit/incremental-merkle-tree.
// Not directly using MerkleProof defined in @zk-kit/incremental-merkle-tree so
// library users can choose whatever merkle tree management method they want.
export interface MerkleProof {
root: bigint;
siblings: [bigint][];
pathIndices: number[];
}
export interface EffECDSAPubInput {
Tx: bigint;
Ty: bigint;
Ux: bigint;
Uy: bigint;
}
export interface NIZK {
proof: Uint8Array;
publicInput: PublicInput;
}
export interface ProverConfig {
witnessGenWasm: string;
circuit: string;
enableProfiler?: boolean;
useRemoteCircuit?: boolean;
}
export interface ProveArgs {
sig: string;
msgHash: Buffer,
merkleProof: MerkleProof;
}
export interface VerifyArgs {
proof: Uint8Array,
publicInputSer: Uint8Array
}
export interface VerifyConfig {
circuit: string; // Path to circuit file compiled by Nova-Scotia
enableProfiler?: boolean;
useRemoteCircuit?: boolean;
}
export interface IProver {
circuit: string; // Path to circuit file compiled by Nova-Scotia
witnessGenWasm: string; // Path to witness generator wasm file generated by Circom
prove({ sig, msgHash, merkleProof }: ProveArgs): Promise<NIZK>;
}
export interface IVerifier {
circuit: string; // Path to circuit file compiled by Nova-Scotia
verify({ proof, publicInputSer }: VerifyArgs): Promise<boolean>;
}

View File

@@ -1,10 +1,10 @@
import * as wasm from "./wasm";
import { wasmBytes } from "./wasm_bytes";
import { wasmBytes } from "./wasmBytes";
export const init = async () => {
await wasm.initSync(wasmBytes.buffer);
wasm.init_panic_hook();
};
export default wasm;
export { wasm };

View File

@@ -1,99 +1,60 @@
/* tslint:disable */
/* eslint-disable */
/**
*/
*/
export function init_panic_hook(): void;
/**
* @param {Uint8Array} circuit
* @param {Uint8Array} vars
* @param {Uint8Array} public_inputs
* @returns {Uint8Array}
*/
export function prove(
circuit: Uint8Array,
vars: Uint8Array,
public_inputs: Uint8Array
): Uint8Array;
* @param {Uint8Array} circuit
* @param {Uint8Array} vars
* @param {Uint8Array} public_inputs
* @returns {Uint8Array}
*/
export function prove(circuit: Uint8Array, vars: Uint8Array, public_inputs: Uint8Array): Uint8Array;
/**
* @param {Uint8Array} circuit
* @param {Uint8Array} proof
* @param {Uint8Array} public_input
* @returns {boolean}
*/
export function verify(
circuit: Uint8Array,
proof: Uint8Array,
public_input: Uint8Array
): boolean;
* @param {Uint8Array} circuit
* @param {Uint8Array} proof
* @param {Uint8Array} public_input
* @returns {boolean}
*/
export function verify(circuit: Uint8Array, proof: Uint8Array, public_input: Uint8Array): boolean;
/**
* @param {Uint8Array} input_bytes
* @returns {Uint8Array}
*/
* @param {Uint8Array} input_bytes
* @returns {Uint8Array}
*/
export function poseidon(input_bytes: Uint8Array): Uint8Array;
export type InitInput =
| RequestInfo
| URL
| Response
| BufferSource
| WebAssembly.Module;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly prove: (
a: number,
b: number,
c: number,
d: number,
e: number,
f: number,
g: number
) => void;
readonly verify: (
a: number,
b: number,
c: number,
d: number,
e: number,
f: number,
g: number
) => void;
readonly memory: WebAssembly.Memory;
readonly prove: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
readonly poseidon: (a: number, b: number, c: number) => void;
readonly init_panic_hook: () => void;
readonly memory: WebAssembly.Memory;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_thread_destroy: (a: number, b: number) => void;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
* @param {WebAssembly.Memory} maybe_memory
*
* @returns {InitOutput}
*/
export function initSync(
module: SyncInitInput,
maybe_memory?: WebAssembly.Memory
): InitOutput;
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
* @param {WebAssembly.Memory} maybe_memory
*
* @returns {Promise<InitOutput>}
*/
export default function init(
module_or_path?: InitInput | Promise<InitInput>,
maybe_memory?: WebAssembly.Memory
): Promise<InitOutput>;
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
* @param {WebAssembly.Memory} maybe_memory
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput>;

View File

@@ -20,21 +20,22 @@ function takeObject(idx) {
return ret;
}
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
cachedTextDecoder.decode();
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
let cachedUint8Memory0 = null;
function getUint8Memory0() {
if (cachedUint8Memory0 === null || cachedUint8Memory0.buffer !== wasm.memory.buffer) {
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8Memory0;
}
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
function addHeapObject(obj) {
@@ -54,7 +55,7 @@ export function init_panic_hook() {
let WASM_VECTOR_LEN = 0;
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
const ptr = malloc(arg.length * 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
@@ -63,13 +64,14 @@ function passArray8ToWasm0(arg, malloc) {
let cachedInt32Memory0 = null;
function getInt32Memory0() {
if (cachedInt32Memory0 === null || cachedInt32Memory0.buffer !== wasm.memory.buffer) {
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
@@ -95,9 +97,9 @@ export function prove(circuit, vars, public_inputs) {
if (r3) {
throw takeObject(r2);
}
var v3 = getArrayU8FromWasm0(r0, r1).slice();
var v4 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v3;
return v4;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
@@ -148,9 +150,9 @@ export function poseidon(input_bytes) {
if (r3) {
throw takeObject(r2);
}
var v1 = getArrayU8FromWasm0(r0, r1).slice();
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v1;
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
@@ -164,29 +166,33 @@ function handleError(f, args) {
}
}
const cachedTextEncoder = new TextEncoder('utf-8');
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
const encodeString = function (arg, view) {
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
};
});
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length);
const ptr = malloc(buf.length) >>> 0;
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len);
let ptr = malloc(len) >>> 0;
const mem = getUint8Memory0();
@@ -202,7 +208,7 @@ function passStringToWasm0(arg, malloc, realloc) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3);
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
@@ -213,7 +219,7 @@ function passStringToWasm0(arg, malloc, realloc) {
return ptr;
}
async function load(module, imports) {
async function __wbg_load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
@@ -244,18 +250,9 @@ async function load(module, imports) {
}
}
function getImports() {
function __wbg_get_imports() {
const imports = {};
imports.wbg = {};
imports.wbg.__wbg_getRandomValues_3774744e221a22ad = function() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
imports.wbg.__wbg_randomFillSync_e950366c42764a07 = function() { return handleError(function (arg0, arg1) {
getObject(arg0).randomFillSync(takeObject(arg1));
}, arguments) };
imports.wbg.__wbg_crypto_70a96de3b6b73dac = function(arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
@@ -281,6 +278,9 @@ function getImports() {
const ret = typeof(getObject(arg0)) === 'string';
return ret;
};
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
imports.wbg.__wbg_msCrypto_adbc770ec9eca9c7 = function(arg0) {
const ret = getObject(arg0).msCrypto;
return addHeapObject(ret);
@@ -297,11 +297,17 @@ function getImports() {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
imports.wbg.__wbg_getRandomValues_3774744e221a22ad = function() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };
imports.wbg.__wbg_randomFillSync_e950366c42764a07 = function() { return handleError(function (arg0, arg1) {
getObject(arg0).randomFillSync(takeObject(arg1));
}, arguments) };
imports.wbg.__wbg_newnoargs_e643855c6572a4a8 = function(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_call_95d1ea488d03e4e8 = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_call_f96b398515635514 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
@@ -309,19 +315,19 @@ function getImports() {
const ret = getObject(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbg_self_e7c1f827057f6584 = function() { return handleError(function () {
imports.wbg.__wbg_self_b9aad7f1c618bfaf = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_window_a09ec664e14b1b81 = function() { return handleError(function () {
imports.wbg.__wbg_window_55e469842c98b086 = function() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_globalThis_87cbb8506fecf3a9 = function() { return handleError(function () {
imports.wbg.__wbg_globalThis_d0957e302752547e = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_global_c85a9259e621f3db = function() { return handleError(function () {
imports.wbg.__wbg_global_ae2f87312b8987fb = function() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
@@ -329,30 +335,30 @@ function getImports() {
const ret = getObject(arg0) === undefined;
return ret;
};
imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_call_35782e9a1aa5e091 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_buffer_cf65c07de34b9a08 = function(arg0) {
imports.wbg.__wbg_buffer_fcbfb6d88b2732e9 = function(arg0) {
const ret = getObject(arg0).buffer;
return addHeapObject(ret);
};
imports.wbg.__wbg_newwithbyteoffsetandlength_9fb2f11355ecadf5 = function(arg0, arg1, arg2) {
imports.wbg.__wbg_newwithbyteoffsetandlength_92c251989c485785 = function(arg0, arg1, arg2) {
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
};
imports.wbg.__wbg_new_537b7341ce90bb31 = function(arg0) {
imports.wbg.__wbg_new_bc5d9aad3f9ac80e = function(arg0) {
const ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_set_17499e8aa4003ebd = function(arg0, arg1, arg2) {
imports.wbg.__wbg_set_4b3aa8445ac1e91c = function(arg0, arg1, arg2) {
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
};
imports.wbg.__wbg_newwithlength_b56c882b57805732 = function(arg0) {
imports.wbg.__wbg_newwithlength_89eca18f2603a999 = function(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return addHeapObject(ret);
};
imports.wbg.__wbg_subarray_7526649b91a252a6 = function(arg0, arg1, arg2) {
imports.wbg.__wbg_subarray_7649d027b2b141b3 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
};
@@ -362,16 +368,20 @@ function getImports() {
};
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
const ret = getObject(arg1).stack;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len1;
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
};
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(arg0, arg1);
wasm.__wbindgen_free(deferred0_0, deferred0_1);
}
};
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
@@ -385,52 +395,60 @@ function getImports() {
return imports;
}
function initMemory(imports, maybe_memory) {
imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:18,maximum:65536,shared:true});
function __wbg_init_memory(imports, maybe_memory) {
}
function finalizeInit(instance, module) {
function __wbg_finalize_init(instance, module) {
wasm = instance.exports;
init.__wbindgen_wasm_module = module;
__wbg_init.__wbindgen_wasm_module = module;
cachedInt32Memory0 = null;
cachedUint8Memory0 = null;
wasm.__wbindgen_start();
return wasm;
}
function initSync(module, maybe_memory) {
const imports = getImports();
async function initSync(module, maybe_memory) {
if (wasm !== undefined) return wasm;
initMemory(imports, maybe_memory);
const imports = __wbg_get_imports();
__wbg_init_memory(imports, maybe_memory);
/*
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
*/
const compiled = WebAssembly.compile(module);
const instance = new WebAssembly.Instance(module, imports);
const instance = await WebAssembly.instantiate(await compiled, imports);
return finalizeInit(instance, module);
return __wbg_finalize_init(instance, module);
}
async function init(input, maybe_memory) {
async function __wbg_init(input, maybe_memory) {
if (wasm !== undefined) return wasm;
/*
if (typeof input === 'undefined') {
input = new URL('spartan_wasm_bg.wasm', import.meta.url);
}
*/
const imports = getImports();
const imports = __wbg_get_imports();
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
input = fetch(input);
}
initMemory(imports, maybe_memory);
__wbg_init_memory(imports, maybe_memory);
const { instance, module } = await load(await input, imports);
const { instance, module } = await __wbg_load(await input, imports);
return finalizeInit(instance, module);
return __wbg_finalize_init(instance, module);
}
export { initSync }
export default init;
export default __wbg_init;

View File

@@ -1,9 +1,10 @@
import { hashPersonalMessage } from "@ethereumjs/util";
import {
CircuitPubInput,
PublicInput,
verifyEffEcdsaPubInput
} from "../src/helpers/public_input";
import { hashPersonalMessage } from "@ethereumjs/util";
} from "../src/helpers/publicInputs";
describe("public_input", () => {
/**

View File

@@ -1,19 +1,20 @@
import {
MembershipProver,
MembershipVerifier,
Tree,
Poseidon,
NIZK
} from "../src/lib";
import {
hashPersonalMessage,
ecsign,
privateToAddress,
privateToPublic
} from "@ethereumjs/util";
var EC = require("elliptic").ec;
import * as path from "path";
import {
MembershipProver,
MembershipVerifier,
Tree,
Poseidon,
NIZK
} from "../src";
describe("membership prove and verify", () => {
// Init prover
const treeDepth = 20;
@@ -25,7 +26,6 @@ describe("membership prove and verify", () => {
// Sign (Use privKeys[0] for proving)
const proverIndex = 0;
const proverPrivKey = privKeys[proverIndex];
let proverAddress: bigint;
let msg = Buffer.from("harry potter");
const msgHash = hashPersonalMessage(msg);
@@ -84,11 +84,14 @@ describe("membership prove and verify", () => {
const index = pubKeyTree.indexOf(proverPubKeyHash as bigint);
const merkleProof = pubKeyTree.createProof(index);
nizk = await pubKeyMembershipProver.prove(sig, msgHash, merkleProof);
nizk = await pubKeyMembershipProver.prove({ sig, msgHash, merkleProof });
const { proof, publicInput } = nizk;
expect(
await pubKeyMembershipVerifier.verify(proof, publicInput.serialize())
await pubKeyMembershipVerifier.verify({
proof,
publicInputSer: publicInput.serialize()
})
).toBe(true);
});
@@ -97,17 +100,23 @@ describe("membership prove and verify", () => {
let proof = nizk.proof;
proof[0] = proof[0] += 1;
expect(
await pubKeyMembershipVerifier.verify(proof, publicInput.serialize())
await pubKeyMembershipVerifier.verify({
proof,
publicInputSer: publicInput.serialize()
})
).toBe(false);
});
it("should assert invalid public input", async () => {
const { proof } = nizk;
let publicInput = nizk.publicInput.serialize();
publicInput[0] = publicInput[0] += 1;
expect(await pubKeyMembershipVerifier.verify(proof, publicInput)).toBe(
false
);
let publicInputSer = nizk.publicInput.serialize();
publicInputSer[0] = publicInputSer[0] += 1;
expect(
await pubKeyMembershipVerifier.verify({
proof,
publicInputSer
})
).toBe(false);
});
});
@@ -154,14 +163,14 @@ describe("membership prove and verify", () => {
await addressMembershipProver.initWasm();
nizk = await addressMembershipProver.prove(sig, msgHash, merkleProof);
nizk = await addressMembershipProver.prove({ sig, msgHash, merkleProof });
await addressMembershipVerifier.initWasm();
expect(
await addressMembershipVerifier.verify(
nizk.proof,
nizk.publicInput.serialize()
)
await addressMembershipVerifier.verify({
proof: nizk.proof,
publicInputSer: nizk.publicInput.serialize()
})
).toBe(true);
});
@@ -170,17 +179,23 @@ describe("membership prove and verify", () => {
let proof = nizk.proof;
proof[0] = proof[0] += 1;
expect(
await addressMembershipVerifier.verify(proof, publicInput.serialize())
await addressMembershipVerifier.verify({
proof,
publicInputSer: publicInput.serialize()
})
).toBe(false);
});
it("should assert invalid public input", async () => {
const { proof } = nizk;
let publicInput = nizk.publicInput.serialize();
publicInput[0] = publicInput[0] += 1;
expect(await addressMembershipVerifier.verify(proof, publicInput)).toBe(
false
);
let publicInputSer = nizk.publicInput.serialize();
publicInputSer[0] = publicInputSer[0] += 1;
expect(
await addressMembershipVerifier.verify({
proof,
publicInputSer
})
).toBe(false);
});
});
});

View File

@@ -0,0 +1,31 @@
import { Tree, Poseidon } from "../src";
describe("Merkle tree prove and verify", () => {
let poseidon: Poseidon;
let tree: Tree;
const members = new Array(10).fill(0).map((_, i) => BigInt(i));
beforeAll(async () => {
// Init Poseidon
poseidon = new Poseidon();
await poseidon.initWasm();
const treeDepth = 20;
tree = new Tree(treeDepth, poseidon);
for (const member of members) {
tree.insert(member);
}
});
it("should prove and verify a valid Merkle proof", async () => {
const proof = tree.createProof(0);
expect(tree.verifyProof(proof, members[0])).toBe(true);
});
it("should assert an invalid Merkle proof", async () => {
const proof = tree.createProof(0);
proof.siblings[0][0] = proof.siblings[0][0] += BigInt(1);
expect(tree.verifyProof(proof, members[0])).toBe(false);
proof.siblings[0][0] = proof.siblings[0][0] -= BigInt(1);
});
});

View File

@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"exclude": [
"./tests/**/*"
],
}

View File

@@ -1,25 +1,31 @@
{
"compilerOptions": {
"baseUrl": ".",
"rootDir": ".",
"outDir": "./dist",
"declaration": true,
"target": "ES6",
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"paths": {
"@src/*": [
"src/*"
]
},
},
"include": [
"./src/**/*",
"./src/**/*.wasm",
"./tests/**/*"
],
"exclude": [
"./jest.config.js",
"./node_modules",
"./tests",
"./build"
"./dist"
],
"compilerOptions": {
"declaration": true,
"target": "ES6",
"module": "CommonJS",
"rootDir": "./src",
"moduleResolution": "node",
"allowJs": true,
"outDir": "./build",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}

View File

@@ -2057,6 +2057,14 @@
node-addon-api "^3.2.1"
node-gyp-build "^4.3.0"
"@personaelabs/spartan-ecdsa@file:./packages/lib":
version "2.3.0"
dependencies:
"@ethereumjs/util" "^8.0.3"
"@zk-kit/incremental-merkle-tree" "^1.0.0"
elliptic "^6.5.4"
snarkjs "^0.7.1"
"@phenomnomnominal/tsquery@4.1.1":
version "4.1.1"
resolved "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-4.1.1.tgz"
@@ -3136,6 +3144,13 @@ circom_runtime@0.1.21:
dependencies:
ffjavascript "0.2.56"
circom_runtime@0.1.24:
version "0.1.24"
resolved "https://registry.yarnpkg.com/circom_runtime/-/circom_runtime-0.1.24.tgz#60ca8a31c3675802fbab5a0bcdeb02556e510733"
integrity sha512-H7/7I2J/cBmRnZm9docOCGhfxzS61BEm4TMCWcrZGsWNBQhePNfQq88Oj2XpUfzmBTCd8pRvRb3Mvazt3TMrJw==
dependencies:
ffjavascript "0.2.60"
circom_tester@^0.0.19:
version "0.0.19"
resolved "https://registry.npmjs.org/circom_tester/-/circom_tester-0.0.19.tgz"
@@ -4300,6 +4315,15 @@ ffjavascript@0.2.56:
wasmcurves "0.2.0"
web-worker "^1.2.0"
ffjavascript@0.2.60:
version "0.2.60"
resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.60.tgz#4d8ae613d6bf4e98b3cc29ba10c626f5853854cf"
integrity sha512-T/9bnEL5xAZRDbQoEMf+pM9nrhK+C3JyZNmqiWub26EQorW7Jt+jR54gpqDhceA4Nj0YctPQwYnl8xa52/A26A==
dependencies:
wasmbuilder "0.0.16"
wasmcurves "0.2.2"
web-worker "^1.2.0"
ffjavascript@^0.2.45, ffjavascript@^0.2.48, ffjavascript@^0.2.56, ffjavascript@^0.2.57:
version "0.2.57"
resolved "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.57.tgz"
@@ -7070,6 +7094,16 @@ r1csfile@0.0.41, r1csfile@^0.0.41:
fastfile "0.0.20"
ffjavascript "0.2.56"
r1csfile@0.0.47:
version "0.0.47"
resolved "https://registry.yarnpkg.com/r1csfile/-/r1csfile-0.0.47.tgz#ed95a0dc8e910e9c070253906f7a31bd8c5333c8"
integrity sha512-oI4mAwuh1WwuFg95eJDNDDL8hCaZkwnPuNZrQdLBWvDoRU7EG+L/MOHL7SwPW2Y+ZuYcTLpj3rBkgllBQZN/JA==
dependencies:
"@iden3/bigarray" "0.0.2"
"@iden3/binfileutils" "0.0.11"
fastfile "0.0.20"
ffjavascript "0.2.60"
react-dom@18.2.0:
version "18.2.0"
resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz"
@@ -7446,7 +7480,7 @@ smart-buffer@^4.2.0:
resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz"
integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==
snarkjs@0.5.0, snarkjs@^0.5.0:
snarkjs@0.5.0:
version "0.5.0"
resolved "https://registry.npmjs.org/snarkjs/-/snarkjs-0.5.0.tgz"
integrity sha512-KWz8mZ2Y+6wvn6GGkQo6/ZlKwETdAGohd40Lzpwp5TUZCn6N6O4Az1SuX1rw/qREGL6Im+ycb19suCFE8/xaKA==
@@ -7462,6 +7496,22 @@ snarkjs@0.5.0, snarkjs@^0.5.0:
logplease "^1.2.15"
r1csfile "0.0.41"
snarkjs@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/snarkjs/-/snarkjs-0.7.1.tgz#c96ecaf4db8c2eb44d60b17ee02f37ed39c821bb"
integrity sha512-Qs1oxssa135WZkzfARgEp5SuKHKvKNtcspeJbE5je6MurUpBylD1rzcAzQSTGWA/EH/BV/TmUyTaTD64xScvbA==
dependencies:
"@iden3/binfileutils" "0.0.11"
bfj "^7.0.2"
blake2b-wasm "^2.4.0"
circom_runtime "0.1.24"
ejs "^3.1.6"
fastfile "0.0.20"
ffjavascript "0.2.60"
js-sha3 "^0.8.0"
logplease "^1.2.15"
r1csfile "0.0.47"
socks-proxy-agent@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz"
@@ -8133,6 +8183,13 @@ wasmcurves@0.2.0:
dependencies:
wasmbuilder "0.0.16"
wasmcurves@0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/wasmcurves/-/wasmcurves-0.2.2.tgz#ca444f6a6f6e2a5cbe6629d98ff478a62b4ccb2b"
integrity sha512-JRY908NkmKjFl4ytnTu5ED6AwPD+8VJ9oc94kdq7h5bIwbj0L4TDJ69mG+2aLs2SoCmGfqIesMWTEJjtYsoQXQ==
dependencies:
wasmbuilder "0.0.16"
wcwidth@^1.0.0, wcwidth@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz"