@reclaimprotocol/zk-symmetric-crypto
Version:
JS Wrappers for Various ZK Snark Circuits
27 lines (26 loc) • 1.17 kB
TypeScript
import type { GenerateProofOpts, GenerateWitnessOpts, GetPublicSignalsOpts, Proof, VerifyProofOpts, ZKProofInput, ZKProofPublicSignals } from './types.ts';
/**
* 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, }: GenerateWitnessOpts): Promise<{
witness: ZKProofInput;
plaintextArray: Uint8Array<ArrayBufferLike>;
}>;
export declare function getPublicSignals({ publicInput, algorithm, ...opts }: GetPublicSignalsOpts): Promise<ZKProofPublicSignals>;