UNPKG

advanced-ussd-builder

Version:

Advanced USSD Menu Builder with persistent state and navigation

83 lines 2.19 kB
import { EventEmitter } from 'events'; export interface ISessionData { sessionId: string; userId?: string; phoneNumber?: string; authenticated: boolean; createdAt: number; lastActivity: number; expiresAt: number; metadata?: Record<string, any>; } export interface ISecureSessionOptions { masterKey?: string; sessionTTL?: number; maxSessionAge?: number; regenerateOnAuth?: boolean; } export declare class SecureSessionManager extends EventEmitter { private encryptionKey; private signingKey; private readonly sessionTTL; private readonly maxSessionAge; private readonly regenerateOnAuth; private revokedSessions; constructor(options?: ISecureSessionOptions); /** * Derive a purpose-specific key from master key */ private deriveKey; /** * Generate a cryptographically secure session ID */ generateSessionId(): string; /** * Create a new session */ createSession(phoneNumber?: string, metadata?: Record<string, any>): ISessionData; /** * Encrypt session data with AES-256-GCM */ private encryptData; /** * Decrypt session data */ private decryptData; /** * Create a signed session token */ createSessionToken(session: ISessionData): string; /** * Verify and extract session from token */ verifySessionToken(token: string): ISessionData; /** * Update session activity */ touchSession(session: ISessionData): ISessionData; /** * Authenticate a session */ authenticateSession(session: ISessionData, userId: string): ISessionData; /** * Invalidate a session */ invalidateSession(sessionId: string): void; /** * Sign data with HMAC */ private sign; /** * Verify HMAC signature */ private verifySignature; /** * Validate session is still valid */ isSessionValid(session: ISessionData): boolean; /** * Get session metadata for logging (without sensitive data) */ getSessionMetadata(session: ISessionData): Record<string, any>; } //# sourceMappingURL=session-manager.d.ts.map