import { SecureStorageConfig, SecureStorageInterface, SecureStorageResult, SecureStorageSetOptions, SecureStorageMetadata, StorageQuotaInfo, EncryptedData, EncryptionAlgorithm, EncryptedString } from './types'; /** * Secure Storage implementation with encryption * * Features: * - AES-GCM encryption with PBKDF2 key derivation * - Optional compression for large data * - Automatic expiration handling * - Storage quota monitoring * - IndexedDB fallback for large items * * @example * ```typescript * const storage = new SecureStorage('my-secret-key'); * * // Store encrypted data * await storage.setItem('user-data', { name: 'John', email: 'john@example.com' }); * * // Retrieve decrypted data * const result = await storage.getItem<{ name: string; email: string }>('user-data'); * if (result.success) { * console.log(result.data); * } * * // Check storage quota * const quota = await storage.getQuotaInfo(); * console.log(`Using ${quota.usagePercent}% of storage`); * ``` */ export declare class SecureStorage implements SecureStorageInterface { private readonly config; private readonly encryptionKey; private readonly storage; constructor(encryptionKey: string, options?: Partial, useSessionStorage?: boolean); /** * Store an encrypted item */ setItem(key: string, value: T, options?: SecureStorageSetOptions): Promise>; /** * Retrieve and decrypt an item */ getItem(key: string): Promise>; /** * Remove an item */ removeItem(key: string): Promise>; /** * Check if an item exists */ hasItem(key: string): Promise; /** * Get all keys */ keys(): Promise; /** * Get storage quota information */ getQuotaInfo(): Promise; /** * Clear all secure storage items */ clear(): Promise>; /** * Get item metadata */ getMetadata(key: string): Promise; /** * Cleanup expired items */ cleanup(): Promise; /** * Get configuration */ getConfig(): Readonly; /** * Get the full storage key with prefix */ private getStorageKey; /** * Estimate total storage size in bytes */ private estimateStorageSize; /** * Create metadata for an item */ private createMetadata; /** * Update last accessed time in metadata */ private updateLastAccessed; /** * Get the type of value for metadata */ private getValueType; } /** * Create a secure localStorage instance */ export declare function createSecureLocalStorage(encryptionKey: string, options?: Partial): SecureStorage; /** * Create a secure sessionStorage instance */ export declare function createSecureSessionStorage(encryptionKey: string, options?: Partial): SecureStorage; /** * Initialize the default secure storage instance * Call this once during app initialization */ export declare function initSecureStorage(encryptionKey: string): SecureStorage; /** * Get the default secure storage instance * @throws Error if not initialized */ export declare function getSecureStorage(): SecureStorage; /** * Check if secure storage is available */ export declare function isSecureStorageAvailable(): boolean; /** * Securely wipe a string from memory * Note: This is best-effort in JavaScript due to string immutability */ export declare function secureWipe(value: string): void; /** * Generate a secure encryption key * Returns a base64-encoded key suitable for SecureStorage */ export declare function generateEncryptionKey(length?: number): string; /** * Hash sensitive data for storage keys * Use when the key itself should not reveal information */ export declare function hashForKey(data: string): Promise; export type { SecureStorageConfig, SecureStorageInterface, SecureStorageResult, SecureStorageSetOptions, SecureStorageMetadata, StorageQuotaInfo, EncryptedData, EncryptionAlgorithm, EncryptedString, };