minauth
Version:
A TypeScript library for building authentication systems on top of the Mina blockchain and other zero-knowledge proofs solutions.
32 lines (31 loc) • 1.16 kB
TypeScript
import { ReaderTaskEither } from 'fp-ts/lib/ReaderTaskEither.js';
import { Decoder } from './encodedecoder.js';
import { FpInterfaceType } from './interfacekind.js';
import { Logger } from './logger.js';
import { MinAuthProof } from '../common/proof.js';
export type GenerateProofEnv<Conf> = Readonly<{
logger: Logger;
config: Conf;
}>;
export type GenerateProofError = {
__tag: 'failedToInitializeProver';
reason: string;
} | {
__tag: 'failedToProve';
reason: string;
} | {
__tag: 'failedToFetchPublicInputs';
reason: string;
publicInputArgs: unknown;
} | {
__tag: 'otherError';
detail: unknown;
};
export type GenerateProof<Conf, A> = ReaderTaskEither<GenerateProofEnv<Conf>, GenerateProofError, A>;
export interface ProofGenerator<Conf> {
generateProof: () => GenerateProof<Conf, MinAuthProof>;
readonly confDec: Decoder<FpInterfaceType, Conf>;
}
export type UntypedProofGenerator = ProofGenerator<unknown>;
export declare const askConfig: <Conf>() => GenerateProof<Conf, Conf>;
export declare const asUntypedProofGenerator: <Conf>({ confDec, generateProof }: ProofGenerator<Conf>) => UntypedProofGenerator;