lambdaworks-groth16-ts
Version:
TypeScript bindings for LambdaWorks Groth16 SNARK prover
112 lines (107 loc) • 5.36 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
export function start(): void;
export class CircuitProcessor {
free(): void;
constructor();
compute_witness(circuit_params: any, inputs_json: string): any;
validate_witness(_circuit_params: any, _witness: any): boolean;
}
export class FieldOperations {
free(): void;
constructor();
from_hex(hex_string: string): string;
add(a: string, b: string): string;
multiply(a: string, b: string): string;
equals(a: string, b: string): boolean;
}
export class Groth16Prover {
free(): void;
constructor();
prove(_circuit_params: any, proving_key: any, witness: any): any;
prove_with_inputs(circuit_params: any, proving_key: any, inputs_json: string): any;
export_proof(proof: any, format: string): string;
}
export class Groth16Verifier {
free(): void;
constructor();
verify(verifying_key: any, public_inputs: any, proof: any): boolean;
}
export class LambdaWorksGroth16WASM {
free(): void;
constructor();
get_version(): string;
get_field_ops(): FieldOperations;
get_circuit_processor(): CircuitProcessor;
get_setup_manager(): TrustedSetupManager;
get_prover(): Groth16Prover;
get_verifier(): Groth16Verifier;
}
export class TrustedSetupManager {
free(): void;
constructor();
generate_unsafe_setup(circuit_params: any): any;
export_verifying_key(vk_js: any): string;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly start: () => void;
readonly trustedsetupmanager_generate_unsafe_setup: (a: number, b: any) => [number, number, number];
readonly trustedsetupmanager_export_verifying_key: (a: number, b: any) => [number, number, number, number];
readonly __wbg_circuitprocessor_free: (a: number, b: number) => void;
readonly circuitprocessor_new: () => number;
readonly circuitprocessor_compute_witness: (a: number, b: any, c: number, d: number) => [number, number, number];
readonly circuitprocessor_validate_witness: (a: number, b: any, c: any) => number;
readonly fieldoperations_from_hex: (a: number, b: number, c: number) => [number, number];
readonly fieldoperations_add: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
readonly fieldoperations_multiply: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
readonly fieldoperations_equals: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
readonly groth16prover_prove: (a: number, b: any, c: any, d: any) => [number, number, number];
readonly groth16prover_prove_with_inputs: (a: number, b: any, c: any, d: number, e: number) => [number, number, number];
readonly groth16prover_export_proof: (a: number, b: any, c: number, d: number) => [number, number, number, number];
readonly groth16verifier_verify: (a: number, b: any, c: any, d: any) => [number, number, number];
readonly lambdaworksgroth16wasm_get_version: (a: number) => [number, number];
readonly lambdaworksgroth16wasm_get_circuit_processor: (a: number) => number;
readonly lambdaworksgroth16wasm_get_field_ops: (a: number) => number;
readonly lambdaworksgroth16wasm_get_setup_manager: (a: number) => number;
readonly lambdaworksgroth16wasm_get_prover: (a: number) => number;
readonly lambdaworksgroth16wasm_get_verifier: (a: number) => number;
readonly trustedsetupmanager_new: () => number;
readonly fieldoperations_new: () => number;
readonly groth16prover_new: () => number;
readonly groth16verifier_new: () => number;
readonly lambdaworksgroth16wasm_new: () => number;
readonly __wbg_groth16verifier_free: (a: number, b: number) => void;
readonly __wbg_trustedsetupmanager_free: (a: number, b: number) => void;
readonly __wbg_fieldoperations_free: (a: number, b: number) => void;
readonly __wbg_lambdaworksgroth16wasm_free: (a: number, b: number) => void;
readonly __wbg_groth16prover_free: (a: number, b: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __externref_table_alloc: () => number;
readonly __wbindgen_export_4: WebAssembly.Table;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __externref_table_dealloc: (a: 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 {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;