wasmruntime

package
v0.16.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package wasmruntime exposes a gnark prover to JavaScript as an object of promise-returning methods (readConstraintSystem, readProvingKey, readVerificationKey, prepareProvingKey, prove, verify, release) that operate on string handles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install[PK, VK, Proof any](cfg Config[PK, VK, Proof]) error

Install publishes the runtime on globalThis. The caller must keep the Go program alive afterwards (for example with select {}).

Types

type Config

type Config[PK, VK, Proof any] struct {
	// GlobalName is the name of the object installed on globalThis.
	GlobalName string

	CSFactory    func(ecc.ID) constraint.ConstraintSystem
	PKFactory    func(ecc.ID) PK
	VKFactory    func(ecc.ID) VK
	ProofFactory func(ecc.ID) Proof

	// Prepare, if set, is called once per proving key before its first proof,
	// with the constraint system when the caller provided one.
	Prepare func(constraint.ConstraintSystem, PK) error
	// ReleasePK, if set, is called when a proving-key handle is released. It
	// should detach any accelerator and free its resident GPU resources.
	ReleasePK func(PK) error
	Prove     func(constraint.ConstraintSystem, PK, witness.Witness, ...backend.ProverOption) (Proof, error)
	Verify    func(Proof, VK, witness.Witness, ...backend.VerifierOption) error
}

Config describes the proof system exposed by Install.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL