UNPKG

@light-auth/core

Version:

light auth core framework agnostic, using arctic

14 lines (13 loc) 942 B
import { type LightAuthConfig, type LightAuthCookie, type LightAuthCsrfToken, type LightAuthSession, type LightAuthUser } from "../models"; export declare function getCsrfToken<Session extends LightAuthSession = LightAuthSession, User extends LightAuthUser<Session> = LightAuthUser<Session>>(args: { config: LightAuthConfig<Session, User>; [key: string]: unknown; }): Promise<void>; /** * Using the origin header to verify if the request is coming from a trusted source * See https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#allowed-origins-advanced * TODO: Add support for reverse proxies or multi-layered backend architectures */ export declare function checkCsrfOrigin(headers: Headers): Promise<boolean>; export declare function createCsrfToken(secret: string): LightAuthCsrfToken; export declare function validateCsrfToken(cookies: LightAuthCookie[], secret: string): boolean;