UNPKG

next-auth-pubkey

Version:

A light-weight Lightning and Nostr auth provider for your Next.js app that's entirely self-hosted and plugs seamlessly into the next-auth framework.

48 lines 1.88 kB
/// <reference types="node" /> import { NextApiRequest, NextApiResponse } from "next/types"; import { NextRequest } from "next/server"; import { Config } from "../config/index.js"; import createHandler from "../handlers/create.js"; export type HandlerArguments = { query?: Record<string, string | boolean | number | undefined | null>; body?: Record<string, string | boolean | number | undefined | null>; cookies: { sessionToken?: string; }; url: URL; config: Config; }; export declare enum HandlerErrorCodes { Forbidden = "You are already logged in.", NotFound = "Path not found.", Unauthorized = "You could not be signed in.", Gone = "Session not found.", BadRequest = "Missing required query or body arguments.", Default = "Unable to sign in." } type HandlerError = { error: keyof typeof HandlerErrorCodes; log?: string; message?: string; status?: 302 | 404 | 410 | 500; headers?: Record<string, string>; }; type HandlerRedirect = { redirect: URL; }; type HandlerResponse = { status?: 200; headers?: Record<string, string>; response: string | Buffer | Record<string, string | boolean | number | undefined | null>; }; export type HandlerReturn = HandlerRedirect | HandlerError | HandlerResponse; export declare function pagesHandler(req: NextApiRequest, res: NextApiResponse, config: Config, handler: (args: HandlerArguments) => Promise<HandlerReturn>): Promise<void | NextApiResponse<any>>; export declare function appHandler(req: NextRequest, config: Config, handler: (args: HandlerArguments) => Promise<HandlerReturn>): Promise<Response | undefined>; type Arguments = { config: Config; req: NextApiRequest | NextRequest; res?: NextApiResponse; }; export default function getHandler(args: Arguments): typeof createHandler; export {}; //# sourceMappingURL=handlers.d.ts.map