UNPKG

@auth0/nextjs-auth0

Version:
74 lines (73 loc) 1.83 kB
import { JWTDecryptResult } from "jose"; import { SessionData } from "../../types/index.js"; export declare const LEGACY_COOKIE_NAME = "appSession"; /** * Key-value store for the user's claims. */ interface LegacyClaims { [key: string]: any; } /** * The user's session. */ export declare class LegacySession { /** * Any of the claims from the `id_token`. */ user: LegacyClaims; /** * The ID token. */ idToken?: string | undefined; /** * The access token. */ accessToken?: string | undefined; /** * The access token scopes. */ accessTokenScope?: string | undefined; /** * The expiration of the access token. */ accessTokenExpiresAt?: number; /** * The refresh token, which is used to request a new access token. * * **IMPORTANT** You need to request the `offline_access` scope on login to get a refresh token * from Auth0. */ refreshToken?: string | undefined; [key: string]: any; constructor(user: LegacyClaims); } /** * The legacy headers of the session. */ interface LegacyHeaders { /** * Timestamp (in secs) when the session was created. */ iat: number; /** * Timestamp (in secs) when the session was last touched. */ uat: number; /** * Timestamp (in secs) when the session expires. */ exp: number; } export interface LegacySessionPayload { /** * The session header. */ header: LegacyHeaders; /** * The session data. */ data: LegacySession; } export declare function normalizeStatelessSession(sessionCookie: JWTDecryptResult<LegacySessionPayload | SessionData>): SessionData; export declare function normalizeStatefulSession(sessionData: SessionData | LegacySessionPayload): SessionData; export {};