@bantis/local-cipher 1.0.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/core/EncryptionHelper.ts","../src/core/SecureStorage.ts","../src/integrations/react.ts","../node_modules/tslib/tslib.es6.js","../src/integrations/angular.ts","../src/utils/debug.ts","../src/index.ts"],"sourcesContent":["/**\n * EncryptionHelper - Clase responsable de todas las operaciones criptográficas\n * Implementa AES-256-GCM con derivación de claves PBKDF2 y fingerprinting del navegador\n */\nexport class EncryptionHelper {\n // Constantes criptográficas\n private static readonly ALGORITHM = 'AES-GCM';\n private static readonly KEY_LENGTH = 256;\n private static readonly IV_LENGTH = 12; // 96 bits para GCM\n private static readonly SALT_LENGTH = 16; // 128 bits\n private static readonly ITERATIONS = 100000;\n private static readonly HASH_ALGORITHM = 'SHA-256';\n private static readonly SALT_STORAGE_KEY = '__app_salt';\n private static readonly APP_IDENTIFIER = 'mtt-local-cipher-v1'; // Identificador único de la app\n\n // Propiedades privadas\n private key: CryptoKey | null = null;\n private baseKey: string = '';\n private baseKeyPromise: Promise<string> | null = null;\n\n /**\n * Genera un fingerprint único del navegador\n * Combina múltiples características del navegador para crear una huella digital\n */\n private async generateBaseKey(): Promise<string> {\n if (this.baseKeyPromise) {\n return this.baseKeyPromise;\n }\n\n this.baseKeyPromise = (async () => {\n const components = [\n navigator.userAgent,\n navigator.language,\n screen.width.toString(),\n screen.height.toString(),\n screen.colorDepth.toString(),\n new Intl.DateTimeFormat().resolvedOptions().timeZone,\n EncryptionHelper.APP_IDENTIFIER,\n ];\n\n const fingerprint = components.join('|');\n this.baseKey = await this.hashString(fingerprint);\n return this.baseKey;\n })();\n\n return this.baseKeyPromise;\n }\n\n /**\n * Hashea un string usando SHA-256\n * @param str - String a hashear\n * @returns Hash hexadecimal\n */\n private async hashString(str: string): Promise<string> {\n const encoder = new TextEncoder();\n const data = encoder.encode(str);\n const hashBuffer = await crypto.subtle.digest(EncryptionHelper.HASH_ALGORITHM, data);\n return this.arrayBufferToHex(hashBuffer);\n }\n\n /**\n * Deriva una clave criptográfica usando PBKDF2\n * @param password - Password base (fingerprint)\n * @param salt - Salt aleatorio\n * @returns CryptoKey para AES-GCM\n */\n private async deriveKey(password: string, salt: Uint8Array): Promise<CryptoKey> {\n const encoder = new TextEncoder();\n const passwordBuffer = encoder.encode(password);\n\n // Importar el password como material de clave\n const keyMaterial = await crypto.subtle.importKey(\n 'raw',\n passwordBuffer,\n 'PBKDF2',\n false,\n ['deriveBits', 'deriveKey']\n );\n\n // Derivar la clave AES-GCM\n return crypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt,\n iterations: EncryptionHelper.ITERATIONS,\n hash: EncryptionHelper.HASH_ALGORITHM,\n },\n keyMaterial,\n {\n name: EncryptionHelper.ALGORITHM,\n length: EncryptionHelper.KEY_LENGTH,\n },\n false,\n ['encrypt', 'decrypt']\n );\n }\n\n /**\n * Inicializa el sistema de encriptación generando un nuevo salt\n */\n public async initialize(): Promise<void> {\n // Generar salt aleatorio\n const salt = crypto.getRandomValues(new Uint8Array(EncryptionHelper.SALT_LENGTH));\n\n // Obtener y hashear el baseKey\n const baseKey = await this.generateBaseKey();\n\n // Derivar la clave\n this.key = await this.deriveKey(baseKey, salt);\n\n // Guardar el salt en localStorage\n localStorage.setItem(\n EncryptionHelper.SALT_STORAGE_KEY,\n this.arrayBufferToBase64(salt.buffer)\n );\n }\n\n /**\n * Inicializa desde un salt almacenado previamente\n */\n public async initializeFromStored(): Promise<void> {\n const storedSalt = localStorage.getItem(EncryptionHelper.SALT_STORAGE_KEY);\n\n if (!storedSalt) {\n // Si no hay salt almacenado, inicializar uno nuevo\n await this.initialize();\n return;\n }\n\n // Recuperar el salt\n const salt = new Uint8Array(this.base64ToArrayBuffer(storedSalt));\n\n // Obtener el baseKey\n const baseKey = await this.generateBaseKey();\n\n // Derivar la misma clave\n this.key = await this.deriveKey(baseKey, salt);\n }\n\n /**\n * Encripta un texto plano usando AES-256-GCM\n * @param plaintext - Texto a encriptar\n * @returns Texto encriptado en Base64 (IV + datos encriptados)\n */\n public async encrypt(plaintext: string): Promise<string> {\n if (!this.key) {\n await this.initializeFromStored();\n }\n\n if (!this.key) {\n throw new Error('No se pudo inicializar la clave de encriptación');\n }\n\n // Convertir texto a bytes\n const encoder = new TextEncoder();\n const data = encoder.encode(plaintext);\n\n // Generar IV aleatorio\n const iv = crypto.getRandomValues(new Uint8Array(EncryptionHelper.IV_LENGTH));\n\n // Encriptar\n const encryptedBuffer = await crypto.subtle.encrypt(\n {\n name: EncryptionHelper.ALGORITHM,\n iv,\n },\n this.key,\n data\n );\n\n // Combinar IV + datos encriptados\n const combined = new Uint8Array(iv.length + encryptedBuffer.byteLength);\n combined.set(iv, 0);\n combined.set(new Uint8Array(encryptedBuffer), iv.length);\n\n // Retornar en Base64\n return this.arrayBufferToBase64(combined.buffer);\n }\n\n /**\n * Desencripta un texto encriptado\n * @param ciphertext - Texto encriptado en Base64\n * @returns Texto plano\n */\n public async decrypt(ciphertext: string): Promise<string> {\n if (!this.key) {\n await this.initializeFromStored();\n }\n\n if (!this.key) {\n throw new Error('No se pudo inicializar la clave de encriptación');\n }\n\n try {\n // Decodificar de Base64\n const combined = new Uint8Array(this.base64ToArrayBuffer(ciphertext));\n\n // Extraer IV y datos encriptados\n const iv = combined.slice(0, EncryptionHelper.IV_LENGTH);\n const encryptedData = combined.slice(EncryptionHelper.IV_LENGTH);\n\n // Desencriptar\n const decryptedBuffer = await crypto.subtle.decrypt(\n {\n name: EncryptionHelper.ALGORITHM,\n iv,\n },\n this.key,\n encryptedData\n );\n\n // Convertir bytes a texto\n const decoder = new TextDecoder();\n return decoder.decode(decryptedBuffer);\n } catch (error) {\n throw new Error(`Error al desencriptar: ${error instanceof Error ? error.message : 'Error desconocido'}`);\n }\n }\n\n /**\n * Encripta el nombre de una clave para ofuscar nombres en localStorage\n * @param keyName - Nombre original de la clave\n * @returns Nombre encriptado con prefijo __enc_\n */\n public async encryptKey(keyName: string): Promise<string> {\n const baseKey = await this.generateBaseKey();\n const combined = keyName + baseKey;\n const hash = await this.hashString(combined);\n return `__enc_${hash.substring(0, 16)}`;\n }\n\n /**\n * Limpia todos los datos encriptados del localStorage\n */\n public clearEncryptedData(): void {\n const keysToRemove: string[] = [];\n\n // Identificar todas las claves encriptadas\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith('__enc_')) {\n keysToRemove.push(key);\n }\n }\n\n // Eliminar claves encriptadas\n keysToRemove.forEach(key => localStorage.removeItem(key));\n\n // Eliminar salt\n localStorage.removeItem(EncryptionHelper.SALT_STORAGE_KEY);\n\n // Resetear clave en memoria\n this.key = null;\n this.baseKey = '';\n this.baseKeyPromise = null;\n }\n\n /**\n * Verifica si el navegador soporta Web Crypto API\n */\n public static isSupported(): boolean {\n return !!(\n typeof crypto !== 'undefined' &&\n crypto.subtle &&\n crypto.getRandomValues\n );\n }\n\n // Métodos auxiliares para conversión de datos\n\n private arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n private base64ToArrayBuffer(base64: string): ArrayBuffer {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes.buffer;\n }\n\n private arrayBufferToHex(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n return Array.from(bytes)\n .map(b => b.toString(16).padStart(2, '0'))\n .join('');\n }\n}\n","import { EncryptionHelper } from './EncryptionHelper';\n\n/**\n * SecureStorage - API de alto nivel que imita localStorage con cifrado automático\n * Implementa el patrón Singleton\n */\nexport class SecureStorage {\n private static instance: SecureStorage | null = null;\n private encryptionHelper: EncryptionHelper;\n\n private constructor() {\n this.encryptionHelper = new EncryptionHelper();\n }\n\n /**\n * Obtiene la instancia singleton de SecureStorage\n */\n public static getInstance(): SecureStorage {\n if (!SecureStorage.instance) {\n SecureStorage.instance = new SecureStorage();\n }\n return SecureStorage.instance;\n }\n\n /**\n * Guarda un valor encriptado en localStorage\n * @param key - Clave para almacenar\n * @param value - Valor a encriptar y almacenar\n */\n public async setItem(key: string, value: string): Promise<void> {\n if (!EncryptionHelper.isSupported()) {\n console.warn('Web Crypto API no soportada, usando localStorage sin encriptar');\n localStorage.setItem(key, value);\n return;\n }\n\n try {\n // Encriptar el nombre de la clave\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n\n // Encriptar el valor\n const encryptedValue = await this.encryptionHelper.encrypt(value);\n\n // Guardar en localStorage\n localStorage.setItem(encryptedKey, encryptedValue);\n } catch (error) {\n console.error('Error al guardar dato encriptado, usando fallback:', error);\n localStorage.setItem(key, value);\n }\n }\n\n /**\n * Recupera y desencripta un valor de localStorage\n * @param key - Clave a buscar\n * @returns Valor desencriptado o null si no existe\n */\n public async getItem(key: string): Promise<string | null> {\n if (!EncryptionHelper.isSupported()) {\n return localStorage.getItem(key);\n }\n\n try {\n // Encriptar el nombre de la clave\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n\n // Buscar el valor encriptado\n let encryptedValue = localStorage.getItem(encryptedKey);\n\n // Retrocompatibilidad: si no existe con clave encriptada, buscar con clave normal\n if (!encryptedValue) {\n encryptedValue = localStorage.getItem(key);\n if (!encryptedValue) {\n return null;\n }\n // Si encontramos un valor con clave normal, intentar desencriptarlo\n // (podría ser un valor ya encriptado pero con clave antigua)\n }\n\n // Desencriptar el valor\n return await this.encryptionHelper.decrypt(encryptedValue);\n } catch (error) {\n console.error('Error al recuperar dato encriptado:', error);\n // Fallback: intentar leer directamente\n return localStorage.getItem(key);\n }\n }\n\n /**\n * Elimina un valor de localStorage\n * @param key - Clave a eliminar\n */\n public async removeItem(key: string): Promise<void> {\n if (!EncryptionHelper.isSupported()) {\n localStorage.removeItem(key);\n return;\n }\n\n try {\n // Encriptar el nombre de la clave\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n\n // Eliminar ambas versiones (encriptada y normal) por seguridad\n localStorage.removeItem(encryptedKey);\n localStorage.removeItem(key);\n } catch (error) {\n console.error('Error al eliminar dato encriptado:', error);\n localStorage.removeItem(key);\n }\n }\n\n /**\n * Verifica si existe un valor para la clave dada\n * @param key - Clave a verificar\n * @returns true si existe, false si no\n */\n public async hasItem(key: string): Promise<boolean> {\n const value = await this.getItem(key);\n return value !== null;\n }\n\n /**\n * Limpia todos los datos encriptados\n */\n public clear(): void {\n this.encryptionHelper.clearEncryptedData();\n }\n\n /**\n * Migra datos existentes no encriptados a formato encriptado\n * @param keys - Array de claves a migrar\n */\n public async migrateExistingData(keys: string[]): Promise<void> {\n if (!EncryptionHelper.isSupported()) {\n console.warn('Web Crypto API no soportada, no se puede migrar');\n return;\n }\n\n console.log(`🔄 Iniciando migración de ${keys.length} claves...`);\n\n for (const key of keys) {\n try {\n // Leer el valor no encriptado\n const value = localStorage.getItem(key);\n\n if (value === null) {\n continue; // La clave no existe, saltar\n }\n\n // Verificar si ya está encriptado intentando desencriptarlo\n try {\n await this.encryptionHelper.decrypt(value);\n console.log(`✓ ${key} ya está encriptado, saltando`);\n continue;\n } catch {\n // No está encriptado, proceder con la migración\n }\n\n // Guardar usando setItem (que encriptará automáticamente)\n await this.setItem(key, value);\n\n // Eliminar la versión no encriptada\n localStorage.removeItem(key);\n\n console.log(`✓ ${key} migrado exitosamente`);\n } catch (error) {\n console.error(`✗ Error al migrar ${key}:`, error);\n }\n }\n\n console.log('✅ Migración completada');\n }\n\n /**\n * Obtiene información de debug sobre el estado del almacenamiento\n */\n public getDebugInfo(): {\n cryptoSupported: boolean;\n encryptedKeys: string[];\n unencryptedKeys: string[];\n totalKeys: number;\n } {\n const allKeys: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key) allKeys.push(key);\n }\n\n const encryptedKeys = allKeys.filter(key => key.startsWith('__enc_'));\n const unencryptedKeys = allKeys.filter(\n key => !key.startsWith('__enc_') && key !== '__app_salt'\n );\n\n return {\n cryptoSupported: EncryptionHelper.isSupported(),\n encryptedKeys,\n unencryptedKeys,\n totalKeys: allKeys.length,\n };\n }\n}\n","import { useState, useEffect, useCallback } from 'react';\nimport { SecureStorage } from '../core/SecureStorage';\n\nconst secureStorage = SecureStorage.getInstance();\n\n/**\n * Hook de React para usar SecureStorage de forma reactiva\n * Similar a useState pero con persistencia encriptada\n * \n * @param key - Clave para almacenar en localStorage\n * @param initialValue - Valor inicial si no existe en storage\n * @returns [value, setValue, loading, error]\n * \n * @example\n * const [token, setToken, loading] = useSecureStorage('accessToken', '');\n */\nexport function useSecureStorage<T = string>(\n key: string,\n initialValue: T\n): [T, (value: T) => Promise<void>, boolean, Error | null] {\n const [storedValue, setStoredValue] = useState<T>(initialValue);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Cargar valor inicial\n useEffect(() => {\n const loadValue = async () => {\n try {\n setLoading(true);\n setError(null);\n const item = await secureStorage.getItem(key);\n\n if (item !== null) {\n // Si T es un objeto, parsear JSON\n if (typeof initialValue === 'object') {\n setStoredValue(JSON.parse(item) as T);\n } else {\n setStoredValue(item as T);\n }\n } else {\n setStoredValue(initialValue);\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al cargar valor'));\n setStoredValue(initialValue);\n } finally {\n setLoading(false);\n }\n };\n\n loadValue();\n }, [key]); // Solo recargar si cambia la clave\n\n // Función para actualizar el valor\n const setValue = useCallback(\n async (value: T) => {\n try {\n setError(null);\n setStoredValue(value);\n\n // Si T es un objeto, convertir a JSON\n const valueToStore = typeof value === 'object'\n ? JSON.stringify(value)\n : String(value);\n\n await secureStorage.setItem(key, valueToStore);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al guardar valor'));\n throw err;\n }\n },\n [key]\n );\n\n return [storedValue, setValue, loading, error];\n}\n\n/**\n * Hook para verificar si una clave existe en SecureStorage\n * \n * @param key - Clave a verificar\n * @returns [exists, loading, error]\n * \n * @example\n * const [hasToken, loading] = useSecureStorageItem('accessToken');\n */\nexport function useSecureStorageItem(\n key: string\n): [boolean, boolean, Error | null] {\n const [exists, setExists] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const checkExists = async () => {\n try {\n setLoading(true);\n setError(null);\n const hasItem = await secureStorage.hasItem(key);\n setExists(hasItem);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al verificar clave'));\n setExists(false);\n } finally {\n setLoading(false);\n }\n };\n\n checkExists();\n }, [key]);\n\n return [exists, loading, error];\n}\n\n/**\n * Hook para obtener información de debug del almacenamiento\n * \n * @returns Información de debug\n * \n * @example\n * const debugInfo = useSecureStorageDebug();\n * console.log(`Claves encriptadas: ${debugInfo.encryptedKeys.length}`);\n */\nexport function useSecureStorageDebug() {\n const [debugInfo, setDebugInfo] = useState(secureStorage.getDebugInfo());\n\n useEffect(() => {\n // Actualizar cada segundo\n const interval = setInterval(() => {\n setDebugInfo(secureStorage.getDebugInfo());\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n return debugInfo;\n}\n\n/**\n * Exportar la instancia de SecureStorage para uso directo\n */\nexport { secureStorage };\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable, from } from 'rxjs';\nimport { map, catchError } from 'rxjs/operators';\nimport { SecureStorage } from '../core/SecureStorage';\n\n/**\n * Servicio de Angular para SecureStorage\n * Proporciona una API reactiva usando RxJS Observables\n * \n * @example\n * constructor(private secureStorage: SecureStorageService) {}\n * \n * // Guardar\n * this.secureStorage.setItem('token', 'abc123').subscribe();\n * \n * // Leer\n * this.secureStorage.getItem('token').subscribe(token => console.log(token));\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class SecureStorageService {\n private storage: SecureStorage;\n private debugInfo$ = new BehaviorSubject(this.getDebugInfo());\n\n constructor() {\n this.storage = SecureStorage.getInstance();\n\n // Actualizar debug info cada segundo\n setInterval(() => {\n this.debugInfo$.next(this.getDebugInfo());\n }, 1000);\n }\n\n /**\n * Guarda un valor encriptado\n * @param key - Clave\n * @param value - Valor a guardar\n * @returns Observable que completa cuando se guarda\n */\n setItem(key: string, value: string): Observable<void> {\n return from(this.storage.setItem(key, value));\n }\n\n /**\n * Recupera un valor desencriptado\n * @param key - Clave\n * @returns Observable con el valor o null\n */\n getItem(key: string): Observable<string | null> {\n return from(this.storage.getItem(key));\n }\n\n /**\n * Elimina un valor\n * @param key - Clave a eliminar\n * @returns Observable que completa cuando se elimina\n */\n removeItem(key: string): Observable<void> {\n return from(this.storage.removeItem(key));\n }\n\n /**\n * Verifica si existe una clave\n * @param key - Clave a verificar\n * @returns Observable con true/false\n */\n hasItem(key: string): Observable<boolean> {\n return from(this.storage.hasItem(key));\n }\n\n /**\n * Limpia todos los datos encriptados\n */\n clear(): void {\n this.storage.clear();\n }\n\n /**\n * Migra datos existentes a formato encriptado\n * @param keys - Array de claves a migrar\n * @returns Observable que completa cuando termina la migración\n */\n migrateExistingData(keys: string[]): Observable<void> {\n return from(this.storage.migrateExistingData(keys));\n }\n\n /**\n * Obtiene información de debug como Observable\n * @returns Observable con información de debug que se actualiza automáticamente\n */\n getDebugInfo$(): Observable<{\n cryptoSupported: boolean;\n encryptedKeys: string[];\n unencryptedKeys: string[];\n totalKeys: number;\n }> {\n return this.debugInfo$.asObservable();\n }\n\n /**\n * Obtiene información de debug de forma síncrona\n */\n private getDebugInfo() {\n return this.storage.getDebugInfo();\n }\n\n /**\n * Helper para guardar objetos JSON\n * @param key - Clave\n * @param value - Objeto a guardar\n */\n setObject<T>(key: string, value: T): Observable<void> {\n return this.setItem(key, JSON.stringify(value));\n }\n\n /**\n * Helper para recuperar objetos JSON\n * @param key - Clave\n * @returns Observable con el objeto parseado o null\n */\n getObject<T>(key: string): Observable<T | null> {\n return this.getItem(key).pipe(\n map(value => value ? JSON.parse(value) as T : null),\n catchError(() => from([null]))\n );\n }\n}\n","import { EncryptionHelper } from '../core/EncryptionHelper';\nimport { SecureStorage } from '../core/SecureStorage';\n\nconst secureStorage = SecureStorage.getInstance();\n\n/**\n * Función de debug para verificar el estado del sistema de encriptación\n * Muestra información detallada en la consola\n */\nexport async function debugEncryptionState(): Promise<void> {\n console.group('🔐 Estado del Sistema de Encriptación');\n\n console.log('Soporte Crypto API:', EncryptionHelper.isSupported());\n\n // Obtener información de debug\n const debugInfo = secureStorage.getDebugInfo();\n\n console.log('Claves encriptadas:', debugInfo.encryptedKeys.length);\n console.log('Claves sin encriptar:', debugInfo.unencryptedKeys);\n console.log('Total de claves:', debugInfo.totalKeys);\n\n if (debugInfo.encryptedKeys.length > 0) {\n console.log('✅ Datos encriptados encontrados:');\n debugInfo.encryptedKeys.forEach(key => {\n const value = localStorage.getItem(key);\n console.log(` ${key}: ${value?.substring(0, 30)}...`);\n });\n } else {\n console.log('⚠️ No se encontraron datos encriptados');\n }\n\n if (debugInfo.unencryptedKeys.length > 0) {\n console.log('⚠️ Claves sin encriptar encontradas:');\n debugInfo.unencryptedKeys.forEach(key => {\n console.log(` ${key}`);\n });\n }\n\n console.groupEnd();\n}\n\n/**\n * Fuerza la migración de claves comunes a formato encriptado\n * Útil para desarrollo y testing\n */\nexport async function forceMigration(customKeys?: string[]): Promise<void> {\n const defaultKeys = [\n 'accessToken',\n 'refreshToken',\n 'user',\n 'sessionId',\n 'authToken',\n 'userData',\n ];\n\n const keysToMigrate = customKeys || defaultKeys;\n\n console.log(`🔄 Iniciando migración forzada de ${keysToMigrate.length} claves...`);\n\n await secureStorage.migrateExistingData(keysToMigrate);\n\n console.log('✅ Migración forzada completada');\n\n // Mostrar estado después de la migración\n await debugEncryptionState();\n}\n\n/**\n * Limpia todos los datos encriptados (útil para testing)\n */\nexport function clearAllEncryptedData(): void {\n console.log('🗑️ Limpiando todos los datos encriptados...');\n secureStorage.clear();\n console.log('✅ Datos encriptados limpiados');\n}\n\n/**\n * Prueba el sistema de encriptación con datos de ejemplo\n */\nexport async function testEncryption(): Promise<void> {\n console.group('🧪 Prueba del Sistema de Encriptación');\n\n try {\n const testKey = '__test_encryption_key';\n const testValue = 'Este es un valor de prueba con caracteres especiales: áéíóú ñ 你好 🔐';\n\n console.log('1. Guardando valor de prueba...');\n await secureStorage.setItem(testKey, testValue);\n console.log('✅ Valor guardado');\n\n console.log('2. Recuperando valor...');\n const retrieved = await secureStorage.getItem(testKey);\n console.log('✅ Valor recuperado:', retrieved);\n\n console.log('3. Verificando integridad...');\n if (retrieved === testValue) {\n console.log('✅ Integridad verificada - Los valores coinciden');\n } else {\n console.error('❌ Error de integridad - Los valores NO coinciden');\n console.log('Original:', testValue);\n console.log('Recuperado:', retrieved);\n }\n\n console.log('4. Limpiando valor de prueba...');\n await secureStorage.removeItem(testKey);\n console.log('✅ Valor eliminado');\n\n console.log('5. Verificando eliminación...');\n const shouldBeNull = await secureStorage.getItem(testKey);\n if (shouldBeNull === null) {\n console.log('✅ Eliminación verificada');\n } else {\n console.error('❌ El valor no fue eliminado correctamente');\n }\n\n console.log('\\n✅ Todas las pruebas pasaron exitosamente');\n } catch (error) {\n console.error('❌ Error en las pruebas:', error);\n }\n\n console.groupEnd();\n}\n","/**\n * @mtt/local-cipher\n * Librería de cifrado local AES-256-GCM para Angular, React y JavaScript\n * \n * @author MTT\n * @license MIT\n */\n\n// Core exports\nexport { EncryptionHelper } from './core/EncryptionHelper';\nexport { SecureStorage } from './core/SecureStorage';\n\n// React exports\nexport {\n useSecureStorage,\n useSecureStorageItem,\n useSecureStorageDebug,\n secureStorage as reactSecureStorage,\n} from './integrations/react';\n\n// Angular exports\nexport { SecureStorageService } from './integrations/angular';\n\n// Utility functions\nexport { debugEncryptionState, forceMigration } from './utils/debug';\n\n// Default instance for vanilla JS\nimport { SecureStorage } from './core/SecureStorage';\nexport const secureStorage = SecureStorage.getInstance();\n\n// Version\nexport const VERSION = '1.0.0';\n"],"names":["secureStorage"],"mappings":";;;;;AAAA;;;AAGG;MACU,gBAAgB,CAAA;AAA7B,IAAA,WAAA,GAAA;;QAYY,IAAA,CAAA,GAAG,GAAqB,IAAI;QAC5B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G,CAAC,gCAAgC,CAAC;;IAG7C,MAAM,oBAAoB,EAAE;AAChC;;ACjEA;;;;;;AAMG;AAEH;MAoBa,aAAa,GAAG,aAAa,CAAC,WAAW;AAEtD;AACO,MAAM,OAAO,GAAG;;;;","x_google_ignoreList":[3]}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/types/index.ts","../src/core/EncryptionHelper.ts","../src/core/EventEmitter.ts","../src/utils/logger.ts","../src/core/KeyRotation.ts","../src/core/NamespacedStorage.ts","../src/utils/compression.ts","../src/core/SecureStorage.ts","../src/utils/debug.ts","../src/integrations/react.ts","../node_modules/tslib/tslib.es6.js","../src/integrations/angular.ts","../src/index.ts"],"sourcesContent":["/**\n * Configuration types for @bantis/local-cipher\n */\n\n/**\n * Encryption configuration options\n */\nexport interface EncryptionConfig {\n /** Number of PBKDF2 iterations (default: 100000) */\n iterations?: number;\n /** Salt length in bytes (default: 16) */\n saltLength?: number;\n /** IV length in bytes (default: 12) */\n ivLength?: number;\n /** Custom app identifier for fingerprinting (default: 'bantis-local-cipher-v2') */\n appIdentifier?: string;\n /** AES key length in bits (default: 256) */\n keyLength?: 128 | 192 | 256;\n}\n\n/**\n * Storage configuration options\n */\nexport interface StorageConfig {\n /** Enable data compression (default: true for values > 1KB) */\n compression?: boolean;\n /** Compression threshold in bytes (default: 1024) */\n compressionThreshold?: number;\n /** Enable automatic cleanup of expired items (default: true) */\n autoCleanup?: boolean;\n /** Auto cleanup interval in ms (default: 60000 - 1 minute) */\n cleanupInterval?: number;\n}\n\n/**\n * Debug configuration options\n */\nexport interface DebugConfig {\n /** Enable debug mode (default: false) */\n enabled?: boolean;\n /** Log level (default: 'info') */\n logLevel?: LogLevel;\n /** Custom log prefix (default: 'SecureStorage') */\n prefix?: string;\n}\n\n/**\n * Log levels\n */\nexport type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug' | 'verbose';\n\n/**\n * Complete configuration for SecureStorage\n */\nexport interface SecureStorageConfig {\n /** Encryption configuration */\n encryption?: EncryptionConfig;\n /** Storage configuration */\n storage?: StorageConfig;\n /** Debug configuration */\n debug?: DebugConfig;\n}\n\n/**\n * Stored value with metadata\n */\nexport interface StoredValue {\n /** Encrypted value */\n value: string;\n /** Expiration timestamp (ms since epoch) */\n expiresAt?: number;\n /** Creation timestamp (ms since epoch) */\n createdAt: number;\n /** Last modified timestamp (ms since epoch) */\n modifiedAt: number;\n /** Data version for migration */\n version: number;\n /** Whether value is compressed */\n compressed?: boolean;\n /** SHA-256 checksum for integrity */\n checksum?: string;\n}\n\n/**\n * Options for setItemWithExpiry\n */\nexport interface ExpiryOptions {\n /** Expiration time in milliseconds from now */\n expiresIn?: number;\n /** Absolute expiration date */\n expiresAt?: Date;\n}\n\n/**\n * Encrypted backup structure\n */\nexport interface EncryptedBackup {\n /** Backup version */\n version: string;\n /** Backup timestamp */\n timestamp: number;\n /** Encrypted data */\n data: Record<string, string>;\n /** Backup metadata */\n metadata: {\n /** Key version used for encryption */\n keyVersion: number;\n /** Encryption algorithm */\n algorithm: string;\n /** Number of items */\n itemCount: number;\n };\n}\n\n/**\n * Integrity information\n */\nexport interface IntegrityInfo {\n /** Whether data is valid */\n valid: boolean;\n /** Last modified timestamp */\n lastModified: number;\n /** SHA-256 checksum */\n checksum: string;\n /** Data version */\n version: number;\n}\n\n/**\n * Storage event types\n */\nexport type StorageEventType =\n | 'encrypted'\n | 'decrypted'\n | 'deleted'\n | 'cleared'\n | 'expired'\n | 'error'\n | 'keyRotated'\n | 'compressed'\n | 'decompressed';\n\n/**\n * Storage event data\n */\nexport interface StorageEventData {\n /** Event type */\n type: StorageEventType;\n /** Key involved (if applicable) */\n key?: string;\n /** Event timestamp */\n timestamp: number;\n /** Additional metadata */\n metadata?: any;\n /** Error (if type is 'error') */\n error?: Error;\n}\n\n/**\n * Event listener function\n */\nexport type EventListener = (data: StorageEventData) => void;\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: Required<SecureStorageConfig> = {\n encryption: {\n iterations: 100000,\n saltLength: 16,\n ivLength: 12,\n appIdentifier: 'bantis-local-cipher-v2',\n keyLength: 256,\n },\n storage: {\n compression: true,\n compressionThreshold: 1024,\n autoCleanup: true,\n cleanupInterval: 60000,\n },\n debug: {\n enabled: false,\n logLevel: 'info',\n prefix: 'SecureStorage',\n },\n};\n\n/**\n * Current library version\n */\nexport const LIBRARY_VERSION = '2.0.0';\n\n/**\n * Storage data version\n */\nexport const STORAGE_VERSION = 2;\n","import type { EncryptionConfig } from '../types';\nimport { DEFAULT_CONFIG } from '../types';\n\n/**\n * EncryptionHelper - Clase responsable de todas las operaciones criptográficas\n * Implementa AES-256-GCM con derivación de claves PBKDF2 y fingerprinting del navegador\n */\nexport class EncryptionHelper {\n // Constantes criptográficas (ahora configurables)\n private static readonly ALGORITHM = 'AES-GCM';\n private static readonly HASH_ALGORITHM = 'SHA-256';\n private static readonly SALT_STORAGE_KEY = '__app_salt';\n private static readonly KEY_VERSION_KEY = '__key_version';\n\n // Configuración\n private readonly config: Required<EncryptionConfig>;\n\n // Propiedades privadas\n private key: CryptoKey | null = null;\n private baseKey: string = '';\n private baseKeyPromise: Promise<string> | null = null;\n private keyVersion: number = 1;\n\n constructor(config?: EncryptionConfig) {\n this.config = { ...DEFAULT_CONFIG.encryption, ...config } as Required<EncryptionConfig>;\n\n // Load key version from storage\n const storedVersion = localStorage.getItem(EncryptionHelper.KEY_VERSION_KEY);\n if (storedVersion) {\n this.keyVersion = parseInt(storedVersion, 10);\n }\n }\n\n /**\n * Get current key version\n */\n public getKeyVersion(): number {\n return this.keyVersion;\n }\n\n /**\n * Genera un fingerprint único del navegador\n * Combina múltiples características del navegador para crear una huella digital\n */\n private async generateBaseKey(): Promise<string> {\n if (this.baseKeyPromise) {\n return this.baseKeyPromise;\n }\n\n this.baseKeyPromise = (async () => {\n const components = [\n navigator.userAgent,\n navigator.language,\n screen.width.toString(),\n screen.height.toString(),\n screen.colorDepth.toString(),\n new Intl.DateTimeFormat().resolvedOptions().timeZone,\n this.config.appIdentifier,\n ];\n\n const fingerprint = components.join('|');\n this.baseKey = await this.hashString(fingerprint);\n return this.baseKey;\n })();\n\n return this.baseKeyPromise;\n }\n\n /**\n * Hashea un string usando SHA-256\n * @param str - String a hashear\n * @returns Hash hexadecimal\n */\n private async hashString(str: string): Promise<string> {\n const encoder = new TextEncoder();\n const data = encoder.encode(str);\n const hashBuffer = await crypto.subtle.digest(EncryptionHelper.HASH_ALGORITHM, data);\n return this.arrayBufferToHex(hashBuffer);\n }\n\n /**\n * Deriva una clave criptográfica usando PBKDF2\n * @param password - Password base (fingerprint)\n * @param salt - Salt aleatorio\n * @returns CryptoKey para AES-GCM\n */\n private async deriveKey(password: string, salt: Uint8Array): Promise<CryptoKey> {\n const encoder = new TextEncoder();\n const passwordBuffer = encoder.encode(password);\n\n // Importar el password como material de clave\n const keyMaterial = await crypto.subtle.importKey(\n 'raw',\n passwordBuffer,\n 'PBKDF2',\n false,\n ['deriveBits', 'deriveKey']\n );\n\n // Derivar la clave AES-GCM\n return crypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt,\n iterations: this.config.iterations,\n hash: EncryptionHelper.HASH_ALGORITHM,\n },\n keyMaterial,\n {\n name: EncryptionHelper.ALGORITHM,\n length: this.config.keyLength,\n },\n false,\n ['encrypt', 'decrypt']\n );\n }\n\n /**\n * Inicializa el sistema de encriptación generando un nuevo salt\n */\n public async initialize(): Promise<void> {\n // Generar salt aleatorio\n const salt = crypto.getRandomValues(new Uint8Array(this.config.saltLength));\n\n // Obtener y hashear el baseKey\n const baseKey = await this.generateBaseKey();\n\n // Derivar la clave\n this.key = await this.deriveKey(baseKey, salt);\n\n // Increment key version\n this.keyVersion++;\n localStorage.setItem(EncryptionHelper.KEY_VERSION_KEY, this.keyVersion.toString());\n\n // Guardar el salt en localStorage\n localStorage.setItem(\n EncryptionHelper.SALT_STORAGE_KEY,\n this.arrayBufferToBase64(salt.buffer)\n );\n }\n\n /**\n * Inicializa desde un salt almacenado previamente\n */\n public async initializeFromStored(): Promise<void> {\n const storedSalt = localStorage.getItem(EncryptionHelper.SALT_STORAGE_KEY);\n\n if (!storedSalt) {\n // Si no hay salt almacenado, inicializar uno nuevo\n await this.initialize();\n return;\n }\n\n // Recuperar el salt\n const salt = new Uint8Array(this.base64ToArrayBuffer(storedSalt));\n\n // Obtener el baseKey\n const baseKey = await this.generateBaseKey();\n\n // Derivar la misma clave\n this.key = await this.deriveKey(baseKey, salt);\n }\n\n /**\n * Encripta un texto plano usando AES-256-GCM\n * @param plaintext - Texto a encriptar\n * @returns Texto encriptado en Base64 (IV + datos encriptados)\n */\n public async encrypt(plaintext: string): Promise<string> {\n if (!this.key) {\n await this.initializeFromStored();\n }\n\n if (!this.key) {\n throw new Error('No se pudo inicializar la clave de encriptación');\n }\n\n // Convertir texto a bytes\n const encoder = new TextEncoder();\n const data = encoder.encode(plaintext);\n\n // Generar IV aleatorio\n const iv = crypto.getRandomValues(new Uint8Array(this.config.ivLength));\n\n // Encriptar\n const encryptedBuffer = await crypto.subtle.encrypt(\n {\n name: EncryptionHelper.ALGORITHM,\n iv,\n },\n this.key,\n data\n );\n\n // Combinar IV + datos encriptados\n const combined = new Uint8Array(iv.length + encryptedBuffer.byteLength);\n combined.set(iv, 0);\n combined.set(new Uint8Array(encryptedBuffer), iv.length);\n\n // Retornar en Base64\n return this.arrayBufferToBase64(combined.buffer);\n }\n\n /**\n * Desencripta un texto encriptado\n * @param ciphertext - Texto encriptado en Base64\n * @returns Texto plano\n */\n public async decrypt(ciphertext: string): Promise<string> {\n if (!this.key) {\n await this.initializeFromStored();\n }\n\n if (!this.key) {\n throw new Error('No se pudo inicializar la clave de encriptación');\n }\n\n try {\n // Decodificar de Base64\n const combined = new Uint8Array(this.base64ToArrayBuffer(ciphertext));\n\n // Extraer IV y datos encriptados\n const iv = combined.slice(0, this.config.ivLength);\n const encryptedData = combined.slice(this.config.ivLength);\n\n // Desencriptar\n const decryptedBuffer = await crypto.subtle.decrypt(\n {\n name: EncryptionHelper.ALGORITHM,\n iv,\n },\n this.key,\n encryptedData\n );\n\n // Convertir bytes a texto\n const decoder = new TextDecoder();\n return decoder.decode(decryptedBuffer);\n } catch (error) {\n throw new Error(`Error al desencriptar: ${error instanceof Error ? error.message : 'Error desconocido'}`);\n }\n }\n\n /**\n * Encripta el nombre de una clave para ofuscar nombres en localStorage\n * @param keyName - Nombre original de la clave\n * @returns Nombre encriptado con prefijo __enc_\n */\n public async encryptKey(keyName: string): Promise<string> {\n const baseKey = await this.generateBaseKey();\n const combined = keyName + baseKey;\n const hash = await this.hashString(combined);\n return `__enc_${hash.substring(0, 16)}`;\n }\n\n /**\n * Limpia todos los datos encriptados del localStorage\n */\n public clearEncryptedData(): void {\n const keysToRemove: string[] = [];\n\n // Identificar todas las claves encriptadas\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith('__enc_')) {\n keysToRemove.push(key);\n }\n }\n\n // Eliminar claves encriptadas\n keysToRemove.forEach(key => localStorage.removeItem(key));\n\n // Eliminar salt\n localStorage.removeItem(EncryptionHelper.SALT_STORAGE_KEY);\n\n // Resetear clave en memoria\n this.key = null;\n this.baseKey = '';\n this.baseKeyPromise = null;\n }\n\n /**\n * Verifica si el navegador soporta Web Crypto API\n */\n public static isSupported(): boolean {\n return !!(\n typeof crypto !== 'undefined' &&\n crypto.subtle &&\n crypto.getRandomValues\n );\n }\n\n // Métodos auxiliares para conversión de datos\n\n private arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n private base64ToArrayBuffer(base64: string): ArrayBuffer {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes.buffer;\n }\n\n private arrayBufferToHex(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n return Array.from(bytes)\n .map(b => b.toString(16).padStart(2, '0'))\n .join('');\n }\n}\n","import type { StorageEventType, StorageEventData, EventListener } from '../types';\n\n/**\n * Simple event emitter for storage events\n */\nexport class EventEmitter {\n private listeners: Map<StorageEventType, Set<EventListener>> = new Map();\n private onceListeners: Map<StorageEventType, Set<EventListener>> = new Map();\n\n /**\n * Register an event listener\n */\n on(event: StorageEventType, listener: EventListener): void {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event)!.add(listener);\n }\n\n /**\n * Register a one-time event listener\n */\n once(event: StorageEventType, listener: EventListener): void {\n if (!this.onceListeners.has(event)) {\n this.onceListeners.set(event, new Set());\n }\n this.onceListeners.get(event)!.add(listener);\n }\n\n /**\n * Remove an event listener\n */\n off(event: StorageEventType, listener: EventListener): void {\n this.listeners.get(event)?.delete(listener);\n this.onceListeners.get(event)?.delete(listener);\n }\n\n /**\n * Remove all listeners for an event\n */\n removeAllListeners(event?: StorageEventType): void {\n if (event) {\n this.listeners.delete(event);\n this.onceListeners.delete(event);\n } else {\n this.listeners.clear();\n this.onceListeners.clear();\n }\n }\n\n /**\n * Emit an event\n */\n emit(event: StorageEventType, data: Omit<StorageEventData, 'type' | 'timestamp'>): void {\n const eventData: StorageEventData = {\n type: event,\n timestamp: Date.now(),\n ...data,\n };\n\n // Call regular listeners\n this.listeners.get(event)?.forEach(listener => {\n try {\n listener(eventData);\n } catch (error) {\n console.error(`Error in event listener for ${event}:`, error);\n }\n });\n\n // Call and remove once listeners\n const onceSet = this.onceListeners.get(event);\n if (onceSet) {\n onceSet.forEach(listener => {\n try {\n listener(eventData);\n } catch (error) {\n console.error(`Error in once listener for ${event}:`, error);\n }\n });\n this.onceListeners.delete(event);\n }\n }\n\n /**\n * Get listener count for an event\n */\n listenerCount(event: StorageEventType): number {\n const regularCount = this.listeners.get(event)?.size ?? 0;\n const onceCount = this.onceListeners.get(event)?.size ?? 0;\n return regularCount + onceCount;\n }\n\n /**\n * Get all event types with listeners\n */\n eventNames(): StorageEventType[] {\n const events = new Set<StorageEventType>();\n this.listeners.forEach((_, event) => events.add(event));\n this.onceListeners.forEach((_, event) => events.add(event));\n return Array.from(events);\n }\n}\n","import type { LogLevel, DebugConfig } from '../types';\n\n/**\n * Logger utility for debug mode\n */\nexport class Logger {\n private enabled: boolean;\n private logLevel: LogLevel;\n private prefix: string;\n\n private static readonly LOG_LEVELS: Record<LogLevel, number> = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n verbose: 5,\n };\n\n constructor(config: DebugConfig = {}) {\n this.enabled = config.enabled ?? false;\n this.logLevel = config.logLevel ?? 'info';\n this.prefix = config.prefix ?? 'SecureStorage';\n }\n\n private shouldLog(level: LogLevel): boolean {\n if (!this.enabled) return false;\n return Logger.LOG_LEVELS[level] <= Logger.LOG_LEVELS[this.logLevel];\n }\n\n private formatMessage(level: string, message: string, ...args: any[]): string {\n const timestamp = new Date().toISOString();\n return `[${this.prefix}] [${level.toUpperCase()}] ${timestamp} - ${message}`;\n }\n\n error(message: string, ...args: any[]): void {\n if (this.shouldLog('error')) {\n console.error(this.formatMessage('error', message), ...args);\n }\n }\n\n warn(message: string, ...args: any[]): void {\n if (this.shouldLog('warn')) {\n console.warn(this.formatMessage('warn', message), ...args);\n }\n }\n\n info(message: string, ...args: any[]): void {\n if (this.shouldLog('info')) {\n console.info(this.formatMessage('info', message), ...args);\n }\n }\n\n debug(message: string, ...args: any[]): void {\n if (this.shouldLog('debug')) {\n console.debug(this.formatMessage('debug', message), ...args);\n }\n }\n\n verbose(message: string, ...args: any[]): void {\n if (this.shouldLog('verbose')) {\n console.log(this.formatMessage('verbose', message), ...args);\n }\n }\n\n time(label: string): void {\n if (this.enabled && this.shouldLog('debug')) {\n console.time(`[${this.prefix}] ${label}`);\n }\n }\n\n timeEnd(label: string): void {\n if (this.enabled && this.shouldLog('debug')) {\n console.timeEnd(`[${this.prefix}] ${label}`);\n }\n }\n\n group(label: string): void {\n if (this.enabled && this.shouldLog('debug')) {\n console.group(`[${this.prefix}] ${label}`);\n }\n }\n\n groupEnd(): void {\n if (this.enabled && this.shouldLog('debug')) {\n console.groupEnd();\n }\n }\n}\n","import { EncryptionHelper } from './EncryptionHelper';\nimport type { EncryptedBackup } from '../types';\nimport { Logger } from '../utils/logger';\n\n/**\n * Key rotation utilities\n */\nexport class KeyRotation {\n private encryptionHelper: EncryptionHelper;\n private logger: Logger;\n\n constructor(encryptionHelper: EncryptionHelper, logger?: Logger) {\n this.encryptionHelper = encryptionHelper;\n this.logger = logger ?? new Logger();\n }\n\n /**\n * Rotate all encryption keys\n * Re-encrypts all data with a new salt\n */\n async rotateKeys(): Promise<void> {\n this.logger.info('Starting key rotation...');\n\n // 1. Export all current data\n const backup = await this.exportEncryptedData();\n\n // 2. Clear old encryption\n this.encryptionHelper.clearEncryptedData();\n\n // 3. Initialize new encryption\n await this.encryptionHelper.initialize();\n\n // 4. Re-encrypt all data\n for (const [key, value] of Object.entries(backup.data)) {\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n const encryptedValue = await this.encryptionHelper.encrypt(value);\n localStorage.setItem(encryptedKey, encryptedValue);\n }\n\n this.logger.info(`Key rotation completed. Re-encrypted ${backup.metadata.itemCount} items`);\n }\n\n /**\n * Export all encrypted data as backup\n */\n async exportEncryptedData(): Promise<EncryptedBackup> {\n this.logger.info('Exporting encrypted data...');\n const data: Record<string, string> = {};\n let itemCount = 0;\n\n for (let i = 0; i < localStorage.length; i++) {\n const encryptedKey = localStorage.key(i);\n if (encryptedKey && encryptedKey.startsWith('__enc_')) {\n const encryptedValue = localStorage.getItem(encryptedKey);\n if (encryptedValue) {\n try {\n // Decrypt to get original key and value\n const decryptedValue = await this.encryptionHelper.decrypt(encryptedValue);\n // Store with encrypted key as identifier\n data[encryptedKey] = decryptedValue;\n itemCount++;\n } catch (error) {\n this.logger.warn(`Failed to decrypt key ${encryptedKey}:`, error);\n }\n }\n }\n }\n\n const backup: EncryptedBackup = {\n version: '2.0.0',\n timestamp: Date.now(),\n data,\n metadata: {\n keyVersion: this.encryptionHelper.getKeyVersion(),\n algorithm: 'AES-256-GCM',\n itemCount,\n },\n };\n\n this.logger.info(`Exported ${itemCount} items`);\n return backup;\n }\n\n /**\n * Import encrypted data from backup\n */\n async importEncryptedData(backup: EncryptedBackup): Promise<void> {\n this.logger.info(`Importing backup from ${new Date(backup.timestamp).toISOString()}...`);\n\n let imported = 0;\n for (const [encryptedKey, value] of Object.entries(backup.data)) {\n try {\n const encryptedValue = await this.encryptionHelper.encrypt(value);\n localStorage.setItem(encryptedKey, encryptedValue);\n imported++;\n } catch (error) {\n this.logger.error(`Failed to import key ${encryptedKey}:`, error);\n }\n }\n\n this.logger.info(`Imported ${imported}/${backup.metadata.itemCount} items`);\n }\n}\n","import type { SecureStorageConfig } from '../types';\n\n/**\n * Namespaced storage for organizing data\n */\nexport class NamespacedStorage {\n private prefix: string;\n private storage: any; // Reference to parent SecureStorage\n\n constructor(storage: any, namespace: string) {\n this.storage = storage;\n this.prefix = `__ns_${namespace}__`;\n }\n\n /**\n * Set item in this namespace\n */\n async setItem(key: string, value: string): Promise<void> {\n return this.storage.setItem(`${this.prefix}${key}`, value);\n }\n\n /**\n * Set item with expiry in this namespace\n */\n async setItemWithExpiry(key: string, value: string, options: { expiresIn?: number; expiresAt?: Date }): Promise<void> {\n return this.storage.setItemWithExpiry(`${this.prefix}${key}`, value, options);\n }\n\n /**\n * Get item from this namespace\n */\n async getItem(key: string): Promise<string | null> {\n return this.storage.getItem(`${this.prefix}${key}`);\n }\n\n /**\n * Remove item from this namespace\n */\n async removeItem(key: string): Promise<void> {\n return this.storage.removeItem(`${this.prefix}${key}`);\n }\n\n /**\n * Check if item exists in this namespace\n */\n async hasItem(key: string): Promise<boolean> {\n return this.storage.hasItem(`${this.prefix}${key}`);\n }\n\n /**\n * Clear all items in this namespace\n */\n async clearNamespace(): Promise<void> {\n const keysToRemove: string[] = [];\n\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.includes(this.prefix)) {\n keysToRemove.push(key.replace(this.prefix, ''));\n }\n }\n\n for (const key of keysToRemove) {\n await this.removeItem(key);\n }\n }\n\n /**\n * Get all keys in this namespace\n */\n async keys(): Promise<string[]> {\n const keys: string[] = [];\n\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.includes(this.prefix)) {\n keys.push(key.replace(this.prefix, ''));\n }\n }\n\n return keys;\n }\n}\n","/**\n * Compression utilities using CompressionStream API\n */\n\n/**\n * Check if compression is supported\n */\nexport function isCompressionSupported(): boolean {\n return typeof CompressionStream !== 'undefined' && typeof DecompressionStream !== 'undefined';\n}\n\n/**\n * Compress a string using gzip\n */\nexport async function compress(data: string): Promise<Uint8Array> {\n if (!isCompressionSupported()) {\n // Fallback: return uncompressed data with marker\n const encoder = new TextEncoder();\n return encoder.encode(data);\n }\n\n try {\n const encoder = new TextEncoder();\n const stream = new Blob([data]).stream();\n const compressedStream = stream.pipeThrough(new CompressionStream('gzip'));\n const compressedBlob = await new Response(compressedStream).blob();\n const buffer = await compressedBlob.arrayBuffer();\n return new Uint8Array(buffer);\n } catch (error) {\n console.warn('Compression failed, returning uncompressed data:', error);\n const encoder = new TextEncoder();\n return encoder.encode(data);\n }\n}\n\n/**\n * Decompress gzip data to string\n */\nexport async function decompress(data: Uint8Array): Promise<string> {\n if (!isCompressionSupported()) {\n // Fallback: assume uncompressed\n const decoder = new TextDecoder();\n return decoder.decode(data);\n }\n\n try {\n const stream = new Blob([data]).stream();\n const decompressedStream = stream.pipeThrough(new DecompressionStream('gzip'));\n const decompressedBlob = await new Response(decompressedStream).blob();\n return await decompressedBlob.text();\n } catch (error) {\n // If decompression fails, try to decode as plain text\n console.warn('Decompression failed, trying plain text:', error);\n const decoder = new TextDecoder();\n return decoder.decode(data);\n }\n}\n\n/**\n * Check if data should be compressed based on size\n */\nexport function shouldCompress(data: string, threshold: number = 1024): boolean {\n return data.length >= threshold;\n}\n\n/**\n * Get compression ratio\n */\nexport function getCompressionRatio(original: number, compressed: number): number {\n return compressed / original;\n}\n","import { EncryptionHelper } from './EncryptionHelper';\nimport { EventEmitter } from './EventEmitter';\nimport { KeyRotation } from './KeyRotation';\nimport { NamespacedStorage } from './NamespacedStorage';\nimport { Logger } from '../utils/logger';\nimport { compress, decompress, shouldCompress } from '../utils/compression';\nimport type {\n SecureStorageConfig,\n StoredValue,\n ExpiryOptions,\n IntegrityInfo,\n StorageEventType,\n EventListener,\n} from '../types';\nimport { DEFAULT_CONFIG, STORAGE_VERSION } from '../types';\n\n/**\n * SecureStorage v2 - API de alto nivel que imita localStorage con cifrado automático\n * Incluye: configuración personalizable, eventos, compresión, expiración, namespaces, rotación de claves\n */\nexport class SecureStorage {\n private static instance: SecureStorage | null = null;\n private encryptionHelper: EncryptionHelper;\n private eventEmitter: EventEmitter;\n private keyRotation: KeyRotation;\n private logger: Logger;\n private config: Required<SecureStorageConfig>;\n private cleanupInterval: NodeJS.Timeout | null = null;\n\n private constructor(config?: SecureStorageConfig) {\n // Merge config with defaults\n this.config = {\n encryption: { ...DEFAULT_CONFIG.encryption, ...config?.encryption },\n storage: { ...DEFAULT_CONFIG.storage, ...config?.storage },\n debug: { ...DEFAULT_CONFIG.debug, ...config?.debug },\n } as Required<SecureStorageConfig>;\n\n // Initialize components\n this.logger = new Logger(this.config.debug);\n this.encryptionHelper = new EncryptionHelper(this.config.encryption);\n this.eventEmitter = new EventEmitter();\n this.keyRotation = new KeyRotation(this.encryptionHelper, this.logger);\n\n this.logger.info('SecureStorage v2 initialized', this.config);\n\n // Setup auto-cleanup if enabled\n if (this.config.storage.autoCleanup) {\n this.setupAutoCleanup();\n }\n }\n\n /**\n * Obtiene la instancia singleton de SecureStorage\n */\n public static getInstance(config?: SecureStorageConfig): SecureStorage {\n if (!SecureStorage.instance) {\n SecureStorage.instance = new SecureStorage(config);\n }\n return SecureStorage.instance;\n }\n\n /**\n * Setup automatic cleanup of expired items\n */\n private setupAutoCleanup(): void {\n if (this.cleanupInterval) {\n clearInterval(this.cleanupInterval);\n }\n\n this.cleanupInterval = setInterval(() => {\n this.cleanExpired().catch(err => {\n this.logger.error('Auto-cleanup failed:', err);\n });\n }, this.config.storage.cleanupInterval);\n\n this.logger.debug(`Auto-cleanup enabled with interval: ${this.config.storage.cleanupInterval}ms`);\n }\n\n /**\n * Guarda un valor encriptado en localStorage\n */\n public async setItem(key: string, value: string): Promise<void> {\n this.logger.time(`setItem:${key}`);\n\n if (!EncryptionHelper.isSupported()) {\n this.logger.warn('Web Crypto API no soportada, usando localStorage sin encriptar');\n localStorage.setItem(key, value);\n return;\n }\n\n try {\n // Check if compression should be applied\n const shouldCompressData = this.config.storage.compression &&\n shouldCompress(value, this.config.storage.compressionThreshold);\n\n let processedValue = value;\n let compressed = false;\n\n if (shouldCompressData) {\n this.logger.debug(`Compressing value for key: ${key}`);\n const compressedData = await compress(value);\n processedValue = this.encryptionHelper['arrayBufferToBase64'](compressedData.buffer);\n compressed = true;\n this.eventEmitter.emit('compressed', { key });\n }\n\n // Create StoredValue wrapper\n const now = Date.now();\n const storedValue: StoredValue = {\n value: processedValue,\n createdAt: now,\n modifiedAt: now,\n version: STORAGE_VERSION,\n compressed,\n };\n\n // Calculate checksum for integrity\n const checksum = await this.calculateChecksum(processedValue);\n storedValue.checksum = checksum;\n\n // Serialize StoredValue\n const serialized = JSON.stringify(storedValue);\n\n // Encrypt the key\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n\n // Encrypt the value\n const encryptedValue = await this.encryptionHelper.encrypt(serialized);\n\n // Store in localStorage\n localStorage.setItem(encryptedKey, encryptedValue);\n\n this.logger.verbose(`Stored key: ${key}, compressed: ${compressed}, size: ${encryptedValue.length}`);\n this.eventEmitter.emit('encrypted', { key, metadata: { compressed, size: encryptedValue.length } });\n this.logger.timeEnd(`setItem:${key}`);\n } catch (error) {\n this.logger.error(`Error al guardar dato encriptado para ${key}:`, error);\n this.eventEmitter.emit('error', { key, error: error as Error });\n localStorage.setItem(key, value);\n }\n }\n\n /**\n * Guarda un valor con tiempo de expiración\n */\n public async setItemWithExpiry(key: string, value: string, options: ExpiryOptions): Promise<void> {\n this.logger.time(`setItemWithExpiry:${key}`);\n\n if (!EncryptionHelper.isSupported()) {\n this.logger.warn('Web Crypto API no soportada, usando localStorage sin encriptar');\n localStorage.setItem(key, value);\n return;\n }\n\n try {\n // Check if compression should be applied\n const shouldCompressData = this.config.storage.compression &&\n shouldCompress(value, this.config.storage.compressionThreshold);\n\n let processedValue = value;\n let compressed = false;\n\n if (shouldCompressData) {\n this.logger.debug(`Compressing value for key: ${key}`);\n const compressedData = await compress(value);\n processedValue = this.encryptionHelper['arrayBufferToBase64'](compressedData.buffer);\n compressed = true;\n this.eventEmitter.emit('compressed', { key });\n }\n\n // Calculate expiration timestamp\n let expiresAt: number | undefined;\n if (options.expiresIn) {\n expiresAt = Date.now() + options.expiresIn;\n } else if (options.expiresAt) {\n expiresAt = options.expiresAt.getTime();\n }\n\n // Create StoredValue wrapper\n const now = Date.now();\n const storedValue: StoredValue = {\n value: processedValue,\n createdAt: now,\n modifiedAt: now,\n version: STORAGE_VERSION,\n compressed,\n expiresAt,\n };\n\n // Calculate checksum for integrity\n const checksum = await this.calculateChecksum(processedValue);\n storedValue.checksum = checksum;\n\n // Serialize StoredValue\n const serialized = JSON.stringify(storedValue);\n\n // Encrypt the key\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n\n // Encrypt the value\n const encryptedValue = await this.encryptionHelper.encrypt(serialized);\n\n // Store in localStorage\n localStorage.setItem(encryptedKey, encryptedValue);\n\n this.logger.verbose(`Stored key with expiry: ${key}, expiresAt: ${expiresAt}`);\n this.eventEmitter.emit('encrypted', { key, metadata: { compressed, expiresAt } });\n this.logger.timeEnd(`setItemWithExpiry:${key}`);\n } catch (error) {\n this.logger.error(`Error al guardar dato con expiración para ${key}:`, error);\n this.eventEmitter.emit('error', { key, error: error as Error });\n throw error;\n }\n }\n\n /**\n * Recupera y desencripta un valor de localStorage\n */\n public async getItem(key: string): Promise<string | null> {\n this.logger.time(`getItem:${key}`);\n\n if (!EncryptionHelper.isSupported()) {\n return localStorage.getItem(key);\n }\n\n try {\n // Encrypt the key\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n\n // Get encrypted value\n let encryptedValue = localStorage.getItem(encryptedKey);\n\n // Backward compatibility: try with plain key\n if (!encryptedValue) {\n encryptedValue = localStorage.getItem(key);\n if (!encryptedValue) {\n this.logger.timeEnd(`getItem:${key}`);\n return null;\n }\n }\n\n // Decrypt the value\n const decrypted = await this.encryptionHelper.decrypt(encryptedValue);\n\n // Try to parse as StoredValue (v2 format)\n let storedValue: StoredValue;\n try {\n storedValue = JSON.parse(decrypted);\n\n // Validate it's a StoredValue object\n if (!storedValue.value || !storedValue.version) {\n // It's v1 format (plain string), auto-migrate\n this.logger.info(`Auto-migrating v1 data for key: ${key}`);\n await this.setItem(key, decrypted);\n this.logger.timeEnd(`getItem:${key}`);\n return decrypted;\n }\n } catch {\n // Not JSON, it's v1 format (plain string), auto-migrate\n this.logger.info(`Auto-migrating v1 data for key: ${key}`);\n await this.setItem(key, decrypted);\n this.logger.timeEnd(`getItem:${key}`);\n return decrypted;\n }\n\n // Check expiration\n if (storedValue.expiresAt && storedValue.expiresAt < Date.now()) {\n this.logger.info(`Key expired: ${key}`);\n await this.removeItem(key);\n this.eventEmitter.emit('expired', { key });\n this.logger.timeEnd(`getItem:${key}`);\n return null;\n }\n\n // Verify integrity if checksum exists\n if (storedValue.checksum) {\n const calculatedChecksum = await this.calculateChecksum(storedValue.value);\n if (calculatedChecksum !== storedValue.checksum) {\n this.logger.warn(`Integrity check failed for key: ${key}`);\n this.eventEmitter.emit('error', {\n key,\n error: new Error('Integrity verification failed')\n });\n }\n }\n\n // Decompress if needed\n let finalValue = storedValue.value;\n if (storedValue.compressed) {\n this.logger.debug(`Decompressing value for key: ${key}`);\n const compressedData = this.encryptionHelper['base64ToArrayBuffer'](storedValue.value);\n finalValue = await decompress(new Uint8Array(compressedData));\n this.eventEmitter.emit('decompressed', { key });\n }\n\n this.eventEmitter.emit('decrypted', { key });\n this.logger.timeEnd(`getItem:${key}`);\n return finalValue;\n } catch (error) {\n this.logger.error(`Error al recuperar dato encriptado para ${key}:`, error);\n this.eventEmitter.emit('error', { key, error: error as Error });\n // Fallback: try plain key\n const fallback = localStorage.getItem(key);\n this.logger.timeEnd(`getItem:${key}`);\n return fallback;\n }\n }\n\n /**\n * Elimina un valor de localStorage\n */\n public async removeItem(key: string): Promise<void> {\n if (!EncryptionHelper.isSupported()) {\n localStorage.removeItem(key);\n return;\n }\n\n try {\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n localStorage.removeItem(encryptedKey);\n localStorage.removeItem(key); // Remove both versions\n this.eventEmitter.emit('deleted', { key });\n this.logger.info(`Removed key: ${key}`);\n } catch (error) {\n this.logger.error(`Error al eliminar dato para ${key}:`, error);\n localStorage.removeItem(key);\n }\n }\n\n /**\n * Verifica si existe un valor para la clave dada\n */\n public async hasItem(key: string): Promise<boolean> {\n const value = await this.getItem(key);\n return value !== null;\n }\n\n /**\n * Limpia todos los datos encriptados\n */\n public clear(): void {\n this.encryptionHelper.clearEncryptedData();\n this.eventEmitter.emit('cleared', {});\n this.logger.info('All encrypted data cleared');\n }\n\n /**\n * Limpia todos los items expirados\n */\n public async cleanExpired(): Promise<number> {\n this.logger.info('Starting cleanup of expired items...');\n let cleanedCount = 0;\n\n const keysToCheck: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith('__enc_')) {\n keysToCheck.push(key);\n }\n }\n\n for (const encryptedKey of keysToCheck) {\n try {\n const encryptedValue = localStorage.getItem(encryptedKey);\n if (!encryptedValue) continue;\n\n const decrypted = await this.encryptionHelper.decrypt(encryptedValue);\n const storedValue: StoredValue = JSON.parse(decrypted);\n\n if (storedValue.expiresAt && storedValue.expiresAt < Date.now()) {\n localStorage.removeItem(encryptedKey);\n cleanedCount++;\n this.eventEmitter.emit('expired', { key: encryptedKey });\n }\n } catch (error) {\n this.logger.warn(`Failed to check expiration for ${encryptedKey}:`, error);\n }\n }\n\n this.logger.info(`Cleanup completed. Removed ${cleanedCount} expired items`);\n return cleanedCount;\n }\n\n /**\n * Verifica la integridad de un valor almacenado\n */\n public async verifyIntegrity(key: string): Promise<boolean> {\n try {\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n const encryptedValue = localStorage.getItem(encryptedKey);\n\n if (!encryptedValue) return false;\n\n const decrypted = await this.encryptionHelper.decrypt(encryptedValue);\n const storedValue: StoredValue = JSON.parse(decrypted);\n\n if (!storedValue.checksum) {\n this.logger.warn(`No checksum found for key: ${key}`);\n return true; // No checksum to verify\n }\n\n const calculatedChecksum = await this.calculateChecksum(storedValue.value);\n return calculatedChecksum === storedValue.checksum;\n } catch (error) {\n this.logger.error(`Error verifying integrity for ${key}:`, error);\n return false;\n }\n }\n\n /**\n * Obtiene información de integridad de un valor\n */\n public async getIntegrityInfo(key: string): Promise<IntegrityInfo | null> {\n try {\n const encryptedKey = await this.encryptionHelper.encryptKey(key);\n const encryptedValue = localStorage.getItem(encryptedKey);\n\n if (!encryptedValue) return null;\n\n const decrypted = await this.encryptionHelper.decrypt(encryptedValue);\n const storedValue: StoredValue = JSON.parse(decrypted);\n\n const valid = storedValue.checksum\n ? await this.calculateChecksum(storedValue.value) === storedValue.checksum\n : true;\n\n return {\n valid,\n lastModified: storedValue.modifiedAt,\n checksum: storedValue.checksum || '',\n version: storedValue.version,\n };\n } catch (error) {\n this.logger.error(`Error getting integrity info for ${key}:`, error);\n return null;\n }\n }\n\n /**\n * Crea un namespace para organizar datos\n */\n public namespace(name: string): NamespacedStorage {\n this.logger.debug(`Creating namespace: ${name}`);\n return new NamespacedStorage(this, name);\n }\n\n /**\n * Rota todas las claves de encriptación\n */\n public async rotateKeys(): Promise<void> {\n this.logger.info('Starting key rotation...');\n await this.keyRotation.rotateKeys();\n this.eventEmitter.emit('keyRotated', {});\n this.logger.info('Key rotation completed');\n }\n\n /**\n * Exporta todos los datos encriptados como backup\n */\n public async exportEncryptedData() {\n return this.keyRotation.exportEncryptedData();\n }\n\n /**\n * Importa datos desde un backup\n */\n public async importEncryptedData(backup: any) {\n return this.keyRotation.importEncryptedData(backup);\n }\n\n /**\n * Registra un listener de eventos\n */\n public on(event: StorageEventType, listener: EventListener): void {\n this.eventEmitter.on(event, listener);\n }\n\n /**\n * Registra un listener de un solo uso\n */\n public once(event: StorageEventType, listener: EventListener): void {\n this.eventEmitter.once(event, listener);\n }\n\n /**\n * Elimina un listener de eventos\n */\n public off(event: StorageEventType, listener: EventListener): void {\n this.eventEmitter.off(event, listener);\n }\n\n /**\n * Elimina todos los listeners de un evento\n */\n public removeAllListeners(event?: StorageEventType): void {\n this.eventEmitter.removeAllListeners(event);\n }\n\n /**\n * Migra datos existentes no encriptados a formato encriptado\n */\n public async migrateExistingData(keys: string[]): Promise<void> {\n if (!EncryptionHelper.isSupported()) {\n this.logger.warn('Web Crypto API no soportada, no se puede migrar');\n return;\n }\n\n this.logger.info(`Iniciando migración de ${keys.length} claves...`);\n\n for (const key of keys) {\n try {\n const value = localStorage.getItem(key);\n if (value === null) continue;\n\n // Try to decrypt to check if already encrypted\n try {\n await this.encryptionHelper.decrypt(value);\n this.logger.info(`✓ ${key} ya está encriptado, saltando`);\n continue;\n } catch {\n // Not encrypted, proceed with migration\n }\n\n await this.setItem(key, value);\n localStorage.removeItem(key);\n this.logger.info(`✓ ${key} migrado exitosamente`);\n } catch (error) {\n this.logger.error(`✗ Error al migrar ${key}:`, error);\n }\n }\n\n this.logger.info('✅ Migración completada');\n }\n\n /**\n * Obtiene información de debug sobre el estado del almacenamiento\n */\n public getDebugInfo(): {\n cryptoSupported: boolean;\n encryptedKeys: string[];\n unencryptedKeys: string[];\n totalKeys: number;\n config: Required<SecureStorageConfig>;\n } {\n const allKeys: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key) allKeys.push(key);\n }\n\n const encryptedKeys = allKeys.filter(key => key.startsWith('__enc_'));\n const unencryptedKeys = allKeys.filter(\n key => !key.startsWith('__enc_') && key !== '__app_salt' && key !== '__key_version'\n );\n\n return {\n cryptoSupported: EncryptionHelper.isSupported(),\n encryptedKeys,\n unencryptedKeys,\n totalKeys: allKeys.length,\n config: this.config,\n };\n }\n\n /**\n * Calcula el checksum SHA-256 de un valor\n */\n private async calculateChecksum(value: string): Promise<string> {\n const encoder = new TextEncoder();\n const data = encoder.encode(value);\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n }\n\n /**\n * Cleanup on destroy\n */\n public destroy(): void {\n if (this.cleanupInterval) {\n clearInterval(this.cleanupInterval);\n this.cleanupInterval = null;\n }\n this.removeAllListeners();\n this.logger.info('SecureStorage destroyed');\n }\n}\n","import { EncryptionHelper } from '../core/EncryptionHelper';\nimport { SecureStorage } from '../core/SecureStorage';\n\nconst secureStorage = SecureStorage.getInstance();\n\n/**\n * Función de debug para verificar el estado del sistema de encriptación\n * Muestra información detallada en la consola\n */\nexport async function debugEncryptionState(): Promise<void> {\n console.group('🔐 Estado del Sistema de Encriptación');\n\n console.log('Soporte Crypto API:', EncryptionHelper.isSupported());\n\n // Obtener información de debug\n const debugInfo = secureStorage.getDebugInfo();\n\n console.log('Claves encriptadas:', debugInfo.encryptedKeys.length);\n console.log('Claves sin encriptar:', debugInfo.unencryptedKeys);\n console.log('Total de claves:', debugInfo.totalKeys);\n\n if (debugInfo.encryptedKeys.length > 0) {\n console.log('✅ Datos encriptados encontrados:');\n debugInfo.encryptedKeys.forEach(key => {\n const value = localStorage.getItem(key);\n console.log(` ${key}: ${value?.substring(0, 30)}...`);\n });\n } else {\n console.log('⚠️ No se encontraron datos encriptados');\n }\n\n if (debugInfo.unencryptedKeys.length > 0) {\n console.log('⚠️ Claves sin encriptar encontradas:');\n debugInfo.unencryptedKeys.forEach(key => {\n console.log(` ${key}`);\n });\n }\n\n console.groupEnd();\n}\n\n/**\n * Fuerza la migración de claves comunes a formato encriptado\n * Útil para desarrollo y testing\n */\nexport async function forceMigration(customKeys?: string[]): Promise<void> {\n const defaultKeys = [\n 'accessToken',\n 'refreshToken',\n 'user',\n 'sessionId',\n 'authToken',\n 'userData',\n ];\n\n const keysToMigrate = customKeys || defaultKeys;\n\n console.log(`🔄 Iniciando migración forzada de ${keysToMigrate.length} claves...`);\n\n await secureStorage.migrateExistingData(keysToMigrate);\n\n console.log('✅ Migración forzada completada');\n\n // Mostrar estado después de la migración\n await debugEncryptionState();\n}\n\n/**\n * Limpia todos los datos encriptados (útil para testing)\n */\nexport function clearAllEncryptedData(): void {\n console.log('🗑️ Limpiando todos los datos encriptados...');\n secureStorage.clear();\n console.log('✅ Datos encriptados limpiados');\n}\n\n/**\n * Prueba el sistema de encriptación con datos de ejemplo\n */\nexport async function testEncryption(): Promise<void> {\n console.group('🧪 Prueba del Sistema de Encriptación');\n\n try {\n const testKey = '__test_encryption_key';\n const testValue = 'Este es un valor de prueba con caracteres especiales: áéíóú ñ 你好 🔐';\n\n console.log('1. Guardando valor de prueba...');\n await secureStorage.setItem(testKey, testValue);\n console.log('✅ Valor guardado');\n\n console.log('2. Recuperando valor...');\n const retrieved = await secureStorage.getItem(testKey);\n console.log('✅ Valor recuperado:', retrieved);\n\n console.log('3. Verificando integridad...');\n if (retrieved === testValue) {\n console.log('✅ Integridad verificada - Los valores coinciden');\n } else {\n console.error('❌ Error de integridad - Los valores NO coinciden');\n console.log('Original:', testValue);\n console.log('Recuperado:', retrieved);\n }\n\n console.log('4. Limpiando valor de prueba...');\n await secureStorage.removeItem(testKey);\n console.log('✅ Valor eliminado');\n\n console.log('5. Verificando eliminación...');\n const shouldBeNull = await secureStorage.getItem(testKey);\n if (shouldBeNull === null) {\n console.log('✅ Eliminación verificada');\n } else {\n console.error('❌ El valor no fue eliminado correctamente');\n }\n\n console.log('\\n✅ Todas las pruebas pasaron exitosamente');\n } catch (error) {\n console.error('❌ Error en las pruebas:', error);\n }\n\n console.groupEnd();\n}\n","import { useState, useEffect, useCallback } from 'react';\nimport { SecureStorage } from '../core/SecureStorage';\nimport type { SecureStorageConfig, StorageEventType, StorageEventData, ExpiryOptions } from '../types';\n\n// Allow custom storage instance or use default\nlet defaultStorage: SecureStorage | null = null;\n\nfunction getDefaultStorage(): SecureStorage {\n if (!defaultStorage) {\n defaultStorage = SecureStorage.getInstance();\n }\n return defaultStorage;\n}\n\n/**\n * Initialize SecureStorage with custom configuration\n */\nexport function initializeSecureStorage(config?: SecureStorageConfig): SecureStorage {\n defaultStorage = SecureStorage.getInstance(config);\n return defaultStorage;\n}\n\n/**\n * Hook de React para usar SecureStorage de forma reactiva\n * Similar a useState pero con persistencia encriptada\n * \n * @param key - Clave para almacenar en localStorage\n * @param initialValue - Valor inicial si no existe en storage\n * @param storage - Instancia personalizada de SecureStorage (opcional)\n * @returns [value, setValue, loading, error]\n * \n * @example\n * const [token, setToken, loading] = useSecureStorage('accessToken', '');\n */\nexport function useSecureStorage<T = string>(\n key: string,\n initialValue: T,\n storage?: SecureStorage\n): [T, (value: T) => Promise<void>, boolean, Error | null] {\n const secureStorage = storage || getDefaultStorage();\n const [storedValue, setStoredValue] = useState<T>(initialValue);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Cargar valor inicial\n useEffect(() => {\n const loadValue = async () => {\n try {\n setLoading(true);\n setError(null);\n const item = await secureStorage.getItem(key);\n\n if (item !== null) {\n // Si T es un objeto, parsear JSON\n if (typeof initialValue === 'object') {\n setStoredValue(JSON.parse(item) as T);\n } else {\n setStoredValue(item as T);\n }\n } else {\n setStoredValue(initialValue);\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al cargar valor'));\n setStoredValue(initialValue);\n } finally {\n setLoading(false);\n }\n };\n\n loadValue();\n }, [key]); // Solo recargar si cambia la clave\n\n // Función para actualizar el valor\n const setValue = useCallback(\n async (value: T) => {\n try {\n setError(null);\n setStoredValue(value);\n\n // Si T es un objeto, convertir a JSON\n const valueToStore = typeof value === 'object'\n ? JSON.stringify(value)\n : String(value);\n\n await secureStorage.setItem(key, valueToStore);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al guardar valor'));\n throw err;\n }\n },\n [key, secureStorage]\n );\n\n return [storedValue, setValue, loading, error];\n}\n\n/**\n * Hook para usar SecureStorage con expiración\n * \n * @param key - Clave para almacenar\n * @param initialValue - Valor inicial\n * @param expiryOptions - Opciones de expiración\n * @param storage - Instancia personalizada de SecureStorage (opcional)\n * @returns [value, setValue, loading, error]\n * \n * @example\n * const [session, setSession] = useSecureStorageWithExpiry('session', null, { expiresIn: 3600000 });\n */\nexport function useSecureStorageWithExpiry<T = string>(\n key: string,\n initialValue: T,\n expiryOptions: ExpiryOptions,\n storage?: SecureStorage\n): [T, (value: T) => Promise<void>, boolean, Error | null] {\n const secureStorage = storage || getDefaultStorage();\n const [storedValue, setStoredValue] = useState<T>(initialValue);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Cargar valor inicial\n useEffect(() => {\n const loadValue = async () => {\n try {\n setLoading(true);\n setError(null);\n const item = await secureStorage.getItem(key);\n\n if (item !== null) {\n if (typeof initialValue === 'object') {\n setStoredValue(JSON.parse(item) as T);\n } else {\n setStoredValue(item as T);\n }\n } else {\n setStoredValue(initialValue);\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al cargar valor'));\n setStoredValue(initialValue);\n } finally {\n setLoading(false);\n }\n };\n\n loadValue();\n }, [key]);\n\n // Función para actualizar el valor con expiración\n const setValue = useCallback(\n async (value: T) => {\n try {\n setError(null);\n setStoredValue(value);\n\n const valueToStore = typeof value === 'object'\n ? JSON.stringify(value)\n : String(value);\n\n await secureStorage.setItemWithExpiry(key, valueToStore, expiryOptions);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al guardar valor'));\n throw err;\n }\n },\n [key, secureStorage, expiryOptions]\n );\n\n return [storedValue, setValue, loading, error];\n}\n\n/**\n * Hook para verificar si una clave existe en SecureStorage\n * \n * @param key - Clave a verificar\n * @param storage - Instancia personalizada de SecureStorage (opcional)\n * @returns [exists, loading, error]\n * \n * @example\n * const [hasToken, loading] = useSecureStorageItem('accessToken');\n */\nexport function useSecureStorageItem(\n key: string,\n storage?: SecureStorage\n): [boolean, boolean, Error | null] {\n const secureStorage = storage || getDefaultStorage();\n const [exists, setExists] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const checkExists = async () => {\n try {\n setLoading(true);\n setError(null);\n const hasItem = await secureStorage.hasItem(key);\n setExists(hasItem);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Error al verificar clave'));\n setExists(false);\n } finally {\n setLoading(false);\n }\n };\n\n checkExists();\n }, [key, secureStorage]);\n\n return [exists, loading, error];\n}\n\n/**\n * Hook para escuchar eventos de SecureStorage\n * \n * @param event - Tipo de evento a escuchar\n * @param handler - Función manejadora del evento\n * @param storage - Instancia personalizada de SecureStorage (opcional)\n * \n * @example\n * useSecureStorageEvents('encrypted', (data) => {\n * console.log('Item encrypted:', data.key);\n * });\n */\nexport function useSecureStorageEvents(\n event: StorageEventType,\n handler: (data: StorageEventData) => void,\n storage?: SecureStorage\n): void {\n const secureStorage = storage || getDefaultStorage();\n\n useEffect(() => {\n secureStorage.on(event, handler);\n\n return () => {\n secureStorage.off(event, handler);\n };\n }, [event, handler, secureStorage]);\n}\n\n/**\n * Hook para obtener información de debug del almacenamiento\n * \n * @param storage - Instancia personalizada de SecureStorage (opcional)\n * @returns Información de debug\n * \n * @example\n * const debugInfo = useSecureStorageDebug();\n * console.log(`Claves encriptadas: ${debugInfo.encryptedKeys.length}`);\n */\nexport function useSecureStorageDebug(storage?: SecureStorage) {\n const secureStorage = storage || getDefaultStorage();\n const [debugInfo, setDebugInfo] = useState(secureStorage.getDebugInfo());\n\n useEffect(() => {\n // Actualizar cada segundo\n const interval = setInterval(() => {\n setDebugInfo(secureStorage.getDebugInfo());\n }, 1000);\n\n return () => clearInterval(interval);\n }, [secureStorage]);\n\n return debugInfo;\n}\n\n/**\n * Hook para usar un namespace de SecureStorage\n * \n * @param namespace - Nombre del namespace\n * @param storage - Instancia personalizada de SecureStorage (opcional)\n * @returns Instancia de NamespacedStorage\n * \n * @example\n * const userStorage = useNamespace('user');\n * await userStorage.setItem('profile', JSON.stringify(profile));\n */\nexport function useNamespace(namespace: string, storage?: SecureStorage) {\n const secureStorage = storage || getDefaultStorage();\n const [namespacedStorage] = useState(() => secureStorage.namespace(namespace));\n\n return namespacedStorage;\n}\n\n/**\n * Exportar la instancia de SecureStorage para uso directo\n */\nexport const secureStorage = getDefaultStorage();\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable, from, Subject } from 'rxjs';\nimport { map, catchError } from 'rxjs/operators';\nimport { SecureStorage } from '../core/SecureStorage';\nimport type { SecureStorageConfig, StorageEventData, ExpiryOptions, EncryptedBackup } from '../types';\n\n/**\n * Servicio de Angular para SecureStorage v2\n * Proporciona una API reactiva usando RxJS Observables\n * \n * @example\n * constructor(private secureStorage: SecureStorageService) {}\n * \n * // Guardar\n * this.secureStorage.setItem('token', 'abc123').subscribe();\n * \n * // Leer\n * this.secureStorage.getItem('token').subscribe(token => console.log(token));\n * \n * // Escuchar eventos\n * this.secureStorage.events$.subscribe(event => console.log(event));\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class SecureStorageService {\n private storage: SecureStorage;\n private debugInfo$ = new BehaviorSubject(this.getDebugInfo());\n private eventsSubject$ = new Subject<StorageEventData>();\n\n /**\n * Observable de eventos de storage\n */\n public events$ = this.eventsSubject$.asObservable();\n\n constructor(config?: SecureStorageConfig) {\n this.storage = SecureStorage.getInstance(config);\n\n // Setup event forwarding to Observable\n this.storage.on('encrypted', (data) => this.eventsSubject$.next(data));\n this.storage.on('decrypted', (data) => this.eventsSubject$.next(data));\n this.storage.on('deleted', (data) => this.eventsSubject$.next(data));\n this.storage.on('cleared', (data) => this.eventsSubject$.next(data));\n this.storage.on('expired', (data) => this.eventsSubject$.next(data));\n this.storage.on('error', (data) => this.eventsSubject$.next(data));\n this.storage.on('keyRotated', (data) => this.eventsSubject$.next(data));\n this.storage.on('compressed', (data) => this.eventsSubject$.next(data));\n this.storage.on('decompressed', (data) => this.eventsSubject$.next(data));\n\n // Actualizar debug info cada segundo\n setInterval(() => {\n this.debugInfo$.next(this.getDebugInfo());\n }, 1000);\n }\n\n /**\n * Guarda un valor encriptado\n * @param key - Clave\n * @param value - Valor a guardar\n * @returns Observable que completa cuando se guarda\n */\n setItem(key: string, value: string): Observable<void> {\n return from(this.storage.setItem(key, value));\n }\n\n /**\n * Guarda un valor con expiración\n * @param key - Clave\n * @param value - Valor a guardar\n * @param options - Opciones de expiración\n * @returns Observable que completa cuando se guarda\n */\n setItemWithExpiry(key: string, value: string, options: ExpiryOptions): Observable<void> {\n return from(this.storage.setItemWithExpiry(key, value, options));\n }\n\n /**\n * Recupera un valor desencriptado\n * @param key - Clave\n * @returns Observable con el valor o null\n */\n getItem(key: string): Observable<string | null> {\n return from(this.storage.getItem(key));\n }\n\n /**\n * Elimina un valor\n * @param key - Clave a eliminar\n * @returns Observable que completa cuando se elimina\n */\n removeItem(key: string): Observable<void> {\n return from(this.storage.removeItem(key));\n }\n\n /**\n * Verifica si existe una clave\n * @param key - Clave a verificar\n * @returns Observable con true/false\n */\n hasItem(key: string): Observable<boolean> {\n return from(this.storage.hasItem(key));\n }\n\n /**\n * Limpia todos los datos encriptados\n */\n clear(): void {\n this.storage.clear();\n }\n\n /**\n * Limpia todos los items expirados\n * @returns Observable con el número de items eliminados\n */\n cleanExpired(): Observable<number> {\n return from(this.storage.cleanExpired());\n }\n\n /**\n * Verifica la integridad de un valor\n * @param key - Clave a verificar\n * @returns Observable con true si es válido\n */\n verifyIntegrity(key: string): Observable<boolean> {\n return from(this.storage.verifyIntegrity(key));\n }\n\n /**\n * Obtiene información de integridad de un valor\n * @param key - Clave\n * @returns Observable con información de integridad\n */\n getIntegrityInfo(key: string): Observable<any> {\n return from(this.storage.getIntegrityInfo(key));\n }\n\n /**\n * Crea un namespace para organizar datos\n * @param name - Nombre del namespace\n * @returns Instancia de NamespacedStorage\n */\n namespace(name: string) {\n return this.storage.namespace(name);\n }\n\n /**\n * Rota todas las claves de encriptación\n * @returns Observable que completa cuando termina la rotación\n */\n rotateKeys(): Observable<void> {\n return from(this.storage.rotateKeys());\n }\n\n /**\n * Exporta todos los datos como backup\n * @returns Observable con el backup\n */\n exportEncryptedData(): Observable<EncryptedBackup> {\n return from(this.storage.exportEncryptedData());\n }\n\n /**\n * Importa datos desde un backup\n * @param backup - Backup a importar\n * @returns Observable que completa cuando termina la importación\n */\n importEncryptedData(backup: EncryptedBackup): Observable<void> {\n return from(this.storage.importEncryptedData(backup));\n }\n\n /**\n * Migra datos existentes a formato encriptado\n * @param keys - Array de claves a migrar\n * @returns Observable que completa cuando termina la migración\n */\n migrateExistingData(keys: string[]): Observable<void> {\n return from(this.storage.migrateExistingData(keys));\n }\n\n /**\n * Obtiene información de debug como Observable\n * @returns Observable con información de debug que se actualiza automáticamente\n */\n getDebugInfo$(): Observable<any> {\n return this.debugInfo$.asObservable();\n }\n\n /**\n * Obtiene información de debug de forma síncrona\n */\n private getDebugInfo() {\n return this.storage.getDebugInfo();\n }\n\n /**\n * Helper para guardar objetos JSON\n * @param key - Clave\n * @param value - Objeto a guardar\n */\n setObject<T>(key: string, value: T): Observable<void> {\n return this.setItem(key, JSON.stringify(value));\n }\n\n /**\n * Helper para guardar objetos JSON con expiración\n * @param key - Clave\n * @param value - Objeto a guardar\n * @param options - Opciones de expiración\n */\n setObjectWithExpiry<T>(key: string, value: T, options: ExpiryOptions): Observable<void> {\n return this.setItemWithExpiry(key, JSON.stringify(value), options);\n }\n\n /**\n * Helper para recuperar objetos JSON\n * @param key - Clave\n * @returns Observable con el objeto parseado o null\n */\n getObject<T>(key: string): Observable<T | null> {\n return this.getItem(key).pipe(\n map(value => value ? JSON.parse(value) as T : null),\n catchError(() => from([null]))\n );\n }\n\n /**\n * Registra un listener para un tipo de evento específico\n * @param event - Tipo de evento\n * @param handler - Función manejadora\n */\n on(event: any, handler: (data: StorageEventData) => void): void {\n this.storage.on(event, handler);\n }\n\n /**\n * Elimina un listener de evento\n * @param event - Tipo de evento\n * @param handler - Función manejadora\n */\n off(event: any, handler: (data: StorageEventData) => void): void {\n this.storage.off(event, handler);\n }\n\n /**\n * Observable filtrado por tipo de evento\n * @param eventType - Tipo de evento a filtrar\n * @returns Observable con eventos del tipo especificado\n */\n onEvent$(eventType: string): Observable<StorageEventData> {\n return this.events$.pipe(\n map(event => event.type === eventType ? event : null),\n map(event => event!)\n );\n }\n}\n","/**\n * @bantis/local-cipher v2.0.0\n * Librería de cifrado local AES-256-GCM para Angular, React y JavaScript\n * \n * @author MTT\n * @license MIT\n */\n\n// Core exports\nexport { EncryptionHelper } from './core/EncryptionHelper';\nexport { SecureStorage } from './core/SecureStorage';\nexport { EventEmitter } from './core/EventEmitter';\nexport { KeyRotation } from './core/KeyRotation';\nexport { NamespacedStorage } from './core/NamespacedStorage';\n\n// Type exports\nexport type {\n EncryptionConfig,\n StorageConfig,\n DebugConfig,\n SecureStorageConfig,\n StoredValue,\n ExpiryOptions,\n EncryptedBackup,\n IntegrityInfo,\n StorageEventType,\n StorageEventData,\n EventListener,\n LogLevel,\n} from './types';\nexport { DEFAULT_CONFIG, LIBRARY_VERSION, STORAGE_VERSION } from './types';\n\n// Utility exports\nexport { Logger } from './utils/logger';\nexport { compress, decompress, shouldCompress, isCompressionSupported } from './utils/compression';\nexport { debugEncryptionState, forceMigration } from './utils/debug';\n\n// React exports\nexport {\n useSecureStorage,\n useSecureStorageItem,\n useSecureStorageDebug,\n secureStorage as reactSecureStorage,\n} from './integrations/react';\n\n// Angular exports\nexport { SecureStorageService } from './integrations/angular';\n\n// Default instance for vanilla JS\nimport { SecureStorage } from './core/SecureStorage';\nexport const secureStorage = SecureStorage.getInstance();\n\n// Version\nexport const VERSION = '2.0.0';\n"],"names":["secureStorage"],"mappings":";;;;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