@light-auth/astro
Version:
light auth framework for astro, using arctic
24 lines (23 loc) • 2.24 kB
TypeScript
import { type LightAuthConfig, type LightAuthSession, type LightAuthUser } from "@light-auth/core";
import type { APIRoute, AstroSharedContext } from "astro";
export declare const createGetAuthUser: <Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>) => (context: AstroSharedContext, providerUserId?: string) => Promise<User | null>;
export declare function createSignin<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>): (context: AstroSharedContext, providerName?: string, callbackUrl?: string) => Promise<any>;
export declare function createSignout<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>): (context: AstroSharedContext, revokeToken?: boolean, callbackUrl?: string) => Promise<any>;
export declare const createHandler: <Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>) => {
GET: APIRoute;
POST: APIRoute;
};
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: {
GET: (...args: any[]) => Promise<any>;
POST: (...args: any[]) => Promise<any>;
};
basePath: string;
getAuthSession: (context: AstroSharedContext) => Promise<Session | null | undefined>;
setAuthSession: (context: AstroSharedContext, session: Session) => Promise<Session | null | undefined>;
getUser: (context: AstroSharedContext, providerUserId?: string) => Promise<User | null>;
setUser: (context: AstroSharedContext, user: User) => Promise<User | null | undefined>;
signIn: (context: AstroSharedContext, providerName?: string, callbackUrl?: string) => Promise<any>;
signOut: (context: AstroSharedContext, revokeToken?: boolean, callbackUrl?: string) => Promise<any>;
};