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.

31 lines 1.27 kB
import { NextApiRequest, NextApiResponse } from "next/types"; import { OAuthConfig } from "next-auth/providers/oauth"; import { UserConfig } from "./config/index.js"; import { NextRequest } from "next/server"; export interface PubKeyAuthProfile extends Record<string, string | number | null> { id: string; image: string | null; name: string | null; iat: number; iss: string; aud: string; exp: number; sub: string; } /** * Generate a provider and handler to setup Lightning auth. * * @param {Object} userConfig - config options, see the package README for details * * @returns {Object} * @returns {String} provider - a provider that can be added to the `next-auth` config's providerArray * @returns {String} handler - an API handler to be exported in the pages/api/pubkey/[...pubkey] folder */ export default function NextAuthPubkey(userConfig: UserConfig): { lightningProvider: OAuthConfig<PubKeyAuthProfile>; nostrProvider: OAuthConfig<PubKeyAuthProfile>; handler: (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>; GET: (req: NextRequest) => Promise<Response | undefined>; POST: (req: NextRequest) => Promise<Response | undefined>; }; //# sourceMappingURL=index.d.ts.map