@nori-zk/proof-conversion
Version:
Verifying zkVM proofs inside o1js circuits, to generate Mina compatible proof
35 lines • 1.55 kB
JavaScript
import { isArrayOfLength, isArrayOfBoundedLength, isString, isBoundedNumberUnion, isComplexProjectivePoint, isProjectivePoint, } from '../validation/guards/index.js';
// Runtime validation ======================================================================
export const snarkjsGroth16ProofSchema = {
protocol: 'groth16',
curve: 'bn128',
pi_a: isProjectivePoint,
pi_b: isComplexProjectivePoint,
pi_c: isProjectivePoint,
};
const isConstrainedIC = isArrayOfBoundedLength(isProjectivePoint, {
minLength: 0,
maxLength: 7,
});
const isSnarkjsAlphaBeta = isArrayOfLength(isComplexProjectivePoint, 2);
export const snarkjsGroth16VKSchema = {
protocol: 'groth16',
curve: 'bn128',
nPublic: isBoundedNumberUnion({ min: 0, max: 6 }),
vk_alpha_1: isProjectivePoint,
vk_beta_2: isComplexProjectivePoint,
vk_gamma_2: isComplexProjectivePoint,
vk_delta_2: isComplexProjectivePoint,
vk_alphabeta_12: isSnarkjsAlphaBeta,
IC: isConstrainedIC,
};
export const snarkjsGroth16PublicInputsSchema = isArrayOfBoundedLength(isString, { maxLength: 6 });
// Schema for obj form (proof + vk + publicInputs)
export const snarkjsGroth16InputSchema = {
proof: snarkjsGroth16ProofSchema,
vk: snarkjsGroth16VKSchema,
publicInputs: snarkjsGroth16PublicInputsSchema,
};
// Keys for the ApiMethod helper - must match the keys in the schema - must be explicit tuples with 'as const' for proper type inference
export const snarkjsGroth16ArgKeys = ['proof', 'vk', 'publicInputs'];
//# sourceMappingURL=schema.js.map