UNPKG

@light-auth/express

Version:

light auth framework for express, using arctic

18 lines (17 loc) 2.26 kB
import { type LightAuthConfig, type LightAuthSession, type LightAuthUser } from "@light-auth/core"; import { type Request as ExpressRequest, type Response as ExpressResponse, type NextFunction } from "express"; export declare function createSignout<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>): (req: ExpressRequest, res: ExpressResponse, revokeToken?: boolean, callbackUrl?: string) => Promise<any>; export declare const createAuthHandler: <Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>) => (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<void>; export declare const createMiddleware: <Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>) => (req: ExpressRequest, res: ExpressResponse, next: NextFunction, ...params: any[]) => Promise<void>; export declare function CreateLightAuth<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>): { providers: import("@light-auth/core").LightAuthProvider[]; handlers: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<void>; middleware: (req: ExpressRequest, res: ExpressResponse, next: NextFunction, ...params: any[]) => Promise<void>; basePath: string; getAuthSession: (req: ExpressRequest, res: ExpressResponse) => Promise<Session | null | undefined>; setAuthSession: (req: ExpressRequest, res: ExpressResponse, session: Session) => Promise<Session | null | undefined>; getUser: (req: ExpressRequest, res: ExpressResponse, providerUserId?: string) => Promise<User | null>; setUser: (req: ExpressRequest, res: ExpressResponse, user: User) => Promise<User | null | undefined>; signIn: (req: ExpressRequest, res: ExpressResponse, providerName?: string, callbackUrl?: string) => Promise<any>; signOut: (req: ExpressRequest, res: ExpressResponse, revokeToken?: boolean, callbackUrl?: string) => Promise<any>; };