JS / TypeScript end-to-end
This guide uses the Verity JS / TypeScript SDK, which wraps ProveKit’s WASM backend for browser and Node.js environments.
Install
Section titled “Install”npm i @atheonxyz/verity
# Noir peer deps for in-JS witness generation. Required for proving.# Pin 1.0.0-beta.11 to match the audited v1 ProveKit branch.npm i @noir-lang/noir_js@1.0.0-beta.11 \ @noir-lang/acvm_js@1.0.0-beta.11 \ @noir-lang/noirc_abi@1.0.0-beta.11 \ @noir-lang/types@1.0.0-beta.11Your application never imports these packages; Verity does internally. They’re declared as peer dependencies, so npm won’t pull them in transitively when you install @atheonxyz/verity.
Minimal flow
Section titled “Minimal flow”import { Backend, Verity } from "@atheonxyz/verity";
const verity = await Verity.create(Backend.ProveKit);
const prover = await verity.loadProver(proverBytes); // Uint8Array of .pkpconst verifier = await verity.loadVerifier(verifierBytes); // Uint8Array of .pkv
const proof = await prover.prove({ age: "25", threshold: "18" });const valid = await verifier.verify(proof);
if (!valid) { throw new Error("proof did not verify");}
prover.dispose();verifier.dispose();prove accepts either a plain object whose keys match the circuit’s input ABI, or a JSON string with the same shape. For arrays and nested types, keep the object layout aligned with the circuit ABI and validate it in application tests. If your inputs live in a Prover.toml file, parse the TOML in JS first and pass the resulting object; Verity does not parse TOML for you (see the working example below).
Working example
Section titled “Working example”playground/wasm-demo/ in the ProveKit repo is a complete browser proof flow: artifact fetching, optional Prover.toml parsing, thread-pool setup with iOS/Android-aware fallbacks via Verity.create(Backend.ProveKit, { threads }), and progress logging. Use it as a reference when building your own integration.
Build and packaging notes
Section titled “Build and packaging notes”- Browser threading depends on
SharedArrayBuffer. The Verity ProveKit binding falls back to a non-threaded path when worker/thread-pool initialization is unavailable. iOS WebKit is particularly unreliable for WASM threading; the wasm-demo runs single-threaded there by default. proverBytesandverifierBytesare assumed to beUint8Arrayvalues already loaded by the application. Fetching, caching, integrity checks, and lifecycle cleanup are the host’s responsibility.