toip.tools

class · Browser and Node

MembershipProver

@toip-tools/anon-membershipView source
TypeScriptImport
import { MembershipProver } from "@toip-tools/anon-membership";

Constructor

This class has no public constructor. Use its public factory methods below to create an instance.

Properties

circuitrequired
string

Methods

prove

Always the zero-knowledge target. Throws MembershipError if the witness doesn't satisfy the statement.

TypeScriptSignature
prove(statement: Statement, witness: Witness, onProgress?: (p: ProveProgress) => void): Promise<MembershipProof>;

Parameters

statementrequired
Statement
witnessrequired
Witness
onProgressoptional
((p: ProveProgress) => void) | undefined

Returns

destroy

Frees the prover and deletes bb.js's browser cache, if there is one.

TypeScriptSignature
destroy(): Promise<void>;

No parameters.

Returns

Promise<void>

static create

Loads the prover once; later proofs reuse it. This is the warm-up.

TypeScriptSignature
create(opts?: BackendOptions & {
    artifacts?: CircuitArtifacts;
}): Promise<MembershipProver>;

Parameters

optsoptional
BackendOptions & { artifacts?: CircuitArtifacts; }

Default: {}

Fields of opts
threadsoptional
number | undefined

Worker threads for bb.js. Default: all cores up to 16 where threads are possible, else 1.

crsoptional
CrsSource | undefined

Default: the CRS bundled with this package.

artifactsoptional
CircuitArtifacts | undefined

Returns