UNPKG

@devtion/actions

Version:
96 lines 5.64 kB
import { CircuitSignals, Groth16Proof, PublicSignals } from "snarkjs"; import { Firestore } from "firebase/firestore"; import { Functions } from "firebase/functions"; import { CeremonyArtifacts } from "../types/index"; /** * Verify that a zKey is valid * @param r1csLocalFilePath <string> path to the r1cs file * @param zkeyLocalPath <string> path to the zKey file * @param potLocalFilePath <string> path to the PoT file * @param logger <any> logger instance * @returns <boolean> true if the zKey is valid, false otherwise */ export declare const verifyZKey: (r1csLocalFilePath: string, zkeyLocalPath: string, potLocalFilePath: string, logger?: any) => Promise<boolean>; /** * Generates a GROTH16 proof * @param circuitInput <object> Input to the circuit * @param zkeyFilePath <string> Path to the proving key * @param wasmFilePath <string> Path to the compiled circuit * @param logger <any> Optional logger * @returns <Promise<object>> The proof */ export declare const generateGROTH16Proof: (circuitInput: CircuitSignals, zkeyFilePath: string, wasmFilePath: string, logger?: any) => Promise<any>; /** * Verifies a GROTH16 proof * @param verificationKeyPath <string> Path to the verification key * @param publicSignals <object> Public signals * @param proof <object> Proof * @returns <Promise<boolean>> Whether the proof is valid or not */ export declare const verifyGROTH16Proof: (verificationKeyPath: string, publicSignals: PublicSignals, proof: Groth16Proof) => Promise<boolean>; /** * Helper method to extract the Solidity verifier * from a final zKey file and save it to a local file. * @param finalZkeyPath <string> The path to the zKey file. * @return <any> The Solidity verifier code. */ export declare const exportVerifierContract: (finalZkeyPath: string, templatePath: string) => Promise<any>; /** * Helpers method to extract the vKey from a final zKey file * @param finalZkeyPath <string> The path to the zKey file. * @return <any> The vKey. */ export declare const exportVkey: (finalZkeyPath: string) => Promise<any>; /** * Helper method to extract the Solidity verifier and the Verification key * from a final zKey file and save them to local files. * @param finalZkeyPath <string> The path to the zKey file. * @param verifierLocalPath <string> The path to the local file where the verifier will be saved. * @param vKeyLocalPath <string> The path to the local file where the vKey will be saved. * @param templatePath <string> The path to the template file. */ export declare const exportVerifierAndVKey: (finalZkeyPath: string, verifierLocalPath: string, vKeyLocalPath: string, templatePath: string) => Promise<void>; /** * Generate a zKey from scratch (useful to compute either the genesis or final zKey) * @param isFinalizing <boolean> Whether the ceremony is finalizing or not * @param r1csLocalPath <string> The path to the local r1cs file * @param potLocalPath <string> The path to the local pot file * @param zkeyLocalPath <string> The path to save the generated zKey * @param logger <any> The logger instance * @param finalContributionZKeyLocalPath <string> The path to the local zkey file of the final contribution (only for final zKey) * @param coordinatorIdentifier <string> The identifier of the coordinator (only for final zKey) * @param beacon <string> The beacon value for the last contribution (only for final zKey) */ export declare const generateZkeyFromScratch: (isFinalizing: boolean, r1csLocalPath: string, potLocalPath: string, zkeyLocalPath: string, logger: any, finalContributionZKeyLocalPath?: string, coordinatorIdentifier?: string, beacon?: string) => Promise<void>; /** * Helper function used to compare two ceremony artifacts * @param firebaseFunctions <Functions> Firebase functions object * @param localPath1 <string> Local path to store the first artifact * @param localPath2 <string> Local path to store the second artifact * @param storagePath1 <string> Storage path to the first artifact * @param storagePath2 <string> Storage path to the second artifact * @param bucketName1 <string> Bucket name of the first artifact * @param bucketName2 <string> Bucket name of the second artifact * @param cleanup <boolean> Whether to delete the downloaded files or not * @returns <Promise<boolean>> true if the hashes match, false otherwise */ export declare const compareCeremonyArtifacts: (firebaseFunctions: Functions, localPath1: string, localPath2: string, storagePath1: string, storagePath2: string, bucketName1: string, bucketName2: string, cleanup: boolean) => Promise<boolean>; /** * Given a ceremony prefix, download all the ceremony artifacts * @param functions <Functions> firebase functions instance * @param firestore <Firestore> firebase firestore instance * @param ceremonyPrefix <string> ceremony prefix * @param outputDirectory <string> output directory where to * @returns <Promise<CeremonyArtifacts[]>> array of ceremony artifacts */ export declare const downloadAllCeremonyArtifacts: (functions: Functions, firestore: Firestore, ceremonyPrefix: string, outputDirectory: string) => Promise<CeremonyArtifacts[]>; /** * Fetch the final contribution beacon from Firestore * @param firestore <Firestore> firebase firestore instance * @param ceremonyId <string> ceremony id * @param circuitId <string> circuit id * @param participantId <string> participant id * @returns <Promise<string>> final contribution beacon */ export declare const getFinalContributionBeacon: (firestore: Firestore, ceremonyId: string, circuitId: string, participantId: string) => Promise<string>; //# sourceMappingURL=verification.d.ts.map