UNPKG

@cipherstash/nextjs

Version:

Nextjs package for use with @cipherstash/protect

22 lines (19 loc) 749 B
import { NextResponse, NextRequest } from 'next/server'; declare const CS_COOKIE_NAME = "__cipherstash_cts_session"; type CtsToken = { accessToken: string; expiry: number; }; type GetCtsTokenResponse = Promise<{ success: boolean; error: string; ctsToken?: never; } | { success: boolean; error?: never; ctsToken: CtsToken; }>; declare const getCtsToken: (oidcToken?: string) => GetCtsTokenResponse; declare const resetCtsToken: (res?: NextResponse) => NextResponse<unknown>; declare const protectMiddleware: (oidcToken: string, req: NextRequest, res?: NextResponse) => Promise<NextResponse<unknown>>; export { CS_COOKIE_NAME, type CtsToken, type GetCtsTokenResponse, getCtsToken, protectMiddleware, resetCtsToken };