UNPKG

tl-shared-security

Version:

Enterprise-grade security module for frontend and backend applications with comprehensive protection against XSS, CSRF, SQL injection, and other security vulnerabilities

48 lines 1.44 kB
export interface SecureStorageOptions { prefix?: string; encryptionKey?: string; useSessionStorage?: boolean; expiryInMinutes?: number; } export declare class SecureStorage { private options; private storage; constructor(options?: SecureStorageOptions); /** * Sets an item in secure storage * @param key - Storage key * @param value - Value to store * @param customExpiry - Custom expiry time in minutes */ setItem(key: string, value: any, customExpiry?: number): void; /** * Gets an item from secure storage * @param key - Storage key * @param defaultValue - Default value if item doesn't exist * @returns Stored value or default value */ getItem<T = any>(key: string, defaultValue?: T): T | null | undefined; /** * Removes an item from secure storage * @param key - Storage key */ removeItem(key: string): void; /** * Clears all items from secure storage with the configured prefix */ clear(): void; /** * Gets all keys in secure storage with the configured prefix * @returns Array of keys */ getAllKeys(): string[]; /** * Removes expired items from secure storage */ removeExpiredItems(): void; private getPrefixedKey; private encrypt; private decrypt; } export declare const secureStorage: SecureStorage; //# sourceMappingURL=secure-storage.d.ts.map