Skip to content

@lelantos-org/sdk / prover / WasmProver

Class: WasmProver ​

Defined in: @lelantos-org/sdk/dist/prover/wasm-prover.d.ts:4

Pluggable Groth16 prover.

Implements ​

Methods ​

build() ​

ts
static build(artifacts, opts?): Promise<WasmProver>;

Defined in: @lelantos-org/sdk/dist/prover/wasm-prover.d.ts:16

Build a prover over artifacts, or return the cached or in-flight one.

opts reaches the artifact fetch, so a caller can observe or abort the zkey download. It applies only to the call that starts the build: a later caller for the same artifacts joins the existing promise, and neither its progress callback nor its signal takes effect.

Parameters ​

ParameterType
artifactsProverArtifacts
opts?LoadArtifactOpts

Returns ​

Promise<WasmProver>


preload() ​

ts
static preload(artifacts?, opts?): Promise<void>;

Defined in: @lelantos-org/sdk/dist/prover/wasm-prover.d.ts:22

Warm the wasm module to avoid first-prove latency. With artifacts, also fetches + parses them (full build, cached).

Parameters ​

ParameterType
artifacts?ProverArtifacts
opts?LoadArtifactOpts

Returns ​

Promise<void>


prove() ​

ts
prove(input): Promise<ProveResult>;

Defined in: @lelantos-org/sdk/dist/prover/wasm-prover.d.ts:41

Prove a witness against the configured circuit.

Parameters ​

ParameterType
inputRecord<string, unknown>

Returns ​

Promise<ProveResult>

Implementation of ​

Prover.prove


shutdown() ​

ts
static shutdown(): Promise<void>;

Defined in: @lelantos-org/sdk/dist/prover/wasm-prover.d.ts:40

Terminate the rayon worker pool and drop every cached prover.

Not required for process exit (the workers are unref'd); provides a deterministic teardown point for long-lived hosts and test suites.

Irreversible once a thread pool has started. rayon's global pool is initialised once per wasm module instance, and a re-import returns the same instance with the terminated pool still registered. A second initThreadPool throws, yet the module still dispatches into the terminated pool, so session.prove would block indefinitely. Later build() and preload() calls therefore throw; proving again requires a fresh realm (a worker or child process).

If no pool was started (single-threaded configuration), the module memo is dropped and the next build() works normally.

Returns ​

Promise<void>