@light-auth/core
Version:
light auth core framework agnostic, using arctic
50 lines (49 loc) • 1.64 kB
TypeScript
import { type BaseResponse } from "./light-auth-base";
import { type LightAuthCookie } from "./light-auth-cookie";
import type { LightAuthServerEnv } from "./light-auth-server-env";
export interface LightAuthRouter {
redirectTo: (args: {
env: LightAuthServerEnv;
basePath: string;
url: string;
init?: ResponseInit | undefined;
[key: string]: unknown;
}) => Promise<BaseResponse> | BaseResponse;
getCookies: (args: {
env: LightAuthServerEnv;
basePath: string;
search?: string | RegExp;
[key: string]: unknown;
}) => Promise<LightAuthCookie[]> | LightAuthCookie[];
setCookies: (args: {
env: LightAuthServerEnv;
basePath: string;
cookies?: LightAuthCookie[];
init?: ResponseInit | undefined;
[key: string]: unknown;
}) => Promise<BaseResponse> | BaseResponse;
getHeaders: (args: {
env: LightAuthServerEnv;
basePath: string;
search?: string | RegExp;
[key: string]: unknown;
}) => Headers | Promise<Headers>;
getUrl: (args: {
env: LightAuthServerEnv;
basePath: string;
endpoint?: string;
[key: string]: unknown;
}) => string | Promise<string>;
getRequest: (args: {
env: LightAuthServerEnv;
basePath: string;
[key: string]: unknown;
}) => Promise<Request> | Request;
returnJson: (args: {
env: LightAuthServerEnv;
basePath: string;
data: {} | null;
init?: ResponseInit | undefined;
[key: string]: unknown;
}) => Promise<BaseResponse> | BaseResponse;
}