micro-zk-proofs
Version:
Create & verify zero-knowledge SNARK proofs in parallel, using noble cryptography
71 lines • 2.18 kB
TypeScript
/**
* Minimal witness program executor for circom programs, based on websnark/wasmsnark/snarkjs.
* Unsafe: it uses eval, better to be used inside worker threads.
* Depends on **monkey-patched BigInt** prototypes due to how circom programs are serialized.
* We only patch prototypes before execution. After finishing, patches are reverted.
* This way, no other code can interfere with it.
* @module
*/
import { type IField } from '@noble/curves/abstract/modular';
import * as P from 'micro-packed';
import { type CircuitInfo, type Constraint } from './index.js';
export declare function generateWitness(circJson: any): (input: any) => any;
export type R1CSType = P.CoderType<P.StructInput<{
magic: undefined;
version: number;
sections: P.Values<{
header: {
TAG: 'header';
data: P.StructInput<{
prime: any;
nWires: any;
nPubOut: any;
nPubIn: any;
nPrvIn: any;
nLables: any;
mConstraints: any;
}>;
};
constraint: {
TAG: 'constraint';
data: [Constraint, Constraint, Constraint][];
};
wire2label: {
TAG: 'wire2label';
data: bigint[];
};
customGatesList: {
TAG: 'customGatesList';
data: P.Bytes;
};
customGatesApplication: {
TAG: 'customGatesApplication';
data: P.Bytes;
};
}>[];
}>>;
export type WTNSType = P.CoderType<P.StructInput<{
magic: undefined;
version: number;
sections: P.Values<{
header: {
TAG: 'header';
data: P.StructInput<{
prime: any;
size: any;
}>;
};
witness: {
TAG: 'witness';
data: bigint[];
};
}>[];
}>>;
/** Binary coders for Circom2 */
export declare const getCoders: (field: IField<bigint>) => {
R1CS: R1CSType;
binWitness: P.CoderType<bigint[]>;
WTNS: WTNSType;
getCircuitInfo: (bytes: Uint8Array) => CircuitInfo;
};
//# sourceMappingURL=witness.d.ts.map