UNPKG

@reclaimprotocol/zk-symmetric-crypto

Version:

JS Wrappers for Various ZK Snark Circuits

27 lines (26 loc) 1.21 kB
import { GenerateProofOpts, GenerateWitnessOpts, GetPublicSignalsOpts, Proof, VerifyProofOpts, ZKProofInput, ZKProofPublicSignals } from './types'; /** * Generate ZK proof for CHACHA20-CTR encryption. * Circuit proves that the ciphertext is a * valid encryption of the given plaintext. * The plaintext can be partially redacted. */ export declare function generateProof(opts: GenerateProofOpts): Promise<Proof>; /** * Verify a ZK proof for CHACHA20-CTR encryption. * * @param proofs JSON proof generated by "generateProof" * @param publicInput * @param zkey */ export declare function verifyProof(opts: VerifyProofOpts): Promise<void>; /** * Generate a ZK witness for the symmetric encryption circuit. * This witness can then be used to generate a ZK proof, * using the operator's groth16Prove function. */ export declare function generateZkWitness({ algorithm, privateInput: { key }, publicInput: { ciphertext, iv, offsetBytes }, }: GenerateWitnessOpts): Promise<{ witness: ZKProofInput; plaintextArray: Uint8Array; }>; export declare function getPublicSignals({ proof: { algorithm, plaintext }, publicInput: { ciphertext, iv, offsetBytes }, }: GetPublicSignalsOpts): ZKProofPublicSignals;