UNPKG

arctic-lights

Version:

Drop-In replacement for NextAuth v5, built with arctic for faster performance

71 lines (70 loc) 1.75 kB
import { Tokens } from "arctic"; import { ProviderStyle } from "./react"; export type User = { email: string; name?: string; image?: string; raw?: any; }; export type Provider = { getUser: (accessToken: string) => Promise<User | undefined>; options: any; pkce: boolean; style?: ProviderStyle; scopes: string[]; type: string; }; export type ArcticLightsOptions = { providers: (Provider | null)[] | Promise<(Provider | null)[]>; secret?: string; session?: { maxAge?: number; accepted?: { cookie?: string; header?: string; }; }; callbacks?: { jwt?: (options: { token: any; account?: Tokens; profile: User; }) => Promise<any>; session?: (options: { session: Session; token: { provider: string; user: User; }; user: User; }) => Promise<any>; }; pages?: { signIn?: string; signOut?: string; error?: string; }; }; export type Session = { expires: Date; provider: string; user: User; }; declare const ArcticLights: (options: ArcticLightsOptions) => { handlers: { GET: (req: any, { params }: { params: { arcticlights?: string[]; nextauth?: string[]; }; }) => Promise<Response>; POST: () => Promise<Response>; }; auth: () => Promise<Session | null>; getProviders: () => Promise<{ type: string; style: ProviderStyle | undefined; }[]>; generateToken: (session: Session) => Promise<string | undefined>; }; export default ArcticLights;