supertokens-node
Version:
NodeJS driver for SuperTokens core
37 lines (36 loc) • 2.38 kB
TypeScript
import RecipeModule from "../../recipeModule";
import { TypeInput, TypeNormalisedInput, VerifySessionOptions } from "./types";
import STError from "./error";
import Session from "./sessionClass";
import { HandshakeInfo } from "./types";
import * as express from "express";
import { NormalisedAppinfo, RecipeListFunction, APIHandled, HTTPMethod } from "../../types";
import NormalisedURLPath from "../../normalisedURLPath";
export default class SessionRecipe extends RecipeModule {
private static instance;
static RECIPE_ID: string;
config: TypeNormalisedInput;
handshakeInfo: HandshakeInfo | undefined;
constructor(recipeId: string, appInfo: NormalisedAppinfo, isInServerlessEnv: boolean, config?: TypeInput);
static getInstanceOrThrowError(): SessionRecipe;
static init(config?: TypeInput): RecipeListFunction;
static reset(): void;
getAPIsHandled: () => APIHandled[];
handleAPIRequest: (id: string, req: express.Request, res: express.Response, next: express.NextFunction, __: NormalisedURLPath, ___: HTTPMethod) => Promise<void>;
handleError: (err: STError, request: express.Request, response: express.Response, next: express.NextFunction) => void;
getAllCORSHeaders: () => string[];
isErrorFromThisOrChildRecipeBasedOnInstance: (err: any) => err is STError;
getHandshakeInfo: () => Promise<HandshakeInfo>;
updateJwtSigningPublicKeyInfo: (newKey: string, newExpiry: number) => void;
createNewSession: (res: express.Response, userId: string, jwtPayload?: any, sessionData?: any) => Promise<Session>;
getSession: (req: express.Request, res: express.Response, options?: boolean | VerifySessionOptions | undefined) => Promise<Session | undefined>;
refreshSession: (req: express.Request, res: express.Response) => Promise<Session>;
revokeAllSessionsForUser: (userId: string) => Promise<string[]>;
getAllSessionHandlesForUser: (userId: string) => Promise<string[]>;
revokeSession: (sessionHandle: string) => Promise<boolean>;
revokeMultipleSessions: (sessionHandles: string[]) => Promise<string[]>;
getSessionData: (sessionHandle: string) => Promise<any>;
updateSessionData: (sessionHandle: string, newSessionData: any) => Promise<void>;
getJWTPayload: (sessionHandle: string) => Promise<any>;
updateJWTPayload: (sessionHandle: string, newJWTPayload: any) => Promise<void>;
}