@nori-zk/proof-conversion
Version:
Verifying zkVM proofs inside o1js circuits, to generate Mina compatible proof
85 lines (84 loc) • 3.49 kB
TypeScript
import type { AffinePoint2d, ComplexAffinePoint2d, Field12, ProjectivePoint, ComplexProjectivePoint } from '@nori-zk/proof-conversion-utils';
/**
* Type guard validator for G1 affine points (2D with x, y coordinates).
* Returns a ValidatorFn that narrows the type to `AffinePoint2d` on success.
*
* Validates objects with structure: `{ x: string, y: string }`
*
* @returns ValidatorFn<AffinePoint2d> - Validator function with type predicate
*
* @example
* const validator = isAffinePoint2d;
* if (validator(value)) {
* // value is narrowed to type: AffinePoint2d
* const x = value.x; // string
* }
*/
export declare const isAffinePoint2d: import("./core.js").ValidatorFn<AffinePoint2d>;
/**
* Type guard validator for G2 affine points (2D with complex coordinates).
* Returns a ValidatorFn that narrows the type to `ComplexAffinePoint2d` on success.
*
* Validates objects with structure: `{ x_c0: string, x_c1: string, y_c0: string, y_c1: string }`
*
* @returns ValidatorFn<ComplexAffinePoint2d> - Validator function with type predicate
*
* @example
* const validator = isComplexAffinePoint2d;
* if (validator(value)) {
* // value is narrowed to type: ComplexAffinePoint2d
* const x0 = value.x_c0; // string
* }
*/
export declare const isComplexAffinePoint2d: import("./core.js").ValidatorFn<ComplexAffinePoint2d>;
/**
* Type guard validator for Fq12 field elements (12 string components).
* Returns a ValidatorFn that narrows the type to `Field12` on success.
*
* Validates objects with 12 string fields: g00, g01, g10, g11, g20, g21, h00, h01, h10, h11, h20, h21
*
* @returns ValidatorFn<Field12> - Validator function with type predicate
*
* @example
* const validator = isField12;
* if (validator(value)) {
* // value is narrowed to type: Field12
* const g00 = value.g00; // string
* }
*/
export declare const isField12: import("./core.js").ValidatorFn<Field12>;
/**
* Type guard validator for G1 projective points: [x, y, z] where each is a string.
* Returns a ValidatorFn that narrows the type to `ProjectivePoint` on success.
*
* Note: Uses explicit type predicate to match imported `ProjectivePoint` type exactly.
* Cannot use `isArrayOfLength(isString, 3)` because that would return `[string, string, string]`
* instead of the imported `ProjectivePoint` type.
*
* @returns ValidatorFn<ProjectivePoint> - Validator function with type predicate
*
* @example
* const validator = isProjectivePoint;
* if (validator(value)) {
* // value is narrowed to type: ProjectivePoint
* const [x, y, z] = value; // all strings
* }
*/
export declare const isProjectivePoint: import("./core.js").ValidatorFn<ProjectivePoint>;
/**
* Type guard validator for G2 projective points: [[x_c0, x_c1], [y_c0, y_c1], [z_c0, z_c1]].
* Returns a ValidatorFn that narrows the type to `ComplexProjectivePoint` on success.
*
* Note: Uses explicit type predicate to match imported `ComplexProjectivePoint` type exactly.
* Cannot compose from primitives because TypeScript would infer structural type instead.
*
* @returns ValidatorFn<ComplexProjectivePoint> - Validator function with type predicate
*
* @example
* const validator = isComplexProjectivePoint;
* if (validator(value)) {
* // value is narrowed to type: ComplexProjectivePoint
* const [[x_c0, x_c1], [y_c0, y_c1], [z_c0, z_c1]] = value; // all strings
* }
*/
export declare const isComplexProjectivePoint: import("./core.js").ValidatorFn<ComplexProjectivePoint>;