@light-auth/core
Version:
light auth core framework agnostic, using arctic
22 lines (21 loc) • 1.25 kB
TypeScript
import { type LightAuthProvider, type LightAuthConfig, type LightAuthSession, type LightAuthUser, type LightAuthServerEnv } from "../models";
/**
* Checks the configuration and throws an error if any required fields are missing.
* @param config The configuration object to check.
* @returns The checked configuration object.
* @throws Error if any required fields are missing.
*/
export declare function checkConfig<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(config: LightAuthConfig<Session, User>, providerName?: string): Required<LightAuthConfig<Session, User>> & {
provider: LightAuthProvider;
};
/** get the max age from the environment variable or use the default value */
export declare function getSessionExpirationMaxAge(): number;
/** Resolves the basePath, defaults to "/api/default" if not provided or falsy */
export declare function resolveBasePath(basePath: string | undefined | null, env: LightAuthServerEnv | null | undefined): string;
export declare function buildSecret(env?: {
[key: string]: string | undefined;
}): string;
export declare function buildFullUrl({ url, incomingHeaders }: {
url: string;
incomingHeaders: Headers;
}): string;