UNPKG

minauth

Version:

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

14 lines (13 loc) 635 B
/// <reference types="node" /> import { TaskEither } from 'fp-ts/lib/TaskEither.js'; import * as Express from 'express'; /** * Converts a simple request handler from a functional-style definition * into a form expected by express.js * If the handler returns a value, it is returned as json with code 200 * If the handler throws an error, it is logged and the code 400 is returned */ export declare const wrapTrivialExpressHandler: <R>(f: (req: Express.Request) => TaskEither<string, R>, onError?: (err: string) => { statusCode: number; body: unknown; }) => (req: Express.Request, resp: Express.Response) => Promise<void>;