UNPKG

minauth

Version:

A TypeScript library for building authentication systems on top of the Mina blockchain and other zero-knowledge proofs solutions.

35 lines (34 loc) 930 B
import { Request } from 'express'; import { Strategy } from 'passport-strategy'; import { MinAuthProof } from '../common/proof.js'; import { Logger } from '../plugin/logger.js'; /** * A result of a proof verification. */ type VerificationResult = { __tag: 'success'; output: unknown; } | { __tag: 'failed'; error: string; }; export type AuthenticationResponse = { plugin: string; output: unknown; }; export interface MinAuthStrategyConfig { logger: Logger; verifierUrl: string; } /** * Minauth's integration with passport.js. * This implementation uses the plugin server to verify the proof. */ declare class MinAuthStrategy extends Strategy { name: string; readonly verifyProof: (_: MinAuthProof) => Promise<VerificationResult>; readonly log: Logger; constructor(config: MinAuthStrategyConfig); authenticate(req: Request): Promise<void>; } export default MinAuthStrategy;