UNPKG

@toruslabs/session-manager

Version:
33 lines (32 loc) 934 B
export type IRequestBody = Record<string, unknown>; export interface ApiRequestParams { url: string; method?: string; headers?: RequestInit["headers"]; data?: IRequestBody; } export interface ISessionManager<TSessionData> { sessionId: string; createSession(data: TSessionData): Promise<string>; authorizeSession(): Promise<TSessionData>; updateSession(data: Partial<TSessionData>): Promise<void>; invalidateSession(): Promise<boolean>; } export type SessionApiResponse = { message?: string; }; export interface SessionManagerOptions { sessionServerBaseUrl?: string; sessionNamespace?: string; sessionTime?: number; sessionId?: string; allowedOrigin?: string | boolean; } export interface SessionRequestBody extends IRequestBody { key: string; data: string; signature: string; timeout?: number; namespace?: string; allowedOrigin?: string | boolean; }