diff --git a/README.md b/README.md index 391486a..45efa38 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SecureBit.chat v4.02.985 - ECDH + DTLS + SAS +# SecureBit.chat v4.2.12 - ECDH + DTLS + SAS
diff --git a/dist/app-boot.js b/dist/app-boot.js index 8e13bd4..0e61ca1 100644 --- a/dist/app-boot.js +++ b/dist/app-boot.js @@ -14148,7 +14148,7 @@ Right-click or Ctrl+click to disconnect`, React.createElement("p", { key: "subtitle", className: "text-xs sm:text-sm text-muted hidden sm:block" - }, "End-to-end freedom v4.02.985") + }, "End-to-end freedom v4.2.12") ]) ]), // Status and Controls - Responsive @@ -14273,7 +14273,7 @@ window.EnhancedMinimalHeader = EnhancedMinimalHeader; var DownloadApps = () => { const apps = [ { id: "web", name: "Web App", subtitle: "Browser Version", icon: "fas fa-globe", platform: "Web", isActive: true, url: "https://securebitchat.github.io/securebit-chat/", color: "green" }, - { id: "windows", name: "Windows", subtitle: "Desktop App", icon: "fab fa-windows", platform: "Desktop", isActive: false, url: "#", color: "blue" }, + { id: "windows", name: "Windows", subtitle: "Desktop App", icon: "fab fa-windows", platform: "Desktop", isActive: true, url: "https://securebit.chat/download/windows/SecureBit%20Chat%20Setup%204.1.222.exe", color: "blue" }, { id: "macos", name: "macOS", subtitle: "Desktop App", icon: "fab fa-apple", platform: "Desktop", isActive: false, url: "#", color: "gray" }, { id: "linux", name: "Linux", subtitle: "Desktop App", icon: "fab fa-linux", platform: "Desktop", isActive: false, url: "#", color: "orange" }, { id: "ios", name: "iOS", subtitle: "iPhone & iPad", icon: "fab fa-apple", platform: "Mobile", isActive: false, url: "https://apps.apple.com/app/securebit-chat/", color: "blue" }, diff --git a/dist/app-boot.js.map b/dist/app-boot.js.map index 8277f92..55d7a28 100644 --- a/dist/app-boot.js.map +++ b/dist/app-boot.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/crypto/EnhancedSecureCryptoUtils.js", "../src/transfer/EnhancedSecureFileTransfer.js", "../src/network/EnhancedSecureWebRTCManager.js", "../src/components/ui/SessionTimer.jsx", "../src/components/ui/Header.jsx", "../src/components/ui/DownloadApps.jsx", "../src/components/ui/FileTransfer.jsx", "../src/scripts/app-boot.js"], - "sourcesContent": ["class EnhancedSecureCryptoUtils {\n\n static _keyMetadata = new WeakMap();\n \n // Initialize secure logging system after class definition\n\n // Utility to sort object keys for deterministic serialization\n static sortObjectKeys(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(EnhancedSecureCryptoUtils.sortObjectKeys);\n }\n\n const sortedObj = {};\n Object.keys(obj).sort().forEach(key => {\n sortedObj[key] = EnhancedSecureCryptoUtils.sortObjectKeys(obj[key]);\n });\n return sortedObj;\n }\n\n // Utility to assert CryptoKey type and properties\n static assertCryptoKey(key, expectedName = null, expectedUsages = []) {\n if (!(key instanceof CryptoKey)) throw new Error('Expected CryptoKey');\n if (expectedName && key.algorithm?.name !== expectedName) {\n throw new Error(`Expected algorithm ${expectedName}, got ${key.algorithm?.name}`);\n }\n for (const u of expectedUsages) {\n if (!key.usages || !key.usages.includes(u)) {\n throw new Error(`Missing required key usage: ${u}`);\n }\n }\n }\n // Helper function to convert ArrayBuffer to Base64\n static arrayBufferToBase64(buffer) {\n let binary = '';\n const bytes = new Uint8Array(buffer);\n const len = bytes.byteLength;\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n // Helper function to convert Base64 to ArrayBuffer\n static base64ToArrayBuffer(base64) {\n try {\n // Validate input\n if (typeof base64 !== 'string' || !base64) {\n throw new Error('Invalid base64 input: must be a non-empty string');\n }\n\n // Remove any whitespace and validate base64 format\n const cleanBase64 = base64.trim();\n if (!/^[A-Za-z0-9+/]*={0,2}$/.test(cleanBase64)) {\n throw new Error('Invalid base64 format');\n }\n\n // Handle empty string case\n if (cleanBase64 === '') {\n return new ArrayBuffer(0);\n }\n\n const binaryString = atob(cleanBase64);\n const len = binaryString.length;\n const bytes = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes.buffer;\n } catch (error) {\n console.error('Base64 to ArrayBuffer conversion failed:', error.message);\n throw new Error(`Base64 conversion error: ${error.message}`);\n }\n }\n\n // Helper function to convert hex string to Uint8Array\n static hexToUint8Array(hexString) {\n try {\n if (!hexString || typeof hexString !== 'string') {\n throw new Error('Invalid hex string input: must be a non-empty string');\n }\n\n // Remove colons and spaces from hex string (e.g., \"aa:bb:cc\" -> \"aabbcc\")\n const cleanHex = hexString.replace(/:/g, '').replace(/\\s/g, '');\n \n // Validate hex format\n if (!/^[0-9a-fA-F]*$/.test(cleanHex)) {\n throw new Error('Invalid hex format: contains non-hex characters');\n }\n \n // Ensure even length\n if (cleanHex.length % 2 !== 0) {\n throw new Error('Invalid hex format: odd length');\n }\n\n // Convert hex string to bytes\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = parseInt(cleanHex.substr(i, 2), 16);\n }\n \n return bytes;\n } catch (error) {\n console.error('Hex to Uint8Array conversion failed:', error.message);\n throw new Error(`Hex conversion error: ${error.message}`);\n }\n }\n\n static async encryptData(data, password) {\n try {\n const dataString = typeof data === 'string' ? data : JSON.stringify(data);\n const salt = crypto.getRandomValues(new Uint8Array(16));\n const encoder = new TextEncoder();\n const passwordBuffer = encoder.encode(password);\n\n const keyMaterial = await crypto.subtle.importKey(\n 'raw',\n passwordBuffer,\n { name: 'PBKDF2' },\n false,\n ['deriveKey']\n );\n\n const key = await crypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt,\n iterations: 100000,\n hash: 'SHA-256',\n },\n keyMaterial,\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt']\n );\n\n const iv = crypto.getRandomValues(new Uint8Array(12));\n const dataBuffer = encoder.encode(dataString);\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: iv },\n key,\n dataBuffer\n );\n\n const encryptedPackage = {\n version: '1.0',\n salt: Array.from(salt),\n iv: Array.from(iv),\n data: Array.from(new Uint8Array(encrypted)),\n timestamp: Date.now(),\n };\n\n const packageString = JSON.stringify(encryptedPackage);\n return EnhancedSecureCryptoUtils.arrayBufferToBase64(new TextEncoder().encode(packageString).buffer);\n\n } catch (error) {\n console.error('Encryption failed:', error.message);\n throw new Error(`Encryption error: ${error.message}`);\n }\n }\n\n static async decryptData(encryptedData, password) {\n try {\n const packageBuffer = EnhancedSecureCryptoUtils.base64ToArrayBuffer(encryptedData);\n const packageString = new TextDecoder().decode(packageBuffer);\n const encryptedPackage = JSON.parse(packageString);\n\n if (!encryptedPackage.version || !encryptedPackage.salt || !encryptedPackage.iv || !encryptedPackage.data) {\n throw new Error('Invalid encrypted data format');\n }\n\n const salt = new Uint8Array(encryptedPackage.salt);\n const iv = new Uint8Array(encryptedPackage.iv);\n const encrypted = new Uint8Array(encryptedPackage.data);\n\n const encoder = new TextEncoder();\n const passwordBuffer = encoder.encode(password);\n\n const keyMaterial = await crypto.subtle.importKey(\n 'raw',\n passwordBuffer,\n { name: 'PBKDF2' },\n false,\n ['deriveKey']\n );\n\n const key = await crypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt,\n iterations: 100000,\n hash: 'SHA-256'\n },\n keyMaterial,\n { name: 'AES-GCM', length: 256 },\n false,\n ['decrypt']\n );\n\n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv },\n key,\n encrypted\n );\n\n const decryptedString = new TextDecoder().decode(decrypted);\n\n try {\n return JSON.parse(decryptedString);\n } catch {\n return decryptedString;\n }\n\n } catch (error) {\n console.error('Decryption failed:', error.message);\n throw new Error(`Decryption error: ${error.message}`);\n }\n }\n\n \n // Generate secure password for data exchange\n static generateSecurePassword() {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?';\n const length = 32; \n const randomValues = new Uint32Array(length);\n crypto.getRandomValues(randomValues);\n \n let password = '';\n for (let i = 0; i < length; i++) {\n password += chars[randomValues[i] % chars.length];\n }\n return password;\n }\n\n // Real security level calculation with actual verification\n static async calculateSecurityLevel(securityManager) {\n let score = 0;\n const maxScore = 100; // Fixed: Changed from 110 to 100 for cleaner percentage\n const verificationResults = {};\n \n try {\n // Fallback to basic calculation if securityManager is not fully initialized\n if (!securityManager || !securityManager.securityFeatures) {\n console.warn('Security manager not fully initialized, using fallback calculation');\n return {\n level: 'INITIALIZING',\n score: 0,\n color: 'gray',\n verificationResults: {},\n timestamp: Date.now(),\n details: 'Security system initializing...',\n isRealData: false\n };\n }\n\n // All security features are enabled by default - no session type restrictions\n const sessionType = 'full'; // All features enabled\n const isDemoSession = false; // All features available\n \n // 1. Base encryption verification (20 points) - Available in demo\n try {\n const encryptionResult = await EnhancedSecureCryptoUtils.verifyEncryption(securityManager);\n if (encryptionResult.passed) {\n score += 20;\n verificationResults.verifyEncryption = { passed: true, details: encryptionResult.details, points: 20 };\n } else {\n verificationResults.verifyEncryption = { passed: false, details: encryptionResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyEncryption = { passed: false, details: `Encryption check failed: ${error.message}`, points: 0 };\n }\n \n // 2. Simple key exchange verification (15 points) - Available in demo\n try {\n const ecdhResult = await EnhancedSecureCryptoUtils.verifyECDHKeyExchange(securityManager);\n if (ecdhResult.passed) {\n score += 15;\n verificationResults.verifyECDHKeyExchange = { passed: true, details: ecdhResult.details, points: 15 };\n } else {\n verificationResults.verifyECDHKeyExchange = { passed: false, details: ecdhResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyECDHKeyExchange = { passed: false, details: `Key exchange check failed: ${error.message}`, points: 0 };\n }\n \n // 3. Message integrity verification (10 points) - Available in demo\n try {\n const integrityResult = await EnhancedSecureCryptoUtils.verifyMessageIntegrity(securityManager);\n if (integrityResult.passed) {\n score += 10;\n verificationResults.verifyMessageIntegrity = { passed: true, details: integrityResult.details, points: 10 };\n } else {\n verificationResults.verifyMessageIntegrity = { passed: false, details: integrityResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyMessageIntegrity = { passed: false, details: `Message integrity check failed: ${error.message}`, points: 0 };\n }\n \n // 4. ECDSA signatures verification (15 points) - All features enabled by default\n try {\n const ecdsaResult = await EnhancedSecureCryptoUtils.verifyECDSASignatures(securityManager);\n if (ecdsaResult.passed) {\n score += 15;\n verificationResults.verifyECDSASignatures = { passed: true, details: ecdsaResult.details, points: 15 };\n } else {\n verificationResults.verifyECDSASignatures = { passed: false, details: ecdsaResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyECDSASignatures = { passed: false, details: `Digital signatures check failed: ${error.message}`, points: 0 };\n }\n \n // 5. Rate limiting verification (5 points) - Available in demo\n try {\n const rateLimitResult = await EnhancedSecureCryptoUtils.verifyRateLimiting(securityManager);\n if (rateLimitResult.passed) {\n score += 5;\n verificationResults.verifyRateLimiting = { passed: true, details: rateLimitResult.details, points: 5 };\n } else {\n verificationResults.verifyRateLimiting = { passed: false, details: rateLimitResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyRateLimiting = { passed: false, details: `Rate limiting check failed: ${error.message}`, points: 0 };\n }\n \n // 6. Metadata protection verification (10 points) - All features enabled by default\n try {\n const metadataResult = await EnhancedSecureCryptoUtils.verifyMetadataProtection(securityManager);\n if (metadataResult.passed) {\n score += 10;\n verificationResults.verifyMetadataProtection = { passed: true, details: metadataResult.details, points: 10 };\n } else {\n verificationResults.verifyMetadataProtection = { passed: false, details: metadataResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyMetadataProtection = { passed: false, details: `Metadata protection check failed: ${error.message}`, points: 0 };\n }\n \n // 7. Perfect Forward Secrecy verification (10 points) - All features enabled by default\n try {\n const pfsResult = await EnhancedSecureCryptoUtils.verifyPerfectForwardSecrecy(securityManager);\n if (pfsResult.passed) {\n score += 10;\n verificationResults.verifyPerfectForwardSecrecy = { passed: true, details: pfsResult.details, points: 10 };\n } else {\n verificationResults.verifyPerfectForwardSecrecy = { passed: false, details: pfsResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyPerfectForwardSecrecy = { passed: false, details: `PFS check failed: ${error.message}`, points: 0 };\n }\n \n // 8. Nested encryption verification (5 points) - All features enabled by default\n if (await EnhancedSecureCryptoUtils.verifyNestedEncryption(securityManager)) {\n score += 5;\n verificationResults.nestedEncryption = { passed: true, details: 'Nested encryption active', points: 5 };\n } else {\n verificationResults.nestedEncryption = { passed: false, details: 'Nested encryption failed', points: 0 };\n }\n \n // 9. Packet padding verification (5 points) - All features enabled by default\n if (await EnhancedSecureCryptoUtils.verifyPacketPadding(securityManager)) {\n score += 5;\n verificationResults.packetPadding = { passed: true, details: 'Packet padding active', points: 5 };\n } else {\n verificationResults.packetPadding = { passed: false, details: 'Packet padding failed', points: 0 };\n }\n \n // 10. Advanced features verification (10 points) - All features enabled by default\n if (await EnhancedSecureCryptoUtils.verifyAdvancedFeatures(securityManager)) {\n score += 10;\n verificationResults.advancedFeatures = { passed: true, details: 'Advanced features active', points: 10 };\n } else {\n verificationResults.advancedFeatures = { passed: false, details: 'Advanced features failed', points: 0 };\n }\n \n const percentage = Math.round((score / maxScore) * 100);\n \n // All security features are available - no restrictions\n const availableChecks = 10; // All 10 security checks available\n const passedChecks = Object.values(verificationResults).filter(r => r.passed).length;\n \n const result = {\n level: percentage >= 85 ? 'HIGH' : percentage >= 65 ? 'MEDIUM' : percentage >= 35 ? 'LOW' : 'CRITICAL',\n score: percentage,\n color: percentage >= 85 ? 'green' : percentage >= 65 ? 'orange' : percentage >= 35 ? 'yellow' : 'red',\n verificationResults,\n timestamp: Date.now(),\n details: `Real verification: ${score}/${maxScore} security checks passed (${passedChecks}/${availableChecks} available)`,\n isRealData: true,\n passedChecks: passedChecks,\n totalChecks: availableChecks,\n sessionType: sessionType,\n maxPossibleScore: 100 // All features enabled - max 100 points\n };\n \n console.log('Real security level calculated:', {\n score: percentage,\n level: result.level,\n passedChecks: passedChecks,\n totalChecks: availableChecks,\n sessionType: sessionType,\n maxPossibleScore: result.maxPossibleScore\n });\n \n return result;\n } catch (error) {\n console.error('Security level calculation failed:', error.message);\n return {\n level: 'UNKNOWN',\n score: 0,\n color: 'red',\n verificationResults: {},\n timestamp: Date.now(),\n details: `Verification failed: ${error.message}`,\n isRealData: false\n };\n }\n }\n\n // Real verification functions\n static async verifyEncryption(securityManager) {\n try {\n if (!securityManager.encryptionKey) {\n return { passed: false, details: 'No encryption key available' };\n }\n \n // Test actual encryption/decryption with multiple data types\n const testCases = [\n 'Test encryption verification',\n '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438',\n 'Special chars: !@#$%^&*()_+-=[]{}|;:,.<>?',\n 'Large data: ' + 'A'.repeat(1000)\n ];\n \n for (const testData of testCases) {\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n const iv = crypto.getRandomValues(new Uint8Array(12));\n \n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n securityManager.encryptionKey,\n testBuffer\n );\n \n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv },\n securityManager.encryptionKey,\n encrypted\n );\n \n const decryptedText = new TextDecoder().decode(decrypted);\n if (decryptedText !== testData) {\n return { passed: false, details: `Decryption mismatch for: ${testData.substring(0, 20)}...` };\n }\n }\n \n return { passed: true, details: 'AES-GCM encryption/decryption working correctly' };\n } catch (error) {\n console.error('Encryption verification failed:', error.message);\n return { passed: false, details: `Encryption test failed: ${error.message}` };\n }\n }\n \n static async verifyECDHKeyExchange(securityManager) {\n try {\n if (!securityManager.ecdhKeyPair || !securityManager.ecdhKeyPair.privateKey || !securityManager.ecdhKeyPair.publicKey) {\n return { passed: false, details: 'No ECDH key pair available' };\n }\n \n // Test that keys are actually ECDH keys\n const keyType = securityManager.ecdhKeyPair.privateKey.algorithm.name;\n const curve = securityManager.ecdhKeyPair.privateKey.algorithm.namedCurve;\n \n if (keyType !== 'ECDH') {\n return { passed: false, details: `Invalid key type: ${keyType}, expected ECDH` };\n }\n \n if (curve !== 'P-384' && curve !== 'P-256') {\n return { passed: false, details: `Unsupported curve: ${curve}, expected P-384 or P-256` };\n }\n \n // Test key derivation\n try {\n const derivedKey = await crypto.subtle.deriveKey(\n { name: 'ECDH', public: securityManager.ecdhKeyPair.publicKey },\n securityManager.ecdhKeyPair.privateKey,\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt', 'decrypt']\n );\n \n if (!derivedKey) {\n return { passed: false, details: 'Key derivation failed' };\n }\n } catch (deriveError) {\n return { passed: false, details: `Key derivation test failed: ${deriveError.message}` };\n }\n \n return { passed: true, details: `ECDH key exchange working with ${curve} curve` };\n } catch (error) {\n console.error('ECDH verification failed:', error.message);\n return { passed: false, details: `ECDH test failed: ${error.message}` };\n }\n }\n \n static async verifyECDSASignatures(securityManager) {\n try {\n if (!securityManager.ecdsaKeyPair || !securityManager.ecdsaKeyPair.privateKey || !securityManager.ecdsaKeyPair.publicKey) {\n return { passed: false, details: 'No ECDSA key pair available' };\n }\n \n // Test actual signing and verification with multiple test cases\n const testCases = [\n 'Test ECDSA signature verification',\n '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0434\u043B\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u0438',\n 'Special chars: !@#$%^&*()_+-=[]{}|;:,.<>?',\n 'Large data: ' + 'B'.repeat(2000)\n ];\n \n for (const testData of testCases) {\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n const signature = await crypto.subtle.sign(\n { name: 'ECDSA', hash: 'SHA-256' },\n securityManager.ecdsaKeyPair.privateKey,\n testBuffer\n );\n \n const isValid = await crypto.subtle.verify(\n { name: 'ECDSA', hash: 'SHA-256' },\n securityManager.ecdsaKeyPair.publicKey,\n signature,\n testBuffer\n );\n \n if (!isValid) {\n return { passed: false, details: `Signature verification failed for: ${testData.substring(0, 20)}...` };\n }\n }\n \n return { passed: true, details: 'ECDSA digital signatures working correctly' };\n } catch (error) {\n console.error('ECDSA verification failed:', error.message);\n return { passed: false, details: `ECDSA test failed: ${error.message}` };\n }\n }\n \n static async verifyMessageIntegrity(securityManager) {\n try {\n // Check if macKey exists and is a valid CryptoKey\n if (!securityManager.macKey || !(securityManager.macKey instanceof CryptoKey)) {\n return { passed: false, details: 'MAC key not available or invalid' };\n }\n \n // Test message integrity with HMAC using multiple test cases\n const testCases = [\n 'Test message integrity verification',\n '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0446\u0435\u043B\u043E\u0441\u0442\u043D\u043E\u0441\u0442\u0438',\n 'Special chars: !@#$%^&*()_+-=[]{}|;:,.<>?',\n 'Large data: ' + 'C'.repeat(3000)\n ];\n \n for (const testData of testCases) {\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n const hmac = await crypto.subtle.sign(\n { name: 'HMAC', hash: 'SHA-256' },\n securityManager.macKey,\n testBuffer\n );\n \n const isValid = await crypto.subtle.verify(\n { name: 'HMAC', hash: 'SHA-256' },\n securityManager.macKey,\n hmac,\n testBuffer\n );\n \n if (!isValid) {\n return { passed: false, details: `HMAC verification failed for: ${testData.substring(0, 20)}...` };\n }\n }\n \n return { passed: true, details: 'Message integrity (HMAC) working correctly' };\n } catch (error) {\n console.error('Message integrity verification failed:', error.message);\n return { passed: false, details: `Message integrity test failed: ${error.message}` };\n }\n }\n \n // Additional verification functions\n static async verifyRateLimiting(securityManager) {\n try {\n // Rate limiting is always available in this implementation\n return { passed: true, details: 'Rate limiting is active and working' };\n } catch (error) {\n return { passed: false, details: `Rate limiting test failed: ${error.message}` };\n }\n }\n \n static async verifyMetadataProtection(securityManager) {\n try {\n // Metadata protection is always enabled in this implementation\n return { passed: true, details: 'Metadata protection is working correctly' };\n } catch (error) {\n return { passed: false, details: `Metadata protection test failed: ${error.message}` };\n }\n }\n \n static async verifyPerfectForwardSecrecy(securityManager) {\n try {\n // Perfect Forward Secrecy is always enabled in this implementation\n return { passed: true, details: 'Perfect Forward Secrecy is configured and active' };\n } catch (error) {\n return { passed: false, details: `PFS test failed: ${error.message}` };\n }\n }\n \n static async verifyReplayProtection(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifyReplayProtection debug:');\n console.log(' - securityManager.replayProtection:', securityManager.replayProtection);\n console.log(' - securityManager keys:', Object.keys(securityManager));\n \n // Check if replay protection is enabled\n if (!securityManager.replayProtection) {\n return { passed: false, details: 'Replay protection not enabled' };\n }\n \n return { passed: true, details: 'Replay protection is working correctly' };\n } catch (error) {\n return { passed: false, details: `Replay protection test failed: ${error.message}` };\n }\n }\n \n static async verifyDTLSFingerprint(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifyDTLSFingerprint debug:');\n console.log(' - securityManager.dtlsFingerprint:', securityManager.dtlsFingerprint);\n \n // Check if DTLS fingerprint is available\n if (!securityManager.dtlsFingerprint) {\n return { passed: false, details: 'DTLS fingerprint not available' };\n }\n \n return { passed: true, details: 'DTLS fingerprint is valid and available' };\n } catch (error) {\n return { passed: false, details: `DTLS fingerprint test failed: ${error.message}` };\n }\n }\n \n static async verifySASVerification(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifySASVerification debug:');\n console.log(' - securityManager.sasCode:', securityManager.sasCode);\n \n // Check if SAS code is available\n if (!securityManager.sasCode) {\n return { passed: false, details: 'SAS code not available' };\n }\n \n return { passed: true, details: 'SAS verification code is valid and available' };\n } catch (error) {\n return { passed: false, details: `SAS verification test failed: ${error.message}` };\n }\n }\n \n static async verifyTrafficObfuscation(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifyTrafficObfuscation debug:');\n console.log(' - securityManager.trafficObfuscation:', securityManager.trafficObfuscation);\n \n // Check if traffic obfuscation is enabled\n if (!securityManager.trafficObfuscation) {\n return { passed: false, details: 'Traffic obfuscation not enabled' };\n }\n \n return { passed: true, details: 'Traffic obfuscation is working correctly' };\n } catch (error) {\n return { passed: false, details: `Traffic obfuscation test failed: ${error.message}` };\n }\n }\n \n static async verifyNestedEncryption(securityManager) {\n try {\n // Check if nestedEncryptionKey exists and is a valid CryptoKey\n if (!securityManager.nestedEncryptionKey || !(securityManager.nestedEncryptionKey instanceof CryptoKey)) {\n console.warn('Nested encryption key not available or invalid');\n return false;\n }\n \n // Test nested encryption\n const testData = 'Test nested encryption verification';\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n // Simulate nested encryption\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: crypto.getRandomValues(new Uint8Array(12)) },\n securityManager.nestedEncryptionKey,\n testBuffer\n );\n \n return encrypted && encrypted.byteLength > 0;\n } catch (error) {\n console.error('Nested encryption verification failed:', error.message);\n return false;\n }\n }\n \n static async verifyPacketPadding(securityManager) {\n try {\n if (!securityManager.paddingConfig || !securityManager.paddingConfig.enabled) return false;\n \n // Test packet padding functionality\n const testData = 'Test packet padding verification';\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n // Simulate packet padding\n const paddingSize = Math.floor(Math.random() * (securityManager.paddingConfig.maxPadding - securityManager.paddingConfig.minPadding)) + securityManager.paddingConfig.minPadding;\n const paddedData = new Uint8Array(testBuffer.byteLength + paddingSize);\n paddedData.set(new Uint8Array(testBuffer), 0);\n \n return paddedData.byteLength >= testBuffer.byteLength + securityManager.paddingConfig.minPadding;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Packet padding verification failed', { error: error.message });\n return false;\n }\n }\n \n static async verifyAdvancedFeatures(securityManager) {\n try {\n // Test advanced features like traffic obfuscation, fake traffic, etc.\n const hasFakeTraffic = securityManager.fakeTrafficConfig && securityManager.fakeTrafficConfig.enabled;\n const hasDecoyChannels = securityManager.decoyChannelsConfig && securityManager.decoyChannelsConfig.enabled;\n const hasAntiFingerprinting = securityManager.antiFingerprintingConfig && securityManager.antiFingerprintingConfig.enabled;\n \n return hasFakeTraffic || hasDecoyChannels || hasAntiFingerprinting;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Advanced features verification failed', { error: error.message });\n return false;\n }\n }\n \n static async verifyMutualAuth(securityManager) {\n try {\n if (!securityManager.isVerified || !securityManager.verificationCode) return false;\n \n // Test mutual authentication\n return securityManager.isVerified && securityManager.verificationCode.length > 0;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Mutual auth verification failed', { error: error.message });\n return false;\n }\n }\n \n \n static async verifyNonExtractableKeys(securityManager) {\n try {\n if (!securityManager.encryptionKey) return false;\n \n // Test if keys are non-extractable\n const keyData = await crypto.subtle.exportKey('raw', securityManager.encryptionKey);\n return keyData && keyData.byteLength > 0;\n } catch (error) {\n // If export fails, keys are non-extractable (which is good)\n return true;\n }\n }\n \n static async verifyEnhancedValidation(securityManager) {\n try {\n if (!securityManager.securityFeatures) return false;\n \n // Test enhanced validation features\n const hasValidation = securityManager.securityFeatures.hasEnhancedValidation || \n securityManager.securityFeatures.hasEnhancedReplayProtection;\n \n return hasValidation;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Enhanced validation verification failed', { error: error.message });\n return false;\n }\n }\n \n \n static async verifyPFS(securityManager) {\n try {\n // Check if PFS is active\n return securityManager.securityFeatures &&\n securityManager.securityFeatures.hasPFS === true &&\n securityManager.keyRotationInterval &&\n securityManager.currentKeyVersion !== undefined &&\n securityManager.keyVersions &&\n securityManager.keyVersions instanceof Map;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'PFS verification failed', { error: error.message });\n return false;\n }\n }\n\n // Rate limiting implementation\n static rateLimiter = {\n messages: new Map(),\n connections: new Map(),\n locks: new Map(),\n \n async checkMessageRate(identifier, limit = 60, windowMs = 60000) {\n if (typeof identifier !== 'string' || identifier.length > 256) {\n return false;\n }\n \n const key = `msg_${identifier}`;\n\n if (this.locks.has(key)) {\n\n await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 10) + 5));\n return this.checkMessageRate(identifier, limit, windowMs);\n }\n \n this.locks.set(key, true);\n \n try {\n const now = Date.now();\n \n if (!this.messages.has(key)) {\n this.messages.set(key, []);\n }\n \n const timestamps = this.messages.get(key);\n \n const validTimestamps = timestamps.filter(ts => now - ts < windowMs);\n \n if (validTimestamps.length >= limit) {\n return false; \n }\n \n validTimestamps.push(now);\n this.messages.set(key, validTimestamps);\n return true;\n } finally {\n this.locks.delete(key);\n }\n },\n \n async checkConnectionRate(identifier, limit = 5, windowMs = 300000) {\n if (typeof identifier !== 'string' || identifier.length > 256) {\n return false;\n }\n \n const key = `conn_${identifier}`;\n \n if (this.locks.has(key)) {\n await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 10) + 5));\n return this.checkConnectionRate(identifier, limit, windowMs);\n }\n \n this.locks.set(key, true);\n \n try {\n const now = Date.now();\n \n if (!this.connections.has(key)) {\n this.connections.set(key, []);\n }\n \n const timestamps = this.connections.get(key);\n const validTimestamps = timestamps.filter(ts => now - ts < windowMs);\n \n if (validTimestamps.length >= limit) {\n return false;\n }\n \n validTimestamps.push(now);\n this.connections.set(key, validTimestamps);\n return true;\n } finally {\n this.locks.delete(key);\n }\n },\n \n cleanup() {\n const now = Date.now();\n const maxAge = 3600000; \n \n for (const [key, timestamps] of this.messages.entries()) {\n if (this.locks.has(key)) continue;\n \n const valid = timestamps.filter(ts => now - ts < maxAge);\n if (valid.length === 0) {\n this.messages.delete(key);\n } else {\n this.messages.set(key, valid);\n }\n }\n \n for (const [key, timestamps] of this.connections.entries()) {\n if (this.locks.has(key)) continue;\n \n const valid = timestamps.filter(ts => now - ts < maxAge);\n if (valid.length === 0) {\n this.connections.delete(key);\n } else {\n this.connections.set(key, valid);\n }\n }\n\n for (const lockKey of this.locks.keys()) {\n const keyTimestamp = parseInt(lockKey.split('_').pop()) || 0;\n if (now - keyTimestamp > 30000) {\n this.locks.delete(lockKey);\n }\n }\n }\n};\n\n static validateSalt(salt) {\n if (!salt || salt.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes');\n }\n \n const uniqueBytes = new Set(salt);\n if (uniqueBytes.size < 16) {\n throw new Error('Salt has insufficient entropy');\n }\n \n return true;\n }\n\n // Secure logging without data leaks\n static secureLog = {\n logs: [],\n maxLogs: 100,\n isProductionMode: false,\n \n // Initialize production mode detection\n init() {\n this.isProductionMode = this._detectProductionMode();\n if (this.isProductionMode) {\n console.log('[SecureChat] Production mode detected - sensitive logging disabled');\n }\n },\n \n _detectProductionMode() {\n return (\n (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') ||\n (!window.DEBUG_MODE && !window.DEVELOPMENT_MODE) ||\n (window.location.hostname && !window.location.hostname.includes('localhost') && \n !window.location.hostname.includes('127.0.0.1') && \n !window.location.hostname.includes('.local')) ||\n (typeof window.webpackHotUpdate === 'undefined' && !window.location.search.includes('debug'))\n );\n },\n \n log(level, message, context = {}) {\n const sanitizedContext = this.sanitizeContext(context);\n const logEntry = {\n timestamp: Date.now(),\n level,\n message,\n context: sanitizedContext,\n id: crypto.getRandomValues(new Uint32Array(1))[0]\n };\n \n this.logs.push(logEntry);\n \n // Keep only recent logs\n if (this.logs.length > this.maxLogs) {\n this.logs = this.logs.slice(-this.maxLogs);\n }\n \n // Production-safe console output\n if (this.isProductionMode) {\n if (level === 'error') {\n // \u0412 production \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u043A\u043E\u0434 \u043E\u0448\u0438\u0431\u043A\u0438 \u0431\u0435\u0437 \u0434\u0435\u0442\u0430\u043B\u0435\u0439\n console.error(`\u274C [SecureChat] ${message} [ERROR_CODE: ${this._generateErrorCode(message)}]`);\n } else if (level === 'warn') {\n // \u0412 production \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435 \u0431\u0435\u0437 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u0430\n console.warn(`\u26A0\uFE0F [SecureChat] ${message}`);\n } else {\n // \u0412 production \u043D\u0435 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C info/debug \u043B\u043E\u0433\u0438\n return;\n }\n } else {\n // Development mode - \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0432\u0441\u0435\n if (level === 'error') {\n console.error(`\u274C [SecureChat] ${message}`, { errorType: sanitizedContext?.constructor?.name || 'Unknown' });\n } else if (level === 'warn') {\n console.warn(`\u26A0\uFE0F [SecureChat] ${message}`, { details: sanitizedContext });\n } else {\n console.log(`[SecureChat] ${message}`, sanitizedContext);\n }\n }\n },\n \n // \u0413\u0435\u043D\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u044B\u0439 \u043A\u043E\u0434 \u043E\u0448\u0438\u0431\u043A\u0438 \u0434\u043B\u044F production\n _generateErrorCode(message) {\n const hash = message.split('').reduce((a, b) => {\n a = ((a << 5) - a) + b.charCodeAt(0);\n return a & a;\n }, 0);\n return Math.abs(hash).toString(36).substring(0, 6).toUpperCase();\n },\n \n sanitizeContext(context) {\n if (!context || typeof context !== 'object') {\n return context;\n }\n \n const sensitivePatterns = [\n /key/i, /secret/i, /password/i, /token/i, /signature/i,\n /challenge/i, /proof/i, /salt/i, /iv/i, /nonce/i, /hash/i,\n /fingerprint/i, /mac/i, /private/i, /encryption/i, /decryption/i\n ];\n \n const sanitized = {};\n for (const [key, value] of Object.entries(context)) {\n const isSensitive = sensitivePatterns.some(pattern => \n pattern.test(key) || (typeof value === 'string' && pattern.test(value))\n );\n \n if (isSensitive) {\n sanitized[key] = '[REDACTED]';\n } else if (typeof value === 'string' && value.length > 100) {\n sanitized[key] = value.substring(0, 100) + '...[TRUNCATED]';\n } else if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n sanitized[key] = `[${value.constructor.name}(${value.byteLength || value.length} bytes)]`;\n } else if (value && typeof value === 'object' && !Array.isArray(value)) {\n // \u0420\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u0430\u044F \u0441\u0430\u043D\u0438\u0442\u0438\u0437\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432\n sanitized[key] = this.sanitizeContext(value);\n } else {\n sanitized[key] = value;\n }\n }\n return sanitized;\n },\n \n getLogs(level = null) {\n if (level) {\n return this.logs.filter(log => log.level === level);\n }\n return [...this.logs];\n },\n \n clearLogs() {\n this.logs = [];\n },\n \n // \u041C\u0435\u0442\u043E\u0434 \u0434\u043B\u044F \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u043E\u0448\u0438\u0431\u043E\u043A \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 production\n async sendErrorToServer(errorCode, message, context = {}) {\n if (!this.isProductionMode) {\n return; // \u0412 development \u043D\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C\n }\n \n try {\n // \u041E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E\n const safeErrorData = {\n errorCode,\n timestamp: Date.now(),\n userAgent: navigator.userAgent.substring(0, 100),\n url: window.location.href.substring(0, 100)\n };\n \n // \u0417\u0434\u0435\u0441\u044C \u043C\u043E\u0436\u043D\u043E \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\n // await fetch('/api/error-log', { method: 'POST', body: JSON.stringify(safeErrorData) });\n \n if (window.DEBUG_MODE) {\n console.log('[SecureChat] Error logged to server:', safeErrorData);\n }\n } catch (e) {\n // \u041D\u0435 \u043B\u043E\u0433\u0438\u0440\u0443\u0435\u043C \u043E\u0448\u0438\u0431\u043A\u0438 \u043B\u043E\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\n }\n }\n };\n\n // Generate ECDH key pair for secure key exchange (non-extractable) with fallback\n static async generateECDHKeyPair() {\n try {\n // Try P-384 first\n try {\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDH',\n namedCurve: 'P-384'\n },\n false, // Non-extractable for enhanced security\n ['deriveKey']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDH key pair generated successfully (P-384)', {\n curve: 'P-384',\n extractable: false\n });\n \n return keyPair;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 generation failed, trying P-256', { error: p384Error.message });\n \n // Fallback to P-256\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDH',\n namedCurve: 'P-256'\n },\n false, // Non-extractable for enhanced security\n ['deriveKey']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDH key pair generated successfully (P-256 fallback)', {\n curve: 'P-256',\n extractable: false\n });\n \n return keyPair;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'ECDH key generation failed', { error: error.message });\n throw new Error('Failed to create keys for secure exchange');\n }\n }\n\n // Generate ECDSA key pair for digital signatures with fallback\n static async generateECDSAKeyPair() {\n try {\n // Try P-384 first\n try {\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDSA',\n namedCurve: 'P-384'\n },\n false, // Non-extractable for enhanced security\n ['sign', 'verify']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDSA key pair generated successfully (P-384)', {\n curve: 'P-384',\n extractable: false\n });\n \n return keyPair;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 generation failed, trying P-256', { error: p384Error.message });\n \n // Fallback to P-256\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDSA',\n namedCurve: 'P-256'\n },\n false, // Non-extractable for enhanced security\n ['sign', 'verify']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDSA key pair generated successfully (P-256 fallback)', {\n curve: 'P-256',\n extractable: false\n });\n \n return keyPair;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'ECDSA key generation failed', { error: error.message });\n throw new Error('Failed to generate keys for digital signatures');\n }\n }\n\n // Sign data with ECDSA (P-384 or P-256)\n static async signData(privateKey, data) {\n try {\n const encoder = new TextEncoder();\n const dataBuffer = typeof data === 'string' ? encoder.encode(data) : data;\n \n // Try SHA-384 first, fallback to SHA-256\n try {\n const signature = await crypto.subtle.sign(\n {\n name: 'ECDSA',\n hash: 'SHA-384'\n },\n privateKey,\n dataBuffer\n );\n \n return Array.from(new Uint8Array(signature));\n } catch (sha384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'SHA-384 signing failed, trying SHA-256', { error: sha384Error.message });\n \n const signature = await crypto.subtle.sign(\n {\n name: 'ECDSA',\n hash: 'SHA-256'\n },\n privateKey,\n dataBuffer\n );\n \n return Array.from(new Uint8Array(signature));\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Data signing failed', { error: error.message });\n throw new Error('Failed to sign data');\n }\n }\n\n // Verify ECDSA signature (P-384 or P-256)\n static async verifySignature(publicKey, signature, data) {\n try {\n const encoder = new TextEncoder();\n const dataBuffer = typeof data === 'string' ? encoder.encode(data) : data;\n const signatureBuffer = new Uint8Array(signature);\n \n // Try SHA-384 first, fallback to SHA-256\n try {\n const isValid = await crypto.subtle.verify(\n {\n name: 'ECDSA',\n hash: 'SHA-384'\n },\n publicKey,\n signatureBuffer,\n dataBuffer\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signature verification completed (SHA-384)', {\n isValid,\n dataSize: dataBuffer.length\n });\n \n return isValid;\n } catch (sha384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'SHA-384 verification failed, trying SHA-256', { error: sha384Error.message });\n \n const isValid = await crypto.subtle.verify(\n {\n name: 'ECDSA',\n hash: 'SHA-256'\n },\n publicKey,\n signatureBuffer,\n dataBuffer\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signature verification completed (SHA-256 fallback)', {\n isValid,\n dataSize: dataBuffer.length\n });\n \n return isValid;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Signature verification failed', { error: error.message });\n throw new Error('Failed to verify digital signature');\n }\n }\n\n // Enhanced DER/SPKI validation with full ASN.1 parsing\n static async validateKeyStructure(keyData, expectedAlgorithm = 'ECDH') {\n try {\n if (!Array.isArray(keyData) || keyData.length === 0) {\n throw new Error('Invalid key data format');\n }\n\n const keyBytes = new Uint8Array(keyData);\n\n // Size limits to prevent DoS\n if (keyBytes.length < 50) {\n throw new Error('Key data too short - invalid SPKI structure');\n }\n if (keyBytes.length > 2000) {\n throw new Error('Key data too long - possible attack');\n }\n\n // Parse ASN.1 DER structure\n const asn1 = EnhancedSecureCryptoUtils.parseASN1(keyBytes);\n \n // Validate SPKI structure\n if (!asn1 || asn1.tag !== 0x30) {\n throw new Error('Invalid SPKI structure - missing SEQUENCE tag');\n }\n\n // SPKI should have exactly 2 elements: AlgorithmIdentifier and BIT STRING\n if (asn1.children.length !== 2) {\n throw new Error(`Invalid SPKI structure - expected 2 elements, got ${asn1.children.length}`);\n }\n\n // Validate AlgorithmIdentifier\n const algIdentifier = asn1.children[0];\n if (algIdentifier.tag !== 0x30) {\n throw new Error('Invalid AlgorithmIdentifier - not a SEQUENCE');\n }\n\n // Parse algorithm OID\n const algOid = algIdentifier.children[0];\n if (algOid.tag !== 0x06) {\n throw new Error('Invalid algorithm OID - not an OBJECT IDENTIFIER');\n }\n\n // Validate algorithm OID based on expected algorithm\n const oidBytes = algOid.value;\n const oidString = EnhancedSecureCryptoUtils.oidToString(oidBytes);\n \n // Check for expected algorithms\n const validAlgorithms = {\n 'ECDH': ['1.2.840.10045.2.1'], // id-ecPublicKey\n 'ECDSA': ['1.2.840.10045.2.1'], // id-ecPublicKey (same as ECDH)\n 'RSA': ['1.2.840.113549.1.1.1'], // rsaEncryption\n 'AES-GCM': ['2.16.840.1.101.3.4.1.6', '2.16.840.1.101.3.4.1.46'] // AES-128-GCM, AES-256-GCM\n };\n\n const expectedOids = validAlgorithms[expectedAlgorithm];\n if (!expectedOids) {\n throw new Error(`Unknown algorithm: ${expectedAlgorithm}`);\n }\n\n if (!expectedOids.includes(oidString)) {\n throw new Error(`Invalid algorithm OID: expected ${expectedOids.join(' or ')}, got ${oidString}`);\n }\n\n // For EC algorithms, validate curve parameters\n if (expectedAlgorithm === 'ECDH' || expectedAlgorithm === 'ECDSA') {\n if (algIdentifier.children.length < 2) {\n throw new Error('Missing curve parameters for EC key');\n }\n\n const curveOid = algIdentifier.children[1];\n if (curveOid.tag !== 0x06) {\n throw new Error('Invalid curve OID - not an OBJECT IDENTIFIER');\n }\n\n const curveOidString = EnhancedSecureCryptoUtils.oidToString(curveOid.value);\n \n // Only allow P-256 and P-384 curves\n const validCurves = {\n '1.2.840.10045.3.1.7': 'P-256', // secp256r1\n '1.3.132.0.34': 'P-384' // secp384r1\n };\n\n if (!validCurves[curveOidString]) {\n throw new Error(`Invalid or unsupported curve OID: ${curveOidString}`);\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'EC key curve validated', {\n curve: validCurves[curveOidString],\n oid: curveOidString\n });\n }\n\n // Validate public key BIT STRING\n const publicKeyBitString = asn1.children[1];\n if (publicKeyBitString.tag !== 0x03) {\n throw new Error('Invalid public key - not a BIT STRING');\n }\n\n // Check for unused bits (should be 0 for public keys)\n if (publicKeyBitString.value[0] !== 0x00) {\n throw new Error(`Invalid BIT STRING - unexpected unused bits: ${publicKeyBitString.value[0]}`);\n }\n\n // For EC keys, validate point format\n if (expectedAlgorithm === 'ECDH' || expectedAlgorithm === 'ECDSA') {\n const pointData = publicKeyBitString.value.slice(1); // Skip unused bits byte\n \n // Check for uncompressed point format (0x04)\n if (pointData[0] !== 0x04) {\n throw new Error(`Invalid EC point format: expected uncompressed (0x04), got 0x${pointData[0].toString(16)}`);\n }\n\n // Validate point size based on curve\n const expectedSizes = {\n 'P-256': 65, // 1 + 32 + 32\n 'P-384': 97 // 1 + 48 + 48\n };\n\n // We already validated the curve above, so we can determine expected size\n const curveOidString = EnhancedSecureCryptoUtils.oidToString(algIdentifier.children[1].value);\n const curveName = curveOidString === '1.2.840.10045.3.1.7' ? 'P-256' : 'P-384';\n const expectedSize = expectedSizes[curveName];\n\n if (pointData.length !== expectedSize) {\n throw new Error(`Invalid EC point size for ${curveName}: expected ${expectedSize}, got ${pointData.length}`);\n }\n }\n\n // Additional validation: try to import the key\n try {\n const algorithm = expectedAlgorithm === 'ECDSA' || expectedAlgorithm === 'ECDH'\n ? { name: expectedAlgorithm, namedCurve: 'P-384' }\n : { name: expectedAlgorithm };\n\n const usages = expectedAlgorithm === 'ECDSA' ? ['verify'] : [];\n \n await crypto.subtle.importKey('spki', keyBytes.buffer, algorithm, false, usages);\n } catch (importError) {\n // Try P-256 as fallback for EC keys\n if (expectedAlgorithm === 'ECDSA' || expectedAlgorithm === 'ECDH') {\n try {\n const algorithm = { name: expectedAlgorithm, namedCurve: 'P-256' };\n const usages = expectedAlgorithm === 'ECDSA' ? ['verify'] : [];\n await crypto.subtle.importKey('spki', keyBytes.buffer, algorithm, false, usages);\n } catch (fallbackError) {\n throw new Error(`Key import validation failed: ${fallbackError.message}`);\n }\n } else {\n throw new Error(`Key import validation failed: ${importError.message}`);\n }\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Key structure validation passed', {\n keyLen: keyBytes.length,\n algorithm: expectedAlgorithm,\n asn1Valid: true,\n oidValid: true,\n importValid: true\n });\n\n return true;\n } catch (err) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Key structure validation failed', {\n error: err.message,\n algorithm: expectedAlgorithm\n });\n throw new Error(`Invalid key structure: ${err.message}`);\n }\n }\n\n // ASN.1 DER parser helper\n static parseASN1(bytes, offset = 0) {\n if (offset >= bytes.length) {\n return null;\n }\n\n const tag = bytes[offset];\n let lengthOffset = offset + 1;\n \n if (lengthOffset >= bytes.length) {\n throw new Error('Truncated ASN.1 structure');\n }\n\n let length = bytes[lengthOffset];\n let valueOffset = lengthOffset + 1;\n\n // Handle long form length\n if (length & 0x80) {\n const numLengthBytes = length & 0x7f;\n if (numLengthBytes > 4) {\n throw new Error('ASN.1 length too large');\n }\n \n length = 0;\n for (let i = 0; i < numLengthBytes; i++) {\n if (valueOffset + i >= bytes.length) {\n throw new Error('Truncated ASN.1 length');\n }\n length = (length << 8) | bytes[valueOffset + i];\n }\n valueOffset += numLengthBytes;\n }\n\n if (valueOffset + length > bytes.length) {\n throw new Error('ASN.1 structure extends beyond data');\n }\n\n const value = bytes.slice(valueOffset, valueOffset + length);\n const node = {\n tag: tag,\n length: length,\n value: value,\n children: []\n };\n\n // Parse children for SEQUENCE and SET\n if (tag === 0x30 || tag === 0x31) {\n let childOffset = 0;\n while (childOffset < value.length) {\n const child = EnhancedSecureCryptoUtils.parseASN1(value, childOffset);\n if (!child) break;\n node.children.push(child);\n childOffset = childOffset + 1 + child.lengthBytes + child.length;\n }\n }\n\n // Calculate how many bytes were used for length encoding\n node.lengthBytes = valueOffset - lengthOffset;\n \n return node;\n }\n\n // OID decoder helper\n static oidToString(bytes) {\n if (!bytes || bytes.length === 0) {\n throw new Error('Empty OID');\n }\n\n const parts = [];\n \n // First byte encodes first two components\n const first = Math.floor(bytes[0] / 40);\n const second = bytes[0] % 40;\n parts.push(first);\n parts.push(second);\n\n // Decode remaining components\n let value = 0;\n for (let i = 1; i < bytes.length; i++) {\n value = (value << 7) | (bytes[i] & 0x7f);\n if (!(bytes[i] & 0x80)) {\n parts.push(value);\n value = 0;\n }\n }\n\n return parts.join('.');\n }\n\n // Helper to validate and sanitize OID string\n static validateOidString(oidString) {\n // OID format: digits separated by dots\n const oidRegex = /^[0-9]+(\\.[0-9]+)*$/;\n if (!oidRegex.test(oidString)) {\n throw new Error(`Invalid OID format: ${oidString}`);\n }\n\n const parts = oidString.split('.').map(Number);\n \n // First component must be 0, 1, or 2\n if (parts[0] > 2) {\n throw new Error(`Invalid OID first component: ${parts[0]}`);\n }\n\n // If first component is 0 or 1, second must be <= 39\n if ((parts[0] === 0 || parts[0] === 1) && parts[1] > 39) {\n throw new Error(`Invalid OID second component: ${parts[1]} (must be <= 39 for first component ${parts[0]})`);\n }\n\n return true;\n }\n\n // Export public key for transmission with signature \n static async exportPublicKeyWithSignature(publicKey, signingKey, keyType = 'ECDH') {\n try {\n // Validate key type\n if (!['ECDH', 'ECDSA'].includes(keyType)) {\n throw new Error('Invalid key type');\n }\n \n const exported = await crypto.subtle.exportKey('spki', publicKey);\n const keyData = Array.from(new Uint8Array(exported));\n \n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, keyType);\n \n // Create signed key package\n const keyPackage = {\n keyType,\n keyData,\n timestamp: Date.now(),\n version: '4.0'\n };\n \n // Sign the key package\n const packageString = JSON.stringify(keyPackage);\n const signature = await EnhancedSecureCryptoUtils.signData(signingKey, packageString);\n \n const signedPackage = {\n ...keyPackage,\n signature\n };\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Public key exported with signature', {\n keyType,\n keySize: keyData.length,\n signed: true\n });\n \n return signedPackage;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Public key export failed', {\n error: error.message,\n keyType\n });\n throw new Error(`Failed to export ${keyType} key: ${error.message}`);\n }\n }\n\n // Import and verify signed public key\n static async importSignedPublicKey(signedPackage, verifyingKey, expectedKeyType = 'ECDH') {\n try {\n // Validate package structure\n if (!signedPackage || typeof signedPackage !== 'object') {\n throw new Error('Invalid signed package format');\n }\n \n const { keyType, keyData, timestamp, version, signature } = signedPackage;\n \n if (!keyType || !keyData || !timestamp || !signature) {\n throw new Error('Missing required fields in signed package');\n }\n \n if (!EnhancedSecureCryptoUtils.constantTimeCompare(keyType, expectedKeyType)) {\n throw new Error(`Key type mismatch: expected ${expectedKeyType}, got ${keyType}`);\n }\n \n // Check timestamp (reject keys older than 1 hour)\n const keyAge = Date.now() - timestamp;\n if (keyAge > 3600000) {\n throw new Error('Signed key package is too old');\n }\n \n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, keyType);\n \n // Verify signature\n const packageCopy = { keyType, keyData, timestamp, version };\n const packageString = JSON.stringify(packageCopy);\n const isValidSignature = await EnhancedSecureCryptoUtils.verifySignature(verifyingKey, signature, packageString);\n \n if (!isValidSignature) {\n throw new Error('Invalid signature on key package - possible MITM attack');\n }\n \n // Import the key with fallback support\n const keyBytes = new Uint8Array(keyData);\n \n // Try P-384 first\n try {\n const algorithm = keyType === 'ECDH' ?\n { name: 'ECDH', namedCurve: 'P-384' }\n : { name: 'ECDSA', namedCurve: 'P-384' };\n \n const keyUsages = keyType === 'ECDH' ? [] : ['verify'];\n \n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n algorithm,\n false, // Non-extractable\n keyUsages\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signed public key imported successfully (P-384)', {\n keyType,\n signatureValid: true,\n keyAge: Math.round(keyAge / 1000) + 's'\n });\n \n return publicKey;\n } catch (p384Error) {\n // Fallback to P-256\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 import failed, trying P-256', {\n error: p384Error.message\n });\n \n const algorithm = keyType === 'ECDH' ?\n { name: 'ECDH', namedCurve: 'P-256' }\n : { name: 'ECDSA', namedCurve: 'P-256' };\n \n const keyUsages = keyType === 'ECDH' ? [] : ['verify'];\n \n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n algorithm,\n false, // Non-extractable\n keyUsages\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signed public key imported successfully (P-256 fallback)', {\n keyType,\n signatureValid: true,\n keyAge: Math.round(keyAge / 1000) + 's'\n });\n \n return publicKey;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Signed public key import failed', {\n error: error.message,\n expectedKeyType\n });\n throw new Error(`Failed to import the signed key: ${error.message}`);\n }\n }\n\n // Legacy export for backward compatibility\n static async exportPublicKey(publicKey) {\n try {\n const exported = await crypto.subtle.exportKey('spki', publicKey);\n const keyData = Array.from(new Uint8Array(exported));\n \n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, 'ECDH');\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Legacy public key exported', { keySize: keyData.length });\n return keyData;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Legacy public key export failed', { error: error.message });\n throw new Error('Failed to export the public key');\n }\n }\n\n // Legacy import for backward compatibility with fallback\n static async importPublicKey(keyData) {\n try {\n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, 'ECDH');\n \n const keyBytes = new Uint8Array(keyData);\n \n // Try P-384 first\n try {\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: 'ECDH',\n namedCurve: 'P-384'\n },\n false, // Non-extractable\n []\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Legacy public key imported (P-384)', { keySize: keyData.length });\n return publicKey;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 import failed, trying P-256', { error: p384Error.message });\n \n // Fallback to P-256\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: 'ECDH',\n namedCurve: 'P-256'\n },\n false, // Non-extractable\n []\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Legacy public key imported (P-256 fallback)', { keySize: keyData.length });\n return publicKey;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Legacy public key import failed', { error: error.message });\n throw new Error('Failed to import the public key');\n }\n }\n\n\n // Method to check if a key is trusted\n static isKeyTrusted(keyOrFingerprint) {\n if (keyOrFingerprint instanceof CryptoKey) {\n const meta = EnhancedSecureCryptoUtils._keyMetadata.get(keyOrFingerprint);\n return meta ? meta.trusted === true : false;\n } else if (keyOrFingerprint && keyOrFingerprint._securityMetadata) {\n // Check by key metadata\n return keyOrFingerprint._securityMetadata.trusted === true;\n }\n\n return false;\n }\n\n static async importPublicKeyFromSignedPackage(signedPackage, verifyingKey = null, options = {}) {\n try {\n if (!signedPackage || !signedPackage.keyData || !signedPackage.signature) {\n throw new Error('Invalid signed key package format');\n }\n\n // Validate all required fields are present\n const requiredFields = ['keyData', 'signature', 'keyType', 'timestamp', 'version'];\n const missingFields = requiredFields.filter(field => !signedPackage[field]);\n\n if (missingFields.length > 0) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Missing required fields in signed package', {\n missingFields: missingFields,\n availableFields: Object.keys(signedPackage)\n });\n throw new Error(`Required fields are missing in the signed package: ${missingFields.join(', ')}`);\n }\n\n // SECURITY ENHANCEMENT: MANDATORY signature verification for signed packages\n if (!verifyingKey) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'SECURITY VIOLATION: Signed package received without verifying key', {\n keyType: signedPackage.keyType,\n keySize: signedPackage.keyData.length,\n timestamp: signedPackage.timestamp,\n version: signedPackage.version,\n securityRisk: 'HIGH - Potential MITM attack vector'\n });\n\n // REJECT the signed package if no verifying key provided\n throw new Error('CRITICAL SECURITY ERROR: Signed key package received without a verification key. ' +\n 'This may indicate a possible MITM attack attempt. Import rejected for security reasons.');\n }\n\n // \u041E\u0411\u041D\u041E\u0412\u041B\u0415\u041D\u041E: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C \u0443\u043B\u0443\u0447\u0448\u0435\u043D\u043D\u0443\u044E \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u044E\n await EnhancedSecureCryptoUtils.validateKeyStructure(signedPackage.keyData, signedPackage.keyType || 'ECDH');\n\n // MANDATORY signature verification when verifyingKey is provided\n const packageCopy = { ...signedPackage };\n delete packageCopy.signature;\n const packageString = JSON.stringify(packageCopy);\n const isValidSignature = await EnhancedSecureCryptoUtils.verifySignature(verifyingKey, signedPackage.signature, packageString);\n\n if (!isValidSignature) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'SECURITY BREACH: Invalid signature detected - MITM attack prevented', {\n keyType: signedPackage.keyType,\n keySize: signedPackage.keyData.length,\n timestamp: signedPackage.timestamp,\n version: signedPackage.version,\n attackPrevented: true\n });\n throw new Error('CRITICAL SECURITY ERROR: Invalid key signature detected. ' +\n 'This indicates a possible MITM attack attempt. Key import rejected.');\n }\n\n // Additional MITM protection: Check for key reuse and suspicious patterns\n const keyFingerprint = await EnhancedSecureCryptoUtils.calculateKeyFingerprint(signedPackage.keyData);\n\n // Log successful verification with security details\n EnhancedSecureCryptoUtils.secureLog.log('info', 'SECURE: Signature verification passed for signed package', {\n keyType: signedPackage.keyType,\n keySize: signedPackage.keyData.length,\n timestamp: signedPackage.timestamp,\n version: signedPackage.version,\n signatureVerified: true,\n securityLevel: 'HIGH',\n keyFingerprint: keyFingerprint.substring(0, 8) // Only log first 8 chars for security\n });\n\n // Import the public key with fallback\n const keyBytes = new Uint8Array(signedPackage.keyData);\n const keyType = signedPackage.keyType || 'ECDH';\n\n // Try P-384 first\n try {\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: keyType,\n namedCurve: 'P-384'\n },\n false, // Non-extractable\n keyType === 'ECDSA' ? ['verify'] : []\n );\n\n // Use WeakMap to store metadata\n EnhancedSecureCryptoUtils._keyMetadata.set(publicKey, {\n trusted: true,\n verificationStatus: 'VERIFIED_SECURE',\n verificationTimestamp: Date.now()\n });\n\n return publicKey;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 import failed, trying P-256', { error: p384Error.message });\n\n // Fallback to P-256\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: keyType,\n namedCurve: 'P-256'\n },\n false, // Non-extractable\n keyType === 'ECDSA' ? ['verify'] : []\n );\n\n // Use WeakMap to store metadata\n EnhancedSecureCryptoUtils._keyMetadata.set(publicKey, {\n trusted: true,\n verificationStatus: 'VERIFIED_SECURE',\n verificationTimestamp: Date.now()\n });\n\n return publicKey;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Signed package key import failed', {\n error: error.message,\n securityImplications: 'Potential security breach prevented'\n });\n throw new Error(`Failed to import the public key from the signed package: ${error.message}`);\n }\n }\n\n // Enhanced key derivation with metadata protection and 64-byte salt\n static async deriveSharedKeys(privateKey, publicKey, salt) {\n try {\n // Validate input parameters are CryptoKey instances\n if (!(privateKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Private key is not a CryptoKey', {\n privateKeyType: typeof privateKey,\n privateKeyAlgorithm: privateKey?.algorithm?.name\n });\n throw new Error('The private key is not a valid CryptoKey.');\n }\n \n if (!(publicKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Public key is not a CryptoKey', {\n publicKeyType: typeof publicKey,\n publicKeyAlgorithm: publicKey?.algorithm?.name\n });\n throw new Error('The private key is not a valid CryptoKey.');\n }\n \n // Validate salt size (should be 64 bytes for enhanced security)\n if (!salt || salt.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes for enhanced security');\n }\n \n const saltBytes = new Uint8Array(salt);\n const encoder = new TextEncoder();\n \n // Enhanced context info with version and additional entropy\n const contextInfo = encoder.encode('SecureBit.chat v4.0 Enhanced Security Edition');\n \n // Derive master shared secret with enhanced parameters\n // Try SHA-384 first, fallback to SHA-256\n let sharedSecret;\n try {\n sharedSecret = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey\n },\n privateKey,\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: contextInfo\n },\n false, // Non-extractable\n ['deriveKey']\n );\n } catch (sha384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'SHA-384 key derivation failed, trying SHA-256', { \n error: sha384Error.message,\n privateKeyType: typeof privateKey,\n publicKeyType: typeof publicKey,\n privateKeyAlgorithm: privateKey?.algorithm?.name,\n publicKeyAlgorithm: publicKey?.algorithm?.name\n });\n \n sharedSecret = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey\n },\n privateKey,\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: contextInfo\n },\n false, // Non-extractable\n ['deriveKey']\n );\n }\n\n // Derive message encryption key with fallback\n let encryptionKey;\n try {\n encryptionKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('message-encryption-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable for enhanced security\n ['encrypt', 'decrypt']\n );\n } catch (sha384Error) {\n encryptionKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('message-encryption-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable for enhanced security\n ['encrypt', 'decrypt']\n );\n }\n\n // Derive MAC key for message authentication with fallback\n let macKey;\n try {\n macKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('message-authentication-v4')\n },\n sharedSecret,\n {\n name: 'HMAC',\n hash: 'SHA-384'\n },\n false, // Non-extractable\n ['sign', 'verify']\n );\n } catch (sha384Error) {\n macKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('message-authentication-v4')\n },\n sharedSecret,\n {\n name: 'HMAC',\n hash: 'SHA-256'\n },\n false, // Non-extractable\n ['sign', 'verify']\n );\n }\n\n // Derive separate metadata encryption key with fallback\n let metadataKey;\n try {\n metadataKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('metadata-protection-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable\n ['encrypt', 'decrypt']\n );\n } catch (sha384Error) {\n metadataKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('metadata-protection-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable\n ['encrypt', 'decrypt']\n );\n }\n\n // Generate temporary extractable key for fingerprint calculation with fallback\n let fingerprintKey;\n try {\n fingerprintKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('fingerprint-generation-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n true, // Extractable only for fingerprint\n ['encrypt', 'decrypt']\n );\n } catch (sha384Error) {\n fingerprintKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('fingerprint-generation-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n true, // Extractable only for fingerprint\n ['encrypt', 'decrypt']\n );\n }\n\n // Generate key fingerprint for verification\n const fingerprintKeyData = await crypto.subtle.exportKey('raw', fingerprintKey);\n const fingerprint = await EnhancedSecureCryptoUtils.generateKeyFingerprint(Array.from(new Uint8Array(fingerprintKeyData)));\n\n // Validate that all derived keys are CryptoKey instances\n if (!(encryptionKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Derived encryption key is not a CryptoKey', {\n encryptionKeyType: typeof encryptionKey,\n encryptionKeyAlgorithm: encryptionKey?.algorithm?.name\n });\n throw new Error('The derived encryption key is not a valid CryptoKey.');\n }\n \n if (!(macKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Derived MAC key is not a CryptoKey', {\n macKeyType: typeof macKey,\n macKeyAlgorithm: macKey?.algorithm?.name\n });\n throw new Error('The derived MAC key is not a valid CryptoKey.');\n }\n \n if (!(metadataKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Derived metadata key is not a CryptoKey', {\n metadataKeyType: typeof metadataKey,\n metadataKeyAlgorithm: metadataKey?.algorithm?.name\n });\n throw new Error('The derived metadata key is not a valid CryptoKey.');\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Enhanced shared keys derived successfully', {\n saltSize: salt.length,\n hasMetadataKey: true,\n nonExtractable: true,\n version: '4.0',\n allKeysValid: true\n });\n\n return {\n encryptionKey,\n macKey,\n metadataKey,\n fingerprint,\n timestamp: Date.now(),\n version: '4.0'\n };\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Enhanced key derivation failed', { error: error.message });\n throw new Error(`Failed to create shared encryption keys: ${error.message}`);\n }\n }\n\n static async generateKeyFingerprint(keyData) {\n const keyBuffer = new Uint8Array(keyData);\n const hashBuffer = await crypto.subtle.digest('SHA-384', keyBuffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.slice(0, 12).map(b => b.toString(16).padStart(2, '0')).join(':');\n }\n\n // Generate mutual authentication challenge\n static generateMutualAuthChallenge() {\n const challenge = crypto.getRandomValues(new Uint8Array(48)); // Increased to 48 bytes\n const timestamp = Date.now();\n const nonce = crypto.getRandomValues(new Uint8Array(16));\n \n return {\n challenge: Array.from(challenge),\n timestamp,\n nonce: Array.from(nonce),\n version: '4.0'\n };\n }\n\n // Create cryptographic proof for mutual authentication\n static async createAuthProof(challenge, privateKey, publicKey) {\n try {\n if (!challenge || !challenge.challenge || !challenge.timestamp || !challenge.nonce) {\n throw new Error('Invalid challenge structure');\n }\n \n // Check challenge age (max 2 minutes)\n const challengeAge = Date.now() - challenge.timestamp;\n if (challengeAge > 120000) {\n throw new Error('Challenge expired');\n }\n \n // Create proof data\n const proofData = {\n challenge: challenge.challenge,\n timestamp: challenge.timestamp,\n nonce: challenge.nonce,\n responseTimestamp: Date.now(),\n publicKeyHash: await EnhancedSecureCryptoUtils.hashPublicKey(publicKey)\n };\n \n // Sign the proof\n const proofString = JSON.stringify(proofData);\n const signature = await EnhancedSecureCryptoUtils.signData(privateKey, proofString);\n \n const proof = {\n ...proofData,\n signature,\n version: '4.0'\n };\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Authentication proof created', {\n challengeAge: Math.round(challengeAge / 1000) + 's'\n });\n \n return proof;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Authentication proof creation failed', { error: error.message });\n throw new Error(`Failed to create cryptographic proof: ${error.message}`);\n }\n }\n\n // Verify mutual authentication proof\n static async verifyAuthProof(proof, challenge, publicKey) {\n try {\n await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 20) + 5));\n // Assert the public key is valid and has the correct usage\n EnhancedSecureCryptoUtils.assertCryptoKey(publicKey, 'ECDSA', ['verify']);\n\n if (!proof || !challenge || !publicKey) {\n throw new Error('Missing required parameters for proof verification');\n }\n\n // Validate proof structure\n const requiredFields = ['challenge', 'timestamp', 'nonce', 'responseTimestamp', 'publicKeyHash', 'signature'];\n for (const field of requiredFields) {\n if (!proof[field]) {\n throw new Error(`Missing required field: ${field}`);\n }\n }\n\n // Verify challenge matches\n if (!EnhancedSecureCryptoUtils.constantTimeCompareArrays(proof.challenge, challenge.challenge) ||\n proof.timestamp !== challenge.timestamp ||\n !EnhancedSecureCryptoUtils.constantTimeCompareArrays(proof.nonce, challenge.nonce)) {\n throw new Error('Challenge mismatch - possible replay attack');\n }\n\n // Check response time (max 5 minutes)\n const responseAge = Date.now() - proof.responseTimestamp;\n if (responseAge > 300000) {\n throw new Error('Proof response expired');\n }\n\n // Verify public key hash\n const expectedHash = await EnhancedSecureCryptoUtils.hashPublicKey(publicKey);\n if (!EnhancedSecureCryptoUtils.constantTimeCompare(proof.publicKeyHash, expectedHash)) {\n throw new Error('Public key hash mismatch');\n }\n\n // Verify signature\n const proofCopy = { ...proof };\n delete proofCopy.signature;\n const proofString = JSON.stringify(proofCopy);\n const isValidSignature = await EnhancedSecureCryptoUtils.verifySignature(publicKey, proof.signature, proofString);\n\n if (!isValidSignature) {\n throw new Error('Invalid proof signature');\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Authentication proof verified successfully', {\n responseAge: Math.round(responseAge / 1000) + 's'\n });\n\n return true;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Authentication proof verification failed', { error: error.message });\n throw new Error(`Failed to verify cryptographic proof: ${error.message}`);\n }\n }\n\n // Hash public key for verification\n static async hashPublicKey(publicKey) {\n try {\n const exported = await crypto.subtle.exportKey('spki', publicKey);\n const hash = await crypto.subtle.digest('SHA-384', exported);\n const hashArray = Array.from(new Uint8Array(hash));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Public key hashing failed', { error: error.message });\n throw new Error('Failed to create hash of the public key');\n }\n }\n\n // Legacy authentication challenge for backward compatibility\n static generateAuthChallenge() {\n const challenge = crypto.getRandomValues(new Uint8Array(32));\n return Array.from(challenge);\n }\n\n // Generate verification code for out-of-band authentication\n static generateVerificationCode() {\n const chars = '0123456789ABCDEF';\n let result = '';\n const values = crypto.getRandomValues(new Uint8Array(6));\n for (let i = 0; i < 6; i++) {\n result += chars[values[i] % chars.length];\n }\n return result.match(/.{1,2}/g).join('-');\n }\n\n // Enhanced message encryption with metadata protection and sequence numbers\n static async encryptMessage(message, encryptionKey, macKey, metadataKey, messageId, sequenceNumber = 0) {\n try {\n if (!message || typeof message !== 'string') {\n throw new Error('Invalid message format');\n }\n\n EnhancedSecureCryptoUtils.assertCryptoKey(encryptionKey, 'AES-GCM', ['encrypt']);\n EnhancedSecureCryptoUtils.assertCryptoKey(macKey, 'HMAC', ['sign']);\n EnhancedSecureCryptoUtils.assertCryptoKey(metadataKey, 'AES-GCM', ['encrypt']);\n\n const encoder = new TextEncoder();\n const messageData = encoder.encode(message);\n const messageIv = crypto.getRandomValues(new Uint8Array(12));\n const metadataIv = crypto.getRandomValues(new Uint8Array(12));\n const timestamp = Date.now();\n\n const paddingSize = 16 - (messageData.length % 16);\n const paddedMessage = new Uint8Array(messageData.length + paddingSize);\n paddedMessage.set(messageData);\n const padding = crypto.getRandomValues(new Uint8Array(paddingSize));\n paddedMessage.set(padding, messageData.length);\n\n const encryptedMessage = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: messageIv },\n encryptionKey,\n paddedMessage\n );\n\n const metadata = {\n id: messageId,\n timestamp: timestamp,\n sequenceNumber: sequenceNumber,\n originalLength: messageData.length,\n version: '4.0'\n };\n\n const metadataStr = JSON.stringify(EnhancedSecureCryptoUtils.sortObjectKeys(metadata));\n const encryptedMetadata = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: metadataIv },\n metadataKey,\n encoder.encode(metadataStr)\n );\n\n const payload = {\n messageIv: Array.from(messageIv),\n messageData: Array.from(new Uint8Array(encryptedMessage)),\n metadataIv: Array.from(metadataIv),\n metadataData: Array.from(new Uint8Array(encryptedMetadata)),\n version: '4.0'\n };\n\n const sortedPayload = EnhancedSecureCryptoUtils.sortObjectKeys(payload);\n const payloadStr = JSON.stringify(sortedPayload);\n\n const mac = await crypto.subtle.sign(\n 'HMAC',\n macKey,\n encoder.encode(payloadStr)\n );\n\n payload.mac = Array.from(new Uint8Array(mac));\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Message encrypted with metadata protection', {\n messageId,\n sequenceNumber,\n hasMetadataProtection: true,\n hasPadding: true\n });\n\n return payload;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Message encryption failed', {\n error: error.message,\n messageId\n });\n throw new Error(`Failed to encrypt the message: ${error.message}`);\n }\n }\n\n // Enhanced message decryption with metadata protection and sequence validation\n static async decryptMessage(encryptedPayload, encryptionKey, macKey, metadataKey, expectedSequenceNumber = null) {\n try {\n EnhancedSecureCryptoUtils.assertCryptoKey(encryptionKey, 'AES-GCM', ['decrypt']);\n EnhancedSecureCryptoUtils.assertCryptoKey(macKey, 'HMAC', ['verify']);\n EnhancedSecureCryptoUtils.assertCryptoKey(metadataKey, 'AES-GCM', ['decrypt']);\n\n const requiredFields = ['messageIv', 'messageData', 'metadataIv', 'metadataData', 'mac', 'version'];\n for (const field of requiredFields) {\n if (!encryptedPayload[field]) {\n throw new Error(`Missing required field: ${field}`);\n }\n }\n\n const payloadCopy = { ...encryptedPayload };\n delete payloadCopy.mac;\n const sortedPayloadCopy = EnhancedSecureCryptoUtils.sortObjectKeys(payloadCopy);\n const payloadStr = JSON.stringify(sortedPayloadCopy);\n\n const macValid = await crypto.subtle.verify(\n 'HMAC',\n macKey,\n new Uint8Array(encryptedPayload.mac),\n new TextEncoder().encode(payloadStr)\n );\n\n if (!macValid) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'MAC verification failed', {\n payloadFields: Object.keys(encryptedPayload),\n macLength: encryptedPayload.mac?.length\n });\n throw new Error('Message authentication failed - possible tampering');\n }\n\n const metadataIv = new Uint8Array(encryptedPayload.metadataIv);\n const metadataData = new Uint8Array(encryptedPayload.metadataData);\n\n const decryptedMetadataBuffer = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: metadataIv },\n metadataKey,\n metadataData\n );\n\n const metadataStr = new TextDecoder().decode(decryptedMetadataBuffer);\n const metadata = JSON.parse(metadataStr);\n\n if (!metadata.id || !metadata.timestamp || metadata.sequenceNumber === undefined || !metadata.originalLength) {\n throw new Error('Invalid metadata structure');\n }\n\n const messageAge = Date.now() - metadata.timestamp;\n if (messageAge > 300000) {\n throw new Error('Message expired (older than 5 minutes)');\n }\n\n if (expectedSequenceNumber !== null) {\n if (metadata.sequenceNumber < expectedSequenceNumber) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'Received message with lower sequence number, possible queued message', {\n expected: expectedSequenceNumber,\n received: metadata.sequenceNumber,\n messageId: metadata.id\n });\n } else if (metadata.sequenceNumber > expectedSequenceNumber + 10) {\n throw new Error(`Sequence number gap too large: expected around ${expectedSequenceNumber}, got ${metadata.sequenceNumber}`);\n }\n }\n\n const messageIv = new Uint8Array(encryptedPayload.messageIv);\n const messageData = new Uint8Array(encryptedPayload.messageData);\n\n const decryptedMessageBuffer = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: messageIv },\n encryptionKey,\n messageData\n );\n\n const paddedMessage = new Uint8Array(decryptedMessageBuffer);\n const originalMessage = paddedMessage.slice(0, metadata.originalLength);\n\n const decoder = new TextDecoder();\n const message = decoder.decode(originalMessage);\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Message decrypted successfully', {\n messageId: metadata.id,\n sequenceNumber: metadata.sequenceNumber,\n messageAge: Math.round(messageAge / 1000) + 's'\n });\n\n return {\n message: message,\n messageId: metadata.id,\n timestamp: metadata.timestamp,\n sequenceNumber: metadata.sequenceNumber\n };\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Message decryption failed', { error: error.message });\n throw new Error(`Failed to decrypt the message: ${error.message}`);\n }\n }\n\n // Enhanced input sanitization\n static sanitizeMessage(message) {\n if (typeof message !== 'string') {\n throw new Error('Message must be a string');\n }\n \n return message\n .replace(/)<[^<]*)*<\\/script>/gi, '')\n .replace(/javascript:/gi, '')\n .replace(/data:/gi, '')\n .replace(/vbscript:/gi, '')\n .replace(/onload\\s*=/gi, '')\n .replace(/onerror\\s*=/gi, '')\n .replace(/onclick\\s*=/gi, '')\n .trim()\n .substring(0, 2000); // Increased limit\n }\n\n // Generate cryptographically secure salt (64 bytes for enhanced security)\n static generateSalt() {\n return Array.from(crypto.getRandomValues(new Uint8Array(64)));\n }\n\n // Calculate key fingerprint for MITM protection\n static async calculateKeyFingerprint(keyData) {\n try {\n const encoder = new TextEncoder();\n const keyBytes = new Uint8Array(keyData);\n \n // Create a hash of the key data for fingerprinting\n const hashBuffer = await crypto.subtle.digest('SHA-256', keyBytes);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n \n // Convert to hexadecimal string\n const fingerprint = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Key fingerprint calculated', {\n keySize: keyData.length,\n fingerprintLength: fingerprint.length\n });\n \n return fingerprint;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Key fingerprint calculation failed', { error: error.message });\n throw new Error('Failed to compute the key fingerprint');\n }\n }\n\n static constantTimeCompare(a, b) {\n const strA = typeof a === 'string' ? a : JSON.stringify(a);\n const strB = typeof b === 'string' ? b : JSON.stringify(b);\n \n if (strA.length !== strB.length) {\n let dummy = 0;\n for (let i = 0; i < Math.max(strA.length, strB.length); i++) {\n dummy |= (strA.charCodeAt(i % strA.length) || 0) ^ (strB.charCodeAt(i % strB.length) || 0);\n }\n return false;\n }\n \n let result = 0;\n for (let i = 0; i < strA.length; i++) {\n result |= strA.charCodeAt(i) ^ strB.charCodeAt(i);\n }\n \n return result === 0;\n }\n\n static constantTimeCompareArrays(arr1, arr2) {\n if (!Array.isArray(arr1) || !Array.isArray(arr2)) {\n return false;\n }\n \n if (arr1.length !== arr2.length) {\n let dummy = 0;\n const maxLen = Math.max(arr1.length, arr2.length);\n for (let i = 0; i < maxLen; i++) {\n dummy |= (arr1[i % arr1.length] || 0) ^ (arr2[i % arr2.length] || 0);\n }\n return false;\n }\n \n let result = 0;\n for (let i = 0; i < arr1.length; i++) {\n result |= arr1[i] ^ arr2[i];\n }\n \n return result === 0;\n }\n \n /**\n * CRITICAL SECURITY: Encrypt data with AAD (Additional Authenticated Data)\n * This method provides authenticated encryption with additional data binding\n */\n static async encryptDataWithAAD(data, key, aad) {\n try {\n const dataString = typeof data === 'string' ? data : JSON.stringify(data);\n const encoder = new TextEncoder();\n const dataBuffer = encoder.encode(dataString);\n const aadBuffer = encoder.encode(aad);\n\n // Generate random IV\n const iv = crypto.getRandomValues(new Uint8Array(12));\n\n // Encrypt with AAD\n const encrypted = await crypto.subtle.encrypt(\n { \n name: 'AES-GCM', \n iv: iv,\n additionalData: aadBuffer\n },\n key,\n dataBuffer\n );\n\n // Package encrypted data\n const encryptedPackage = {\n version: '1.0',\n iv: Array.from(iv),\n data: Array.from(new Uint8Array(encrypted)),\n aad: aad,\n timestamp: Date.now()\n };\n\n const packageString = JSON.stringify(encryptedPackage);\n const packageBuffer = encoder.encode(packageString);\n \n return EnhancedSecureCryptoUtils.arrayBufferToBase64(packageBuffer);\n } catch (error) {\n throw new Error(`AAD encryption failed: ${error.message}`);\n }\n }\n\n /**\n * CRITICAL SECURITY: Decrypt data with AAD validation\n * This method provides authenticated decryption with additional data validation\n */\n static async decryptDataWithAAD(encryptedData, key, expectedAad) {\n try {\n const packageBuffer = EnhancedSecureCryptoUtils.base64ToArrayBuffer(encryptedData);\n const packageString = new TextDecoder().decode(packageBuffer);\n const encryptedPackage = JSON.parse(packageString);\n\n if (!encryptedPackage.version || !encryptedPackage.iv || !encryptedPackage.data || !encryptedPackage.aad) {\n throw new Error('Invalid encrypted data format');\n }\n\n // Validate AAD matches expected\n if (encryptedPackage.aad !== expectedAad) {\n throw new Error('AAD mismatch - possible tampering or replay attack');\n }\n\n const iv = new Uint8Array(encryptedPackage.iv);\n const encrypted = new Uint8Array(encryptedPackage.data);\n const aadBuffer = new TextEncoder().encode(encryptedPackage.aad);\n\n // Decrypt with AAD validation\n const decrypted = await crypto.subtle.decrypt(\n { \n name: 'AES-GCM', \n iv: iv,\n additionalData: aadBuffer\n },\n key,\n encrypted\n );\n\n const decryptedString = new TextDecoder().decode(decrypted);\n\n try {\n return JSON.parse(decryptedString);\n } catch {\n return decryptedString;\n }\n } catch (error) {\n throw new Error(`AAD decryption failed: ${error.message}`);\n }\n }\n\n // Initialize secure logging system after class definition\n static {\n if (EnhancedSecureCryptoUtils.secureLog && typeof EnhancedSecureCryptoUtils.secureLog.init === 'function') {\n EnhancedSecureCryptoUtils.secureLog.init();\n }\n }\n}\n\nexport { EnhancedSecureCryptoUtils };", "// ============================================\n// SECURE FILE TRANSFER CONTEXT\n// ============================================\nclass SecureFileTransferContext {\n static #instance = null;\n static #contextKey = Symbol('SecureFileTransferContext');\n \n static getInstance() {\n if (!this.#instance) {\n this.#instance = new SecureFileTransferContext();\n }\n return this.#instance;\n }\n \n #fileTransferSystem = null;\n #active = false;\n #securityLevel = 'high';\n \n setFileTransferSystem(system) {\n if (!(system instanceof EnhancedSecureFileTransfer)) {\n throw new Error('Invalid file transfer system instance');\n }\n this.#fileTransferSystem = system;\n this.#active = true;\n console.log('\uD83D\uDD12 Secure file transfer context initialized');\n }\n \n getFileTransferSystem() {\n return this.#fileTransferSystem;\n }\n \n isActive() {\n return this.#active && this.#fileTransferSystem !== null;\n }\n \n deactivate() {\n this.#active = false;\n this.#fileTransferSystem = null;\n console.log('\uD83D\uDD12 Secure file transfer context deactivated');\n }\n \n getSecurityLevel() {\n return this.#securityLevel;\n }\n \n setSecurityLevel(level) {\n if (['low', 'medium', 'high'].includes(level)) {\n this.#securityLevel = level;\n }\n }\n}\n\n// ============================================\n// SECURITY ERROR HANDLER\n// ============================================\n\nclass SecurityErrorHandler {\n static #allowedErrors = new Set([\n 'File size exceeds maximum limit',\n 'Unsupported file type',\n 'Transfer timeout',\n 'Connection lost',\n 'Invalid file data',\n 'File transfer failed',\n 'Transfer cancelled',\n 'Network error',\n 'File not found',\n 'Permission denied'\n ]);\n \n static sanitizeError(error) {\n const message = error.message || error;\n\n for (const allowed of this.#allowedErrors) {\n if (message.includes(allowed)) {\n return allowed;\n }\n }\n\n console.error('\uD83D\uDD12 Internal file transfer error:', {\n message: error.message,\n stack: error.stack,\n timestamp: new Date().toISOString()\n });\n\n return 'File transfer failed';\n }\n \n static logSecurityEvent(event, details = {}) {\n console.warn('\uD83D\uDD12 Security event:', {\n event,\n timestamp: new Date().toISOString(),\n ...details\n });\n }\n}\n\n// ============================================\n// FILE METADATA SIGNATURE SYSTEM\n// ============================================\n\nclass FileMetadataSigner {\n static async signFileMetadata(metadata, privateKey) {\n try {\n const encoder = new TextEncoder();\n const data = encoder.encode(JSON.stringify({\n fileId: metadata.fileId,\n fileName: metadata.fileName,\n fileSize: metadata.fileSize,\n fileHash: metadata.fileHash,\n timestamp: metadata.timestamp,\n version: metadata.version || '2.0'\n }));\n \n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n privateKey,\n data\n );\n \n return Array.from(new Uint8Array(signature));\n } catch (error) {\n SecurityErrorHandler.logSecurityEvent('signature_failed', { error: error.message });\n throw new Error('Failed to sign file metadata');\n }\n }\n \n static async verifyFileMetadata(metadata, signature, publicKey) {\n try {\n const encoder = new TextEncoder();\n const data = encoder.encode(JSON.stringify({\n fileId: metadata.fileId,\n fileName: metadata.fileName,\n fileSize: metadata.fileSize,\n fileHash: metadata.fileHash,\n timestamp: metadata.timestamp,\n version: metadata.version || '2.0'\n }));\n \n const signatureBuffer = new Uint8Array(signature);\n \n const isValid = await crypto.subtle.verify(\n 'RSASSA-PKCS1-v1_5',\n publicKey,\n signatureBuffer,\n data\n );\n \n if (!isValid) {\n SecurityErrorHandler.logSecurityEvent('invalid_signature', { fileId: metadata.fileId });\n }\n \n return isValid;\n } catch (error) {\n SecurityErrorHandler.logSecurityEvent('verification_failed', { error: error.message });\n return false;\n }\n }\n}\n\n// ============================================\n// \u0422\u041E\u0427\u041D\u042B\u0415 \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u042F \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u041E\u0421\u0422\u0418\n// ============================================\n\nclass MessageSizeValidator {\n static MAX_MESSAGE_SIZE = 1024 * 1024; // 1MB\n \n static isMessageSizeValid(message) {\n const messageString = JSON.stringify(message);\n const sizeInBytes = new Blob([messageString]).size;\n \n if (sizeInBytes > this.MAX_MESSAGE_SIZE) {\n SecurityErrorHandler.logSecurityEvent('message_too_large', {\n size: sizeInBytes,\n limit: this.MAX_MESSAGE_SIZE\n });\n throw new Error('Message too large');\n }\n \n return true;\n }\n}\n\nclass AtomicOperations {\n constructor() {\n this.locks = new Map();\n }\n \n async withLock(key, operation) {\n if (this.locks.has(key)) {\n await this.locks.get(key);\n }\n \n const lockPromise = (async () => {\n try {\n return await operation();\n } finally {\n this.locks.delete(key);\n }\n })();\n \n this.locks.set(key, lockPromise);\n return lockPromise;\n }\n}\n\n// Rate limiting \u0434\u043B\u044F \u0437\u0430\u0449\u0438\u0442\u044B \u043E\u0442 \u0441\u043F\u0430\u043C\u0430\nclass RateLimiter {\n constructor(maxRequests, windowMs) {\n this.maxRequests = maxRequests;\n this.windowMs = windowMs;\n this.requests = new Map();\n }\n \n isAllowed(identifier) {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n \n if (!this.requests.has(identifier)) {\n this.requests.set(identifier, []);\n }\n \n const userRequests = this.requests.get(identifier);\n \n const validRequests = userRequests.filter(time => time > windowStart);\n this.requests.set(identifier, validRequests);\n \n if (validRequests.length >= this.maxRequests) {\n SecurityErrorHandler.logSecurityEvent('rate_limit_exceeded', {\n identifier,\n requestCount: validRequests.length,\n limit: this.maxRequests\n });\n return false;\n }\n \n validRequests.push(now);\n return true;\n }\n}\n\nclass SecureMemoryManager {\n static secureWipe(buffer) {\n if (buffer instanceof ArrayBuffer) {\n const view = new Uint8Array(buffer);\n crypto.getRandomValues(view);\n } else if (buffer instanceof Uint8Array) {\n crypto.getRandomValues(buffer);\n }\n }\n \n static secureDelete(obj, prop) {\n if (obj[prop]) {\n this.secureWipe(obj[prop]);\n delete obj[prop];\n }\n }\n}\n\nclass EnhancedSecureFileTransfer {\n constructor(webrtcManager, onProgress, onComplete, onError, onFileReceived) {\n this.webrtcManager = webrtcManager;\n this.onProgress = onProgress;\n this.onComplete = onComplete;\n this.onError = onError;\n this.onFileReceived = onFileReceived;\n \n // Validate webrtcManager\n if (!webrtcManager) {\n throw new Error('webrtcManager is required for EnhancedSecureFileTransfer');\n }\n \n SecureFileTransferContext.getInstance().setFileTransferSystem(this);\n \n this.atomicOps = new AtomicOperations();\n this.rateLimiter = new RateLimiter(10, 60000);\n\n this.signingKey = null;\n this.verificationKey = null;\n \n // Transfer settings\n this.CHUNK_SIZE = 64 * 1024; // 64 KB\n this.MAX_FILE_SIZE = 100 * 1024 * 1024; // 100 MB limit\n this.MAX_CONCURRENT_TRANSFERS = 3;\n this.CHUNK_TIMEOUT = 30000; // 30 seconds per chunk\n this.RETRY_ATTEMPTS = 3;\n\n this.FILE_TYPE_RESTRICTIONS = {\n documents: {\n extensions: ['.pdf', '.doc', '.docx', '.txt', '.md', '.rtf', '.odt'],\n mimeTypes: [\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/plain',\n 'text/markdown',\n 'application/rtf',\n 'application/vnd.oasis.opendocument.text'\n ],\n maxSize: 50 * 1024 * 1024, // 50 MB\n category: 'Documents',\n description: 'PDF, DOC, TXT, MD, RTF, ODT'\n },\n \n images: {\n extensions: ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp', '.svg', '.ico'],\n mimeTypes: [\n 'image/jpeg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/bmp',\n 'image/svg+xml',\n 'image/x-icon'\n ],\n maxSize: 25 * 1024 * 1024, // 25 MB\n category: 'Images',\n description: 'JPG, PNG, GIF, WEBP, BMP, SVG, ICO'\n },\n \n archives: {\n extensions: ['.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.xz'],\n mimeTypes: [\n 'application/zip',\n 'application/x-rar-compressed',\n 'application/x-7z-compressed',\n 'application/x-tar',\n 'application/gzip',\n 'application/x-bzip2',\n 'application/x-xz'\n ],\n maxSize: 100 * 1024 * 1024, // 100 MB\n category: 'Archives',\n description: 'ZIP, RAR, 7Z, TAR, GZ, BZ2, XZ'\n },\n \n media: {\n extensions: ['.mp3', '.mp4', '.avi', '.mkv', '.mov', '.wmv', '.flv', '.webm', '.ogg', '.wav'],\n mimeTypes: [\n 'audio/mpeg',\n 'video/mp4',\n 'video/x-msvideo',\n 'video/x-matroska',\n 'video/quicktime',\n 'video/x-ms-wmv',\n 'video/x-flv',\n 'video/webm',\n 'audio/ogg',\n 'audio/wav'\n ],\n maxSize: 100 * 1024 * 1024, // 100 MB\n category: 'Media',\n description: 'MP3, MP4, AVI, MKV, MOV, WMV, FLV, WEBM, OGG, WAV'\n },\n \n general: {\n extensions: [], \n mimeTypes: [], \n maxSize: 50 * 1024 * 1024, // 50 MB\n category: 'General',\n description: 'Any file type up to size limits'\n }\n };\n \n // Active transfers tracking\n this.activeTransfers = new Map(); // fileId -> transfer state\n this.receivingTransfers = new Map(); // fileId -> receiving state\n this.transferQueue = []; // Queue for pending transfers\n this.pendingChunks = new Map();\n \n // Session key derivation\n this.sessionKeys = new Map(); // fileId -> derived session key\n \n // Security\n this.processedChunks = new Set(); // Prevent replay attacks\n this.transferNonces = new Map(); // fileId -> current nonce counter\n this.receivedFileBuffers = new Map(); // fileId -> { buffer:ArrayBuffer, type:string, name:string, size:number }\n\n this.setupFileMessageHandlers();\n\n if (this.webrtcManager) {\n this.webrtcManager.fileTransferSystem = this;\n }\n }\n\n // ============================================\n // FILE TYPE VALIDATION SYSTEM\n // ============================================\n\n getFileType(file) {\n const fileName = file.name.toLowerCase();\n const fileExtension = fileName.substring(fileName.lastIndexOf('.'));\n const mimeType = file.type.toLowerCase();\n\n for (const [typeKey, typeConfig] of Object.entries(this.FILE_TYPE_RESTRICTIONS)) {\n if (typeKey === 'general') continue; // \u041F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u0435\u043C \u043E\u0431\u0449\u0438\u0439 \u0442\u0438\u043F\n\n if (typeConfig.extensions.includes(fileExtension)) {\n return {\n type: typeKey,\n category: typeConfig.category,\n description: typeConfig.description,\n maxSize: typeConfig.maxSize,\n allowed: true\n };\n }\n\n if (typeConfig.mimeTypes.includes(mimeType)) {\n return {\n type: typeKey,\n category: typeConfig.category,\n description: typeConfig.description,\n maxSize: typeConfig.maxSize,\n allowed: true\n };\n }\n }\n\n const generalConfig = this.FILE_TYPE_RESTRICTIONS.general;\n return {\n type: 'general',\n category: generalConfig.category,\n description: generalConfig.description,\n maxSize: generalConfig.maxSize,\n allowed: true\n };\n }\n\n validateFile(file) {\n const fileType = this.getFileType(file);\n const errors = [];\n\n if (file.size > fileType.maxSize) {\n errors.push(`File size (${this.formatFileSize(file.size)}) exceeds maximum allowed for ${fileType.category} (${this.formatFileSize(fileType.maxSize)})`);\n }\n\n if (!fileType.allowed) {\n errors.push(`File type not allowed. Supported types: ${fileType.description}`);\n }\n\n if (file.size > this.MAX_FILE_SIZE) {\n errors.push(`File size (${this.formatFileSize(file.size)}) exceeds general limit (${this.formatFileSize(this.MAX_FILE_SIZE)})`);\n }\n \n return {\n isValid: errors.length === 0,\n errors: errors,\n fileType: fileType,\n fileSize: file.size,\n formattedSize: this.formatFileSize(file.size)\n };\n }\n\n formatFileSize(bytes) {\n if (bytes === 0) return '0 B';\n const k = 1024;\n const sizes = ['B', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n\n getSupportedFileTypes() {\n const supportedTypes = {};\n \n for (const [typeKey, typeConfig] of Object.entries(this.FILE_TYPE_RESTRICTIONS)) {\n if (typeKey === 'general') continue;\n \n supportedTypes[typeKey] = {\n category: typeConfig.category,\n description: typeConfig.description,\n extensions: typeConfig.extensions,\n maxSize: this.formatFileSize(typeConfig.maxSize),\n maxSizeBytes: typeConfig.maxSize\n };\n }\n \n return supportedTypes;\n }\n\n getFileTypeInfo() {\n return {\n supportedTypes: this.getSupportedFileTypes(),\n generalMaxSize: this.formatFileSize(this.MAX_FILE_SIZE),\n generalMaxSizeBytes: this.MAX_FILE_SIZE,\n restrictions: this.FILE_TYPE_RESTRICTIONS\n };\n }\n\n // ============================================\n // ENCODING HELPERS (Base64 for efficient transport)\n // ============================================\n arrayBufferToBase64(buffer) {\n const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n let binary = '';\n const len = bytes.byteLength;\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n base64ToUint8Array(base64) {\n const binaryString = atob(base64);\n const len = binaryString.length;\n const bytes = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes;\n }\n\n // ============================================\n // PUBLIC ACCESSORS FOR RECEIVED FILES\n // ============================================\n getReceivedFileMeta(fileId) {\n const entry = this.receivedFileBuffers.get(fileId);\n if (!entry) return null;\n return { fileId, fileName: entry.name, fileSize: entry.size, mimeType: entry.type };\n }\n\n async getBlob(fileId) {\n const entry = this.receivedFileBuffers.get(fileId);\n if (!entry) return null;\n return new Blob([entry.buffer], { type: entry.type });\n }\n\n async getObjectURL(fileId) {\n const blob = await this.getBlob(fileId);\n if (!blob) return null;\n return URL.createObjectURL(blob);\n }\n\n revokeObjectURL(url) {\n try { URL.revokeObjectURL(url); } catch (_) {}\n }\n\n setupFileMessageHandlers() {\n if (!this.webrtcManager.dataChannel) {\n const setupRetry = setInterval(() => {\n if (this.webrtcManager.dataChannel) {\n clearInterval(setupRetry);\n this.setupMessageInterception();\n }\n }, 100);\n\n setTimeout(() => {\n clearInterval(setupRetry);\n }, 5000);\n \n return;\n }\n \n // \u0415\u0441\u043B\u0438 dataChannel \u0443\u0436\u0435 \u0433\u043E\u0442\u043E\u0432, \u0441\u0440\u0430\u0437\u0443 \u043D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043C\n this.setupMessageInterception();\n }\n\n setupMessageInterception() {\n try {\n if (!this.webrtcManager.dataChannel) {\n return;\n }\n\n if (this.webrtcManager) {\n this.webrtcManager.fileTransferSystem = this;\n }\n\n if (this.webrtcManager.dataChannel.onmessage) {\n this.originalOnMessage = this.webrtcManager.dataChannel.onmessage;\n }\n\n this.webrtcManager.dataChannel.onmessage = async (event) => {\n try {\n if (event.data.length > MessageSizeValidator.MAX_MESSAGE_SIZE) {\n console.warn('\uD83D\uDD12 Message too large, ignoring');\n SecurityErrorHandler.logSecurityEvent('oversized_message_blocked');\n return;\n }\n \n if (typeof event.data === 'string') {\n try {\n const parsed = JSON.parse(event.data);\n \n MessageSizeValidator.isMessageSizeValid(parsed);\n \n if (this.isFileTransferMessage(parsed)) {\n await this.handleFileMessage(parsed);\n return; \n }\n } catch (parseError) {\n if (parseError.message === 'Message too large') {\n return; \n }\n }\n }\n\n if (this.originalOnMessage) {\n return this.originalOnMessage.call(this.webrtcManager.dataChannel, event);\n }\n } catch (error) {\n console.error('\u274C Error in file system message interception:', error);\n if (this.originalOnMessage) {\n return this.originalOnMessage.call(this.webrtcManager.dataChannel, event);\n }\n }\n };\n } catch (error) {\n console.error('\u274C Failed to set up message interception:', error);\n }\n }\n\n isFileTransferMessage(message) {\n if (!message || typeof message !== 'object' || !message.type) {\n return false;\n }\n \n const fileMessageTypes = [\n 'file_transfer_start',\n 'file_transfer_response', \n 'file_chunk',\n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error'\n ];\n \n return fileMessageTypes.includes(message.type);\n }\n\n async handleFileMessage(message) {\n try {\n if (!this.webrtcManager.fileTransferSystem) {\n try {\n if (typeof this.webrtcManager.initializeFileTransfer === 'function') {\n this.webrtcManager.initializeFileTransfer();\n \n let attempts = 0;\n const maxAttempts = 50; \n while (!this.webrtcManager.fileTransferSystem && attempts < maxAttempts) {\n await new Promise(resolve => setTimeout(resolve, 100));\n attempts++;\n }\n \n if (!this.webrtcManager.fileTransferSystem) {\n throw new Error('File transfer system initialization timeout');\n }\n } else {\n throw new Error('initializeFileTransfer method not available');\n }\n } catch (initError) {\n console.error('\u274C Failed to initialize file transfer system:', initError);\n if (message.fileId) {\n const errorMessage = {\n type: 'file_transfer_error',\n fileId: message.fileId,\n error: 'File transfer system not available',\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n }\n return;\n }\n }\n \n switch (message.type) {\n case 'file_transfer_start':\n await this.handleFileTransferStart(message);\n break;\n \n case 'file_transfer_response':\n this.handleTransferResponse(message);\n break;\n \n case 'file_chunk':\n await this.handleFileChunk(message);\n break;\n \n case 'chunk_confirmation':\n this.handleChunkConfirmation(message);\n break;\n \n case 'file_transfer_complete':\n this.handleTransferComplete(message);\n break;\n \n case 'file_transfer_error':\n this.handleTransferError(message);\n break;\n \n default:\n console.warn('\u26A0\uFE0F Unknown file message type:', message.type);\n }\n \n } catch (error) {\n console.error('\u274C Error handling file message:', error);\n\n if (message.fileId) {\n const errorMessage = {\n type: 'file_transfer_error',\n fileId: message.fileId,\n error: error.message,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n }\n }\n }\n\n // ============================================\n // SIMPLIFIED KEY DERIVATION - USE SHARED DATA\n // ============================================\n\n async deriveFileSessionKey(fileId) {\n try {\n \n if (!this.webrtcManager.keyFingerprint || !this.webrtcManager.sessionSalt) {\n throw new Error('WebRTC session data not available');\n }\n\n const fileSalt = crypto.getRandomValues(new Uint8Array(32));\n\n const encoder = new TextEncoder();\n const fingerprintData = encoder.encode(this.webrtcManager.keyFingerprint);\n const fileIdData = encoder.encode(fileId);\n\n const sessionSaltArray = new Uint8Array(this.webrtcManager.sessionSalt);\n const combinedSeed = new Uint8Array(\n fingerprintData.length + \n sessionSaltArray.length + \n fileSalt.length + \n fileIdData.length\n );\n \n let offset = 0;\n combinedSeed.set(fingerprintData, offset);\n offset += fingerprintData.length;\n combinedSeed.set(sessionSaltArray, offset);\n offset += sessionSaltArray.length;\n combinedSeed.set(fileSalt, offset);\n offset += fileSalt.length;\n combinedSeed.set(fileIdData, offset);\n\n const keyMaterial = await crypto.subtle.digest('SHA-256', combinedSeed);\n\n const fileSessionKey = await crypto.subtle.importKey(\n 'raw',\n keyMaterial,\n { name: 'AES-GCM' },\n false,\n ['encrypt', 'decrypt']\n );\n\n this.sessionKeys.set(fileId, {\n key: fileSessionKey,\n salt: Array.from(fileSalt),\n created: Date.now()\n });\n\n return { key: fileSessionKey, salt: Array.from(fileSalt) };\n\n } catch (error) {\n console.error('\u274C Failed to derive file session key:', error);\n throw error;\n }\n }\n\n async deriveFileSessionKeyFromSalt(fileId, saltArray) {\n try {\n if (!saltArray || !Array.isArray(saltArray) || saltArray.length !== 32) {\n throw new Error(`Invalid salt: ${saltArray?.length || 0} bytes`);\n }\n \n if (!this.webrtcManager.keyFingerprint || !this.webrtcManager.sessionSalt) {\n throw new Error('WebRTC session data not available');\n }\n\n const encoder = new TextEncoder();\n const fingerprintData = encoder.encode(this.webrtcManager.keyFingerprint);\n const fileIdData = encoder.encode(fileId);\n\n const fileSalt = new Uint8Array(saltArray);\n const sessionSaltArray = new Uint8Array(this.webrtcManager.sessionSalt);\n\n const combinedSeed = new Uint8Array(\n fingerprintData.length + \n sessionSaltArray.length + \n fileSalt.length + \n fileIdData.length\n );\n \n let offset = 0;\n combinedSeed.set(fingerprintData, offset);\n offset += fingerprintData.length;\n combinedSeed.set(sessionSaltArray, offset);\n offset += sessionSaltArray.length;\n combinedSeed.set(fileSalt, offset);\n offset += fileSalt.length;\n combinedSeed.set(fileIdData, offset);\n\n const keyMaterial = await crypto.subtle.digest('SHA-256', combinedSeed);\n\n const fileSessionKey = await crypto.subtle.importKey(\n 'raw',\n keyMaterial,\n { name: 'AES-GCM' },\n false,\n ['encrypt', 'decrypt']\n );\n\n this.sessionKeys.set(fileId, {\n key: fileSessionKey,\n salt: saltArray,\n created: Date.now()\n });\n\n return fileSessionKey;\n\n } catch (error) {\n console.error('\u274C Failed to derive session key from salt:', error);\n throw error;\n }\n }\n\n // ============================================\n // FILE TRANSFER IMPLEMENTATION\n // ============================================\n\n async sendFile(file) {\n try {\n // Validate webrtcManager\n if (!this.webrtcManager) {\n throw new Error('WebRTC Manager not initialized');\n }\n\n const clientId = this.getClientIdentifier();\n if (!this.rateLimiter.isAllowed(clientId)) {\n SecurityErrorHandler.logSecurityEvent('rate_limit_exceeded', { clientId });\n throw new Error('Rate limit exceeded. Please wait before sending another file.');\n }\n\n if (!file || !file.size) {\n throw new Error('Invalid file object');\n }\n\n const validation = this.validateFile(file);\n if (!validation.isValid) {\n const errorMessage = validation.errors.join('. ');\n throw new Error(errorMessage);\n }\n\n if (this.activeTransfers.size >= this.MAX_CONCURRENT_TRANSFERS) {\n throw new Error('Maximum concurrent transfers reached');\n }\n\n // Generate unique file ID\n const fileId = `file_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n \n // Calculate file hash for integrity verification\n const fileHash = await this.calculateFileHash(file);\n \n // Derive session key for this file\n const keyResult = await this.deriveFileSessionKey(fileId);\n const sessionKey = keyResult.key;\n const salt = keyResult.salt;\n \n // Create transfer state\n const transferState = {\n fileId: fileId,\n file: file,\n fileHash: fileHash,\n sessionKey: sessionKey,\n salt: salt, \n totalChunks: Math.ceil(file.size / this.CHUNK_SIZE),\n sentChunks: 0,\n confirmedChunks: 0,\n startTime: Date.now(),\n status: 'preparing',\n retryCount: 0,\n lastChunkTime: Date.now()\n };\n\n this.activeTransfers.set(fileId, transferState);\n this.transferNonces.set(fileId, 0);\n\n // Send file metadata first\n await this.sendFileMetadata(transferState);\n \n // Start chunk transmission\n await this.startChunkTransmission(transferState);\n \n return fileId;\n\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C File sending failed:', safeError);\n if (this.onError) this.onError(safeError);\n throw new Error(safeError);\n }\n }\n\n async sendFileMetadata(transferState) {\n try {\n const metadata = {\n type: 'file_transfer_start',\n fileId: transferState.fileId,\n fileName: transferState.file.name,\n fileSize: transferState.file.size,\n fileType: transferState.file.type || 'application/octet-stream',\n fileHash: transferState.fileHash,\n totalChunks: transferState.totalChunks,\n chunkSize: this.CHUNK_SIZE,\n salt: transferState.salt, \n timestamp: Date.now(),\n version: '2.0'\n };\n\n if (this.signingKey) {\n try {\n metadata.signature = await FileMetadataSigner.signFileMetadata(metadata, this.signingKey);\n console.log('\uD83D\uDD12 File metadata signed successfully');\n } catch (signError) {\n SecurityErrorHandler.logSecurityEvent('signature_failed', { \n fileId: transferState.fileId, \n error: signError.message \n });\n }\n }\n\n // Send metadata through secure channel\n await this.sendSecureMessage(metadata);\n \n transferState.status = 'metadata_sent';\n\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to send file metadata:', safeError);\n transferState.status = 'failed';\n throw new Error(safeError);\n }\n }\n\n async startChunkTransmission(transferState) {\n try {\n transferState.status = 'transmitting';\n \n const file = transferState.file;\n const totalChunks = transferState.totalChunks;\n \n for (let chunkIndex = 0; chunkIndex < totalChunks; chunkIndex++) {\n const start = chunkIndex * this.CHUNK_SIZE;\n const end = Math.min(start + this.CHUNK_SIZE, file.size);\n \n // Read chunk from file\n const chunkData = await this.readFileChunk(file, start, end);\n \n // Send chunk (\u0441 \u0443\u0447\u0451\u0442\u043E\u043C backpressure)\n await this.sendFileChunk(transferState, chunkIndex, chunkData);\n \n // Update progress\n transferState.sentChunks++;\n const progress = Math.round((transferState.sentChunks / totalChunks) * 95) + 5; // 5-100%\n\n await this.waitForBackpressure();\n }\n \n transferState.status = 'waiting_confirmation';\n \n // Timeout for completion confirmation\n setTimeout(() => {\n if (this.activeTransfers.has(transferState.fileId)) {\n const state = this.activeTransfers.get(transferState.fileId);\n if (state.status === 'waiting_confirmation') {\n this.cleanupTransfer(transferState.fileId);\n }\n }\n }, 30000);\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Chunk transmission failed:', safeError);\n transferState.status = 'failed';\n throw new Error(safeError);\n }\n }\n\n async readFileChunk(file, start, end) {\n try {\n const blob = file.slice(start, end);\n return await blob.arrayBuffer();\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to read file chunk:', safeError);\n throw new Error(safeError);\n }\n }\n\n async sendFileChunk(transferState, chunkIndex, chunkData) {\n try {\n const sessionKey = transferState.sessionKey;\n const nonce = crypto.getRandomValues(new Uint8Array(12));\n \n // Encrypt chunk data\n const encryptedChunk = await crypto.subtle.encrypt(\n {\n name: 'AES-GCM',\n iv: nonce\n },\n sessionKey,\n chunkData\n );\n \n // Use Base64 to drastically reduce JSON overhead\n const encryptedB64 = this.arrayBufferToBase64(new Uint8Array(encryptedChunk));\n const chunkMessage = {\n type: 'file_chunk',\n fileId: transferState.fileId,\n chunkIndex: chunkIndex,\n totalChunks: transferState.totalChunks,\n nonce: Array.from(nonce),\n encryptedDataB64: encryptedB64,\n chunkSize: chunkData.byteLength,\n timestamp: Date.now()\n };\n\n await this.waitForBackpressure();\n // Send chunk through secure channel\n await this.sendSecureMessage(chunkMessage);\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to send file chunk:', safeError);\n throw new Error(safeError);\n }\n }\n\n async sendSecureMessage(message) {\n\n const messageString = JSON.stringify(message);\n const dc = this.webrtcManager?.dataChannel;\n const maxRetries = 10;\n let attempt = 0;\n const wait = (ms) => new Promise(r => setTimeout(r, ms));\n\n while (true) {\n try {\n if (!dc || dc.readyState !== 'open') {\n throw new Error('Data channel not ready');\n }\n await this.waitForBackpressure();\n dc.send(messageString);\n return; // success\n } catch (error) {\n const msg = String(error?.message || '');\n const queueFull = msg.includes('send queue is full') || msg.includes('bufferedAmount');\n const opErr = error?.name === 'OperationError';\n if ((queueFull || opErr) && attempt < maxRetries) {\n attempt++;\n await this.waitForBackpressure();\n await wait(Math.min(50 * attempt, 500));\n continue;\n }\n console.error('\u274C Failed to send secure message:', error);\n throw error;\n }\n }\n }\n\n async waitForBackpressure() {\n try {\n const dc = this.webrtcManager?.dataChannel;\n if (!dc) return;\n\n if (typeof dc.bufferedAmountLowThreshold === 'number') {\n if (dc.bufferedAmount > dc.bufferedAmountLowThreshold) {\n await new Promise(resolve => {\n const handler = () => {\n dc.removeEventListener('bufferedamountlow', handler);\n resolve();\n };\n dc.addEventListener('bufferedamountlow', handler, { once: true });\n });\n }\n return;\n }\n\n const softLimit = 4 * 1024 * 1024;\n while (dc.bufferedAmount > softLimit) {\n await new Promise(r => setTimeout(r, 20));\n }\n } catch (_) {\n // ignore\n }\n }\n\n async calculateFileHash(file) {\n try {\n const arrayBuffer = await file.arrayBuffer();\n const hashBuffer = await crypto.subtle.digest('SHA-256', arrayBuffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n } catch (error) {\n console.error('\u274C File hash calculation failed:', error);\n throw error;\n }\n }\n\n // ============================================\n // MESSAGE HANDLERS\n // ============================================\n\n async handleFileTransferStart(metadata) {\n try {\n // Validate metadata\n if (!metadata.fileId || !metadata.fileName || !metadata.fileSize) {\n throw new Error('Invalid file transfer metadata');\n }\n\n if (metadata.signature && this.verificationKey) {\n try {\n const isValid = await FileMetadataSigner.verifyFileMetadata(\n metadata, \n metadata.signature, \n this.verificationKey\n );\n \n if (!isValid) {\n SecurityErrorHandler.logSecurityEvent('invalid_metadata_signature', { \n fileId: metadata.fileId \n });\n throw new Error('Invalid file metadata signature');\n }\n \n console.log('\uD83D\uDD12 File metadata signature verified successfully');\n } catch (verifyError) {\n SecurityErrorHandler.logSecurityEvent('verification_failed', { \n fileId: metadata.fileId, \n error: verifyError.message \n });\n throw new Error('File metadata verification failed');\n }\n }\n \n // Check if we already have this transfer\n if (this.receivingTransfers.has(metadata.fileId)) {\n return;\n }\n \n // Derive session key from salt\n const sessionKey = await this.deriveFileSessionKeyFromSalt(\n metadata.fileId,\n metadata.salt\n );\n \n // Create receiving transfer state\n const receivingState = {\n fileId: metadata.fileId,\n fileName: metadata.fileName,\n fileSize: metadata.fileSize,\n fileType: metadata.fileType || 'application/octet-stream',\n fileHash: metadata.fileHash,\n totalChunks: metadata.totalChunks,\n chunkSize: metadata.chunkSize || this.CHUNK_SIZE,\n sessionKey: sessionKey,\n salt: metadata.salt,\n receivedChunks: new Map(),\n receivedCount: 0,\n startTime: Date.now(),\n lastChunkTime: Date.now(),\n status: 'receiving'\n };\n \n this.receivingTransfers.set(metadata.fileId, receivingState);\n \n // Send acceptance response\n const response = {\n type: 'file_transfer_response',\n fileId: metadata.fileId,\n accepted: true,\n timestamp: Date.now()\n };\n \n await this.sendSecureMessage(response);\n\n // Process buffered chunks if any\n if (this.pendingChunks.has(metadata.fileId)) {\n const bufferedChunks = this.pendingChunks.get(metadata.fileId);\n \n for (const [chunkIndex, chunkMessage] of bufferedChunks.entries()) {\n await this.handleFileChunk(chunkMessage);\n }\n \n this.pendingChunks.delete(metadata.fileId);\n }\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to handle file transfer start:', safeError);\n \n // Send error response\n const errorResponse = {\n type: 'file_transfer_response',\n fileId: metadata.fileId,\n accepted: false,\n error: safeError, \n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorResponse);\n }\n }\n\n async handleFileChunk(chunkMessage) {\n return this.atomicOps.withLock(\n `chunk-${chunkMessage.fileId}`, \n async () => {\n try {\n let receivingState = this.receivingTransfers.get(chunkMessage.fileId);\n \n // Buffer early chunks if transfer not yet initialized\n if (!receivingState) {\n if (!this.pendingChunks.has(chunkMessage.fileId)) {\n this.pendingChunks.set(chunkMessage.fileId, new Map());\n }\n \n this.pendingChunks.get(chunkMessage.fileId).set(chunkMessage.chunkIndex, chunkMessage);\n return;\n }\n \n // Update last chunk time\n receivingState.lastChunkTime = Date.now();\n \n // Check if chunk already received\n if (receivingState.receivedChunks.has(chunkMessage.chunkIndex)) {\n return;\n }\n \n // Validate chunk\n if (chunkMessage.chunkIndex < 0 || chunkMessage.chunkIndex >= receivingState.totalChunks) {\n throw new Error(`Invalid chunk index: ${chunkMessage.chunkIndex}`);\n }\n \n // Decrypt chunk\n const nonce = new Uint8Array(chunkMessage.nonce);\n // Backward compatible: prefer Base64, fallback to numeric array\n let encryptedData;\n if (chunkMessage.encryptedDataB64) {\n encryptedData = this.base64ToUint8Array(chunkMessage.encryptedDataB64);\n } else if (chunkMessage.encryptedData) {\n encryptedData = new Uint8Array(chunkMessage.encryptedData);\n } else {\n throw new Error('Missing encrypted data');\n }\n \n const decryptedChunk = await crypto.subtle.decrypt(\n {\n name: 'AES-GCM',\n iv: nonce\n },\n receivingState.sessionKey,\n encryptedData\n );\n \n // Verify chunk size\n if (decryptedChunk.byteLength !== chunkMessage.chunkSize) {\n throw new Error(`Chunk size mismatch: expected ${chunkMessage.chunkSize}, got ${decryptedChunk.byteLength}`);\n }\n \n // Store chunk\n receivingState.receivedChunks.set(chunkMessage.chunkIndex, decryptedChunk);\n receivingState.receivedCount++;\n \n // Send chunk confirmation\n const confirmation = {\n type: 'chunk_confirmation',\n fileId: chunkMessage.fileId,\n chunkIndex: chunkMessage.chunkIndex,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(confirmation);\n \n // Check if all chunks received\n if (receivingState.receivedCount === receivingState.totalChunks) {\n await this.assembleFile(receivingState);\n }\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to handle file chunk:', safeError);\n \n // Send error notification\n const errorMessage = {\n type: 'file_transfer_error',\n fileId: chunkMessage.fileId,\n error: safeError, \n chunkIndex: chunkMessage.chunkIndex,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n \n // Mark transfer as failed\n const receivingState = this.receivingTransfers.get(chunkMessage.fileId);\n if (receivingState) {\n receivingState.status = 'failed';\n }\n \n if (this.onError) {\n this.onError(`Chunk processing failed: ${safeError}`);\n }\n }\n }\n );\n }\n\n async assembleFile(receivingState) {\n try {\n receivingState.status = 'assembling';\n \n // Verify we have all chunks\n for (let i = 0; i < receivingState.totalChunks; i++) {\n if (!receivingState.receivedChunks.has(i)) {\n throw new Error(`Missing chunk ${i}`);\n }\n }\n \n // Combine all chunks in order\n const chunks = [];\n for (let i = 0; i < receivingState.totalChunks; i++) {\n const chunk = receivingState.receivedChunks.get(i);\n chunks.push(new Uint8Array(chunk));\n }\n \n // Calculate total size\n const totalSize = chunks.reduce((sum, chunk) => sum + chunk.length, 0);\n \n // Verify total size matches expected\n if (totalSize !== receivingState.fileSize) {\n throw new Error(`File size mismatch: expected ${receivingState.fileSize}, got ${totalSize}`);\n }\n \n // Combine into single array\n const fileData = new Uint8Array(totalSize);\n let offset = 0;\n for (const chunk of chunks) {\n fileData.set(chunk, offset);\n offset += chunk.length;\n }\n \n // Verify file integrity\n const receivedHash = await this.calculateFileHashFromData(fileData);\n if (receivedHash !== receivingState.fileHash) {\n throw new Error('File integrity check failed - hash mismatch');\n }\n\n const fileBuffer = fileData.buffer;\n const fileBlob = new Blob([fileBuffer], { type: receivingState.fileType });\n \n receivingState.endTime = Date.now();\n receivingState.status = 'completed';\n\n this.receivedFileBuffers.set(receivingState.fileId, {\n buffer: fileBuffer,\n type: receivingState.fileType,\n name: receivingState.fileName,\n size: receivingState.fileSize\n });\n\n if (this.onFileReceived) {\n const getBlob = async () => new Blob([this.receivedFileBuffers.get(receivingState.fileId).buffer], { type: receivingState.fileType });\n const getObjectURL = async () => {\n const blob = await getBlob();\n return URL.createObjectURL(blob);\n };\n const revokeObjectURL = (url) => {\n try { URL.revokeObjectURL(url); } catch (_) {}\n };\n\n this.onFileReceived({\n fileId: receivingState.fileId,\n fileName: receivingState.fileName,\n fileSize: receivingState.fileSize,\n mimeType: receivingState.fileType,\n transferTime: receivingState.endTime - receivingState.startTime,\n // backward-compatibility for existing UIs\n fileBlob,\n getBlob,\n getObjectURL,\n revokeObjectURL\n });\n }\n \n // Send completion confirmation\n const completionMessage = {\n type: 'file_transfer_complete',\n fileId: receivingState.fileId,\n success: true,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(completionMessage);\n \n // Cleanup\n if (this.receivingTransfers.has(receivingState.fileId)) {\n const rs = this.receivingTransfers.get(receivingState.fileId);\n if (rs && rs.receivedChunks) rs.receivedChunks.clear();\n }\n this.receivingTransfers.delete(receivingState.fileId);\n \n } catch (error) {\n console.error('\u274C File assembly failed:', error);\n receivingState.status = 'failed';\n \n if (this.onError) {\n this.onError(`File assembly failed: ${error.message}`);\n }\n \n // Send error notification\n const errorMessage = {\n type: 'file_transfer_complete',\n fileId: receivingState.fileId,\n success: false,\n error: error.message,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n \n // Cleanup failed transfer\n this.cleanupReceivingTransfer(receivingState.fileId);\n }\n }\n\n async calculateFileHashFromData(data) {\n try {\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 } catch (error) {\n console.error('\u274C Hash calculation failed:', error);\n throw error;\n }\n }\n\n handleTransferResponse(response) {\n try {\n const transferState = this.activeTransfers.get(response.fileId);\n \n if (!transferState) {\n return;\n }\n \n if (response.accepted) {\n transferState.status = 'accepted';\n } else {\n transferState.status = 'rejected';\n \n if (this.onError) {\n this.onError(`Transfer rejected: ${response.error || 'Unknown reason'}`);\n }\n \n this.cleanupTransfer(response.fileId);\n }\n } catch (error) {\n console.error('\u274C Failed to handle transfer response:', error);\n }\n }\n\n handleChunkConfirmation(confirmation) {\n try {\n const transferState = this.activeTransfers.get(confirmation.fileId);\n if (!transferState) {\n return;\n }\n \n transferState.confirmedChunks++;\n transferState.lastChunkTime = Date.now();\n } catch (error) {\n console.error('\u274C Failed to handle chunk confirmation:', error);\n }\n }\n\n handleTransferComplete(completion) {\n try {\n const transferState = this.activeTransfers.get(completion.fileId);\n if (!transferState) {\n return;\n }\n \n if (completion.success) {\n transferState.status = 'completed';\n transferState.endTime = Date.now();\n \n if (this.onComplete) {\n this.onComplete({\n fileId: transferState.fileId,\n fileName: transferState.file.name,\n fileSize: transferState.file.size,\n transferTime: transferState.endTime - transferState.startTime,\n status: 'completed'\n });\n }\n } else {\n transferState.status = 'failed';\n \n if (this.onError) {\n this.onError(`Transfer failed: ${completion.error || 'Unknown error'}`);\n }\n }\n \n this.cleanupTransfer(completion.fileId);\n \n } catch (error) {\n console.error('\u274C Failed to handle transfer completion:', error);\n }\n }\n\n handleTransferError(errorMessage) {\n try {\n const transferState = this.activeTransfers.get(errorMessage.fileId);\n if (transferState) {\n transferState.status = 'failed';\n this.cleanupTransfer(errorMessage.fileId);\n }\n \n const receivingState = this.receivingTransfers.get(errorMessage.fileId);\n if (receivingState) {\n receivingState.status = 'failed';\n this.cleanupReceivingTransfer(errorMessage.fileId);\n }\n \n if (this.onError) {\n this.onError(`Transfer error: ${errorMessage.error || 'Unknown error'}`);\n }\n \n } catch (error) {\n console.error('\u274C Failed to handle transfer error:', error);\n }\n }\n\n // ============================================\n // UTILITY METHODS\n // ============================================\n\n getActiveTransfers() {\n return Array.from(this.activeTransfers.values()).map(transfer => ({\n fileId: transfer.fileId,\n fileName: transfer.file?.name || 'Unknown',\n fileSize: transfer.file?.size || 0,\n progress: Math.round((transfer.sentChunks / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n }));\n }\n\n getReceivingTransfers() {\n return Array.from(this.receivingTransfers.values()).map(transfer => ({\n fileId: transfer.fileId,\n fileName: transfer.fileName || 'Unknown',\n fileSize: transfer.fileSize || 0,\n progress: Math.round((transfer.receivedCount / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n }));\n }\n\n cancelTransfer(fileId) {\n try {\n if (this.activeTransfers.has(fileId)) {\n this.cleanupTransfer(fileId);\n return true;\n }\n if (this.receivingTransfers.has(fileId)) {\n this.cleanupReceivingTransfer(fileId);\n return true;\n }\n return false;\n } catch (error) {\n console.error('\u274C Failed to cancel transfer:', error);\n return false;\n }\n }\n\n cleanupTransfer(fileId) {\n this.activeTransfers.delete(fileId);\n this.sessionKeys.delete(fileId);\n this.transferNonces.delete(fileId);\n \n // Remove processed chunk IDs for this transfer\n for (const chunkId of this.processedChunks) {\n if (chunkId.startsWith(fileId)) {\n this.processedChunks.delete(chunkId);\n }\n }\n }\n\n // \u2705 \u0423\u041B\u0423\u0427\u0428\u0415\u041D\u041D\u0410\u042F \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u043F\u0430\u043C\u044F\u0442\u0438 \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0435\u043D\u0438\u044F use-after-free\n cleanupReceivingTransfer(fileId) {\n try {\n // \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E \u043E\u0447\u0438\u0449\u0430\u0435\u043C pending chunks\n this.pendingChunks.delete(fileId);\n \n const receivingState = this.receivingTransfers.get(fileId);\n if (receivingState) {\n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 receivedChunks \u0441 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0439 \u0437\u0430\u0449\u0438\u0442\u043E\u0439\n if (receivingState.receivedChunks && receivingState.receivedChunks.size > 0) {\n for (const [index, chunk] of receivingState.receivedChunks) {\n try {\n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430 \u0432\u0430\u043B\u0438\u0434\u043D\u043E\u0441\u0442\u044C chunk\n if (chunk && (chunk instanceof ArrayBuffer || chunk instanceof Uint8Array)) {\n SecureMemoryManager.secureWipe(chunk);\n \n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 - \u0437\u0430\u043F\u043E\u043B\u043D\u044F\u0435\u043C \u043D\u0443\u043B\u044F\u043C\u0438 \u043F\u0435\u0440\u0435\u0434 \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u0435\u043C\n if (chunk instanceof ArrayBuffer) {\n const view = new Uint8Array(chunk);\n view.fill(0);\n } else if (chunk instanceof Uint8Array) {\n chunk.fill(0);\n }\n }\n } catch (chunkError) {\n console.warn('\u26A0\uFE0F Failed to securely wipe chunk:', chunkError);\n }\n }\n receivingState.receivedChunks.clear();\n }\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 session key\n if (receivingState.sessionKey) {\n try {\n // \u0414\u043B\u044F CryptoKey \u043D\u0435\u043B\u044C\u0437\u044F \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E \u043E\u0447\u0438\u0441\u0442\u0438\u0442\u044C, \u043D\u043E \u043C\u043E\u0436\u0435\u043C \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443\n receivingState.sessionKey = null;\n } catch (keyError) {\n console.warn('\u26A0\uFE0F Failed to clear session key:', keyError);\n }\n }\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\n if (receivingState.salt) {\n try {\n if (Array.isArray(receivingState.salt)) {\n receivingState.salt.fill(0);\n }\n receivingState.salt = null;\n } catch (saltError) {\n console.warn('\u26A0\uFE0F Failed to clear salt:', saltError);\n }\n }\n \n // \u041E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 receivingState\n for (const [key, value] of Object.entries(receivingState)) {\n if (value && typeof value === 'object') {\n if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n SecureMemoryManager.secureWipe(value);\n } else if (Array.isArray(value)) {\n value.fill(0);\n }\n receivingState[key] = null;\n }\n }\n }\n \n // \u0423\u0434\u0430\u043B\u044F\u0435\u043C \u0438\u0437 \u043E\u0441\u043D\u043E\u0432\u043D\u044B\u0445 \u043A\u043E\u043B\u043B\u0435\u043A\u0446\u0438\u0439\n this.receivingTransfers.delete(fileId);\n this.sessionKeys.delete(fileId);\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u0444\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0431\u0443\u0444\u0435\u0440\u0430 \u0444\u0430\u0439\u043B\u0430\n const fileBuffer = this.receivedFileBuffers.get(fileId);\n if (fileBuffer) {\n try {\n if (fileBuffer.buffer) {\n SecureMemoryManager.secureWipe(fileBuffer.buffer);\n \n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 - \u0437\u0430\u043F\u043E\u043B\u043D\u044F\u0435\u043C \u043D\u0443\u043B\u044F\u043C\u0438\n const view = new Uint8Array(fileBuffer.buffer);\n view.fill(0);\n }\n \n // \u041E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 fileBuffer\n for (const [key, value] of Object.entries(fileBuffer)) {\n if (value && typeof value === 'object') {\n if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n SecureMemoryManager.secureWipe(value);\n }\n fileBuffer[key] = null;\n }\n }\n \n this.receivedFileBuffers.delete(fileId);\n } catch (bufferError) {\n console.warn('\u26A0\uFE0F Failed to securely clear file buffer:', bufferError);\n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u044F\u0435\u043C \u0434\u0430\u0436\u0435 \u043F\u0440\u0438 \u043E\u0448\u0438\u0431\u043A\u0435\n this.receivedFileBuffers.delete(fileId);\n }\n }\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 processed chunks\n const chunksToRemove = [];\n for (const chunkId of this.processedChunks) {\n if (chunkId.startsWith(fileId)) {\n chunksToRemove.push(chunkId);\n }\n }\n \n // \u0423\u0434\u0430\u043B\u044F\u0435\u043C \u0432 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u043C \u0446\u0438\u043A\u043B\u0435 \u0434\u043B\u044F \u0438\u0437\u0431\u0435\u0436\u0430\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043A\u043E\u043B\u043B\u0435\u043A\u0446\u0438\u0438 \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438\n for (const chunkId of chunksToRemove) {\n this.processedChunks.delete(chunkId);\n }\n \n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u043F\u0430\u043C\u044F\u0442\u0438\n if (typeof global !== 'undefined' && global.gc) {\n try {\n global.gc();\n } catch (gcError) {\n // \u0418\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u0435\u043C \u043E\u0448\u0438\u0431\u043A\u0438 GC\n }\n }\n \n console.log(`\uD83D\uDD12 Memory safely cleaned for file transfer: ${fileId}`);\n \n } catch (error) {\n console.error('\u274C Error during secure memory cleanup:', error);\n \n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u0434\u0430\u0436\u0435 \u043F\u0440\u0438 \u043E\u0448\u0438\u0431\u043A\u0435\n this.receivingTransfers.delete(fileId);\n this.sessionKeys.delete(fileId);\n this.receivedFileBuffers.delete(fileId);\n this.pendingChunks.delete(fileId);\n \n throw new Error(`Memory cleanup failed: ${error.message}`);\n }\n }\n\n getTransferStatus(fileId) {\n if (this.activeTransfers.has(fileId)) {\n const transfer = this.activeTransfers.get(fileId);\n return {\n type: 'sending',\n fileId: transfer.fileId,\n fileName: transfer.file.name,\n progress: Math.round((transfer.sentChunks / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n };\n }\n \n if (this.receivingTransfers.has(fileId)) {\n const transfer = this.receivingTransfers.get(fileId);\n return {\n type: 'receiving',\n fileId: transfer.fileId,\n fileName: transfer.fileName,\n progress: Math.round((transfer.receivedCount / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n };\n }\n \n return null;\n }\n\n getSystemStatus() {\n return {\n initialized: true,\n activeTransfers: this.activeTransfers.size,\n receivingTransfers: this.receivingTransfers.size,\n totalTransfers: this.activeTransfers.size + this.receivingTransfers.size,\n maxConcurrentTransfers: this.MAX_CONCURRENT_TRANSFERS,\n maxFileSize: this.MAX_FILE_SIZE,\n chunkSize: this.CHUNK_SIZE,\n hasWebrtcManager: !!this.webrtcManager,\n isConnected: this.webrtcManager?.isConnected?.() || false,\n hasDataChannel: !!this.webrtcManager?.dataChannel,\n dataChannelState: this.webrtcManager?.dataChannel?.readyState,\n isVerified: this.webrtcManager?.isVerified,\n hasEncryptionKey: !!this.webrtcManager?.encryptionKey,\n hasMacKey: !!this.webrtcManager?.macKey,\n linkedToWebRTCManager: this.webrtcManager?.fileTransferSystem === this,\n supportedFileTypes: this.getSupportedFileTypes(),\n fileTypeInfo: this.getFileTypeInfo()\n };\n }\n\n cleanup() {\n SecureFileTransferContext.getInstance().deactivate();\n\n if (this.webrtcManager && this.webrtcManager.dataChannel && this.originalOnMessage) {\n this.webrtcManager.dataChannel.onmessage = this.originalOnMessage;\n this.originalOnMessage = null;\n }\n \n if (this.webrtcManager && this.originalProcessMessage) {\n this.webrtcManager.processMessage = this.originalProcessMessage;\n this.originalProcessMessage = null;\n }\n \n if (this.webrtcManager && this.originalRemoveSecurityLayers) {\n this.webrtcManager.removeSecurityLayers = this.originalRemoveSecurityLayers;\n this.originalRemoveSecurityLayers = null;\n }\n \n // Cleanup all active transfers with secure memory wiping\n for (const fileId of this.activeTransfers.keys()) {\n this.cleanupTransfer(fileId);\n }\n \n for (const fileId of this.receivingTransfers.keys()) {\n this.cleanupReceivingTransfer(fileId);\n }\n\n if (this.atomicOps) {\n this.atomicOps.locks.clear();\n }\n \n if (this.rateLimiter) {\n this.rateLimiter.requests.clear();\n }\n \n // Clear all state\n this.pendingChunks.clear();\n this.activeTransfers.clear();\n this.receivingTransfers.clear();\n this.transferQueue.length = 0;\n this.sessionKeys.clear();\n this.transferNonces.clear();\n this.processedChunks.clear();\n\n this.clearKeys();\n }\n\n // ============================================\n // SESSION UPDATE HANDLER - FIXED\n // ============================================\n \n onSessionUpdate(sessionData) {\n // Clear session keys cache for resync\n this.sessionKeys.clear();\n }\n\n // ============================================\n // DEBUGGING AND DIAGNOSTICS\n // ============================================\n\n diagnoseFileTransferIssue() {\n const diagnosis = {\n timestamp: new Date().toISOString(),\n fileTransferSystem: {\n initialized: !!this,\n hasWebrtcManager: !!this.webrtcManager,\n webrtcManagerType: this.webrtcManager?.constructor?.name,\n linkedToWebRTCManager: this.webrtcManager?.fileTransferSystem === this\n },\n webrtcManager: {\n hasDataChannel: !!this.webrtcManager?.dataChannel,\n dataChannelState: this.webrtcManager?.dataChannel?.readyState,\n isConnected: this.webrtcManager?.isConnected?.() || false,\n isVerified: this.webrtcManager?.isVerified,\n hasEncryptionKey: !!this.webrtcManager?.encryptionKey,\n hasMacKey: !!this.webrtcManager?.macKey,\n hasKeyFingerprint: !!this.webrtcManager?.keyFingerprint,\n hasSessionSalt: !!this.webrtcManager?.sessionSalt\n },\n securityContext: {\n contextActive: SecureFileTransferContext.getInstance().isActive(),\n securityLevel: SecureFileTransferContext.getInstance().getSecurityLevel(),\n hasAtomicOps: !!this.atomicOps,\n hasRateLimiter: !!this.rateLimiter\n },\n transfers: {\n activeTransfers: this.activeTransfers.size,\n receivingTransfers: this.receivingTransfers.size,\n pendingChunks: this.pendingChunks.size,\n sessionKeys: this.sessionKeys.size\n },\n fileTypeSupport: {\n supportedTypes: this.getSupportedFileTypes(),\n generalMaxSize: this.formatFileSize(this.MAX_FILE_SIZE),\n restrictions: Object.keys(this.FILE_TYPE_RESTRICTIONS)\n }\n };\n \n return diagnosis;\n }\n\n async debugKeyDerivation(fileId) {\n try {\n if (!this.webrtcManager.keyFingerprint || !this.webrtcManager.sessionSalt) {\n throw new Error('Session data not available');\n }\n \n // Test sender derivation\n const senderResult = await this.deriveFileSessionKey(fileId);\n \n // Test receiver derivation with same salt\n const receiverKey = await this.deriveFileSessionKeyFromSalt(fileId, senderResult.salt);\n \n // Test encryption/decryption\n const testData = new TextEncoder().encode('test data');\n const nonce = crypto.getRandomValues(new Uint8Array(12));\n \n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: nonce },\n senderResult.key,\n testData\n );\n \n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: nonce },\n receiverKey,\n encrypted\n );\n \n const decryptedText = new TextDecoder().decode(decrypted);\n \n if (decryptedText === 'test data') {\n return { success: true, message: 'All tests passed' };\n } else {\n throw new Error('Decryption verification failed');\n }\n \n } catch (error) {\n console.error('\u274C Key derivation test failed:', error);\n return { success: false, error: error.message };\n }\n }\n\n // ============================================\n // ALTERNATIVE METHOD OF INITIALIZING HANDLERS\n // ============================================\n\n registerWithWebRTCManager() {\n if (!this.webrtcManager) {\n throw new Error('WebRTC manager not available');\n }\n\n this.webrtcManager.fileTransferSystem = this;\n\n this.webrtcManager.setFileMessageHandler = (handler) => {\n this.webrtcManager._fileMessageHandler = handler;\n };\n\n this.webrtcManager.setFileMessageHandler((message) => {\n return this.handleFileMessage(message);\n });\n }\n\n static createFileMessageFilter(fileTransferSystem) {\n return async (event) => {\n try {\n if (typeof event.data === 'string') {\n const parsed = JSON.parse(event.data);\n \n if (fileTransferSystem.isFileTransferMessage(parsed)) {\n await fileTransferSystem.handleFileMessage(parsed);\n return true; \n }\n }\n } catch (error) {\n }\n \n return false; \n };\n }\n\n // ============================================\n // SECURITY KEY MANAGEMENT\n // ============================================\n\n setSigningKey(privateKey) {\n if (!privateKey || !(privateKey instanceof CryptoKey)) {\n throw new Error('Invalid private key for signing');\n }\n this.signingKey = privateKey;\n console.log('\uD83D\uDD12 Signing key set successfully');\n }\n\n setVerificationKey(publicKey) {\n if (!publicKey || !(publicKey instanceof CryptoKey)) {\n throw new Error('Invalid public key for verification');\n }\n this.verificationKey = publicKey;\n console.log('\uD83D\uDD12 Verification key set successfully');\n }\n\n async generateSigningKeyPair() {\n try {\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: 2048,\n publicExponent: new Uint8Array([1, 0, 1]),\n hash: 'SHA-256'\n },\n true, // extractable\n ['sign', 'verify']\n );\n \n this.signingKey = keyPair.privateKey;\n this.verificationKey = keyPair.publicKey;\n \n console.log('\uD83D\uDD12 RSA key pair generated successfully');\n return keyPair;\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to generate signing key pair:', safeError);\n throw new Error(safeError);\n }\n }\n\n clearKeys() {\n this.signingKey = null;\n this.verificationKey = null;\n console.log('\uD83D\uDD12 Security keys cleared');\n }\n\n getSecurityStatus() {\n return {\n signingEnabled: this.signingKey !== null,\n verificationEnabled: this.verificationKey !== null,\n contextActive: SecureFileTransferContext.getInstance().isActive(),\n securityLevel: SecureFileTransferContext.getInstance().getSecurityLevel()\n };\n }\n\n getClientIdentifier() {\n return this.webrtcManager?.connectionId || \n this.webrtcManager?.keyFingerprint?.substring(0, 16) || \n 'default-client';\n }\n \n destroy() {\n SecureFileTransferContext.getInstance().deactivate();\n this.clearKeys();\n console.log('\uD83D\uDD12 File transfer system destroyed safely');\n }\n}\n\nexport { EnhancedSecureFileTransfer };", "// Import EnhancedSecureFileTransfer\nimport { EnhancedSecureFileTransfer } from '../transfer/EnhancedSecureFileTransfer.js';\n\n// MUTEX SYSTEM FIXES - RESOLVING MESSAGE DELIVERY ISSUES\n// ============================================\n// Issue: After introducing the Mutex system, messages stopped being delivered between users\n// Fix: Simplified locking logic \u2014 mutex is used ONLY for critical operations\n// - Regular messages are processed WITHOUT mutex\n// - File messages are processed WITHOUT mutex \n// - Mutex is used ONLY for cryptographic operations\n// ============================================\n\nclass EnhancedSecureWebRTCManager {\n // ============================================\n // CONSTANTS\n // ============================================\n \n static TIMEOUTS = {\n KEY_ROTATION_INTERVAL: 300000, // 5 minutes\n CONNECTION_TIMEOUT: 10000, // 10 seconds \n HEARTBEAT_INTERVAL: 30000, // 30 seconds\n SECURITY_CALC_DELAY: 1000, // 1 second\n SECURITY_CALC_RETRY_DELAY: 3000, // 3 seconds\n CLEANUP_INTERVAL: 300000, // 5 minutes (periodic cleanup)\n CLEANUP_CHECK_INTERVAL: 60000, // 1 minute (cleanup check)\n ICE_GATHERING_TIMEOUT: 10000, // 10 seconds\n DISCONNECT_CLEANUP_DELAY: 500, // 500ms\n PEER_DISCONNECT_CLEANUP: 2000, // 2 seconds\n STAGE2_ACTIVATION_DELAY: 10000, // 10 seconds\n STAGE3_ACTIVATION_DELAY: 15000, // 15 seconds \n STAGE4_ACTIVATION_DELAY: 20000, // 20 seconds\n FILE_TRANSFER_INIT_DELAY: 1000, // 1 second\n FAKE_TRAFFIC_MIN_INTERVAL: 15000, // 15 seconds\n FAKE_TRAFFIC_MAX_INTERVAL: 30000, // 30 seconds\n DECOY_INITIAL_DELAY: 5000, // 5 seconds\n DECOY_TRAFFIC_MIN: 10000, // 10 seconds\n DECOY_TRAFFIC_MAX: 25000, // 25 seconds\n REORDER_TIMEOUT: 3000, // 3 seconds\n RETRY_CONNECTION_DELAY: 2000 // 2 seconds\n };\n\n static LIMITS = {\n MAX_CONNECTION_ATTEMPTS: 3,\n MAX_OLD_KEYS: 3,\n MAX_PROCESSED_MESSAGE_IDS: 1000,\n MAX_OUT_OF_ORDER_PACKETS: 5,\n MAX_DECOY_CHANNELS: 1,\n MESSAGE_RATE_LIMIT: 60, // messages per minute\n MAX_KEY_AGE: 900000, // 15 minutes\n OFFER_MAX_AGE: 3600000, // 1 hour\n SALT_SIZE_V3: 32, // bytes\n SALT_SIZE_V4: 64 // bytes\n };\n\n static SIZES = {\n VERIFICATION_CODE_MIN_LENGTH: 6,\n FAKE_TRAFFIC_MIN_SIZE: 32,\n FAKE_TRAFFIC_MAX_SIZE: 128,\n PACKET_PADDING_MIN: 64,\n PACKET_PADDING_MAX: 512,\n CHUNK_SIZE_MAX: 2048,\n CHUNK_DELAY_MIN: 100,\n CHUNK_DELAY_MAX: 500,\n FINGERPRINT_DISPLAY_LENGTH: 8,\n SESSION_ID_LENGTH: 16,\n NESTED_ENCRYPTION_IV_SIZE: 12\n };\n\n static MESSAGE_TYPES = {\n // Regular messages\n MESSAGE: 'message',\n ENHANCED_MESSAGE: 'enhanced_message',\n \n // System messages\n HEARTBEAT: 'heartbeat',\n VERIFICATION: 'verification',\n VERIFICATION_RESPONSE: 'verification_response',\n VERIFICATION_CONFIRMED: 'verification_confirmed',\n VERIFICATION_BOTH_CONFIRMED: 'verification_both_confirmed',\n PEER_DISCONNECT: 'peer_disconnect',\n SECURITY_UPGRADE: 'security_upgrade',\n KEY_ROTATION_SIGNAL: 'key_rotation_signal',\n KEY_ROTATION_READY: 'key_rotation_ready',\n \n // File transfer messages\n FILE_TRANSFER_START: 'file_transfer_start',\n FILE_TRANSFER_RESPONSE: 'file_transfer_response',\n FILE_CHUNK: 'file_chunk',\n CHUNK_CONFIRMATION: 'chunk_confirmation',\n FILE_TRANSFER_COMPLETE: 'file_transfer_complete',\n FILE_TRANSFER_ERROR: 'file_transfer_error',\n \n // Fake traffic\n FAKE: 'fake'\n };\n\n static FILTERED_RESULTS = {\n FAKE_MESSAGE: 'FAKE_MESSAGE_FILTERED',\n FILE_MESSAGE: 'FILE_MESSAGE_FILTERED', \n SYSTEM_MESSAGE: 'SYSTEM_MESSAGE_FILTERED'\n };\n\n // Static debug flag instead of this._debugMode\n static DEBUG_MODE = true; // Set to true during development, false in production\n\n\n constructor(onMessage, onStatusChange, onKeyExchange, onVerificationRequired, onAnswerError = null, onVerificationStateChange = null, config = {}) {\n // Determine runtime mode\n this._isProductionMode = this._detectProductionMode();\n // Use static flag instead of this._debugMode\n this._debugMode = !this._isProductionMode && EnhancedSecureWebRTCManager.DEBUG_MODE;\n \n // Configuration from constructor parameters instead of global flags\n this._config = {\n fakeTraffic: {\n enabled: config.fakeTraffic?.enabled ?? true,\n minInterval: config.fakeTraffic?.minInterval ?? EnhancedSecureWebRTCManager.TIMEOUTS.FAKE_TRAFFIC_MIN_INTERVAL,\n maxInterval: config.fakeTraffic?.maxInterval ?? EnhancedSecureWebRTCManager.TIMEOUTS.FAKE_TRAFFIC_MAX_INTERVAL,\n minSize: config.fakeTraffic?.minSize ?? EnhancedSecureWebRTCManager.SIZES.FAKE_TRAFFIC_MIN_SIZE,\n maxSize: config.fakeTraffic?.maxSize ?? EnhancedSecureWebRTCManager.SIZES.FAKE_TRAFFIC_MAX_SIZE,\n patterns: config.fakeTraffic?.patterns ?? ['heartbeat', 'status', 'sync']\n },\n decoyChannels: {\n enabled: config.decoyChannels?.enabled ?? true,\n maxDecoyChannels: config.decoyChannels?.maxDecoyChannels ?? EnhancedSecureWebRTCManager.LIMITS.MAX_DECOY_CHANNELS,\n decoyChannelNames: config.decoyChannels?.decoyChannelNames ?? ['heartbeat'],\n sendDecoyData: config.decoyChannels?.sendDecoyData ?? true,\n randomDecoyIntervals: config.decoyChannels?.randomDecoyIntervals ?? true\n },\n packetPadding: {\n enabled: config.packetPadding?.enabled ?? true,\n minPadding: config.packetPadding?.minPadding ?? EnhancedSecureWebRTCManager.SIZES.PACKET_PADDING_MIN,\n maxPadding: config.packetPadding?.maxPadding ?? EnhancedSecureWebRTCManager.SIZES.PACKET_PADDING_MAX,\n useRandomPadding: config.packetPadding?.useRandomPadding ?? true,\n preserveMessageSize: config.packetPadding?.preserveMessageSize ?? false\n },\n antiFingerprinting: {\n enabled: config.antiFingerprinting?.enabled ?? false,\n randomizeTiming: config.antiFingerprinting?.randomizeTiming ?? true,\n randomizeSizes: config.antiFingerprinting?.randomizeSizes ?? false,\n addNoise: config.antiFingerprinting?.addNoise ?? true,\n maskPatterns: config.antiFingerprinting?.maskPatterns ?? false,\n useRandomHeaders: config.antiFingerprinting?.useRandomHeaders ?? false\n }\n };\n\n // Initialize own logging system\n this._initializeSecureLogging();\n this._setupOwnLogger();\n this._setupProductionLogging();\n \n // Store important methods first\n this._storeImportantMethods();\n \n // Setup global API after storing methods\n this._setupSecureGlobalAPI();\n if (!window.EnhancedSecureCryptoUtils) {\n throw new Error('EnhancedSecureCryptoUtils is not loaded. Please ensure the module is loaded first.');\n }\n this.getSecurityData = () => {\n // Return only public information\n return this.lastSecurityCalculation ? {\n level: this.lastSecurityCalculation.level,\n score: this.lastSecurityCalculation.score,\n timestamp: this.lastSecurityCalculation.timestamp,\n // Do NOT return check details or sensitive data\n } : null;\n };\n this._secureLog('info', '\uD83D\uDD12 Enhanced WebRTC Manager initialized with secure API');\n this.currentSessionType = null;\n this.currentSecurityLevel = 'basic';\n this.sessionConstraints = null;\n this.peerConnection = null;\n this.dataChannel = null;\n\n\n this.onMessage = onMessage;\n this.onStatusChange = onStatusChange;\n this.onKeyExchange = onKeyExchange;\n this.onVerificationStateChange = onVerificationStateChange;\n\n this.onVerificationRequired = onVerificationRequired;\n this.onAnswerError = onAnswerError; // Callback for response processing errors\n this.isInitiator = false;\n this.connectionAttempts = 0;\n this.maxConnectionAttempts = EnhancedSecureWebRTCManager.LIMITS.MAX_CONNECTION_ATTEMPTS;\n try {\n this._initializeMutexSystem();\n} catch (error) {\n this._secureLog('error', '\u274C Failed to initialize mutex system', {\n errorType: error.constructor.name\n });\n throw new Error('Critical: Mutex system initialization failed');\n}\n\n// Post-initialization validation of the mutex system\nif (!this._validateMutexSystem()) {\n this._secureLog('error', '\u274C Mutex system validation failed after initialization');\n throw new Error('Critical: Mutex system validation failed');\n}\n\nif (typeof window !== 'undefined') {\n this._secureLog('info', '\uD83D\uDD12 Emergency mutex handlers will be available through secure API');\n}\n\nthis._secureLog('info', '\uD83D\uDD12 Enhanced Mutex system fully initialized and validated');\n this.heartbeatInterval = null;\n this.messageQueue = [];\n this.ecdhKeyPair = null;\n this.ecdsaKeyPair = null;\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n this.verificationCode = null;\n this.pendingSASCode = null;\n this.isVerified = false;\n this.processedMessageIds = new Set();\n \n // Mutual verification states\n this.localVerificationConfirmed = false;\n this.remoteVerificationConfirmed = false;\n this.bothVerificationsConfirmed = false;\n \n // Store expected DTLS fingerprint for validation\n this.expectedDTLSFingerprint = null;\n this.strictDTLSValidation = true; // Can be disabled for debugging\n \n // Real Perfect Forward Secrecy implementation\n this.ephemeralKeyPairs = new Map(); // Store ephemeral keys for current session only\n this.sessionStartTime = Date.now(); // Track session lifetime for PFS\n this.messageCounter = 0;\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.sessionSalt = null;\n \n // Anti-Replay and Message Ordering Protection\n this.replayWindowSize = 64; // Sliding window for replay protection\n this.replayWindow = new Set(); // Track recent sequence numbers\n this.maxSequenceGap = 100; // Maximum allowed sequence gap\n this.replayProtectionEnabled = true; // Enable/disable replay protection\n this.sessionId = null; // MITM protection: Session identifier\n this.connectionId = Array.from(crypto.getRandomValues(new Uint8Array(8)))\n .map(b => b.toString(16).padStart(2, '0')).join(''); // Connection identifier for AAD\n this.peerPublicKey = null; // Store peer's public key for PFS\n this.rateLimiterId = null;\n this.intentionalDisconnect = false;\n this.lastCleanupTime = Date.now();\n \n // Reset notification flags for new connection\n this._resetNotificationFlags();\n \n \n\n this.verificationInitiationSent = false;\n this.disconnectNotificationSent = false;\n this.reconnectionFailedNotificationSent = false;\n this.peerDisconnectNotificationSent = false;\n this.connectionClosedNotificationSent = false;\n this.fakeTrafficDisabledNotificationSent = false;\n this.advancedFeaturesDisabledNotificationSent = false;\n this.securityUpgradeNotificationSent = false;\n this.lastSecurityUpgradeStage = null;\n this.securityCalculationNotificationSent = false;\n this.lastSecurityCalculationLevel = null;\n \n // File transfer integration\n this.fileTransferSystem = null;\n this.onFileProgress = null;\n \n // ============================================\n // IV REUSE PREVENTION SYSTEM\n // ============================================\n // IV REUSE PREVENTION SYSTEM WITH LIMITS\n // ============================================\n this._ivTrackingSystem = {\n usedIVs: new Set(), // Track all used IVs to prevent reuse\n ivHistory: new Map(), // Track IV usage with timestamps (max 10k entries)\n collisionCount: 0, // Track potential collisions\n maxIVHistorySize: 10000, // Maximum IV history size\n maxSessionIVs: 1000, // Maximum IVs per session\n entropyValidation: {\n minEntropy: 3.0, // Minimum entropy threshold\n entropyTests: 0,\n entropyFailures: 0\n },\n rngValidation: {\n testsPerformed: 0,\n weakRngDetected: false,\n lastValidation: 0\n },\n sessionIVs: new Map(), // Track IVs per session\n emergencyMode: false // Emergency mode if IV reuse detected\n };\n \n // IV cleanup tracking\n this._lastIVCleanupTime = null;\n \n // ============================================\n // SECURE ERROR HANDLING SYSTEM\n // ============================================\n this._secureErrorHandler = {\n errorCategories: {\n CRYPTOGRAPHIC: 'cryptographic',\n NETWORK: 'network',\n VALIDATION: 'validation',\n SYSTEM: 'system',\n UNKNOWN: 'unknown'\n },\n errorMappings: new Map(), // Map internal errors to safe messages\n errorCounts: new Map(), // Track error frequencies\n lastErrorTime: 0,\n errorThreshold: 10, // Max errors per minute\n isInErrorMode: false\n };\n \n // ============================================\n // SECURE MEMORY MANAGEMENT SYSTEM\n // ============================================\n this._secureMemoryManager = {\n sensitiveData: new WeakMap(), // Track sensitive data for secure cleanup\n cleanupQueue: [], // Queue for deferred cleanup operations\n isCleaning: false, // Prevent concurrent cleanup operations\n cleanupInterval: null, // Periodic cleanup timer\n memoryStats: {\n totalCleanups: 0,\n failedCleanups: 0,\n lastCleanup: 0\n }\n };\n this.onFileReceived = null;\n this.onFileError = null;\n \n // PFS (Perfect Forward Secrecy) Implementation\n this.keyRotationInterval = EnhancedSecureWebRTCManager.TIMEOUTS.KEY_ROTATION_INTERVAL;\n this.lastKeyRotation = Date.now();\n this.currentKeyVersion = 0;\n this.keyVersions = new Map(); // Store key versions for PFS\n this.oldKeys = new Map(); // Store old keys temporarily for decryption\n this.maxOldKeys = EnhancedSecureWebRTCManager.LIMITS.MAX_OLD_KEYS; // Keep last 3 key versions for decryption\n this.peerConnection = null;\n this.dataChannel = null;\n \n\n this.securityFeatures = {\n // All security features enabled by default - no payment required\n hasEncryption: true, \n hasECDH: true, \n hasECDSA: true, \n hasMutualAuth: true, \n hasMetadataProtection: true, \n hasEnhancedReplayProtection: true, \n hasNonExtractableKeys: true, \n hasRateLimiting: true, \n hasEnhancedValidation: true, \n hasPFS: true, // Real Perfect Forward Secrecy enabled \n \n // Advanced Features - All enabled by default\n hasNestedEncryption: true, \n hasPacketPadding: true, \n hasPacketReordering: true, \n hasAntiFingerprinting: true, \n hasFakeTraffic: true, \n hasDecoyChannels: true, \n hasMessageChunking: true \n };\n this._secureLog('info', '\uD83D\uDD12 Enhanced WebRTC Manager initialized with tiered security');\n \n // Log configuration for debugging\n this._secureLog('info', '\uD83D\uDD12 Configuration loaded from constructor parameters', {\n fakeTraffic: this._config.fakeTraffic.enabled,\n decoyChannels: this._config.decoyChannels.enabled,\n packetPadding: this._config.packetPadding.enabled,\n antiFingerprinting: this._config.antiFingerprinting.enabled\n });\n \n // XSS Hardening - replace all window.DEBUG_MODE references\n this._hardenDebugModeReferences();\n \n // Initialize unified scheduler for all maintenance tasks\n this._initializeUnifiedScheduler();\n \n this._syncSecurityFeaturesWithTariff();\n \n if (!this._validateCryptographicSecurity()) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Cryptographic security validation failed after tariff sync');\n throw new Error('Critical cryptographic features are missing after tariff synchronization');\n }\n // ============================================\n // ENHANCED SECURITY FEATURES\n // ============================================\n \n // 1. Nested Encryption Layer\n this.nestedEncryptionKey = null;\n // Removed nestedEncryptionIV and nestedEncryptionCounter\n // Each nested encryption now generates fresh random IV for maximum security\n \n // 2. Packet Padding\n this.paddingConfig = {\n enabled: this._config.packetPadding.enabled,\n minPadding: this._config.packetPadding.minPadding,\n maxPadding: this._config.packetPadding.maxPadding,\n useRandomPadding: this._config.packetPadding.useRandomPadding,\n preserveMessageSize: this._config.packetPadding.preserveMessageSize\n };\n \n // 3. Fake Traffic Generation\n this.fakeTrafficConfig = {\n enabled: this._config.fakeTraffic.enabled,\n minInterval: this._config.fakeTraffic.minInterval,\n maxInterval: this._config.fakeTraffic.maxInterval,\n minSize: this._config.fakeTraffic.minSize,\n maxSize: this._config.fakeTraffic.maxSize,\n patterns: this._config.fakeTraffic.patterns\n };\n this.fakeTrafficTimer = null;\n this.lastFakeTraffic = 0;\n \n // 4. Message Chunking\n this.chunkingConfig = {\n enabled: false,\n maxChunkSize: EnhancedSecureWebRTCManager.SIZES.CHUNK_SIZE_MAX, \n minDelay: EnhancedSecureWebRTCManager.SIZES.CHUNK_DELAY_MIN,\n maxDelay: EnhancedSecureWebRTCManager.SIZES.CHUNK_DELAY_MAX,\n useRandomDelays: true,\n addChunkHeaders: true\n };\n this.chunkQueue = [];\n this.chunkingInProgress = false;\n \n // 5. Decoy Channels\n this.decoyChannels = new Map();\n this.decoyChannelConfig = {\n enabled: this._config.decoyChannels.enabled,\n maxDecoyChannels: this._config.decoyChannels.maxDecoyChannels,\n decoyChannelNames: this._config.decoyChannels.decoyChannelNames,\n sendDecoyData: this._config.decoyChannels.sendDecoyData,\n randomDecoyIntervals: this._config.decoyChannels.randomDecoyIntervals\n };\n this.decoyTimers = new Map();\n \n // 6. Packet Reordering Protection\n this.reorderingConfig = {\n enabled: false, \n maxOutOfOrder: EnhancedSecureWebRTCManager.LIMITS.MAX_OUT_OF_ORDER_PACKETS, \n reorderTimeout: EnhancedSecureWebRTCManager.TIMEOUTS.REORDER_TIMEOUT, \n useSequenceNumbers: true,\n useTimestamps: true\n };\n this.packetBuffer = new Map(); // sequence -> {data, timestamp}\n this.lastProcessedSequence = -1;\n \n // 7. Anti-Fingerprinting\n this.antiFingerprintingConfig = {\n enabled: this._config.antiFingerprinting.enabled,\n randomizeTiming: this._config.antiFingerprinting.randomizeTiming,\n randomizeSizes: this._config.antiFingerprinting.randomizeSizes,\n addNoise: this._config.antiFingerprinting.addNoise,\n maskPatterns: this._config.antiFingerprinting.maskPatterns,\n useRandomHeaders: this._config.antiFingerprinting.useRandomHeaders\n };\n this.fingerprintMask = this.generateFingerprintMask();\n \n // Initialize rate limiter ID\n this.rateLimiterId = `webrtc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n \n // Start periodic cleanup\n this.startPeriodicCleanup();\n \n this.initializeEnhancedSecurity(); \n \n // ============================================\n // MUTEX SYSTEM TO PREVENT RACE CONDITIONS\n // ============================================\n\n // Mutex for key operations\n this._keyOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null\n };\n\n // Mutex for encryption/decryption operations\n this._cryptoOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null\n };\n\n // Mutex for connection initialization\n this._connectionOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null\n };\n\n // Key system state\n this._keySystemState = {\n isInitializing: false,\n isRotating: false,\n isDestroying: false,\n lastOperation: null,\n lastOperationTime: Date.now()\n };\n\n // Operation counters\n this._operationCounters = {\n keyOperations: 0,\n cryptoOperations: 0,\n connectionOperations: 0\n };\n\n }\n \n /**\n * Create AAD with sequence number for anti-replay protection\n * This binds each message to its sequence number and prevents replay attacks\n */\n _createMessageAAD(messageType, messageData = null, isFileMessage = false) {\n try {\n const aad = {\n sessionId: this.currentSession?.sessionId || this.sessionId || 'unknown',\n keyFingerprint: this.keyFingerprint || 'unknown',\n sequenceNumber: this._generateNextSequenceNumber(),\n messageType: messageType,\n timestamp: Date.now(),\n connectionId: this.connectionId || 'unknown',\n isFileMessage: isFileMessage\n };\n\n // Add message-specific data if available\n if (messageData && typeof messageData === 'object') {\n if (messageData.fileId) aad.fileId = messageData.fileId;\n if (messageData.chunkIndex !== undefined) aad.chunkIndex = messageData.chunkIndex;\n if (messageData.totalChunks !== undefined) aad.totalChunks = messageData.totalChunks;\n }\n\n return JSON.stringify(aad);\n } catch (error) {\n this._secureLog('error', '\u274C Failed to create message AAD', {\n errorType: error.constructor.name,\n message: error.message,\n messageType: messageType\n });\n // Fallback to basic AAD\n return JSON.stringify({\n sessionId: 'unknown',\n keyFingerprint: 'unknown',\n sequenceNumber: Date.now(),\n messageType: messageType,\n timestamp: Date.now(),\n connectionId: 'unknown',\n isFileMessage: isFileMessage\n });\n }\n }\n \n /**\n * Generate next sequence number for outgoing messages\n * This ensures unique ordering and prevents replay attacks\n */\n _generateNextSequenceNumber() {\n const nextSeq = this.sequenceNumber++;\n \n // Reset sequence number if it gets too large\n if (this.sequenceNumber > Number.MAX_SAFE_INTEGER - 1000) {\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.replayWindow.clear();\n this._secureLog('warn', '\u26A0\uFE0F Sequence number reset due to overflow', {\n timestamp: Date.now()\n });\n }\n \n return nextSeq;\n }\n \n /**\n * Enhanced mutex system initialization with atomic protection\n */\n _initializeMutexSystem() {\n // Initialize standard mutexes with enhanced state tracking\n this._keyOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null,\n lockTime: null,\n operationCount: 0\n };\n\n this._cryptoOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null,\n lockTime: null,\n operationCount: 0\n };\n\n this._connectionOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null,\n lockTime: null,\n operationCount: 0\n };\n\n // Enhanced key system state with atomic operation tracking\n this._keySystemState = {\n isInitializing: false,\n isRotating: false,\n isDestroying: false,\n lastOperation: null,\n lastOperationTime: Date.now(),\n operationId: null,\n concurrentOperations: 0,\n maxConcurrentOperations: 1\n };\n\n // Operation counters with atomic increments\n this._operationCounters = {\n keyOperations: 0,\n cryptoOperations: 0,\n connectionOperations: 0,\n totalOperations: 0,\n failedOperations: 0\n };\n\n this._secureLog('info', '\uD83D\uDD12 Enhanced mutex system initialized with atomic protection', {\n mutexes: ['keyOperation', 'cryptoOperation', 'connectionOperation'],\n timestamp: Date.now(),\n features: ['atomic_operations', 'race_condition_protection', 'enhanced_state_tracking']\n });\n }\n\n /**\n * XSS Hardening - Debug mode references validation\n * This method is called during initialization to ensure XSS hardening\n */\n _hardenDebugModeReferences() {\n // Log that we're hardening debug mode references\n this._secureLog('info', '\uD83D\uDD12 XSS Hardening: Debug mode references already replaced');\n }\n\n /**\n * Unified scheduler for all maintenance tasks\n * Replaces multiple setInterval calls with a single, controlled scheduler\n */\n _initializeUnifiedScheduler() {\n // Single scheduler interval for all maintenance tasks\n this._maintenanceScheduler = setInterval(() => {\n this._executeMaintenanceCycle();\n }, 300000); // Every 5 minutes\n \n // Log scheduler initialization\n this._secureLog('info', '\uD83D\uDD27 Unified maintenance scheduler initialized (5-minute cycle)');\n \n // Store scheduler reference for cleanup\n this._activeTimers = new Set([this._maintenanceScheduler]);\n }\n\n /**\n * Execute all maintenance tasks in a single cycle\n */\n _executeMaintenanceCycle() {\n try {\n this._secureLog('info', '\uD83D\uDD27 Starting maintenance cycle');\n \n // 1. Log cleanup and security audit\n this._cleanupLogs();\n this._auditLoggingSystemSecurity();\n \n // 2. Security monitoring\n this._verifyAPIIntegrity();\n this._validateCryptographicSecurity();\n this._syncSecurityFeaturesWithTariff();\n \n // 3. Resource cleanup\n this._cleanupResources();\n this._enforceResourceLimits();\n \n // 4. Key monitoring (if connected)\n if (this.isConnected && this.isVerified) {\n this._monitorKeySecurity();\n }\n \n // 5. Global exposure monitoring (debug mode only)\n if (this._debugMode) {\n this._monitorGlobalExposure();\n }\n \n // 6. Heartbeat (if enabled and connected)\n if (this._heartbeatConfig && this._heartbeatConfig.enabled && this.isConnected()) {\n this._sendHeartbeat();\n }\n \n this._secureLog('info', '\uD83D\uDD27 Maintenance cycle completed successfully');\n \n } catch (error) {\n this._secureLog('error', '\u274C Maintenance cycle failed', {\n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n \n // Emergency cleanup on failure\n this._emergencyCleanup();\n }\n }\n\n /**\n * Enforce hard resource limits with emergency cleanup\n */\n _enforceResourceLimits() {\n const violations = [];\n \n // Check log entries\n if (this._logCounts.size > this._resourceLimits.maxLogEntries) {\n violations.push('log_entries');\n }\n \n // Check message queue\n if (this.messageQueue.length > this._resourceLimits.maxMessageQueue) {\n violations.push('message_queue');\n }\n \n // Check IV history\n if (this._ivTrackingSystem && this._ivTrackingSystem.ivHistory.size > this._resourceLimits.maxIVHistory) {\n violations.push('iv_history');\n }\n \n // Check processed message IDs\n if (this.processedMessageIds.size > this._resourceLimits.maxProcessedMessageIds) {\n violations.push('processed_message_ids');\n }\n \n // Check decoy channels\n if (this.decoyChannels.size > this._resourceLimits.maxDecoyChannels) {\n violations.push('decoy_channels');\n }\n \n // Check fake traffic messages\n if (this._fakeTrafficMessages && this._fakeTrafficMessages.length > this._resourceLimits.maxFakeTrafficMessages) {\n violations.push('fake_traffic_messages');\n }\n \n // Check chunk queue\n if (this.chunkQueue.length > this._resourceLimits.maxChunkQueue) {\n violations.push('chunk_queue');\n }\n \n // Check packet buffer\n if (this.packetBuffer && this.packetBuffer.size > this._resourceLimits.maxPacketBuffer) {\n violations.push('packet_buffer');\n }\n \n // If violations detected, trigger emergency cleanup\n if (violations.length > 0) {\n this._secureLog('warn', '\u26A0\uFE0F Resource limit violations detected', { violations });\n this._emergencyCleanup();\n }\n }\n\n /**\n * Emergency cleanup when resource limits are exceeded\n */\n _emergencyCleanup() {\n this._secureLog('warn', '\uD83D\uDEA8 EMERGENCY: Resource limits exceeded, performing emergency cleanup');\n \n try {\n // 1. Clear all logs immediately\n this._logCounts.clear();\n this._secureLog('info', '\uD83E\uDDF9 Emergency: All logs cleared');\n \n // 2. Clear message queue\n this.messageQueue.length = 0;\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Message queue cleared');\n \n // 3. Enhanced IV history cleanup\n if (this._ivTrackingSystem) {\n this._ivTrackingSystem.usedIVs.clear();\n this._ivTrackingSystem.ivHistory.clear();\n this._ivTrackingSystem.sessionIVs.clear();\n this._ivTrackingSystem.collisionCount = 0;\n this._ivTrackingSystem.emergencyMode = false;\n this._secureLog('info', '\uD83E\uDDF9 Enhanced Emergency: IV tracking system cleared');\n }\n \n // 4. Clear processed message IDs\n this.processedMessageIds.clear();\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Processed message IDs cleared');\n \n // 5. Enhanced decoy channels cleanup\n if (this.decoyChannels) {\n for (const [channelName, timer] of this.decoyTimers) {\n if (timer) clearTimeout(timer);\n }\n this.decoyChannels.clear();\n this.decoyTimers.clear();\n this._secureLog('info', '\uD83E\uDDF9 Enhanced Emergency: Decoy channels cleared');\n }\n \n // 6. Enhanced fake traffic cleanup\n if (this.fakeTrafficTimer) {\n clearTimeout(this.fakeTrafficTimer);\n this.fakeTrafficTimer = null;\n }\n if (this._fakeTrafficMessages) {\n this._fakeTrafficMessages.length = 0;\n this._secureLog('info', '\uD83E\uDDF9 Enhanced Emergency: Fake traffic messages cleared');\n }\n \n // 7. Clear chunk queue\n this.chunkQueue.length = 0;\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Chunk queue cleared');\n \n // 8. Clear packet buffer\n if (this.packetBuffer) {\n this.packetBuffer.clear();\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Packet buffer cleared');\n }\n \n // 9. Enhanced memory cleanup with quantum-resistant patterns\n this._secureMemoryManager.isCleaning = true;\n this._secureMemoryManager.cleanupQueue.length = 0;\n this._secureMemoryManager.memoryStats.lastCleanup = Date.now();\n \n // Force multiple garbage collection cycles\n if (typeof window.gc === 'function') {\n try {\n // Multiple GC cycles for thorough cleanup\n for (let i = 0; i < 3; i++) {\n window.gc();\n this._secureLog('info', `\uD83E\uDDF9 Enhanced Emergency: Garbage collection cycle ${i + 1}/3`);\n // Small delay between cycles\n if (i < 2) {\n const start = Date.now();\n while (Date.now() - start < 10) {\n // Busy wait for 10ms\n }\n }\n }\n } catch (e) {\n // Ignore GC errors\n }\n }\n \n this._secureMemoryManager.isCleaning = false;\n \n this._secureLog('info', '\u2705 Enhanced emergency cleanup completed successfully');\n \n } catch (error) {\n this._secureLog('error', '\u274C Enhanced emergency cleanup failed', {\n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n \n // Rollback mechanism (simplified)\n this._secureMemoryManager.isCleaning = false;\n }\n }\n\n /**\n * Validate emergency cleanup success\n * @param {Object} originalState - Original state before cleanup\n * @returns {Object} Validation results\n */\n _validateEmergencyCleanup(originalState) {\n const currentState = {\n messageQueueSize: this.messageQueue.length,\n processedIdsSize: this.processedMessageIds.size,\n packetBufferSize: this.packetBuffer ? this.packetBuffer.size : 0,\n ivTrackingSize: this._ivTrackingSystem ? this._ivTrackingSystem.usedIVs.size : 0,\n decoyChannelsSize: this.decoyChannels ? this.decoyChannels.size : 0\n };\n \n const validation = {\n messageQueueCleared: currentState.messageQueueSize === 0,\n processedIdsCleared: currentState.processedIdsSize === 0,\n packetBufferCleared: currentState.packetBufferSize === 0,\n ivTrackingCleared: currentState.ivTrackingSize === 0,\n decoyChannelsCleared: currentState.decoyChannelsSize === 0,\n allCleared: (\n currentState.messageQueueSize === 0 &&\n currentState.processedIdsSize === 0 &&\n currentState.packetBufferSize === 0 &&\n currentState.ivTrackingSize === 0 &&\n currentState.decoyChannelsSize === 0\n )\n };\n \n return validation;\n }\n\n /**\n * Cleanup resources based on age and usage\n */\n _cleanupResources() {\n const now = Date.now();\n \n // Clean old processed message IDs (keep only last hour)\n if (this.processedMessageIds.size > this._emergencyThresholds.processedMessageIds) {\n this.processedMessageIds.clear();\n this._secureLog('info', '\uD83E\uDDF9 Old processed message IDs cleared');\n }\n \n // Clean old IVs\n if (this._ivTrackingSystem) {\n this._cleanupOldIVs();\n }\n \n // Clean old keys\n this.cleanupOldKeys();\n \n // Clean rate limiter\n if (window.EnhancedSecureCryptoUtils && window.EnhancedSecureCryptoUtils.rateLimiter) {\n window.EnhancedSecureCryptoUtils.rateLimiter.cleanup();\n }\n \n this._secureLog('info', '\uD83E\uDDF9 Resource cleanup completed');\n }\n\n /**\n * Monitor key security (replaces _startKeySecurityMonitoring)\n */\n _monitorKeySecurity() {\n if (this._keyStorageStats.activeKeys > 10) {\n this._secureLog('warn', '\u26A0\uFE0F High number of active keys detected. Consider rotation.');\n }\n \n if (Date.now() - (this._keyStorageStats.lastRotation || 0) > 3600000) {\n this._rotateKeys();\n }\n }\n\n /**\n * Send heartbeat message (called by unified scheduler)\n */\n _sendHeartbeat() {\n try {\n if (this.isConnected() && this.dataChannel && this.dataChannel.readyState === 'open') {\n this.dataChannel.send(JSON.stringify({ \n type: EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT, \n timestamp: Date.now() \n }));\n \n this._heartbeatConfig.lastHeartbeat = Date.now();\n this._secureLog('debug', '\uD83D\uDC93 Heartbeat sent');\n }\n } catch (error) {\n this._secureLog('error', '\u274C Heartbeat failed:', { \n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n }\n }\n\n /**\n * Comprehensive input validation to prevent DoS and injection attacks\n * @param {any} data - Data to validate\n * @param {string} context - Context for validation (e.g., 'sendMessage', 'sendSecureMessage')\n * @returns {Object} Validation result with isValid and sanitizedData\n */\n _validateInputData(data, context = 'unknown') {\n const validationResult = {\n isValid: false,\n sanitizedData: null,\n errors: [],\n warnings: []\n };\n\n try {\n // 1. Basic type validation\n if (data === null || data === undefined) {\n validationResult.errors.push('Data cannot be null or undefined');\n return validationResult;\n }\n\n // 2. Size validation for strings\n if (typeof data === 'string') {\n if (data.length > this._inputValidationLimits.maxStringLength) {\n validationResult.errors.push(`String too long: ${data.length} > ${this._inputValidationLimits.maxStringLength}`);\n return validationResult;\n }\n\n // 3. Malicious pattern detection for strings\n for (const pattern of this._maliciousPatterns) {\n if (pattern.test(data)) {\n validationResult.errors.push(`Malicious pattern detected: ${pattern.source}`);\n this._secureLog('warn', '\uD83D\uDEA8 Malicious pattern detected in input', {\n context: context,\n pattern: pattern.source,\n dataLength: data.length\n });\n return validationResult;\n }\n }\n\n // 4. Sanitize string data\n validationResult.sanitizedData = this._sanitizeInputString(data);\n validationResult.isValid = true;\n return validationResult;\n }\n\n // 5. Object validation\n if (typeof data === 'object') {\n // Check for circular references\n const seen = new WeakSet();\n const checkCircular = (obj, path = '') => {\n if (obj === null || typeof obj !== 'object') return;\n \n if (seen.has(obj)) {\n validationResult.errors.push(`Circular reference detected at path: ${path}`);\n return;\n }\n \n seen.add(obj);\n \n // Check object depth\n if (path.split('.').length > this._inputValidationLimits.maxObjectDepth) {\n validationResult.errors.push(`Object too deep: ${path.split('.').length} > ${this._inputValidationLimits.maxObjectDepth}`);\n return;\n }\n\n // Check array length\n if (Array.isArray(obj) && obj.length > this._inputValidationLimits.maxArrayLength) {\n validationResult.errors.push(`Array too long: ${obj.length} > ${this._inputValidationLimits.maxArrayLength}`);\n return;\n }\n\n // Recursively check all properties\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n checkCircular(obj[key], path ? `${path}.${key}` : key);\n }\n }\n };\n\n checkCircular(data);\n \n if (validationResult.errors.length > 0) {\n return validationResult;\n }\n\n // 6. Check total object size\n const objectSize = this._calculateObjectSize(data);\n if (objectSize > this._inputValidationLimits.maxMessageSize) {\n validationResult.errors.push(`Object too large: ${objectSize} bytes > ${this._inputValidationLimits.maxMessageSize} bytes`);\n return validationResult;\n }\n\n // 7. Sanitize object data\n validationResult.sanitizedData = this._sanitizeInputObject(data);\n validationResult.isValid = true;\n return validationResult;\n }\n\n // 8. ArrayBuffer validation\n if (data instanceof ArrayBuffer) {\n if (data.byteLength > this._inputValidationLimits.maxMessageSize) {\n validationResult.errors.push(`ArrayBuffer too large: ${data.byteLength} bytes > ${this._inputValidationLimits.maxMessageSize} bytes`);\n return validationResult;\n }\n \n validationResult.sanitizedData = data;\n validationResult.isValid = true;\n return validationResult;\n }\n\n // 9. Other types are not allowed\n validationResult.errors.push(`Unsupported data type: ${typeof data}`);\n return validationResult;\n\n } catch (error) {\n validationResult.errors.push(`Validation error: ${error.message}`);\n this._secureLog('error', '\u274C Input validation failed', {\n context: context,\n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n return validationResult;\n }\n }\n\n /**\n * Calculate approximate object size in bytes\n * @param {any} obj - Object to calculate size for\n * @returns {number} Size in bytes\n */\n _calculateObjectSize(obj) {\n try {\n const jsonString = JSON.stringify(obj);\n return new TextEncoder().encode(jsonString).length;\n } catch (error) {\n // If JSON.stringify fails, estimate size\n return 1024 * 1024; // Assume 1MB to be safe\n }\n }\n\n /**\n * Sanitize string data for input validation\n * @param {string} str - String to sanitize\n * @returns {string} Sanitized string\n */\n _sanitizeInputString(str) {\n if (typeof str !== 'string') return str;\n \n // Remove null bytes\n str = str.replace(/\\0/g, '');\n \n // Normalize whitespace\n str = str.replace(/\\s+/g, ' ');\n \n // Trim\n str = str.trim();\n \n return str;\n }\n\n /**\n * Sanitize object data for input validation\n * @param {any} obj - Object to sanitize\n * @returns {any} Sanitized object\n */\n _sanitizeInputObject(obj) {\n if (obj === null || typeof obj !== 'object') return obj;\n \n if (Array.isArray(obj)) {\n return obj.map(item => this._sanitizeInputObject(item));\n }\n \n const sanitized = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n const value = obj[key];\n if (typeof value === 'string') {\n sanitized[key] = this._sanitizeInputString(value);\n } else if (typeof value === 'object') {\n sanitized[key] = this._sanitizeInputObject(value);\n } else {\n sanitized[key] = value;\n }\n }\n }\n \n return sanitized;\n }\n\n /**\n * Rate limiting for message sending\n * @param {string} context - Context for rate limiting\n * @returns {boolean} true if rate limit allows\n */\n _checkRateLimit(context = 'message') {\n const now = Date.now();\n \n // Initialize rate limiter if not exists\n if (!this._rateLimiter) {\n this._rateLimiter = {\n messageCount: 0,\n lastReset: now,\n burstCount: 0,\n lastBurstReset: now\n };\n }\n \n // Reset counters if needed\n if (now - this._rateLimiter.lastReset > 60000) { // 1 minute\n this._rateLimiter.messageCount = 0;\n this._rateLimiter.lastReset = now;\n }\n \n if (now - this._rateLimiter.lastBurstReset > 1000) { // 1 second\n this._rateLimiter.burstCount = 0;\n this._rateLimiter.lastBurstReset = now;\n }\n \n // Check burst limit\n if (this._rateLimiter.burstCount >= this._inputValidationLimits.rateLimitBurstSize) {\n this._secureLog('warn', '\u26A0\uFE0F Rate limit burst exceeded', { context });\n return false;\n }\n \n // Check overall rate limit\n if (this._rateLimiter.messageCount >= this._inputValidationLimits.rateLimitMessagesPerMinute) {\n this._secureLog('warn', '\u26A0\uFE0F Rate limit exceeded', { context });\n return false;\n }\n \n // Increment counters\n this._rateLimiter.messageCount++;\n this._rateLimiter.burstCount++;\n \n return true;\n }\n\n // ============================================\n // SECURE KEY STORAGE MANAGEMENT\n // ============================================\n\n /**\n * Initializes the secure key storage\n */\n _initializeSecureKeyStorage() {\n // Initialize with the new class\n this._secureKeyStorage = new SecureKeyStorage();\n \n // Keep the stats structure for compatibility\n this._keyStorageStats = {\n totalKeys: 0,\n activeKeys: 0,\n lastAccess: null,\n lastRotation: null,\n };\n \n this._secureLog('info', '\uD83D\uDD10 Enhanced secure key storage initialized');\n }\n\n // Helper: ensure file transfer system is ready (lazy init on receiver)\n async _ensureFileTransferReady() {\n try {\n // If already initialized \u2014 done\n if (this.fileTransferSystem) {\n return true;\n }\n // Requires an open data channel and a verified connection\n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n throw new Error('Data channel not open');\n }\n if (!this.isVerified) {\n throw new Error('Connection not verified');\n }\n // Initialization\n this.initializeFileTransfer();\n \n // \u041A\u0420\u0418\u0422\u0418\u0427\u0415\u0421\u041A\u041E\u0415 \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u0416\u0434\u0435\u043C \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0442\u0430\u0439\u043C\u0430\u0443\u0442\u043E\u043C\n let attempts = 0;\n const maxAttempts = 50; // 5 \u0441\u0435\u043A\u0443\u043D\u0434 \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C\n while (!this.fileTransferSystem && attempts < maxAttempts) {\n await new Promise(r => setTimeout(r, 100));\n attempts++;\n }\n \n if (!this.fileTransferSystem) {\n throw new Error('File transfer system initialization timeout');\n }\n \n return true;\n } catch (e) {\n this._secureLog('error', '\u274C _ensureFileTransferReady failed', { \n errorType: e?.constructor?.name || 'Unknown',\n hasMessage: !!e?.message \n });\n return false;\n }\n }\n\n _getSecureKey(keyId) {\n return this._secureKeyStorage.retrieveKey(keyId);\n }\n\n async _setSecureKey(keyId, key) {\n if (!(key instanceof CryptoKey)) {\n this._secureLog('error', '\u274C Attempt to store non-CryptoKey');\n return false;\n }\n \n const success = await this._secureKeyStorage.storeKey(keyId, key, {\n version: this.currentKeyVersion,\n type: key.algorithm.name\n });\n \n if (success) {\n this._secureLog('info', `\uD83D\uDD11 Key ${keyId} stored securely with encryption`);\n }\n \n return success;\n }\n\n /**\n * Validates a key value\n * @param {CryptoKey} key - Key to validate\n * @returns {boolean} true if the key is valid\n */\n _validateKeyValue(key) {\n return key instanceof CryptoKey &&\n key.algorithm &&\n key.usages &&\n key.usages.length > 0;\n }\n\n _secureWipeKeys() {\n this._secureKeyStorage.secureWipeAll();\n this._secureLog('info', '\uD83E\uDDF9 All keys securely wiped and encrypted storage cleared');\n }\n\n /**\n * Validates key storage state\n * @returns {boolean} true if the storage is ready\n */\n _validateKeyStorage() {\n return this._secureKeyStorage instanceof SecureKeyStorage;\n }\n\n /**\n * Returns secure key storage statistics\n * @returns {object} Storage metrics\n */\n _getKeyStorageStats() {\n const stats = this._secureKeyStorage.getStorageStats();\n return {\n totalKeysCount: stats.totalKeys,\n activeKeysCount: stats.totalKeys,\n hasLastAccess: stats.metadata.some(m => m.lastAccessed),\n hasLastRotation: !!this._keyStorageStats.lastRotation,\n storageType: 'SecureKeyStorage',\n timestamp: Date.now()\n };\n }\n\n /**\n * Performs key rotation in storage\n */\n _rotateKeys() {\n const oldKeys = Array.from(this._secureKeyStorage.keys());\n this._secureKeyStorage.clear();\n this._keyStorageStats.lastRotation = Date.now();\n this._keyStorageStats.activeKeys = 0;\n this._secureLog('info', `\uD83D\uDD04 Key rotation completed. ${oldKeys.length} keys rotated`);\n }\n\n /**\n * Emergency key wipe (e.g., upon detecting a threat)\n */\n _emergencyKeyWipe() {\n this._secureWipeKeys();\n this._secureLog('error', '\uD83D\uDEA8 EMERGENCY: All keys wiped due to security threat');\n }\n\n /**\n * Starts key security monitoring\n * @deprecated Use unified scheduler instead\n */\n _startKeySecurityMonitoring() {\n // Functionality moved to unified scheduler\n this._secureLog('info', '\uD83D\uDD27 Key security monitoring moved to unified scheduler');\n }\n\n\n // ============================================\n // HELPER METHODS\n // ============================================\n /**\n * Constant-time key validation to prevent timing attacks\n * @param {CryptoKey} key - Key to validate\n * @returns {boolean} true if key is valid\n */\n _validateKeyConstantTime(key) {\n // Constant-time validation to prevent timing attacks\n let isValid = 0;\n \n // Check if key is CryptoKey instance (constant-time)\n try {\n const isCryptoKey = key instanceof CryptoKey;\n isValid += isCryptoKey ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // Check algorithm (constant-time)\n try {\n const hasAlgorithm = !!(key && key.algorithm);\n isValid += hasAlgorithm ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // Check type (constant-time)\n try {\n const hasType = !!(key && key.type);\n isValid += hasType ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // Check extractable property (constant-time)\n try {\n const hasExtractable = key && key.extractable !== undefined;\n isValid += hasExtractable ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // All checks must pass\n return isValid === 4;\n }\n\n /**\n * Constant-time key pair validation\n * @param {Object} keyPair - Key pair to validate\n * @returns {boolean} true if key pair is valid\n */\n _validateKeyPairConstantTime(keyPair) {\n if (!keyPair || typeof keyPair !== 'object') return false;\n \n const privateKeyValid = this._validateKeyConstantTime(keyPair.privateKey);\n const publicKeyValid = this._validateKeyConstantTime(keyPair.publicKey);\n \n // Constant-time AND operation\n return privateKeyValid && publicKeyValid;\n }\n\n /**\n * Enhanced secure logging system initialization\n */\n _initializeSecureLogging() {\n // Logging levels\n this._logLevels = {\n error: 0,\n warn: 1, \n info: 2,\n debug: 3,\n trace: 4\n };\n \n // Ultra-strict levels for production\n this._currentLogLevel = this._isProductionMode ? \n this._logLevels.error : // In production, ONLY critical errors\n this._logLevels.info; // In development, up to info\n \n // Reduced log limits to prevent data accumulation\n this._logCounts = new Map();\n this._maxLogCount = this._isProductionMode ? 5 : 50; // Reduced limits\n \n // Hard resource limits to prevent memory leaks\n this._resourceLimits = {\n maxLogEntries: this._isProductionMode ? 100 : 1000,\n maxMessageQueue: 1000,\n maxIVHistory: 10000,\n maxProcessedMessageIds: 5000,\n maxDecoyChannels: 100,\n maxFakeTrafficMessages: 500,\n maxChunkQueue: 200,\n maxPacketBuffer: 1000\n };\n \n // Emergency cleanup thresholds\n this._emergencyThresholds = {\n logEntries: this._resourceLimits.maxLogEntries * 0.8, // 80%\n messageQueue: this._resourceLimits.maxMessageQueue * 0.8,\n ivHistory: this._resourceLimits.maxIVHistory * 0.8,\n processedMessageIds: this._resourceLimits.maxProcessedMessageIds * 0.8\n };\n \n // Input validation limits to prevent DoS attacks\n this._inputValidationLimits = {\n maxStringLength: 100000, // 100KB for strings\n maxObjectDepth: 10, // Maximum object nesting depth\n maxArrayLength: 1000, // Maximum array length\n maxMessageSize: 1024 * 1024, // 1MB total message size\n maxConcurrentMessages: 10, // Maximum concurrent message processing\n rateLimitMessagesPerMinute: 60, // Rate limiting\n rateLimitBurstSize: 10 // Burst size for rate limiting\n };\n \n // Malicious pattern detection\n this._maliciousPatterns = [\n /)<[^<]*)*<\\/script>/gi, // Script tags\n /javascript:/gi, // JavaScript protocol\n /data:text\\/html/gi, // Data URLs with HTML\n /on\\w+\\s*=/gi, // Event handlers\n /eval\\s*\\(/gi, // eval() calls\n /document\\./gi, // Document object access\n /window\\./gi, // Window object access\n /localStorage/gi, // LocalStorage access\n /sessionStorage/gi, // SessionStorage access\n /fetch\\s*\\(/gi, // Fetch API calls\n /XMLHttpRequest/gi, // XHR calls\n /import\\s*\\(/gi, // Dynamic imports\n /require\\s*\\(/gi, // Require calls\n /process\\./gi, // Process object access\n /global/gi, // Global object access\n /__proto__/gi, // Prototype pollution\n /constructor/gi, // Constructor access\n /prototype/gi, // Prototype access\n /toString\\s*\\(/gi, // toString calls\n /valueOf\\s*\\(/gi // valueOf calls\n ];\n\n // Comprehensive blacklist with all sensitive patterns\n this._absoluteBlacklist = new Set([\n // Cryptographic keys\n 'encryptionKey', 'macKey', 'metadataKey', 'privateKey', 'publicKey',\n 'ecdhKeyPair', 'ecdsaKeyPair', 'peerPublicKey', 'nestedEncryptionKey',\n \n // Authentication and session data\n 'verificationCode', 'sessionSalt', 'keyFingerprint', 'sessionId',\n 'authChallenge', 'authProof', 'authToken', 'sessionToken',\n \n // Credentials and secrets\n 'password', 'token', 'secret', 'credential', 'signature',\n 'apiKey', 'accessKey', 'secretKey', 'privateKey',\n \n // Cryptographic materials\n 'hash', 'digest', 'nonce', 'iv', 'cipher', 'seed',\n 'entropy', 'random', 'salt', 'fingerprint',\n \n // JWT and session data\n 'jwt', 'bearer', 'refreshToken', 'accessToken',\n \n // File transfer sensitive data\n 'fileHash', 'fileSignature', 'transferKey', 'chunkKey'\n ]);\n\n // Minimal whitelist with strict validation\n this._safeFieldsWhitelist = new Set([\n // Basic status fields\n 'timestamp', 'type', 'status', 'state', 'level',\n 'isConnected', 'isVerified', 'isInitiator', 'version',\n \n // Counters and metrics (safe)\n 'count', 'total', 'active', 'inactive', 'success', 'failure',\n \n // Connection states (safe)\n 'readyState', 'connectionState', 'iceConnectionState',\n \n // Feature counts (safe)\n 'activeFeaturesCount', 'totalFeatures', 'stage',\n \n // Error types (safe)\n 'errorType', 'errorCode', 'phase', 'attempt'\n ]);\n \n // Initialize security monitoring\n this._initializeLogSecurityMonitoring();\n \n this._secureLog('info', `\uD83D\uDD27 Enhanced secure logging initialized (Production: ${this._isProductionMode})`);\n }\n\n /**\n * Initialize security monitoring for logging system\n */\n _initializeLogSecurityMonitoring() {\n // Security monitoring moved to unified scheduler\n this._logSecurityViolations = 0;\n this._maxLogSecurityViolations = 3;\n }\n\n /**\n * Audit logging system security\n */\n _auditLoggingSystemSecurity() {\n let violations = 0;\n \n // Check for excessive log counts (potential data leakage)\n for (const [key, count] of this._logCounts.entries()) {\n if (count > this._maxLogCount * 2) {\n violations++;\n this._originalConsole?.error?.(`\uD83D\uDEA8 LOG SECURITY: Excessive log count detected: ${key}`);\n }\n }\n \n // Check for blacklisted patterns in recent logs\n const recentLogs = Array.from(this._logCounts.keys());\n for (const logKey of recentLogs) {\n if (this._containsSensitiveContent(logKey)) {\n violations++;\n this._originalConsole?.error?.(`\uD83D\uDEA8 LOG SECURITY: Sensitive content in log key: ${logKey}`);\n }\n }\n \n // Emergency shutdown if too many violations\n this._logSecurityViolations += violations;\n if (this._logSecurityViolations >= this._maxLogSecurityViolations) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.('\uD83D\uDEA8 CRITICAL: Logging system disabled due to security violations');\n }\n }\n\n _secureLogShim(...args) {\n try {\n // Validate arguments array\n if (!Array.isArray(args) || args.length === 0) {\n return;\n }\n \n // Proper destructuring with fallback\n const message = args[0];\n const restArgs = args.slice(1);\n \n // Handle different argument patterns\n if (restArgs.length === 0) {\n this._secureLog('info', String(message || ''));\n return;\n }\n \n if (restArgs.length === 1) {\n this._secureLog('info', String(message || ''), restArgs[0]);\n return;\n }\n \n // Proper object structure for multiple args\n this._secureLog('info', String(message || ''), { \n additionalArgs: restArgs,\n argCount: restArgs.length \n });\n } catch (error) {\n // Better error handling - fallback to original console if available\n try {\n if (this._originalConsole?.log) {\n this._originalConsole.log(...args);\n }\n } catch (fallbackError) {\n // Silent failure to prevent execution disruption\n }\n }\n }\n\n /**\n * Setup own logger without touching global console\n */\n _setupOwnLogger() {\n // Create own logger without touching global console\n this.logger = {\n log: (message, data) => this._secureLog('info', message, data),\n info: (message, data) => this._secureLog('info', message, data),\n warn: (message, data) => this._secureLog('warn', message, data),\n error: (message, data) => this._secureLog('error', message, data),\n debug: (message, data) => this._secureLog('debug', message, data)\n };\n \n // In development, log to console; in production, use secure logging only\n if (EnhancedSecureWebRTCManager.DEBUG_MODE) {\n this._secureLog('info', '\uD83D\uDD12 Own logger created - development mode');\n } else {\n this._secureLog('info', '\uD83D\uDD12 Own logger created - production mode');\n }\n }\n /**\n * Production logging - use own logger with minimal output\n */\n _setupProductionLogging() {\n // In production, own logger becomes minimal\n if (this._isProductionMode) {\n this.logger = {\n log: () => {}, // No-op in production\n info: () => {}, // No-op in production\n warn: (message, data) => this._secureLog('warn', message, data),\n error: (message, data) => this._secureLog('error', message, data),\n debug: () => {} // No-op in production\n };\n \n this._secureLog('info', '\uD83D\uDD12 Production logging mode activated');\n }\n }\n /**\n * Secure logging with enhanced data protection\n * @param {string} level - Log level (error, warn, info, debug, trace)\n * @param {string} message - Message\n * @param {object} data - Optional payload (will be sanitized)\n */\n _secureLog(level, message, data = null) {\n // Pre-sanitization audit to prevent data leakage\n if (data && !this._auditLogMessage(message, data)) {\n // Log the attempt but block the actual data\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY: Logging blocked due to potential data leakage');\n return;\n }\n \n // Check log level\n if (this._logLevels[level] > this._currentLogLevel) {\n return;\n }\n \n // Prevent log spam with better key generation\n const logKey = `${level}:${message.substring(0, 50)}`;\n const currentCount = this._logCounts.get(logKey) || 0;\n \n if (currentCount >= this._maxLogCount) {\n return;\n }\n \n this._logCounts.set(logKey, currentCount + 1);\n \n // Enhanced sanitization with multiple passes\n let sanitizedData = null;\n if (data) {\n // First pass: basic sanitization\n sanitizedData = this._sanitizeLogData(data);\n \n // Second pass: check if sanitized data still contains sensitive content\n if (this._containsSensitiveContent(JSON.stringify(sanitizedData))) {\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY: Sanitized data still contains sensitive content - blocking log');\n return;\n }\n }\n \n // Production mode security - only log essential errors\n if (this._isProductionMode) {\n if (level === 'error') {\n // In production, only log error messages without sensitive data\n const safeMessage = this._sanitizeString(message);\n this._originalConsole?.error?.(safeMessage);\n }\n // Block all other log levels in production\n return;\n }\n \n // Development mode: full logging with sanitized data\n const logMethod = this._originalConsole?.[level] || this._originalConsole?.log;\n if (sanitizedData) {\n logMethod(message, sanitizedData);\n } else {\n logMethod(message);\n }\n }\n /**\n * Enhanced sanitization for log data with multiple security layers\n */\n _sanitizeLogData(data) {\n // Pre-check for sensitive content before processing\n if (typeof data === 'string') {\n return this._sanitizeString(data);\n }\n \n if (!data || typeof data !== 'object') {\n return data;\n }\n \n const sanitized = {};\n \n for (const [key, value] of Object.entries(data)) {\n const lowerKey = key.toLowerCase();\n \n // Enhanced blacklist with more comprehensive patterns\n const blacklistPatterns = [\n 'key', 'secret', 'token', 'password', 'credential', 'auth',\n 'fingerprint', 'salt', 'signature', 'private', 'encryption',\n 'mac', 'metadata', 'session', 'jwt', 'bearer', 'hash',\n 'digest', 'nonce', 'iv', 'cipher', 'seed', 'entropy'\n ];\n \n const isBlacklisted = this._absoluteBlacklist.has(key) || \n blacklistPatterns.some(pattern => lowerKey.includes(pattern));\n \n if (isBlacklisted) {\n sanitized[key] = '[SENSITIVE_DATA_BLOCKED]';\n continue;\n }\n \n // Enhanced whitelist with strict validation\n if (this._safeFieldsWhitelist.has(key)) {\n // Even whitelisted fields get sanitized if they contain sensitive data\n if (typeof value === 'string') {\n sanitized[key] = this._sanitizeString(value);\n } else {\n sanitized[key] = value;\n }\n continue;\n }\n \n // Enhanced type handling with security checks\n if (typeof value === 'boolean' || typeof value === 'number') {\n sanitized[key] = value;\n } else if (typeof value === 'string') {\n sanitized[key] = this._sanitizeString(value);\n } else if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n // Don't reveal actual byte lengths for security\n sanitized[key] = `[${value.constructor.name}( bytes)]`;\n } else if (value && typeof value === 'object') {\n // Recursive sanitization with depth limit and security check\n try {\n sanitized[key] = this._sanitizeLogData(value);\n } catch (error) {\n sanitized[key] = '[RECURSIVE_SANITIZATION_FAILED]';\n }\n } else {\n sanitized[key] = `[${typeof value}]`;\n }\n }\n \n // Final security check on sanitized data\n const sanitizedString = JSON.stringify(sanitized);\n if (this._containsSensitiveContent(sanitizedString)) {\n return { error: 'SANITIZATION_FAILED_SENSITIVE_CONTENT_DETECTED' };\n }\n \n return sanitized;\n }\n /**\n * Enhanced sanitization for strings with comprehensive pattern detection\n */\n _sanitizeString(str) {\n if (typeof str !== 'string' || str.length === 0) {\n return str;\n }\n \n // Comprehensive sensitive pattern detection\n const sensitivePatterns = [\n // Hex patterns (various lengths)\n /[a-f0-9]{16,}/i, // 16+ hex chars (covers short keys)\n /[a-f0-9]{8,}/i, // 8+ hex chars (covers shorter keys)\n \n // Base64 patterns (comprehensive)\n /[A-Za-z0-9+/]{16,}={0,2}/, // Base64 with padding\n /[A-Za-z0-9+/]{12,}/, // Base64 without padding\n /[A-Za-z0-9+/=]{10,}/, // Base64-like patterns\n \n // Base58 patterns (Bitcoin-style)\n /[1-9A-HJ-NP-Za-km-z]{16,}/, // Base58 strings\n \n // Base32 patterns\n /[A-Z2-7]{16,}={0,6}/, // Base32 with padding\n /[A-Z2-7]{12,}/, // Base32 without padding\n \n // Custom encoding patterns\n /[A-Za-z0-9\\-_]{16,}/, // URL-safe base64 variants\n /[A-Za-z0-9\\.\\-_]{16,}/, // JWT-like patterns\n \n // Long alphanumeric strings (potential keys)\n /\\b[A-Za-z0-9]{12,}\\b/, // 12+ alphanumeric chars\n /\\b[A-Za-z0-9]{8,}\\b/, // 8+ alphanumeric chars\n \n // PEM key patterns\n /BEGIN\\s+(PRIVATE|PUBLIC|RSA|DSA|EC)\\s+KEY/i,\n /END\\s+(PRIVATE|PUBLIC|RSA|DSA|EC)\\s+KEY/i,\n \n // JWT patterns\n /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n \n // API key patterns\n /(api[_-]?key|token|secret|password|credential)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n \n // UUID patterns\n /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,\n \n // Credit cards and SSN (existing patterns)\n /\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b/,\n /\\b\\d{3}-\\d{2}-\\d{4}\\b/,\n \n // Email patterns (more restrictive)\n /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/,\n \n // Crypto-specific patterns\n /(fingerprint|hash|digest|signature)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n /(encryption|mac|metadata)[\\s]*key[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n \n // Session and auth patterns\n /(session|auth|jwt|bearer)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n ];\n \n // Check for sensitive patterns with early return\n for (const pattern of sensitivePatterns) {\n if (pattern.test(str)) {\n // Always fully hide sensitive data\n return '[SENSITIVE_DATA_REDACTED]';\n }\n }\n \n // Check for suspicious entropy (high randomness indicates keys)\n if (this._hasHighEntropy(str)) {\n return '[HIGH_ENTROPY_DATA_REDACTED]';\n }\n \n // Check for suspicious character distributions\n if (this._hasSuspiciousDistribution(str)) {\n return '[SUSPICIOUS_DATA_REDACTED]';\n }\n \n // For regular strings \u2014 limit length more aggressively\n if (str.length > 50) {\n return str.substring(0, 20) + '...[TRUNCATED]';\n }\n \n return str;\n }\n /**\n * Enhanced sensitive content detection\n */\n _containsSensitiveContent(str) {\n if (typeof str !== 'string') return false;\n \n // Use the same comprehensive patterns as _sanitizeString\n const sensitivePatterns = [\n /[a-f0-9]{16,}/i,\n /[A-Za-z0-9+/]{16,}={0,2}/,\n /[1-9A-HJ-NP-Za-km-z]{16,}/,\n /[A-Z2-7]{16,}={0,6}/,\n /\\b[A-Za-z0-9]{12,}\\b/,\n /BEGIN\\s+(PRIVATE|PUBLIC|RSA|DSA|EC)\\s+KEY/i,\n /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n /(api[_-]?key|token|secret|password|credential)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n ];\n \n return sensitivePatterns.some(pattern => pattern.test(str)) ||\n this._hasHighEntropy(str) ||\n this._hasSuspiciousDistribution(str);\n }\n\n /**\n * Check for high entropy strings (likely cryptographic keys)\n */\n _hasHighEntropy(str) {\n if (str.length < 8) return false;\n \n // Calculate character frequency\n const charCount = {};\n for (const char of str) {\n charCount[char] = (charCount[char] || 0) + 1;\n }\n \n // Calculate Shannon entropy\n const length = str.length;\n let entropy = 0;\n \n for (const count of Object.values(charCount)) {\n const probability = count / length;\n entropy -= probability * Math.log2(probability);\n }\n \n // High entropy (>4.5 bits per character) suggests cryptographic data\n return entropy > 4.5;\n }\n\n /**\n * Check for suspicious character distributions\n */\n _hasSuspiciousDistribution(str) {\n if (str.length < 8) return false;\n \n // Check for uniform distribution of hex characters\n const hexChars = str.match(/[a-f0-9]/gi) || [];\n if (hexChars.length >= str.length * 0.8) {\n // If 80%+ are hex chars, likely a key\n return true;\n }\n \n // Check for base64-like distribution\n const base64Chars = str.match(/[A-Za-z0-9+/=]/g) || [];\n if (base64Chars.length >= str.length * 0.9) {\n // If 90%+ are base64 chars, likely encoded data\n return true;\n }\n \n // Check for very low character diversity (suggests random data)\n const uniqueChars = new Set(str).size;\n const diversityRatio = uniqueChars / str.length;\n \n // If diversity is too high (>0.8) for the length, likely random data\n if (diversityRatio > 0.8 && str.length > 16) {\n return true;\n }\n \n return false;\n }\n\n\n // ============================================\n // SECURE LOGGING SYSTEM\n // ============================================\n \n /**\n * Detects production mode\n */\n _detectProductionMode() {\n // Check various production mode indicators\n return (\n // Standard env variables\n (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') ||\n // No debug flags\n (!this._debugMode) ||\n // Production domains\n (window.location.hostname && !window.location.hostname.includes('localhost') && \n !window.location.hostname.includes('127.0.0.1') && \n !window.location.hostname.includes('.local')) ||\n // Minified code (heuristic check)\n (typeof window.webpackHotUpdate === 'undefined' && !window.location.search.includes('debug'))\n );\n }\n // ============================================\n // FIXED SECURE GLOBAL API\n // ============================================\n \n /**\n * Sets up a secure global API with limited access\n */\n _setupSecureGlobalAPI() {\n // Log that we're starting API setup\n this._secureLog('info', '\uD83D\uDD12 Starting secure global API setup');\n \n // Create simple public API with safety checks\n const secureAPI = {};\n \n // Only bind methods that exist\n if (typeof this.sendMessage === 'function') {\n secureAPI.sendMessage = this.sendMessage.bind(this);\n }\n \n // Create simple getConnectionStatus method\n secureAPI.getConnectionStatus = () => ({\n isConnected: this.isConnected ? this.isConnected() : false,\n isVerified: this.isVerified || false,\n connectionState: this.peerConnection?.connectionState || 'disconnected'\n });\n \n // Create simple getSecurityStatus method\n secureAPI.getSecurityStatus = () => ({\n securityLevel: this.currentSecurityLevel || 'basic',\n stage: 'initialized',\n activeFeaturesCount: Object.values(this.securityFeatures || {}).filter(Boolean).length\n });\n \n if (typeof this.sendFile === 'function') {\n secureAPI.sendFile = this.sendFile.bind(this);\n }\n \n // Create simple getFileTransferStatus method\n secureAPI.getFileTransferStatus = () => ({\n initialized: !!this.fileTransferSystem,\n status: 'ready',\n activeTransfers: 0,\n receivingTransfers: 0\n });\n \n if (typeof this.disconnect === 'function') {\n secureAPI.disconnect = this.disconnect.bind(this);\n }\n \n // Create simple API object with safety checks\n const safeGlobalAPI = {\n ...secureAPI, // Spread only existing methods\n getConfiguration: () => ({\n fakeTraffic: this._config.fakeTraffic.enabled,\n decoyChannels: this._config.decoyChannels.enabled,\n packetPadding: this._config.packetPadding.enabled,\n antiFingerprinting: this._config.antiFingerprinting.enabled\n }),\n emergency: {}\n };\n \n // Only add emergency methods that exist\n if (typeof this._emergencyUnlockAllMutexes === 'function') {\n safeGlobalAPI.emergency.unlockAllMutexes = this._emergencyUnlockAllMutexes.bind(this);\n }\n \n if (typeof this._emergencyRecoverMutexSystem === 'function') {\n safeGlobalAPI.emergency.recoverMutexSystem = this._emergencyRecoverMutexSystem.bind(this);\n }\n \n if (typeof this._emergencyDisableLogging === 'function') {\n safeGlobalAPI.emergency.disableLogging = this._emergencyDisableLogging.bind(this);\n }\n \n if (typeof this._resetLoggingSystem === 'function') {\n safeGlobalAPI.emergency.resetLogging = this._resetLoggingSystem.bind(this);\n }\n \n // Add file transfer system status\n safeGlobalAPI.getFileTransferSystemStatus = () => ({\n initialized: !!this.fileTransferSystem,\n status: 'ready',\n activeTransfers: 0,\n receivingTransfers: 0\n });\n \n // Log available methods for debugging\n this._secureLog('info', '\uD83D\uDD12 API methods available', {\n sendMessage: !!secureAPI.sendMessage,\n getConnectionStatus: !!secureAPI.getConnectionStatus,\n getSecurityStatus: !!secureAPI.getSecurityStatus,\n sendFile: !!secureAPI.sendFile,\n getFileTransferStatus: !!secureAPI.getFileTransferStatus,\n disconnect: !!secureAPI.disconnect,\n getConfiguration: !!safeGlobalAPI.getConfiguration,\n emergencyMethods: Object.keys(safeGlobalAPI.emergency).length\n });\n\n // Apply Object.freeze to prevent modification\n Object.freeze(safeGlobalAPI);\n Object.freeze(safeGlobalAPI.emergency);\n\n // Export API once without monitoring\n this._createProtectedGlobalAPI(safeGlobalAPI);\n \n // Setup minimal protection\n this._setupMinimalGlobalProtection();\n \n // Log that API setup is complete\n this._secureLog('info', '\uD83D\uDD12 Secure global API setup completed successfully');\n }\n /**\n * Create simple global API export\n */\n _createProtectedGlobalAPI(safeGlobalAPI) {\n // Log that we're creating protected global API\n this._secureLog('info', '\uD83D\uDD12 Creating protected global API');\n \n // Simple API export without proxy or monitoring\n if (!window.secureBitChat) {\n this._exportAPI(safeGlobalAPI);\n } else {\n this._secureLog('warn', '\u26A0\uFE0F Global API already exists, skipping setup');\n }\n }\n \n /**\n * Simple API export without monitoring\n */\n _exportAPI(apiObject) {\n // Log that we're exporting API\n this._secureLog('info', '\uD83D\uDD12 Exporting API to window.secureBitChat');\n \n // Check if important methods are available\n if (!this._importantMethods || !this._importantMethods.defineProperty) {\n this._secureLog('error', '\u274C Important methods not available for API export, using fallback');\n // Fallback to direct Object.defineProperty\n Object.defineProperty(window, 'secureBitChat', {\n value: apiObject,\n writable: false,\n configurable: false,\n enumerable: true\n });\n } else {\n // One-time export with immutable properties\n this._importantMethods.defineProperty(window, 'secureBitChat', {\n value: apiObject,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n \n this._secureLog('info', '\uD83D\uDD12 Secure API exported to window.secureBitChat');\n }\n \n /**\n * Setup minimal global protection\n */\n _setupMinimalGlobalProtection() {\n // Simple protection without monitoring (methods already stored)\n this._protectGlobalAPI();\n \n this._secureLog('info', '\uD83D\uDD12 Minimal global protection activated');\n }\n \n /**\n * Store important methods in closure for local use\n */\n _storeImportantMethods() {\n // Store references to important methods locally\n this._importantMethods = {\n defineProperty: Object.defineProperty,\n getOwnPropertyDescriptor: Object.getOwnPropertyDescriptor,\n freeze: Object.freeze,\n consoleLog: console.log,\n consoleError: console.error,\n consoleWarn: console.warn\n };\n \n this._secureLog('info', '\uD83D\uDD12 Important methods stored locally', {\n defineProperty: !!this._importantMethods.defineProperty,\n getOwnPropertyDescriptor: !!this._importantMethods.getOwnPropertyDescriptor,\n freeze: !!this._importantMethods.freeze\n });\n }\n\n /**\n * Simple protection without monitoring\n */\n _setupSimpleProtection() {\n this._secureLog('info', '\uD83D\uDD12 Simple protection activated - no monitoring');\n }\n\n /**\n * No global exposure prevention needed\n */\n _preventGlobalExposure() {\n this._secureLog('info', '\uD83D\uDD12 No global exposure prevention - using secure API export only');\n }\n /**\n * API integrity check - only at initialization\n */\n _verifyAPIIntegrity() {\n try {\n if (!window.secureBitChat) {\n this._secureLog('error', '\u274C SECURITY ALERT: Secure API has been removed!');\n return false;\n }\n \n const requiredMethods = ['sendMessage', 'getConnectionStatus', 'disconnect'];\n const missingMethods = requiredMethods.filter(method => \n typeof window.secureBitChat[method] !== 'function'\n );\n \n if (missingMethods.length > 0) {\n this._secureLog('error', '\u274C SECURITY ALERT: API tampering detected, missing methods:', { errorType: missingMethods?.constructor?.name || 'Unknown' });\n return false;\n }\n \n return true;\n } catch (error) {\n this._secureLog('error', '\u274C SECURITY ALERT: API integrity check failed:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n // ============================================\n // ADDITIONAL SECURITY METHODS\n // ============================================\n \n /**\n * Simple global exposure check - only at initialization\n */\n _auditGlobalExposure() {\n // Only check once at initialization, no periodic scanning\n this._secureLog('info', '\uD83D\uDD12 Global exposure check completed at initialization');\n return [];\n }\n \n /**\n * No periodic security audits - only at initialization\n */\n _startSecurityAudit() {\n // Only audit once at initialization, no periodic checks\n this._secureLog('info', '\uD83D\uDD12 Security audit completed at initialization - no periodic monitoring');\n }\n \n /**\n * Simple global API protection\n */\n _protectGlobalAPI() {\n if (!window.secureBitChat) {\n this._secureLog('warn', '\u26A0\uFE0F Global API not found during protection setup');\n return;\n }\n\n try {\n // Validate API integrity once\n if (this._validateAPIIntegrityOnce()) {\n this._secureLog('info', '\uD83D\uDD12 Global API protection verified');\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to verify global API protection', { \n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n \n /**\n * Validate API integrity once at initialization\n */\n _validateAPIIntegrityOnce() {\n try {\n // Check if API is properly configured\n if (!this._importantMethods || !this._importantMethods.getOwnPropertyDescriptor) {\n // Fallback to direct Object.getOwnPropertyDescriptor\n const descriptor = Object.getOwnPropertyDescriptor(window, 'secureBitChat');\n \n if (!descriptor || descriptor.configurable) {\n throw new Error('secureBitChat must not be reconfigurable!');\n }\n } else {\n const descriptor = this._importantMethods.getOwnPropertyDescriptor(window, 'secureBitChat');\n \n if (!descriptor || descriptor.configurable) {\n throw new Error('secureBitChat must not be reconfigurable!');\n }\n }\n \n this._secureLog('info', '\u2705 API integrity validated');\n return true;\n \n } catch (error) {\n this._secureLog('error', '\u274C API integrity validation failed', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n return false;\n }\n }\n \n /**\n * Secure memory wipe for sensitive data\n */\n _secureWipeMemory(data, context = 'unknown') {\n if (!data) return;\n \n try {\n // Different handling for different data types\n if (data instanceof ArrayBuffer) {\n this._secureWipeArrayBuffer(data, context);\n } else if (data instanceof Uint8Array) {\n this._secureWipeUint8Array(data, context);\n } else if (Array.isArray(data)) {\n this._secureWipeArray(data, context);\n } else if (typeof data === 'string') {\n this._secureWipeString(data, context);\n } else if (data instanceof CryptoKey) {\n this._secureWipeCryptoKey(data, context);\n } else if (typeof data === 'object') {\n this._secureWipeObject(data, context);\n }\n \n this._secureMemoryManager.memoryStats.totalCleanups++;\n \n } catch (error) {\n this._secureMemoryManager.memoryStats.failedCleanups++;\n this._secureLog('error', '\u274C Secure memory wipe failed', {\n context: context,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n \n /**\n * Secure wipe for ArrayBuffer\n */\n _secureWipeArrayBuffer(buffer, context) {\n if (!buffer || buffer.byteLength === 0) return;\n \n try {\n const view = new Uint8Array(buffer);\n \n // Overwrite with random data first\n crypto.getRandomValues(view);\n \n // Overwrite with zeros\n view.fill(0);\n \n // Overwrite with ones\n view.fill(255);\n \n // Final zero overwrite\n view.fill(0);\n \n this._secureLog('debug', '\uD83D\uDD12 ArrayBuffer securely wiped', {\n context: context,\n size: buffer.byteLength\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe ArrayBuffer', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure wipe for Uint8Array\n */\n _secureWipeUint8Array(array, context) {\n if (!array || array.length === 0) return;\n \n try {\n // Overwrite with random data first\n crypto.getRandomValues(array);\n \n // Overwrite with zeros\n array.fill(0);\n \n // Overwrite with ones\n array.fill(255);\n \n // Final zero overwrite\n array.fill(0);\n \n this._secureLog('debug', '\uD83D\uDD12 Uint8Array securely wiped', {\n context: context,\n size: array.length\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe Uint8Array', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure wipe for arrays\n */\n _secureWipeArray(array, context) {\n if (!Array.isArray(array) || array.length === 0) return;\n \n try {\n // Recursively wipe each element\n array.forEach((item, index) => {\n if (item !== null && item !== undefined) {\n this._secureWipeMemory(item, `${context}[${index}]`);\n }\n });\n \n // Fill with nulls\n array.fill(null);\n \n this._secureLog('debug', '\uD83D\uDD12 Array securely wiped', {\n context: context,\n size: array.length\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe array', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * No string wiping - strings are immutable in JS\n */\n _secureWipeString(str, context) {\n // Strings are immutable in JavaScript, no need to wipe\n // Just remove the reference\n this._secureLog('debug', '\uD83D\uDD12 String reference removed (strings are immutable)', {\n context: context,\n length: str ? str.length : 0\n });\n }\n \n /**\n * CryptoKey cleanup - store in WeakMap for proper GC\n */\n _secureWipeCryptoKey(key, context) {\n if (!key || !(key instanceof CryptoKey)) return;\n \n try {\n // Store in WeakMap for proper garbage collection\n if (!this._cryptoKeyStorage) {\n this._cryptoKeyStorage = new WeakMap();\n }\n \n // Store reference for cleanup tracking\n this._cryptoKeyStorage.set(key, {\n context: context,\n timestamp: Date.now(),\n type: key.type\n });\n \n this._secureLog('debug', '\uD83D\uDD12 CryptoKey stored in WeakMap for cleanup', {\n context: context,\n type: key.type\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to store CryptoKey for cleanup', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure wipe for objects\n */\n _secureWipeObject(obj, context) {\n if (!obj || typeof obj !== 'object') return;\n \n try {\n // Recursively wipe all properties\n for (const [key, value] of Object.entries(obj)) {\n if (value !== null && value !== undefined) {\n this._secureWipeMemory(value, `${context}.${key}`);\n }\n // Set property to null\n obj[key] = null;\n }\n \n this._secureLog('debug', '\uD83D\uDD12 Object securely wiped', {\n context: context,\n properties: Object.keys(obj).length\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe object', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure cleanup of cryptographic materials\n */\n _secureCleanupCryptographicMaterials() {\n try {\n // Secure wipe of key pairs\n if (this.ecdhKeyPair) {\n this._secureWipeMemory(this.ecdhKeyPair, 'ecdhKeyPair');\n this.ecdhKeyPair = null;\n }\n \n if (this.ecdsaKeyPair) {\n this._secureWipeMemory(this.ecdsaKeyPair, 'ecdsaKeyPair');\n this.ecdsaKeyPair = null;\n }\n \n // Secure wipe of derived keys\n if (this.encryptionKey) {\n this._secureWipeMemory(this.encryptionKey, 'encryptionKey');\n this.encryptionKey = null;\n }\n \n if (this.macKey) {\n this._secureWipeMemory(this.macKey, 'macKey');\n this.macKey = null;\n }\n \n if (this.metadataKey) {\n this._secureWipeMemory(this.metadataKey, 'metadataKey');\n this.metadataKey = null;\n }\n \n if (this.nestedEncryptionKey) {\n this._secureWipeMemory(this.nestedEncryptionKey, 'nestedEncryptionKey');\n this.nestedEncryptionKey = null;\n }\n \n // Secure wipe of session data\n if (this.sessionSalt) {\n this._secureWipeMemory(this.sessionSalt, 'sessionSalt');\n this.sessionSalt = null;\n }\n \n if (this.sessionId) {\n this._secureWipeMemory(this.sessionId, 'sessionId');\n this.sessionId = null;\n }\n \n if (this.verificationCode) {\n this._secureWipeMemory(this.verificationCode, 'verificationCode');\n this.verificationCode = null;\n }\n \n if (this.peerPublicKey) {\n this._secureWipeMemory(this.peerPublicKey, 'peerPublicKey');\n this.peerPublicKey = null;\n }\n \n if (this.keyFingerprint) {\n this._secureWipeMemory(this.keyFingerprint, 'keyFingerprint');\n this.keyFingerprint = null;\n }\n \n if (this.connectionId) {\n this._secureWipeMemory(this.connectionId, 'connectionId');\n this.connectionId = null;\n }\n \n this._secureLog('info', '\uD83D\uDD12 Cryptographic materials securely cleaned up');\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to cleanup cryptographic materials', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n \n /**\n * Force garbage collection if available\n */\n _forceGarbageCollection() {\n try {\n // Try to force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n this._secureLog('debug', '\uD83D\uDD12 Garbage collection forced');\n } else if (typeof global.gc === 'function') {\n global.gc();\n this._secureLog('debug', '\uD83D\uDD12 Garbage collection forced (global)');\n } else {\n this._secureLog('debug', '\u26A0\uFE0F Garbage collection not available');\n }\n } catch (error) {\n this._secureLog('error', '\u274C Failed to force garbage collection', {\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Perform periodic memory cleanup\n */\n _performPeriodicMemoryCleanup() {\n try {\n this._secureMemoryManager.isCleaning = true;\n \n // Clean up any remaining sensitive data\n this._secureCleanupCryptographicMaterials();\n \n // Clean up message queue if it's too large\n if (this.messageQueue && this.messageQueue.length > 100) {\n const excessMessages = this.messageQueue.splice(0, this.messageQueue.length - 50);\n excessMessages.forEach((message, index) => {\n this._secureWipeMemory(message, `periodicCleanup[${index}]`);\n });\n }\n \n // Clean up processed message IDs if too many\n if (this.processedMessageIds && this.processedMessageIds.size > 1000) {\n this.processedMessageIds.clear();\n }\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n this._secureLog('debug', '\uD83D\uDD12 Periodic memory cleanup completed');\n \n } catch (error) {\n this._secureLog('error', '\u274C Error during periodic memory cleanup', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n } finally {\n this._secureMemoryManager.isCleaning = false;\n }\n }\n \n /**\n * Create secure error message without information disclosure\n */\n _createSecureErrorMessage(originalError, context = 'unknown') {\n try {\n // Categorize error for appropriate handling\n const category = this._categorizeError(originalError);\n \n // Generate safe error message based on category\n const safeMessage = this._getSafeErrorMessage(category, context);\n \n // Log detailed error internally for debugging\n this._secureLog('error', 'Internal error occurred', {\n category: category,\n context: context,\n errorType: originalError?.constructor?.name || 'Unknown',\n timestamp: Date.now()\n });\n \n // Track error frequency\n this._trackErrorFrequency(category);\n \n return safeMessage;\n \n } catch (error) {\n // Fallback to generic error if error handling fails\n this._secureLog('error', 'Error handling failed', {\n originalError: originalError?.message || 'Unknown',\n handlingError: error.message\n });\n return 'An unexpected error occurred';\n }\n }\n \n /**\n * Categorize error for appropriate handling\n */\n _categorizeError(error) {\n if (!error || !error.message) {\n return this._secureErrorHandler.errorCategories.UNKNOWN;\n }\n \n const message = error.message.toLowerCase();\n \n // Cryptographic errors\n if (message.includes('crypto') || \n message.includes('key') || \n message.includes('encrypt') || \n message.includes('decrypt') ||\n message.includes('sign') ||\n message.includes('verify') ||\n message.includes('ecdh') ||\n message.includes('ecdsa')) {\n return this._secureErrorHandler.errorCategories.CRYPTOGRAPHIC;\n }\n \n // Network errors\n if (message.includes('network') || \n message.includes('connection') || \n message.includes('timeout') ||\n message.includes('webrtc') ||\n message.includes('peer')) {\n return this._secureErrorHandler.errorCategories.NETWORK;\n }\n \n // Validation errors\n if (message.includes('invalid') || \n message.includes('validation') || \n message.includes('format') ||\n message.includes('type')) {\n return this._secureErrorHandler.errorCategories.VALIDATION;\n }\n \n // System errors\n if (message.includes('system') || \n message.includes('internal') || \n message.includes('memory') ||\n message.includes('resource')) {\n return this._secureErrorHandler.errorCategories.SYSTEM;\n }\n \n return this._secureErrorHandler.errorCategories.UNKNOWN;\n }\n \n /**\n * Get safe error message based on category\n */\n _getSafeErrorMessage(category, context) {\n const safeMessages = {\n [this._secureErrorHandler.errorCategories.CRYPTOGRAPHIC]: {\n 'key_generation': 'Security initialization failed',\n 'key_import': 'Security verification failed',\n 'key_derivation': 'Security setup failed',\n 'encryption': 'Message security failed',\n 'decryption': 'Message verification failed',\n 'signature': 'Authentication failed',\n 'default': 'Security operation failed'\n },\n [this._secureErrorHandler.errorCategories.NETWORK]: {\n 'connection': 'Connection failed',\n 'timeout': 'Connection timeout',\n 'peer': 'Peer connection failed',\n 'webrtc': 'Communication failed',\n 'default': 'Network operation failed'\n },\n [this._secureErrorHandler.errorCategories.VALIDATION]: {\n 'format': 'Invalid data format',\n 'type': 'Invalid data type',\n 'structure': 'Invalid data structure',\n 'default': 'Validation failed'\n },\n [this._secureErrorHandler.errorCategories.SYSTEM]: {\n 'memory': 'System resource error',\n 'resource': 'System resource unavailable',\n 'internal': 'Internal system error',\n 'default': 'System operation failed'\n },\n [this._secureErrorHandler.errorCategories.UNKNOWN]: {\n 'default': 'An unexpected error occurred'\n }\n };\n \n const categoryMessages = safeMessages[category] || safeMessages[this._secureErrorHandler.errorCategories.UNKNOWN];\n \n // Determine specific context for more precise message\n let specificContext = 'default';\n if (context.includes('key') || context.includes('crypto')) {\n specificContext = category === this._secureErrorHandler.errorCategories.CRYPTOGRAPHIC ? 'key_generation' : 'default';\n } else if (context.includes('connection') || context.includes('peer')) {\n specificContext = category === this._secureErrorHandler.errorCategories.NETWORK ? 'connection' : 'default';\n } else if (context.includes('validation') || context.includes('format')) {\n specificContext = category === this._secureErrorHandler.errorCategories.VALIDATION ? 'format' : 'default';\n }\n \n return categoryMessages[specificContext] || categoryMessages.default;\n }\n \n /**\n * Track error frequency for security monitoring\n */\n _trackErrorFrequency(category) {\n const now = Date.now();\n \n // Clean old error counts\n if (now - this._secureErrorHandler.lastErrorTime > 60000) { // 1 minute\n this._secureErrorHandler.errorCounts.clear();\n }\n \n // Increment error count\n const currentCount = this._secureErrorHandler.errorCounts.get(category) || 0;\n this._secureErrorHandler.errorCounts.set(category, currentCount + 1);\n this._secureErrorHandler.lastErrorTime = now;\n \n // Check if we're exceeding error threshold\n const totalErrors = Array.from(this._secureErrorHandler.errorCounts.values()).reduce((sum, count) => sum + count, 0);\n \n if (totalErrors > this._secureErrorHandler.errorThreshold) {\n this._secureErrorHandler.isInErrorMode = true;\n this._secureLog('warn', '\u26A0\uFE0F High error frequency detected - entering error mode', {\n totalErrors: totalErrors,\n threshold: this._secureErrorHandler.errorThreshold\n });\n }\n }\n \n /**\n * Throw secure error without information disclosure\n */\n _throwSecureError(originalError, context = 'unknown') {\n const secureMessage = this._createSecureErrorMessage(originalError, context);\n throw new Error(secureMessage);\n }\n \n /**\n * Get error handling statistics\n */\n _getErrorHandlingStats() {\n return {\n errorCounts: Object.fromEntries(this._secureErrorHandler.errorCounts),\n isInErrorMode: this._secureErrorHandler.isInErrorMode,\n lastErrorTime: this._secureErrorHandler.lastErrorTime,\n errorThreshold: this._secureErrorHandler.errorThreshold\n };\n }\n \n /**\n * Reset error handling system\n */\n _resetErrorHandlingSystem() {\n this._secureErrorHandler.errorCounts.clear();\n this._secureErrorHandler.isInErrorMode = false;\n this._secureErrorHandler.lastErrorTime = 0;\n \n this._secureLog('info', '\uD83D\uDD04 Error handling system reset');\n }\n \n /**\n * Get memory management statistics\n */\n _getMemoryManagementStats() {\n return {\n totalCleanups: this._secureMemoryManager.memoryStats.totalCleanups,\n failedCleanups: this._secureMemoryManager.memoryStats.failedCleanups,\n lastCleanup: this._secureMemoryManager.memoryStats.lastCleanup,\n isCleaning: this._secureMemoryManager.isCleaning,\n queueLength: this._secureMemoryManager.cleanupQueue.length\n };\n }\n \n /**\n * Validate API integrity and security\n */\n _validateAPIIntegrity() {\n try {\n // Check if API exists\n if (!window.secureBitChat) {\n this._secureLog('error', '\u274C Global API not found during integrity validation');\n return false;\n }\n \n // Validate required methods exist\n const requiredMethods = ['sendMessage', 'getConnectionStatus', 'getSecurityStatus', 'sendFile', 'disconnect'];\n const missingMethods = requiredMethods.filter(method => \n !window.secureBitChat[method] || typeof window.secureBitChat[method] !== 'function'\n );\n \n if (missingMethods.length > 0) {\n this._secureLog('error', '\u274C Global API integrity validation failed - missing methods', {\n missingMethods: missingMethods\n });\n return false;\n }\n \n // Test method binding integrity\n const testContext = { test: true };\n const boundMethods = requiredMethods.map(method => {\n try {\n return window.secureBitChat[method].bind(testContext);\n } catch (error) {\n return null;\n }\n });\n \n const unboundMethods = boundMethods.filter(method => method === null);\n if (unboundMethods.length > 0) {\n this._secureLog('error', '\u274C Global API integrity validation failed - method binding issues', {\n unboundMethods: unboundMethods.length\n });\n return false;\n }\n \n // Test API immutability\n try {\n const testProp = '_integrity_test_' + Date.now();\n Object.defineProperty(window.secureBitChat, testProp, {\n value: 'test',\n writable: true,\n configurable: true\n });\n \n this._secureLog('error', '\u274C Global API integrity validation failed - API is mutable');\n delete window.secureBitChat[testProp];\n return false;\n \n } catch (immutabilityError) {\n // This is expected - API should be immutable\n this._secureLog('debug', '\u2705 Global API immutability verified');\n }\n \n this._secureLog('info', '\u2705 Global API integrity validation passed');\n return true;\n \n } catch (error) {\n this._secureLog('error', '\u274C Global API integrity validation failed', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n return false;\n }\n }\n\n _validateCryptographicSecurity() {\n // Check if basic security features are available\n const criticalFeatures = ['hasRateLimiting'];\n const missingCritical = criticalFeatures.filter(feature => !this.securityFeatures[feature]);\n \n if (missingCritical.length > 0) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Missing critical rate limiting feature', {\n missing: missingCritical,\n currentFeatures: this.securityFeatures,\n action: 'Rate limiting will be forced enabled'\n });\n\n missingCritical.forEach(feature => {\n this.securityFeatures[feature] = true;\n this._secureLog('warn', `\u26A0\uFE0F Forced enable critical: ${feature} = true`);\n });\n }\n\n // Log current security state\n const availableFeatures = Object.keys(this.securityFeatures).filter(f => this.securityFeatures[f]);\n const encryptionFeatures = ['hasEncryption', 'hasECDH', 'hasECDSA'].filter(f => this.securityFeatures[f]);\n \n this._secureLog('info', '\u2705 Cryptographic security validation passed', {\n criticalFeatures: criticalFeatures.length,\n availableFeatures: availableFeatures.length,\n encryptionFeatures: encryptionFeatures.length,\n totalSecurityFeatures: availableFeatures.length,\n note: 'Encryption features will be enabled after key generation',\n currentState: {\n hasEncryption: this.securityFeatures.hasEncryption,\n hasECDH: this.securityFeatures.hasECDH,\n hasECDSA: this.securityFeatures.hasECDSA,\n hasRateLimiting: this.securityFeatures.hasRateLimiting\n }\n });\n \n return true;\n }\n\n _syncSecurityFeaturesWithTariff() {\n // All security features are enabled by default - no payment required\n this._secureLog('info', '\u2705 All security features enabled by default - no payment required');\n \n // Ensure all features are enabled\n const allFeatures = [\n 'hasEncryption', 'hasECDH', 'hasECDSA', 'hasMutualAuth',\n 'hasMetadataProtection', 'hasEnhancedReplayProtection',\n 'hasNonExtractableKeys', 'hasRateLimiting', 'hasEnhancedValidation', 'hasPFS',\n 'hasNestedEncryption', 'hasPacketPadding', 'hasPacketReordering',\n 'hasAntiFingerprinting', 'hasFakeTraffic', 'hasDecoyChannels', 'hasMessageChunking'\n ];\n \n allFeatures.forEach(feature => {\n this.securityFeatures[feature] = true;\n });\n \n this._secureLog('info', '\u2705 All security features enabled by default', {\n enabledFeatures: Object.keys(this.securityFeatures).filter(f => this.securityFeatures[f]).length,\n totalFeatures: Object.keys(this.securityFeatures).length\n });\n \n return;\n }\n \n /**\n * Emergency shutdown for critical issues\n */\n _emergencyShutdown(reason = 'Security breach') {\n this._secureLog('error', '\u274C EMERGENCY SHUTDOWN: ${reason}');\n \n try {\n // Clear critical data\n this.encryptionKey = null;\n this.macKey = null;\n this.metadataKey = null;\n this.verificationCode = null;\n this.keyFingerprint = null;\n this.connectionId = null;\n \n // Close connections\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Clear buffers\n this.messageQueue = [];\n this.processedMessageIds.clear();\n this.packetBuffer.clear();\n \n // Notify UI\n if (this.onStatusChange) {\n this.onStatusChange('security_breach');\n }\n \n this._secureLog('info', '\uD83D\uDD12 Emergency shutdown completed');\n \n } catch (error) {\n this._secureLog('error', '\u274C Error during emergency shutdown:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n _finalizeSecureInitialization() {\n this._startKeySecurityMonitoring();\n \n // Verify API integrity\n if (!this._verifyAPIIntegrity()) {\n this._secureLog('error', '\u274C Security initialization failed');\n return;\n }\n\n this._startSecurityMonitoring();\n \n // Start periodic log cleanup\n setInterval(() => {\n this._cleanupLogs();\n }, 300000);\n \n this._secureLog('info', '\u2705 Secure WebRTC Manager initialization completed');\n this._secureLog('info', '\uD83D\uDD12 Global exposure protection: Monitoring only, no automatic removal');\n }\n /**\n * Start security monitoring\n * @deprecated Use unified scheduler instead\n */\n _startSecurityMonitoring() {\n // All security monitoring moved to unified scheduler\n this._secureLog('info', '\uD83D\uDD27 Security monitoring moved to unified scheduler');\n }\n /**\n * Validates connection readiness for sending data\n * @param {boolean} throwError - whether to throw on not ready\n * @returns {boolean} true if connection is ready\n */\n _validateConnection(throwError = true) {\n const isDataChannelReady = this.dataChannel && this.dataChannel.readyState === 'open';\n const isConnectionVerified = this.isVerified;\n const isValid = isDataChannelReady && isConnectionVerified;\n \n if (!isValid && throwError) {\n if (!isDataChannelReady) {\n throw new Error('Data channel not ready');\n }\n if (!isConnectionVerified) {\n throw new Error('Connection not verified');\n }\n }\n \n return isValid;\n }\n\n /**\n * Hard gate for traffic blocking without verification\n * This method enforces that NO traffic (including system messages and file transfers)\n * can pass through without proper cryptographic verification\n */\n _enforceVerificationGate(operation = 'unknown', throwError = true) {\n if (!this.isVerified) {\n const errorMessage = `SECURITY VIOLATION: ${operation} blocked - connection not cryptographically verified`;\n this._secureLog('error', errorMessage, {\n operation: operation,\n isVerified: this.isVerified,\n hasKeys: !!(this.encryptionKey && this.macKey),\n timestamp: Date.now()\n });\n \n if (throwError) {\n throw new Error(errorMessage);\n }\n return false;\n }\n return true;\n }\n\n /**\n * Safe method to set isVerified only after cryptographic verification\n * This is the ONLY method that should set isVerified = true\n */\n _setVerifiedStatus(verified, verificationMethod = 'unknown', verificationData = null) {\n if (verified) {\n // Validate that we have proper cryptographic verification\n if (!this.encryptionKey || !this.macKey) {\n throw new Error('Cannot set verified=true without encryption keys');\n }\n \n if (!verificationMethod || verificationMethod === 'unknown') {\n throw new Error('Cannot set verified=true without specifying verification method');\n }\n \n // Log the verification for audit trail\n this._secureLog('info', 'Connection verified through cryptographic verification', {\n verificationMethod: verificationMethod,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n keyFingerprint: this.keyFingerprint,\n timestamp: Date.now(),\n verificationData: verificationData ? 'provided' : 'none'\n });\n }\n \n this.isVerified = verified;\n \n if (verified) {\n this.onStatusChange('connected');\n } else {\n this.onStatusChange('disconnected');\n }\n }\n\n /**\n * Create AAD (Additional Authenticated Data) for file messages\n * This binds file messages to the current session and prevents replay attacks\n */\n _createFileMessageAAD(messageType, messageData = null) {\n // Verify that _createMessageAAD method is available\n if (typeof this._createMessageAAD !== 'function') {\n throw new Error('_createMessageAAD method is not available in _createFileMessageAAD. Manager may not be fully initialized.');\n }\n // Use the unified AAD creation method with file message flag\n return this._createMessageAAD(messageType, messageData, true);\n }\n\n /**\n * Validate AAD for file messages\n * This ensures file messages are bound to the correct session\n */\n _validateFileMessageAAD(aadString, expectedMessageType = null) {\n try {\n const aad = JSON.parse(aadString);\n \n // Validate session binding\n if (aad.sessionId !== (this.currentSession?.sessionId || 'unknown')) {\n throw new Error('AAD sessionId mismatch - possible replay attack');\n }\n \n if (aad.keyFingerprint !== (this.keyFingerprint || 'unknown')) {\n throw new Error('AAD keyFingerprint mismatch - possible key substitution attack');\n }\n \n // Validate message type if specified\n if (expectedMessageType && aad.messageType !== expectedMessageType) {\n throw new Error(`AAD messageType mismatch - expected ${expectedMessageType}, got ${aad.messageType}`);\n }\n \n // Validate timestamp (prevent very old messages)\n const now = Date.now();\n const messageAge = now - aad.timestamp;\n if (messageAge > 300000) { // 5 minutes\n throw new Error('AAD timestamp too old - possible replay attack');\n }\n \n return aad;\n } catch (error) {\n this._secureLog('error', 'AAD validation failed', { error: error.message, aadString });\n throw new Error(`AAD validation failed: ${error.message}`);\n }\n }\n\n /**\n * Extract DTLS fingerprint from SDP\n * This is essential for MITM protection\n */\n _extractDTLSFingerprintFromSDP(sdp) {\n try {\n if (!sdp || typeof sdp !== 'string') {\n throw new Error('Invalid SDP provided');\n }\n\n // Look for a=fingerprint lines in SDP with more flexible regex\n const fingerprintRegex = /a=fingerprint:([a-zA-Z0-9-]+)\\s+([A-Fa-f0-9:]+)/g;\n const fingerprints = [];\n let match;\n\n while ((match = fingerprintRegex.exec(sdp)) !== null) {\n fingerprints.push({\n algorithm: match[1].toLowerCase(),\n fingerprint: match[2].toLowerCase().replace(/:/g, '')\n });\n }\n\n if (fingerprints.length === 0) {\n // Try alternative fingerprint format\n const altFingerprintRegex = /fingerprint\\s*=\\s*([a-zA-Z0-9-]+)\\s+([A-Fa-f0-9:]+)/gi;\n while ((match = altFingerprintRegex.exec(sdp)) !== null) {\n fingerprints.push({\n algorithm: match[1].toLowerCase(),\n fingerprint: match[2].toLowerCase().replace(/:/g, '')\n });\n }\n }\n\n if (fingerprints.length === 0) {\n this._secureLog('warn', 'No DTLS fingerprints found in SDP - this may be normal for some WebRTC implementations', {\n sdpLength: sdp.length,\n sdpPreview: sdp.substring(0, 200) + '...'\n });\n throw new Error('No DTLS fingerprints found in SDP');\n }\n\n // Prefer SHA-256 fingerprints\n const sha256Fingerprint = fingerprints.find(fp => fp.algorithm === 'sha-256');\n if (sha256Fingerprint) {\n return sha256Fingerprint.fingerprint;\n }\n\n // Fallback to first available fingerprint\n return fingerprints[0].fingerprint;\n } catch (error) {\n this._secureLog('error', 'Failed to extract DTLS fingerprint from SDP', { \n error: error.message,\n sdpLength: sdp?.length || 0\n });\n throw new Error(`DTLS fingerprint extraction failed: ${error.message}`);\n }\n }\n\n /**\n * Validate DTLS fingerprint against expected value\n * This prevents MITM attacks by ensuring the remote peer has the expected certificate\n */\n _validateDTLSFingerprint(receivedFingerprint, expectedFingerprint, context = 'unknown') {\n try {\n if (!receivedFingerprint || !expectedFingerprint) {\n throw new Error('Missing fingerprint for validation');\n }\n\n // Normalize fingerprints (remove colons, convert to lowercase)\n const normalizedReceived = receivedFingerprint.toLowerCase().replace(/:/g, '');\n const normalizedExpected = expectedFingerprint.toLowerCase().replace(/:/g, '');\n\n if (normalizedReceived !== normalizedExpected) {\n this._secureLog('error', 'DTLS fingerprint mismatch - possible MITM attack', {\n context: context,\n received: normalizedReceived,\n expected: normalizedExpected,\n timestamp: Date.now()\n });\n \n throw new Error(`DTLS fingerprint mismatch - possible MITM attack in ${context}`);\n }\n\n this._secureLog('info', 'DTLS fingerprint validation successful', {\n context: context,\n fingerprint: normalizedReceived,\n timestamp: Date.now()\n });\n\n return true;\n } catch (error) {\n this._secureLog('error', 'DTLS fingerprint validation failed', { \n error: error.message, \n context: context \n });\n throw error;\n }\n }\n\n /**\n * Compute SAS (Short Authentication String) for MITM protection\n * Uses HKDF with DTLS fingerprints to generate a stable 7-digit verification code\n * @param {ArrayBuffer|Uint8Array} keyMaterialRaw - Shared secret or key fingerprint data\n * @param {string} localFP - Local DTLS fingerprint\n * @param {string} remoteFP - Remote DTLS fingerprint\n * @returns {Promise} 7-digit SAS code\n */\n async _computeSAS(keyMaterialRaw, localFP, remoteFP) {\n try {\n console.log('_computeSAS called with parameters:', {\n keyMaterialRaw: keyMaterialRaw ? `${keyMaterialRaw.constructor.name} (${keyMaterialRaw.length || keyMaterialRaw.byteLength} bytes)` : 'null/undefined',\n localFP: localFP ? `${localFP.substring(0, 20)}...` : 'null/undefined',\n remoteFP: remoteFP ? `${remoteFP.substring(0, 20)}...` : 'null/undefined'\n });\n \n if (!keyMaterialRaw || !localFP || !remoteFP) {\n const missing = [];\n if (!keyMaterialRaw) missing.push('keyMaterialRaw');\n if (!localFP) missing.push('localFP');\n if (!remoteFP) missing.push('remoteFP');\n throw new Error(`Missing required parameters for SAS computation: ${missing.join(', ')}`);\n }\n\n const enc = new TextEncoder();\n\n const salt = enc.encode(\n 'webrtc-sas|' + [localFP, remoteFP].sort().join('|')\n );\n\n let keyBuffer;\n if (keyMaterialRaw instanceof ArrayBuffer) {\n keyBuffer = keyMaterialRaw;\n } else if (keyMaterialRaw instanceof Uint8Array) {\n keyBuffer = keyMaterialRaw.buffer;\n } else if (typeof keyMaterialRaw === 'string') {\n // \u0415\u0441\u043B\u0438 \u044D\u0442\u043E \u0441\u0442\u0440\u043E\u043A\u0430 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, keyFingerprint), \u0434\u0435\u043A\u043E\u0434\u0438\u0440\u0443\u0435\u043C \u0435\u0451\n // \u041F\u0440\u0435\u0434\u043F\u043E\u043B\u0430\u0433\u0430\u0435\u043C, \u0447\u0442\u043E \u044D\u0442\u043E hex \u0441\u0442\u0440\u043E\u043A\u0430\n const hexString = keyMaterialRaw.replace(/:/g, '').replace(/\\s/g, '');\n const bytes = new Uint8Array(hexString.length / 2);\n for (let i = 0; i < hexString.length; i += 2) {\n bytes[i / 2] = parseInt(hexString.substr(i, 2), 16);\n }\n keyBuffer = bytes.buffer;\n } else {\n throw new Error('Invalid keyMaterialRaw type');\n }\n\n // \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C HKDF(SHA-256) \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u044B\u0435 64 \u0431\u0438\u0442\u0430 \u044D\u043D\u0442\u0440\u043E\u043F\u0438\u0438 \u0434\u043B\u044F \u043A\u043E\u0434\u0430\n const key = await crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n 'HKDF',\n false,\n ['deriveBits']\n );\n\n const info = enc.encode('p2p-sas-v1');\n const bits = await crypto.subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n key,\n 64 // 64 \u0431\u0438\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0434\u043B\u044F 6\u20137 \u0437\u043D\u0430\u043A\u043E\u0432\n );\n\n const dv = new DataView(bits);\n const n = (dv.getUint32(0) ^ dv.getUint32(4)) >>> 0;\n const sasCode = String(n % 10_000_000).padStart(7, '0'); \n\n console.log('\uD83C\uDFAF _computeSAS computed code:', sasCode, '(type:', typeof sasCode, ')');\n\n this._secureLog('info', 'SAS code computed successfully', {\n localFP: localFP.substring(0, 16) + '...',\n remoteFP: remoteFP.substring(0, 16) + '...',\n sasLength: sasCode.length,\n timestamp: Date.now()\n });\n\n return sasCode;\n } catch (error) {\n this._secureLog('error', 'SAS computation failed', {\n error: error.message,\n keyMaterialType: typeof keyMaterialRaw,\n hasLocalFP: !!localFP,\n hasRemoteFP: !!remoteFP,\n timestamp: Date.now()\n });\n throw new Error(`SAS computation failed: ${error.message}`);\n }\n }\n\n /**\n * UTILITY: Decode hex keyFingerprint to Uint8Array for SAS computation\n * @param {string} hexString - Hex encoded keyFingerprint (e.g., \"aa:bb:cc:dd\")\n * @returns {Uint8Array} Decoded bytes\n */\n _decodeKeyFingerprint(hexString) {\n try {\n if (!hexString || typeof hexString !== 'string') {\n throw new Error('Invalid hex string provided');\n }\n\n // Use the utility from EnhancedSecureCryptoUtils\n return window.EnhancedSecureCryptoUtils.hexToUint8Array(hexString);\n } catch (error) {\n this._secureLog('error', 'Key fingerprint decoding failed', {\n error: error.message,\n inputType: typeof hexString,\n inputLength: hexString?.length || 0\n });\n throw new Error(`Key fingerprint decoding failed: ${error.message}`);\n }\n }\n\n /**\n * Emergency key wipe on fingerprint mismatch\n * This ensures no sensitive data remains if MITM is detected\n */\n _emergencyWipeOnFingerprintMismatch(reason = 'DTLS fingerprint mismatch') {\n try {\n this._secureLog('error', '\uD83D\uDEA8 EMERGENCY: Initiating security wipe due to fingerprint mismatch', {\n reason: reason,\n timestamp: Date.now()\n });\n\n // Wipe all cryptographic materials\n this._secureWipeKeys();\n this._secureWipeMemory(this.encryptionKey, 'emergency_wipe');\n this._secureWipeMemory(this.macKey, 'emergency_wipe');\n this._secureWipeMemory(this.metadataKey, 'emergency_wipe');\n \n // Wipe ephemeral keys for PFS\n this._wipeEphemeralKeys();\n \n // Hard wipe old keys for PFS\n this._hardWipeOldKeys();\n\n // Reset verification status\n this.isVerified = null;\n this.verificationCode = null;\n this.keyFingerprint = null;\n this.connectionId = null;\n this.expectedDTLSFingerprint = null;\n\n // Disconnect immediately\n this.disconnect();\n\n // Notify UI about security breach\n this.deliverMessageToUI('\uD83D\uDEA8 SECURITY BREACH: Connection terminated due to fingerprint mismatch. Possible MITM attack detected!', 'system');\n\n } catch (error) {\n this._secureLog('error', 'Failed to perform emergency wipe', { error: error.message });\n }\n }\n\n /**\n * Set expected DTLS fingerprint via out-of-band channel\n * This should be called after receiving the fingerprint through a secure channel\n * (e.g., QR code, voice call, in-person exchange, etc.)\n */\n setExpectedDTLSFingerprint(fingerprint, source = 'out_of_band') {\n try {\n if (!fingerprint || typeof fingerprint !== 'string') {\n throw new Error('Invalid fingerprint provided');\n }\n\n // Normalize fingerprint\n const normalizedFingerprint = fingerprint.toLowerCase().replace(/:/g, '');\n\n // Validate fingerprint format (should be hex string)\n if (!/^[a-f0-9]{40,64}$/.test(normalizedFingerprint)) {\n throw new Error('Invalid fingerprint format - must be hex string');\n }\n\n this.expectedDTLSFingerprint = normalizedFingerprint;\n\n this._secureLog('info', 'Expected DTLS fingerprint set via out-of-band channel', {\n source: source,\n fingerprint: normalizedFingerprint,\n timestamp: Date.now()\n });\n\n this.deliverMessageToUI(`\u2705 DTLS fingerprint set via ${source}. MITM protection enabled.`, 'system');\n\n } catch (error) {\n this._secureLog('error', 'Failed to set expected DTLS fingerprint', { error: error.message });\n throw error;\n }\n }\n\n /**\n * Get current DTLS fingerprint for out-of-band verification\n * This should be shared through a secure channel (QR code, voice, etc.)\n */\n getCurrentDTLSFingerprint() {\n try {\n if (!this.expectedDTLSFingerprint) {\n throw new Error('No DTLS fingerprint available - connection not established');\n }\n\n return this.expectedDTLSFingerprint;\n } catch (error) {\n this._secureLog('error', 'Failed to get current DTLS fingerprint', { error: error.message });\n throw error;\n }\n }\n\n /**\n * DEBUGGING: Temporarily disable strict DTLS validation\n * This should only be used for debugging connection issues\n */\n disableStrictDTLSValidation() {\n this.strictDTLSValidation = false;\n this._secureLog('warn', '\u26A0\uFE0F Strict DTLS validation disabled - security reduced', {\n timestamp: Date.now()\n });\n this.deliverMessageToUI('\u26A0\uFE0F DTLS validation disabled for debugging', 'system');\n }\n\n /**\n * SECURITY: Re-enable strict DTLS validation\n */\n enableStrictDTLSValidation() {\n this.strictDTLSValidation = true;\n this._secureLog('info', '\u2705 Strict DTLS validation re-enabled', {\n timestamp: Date.now()\n });\n this.deliverMessageToUI('\u2705 DTLS validation re-enabled', 'system');\n }\n\n /**\n * Generate ephemeral ECDH keys for Perfect Forward Secrecy\n * This ensures each session has unique, non-persistent keys\n */\n async _generateEphemeralECDHKeys() {\n try {\n this._secureLog('info', '\uD83D\uDD11 Generating ephemeral ECDH keys for PFS', {\n sessionStartTime: this.sessionStartTime,\n timestamp: Date.now()\n });\n\n // Generate new ephemeral ECDH key pair\n const ephemeralKeyPair = await window.EnhancedSecureCryptoUtils.generateECDHKeyPair();\n \n if (!ephemeralKeyPair || !this._validateKeyPairConstantTime(ephemeralKeyPair)) {\n throw new Error('Ephemeral ECDH key pair validation failed');\n }\n\n // Store ephemeral keys with session binding\n const sessionId = this.currentSession?.sessionId || `session_${Date.now()}`;\n this.ephemeralKeyPairs.set(sessionId, {\n keyPair: ephemeralKeyPair,\n timestamp: Date.now(),\n sessionId: sessionId\n });\n\n this._secureLog('info', '\u2705 Ephemeral ECDH keys generated for PFS', {\n sessionId: sessionId,\n timestamp: Date.now()\n });\n\n return ephemeralKeyPair;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to generate ephemeral ECDH keys', { error: error.message });\n throw new Error(`Ephemeral key generation failed: ${error.message}`);\n }\n }\n\n /**\n * Hard wipe old keys for real PFS\n * This prevents retrospective decryption attacks\n */\n _hardWipeOldKeys() {\n try {\n this._secureLog('info', '\uD83E\uDDF9 Performing hard wipe of old keys for PFS', {\n oldKeysCount: this.oldKeys.size,\n timestamp: Date.now()\n });\n\n // Hard wipe all old keys\n for (const [version, keySet] of this.oldKeys.entries()) {\n if (keySet.encryptionKey) {\n this._secureWipeMemory(keySet.encryptionKey, 'pfs_key_wipe');\n }\n if (keySet.macKey) {\n this._secureWipeMemory(keySet.macKey, 'pfs_key_wipe');\n }\n if (keySet.metadataKey) {\n this._secureWipeMemory(keySet.metadataKey, 'pfs_key_wipe');\n }\n \n // Clear references\n keySet.encryptionKey = null;\n keySet.macKey = null;\n keySet.metadataKey = null;\n keySet.keyFingerprint = null;\n }\n\n // Clear the oldKeys map completely\n this.oldKeys.clear();\n\n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n }\n\n this._secureLog('info', '\u2705 Hard wipe of old keys completed for PFS', {\n timestamp: Date.now()\n });\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to perform hard wipe of old keys', { error: error.message });\n }\n }\n\n /**\n * Wipe ephemeral keys when session ends\n * This ensures session-specific keys are destroyed\n */\n _wipeEphemeralKeys() {\n try {\n this._secureLog('info', '\uD83E\uDDF9 Wiping ephemeral keys for PFS', {\n ephemeralKeysCount: this.ephemeralKeyPairs.size,\n timestamp: Date.now()\n });\n\n // Wipe all ephemeral key pairs\n for (const [sessionId, keyData] of this.ephemeralKeyPairs.entries()) {\n if (keyData.keyPair?.privateKey) {\n this._secureWipeMemory(keyData.keyPair.privateKey, 'ephemeral_key_wipe');\n }\n if (keyData.keyPair?.publicKey) {\n this._secureWipeMemory(keyData.keyPair.publicKey, 'ephemeral_key_wipe');\n }\n \n // Clear references\n keyData.keyPair = null;\n keyData.timestamp = null;\n keyData.sessionId = null;\n }\n\n // Clear the ephemeral keys map\n this.ephemeralKeyPairs.clear();\n\n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n }\n\n this._secureLog('info', '\u2705 Ephemeral keys wiped for PFS', {\n timestamp: Date.now()\n });\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe ephemeral keys', { error: error.message });\n }\n }\n\n /**\n * Encrypt file messages with AAD\n * This ensures file messages are properly authenticated and bound to session\n */\n async _encryptFileMessage(messageData, aad) {\n try {\n if (!this.encryptionKey) {\n throw new Error('No encryption key available for file message');\n }\n\n // Convert message to string if it's an object\n const messageString = typeof messageData === 'string' ? messageData : JSON.stringify(messageData);\n \n // Encrypt with AAD using AES-GCM\n const encryptedData = await window.EnhancedSecureCryptoUtils.encryptDataWithAAD(\n messageString, \n this.encryptionKey, \n aad\n );\n \n // Create encrypted message wrapper\n const encryptedMessage = {\n type: 'encrypted_file_message',\n encryptedData: encryptedData,\n aad: aad,\n timestamp: Date.now(),\n keyFingerprint: this.keyFingerprint\n };\n \n return JSON.stringify(encryptedMessage);\n } catch (error) {\n this._secureLog('error', 'Failed to encrypt file message', { error: error.message });\n throw new Error(`File message encryption failed: ${error.message}`);\n }\n }\n\n /**\n * Decrypt file messages with AAD validation\n * This ensures file messages are properly authenticated and bound to session\n */\n async _decryptFileMessage(encryptedMessageString) {\n try {\n const encryptedMessage = JSON.parse(encryptedMessageString);\n \n if (encryptedMessage.type !== 'encrypted_file_message') {\n throw new Error('Invalid encrypted file message type');\n }\n \n // Validate key fingerprint\n if (encryptedMessage.keyFingerprint !== this.keyFingerprint) {\n throw new Error('Key fingerprint mismatch in encrypted file message');\n }\n \n // Validate AAD with sequence number\n const aad = this._validateMessageAAD(encryptedMessage.aad, 'file_message');\n \n if (!this.encryptionKey) {\n throw new Error('No encryption key available for file message decryption');\n }\n \n // Decrypt with AAD validation\n const decryptedData = await window.EnhancedSecureCryptoUtils.decryptDataWithAAD(\n encryptedMessage.encryptedData,\n this.encryptionKey,\n encryptedMessage.aad\n );\n \n return {\n decryptedData: decryptedData,\n aad: aad\n };\n } catch (error) {\n this._secureLog('error', 'Failed to decrypt file message', { error: error.message });\n throw new Error(`File message decryption failed: ${error.message}`);\n }\n }\n\n /**\n * Validates encryption keys readiness\n * @param {boolean} throwError - whether to throw on not ready\n * @returns {boolean} true if keys are ready\n */\n _validateEncryptionKeys(throwError = true) {\n const hasAllKeys = !!(this.encryptionKey && this.macKey && this.metadataKey);\n \n if (!hasAllKeys && throwError) {\n throw new Error('Encryption keys not initialized');\n }\n \n return hasAllKeys;\n }\n\n /**\n * Checks whether a message is a file-transfer message\n * @param {string|object} data - message payload\n * @returns {boolean} true if it's a file message\n */\n _isFileMessage(data) {\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return parsed.type && parsed.type.startsWith('file_');\n } catch {\n return false;\n }\n }\n \n if (typeof data === 'object' && data.type) {\n return data.type.startsWith('file_');\n }\n \n return false;\n }\n\n /**\n * Checks whether a message is a system message\n * @param {string|object} data - message payload \n * @returns {boolean} true if it's a system message\n */\n _isSystemMessage(data) {\n const systemTypes = [\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_BOTH_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.PEER_DISCONNECT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.SECURITY_UPGRADE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_SIGNAL,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_READY\n ];\n\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return systemTypes.includes(parsed.type);\n } catch {\n return false;\n }\n }\n \n if (typeof data === 'object' && data.type) {\n return systemTypes.includes(data.type);\n }\n \n return false;\n }\n\n /**\n * Checks whether a message is fake traffic\n * @param {any} data - message payload\n * @returns {boolean} true if it's a fake message\n */\n _isFakeMessage(data) {\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return parsed.type === EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE || \n parsed.isFakeTraffic === true;\n } catch {\n return false;\n }\n }\n \n if (typeof data === 'object' && data !== null) {\n return data.type === EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE || \n data.isFakeTraffic === true;\n }\n \n return false;\n }\n\n /**\n * Safely executes an operation with error handling\n * @param {Function} operation - operation to execute\n * @param {string} errorMessage - error message to log\n * @param {any} fallback - default value on error\n * @returns {any} operation result or fallback\n */\n _withErrorHandling(operation, errorMessage, fallback = null) {\n try {\n return operation();\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C ${errorMessage}:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n return fallback;\n }\n }\n\n /**\n * Safely executes an async operation with error handling\n * @param {Function} operation - async operation\n * @param {string} errorMessage - error message to log\n * @param {any} fallback - default value on error\n * @returns {Promise} operation result or fallback\n */\n async _withAsyncErrorHandling(operation, errorMessage, fallback = null) {\n try {\n return await operation();\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C ${errorMessage}:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n return fallback;\n }\n }\n\n\n /**\n * Extracts message type from data\n * @param {string|object} data - message data\n * @returns {string|null} message type or null\n */\n _getMessageType(data) {\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return parsed.type || null;\n } catch {\n return null;\n }\n }\n \n if (typeof data === 'object' && data !== null) {\n return data.type || null;\n }\n \n return null;\n }\n\n /**\n * Resets notification flags for a new connection\n */\n _resetNotificationFlags() {\n this.lastSecurityLevelNotification = null;\n this.verificationNotificationSent = false;\n this.verificationInitiationSent = false;\n this.disconnectNotificationSent = false;\n this.reconnectionFailedNotificationSent = false;\n this.peerDisconnectNotificationSent = false;\n this.connectionClosedNotificationSent = false;\n this.fakeTrafficDisabledNotificationSent = false;\n this.advancedFeaturesDisabledNotificationSent = false;\n this.securityUpgradeNotificationSent = false;\n this.lastSecurityUpgradeStage = null;\n this.securityCalculationNotificationSent = false;\n this.lastSecurityCalculationLevel = null;\n }\n\n /**\n * Checks whether a message was filtered out\n * @param {any} result - processing result\n * @returns {boolean} true if filtered\n */\n _isFilteredMessage(result) {\n const filteredResults = Object.values(EnhancedSecureWebRTCManager.FILTERED_RESULTS);\n return filteredResults.includes(result);\n }\n /**\n * Enhanced log cleanup with security checks\n */\n _cleanupLogs() {\n // More aggressive cleanup to prevent data accumulation\n if (this._logCounts.size > 500) {\n this._logCounts.clear();\n this._secureLog('debug', '\uD83E\uDDF9 Log counts cleared due to size limit');\n }\n \n // Clean up old log entries to prevent memory leaks\n const now = Date.now();\n const maxAge = 300000; // 5 minutes\n \n // Check for suspicious log patterns\n let suspiciousCount = 0;\n for (const [key, count] of this._logCounts.entries()) {\n if (count > 10) {\n suspiciousCount++;\n }\n }\n \n // Emergency cleanup if too many suspicious patterns\n if (suspiciousCount > 20) {\n this._logCounts.clear();\n this._secureLog('warn', '\uD83D\uDEA8 Emergency log cleanup due to suspicious patterns');\n }\n \n // Reset security violation counter if system is stable\n if (this._logSecurityViolations > 0 && suspiciousCount < 5) {\n this._logSecurityViolations = Math.max(0, this._logSecurityViolations - 1);\n }\n \n // Clean up old IVs periodically\n if (!this._lastIVCleanupTime || Date.now() - this._lastIVCleanupTime > 300000) { // Every 5 minutes\n this._cleanupOldIVs();\n this._lastIVCleanupTime = Date.now();\n }\n \n // Periodic secure memory cleanup\n if (!this._secureMemoryManager.memoryStats.lastCleanup || \n Date.now() - this._secureMemoryManager.memoryStats.lastCleanup > 600000) { // Every 10 minutes\n this._performPeriodicMemoryCleanup();\n this._secureMemoryManager.memoryStats.lastCleanup = Date.now();\n }\n }\n /**\n * Secure logging stats with sensitive data protection\n */\n _getLoggingStats() {\n // Only return safe statistics\n const stats = {\n isProductionMode: this._isProductionMode,\n debugMode: this._debugMode,\n currentLogLevel: this._currentLogLevel,\n logCountsSize: this._logCounts.size,\n maxLogCount: this._maxLogCount,\n securityViolations: this._logSecurityViolations || 0,\n maxSecurityViolations: this._maxLogSecurityViolations || 3,\n systemStatus: this._currentLogLevel === -1 ? 'DISABLED' : 'ACTIVE'\n };\n \n // Sanitize any potentially sensitive data\n const sanitizedStats = {};\n for (const [key, value] of Object.entries(stats)) {\n if (typeof value === 'string' && this._containsSensitiveContent(value)) {\n sanitizedStats[key] = '[SENSITIVE_DATA_REDACTED]';\n } else {\n sanitizedStats[key] = value;\n }\n }\n \n return sanitizedStats;\n }\n /**\n * Enhanced emergency logging disable with cleanup\n */\n _emergencyDisableLogging() {\n // Immediately disable all logging levels\n this._currentLogLevel = -1;\n \n // Clear all log data to prevent memory leaks\n this._logCounts.clear();\n \n // Clear any cached sensitive data\n if (this._logSecurityViolations) {\n this._logSecurityViolations = 0;\n }\n \n // Override _secureLog to a secure no-op\n this._secureLog = () => {\n // Only allow emergency console errors\n if (arguments[0] === 'error' && this._originalConsole?.error) {\n this._originalConsole.error('\uD83D\uDEA8 SECURITY: Logging system disabled - potential data exposure prevented');\n }\n };\n \n // Store original functions before overriding\n this._originalSanitizeString = this._sanitizeString;\n this._originalSanitizeLogData = this._sanitizeLogData;\n this._originalAuditLogMessage = this._auditLogMessage;\n this._originalContainsSensitiveContent = this._containsSensitiveContent;\n \n // Override all logging methods to prevent bypass\n this._sanitizeString = () => '[LOGGING_DISABLED]';\n this._sanitizeLogData = () => ({ error: 'LOGGING_DISABLED' });\n this._auditLogMessage = () => false;\n this._containsSensitiveContent = () => true; // Block everything\n \n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n try {\n window.gc();\n } catch (e) {\n // Ignore GC errors\n }\n }\n \n // Notify about the emergency shutdown\n this._originalConsole?.error?.('\uD83D\uDEA8 CRITICAL: Secure logging system disabled due to potential data exposure');\n }\n\n /**\n * Reset logging system after emergency shutdown\n * Use this function to restore normal logging functionality\n */\n _resetLoggingSystem() {\n this._secureLog('info', '\uD83D\uDD27 Resetting logging system after emergency shutdown');\n \n // Restore original sanitize functions\n this._sanitizeString = this._originalSanitizeString || ((str) => str);\n this._sanitizeLogData = this._originalSanitizeLogData || ((data) => data);\n this._auditLogMessage = this._originalAuditLogMessage || (() => true);\n this._containsSensitiveContent = this._originalContainsSensitiveContent || (() => false);\n \n // Reset security violation counters\n this._logSecurityViolations = 0;\n \n this._secureLog('info', '\u2705 Logging system reset successfully');\n }\n /**\n * Enhanced audit function for log message security\n */\n _auditLogMessage(message, data) {\n if (!data || typeof data !== 'object') return true;\n \n // Convert to string and check for sensitive content\n const dataString = JSON.stringify(data);\n \n // Check message itself for sensitive content\n if (this._containsSensitiveContent(message)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY BREACH: Sensitive content detected in log message');\n return false;\n }\n \n // Check data string for sensitive content\n if (this._containsSensitiveContent(dataString)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY BREACH: Sensitive content detected in log data');\n return false;\n }\n \n // Enhanced dangerous pattern detection\n const dangerousPatterns = [\n 'secret', 'token', 'password', 'credential', 'auth',\n 'fingerprint', 'salt', 'signature', 'private_key', 'api_key', 'private',\n 'encryption', 'mac', 'metadata', 'session', 'jwt', 'bearer',\n 'key', 'hash', 'digest', 'nonce', 'iv', 'cipher'\n ];\n \n const dataStringLower = dataString.toLowerCase();\n \n for (const pattern of dangerousPatterns) {\n if (dataStringLower.includes(pattern) && !this._safeFieldsWhitelist.has(pattern)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.(`\uD83D\uDEA8 SECURITY BREACH: Dangerous pattern detected in log: ${pattern}`);\n return false;\n }\n }\n \n // Check for high entropy values in data\n for (const [key, value] of Object.entries(data)) {\n if (typeof value === 'string' && this._hasHighEntropy(value)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.(`\uD83D\uDEA8 SECURITY BREACH: High entropy value detected in log field: ${key}`);\n return false;\n }\n }\n \n return true;\n }\n\n initializeFileTransfer() {\n try {\n this._secureLog('info', '\uD83D\uDD27 Initializing Enhanced Secure File Transfer system...');\n\n if (this.fileTransferSystem) {\n this._secureLog('info', '\u2705 File transfer system already initialized');\n return;\n }\n \n // Step-by-step readiness check\n const channelReady = !!(this.dataChannel && this.dataChannel.readyState === 'open');\n if (!channelReady) {\n this._secureLog('warn', '\u26A0\uFE0F Data channel not open, deferring file transfer initialization');\n if (this.dataChannel) {\n const initHandler = () => {\n this._secureLog('info', '\uD83D\uDD04 DataChannel opened, initializing file transfer...');\n this.initializeFileTransfer();\n };\n this.dataChannel.addEventListener('open', initHandler, { once: true });\n }\n return;\n }\n\n if (!this.isVerified) {\n this._secureLog('warn', '\u26A0\uFE0F Connection not verified yet, deferring file transfer initialization');\n setTimeout(() => this.initializeFileTransfer(), 500);\n return;\n }\n \n // FIX: Clean up previous system if present\n if (this.fileTransferSystem) {\n this._secureLog('info', '\uD83E\uDDF9 Cleaning up existing file transfer system');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n // Ensure encryption keys are present\n if (!this.encryptionKey || !this.macKey) {\n this._secureLog('warn', '\u26A0\uFE0F Encryption keys not ready, deferring file transfer initialization');\n setTimeout(() => this.initializeFileTransfer(), 1000);\n return;\n }\n \n // IMPORTANT: callback order: (onProgress, onComplete, onError, onFileReceived)\n const safeOnComplete = (summary) => {\n // Sender: finalize transfer, no Blob handling\n try {\n this._secureLog('info', '\uD83C\uDFC1 Sender transfer summary', { summary });\n // Optionally forward as progress/UI event\n if (this.onFileProgress) {\n this.onFileProgress({ type: 'complete', ...summary });\n }\n } catch (e) {\n this._secureLog('warn', '\u26A0\uFE0F onComplete handler failed:', { details: e.message });\n }\n };\n\n this.fileTransferSystem = new EnhancedSecureFileTransfer(\n this,\n this.onFileProgress || null,\n safeOnComplete,\n this.onFileError || null,\n this.onFileReceived || null\n );\n \n this._fileTransferActive = true;\n \n this._secureLog('info', '\u2705 Enhanced Secure File Transfer system initialized successfully');\n \n // Verify the system is ready\n const status = this.fileTransferSystem.getSystemStatus();\n this._secureLog('info', '\uD83D\uDD0D File transfer system status after init', { status });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to initialize file transfer system', { errorType: error.constructor.name });\n this.fileTransferSystem = null;\n this._fileTransferActive = false;\n }\n }\n\n // ============================================\n // ENHANCED SECURITY INITIALIZATION\n // ============================================\n\n async initializeEnhancedSecurity() {\n try {\n // Generate nested encryption key\n await this.generateNestedEncryptionKey();\n \n // Initialize decoy channels\n if (this.decoyChannelConfig.enabled) {\n this.initializeDecoyChannels();\n }\n \n // Start fake traffic generation\n if (this.fakeTrafficConfig.enabled) {\n this.startFakeTrafficGeneration();\n }\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to initialize enhanced security', { errorType: error.constructor.name });\n }\n }\n \n // Generate fingerprint mask for anti-fingerprinting with enhanced randomization\n generateFingerprintMask() {\n // Enhanced randomization to prevent side-channel attacks\n const cryptoRandom = crypto.getRandomValues(new Uint8Array(128));\n \n const mask = {\n timingOffset: cryptoRandom[0] % 1000 + cryptoRandom[1] % 500, // 0-1500ms\n sizeVariation: (cryptoRandom[2] % 50 + 75) / 100, // 0.75 to 1.25\n noisePattern: Array.from(crypto.getRandomValues(new Uint8Array(64))), // Increased size\n headerVariations: [\n 'X-Client-Version', 'X-Session-ID', 'X-Request-ID', 'X-Timestamp', 'X-Signature',\n 'X-Secure', 'X-Encrypted', 'X-Protected', 'X-Safe', 'X-Anonymous', 'X-Private'\n ],\n noiseIntensity: cryptoRandom[3] % 100 + 50, // 50-150%\n sizeMultiplier: (cryptoRandom[4] % 50 + 75) / 100, // 0.75-1.25\n timingVariation: cryptoRandom[5] % 1000 + 100 // 100-1100ms\n };\n return mask;\n }\n\n // Security configuration - all features enabled by default\n configureSecurityForSession(sessionType, securityLevel) {\n this._secureLog('info', `\uD83D\uDD27 Configuring security for ${sessionType} session (${securityLevel} level)`);\n \n this.currentSessionType = sessionType;\n this.currentSecurityLevel = securityLevel;\n \n // All security features are enabled by default - no payment required\n this.sessionConstraints = {};\n \n Object.keys(this.securityFeatures).forEach(feature => {\n this.sessionConstraints[feature] = true; // All features enabled\n });\n \n this.applySessionConstraints();\n \n this._secureLog('info', `\u2705 Security configured for ${sessionType} - all features enabled`, { constraints: this.sessionConstraints });\n\n if (!this._validateCryptographicSecurity()) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Cryptographic security validation failed after session configuration');\n\n if (this.onStatusChange) {\n this.onStatusChange('security_breach', {\n type: 'crypto_security_failure',\n sessionType: sessionType,\n message: 'Cryptographic security validation failed after session configuration'\n });\n }\n }\n \n this.notifySecurityLevel();\n \n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, EnhancedSecureWebRTCManager.TIMEOUTS.SECURITY_CALC_DELAY);\n }\n\n // Applying session constraints - all features enabled by default\n applySessionConstraints() {\n if (!this.sessionConstraints) return;\n\n // All features are enabled by default - no restrictions\n Object.keys(this.sessionConstraints).forEach(feature => {\n this.securityFeatures[feature] = true; // All features enabled\n \n // Enable linked configurations\n switch (feature) {\n case 'hasFakeTraffic':\n this.fakeTrafficConfig.enabled = true;\n if (this.isConnected()) {\n this.startFakeTrafficGeneration();\n }\n break;\n case 'hasDecoyChannels':\n this.decoyChannelConfig.enabled = true;\n if (this.isConnected()) {\n this.initializeDecoyChannels();\n }\n break;\n case 'hasPacketReordering':\n this.reorderingConfig.enabled = true;\n break;\n case 'hasAntiFingerprinting':\n this.antiFingerprintingConfig.enabled = true;\n break;\n case 'hasMessageChunking':\n this.chunkingConfig.enabled = true;\n break;\n }\n });\n \n this._secureLog('info', '\u2705 All security features enabled by default', {\n constraints: this.sessionConstraints,\n currentFeatures: this.securityFeatures\n });\n }\n deliverMessageToUI(message, type = 'received') {\n try {\n // Add debug logs\n this._secureLog('debug', '\uD83D\uDCE4 deliverMessageToUI called', {\n message: message,\n type: type,\n messageType: typeof message,\n hasOnMessage: !!this.onMessage\n });\n \n // Filter out file-transfer and system messages\n if (typeof message === 'object' && message.type) {\n const blockedTypes = [\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_START,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_CHUNK,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.CHUNK_CONFIRMATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_COMPLETE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_ERROR,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_BOTH_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.PEER_DISCONNECT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_SIGNAL,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_READY,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.SECURITY_UPGRADE\n ];\n if (blockedTypes.includes(message.type)) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83D\uDED1 Blocked system/file message from UI: ${message.type}`);\n }\n return; // do not show in chat\n }\n }\n\n // Additional check for string messages containing JSON\n if (typeof message === 'string' && message.trim().startsWith('{')) {\n try {\n const parsedMessage = JSON.parse(message);\n if (parsedMessage.type) {\n const blockedTypes = [\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_START,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_CHUNK,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.CHUNK_CONFIRMATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_COMPLETE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_ERROR,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_BOTH_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.PEER_DISCONNECT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_SIGNAL,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_READY,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.SECURITY_UPGRADE\n ];\n if (blockedTypes.includes(parsedMessage.type)) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83D\uDED1 Blocked system/file message from UI (string): ${parsedMessage.type}`);\n }\n return; // do not show in chat\n }\n }\n } catch (parseError) {\n // Not JSON \u2014 fine for plain text messages\n }\n }\n\n if (this.onMessage) {\n this._secureLog('debug', '\uD83D\uDCE4 Calling this.onMessage callback', { message, type });\n this.onMessage(message, type);\n } else {\n this._secureLog('warn', '\u26A0\uFE0F this.onMessage callback is null or undefined');\n }\n } catch (err) {\n this._secureLog('error', '\u274C Failed to deliver message to UI:', { errorType: err?.constructor?.name || 'Unknown' });\n }\n }\n\n\n // Security Level Notification\n notifySecurityLevel() {\n // Avoid duplicate notifications for the same security level\n if (this.lastSecurityLevelNotification === this.currentSecurityLevel) {\n return; // prevent duplication\n }\n \n this.lastSecurityLevelNotification = this.currentSecurityLevel;\n \n const levelMessages = {\n 'basic': '\uD83D\uDD12 Basic Security Active - Demo session with essential protection',\n 'enhanced': '\uD83D\uDD10 Enhanced Security Active - Paid session with advanced protection',\n 'maximum': '\uD83D\uDEE1\uFE0F Maximum Security Active - Premium session with complete protection'\n };\n\n const message = levelMessages[this.currentSecurityLevel] || levelMessages['basic'];\n \n if (this.onMessage) {\n this.deliverMessageToUI(message, 'system');\n }\n\n // Showing details of functions for paid sessions\n if (this.currentSecurityLevel !== 'basic' && this.onMessage) {\n const activeFeatures = Object.entries(this.securityFeatures)\n .filter(([key, value]) => value === true)\n .map(([key]) => key.replace('has', '').replace(/([A-Z])/g, ' $1').trim().toLowerCase())\n .slice(0, 5); \n\n this.deliverMessageToUI(`\uD83D\uDD27 Active: ${activeFeatures.join(', ')}...`, 'system');\n }\n }\n\n // Cleaning decoy channels\n cleanupDecoyChannels() {\n // Stopping decoy traffic\n for (const [channelName, timer] of this.decoyTimers.entries()) {\n clearTimeout(timer);\n }\n this.decoyTimers.clear();\n \n // Closing decoy channels\n for (const [channelName, channel] of this.decoyChannels.entries()) {\n if (channel.readyState === 'open') {\n channel.close();\n }\n }\n this.decoyChannels.clear();\n \n this._secureLog('info', '\uD83E\uDDF9 Decoy channels cleaned up');\n }\n\n // ============================================\n // 1. NESTED ENCRYPTION LAYER\n // ============================================\n\n async generateNestedEncryptionKey() {\n try {\n // Generate additional encryption key for nested encryption\n this.nestedEncryptionKey = await crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt', 'decrypt']\n );\n \n // Generate random IV for nested encryption\n // No need for base IV or counter - each encryption gets fresh random IV\n // This ensures maximum entropy and prevents IV reuse attacks\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to generate nested encryption key:', { errorType: error?.constructor?.name || 'Unknown' });\n throw error;\n }\n }\n\n async applyNestedEncryption(data) {\n if (!this.nestedEncryptionKey || !this.securityFeatures.hasNestedEncryption) {\n return data;\n }\n\n try {\n // Generate cryptographically secure IV with reuse prevention\n const uniqueIV = this._generateSecureIV(\n EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE, \n 'nestedEncryption'\n );\n \n // Encrypt data with nested layer\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: uniqueIV },\n this.nestedEncryptionKey,\n data\n );\n \n // Combine IV and encrypted data\n const result = new Uint8Array(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE + encrypted.byteLength);\n result.set(uniqueIV, 0);\n result.set(new Uint8Array(encrypted), EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE);\n \n this._secureLog('debug', '\u2705 Nested encryption applied with secure IV', {\n ivSize: uniqueIV.length,\n dataSize: data.byteLength,\n encryptedSize: encrypted.byteLength\n });\n \n return result.buffer;\n } catch (error) {\n this._secureLog('error', '\u274C Nested encryption failed:', { \n errorType: error?.constructor?.name || 'Unknown',\n errorMessage: error?.message || 'Unknown error'\n });\n \n // If IV generation failed due to emergency mode, disable nested encryption\n if (error.message.includes('emergency mode')) {\n this.securityFeatures.hasNestedEncryption = false;\n this._secureLog('warn', '\u26A0\uFE0F Nested encryption disabled due to IV emergency mode');\n }\n \n return data; // Fallback to original data\n }\n }\n\n async removeNestedEncryption(data) {\n if (!this.nestedEncryptionKey || !this.securityFeatures.hasNestedEncryption) {\n return data;\n }\n\n // Check that the data is actually encrypted with proper IV size\n if (!(data instanceof ArrayBuffer) || data.byteLength < EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE + 16) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Data not encrypted or too short for nested decryption (need IV + minimum encrypted data)');\n }\n return data;\n }\n\n try {\n const dataArray = new Uint8Array(data);\n const iv = dataArray.slice(0, EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE);\n const encryptedData = dataArray.slice(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE);\n \n // Check that there is data to decrypt\n if (encryptedData.length === 0) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD No encrypted data found');\n }\n return data;\n }\n \n // Decrypt nested layer\n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: iv },\n this.nestedEncryptionKey,\n encryptedData\n );\n \n return decrypted;\n } catch (error) {\n // FIX: Better error handling\n if (error.name === 'OperationError') {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Data not encrypted with nested encryption, skipping...');\n }\n } else {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Nested decryption failed:', { details: error.message });\n }\n }\n return data; // Fallback to original data\n }\n }\n\n // ============================================\n // 2. PACKET PADDING\n // ============================================\n\n applyPacketPadding(data) {\n if (!this.securityFeatures.hasPacketPadding) {\n return data;\n }\n\n try {\n const originalSize = data.byteLength;\n let paddingSize;\n \n if (this.paddingConfig.useRandomPadding) {\n // Generate random padding size\n paddingSize = Math.floor(Math.random() * \n (this.paddingConfig.maxPadding - this.paddingConfig.minPadding + 1)) + \n this.paddingConfig.minPadding;\n } else {\n // Use fixed padding size\n paddingSize = this.paddingConfig.minPadding;\n }\n \n // Generate random padding data\n const padding = crypto.getRandomValues(new Uint8Array(paddingSize));\n \n // Create padded message\n const paddedData = new Uint8Array(originalSize + paddingSize + 4);\n \n // Add original size (4 bytes)\n const sizeView = new DataView(paddedData.buffer, 0, 4);\n sizeView.setUint32(0, originalSize, false);\n \n // Add original data\n paddedData.set(new Uint8Array(data), 4);\n \n // Add padding\n paddedData.set(padding, 4 + originalSize);\n \n return paddedData.buffer;\n } catch (error) {\n this._secureLog('error', '\u274C Packet padding failed:', { errorType: error?.constructor?.name || 'Unknown' });\n return data; // Fallback to original data\n }\n }\n\n removePacketPadding(data) {\n if (!this.securityFeatures.hasPacketPadding) {\n return data;\n }\n\n try {\n const dataArray = new Uint8Array(data);\n \n // Check for minimum data length (4 bytes for size + minimum 1 byte of data)\n if (dataArray.length < 5) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Data too short for packet padding removal, skipping');\n }\n return data;\n }\n \n // Extract original size (first 4 bytes)\n const sizeView = new DataView(dataArray.buffer, 0, 4);\n const originalSize = sizeView.getUint32(0, false);\n \n // Checking the reasonableness of the size\n if (originalSize <= 0 || originalSize > dataArray.length - 4) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Invalid packet padding size, skipping removal');\n }\n return data;\n }\n \n // Extract original data\n const originalData = dataArray.slice(4, 4 + originalSize);\n \n return originalData.buffer;\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C Packet padding removal failed:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n return data; // Fallback to original data\n }\n }\n\n // ============================================\n // 3. FAKE TRAFFIC GENERATION\n // ============================================\n\n startFakeTrafficGeneration() {\n if (!this.fakeTrafficConfig.enabled || !this.isConnected()) {\n return;\n }\n\n // Prevent multiple fake traffic generators\n if (this.fakeTrafficTimer) {\n this._secureLog('warn', '\u26A0\uFE0F Fake traffic generation already running');\n return;\n }\n\n const sendFakeMessage = async () => {\n if (!this.isConnected()) {\n this.stopFakeTrafficGeneration();\n return;\n }\n\n try {\n const fakeMessage = this.generateFakeMessage();\n await this.sendFakeMessage(fakeMessage);\n \n // FIX: Increase intervals to reduce load\n const nextInterval = this.fakeTrafficConfig.randomDecoyIntervals ? \n Math.random() * (this.fakeTrafficConfig.maxInterval - this.fakeTrafficConfig.minInterval) + \n this.fakeTrafficConfig.minInterval :\n this.fakeTrafficConfig.minInterval;\n \n // Minimum interval 15 seconds for stability\n const safeInterval = Math.max(nextInterval, EnhancedSecureWebRTCManager.TIMEOUTS.FAKE_TRAFFIC_MIN_INTERVAL);\n \n this.fakeTrafficTimer = setTimeout(sendFakeMessage, safeInterval);\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C Fake traffic generation failed:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n this.stopFakeTrafficGeneration();\n }\n };\n\n // Start fake traffic generation with longer initial delay\n const initialDelay = Math.random() * this.fakeTrafficConfig.maxInterval + EnhancedSecureWebRTCManager.TIMEOUTS.DECOY_INITIAL_DELAY; // Add 5 seconds minimum\n this.fakeTrafficTimer = setTimeout(sendFakeMessage, initialDelay);\n }\n\n stopFakeTrafficGeneration() {\n if (this.fakeTrafficTimer) {\n clearTimeout(this.fakeTrafficTimer);\n this.fakeTrafficTimer = null;\n }\n }\n\n generateFakeMessage() {\n const pattern = this.fakeTrafficConfig.patterns[\n Math.floor(Math.random() * this.fakeTrafficConfig.patterns.length)\n ];\n \n const size = Math.floor(Math.random() * \n (this.fakeTrafficConfig.maxSize - this.fakeTrafficConfig.minSize + 1)) + \n this.fakeTrafficConfig.minSize;\n \n const fakeData = crypto.getRandomValues(new Uint8Array(size));\n \n return {\n type: EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE, \n pattern: pattern,\n data: Array.from(fakeData).map(b => b.toString(16).padStart(2, '0')).join(''),\n timestamp: Date.now(),\n size: size,\n isFakeTraffic: true, \n source: 'fake_traffic_generator',\n fakeId: crypto.getRandomValues(new Uint32Array(1))[0].toString(36) \n };\n }\n\n // ============================================\n // EMERGENCY SHUT-OFF OF ADVANCED FUNCTIONS\n // ============================================\n\n emergencyDisableAdvancedFeatures() {\n this._secureLog('error', '\uD83D\uDEA8 Emergency disabling advanced security features due to errors');\n \n // Disable problematic functions\n this.securityFeatures.hasNestedEncryption = false;\n this.securityFeatures.hasPacketReordering = false;\n this.securityFeatures.hasAntiFingerprinting = false;\n \n // Disable configurations\n this.reorderingConfig.enabled = false;\n this.antiFingerprintingConfig.enabled = false;\n \n // Clear the buffers\n this.packetBuffer.clear();\n \n // Stopping fake traffic\n this.emergencyDisableFakeTraffic();\n \n this._secureLog('info', '\u2705 Advanced features disabled, keeping basic encryption');\n \n // Check that advanced-features-disabled notification wasn't already sent\n if (!this.advancedFeaturesDisabledNotificationSent) {\n this.advancedFeaturesDisabledNotificationSent = true;\n if (this.onMessage) {\n this.deliverMessageToUI('\uD83D\uDEA8 Advanced security features temporarily disabled due to compatibility issues', 'system');\n }\n }\n }\n\n async sendFakeMessage(fakeMessage) {\n if (!this._validateConnection(false)) {\n return;\n }\n\n try {\n this._secureLog('debug', '\uD83C\uDFAD Sending fake message', {\n hasPattern: !!fakeMessage.pattern,\n sizeRange: fakeMessage.size > 100 ? 'large' : 'small'\n });\n \n const fakeData = JSON.stringify({\n ...fakeMessage,\n type: EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE, \n isFakeTraffic: true, \n timestamp: Date.now()\n });\n \n const fakeBuffer = new TextEncoder().encode(fakeData);\n const encryptedFake = await this.applySecurityLayers(fakeBuffer, true);\n this.dataChannel.send(encryptedFake);\n \n this._secureLog('debug', '\uD83C\uDFAD Fake message sent successfully', {\n pattern: fakeMessage.pattern\n });\n } catch (error) {\n this._secureLog('error', '\u274C Failed to send fake message', {\n error: error.message\n });\n }\n }\n\ncheckFakeTrafficStatus() {\n const status = {\n fakeTrafficEnabled: this.securityFeatures.hasFakeTraffic,\n fakeTrafficConfigEnabled: this.fakeTrafficConfig.enabled,\n timerActive: !!this.fakeTrafficTimer,\n patterns: this.fakeTrafficConfig.patterns,\n intervals: {\n min: this.fakeTrafficConfig.minInterval,\n max: this.fakeTrafficConfig.maxInterval\n }\n };\n \n if (this._debugMode) {\n this._secureLog('info', '\uD83C\uDFAD Fake Traffic Status', { status });\n }\n return status;\n }\nemergencyDisableFakeTraffic() {\n if (this._debugMode) {\n this._secureLog('error', '\uD83D\uDEA8 Emergency disabling fake traffic');\n }\n \n this.securityFeatures.hasFakeTraffic = false;\n this.fakeTrafficConfig.enabled = false;\n this.stopFakeTrafficGeneration();\n \n if (this._debugMode) {\n this._secureLog('info', '\u2705 Fake traffic disabled');\n }\n \n // Check that fake-traffic-disabled notification wasn't already sent\n if (!this.fakeTrafficDisabledNotificationSent) {\n this.fakeTrafficDisabledNotificationSent = true;\n if (this.onMessage) {\n this.deliverMessageToUI('\uD83D\uDEA8 Fake traffic emergency disabled', 'system');\n }\n }\n }\n async _applySecurityLayersWithoutMutex(data, isFakeMessage = false) {\n try {\n let processedData = data;\n \n if (isFakeMessage) {\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n return processedData;\n }\n \n // Nested Encryption (if enabled)\n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey && processedData instanceof ArrayBuffer) {\n processedData = await this.applyNestedEncryption(processedData);\n }\n \n // Packet Reordering (if enabled)\n if (this.securityFeatures.hasPacketReordering && this.reorderingConfig?.enabled && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketReordering(processedData);\n }\n \n // Packet Padding (if enabled)\n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketPadding(processedData);\n }\n \n // Anti-Fingerprinting (if enabled)\n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n processedData = this.applyAntiFingerprinting(processedData);\n }\n \n // Final encryption (if keys are present)\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n \n return processedData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in applySecurityLayersWithoutMutex:', { errorType: error?.constructor?.name || 'Unknown' });\n return data; // Return original data on error\n }\n}\n // ============================================\n // 4. MESSAGE CHUNKING\n // ============================================\n\n async processChunkedMessage(chunkData) {\n try {\n if (!this.chunkingConfig.addChunkHeaders) {\n // No headers, treat as regular message\n return this.processMessage(chunkData);\n }\n\n const chunkArray = new Uint8Array(chunkData);\n if (chunkArray.length < 16) {\n // Too small to be a chunk with header\n return this.processMessage(chunkData);\n }\n\n // Extract chunk header\n const headerView = new DataView(chunkArray.buffer, 0, 16);\n const messageId = headerView.getUint32(0, false);\n const chunkIndex = headerView.getUint32(4, false);\n const totalChunks = headerView.getUint32(8, false);\n const chunkSize = headerView.getUint32(12, false);\n\n // Extract chunk data\n const chunk = chunkArray.slice(16, 16 + chunkSize);\n\n // Store chunk in buffer\n if (!this.chunkQueue[messageId]) {\n this.chunkQueue[messageId] = {\n chunks: new Array(totalChunks),\n received: 0,\n timestamp: Date.now()\n };\n }\n\n const messageBuffer = this.chunkQueue[messageId];\n messageBuffer.chunks[chunkIndex] = chunk;\n messageBuffer.received++;\n\n this._secureLog('debug', `\uD83D\uDCE6 Received chunk ${chunkIndex + 1}/${totalChunks} for message ${messageId}`);\n\n // Check if all chunks received\n if (messageBuffer.received === totalChunks) {\n // Combine all chunks\n const totalSize = messageBuffer.chunks.reduce((sum, chunk) => sum + chunk.length, 0);\n const combinedData = new Uint8Array(totalSize);\n \n let offset = 0;\n for (const chunk of messageBuffer.chunks) {\n combinedData.set(chunk, offset);\n offset += chunk.length;\n }\n\n // Process complete message\n await this.processMessage(combinedData.buffer);\n \n // Clean up\n delete this.chunkQueue[messageId];\n \n this._secureLog('info', `\uD83D\uDCE6 Chunked message ${messageId} reassembled and processed`);\n }\n } catch (error) {\n this._secureLog('error', '\u274C Chunked message processing failed:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n\n // ============================================\n // 5. DECOY CHANNELS\n // ============================================\n\n initializeDecoyChannels() {\n if (!this.decoyChannelConfig.enabled || !this.peerConnection) {\n return;\n }\n\n // Prevent multiple initializations\n if (this.decoyChannels.size > 0) {\n this._secureLog('warn', '\u26A0\uFE0F Decoy channels already initialized, skipping...');\n return;\n }\n\n try {\n const numDecoyChannels = Math.min(\n this.decoyChannelConfig.maxDecoyChannels,\n this.decoyChannelConfig.decoyChannelNames.length\n );\n\n for (let i = 0; i < numDecoyChannels; i++) {\n const channelName = this.decoyChannelConfig.decoyChannelNames[i];\n const decoyChannel = this.peerConnection.createDataChannel(channelName, {\n ordered: Math.random() > 0.5,\n maxRetransmits: Math.floor(Math.random() * 3)\n });\n\n this.setupDecoyChannel(decoyChannel, channelName);\n this.decoyChannels.set(channelName, decoyChannel);\n }\n\n if (this._debugMode) {\n this._secureLog('info', `\uD83C\uDFAD Initialized ${numDecoyChannels} decoy channels`);\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C Failed to initialize decoy channels:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n }\n\n setupDecoyChannel(channel, channelName) {\n channel.onopen = () => {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Decoy channel \"${channelName}\" opened`);\n }\n this.startDecoyTraffic(channel, channelName);\n };\n\n channel.onmessage = (event) => {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Received decoy message on \"${channelName}\": ${event.data?.length || 'undefined'} bytes`);\n }\n };\n\n channel.onclose = () => {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Decoy channel \"${channelName}\" closed`);\n }\n this.stopDecoyTraffic(channelName);\n };\n\n channel.onerror = (error) => {\n if (this._debugMode) {\n this._secureLog('error', `\u274C Decoy channel \"${channelName}\" error`, { error: error.message });\n }\n };\n }\n\n startDecoyTraffic(channel, channelName) {\n const sendDecoyData = async () => {\n if (channel.readyState !== 'open') {\n return;\n }\n\n try {\n const decoyData = this.generateDecoyData(channelName);\n channel.send(decoyData);\n \n const interval = this.decoyChannelConfig.randomDecoyIntervals ?\n Math.random() * 15000 + 10000 : \n 20000; \n \n this.decoyTimers.set(channelName, setTimeout(() => sendDecoyData(), interval));\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', `\u274C Failed to send decoy data on \"${channelName}\"`, { error: error.message });\n }\n }\n };\n\n const initialDelay = Math.random() * 10000 + 5000; \n this.decoyTimers.set(channelName, setTimeout(() => sendDecoyData(), initialDelay));\n }\n\n stopDecoyTraffic(channelName) {\n const timer = this.decoyTimers.get(channelName);\n if (timer) {\n clearTimeout(timer);\n this.decoyTimers.delete(channelName);\n }\n }\n\n generateDecoyData(channelName) {\n const decoyTypes = {\n 'sync': () => JSON.stringify({\n type: 'sync',\n timestamp: Date.now(),\n sequence: Math.floor(Math.random() * 1000),\n data: Array.from(crypto.getRandomValues(new Uint8Array(32)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'status': () => JSON.stringify({\n type: 'status',\n status: ['online', 'away', 'busy'][Math.floor(Math.random() * 3)],\n uptime: Math.floor(Math.random() * 3600),\n data: Array.from(crypto.getRandomValues(new Uint8Array(16)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'heartbeat': () => JSON.stringify({\n type: 'heartbeat',\n timestamp: Date.now(),\n data: Array.from(crypto.getRandomValues(new Uint8Array(24)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'metrics': () => JSON.stringify({\n type: 'metrics',\n cpu: Math.random() * 100,\n memory: Math.random() * 100,\n network: Math.random() * 1000,\n data: Array.from(crypto.getRandomValues(new Uint8Array(20)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'debug': () => JSON.stringify({\n type: 'debug',\n level: ['info', 'warn', 'error'][Math.floor(Math.random() * 3)],\n message: 'Debug message',\n data: Array.from(crypto.getRandomValues(new Uint8Array(28)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n })\n };\n\n return decoyTypes[channelName] ? decoyTypes[channelName]() : \n Array.from(crypto.getRandomValues(new Uint8Array(64)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n }\n\n // ============================================\n // 6. PACKET REORDERING PROTECTION\n // ============================================\n\n addReorderingHeaders(data) {\n if (!this.reorderingConfig.enabled) {\n return data;\n }\n\n try {\n const dataArray = new Uint8Array(data);\n const headerSize = this.reorderingConfig.useTimestamps ? 12 : 8;\n const header = new ArrayBuffer(headerSize);\n const headerView = new DataView(header);\n\n // Add sequence number\n if (this.reorderingConfig.useSequenceNumbers) {\n headerView.setUint32(0, this.sequenceNumber++, false);\n }\n\n // Add timestamp\n if (this.reorderingConfig.useTimestamps) {\n headerView.setUint32(4, Date.now(), false);\n }\n\n // Add data size\n headerView.setUint32(this.reorderingConfig.useTimestamps ? 8 : 4, dataArray.length, false);\n\n // Combine header and data\n const result = new Uint8Array(headerSize + dataArray.length);\n result.set(new Uint8Array(header), 0);\n result.set(dataArray, headerSize);\n\n return result.buffer;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to add reordering headers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }\n\n async processReorderedPacket(data) {\n if (!this.reorderingConfig.enabled) {\n return this.processMessage(data);\n }\n\n try {\n const dataArray = new Uint8Array(data);\n const headerSize = this.reorderingConfig.useTimestamps ? 12 : 8;\n\n if (dataArray.length < headerSize) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Data too short for reordering headers, processing directly');\n }\n return this.processMessage(data);\n }\n\n const headerView = new DataView(dataArray.buffer, 0, headerSize);\n let sequence = 0;\n let timestamp = 0;\n let dataSize = 0;\n\n if (this.reorderingConfig.useSequenceNumbers) {\n sequence = headerView.getUint32(0, false);\n }\n\n if (this.reorderingConfig.useTimestamps) {\n timestamp = headerView.getUint32(4, false);\n }\n\n dataSize = headerView.getUint32(this.reorderingConfig.useTimestamps ? 8 : 4, false);\n\n if (dataSize > dataArray.length - headerSize || dataSize <= 0) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Invalid reordered packet data size, processing directly');\n }\n return this.processMessage(data);\n }\n\n const actualData = dataArray.slice(headerSize, headerSize + dataSize);\n\n try {\n const textData = new TextDecoder().decode(actualData);\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Reordered fake message: ${content.pattern || 'unknown'}`);\n }\n return; \n }\n } catch (e) {\n\n }\n\n this.packetBuffer.set(sequence, {\n data: actualData.buffer,\n timestamp: timestamp || Date.now()\n });\n\n await this.processOrderedPackets();\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to process reordered packet:', { errorType: error?.constructor?.name || 'Unknown' });\n return this.processMessage(data);\n }\n}\n\n// ============================================\n// IMPROVED PROCESSORDEREDPACKETS with filtering\n// ============================================\n\nasync processOrderedPackets() {\n const now = Date.now();\n const timeout = this.reorderingConfig.reorderTimeout;\n\n while (true) {\n const nextSequence = this.lastProcessedSequence + 1;\n const packet = this.packetBuffer.get(nextSequence);\n\n if (!packet) {\n const oldestPacket = this.findOldestPacket();\n if (oldestPacket && (now - oldestPacket.timestamp) > timeout) {\n this._secureLog('warn', '\u26A0\uFE0F Packet ${oldestPacket.sequence} timed out, processing out of order');\n \n try {\n const textData = new TextDecoder().decode(oldestPacket.data);\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Timed out fake message: ${content.pattern || 'unknown'}`);\n this.packetBuffer.delete(oldestPacket.sequence);\n this.lastProcessedSequence = oldestPacket.sequence;\n continue; \n }\n } catch (e) {\n }\n \n await this.processMessage(oldestPacket.data);\n this.packetBuffer.delete(oldestPacket.sequence);\n this.lastProcessedSequence = oldestPacket.sequence;\n } else {\n break; \n }\n } else {\n try {\n const textData = new TextDecoder().decode(packet.data);\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Ordered fake message: ${content.pattern || 'unknown'}`);\n this.packetBuffer.delete(nextSequence);\n this.lastProcessedSequence = nextSequence;\n continue; \n }\n } catch (e) {\n }\n \n await this.processMessage(packet.data);\n this.packetBuffer.delete(nextSequence);\n this.lastProcessedSequence = nextSequence;\n }\n }\n\n this.cleanupOldPackets(now, timeout);\n}\n\n\n findOldestPacket() {\n let oldest = null;\n for (const [sequence, packet] of this.packetBuffer.entries()) {\n if (!oldest || packet.timestamp < oldest.timestamp) {\n oldest = { sequence, ...packet };\n }\n }\n return oldest;\n }\n\n cleanupOldPackets(now, timeout) {\n for (const [sequence, packet] of this.packetBuffer.entries()) {\n if ((now - packet.timestamp) > timeout) {\n this._secureLog('warn', '\u26A0\uFE0F \uD83D\uDDD1\uFE0F Removing timed out packet ${sequence}');\n this.packetBuffer.delete(sequence);\n }\n }\n }\n\n // ============================================\n // 7. ANTI-FINGERPRINTING\n // ============================================\n\n applyAntiFingerprinting(data) {\n if (!this.antiFingerprintingConfig.enabled) {\n return data;\n }\n\n try {\n let processedData = data;\n\n // Add random noise\n if (this.antiFingerprintingConfig.addNoise) {\n processedData = this.addNoise(processedData);\n }\n\n // Randomize sizes\n if (this.antiFingerprintingConfig.randomizeSizes) {\n processedData = this.randomizeSize(processedData);\n }\n\n // Mask patterns\n if (this.antiFingerprintingConfig.maskPatterns) {\n processedData = this.maskPatterns(processedData);\n }\n\n // Add random headers\n if (this.antiFingerprintingConfig.useRandomHeaders) {\n processedData = this.addRandomHeaders(processedData);\n }\n\n return processedData;\n } catch (error) {\n this._secureLog('error', '\u274C Anti-fingerprinting failed:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }\n\n addNoise(data) {\n const dataArray = new Uint8Array(data);\n const noiseSize = Math.floor(Math.random() * 32) + 8; // 8-40 bytes\n const noise = crypto.getRandomValues(new Uint8Array(noiseSize));\n \n const result = new Uint8Array(dataArray.length + noiseSize);\n result.set(dataArray, 0);\n result.set(noise, dataArray.length);\n \n return result.buffer;\n }\n\n randomizeSize(data) {\n const dataArray = new Uint8Array(data);\n const variation = this.fingerprintMask.sizeVariation;\n const targetSize = Math.floor(dataArray.length * variation);\n \n if (targetSize > dataArray.length) {\n // Add padding to increase size\n const padding = crypto.getRandomValues(new Uint8Array(targetSize - dataArray.length));\n const result = new Uint8Array(targetSize);\n result.set(dataArray, 0);\n result.set(padding, dataArray.length);\n return result.buffer;\n } else if (targetSize < dataArray.length) {\n // Truncate to decrease size\n return dataArray.slice(0, targetSize).buffer;\n }\n \n return data;\n }\n\n maskPatterns(data) {\n const dataArray = new Uint8Array(data);\n const result = new Uint8Array(dataArray.length);\n \n // Apply XOR with noise pattern\n for (let i = 0; i < dataArray.length; i++) {\n const noiseByte = this.fingerprintMask.noisePattern[i % this.fingerprintMask.noisePattern.length];\n result[i] = dataArray[i] ^ noiseByte;\n }\n \n return result.buffer;\n }\n\n addRandomHeaders(data) {\n const dataArray = new Uint8Array(data);\n const headerCount = Math.floor(Math.random() * 3) + 1; // 1-3 headers\n let totalHeaderSize = 0;\n \n // Calculate total header size\n for (let i = 0; i < headerCount; i++) {\n totalHeaderSize += 4 + Math.floor(Math.random() * 16) + 4; // size + data + checksum\n }\n \n const result = new Uint8Array(totalHeaderSize + dataArray.length);\n let offset = 0;\n \n // Add random headers\n for (let i = 0; i < headerCount; i++) {\n const headerName = this.fingerprintMask.headerVariations[\n Math.floor(Math.random() * this.fingerprintMask.headerVariations.length)\n ];\n const headerData = crypto.getRandomValues(new Uint8Array(Math.floor(Math.random() * 16) + 4));\n \n // Header structure: [size:4][name:4][data:variable][checksum:4]\n const headerView = new DataView(result.buffer, offset);\n headerView.setUint32(0, headerData.length + 8, false); // Total header size\n headerView.setUint32(4, this.hashString(headerName), false); // Name hash\n \n result.set(headerData, offset + 8);\n \n // Add checksum\n const checksum = this.calculateChecksum(result.slice(offset, offset + 8 + headerData.length));\n const checksumView = new DataView(result.buffer, offset + 8 + headerData.length);\n checksumView.setUint32(0, checksum, false);\n \n offset += 8 + headerData.length + 4;\n }\n \n // Add original data\n result.set(dataArray, offset);\n \n return result.buffer;\n }\n\n hashString(str) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash;\n }\n return Math.abs(hash);\n }\n\n calculateChecksum(data) {\n let checksum = 0;\n for (let i = 0; i < data.length; i++) {\n checksum = (checksum + data[i]) & 0xFFFFFFFF;\n }\n return checksum;\n }\n\n // ============================================\n // ENHANCED MESSAGE SENDING AND RECEIVING\n // ============================================\n\n async removeSecurityLayers(data) {\n try {\n const status = this.getSecurityStatus();\n if (this._debugMode) {\n this._secureLog('debug', `\uD83D\uDD0D removeSecurityLayers (Stage ${status.stage})`, {\n dataType: typeof data,\n dataLength: data?.length || data?.byteLength || 0,\n activeFeatures: status.activeFeaturesCount\n });\n }\n\n if (!data) {\n this._secureLog('warn', '\u26A0\uFE0F Received empty data');\n return null;\n }\n\n let processedData = data;\n\n // IMPORTANT: Early check for fake messages\n if (typeof data === 'string') {\n try {\n const jsonData = JSON.parse(data);\n \n // PRIORITY ONE: Filtering out fake messages\n if (jsonData.type === 'fake') {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Fake message filtered out: ${jsonData.pattern} (size: ${jsonData.size})`);\n }\n return 'FAKE_MESSAGE_FILTERED'; \n }\n \n // System messages \u2014 do NOT return for re-processing\n if (jsonData.type && ['heartbeat', 'verification', 'verification_response', 'peer_disconnect', 'key_rotation_signal', 'key_rotation_ready', 'security_upgrade'].includes(jsonData.type)) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDD27 System message detected, blocking from chat', { type: jsonData.type });\n }\n return 'SYSTEM_MESSAGE_FILTERED';\n }\n \n // File transfer messages \u2014 do NOT return for display\n if (jsonData.type && ['file_transfer_start', 'file_transfer_response', 'file_chunk', 'chunk_confirmation', 'file_transfer_complete', 'file_transfer_error'].includes(jsonData.type)) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCC1 File transfer message detected, blocking from chat', { type: jsonData.type });\n }\n return 'FILE_MESSAGE_FILTERED';\n }\n \n // Regular text messages - extract the actual message text\n if (jsonData.type === 'message') {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, extracting text', { data: jsonData.data });\n }\n return jsonData.data; // Return the actual message text, not the JSON\n }\n \n // Enhanced messages\n if (jsonData.type === 'enhanced_message' && jsonData.data) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDD10 Enhanced message detected, decrypting...');\n }\n \n if (!this.encryptionKey || !this.macKey || !this.metadataKey) {\n this._secureLog('error', '\u274C Missing encryption keys');\n return null;\n }\n \n const decryptedResult = await window.EnhancedSecureCryptoUtils.decryptMessage(\n jsonData.data,\n this.encryptionKey,\n this.macKey,\n this.metadataKey\n );\n \n if (this._debugMode) {\n this._secureLog('debug', '\u2705 Enhanced message decrypted, extracting...');\n this._secureLog('debug', '\uD83D\uDD0D decryptedResult', {\n type: typeof decryptedResult,\n hasMessage: !!decryptedResult?.message,\n messageType: typeof decryptedResult?.message,\n messageLength: decryptedResult?.message?.length || 0,\n messageSample: decryptedResult?.message?.substring(0, 50) || 'no message'\n });\n }\n \n // CHECKING FOR FAKE MESSAGES AFTER DECRYPTION\n try {\n const decryptedContent = JSON.parse(decryptedResult.message);\n if (decryptedContent.type === 'fake' || decryptedContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Encrypted fake message: ${decryptedContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Decrypted content is not JSON, treating as plain text message');\n }\n }\n \n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCE4 Returning decrypted message', { message: decryptedResult.message?.substring(0, 50) });\n }\n return decryptedResult.message;\n }\n \n // Regular messages\n if (jsonData.type === 'message' && jsonData.data) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, extracting data');\n }\n return jsonData.data; // Return the actual message text\n }\n \n // If it's a regular message with type 'message', let it continue processing\n if (jsonData.type === 'message') {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, returning for display');\n }\n return data; // Return the original JSON string for processing\n }\n \n // If it's not a special type, return the original data for display\n if (!jsonData.type || (jsonData.type !== 'fake' && !['heartbeat', 'verification', 'verification_response', 'peer_disconnect', 'key_rotation_signal', 'key_rotation_ready', 'enhanced_message', 'security_upgrade', 'file_transfer_start', 'file_transfer_response', 'file_chunk', 'chunk_confirmation', 'file_transfer_complete', 'file_transfer_error'].includes(jsonData.type))) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, returning for display');\n }\n return data;\n }\n } catch (e) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCC4 Not JSON, processing as raw data');\n }\n // If it's not JSON, it might be a plain text message - return as-is\n return data;\n }\n }\n\n // Standard Decryption\n if (this.encryptionKey && typeof processedData === 'string' && processedData.length > 50) {\n try {\n const base64Regex = /^[A-Za-z0-9+/=]+$/;\n if (base64Regex.test(processedData.trim())) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDD13 Applying standard decryption...');\n }\n processedData = await window.EnhancedSecureCryptoUtils.decryptData(processedData, this.encryptionKey);\n if (this._debugMode) {\n this._secureLog('debug', '\u2705 Standard decryption successful');\n }\n \n // CHECKING FOR FAKE MESSAGES AFTER LEGACY DECRYPTION\n if (typeof processedData === 'string') {\n try {\n const legacyContent = JSON.parse(processedData);\n if (legacyContent.type === 'fake' || legacyContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Legacy fake message: ${legacyContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n \n }\n processedData = new TextEncoder().encode(processedData).buffer;\n }\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Standard decryption failed:', { details: error.message });\n }\n return data; \n }\n }\n\n if (this.securityFeatures.hasNestedEncryption && \n this.nestedEncryptionKey && \n processedData instanceof ArrayBuffer &&\n processedData.byteLength > 12) { \n \n try {\n processedData = await this.removeNestedEncryption(processedData);\n \n if (processedData instanceof ArrayBuffer) {\n try {\n const textData = new TextDecoder().decode(processedData);\n const nestedContent = JSON.parse(textData);\n if (nestedContent.type === 'fake' || nestedContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Nested fake message: ${nestedContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n \n }\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Nested decryption failed - skipping this layer:', { details: error.message });\n }\n }\n }\n\n if (this.securityFeatures.hasPacketReordering && \n this.reorderingConfig.enabled && \n processedData instanceof ArrayBuffer) {\n try {\n const headerSize = this.reorderingConfig.useTimestamps ? 12 : 8;\n if (processedData.byteLength > headerSize) {\n return await this.processReorderedPacket(processedData);\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Reordering processing failed - using direct processing:', { details: error.message });\n }\n }\n }\n\n // Packet Padding Removal\n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removePacketPadding(processedData);\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Padding removal failed:', { details: error.message });\n }\n }\n }\n\n // Anti-Fingerprinting Removal\n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removeAntiFingerprinting(processedData);\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Anti-fingerprinting removal failed:', { details: error.message });\n }\n }\n }\n\n // Final transformation\n if (processedData instanceof ArrayBuffer) {\n processedData = new TextDecoder().decode(processedData);\n }\n\n if (typeof processedData === 'string') {\n try {\n const finalContent = JSON.parse(processedData);\n if (finalContent.type === 'fake' || finalContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Final check fake message: ${finalContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n }\n }\n\n return processedData;\n\n } catch (error) {\n this._secureLog('error', '\u274C Critical error in removeSecurityLayers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n}\n\n removeAntiFingerprinting(data) {\n // This is a simplified version - in practice, you'd need to reverse all operations\n // For now, we'll just return the data as-is since the operations are mostly additive\n return data;\n }\n\n async applySecurityLayers(data, isFakeMessage = false) {\n try {\n let processedData = data;\n \n if (isFakeMessage) {\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n return processedData;\n }\n \n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey && processedData instanceof ArrayBuffer) {\n processedData = await this.applyNestedEncryption(processedData);\n }\n \n if (this.securityFeatures.hasPacketReordering && this.reorderingConfig?.enabled && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketReordering(processedData);\n }\n \n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketPadding(processedData);\n }\n \n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n processedData = this.applyAntiFingerprinting(processedData);\n }\n \n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n \n return processedData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in applySecurityLayers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }\n\n async sendMessage(data) {\n // Comprehensive input validation\n const validation = this._validateInputData(data, 'sendMessage');\n if (!validation.isValid) {\n const errorMessage = `Input validation failed: ${validation.errors.join(', ')}`;\n this._secureLog('error', '\u274C Input validation failed in sendMessage', {\n errors: validation.errors,\n dataType: typeof data,\n dataLength: data?.length || data?.byteLength || 0\n });\n throw new Error(errorMessage);\n }\n\n // Rate limiting check\n if (!this._checkRateLimit('sendMessage')) {\n throw new Error('Rate limit exceeded for message sending');\n }\n\n // Enforce verification gate\n this._enforceVerificationGate('sendMessage');\n\n // Connection validation\n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n throw new Error('Data channel not ready');\n }\n\n try {\n this._secureLog('debug', 'sendMessage called', {\n hasDataChannel: !!this.dataChannel,\n dataChannelReady: this.dataChannel?.readyState === 'open',\n isInitiator: this.isInitiator,\n isVerified: this.isVerified,\n connectionReady: this.peerConnection?.connectionState === 'connected'\n });\n\n this._secureLog('debug', '\uD83D\uDD0D sendMessage DEBUG', {\n dataType: typeof validation.sanitizedData,\n isString: typeof validation.sanitizedData === 'string',\n isArrayBuffer: validation.sanitizedData instanceof ArrayBuffer,\n dataLength: validation.sanitizedData?.length || validation.sanitizedData?.byteLength || 0,\n });\n\n // CRITICAL SECURITY FIX: File messages MUST be encrypted\n // No more bypassing encryption for file_* messages\n if (typeof validation.sanitizedData === 'string') {\n try {\n const parsed = JSON.parse(validation.sanitizedData);\n \n if (parsed.type && parsed.type.startsWith('file_')) {\n this._secureLog('debug', '\uD83D\uDCC1 File message detected - applying full encryption with AAD', { type: parsed.type });\n \n // Create AAD for file message\n const aad = this._createFileMessageAAD(parsed.type, parsed.data);\n \n // Encrypt file message with AAD\n const encryptedData = await this._encryptFileMessage(validation.sanitizedData, aad);\n \n this.dataChannel.send(encryptedData);\n return true;\n }\n } catch (jsonError) {\n // Not JSON \u2014 continue normal handling\n }\n }\n\n // For regular text messages, send via secure path with AAD\n if (typeof validation.sanitizedData === 'string') {\n // Verify that _createMessageAAD method is available\n if (typeof this._createMessageAAD !== 'function') {\n throw new Error('_createMessageAAD method is not available. Manager may not be fully initialized.');\n }\n \n // Create AAD with sequence number for anti-replay protection\n const aad = this._createMessageAAD('message', { content: validation.sanitizedData });\n \n return await this.sendSecureMessage({ \n type: 'message', \n data: validation.sanitizedData, \n timestamp: Date.now(),\n aad: aad // Include AAD for sequence number validation\n });\n }\n\n // For binary data, apply security layers with a limited mutex\n this._secureLog('debug', '\uD83D\uDD10 Applying security layers to non-string data');\n const securedData = await this._applySecurityLayersWithLimitedMutex(validation.sanitizedData, false);\n this.dataChannel.send(securedData);\n \n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to send message', { \n error: error.message,\n errorType: error.constructor.name\n });\n throw error;\n }\n }\n\n // FIX: New method applying security layers with limited mutex use\n async _applySecurityLayersWithLimitedMutex(data, isFakeMessage = false) {\n // Use mutex ONLY for cryptographic operations\n return this._withMutex('cryptoOperation', async (operationId) => {\n try {\n let processedData = data;\n \n if (isFakeMessage) {\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n return processedData;\n }\n \n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey && processedData instanceof ArrayBuffer) {\n processedData = await this.applyNestedEncryption(processedData);\n }\n \n if (this.securityFeatures.hasPacketReordering && this.reorderingConfig?.enabled && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketReordering(processedData);\n }\n \n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketPadding(processedData);\n }\n \n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n processedData = this.applyAntiFingerprinting(processedData);\n }\n \n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n \n return processedData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in applySecurityLayers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }, 3000); // Short timeout for crypto operations\n}\n\n async sendSystemMessage(messageData) {\n // Block system messages without verification\n // Exception: Allow verification-related system messages\n const isVerificationMessage = messageData.type === 'verification_request' || \n messageData.type === 'verification_response' ||\n messageData.type === 'verification_required';\n \n if (!isVerificationMessage) {\n this._enforceVerificationGate('sendSystemMessage', false);\n }\n \n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n this._secureLog('warn', '\u26A0\uFE0F Cannot send system message - data channel not ready');\n return false;\n }\n\n try {\n const systemMessage = JSON.stringify({\n type: messageData.type,\n data: messageData,\n timestamp: Date.now()\n });\n\n this._secureLog('debug', '\uD83D\uDD27 Sending system message', { type: messageData.type });\n this.dataChannel.send(systemMessage);\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to send system message:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n\n // FIX 1: Simplified mutex system for message processing\nasync processMessage(data) {\n try {\n this._secureLog('debug', '\uFFFD\uFFFD Processing message', {\n dataType: typeof data,\n isArrayBuffer: data instanceof ArrayBuffer,\n hasData: !!(data?.length || data?.byteLength)\n });\n \n // CRITICAL: Early check for file messages WITHOUT mutex\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n\n // ============================================\n // FILE MESSAGES \u2014 PRIORITY 1 (WITHOUT MUTEX)\n // ============================================\n \n const fileMessageTypes = [\n 'file_transfer_start',\n 'file_transfer_response',\n 'file_chunk', \n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error'\n ];\n\n // CRITICAL SECURITY FIX: Check for encrypted file messages first\n if (parsed.type === 'encrypted_file_message') {\n this._secureLog('debug', '\uD83D\uDCC1 Encrypted file message detected in processMessage');\n \n try {\n // Decrypt and validate file message\n const { decryptedData, aad } = await this._decryptFileMessage(data);\n \n // Parse decrypted data\n const decryptedParsed = JSON.parse(decryptedData);\n \n this._secureLog('debug', '\uD83D\uDCC1 File message decrypted successfully', { \n type: decryptedParsed.type,\n aadMessageType: aad.messageType \n });\n \n // Process decrypted file message\n if (this.fileTransferSystem && typeof this.fileTransferSystem.handleFileMessage === 'function') {\n await this.fileTransferSystem.handleFileMessage(decryptedParsed);\n return;\n }\n } catch (error) {\n this._secureLog('error', '\u274C Failed to decrypt file message', { error: error.message });\n return; // Drop invalid file message\n }\n }\n \n // Legacy unencrypted file messages - should not happen in secure mode\n if (parsed.type && fileMessageTypes.includes(parsed.type)) {\n this._secureLog('warn', '\u26A0\uFE0F Unencrypted file message detected - this should not happen in secure mode', { type: parsed.type });\n \n // Drop unencrypted file messages for security\n this._secureLog('error', '\u274C Dropping unencrypted file message for security', { type: parsed.type });\n return;\n }\n \n // ============================================\n // ENHANCED MESSAGES WITH AAD VALIDATION (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'enhanced_message') {\n this._secureLog('debug', '\uD83D\uDD10 Enhanced message detected in processMessage');\n \n try {\n // Decrypt enhanced message\n const decryptedData = await window.EnhancedSecureCryptoUtils.decryptMessage(\n parsed.data,\n this.encryptionKey,\n this.macKey,\n this.metadataKey\n );\n \n // Parse decrypted data\n const decryptedParsed = JSON.parse(decryptedData.data);\n \n // Validate AAD with sequence number\n if (decryptedData.metadata && decryptedData.metadata.sequenceNumber !== undefined) {\n if (!this._validateIncomingSequenceNumber(decryptedData.metadata.sequenceNumber, 'enhanced_message')) {\n this._secureLog('warn', '\u26A0\uFE0F Enhanced message sequence number validation failed - possible replay attack', {\n received: decryptedData.metadata.sequenceNumber,\n expected: this.expectedSequenceNumber\n });\n return; // Drop message with invalid sequence number\n }\n }\n \n // Process decrypted message\n if (decryptedParsed.type === 'message' && this.onMessage && decryptedParsed.data) {\n this.deliverMessageToUI(decryptedParsed.data, 'received');\n }\n \n return;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to decrypt enhanced message', { error: error.message });\n return; // Drop invalid enhanced message\n }\n }\n \n // ============================================\n // REGULAR USER MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'message') {\n this._secureLog('debug', '\uD83D\uDCDD Regular user message detected in processMessage');\n if (this.onMessage && parsed.data) {\n this.deliverMessageToUI(parsed.data, 'received');\n }\n return;\n }\n \n // ============================================\n // SYSTEM MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type && ['heartbeat', 'verification', 'verification_response', 'verification_confirmed', 'verification_both_confirmed', 'peer_disconnect', 'security_upgrade'].includes(parsed.type)) {\n this.handleSystemMessage(parsed);\n return;\n }\n \n // ============================================\n // FAKE MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'fake') {\n this._secureLog('warn', '\uD83C\uDFAD Fake message blocked in processMessage', { pattern: parsed.pattern });\n return;\n }\n \n } catch (jsonError) {\n // Not JSON \u2014 treat as text WITHOUT mutex\n if (this.onMessage) {\n this.deliverMessageToUI(data, 'received');\n }\n return;\n }\n }\n\n // ============================================\n // ENCRYPTED DATA PROCESSING (WITH MUTEX ONLY FOR CRYPTO)\n // ============================================\n \n // If here \u2014 apply security layers with limited mutex\n const originalData = await this._processEncryptedDataWithLimitedMutex(data);\n\n // Check processing result\n if (originalData === 'FAKE_MESSAGE_FILTERED' || \n originalData === 'FILE_MESSAGE_FILTERED' || \n originalData === 'SYSTEM_MESSAGE_FILTERED') {\n return;\n }\n \n if (!originalData) {\n this._secureLog('warn', '\u26A0\uFE0F No data returned from removeSecurityLayers');\n return;\n }\n\n // Handle result after removeSecurityLayers\n let messageText;\n \n if (typeof originalData === 'string') {\n try {\n const message = JSON.parse(originalData);\n \n // SECOND CHECK FOR FILE MESSAGES AFTER DECRYPTION\n if (message.type && fileMessageTypes.includes(message.type)) {\n this._secureLog('debug', '\uD83D\uDCC1 File message detected after decryption', { type: message.type });\n if (this.fileTransferSystem) {\n await this.fileTransferSystem.handleFileMessage(message);\n }\n return;\n }\n \n if (message.type && ['heartbeat', 'verification', 'verification_response', 'verification_confirmed', 'verification_both_confirmed', 'peer_disconnect', 'security_upgrade'].includes(message.type)) {\n this.handleSystemMessage(message);\n return;\n }\n \n if (message.type === 'fake') {\n this._secureLog('warn', `\uD83C\uDFAD Post-decryption fake message blocked: ${message.pattern}`);\n return;\n }\n \n // Regular messages\n if (message.type === 'message' && message.data) {\n messageText = message.data;\n } else {\n messageText = originalData;\n }\n } catch (e) {\n messageText = originalData;\n }\n } else if (originalData instanceof ArrayBuffer) {\n messageText = new TextDecoder().decode(originalData);\n } else if (originalData && typeof originalData === 'object' && originalData.message) {\n messageText = originalData.message;\n } else {\n this._secureLog('warn', '\u26A0\uFE0F Unexpected data type after processing:', { details: typeof originalData });\n return;\n }\n\n // Final check for fake and file messages\n if (messageText && messageText.trim().startsWith('{')) {\n try {\n const finalCheck = JSON.parse(messageText);\n if (finalCheck.type === 'fake') {\n this._secureLog('warn', `\uD83C\uDFAD Final fake message check blocked: ${finalCheck.pattern}`);\n return;\n }\n \n // Additional check for file and system messages\n const blockedTypes = [\n 'file_transfer_start', 'file_transfer_response', 'file_chunk', \n 'chunk_confirmation', 'file_transfer_complete', 'file_transfer_error',\n 'heartbeat', 'verification', 'verification_response', \n 'peer_disconnect', 'key_rotation_signal', 'key_rotation_ready', 'security_upgrade'\n ];\n \n if (finalCheck.type && blockedTypes.includes(finalCheck.type)) {\n this._secureLog('warn', `\uD83D\uDCC1 Final system/file message check blocked: ${finalCheck.type}`);\n return;\n }\n } catch (e) {\n // Not JSON \u2014 fine for plain text\n }\n }\n\n // Deliver message to the UI\n if (this.onMessage && messageText) {\n this._secureLog('debug', '\uD83D\uDCE4 Calling message handler with', { message: messageText.substring(0, 100) });\n this.deliverMessageToUI(messageText, 'received');\n }\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to process message:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n}\n\n // FIX: New method with limited mutex when processing encrypted data\n async _processEncryptedDataWithLimitedMutex(data) {\n // Use mutex ONLY for cryptographic operations\n return this._withMutex('cryptoOperation', async (operationId) => {\n this._secureLog('debug', '\uD83D\uDD10 Processing encrypted data with limited mutex', {\n operationId: operationId,\n dataType: typeof data\n });\n \n try {\n // Apply security layers\n const originalData = await this.removeSecurityLayers(data);\n return originalData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error processing encrypted data', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n return data; // Return original data on error\n }\n }, 2000); // Short timeout for crypto operations\n }\n\n notifySecurityUpdate() {\n try {\n this._secureLog('debug', '\uD83D\uDD12 Notifying about security level update', {\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n hasKeys: !!(this.encryptionKey && this.macKey && this.metadataKey),\n hasLastCalculation: !!this.lastSecurityCalculation\n });\n \n // Send an event about security level update\n document.dispatchEvent(new CustomEvent('security-level-updated', {\n detail: { \n timestamp: Date.now(), \n manager: 'webrtc',\n webrtcManager: this,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n hasKeys: !!(this.encryptionKey && this.macKey && this.metadataKey),\n lastCalculation: this.lastSecurityCalculation\n }\n }));\n \n // FIX: Force header refresh with correct manager\n setTimeout(() => {\n // Removed global callback - use event system instead\n // if (window.forceHeaderSecurityUpdate) {\n // window.forceHeaderSecurityUpdate(this);\n // }\n }, 100);\n \n // FIX: Direct update if there is a calculation\n if (this.lastSecurityCalculation) {\n document.dispatchEvent(new CustomEvent('real-security-calculated', {\n detail: {\n securityData: this.lastSecurityCalculation,\n webrtcManager: this,\n timestamp: Date.now()\n }\n }));\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in notifySecurityUpdate', {\n error: error.message\n });\n }\n }\n\n handleSystemMessage(message) {\n this._secureLog('debug', '\uD83D\uDD27 Handling system message:', { type: message.type });\n \n switch (message.type) {\n case 'heartbeat':\n this.handleHeartbeat();\n break;\n case 'verification':\n this.handleVerificationRequest(message.data);\n break;\n case 'verification_response':\n this.handleVerificationResponse(message.data);\n break;\n case 'sas_code':\n this.handleSASCode(message.data);\n break;\n case 'verification_confirmed':\n this.handleVerificationConfirmed(message.data);\n break;\n case 'verification_both_confirmed':\n this.handleVerificationBothConfirmed(message.data);\n break;\n case 'peer_disconnect':\n this.handlePeerDisconnectNotification(message);\n break;\n case 'key_rotation_signal':\n this._secureLog('debug', '\uD83D\uDD04 Key rotation signal received (ignored for stability)');\n break;\n case 'key_rotation_ready':\n this._secureLog('debug', '\uD83D\uDD04 Key rotation ready signal received (ignored for stability)');\n break;\n case 'security_upgrade':\n this._secureLog('debug', '\uD83D\uDD12 Security upgrade notification received:', { type: message.type });\n // Security upgrade messages are handled internally, not displayed to user\n // to prevent duplicate system messages\n break;\n default:\n this._secureLog('debug', '\uD83D\uDD27 Unknown system message type:', { type: message.type });\n }\n }\n\n // ============================================\n // FUNCTION MANAGEMENT METHODS\n // ============================================\n\n // Method to enable Stage 2 functions\n enableStage2Security() {\n if (this.sessionConstraints?.hasPacketReordering) {\n this.securityFeatures.hasPacketReordering = true;\n this.reorderingConfig.enabled = true;\n }\n \n if (this.sessionConstraints?.hasAntiFingerprinting) {\n this.securityFeatures.hasAntiFingerprinting = true;\n this.antiFingerprintingConfig.enabled = true;\n if (this.currentSecurityLevel === 'enhanced') {\n this.antiFingerprintingConfig.randomizeSizes = false;\n this.antiFingerprintingConfig.maskPatterns = false;\n this.antiFingerprintingConfig.useRandomHeaders = false;\n }\n }\n \n this.notifySecurityUpgrade(2);\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, 500);\n }\n\n // Method to enable Stage 3 features (traffic obfuscation)\n enableStage3Security() {\n if (this.currentSecurityLevel !== 'maximum') {\n this._secureLog('info', '\uD83D\uDD12 Stage 3 features only available for premium sessions');\n return;\n }\n \n if (this.sessionConstraints?.hasMessageChunking) {\n this.securityFeatures.hasMessageChunking = true;\n this.chunkingConfig.enabled = true;\n }\n \n if (this.sessionConstraints?.hasFakeTraffic) {\n this.securityFeatures.hasFakeTraffic = true;\n this.fakeTrafficConfig.enabled = true;\n this.startFakeTrafficGeneration();\n }\n \n this.notifySecurityUpgrade(3);\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, 500);\n }\n\n // Method for enabling Stage 4 functions (maximum safety)\n enableStage4Security() {\n if (this.currentSecurityLevel !== 'maximum') {\n this._secureLog('info', '\uD83D\uDD12 Stage 4 features only available for premium sessions');\n return;\n }\n \n if (this.sessionConstraints?.hasDecoyChannels && this.isConnected() && this.isVerified) {\n this.securityFeatures.hasDecoyChannels = true;\n this.decoyChannelConfig.enabled = true;\n \n try {\n this.initializeDecoyChannels();\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Decoy channels initialization failed:', { details: error.message });\n this.securityFeatures.hasDecoyChannels = false;\n this.decoyChannelConfig.enabled = false;\n }\n }\n \n // Full anti-fingerprinting for maximum sessions\n if (this.sessionConstraints?.hasAntiFingerprinting) {\n this.antiFingerprintingConfig.randomizeSizes = true;\n this.antiFingerprintingConfig.maskPatterns = true;\n this.antiFingerprintingConfig.useRandomHeaders = false; \n }\n \n this.notifySecurityUpgrade(4);\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, 500);\n }\n\n forceSecurityUpdate() {\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n this.notifySecurityUpdate();\n }, 100);\n }\n\n // Method for getting security status\n getSecurityStatus() {\n const activeFeatures = Object.entries(this.securityFeatures)\n .filter(([key, value]) => value === true)\n .map(([key]) => key);\n \n const stage = this.currentSecurityLevel === 'basic' ? 1 : \n this.currentSecurityLevel === 'enhanced' ? 2 :\n this.currentSecurityLevel === 'maximum' ? 4 : 1;\n \n return {\n stage: stage,\n sessionType: this.currentSessionType,\n securityLevel: this.currentSecurityLevel,\n activeFeatures: activeFeatures,\n totalFeatures: Object.keys(this.securityFeatures).length,\n activeFeaturesCount: activeFeatures.length,\n activeFeaturesNames: activeFeatures,\n sessionConstraints: this.sessionConstraints\n };\n }\n\n // Method to notify UI about security update\n notifySecurityUpgrade(stage) {\n const stageNames = {\n 1: 'Basic Enhanced',\n 2: 'Medium Security', \n 3: 'High Security',\n 4: 'Maximum Security'\n };\n \n const message = `\uD83D\uDD12 Security upgraded to Stage ${stage}: ${stageNames[stage]}`;\n \n // Avoid duplicate security-upgrade notifications\n if (!this.securityUpgradeNotificationSent || this.lastSecurityUpgradeStage !== stage) {\n this.securityUpgradeNotificationSent = true;\n this.lastSecurityUpgradeStage = stage;\n \n // Notify local UI via onMessage\n if (this.onMessage) {\n this.deliverMessageToUI(message, 'system');\n }\n }\n\n // Send security upgrade notification to peer via WebRTC\n if (this.dataChannel && this.dataChannel.readyState === 'open') {\n try {\n const securityNotification = {\n type: 'security_upgrade',\n stage: stage,\n stageName: stageNames[stage],\n message: message,\n timestamp: Date.now()\n };\n \n this._secureLog('debug', '\uD83D\uDD12 Sending security upgrade notification to peer:', { type: securityNotification.type, stage: securityNotification.stage });\n this.dataChannel.send(JSON.stringify(securityNotification));\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Failed to send security upgrade notification to peer:', { details: error.message });\n }\n }\n\n const status = this.getSecurityStatus();\n }\n\n async calculateAndReportSecurityLevel() {\n try {\n if (!window.EnhancedSecureCryptoUtils) {\n this._secureLog('warn', '\u26A0\uFE0F EnhancedSecureCryptoUtils not available for security calculation');\n return null;\n }\n\n if (!this.isConnected() || !this.isVerified || !this.encryptionKey || !this.macKey) {\n this._secureLog('debug', '\u26A0\uFE0F WebRTC not ready for security calculation', {\n connected: this.isConnected(),\n verified: this.isVerified,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey\n });\n return null;\n }\n\n this._secureLog('debug', '\uD83D\uDD0D Calculating real security level', {\n managerState: 'ready',\n hasAllKeys: !!(this.encryptionKey && this.macKey && this.metadataKey)\n });\n \n const securityData = await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(this);\n \n this._secureLog('info', '\uD83D\uDD10 Real security level calculated', {\n hasSecurityLevel: !!securityData.level,\n scoreRange: securityData.score > 80 ? 'high' : securityData.score > 50 ? 'medium' : 'low',\n checksRatio: `${securityData.passedChecks}/${securityData.totalChecks}`,\n isRealCalculation: securityData.isRealData\n });\n\n this.lastSecurityCalculation = securityData;\n\n document.dispatchEvent(new CustomEvent('real-security-calculated', {\n detail: {\n securityData: securityData,\n webrtcManager: this,\n timestamp: Date.now(),\n source: 'calculateAndReportSecurityLevel'\n }\n }));\n\n if (securityData.isRealData && this.onMessage) {\n if (!this.securityCalculationNotificationSent || this.lastSecurityCalculationLevel !== securityData.level) {\n this.securityCalculationNotificationSent = true;\n this.lastSecurityCalculationLevel = securityData.level;\n \n const message = `\uD83D\uDD12 Security Level: ${securityData.level} (${securityData.score}%) - ${securityData.passedChecks}/${securityData.totalChecks} checks passed`;\n this.deliverMessageToUI(message, 'system');\n }\n }\n \n return securityData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to calculate real security level', {\n errorType: error.constructor.name\n });\n return null;\n }\n }\n\n // ============================================\n // AUTOMATIC STEP-BY-STEP SWITCHING ON\n // ============================================\n\n // Method for automatic feature enablement with stability check\n async autoEnableSecurityFeatures() {\n if (this.currentSessionType === 'demo') {\n this._secureLog('info', '\uD83D\uDD12 Demo session - keeping basic security only');\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpgrade(1);\n return;\n }\n\n const checkStability = () => {\n const isStable = this.isConnected() && \n this.isVerified && \n this.connectionAttempts === 0 && \n this.messageQueue.length === 0 &&\n this.peerConnection?.connectionState === 'connected';\n return isStable;\n };\n \n this._secureLog('info', `\uD83D\uDD12 ${this.currentSessionType} session - starting graduated security activation`);\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpgrade(1);\n \n if (this.currentSecurityLevel === 'enhanced' || this.currentSecurityLevel === 'maximum') {\n setTimeout(async () => {\n if (checkStability()) {\n console.log('\u2705 Activating Stage 2 for paid session');\n this.enableStage2Security();\n await this.calculateAndReportSecurityLevel(); \n \n // For maximum sessions, turn on Stage 3 and 4\n if (this.currentSecurityLevel === 'maximum') {\n setTimeout(async () => {\n if (checkStability()) {\n console.log('\u2705 Activating Stage 3 for premium session');\n this.enableStage3Security();\n await this.calculateAndReportSecurityLevel();\n \n setTimeout(async () => {\n if (checkStability()) {\n console.log('\u2705 Activating Stage 4 for premium session');\n this.enableStage4Security();\n await this.calculateAndReportSecurityLevel();\n }\n }, 20000);\n }\n }, 15000);\n }\n }\n }, 10000);\n }\n }\n\n // ============================================\n // CONNECTION MANAGEMENT WITH ENHANCED SECURITY\n // ============================================\n\n async establishConnection() {\n try {\n // Initialize enhanced security features\n await this.initializeEnhancedSecurity();\n \n // Start fake traffic generation\n if (this.fakeTrafficConfig.enabled) {\n this.startFakeTrafficGeneration();\n }\n \n // Initialize decoy channels\n if (this.decoyChannelConfig.enabled) {\n this.initializeDecoyChannels();\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to establish enhanced connection:', { errorType: error?.constructor?.name || 'Unknown' });\n // Do not close the connection on setup errors \u2014 just log and continue\n this.onStatusChange('disconnected');\n throw error;\n }\n }\n\n disconnect() {\n try {\n console.log('\uD83D\uDD0C Disconnecting WebRTC Manager...');\n \n // Cleanup file transfer system\n if (this.fileTransferSystem) {\n console.log('\uD83E\uDDF9 Cleaning up file transfer system during disconnect...');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n // Stop fake traffic generation\n this.stopFakeTrafficGeneration();\n \n // Stop decoy traffic\n for (const [channelName, timer] of this.decoyTimers.entries()) {\n clearTimeout(timer);\n }\n this.decoyTimers.clear();\n \n // Close decoy channels\n for (const [channelName, channel] of this.decoyChannels.entries()) {\n if (channel.readyState === 'open') {\n channel.close();\n }\n }\n this.decoyChannels.clear();\n \n // Clean up packet buffer\n this.packetBuffer.clear();\n \n // Clean up chunk queue\n this.chunkQueue = [];\n \n // Wipe ephemeral keys for PFS on disconnect\n this._wipeEphemeralKeys();\n \n // Hard wipe old keys for PFS\n this._hardWipeOldKeys();\n\n // Clear verification states\n this._clearVerificationStates();\n\n } catch (error) {\n this._secureLog('error', '\u274C Error during enhanced disconnect:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n\n /**\n * Clear all verification states and data\n * Called when verification is rejected or connection is terminated\n */\n _clearVerificationStates() {\n try {\n console.log('\uD83E\uDDF9 Clearing verification states...');\n \n // Clear verification states\n this.localVerificationConfirmed = false;\n this.remoteVerificationConfirmed = false;\n this.bothVerificationsConfirmed = false;\n this.isVerified = false;\n this.verificationCode = null;\n this.pendingSASCode = null;\n \n // Clear key fingerprint and connection data\n this.keyFingerprint = null;\n this.expectedDTLSFingerprint = null;\n this.connectionId = null;\n \n // Clear processed message IDs\n this.processedMessageIds.clear();\n \n // Reset notification flags\n this.verificationNotificationSent = false;\n this.verificationInitiationSent = false;\n \n console.log('\u2705 Verification states cleared successfully');\n \n } catch (error) {\n this._secureLog('error', '\u274C Error clearing verification states:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n\n // Start periodic cleanup for rate limiting and security\n startPeriodicCleanup() {\n // Cleanup moved to unified scheduler\n this._secureLog('info', '\uD83D\uDD27 Periodic cleanup moved to unified scheduler');\n }\n\n // Calculate current security level with real verification\n async calculateSecurityLevel() {\n return await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(this);\n }\n\n // PFS: Check if key rotation is needed\n shouldRotateKeys() {\n if (!this.isConnected() || !this.isVerified) {\n return false;\n }\n \n const now = Date.now();\n const timeSinceLastRotation = now - this.lastKeyRotation;\n \n // Rotate keys every 5 minutes or after 100 messages\n return timeSinceLastRotation > this.keyRotationInterval || \n this.messageCounter % 100 === 0;\n }\n\n // PFS: Rotate encryption keys for Perfect Forward Secrecy\n async rotateKeys() {\n return this._withMutex('keyOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDD04 Starting key rotation with mutex', {\n operationId: operationId\n });\n \n // Validate state inside the critical section\n if (!this.isConnected() || !this.isVerified) {\n this._secureLog('warn', '\u26A0\uFE0F Key rotation aborted - connection not ready', {\n operationId: operationId,\n isConnected: this.isConnected(),\n isVerified: this.isVerified\n });\n return false;\n }\n \n // Ensure rotation is not already in progress\n if (this._keySystemState.isRotating) {\n this._secureLog('warn', '\u26A0\uFE0F Key rotation already in progress', {\n operationId: operationId\n });\n return false;\n }\n \n try {\n // Set rotation flag\n this._keySystemState.isRotating = true;\n this._keySystemState.lastOperation = 'rotation';\n this._keySystemState.lastOperationTime = Date.now();\n \n // Send rotation signal to peer\n const rotationSignal = {\n type: 'key_rotation_signal',\n newVersion: this.currentKeyVersion + 1,\n timestamp: Date.now(),\n operationId: operationId\n };\n \n if (this.dataChannel && this.dataChannel.readyState === 'open') {\n this.dataChannel.send(JSON.stringify(rotationSignal));\n } else {\n throw new Error('Data channel not ready for key rotation');\n }\n \n // Perform hard wipe of old keys for real PFS\n this._hardWipeOldKeys();\n \n // Wait for peer confirmation\n return new Promise((resolve) => {\n this.pendingRotation = {\n newVersion: this.currentKeyVersion + 1,\n operationId: operationId,\n resolve: resolve,\n timeout: setTimeout(() => {\n this._secureLog('error', '\u26A0\uFE0F Key rotation timeout', {\n operationId: operationId\n });\n this._keySystemState.isRotating = false;\n this.pendingRotation = null;\n resolve(false);\n }, 10000) // 10 seconds timeout\n };\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Key rotation failed in critical section', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._keySystemState.isRotating = false;\n return false;\n }\n }, 10000); // 10 seconds timeout for the entire operation\n }\n\n // Real PFS - Clean up old keys with hard wipe\n cleanupOldKeys() {\n const now = Date.now();\n const maxKeyAge = EnhancedSecureWebRTCManager.LIMITS.MAX_KEY_AGE; // 15 minutes - keys older than this are deleted\n \n let wipedKeysCount = 0;\n \n for (const [version, keySet] of this.oldKeys.entries()) {\n if (now - keySet.timestamp > maxKeyAge) {\n // Hard wipe old keys before deletion\n if (keySet.encryptionKey) {\n this._secureWipeMemory(keySet.encryptionKey, 'pfs_cleanup_wipe');\n }\n if (keySet.macKey) {\n this._secureWipeMemory(keySet.macKey, 'pfs_cleanup_wipe');\n }\n if (keySet.metadataKey) {\n this._secureWipeMemory(keySet.metadataKey, 'pfs_cleanup_wipe');\n }\n \n // Clear references\n keySet.encryptionKey = null;\n keySet.macKey = null;\n keySet.metadataKey = null;\n keySet.keyFingerprint = null;\n \n this.oldKeys.delete(version);\n wipedKeysCount++;\n \n this._secureLog('info', '\uD83E\uDDF9 Old PFS keys hard wiped and cleaned up', {\n version: version,\n age: Math.round((now - keySet.timestamp) / 1000) + 's',\n timestamp: Date.now()\n });\n }\n }\n \n if (wipedKeysCount > 0) {\n this._secureLog('info', `\u2705 PFS cleanup completed: ${wipedKeysCount} keys hard wiped`, {\n timestamp: Date.now()\n });\n }\n }\n\n // PFS: Get keys for specific version (for decryption)\n getKeysForVersion(version) {\n // First, we check the old keys (including version 0).\n const oldKeySet = this.oldKeys.get(version);\n if (oldKeySet && oldKeySet.encryptionKey && oldKeySet.macKey && oldKeySet.metadataKey) {\n return {\n encryptionKey: oldKeySet.encryptionKey,\n macKey: oldKeySet.macKey,\n metadataKey: oldKeySet.metadataKey\n };\n }\n \n // If this is the current version, return the current keys.\n if (version === this.currentKeyVersion) {\n if (this.encryptionKey && this.macKey && this.metadataKey) {\n return {\n encryptionKey: this.encryptionKey,\n macKey: this.macKey,\n metadataKey: this.metadataKey\n };\n }\n }\n \n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'No valid keys found for version', {\n requestedVersion: version,\n currentVersion: this.currentKeyVersion,\n availableVersions: Array.from(this.oldKeys.keys())\n });\n \n return null;\n }\n\n createPeerConnection() {\n const config = {\n iceServers: [\n { urls: 'stun:stun.l.google.com:19302' },\n { urls: 'stun:stun1.l.google.com:19302' },\n { urls: 'stun:stun2.l.google.com:19302' },\n { urls: 'stun:stun3.l.google.com:19302' },\n { urls: 'stun:stun4.l.google.com:19302' }\n ],\n iceCandidatePoolSize: 10,\n bundlePolicy: 'balanced'\n };\n\n this.peerConnection = new RTCPeerConnection(config);\n\n this.peerConnection.onconnectionstatechange = () => {\n const state = this.peerConnection.connectionState;\n console.log('Connection state:', state);\n \n if (state === 'connected' && !this.isVerified) {\n this.onStatusChange('verifying');\n } else if (state === 'connected' && this.isVerified) {\n this.onStatusChange('connected');\n } else if (state === 'disconnected' || state === 'closed') {\n // If this is an intentional disconnect, clear immediately.\n if (this.intentionalDisconnect) {\n this.onStatusChange('disconnected');\n setTimeout(() => this.disconnect(), 100);\n } else {\n this.onStatusChange('disconnected');\n // Clear verification states on unexpected disconnect\n this._clearVerificationStates();\n }\n } else if (state === 'failed') {\n // Do not auto-reconnect to avoid closing the session on errors\n this.onStatusChange('disconnected');\n\n } else {\n this.onStatusChange(state);\n }\n };\n\n this.peerConnection.ondatachannel = (event) => {\n console.log('\uD83D\uDD17 Data channel received:', {\n channelLabel: event.channel.label,\n channelState: event.channel.readyState,\n isInitiator: this.isInitiator,\n channelId: event.channel.id,\n protocol: event.channel.protocol\n });\n \n // CRITICAL: Store the received data channel\n if (event.channel.label === 'securechat') {\n console.log('\uD83D\uDD17 MAIN DATA CHANNEL RECEIVED (answerer side)');\n this.dataChannel = event.channel;\n this.setupDataChannel(event.channel);\n } else {\n console.log('\uD83D\uDD17 ADDITIONAL DATA CHANNEL RECEIVED:', event.channel.label);\n // Handle additional channels (heartbeat, etc.)\n if (event.channel.label === 'heartbeat') {\n this.heartbeatChannel = event.channel;\n }\n }\n };\n }\n\n setupDataChannel(channel) {\n console.log('\uD83D\uDD17 setupDataChannel called:', {\n channelLabel: channel.label,\n channelState: channel.readyState,\n isInitiator: this.isInitiator,\n isVerified: this.isVerified\n });\n\n this.dataChannel = channel;\n\n this.dataChannel.onopen = async () => {\n console.log('\uD83D\uDD17 Data channel opened:', {\n isInitiator: this.isInitiator,\n isVerified: this.isVerified,\n dataChannelState: this.dataChannel.readyState,\n dataChannelLabel: this.dataChannel.label\n });\n // Configure backpressure for large transfers\n try {\n if (this.dataChannel && typeof this.dataChannel.bufferedAmountLowThreshold === 'number') {\n // 1 MB threshold for bufferedamountlow event\n this.dataChannel.bufferedAmountLowThreshold = 1024 * 1024;\n }\n } catch (e) {\n // ignore\n }\n \n try {\n await this.establishConnection();\n\n this.initializeFileTransfer();\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in establishConnection:', { errorType: error?.constructor?.name || 'Unknown' });\n // Continue despite errors\n }\n \n // CRITICAL: Send pending SAS code if available\n if (this.pendingSASCode && this.dataChannel && this.dataChannel.readyState === 'open') {\n try {\n const sasPayload = {\n type: 'sas_code',\n data: {\n code: this.pendingSASCode,\n timestamp: Date.now(),\n verificationMethod: 'SAS',\n securityLevel: 'MITM_PROTECTION_REQUIRED'\n }\n };\n console.log('\uD83D\uDCE4 Sending pending SAS code to Answer side:', this.pendingSASCode);\n this.dataChannel.send(JSON.stringify(sasPayload));\n this.pendingSASCode = null; // Clear after sending\n } catch (error) {\n console.error('Failed to send pending SAS code to Answer side:', error);\n }\n } else if (this.pendingSASCode) {\n console.log('\u26A0\uFE0F Cannot send SAS code - dataChannel not ready:', {\n hasDataChannel: !!this.dataChannel,\n readyState: this.dataChannel?.readyState,\n pendingSASCode: this.pendingSASCode\n });\n }\n \n if (this.isVerified) {\n this.onStatusChange('connected');\n this.processMessageQueue();\n \n setTimeout(async () => {\n await this.calculateAndReportSecurityLevel();\n this.autoEnableSecurityFeatures();\n this.notifySecurityUpdate();\n }, 500);\n } else {\n this.onStatusChange('verifying');\n this.initiateVerification();\n }\n this.startHeartbeat();\n };\n\n this.dataChannel.onclose = () => {\n if (!this.intentionalDisconnect) {\n this.onStatusChange('disconnected');\n // Clear verification states on data channel close\n this._clearVerificationStates();\n \n if (!this.connectionClosedNotificationSent) {\n this.connectionClosedNotificationSent = true;\n this.deliverMessageToUI('\uD83D\uDD0C Enhanced secure connection closed. Check connection status.', 'system');\n }\n } else {\n this.onStatusChange('disconnected');\n // Clear verification states on intentional disconnect\n this._clearVerificationStates();\n \n if (!this.connectionClosedNotificationSent) {\n this.connectionClosedNotificationSent = true;\n this.deliverMessageToUI('\uD83D\uDD0C Enhanced secure connection closed', 'system');\n }\n }\n \n // Wipe ephemeral keys when session ends for PFS\n this._wipeEphemeralKeys();\n \n this.stopHeartbeat();\n this.isVerified = false;\n };\n\n // FIX 2: Remove mutex entirely from message processing path\n this.dataChannel.onmessage = async (event) => {\n try {\n console.log('\uD83D\uDCE8 Raw message received:', {\n dataType: typeof event.data,\n dataLength: event.data?.length || event.data?.byteLength || 0,\n isString: typeof event.data === 'string'\n });\n\n // IMPORTANT: Process ALL messages WITHOUT mutex\n if (typeof event.data === 'string') {\n try {\n const parsed = JSON.parse(event.data);\n console.log('\uD83D\uDCE8 Parsed message:', {\n type: parsed.type,\n hasData: !!parsed.data,\n timestamp: parsed.timestamp\n });\n \n // ============================================\n // CRITICAL: FILE MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n const fileMessageTypes = [\n 'file_transfer_start',\n 'file_transfer_response', \n 'file_chunk',\n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error'\n ];\n \n if (parsed.type && fileMessageTypes.includes(parsed.type)) {\n console.log('\uD83D\uDCC1 File message intercepted at WebRTC level:', parsed.type);\n\n if (!this.fileTransferSystem) {\n try {\n if (this.isVerified && this.dataChannel && this.dataChannel.readyState === 'open') {\n this.initializeFileTransfer();\n\n let attempts = 0;\n const maxAttempts = 30;\n while (!this.fileTransferSystem && attempts < maxAttempts) {\n await new Promise(resolve => setTimeout(resolve, 100));\n attempts++;\n }\n }\n } catch (initError) {\n this._secureLog('error', '\u274C Failed to initialize file transfer system for receiver:', { errorType: initError?.constructor?.name || 'Unknown' });\n }\n }\n\n if (this.fileTransferSystem) {\n console.log('\uD83D\uDCC1 Forwarding to local file transfer system:', parsed.type);\n await this.fileTransferSystem.handleFileMessage(parsed);\n return;\n }\n // Attempt lazy initialization on receiver side\n this._secureLog('warn', '\u26A0\uFE0F File transfer system not ready, attempting lazy init...');\n try {\n await this._ensureFileTransferReady();\n if (this.fileTransferSystem) {\n await this.fileTransferSystem.handleFileMessage(parsed);\n return;\n }\n } catch (e) {\n this._secureLog('error', '\u274C Lazy init of file transfer failed:', { errorType: e?.message || e?.constructor?.name || 'Unknown' });\n }\n this._secureLog('error', '\u274C No file transfer system available for:', { errorType: parsed.type?.constructor?.name || 'Unknown' });\n return; // IMPORTANT: Do not process further\n }\n \n // ============================================\n // SYSTEM MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type && ['heartbeat', 'verification', 'verification_response', 'verification_confirmed', 'verification_both_confirmed', 'sas_code', 'peer_disconnect', 'security_upgrade'].includes(parsed.type)) {\n console.log('\uD83D\uDD27 System message detected:', parsed.type);\n this.handleSystemMessage(parsed);\n return;\n }\n \n // ============================================\n // REGULAR USER MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'message' && parsed.data) {\n console.log('\uD83D\uDCDD User message detected:', parsed.data.substring(0, 50));\n if (this.onMessage) {\n this.deliverMessageToUI(parsed.data, 'received');\n }\n return;\n }\n \n // ============================================\n // ENHANCED MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'enhanced_message' && parsed.data) {\n console.log('\uD83D\uDD10 Enhanced message detected, processing...');\n await this._processEnhancedMessageWithoutMutex(parsed);\n return;\n }\n \n // ============================================\n // FAKE MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'fake') {\n console.log('\uD83C\uDFAD Fake message blocked:', parsed.pattern);\n return;\n }\n \n // ============================================\n // UNKNOWN MESSAGE TYPES\n // ============================================\n \n console.log('\u2753 Unknown message type:', parsed.type);\n \n } catch (jsonError) {\n // Not JSON \u2014 treat as regular text message\n console.log('\uD83D\uDCC4 Non-JSON message detected, treating as text');\n if (this.onMessage) {\n this.deliverMessageToUI(event.data, 'received');\n }\n return;\n }\n } else if (event.data instanceof ArrayBuffer) {\n // Binary data \u2014 process WITHOUT mutex\n console.log('\uD83D\uDD22 Binary data received, processing...');\n await this._processBinaryDataWithoutMutex(event.data);\n } else {\n console.log('\u2753 Unknown data type:', typeof event.data);\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to process message in onmessage:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n };\n }\n // FIX 4: New method for processing binary data WITHOUT mutex\n async _processBinaryDataWithoutMutex(data) {\n try {\n console.log('\uD83D\uDD22 Processing binary data without mutex...');\n \n // Apply security layers WITHOUT mutex\n let processedData = data;\n \n // Nested Encryption Removal (if enabled)\n if (this.securityFeatures.hasNestedEncryption && \n this.nestedEncryptionKey && \n processedData instanceof ArrayBuffer &&\n processedData.byteLength > 12) {\n \n try {\n processedData = await this.removeNestedEncryption(processedData);\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Nested decryption failed, continuing with original data');\n }\n }\n \n // Packet Padding Removal (if enabled)\n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removePacketPadding(processedData);\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Packet padding removal failed, continuing with original data');\n }\n }\n \n // Anti-Fingerprinting Removal (if enabled)\n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removeAntiFingerprinting(processedData);\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Anti-fingerprinting removal failed, continuing with original data');\n }\n }\n \n // Convert to text\n if (processedData instanceof ArrayBuffer) {\n const textData = new TextDecoder().decode(processedData);\n \n // Check for fake messages\n try {\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n console.log(`\uD83C\uDFAD BLOCKED: Binary fake message: ${content.pattern || 'unknown'}`);\n return;\n }\n } catch (e) {\n // Not JSON \u2014 fine for plain text\n }\n \n // Deliver message to user\n if (this.onMessage) {\n this.deliverMessageToUI(textData, 'received');\n }\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Error processing binary data:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n // FIX 3: New method for processing enhanced messages WITHOUT mutex\n async _processEnhancedMessageWithoutMutex(parsedMessage) {\n try {\n console.log('\uD83D\uDD10 Processing enhanced message without mutex...');\n \n if (!this.encryptionKey || !this.macKey || !this.metadataKey) {\n this._secureLog('error', '\u274C Missing encryption keys for enhanced message');\n return;\n }\n \n const decryptedResult = await window.EnhancedSecureCryptoUtils.decryptMessage(\n parsedMessage.data,\n this.encryptionKey,\n this.macKey,\n this.metadataKey\n );\n \n if (decryptedResult && decryptedResult.message) {\n console.log('\u2705 Enhanced message decrypted successfully');\n \n // Try parsing JSON and showing nested text if it's a chat message\n try {\n const decryptedContent = JSON.parse(decryptedResult.message);\n if (decryptedContent.type === 'fake' || decryptedContent.isFakeTraffic === true) {\n console.log(`\uFFFD\uFFFD BLOCKED: Encrypted fake message: ${decryptedContent.pattern || 'unknown'}`);\n return;\n }\n if (decryptedContent && decryptedContent.type === 'message' && typeof decryptedContent.data === 'string') {\n if (this.onMessage) {\n this.deliverMessageToUI(decryptedContent.data, 'received');\n }\n return;\n }\n } catch (e) {\n // Not JSON \u2014 fine for plain text\n }\n \n // Otherwise pass as-is\n if (this.onMessage) {\n this.deliverMessageToUI(decryptedResult.message, 'received');\n }\n } else {\n this._secureLog('warn', '\u26A0\uFE0F No message content in decrypted result');\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Error processing enhanced message:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n /**\n * Creates a unique ID for an operation\n */\n _generateOperationId() {\n return `op_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n }\n\n /**\n * Atomic mutex acquisition with enhanced race condition protection\n */\n async _acquireMutex(mutexName, operationId, timeout = 5000) {\n // Build correct mutex property name\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Unknown mutex: ${mutexName}`, {\n mutexPropertyName: mutexPropertyName,\n availableMutexes: this._getAvailableMutexes(),\n operationId: operationId\n });\n throw new Error(`Unknown mutex: ${mutexName}. Available: ${this._getAvailableMutexes().join(', ')}`);\n }\n \n // Validate operation ID\n if (!operationId || typeof operationId !== 'string') {\n throw new Error('Invalid operation ID for mutex acquisition');\n }\n \n return new Promise((resolve, reject) => {\n // Atomic lock attempt with immediate state check\n const attemptLock = () => {\n // Check if mutex is already locked by this operation\n if (mutex.lockId === operationId) {\n this._secureLog('warn', `\u26A0\uFE0F Mutex '${mutexName}' already locked by same operation`, {\n operationId: operationId\n });\n resolve();\n return;\n }\n \n // Atomic check and lock operation\n if (!mutex.locked) {\n // Set lock state atomically\n mutex.locked = true;\n mutex.lockId = operationId;\n mutex.lockTime = Date.now();\n \n this._secureLog('debug', `\uD83D\uDD12 Mutex '${mutexName}' acquired atomically`, {\n operationId: operationId,\n lockTime: mutex.lockTime\n });\n \n // Set timeout for automatic release with enhanced validation\n mutex.lockTimeout = setTimeout(() => {\n // Enhanced timeout handling with state validation\n this._handleMutexTimeout(mutexName, operationId, timeout);\n }, timeout);\n \n resolve();\n } else {\n // Add to queue with timeout\n const queueItem = { \n resolve, \n reject, \n operationId,\n timestamp: Date.now(),\n timeout: setTimeout(() => {\n // Remove from queue on timeout\n const index = mutex.queue.findIndex(item => item.operationId === operationId);\n if (index !== -1) {\n mutex.queue.splice(index, 1);\n reject(new Error(`Mutex acquisition timeout for '${mutexName}'`));\n }\n }, timeout)\n };\n \n mutex.queue.push(queueItem);\n \n this._secureLog('debug', `\u23F3 Operation queued for mutex '${mutexName}'`, {\n operationId: operationId,\n queueLength: mutex.queue.length,\n currentLockId: mutex.lockId\n });\n }\n };\n \n // Execute lock attempt immediately\n attemptLock();\n });\n }\n\n /**\n * Enhanced mutex release with strict validation and error handling\n */\n _releaseMutex(mutexName, operationId) {\n // Validate input parameters\n if (!mutexName || typeof mutexName !== 'string') {\n throw new Error('Invalid mutex name provided for release');\n }\n \n if (!operationId || typeof operationId !== 'string') {\n throw new Error('Invalid operation ID provided for mutex release');\n }\n \n // Build correct mutex property name\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Unknown mutex for release: ${mutexName}`, {\n mutexPropertyName: mutexPropertyName,\n availableMutexes: this._getAvailableMutexes(),\n operationId: operationId\n });\n throw new Error(`Unknown mutex for release: ${mutexName}`);\n }\n \n // Strict validation of lock ownership\n if (mutex.lockId !== operationId) {\n this._secureLog('error', `\u274C CRITICAL: Invalid mutex release attempt - potential race condition`, {\n mutexName: mutexName,\n expectedLockId: mutex.lockId,\n providedOperationId: operationId,\n mutexState: {\n locked: mutex.locked,\n lockTime: mutex.lockTime,\n queueLength: mutex.queue.length\n }\n });\n \n // Throw error instead of silent failure\n throw new Error(`Invalid mutex release attempt for '${mutexName}': expected '${mutex.lockId}', got '${operationId}'`);\n }\n \n // Validate mutex is actually locked\n if (!mutex.locked) {\n this._secureLog('error', `\u274C CRITICAL: Attempting to release unlocked mutex`, {\n mutexName: mutexName,\n operationId: operationId,\n mutexState: {\n locked: mutex.locked,\n lockId: mutex.lockId,\n lockTime: mutex.lockTime\n }\n });\n throw new Error(`Attempting to release unlocked mutex: ${mutexName}`);\n }\n \n try {\n // Clear timeout first\n if (mutex.lockTimeout) {\n clearTimeout(mutex.lockTimeout);\n mutex.lockTimeout = null;\n }\n \n // Calculate lock duration for monitoring\n const lockDuration = mutex.lockTime ? Date.now() - mutex.lockTime : 0;\n \n // Atomic release with state validation\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTime = null;\n \n this._secureLog('debug', `\uD83D\uDD13 Mutex released successfully: ${mutexName}`, {\n operationId: operationId,\n lockDuration: lockDuration,\n queueLength: mutex.queue.length\n });\n \n // Process next in queue with enhanced error handling\n this._processNextInQueue(mutexName);\n \n } catch (error) {\n // If queue processing fails, ensure mutex is still released\n this._secureLog('error', `\u274C Error during mutex release queue processing`, {\n mutexName: mutexName,\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Ensure mutex is released even if queue processing fails\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTime = null;\n mutex.lockTimeout = null;\n \n throw error;\n }\n }\n\n /**\n * Enhanced queue processing with comprehensive error handling\n */\n _processNextInQueue(mutexName) {\n const mutex = this[`_${mutexName}Mutex`];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Mutex not found for queue processing: ${mutexName}`);\n return;\n }\n \n if (mutex.queue.length === 0) {\n return;\n }\n \n // Validate mutex state before processing queue\n if (mutex.locked) {\n this._secureLog('warn', `\u26A0\uFE0F Mutex '${mutexName}' is still locked, skipping queue processing`, {\n lockId: mutex.lockId,\n queueLength: mutex.queue.length\n });\n return;\n }\n \n // Get next item from queue atomically with validation\n const nextItem = mutex.queue.shift();\n \n if (!nextItem) {\n this._secureLog('warn', `\u26A0\uFE0F Empty queue item for mutex '${mutexName}'`);\n return;\n }\n \n // Validate queue item structure\n if (!nextItem.operationId || !nextItem.resolve || !nextItem.reject) {\n this._secureLog('error', `\u274C Invalid queue item structure for mutex '${mutexName}'`, {\n hasOperationId: !!nextItem.operationId,\n hasResolve: !!nextItem.resolve,\n hasReject: !!nextItem.reject\n });\n return;\n }\n \n try {\n // Clear timeout for this item\n if (nextItem.timeout) {\n clearTimeout(nextItem.timeout);\n }\n \n // Attempt to acquire lock for next item\n this._secureLog('debug', `\uD83D\uDD04 Processing next operation in queue for mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n queueRemaining: mutex.queue.length,\n timestamp: Date.now()\n });\n \n // Retry lock acquisition for queued operation with enhanced error handling\n setTimeout(async () => {\n try {\n await this._acquireMutex(mutexName, nextItem.operationId, 5000);\n \n this._secureLog('debug', `\u2705 Queued operation acquired mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n acquisitionTime: Date.now()\n });\n \n nextItem.resolve();\n \n } catch (error) {\n this._secureLog('error', `\u274C Queued operation failed to acquire mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n errorType: error.constructor.name,\n errorMessage: error.message,\n timestamp: Date.now()\n });\n \n // Reject with detailed error information\n nextItem.reject(new Error(`Queue processing failed for '${mutexName}': ${error.message}`));\n \n // Continue processing queue even if one item fails\n setTimeout(() => {\n this._processNextInQueue(mutexName);\n }, 50);\n }\n }, 10); // Small delay to prevent immediate re-acquisition\n \n } catch (error) {\n this._secureLog('error', `\u274C Critical error during queue processing for mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Reject the operation and continue processing\n try {\n nextItem.reject(new Error(`Queue processing critical error: ${error.message}`));\n } catch (rejectError) {\n this._secureLog('error', `\u274C Failed to reject queue item`, {\n originalError: error.message,\n rejectError: rejectError.message\n });\n }\n \n // Continue processing remaining queue items\n setTimeout(() => {\n this._processNextInQueue(mutexName);\n }, 100);\n }\n }\n\n _getAvailableMutexes() {\n const mutexes = [];\n const propertyNames = Object.getOwnPropertyNames(this);\n \n for (const prop of propertyNames) {\n if (prop.endsWith('Mutex') && prop.startsWith('_')) {\n // Extract mutex name without prefix/suffix\n const mutexName = prop.slice(1, -5); // Remove '_' prefix and 'Mutex' suffix\n mutexes.push(mutexName);\n }\n }\n \n return mutexes;\n }\n\n /**\n * Enhanced mutex execution with atomic operations\n */\n async _withMutex(mutexName, operation, timeout = 5000) {\n const operationId = this._generateOperationId();\n \n // Validate mutex system before operation\n if (!this._validateMutexSystem()) {\n this._secureLog('error', '\u274C Mutex system not properly initialized', {\n operationId: operationId,\n mutexName: mutexName\n });\n throw new Error('Mutex system not properly initialized. Call _initializeMutexSystem() first.');\n }\n \n // Get mutex reference with validation\n const mutex = this[`_${mutexName}Mutex`];\n if (!mutex) {\n throw new Error(`Mutex '${mutexName}' not found`);\n }\n \n let mutexAcquired = false;\n \n try {\n // Atomic mutex acquisition with timeout\n await this._acquireMutex(mutexName, operationId, timeout);\n mutexAcquired = true;\n \n // Increment operation counter atomically\n const counterKey = `${mutexName}Operations`;\n if (this._operationCounters && this._operationCounters[counterKey] !== undefined) {\n this._operationCounters[counterKey]++;\n }\n \n // Execute operation with enhanced error handling\n const result = await operation(operationId);\n \n // Validate result before returning\n if (result === undefined && operation.name !== 'cleanup') {\n this._secureLog('warn', '\u26A0\uFE0F Mutex operation returned undefined result', {\n operationId: operationId,\n mutexName: mutexName,\n operationName: operation.name\n });\n }\n \n return result;\n \n } catch (error) {\n // Enhanced error logging with context\n this._secureLog('error', '\u274C Error in mutex operation', {\n operationId: operationId,\n mutexName: mutexName,\n errorType: error.constructor.name,\n errorMessage: error.message,\n mutexAcquired: mutexAcquired,\n mutexState: mutex ? {\n locked: mutex.locked,\n lockId: mutex.lockId,\n queueLength: mutex.queue.length\n } : 'null'\n });\n \n // If this is a key operation error, trigger emergency recovery\n if (mutexName === 'keyOperation') {\n this._handleKeyOperationError(error, operationId);\n }\n \n // Trigger emergency unlock for critical mutex errors\n if (error.message.includes('timeout') || error.message.includes('race condition')) {\n this._emergencyUnlockAllMutexes('errorHandler');\n }\n \n throw error;\n } finally {\n // Always release mutex in finally block with validation\n if (mutexAcquired) {\n try {\n await this._releaseMutex(mutexName, operationId);\n \n // Verify mutex was properly released\n if (mutex.locked && mutex.lockId === operationId) {\n this._secureLog('error', '\u274C Mutex release verification failed', {\n operationId: operationId,\n mutexName: mutexName\n });\n // Force release as fallback\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n }\n \n } catch (releaseError) {\n this._secureLog('error', '\u274C Error releasing mutex in finally block', {\n operationId: operationId,\n mutexName: mutexName,\n releaseErrorType: releaseError.constructor.name,\n releaseErrorMessage: releaseError.message\n });\n \n // Force release on error\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n }\n }\n }\n }\n\n _validateMutexSystem() {\n const requiredMutexes = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n \n for (const mutexName of requiredMutexes) {\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (!mutex || typeof mutex !== 'object') {\n this._secureLog('error', `\u274C Missing or invalid mutex: ${mutexName}`, {\n mutexPropertyName: mutexPropertyName,\n mutexType: typeof mutex\n });\n return false;\n }\n \n // Validate mutex structure\n const requiredProps = ['locked', 'queue', 'lockId', 'lockTimeout'];\n for (const prop of requiredProps) {\n if (!(prop in mutex)) {\n this._secureLog('error', `\u274C Mutex ${mutexName} missing property: ${prop}`);\n return false;\n }\n }\n }\n \n return true;\n }\n\n /**\n * Enhanced emergency recovery of the mutex system\n */\n _emergencyRecoverMutexSystem() {\n this._secureLog('warn', '\uD83D\uDEA8 Emergency mutex system recovery initiated');\n \n try {\n // Emergency unlock all mutexes first\n this._emergencyUnlockAllMutexes('emergencyRecovery');\n \n // Force re-initialize the system\n this._initializeMutexSystem();\n \n // Validate recovery success\n if (!this._validateMutexSystem()) {\n throw new Error('Mutex system validation failed after recovery');\n }\n \n this._secureLog('info', '\u2705 Mutex system recovered successfully with validation');\n return true;\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to recover mutex system', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Last resort - force re-initialization\n try {\n this._initializeMutexSystem();\n this._secureLog('warn', '\u26A0\uFE0F Forced mutex system re-initialization completed');\n return true;\n } catch (reinitError) {\n this._secureLog('error', '\u274C CRITICAL: Forced re-initialization also failed', {\n originalError: error.message,\n reinitError: reinitError.message\n });\n return false;\n }\n }\n }\n\n /**\n * Atomic key generation with race condition protection\n */\n async _generateEncryptionKeys() {\n return this._withMutex('keyOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDD11 Generating encryption keys with atomic mutex', {\n operationId: operationId\n });\n \n // Atomic state check and update using mutex lock\n const currentState = this._keySystemState;\n \n // Atomic check - if already initializing, wait or fail\n if (currentState.isInitializing) {\n this._secureLog('warn', '\u26A0\uFE0F Key generation already in progress, waiting for completion', {\n operationId: operationId,\n lastOperation: currentState.lastOperation,\n lastOperationTime: currentState.lastOperationTime\n });\n \n // Wait for existing operation to complete\n let waitAttempts = 0;\n const maxWaitAttempts = 50; // 5 seconds max wait\n \n while (currentState.isInitializing && waitAttempts < maxWaitAttempts) {\n await new Promise(resolve => setTimeout(resolve, 100));\n waitAttempts++;\n }\n \n if (currentState.isInitializing) {\n throw new Error('Key generation timeout - operation still in progress after 5 seconds');\n }\n }\n \n // Atomic state update within mutex protection\n try {\n // Set state atomically within mutex\n currentState.isInitializing = true;\n currentState.lastOperation = 'generation';\n currentState.lastOperationTime = Date.now();\n currentState.operationId = operationId;\n \n this._secureLog('debug', '\uD83D\uDD12 Atomic key generation state set', {\n operationId: operationId,\n timestamp: currentState.lastOperationTime\n });\n \n // Generate keys with individual error handling\n let ecdhKeyPair = null;\n let ecdsaKeyPair = null;\n \n // Generate ephemeral ECDH keys for PFS\n try {\n ecdhKeyPair = await this._generateEphemeralECDHKeys();\n \n // Validate ECDH keys immediately\n if (!ecdhKeyPair || !ecdhKeyPair.privateKey || !ecdhKeyPair.publicKey) {\n throw new Error('Ephemeral ECDH key pair validation failed');\n }\n \n // Constant-time validation for key types\n if (!this._validateKeyPairConstantTime(ecdhKeyPair)) {\n throw new Error('Ephemeral ECDH keys are not valid CryptoKey instances');\n }\n \n this._secureLog('debug', '\u2705 Ephemeral ECDH keys generated and validated for PFS', {\n operationId: operationId,\n privateKeyType: ecdhKeyPair.privateKey.algorithm?.name,\n publicKeyType: ecdhKeyPair.publicKey.algorithm?.name,\n isEphemeral: true\n });\n \n } catch (ecdhError) {\n this._secureLog('error', '\u274C Ephemeral ECDH key generation failed', {\n operationId: operationId,\n errorType: ecdhError.constructor.name\n });\n this._throwSecureError(ecdhError, 'ephemeral_ecdh_key_generation');\n }\n \n // Generate ECDSA keys with retry mechanism\n try {\n ecdsaKeyPair = await window.EnhancedSecureCryptoUtils.generateECDSAKeyPair();\n \n // Validate ECDSA keys immediately\n if (!ecdsaKeyPair || !ecdsaKeyPair.privateKey || !ecdsaKeyPair.publicKey) {\n throw new Error('ECDSA key pair validation failed');\n }\n \n // Constant-time validation for key types\n if (!this._validateKeyPairConstantTime(ecdsaKeyPair)) {\n throw new Error('ECDSA keys are not valid CryptoKey instances');\n }\n \n this._secureLog('debug', '\u2705 ECDSA keys generated and validated', {\n operationId: operationId,\n privateKeyType: ecdsaKeyPair.privateKey.algorithm?.name,\n publicKeyType: ecdsaKeyPair.publicKey.algorithm?.name\n });\n \n } catch (ecdsaError) {\n this._secureLog('error', '\u274C ECDSA key generation failed', {\n operationId: operationId,\n errorType: ecdsaError.constructor.name\n });\n this._throwSecureError(ecdsaError, 'ecdsa_key_generation');\n }\n \n // Final validation of both key pairs\n if (!ecdhKeyPair || !ecdsaKeyPair) {\n throw new Error('One or both key pairs failed to generate');\n }\n \n // Enable security features after successful key generation\n this._enableSecurityFeaturesAfterKeyGeneration(ecdhKeyPair, ecdsaKeyPair);\n \n this._secureLog('info', '\u2705 Encryption keys generated successfully with atomic protection', {\n operationId: operationId,\n hasECDHKeys: !!(ecdhKeyPair?.privateKey && ecdhKeyPair?.publicKey),\n hasECDSAKeys: !!(ecdsaKeyPair?.privateKey && ecdsaKeyPair?.publicKey),\n generationTime: Date.now() - currentState.lastOperationTime\n });\n \n return { ecdhKeyPair, ecdsaKeyPair };\n \n } catch (error) {\n // Ensure state is reset on any error\n this._secureLog('error', '\u274C Key generation failed, resetting state', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n throw error;\n } finally {\n // Always reset state in finally block\n currentState.isInitializing = false;\n currentState.operationId = null;\n \n this._secureLog('debug', '\uD83D\uDD13 Key generation state reset', {\n operationId: operationId\n });\n }\n });\n }\n\n /**\n * Enable security features after successful key generation\n */\n _enableSecurityFeaturesAfterKeyGeneration(ecdhKeyPair, ecdsaKeyPair) {\n try {\n // Enable encryption features based on available keys\n if (ecdhKeyPair && ecdhKeyPair.privateKey && ecdhKeyPair.publicKey) {\n this.securityFeatures.hasEncryption = true;\n this.securityFeatures.hasECDH = true;\n this._secureLog('info', '\uD83D\uDD12 ECDH encryption features enabled');\n }\n \n if (ecdsaKeyPair && ecdsaKeyPair.privateKey && ecdsaKeyPair.publicKey) {\n this.securityFeatures.hasECDSA = true;\n this._secureLog('info', '\uD83D\uDD12 ECDSA signature features enabled');\n }\n \n // Enable additional features that depend on encryption\n if (this.securityFeatures.hasEncryption) {\n this.securityFeatures.hasMetadataProtection = true;\n this.securityFeatures.hasEnhancedReplayProtection = true;\n this.securityFeatures.hasNonExtractableKeys = true;\n this._secureLog('info', '\uD83D\uDD12 Additional encryption-dependent features enabled');\n }\n \n // Enable PFS after ephemeral key generation\n if (ecdhKeyPair && this.ephemeralKeyPairs.size > 0) {\n this.securityFeatures.hasPFS = true;\n this._secureLog('info', '\uD83D\uDD12 Perfect Forward Secrecy enabled with ephemeral keys');\n }\n \n this._secureLog('info', '\uD83D\uDD12 Security features updated after key generation', {\n hasEncryption: this.securityFeatures.hasEncryption,\n hasECDH: this.securityFeatures.hasECDH,\n hasECDSA: this.securityFeatures.hasECDSA,\n hasMetadataProtection: this.securityFeatures.hasMetadataProtection,\n hasEnhancedReplayProtection: this.securityFeatures.hasEnhancedReplayProtection,\n hasNonExtractableKeys: this.securityFeatures.hasNonExtractableKeys,\n hasPFS: this.securityFeatures.hasPFS\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to enable security features after key generation', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n\n /**\n * Enhanced emergency mutex unlocking with authorization and validation\n */\n _emergencyUnlockAllMutexes(callerContext = 'unknown') {\n // Validate caller authorization\n const authorizedCallers = [\n 'keyOperation', 'cryptoOperation', 'connectionOperation',\n 'emergencyRecovery', 'systemShutdown', 'errorHandler'\n ];\n \n if (!authorizedCallers.includes(callerContext)) {\n this._secureLog('error', `\uD83D\uDEA8 UNAUTHORIZED emergency mutex unlock attempt`, {\n callerContext: callerContext,\n authorizedCallers: authorizedCallers,\n timestamp: Date.now()\n });\n throw new Error(`Unauthorized emergency mutex unlock attempt by: ${callerContext}`);\n }\n \n const mutexes = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n \n this._secureLog('error', '\uD83D\uDEA8 EMERGENCY: Unlocking all mutexes with authorization and state cleanup', {\n callerContext: callerContext,\n timestamp: Date.now()\n });\n \n let unlockedCount = 0;\n let errorCount = 0;\n \n mutexes.forEach(mutexName => {\n const mutex = this[`_${mutexName}Mutex`];\n if (mutex) {\n try {\n // Clear timeout first\n if (mutex.lockTimeout) {\n clearTimeout(mutex.lockTimeout);\n }\n \n // Log mutex state before emergency unlock\n const previousState = {\n locked: mutex.locked,\n lockId: mutex.lockId,\n lockTime: mutex.lockTime,\n queueLength: mutex.queue.length\n };\n \n // Reset mutex state atomically\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n mutex.lockTime = null;\n \n // Clear queue with proper error handling and logging\n let queueRejectCount = 0;\n mutex.queue.forEach(item => {\n try {\n if (item.reject && typeof item.reject === 'function') {\n item.reject(new Error(`Emergency mutex unlock for ${mutexName} by ${callerContext}`));\n queueRejectCount++;\n }\n } catch (rejectError) {\n this._secureLog('warn', `\u26A0\uFE0F Failed to reject queue item during emergency unlock`, {\n mutexName: mutexName,\n errorType: rejectError.constructor.name\n });\n }\n });\n \n // Clear queue array\n mutex.queue = [];\n \n unlockedCount++;\n \n this._secureLog('debug', `\uD83D\uDD13 Emergency unlocked mutex: ${mutexName}`, {\n previousState: previousState,\n queueRejectCount: queueRejectCount,\n callerContext: callerContext\n });\n \n } catch (error) {\n errorCount++;\n this._secureLog('error', `\u274C Error during emergency unlock of mutex: ${mutexName}`, {\n errorType: error.constructor.name,\n errorMessage: error.message,\n callerContext: callerContext\n });\n }\n }\n });\n \n // Reset key system state with validation\n if (this._keySystemState) {\n try {\n const previousKeyState = { ...this._keySystemState };\n \n this._keySystemState.isInitializing = false;\n this._keySystemState.isRotating = false;\n this._keySystemState.isDestroying = false;\n this._keySystemState.operationId = null;\n this._keySystemState.concurrentOperations = 0;\n \n this._secureLog('debug', `\uD83D\uDD13 Emergency reset key system state`, {\n previousState: previousKeyState,\n callerContext: callerContext\n });\n \n } catch (error) {\n this._secureLog('error', `\u274C Error resetting key system state during emergency unlock`, {\n errorType: error.constructor.name,\n errorMessage: error.message,\n callerContext: callerContext\n });\n }\n }\n \n // Log emergency unlock summary\n this._secureLog('info', `\uD83D\uDEA8 Emergency mutex unlock completed`, {\n callerContext: callerContext,\n unlockedCount: unlockedCount,\n errorCount: errorCount,\n totalMutexes: mutexes.length,\n timestamp: Date.now()\n });\n \n // Trigger system validation after emergency unlock\n setTimeout(() => {\n this._validateMutexSystemAfterEmergencyUnlock();\n }, 100);\n }\n\n /**\n * Handle key operation errors with recovery mechanisms\n */\n _handleKeyOperationError(error, operationId) {\n this._secureLog('error', '\uD83D\uDEA8 Key operation error detected, initiating recovery', {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Reset key system state immediately\n if (this._keySystemState) {\n this._keySystemState.isInitializing = false;\n this._keySystemState.isRotating = false;\n this._keySystemState.isDestroying = false;\n this._keySystemState.operationId = null;\n }\n \n // Clear any partial key data\n this.ecdhKeyPair = null;\n this.ecdsaKeyPair = null;\n this.encryptionKey = null;\n this.macKey = null;\n this.metadataKey = null;\n \n // Trigger emergency recovery if needed\n if (error.message.includes('timeout') || error.message.includes('race condition')) {\n this._secureLog('warn', '\u26A0\uFE0F Race condition or timeout detected, triggering emergency recovery');\n this._emergencyRecoverMutexSystem();\n }\n }\n\n /**\n * Generate cryptographically secure IV with reuse prevention\n */\n _generateSecureIV(ivSize = 12, context = 'general') {\n // Check if we're in emergency mode\n if (this._ivTrackingSystem.emergencyMode) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: IV generation blocked - emergency mode active due to IV reuse');\n throw new Error('IV generation blocked - emergency mode active');\n }\n \n let attempts = 0;\n const maxAttempts = 100; // Prevent infinite loops\n \n while (attempts < maxAttempts) {\n attempts++;\n \n // Generate fresh IV with crypto.getRandomValues\n const iv = crypto.getRandomValues(new Uint8Array(ivSize));\n \n // Convert IV to string for tracking\n const ivString = Array.from(iv).map(b => b.toString(16).padStart(2, '0')).join('');\n \n // Check for IV reuse\n if (this._ivTrackingSystem.usedIVs.has(ivString)) {\n this._ivTrackingSystem.collisionCount++;\n this._secureLog('error', `\uD83D\uDEA8 CRITICAL: IV reuse detected!`, {\n context: context,\n attempt: attempts,\n collisionCount: this._ivTrackingSystem.collisionCount,\n ivString: ivString.substring(0, 16) + '...' // Log partial IV for debugging\n });\n \n // If too many collisions, trigger emergency mode\n if (this._ivTrackingSystem.collisionCount > 5) {\n this._ivTrackingSystem.emergencyMode = true;\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Emergency mode activated due to excessive IV reuse');\n throw new Error('Emergency mode: Excessive IV reuse detected');\n }\n \n continue; // Try again\n }\n \n // Validate IV entropy\n if (!this._validateIVEntropy(iv)) {\n this._ivTrackingSystem.entropyValidation.entropyFailures++;\n this._secureLog('warn', `\u26A0\uFE0F Low entropy IV detected`, {\n context: context,\n attempt: attempts,\n entropyFailures: this._ivTrackingSystem.entropyValidation.entropyFailures\n });\n \n // If too many entropy failures, trigger emergency mode\n if (this._ivTrackingSystem.entropyValidation.entropyFailures > 10) {\n this._ivTrackingSystem.emergencyMode = true;\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Emergency mode activated due to low entropy IVs');\n throw new Error('Emergency mode: Low entropy IVs detected');\n }\n \n continue; // Try again\n }\n \n // Track IV usage\n this._ivTrackingSystem.usedIVs.add(ivString);\n this._ivTrackingSystem.ivHistory.set(ivString, {\n timestamp: Date.now(),\n context: context,\n attempt: attempts\n });\n \n // Track per-session IVs\n if (this.sessionId) {\n if (!this._ivTrackingSystem.sessionIVs.has(this.sessionId)) {\n this._ivTrackingSystem.sessionIVs.set(this.sessionId, new Set());\n }\n this._ivTrackingSystem.sessionIVs.get(this.sessionId).add(ivString);\n }\n \n // Validate RNG periodically\n this._validateRNGQuality();\n \n this._secureLog('debug', `\u2705 Secure IV generated`, {\n context: context,\n attempt: attempts,\n ivSize: ivSize,\n totalIVs: this._ivTrackingSystem.usedIVs.size\n });\n \n return iv;\n }\n \n // If we can't generate a unique IV after max attempts\n this._secureLog('error', `\u274C Failed to generate unique IV after ${maxAttempts} attempts`, {\n context: context,\n totalIVs: this._ivTrackingSystem.usedIVs.size\n });\n throw new Error(`Failed to generate unique IV after ${maxAttempts} attempts`);\n }\n \n /**\n * Validate IV entropy to detect weak RNG\n */\n _validateIVEntropy(iv) {\n this._ivTrackingSystem.entropyValidation.entropyTests++;\n \n // Calculate byte distribution\n const byteCounts = new Array(256).fill(0);\n for (let i = 0; i < iv.length; i++) {\n byteCounts[iv[i]]++;\n }\n \n // Multi-dimensional entropy analysis\n const entropyResults = {\n shannon: 0,\n min: 0,\n collision: 0,\n compression: 0,\n quantum: 0\n };\n \n // 1. Shannon entropy calculation\n let shannonEntropy = 0;\n const totalBytes = iv.length;\n \n for (let i = 0; i < 256; i++) {\n if (byteCounts[i] > 0) {\n const probability = byteCounts[i] / totalBytes;\n shannonEntropy -= probability * Math.log2(probability);\n }\n }\n entropyResults.shannon = shannonEntropy;\n \n // 2. Min-entropy calculation (worst-case scenario)\n const maxCount = Math.max(...byteCounts);\n const maxProbability = maxCount / totalBytes;\n entropyResults.min = -Math.log2(maxProbability);\n \n // 3. Collision entropy calculation\n let collisionSum = 0;\n for (let i = 0; i < 256; i++) {\n if (byteCounts[i] > 0) {\n const probability = byteCounts[i] / totalBytes;\n collisionSum += probability * probability;\n }\n }\n entropyResults.collision = -Math.log2(collisionSum);\n \n // 4. Compression-based entropy estimation\n const ivString = Array.from(iv).map(b => String.fromCharCode(b)).join('');\n const compressedLength = this._estimateCompressedLength(ivString);\n entropyResults.compression = (1 - compressedLength / totalBytes) * 8;\n \n // 5. Quantum-resistant entropy analysis\n entropyResults.quantum = this._calculateQuantumResistantEntropy(iv);\n \n // Enhanced suspicious pattern detection\n const hasSuspiciousPatterns = this._detectAdvancedSuspiciousPatterns(iv);\n \n // Multi-criteria validation\n const minEntropyThreshold = this._ivTrackingSystem.entropyValidation.minEntropy;\n const isValid = (\n entropyResults.shannon >= minEntropyThreshold &&\n entropyResults.min >= minEntropyThreshold * 0.8 &&\n entropyResults.collision >= minEntropyThreshold * 0.9 &&\n entropyResults.compression >= minEntropyThreshold * 0.7 &&\n entropyResults.quantum >= minEntropyThreshold * 0.6 &&\n !hasSuspiciousPatterns\n );\n \n if (!isValid) {\n this._secureLog('warn', `\u26A0\uFE0F Enhanced IV entropy validation failed`, {\n shannon: entropyResults.shannon.toFixed(2),\n min: entropyResults.min.toFixed(2),\n collision: entropyResults.collision.toFixed(2),\n compression: entropyResults.compression.toFixed(2),\n quantum: entropyResults.quantum.toFixed(2),\n minThreshold: minEntropyThreshold,\n hasSuspiciousPatterns: hasSuspiciousPatterns\n });\n }\n \n return isValid;\n }\n \n /**\n * Estimate compressed length for entropy calculation\n * @param {string} data - Data to estimate compression\n * @returns {number} Estimated compressed length\n */\n _estimateCompressedLength(data) {\n // Simple LZ77-like compression estimation\n let compressedLength = 0;\n let i = 0;\n \n while (i < data.length) {\n let matchLength = 0;\n let matchDistance = 0;\n \n // Look for repeated patterns\n for (let j = Math.max(0, i - 255); j < i; j++) {\n let k = 0;\n while (i + k < data.length && data[i + k] === data[j + k] && k < 255) {\n k++;\n }\n if (k > matchLength) {\n matchLength = k;\n matchDistance = i - j;\n }\n }\n \n if (matchLength >= 3) {\n compressedLength += 3; // Distance + length + literal\n i += matchLength;\n } else {\n compressedLength += 1;\n i += 1;\n }\n }\n \n return compressedLength;\n }\n\n /**\n * Calculate quantum-resistant entropy\n * @param {Uint8Array} data - Data to analyze\n * @returns {number} Quantum-resistant entropy score\n */\n _calculateQuantumResistantEntropy(data) {\n // Quantum-resistant entropy analysis\n let quantumScore = 0;\n \n // 1. Check for quantum-vulnerable patterns\n const hasQuantumVulnerablePatterns = this._detectQuantumVulnerablePatterns(data);\n if (hasQuantumVulnerablePatterns) {\n quantumScore -= 2;\n }\n \n // 2. Analyze bit distribution\n const bitDistribution = this._analyzeBitDistribution(data);\n quantumScore += bitDistribution.score;\n \n // 3. Check for periodicity\n const periodicity = this._detectPeriodicity(data);\n quantumScore -= periodicity * 0.5;\n \n // 4. Normalize to 0-8 range\n return Math.max(0, Math.min(8, quantumScore));\n }\n\n /**\n * Detect quantum-vulnerable patterns\n * @param {Uint8Array} data - Data to analyze\n * @returns {boolean} true if quantum-vulnerable patterns found\n */\n _detectQuantumVulnerablePatterns(data) {\n // Check for patterns vulnerable to quantum attacks\n const patterns = [\n [0, 0, 0, 0, 0, 0, 0, 0], // All zeros\n [255, 255, 255, 255, 255, 255, 255, 255], // All ones\n [0, 1, 0, 1, 0, 1, 0, 1], // Alternating\n [1, 0, 1, 0, 1, 0, 1, 0] // Alternating reverse\n ];\n \n for (const pattern of patterns) {\n for (let i = 0; i <= data.length - pattern.length; i++) {\n let match = true;\n for (let j = 0; j < pattern.length; j++) {\n if (data[i + j] !== pattern[j]) {\n match = false;\n break;\n }\n }\n if (match) return true;\n }\n }\n \n return false;\n }\n\n /**\n * Analyze bit distribution\n * @param {Uint8Array} data - Data to analyze\n * @returns {Object} Bit distribution analysis\n */\n _analyzeBitDistribution(data) {\n let ones = 0;\n let totalBits = data.length * 8;\n \n for (const byte of data) {\n ones += (byte >>> 0).toString(2).split('1').length - 1;\n }\n \n const zeroRatio = (totalBits - ones) / totalBits;\n const oneRatio = ones / totalBits;\n \n // Ideal distribution is 50/50\n const deviation = Math.abs(0.5 - oneRatio);\n const score = Math.max(0, 8 - deviation * 16);\n \n return { score, zeroRatio, oneRatio, deviation };\n }\n\n /**\n * Detect periodicity in data\n * @param {Uint8Array} data - Data to analyze\n * @returns {number} Periodicity score (0-1)\n */\n _detectPeriodicity(data) {\n if (data.length < 16) return 0;\n \n let maxPeriodicity = 0;\n \n // Check for periods from 2 to data.length/2\n for (let period = 2; period <= data.length / 2; period++) {\n let matches = 0;\n let totalChecks = 0;\n \n for (let i = 0; i < data.length - period; i++) {\n if (data[i] === data[i + period]) {\n matches++;\n }\n totalChecks++;\n }\n \n if (totalChecks > 0) {\n const periodicity = matches / totalChecks;\n maxPeriodicity = Math.max(maxPeriodicity, periodicity);\n }\n }\n \n return maxPeriodicity;\n }\n\n /**\n * Enhanced suspicious pattern detection\n * @param {Uint8Array} iv - IV to check\n * @returns {boolean} true if suspicious patterns found\n */\n _detectAdvancedSuspiciousPatterns(iv) {\n // Enhanced pattern detection with quantum-resistant analysis\n const patterns = [\n // Sequential patterns\n [0, 1, 2, 3, 4, 5, 6, 7],\n [255, 254, 253, 252, 251, 250, 249, 248],\n \n // Repeated patterns\n [0, 0, 0, 0, 0, 0, 0, 0],\n [255, 255, 255, 255, 255, 255, 255, 255],\n \n // Alternating patterns\n [0, 255, 0, 255, 0, 255, 0, 255],\n [255, 0, 255, 0, 255, 0, 255, 0]\n ];\n \n for (const pattern of patterns) {\n for (let i = 0; i <= iv.length - pattern.length; i++) {\n let match = true;\n for (let j = 0; j < pattern.length; j++) {\n if (iv[i + j] !== pattern[j]) {\n match = false;\n break;\n }\n }\n if (match) return true;\n }\n }\n \n // Check for low entropy regions\n const entropyMap = this._calculateLocalEntropy(iv);\n const lowEntropyRegions = entropyMap.filter(e => e < 3.0).length;\n \n return lowEntropyRegions > iv.length * 0.3; // More than 30% low entropy\n }\n\n /**\n * Calculate local entropy for pattern detection\n * @param {Uint8Array} data - Data to analyze\n * @returns {Array} Array of local entropy values\n */\n _calculateLocalEntropy(data) {\n const windowSize = 8;\n const entropyMap = [];\n \n for (let i = 0; i <= data.length - windowSize; i++) {\n const window = data.slice(i, i + windowSize);\n const charCount = {};\n \n for (const byte of window) {\n charCount[byte] = (charCount[byte] || 0) + 1;\n }\n \n let entropy = 0;\n for (const count of Object.values(charCount)) {\n const probability = count / windowSize;\n entropy -= probability * Math.log2(probability);\n }\n \n entropyMap.push(entropy);\n }\n \n return entropyMap;\n }\n\n /**\n * Detect suspicious patterns in IVs\n */\n _detectSuspiciousIVPatterns(iv) {\n // Check for all zeros or all ones\n const allZeros = iv.every(byte => byte === 0);\n const allOnes = iv.every(byte => byte === 255);\n \n if (allZeros || allOnes) {\n return true;\n }\n \n // Check for sequential patterns\n let sequentialCount = 0;\n for (let i = 1; i < iv.length; i++) {\n if (iv[i] === iv[i-1] + 1 || iv[i] === iv[i-1] - 1) {\n sequentialCount++;\n } else {\n sequentialCount = 0;\n }\n \n if (sequentialCount >= 3) {\n return true; // Suspicious sequential pattern\n }\n }\n \n // Check for repeated patterns\n for (let patternLength = 2; patternLength <= Math.floor(iv.length / 2); patternLength++) {\n for (let start = 0; start <= iv.length - patternLength * 2; start++) {\n const pattern1 = iv.slice(start, start + patternLength);\n const pattern2 = iv.slice(start + patternLength, start + patternLength * 2);\n \n if (pattern1.every((byte, index) => byte === pattern2[index])) {\n return true; // Repeated pattern detected\n }\n }\n }\n \n return false;\n }\n \n /**\n * Clean up old IVs with strict limits\n */\n _cleanupOldIVs() {\n const now = Date.now();\n const maxAge = 1800000; // Reduced to 30 minutes for better security\n let cleanedCount = 0;\n const cleanupBatch = [];\n \n // Aggressive cleanup with quantum-resistant patterns\n // Enforce maximum IV history size with batch processing\n if (this._ivTrackingSystem.ivHistory.size > this._ivTrackingSystem.maxIVHistorySize) {\n const ivArray = Array.from(this._ivTrackingSystem.ivHistory.entries());\n const toRemove = ivArray.slice(0, ivArray.length - this._ivTrackingSystem.maxIVHistorySize);\n \n for (const [ivString] of toRemove) {\n cleanupBatch.push(ivString);\n cleanedCount++;\n \n // Process in batches to prevent memory spikes\n if (cleanupBatch.length >= 100) {\n this._processCleanupBatch(cleanupBatch);\n cleanupBatch.length = 0;\n }\n }\n }\n \n // Clean up old IVs from history by age with enhanced security\n for (const [ivString, metadata] of this._ivTrackingSystem.ivHistory.entries()) {\n if (now - metadata.timestamp > maxAge) {\n cleanupBatch.push(ivString);\n cleanedCount++;\n \n // Process in batches to prevent memory spikes\n if (cleanupBatch.length >= 100) {\n this._processCleanupBatch(cleanupBatch);\n cleanupBatch.length = 0;\n }\n }\n }\n \n // Process remaining batch\n if (cleanupBatch.length > 0) {\n this._processCleanupBatch(cleanupBatch);\n }\n \n // Enhanced session IV cleanup with entropy preservation\n for (const [sessionId, sessionIVs] of this._ivTrackingSystem.sessionIVs.entries()) {\n if (sessionIVs.size > this._ivTrackingSystem.maxSessionIVs) {\n const ivArray = Array.from(sessionIVs);\n const toRemove = ivArray.slice(0, ivArray.length - this._ivTrackingSystem.maxSessionIVs);\n \n for (const ivString of toRemove) {\n sessionIVs.delete(ivString);\n this._ivTrackingSystem.usedIVs.delete(ivString);\n this._ivTrackingSystem.ivHistory.delete(ivString);\n cleanedCount++;\n }\n }\n }\n \n // Force garbage collection if available and significant cleanup occurred\n if (typeof window.gc === 'function' && cleanedCount > 50) {\n try {\n window.gc();\n } catch (e) {\n // Ignore GC errors\n }\n }\n \n if (cleanedCount > 0) {\n this._secureLog('debug', `\uD83E\uDDF9 Enhanced cleanup: ${cleanedCount} old IVs removed`, {\n cleanedCount: cleanedCount,\n remainingIVs: this._ivTrackingSystem.usedIVs.size,\n remainingHistory: this._ivTrackingSystem.ivHistory.size,\n memoryPressure: this._calculateMemoryPressure()\n });\n }\n }\n \n /**\n * Process cleanup batch with constant-time operations\n * @param {Array} batch - Batch of items to clean up\n */\n _processCleanupBatch(batch) {\n // Constant-time batch processing\n for (const item of batch) {\n this._ivTrackingSystem.usedIVs.delete(item);\n this._ivTrackingSystem.ivHistory.delete(item);\n }\n }\n\n /**\n * Calculate memory pressure for adaptive cleanup\n * @returns {number} Memory pressure score (0-100)\n */\n _calculateMemoryPressure() {\n const totalIVs = this._ivTrackingSystem.usedIVs.size;\n const maxAllowed = this._resourceLimits.maxIVHistory;\n \n return Math.min(100, Math.floor((totalIVs / maxAllowed) * 100));\n }\n\n /**\n * Get IV tracking system statistics\n */\n _getIVTrackingStats() {\n return {\n totalIVs: this._ivTrackingSystem.usedIVs.size,\n collisionCount: this._ivTrackingSystem.collisionCount,\n entropyTests: this._ivTrackingSystem.entropyValidation.entropyTests,\n entropyFailures: this._ivTrackingSystem.entropyValidation.entropyFailures,\n rngTests: this._ivTrackingSystem.rngValidation.testsPerformed,\n weakRngDetected: this._ivTrackingSystem.rngValidation.weakRngDetected,\n emergencyMode: this._ivTrackingSystem.emergencyMode,\n sessionCount: this._ivTrackingSystem.sessionIVs.size,\n lastCleanup: this._lastIVCleanupTime || 0\n };\n }\n \n /**\n * Reset IV tracking system (for testing or emergency recovery)\n */\n _resetIVTrackingSystem() {\n this._secureLog('warn', '\uD83D\uDD04 Resetting IV tracking system');\n \n this._ivTrackingSystem.usedIVs.clear();\n this._ivTrackingSystem.ivHistory.clear();\n this._ivTrackingSystem.sessionIVs.clear();\n this._ivTrackingSystem.collisionCount = 0;\n this._ivTrackingSystem.entropyValidation.entropyTests = 0;\n this._ivTrackingSystem.entropyValidation.entropyFailures = 0;\n this._ivTrackingSystem.rngValidation.testsPerformed = 0;\n this._ivTrackingSystem.rngValidation.weakRngDetected = false;\n this._ivTrackingSystem.emergencyMode = false;\n \n this._secureLog('info', '\u2705 IV tracking system reset completed');\n }\n \n /**\n * Validate RNG quality\n */\n _validateRNGQuality() {\n const now = Date.now();\n \n // Validate RNG every 1000 IV generations\n if (this._ivTrackingSystem.rngValidation.testsPerformed % 1000 === 0) {\n try {\n // Generate test IVs and validate\n const testIVs = [];\n for (let i = 0; i < 100; i++) {\n testIVs.push(crypto.getRandomValues(new Uint8Array(12)));\n }\n \n // Check for duplicates in test set\n const testIVStrings = testIVs.map(iv => Array.from(iv).map(b => b.toString(16).padStart(2, '0')).join(''));\n const uniqueTestIVs = new Set(testIVStrings);\n \n if (uniqueTestIVs.size < 95) { // Allow some tolerance\n this._ivTrackingSystem.rngValidation.weakRngDetected = true;\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Weak RNG detected in validation test', {\n uniqueIVs: uniqueTestIVs.size,\n totalTests: testIVs.length\n });\n }\n \n this._ivTrackingSystem.rngValidation.lastValidation = now;\n \n } catch (error) {\n this._secureLog('error', '\u274C RNG validation failed', {\n errorType: error.constructor.name\n });\n }\n }\n \n this._ivTrackingSystem.rngValidation.testsPerformed++;\n }\n \n /**\n * Handle mutex timeout with enhanced state validation\n */\n _handleMutexTimeout(mutexName, operationId, timeout) {\n const mutex = this[`_${mutexName}Mutex`];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Mutex '${mutexName}' not found during timeout handling`);\n return;\n }\n \n // Validate timeout conditions\n if (mutex.lockId !== operationId) {\n this._secureLog('warn', `\u26A0\uFE0F Timeout for different operation ID on mutex '${mutexName}'`, {\n expectedOperationId: operationId,\n actualLockId: mutex.lockId,\n locked: mutex.locked\n });\n return;\n }\n \n if (!mutex.locked) {\n this._secureLog('warn', `\u26A0\uFE0F Timeout for already unlocked mutex '${mutexName}'`, {\n operationId: operationId\n });\n return;\n }\n \n try {\n // Calculate lock duration for monitoring\n const lockDuration = mutex.lockTime ? Date.now() - mutex.lockTime : 0;\n \n this._secureLog('warn', `\u26A0\uFE0F Mutex '${mutexName}' auto-released due to timeout`, {\n operationId: operationId,\n lockDuration: lockDuration,\n timeout: timeout,\n queueLength: mutex.queue.length\n });\n \n // Atomic release with state validation\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n mutex.lockTime = null;\n \n // Process next in queue with error handling\n setTimeout(() => {\n try {\n this._processNextInQueue(mutexName);\n } catch (queueError) {\n this._secureLog('error', `\u274C Error processing queue after timeout for mutex '${mutexName}'`, {\n errorType: queueError.constructor.name,\n errorMessage: queueError.message\n });\n }\n }, 10);\n \n } catch (error) {\n this._secureLog('error', `\u274C Critical error during mutex timeout handling for '${mutexName}'`, {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Force emergency unlock if timeout handling fails\n try {\n this._emergencyUnlockAllMutexes('timeoutHandler');\n } catch (emergencyError) {\n this._secureLog('error', `\u274C Emergency unlock failed during timeout handling`, {\n originalError: error.message,\n emergencyError: emergencyError.message\n });\n }\n }\n }\n\n /**\n * Validate mutex system after emergency unlock\n */\n _validateMutexSystemAfterEmergencyUnlock() {\n const mutexes = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n let validationErrors = 0;\n \n this._secureLog('info', '\uD83D\uDD0D Validating mutex system after emergency unlock');\n \n mutexes.forEach(mutexName => {\n const mutex = this[`_${mutexName}Mutex`];\n \n if (!mutex) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' not found after emergency unlock`);\n return;\n }\n \n // Validate mutex state consistency\n if (mutex.locked) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still locked after emergency unlock`, {\n lockId: mutex.lockId,\n lockTime: mutex.lockTime\n });\n }\n \n if (mutex.lockId !== null) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still has lock ID after emergency unlock`, {\n lockId: mutex.lockId\n });\n }\n \n if (mutex.lockTimeout !== null) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still has timeout after emergency unlock`);\n }\n \n if (mutex.queue.length > 0) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still has queue items after emergency unlock`, {\n queueLength: mutex.queue.length\n });\n }\n });\n \n // Validate key system state\n if (this._keySystemState) {\n if (this._keySystemState.isInitializing || \n this._keySystemState.isRotating || \n this._keySystemState.isDestroying) {\n validationErrors++;\n this._secureLog('error', `\u274C Key system state not properly reset after emergency unlock`, {\n isInitializing: this._keySystemState.isInitializing,\n isRotating: this._keySystemState.isRotating,\n isDestroying: this._keySystemState.isDestroying\n });\n }\n }\n \n if (validationErrors === 0) {\n this._secureLog('info', '\u2705 Mutex system validation passed after emergency unlock');\n } else {\n this._secureLog('error', `\u274C Mutex system validation failed after emergency unlock`, {\n validationErrors: validationErrors\n });\n \n // Force re-initialization if validation fails\n setTimeout(() => {\n this._emergencyRecoverMutexSystem();\n }, 1000);\n }\n }\n /**\n * NEW: Diagnostics of the mutex system state\n */\n _getMutexSystemDiagnostics() {\n const diagnostics = {\n timestamp: Date.now(),\n systemValid: this._validateMutexSystem(),\n mutexes: {},\n counters: { ...this._operationCounters },\n keySystemState: { ...this._keySystemState }\n };\n \n const mutexNames = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n \n mutexNames.forEach(mutexName => {\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (mutex) {\n diagnostics.mutexes[mutexName] = {\n locked: mutex.locked,\n lockId: mutex.lockId,\n queueLength: mutex.queue.length,\n hasTimeout: !!mutex.lockTimeout\n };\n } else {\n diagnostics.mutexes[mutexName] = { error: 'not_found' };\n }\n });\n \n return diagnostics;\n }\n\n /**\n * FULLY FIXED createSecureOffer()\n * With race-condition protection and improved security\n */\n async createSecureOffer() {\n console.log('\uD83C\uDFAF createSecureOffer called');\n return this._withMutex('connectionOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDCE4 Creating secure offer with mutex', {\n operationId: operationId,\n connectionAttempts: this.connectionAttempts,\n currentState: this.peerConnection?.connectionState || 'none'\n });\n \n try {\n // ============================================\n // PHASE 1: INITIALIZATION AND VALIDATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 1: Initialization and validation');\n \n // Reset notification flags for a new connection\n this._resetNotificationFlags();\n \n // Rate limiting check\n if (!this._checkRateLimit()) {\n throw new Error('Connection rate limit exceeded. Please wait before trying again.');\n }\n \n // Reset attempt counters\n this.connectionAttempts = 0;\n \n // Generate session salt (64 bytes for v4.0)\n this.sessionSalt = window.EnhancedSecureCryptoUtils.generateSalt();\n console.log('\uD83C\uDFAF PHASE 1 completed: Session salt generated');\n \n this._secureLog('debug', '\uD83E\uDDC2 Session salt generated', {\n operationId: operationId,\n saltLength: this.sessionSalt.length,\n isValidSalt: Array.isArray(this.sessionSalt) && this.sessionSalt.length === 64\n });\n \n // ============================================\n // PHASE 2: SECURE KEY GENERATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 2: Secure key generation');\n \n // Secure key generation via mutex\n const keyPairs = await this._generateEncryptionKeys();\n this.ecdhKeyPair = keyPairs.ecdhKeyPair;\n this.ecdsaKeyPair = keyPairs.ecdsaKeyPair;\n \n // Validate generated keys\n if (!this.ecdhKeyPair?.privateKey || !this.ecdhKeyPair?.publicKey) {\n throw new Error('Failed to generate valid ECDH key pair');\n }\n \n if (!this.ecdsaKeyPair?.privateKey || !this.ecdsaKeyPair?.publicKey) {\n throw new Error('Failed to generate valid ECDSA key pair');\n }\n \n // ============================================\n // PHASE 3: MITM PROTECTION AND FINGERPRINTING\n // ============================================\n console.log('\uD83C\uDFAF PHASE 3: MITM protection and fingerprinting');\n \n // MITM Protection: Compute unique key fingerprints\n const ecdhFingerprint = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(\n await crypto.subtle.exportKey('spki', this.ecdhKeyPair.publicKey)\n );\n const ecdsaFingerprint = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(\n await crypto.subtle.exportKey('spki', this.ecdsaKeyPair.publicKey)\n );\n \n // Validate fingerprints\n if (!ecdhFingerprint || !ecdsaFingerprint) {\n throw new Error('Failed to generate key fingerprints');\n }\n \n this._secureLog('info', 'Generated unique key pairs for MITM protection', {\n operationId: operationId,\n hasECDHFingerprint: !!ecdhFingerprint,\n hasECDSAFingerprint: !!ecdsaFingerprint,\n fingerprintLength: ecdhFingerprint.length,\n timestamp: Date.now()\n });\n \n // ============================================\n // PHASE 4: EXPORT SIGNED KEYS\n // ============================================\n console.log('\uD83C\uDFAF PHASE 4: Export signed keys');\n \n // Export keys with digital signatures\n const ecdhPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdhKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDH'\n );\n \n const ecdsaPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdsaKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDSA'\n );\n\n \n if (!ecdhPublicKeyData || typeof ecdhPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDH key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export validation failed - hard abort required');\n }\n \n if (!ecdhPublicKeyData.keyData || !ecdhPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdhPublicKeyData.keyData,\n hasSignature: !!ecdhPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export incomplete - hard abort required');\n }\n \n if (!ecdsaPublicKeyData || typeof ecdsaPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDSA key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export validation failed - hard abort required');\n }\n \n if (!ecdsaPublicKeyData.keyData || !ecdsaPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdsaPublicKeyData.keyData,\n hasSignature: !!ecdsaPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export incomplete - hard abort required');\n }\n \n // ============================================\n // PHASE 5: UPDATE SECURITY FEATURES\n // ============================================\n console.log('\uD83C\uDFAF PHASE 5: Update security features');\n \n // Atomic update of security features\n this._updateSecurityFeatures({\n hasEncryption: true,\n hasECDH: true,\n hasECDSA: true,\n hasMutualAuth: true,\n hasMetadataProtection: true,\n hasEnhancedReplayProtection: true,\n hasNonExtractableKeys: true,\n hasRateLimiting: true,\n hasEnhancedValidation: true,\n hasPFS: true\n });\n \n // ============================================\n // PHASE 6: INITIALIZE PEER CONNECTION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 6: Initialize peer connection');\n \n this.isInitiator = true;\n this.onStatusChange('connecting');\n \n // Create peer connection\n this.createPeerConnection();\n \n // Create main data channel\n this.dataChannel = this.peerConnection.createDataChannel('securechat', {\n ordered: true\n });\n \n // Setup data channel\n this.setupDataChannel(this.dataChannel);\n \n this._secureLog('debug', '\uD83D\uDD17 Data channel created', {\n operationId: operationId,\n channelLabel: this.dataChannel.label,\n channelOrdered: this.dataChannel.ordered\n });\n \n // ============================================\n // PHASE 7: CREATE SDP OFFER\n // ============================================\n console.log('\uD83C\uDFAF PHASE 7: Create SDP offer');\n \n // Create WebRTC offer\n console.log('\uD83C\uDFAF Creating WebRTC offer...');\n const offer = await this.peerConnection.createOffer({\n offerToReceiveAudio: false,\n offerToReceiveVideo: false\n });\n console.log('\uD83C\uDFAF WebRTC offer created successfully');\n \n // Set local description\n console.log('\uD83C\uDFAF Setting local description...');\n await this.peerConnection.setLocalDescription(offer);\n console.log('\uD83C\uDFAF Local description set successfully');\n \n // Extract and store our DTLS fingerprint for out-of-band verification\n console.log('\uD83C\uDFAF Extracting DTLS fingerprint...');\n try {\n const ourFingerprint = this._extractDTLSFingerprintFromSDP(offer.sdp);\n this.expectedDTLSFingerprint = ourFingerprint;\n console.log('\uD83C\uDFAF DTLS fingerprint extracted successfully');\n \n this._secureLog('info', 'Generated DTLS fingerprint for out-of-band verification', {\n fingerprint: ourFingerprint,\n context: 'offer_creation'\n });\n \n // Notify UI that fingerprint is ready for out-of-band verification\n this.deliverMessageToUI(`\uD83D\uDD10 DTLS fingerprint ready for verification: ${ourFingerprint}`, 'system');\n } catch (error) {\n this._secureLog('error', 'Failed to extract DTLS fingerprint from offer', { error: error.message });\n // Continue without fingerprint validation (fallback mode)\n }\n \n // Await ICE gathering\n await this.waitForIceGathering();\n \n this._secureLog('debug', '\uD83E\uDDCA ICE gathering completed', {\n operationId: operationId,\n iceGatheringState: this.peerConnection.iceGatheringState,\n connectionState: this.peerConnection.connectionState\n });\n \n // ============================================\n // PHASE 8: GENERATE SAS FOR OUT-OF-BAND VERIFICATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 8: Generate SAS for out-of-band verification');\n\n this.verificationCode = window.EnhancedSecureCryptoUtils.generateVerificationCode();\n console.log('\uD83C\uDFAF Placeholder verification code generated:', this.verificationCode);\n \n // Validate verification code\n if (!this.verificationCode || this.verificationCode.length < EnhancedSecureWebRTCManager.SIZES.VERIFICATION_CODE_MIN_LENGTH) {\n throw new Error('Failed to generate valid verification code');\n }\n \n // ============================================\n // PHASE 9: MUTUAL AUTHENTICATION CHALLENGE\n // ============================================\n console.log('\uD83C\uDFAF PHASE 9: Mutual authentication challenge');\n \n // Generate challenge for mutual authentication\n const authChallenge = window.EnhancedSecureCryptoUtils.generateMutualAuthChallenge();\n \n if (!authChallenge) {\n throw new Error('Failed to generate mutual authentication challenge');\n }\n \n // ============================================\n // PHASE 10: SESSION ID FOR MITM PROTECTION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 10: Session ID for MITM protection');\n \n // MITM Protection: Generate session-specific ID\n this.sessionId = Array.from(crypto.getRandomValues(new Uint8Array(EnhancedSecureWebRTCManager.SIZES.SESSION_ID_LENGTH)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n \n // Validate session ID\n if (!this.sessionId || this.sessionId.length !== (EnhancedSecureWebRTCManager.SIZES.SESSION_ID_LENGTH * 2)) {\n throw new Error('Failed to generate valid session ID');\n }\n \n // Generate connection ID for AAD\n this.connectionId = Array.from(crypto.getRandomValues(new Uint8Array(8)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n \n // ============================================\n // PHASE 11: SECURITY LEVEL CALCULATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 11: Security level calculation');\n \n // All security features are enabled by default\n const securityLevel = {\n level: 'MAXIMUM',\n score: 100,\n color: 'green',\n details: 'All security features enabled by default',\n passedChecks: 10,\n totalChecks: 10,\n isRealData: true\n };\n \n // ============================================\n // PHASE 12: CREATE OFFER PACKAGE\n // ============================================\n console.log('\uD83C\uDFAF PHASE 12: Create offer package');\n \n const currentTimestamp = Date.now();\n console.log('\uD83C\uDFAF Creating offer package object...');\n \n // Create compact offer package for smaller QR codes\n const offerPackage = {\n // Core information (minimal)\n t: 'offer', // type\n s: this.peerConnection.localDescription.sdp, // sdp\n v: '4.0', // version\n ts: currentTimestamp, // timestamp\n \n // Cryptographic keys (essential)\n e: ecdhPublicKeyData, // ecdhPublicKey\n d: ecdsaPublicKeyData, // ecdsaPublicKey\n \n // Session data (essential)\n sl: this.sessionSalt, // salt\n si: this.sessionId, // sessionId\n ci: this.connectionId, // connectionId\n \n // Authentication (essential)\n vc: this.verificationCode, // verificationCode\n ac: authChallenge, // authChallenge\n \n // Security metadata (simplified)\n slv: 'MAX', // securityLevel\n \n // Key fingerprints (shortened)\n kf: {\n e: ecdhFingerprint.substring(0, 12), // ecdh (12 chars)\n d: ecdsaFingerprint.substring(0, 12) // ecdsa (12 chars)\n }\n };\n console.log('\uD83C\uDFAF Offer package object created successfully');\n \n // ============================================\n // PHASE 13: VALIDATE OFFER PACKAGE\n // ============================================\n console.log('\uD83C\uDFAF PHASE 13: Validate offer package');\n \n // Final validation of the generated package\n console.log('\uD83C\uDFAF Validating offer package...');\n try {\n const validationResult = this.validateEnhancedOfferData(offerPackage);\n console.log('\uD83C\uDFAF Validation result:', validationResult);\n if (!validationResult) {\n console.log('\uD83C\uDFAF Offer package validation FAILED');\n throw new Error('Generated offer package failed validation');\n }\n console.log('\uD83C\uDFAF Offer package validation PASSED');\n } catch (validationError) {\n console.log('\uD83C\uDFAF Validation ERROR:', validationError.message);\n throw new Error(`Offer package validation error: ${validationError.message}`);\n }\n \n // ============================================\n // PHASE 14: LOGGING AND EVENTS\n // ============================================\n console.log('\uD83C\uDFAF PHASE 14: Logging and events');\n \n this._secureLog('info', 'Enhanced secure offer created successfully', {\n operationId: operationId,\n version: offerPackage.version,\n hasECDSA: true,\n hasMutualAuth: true,\n hasSessionId: !!offerPackage.sessionId,\n securityLevel: securityLevel.level,\n timestamp: currentTimestamp,\n capabilitiesCount: 10 // All capabilities enabled by default\n });\n \n // Dispatch event about new connection\n document.dispatchEvent(new CustomEvent('new-connection', {\n detail: { \n type: 'offer',\n timestamp: currentTimestamp,\n securityLevel: securityLevel.level,\n operationId: operationId\n }\n }));\n \n // ============================================\n // PHASE 15: RETURN RESULT\n // ============================================\n console.log('\uD83C\uDFAF PHASE 15: Return result');\n \n console.log('\uD83C\uDFAF createSecureOffer completed successfully, returning offerPackage');\n return offerPackage;\n \n } catch (error) {\n // ============================================\n // ERROR HANDLING\n // ============================================\n \n this._secureLog('error', '\u274C Enhanced secure offer creation failed in critical section', {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message,\n phase: this._determineErrorPhase(error),\n connectionAttempts: this.connectionAttempts\n });\n \n // Cleanup state on error\n this._cleanupFailedOfferCreation();\n \n // Update status\n this.onStatusChange('disconnected');\n \n // Re-throw for upper-level handling\n throw error;\n }\n }, 15000); // 15 seconds timeout for the entire offer creation\n }\n\n /**\n * HELPER: Determine the phase where the error occurred\n */\n _determineErrorPhase(error) {\n const message = error.message.toLowerCase();\n \n if (message.includes('rate limit')) return 'rate_limiting';\n if (message.includes('key pair') || message.includes('generate')) return 'key_generation';\n if (message.includes('fingerprint')) return 'fingerprinting';\n if (message.includes('export') || message.includes('signature')) return 'key_export';\n if (message.includes('peer connection')) return 'webrtc_setup';\n if (message.includes('offer') || message.includes('sdp')) return 'sdp_creation';\n if (message.includes('verification')) return 'verification_setup';\n if (message.includes('session')) return 'session_setup';\n if (message.includes('validation')) return 'package_validation';\n \n return 'unknown';\n }\n\n /**\n * Secure cleanup state after failed offer creation\n */\n _cleanupFailedOfferCreation() {\n try {\n // Secure wipe of cryptographic materials\n this._secureCleanupCryptographicMaterials();\n \n // Close peer connection if it was created\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Clear data channel\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n \n // Reset flags\n this.isInitiator = false;\n this.isVerified = false;\n \n // Reset security features to baseline\n this._updateSecurityFeatures({\n hasEncryption: false,\n hasECDH: false,\n hasECDSA: false,\n hasMutualAuth: false,\n hasMetadataProtection: false,\n hasEnhancedReplayProtection: false,\n hasNonExtractableKeys: false,\n hasEnhancedValidation: false,\n hasPFS: false\n });\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n this._secureLog('debug', '\uD83D\uDD12 Failed offer creation cleanup completed with secure memory wipe');\n \n } catch (cleanupError) {\n this._secureLog('error', '\u274C Error during offer creation cleanup', {\n errorType: cleanupError.constructor.name,\n errorMessage: cleanupError.message\n });\n }\n }\n\n /**\n * HELPER: Atomic update of security features (if not added yet)\n */\n _updateSecurityFeatures(updates) {\n const oldFeatures = { ...this.securityFeatures };\n \n try {\n Object.assign(this.securityFeatures, updates);\n \n this._secureLog('debug', '\uD83D\uDD27 Security features updated', {\n updatedCount: Object.keys(updates).length,\n totalFeatures: Object.keys(this.securityFeatures).length\n });\n \n } catch (error) {\n // Roll back on error\n this.securityFeatures = oldFeatures;\n this._secureLog('error', '\u274C Security features update failed, rolled back', {\n errorType: error.constructor.name\n });\n throw error;\n }\n }\n\n /**\n * FULLY FIXED METHOD createSecureAnswer()\n * With race-condition protection and enhanced security\n */\n async createSecureAnswer(offerData) {\n console.log('\uD83C\uDFAF createSecureAnswer called with offerData:', offerData ? 'present' : 'null');\n return this._withMutex('connectionOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDCE8 Creating secure answer with mutex', {\n operationId: operationId,\n hasOfferData: !!offerData,\n offerType: offerData?.type,\n offerVersion: offerData?.version,\n offerTimestamp: offerData?.timestamp\n });\n \n try {\n // ============================================\n // PHASE 1: PRE-VALIDATION OF OFFER\n // ============================================\n \n // Reset notification flags for a new connection\n this._resetNotificationFlags();\n \n this._secureLog('debug', 'Starting enhanced offer validation', {\n operationId: operationId,\n hasOfferData: !!offerData,\n offerType: offerData?.type,\n hasECDHKey: !!offerData?.ecdhPublicKey,\n hasECDSAKey: !!offerData?.ecdsaPublicKey,\n hasSalt: !!offerData?.salt\n });\n \n // Strict input validation\n if (!this.validateEnhancedOfferData(offerData)) {\n throw new Error('Invalid connection data format - failed enhanced validation');\n }\n \n // Rate limiting check\n if (!window.EnhancedSecureCryptoUtils.rateLimiter.checkConnectionRate(this.rateLimiterId)) {\n throw new Error('Connection rate limit exceeded. Please wait before trying again.');\n }\n \n // ============================================\n // PHASE 2: SECURITY AND ANTI-REPLAY PROTECTION\n // ============================================\n \n // MITM Protection: Validate offer data structure (support both formats)\n const timestamp = offerData.ts || offerData.timestamp;\n const version = offerData.v || offerData.version;\n if (!timestamp || !version) {\n throw new Error('Missing required security fields in offer data \u2013 possible MITM attack');\n }\n \n // Replay attack protection (window reduced to 5 minutes)\n const offerAge = Date.now() - timestamp;\n const MAX_OFFER_AGE = 300000; // 5 minutes instead of 1 hour\n \n if (offerAge > MAX_OFFER_AGE) {\n this._secureLog('error', 'Offer data is too old - possible replay attack', {\n operationId: operationId,\n offerAge: Math.round(offerAge / 1000),\n maxAllowedAge: Math.round(MAX_OFFER_AGE / 1000),\n timestamp: offerData.timestamp\n });\n \n // Notify the main code about the replay attack\n if (this.onAnswerError) {\n this.onAnswerError('replay_attack', 'Offer data is too old \u2013 possible replay attack');\n }\n \n throw new Error('Offer data is too old \u2013 possible replay attack');\n }\n \n // Protocol version compatibility check (support both formats)\n const protocolVersion = version; // Use the version we already extracted\n if (protocolVersion !== '4.0') {\n this._secureLog('warn', 'Protocol version mismatch detected', {\n operationId: operationId,\n expectedVersion: '4.0',\n receivedVersion: protocolVersion\n });\n \n // For backward compatibility with v3.0, a fallback can be added\n if (protocolVersion !== '3.0') {\n throw new Error(`Unsupported protocol version: ${protocolVersion}`);\n }\n }\n \n // ============================================\n // PHASE 3: EXTRACT AND VALIDATE SESSION SALT\n // ============================================\n \n // Set session salt from offer (support both formats)\n this.sessionSalt = offerData.sl || offerData.salt;\n \n // Validate session salt\n if (!Array.isArray(this.sessionSalt)) {\n throw new Error('Invalid session salt format - must be array');\n }\n \n const expectedSaltLength = protocolVersion === '4.0' ? 64 : 32;\n if (this.sessionSalt.length !== expectedSaltLength) {\n throw new Error(`Invalid session salt length: expected ${expectedSaltLength}, got ${this.sessionSalt.length}`);\n }\n \n // MITM Protection: Check salt integrity\n const saltFingerprint = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(this.sessionSalt);\n \n this._secureLog('info', 'Session salt validated successfully', {\n operationId: operationId,\n saltLength: this.sessionSalt.length,\n saltFingerprint: saltFingerprint.substring(0, 8)\n });\n \n // ============================================\n // PHASE 4: SECURE GENERATION OF OUR KEYS\n // ============================================\n \n // Secure generation of our keys via mutex\n const keyPairs = await this._generateEncryptionKeys();\n this.ecdhKeyPair = keyPairs.ecdhKeyPair;\n this.ecdsaKeyPair = keyPairs.ecdsaKeyPair;\n \n // Additional validation of generated keys\n if (!(this.ecdhKeyPair?.privateKey instanceof CryptoKey)) {\n this._secureLog('error', 'Local ECDH private key is not a CryptoKey', {\n operationId: operationId,\n hasKeyPair: !!this.ecdhKeyPair,\n privateKeyType: typeof this.ecdhKeyPair?.privateKey,\n privateKeyAlgorithm: this.ecdhKeyPair?.privateKey?.algorithm?.name\n });\n throw new Error('Local ECDH private key is not a valid CryptoKey');\n }\n \n // ============================================\n // PHASE 5: IMPORT AND VERIFY PEER KEYS\n // ============================================\n \n // Import peer ECDSA public key for signature verification (support both formats)\n let peerECDSAPublicKey;\n \n try {\n const ecdsaKey = offerData.d || offerData.ecdsaPublicKey;\n peerECDSAPublicKey = await crypto.subtle.importKey(\n 'spki',\n new Uint8Array(ecdsaKey.keyData),\n {\n name: 'ECDSA',\n namedCurve: 'P-384'\n },\n false,\n ['verify']\n );\n } catch (error) {\n this._throwSecureError(error, 'ecdsa_key_import');\n }\n \n // ============================================\n // PHASE 6: IMPORT AND VERIFY ECDH KEY\n // ============================================\n \n // Import and verify ECDH public key using verified ECDSA key (support both formats)\n let peerECDHPublicKey;\n \n try {\n const ecdhKey = offerData.e || offerData.ecdhPublicKey;\n peerECDHPublicKey = await window.EnhancedSecureCryptoUtils.importSignedPublicKey(\n ecdhKey,\n peerECDSAPublicKey,\n 'ECDH'\n );\n } catch (error) {\n this._secureLog('error', 'Failed to import signed ECDH public key', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._throwSecureError(error, 'ecdh_key_import');\n }\n \n // Final validation of ECDH key\n if (!(peerECDHPublicKey instanceof CryptoKey)) {\n this._secureLog('error', 'Peer ECDH public key is not a CryptoKey', {\n operationId: operationId,\n publicKeyType: typeof peerECDHPublicKey,\n publicKeyAlgorithm: peerECDHPublicKey?.algorithm?.name\n });\n throw new Error('Peer ECDH public key is not a valid CryptoKey');\n }\n \n // Save peer key for PFS rotation\n this.peerPublicKey = peerECDHPublicKey;\n \n // ============================================\n // PHASE 7: DERIVE SHARED ENCRYPTION KEYS\n // ============================================\n \n // Derive shared keys with metadata protection\n let derivedKeys;\n \n try {\n derivedKeys = await window.EnhancedSecureCryptoUtils.deriveSharedKeys(\n this.ecdhKeyPair.privateKey,\n peerECDHPublicKey,\n this.sessionSalt\n );\n } catch (error) {\n this._secureLog('error', 'Failed to derive shared keys', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._throwSecureError(error, 'key_derivation');\n }\n \n // Securely set keys via helper\n await this._setEncryptionKeys(\n derivedKeys.encryptionKey,\n derivedKeys.macKey,\n derivedKeys.metadataKey,\n derivedKeys.fingerprint\n );\n \n // Additional validation of installed keys\n if (!(this.encryptionKey instanceof CryptoKey) || \n !(this.macKey instanceof CryptoKey) || \n !(this.metadataKey instanceof CryptoKey)) {\n \n this._secureLog('error', 'Invalid key types after derivation', {\n operationId: operationId,\n encryptionKeyType: typeof this.encryptionKey,\n macKeyType: typeof this.macKey,\n metadataKeyType: typeof this.metadataKey\n });\n throw new Error('Invalid key types after derivation');\n }\n \n // Set verification code from offer\n this.verificationCode = offerData.verificationCode;\n \n this._secureLog('info', 'Encryption keys derived and set successfully', {\n operationId: operationId,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n hasMetadataKey: !!this.metadataKey,\n hasKeyFingerprint: !!this.keyFingerprint,\n mitmProtection: 'enabled',\n signatureVerified: true\n });\n \n // ============================================\n // PHASE 8: UPDATE SECURITY FEATURES\n // ============================================\n \n // Atomic update of security features\n this._updateSecurityFeatures({\n hasEncryption: true,\n hasECDH: true,\n hasECDSA: true,\n hasMutualAuth: true,\n hasMetadataProtection: true,\n hasEnhancedReplayProtection: true,\n hasNonExtractableKeys: true,\n hasRateLimiting: true,\n hasEnhancedValidation: true,\n hasPFS: true\n });\n \n // PFS: Initialize key version tracking\n this.currentKeyVersion = 0;\n this.lastKeyRotation = Date.now();\n this.keyVersions.set(0, {\n salt: this.sessionSalt,\n timestamp: this.lastKeyRotation,\n messageCount: 0\n });\n \n // ============================================\n // PHASE 9: CREATE AUTHENTICATION PROOF\n // ============================================\n \n // Create proof for mutual authentication\n let authProof;\n \n if (offerData.authChallenge) {\n try {\n authProof = await window.EnhancedSecureCryptoUtils.createAuthProof(\n offerData.authChallenge,\n this.ecdsaKeyPair.privateKey,\n this.ecdsaKeyPair.publicKey\n );\n } catch (error) {\n this._secureLog('error', 'Failed to create authentication proof', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._throwSecureError(error, 'authentication_proof_creation');\n }\n } else {\n this._secureLog('warn', 'No auth challenge in offer - mutual auth disabled', {\n operationId: operationId\n });\n }\n \n // ============================================\n // PHASE 10: INITIALIZE WEBRTC\n // ============================================\n \n this.isInitiator = false;\n this.onStatusChange('connecting');\n \n // DEBUG: Check keyFingerprint before calling onKeyExchange\n console.log('Before onKeyExchange - keyFingerprint:', this.keyFingerprint);\n this.onKeyExchange(this.keyFingerprint);\n \n // Create peer connection first\n this.createPeerConnection();\n \n // Validate DTLS fingerprint before setting remote description\n if (this.strictDTLSValidation) {\n try {\n const receivedFingerprint = this._extractDTLSFingerprintFromSDP(offerData.sdp);\n \n if (this.expectedDTLSFingerprint) {\n this._validateDTLSFingerprint(receivedFingerprint, this.expectedDTLSFingerprint, 'offer_validation');\n } else {\n // Store fingerprint for future validation (first connection)\n this.expectedDTLSFingerprint = receivedFingerprint;\n this._secureLog('info', 'Stored DTLS fingerprint for future validation', {\n fingerprint: receivedFingerprint,\n context: 'first_connection'\n });\n }\n } catch (error) {\n this._secureLog('warn', 'DTLS fingerprint validation failed - continuing in fallback mode', { \n error: error.message,\n context: 'offer_validation'\n });\n // Continue without strict fingerprint validation for first connection\n // This allows the connection to proceed while maintaining security awareness\n }\n } else {\n this._secureLog('info', 'DTLS fingerprint validation disabled - proceeding without validation');\n }\n\n // Set remote description from offer\n try {\n this._secureLog('debug', 'Setting remote description from offer', {\n operationId: operationId,\n sdpLength: offerData.sdp?.length || 0\n });\n \n await this.peerConnection.setRemoteDescription(new RTCSessionDescription({\n type: 'offer',\n sdp: offerData.s || offerData.sdp\n }));\n \n this._secureLog('debug', 'Remote description set successfully', {\n operationId: operationId,\n signalingState: this.peerConnection.signalingState\n });\n } catch (error) {\n this._secureLog('error', 'Failed to set remote description', { \n error: error.message,\n operationId: operationId\n });\n this._throwSecureError(error, 'webrtc_remote_description');\n }\n \n this._secureLog('debug', '\uD83D\uDD17 Remote description set successfully', {\n operationId: operationId,\n connectionState: this.peerConnection.connectionState,\n signalingState: this.peerConnection.signalingState\n });\n \n // ============================================\n // PHASE 11: CREATE SDP ANSWER\n // ============================================\n \n // Create WebRTC answer\n let answer;\n \n try {\n answer = await this.peerConnection.createAnswer({\n offerToReceiveAudio: false,\n offerToReceiveVideo: false\n });\n } catch (error) {\n this._throwSecureError(error, 'webrtc_create_answer');\n }\n \n // Set local description\n try {\n await this.peerConnection.setLocalDescription(answer);\n } catch (error) {\n this._throwSecureError(error, 'webrtc_local_description');\n }\n \n // Extract and store our DTLS fingerprint for out-of-band verification\n try {\n const ourFingerprint = this._extractDTLSFingerprintFromSDP(answer.sdp);\n this.expectedDTLSFingerprint = ourFingerprint;\n \n this._secureLog('info', 'Generated DTLS fingerprint for out-of-band verification', {\n fingerprint: ourFingerprint,\n context: 'answer_creation'\n });\n \n // Notify UI that fingerprint is ready for out-of-band verification\n this.deliverMessageToUI(`\uD83D\uDD10 DTLS fingerprint ready for verification: ${ourFingerprint}`, 'system');\n } catch (error) {\n this._secureLog('error', 'Failed to extract DTLS fingerprint from answer', { error: error.message });\n // Continue without fingerprint validation (fallback mode)\n }\n \n \n // Await ICE gathering\n await this.waitForIceGathering();\n \n this._secureLog('debug', '\uD83E\uDDCA ICE gathering completed for answer', {\n operationId: operationId,\n iceGatheringState: this.peerConnection.iceGatheringState,\n connectionState: this.peerConnection.connectionState\n });\n \n // ============================================\n // PHASE 12: EXPORT OUR KEYS\n // ============================================\n \n // Export our keys with signatures\n const ecdhPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdhKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDH'\n );\n \n const ecdsaPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdsaKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDSA'\n );\n \n if (!ecdhPublicKeyData || typeof ecdhPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDH key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export validation failed - hard abort required');\n }\n \n if (!ecdhPublicKeyData.keyData || !ecdhPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdhPublicKeyData.keyData,\n hasSignature: !!ecdhPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export incomplete - hard abort required');\n }\n \n if (!ecdsaPublicKeyData || typeof ecdsaPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDSA key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export validation failed - hard abort required');\n }\n \n if (!ecdsaPublicKeyData.keyData || !ecdsaPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdsaPublicKeyData.keyData,\n hasSignature: !!ecdsaPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export incomplete - hard abort required');\n }\n \n // ============================================\n // PHASE 13: SECURITY LEVEL CALCULATION\n // ============================================\n \n // All security features are enabled by default\n const securityLevel = {\n level: 'MAXIMUM',\n score: 100,\n color: 'green',\n details: 'All security features enabled by default',\n passedChecks: 10,\n totalChecks: 10,\n isRealData: true\n };\n \n // ============================================\n // PHASE 14: CREATE ANSWER PACKAGE\n // ============================================\n \n const currentTimestamp = Date.now();\n \n // Create compact answer package for smaller QR codes\n const answerPackage = {\n // Core information (minimal)\n t: 'answer', // type\n s: this.peerConnection.localDescription.sdp, // sdp\n v: '4.0', // version\n ts: currentTimestamp, // timestamp\n \n // Cryptographic keys (essential)\n e: ecdhPublicKeyData, // ecdhPublicKey\n d: ecdsaPublicKeyData, // ecdsaPublicKey\n \n // Authentication (essential)\n ap: authProof, // authProof\n \n // Security metadata (simplified)\n slv: 'MAX', // securityLevel\n \n // Session confirmation (simplified)\n sc: {\n sf: saltFingerprint.substring(0, 12), // saltFingerprint (12 chars)\n kd: true, // keyDerivationSuccess\n ma: true // mutualAuthEnabled\n }\n };\n \n // ============================================\n // PHASE 15: VALIDATION AND LOGGING\n // ============================================\n \n // Final validation of the answer package (support both formats)\n const hasSDP = answerPackage.s || answerPackage.sdp;\n const hasECDH = answerPackage.e || answerPackage.ecdhPublicKey;\n const hasECDSA = answerPackage.d || answerPackage.ecdsaPublicKey;\n \n if (!hasSDP || !hasECDH || !hasECDSA) {\n throw new Error('Generated answer package is incomplete');\n }\n \n this._secureLog('info', 'Enhanced secure answer created successfully', {\n operationId: operationId,\n version: answerPackage.version,\n hasECDSA: true,\n hasMutualAuth: !!authProof,\n hasSessionConfirmation: !!answerPackage.sessionConfirmation,\n securityLevel: securityLevel.level,\n timestamp: currentTimestamp,\n processingTime: currentTimestamp - offerData.timestamp\n });\n \n // Dispatch event about new connection\n document.dispatchEvent(new CustomEvent('new-connection', {\n detail: { \n type: 'answer',\n timestamp: currentTimestamp,\n securityLevel: securityLevel.level,\n operationId: operationId\n }\n }));\n \n // ============================================\n // PHASE 16: SCHEDULE SECURITY CALCULATIONS\n // ============================================\n \n // Plan security calculation after connection\n setTimeout(async () => {\n try {\n const realSecurityData = await this.calculateAndReportSecurityLevel();\n if (realSecurityData) {\n this.notifySecurityUpdate();\n this._secureLog('info', '\u2705 Post-connection security level calculated', {\n operationId: operationId,\n level: realSecurityData.level\n });\n }\n } catch (error) {\n this._secureLog('error', '\u274C Error calculating post-connection security', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n }\n }, 1000);\n \n // Retry if the first calculation fails\n setTimeout(async () => {\n if (!this.lastSecurityCalculation || this.lastSecurityCalculation.score < 50) {\n this._secureLog('info', '\uD83D\uDD04 Retrying security calculation', {\n operationId: operationId\n });\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpdate();\n }\n }, 3000);\n \n // Final security update\n this.notifySecurityUpdate();\n \n // ============================================\n // PHASE 17: RETURN RESULT\n // ============================================\n \n return answerPackage;\n \n } catch (error) {\n // ============================================\n // ERROR HANDLING\n // ============================================\n \n this._secureLog('error', '\u274C Enhanced secure answer creation failed in critical section', {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message,\n phase: this._determineAnswerErrorPhase(error),\n offerAge: offerData?.timestamp ? Date.now() - offerData.timestamp : 'unknown'\n });\n \n // Cleanup state on error\n this._cleanupFailedAnswerCreation();\n \n // Update status\n this.onStatusChange('disconnected');\n \n // Special handling of security errors\n if (this.onAnswerError) {\n if (error.message.includes('too old') || error.message.includes('replay')) {\n this.onAnswerError('replay_attack', error.message);\n } else if (error.message.includes('MITM') || error.message.includes('signature')) {\n this.onAnswerError('security_violation', error.message);\n } else if (error.message.includes('validation') || error.message.includes('format')) {\n this.onAnswerError('invalid_format', error.message);\n } else {\n this.onAnswerError('general_error', error.message);\n }\n }\n \n // Re-throw for upper-level handling\n throw error;\n }\n }, 20000); // 20 seconds timeout for the entire answer creation (longer than offer)\n }\n\n /**\n * HELPER: Determine error phase for answer\n */\n _determineAnswerErrorPhase(error) {\n const message = error.message.toLowerCase();\n \n if (message.includes('validation') || message.includes('format')) return 'offer_validation';\n if (message.includes('rate limit')) return 'rate_limiting';\n if (message.includes('replay') || message.includes('too old')) return 'replay_protection';\n if (message.includes('salt')) return 'salt_validation';\n if (message.includes('key pair') || message.includes('generate')) return 'key_generation';\n if (message.includes('import') || message.includes('ecdsa') || message.includes('ecdh')) return 'key_import';\n if (message.includes('signature') || message.includes('mitm')) return 'signature_verification';\n if (message.includes('derive') || message.includes('shared')) return 'key_derivation';\n if (message.includes('auth') || message.includes('proof')) return 'authentication';\n if (message.includes('remote description') || message.includes('local description')) return 'webrtc_setup';\n if (message.includes('answer') || message.includes('sdp')) return 'sdp_creation';\n if (message.includes('export')) return 'key_export';\n if (message.includes('security level')) return 'security_calculation';\n \n return 'unknown';\n }\n\n /**\n * HELPER: Cleanup state after failed answer creation\n */\n /**\n * Secure cleanup state after failed answer creation\n */\n _cleanupFailedAnswerCreation() {\n try {\n // Secure wipe of cryptographic materials\n this._secureCleanupCryptographicMaterials();\n \n // Secure wipe of PFS key versions\n this.currentKeyVersion = 0;\n this.keyVersions.clear();\n this.oldKeys.clear();\n \n // Close peer connection if created\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Clear data channel\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n \n // Reset flags and counters\n this.isInitiator = false;\n this.isVerified = false;\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.messageCounter = 0;\n this.processedMessageIds.clear();\n this.replayWindow.clear(); // Clear replay window\n \n // Reset security features to baseline\n this._updateSecurityFeatures({\n hasEncryption: false,\n hasECDH: false,\n hasECDSA: false,\n hasMutualAuth: false,\n hasMetadataProtection: false,\n hasEnhancedReplayProtection: false,\n hasNonExtractableKeys: false,\n hasEnhancedValidation: false,\n hasPFS: false\n });\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n this._secureLog('debug', '\uD83D\uDD12 Failed answer creation cleanup completed with secure memory wipe');\n \n } catch (cleanupError) {\n this._secureLog('error', '\u274C Error during answer creation cleanup', {\n errorType: cleanupError.constructor.name,\n errorMessage: cleanupError.message\n });\n }\n }\n\n /**\n * HELPER: Securely set encryption keys (if not set yet)\n */\n async _setEncryptionKeys(encryptionKey, macKey, metadataKey, keyFingerprint) {\n return this._withMutex('keyOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDD10 Setting encryption keys with mutex', {\n operationId: operationId\n });\n \n // Validate all keys before setting\n if (!(encryptionKey instanceof CryptoKey) ||\n !(macKey instanceof CryptoKey) ||\n !(metadataKey instanceof CryptoKey)) {\n throw new Error('Invalid key types provided');\n }\n \n if (!keyFingerprint || typeof keyFingerprint !== 'string') {\n throw new Error('Invalid key fingerprint provided');\n }\n \n // Atomically set all keys\n const oldKeys = {\n encryptionKey: this.encryptionKey,\n macKey: this.macKey,\n metadataKey: this.metadataKey,\n keyFingerprint: this.keyFingerprint\n };\n \n try {\n this.encryptionKey = encryptionKey;\n this.macKey = macKey;\n this.metadataKey = metadataKey;\n this.keyFingerprint = keyFingerprint;\n \n // Reset counters\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.messageCounter = 0;\n this.processedMessageIds.clear();\n this.replayWindow.clear(); // Clear replay window\n \n this._secureLog('info', '\u2705 Encryption keys set successfully', {\n operationId: operationId,\n hasAllKeys: !!(this.encryptionKey && this.macKey && this.metadataKey),\n hasFingerprint: !!this.keyFingerprint\n });\n \n return true;\n \n } catch (error) {\n // Roll back on error\n this.encryptionKey = oldKeys.encryptionKey;\n this.macKey = oldKeys.macKey;\n this.metadataKey = oldKeys.metadataKey;\n this.keyFingerprint = oldKeys.keyFingerprint;\n \n this._secureLog('error', '\u274C Key setting failed, rolled back', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n \n throw error;\n }\n });\n }\n\n async handleSecureAnswer(answerData) {\n console.log('\uD83C\uDFAF handleSecureAnswer called with answerData:', answerData ? 'present' : 'null');\n try {\n \n if (!answerData || typeof answerData !== 'object' || Array.isArray(answerData)) {\n this._secureLog('error', 'CRITICAL: Invalid answer data structure', { \n hasAnswerData: !!answerData,\n answerDataType: typeof answerData,\n isArray: Array.isArray(answerData)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Answer data must be a non-null object');\n }\n \n // Support both compact and legacy answer formats\n const isCompactAnswer = answerData.t === 'answer' && answerData.s;\n const isLegacyAnswer = answerData.type === 'enhanced_secure_answer' && answerData.sdp;\n \n if (!isCompactAnswer && !isLegacyAnswer) {\n this._secureLog('error', 'CRITICAL: Invalid answer format', { \n type: answerData.type || answerData.t,\n hasSdp: !!(answerData.sdp || answerData.s)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Invalid answer format - hard abort required');\n }\n\n // CRITICAL: Strict validation of ECDH public key structure\n // Support both full and compact key names\n const ecdhKey = answerData.ecdhPublicKey || answerData.e;\n const ecdsaKey = answerData.ecdsaPublicKey || answerData.d;\n \n console.log('\uD83D\uDD0D Answer data structure check:', {\n hasEcdhKey: !!ecdhKey,\n ecdhKeyType: typeof ecdhKey,\n isArray: Array.isArray(ecdhKey),\n answerKeys: Object.keys(answerData),\n ecdhKeyKeys: ecdhKey ? Object.keys(ecdhKey) : 'N/A',\n fullAnswerData: answerData,\n usingCompactKeys: !answerData.ecdhPublicKey && !!answerData.e\n });\n \n if (!ecdhKey || typeof ecdhKey !== 'object' || Array.isArray(ecdhKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDH public key structure in answer', { \n hasEcdhKey: !!ecdhKey,\n ecdhKeyType: typeof ecdhKey,\n isArray: Array.isArray(ecdhKey),\n availableKeys: Object.keys(answerData)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Missing or invalid ECDH public key structure');\n }\n \n if (!ecdhKey.keyData || !ecdhKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key missing keyData or signature in answer', { \n hasKeyData: !!ecdhKey.keyData,\n hasSignature: !!ecdhKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key missing keyData or signature');\n }\n\n // CRITICAL: Strict validation of ECDSA public key structure\n if (!ecdsaKey || typeof ecdsaKey !== 'object' || Array.isArray(ecdsaKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDSA public key structure in answer', { \n hasEcdsaKey: !!ecdsaKey,\n ecdsaKeyType: typeof ecdsaKey,\n isArray: Array.isArray(ecdsaKey)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Missing or invalid ECDSA public key structure');\n }\n \n if (!ecdsaKey.keyData || !ecdsaKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key missing keyData or signature in answer', { \n hasKeyData: !!ecdsaKey.keyData,\n hasSignature: !!ecdsaKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key missing keyData or signature');\n }\n\n // Additional MITM protection: Validate answer data structure\n // Support both compact and legacy formats\n const timestamp = answerData.ts || answerData.timestamp;\n const version = answerData.v || answerData.version;\n \n if (!timestamp || !version) {\n throw new Error('Missing required fields in response data \u2013 possible MITM attack');\n }\n\n // MITM Protection: Verify session ID if present (for enhanced security)\n if (answerData.sessionId && this.sessionId && answerData.sessionId !== this.sessionId) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Session ID mismatch detected - possible MITM attack', {\n expectedSessionId: this.sessionId,\n receivedSessionId: answerData.sessionId\n });\n throw new Error('Session ID mismatch \u2013 possible MITM attack');\n }\n\n // Check for replay attacks (reject answers older than 1 hour)\n const answerAge = Date.now() - answerData.timestamp;\n if (answerAge > 3600000) { // 1 hour in milliseconds\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Answer data is too old - possible replay attack', {\n answerAge: answerAge,\n timestamp: answerData.timestamp\n });\n \n // Notify the main code about the replay attack error\n if (this.onAnswerError) {\n this.onAnswerError('replay_attack', 'Response data is too old \u2013 possible replay attack');\n }\n \n throw new Error('Response data is too old \u2013 possible replay attack');\n }\n\n // Check protocol version compatibility\n if (answerData.version !== '4.0') {\n window.EnhancedSecureCryptoUtils.secureLog.log('warn', 'Incompatible protocol version in answer', {\n expectedVersion: '4.0',\n receivedVersion: answerData.version\n });\n }\n\n // Import ECDSA public key for verification (self-signed)\n const peerECDSAPublicKey = await crypto.subtle.importKey(\n 'spki',\n new Uint8Array(ecdsaKey.keyData),\n {\n name: 'ECDSA',\n namedCurve: 'P-384'\n },\n false,\n ['verify']\n );\n\n\n // Now import and verify the ECDH public key using the verified ECDSA key\n const peerPublicKey = await window.EnhancedSecureCryptoUtils.importPublicKeyFromSignedPackage(\n ecdhKey,\n peerECDSAPublicKey\n );\n \n // Additional MITM protection: Verify session salt integrity\n if (!this.sessionSalt || this.sessionSalt.length !== 64) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Invalid session salt detected - possible session hijacking', {\n saltLength: this.sessionSalt ? this.sessionSalt.length : 0\n });\n throw new Error('Invalid session salt \u2013 possible session hijacking attempt');\n }\n\n // Verify that the session salt hasn't been tampered with\n const expectedSaltHash = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(this.sessionSalt);\n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Session salt integrity verified', {\n saltFingerprint: expectedSaltHash.substring(0, 8)\n });\n\n // Additional validation: Ensure all keys are CryptoKey instances before derivation\n if (!(this.ecdhKeyPair?.privateKey instanceof CryptoKey)) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Local ECDH private key is not a CryptoKey in handleSecureAnswer', {\n hasKeyPair: !!this.ecdhKeyPair,\n privateKeyType: typeof this.ecdhKeyPair?.privateKey,\n privateKeyAlgorithm: this.ecdhKeyPair?.privateKey?.algorithm?.name\n });\n throw new Error('Local ECDH private key is not a CryptoKey');\n }\n \n if (!(peerPublicKey instanceof CryptoKey)) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Peer ECDH public key is not a CryptoKey in handleSecureAnswer', {\n publicKeyType: typeof peerPublicKey,\n publicKeyAlgorithm: peerPublicKey?.algorithm?.name\n });\n throw new Error('Peer ECDH public key is not a CryptoKey');\n }\n\n // Store peer's public key for PFS key rotation\n this.peerPublicKey = peerPublicKey;\n \n // Initialize connection ID if not already set\n if (!this.connectionId) {\n this.connectionId = Array.from(crypto.getRandomValues(new Uint8Array(8)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n }\n\n \n const derivedKeys = await window.EnhancedSecureCryptoUtils.deriveSharedKeys(\n this.ecdhKeyPair.privateKey,\n peerPublicKey,\n this.sessionSalt\n );\n \n this.encryptionKey = derivedKeys.encryptionKey;\n this.macKey = derivedKeys.macKey;\n this.metadataKey = derivedKeys.metadataKey;\n this.keyFingerprint = derivedKeys.fingerprint;\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.messageCounter = 0;\n this.processedMessageIds.clear();\n this.replayWindow.clear(); // Clear replay window\n // Validate that all keys are properly set\n if (!(this.encryptionKey instanceof CryptoKey) || \n !(this.macKey instanceof CryptoKey) || \n !(this.metadataKey instanceof CryptoKey)) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Invalid key types after derivation in handleSecureAnswer', {\n encryptionKeyType: typeof this.encryptionKey,\n macKeyType: typeof this.macKey,\n metadataKeyType: typeof this.metadataKey,\n encryptionKeyAlgorithm: this.encryptionKey?.algorithm?.name,\n macKeyAlgorithm: this.macKey?.algorithm?.name,\n metadataKeyAlgorithm: this.metadataKey?.algorithm?.name\n });\n throw new Error('Invalid key types after export');\n }\n \n this._secureLog('info', 'Encryption keys set in handleSecureAnswer', {\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n hasMetadataKey: !!this.metadataKey,\n hasKeyFingerprint: !!this.keyFingerprint,\n mitmProtection: 'enabled',\n signatureVerified: true\n });\n \n // Update security features for initiator after successful key exchange\n this.securityFeatures.hasMutualAuth = true;\n this.securityFeatures.hasMetadataProtection = true;\n this.securityFeatures.hasEnhancedReplayProtection = true;\n this.securityFeatures.hasPFS = true;\n \n // PFS: Initialize key version tracking\n this.currentKeyVersion = 0;\n this.lastKeyRotation = Date.now();\n this.keyVersions.set(0, {\n salt: this.sessionSalt,\n timestamp: this.lastKeyRotation,\n messageCount: 0\n });\n \n this.onKeyExchange(this.keyFingerprint);\n\n // Compute SAS for MITM protection (Offer side - Answer handler)\n try {\n console.log('Starting SAS computation for Offer side (Answer handler)');\n const remoteFP = this._extractDTLSFingerprintFromSDP(answerData.sdp || answerData.s); // \u0443\u0436\u0435 \u0435\u0441\u0442\u044C \u0432 \u043A\u043E\u0434\u0435\n const localFP = this.expectedDTLSFingerprint; // \u0442\u044B \u0435\u0433\u043E \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0448\u044C \u043F\u0440\u0438 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u0438 \u043E\u0444\u0444\u0435\u0440\u0430/\u043E\u0442\u0432\u0435\u0442\u0430\n const keyBytes = this._decodeKeyFingerprint(this.keyFingerprint); // \u0443\u0442\u0438\u043B\u0438\u0442\u0430 \u0434\u0435\u043A\u043E\u0434\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\n console.log('SAS computation parameters:', { \n remoteFP: remoteFP ? remoteFP.substring(0, 16) + '...' : 'null/undefined', \n localFP: localFP ? localFP.substring(0, 16) + '...' : 'null/undefined', \n keyBytesLength: keyBytes ? keyBytes.length : 'null/undefined',\n keyBytesType: keyBytes ? keyBytes.constructor.name : 'null/undefined'\n });\n\n this.verificationCode = await this._computeSAS(keyBytes, localFP, remoteFP);\n this.onStatusChange?.('verifying'); // \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C SAS \u0438 \u0436\u0434\u0451\u043C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F\n this.onVerificationRequired(this.verificationCode);\n \n // CRITICAL: Store SAS code to send when data channel opens\n this.pendingSASCode = this.verificationCode;\n console.log('\uD83D\uDCE4 SAS code ready to send when data channel opens:', this.verificationCode);\n \n this._secureLog('info', 'SAS verification code generated for MITM protection (Offer side)', {\n sasCode: this.verificationCode,\n localFP: localFP.substring(0, 16) + '...',\n remoteFP: remoteFP.substring(0, 16) + '...',\n timestamp: Date.now()\n });\n } catch (sasError) {\n console.error('SAS computation failed in handleSecureAnswer (Offer side):', sasError);\n this._secureLog('error', 'SAS computation failed in handleSecureAnswer (Offer side)', {\n error: sasError.message,\n stack: sasError.stack,\n timestamp: Date.now()\n });\n }\n\n // Validate DTLS fingerprint before setting remote description\n if (this.strictDTLSValidation) {\n try {\n const receivedFingerprint = this._extractDTLSFingerprintFromSDP(answerData.sdp || answerData.s);\n \n if (this.expectedDTLSFingerprint) {\n this._validateDTLSFingerprint(receivedFingerprint, this.expectedDTLSFingerprint, 'answer_validation');\n } else {\n // Store fingerprint for future validation (first connection)\n this.expectedDTLSFingerprint = receivedFingerprint;\n this._secureLog('info', 'Stored DTLS fingerprint for future validation', {\n fingerprint: receivedFingerprint,\n context: 'first_connection'\n });\n }\n } catch (error) {\n this._secureLog('warn', 'DTLS fingerprint validation failed - continuing in fallback mode', { \n error: error.message,\n context: 'answer_validation'\n });\n\n }\n } else {\n this._secureLog('info', 'DTLS fingerprint validation disabled - proceeding without validation');\n }\n\n // Support both full and compact SDP field names\n const sdpData = answerData.sdp || answerData.s;\n \n this._secureLog('debug', 'Setting remote description from answer', {\n sdpLength: sdpData?.length || 0,\n usingCompactSDP: !answerData.sdp && !!answerData.s\n });\n \n await this.peerConnection.setRemoteDescription({\n type: 'answer',\n sdp: sdpData\n });\n \n this._secureLog('debug', 'Remote description set successfully from answer', {\n signalingState: this.peerConnection.signalingState\n });\n \n console.log('Enhanced secure connection established');\n\n setTimeout(async () => {\n try {\n const securityData = await this.calculateAndReportSecurityLevel();\n if (securityData) {\n console.log('\u2705 Security level calculated after connection:', securityData.level);\n this.notifySecurityUpdate();\n }\n } catch (error) {\n this._secureLog('error', '\u274C Error calculating security after connection:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }, 1000);\n setTimeout(async () => {\n if (!this.lastSecurityCalculation || this.lastSecurityCalculation.score < 50) {\n console.log('\uD83D\uDD04 Retrying security calculation...');\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpdate();\n }\n }, 3000);\n this.notifySecurityUpdate();\n } catch (error) {\n this._secureLog('error', 'Enhanced secure answer handling failed', {\n errorType: error.constructor.name\n });\n this.onStatusChange('failed');\n\n if (this.onAnswerError) {\n if (error.message.includes('too old') || error.message.includes('\u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0441\u0442\u0430\u0440\u044B\u0435')) {\n this.onAnswerError('replay_attack', error.message);\n } else if (error.message.includes('MITM') || error.message.includes('signature') || error.message.includes('\u043F\u043E\u0434\u043F\u0438\u0441\u044C')) {\n this.onAnswerError('security_violation', error.message);\n } else {\n this.onAnswerError('general_error', error.message);\n }\n }\n \n throw error;\n }\n }\n\n\n initiateVerification() {\n \n if (this.isInitiator) {\n // Ensure verification initiation notice wasn't already sent\n if (!this.verificationInitiationSent) {\n this.verificationInitiationSent = true;\n this.deliverMessageToUI('\uD83D\uDD10 CRITICAL: Compare verification code with peer out-of-band (voice/video/in-person) to prevent MITM attack!', 'system');\n this.deliverMessageToUI(`\uD83D\uDD10 Your verification code: ${this.verificationCode}`, 'system');\n this.deliverMessageToUI('\uD83D\uDD10 Ask peer to confirm this exact code before allowing traffic!', 'system');\n }\n } else {\n // Answer side: Wait for SAS code from Offer side\n console.log('\uD83D\uDCE5 Answer side: Waiting for SAS code from Offer side');\n this.deliverMessageToUI('\uD83D\uDCE5 Waiting for verification code from peer...', 'system');\n }\n }\n\n confirmVerification() {\n \n try {\n console.log('\uD83D\uDCE4 confirmVerification - sending local confirmation');\n \n // Mark local verification as confirmed\n this.localVerificationConfirmed = true;\n \n // Send confirmation to peer\n const confirmationPayload = {\n type: 'verification_confirmed',\n data: {\n timestamp: Date.now(),\n verificationMethod: 'SAS',\n securityLevel: 'MITM_PROTECTION_REQUIRED'\n }\n };\n \n console.log('\uD83D\uDCE4 Sending verification confirmation:', confirmationPayload);\n this.dataChannel.send(JSON.stringify(confirmationPayload));\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Check if both parties have confirmed\n this._checkBothVerificationsConfirmed();\n \n // Notify UI about local confirmation\n this.deliverMessageToUI('\u2705 You confirmed the verification code. Waiting for peer confirmation...', 'system');\n \n this.processMessageQueue();\n } catch (error) {\n this._secureLog('error', '\u274C SAS verification failed:', { errorType: error?.constructor?.name || 'Unknown' });\n this.deliverMessageToUI('\u274C SAS verification failed', 'system');\n }\n }\n\n _checkBothVerificationsConfirmed() {\n // Check if both parties have confirmed verification\n if (this.localVerificationConfirmed && this.remoteVerificationConfirmed && !this.bothVerificationsConfirmed) {\n console.log('\uD83C\uDF89 Both parties confirmed verification!');\n this.bothVerificationsConfirmed = true;\n \n // Notify both parties that verification is complete\n const bothConfirmedPayload = {\n type: 'verification_both_confirmed',\n data: {\n timestamp: Date.now(),\n verificationMethod: 'SAS',\n securityLevel: 'MITM_PROTECTION_COMPLETE'\n }\n };\n \n console.log('\uD83D\uDCE4 Sending both confirmed notification:', bothConfirmedPayload);\n this.dataChannel.send(JSON.stringify(bothConfirmedPayload));\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Set verified status and open chat after 2 second delay\n this.deliverMessageToUI('\uD83C\uDF89 Both parties confirmed! Opening secure chat in 2 seconds...', 'system');\n \n setTimeout(() => {\n this._setVerifiedStatus(true, 'MUTUAL_SAS_CONFIRMED', { \n code: this.verificationCode,\n timestamp: Date.now()\n });\n this._enforceVerificationGate('mutual_confirmed', false);\n this.onStatusChange?.('verified');\n }, 2000);\n }\n }\n\n handleVerificationConfirmed(data) {\n // Handle peer's verification confirmation\n console.log('\uD83D\uDCE5 Received verification confirmation from peer');\n this.remoteVerificationConfirmed = true;\n \n // Notify UI about peer confirmation\n this.deliverMessageToUI('\u2705 Peer confirmed the verification code. Waiting for your confirmation...', 'system');\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Check if both parties have confirmed\n this._checkBothVerificationsConfirmed();\n }\n\n handleVerificationBothConfirmed(data) {\n // Handle notification that both parties have confirmed\n console.log('\uD83D\uDCE5 Received both confirmed notification from peer');\n this.bothVerificationsConfirmed = true;\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Set verified status and open chat after 2 second delay\n this.deliverMessageToUI('\uD83C\uDF89 Both parties confirmed! Opening secure chat in 2 seconds...', 'system');\n \n setTimeout(() => {\n this._setVerifiedStatus(true, 'MUTUAL_SAS_CONFIRMED', { \n code: this.verificationCode,\n timestamp: Date.now()\n });\n this._enforceVerificationGate('mutual_confirmed', false);\n this.onStatusChange?.('verified');\n }, 2000);\n }\n\n handleVerificationRequest(data) {\n \n console.log('\uD83D\uDD0D handleVerificationRequest called with:');\n console.log(' - receivedCode:', data.code, '(type:', typeof data.code, ')');\n console.log(' - expectedCode:', this.verificationCode, '(type:', typeof this.verificationCode, ')');\n console.log(' - codesMatch:', data.code === this.verificationCode);\n console.log(' - data object:', data);\n \n if (data.code === this.verificationCode) {\n // \u2705 SAS verification successful - MITM protection confirmed\n const responsePayload = {\n type: 'verification_response',\n data: {\n ok: true,\n timestamp: Date.now(),\n verificationMethod: 'SAS', // Indicate SAS was used\n securityLevel: 'MITM_PROTECTED'\n }\n };\n this.dataChannel.send(JSON.stringify(responsePayload));\n \n // Ensure verification success notice wasn't already sent\n if (!this.verificationNotificationSent) {\n this.verificationNotificationSent = true;\n this.deliverMessageToUI('\u2705 SAS verification successful! MITM protection confirmed. Channel is now secure!', 'system');\n }\n \n this.processMessageQueue();\n } else {\n // \u274C SAS verification failed - possible MITM attack\n console.log('\u274C SAS verification failed - codes do not match, disconnecting');\n const responsePayload = {\n type: 'verification_response',\n data: {\n ok: false,\n timestamp: Date.now(),\n reason: 'code_mismatch'\n }\n };\n this.dataChannel.send(JSON.stringify(responsePayload));\n \n this._secureLog('error', 'SAS verification failed - possible MITM attack', {\n receivedCode: data.code,\n expectedCode: this.verificationCode,\n timestamp: Date.now()\n });\n \n this.deliverMessageToUI('\u274C SAS verification failed! Possible MITM attack detected. Connection aborted for safety!', 'system');\n this.disconnect();\n }\n }\n\n handleSASCode(data) {\n \n console.log('\uD83D\uDCE5 Received SAS code from Offer side:', data.code);\n \n this.verificationCode = data.code;\n this.onStatusChange?.('verifying'); // \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C SAS \u0438 \u0436\u0434\u0451\u043C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F\n this.onVerificationRequired(this.verificationCode);\n \n this._secureLog('info', 'SAS code received from Offer side', {\n sasCode: this.verificationCode,\n timestamp: Date.now()\n });\n }\n\n handleVerificationResponse(data) {\n \n if (data.ok === true) {\n \n // Log successful mutual SAS verification\n this._secureLog('info', 'Mutual SAS verification completed - MITM protection active', {\n verificationMethod: data.verificationMethod || 'SAS',\n securityLevel: data.securityLevel || 'MITM_PROTECTED',\n timestamp: Date.now()\n });\n \n // Ensure verification success notice wasn't already sent\n if (!this.verificationNotificationSent) {\n this.verificationNotificationSent = true;\n this.deliverMessageToUI('\u2705 Mutual SAS verification complete! MITM protection active. Channel is now secure!', 'system');\n }\n \n this.processMessageQueue();\n } else {\n // \u274C Peer verification failed - connection not secure\n this._secureLog('error', 'Peer SAS verification failed - connection not secure', {\n responseData: data,\n timestamp: Date.now()\n });\n \n this.deliverMessageToUI('\u274C Peer verification failed! Connection not secure!', 'system');\n this.disconnect();\n }\n }\n\n validateOfferData(offerData) {\n return offerData &&\n offerData.type === 'enhanced_secure_offer' &&\n offerData.sdp &&\n offerData.publicKey &&\n offerData.salt &&\n offerData.verificationCode &&\n Array.isArray(offerData.publicKey) &&\n Array.isArray(offerData.salt) &&\n offerData.salt.length === 32;\n }\n\n validateEnhancedOfferData(offerData) {\n console.log('\uD83C\uDFAF validateEnhancedOfferData called with:', offerData ? 'valid object' : 'null/undefined');\n try {\n // CRITICAL: Strict type checking to prevent syntax errors\n if (!offerData || typeof offerData !== 'object' || Array.isArray(offerData)) {\n this._secureLog('error', 'CRITICAL: Invalid offer data structure', { \n hasOfferData: !!offerData,\n offerDataType: typeof offerData,\n isArray: Array.isArray(offerData)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Offer data must be a non-null object');\n }\n\n // Basic required fields will be validated after format detection\n\n // Check if this is v4.0 compact format or legacy format\n const isV4CompactFormat = offerData.v === '4.0' && offerData.e && offerData.d;\n const isV4Format = offerData.version === '4.0' && offerData.ecdhPublicKey && offerData.ecdsaPublicKey;\n \n // Validate offer type (support compact, legacy v3.0 and v4.0 formats)\n const isValidType = isV4CompactFormat ? \n ['offer'].includes(offerData.t) :\n ['enhanced_secure_offer', 'secure_offer'].includes(offerData.type);\n \n if (!isValidType) {\n throw new Error('Invalid offer type');\n }\n \n if (isV4CompactFormat) {\n // v4.0 compact format validation\n const compactRequiredFields = [\n 'e', 'd', 'sl', 'vc', 'si', 'ci', 'ac', 'slv'\n ];\n \n for (const field of compactRequiredFields) {\n if (!offerData[field]) {\n throw new Error(`Missing required v4.0 compact field: ${field}`);\n }\n }\n \n // Validate key structures\n if (!offerData.e || typeof offerData.e !== 'object' || Array.isArray(offerData.e)) {\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDH public key structure');\n }\n \n if (!offerData.d || typeof offerData.d !== 'object' || Array.isArray(offerData.d)) {\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDSA public key structure');\n }\n \n // Validate salt length\n if (!Array.isArray(offerData.sl) || offerData.sl.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes for v4.0');\n }\n \n // Validate verification code format\n if (typeof offerData.vc !== 'string' || offerData.vc.length < 6) {\n throw new Error('Invalid verification code format');\n }\n \n // Validate security level\n if (!['MAX', 'HIGH', 'MED', 'LOW'].includes(offerData.slv)) {\n throw new Error('Invalid security level');\n }\n \n // Validate timestamp (not older than 1 hour)\n const offerAge = Date.now() - offerData.ts;\n if (offerAge > 3600000) {\n throw new Error('Offer is too old (older than 1 hour)');\n }\n \n this._secureLog('info', 'v4.0 compact offer validation passed', {\n version: offerData.v,\n hasECDH: !!offerData.e,\n hasECDSA: !!offerData.d,\n hasSalt: !!offerData.sl,\n hasVerificationCode: !!offerData.vc,\n securityLevel: offerData.slv,\n offerAge: Math.round(offerAge / 1000) + 's'\n });\n } else if (isV4Format) {\n // v4.0 enhanced validation\n const v4RequiredFields = [\n 'ecdhPublicKey', 'ecdsaPublicKey', 'salt', 'verificationCode',\n 'authChallenge', 'timestamp', 'version', 'securityLevel'\n ];\n\n for (const field of v4RequiredFields) {\n if (!offerData[field]) {\n throw new Error(`Missing v4.0 field: ${field}`);\n }\n }\n\n // Validate salt (must be 64 bytes for v4.0)\n if (!Array.isArray(offerData.salt) || offerData.salt.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes for v4.0');\n }\n\n // Validate timestamp (not older than 1 hour)\n const offerAge = Date.now() - offerData.timestamp;\n if (offerAge > 3600000) {\n throw new Error('Offer is too old (older than 1 hour)');\n }\n\n // CRITICAL: Strict validation of key structures to prevent syntax errors\n if (!offerData.ecdhPublicKey || typeof offerData.ecdhPublicKey !== 'object' || Array.isArray(offerData.ecdhPublicKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDH public key structure', { \n hasEcdhKey: !!offerData.ecdhPublicKey,\n ecdhKeyType: typeof offerData.ecdhPublicKey,\n isArray: Array.isArray(offerData.ecdhPublicKey)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDH public key structure - hard abort required');\n }\n\n if (!offerData.ecdsaPublicKey || typeof offerData.ecdsaPublicKey !== 'object' || Array.isArray(offerData.ecdsaPublicKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDSA public key structure', { \n hasEcdsaKey: !!offerData.ecdsaPublicKey,\n ecdsaKeyType: typeof offerData.ecdsaPublicKey,\n isArray: Array.isArray(offerData.ecdsaPublicKey)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDSA public key structure - hard abort required');\n }\n\n // CRITICAL: Validate key internal structure to prevent syntax errors\n if (!offerData.ecdhPublicKey.keyData || !offerData.ecdhPublicKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key missing keyData or signature', { \n hasKeyData: !!offerData.ecdhPublicKey.keyData,\n hasSignature: !!offerData.ecdhPublicKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key missing keyData or signature');\n }\n\n if (!offerData.ecdsaPublicKey.keyData || !offerData.ecdsaPublicKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key missing keyData or signature', { \n hasKeyData: !!offerData.ecdsaPublicKey.keyData,\n hasSignature: !!offerData.ecdsaPublicKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key missing keyData or signature');\n }\n\n if (typeof offerData.verificationCode !== 'string' || offerData.verificationCode.length < 6) {\n throw new Error('Invalid SAS verification code format - MITM protection required');\n }\n\n this._secureLog('info', 'v4.0 offer validation passed', {\n version: offerData.version,\n hasSecurityLevel: !!offerData.securityLevel?.level,\n offerAge: Math.round(offerAge / 1000) + 's'\n });\n } else {\n // v3.0 backward compatibility validation\n // NOTE: v3.0 has limited security - SAS verification is still critical\n const v3RequiredFields = ['publicKey', 'salt', 'verificationCode'];\n for (const field of v3RequiredFields) {\n if (!offerData[field]) {\n throw new Error(`Missing v3.0 field: ${field}`);\n }\n }\n\n // Validate salt (32 bytes for v3.0)\n if (!Array.isArray(offerData.salt) || offerData.salt.length !== 32) {\n throw new Error('Salt must be exactly 32 bytes for v3.0');\n }\n\n // Validate public key\n if (!Array.isArray(offerData.publicKey)) {\n throw new Error('Invalid public key format for v3.0');\n }\n\n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'v3.0 offer validation passed (backward compatibility)', {\n version: 'v3.0',\n legacy: true\n });\n }\n\n // Validate SDP structure (basic check for all versions)\n const sdp = isV4CompactFormat ? offerData.s : offerData.sdp;\n if (typeof sdp !== 'string' || !sdp.includes('v=0')) {\n throw new Error('Invalid SDP structure');\n }\n\n console.log('\uD83C\uDFAF validateEnhancedOfferData completed successfully');\n return true;\n } catch (error) {\n console.log('\uD83C\uDFAF validateEnhancedOfferData ERROR:', error.message);\n this._secureLog('error', 'CRITICAL: Security validation failed - hard abort required', {\n error: error.message,\n errorType: error.constructor.name,\n timestamp: Date.now()\n });\n\n throw new Error(`CRITICAL SECURITY VALIDATION FAILURE: ${error.message}`);\n }\n }\n\n async sendSecureMessage(message) {\n // Comprehensive input validation\n const validation = this._validateInputData(message, 'sendSecureMessage');\n if (!validation.isValid) {\n const errorMessage = `Input validation failed: ${validation.errors.join(', ')}`;\n this._secureLog('error', '\u274C Input validation failed in sendSecureMessage', {\n errors: validation.errors,\n messageType: typeof message\n });\n throw new Error(errorMessage);\n }\n\n // Rate limiting check\n if (!this._checkRateLimit('sendSecureMessage')) {\n throw new Error('Rate limit exceeded for secure message sending');\n }\n\n // Enforce verification gate\n this._enforceVerificationGate('sendSecureMessage');\n\n // Quick readiness check WITHOUT mutex\n if (!this.isConnected()) {\n if (validation.sanitizedData && typeof validation.sanitizedData === 'object' && validation.sanitizedData.type && validation.sanitizedData.type.startsWith('file_')) {\n throw new Error('Connection not ready for file transfer. Please ensure the connection is established and verified.');\n }\n this.messageQueue.push(validation.sanitizedData);\n throw new Error('Connection not ready. Message queued for sending.');\n }\n \n // Use mutex ONLY for cryptographic operations\n return this._withMutex('cryptoOperation', async (operationId) => {\n // Re-check inside critical section\n if (!this.isConnected() || !this.isVerified) {\n throw new Error('Connection lost during message preparation');\n }\n \n // Validate keys inside critical section\n if (!this.encryptionKey || !this.macKey || !this.metadataKey) {\n throw new Error('Encryption keys not initialized');\n }\n \n // Additional rate limiting check\n if (!window.EnhancedSecureCryptoUtils.rateLimiter.checkMessageRate(this.rateLimiterId)) {\n throw new Error('Message rate limit exceeded (60 messages per minute)');\n }\n \n try {\n // Accept strings and objects; stringify objects\n const textToSend = typeof validation.sanitizedData === 'string' ? validation.sanitizedData : JSON.stringify(validation.sanitizedData);\n const sanitizedMessage = window.EnhancedSecureCryptoUtils.sanitizeMessage(textToSend);\n const messageId = `msg_${Date.now()}_${this.messageCounter++}`;\n \n // Create AAD with sequence number for anti-replay protection\n if (typeof this._createMessageAAD !== 'function') {\n throw new Error('_createMessageAAD method is not available in sendSecureMessage. Manager may not be fully initialized.');\n }\n const aad = message.aad || this._createMessageAAD('enhanced_message', { content: sanitizedMessage });\n \n // Use enhanced encryption with AAD and sequence number\n const encryptedData = await window.EnhancedSecureCryptoUtils.encryptMessage(\n sanitizedMessage,\n this.encryptionKey,\n this.macKey,\n this.metadataKey,\n messageId,\n JSON.parse(aad).sequenceNumber // Use sequence number from AAD\n );\n \n const payload = {\n type: 'enhanced_message',\n data: encryptedData,\n keyVersion: this.currentKeyVersion,\n version: '4.0'\n };\n \n this.dataChannel.send(JSON.stringify(payload));\n // Locally display only plain strings to avoid UI duplication\n if (typeof validation.sanitizedData === 'string') {\n this.deliverMessageToUI(validation.sanitizedData, 'sent');\n }\n \n this._secureLog('debug', '\uD83D\uDCE4 Secure message sent successfully', {\n operationId: operationId,\n messageLength: sanitizedMessage.length,\n keyVersion: this.currentKeyVersion\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Secure message sending failed', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n throw error;\n }\n }, 2000); // Reduced timeout for crypto operations\n }\n\n processMessageQueue() {\n while (this.messageQueue.length > 0 && this.isConnected() && this.isVerified) {\n const message = this.messageQueue.shift();\n this.sendSecureMessage(message).catch(console.error);\n }\n }\n\n startHeartbeat() {\n // Heartbeat moved to unified scheduler with connection validation\n this._secureLog('info', '\uD83D\uDD27 Heartbeat moved to unified scheduler');\n \n // Store heartbeat configuration for scheduler\n this._heartbeatConfig = {\n enabled: true,\n interval: EnhancedSecureWebRTCManager.TIMEOUTS.HEARTBEAT_INTERVAL,\n lastHeartbeat: 0\n };\n }\n\n stopHeartbeat() {\n // Heartbeat stopped via unified scheduler\n if (this._heartbeatConfig) {\n this._heartbeatConfig.enabled = false;\n }\n }\n\n /**\n * Stop all active timers and cleanup scheduler\n */\n _stopAllTimers() {\n this._secureLog('info', '\uD83D\uDD27 Stopping all timers and cleanup scheduler');\n \n // Stop maintenance scheduler\n if (this._maintenanceScheduler) {\n clearInterval(this._maintenanceScheduler);\n this._maintenanceScheduler = null;\n }\n \n // Stop heartbeat\n if (this._heartbeatConfig) {\n this._heartbeatConfig.enabled = false;\n }\n \n // Clear all timer references\n if (this._activeTimers) {\n this._activeTimers.forEach(timer => {\n if (timer) clearInterval(timer);\n });\n this._activeTimers.clear();\n }\n \n this._secureLog('info', '\u2705 All timers stopped successfully');\n }\n\n handleHeartbeat() {\n console.log('Heartbeat received - connection alive');\n }\n\n waitForIceGathering() {\n return new Promise((resolve) => {\n if (this.peerConnection.iceGatheringState === 'complete') {\n resolve();\n return;\n }\n\n const checkState = () => {\n if (this.peerConnection && this.peerConnection.iceGatheringState === 'complete') {\n this.peerConnection.removeEventListener('icegatheringstatechange', checkState);\n resolve();\n }\n };\n \n this.peerConnection.addEventListener('icegatheringstatechange', checkState);\n \n setTimeout(() => {\n if (this.peerConnection) {\n this.peerConnection.removeEventListener('icegatheringstatechange', checkState);\n }\n resolve();\n }, EnhancedSecureWebRTCManager.TIMEOUTS.ICE_GATHERING_TIMEOUT);\n });\n }\n\n retryConnection() {\n console.log(`Retrying connection (attempt ${this.connectionAttempts}/${this.maxConnectionAttempts})`);\n this.onStatusChange('retrying');\n }\n\n isConnected() {\n const hasDataChannel = !!this.dataChannel;\n const dataChannelState = this.dataChannel?.readyState;\n const isDataChannelOpen = dataChannelState === 'open';\n const isVerified = this.isVerified;\n const connectionState = this.peerConnection?.connectionState;\n \n return this.dataChannel && this.dataChannel.readyState === 'open' && this.isVerified;\n }\n\n getConnectionInfo() {\n return {\n fingerprint: this.keyFingerprint,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n connectionState: this.peerConnection?.connectionState,\n iceConnectionState: this.peerConnection?.iceConnectionState,\n verificationCode: this.verificationCode\n };\n }\n\n disconnect() {\n // Stop all timers first\n this._stopAllTimers();\n \n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n }\n this.intentionalDisconnect = true;\n \n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Starting intentional disconnect');\n\n this.sendDisconnectNotification();\n\n setTimeout(() => {\n this.sendDisconnectNotification(); \n }, 100);\n\n document.dispatchEvent(new CustomEvent('peer-disconnect', {\n detail: { \n reason: 'user_disconnect',\n timestamp: Date.now()\n }\n }));\n }\n \n handleUnexpectedDisconnect() {\n this.sendDisconnectNotification();\n this.isVerified = false;\n \n // Ensure disconnect notification wasn't already sent\n if (!this.disconnectNotificationSent) {\n this.disconnectNotificationSent = true;\n this.deliverMessageToUI('\uD83D\uDD0C Connection lost. Attempting to reconnect...', 'system');\n }\n \n // Cleanup file transfer system on unexpected disconnect\n if (this.fileTransferSystem) {\n console.log('\uD83E\uDDF9 Cleaning up file transfer system on unexpected disconnect...');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n document.dispatchEvent(new CustomEvent('peer-disconnect', {\n detail: { \n reason: 'connection_lost',\n timestamp: Date.now()\n }\n }));\n\n }\n \n sendDisconnectNotification() {\n try {\n if (this.dataChannel && this.dataChannel.readyState === 'open') {\n const notification = {\n type: 'peer_disconnect',\n timestamp: Date.now(),\n reason: this.intentionalDisconnect ? 'user_disconnect' : 'connection_lost'\n };\n\n for (let i = 0; i < 3; i++) {\n try {\n this.dataChannel.send(JSON.stringify(notification));\n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Disconnect notification sent', {\n reason: notification.reason,\n attempt: i + 1\n });\n break;\n } catch (sendError) {\n if (i === 2) { \n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Failed to send disconnect notification', {\n error: sendError.message\n });\n }\n }\n }\n }\n } catch (error) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Could not send disconnect notification', {\n error: error.message\n });\n }\n }\n \n attemptReconnection() {\n // Ensure reconnection-failed notification wasn't already sent\n if (!this.reconnectionFailedNotificationSent) {\n this.reconnectionFailedNotificationSent = true;\n this.deliverMessageToUI('\u274C Unable to reconnect. A new connection is required.', 'system');\n }\n\n }\n \n handlePeerDisconnectNotification(data) {\n const reason = data.reason || 'unknown';\n const reasonText = reason === 'user_disconnect' ? 'manually disconnected.' : 'connection lost.';\n \n // Ensure peer-disconnect notification wasn't already sent\n if (!this.peerDisconnectNotificationSent) {\n this.peerDisconnectNotificationSent = true;\n this.deliverMessageToUI(`\uD83D\uDC4B Peer ${reasonText}`, 'system');\n }\n \n this.onStatusChange('peer_disconnected');\n \n this.intentionalDisconnect = false;\n this.isVerified = false;\n this.stopHeartbeat();\n \n this.onKeyExchange(''); \n this.onVerificationRequired(''); \n\n document.dispatchEvent(new CustomEvent('peer-disconnect', {\n detail: { \n reason: reason,\n timestamp: Date.now()\n }\n }));\n\n setTimeout(() => {\n this.disconnect();\n }, 2000);\n \n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Peer disconnect notification processed', {\n reason: reason\n });\n }\n \n /**\n * Secure disconnect with complete memory cleanup\n */\n disconnect() {\n this.stopHeartbeat();\n this.isVerified = false;\n this.processedMessageIds.clear();\n this.messageCounter = 0;\n \n // Secure cleanup of cryptographic materials\n this._secureCleanupCryptographicMaterials();\n \n // Secure wipe of PFS key versions\n this.keyVersions.clear();\n this.oldKeys.clear();\n this.currentKeyVersion = 0;\n this.lastKeyRotation = Date.now();\n \n // Reset message counters\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.replayWindow.clear(); // Clear replay window\n \n // Reset security features\n this.securityFeatures = {\n hasEncryption: true,\n hasECDH: true,\n hasECDSA: true, \n hasMutualAuth: true, \n hasMetadataProtection: true, \n hasEnhancedReplayProtection: true, \n hasNonExtractableKeys: true, \n hasRateLimiting: true, \n hasEnhancedValidation: true, \n hasPFS: true \n };\n \n // Close connections\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Secure wipe of message queue\n if (this.messageQueue && this.messageQueue.length > 0) {\n this.messageQueue.forEach((message, index) => {\n this._secureWipeMemory(message, `messageQueue[${index}]`);\n });\n this.messageQueue = [];\n }\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n document.dispatchEvent(new CustomEvent('connection-cleaned', {\n detail: { \n timestamp: Date.now(),\n reason: this.intentionalDisconnect ? 'user_cleanup' : 'automatic_cleanup'\n }\n }));\n\n // Notify UI about complete cleanup\n this.onStatusChange('disconnected');\n this.onKeyExchange('');\n this.onVerificationRequired('');\n \n this._secureLog('info', '\uD83D\uDD12 Connection securely cleaned up with complete memory wipe');\n \n // Reset the intentional disconnect flag\n this.intentionalDisconnect = false;\n }\n // Public method to send files\n async sendFile(file) {\n // Enforce verification gate for file transfers\n this._enforceVerificationGate('sendFile');\n \n if (!this.isConnected()) {\n throw new Error('Connection not ready for file transfer. Please ensure the connection is established.');\n }\n\n if (!this.fileTransferSystem) {\n console.log('\uD83D\uDD04 File transfer system not initialized, attempting to initialize...');\n this.initializeFileTransfer();\n \n // Allow time for initialization\n await new Promise(resolve => setTimeout(resolve, 500));\n \n if (!this.fileTransferSystem) {\n throw new Error('File transfer system could not be initialized. Please try reconnecting.');\n }\n }\n\n // Verify key readiness\n if (!this.encryptionKey || !this.macKey) {\n throw new Error('Encryption keys not ready. Please wait for connection to be fully established.');\n }\n\n // Debug logging for file transfer system\n console.log('\uD83D\uDD0D Debug: File transfer system in sendFile:', {\n hasFileTransferSystem: !!this.fileTransferSystem,\n fileTransferSystemType: this.fileTransferSystem.constructor?.name,\n hasWebrtcManager: !!this.fileTransferSystem.webrtcManager,\n webrtcManagerType: this.fileTransferSystem.webrtcManager?.constructor?.name\n });\n\n try {\n console.log('\uD83D\uDE80 Starting file transfer for:', file.name, `(${(file.size / 1024 / 1024).toFixed(2)} MB)`);\n const fileId = await this.fileTransferSystem.sendFile(file);\n console.log('\u2705 File transfer initiated successfully with ID:', fileId);\n return fileId;\n } catch (error) {\n this._secureLog('error', '\u274C File transfer error:', { errorType: error?.constructor?.name || 'Unknown' });\n \n // Re-throw with a clearer message\n if (error.message.includes('Connection not ready')) {\n throw new Error('Connection not ready for file transfer. Check connection status.');\n } else if (error.message.includes('Encryption keys not initialized')) {\n throw new Error('Encryption keys not initialized. Try reconnecting.');\n } else if (error.message.includes('Transfer timeout')) {\n throw new Error('File transfer timeout. Check connection and try again.');\n } else {\n throw error;\n }\n }\n }\n\n // Get active file transfers\n getFileTransfers() {\n if (!this.fileTransferSystem) {\n return { sending: [], receiving: [] };\n }\n \n try {\n // Check available methods in file transfer system\n let sending = [];\n let receiving = [];\n \n if (typeof this.fileTransferSystem.getActiveTransfers === 'function') {\n sending = this.fileTransferSystem.getActiveTransfers();\n } else {\n this._secureLog('warn', '\u26A0\uFE0F getActiveTransfers method not available in file transfer system');\n }\n \n if (typeof this.fileTransferSystem.getReceivingTransfers === 'function') {\n receiving = this.fileTransferSystem.getReceivingTransfers();\n } else {\n this._secureLog('warn', '\u26A0\uFE0F getReceivingTransfers method not available in file transfer system');\n }\n \n return {\n sending: sending || [],\n receiving: receiving || []\n };\n } catch (error) {\n this._secureLog('error', '\u274C Error getting file transfers:', { errorType: error?.constructor?.name || 'Unknown' });\n return { sending: [], receiving: [] };\n }\n }\n\n // Get file transfer system status\n getFileTransferStatus() {\n if (!this.fileTransferSystem) {\n return {\n initialized: false,\n status: 'not_initialized',\n message: 'File transfer system not initialized'\n };\n }\n \n const activeTransfers = this.fileTransferSystem.getActiveTransfers();\n const receivingTransfers = this.fileTransferSystem.getReceivingTransfers();\n \n return {\n initialized: true,\n status: 'ready',\n activeTransfers: activeTransfers.length,\n receivingTransfers: receivingTransfers.length,\n totalTransfers: activeTransfers.length + receivingTransfers.length\n };\n }\n\n // Cancel file transfer\n cancelFileTransfer(fileId) {\n if (!this.fileTransferSystem) return false;\n return this.fileTransferSystem.cancelTransfer(fileId);\n }\n\n // Force cleanup of file transfer system\n cleanupFileTransferSystem() {\n if (this.fileTransferSystem) {\n console.log('\uD83E\uDDF9 Force cleaning up file transfer system...');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n return true;\n }\n return false;\n }\n\n // Reinitialize file transfer system\n reinitializeFileTransfer() {\n try {\n console.log('\uD83D\uDD04 Reinitializing file transfer system...');\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n }\n this.initializeFileTransfer();\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to reinitialize file transfer system:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n\n // Set file transfer callbacks\n setFileTransferCallbacks(onProgress, onReceived, onError) {\n this.onFileProgress = onProgress;\n this.onFileReceived = onReceived;\n this.onFileError = onError;\n \n console.log('\uD83D\uDD27 File transfer callbacks set:', {\n hasProgress: !!onProgress,\n hasReceived: !!onReceived,\n hasError: !!onError\n });\n \n // Reinitialize file transfer system if it exists to update callbacks\n if (this.fileTransferSystem) {\n console.log('\uD83D\uDD04 Reinitializing file transfer system with new callbacks...');\n this.initializeFileTransfer();\n }\n }\n\n // ============================================\n // SESSION ACTIVATION HANDLING\n // ============================================\n\n async handleSessionActivation(sessionData) {\n try {\n console.log('\uD83D\uDD10 Handling session activation:', sessionData);\n \n // Update session state\n this.currentSession = sessionData;\n this.sessionManager = sessionData.sessionManager;\n \n // FIX: More lenient checks for activation\n const hasKeys = !!(this.encryptionKey && this.macKey);\n const hasSession = !!(this.sessionManager && (this.sessionManager.hasActiveSession?.() || sessionData.sessionId));\n \n console.log('\uD83D\uDD0D Session activation status:', {\n hasKeys: hasKeys,\n hasSession: hasSession,\n sessionType: sessionData.sessionType,\n isDemo: sessionData.isDemo\n });\n \n // Force connection status if there is an active session\n if (hasSession) {\n console.log('\uD83D\uDD13 Session activated - forcing connection status to connected');\n this.onStatusChange('connected');\n \n console.log('\u26A0\uFE0F Session activated but NOT verified - cryptographic verification still required');\n }\n\n setTimeout(() => {\n try {\n this.initializeFileTransfer();\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F File transfer initialization failed during session activation:', { details: error.message });\n }\n }, 1000);\n \n console.log('\u2705 Session activation handled successfully');\n \n if (this.fileTransferSystem && this.isConnected()) {\n console.log('\uD83D\uDD04 Synchronizing file transfer keys after session activation...');\n \n if (typeof this.fileTransferSystem.onSessionUpdate === 'function') {\n this.fileTransferSystem.onSessionUpdate({\n keyFingerprint: this.keyFingerprint,\n sessionSalt: this.sessionSalt,\n hasMacKey: !!this.macKey\n });\n }\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to handle session activation:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n // Method to check readiness of file transfers\ncheckFileTransferReadiness() {\n const status = {\n hasFileTransferSystem: !!this.fileTransferSystem,\n hasDataChannel: !!this.dataChannel,\n dataChannelState: this.dataChannel?.readyState,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n ready: false\n };\n \n status.ready = status.hasFileTransferSystem && \n status.hasDataChannel && \n status.dataChannelState === 'open' && \n status.isConnected && \n status.isVerified;\n \n console.log('\uD83D\uDD0D File transfer readiness check:', status);\n return status;\n }\n\n // Method to force re-initialize file transfer system\n forceReinitializeFileTransfer() {\n try {\n console.log('\uD83D\uDD04 Force reinitializing file transfer system...');\n \n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n // Small delay before reinitialization\n setTimeout(() => {\n this.initializeFileTransfer();\n }, 500);\n \n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to force reinitialize file transfer:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n\n // Method to get diagnostic information\n getFileTransferDiagnostics() {\n const diagnostics = {\n timestamp: new Date().toISOString(),\n webrtcManager: {\n hasDataChannel: !!this.dataChannel,\n dataChannelState: this.dataChannel?.readyState,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n isInitiator: this.isInitiator,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n hasMetadataKey: !!this.metadataKey,\n hasKeyFingerprint: !!this.keyFingerprint,\n hasSessionSalt: !!this.sessionSalt\n },\n fileTransferSystem: null,\n globalState: {\n fileTransferActive: this._fileTransferActive || false,\n hasFileTransferSystem: !!this.fileTransferSystem,\n fileTransferSystemType: this.fileTransferSystem ? 'EnhancedSecureFileTransfer' : 'none'\n }\n };\n \n if (this.fileTransferSystem) {\n try {\n diagnostics.fileTransferSystem = this.fileTransferSystem.getSystemStatus();\n } catch (error) {\n diagnostics.fileTransferSystem = { error: error.message };\n }\n }\n \n return diagnostics;\n }\n\n getSupportedFileTypes() {\n if (!this.fileTransferSystem) {\n return { error: 'File transfer system not initialized' };\n }\n \n try {\n return this.fileTransferSystem.getSupportedFileTypes();\n } catch (error) {\n return { error: error.message };\n }\n }\n\n validateFile(file) {\n if (!this.fileTransferSystem) {\n return { \n isValid: false, \n errors: ['File transfer system not initialized'],\n fileType: null,\n fileSize: file?.size || 0,\n formattedSize: '0 B'\n };\n }\n \n try {\n return this.fileTransferSystem.validateFile(file);\n } catch (error) {\n return { \n isValid: false, \n errors: [error.message],\n fileType: null,\n fileSize: file?.size || 0,\n formattedSize: '0 B'\n };\n }\n }\n\n getFileTypeInfo() {\n if (!this.fileTransferSystem) {\n return { error: 'File transfer system not initialized' };\n }\n \n try {\n return this.fileTransferSystem.getFileTypeInfo();\n } catch (error) {\n return { error: error.message };\n }\n }\n\n async forceInitializeFileTransfer(options = {}) {\n const abortController = new AbortController();\n const { signal = abortController.signal, timeout = 6000 } = options;\n\n if (signal && signal !== abortController.signal) {\n signal.addEventListener('abort', () => abortController.abort());\n }\n try {\n if (!this.isVerified) {\n throw new Error('Connection not verified');\n }\n \n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n throw new Error('Data channel not open');\n }\n \n if (!this.encryptionKey || !this.macKey) {\n throw new Error('Encryption keys not ready');\n }\n\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n\n this.initializeFileTransfer();\n\n let attempts = 0;\n const maxAttempts = 50;\n const checkInterval = 100; \n const maxWaitTime = maxAttempts * checkInterval; \n\n const initializationPromise = new Promise((resolve, reject) => {\n const checkInitialization = () => {\n if (abortController.signal.aborted) {\n reject(new Error('Operation cancelled'));\n return;\n }\n \n if (this.fileTransferSystem) {\n resolve(true);\n return;\n }\n \n if (attempts >= maxAttempts) {\n reject(new Error(`Initialization timeout after ${maxWaitTime}ms`));\n return;\n }\n \n attempts++;\n setTimeout(checkInitialization, checkInterval);\n };\n \n checkInitialization();\n });\n\n await Promise.race([\n initializationPromise,\n new Promise((_, reject) => \n setTimeout(() => reject(new Error(`Global timeout after ${timeout}ms`)), timeout)\n )\n ]);\n \n if (this.fileTransferSystem) {\n return true;\n } else {\n throw new Error('Force initialization timeout');\n }\n \n } catch (error) {\n if (error.name === 'AbortError' || error.message.includes('cancelled')) {\n this._secureLog('info', '\u23F9\uFE0F File transfer initialization cancelled by user');\n return { cancelled: true };\n }\n \n this._secureLog('error', '\u274C Force file transfer initialization failed:', { \n errorType: error?.constructor?.name || 'Unknown',\n message: error.message,\n attempts: attempts\n });\n return { error: error.message, attempts: attempts };\n }\n }\n\n cancelFileTransferInitialization() {\n try {\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n this._fileTransferActive = false;\n this._secureLog('info', '\u23F9\uFE0F File transfer initialization cancelled');\n return true;\n }\n return false;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to cancel file transfer initialization:', { \n errorType: error?.constructor?.name || 'Unknown' \n });\n return false;\n }\n }\n \n getFileTransferSystemStatus() {\n if (!this.fileTransferSystem) {\n return { available: false, status: 'not_initialized' };\n }\n \n try {\n const status = this.fileTransferSystem.getSystemStatus();\n return {\n available: true,\n status: status.status || 'unknown',\n activeTransfers: status.activeTransfers || 0,\n receivingTransfers: status.receivingTransfers || 0,\n systemType: 'EnhancedSecureFileTransfer'\n };\n } catch (error) {\n this._secureLog('error', '\u274C Failed to get file transfer system status:', { \n errorType: error?.constructor?.name || 'Unknown' \n });\n return { available: false, status: 'error', error: error.message };\n }\n }\n\n _validateNestedEncryptionSecurity() {\n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey) {\n // Test secure IV generation with reuse prevention\n try {\n const testIV1 = this._generateSecureIV(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE, 'securityTest1');\n const testIV2 = this._generateSecureIV(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE, 'securityTest2');\n \n // Verify IVs are different and properly tracked\n if (testIV1.every((byte, index) => byte === testIV2[index])) {\n this._secureLog('error', '\u274C CRITICAL: Nested encryption security validation failed - IVs are identical!');\n return false;\n }\n \n // Verify IV tracking system is working\n const stats = this._getIVTrackingStats();\n if (stats.totalIVs < 2) {\n this._secureLog('error', '\u274C CRITICAL: IV tracking system not working properly');\n return false;\n }\n \n this._secureLog('info', '\u2705 Nested encryption security validation passed - secure IV generation working');\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C CRITICAL: Nested encryption security validation failed:', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n return false;\n }\n }\n return true;\n }\n}\n\nclass SecureKeyStorage {\n constructor() {\n // Use WeakMap for automatic garbage collection of unused keys\n this._keyStore = new WeakMap();\n this._keyMetadata = new Map(); // Metadata doesn't need WeakMap\n this._keyReferences = new Map(); // Strong references for active keys\n \n // Master encryption key for storage encryption\n this._storageMasterKey = null;\n this._initializeStorageMaster();\n\n setTimeout(() => {\n if (!this.validateStorageIntegrity()) {\n console.error('\u274C CRITICAL: Key storage integrity check failed');\n }\n }, 100);\n \n }\n\n async _initializeStorageMaster() {\n // Generate a master key for encrypting stored keys\n this._storageMasterKey = await crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt', 'decrypt']\n );\n }\n\n async storeKey(keyId, cryptoKey, metadata = {}) {\n if (!(cryptoKey instanceof CryptoKey)) {\n throw new Error('Only CryptoKey objects can be stored');\n }\n\n try {\n // For non-extractable keys, we can only store a reference\n if (!cryptoKey.extractable) {\n // Store the key reference directly without encryption\n this._keyReferences.set(keyId, cryptoKey);\n this._keyMetadata.set(keyId, {\n ...metadata,\n created: Date.now(),\n lastAccessed: Date.now(),\n extractable: false,\n encrypted: false // Mark as not encrypted\n });\n return true;\n }\n\n // For extractable keys, proceed with encryption\n const keyData = await crypto.subtle.exportKey('jwk', cryptoKey);\n const encryptedKeyData = await this._encryptKeyData(keyData);\n \n // Validate that extractable keys are properly encrypted\n if (!encryptedKeyData || encryptedKeyData.byteLength === 0) {\n throw new Error('Failed to encrypt extractable key data');\n }\n\n // Create a storage object\n const storageObject = {\n id: keyId,\n encryptedData: encryptedKeyData,\n algorithm: cryptoKey.algorithm,\n usages: cryptoKey.usages,\n extractable: cryptoKey.extractable,\n type: cryptoKey.type,\n timestamp: Date.now()\n };\n\n // Use WeakMap with the CryptoKey as the key\n this._keyStore.set(cryptoKey, storageObject);\n \n // Store reference for retrieval by ID\n this._keyReferences.set(keyId, cryptoKey);\n \n // Store metadata separately\n this._keyMetadata.set(keyId, {\n ...metadata,\n created: Date.now(),\n lastAccessed: Date.now(),\n extractable: true,\n encrypted: true // Mark extractable keys as encrypted\n });\n\n return true;\n } catch (error) {\n console.error('Failed to store key securely:', error);\n return false;\n }\n }\n\n async retrieveKey(keyId) {\n const metadata = this._keyMetadata.get(keyId);\n if (!metadata) {\n return null;\n }\n\n // Update access time\n metadata.lastAccessed = Date.now();\n\n // For non-encrypted keys (non-extractable), return directly\n if (!metadata.encrypted) {\n // Only non-extractable keys should be non-encrypted\n if (metadata.extractable === false) {\n return this._keyReferences.get(keyId);\n } else {\n // This should never happen - extractable keys must be encrypted\n this._secureLog('error', '\u274C SECURITY VIOLATION: Extractable key marked as non-encrypted', {\n keyId,\n extractable: metadata.extractable,\n encrypted: metadata.encrypted\n });\n return null;\n }\n }\n\n // For encrypted keys, decrypt and recreate\n try {\n const cryptoKey = this._keyReferences.get(keyId);\n const storedData = this._keyStore.get(cryptoKey);\n \n if (!storedData) {\n return null;\n }\n\n // Decrypt the key data\n const decryptedKeyData = await this._decryptKeyData(storedData.encryptedData);\n \n // Recreate the CryptoKey\n const recreatedKey = await crypto.subtle.importKey(\n 'jwk',\n decryptedKeyData,\n storedData.algorithm,\n storedData.extractable,\n storedData.usages\n );\n \n return recreatedKey;\n } catch (error) {\n console.error('Failed to retrieve key:', error);\n return null;\n }\n }\n\n async _encryptKeyData(keyData) {\n const dataToEncrypt = typeof keyData === 'object' \n ? JSON.stringify(keyData) \n : keyData;\n \n const encoder = new TextEncoder();\n const data = encoder.encode(dataToEncrypt);\n \n const iv = crypto.getRandomValues(new Uint8Array(12));\n \n const encryptedData = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n this._storageMasterKey,\n data\n );\n\n // Return IV + encrypted data\n const result = new Uint8Array(iv.length + encryptedData.byteLength);\n result.set(iv, 0);\n result.set(new Uint8Array(encryptedData), iv.length);\n \n return result;\n }\n\n async _decryptKeyData(encryptedData) {\n const iv = encryptedData.slice(0, 12);\n const data = encryptedData.slice(12);\n \n const decryptedData = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv },\n this._storageMasterKey,\n data\n );\n\n const decoder = new TextDecoder();\n const jsonString = decoder.decode(decryptedData);\n \n try {\n return JSON.parse(jsonString);\n } catch {\n return decryptedData;\n }\n }\n\n secureWipe(keyId) {\n const cryptoKey = this._keyReferences.get(keyId);\n \n if (cryptoKey) {\n // Remove from WeakMap (will be GC'd)\n this._keyStore.delete(cryptoKey);\n // Remove strong reference\n this._keyReferences.delete(keyId);\n // Remove metadata\n this._keyMetadata.delete(keyId);\n }\n\n // Overwrite memory locations if possible\n if (typeof window.gc === 'function') {\n window.gc();\n }\n }\n\n secureWipeAll() {\n // Clear all references\n this._keyReferences.clear();\n this._keyMetadata.clear();\n \n // WeakMap entries will be garbage collected\n this._keyStore = new WeakMap();\n \n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n }\n }\n\n // Validate storage integrity\n validateStorageIntegrity() {\n const violations = [];\n \n for (const [keyId, metadata] of this._keyMetadata.entries()) {\n // Check: extractable keys must be encrypted\n if (metadata.extractable === true && metadata.encrypted !== true) {\n violations.push({\n keyId,\n type: 'EXTRACTABLE_KEY_NOT_ENCRYPTED',\n metadata\n });\n }\n \n // Check: non-extractable keys should not be encrypted\n if (metadata.extractable === false && metadata.encrypted === true) {\n violations.push({\n keyId,\n type: 'NON_EXTRACTABLE_KEY_ENCRYPTED',\n metadata\n });\n }\n }\n \n if (violations.length > 0) {\n console.error('\u274C Storage integrity violations detected:', violations);\n return false;\n }\n \n return true;\n }\n\n getStorageStats() {\n return {\n totalKeys: this._keyReferences.size,\n metadata: Array.from(this._keyMetadata.entries()).map(([id, meta]) => ({\n id,\n created: meta.created,\n lastAccessed: meta.lastAccessed,\n age: Date.now() - meta.created\n }))\n };\n }\n\n // Method _generateNextSequenceNumber moved to constructor area for early availability\n\n /**\n * Validate incoming message sequence number\n * This prevents replay attacks and ensures message ordering\n */\n _validateIncomingSequenceNumber(receivedSeq, context = 'unknown') {\n try {\n if (!this.replayProtectionEnabled) {\n return true; // Skip validation if disabled\n }\n\n // Check if sequence number is within acceptable range\n if (receivedSeq < this.expectedSequenceNumber - this.replayWindowSize) {\n this._secureLog('warn', '\u26A0\uFE0F Sequence number too old - possible replay attack', {\n received: receivedSeq,\n expected: this.expectedSequenceNumber,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n\n // Check if sequence number is too far ahead (DoS protection)\n if (receivedSeq > this.expectedSequenceNumber + this.maxSequenceGap) {\n this._secureLog('warn', '\u26A0\uFE0F Sequence number gap too large - possible DoS attack', {\n received: receivedSeq,\n expected: this.expectedSequenceNumber,\n gap: receivedSeq - this.expectedSequenceNumber,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n\n // Check if sequence number is already in replay window\n if (this.replayWindow.has(receivedSeq)) {\n this._secureLog('warn', '\u26A0\uFE0F Duplicate sequence number detected - replay attack', {\n received: receivedSeq,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n\n // Add to replay window\n this.replayWindow.add(receivedSeq);\n \n // Maintain sliding window size\n if (this.replayWindow.size > this.replayWindowSize) {\n const oldestSeq = Math.min(...this.replayWindow);\n this.replayWindow.delete(oldestSeq);\n }\n\n // Update expected sequence number if this is the next expected\n if (receivedSeq === this.expectedSequenceNumber) {\n this.expectedSequenceNumber++;\n \n // Clean up replay window entries that are no longer needed\n while (this.replayWindow.has(this.expectedSequenceNumber - this.replayWindowSize - 1)) {\n this.replayWindow.delete(this.expectedSequenceNumber - this.replayWindowSize - 1);\n }\n }\n\n this._secureLog('debug', '\u2705 Sequence number validation successful', {\n received: receivedSeq,\n expected: this.expectedSequenceNumber,\n context: context,\n timestamp: Date.now()\n });\n\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Sequence number validation failed', {\n error: error.message,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n }\n\n // Method _createMessageAAD moved to constructor area for early availability\n\n /**\n * Validate message AAD with sequence number\n * This ensures message integrity and prevents replay attacks\n */\n _validateMessageAAD(aadString, expectedMessageType = null) {\n try {\n const aad = JSON.parse(aadString);\n \n // Validate session binding\n if (aad.sessionId !== (this.currentSession?.sessionId || 'unknown')) {\n throw new Error('AAD sessionId mismatch - possible replay attack');\n }\n \n if (aad.keyFingerprint !== (this.keyFingerprint || 'unknown')) {\n throw new Error('AAD keyFingerprint mismatch - possible key substitution attack');\n }\n \n // Validate sequence number\n if (!this._validateIncomingSequenceNumber(aad.sequenceNumber, aad.messageType)) {\n throw new Error('Sequence number validation failed - possible replay or DoS attack');\n }\n \n // Validate message type if specified\n if (expectedMessageType && aad.messageType !== expectedMessageType) {\n throw new Error(`AAD messageType mismatch - expected ${expectedMessageType}, got ${aad.messageType}`);\n }\n \n return aad;\n } catch (error) {\n this._secureLog('error', 'AAD validation failed', { error: error.message, aadString });\n throw new Error(`AAD validation failed: ${error.message}`);\n }\n }\n\n /**\n * Get anti-replay protection status\n * This shows the current state of replay protection\n */\n getAntiReplayStatus() {\n const status = {\n replayProtectionEnabled: this.replayProtectionEnabled,\n replayWindowSize: this.replayWindowSize,\n currentReplayWindowSize: this.replayWindow.size,\n sequenceNumber: this.sequenceNumber,\n expectedSequenceNumber: this.expectedSequenceNumber,\n maxSequenceGap: this.maxSequenceGap,\n replayWindowEntries: Array.from(this.replayWindow).sort((a, b) => a - b)\n };\n\n this._secureLog('info', 'Anti-replay status retrieved', status);\n return status;\n }\n\n /**\n * Configure anti-replay protection\n * This allows fine-tuning of replay protection parameters\n */\n configureAntiReplayProtection(config) {\n try {\n if (config.windowSize !== undefined) {\n if (config.windowSize < 16 || config.windowSize > 1024) {\n throw new Error('Replay window size must be between 16 and 1024');\n }\n this.replayWindowSize = config.windowSize;\n }\n\n if (config.maxGap !== undefined) {\n if (config.maxGap < 10 || config.maxGap > 1000) {\n throw new Error('Max sequence gap must be between 10 and 1000');\n }\n this.maxSequenceGap = config.maxGap;\n }\n\n if (config.enabled !== undefined) {\n this.replayProtectionEnabled = config.enabled;\n }\n\n this._secureLog('info', 'Anti-replay protection configured', config);\n return true;\n } catch (error) {\n this._secureLog('error', 'Failed to configure anti-replay protection', { error: error.message });\n return false;\n }\n }\n\n /**\n * Get real security level with actual cryptographic tests\n * This provides real-time verification of security features\n */\n async getRealSecurityLevel() {\n try {\n const securityData = {\n // Basic security features\n ecdhKeyExchange: !!this.ecdhKeyPair,\n ecdsaSignatures: !!this.ecdsaKeyPair,\n aesEncryption: !!this.encryptionKey,\n messageIntegrity: !!this.hmacKey,\n \n // Advanced security features - using the exact property names expected by EnhancedSecureCryptoUtils\n replayProtection: this.replayProtectionEnabled,\n dtlsFingerprint: !!this.expectedDTLSFingerprint,\n sasCode: !!this.verificationCode,\n metadataProtection: true, // Always enabled\n trafficObfuscation: true, // Always enabled\n perfectForwardSecrecy: true, // Always enabled\n \n // Rate limiting\n rateLimiter: true, // Always enabled\n \n // Additional info\n connectionId: this.connectionId,\n keyFingerprint: this.keyFingerprint,\n currentSecurityLevel: this.currentSecurityLevel,\n timestamp: Date.now()\n };\n\n // Debug logging for security features\n console.log('\uD83D\uDD0D getRealSecurityLevel debug:');\n console.log(' - replayProtectionEnabled:', this.replayProtectionEnabled);\n console.log(' - expectedDTLSFingerprint:', !!this.expectedDTLSFingerprint);\n console.log(' - verificationCode:', !!this.verificationCode);\n console.log(' - ecdhKeyPair:', !!this.ecdhKeyPair);\n console.log(' - ecdsaKeyPair:', !!this.ecdsaKeyPair);\n console.log(' - encryptionKey:', !!this.encryptionKey);\n console.log(' - hmacKey:', !!this.hmacKey);\n \n this._secureLog('info', 'Real security level calculated', securityData);\n return securityData;\n } catch (error) {\n this._secureLog('error', 'Failed to calculate real security level', { error: error.message });\n throw error;\n }\n }\n\n\n}\n\nexport { EnhancedSecureWebRTCManager };", "// SessionTimer Component - v4.02.985 - ECDH + DTLS + SAS\nconst SessionTimer = ({ timeLeft, sessionType, sessionManager, onDisconnect }) => {\n const [currentTime, setCurrentTime] = React.useState(timeLeft || 0);\n const [showExpiredMessage, setShowExpiredMessage] = React.useState(false);\n const [initialized, setInitialized] = React.useState(false);\n const [connectionBroken, setConnectionBroken] = React.useState(false);\n \n\n const [loggedHidden, setLoggedHidden] = React.useState(false);\n\n React.useEffect(() => {\n if (connectionBroken) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer initialization skipped - connection broken');\n setLoggedHidden(true);\n }\n return;\n }\n \n let initialTime = 0;\n \n if (sessionManager?.hasActiveSession()) {\n initialTime = sessionManager.getTimeLeft();\n } else if (timeLeft && timeLeft > 0) {\n initialTime = timeLeft;\n }\n\n if (initialTime <= 0) {\n setCurrentTime(0);\n setInitialized(false);\n setLoggedHidden(true);\n return;\n }\n\n if (connectionBroken) {\n setCurrentTime(0);\n setInitialized(false);\n setLoggedHidden(true);\n return;\n }\n setCurrentTime(initialTime);\n setInitialized(true);\n setLoggedHidden(false); \n }, [sessionManager, connectionBroken]);\n\n React.useEffect(() => {\n if (connectionBroken) {\n if (!loggedHidden) {\n setLoggedHidden(true);\n }\n return;\n }\n \n if (timeLeft && timeLeft > 0) {\n setCurrentTime(timeLeft);\n }\n setLoggedHidden(false);\n }, [timeLeft, connectionBroken]);\n\n React.useEffect(() => {\n if (!initialized) {\n return;\n }\n\n if (connectionBroken) {\n if (!loggedHidden) {\n setLoggedHidden(true);\n }\n return;\n }\n\n if (!currentTime || currentTime <= 0 || !sessionManager) {\n return;\n }\n\n const interval = setInterval(() => {\n if (connectionBroken) {\n setCurrentTime(0);\n clearInterval(interval);\n return;\n }\n \n if (sessionManager?.hasActiveSession()) {\n const newTime = sessionManager.getTimeLeft();\n setCurrentTime(newTime);\n\n if (window.DEBUG_MODE && Math.floor(Date.now() / 30000) !== Math.floor((Date.now() - 1000) / 30000)) {\n console.log('\u23F1\uFE0F Timer tick:', Math.floor(newTime / 1000) + 's');\n }\n\n if (newTime <= 0) {\n setShowExpiredMessage(true);\n setTimeout(() => setShowExpiredMessage(false), 5000);\n clearInterval(interval);\n }\n } else {\n setCurrentTime(0);\n clearInterval(interval);\n }\n }, 1000);\n\n return () => {\n clearInterval(interval);\n };\n }, [initialized, currentTime, sessionManager, connectionBroken]);\n\n React.useEffect(() => {\n const handleSessionTimerUpdate = (event) => {\n if (connectionBroken) {\n return;\n }\n \n if (event.detail.timeLeft && event.detail.timeLeft > 0) {\n setCurrentTime(event.detail.timeLeft);\n }\n };\n\n const handleForceHeaderUpdate = (event) => {\n if (connectionBroken) {\n return;\n }\n \n if (sessionManager && sessionManager.hasActiveSession()) {\n const newTime = sessionManager.getTimeLeft();\n setCurrentTime(newTime);\n } else {\n setCurrentTime(event.detail.timeLeft);\n }\n };\n\n const handlePeerDisconnect = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setLoggedHidden(false);\n };\n\n const handleNewConnection = (event) => {\n setConnectionBroken(false);\n setLoggedHidden(false); \n };\n\n const handleConnectionCleaned = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n const handleSessionReset = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n const handleSessionCleanup = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n const handleDisconnected = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n document.addEventListener('session-timer-update', handleSessionTimerUpdate);\n document.addEventListener('force-header-update', handleForceHeaderUpdate);\n document.addEventListener('peer-disconnect', handlePeerDisconnect);\n document.addEventListener('new-connection', handleNewConnection);\n document.addEventListener('connection-cleaned', handleConnectionCleaned);\n document.addEventListener('session-reset', handleSessionReset);\n document.addEventListener('session-cleanup', handleSessionCleanup);\n document.addEventListener('disconnected', handleDisconnected);\n\n return () => {\n document.removeEventListener('session-timer-update', handleSessionTimerUpdate);\n document.removeEventListener('force-header-update', handleForceHeaderUpdate);\n document.removeEventListener('peer-disconnect', handlePeerDisconnect);\n document.removeEventListener('new-connection', handleNewConnection);\n document.removeEventListener('connection-cleaned', handleConnectionCleaned);\n document.removeEventListener('session-reset', handleSessionReset);\n document.removeEventListener('session-cleanup', handleSessionCleanup);\n document.removeEventListener('disconnected', handleDisconnected);\n };\n }, [sessionManager]);\n\n if (showExpiredMessage) {\n return React.createElement('div', {\n className: 'session-timer expired flex items-center space-x-2 px-3 py-1.5 rounded-lg animate-pulse',\n style: { background: 'linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%)' }\n }, [\n React.createElement('i', {\n key: 'icon',\n className: 'fas fa-exclamation-triangle text-red-400'\n }),\n React.createElement('span', {\n key: 'message',\n className: 'text-red-400 text-sm font-medium'\n }, 'Session Expired!')\n ]);\n }\n\n if (!sessionManager) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer hidden - no sessionManager');\n setLoggedHidden(true);\n }\n return null;\n }\n\n if (connectionBroken) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer hidden - connection broken');\n setLoggedHidden(true);\n }\n return null;\n }\n\n if (!currentTime || currentTime <= 0) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer hidden - no time left, currentTime:', currentTime);\n setLoggedHidden(true);\n }\n return null;\n }\n\n if (loggedHidden) {\n setLoggedHidden(false);\n }\n\n const totalMinutes = Math.floor(currentTime / (60 * 1000));\n const totalSeconds = Math.floor(currentTime / 1000);\n \n const isDemo = sessionType === 'demo';\n const isWarning = isDemo ? totalMinutes <= 2 : totalMinutes <= 10;\n const isCritical = isDemo ? totalSeconds <= 60 : totalMinutes <= 5;\n\n const formatTime = (ms) => {\n const hours = Math.floor(ms / (60 * 60 * 1000));\n const minutes = Math.floor((ms % (60 * 60 * 1000)) / (60 * 1000));\n const seconds = Math.floor((ms % (60 * 1000)) / 1000);\n\n if (hours > 0) {\n return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;\n } else {\n return `${minutes}:${seconds.toString().padStart(2, '0')}`;\n }\n };\n\n const getTimerStyle = () => {\n const totalDuration = sessionType === 'demo' ? 6 * 60 * 1000 : 60 * 60 * 1000;\n const timeProgress = (totalDuration - currentTime) / totalDuration;\n \n let backgroundColor, textColor, iconColor, iconClass, shouldPulse;\n \n if (timeProgress <= 0.33) {\n backgroundColor = 'linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(22, 163, 74, 0.15) 100%)';\n textColor = 'text-green-400';\n iconColor = 'text-green-400';\n iconClass = 'fas fa-clock';\n shouldPulse = false;\n } else if (timeProgress <= 0.66) {\n backgroundColor = 'linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(202, 138, 4, 0.15) 100%)';\n textColor = 'text-yellow-400';\n iconColor = 'text-yellow-400';\n iconClass = 'fas fa-clock';\n shouldPulse = false;\n } else {\n backgroundColor = 'linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.15) 100%)';\n textColor = 'text-red-400';\n iconColor = 'text-red-400';\n iconClass = 'fas fa-exclamation-triangle';\n shouldPulse = true;\n }\n \n return { backgroundColor, textColor, iconColor, iconClass, shouldPulse };\n };\n\n const timerStyle = getTimerStyle();\n \n const handleTimerClick = () => {\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n }\n };\n\n return React.createElement('div', {\n className: `session-timer flex items-center space-x-2 px-3 py-1.5 rounded-lg transition-all duration-500 cursor-pointer hover:opacity-80 ${\n isDemo ? 'demo-session' : ''\n } ${timerStyle.shouldPulse ? 'animate-pulse' : ''}`,\n style: { background: timerStyle.backgroundColor },\n onClick: handleTimerClick,\n title: 'Click to disconnect and clear session'\n }, [\n React.createElement('i', {\n key: 'icon',\n className: `${timerStyle.iconClass} ${timerStyle.iconColor}`\n }),\n React.createElement('span', {\n key: 'time',\n className: `text-sm font-mono font-semibold ${timerStyle.textColor}`\n }, formatTime(currentTime)),\n React.createElement('div', {\n key: 'progress',\n className: 'ml-2 w-16 h-1 bg-gray-700 rounded-full overflow-hidden'\n }, [\n React.createElement('div', {\n key: 'progress-bar',\n className: `${timerStyle.textColor.replace('text-', 'bg-')} h-full rounded-full transition-all duration-500`,\n style: { \n width: `${Math.max(0, Math.min(100, (currentTime / (sessionType === 'demo' ? 6 * 60 * 1000 : 60 * 60 * 1000)) * 100))}%`\n }\n })\n ])\n ]);\n};\n\nwindow.SessionTimer = SessionTimer;\n\nwindow.updateSessionTimer = (newTimeLeft, newSessionType) => {\n document.dispatchEvent(new CustomEvent('session-timer-update', {\n detail: { timeLeft: newTimeLeft, sessionType: newSessionType }\n }));\n};\n\n", "const EnhancedMinimalHeader = ({ \n status, \n fingerprint, \n verificationCode, \n onDisconnect, \n isConnected, \n securityLevel, \n sessionManager, \n sessionTimeLeft,\n webrtcManager \n}) => {\n const [currentTimeLeft, setCurrentTimeLeft] = React.useState(sessionTimeLeft || 0);\n const [hasActiveSession, setHasActiveSession] = React.useState(false);\n const [sessionType, setSessionType] = React.useState('unknown');\n const [realSecurityLevel, setRealSecurityLevel] = React.useState(null);\n const [lastSecurityUpdate, setLastSecurityUpdate] = React.useState(0);\n\n // ============================================\n // FIXED SECURITY UPDATE LOGIC\n // ============================================\n \n React.useEffect(() => {\n let isUpdating = false; \n let lastUpdateAttempt = 0; \n \n const updateRealSecurityStatus = async () => {\n const now = Date.now();\n if (now - lastUpdateAttempt < 10000) { \n return;\n }\n\n if (isUpdating) {\n return;\n }\n \n isUpdating = true;\n lastUpdateAttempt = now;\n \n try {\n if (!webrtcManager || !isConnected) {\n return;\n }\n \n const activeWebrtcManager = webrtcManager;\n \n let realSecurityData = null;\n \n if (typeof activeWebrtcManager.getRealSecurityLevel === 'function') {\n realSecurityData = await activeWebrtcManager.getRealSecurityLevel();\n } else if (typeof activeWebrtcManager.calculateAndReportSecurityLevel === 'function') {\n realSecurityData = await activeWebrtcManager.calculateAndReportSecurityLevel();\n } else {\n realSecurityData = await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(activeWebrtcManager);\n }\n \n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD10 REAL security level calculated:', {\n level: realSecurityData?.level,\n score: realSecurityData?.score,\n passedChecks: realSecurityData?.passedChecks,\n totalChecks: realSecurityData?.totalChecks,\n isRealData: realSecurityData?.isRealData,\n sessionType: realSecurityData?.sessionType,\n maxPossibleScore: realSecurityData?.maxPossibleScore,\n verificationResults: realSecurityData?.verificationResults ? Object.keys(realSecurityData.verificationResults) : []\n });\n }\n \n if (realSecurityData && realSecurityData.isRealData !== false) {\n const currentScore = realSecurityLevel?.score || 0;\n const newScore = realSecurityData.score || 0;\n\n if (currentScore !== newScore || !realSecurityLevel) {\n setRealSecurityLevel(realSecurityData);\n setLastSecurityUpdate(now);\n \n if (window.DEBUG_MODE) {\n console.log('\u2705 Security level updated in header component:', {\n oldScore: currentScore,\n newScore: newScore,\n sessionType: realSecurityData.sessionType\n });\n }\n } else if (window.DEBUG_MODE) {\n console.log('\u2139\uFE0F Security level unchanged, skipping update');\n }\n } else {\n console.warn('\u26A0\uFE0F Security calculation returned invalid data');\n }\n \n } catch (error) {\n console.error('\u274C Error in real security calculation:', error);\n } finally {\n isUpdating = false;\n }\n };\n\n if (isConnected) {\n updateRealSecurityStatus();\n \n if (!realSecurityLevel || realSecurityLevel.score < 50) {\n const retryInterval = setInterval(() => {\n if (!realSecurityLevel || realSecurityLevel.score < 50) {\n updateRealSecurityStatus();\n } else {\n clearInterval(retryInterval);\n }\n }, 5000); \n \n setTimeout(() => clearInterval(retryInterval), 30000);\n }\n }\n\n const interval = setInterval(updateRealSecurityStatus, 30000);\n \n return () => clearInterval(interval);\n }, [webrtcManager, isConnected]);\n\n // ============================================\n // FIXED EVENT HANDLERS\n // ============================================\n\n React.useEffect(() => {\n const handleSecurityUpdate = (event) => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD12 Security level update event received:', event.detail);\n }\n\n setTimeout(() => {\n setLastSecurityUpdate(0);\n }, 100);\n };\n\n const handleRealSecurityCalculated = (event) => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD10 Real security calculated event:', event.detail);\n }\n \n if (event.detail && event.detail.securityData) {\n setRealSecurityLevel(event.detail.securityData);\n setLastSecurityUpdate(Date.now());\n }\n };\n\n document.addEventListener('security-level-updated', handleSecurityUpdate);\n document.addEventListener('real-security-calculated', handleRealSecurityCalculated);\n \n window.forceHeaderSecurityUpdate = (webrtcManager) => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD04 Force header security update called');\n }\n \n if (webrtcManager && window.EnhancedSecureCryptoUtils) {\n window.EnhancedSecureCryptoUtils.calculateSecurityLevel(webrtcManager)\n .then(securityData => {\n if (securityData && securityData.isRealData !== false) {\n setRealSecurityLevel(securityData);\n setLastSecurityUpdate(Date.now());\n console.log('\u2705 Header security level force-updated');\n }\n })\n .catch(error => {\n console.error('\u274C Force update failed:', error);\n });\n } else {\n setLastSecurityUpdate(0); \n }\n };\n\n return () => {\n document.removeEventListener('security-level-updated', handleSecurityUpdate);\n document.removeEventListener('real-security-calculated', handleRealSecurityCalculated);\n };\n }, []);\n\n // ============================================\n // REST of the component logic\n // ============================================\n\n React.useEffect(() => {\n // All security features are enabled by default - no session management needed\n setHasActiveSession(true);\n setCurrentTimeLeft(0);\n setSessionType('premium'); // All features enabled\n }, []);\n\n React.useEffect(() => {\n // All security features are enabled by default\n setHasActiveSession(true);\n setCurrentTimeLeft(0);\n setSessionType('premium'); // All features enabled\n }, [sessionTimeLeft]);\n\n React.useEffect(() => {\n const handleForceUpdate = (event) => {\n // All security features are enabled by default\n setHasActiveSession(true);\n setCurrentTimeLeft(0);\n setSessionType('premium'); // All features enabled\n };\n\n // Connection cleanup handler (use existing event from module)\n const handleConnectionCleaned = () => {\n if (window.DEBUG_MODE) {\n console.log('\uD83E\uDDF9 Connection cleaned - clearing security data in header');\n }\n\n setRealSecurityLevel(null);\n setLastSecurityUpdate(0);\n\n setHasActiveSession(false);\n setCurrentTimeLeft(0);\n setSessionType('unknown');\n };\n\n const handlePeerDisconnect = () => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDC4B Peer disconnect detected - clearing security data in header');\n }\n\n setRealSecurityLevel(null);\n setLastSecurityUpdate(0);\n };\n\n const handleDisconnected = () => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD0C Disconnected - clearing security data in header');\n }\n\n setRealSecurityLevel(null);\n setLastSecurityUpdate(0);\n setHasActiveSession(false);\n setCurrentTimeLeft(0);\n setSessionType('unknown');\n };\n\n document.addEventListener('force-header-update', handleForceUpdate);\n document.addEventListener('peer-disconnect', handlePeerDisconnect);\n document.addEventListener('connection-cleaned', handleConnectionCleaned);\n document.addEventListener('disconnected', handleDisconnected);\n \n return () => {\n document.removeEventListener('force-header-update', handleForceUpdate);\n document.removeEventListener('peer-disconnect', handlePeerDisconnect);\n document.removeEventListener('connection-cleaned', handleConnectionCleaned);\n document.removeEventListener('disconnected', handleDisconnected);\n };\n }, []);\n\n // ============================================\n // SECURITY INDICATOR CLICK HANDLER\n // ============================================\n\n const handleSecurityClick = async (event) => {\n // Check if it's a right-click or Ctrl+click to disconnect\n if (event && (event.button === 2 || event.ctrlKey || event.metaKey)) {\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n return;\n }\n }\n\n // Prevent default behavior\n event.preventDefault();\n event.stopPropagation();\n\n // Debug information\n console.log('\uD83D\uDD0D Security click debug:', {\n hasWebrtcManager: !!webrtcManager,\n hasCryptoUtils: !!window.EnhancedSecureCryptoUtils,\n hasRealSecurityLevel: !!realSecurityLevel,\n connectionStatus: webrtcManager?.connectionState || 'unknown'\n });\n\n // Run real security tests if webrtcManager is available\n let realTestResults = null;\n if (webrtcManager && window.EnhancedSecureCryptoUtils) {\n try {\n console.log('\uD83D\uDD0D Running real security tests...');\n realTestResults = await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(webrtcManager);\n console.log('\u2705 Real security tests completed:', realTestResults);\n } catch (error) {\n console.error('\u274C Real security tests failed:', error);\n }\n } else {\n console.log('\u26A0\uFE0F Cannot run security tests:', {\n webrtcManager: !!webrtcManager,\n cryptoUtils: !!window.EnhancedSecureCryptoUtils\n });\n }\n\n // If no real test results and no existing security level, show progress message\n if (!realTestResults && !realSecurityLevel) {\n alert('Security verification in progress...\\nPlease wait for real-time cryptographic verification to complete.');\n return;\n }\n\n // Use real test results if available, otherwise fall back to current data\n let securityData = realTestResults || realSecurityLevel;\n\n // If still no security data, create a basic fallback\n if (!securityData) {\n securityData = {\n level: 'UNKNOWN',\n score: 0,\n color: 'gray',\n verificationResults: {},\n timestamp: Date.now(),\n details: 'Security verification not available',\n isRealData: false,\n passedChecks: 0,\n totalChecks: 0,\n sessionType: 'unknown'\n };\n console.log('\u26A0\uFE0F Using fallback security data:', securityData);\n }\n\n // Detailed information about the REAL security check\n let message = `\uD83D\uDD12 REAL-TIME SECURITY VERIFICATION\\n\\n`;\n message += `Security Level: ${securityData.level} (${securityData.score}%)\\n`;\n message += `Session Type: ${securityData.sessionType || 'premium'}\\n`;\n message += `Verification Time: ${new Date(securityData.timestamp).toLocaleTimeString()}\\n`;\n message += `Data Source: ${securityData.isRealData ? 'Real Cryptographic Tests' : 'Simulated Data'}\\n\\n`;\n \n if (securityData.verificationResults) {\n message += 'DETAILED CRYPTOGRAPHIC TESTS:\\n';\n message += '=' + '='.repeat(40) + '\\n';\n \n const passedTests = Object.entries(securityData.verificationResults).filter(([key, result]) => result.passed);\n const failedTests = Object.entries(securityData.verificationResults).filter(([key, result]) => !result.passed);\n \n if (passedTests.length > 0) {\n message += '\u2705 PASSED TESTS:\\n';\n passedTests.forEach(([key, result]) => {\n const testName = key.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());\n message += ` ${testName}: ${result.details || 'Test passed'}\\n`;\n });\n message += '\\n';\n }\n \n if (failedTests.length > 0) {\n message += '\u274C FAILED/UNAVAILABLE TESTS:\\n';\n failedTests.forEach(([key, result]) => {\n const testName = key.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());\n message += ` ${testName}: ${result.details || 'Test failed or unavailable'}\\n`;\n });\n message += '\\n';\n }\n \n message += `SUMMARY:\\n`;\n message += `Passed: ${securityData.passedChecks}/${securityData.totalChecks} tests\\n`;\n message += `Score: ${securityData.score}/${securityData.maxPossibleScore || 100} points\\n\\n`;\n }\n \n // Real security features status\n message += `\uD83D\uDD12 SECURITY FEATURES STATUS:\\n`;\n message += '=' + '='.repeat(40) + '\\n';\n \n if (securityData.verificationResults) {\n const features = {\n 'ECDSA Digital Signatures': securityData.verificationResults.verifyECDSASignatures?.passed || false,\n 'ECDH Key Exchange': securityData.verificationResults.verifyECDHKeyExchange?.passed || false,\n 'AES-GCM Encryption': securityData.verificationResults.verifyEncryption?.passed || false,\n 'Message Integrity (HMAC)': securityData.verificationResults.verifyMessageIntegrity?.passed || false,\n 'Perfect Forward Secrecy': securityData.verificationResults.verifyPerfectForwardSecrecy?.passed || false,\n 'Replay Protection': securityData.verificationResults.verifyReplayProtection?.passed || false,\n 'DTLS Fingerprint': securityData.verificationResults.verifyDTLSFingerprint?.passed || false,\n 'SAS Verification': securityData.verificationResults.verifySASVerification?.passed || false,\n 'Metadata Protection': securityData.verificationResults.verifyMetadataProtection?.passed || false,\n 'Traffic Obfuscation': securityData.verificationResults.verifyTrafficObfuscation?.passed || false\n };\n \n Object.entries(features).forEach(([feature, isEnabled]) => {\n message += `${isEnabled ? '\u2705' : '\u274C'} ${feature}\\n`;\n });\n } else {\n // Fallback if no verification results\n message += `\u2705 ECDSA Digital Signatures\\n`;\n message += `\u2705 ECDH Key Exchange\\n`;\n message += `\u2705 AES-GCM Encryption\\n`;\n message += `\u2705 Message Integrity (HMAC)\\n`;\n message += `\u2705 Perfect Forward Secrecy\\n`;\n message += `\u2705 Replay Protection\\n`;\n message += `\u2705 DTLS Fingerprint\\n`;\n message += `\u2705 SAS Verification\\n`;\n message += `\u2705 Metadata Protection\\n`;\n message += `\u2705 Traffic Obfuscation\\n`;\n }\n \n message += `\\n${securityData.details || 'Real cryptographic verification completed'}`;\n \n if (securityData.isRealData) {\n message += '\\n\\n\u2705 This is REAL-TIME verification using actual cryptographic functions.';\n } else {\n message += '\\n\\n\u26A0\uFE0F Warning: This data may be simulated. Connection may not be fully established.';\n }\n \n // Show in a more user-friendly way\n const modal = document.createElement('div');\n modal.style.cssText = `\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0,0,0,0.8);\n z-index: 10000;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: monospace;\n `;\n \n const content = document.createElement('div');\n content.style.cssText = `\n background: #1a1a1a;\n color: #fff;\n padding: 20px;\n border-radius: 8px;\n max-width: 80%;\n max-height: 80%;\n overflow-y: auto;\n white-space: pre-line;\n border: 1px solid #333;\n `;\n \n content.textContent = message;\n modal.appendChild(content);\n \n // Close on click outside\n modal.addEventListener('click', (e) => {\n if (e.target === modal) {\n document.body.removeChild(modal);\n }\n });\n \n // Close on Escape key\n const handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n document.body.removeChild(modal);\n document.removeEventListener('keydown', handleKeyDown);\n }\n };\n document.addEventListener('keydown', handleKeyDown);\n \n document.body.appendChild(modal);\n };\n\n // ============================================\n // DISPLAY UTILITIES\n // ============================================\n\n const getStatusConfig = () => {\n switch (status) {\n case 'connected':\n return {\n text: 'Connected',\n className: 'status-connected',\n badgeClass: 'bg-green-500/10 text-green-400 border-green-500/20'\n };\n case 'verifying':\n return {\n text: 'Verifying...',\n className: 'status-verifying',\n badgeClass: 'bg-purple-500/10 text-purple-400 border-purple-500/20'\n };\n case 'connecting':\n return {\n text: 'Connecting...',\n className: 'status-connecting',\n badgeClass: 'bg-blue-500/10 text-blue-400 border-blue-500/20'\n };\n case 'retrying':\n return {\n text: 'Retrying...',\n className: 'status-connecting',\n badgeClass: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20'\n };\n case 'failed':\n return {\n text: 'Error',\n className: 'status-failed',\n badgeClass: 'bg-red-500/10 text-red-400 border-red-500/20'\n };\n case 'reconnecting':\n return {\n text: 'Reconnecting...',\n className: 'status-connecting',\n badgeClass: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20'\n };\n case 'peer_disconnected':\n return {\n text: 'Peer disconnected',\n className: 'status-failed',\n badgeClass: 'bg-orange-500/10 text-orange-400 border-orange-500/20'\n };\n default:\n return {\n text: 'Not connected',\n className: 'status-disconnected',\n badgeClass: 'bg-gray-500/10 text-gray-400 border-gray-500/20'\n };\n }\n };\n\n const config = getStatusConfig();\n const displaySecurityLevel = isConnected ? (realSecurityLevel || securityLevel) : null;\n \n const shouldShowTimer = hasActiveSession && currentTimeLeft > 0 && window.SessionTimer;\n\n // ============================================\n // DATA RELIABILITY INDICATOR\n // ============================================\n\n const getSecurityIndicatorDetails = () => {\n if (!displaySecurityLevel) {\n return {\n tooltip: 'Security verification in progress...',\n isVerified: false,\n dataSource: 'loading'\n };\n }\n \n const isRealData = displaySecurityLevel.isRealData !== false;\n const baseTooltip = `${displaySecurityLevel.level} (${displaySecurityLevel.score}%)`;\n \n if (isRealData) {\n return {\n tooltip: `${baseTooltip} - Real-time verification \u2705\\nRight-click or Ctrl+click to disconnect`,\n isVerified: true,\n dataSource: 'real'\n };\n } else {\n return {\n tooltip: `${baseTooltip} - Estimated (connection establishing...)\\nRight-click or Ctrl+click to disconnect`,\n isVerified: false,\n dataSource: 'estimated'\n };\n }\n };\n\n const securityDetails = getSecurityIndicatorDetails();\n\n // ============================================\n // ADDING global methods for debugging\n // ============================================\n\n React.useEffect(() => {\n window.debugHeaderSecurity = () => {\n console.log('\uD83D\uDD0D Header Security Debug:', {\n realSecurityLevel,\n lastSecurityUpdate,\n isConnected,\n webrtcManagerProp: !!webrtcManager,\n windowWebrtcManager: !!window.webrtcManager,\n cryptoUtils: !!window.EnhancedSecureCryptoUtils,\n displaySecurityLevel: displaySecurityLevel,\n securityDetails: securityDetails\n });\n };\n \n return () => {\n delete window.debugHeaderSecurity;\n };\n }, [realSecurityLevel, lastSecurityUpdate, isConnected, webrtcManager, displaySecurityLevel, securityDetails]);\n\n // ============================================\n // RENDER\n // ============================================\n\n return React.createElement('header', {\n className: 'header-minimal sticky top-0 z-50'\n }, [\n React.createElement('div', {\n key: 'container',\n className: 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8'\n }, [\n React.createElement('div', {\n key: 'content',\n className: 'flex items-center justify-between h-16'\n }, [\n // Logo and Title\n React.createElement('div', {\n key: 'logo-section',\n className: 'flex items-center space-x-2 sm:space-x-3'\n }, [\n React.createElement('div', {\n key: 'logo',\n className: 'icon-container w-8 h-8 sm:w-10 sm:h-10'\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-halved accent-orange text-sm sm:text-base'\n })\n ]),\n React.createElement('div', {\n key: 'title-section'\n }, [\n React.createElement('h1', {\n key: 'title',\n className: 'text-lg sm:text-xl font-semibold text-primary'\n }, 'SecureBit.chat'),\n React.createElement('p', {\n key: 'subtitle',\n className: 'text-xs sm:text-sm text-muted hidden sm:block'\n }, 'End-to-end freedom v4.02.985')\n ])\n ]),\n\n // Status and Controls - Responsive\n React.createElement('div', {\n key: 'status-section',\n className: 'flex items-center space-x-2 sm:space-x-3'\n }, [\n // Session Timer - all features enabled by default\n shouldShowTimer && React.createElement(window.SessionTimer, {\n key: 'session-timer',\n timeLeft: currentTimeLeft,\n sessionType: sessionType,\n onDisconnect: onDisconnect\n }),\n\n displaySecurityLevel && React.createElement('div', {\n key: 'security-level',\n className: 'hidden md:flex items-center space-x-2 cursor-pointer hover:opacity-80 transition-opacity duration-200',\n onClick: handleSecurityClick,\n onContextMenu: (e) => {\n e.preventDefault();\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n }\n },\n title: securityDetails.tooltip\n }, [\n React.createElement('div', {\n key: 'security-icon',\n className: `w-6 h-6 rounded-full flex items-center justify-center relative ${\n displaySecurityLevel.color === 'green' ? 'bg-green-500/20' :\n displaySecurityLevel.color === 'orange' ? 'bg-orange-500/20' :\n displaySecurityLevel.color === 'yellow' ? 'bg-yellow-500/20' : 'bg-red-500/20'\n } ${securityDetails.isVerified ? '' : 'animate-pulse'}`\n }, [\n React.createElement('i', {\n className: `fas fa-shield-alt text-xs ${\n displaySecurityLevel.color === 'green' ? 'text-green-400' :\n displaySecurityLevel.color === 'orange' ? 'text-orange-400' :\n displaySecurityLevel.color === 'yellow' ? 'text-yellow-400' : 'text-red-400'\n }`\n })\n ]),\n React.createElement('div', {\n key: 'security-info',\n className: 'flex flex-col'\n }, [\n React.createElement('div', {\n key: 'security-level-text',\n className: 'text-xs font-medium text-primary flex items-center space-x-1'\n }, [\n React.createElement('span', {}, `${displaySecurityLevel.level} (${displaySecurityLevel.score}%)`)\n ]),\n React.createElement('div', {\n key: 'security-details',\n className: 'text-xs text-muted mt-1 hidden lg:block'\n }, securityDetails.dataSource === 'real' ? \n `${displaySecurityLevel.passedChecks || 0}/${displaySecurityLevel.totalChecks || 0} tests` :\n (displaySecurityLevel.details || `Stage ${displaySecurityLevel.stage || 1}`)\n ),\n React.createElement('div', {\n key: 'security-progress',\n className: 'w-16 h-1 bg-gray-600 rounded-full overflow-hidden'\n }, [\n React.createElement('div', {\n key: 'progress-bar',\n className: `h-full transition-all duration-500 ${\n displaySecurityLevel.color === 'green' ? 'bg-green-400' :\n displaySecurityLevel.color === 'orange' ? 'bg-orange-400' :\n displaySecurityLevel.color === 'yellow' ? 'bg-yellow-400' : 'bg-red-400'\n }`,\n style: { width: `${displaySecurityLevel.score}%` }\n })\n ])\n ])\n ]),\n\n // Mobile Security Indicator\n displaySecurityLevel && React.createElement('div', {\n key: 'mobile-security',\n className: 'md:hidden flex items-center'\n }, [\n React.createElement('div', {\n key: 'mobile-security-icon',\n className: `w-8 h-8 rounded-full flex items-center justify-center cursor-pointer hover:opacity-80 transition-opacity duration-200 relative ${\n displaySecurityLevel.color === 'green' ? 'bg-green-500/20' :\n displaySecurityLevel.color === 'orange' ? 'bg-orange-500/20' :\n displaySecurityLevel.color === 'yellow' ? 'bg-yellow-500/20' : 'bg-red-500/20'\n } ${securityDetails.isVerified ? '' : 'animate-pulse'}`,\n title: securityDetails.tooltip,\n onClick: handleSecurityClick,\n onContextMenu: (e) => {\n e.preventDefault();\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n }\n }\n }, [\n React.createElement('i', {\n className: `fas fa-shield-alt text-sm ${\n displaySecurityLevel.color === 'green' ? 'text-green-400' :\n displaySecurityLevel.color === 'orange' ? 'text-orange-400' :\n displaySecurityLevel.color === 'yellow' ? 'text-yellow-400' : 'text-red-400'\n }`\n })\n ])\n ]),\n\n // Status Badge\n React.createElement('div', {\n key: 'status-badge',\n className: `px-2 sm:px-3 py-1.5 rounded-lg border ${config.badgeClass} flex items-center space-x-1 sm:space-x-2`\n }, [\n React.createElement('span', {\n key: 'status-dot',\n className: `status-dot ${config.className}`\n }),\n React.createElement('span', {\n key: 'status-text',\n className: 'text-xs sm:text-sm font-medium'\n }, config.text),\n ]),\n\n // Disconnect Button\n isConnected && React.createElement('button', {\n key: 'disconnect-btn',\n onClick: onDisconnect,\n className: 'p-1.5 sm:px-3 sm:py-1.5 bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 rounded-lg transition-all duration-200 text-sm'\n }, [\n React.createElement('i', {\n className: 'fas fa-power-off sm:mr-2'\n }),\n React.createElement('span', {\n className: 'hidden sm:inline'\n }, 'Disconnect')\n ])\n ])\n ])\n ])\n ]);\n};\n\nwindow.EnhancedMinimalHeader = EnhancedMinimalHeader;\n", "const DownloadApps = () => {\r\n const apps = [\r\n { id: 'web', name: 'Web App', subtitle: 'Browser Version', icon: 'fas fa-globe', platform: 'Web', isActive: true, url: 'https://securebitchat.github.io/securebit-chat/', color: 'green' },\r\n { id: 'windows', name: 'Windows', subtitle: 'Desktop App', icon: 'fab fa-windows', platform: 'Desktop', isActive: false, url: '#', color: 'blue' },\r\n { id: 'macos', name: 'macOS', subtitle: 'Desktop App', icon: 'fab fa-apple', platform: 'Desktop', isActive: false, url: '#', color: 'gray' },\r\n { id: 'linux', name: 'Linux', subtitle: 'Desktop App', icon: 'fab fa-linux', platform: 'Desktop', isActive: false, url: '#', color: 'orange' },\r\n { id: 'ios', name: 'iOS', subtitle: 'iPhone & iPad', icon: 'fab fa-apple', platform: 'Mobile', isActive: false, url: 'https://apps.apple.com/app/securebit-chat/', color: 'blue' },\r\n { id: 'android', name: 'Android', subtitle: 'Google Play', icon: 'fab fa-android', platform: 'Mobile', isActive: false, url: 'https://play.google.com/store/apps/details?id=com.securebit.chat', color: 'green' }\r\n ];\r\n\r\n const handleDownload = (app) => {\r\n if (app.isActive) window.open(app.url, '_blank');\r\n };\r\n\r\n const desktopApps = apps.filter(a => a.platform !== 'Mobile');\r\n const mobileApps = apps.filter(a => a.platform === 'Mobile');\r\n\r\n const cardSize = \"w-28 h-28\"; \r\n\r\n return React.createElement('div', { className: \"mt-20 px-6\" }, [\r\n // Header\r\n React.createElement('div', { key: 'header', className: \"text-center max-w-3xl mx-auto mb-12\" }, [\r\n React.createElement('h3', { key: 'title', className: \"text-3xl font-bold text-primary mb-3\" }, 'Download SecureBit.chat'),\r\n React.createElement('p', { key: 'subtitle', className: \"text-secondary text-lg mb-5\" }, 'Stay secure on every device. Choose your platform and start chatting privately.')\r\n ]),\r\n\r\n React.createElement('div', { key: 'desktop-row', className: \"hidden sm:flex justify-center flex-wrap gap-6 mb-6\" },\r\n desktopApps.map(app =>\r\n React.createElement('div', {\r\n key: app.id,\r\n className: `group relative ${cardSize} rounded-2xl overflow-hidden card-minimal cursor-pointer`\r\n }, [\r\n React.createElement('i', {\r\n key: 'bg-icon',\r\n className: `${app.icon} absolute text-[3rem] text-white/10 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none transition-all duration-500 group-hover:scale-105`\r\n }),\r\n React.createElement('div', {\r\n key: 'overlay',\r\n className: \"absolute inset-0 bg-black/30 backdrop-blur-md flex flex-col items-center justify-center text-center opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\r\n }, [\r\n React.createElement('h4', { key: 'name', className: `text-sm font-semibold text-primary mb-1` }, app.name),\r\n React.createElement('p', { key: 'subtitle', className: `text-xs text-secondary mb-2` }, app.subtitle),\r\n app.isActive ?\r\n React.createElement('button', {\r\n key: 'btn',\r\n onClick: () => handleDownload(app),\r\n className: `px-2 py-1 rounded-xl bg-emerald-500 text-black font-medium hover:bg-emerald-600 transition-colors text-xs`\r\n }, app.id === \"web\" ? \"Launch\" : \"Download\")\r\n :\r\n React.createElement('span', { key: 'coming', className: \"text-gray-400 font-medium text-xs\" }, \"Coming Soon\")\r\n ])\r\n ])\r\n )\r\n ),\r\n\r\n React.createElement('div', { key: 'mobile-row', className: \"flex justify-center gap-6\" },\r\n mobileApps.map(app =>\r\n React.createElement('div', {\r\n key: app.id,\r\n className: `group relative ${cardSize} rounded-2xl overflow-hidden card-minimal cursor-pointer`\r\n }, [\r\n React.createElement('i', {\r\n key: 'bg-icon',\r\n className: `${app.icon} absolute text-[3rem] text-white/10 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none transition-all duration-500 group-hover:scale-105`\r\n }),\r\n React.createElement('div', {\r\n key: 'overlay',\r\n className: \"absolute inset-0 bg-black/30 backdrop-blur-md flex flex-col items-center justify-center text-center opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\r\n }, [\r\n React.createElement('h4', { key: 'name', className: `text-sm font-semibold text-primary mb-1` }, app.name),\r\n React.createElement('p', { key: 'subtitle', className: `text-xs text-secondary mb-2` }, app.subtitle),\r\n app.isActive ?\r\n React.createElement('button', {\r\n key: 'btn',\r\n onClick: () => handleDownload(app),\r\n className: `px-2 py-1 rounded-xl bg-emerald-500 text-black font-medium hover:bg-emerald-600 transition-colors text-xs`\r\n }, \"Download\")\r\n :\r\n React.createElement('span', { key: 'coming', className: \"text-gray-400 font-medium text-xs\" }, \"Coming Soon\")\r\n ])\r\n ])\r\n )\r\n )\r\n ]);\r\n};\r\n\r\nwindow.DownloadApps = DownloadApps;\r\n", "// File Transfer Component for Chat Interface - Fixed Version\r\nconst FileTransferComponent = ({ webrtcManager, isConnected }) => {\r\n const [dragOver, setDragOver] = React.useState(false);\r\n const [transfers, setTransfers] = React.useState({ sending: [], receiving: [] });\r\n const [readyFiles, setReadyFiles] = React.useState([]); // \u0444\u0430\u0439\u043B\u044B, \u0433\u043E\u0442\u043E\u0432\u044B\u0435 \u043A \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044E\r\n const fileInputRef = React.useRef(null);\r\n\r\n // Update transfers periodically\r\n React.useEffect(() => {\r\n if (!isConnected || !webrtcManager) return;\r\n\r\n const updateTransfers = () => {\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n };\r\n\r\n const interval = setInterval(updateTransfers, 500);\r\n return () => clearInterval(interval);\r\n }, [isConnected, webrtcManager]);\r\n\r\n // Setup file transfer callbacks - \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u041D\u0415 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u043F\u0440\u043E\u043C\u0435\u0436\u0443\u0442\u043E\u0447\u043D\u044B\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u0447\u0430\u0442\r\n React.useEffect(() => {\r\n if (!webrtcManager) return;\r\n\r\n webrtcManager.setFileTransferCallbacks(\r\n // Progress callback - \u0422\u041E\u041B\u042C\u041A\u041E \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C UI, \u041D\u0415 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u0432 \u0447\u0430\u0442\r\n (progress) => {\r\n // \u041E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n \r\n // \u041D\u0415 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u0447\u0430\u0442!\r\n },\r\n \r\n // File received callback - \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u043C \u043A\u043D\u043E\u043F\u043A\u0443 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0432 UI\r\n (fileData) => {\r\n // \u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u043C \u0432 \u0441\u043F\u0438\u0441\u043E\u043A \u0433\u043E\u0442\u043E\u0432\u044B\u0445 \u043A \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044E\r\n setReadyFiles(prev => {\r\n // \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043C \u0434\u0443\u0431\u043B\u0435\u0439 \u043F\u043E fileId\r\n if (prev.some(f => f.fileId === fileData.fileId)) return prev;\r\n return [...prev, {\r\n fileId: fileData.fileId,\r\n fileName: fileData.fileName,\r\n fileSize: fileData.fileSize,\r\n mimeType: fileData.mimeType,\r\n getBlob: fileData.getBlob,\r\n getObjectURL: fileData.getObjectURL,\r\n revokeObjectURL: fileData.revokeObjectURL\r\n }];\r\n });\r\n\r\n // \u041E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0441\u043F\u0438\u0441\u043E\u043A \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0445 \u043F\u0435\u0440\u0435\u0434\u0430\u0447\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n },\r\n \r\n // Error callback\r\n (error) => {\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n \r\n // \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u041D\u0415 \u0434\u0443\u0431\u043B\u0438\u0440\u0443\u0435\u043C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u043E\u0431 \u043E\u0448\u0438\u0431\u043A\u0430\u0445\r\n // \u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F \u043E\u0431 \u043E\u0448\u0438\u0431\u043A\u0430\u0445 \u0443\u0436\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u044E\u0442\u0441\u044F \u0432 WebRTC \u043C\u0435\u043D\u0435\u0434\u0436\u0435\u0440\u0435\r\n }\r\n );\r\n }, [webrtcManager]);\r\n\r\n const handleFileSelect = async (files) => {\r\n if (!isConnected || !webrtcManager) {\r\n alert('\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435.');\r\n return;\r\n }\r\n\r\n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u044F \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\r\n if (!webrtcManager.isConnected() || !webrtcManager.isVerified) {\r\n alert('\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043D\u0435 \u0433\u043E\u0442\u043E\u0432\u043E \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432. \u0414\u043E\u0436\u0434\u0438\u0442\u0435\u0441\u044C \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F.');\r\n return;\r\n }\r\n\r\n for (const file of files) {\r\n try {\r\n // \u041A\u0420\u0418\u0422\u0418\u0427\u0415\u0421\u041A\u041E\u0415 \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u0412\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u044F \u0444\u0430\u0439\u043B\u0430 \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u043E\u0439\r\n const validation = webrtcManager.validateFile(file);\r\n if (!validation.isValid) {\r\n const errorMessage = validation.errors.join('. ');\r\n alert(`\u0424\u0430\u0439\u043B ${file.name} \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D: ${errorMessage}`);\r\n continue;\r\n }\r\n\r\n await webrtcManager.sendFile(file);\r\n } catch (error) {\r\n // \u0411\u043E\u043B\u0435\u0435 \u043C\u044F\u0433\u043A\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A - \u043D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0441\u0435\u0441\u0441\u0438\u044E\r\n \r\n // \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044E \u043E\u0448\u0438\u0431\u043A\u0443, \u043D\u043E \u043D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435\r\n if (error.message.includes('Connection not ready')) {\r\n alert(`\u0424\u0430\u0439\u043B ${file.name} \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u0441\u0435\u0439\u0447\u0430\u0441. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.`);\r\n } else if (error.message.includes('File too large') || error.message.includes('exceeds maximum')) {\r\n alert(`\u0424\u0430\u0439\u043B ${file.name} \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0439: ${error.message}`);\r\n } else if (error.message.includes('Maximum concurrent transfers')) {\r\n alert(`\u0414\u043E\u0441\u0442\u0438\u0433\u043D\u0443\u0442 \u043B\u0438\u043C\u0438\u0442 \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445 \u043F\u0435\u0440\u0435\u0434\u0430\u0447. \u0414\u043E\u0436\u0434\u0438\u0442\u0435\u0441\u044C \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0442\u0435\u043A\u0443\u0449\u0438\u0445 \u043F\u0435\u0440\u0435\u0434\u0430\u0447.`);\r\n } else if (error.message.includes('File type not allowed')) {\r\n alert(`\u0422\u0438\u043F \u0444\u0430\u0439\u043B\u0430 ${file.name} \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F: ${error.message}`);\r\n } else {\r\n alert(`\u041E\u0448\u0438\u0431\u043A\u0430 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u0444\u0430\u0439\u043B\u0430 ${file.name}: ${error.message}`);\r\n }\r\n }\r\n }\r\n };\r\n\r\n const handleDrop = (e) => {\r\n e.preventDefault();\r\n setDragOver(false);\r\n \r\n const files = Array.from(e.dataTransfer.files);\r\n handleFileSelect(files);\r\n };\r\n\r\n const handleDragOver = (e) => {\r\n e.preventDefault();\r\n setDragOver(true);\r\n };\r\n\r\n const handleDragLeave = (e) => {\r\n e.preventDefault();\r\n setDragOver(false);\r\n };\r\n\r\n const handleFileInputChange = (e) => {\r\n const files = Array.from(e.target.files);\r\n handleFileSelect(files);\r\n e.target.value = ''; // Reset input\r\n };\r\n\r\n const formatFileSize = (bytes) => {\r\n if (bytes === 0) return '0 B';\r\n const k = 1024;\r\n const sizes = ['B', 'KB', 'MB', 'GB'];\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\r\n };\r\n\r\n const getStatusIcon = (status) => {\r\n switch (status) {\r\n case 'metadata_sent':\r\n case 'preparing':\r\n return 'fas fa-cog fa-spin';\r\n case 'transmitting':\r\n case 'receiving':\r\n return 'fas fa-exchange-alt fa-pulse';\r\n case 'assembling':\r\n return 'fas fa-puzzle-piece fa-pulse';\r\n case 'completed':\r\n return 'fas fa-check text-green-400';\r\n case 'failed':\r\n return 'fas fa-times text-red-400';\r\n default:\r\n return 'fas fa-circle';\r\n }\r\n };\r\n\r\n const getStatusText = (status) => {\r\n switch (status) {\r\n case 'metadata_sent':\r\n return '\u041F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043A\u0430...';\r\n case 'transmitting':\r\n return '\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430...';\r\n case 'receiving':\r\n return '\u041F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435...';\r\n case 'assembling':\r\n return '\u0421\u0431\u043E\u0440\u043A\u0430 \u0444\u0430\u0439\u043B\u0430...';\r\n case 'completed':\r\n return '\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E';\r\n case 'failed':\r\n return '\u041E\u0448\u0438\u0431\u043A\u0430';\r\n default:\r\n return status;\r\n }\r\n };\r\n\r\n if (!isConnected) {\r\n return React.createElement('div', {\r\n className: \"p-4 text-center text-muted\"\r\n }, '\u041F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043B\u043E\u0432 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u043E\u043C \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0438');\r\n }\r\n\r\n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\r\n const isConnectionReady = webrtcManager && webrtcManager.isConnected() && webrtcManager.isVerified;\r\n \r\n if (!isConnectionReady) {\r\n return React.createElement('div', {\r\n className: \"p-4 text-center text-yellow-600\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-exclamation-triangle mr-2'\r\n }),\r\n '\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442\u0441\u044F... \u041F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043B\u043E\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438.'\r\n ]);\r\n }\r\n\r\n return React.createElement('div', {\r\n className: \"file-transfer-component\"\r\n }, [\r\n // File Drop Zone\r\n React.createElement('div', {\r\n key: 'drop-zone',\r\n className: `file-drop-zone ${dragOver ? 'drag-over' : ''}`,\r\n onDrop: handleDrop,\r\n onDragOver: handleDragOver,\r\n onDragLeave: handleDragLeave,\r\n onClick: () => fileInputRef.current?.click()\r\n }, [\r\n React.createElement('div', {\r\n key: 'drop-content',\r\n className: \"drop-content\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-cloud-upload-alt text-2xl mb-2 text-blue-400'\r\n }),\r\n React.createElement('p', {\r\n key: 'text',\r\n className: \"text-primary font-medium\"\r\n }, 'Drag files here or click to select'),\r\n React.createElement('p', {\r\n key: 'subtext',\r\n className: \"text-muted text-sm\"\r\n }, 'Maximum size: 100 MB per file')\r\n ])\r\n ]),\r\n\r\n // Hidden file input\r\n React.createElement('input', {\r\n key: 'file-input',\r\n ref: fileInputRef,\r\n type: 'file',\r\n multiple: true,\r\n className: 'hidden',\r\n onChange: handleFileInputChange\r\n }),\r\n\r\n // Active Transfers\r\n (transfers.sending.length > 0 || transfers.receiving.length > 0) && React.createElement('div', {\r\n key: 'transfers',\r\n className: \"active-transfers mt-4\"\r\n }, [\r\n React.createElement('h4', {\r\n key: 'title',\r\n className: \"text-primary font-medium mb-3 flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-exchange-alt mr-2'\r\n }),\r\n '\u041F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043B\u043E\u0432'\r\n ]),\r\n\r\n // Sending files\r\n ...transfers.sending.map(transfer => \r\n React.createElement('div', {\r\n key: `send-${transfer.fileId}`,\r\n className: \"transfer-item bg-blue-500/10 border border-blue-500/20 rounded-lg p-3 mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'header',\r\n className: \"flex items-center justify-between mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'info',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-upload text-blue-400 mr-2'\r\n }),\r\n React.createElement('span', {\r\n key: 'name',\r\n className: \"text-primary font-medium text-sm\"\r\n }, transfer.fileName),\r\n React.createElement('span', {\r\n key: 'size',\r\n className: \"text-muted text-xs ml-2\"\r\n }, formatFileSize(transfer.fileSize))\r\n ]),\r\n React.createElement('button', {\r\n key: 'cancel',\r\n onClick: () => webrtcManager.cancelFileTransfer(transfer.fileId),\r\n className: \"text-red-400 hover:text-red-300 text-xs\"\r\n }, [\r\n React.createElement('i', {\r\n className: 'fas fa-times'\r\n })\r\n ])\r\n ]),\r\n React.createElement('div', {\r\n key: 'progress',\r\n className: \"progress-bar\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'fill',\r\n className: \"progress-fill bg-blue-400\",\r\n style: { width: `${transfer.progress}%` }\r\n }),\r\n React.createElement('div', {\r\n key: 'text',\r\n className: \"progress-text text-xs flex items-center justify-between\"\r\n }, [\r\n React.createElement('span', {\r\n key: 'status',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: `${getStatusIcon(transfer.status)} mr-1`\r\n }),\r\n getStatusText(transfer.status)\r\n ]),\r\n React.createElement('span', {\r\n key: 'percent'\r\n }, `${transfer.progress.toFixed(1)}%`)\r\n ])\r\n ])\r\n ])\r\n ),\r\n\r\n // Receiving files\r\n ...transfers.receiving.map(transfer => \r\n React.createElement('div', {\r\n key: `recv-${transfer.fileId}`,\r\n className: \"transfer-item bg-green-500/10 border border-green-500/20 rounded-lg p-3 mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'header',\r\n className: \"flex items-center justify-between mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'info',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-download text-green-400 mr-2'\r\n }),\r\n React.createElement('span', {\r\n key: 'name',\r\n className: \"text-primary font-medium text-sm\"\r\n }, transfer.fileName),\r\n React.createElement('span', {\r\n key: 'size',\r\n className: \"text-muted text-xs ml-2\"\r\n }, formatFileSize(transfer.fileSize))\r\n ]),\r\n React.createElement('div', { key: 'actions', className: 'flex items-center space-x-2' }, [\r\n (() => {\r\n const rf = readyFiles.find(f => f.fileId === transfer.fileId);\r\n if (!rf || transfer.status !== 'completed') return null;\r\n return React.createElement('button', {\r\n key: 'download',\r\n className: 'text-green-400 hover:text-green-300 text-xs flex items-center',\r\n onClick: async () => {\r\n try {\r\n const url = await rf.getObjectURL();\r\n const a = document.createElement('a');\r\n a.href = url;\r\n a.download = rf.fileName || 'file';\r\n a.click();\r\n rf.revokeObjectURL(url);\r\n } catch (e) {\r\n alert('Failed to start download: ' + e.message);\r\n }\r\n }\r\n }, [\r\n React.createElement('i', { key: 'i', className: 'fas fa-download mr-1' }),\r\n 'Download'\r\n ]);\r\n })(),\r\n React.createElement('button', {\r\n key: 'cancel',\r\n onClick: () => webrtcManager.cancelFileTransfer(transfer.fileId),\r\n className: \"text-red-400 hover:text-red-300 text-xs\"\r\n }, [\r\n React.createElement('i', {\r\n className: 'fas fa-times'\r\n })\r\n ])\r\n ])\r\n ]),\r\n React.createElement('div', {\r\n key: 'progress',\r\n className: \"progress-bar\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'fill',\r\n className: \"progress-fill bg-green-400\",\r\n style: { width: `${transfer.progress}%` }\r\n }),\r\n React.createElement('div', {\r\n key: 'text',\r\n className: \"progress-text text-xs flex items-center justify-between\"\r\n }, [\r\n React.createElement('span', {\r\n key: 'status',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: `${getStatusIcon(transfer.status)} mr-1`\r\n }),\r\n getStatusText(transfer.status)\r\n ]),\r\n React.createElement('span', {\r\n key: 'percent'\r\n }, `${transfer.progress.toFixed(1)}%`)\r\n ])\r\n ])\r\n ])\r\n )\r\n ])\r\n ]);\r\n};\r\n\r\n// Export\r\nwindow.FileTransferComponent = FileTransferComponent;", "import { EnhancedSecureCryptoUtils } from '../crypto/EnhancedSecureCryptoUtils.js';\r\nimport { EnhancedSecureWebRTCManager } from '../network/EnhancedSecureWebRTCManager.js';\r\nimport { EnhancedSecureFileTransfer } from '../transfer/EnhancedSecureFileTransfer.js';\r\n\r\n// Import UI components (side-effect: they attach themselves to window.*)\r\nimport '../components/ui/SessionTimer.jsx';\r\nimport '../components/ui/Header.jsx';\r\nimport '../components/ui/DownloadApps.jsx';\r\nimport '../components/ui/FileTransfer.jsx';\r\n\r\n// Expose to global for legacy usage inside app code\r\nwindow.EnhancedSecureCryptoUtils = EnhancedSecureCryptoUtils;\r\nwindow.EnhancedSecureWebRTCManager = EnhancedSecureWebRTCManager;\r\nwindow.EnhancedSecureFileTransfer = EnhancedSecureFileTransfer;\r\n\r\n// Mount application once DOM and modules are ready\r\nconst start = () => {\r\n if (typeof window.initializeApp === 'function') {\r\n window.initializeApp();\r\n } else if (window.DEBUG_MODE) {\r\n console.error('initializeApp is not defined on window');\r\n }\r\n};\r\n\r\nif (document.readyState === 'loading') {\r\n document.addEventListener('DOMContentLoaded', start);\r\n} else {\r\n start();\r\n}\r\n"], - "mappings": ";AAAA,IAAM,4BAAN,MAAM,2BAA0B;AAAA,EAE5B,OAAO,eAAe,oBAAI,QAAQ;AAAA;AAAA;AAAA,EAKlC,OAAO,eAAe,KAAK;AACvB,QAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;AACzC,aAAO;AAAA,IACX;AAEA,QAAI,MAAM,QAAQ,GAAG,GAAG;AACpB,aAAO,IAAI,IAAI,2BAA0B,cAAc;AAAA,IAC3D;AAEA,UAAM,YAAY,CAAC;AACnB,WAAO,KAAK,GAAG,EAAE,KAAK,EAAE,QAAQ,SAAO;AACnC,gBAAU,GAAG,IAAI,2BAA0B,eAAe,IAAI,GAAG,CAAC;AAAA,IACtE,CAAC;AACD,WAAO;AAAA,EACX;AAAA;AAAA,EAGA,OAAO,gBAAgB,KAAK,eAAe,MAAM,iBAAiB,CAAC,GAAG;AAClE,QAAI,EAAE,eAAe,WAAY,OAAM,IAAI,MAAM,oBAAoB;AACrE,QAAI,gBAAgB,IAAI,WAAW,SAAS,cAAc;AACtD,YAAM,IAAI,MAAM,sBAAsB,YAAY,SAAS,IAAI,WAAW,IAAI,EAAE;AAAA,IACpF;AACA,eAAW,KAAK,gBAAgB;AAC5B,UAAI,CAAC,IAAI,UAAU,CAAC,IAAI,OAAO,SAAS,CAAC,GAAG;AACxC,cAAM,IAAI,MAAM,+BAA+B,CAAC,EAAE;AAAA,MACtD;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA,EAEA,OAAO,oBAAoB,QAAQ;AAC/B,QAAI,SAAS;AACb,UAAM,QAAQ,IAAI,WAAW,MAAM;AACnC,UAAM,MAAM,MAAM;AAClB,aAAS,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AW;AACrC,WAAS,iBAAiB,oBAAoB,KAAK;AACrD,OAAO;AACL,QAAM;AACR;", + "sourcesContent": ["class EnhancedSecureCryptoUtils {\n\n static _keyMetadata = new WeakMap();\n \n // Initialize secure logging system after class definition\n\n // Utility to sort object keys for deterministic serialization\n static sortObjectKeys(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(EnhancedSecureCryptoUtils.sortObjectKeys);\n }\n\n const sortedObj = {};\n Object.keys(obj).sort().forEach(key => {\n sortedObj[key] = EnhancedSecureCryptoUtils.sortObjectKeys(obj[key]);\n });\n return sortedObj;\n }\n\n // Utility to assert CryptoKey type and properties\n static assertCryptoKey(key, expectedName = null, expectedUsages = []) {\n if (!(key instanceof CryptoKey)) throw new Error('Expected CryptoKey');\n if (expectedName && key.algorithm?.name !== expectedName) {\n throw new Error(`Expected algorithm ${expectedName}, got ${key.algorithm?.name}`);\n }\n for (const u of expectedUsages) {\n if (!key.usages || !key.usages.includes(u)) {\n throw new Error(`Missing required key usage: ${u}`);\n }\n }\n }\n // Helper function to convert ArrayBuffer to Base64\n static arrayBufferToBase64(buffer) {\n let binary = '';\n const bytes = new Uint8Array(buffer);\n const len = bytes.byteLength;\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n // Helper function to convert Base64 to ArrayBuffer\n static base64ToArrayBuffer(base64) {\n try {\n // Validate input\n if (typeof base64 !== 'string' || !base64) {\n throw new Error('Invalid base64 input: must be a non-empty string');\n }\n\n // Remove any whitespace and validate base64 format\n const cleanBase64 = base64.trim();\n if (!/^[A-Za-z0-9+/]*={0,2}$/.test(cleanBase64)) {\n throw new Error('Invalid base64 format');\n }\n\n // Handle empty string case\n if (cleanBase64 === '') {\n return new ArrayBuffer(0);\n }\n\n const binaryString = atob(cleanBase64);\n const len = binaryString.length;\n const bytes = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes.buffer;\n } catch (error) {\n console.error('Base64 to ArrayBuffer conversion failed:', error.message);\n throw new Error(`Base64 conversion error: ${error.message}`);\n }\n }\n\n // Helper function to convert hex string to Uint8Array\n static hexToUint8Array(hexString) {\n try {\n if (!hexString || typeof hexString !== 'string') {\n throw new Error('Invalid hex string input: must be a non-empty string');\n }\n\n // Remove colons and spaces from hex string (e.g., \"aa:bb:cc\" -> \"aabbcc\")\n const cleanHex = hexString.replace(/:/g, '').replace(/\\s/g, '');\n \n // Validate hex format\n if (!/^[0-9a-fA-F]*$/.test(cleanHex)) {\n throw new Error('Invalid hex format: contains non-hex characters');\n }\n \n // Ensure even length\n if (cleanHex.length % 2 !== 0) {\n throw new Error('Invalid hex format: odd length');\n }\n\n // Convert hex string to bytes\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = parseInt(cleanHex.substr(i, 2), 16);\n }\n \n return bytes;\n } catch (error) {\n console.error('Hex to Uint8Array conversion failed:', error.message);\n throw new Error(`Hex conversion error: ${error.message}`);\n }\n }\n\n static async encryptData(data, password) {\n try {\n const dataString = typeof data === 'string' ? data : JSON.stringify(data);\n const salt = crypto.getRandomValues(new Uint8Array(16));\n const encoder = new TextEncoder();\n const passwordBuffer = encoder.encode(password);\n\n const keyMaterial = await crypto.subtle.importKey(\n 'raw',\n passwordBuffer,\n { name: 'PBKDF2' },\n false,\n ['deriveKey']\n );\n\n const key = await crypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt,\n iterations: 100000,\n hash: 'SHA-256',\n },\n keyMaterial,\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt']\n );\n\n const iv = crypto.getRandomValues(new Uint8Array(12));\n const dataBuffer = encoder.encode(dataString);\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: iv },\n key,\n dataBuffer\n );\n\n const encryptedPackage = {\n version: '1.0',\n salt: Array.from(salt),\n iv: Array.from(iv),\n data: Array.from(new Uint8Array(encrypted)),\n timestamp: Date.now(),\n };\n\n const packageString = JSON.stringify(encryptedPackage);\n return EnhancedSecureCryptoUtils.arrayBufferToBase64(new TextEncoder().encode(packageString).buffer);\n\n } catch (error) {\n console.error('Encryption failed:', error.message);\n throw new Error(`Encryption error: ${error.message}`);\n }\n }\n\n static async decryptData(encryptedData, password) {\n try {\n const packageBuffer = EnhancedSecureCryptoUtils.base64ToArrayBuffer(encryptedData);\n const packageString = new TextDecoder().decode(packageBuffer);\n const encryptedPackage = JSON.parse(packageString);\n\n if (!encryptedPackage.version || !encryptedPackage.salt || !encryptedPackage.iv || !encryptedPackage.data) {\n throw new Error('Invalid encrypted data format');\n }\n\n const salt = new Uint8Array(encryptedPackage.salt);\n const iv = new Uint8Array(encryptedPackage.iv);\n const encrypted = new Uint8Array(encryptedPackage.data);\n\n const encoder = new TextEncoder();\n const passwordBuffer = encoder.encode(password);\n\n const keyMaterial = await crypto.subtle.importKey(\n 'raw',\n passwordBuffer,\n { name: 'PBKDF2' },\n false,\n ['deriveKey']\n );\n\n const key = await crypto.subtle.deriveKey(\n {\n name: 'PBKDF2',\n salt: salt,\n iterations: 100000,\n hash: 'SHA-256'\n },\n keyMaterial,\n { name: 'AES-GCM', length: 256 },\n false,\n ['decrypt']\n );\n\n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv },\n key,\n encrypted\n );\n\n const decryptedString = new TextDecoder().decode(decrypted);\n\n try {\n return JSON.parse(decryptedString);\n } catch {\n return decryptedString;\n }\n\n } catch (error) {\n console.error('Decryption failed:', error.message);\n throw new Error(`Decryption error: ${error.message}`);\n }\n }\n\n \n // Generate secure password for data exchange\n static generateSecurePassword() {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?';\n const length = 32; \n const randomValues = new Uint32Array(length);\n crypto.getRandomValues(randomValues);\n \n let password = '';\n for (let i = 0; i < length; i++) {\n password += chars[randomValues[i] % chars.length];\n }\n return password;\n }\n\n // Real security level calculation with actual verification\n static async calculateSecurityLevel(securityManager) {\n let score = 0;\n const maxScore = 100; // Fixed: Changed from 110 to 100 for cleaner percentage\n const verificationResults = {};\n \n try {\n // Fallback to basic calculation if securityManager is not fully initialized\n if (!securityManager || !securityManager.securityFeatures) {\n console.warn('Security manager not fully initialized, using fallback calculation');\n return {\n level: 'INITIALIZING',\n score: 0,\n color: 'gray',\n verificationResults: {},\n timestamp: Date.now(),\n details: 'Security system initializing...',\n isRealData: false\n };\n }\n\n // All security features are enabled by default - no session type restrictions\n const sessionType = 'full'; // All features enabled\n const isDemoSession = false; // All features available\n \n // 1. Base encryption verification (20 points) - Available in demo\n try {\n const encryptionResult = await EnhancedSecureCryptoUtils.verifyEncryption(securityManager);\n if (encryptionResult.passed) {\n score += 20;\n verificationResults.verifyEncryption = { passed: true, details: encryptionResult.details, points: 20 };\n } else {\n verificationResults.verifyEncryption = { passed: false, details: encryptionResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyEncryption = { passed: false, details: `Encryption check failed: ${error.message}`, points: 0 };\n }\n \n // 2. Simple key exchange verification (15 points) - Available in demo\n try {\n const ecdhResult = await EnhancedSecureCryptoUtils.verifyECDHKeyExchange(securityManager);\n if (ecdhResult.passed) {\n score += 15;\n verificationResults.verifyECDHKeyExchange = { passed: true, details: ecdhResult.details, points: 15 };\n } else {\n verificationResults.verifyECDHKeyExchange = { passed: false, details: ecdhResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyECDHKeyExchange = { passed: false, details: `Key exchange check failed: ${error.message}`, points: 0 };\n }\n \n // 3. Message integrity verification (10 points) - Available in demo\n try {\n const integrityResult = await EnhancedSecureCryptoUtils.verifyMessageIntegrity(securityManager);\n if (integrityResult.passed) {\n score += 10;\n verificationResults.verifyMessageIntegrity = { passed: true, details: integrityResult.details, points: 10 };\n } else {\n verificationResults.verifyMessageIntegrity = { passed: false, details: integrityResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyMessageIntegrity = { passed: false, details: `Message integrity check failed: ${error.message}`, points: 0 };\n }\n \n // 4. ECDSA signatures verification (15 points) - All features enabled by default\n try {\n const ecdsaResult = await EnhancedSecureCryptoUtils.verifyECDSASignatures(securityManager);\n if (ecdsaResult.passed) {\n score += 15;\n verificationResults.verifyECDSASignatures = { passed: true, details: ecdsaResult.details, points: 15 };\n } else {\n verificationResults.verifyECDSASignatures = { passed: false, details: ecdsaResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyECDSASignatures = { passed: false, details: `Digital signatures check failed: ${error.message}`, points: 0 };\n }\n \n // 5. Rate limiting verification (5 points) - Available in demo\n try {\n const rateLimitResult = await EnhancedSecureCryptoUtils.verifyRateLimiting(securityManager);\n if (rateLimitResult.passed) {\n score += 5;\n verificationResults.verifyRateLimiting = { passed: true, details: rateLimitResult.details, points: 5 };\n } else {\n verificationResults.verifyRateLimiting = { passed: false, details: rateLimitResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyRateLimiting = { passed: false, details: `Rate limiting check failed: ${error.message}`, points: 0 };\n }\n \n // 6. Metadata protection verification (10 points) - All features enabled by default\n try {\n const metadataResult = await EnhancedSecureCryptoUtils.verifyMetadataProtection(securityManager);\n if (metadataResult.passed) {\n score += 10;\n verificationResults.verifyMetadataProtection = { passed: true, details: metadataResult.details, points: 10 };\n } else {\n verificationResults.verifyMetadataProtection = { passed: false, details: metadataResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyMetadataProtection = { passed: false, details: `Metadata protection check failed: ${error.message}`, points: 0 };\n }\n \n // 7. Perfect Forward Secrecy verification (10 points) - All features enabled by default\n try {\n const pfsResult = await EnhancedSecureCryptoUtils.verifyPerfectForwardSecrecy(securityManager);\n if (pfsResult.passed) {\n score += 10;\n verificationResults.verifyPerfectForwardSecrecy = { passed: true, details: pfsResult.details, points: 10 };\n } else {\n verificationResults.verifyPerfectForwardSecrecy = { passed: false, details: pfsResult.details, points: 0 };\n }\n } catch (error) {\n verificationResults.verifyPerfectForwardSecrecy = { passed: false, details: `PFS check failed: ${error.message}`, points: 0 };\n }\n \n // 8. Nested encryption verification (5 points) - All features enabled by default\n if (await EnhancedSecureCryptoUtils.verifyNestedEncryption(securityManager)) {\n score += 5;\n verificationResults.nestedEncryption = { passed: true, details: 'Nested encryption active', points: 5 };\n } else {\n verificationResults.nestedEncryption = { passed: false, details: 'Nested encryption failed', points: 0 };\n }\n \n // 9. Packet padding verification (5 points) - All features enabled by default\n if (await EnhancedSecureCryptoUtils.verifyPacketPadding(securityManager)) {\n score += 5;\n verificationResults.packetPadding = { passed: true, details: 'Packet padding active', points: 5 };\n } else {\n verificationResults.packetPadding = { passed: false, details: 'Packet padding failed', points: 0 };\n }\n \n // 10. Advanced features verification (10 points) - All features enabled by default\n if (await EnhancedSecureCryptoUtils.verifyAdvancedFeatures(securityManager)) {\n score += 10;\n verificationResults.advancedFeatures = { passed: true, details: 'Advanced features active', points: 10 };\n } else {\n verificationResults.advancedFeatures = { passed: false, details: 'Advanced features failed', points: 0 };\n }\n \n const percentage = Math.round((score / maxScore) * 100);\n \n // All security features are available - no restrictions\n const availableChecks = 10; // All 10 security checks available\n const passedChecks = Object.values(verificationResults).filter(r => r.passed).length;\n \n const result = {\n level: percentage >= 85 ? 'HIGH' : percentage >= 65 ? 'MEDIUM' : percentage >= 35 ? 'LOW' : 'CRITICAL',\n score: percentage,\n color: percentage >= 85 ? 'green' : percentage >= 65 ? 'orange' : percentage >= 35 ? 'yellow' : 'red',\n verificationResults,\n timestamp: Date.now(),\n details: `Real verification: ${score}/${maxScore} security checks passed (${passedChecks}/${availableChecks} available)`,\n isRealData: true,\n passedChecks: passedChecks,\n totalChecks: availableChecks,\n sessionType: sessionType,\n maxPossibleScore: 100 // All features enabled - max 100 points\n };\n \n console.log('Real security level calculated:', {\n score: percentage,\n level: result.level,\n passedChecks: passedChecks,\n totalChecks: availableChecks,\n sessionType: sessionType,\n maxPossibleScore: result.maxPossibleScore\n });\n \n return result;\n } catch (error) {\n console.error('Security level calculation failed:', error.message);\n return {\n level: 'UNKNOWN',\n score: 0,\n color: 'red',\n verificationResults: {},\n timestamp: Date.now(),\n details: `Verification failed: ${error.message}`,\n isRealData: false\n };\n }\n }\n\n // Real verification functions\n static async verifyEncryption(securityManager) {\n try {\n if (!securityManager.encryptionKey) {\n return { passed: false, details: 'No encryption key available' };\n }\n \n // Test actual encryption/decryption with multiple data types\n const testCases = [\n 'Test encryption verification',\n '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438',\n 'Special chars: !@#$%^&*()_+-=[]{}|;:,.<>?',\n 'Large data: ' + 'A'.repeat(1000)\n ];\n \n for (const testData of testCases) {\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n const iv = crypto.getRandomValues(new Uint8Array(12));\n \n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n securityManager.encryptionKey,\n testBuffer\n );\n \n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv },\n securityManager.encryptionKey,\n encrypted\n );\n \n const decryptedText = new TextDecoder().decode(decrypted);\n if (decryptedText !== testData) {\n return { passed: false, details: `Decryption mismatch for: ${testData.substring(0, 20)}...` };\n }\n }\n \n return { passed: true, details: 'AES-GCM encryption/decryption working correctly' };\n } catch (error) {\n console.error('Encryption verification failed:', error.message);\n return { passed: false, details: `Encryption test failed: ${error.message}` };\n }\n }\n \n static async verifyECDHKeyExchange(securityManager) {\n try {\n if (!securityManager.ecdhKeyPair || !securityManager.ecdhKeyPair.privateKey || !securityManager.ecdhKeyPair.publicKey) {\n return { passed: false, details: 'No ECDH key pair available' };\n }\n \n // Test that keys are actually ECDH keys\n const keyType = securityManager.ecdhKeyPair.privateKey.algorithm.name;\n const curve = securityManager.ecdhKeyPair.privateKey.algorithm.namedCurve;\n \n if (keyType !== 'ECDH') {\n return { passed: false, details: `Invalid key type: ${keyType}, expected ECDH` };\n }\n \n if (curve !== 'P-384' && curve !== 'P-256') {\n return { passed: false, details: `Unsupported curve: ${curve}, expected P-384 or P-256` };\n }\n \n // Test key derivation\n try {\n const derivedKey = await crypto.subtle.deriveKey(\n { name: 'ECDH', public: securityManager.ecdhKeyPair.publicKey },\n securityManager.ecdhKeyPair.privateKey,\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt', 'decrypt']\n );\n \n if (!derivedKey) {\n return { passed: false, details: 'Key derivation failed' };\n }\n } catch (deriveError) {\n return { passed: false, details: `Key derivation test failed: ${deriveError.message}` };\n }\n \n return { passed: true, details: `ECDH key exchange working with ${curve} curve` };\n } catch (error) {\n console.error('ECDH verification failed:', error.message);\n return { passed: false, details: `ECDH test failed: ${error.message}` };\n }\n }\n \n static async verifyECDSASignatures(securityManager) {\n try {\n if (!securityManager.ecdsaKeyPair || !securityManager.ecdsaKeyPair.privateKey || !securityManager.ecdsaKeyPair.publicKey) {\n return { passed: false, details: 'No ECDSA key pair available' };\n }\n \n // Test actual signing and verification with multiple test cases\n const testCases = [\n 'Test ECDSA signature verification',\n '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0434\u043B\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u0438',\n 'Special chars: !@#$%^&*()_+-=[]{}|;:,.<>?',\n 'Large data: ' + 'B'.repeat(2000)\n ];\n \n for (const testData of testCases) {\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n const signature = await crypto.subtle.sign(\n { name: 'ECDSA', hash: 'SHA-256' },\n securityManager.ecdsaKeyPair.privateKey,\n testBuffer\n );\n \n const isValid = await crypto.subtle.verify(\n { name: 'ECDSA', hash: 'SHA-256' },\n securityManager.ecdsaKeyPair.publicKey,\n signature,\n testBuffer\n );\n \n if (!isValid) {\n return { passed: false, details: `Signature verification failed for: ${testData.substring(0, 20)}...` };\n }\n }\n \n return { passed: true, details: 'ECDSA digital signatures working correctly' };\n } catch (error) {\n console.error('ECDSA verification failed:', error.message);\n return { passed: false, details: `ECDSA test failed: ${error.message}` };\n }\n }\n \n static async verifyMessageIntegrity(securityManager) {\n try {\n // Check if macKey exists and is a valid CryptoKey\n if (!securityManager.macKey || !(securityManager.macKey instanceof CryptoKey)) {\n return { passed: false, details: 'MAC key not available or invalid' };\n }\n \n // Test message integrity with HMAC using multiple test cases\n const testCases = [\n 'Test message integrity verification',\n '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0446\u0435\u043B\u043E\u0441\u0442\u043D\u043E\u0441\u0442\u0438',\n 'Special chars: !@#$%^&*()_+-=[]{}|;:,.<>?',\n 'Large data: ' + 'C'.repeat(3000)\n ];\n \n for (const testData of testCases) {\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n const hmac = await crypto.subtle.sign(\n { name: 'HMAC', hash: 'SHA-256' },\n securityManager.macKey,\n testBuffer\n );\n \n const isValid = await crypto.subtle.verify(\n { name: 'HMAC', hash: 'SHA-256' },\n securityManager.macKey,\n hmac,\n testBuffer\n );\n \n if (!isValid) {\n return { passed: false, details: `HMAC verification failed for: ${testData.substring(0, 20)}...` };\n }\n }\n \n return { passed: true, details: 'Message integrity (HMAC) working correctly' };\n } catch (error) {\n console.error('Message integrity verification failed:', error.message);\n return { passed: false, details: `Message integrity test failed: ${error.message}` };\n }\n }\n \n // Additional verification functions\n static async verifyRateLimiting(securityManager) {\n try {\n // Rate limiting is always available in this implementation\n return { passed: true, details: 'Rate limiting is active and working' };\n } catch (error) {\n return { passed: false, details: `Rate limiting test failed: ${error.message}` };\n }\n }\n \n static async verifyMetadataProtection(securityManager) {\n try {\n // Metadata protection is always enabled in this implementation\n return { passed: true, details: 'Metadata protection is working correctly' };\n } catch (error) {\n return { passed: false, details: `Metadata protection test failed: ${error.message}` };\n }\n }\n \n static async verifyPerfectForwardSecrecy(securityManager) {\n try {\n // Perfect Forward Secrecy is always enabled in this implementation\n return { passed: true, details: 'Perfect Forward Secrecy is configured and active' };\n } catch (error) {\n return { passed: false, details: `PFS test failed: ${error.message}` };\n }\n }\n \n static async verifyReplayProtection(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifyReplayProtection debug:');\n console.log(' - securityManager.replayProtection:', securityManager.replayProtection);\n console.log(' - securityManager keys:', Object.keys(securityManager));\n \n // Check if replay protection is enabled\n if (!securityManager.replayProtection) {\n return { passed: false, details: 'Replay protection not enabled' };\n }\n \n return { passed: true, details: 'Replay protection is working correctly' };\n } catch (error) {\n return { passed: false, details: `Replay protection test failed: ${error.message}` };\n }\n }\n \n static async verifyDTLSFingerprint(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifyDTLSFingerprint debug:');\n console.log(' - securityManager.dtlsFingerprint:', securityManager.dtlsFingerprint);\n \n // Check if DTLS fingerprint is available\n if (!securityManager.dtlsFingerprint) {\n return { passed: false, details: 'DTLS fingerprint not available' };\n }\n \n return { passed: true, details: 'DTLS fingerprint is valid and available' };\n } catch (error) {\n return { passed: false, details: `DTLS fingerprint test failed: ${error.message}` };\n }\n }\n \n static async verifySASVerification(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifySASVerification debug:');\n console.log(' - securityManager.sasCode:', securityManager.sasCode);\n \n // Check if SAS code is available\n if (!securityManager.sasCode) {\n return { passed: false, details: 'SAS code not available' };\n }\n \n return { passed: true, details: 'SAS verification code is valid and available' };\n } catch (error) {\n return { passed: false, details: `SAS verification test failed: ${error.message}` };\n }\n }\n \n static async verifyTrafficObfuscation(securityManager) {\n try {\n console.log('\uD83D\uDD0D verifyTrafficObfuscation debug:');\n console.log(' - securityManager.trafficObfuscation:', securityManager.trafficObfuscation);\n \n // Check if traffic obfuscation is enabled\n if (!securityManager.trafficObfuscation) {\n return { passed: false, details: 'Traffic obfuscation not enabled' };\n }\n \n return { passed: true, details: 'Traffic obfuscation is working correctly' };\n } catch (error) {\n return { passed: false, details: `Traffic obfuscation test failed: ${error.message}` };\n }\n }\n \n static async verifyNestedEncryption(securityManager) {\n try {\n // Check if nestedEncryptionKey exists and is a valid CryptoKey\n if (!securityManager.nestedEncryptionKey || !(securityManager.nestedEncryptionKey instanceof CryptoKey)) {\n console.warn('Nested encryption key not available or invalid');\n return false;\n }\n \n // Test nested encryption\n const testData = 'Test nested encryption verification';\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n // Simulate nested encryption\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: crypto.getRandomValues(new Uint8Array(12)) },\n securityManager.nestedEncryptionKey,\n testBuffer\n );\n \n return encrypted && encrypted.byteLength > 0;\n } catch (error) {\n console.error('Nested encryption verification failed:', error.message);\n return false;\n }\n }\n \n static async verifyPacketPadding(securityManager) {\n try {\n if (!securityManager.paddingConfig || !securityManager.paddingConfig.enabled) return false;\n \n // Test packet padding functionality\n const testData = 'Test packet padding verification';\n const encoder = new TextEncoder();\n const testBuffer = encoder.encode(testData);\n \n // Simulate packet padding\n const paddingSize = Math.floor(Math.random() * (securityManager.paddingConfig.maxPadding - securityManager.paddingConfig.minPadding)) + securityManager.paddingConfig.minPadding;\n const paddedData = new Uint8Array(testBuffer.byteLength + paddingSize);\n paddedData.set(new Uint8Array(testBuffer), 0);\n \n return paddedData.byteLength >= testBuffer.byteLength + securityManager.paddingConfig.minPadding;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Packet padding verification failed', { error: error.message });\n return false;\n }\n }\n \n static async verifyAdvancedFeatures(securityManager) {\n try {\n // Test advanced features like traffic obfuscation, fake traffic, etc.\n const hasFakeTraffic = securityManager.fakeTrafficConfig && securityManager.fakeTrafficConfig.enabled;\n const hasDecoyChannels = securityManager.decoyChannelsConfig && securityManager.decoyChannelsConfig.enabled;\n const hasAntiFingerprinting = securityManager.antiFingerprintingConfig && securityManager.antiFingerprintingConfig.enabled;\n \n return hasFakeTraffic || hasDecoyChannels || hasAntiFingerprinting;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Advanced features verification failed', { error: error.message });\n return false;\n }\n }\n \n static async verifyMutualAuth(securityManager) {\n try {\n if (!securityManager.isVerified || !securityManager.verificationCode) return false;\n \n // Test mutual authentication\n return securityManager.isVerified && securityManager.verificationCode.length > 0;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Mutual auth verification failed', { error: error.message });\n return false;\n }\n }\n \n \n static async verifyNonExtractableKeys(securityManager) {\n try {\n if (!securityManager.encryptionKey) return false;\n \n // Test if keys are non-extractable\n const keyData = await crypto.subtle.exportKey('raw', securityManager.encryptionKey);\n return keyData && keyData.byteLength > 0;\n } catch (error) {\n // If export fails, keys are non-extractable (which is good)\n return true;\n }\n }\n \n static async verifyEnhancedValidation(securityManager) {\n try {\n if (!securityManager.securityFeatures) return false;\n \n // Test enhanced validation features\n const hasValidation = securityManager.securityFeatures.hasEnhancedValidation || \n securityManager.securityFeatures.hasEnhancedReplayProtection;\n \n return hasValidation;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Enhanced validation verification failed', { error: error.message });\n return false;\n }\n }\n \n \n static async verifyPFS(securityManager) {\n try {\n // Check if PFS is active\n return securityManager.securityFeatures &&\n securityManager.securityFeatures.hasPFS === true &&\n securityManager.keyRotationInterval &&\n securityManager.currentKeyVersion !== undefined &&\n securityManager.keyVersions &&\n securityManager.keyVersions instanceof Map;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'PFS verification failed', { error: error.message });\n return false;\n }\n }\n\n // Rate limiting implementation\n static rateLimiter = {\n messages: new Map(),\n connections: new Map(),\n locks: new Map(),\n \n async checkMessageRate(identifier, limit = 60, windowMs = 60000) {\n if (typeof identifier !== 'string' || identifier.length > 256) {\n return false;\n }\n \n const key = `msg_${identifier}`;\n\n if (this.locks.has(key)) {\n\n await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 10) + 5));\n return this.checkMessageRate(identifier, limit, windowMs);\n }\n \n this.locks.set(key, true);\n \n try {\n const now = Date.now();\n \n if (!this.messages.has(key)) {\n this.messages.set(key, []);\n }\n \n const timestamps = this.messages.get(key);\n \n const validTimestamps = timestamps.filter(ts => now - ts < windowMs);\n \n if (validTimestamps.length >= limit) {\n return false; \n }\n \n validTimestamps.push(now);\n this.messages.set(key, validTimestamps);\n return true;\n } finally {\n this.locks.delete(key);\n }\n },\n \n async checkConnectionRate(identifier, limit = 5, windowMs = 300000) {\n if (typeof identifier !== 'string' || identifier.length > 256) {\n return false;\n }\n \n const key = `conn_${identifier}`;\n \n if (this.locks.has(key)) {\n await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 10) + 5));\n return this.checkConnectionRate(identifier, limit, windowMs);\n }\n \n this.locks.set(key, true);\n \n try {\n const now = Date.now();\n \n if (!this.connections.has(key)) {\n this.connections.set(key, []);\n }\n \n const timestamps = this.connections.get(key);\n const validTimestamps = timestamps.filter(ts => now - ts < windowMs);\n \n if (validTimestamps.length >= limit) {\n return false;\n }\n \n validTimestamps.push(now);\n this.connections.set(key, validTimestamps);\n return true;\n } finally {\n this.locks.delete(key);\n }\n },\n \n cleanup() {\n const now = Date.now();\n const maxAge = 3600000; \n \n for (const [key, timestamps] of this.messages.entries()) {\n if (this.locks.has(key)) continue;\n \n const valid = timestamps.filter(ts => now - ts < maxAge);\n if (valid.length === 0) {\n this.messages.delete(key);\n } else {\n this.messages.set(key, valid);\n }\n }\n \n for (const [key, timestamps] of this.connections.entries()) {\n if (this.locks.has(key)) continue;\n \n const valid = timestamps.filter(ts => now - ts < maxAge);\n if (valid.length === 0) {\n this.connections.delete(key);\n } else {\n this.connections.set(key, valid);\n }\n }\n\n for (const lockKey of this.locks.keys()) {\n const keyTimestamp = parseInt(lockKey.split('_').pop()) || 0;\n if (now - keyTimestamp > 30000) {\n this.locks.delete(lockKey);\n }\n }\n }\n};\n\n static validateSalt(salt) {\n if (!salt || salt.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes');\n }\n \n const uniqueBytes = new Set(salt);\n if (uniqueBytes.size < 16) {\n throw new Error('Salt has insufficient entropy');\n }\n \n return true;\n }\n\n // Secure logging without data leaks\n static secureLog = {\n logs: [],\n maxLogs: 100,\n isProductionMode: false,\n \n // Initialize production mode detection\n init() {\n this.isProductionMode = this._detectProductionMode();\n if (this.isProductionMode) {\n console.log('[SecureChat] Production mode detected - sensitive logging disabled');\n }\n },\n \n _detectProductionMode() {\n return (\n (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') ||\n (!window.DEBUG_MODE && !window.DEVELOPMENT_MODE) ||\n (window.location.hostname && !window.location.hostname.includes('localhost') && \n !window.location.hostname.includes('127.0.0.1') && \n !window.location.hostname.includes('.local')) ||\n (typeof window.webpackHotUpdate === 'undefined' && !window.location.search.includes('debug'))\n );\n },\n \n log(level, message, context = {}) {\n const sanitizedContext = this.sanitizeContext(context);\n const logEntry = {\n timestamp: Date.now(),\n level,\n message,\n context: sanitizedContext,\n id: crypto.getRandomValues(new Uint32Array(1))[0]\n };\n \n this.logs.push(logEntry);\n \n // Keep only recent logs\n if (this.logs.length > this.maxLogs) {\n this.logs = this.logs.slice(-this.maxLogs);\n }\n \n // Production-safe console output\n if (this.isProductionMode) {\n if (level === 'error') {\n // \u0412 production \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u043A\u043E\u0434 \u043E\u0448\u0438\u0431\u043A\u0438 \u0431\u0435\u0437 \u0434\u0435\u0442\u0430\u043B\u0435\u0439\n console.error(`\u274C [SecureChat] ${message} [ERROR_CODE: ${this._generateErrorCode(message)}]`);\n } else if (level === 'warn') {\n // \u0412 production \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435 \u0431\u0435\u0437 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u0430\n console.warn(`\u26A0\uFE0F [SecureChat] ${message}`);\n } else {\n // \u0412 production \u043D\u0435 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C info/debug \u043B\u043E\u0433\u0438\n return;\n }\n } else {\n // Development mode - \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0432\u0441\u0435\n if (level === 'error') {\n console.error(`\u274C [SecureChat] ${message}`, { errorType: sanitizedContext?.constructor?.name || 'Unknown' });\n } else if (level === 'warn') {\n console.warn(`\u26A0\uFE0F [SecureChat] ${message}`, { details: sanitizedContext });\n } else {\n console.log(`[SecureChat] ${message}`, sanitizedContext);\n }\n }\n },\n \n // \u0413\u0435\u043D\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u044B\u0439 \u043A\u043E\u0434 \u043E\u0448\u0438\u0431\u043A\u0438 \u0434\u043B\u044F production\n _generateErrorCode(message) {\n const hash = message.split('').reduce((a, b) => {\n a = ((a << 5) - a) + b.charCodeAt(0);\n return a & a;\n }, 0);\n return Math.abs(hash).toString(36).substring(0, 6).toUpperCase();\n },\n \n sanitizeContext(context) {\n if (!context || typeof context !== 'object') {\n return context;\n }\n \n const sensitivePatterns = [\n /key/i, /secret/i, /password/i, /token/i, /signature/i,\n /challenge/i, /proof/i, /salt/i, /iv/i, /nonce/i, /hash/i,\n /fingerprint/i, /mac/i, /private/i, /encryption/i, /decryption/i\n ];\n \n const sanitized = {};\n for (const [key, value] of Object.entries(context)) {\n const isSensitive = sensitivePatterns.some(pattern => \n pattern.test(key) || (typeof value === 'string' && pattern.test(value))\n );\n \n if (isSensitive) {\n sanitized[key] = '[REDACTED]';\n } else if (typeof value === 'string' && value.length > 100) {\n sanitized[key] = value.substring(0, 100) + '...[TRUNCATED]';\n } else if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n sanitized[key] = `[${value.constructor.name}(${value.byteLength || value.length} bytes)]`;\n } else if (value && typeof value === 'object' && !Array.isArray(value)) {\n // \u0420\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u0430\u044F \u0441\u0430\u043D\u0438\u0442\u0438\u0437\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432\n sanitized[key] = this.sanitizeContext(value);\n } else {\n sanitized[key] = value;\n }\n }\n return sanitized;\n },\n \n getLogs(level = null) {\n if (level) {\n return this.logs.filter(log => log.level === level);\n }\n return [...this.logs];\n },\n \n clearLogs() {\n this.logs = [];\n },\n \n // \u041C\u0435\u0442\u043E\u0434 \u0434\u043B\u044F \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u043E\u0448\u0438\u0431\u043E\u043A \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 production\n async sendErrorToServer(errorCode, message, context = {}) {\n if (!this.isProductionMode) {\n return; // \u0412 development \u043D\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C\n }\n \n try {\n // \u041E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E\n const safeErrorData = {\n errorCode,\n timestamp: Date.now(),\n userAgent: navigator.userAgent.substring(0, 100),\n url: window.location.href.substring(0, 100)\n };\n \n // \u0417\u0434\u0435\u0441\u044C \u043C\u043E\u0436\u043D\u043E \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\n // await fetch('/api/error-log', { method: 'POST', body: JSON.stringify(safeErrorData) });\n \n if (window.DEBUG_MODE) {\n console.log('[SecureChat] Error logged to server:', safeErrorData);\n }\n } catch (e) {\n // \u041D\u0435 \u043B\u043E\u0433\u0438\u0440\u0443\u0435\u043C \u043E\u0448\u0438\u0431\u043A\u0438 \u043B\u043E\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\n }\n }\n };\n\n // Generate ECDH key pair for secure key exchange (non-extractable) with fallback\n static async generateECDHKeyPair() {\n try {\n // Try P-384 first\n try {\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDH',\n namedCurve: 'P-384'\n },\n false, // Non-extractable for enhanced security\n ['deriveKey']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDH key pair generated successfully (P-384)', {\n curve: 'P-384',\n extractable: false\n });\n \n return keyPair;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 generation failed, trying P-256', { error: p384Error.message });\n \n // Fallback to P-256\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDH',\n namedCurve: 'P-256'\n },\n false, // Non-extractable for enhanced security\n ['deriveKey']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDH key pair generated successfully (P-256 fallback)', {\n curve: 'P-256',\n extractable: false\n });\n \n return keyPair;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'ECDH key generation failed', { error: error.message });\n throw new Error('Failed to create keys for secure exchange');\n }\n }\n\n // Generate ECDSA key pair for digital signatures with fallback\n static async generateECDSAKeyPair() {\n try {\n // Try P-384 first\n try {\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDSA',\n namedCurve: 'P-384'\n },\n false, // Non-extractable for enhanced security\n ['sign', 'verify']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDSA key pair generated successfully (P-384)', {\n curve: 'P-384',\n extractable: false\n });\n \n return keyPair;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 generation failed, trying P-256', { error: p384Error.message });\n \n // Fallback to P-256\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDSA',\n namedCurve: 'P-256'\n },\n false, // Non-extractable for enhanced security\n ['sign', 'verify']\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'ECDSA key pair generated successfully (P-256 fallback)', {\n curve: 'P-256',\n extractable: false\n });\n \n return keyPair;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'ECDSA key generation failed', { error: error.message });\n throw new Error('Failed to generate keys for digital signatures');\n }\n }\n\n // Sign data with ECDSA (P-384 or P-256)\n static async signData(privateKey, data) {\n try {\n const encoder = new TextEncoder();\n const dataBuffer = typeof data === 'string' ? encoder.encode(data) : data;\n \n // Try SHA-384 first, fallback to SHA-256\n try {\n const signature = await crypto.subtle.sign(\n {\n name: 'ECDSA',\n hash: 'SHA-384'\n },\n privateKey,\n dataBuffer\n );\n \n return Array.from(new Uint8Array(signature));\n } catch (sha384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'SHA-384 signing failed, trying SHA-256', { error: sha384Error.message });\n \n const signature = await crypto.subtle.sign(\n {\n name: 'ECDSA',\n hash: 'SHA-256'\n },\n privateKey,\n dataBuffer\n );\n \n return Array.from(new Uint8Array(signature));\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Data signing failed', { error: error.message });\n throw new Error('Failed to sign data');\n }\n }\n\n // Verify ECDSA signature (P-384 or P-256)\n static async verifySignature(publicKey, signature, data) {\n try {\n const encoder = new TextEncoder();\n const dataBuffer = typeof data === 'string' ? encoder.encode(data) : data;\n const signatureBuffer = new Uint8Array(signature);\n \n // Try SHA-384 first, fallback to SHA-256\n try {\n const isValid = await crypto.subtle.verify(\n {\n name: 'ECDSA',\n hash: 'SHA-384'\n },\n publicKey,\n signatureBuffer,\n dataBuffer\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signature verification completed (SHA-384)', {\n isValid,\n dataSize: dataBuffer.length\n });\n \n return isValid;\n } catch (sha384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'SHA-384 verification failed, trying SHA-256', { error: sha384Error.message });\n \n const isValid = await crypto.subtle.verify(\n {\n name: 'ECDSA',\n hash: 'SHA-256'\n },\n publicKey,\n signatureBuffer,\n dataBuffer\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signature verification completed (SHA-256 fallback)', {\n isValid,\n dataSize: dataBuffer.length\n });\n \n return isValid;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Signature verification failed', { error: error.message });\n throw new Error('Failed to verify digital signature');\n }\n }\n\n // Enhanced DER/SPKI validation with full ASN.1 parsing\n static async validateKeyStructure(keyData, expectedAlgorithm = 'ECDH') {\n try {\n if (!Array.isArray(keyData) || keyData.length === 0) {\n throw new Error('Invalid key data format');\n }\n\n const keyBytes = new Uint8Array(keyData);\n\n // Size limits to prevent DoS\n if (keyBytes.length < 50) {\n throw new Error('Key data too short - invalid SPKI structure');\n }\n if (keyBytes.length > 2000) {\n throw new Error('Key data too long - possible attack');\n }\n\n // Parse ASN.1 DER structure\n const asn1 = EnhancedSecureCryptoUtils.parseASN1(keyBytes);\n \n // Validate SPKI structure\n if (!asn1 || asn1.tag !== 0x30) {\n throw new Error('Invalid SPKI structure - missing SEQUENCE tag');\n }\n\n // SPKI should have exactly 2 elements: AlgorithmIdentifier and BIT STRING\n if (asn1.children.length !== 2) {\n throw new Error(`Invalid SPKI structure - expected 2 elements, got ${asn1.children.length}`);\n }\n\n // Validate AlgorithmIdentifier\n const algIdentifier = asn1.children[0];\n if (algIdentifier.tag !== 0x30) {\n throw new Error('Invalid AlgorithmIdentifier - not a SEQUENCE');\n }\n\n // Parse algorithm OID\n const algOid = algIdentifier.children[0];\n if (algOid.tag !== 0x06) {\n throw new Error('Invalid algorithm OID - not an OBJECT IDENTIFIER');\n }\n\n // Validate algorithm OID based on expected algorithm\n const oidBytes = algOid.value;\n const oidString = EnhancedSecureCryptoUtils.oidToString(oidBytes);\n \n // Check for expected algorithms\n const validAlgorithms = {\n 'ECDH': ['1.2.840.10045.2.1'], // id-ecPublicKey\n 'ECDSA': ['1.2.840.10045.2.1'], // id-ecPublicKey (same as ECDH)\n 'RSA': ['1.2.840.113549.1.1.1'], // rsaEncryption\n 'AES-GCM': ['2.16.840.1.101.3.4.1.6', '2.16.840.1.101.3.4.1.46'] // AES-128-GCM, AES-256-GCM\n };\n\n const expectedOids = validAlgorithms[expectedAlgorithm];\n if (!expectedOids) {\n throw new Error(`Unknown algorithm: ${expectedAlgorithm}`);\n }\n\n if (!expectedOids.includes(oidString)) {\n throw new Error(`Invalid algorithm OID: expected ${expectedOids.join(' or ')}, got ${oidString}`);\n }\n\n // For EC algorithms, validate curve parameters\n if (expectedAlgorithm === 'ECDH' || expectedAlgorithm === 'ECDSA') {\n if (algIdentifier.children.length < 2) {\n throw new Error('Missing curve parameters for EC key');\n }\n\n const curveOid = algIdentifier.children[1];\n if (curveOid.tag !== 0x06) {\n throw new Error('Invalid curve OID - not an OBJECT IDENTIFIER');\n }\n\n const curveOidString = EnhancedSecureCryptoUtils.oidToString(curveOid.value);\n \n // Only allow P-256 and P-384 curves\n const validCurves = {\n '1.2.840.10045.3.1.7': 'P-256', // secp256r1\n '1.3.132.0.34': 'P-384' // secp384r1\n };\n\n if (!validCurves[curveOidString]) {\n throw new Error(`Invalid or unsupported curve OID: ${curveOidString}`);\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'EC key curve validated', {\n curve: validCurves[curveOidString],\n oid: curveOidString\n });\n }\n\n // Validate public key BIT STRING\n const publicKeyBitString = asn1.children[1];\n if (publicKeyBitString.tag !== 0x03) {\n throw new Error('Invalid public key - not a BIT STRING');\n }\n\n // Check for unused bits (should be 0 for public keys)\n if (publicKeyBitString.value[0] !== 0x00) {\n throw new Error(`Invalid BIT STRING - unexpected unused bits: ${publicKeyBitString.value[0]}`);\n }\n\n // For EC keys, validate point format\n if (expectedAlgorithm === 'ECDH' || expectedAlgorithm === 'ECDSA') {\n const pointData = publicKeyBitString.value.slice(1); // Skip unused bits byte\n \n // Check for uncompressed point format (0x04)\n if (pointData[0] !== 0x04) {\n throw new Error(`Invalid EC point format: expected uncompressed (0x04), got 0x${pointData[0].toString(16)}`);\n }\n\n // Validate point size based on curve\n const expectedSizes = {\n 'P-256': 65, // 1 + 32 + 32\n 'P-384': 97 // 1 + 48 + 48\n };\n\n // We already validated the curve above, so we can determine expected size\n const curveOidString = EnhancedSecureCryptoUtils.oidToString(algIdentifier.children[1].value);\n const curveName = curveOidString === '1.2.840.10045.3.1.7' ? 'P-256' : 'P-384';\n const expectedSize = expectedSizes[curveName];\n\n if (pointData.length !== expectedSize) {\n throw new Error(`Invalid EC point size for ${curveName}: expected ${expectedSize}, got ${pointData.length}`);\n }\n }\n\n // Additional validation: try to import the key\n try {\n const algorithm = expectedAlgorithm === 'ECDSA' || expectedAlgorithm === 'ECDH'\n ? { name: expectedAlgorithm, namedCurve: 'P-384' }\n : { name: expectedAlgorithm };\n\n const usages = expectedAlgorithm === 'ECDSA' ? ['verify'] : [];\n \n await crypto.subtle.importKey('spki', keyBytes.buffer, algorithm, false, usages);\n } catch (importError) {\n // Try P-256 as fallback for EC keys\n if (expectedAlgorithm === 'ECDSA' || expectedAlgorithm === 'ECDH') {\n try {\n const algorithm = { name: expectedAlgorithm, namedCurve: 'P-256' };\n const usages = expectedAlgorithm === 'ECDSA' ? ['verify'] : [];\n await crypto.subtle.importKey('spki', keyBytes.buffer, algorithm, false, usages);\n } catch (fallbackError) {\n throw new Error(`Key import validation failed: ${fallbackError.message}`);\n }\n } else {\n throw new Error(`Key import validation failed: ${importError.message}`);\n }\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Key structure validation passed', {\n keyLen: keyBytes.length,\n algorithm: expectedAlgorithm,\n asn1Valid: true,\n oidValid: true,\n importValid: true\n });\n\n return true;\n } catch (err) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Key structure validation failed', {\n error: err.message,\n algorithm: expectedAlgorithm\n });\n throw new Error(`Invalid key structure: ${err.message}`);\n }\n }\n\n // ASN.1 DER parser helper\n static parseASN1(bytes, offset = 0) {\n if (offset >= bytes.length) {\n return null;\n }\n\n const tag = bytes[offset];\n let lengthOffset = offset + 1;\n \n if (lengthOffset >= bytes.length) {\n throw new Error('Truncated ASN.1 structure');\n }\n\n let length = bytes[lengthOffset];\n let valueOffset = lengthOffset + 1;\n\n // Handle long form length\n if (length & 0x80) {\n const numLengthBytes = length & 0x7f;\n if (numLengthBytes > 4) {\n throw new Error('ASN.1 length too large');\n }\n \n length = 0;\n for (let i = 0; i < numLengthBytes; i++) {\n if (valueOffset + i >= bytes.length) {\n throw new Error('Truncated ASN.1 length');\n }\n length = (length << 8) | bytes[valueOffset + i];\n }\n valueOffset += numLengthBytes;\n }\n\n if (valueOffset + length > bytes.length) {\n throw new Error('ASN.1 structure extends beyond data');\n }\n\n const value = bytes.slice(valueOffset, valueOffset + length);\n const node = {\n tag: tag,\n length: length,\n value: value,\n children: []\n };\n\n // Parse children for SEQUENCE and SET\n if (tag === 0x30 || tag === 0x31) {\n let childOffset = 0;\n while (childOffset < value.length) {\n const child = EnhancedSecureCryptoUtils.parseASN1(value, childOffset);\n if (!child) break;\n node.children.push(child);\n childOffset = childOffset + 1 + child.lengthBytes + child.length;\n }\n }\n\n // Calculate how many bytes were used for length encoding\n node.lengthBytes = valueOffset - lengthOffset;\n \n return node;\n }\n\n // OID decoder helper\n static oidToString(bytes) {\n if (!bytes || bytes.length === 0) {\n throw new Error('Empty OID');\n }\n\n const parts = [];\n \n // First byte encodes first two components\n const first = Math.floor(bytes[0] / 40);\n const second = bytes[0] % 40;\n parts.push(first);\n parts.push(second);\n\n // Decode remaining components\n let value = 0;\n for (let i = 1; i < bytes.length; i++) {\n value = (value << 7) | (bytes[i] & 0x7f);\n if (!(bytes[i] & 0x80)) {\n parts.push(value);\n value = 0;\n }\n }\n\n return parts.join('.');\n }\n\n // Helper to validate and sanitize OID string\n static validateOidString(oidString) {\n // OID format: digits separated by dots\n const oidRegex = /^[0-9]+(\\.[0-9]+)*$/;\n if (!oidRegex.test(oidString)) {\n throw new Error(`Invalid OID format: ${oidString}`);\n }\n\n const parts = oidString.split('.').map(Number);\n \n // First component must be 0, 1, or 2\n if (parts[0] > 2) {\n throw new Error(`Invalid OID first component: ${parts[0]}`);\n }\n\n // If first component is 0 or 1, second must be <= 39\n if ((parts[0] === 0 || parts[0] === 1) && parts[1] > 39) {\n throw new Error(`Invalid OID second component: ${parts[1]} (must be <= 39 for first component ${parts[0]})`);\n }\n\n return true;\n }\n\n // Export public key for transmission with signature \n static async exportPublicKeyWithSignature(publicKey, signingKey, keyType = 'ECDH') {\n try {\n // Validate key type\n if (!['ECDH', 'ECDSA'].includes(keyType)) {\n throw new Error('Invalid key type');\n }\n \n const exported = await crypto.subtle.exportKey('spki', publicKey);\n const keyData = Array.from(new Uint8Array(exported));\n \n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, keyType);\n \n // Create signed key package\n const keyPackage = {\n keyType,\n keyData,\n timestamp: Date.now(),\n version: '4.0'\n };\n \n // Sign the key package\n const packageString = JSON.stringify(keyPackage);\n const signature = await EnhancedSecureCryptoUtils.signData(signingKey, packageString);\n \n const signedPackage = {\n ...keyPackage,\n signature\n };\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Public key exported with signature', {\n keyType,\n keySize: keyData.length,\n signed: true\n });\n \n return signedPackage;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Public key export failed', {\n error: error.message,\n keyType\n });\n throw new Error(`Failed to export ${keyType} key: ${error.message}`);\n }\n }\n\n // Import and verify signed public key\n static async importSignedPublicKey(signedPackage, verifyingKey, expectedKeyType = 'ECDH') {\n try {\n // Validate package structure\n if (!signedPackage || typeof signedPackage !== 'object') {\n throw new Error('Invalid signed package format');\n }\n \n const { keyType, keyData, timestamp, version, signature } = signedPackage;\n \n if (!keyType || !keyData || !timestamp || !signature) {\n throw new Error('Missing required fields in signed package');\n }\n \n if (!EnhancedSecureCryptoUtils.constantTimeCompare(keyType, expectedKeyType)) {\n throw new Error(`Key type mismatch: expected ${expectedKeyType}, got ${keyType}`);\n }\n \n // Check timestamp (reject keys older than 1 hour)\n const keyAge = Date.now() - timestamp;\n if (keyAge > 3600000) {\n throw new Error('Signed key package is too old');\n }\n \n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, keyType);\n \n // Verify signature\n const packageCopy = { keyType, keyData, timestamp, version };\n const packageString = JSON.stringify(packageCopy);\n const isValidSignature = await EnhancedSecureCryptoUtils.verifySignature(verifyingKey, signature, packageString);\n \n if (!isValidSignature) {\n throw new Error('Invalid signature on key package - possible MITM attack');\n }\n \n // Import the key with fallback support\n const keyBytes = new Uint8Array(keyData);\n \n // Try P-384 first\n try {\n const algorithm = keyType === 'ECDH' ?\n { name: 'ECDH', namedCurve: 'P-384' }\n : { name: 'ECDSA', namedCurve: 'P-384' };\n \n const keyUsages = keyType === 'ECDH' ? [] : ['verify'];\n \n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n algorithm,\n false, // Non-extractable\n keyUsages\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signed public key imported successfully (P-384)', {\n keyType,\n signatureValid: true,\n keyAge: Math.round(keyAge / 1000) + 's'\n });\n \n return publicKey;\n } catch (p384Error) {\n // Fallback to P-256\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 import failed, trying P-256', {\n error: p384Error.message\n });\n \n const algorithm = keyType === 'ECDH' ?\n { name: 'ECDH', namedCurve: 'P-256' }\n : { name: 'ECDSA', namedCurve: 'P-256' };\n \n const keyUsages = keyType === 'ECDH' ? [] : ['verify'];\n \n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n algorithm,\n false, // Non-extractable\n keyUsages\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Signed public key imported successfully (P-256 fallback)', {\n keyType,\n signatureValid: true,\n keyAge: Math.round(keyAge / 1000) + 's'\n });\n \n return publicKey;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Signed public key import failed', {\n error: error.message,\n expectedKeyType\n });\n throw new Error(`Failed to import the signed key: ${error.message}`);\n }\n }\n\n // Legacy export for backward compatibility\n static async exportPublicKey(publicKey) {\n try {\n const exported = await crypto.subtle.exportKey('spki', publicKey);\n const keyData = Array.from(new Uint8Array(exported));\n \n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, 'ECDH');\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Legacy public key exported', { keySize: keyData.length });\n return keyData;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Legacy public key export failed', { error: error.message });\n throw new Error('Failed to export the public key');\n }\n }\n\n // Legacy import for backward compatibility with fallback\n static async importPublicKey(keyData) {\n try {\n await EnhancedSecureCryptoUtils.validateKeyStructure(keyData, 'ECDH');\n \n const keyBytes = new Uint8Array(keyData);\n \n // Try P-384 first\n try {\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: 'ECDH',\n namedCurve: 'P-384'\n },\n false, // Non-extractable\n []\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Legacy public key imported (P-384)', { keySize: keyData.length });\n return publicKey;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 import failed, trying P-256', { error: p384Error.message });\n \n // Fallback to P-256\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: 'ECDH',\n namedCurve: 'P-256'\n },\n false, // Non-extractable\n []\n );\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Legacy public key imported (P-256 fallback)', { keySize: keyData.length });\n return publicKey;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Legacy public key import failed', { error: error.message });\n throw new Error('Failed to import the public key');\n }\n }\n\n\n // Method to check if a key is trusted\n static isKeyTrusted(keyOrFingerprint) {\n if (keyOrFingerprint instanceof CryptoKey) {\n const meta = EnhancedSecureCryptoUtils._keyMetadata.get(keyOrFingerprint);\n return meta ? meta.trusted === true : false;\n } else if (keyOrFingerprint && keyOrFingerprint._securityMetadata) {\n // Check by key metadata\n return keyOrFingerprint._securityMetadata.trusted === true;\n }\n\n return false;\n }\n\n static async importPublicKeyFromSignedPackage(signedPackage, verifyingKey = null, options = {}) {\n try {\n if (!signedPackage || !signedPackage.keyData || !signedPackage.signature) {\n throw new Error('Invalid signed key package format');\n }\n\n // Validate all required fields are present\n const requiredFields = ['keyData', 'signature', 'keyType', 'timestamp', 'version'];\n const missingFields = requiredFields.filter(field => !signedPackage[field]);\n\n if (missingFields.length > 0) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Missing required fields in signed package', {\n missingFields: missingFields,\n availableFields: Object.keys(signedPackage)\n });\n throw new Error(`Required fields are missing in the signed package: ${missingFields.join(', ')}`);\n }\n\n // SECURITY ENHANCEMENT: MANDATORY signature verification for signed packages\n if (!verifyingKey) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'SECURITY VIOLATION: Signed package received without verifying key', {\n keyType: signedPackage.keyType,\n keySize: signedPackage.keyData.length,\n timestamp: signedPackage.timestamp,\n version: signedPackage.version,\n securityRisk: 'HIGH - Potential MITM attack vector'\n });\n\n // REJECT the signed package if no verifying key provided\n throw new Error('CRITICAL SECURITY ERROR: Signed key package received without a verification key. ' +\n 'This may indicate a possible MITM attack attempt. Import rejected for security reasons.');\n }\n\n // \u041E\u0411\u041D\u041E\u0412\u041B\u0415\u041D\u041E: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C \u0443\u043B\u0443\u0447\u0448\u0435\u043D\u043D\u0443\u044E \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u044E\n await EnhancedSecureCryptoUtils.validateKeyStructure(signedPackage.keyData, signedPackage.keyType || 'ECDH');\n\n // MANDATORY signature verification when verifyingKey is provided\n const packageCopy = { ...signedPackage };\n delete packageCopy.signature;\n const packageString = JSON.stringify(packageCopy);\n const isValidSignature = await EnhancedSecureCryptoUtils.verifySignature(verifyingKey, signedPackage.signature, packageString);\n\n if (!isValidSignature) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'SECURITY BREACH: Invalid signature detected - MITM attack prevented', {\n keyType: signedPackage.keyType,\n keySize: signedPackage.keyData.length,\n timestamp: signedPackage.timestamp,\n version: signedPackage.version,\n attackPrevented: true\n });\n throw new Error('CRITICAL SECURITY ERROR: Invalid key signature detected. ' +\n 'This indicates a possible MITM attack attempt. Key import rejected.');\n }\n\n // Additional MITM protection: Check for key reuse and suspicious patterns\n const keyFingerprint = await EnhancedSecureCryptoUtils.calculateKeyFingerprint(signedPackage.keyData);\n\n // Log successful verification with security details\n EnhancedSecureCryptoUtils.secureLog.log('info', 'SECURE: Signature verification passed for signed package', {\n keyType: signedPackage.keyType,\n keySize: signedPackage.keyData.length,\n timestamp: signedPackage.timestamp,\n version: signedPackage.version,\n signatureVerified: true,\n securityLevel: 'HIGH',\n keyFingerprint: keyFingerprint.substring(0, 8) // Only log first 8 chars for security\n });\n\n // Import the public key with fallback\n const keyBytes = new Uint8Array(signedPackage.keyData);\n const keyType = signedPackage.keyType || 'ECDH';\n\n // Try P-384 first\n try {\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: keyType,\n namedCurve: 'P-384'\n },\n false, // Non-extractable\n keyType === 'ECDSA' ? ['verify'] : []\n );\n\n // Use WeakMap to store metadata\n EnhancedSecureCryptoUtils._keyMetadata.set(publicKey, {\n trusted: true,\n verificationStatus: 'VERIFIED_SECURE',\n verificationTimestamp: Date.now()\n });\n\n return publicKey;\n } catch (p384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'P-384 import failed, trying P-256', { error: p384Error.message });\n\n // Fallback to P-256\n const publicKey = await crypto.subtle.importKey(\n 'spki',\n keyBytes,\n {\n name: keyType,\n namedCurve: 'P-256'\n },\n false, // Non-extractable\n keyType === 'ECDSA' ? ['verify'] : []\n );\n\n // Use WeakMap to store metadata\n EnhancedSecureCryptoUtils._keyMetadata.set(publicKey, {\n trusted: true,\n verificationStatus: 'VERIFIED_SECURE',\n verificationTimestamp: Date.now()\n });\n\n return publicKey;\n }\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Signed package key import failed', {\n error: error.message,\n securityImplications: 'Potential security breach prevented'\n });\n throw new Error(`Failed to import the public key from the signed package: ${error.message}`);\n }\n }\n\n // Enhanced key derivation with metadata protection and 64-byte salt\n static async deriveSharedKeys(privateKey, publicKey, salt) {\n try {\n // Validate input parameters are CryptoKey instances\n if (!(privateKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Private key is not a CryptoKey', {\n privateKeyType: typeof privateKey,\n privateKeyAlgorithm: privateKey?.algorithm?.name\n });\n throw new Error('The private key is not a valid CryptoKey.');\n }\n \n if (!(publicKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Public key is not a CryptoKey', {\n publicKeyType: typeof publicKey,\n publicKeyAlgorithm: publicKey?.algorithm?.name\n });\n throw new Error('The private key is not a valid CryptoKey.');\n }\n \n // Validate salt size (should be 64 bytes for enhanced security)\n if (!salt || salt.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes for enhanced security');\n }\n \n const saltBytes = new Uint8Array(salt);\n const encoder = new TextEncoder();\n \n // Enhanced context info with version and additional entropy\n const contextInfo = encoder.encode('SecureBit.chat v4.0 Enhanced Security Edition');\n \n // Derive master shared secret with enhanced parameters\n // Try SHA-384 first, fallback to SHA-256\n let sharedSecret;\n try {\n sharedSecret = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey\n },\n privateKey,\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: contextInfo\n },\n false, // Non-extractable\n ['deriveKey']\n );\n } catch (sha384Error) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'SHA-384 key derivation failed, trying SHA-256', { \n error: sha384Error.message,\n privateKeyType: typeof privateKey,\n publicKeyType: typeof publicKey,\n privateKeyAlgorithm: privateKey?.algorithm?.name,\n publicKeyAlgorithm: publicKey?.algorithm?.name\n });\n \n sharedSecret = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey\n },\n privateKey,\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: contextInfo\n },\n false, // Non-extractable\n ['deriveKey']\n );\n }\n\n // Derive message encryption key with fallback\n let encryptionKey;\n try {\n encryptionKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('message-encryption-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable for enhanced security\n ['encrypt', 'decrypt']\n );\n } catch (sha384Error) {\n encryptionKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('message-encryption-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable for enhanced security\n ['encrypt', 'decrypt']\n );\n }\n\n // Derive MAC key for message authentication with fallback\n let macKey;\n try {\n macKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('message-authentication-v4')\n },\n sharedSecret,\n {\n name: 'HMAC',\n hash: 'SHA-384'\n },\n false, // Non-extractable\n ['sign', 'verify']\n );\n } catch (sha384Error) {\n macKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('message-authentication-v4')\n },\n sharedSecret,\n {\n name: 'HMAC',\n hash: 'SHA-256'\n },\n false, // Non-extractable\n ['sign', 'verify']\n );\n }\n\n // Derive separate metadata encryption key with fallback\n let metadataKey;\n try {\n metadataKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('metadata-protection-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable\n ['encrypt', 'decrypt']\n );\n } catch (sha384Error) {\n metadataKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('metadata-protection-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n false, // Non-extractable\n ['encrypt', 'decrypt']\n );\n }\n\n // Generate temporary extractable key for fingerprint calculation with fallback\n let fingerprintKey;\n try {\n fingerprintKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-384',\n salt: saltBytes,\n info: encoder.encode('fingerprint-generation-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n true, // Extractable only for fingerprint\n ['encrypt', 'decrypt']\n );\n } catch (sha384Error) {\n fingerprintKey = await crypto.subtle.deriveKey(\n {\n name: 'HKDF',\n hash: 'SHA-256',\n salt: saltBytes,\n info: encoder.encode('fingerprint-generation-v4')\n },\n sharedSecret,\n {\n name: 'AES-GCM',\n length: 256\n },\n true, // Extractable only for fingerprint\n ['encrypt', 'decrypt']\n );\n }\n\n // Generate key fingerprint for verification\n const fingerprintKeyData = await crypto.subtle.exportKey('raw', fingerprintKey);\n const fingerprint = await EnhancedSecureCryptoUtils.generateKeyFingerprint(Array.from(new Uint8Array(fingerprintKeyData)));\n\n // Validate that all derived keys are CryptoKey instances\n if (!(encryptionKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Derived encryption key is not a CryptoKey', {\n encryptionKeyType: typeof encryptionKey,\n encryptionKeyAlgorithm: encryptionKey?.algorithm?.name\n });\n throw new Error('The derived encryption key is not a valid CryptoKey.');\n }\n \n if (!(macKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Derived MAC key is not a CryptoKey', {\n macKeyType: typeof macKey,\n macKeyAlgorithm: macKey?.algorithm?.name\n });\n throw new Error('The derived MAC key is not a valid CryptoKey.');\n }\n \n if (!(metadataKey instanceof CryptoKey)) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Derived metadata key is not a CryptoKey', {\n metadataKeyType: typeof metadataKey,\n metadataKeyAlgorithm: metadataKey?.algorithm?.name\n });\n throw new Error('The derived metadata key is not a valid CryptoKey.');\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Enhanced shared keys derived successfully', {\n saltSize: salt.length,\n hasMetadataKey: true,\n nonExtractable: true,\n version: '4.0',\n allKeysValid: true\n });\n\n return {\n encryptionKey,\n macKey,\n metadataKey,\n fingerprint,\n timestamp: Date.now(),\n version: '4.0'\n };\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Enhanced key derivation failed', { error: error.message });\n throw new Error(`Failed to create shared encryption keys: ${error.message}`);\n }\n }\n\n static async generateKeyFingerprint(keyData) {\n const keyBuffer = new Uint8Array(keyData);\n const hashBuffer = await crypto.subtle.digest('SHA-384', keyBuffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.slice(0, 12).map(b => b.toString(16).padStart(2, '0')).join(':');\n }\n\n // Generate mutual authentication challenge\n static generateMutualAuthChallenge() {\n const challenge = crypto.getRandomValues(new Uint8Array(48)); // Increased to 48 bytes\n const timestamp = Date.now();\n const nonce = crypto.getRandomValues(new Uint8Array(16));\n \n return {\n challenge: Array.from(challenge),\n timestamp,\n nonce: Array.from(nonce),\n version: '4.0'\n };\n }\n\n // Create cryptographic proof for mutual authentication\n static async createAuthProof(challenge, privateKey, publicKey) {\n try {\n if (!challenge || !challenge.challenge || !challenge.timestamp || !challenge.nonce) {\n throw new Error('Invalid challenge structure');\n }\n \n // Check challenge age (max 2 minutes)\n const challengeAge = Date.now() - challenge.timestamp;\n if (challengeAge > 120000) {\n throw new Error('Challenge expired');\n }\n \n // Create proof data\n const proofData = {\n challenge: challenge.challenge,\n timestamp: challenge.timestamp,\n nonce: challenge.nonce,\n responseTimestamp: Date.now(),\n publicKeyHash: await EnhancedSecureCryptoUtils.hashPublicKey(publicKey)\n };\n \n // Sign the proof\n const proofString = JSON.stringify(proofData);\n const signature = await EnhancedSecureCryptoUtils.signData(privateKey, proofString);\n \n const proof = {\n ...proofData,\n signature,\n version: '4.0'\n };\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Authentication proof created', {\n challengeAge: Math.round(challengeAge / 1000) + 's'\n });\n \n return proof;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Authentication proof creation failed', { error: error.message });\n throw new Error(`Failed to create cryptographic proof: ${error.message}`);\n }\n }\n\n // Verify mutual authentication proof\n static async verifyAuthProof(proof, challenge, publicKey) {\n try {\n await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 20) + 5));\n // Assert the public key is valid and has the correct usage\n EnhancedSecureCryptoUtils.assertCryptoKey(publicKey, 'ECDSA', ['verify']);\n\n if (!proof || !challenge || !publicKey) {\n throw new Error('Missing required parameters for proof verification');\n }\n\n // Validate proof structure\n const requiredFields = ['challenge', 'timestamp', 'nonce', 'responseTimestamp', 'publicKeyHash', 'signature'];\n for (const field of requiredFields) {\n if (!proof[field]) {\n throw new Error(`Missing required field: ${field}`);\n }\n }\n\n // Verify challenge matches\n if (!EnhancedSecureCryptoUtils.constantTimeCompareArrays(proof.challenge, challenge.challenge) ||\n proof.timestamp !== challenge.timestamp ||\n !EnhancedSecureCryptoUtils.constantTimeCompareArrays(proof.nonce, challenge.nonce)) {\n throw new Error('Challenge mismatch - possible replay attack');\n }\n\n // Check response time (max 5 minutes)\n const responseAge = Date.now() - proof.responseTimestamp;\n if (responseAge > 300000) {\n throw new Error('Proof response expired');\n }\n\n // Verify public key hash\n const expectedHash = await EnhancedSecureCryptoUtils.hashPublicKey(publicKey);\n if (!EnhancedSecureCryptoUtils.constantTimeCompare(proof.publicKeyHash, expectedHash)) {\n throw new Error('Public key hash mismatch');\n }\n\n // Verify signature\n const proofCopy = { ...proof };\n delete proofCopy.signature;\n const proofString = JSON.stringify(proofCopy);\n const isValidSignature = await EnhancedSecureCryptoUtils.verifySignature(publicKey, proof.signature, proofString);\n\n if (!isValidSignature) {\n throw new Error('Invalid proof signature');\n }\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Authentication proof verified successfully', {\n responseAge: Math.round(responseAge / 1000) + 's'\n });\n\n return true;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Authentication proof verification failed', { error: error.message });\n throw new Error(`Failed to verify cryptographic proof: ${error.message}`);\n }\n }\n\n // Hash public key for verification\n static async hashPublicKey(publicKey) {\n try {\n const exported = await crypto.subtle.exportKey('spki', publicKey);\n const hash = await crypto.subtle.digest('SHA-384', exported);\n const hashArray = Array.from(new Uint8Array(hash));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Public key hashing failed', { error: error.message });\n throw new Error('Failed to create hash of the public key');\n }\n }\n\n // Legacy authentication challenge for backward compatibility\n static generateAuthChallenge() {\n const challenge = crypto.getRandomValues(new Uint8Array(32));\n return Array.from(challenge);\n }\n\n // Generate verification code for out-of-band authentication\n static generateVerificationCode() {\n const chars = '0123456789ABCDEF';\n let result = '';\n const values = crypto.getRandomValues(new Uint8Array(6));\n for (let i = 0; i < 6; i++) {\n result += chars[values[i] % chars.length];\n }\n return result.match(/.{1,2}/g).join('-');\n }\n\n // Enhanced message encryption with metadata protection and sequence numbers\n static async encryptMessage(message, encryptionKey, macKey, metadataKey, messageId, sequenceNumber = 0) {\n try {\n if (!message || typeof message !== 'string') {\n throw new Error('Invalid message format');\n }\n\n EnhancedSecureCryptoUtils.assertCryptoKey(encryptionKey, 'AES-GCM', ['encrypt']);\n EnhancedSecureCryptoUtils.assertCryptoKey(macKey, 'HMAC', ['sign']);\n EnhancedSecureCryptoUtils.assertCryptoKey(metadataKey, 'AES-GCM', ['encrypt']);\n\n const encoder = new TextEncoder();\n const messageData = encoder.encode(message);\n const messageIv = crypto.getRandomValues(new Uint8Array(12));\n const metadataIv = crypto.getRandomValues(new Uint8Array(12));\n const timestamp = Date.now();\n\n const paddingSize = 16 - (messageData.length % 16);\n const paddedMessage = new Uint8Array(messageData.length + paddingSize);\n paddedMessage.set(messageData);\n const padding = crypto.getRandomValues(new Uint8Array(paddingSize));\n paddedMessage.set(padding, messageData.length);\n\n const encryptedMessage = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: messageIv },\n encryptionKey,\n paddedMessage\n );\n\n const metadata = {\n id: messageId,\n timestamp: timestamp,\n sequenceNumber: sequenceNumber,\n originalLength: messageData.length,\n version: '4.0'\n };\n\n const metadataStr = JSON.stringify(EnhancedSecureCryptoUtils.sortObjectKeys(metadata));\n const encryptedMetadata = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: metadataIv },\n metadataKey,\n encoder.encode(metadataStr)\n );\n\n const payload = {\n messageIv: Array.from(messageIv),\n messageData: Array.from(new Uint8Array(encryptedMessage)),\n metadataIv: Array.from(metadataIv),\n metadataData: Array.from(new Uint8Array(encryptedMetadata)),\n version: '4.0'\n };\n\n const sortedPayload = EnhancedSecureCryptoUtils.sortObjectKeys(payload);\n const payloadStr = JSON.stringify(sortedPayload);\n\n const mac = await crypto.subtle.sign(\n 'HMAC',\n macKey,\n encoder.encode(payloadStr)\n );\n\n payload.mac = Array.from(new Uint8Array(mac));\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Message encrypted with metadata protection', {\n messageId,\n sequenceNumber,\n hasMetadataProtection: true,\n hasPadding: true\n });\n\n return payload;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Message encryption failed', {\n error: error.message,\n messageId\n });\n throw new Error(`Failed to encrypt the message: ${error.message}`);\n }\n }\n\n // Enhanced message decryption with metadata protection and sequence validation\n static async decryptMessage(encryptedPayload, encryptionKey, macKey, metadataKey, expectedSequenceNumber = null) {\n try {\n EnhancedSecureCryptoUtils.assertCryptoKey(encryptionKey, 'AES-GCM', ['decrypt']);\n EnhancedSecureCryptoUtils.assertCryptoKey(macKey, 'HMAC', ['verify']);\n EnhancedSecureCryptoUtils.assertCryptoKey(metadataKey, 'AES-GCM', ['decrypt']);\n\n const requiredFields = ['messageIv', 'messageData', 'metadataIv', 'metadataData', 'mac', 'version'];\n for (const field of requiredFields) {\n if (!encryptedPayload[field]) {\n throw new Error(`Missing required field: ${field}`);\n }\n }\n\n const payloadCopy = { ...encryptedPayload };\n delete payloadCopy.mac;\n const sortedPayloadCopy = EnhancedSecureCryptoUtils.sortObjectKeys(payloadCopy);\n const payloadStr = JSON.stringify(sortedPayloadCopy);\n\n const macValid = await crypto.subtle.verify(\n 'HMAC',\n macKey,\n new Uint8Array(encryptedPayload.mac),\n new TextEncoder().encode(payloadStr)\n );\n\n if (!macValid) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'MAC verification failed', {\n payloadFields: Object.keys(encryptedPayload),\n macLength: encryptedPayload.mac?.length\n });\n throw new Error('Message authentication failed - possible tampering');\n }\n\n const metadataIv = new Uint8Array(encryptedPayload.metadataIv);\n const metadataData = new Uint8Array(encryptedPayload.metadataData);\n\n const decryptedMetadataBuffer = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: metadataIv },\n metadataKey,\n metadataData\n );\n\n const metadataStr = new TextDecoder().decode(decryptedMetadataBuffer);\n const metadata = JSON.parse(metadataStr);\n\n if (!metadata.id || !metadata.timestamp || metadata.sequenceNumber === undefined || !metadata.originalLength) {\n throw new Error('Invalid metadata structure');\n }\n\n const messageAge = Date.now() - metadata.timestamp;\n if (messageAge > 300000) {\n throw new Error('Message expired (older than 5 minutes)');\n }\n\n if (expectedSequenceNumber !== null) {\n if (metadata.sequenceNumber < expectedSequenceNumber) {\n EnhancedSecureCryptoUtils.secureLog.log('warn', 'Received message with lower sequence number, possible queued message', {\n expected: expectedSequenceNumber,\n received: metadata.sequenceNumber,\n messageId: metadata.id\n });\n } else if (metadata.sequenceNumber > expectedSequenceNumber + 10) {\n throw new Error(`Sequence number gap too large: expected around ${expectedSequenceNumber}, got ${metadata.sequenceNumber}`);\n }\n }\n\n const messageIv = new Uint8Array(encryptedPayload.messageIv);\n const messageData = new Uint8Array(encryptedPayload.messageData);\n\n const decryptedMessageBuffer = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: messageIv },\n encryptionKey,\n messageData\n );\n\n const paddedMessage = new Uint8Array(decryptedMessageBuffer);\n const originalMessage = paddedMessage.slice(0, metadata.originalLength);\n\n const decoder = new TextDecoder();\n const message = decoder.decode(originalMessage);\n\n EnhancedSecureCryptoUtils.secureLog.log('info', 'Message decrypted successfully', {\n messageId: metadata.id,\n sequenceNumber: metadata.sequenceNumber,\n messageAge: Math.round(messageAge / 1000) + 's'\n });\n\n return {\n message: message,\n messageId: metadata.id,\n timestamp: metadata.timestamp,\n sequenceNumber: metadata.sequenceNumber\n };\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Message decryption failed', { error: error.message });\n throw new Error(`Failed to decrypt the message: ${error.message}`);\n }\n }\n\n // Enhanced input sanitization\n static sanitizeMessage(message) {\n if (typeof message !== 'string') {\n throw new Error('Message must be a string');\n }\n \n return message\n .replace(/)<[^<]*)*<\\/script>/gi, '')\n .replace(/javascript:/gi, '')\n .replace(/data:/gi, '')\n .replace(/vbscript:/gi, '')\n .replace(/onload\\s*=/gi, '')\n .replace(/onerror\\s*=/gi, '')\n .replace(/onclick\\s*=/gi, '')\n .trim()\n .substring(0, 2000); // Increased limit\n }\n\n // Generate cryptographically secure salt (64 bytes for enhanced security)\n static generateSalt() {\n return Array.from(crypto.getRandomValues(new Uint8Array(64)));\n }\n\n // Calculate key fingerprint for MITM protection\n static async calculateKeyFingerprint(keyData) {\n try {\n const encoder = new TextEncoder();\n const keyBytes = new Uint8Array(keyData);\n \n // Create a hash of the key data for fingerprinting\n const hashBuffer = await crypto.subtle.digest('SHA-256', keyBytes);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n \n // Convert to hexadecimal string\n const fingerprint = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n \n EnhancedSecureCryptoUtils.secureLog.log('info', 'Key fingerprint calculated', {\n keySize: keyData.length,\n fingerprintLength: fingerprint.length\n });\n \n return fingerprint;\n } catch (error) {\n EnhancedSecureCryptoUtils.secureLog.log('error', 'Key fingerprint calculation failed', { error: error.message });\n throw new Error('Failed to compute the key fingerprint');\n }\n }\n\n static constantTimeCompare(a, b) {\n const strA = typeof a === 'string' ? a : JSON.stringify(a);\n const strB = typeof b === 'string' ? b : JSON.stringify(b);\n \n if (strA.length !== strB.length) {\n let dummy = 0;\n for (let i = 0; i < Math.max(strA.length, strB.length); i++) {\n dummy |= (strA.charCodeAt(i % strA.length) || 0) ^ (strB.charCodeAt(i % strB.length) || 0);\n }\n return false;\n }\n \n let result = 0;\n for (let i = 0; i < strA.length; i++) {\n result |= strA.charCodeAt(i) ^ strB.charCodeAt(i);\n }\n \n return result === 0;\n }\n\n static constantTimeCompareArrays(arr1, arr2) {\n if (!Array.isArray(arr1) || !Array.isArray(arr2)) {\n return false;\n }\n \n if (arr1.length !== arr2.length) {\n let dummy = 0;\n const maxLen = Math.max(arr1.length, arr2.length);\n for (let i = 0; i < maxLen; i++) {\n dummy |= (arr1[i % arr1.length] || 0) ^ (arr2[i % arr2.length] || 0);\n }\n return false;\n }\n \n let result = 0;\n for (let i = 0; i < arr1.length; i++) {\n result |= arr1[i] ^ arr2[i];\n }\n \n return result === 0;\n }\n \n /**\n * CRITICAL SECURITY: Encrypt data with AAD (Additional Authenticated Data)\n * This method provides authenticated encryption with additional data binding\n */\n static async encryptDataWithAAD(data, key, aad) {\n try {\n const dataString = typeof data === 'string' ? data : JSON.stringify(data);\n const encoder = new TextEncoder();\n const dataBuffer = encoder.encode(dataString);\n const aadBuffer = encoder.encode(aad);\n\n // Generate random IV\n const iv = crypto.getRandomValues(new Uint8Array(12));\n\n // Encrypt with AAD\n const encrypted = await crypto.subtle.encrypt(\n { \n name: 'AES-GCM', \n iv: iv,\n additionalData: aadBuffer\n },\n key,\n dataBuffer\n );\n\n // Package encrypted data\n const encryptedPackage = {\n version: '1.0',\n iv: Array.from(iv),\n data: Array.from(new Uint8Array(encrypted)),\n aad: aad,\n timestamp: Date.now()\n };\n\n const packageString = JSON.stringify(encryptedPackage);\n const packageBuffer = encoder.encode(packageString);\n \n return EnhancedSecureCryptoUtils.arrayBufferToBase64(packageBuffer);\n } catch (error) {\n throw new Error(`AAD encryption failed: ${error.message}`);\n }\n }\n\n /**\n * CRITICAL SECURITY: Decrypt data with AAD validation\n * This method provides authenticated decryption with additional data validation\n */\n static async decryptDataWithAAD(encryptedData, key, expectedAad) {\n try {\n const packageBuffer = EnhancedSecureCryptoUtils.base64ToArrayBuffer(encryptedData);\n const packageString = new TextDecoder().decode(packageBuffer);\n const encryptedPackage = JSON.parse(packageString);\n\n if (!encryptedPackage.version || !encryptedPackage.iv || !encryptedPackage.data || !encryptedPackage.aad) {\n throw new Error('Invalid encrypted data format');\n }\n\n // Validate AAD matches expected\n if (encryptedPackage.aad !== expectedAad) {\n throw new Error('AAD mismatch - possible tampering or replay attack');\n }\n\n const iv = new Uint8Array(encryptedPackage.iv);\n const encrypted = new Uint8Array(encryptedPackage.data);\n const aadBuffer = new TextEncoder().encode(encryptedPackage.aad);\n\n // Decrypt with AAD validation\n const decrypted = await crypto.subtle.decrypt(\n { \n name: 'AES-GCM', \n iv: iv,\n additionalData: aadBuffer\n },\n key,\n encrypted\n );\n\n const decryptedString = new TextDecoder().decode(decrypted);\n\n try {\n return JSON.parse(decryptedString);\n } catch {\n return decryptedString;\n }\n } catch (error) {\n throw new Error(`AAD decryption failed: ${error.message}`);\n }\n }\n\n // Initialize secure logging system after class definition\n static {\n if (EnhancedSecureCryptoUtils.secureLog && typeof EnhancedSecureCryptoUtils.secureLog.init === 'function') {\n EnhancedSecureCryptoUtils.secureLog.init();\n }\n }\n}\n\nexport { EnhancedSecureCryptoUtils };", "// ============================================\n// SECURE FILE TRANSFER CONTEXT\n// ============================================\nclass SecureFileTransferContext {\n static #instance = null;\n static #contextKey = Symbol('SecureFileTransferContext');\n \n static getInstance() {\n if (!this.#instance) {\n this.#instance = new SecureFileTransferContext();\n }\n return this.#instance;\n }\n \n #fileTransferSystem = null;\n #active = false;\n #securityLevel = 'high';\n \n setFileTransferSystem(system) {\n if (!(system instanceof EnhancedSecureFileTransfer)) {\n throw new Error('Invalid file transfer system instance');\n }\n this.#fileTransferSystem = system;\n this.#active = true;\n console.log('\uD83D\uDD12 Secure file transfer context initialized');\n }\n \n getFileTransferSystem() {\n return this.#fileTransferSystem;\n }\n \n isActive() {\n return this.#active && this.#fileTransferSystem !== null;\n }\n \n deactivate() {\n this.#active = false;\n this.#fileTransferSystem = null;\n console.log('\uD83D\uDD12 Secure file transfer context deactivated');\n }\n \n getSecurityLevel() {\n return this.#securityLevel;\n }\n \n setSecurityLevel(level) {\n if (['low', 'medium', 'high'].includes(level)) {\n this.#securityLevel = level;\n }\n }\n}\n\n// ============================================\n// SECURITY ERROR HANDLER\n// ============================================\n\nclass SecurityErrorHandler {\n static #allowedErrors = new Set([\n 'File size exceeds maximum limit',\n 'Unsupported file type',\n 'Transfer timeout',\n 'Connection lost',\n 'Invalid file data',\n 'File transfer failed',\n 'Transfer cancelled',\n 'Network error',\n 'File not found',\n 'Permission denied'\n ]);\n \n static sanitizeError(error) {\n const message = error.message || error;\n\n for (const allowed of this.#allowedErrors) {\n if (message.includes(allowed)) {\n return allowed;\n }\n }\n\n console.error('\uD83D\uDD12 Internal file transfer error:', {\n message: error.message,\n stack: error.stack,\n timestamp: new Date().toISOString()\n });\n\n return 'File transfer failed';\n }\n \n static logSecurityEvent(event, details = {}) {\n console.warn('\uD83D\uDD12 Security event:', {\n event,\n timestamp: new Date().toISOString(),\n ...details\n });\n }\n}\n\n// ============================================\n// FILE METADATA SIGNATURE SYSTEM\n// ============================================\n\nclass FileMetadataSigner {\n static async signFileMetadata(metadata, privateKey) {\n try {\n const encoder = new TextEncoder();\n const data = encoder.encode(JSON.stringify({\n fileId: metadata.fileId,\n fileName: metadata.fileName,\n fileSize: metadata.fileSize,\n fileHash: metadata.fileHash,\n timestamp: metadata.timestamp,\n version: metadata.version || '2.0'\n }));\n \n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n privateKey,\n data\n );\n \n return Array.from(new Uint8Array(signature));\n } catch (error) {\n SecurityErrorHandler.logSecurityEvent('signature_failed', { error: error.message });\n throw new Error('Failed to sign file metadata');\n }\n }\n \n static async verifyFileMetadata(metadata, signature, publicKey) {\n try {\n const encoder = new TextEncoder();\n const data = encoder.encode(JSON.stringify({\n fileId: metadata.fileId,\n fileName: metadata.fileName,\n fileSize: metadata.fileSize,\n fileHash: metadata.fileHash,\n timestamp: metadata.timestamp,\n version: metadata.version || '2.0'\n }));\n \n const signatureBuffer = new Uint8Array(signature);\n \n const isValid = await crypto.subtle.verify(\n 'RSASSA-PKCS1-v1_5',\n publicKey,\n signatureBuffer,\n data\n );\n \n if (!isValid) {\n SecurityErrorHandler.logSecurityEvent('invalid_signature', { fileId: metadata.fileId });\n }\n \n return isValid;\n } catch (error) {\n SecurityErrorHandler.logSecurityEvent('verification_failed', { error: error.message });\n return false;\n }\n }\n}\n\n// ============================================\n// \u0422\u041E\u0427\u041D\u042B\u0415 \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u042F \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u041E\u0421\u0422\u0418\n// ============================================\n\nclass MessageSizeValidator {\n static MAX_MESSAGE_SIZE = 1024 * 1024; // 1MB\n \n static isMessageSizeValid(message) {\n const messageString = JSON.stringify(message);\n const sizeInBytes = new Blob([messageString]).size;\n \n if (sizeInBytes > this.MAX_MESSAGE_SIZE) {\n SecurityErrorHandler.logSecurityEvent('message_too_large', {\n size: sizeInBytes,\n limit: this.MAX_MESSAGE_SIZE\n });\n throw new Error('Message too large');\n }\n \n return true;\n }\n}\n\nclass AtomicOperations {\n constructor() {\n this.locks = new Map();\n }\n \n async withLock(key, operation) {\n if (this.locks.has(key)) {\n await this.locks.get(key);\n }\n \n const lockPromise = (async () => {\n try {\n return await operation();\n } finally {\n this.locks.delete(key);\n }\n })();\n \n this.locks.set(key, lockPromise);\n return lockPromise;\n }\n}\n\n// Rate limiting \u0434\u043B\u044F \u0437\u0430\u0449\u0438\u0442\u044B \u043E\u0442 \u0441\u043F\u0430\u043C\u0430\nclass RateLimiter {\n constructor(maxRequests, windowMs) {\n this.maxRequests = maxRequests;\n this.windowMs = windowMs;\n this.requests = new Map();\n }\n \n isAllowed(identifier) {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n \n if (!this.requests.has(identifier)) {\n this.requests.set(identifier, []);\n }\n \n const userRequests = this.requests.get(identifier);\n \n const validRequests = userRequests.filter(time => time > windowStart);\n this.requests.set(identifier, validRequests);\n \n if (validRequests.length >= this.maxRequests) {\n SecurityErrorHandler.logSecurityEvent('rate_limit_exceeded', {\n identifier,\n requestCount: validRequests.length,\n limit: this.maxRequests\n });\n return false;\n }\n \n validRequests.push(now);\n return true;\n }\n}\n\nclass SecureMemoryManager {\n static secureWipe(buffer) {\n if (buffer instanceof ArrayBuffer) {\n const view = new Uint8Array(buffer);\n crypto.getRandomValues(view);\n } else if (buffer instanceof Uint8Array) {\n crypto.getRandomValues(buffer);\n }\n }\n \n static secureDelete(obj, prop) {\n if (obj[prop]) {\n this.secureWipe(obj[prop]);\n delete obj[prop];\n }\n }\n}\n\nclass EnhancedSecureFileTransfer {\n constructor(webrtcManager, onProgress, onComplete, onError, onFileReceived) {\n this.webrtcManager = webrtcManager;\n this.onProgress = onProgress;\n this.onComplete = onComplete;\n this.onError = onError;\n this.onFileReceived = onFileReceived;\n \n // Validate webrtcManager\n if (!webrtcManager) {\n throw new Error('webrtcManager is required for EnhancedSecureFileTransfer');\n }\n \n SecureFileTransferContext.getInstance().setFileTransferSystem(this);\n \n this.atomicOps = new AtomicOperations();\n this.rateLimiter = new RateLimiter(10, 60000);\n\n this.signingKey = null;\n this.verificationKey = null;\n \n // Transfer settings\n this.CHUNK_SIZE = 64 * 1024; // 64 KB\n this.MAX_FILE_SIZE = 100 * 1024 * 1024; // 100 MB limit\n this.MAX_CONCURRENT_TRANSFERS = 3;\n this.CHUNK_TIMEOUT = 30000; // 30 seconds per chunk\n this.RETRY_ATTEMPTS = 3;\n\n this.FILE_TYPE_RESTRICTIONS = {\n documents: {\n extensions: ['.pdf', '.doc', '.docx', '.txt', '.md', '.rtf', '.odt'],\n mimeTypes: [\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'text/plain',\n 'text/markdown',\n 'application/rtf',\n 'application/vnd.oasis.opendocument.text'\n ],\n maxSize: 50 * 1024 * 1024, // 50 MB\n category: 'Documents',\n description: 'PDF, DOC, TXT, MD, RTF, ODT'\n },\n \n images: {\n extensions: ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp', '.svg', '.ico'],\n mimeTypes: [\n 'image/jpeg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/bmp',\n 'image/svg+xml',\n 'image/x-icon'\n ],\n maxSize: 25 * 1024 * 1024, // 25 MB\n category: 'Images',\n description: 'JPG, PNG, GIF, WEBP, BMP, SVG, ICO'\n },\n \n archives: {\n extensions: ['.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.xz'],\n mimeTypes: [\n 'application/zip',\n 'application/x-rar-compressed',\n 'application/x-7z-compressed',\n 'application/x-tar',\n 'application/gzip',\n 'application/x-bzip2',\n 'application/x-xz'\n ],\n maxSize: 100 * 1024 * 1024, // 100 MB\n category: 'Archives',\n description: 'ZIP, RAR, 7Z, TAR, GZ, BZ2, XZ'\n },\n \n media: {\n extensions: ['.mp3', '.mp4', '.avi', '.mkv', '.mov', '.wmv', '.flv', '.webm', '.ogg', '.wav'],\n mimeTypes: [\n 'audio/mpeg',\n 'video/mp4',\n 'video/x-msvideo',\n 'video/x-matroska',\n 'video/quicktime',\n 'video/x-ms-wmv',\n 'video/x-flv',\n 'video/webm',\n 'audio/ogg',\n 'audio/wav'\n ],\n maxSize: 100 * 1024 * 1024, // 100 MB\n category: 'Media',\n description: 'MP3, MP4, AVI, MKV, MOV, WMV, FLV, WEBM, OGG, WAV'\n },\n \n general: {\n extensions: [], \n mimeTypes: [], \n maxSize: 50 * 1024 * 1024, // 50 MB\n category: 'General',\n description: 'Any file type up to size limits'\n }\n };\n \n // Active transfers tracking\n this.activeTransfers = new Map(); // fileId -> transfer state\n this.receivingTransfers = new Map(); // fileId -> receiving state\n this.transferQueue = []; // Queue for pending transfers\n this.pendingChunks = new Map();\n \n // Session key derivation\n this.sessionKeys = new Map(); // fileId -> derived session key\n \n // Security\n this.processedChunks = new Set(); // Prevent replay attacks\n this.transferNonces = new Map(); // fileId -> current nonce counter\n this.receivedFileBuffers = new Map(); // fileId -> { buffer:ArrayBuffer, type:string, name:string, size:number }\n\n this.setupFileMessageHandlers();\n\n if (this.webrtcManager) {\n this.webrtcManager.fileTransferSystem = this;\n }\n }\n\n // ============================================\n // FILE TYPE VALIDATION SYSTEM\n // ============================================\n\n getFileType(file) {\n const fileName = file.name.toLowerCase();\n const fileExtension = fileName.substring(fileName.lastIndexOf('.'));\n const mimeType = file.type.toLowerCase();\n\n for (const [typeKey, typeConfig] of Object.entries(this.FILE_TYPE_RESTRICTIONS)) {\n if (typeKey === 'general') continue; // \u041F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u0435\u043C \u043E\u0431\u0449\u0438\u0439 \u0442\u0438\u043F\n\n if (typeConfig.extensions.includes(fileExtension)) {\n return {\n type: typeKey,\n category: typeConfig.category,\n description: typeConfig.description,\n maxSize: typeConfig.maxSize,\n allowed: true\n };\n }\n\n if (typeConfig.mimeTypes.includes(mimeType)) {\n return {\n type: typeKey,\n category: typeConfig.category,\n description: typeConfig.description,\n maxSize: typeConfig.maxSize,\n allowed: true\n };\n }\n }\n\n const generalConfig = this.FILE_TYPE_RESTRICTIONS.general;\n return {\n type: 'general',\n category: generalConfig.category,\n description: generalConfig.description,\n maxSize: generalConfig.maxSize,\n allowed: true\n };\n }\n\n validateFile(file) {\n const fileType = this.getFileType(file);\n const errors = [];\n\n if (file.size > fileType.maxSize) {\n errors.push(`File size (${this.formatFileSize(file.size)}) exceeds maximum allowed for ${fileType.category} (${this.formatFileSize(fileType.maxSize)})`);\n }\n\n if (!fileType.allowed) {\n errors.push(`File type not allowed. Supported types: ${fileType.description}`);\n }\n\n if (file.size > this.MAX_FILE_SIZE) {\n errors.push(`File size (${this.formatFileSize(file.size)}) exceeds general limit (${this.formatFileSize(this.MAX_FILE_SIZE)})`);\n }\n \n return {\n isValid: errors.length === 0,\n errors: errors,\n fileType: fileType,\n fileSize: file.size,\n formattedSize: this.formatFileSize(file.size)\n };\n }\n\n formatFileSize(bytes) {\n if (bytes === 0) return '0 B';\n const k = 1024;\n const sizes = ['B', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n\n getSupportedFileTypes() {\n const supportedTypes = {};\n \n for (const [typeKey, typeConfig] of Object.entries(this.FILE_TYPE_RESTRICTIONS)) {\n if (typeKey === 'general') continue;\n \n supportedTypes[typeKey] = {\n category: typeConfig.category,\n description: typeConfig.description,\n extensions: typeConfig.extensions,\n maxSize: this.formatFileSize(typeConfig.maxSize),\n maxSizeBytes: typeConfig.maxSize\n };\n }\n \n return supportedTypes;\n }\n\n getFileTypeInfo() {\n return {\n supportedTypes: this.getSupportedFileTypes(),\n generalMaxSize: this.formatFileSize(this.MAX_FILE_SIZE),\n generalMaxSizeBytes: this.MAX_FILE_SIZE,\n restrictions: this.FILE_TYPE_RESTRICTIONS\n };\n }\n\n // ============================================\n // ENCODING HELPERS (Base64 for efficient transport)\n // ============================================\n arrayBufferToBase64(buffer) {\n const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n let binary = '';\n const len = bytes.byteLength;\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n base64ToUint8Array(base64) {\n const binaryString = atob(base64);\n const len = binaryString.length;\n const bytes = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes;\n }\n\n // ============================================\n // PUBLIC ACCESSORS FOR RECEIVED FILES\n // ============================================\n getReceivedFileMeta(fileId) {\n const entry = this.receivedFileBuffers.get(fileId);\n if (!entry) return null;\n return { fileId, fileName: entry.name, fileSize: entry.size, mimeType: entry.type };\n }\n\n async getBlob(fileId) {\n const entry = this.receivedFileBuffers.get(fileId);\n if (!entry) return null;\n return new Blob([entry.buffer], { type: entry.type });\n }\n\n async getObjectURL(fileId) {\n const blob = await this.getBlob(fileId);\n if (!blob) return null;\n return URL.createObjectURL(blob);\n }\n\n revokeObjectURL(url) {\n try { URL.revokeObjectURL(url); } catch (_) {}\n }\n\n setupFileMessageHandlers() {\n if (!this.webrtcManager.dataChannel) {\n const setupRetry = setInterval(() => {\n if (this.webrtcManager.dataChannel) {\n clearInterval(setupRetry);\n this.setupMessageInterception();\n }\n }, 100);\n\n setTimeout(() => {\n clearInterval(setupRetry);\n }, 5000);\n \n return;\n }\n \n // \u0415\u0441\u043B\u0438 dataChannel \u0443\u0436\u0435 \u0433\u043E\u0442\u043E\u0432, \u0441\u0440\u0430\u0437\u0443 \u043D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043C\n this.setupMessageInterception();\n }\n\n setupMessageInterception() {\n try {\n if (!this.webrtcManager.dataChannel) {\n return;\n }\n\n if (this.webrtcManager) {\n this.webrtcManager.fileTransferSystem = this;\n }\n\n if (this.webrtcManager.dataChannel.onmessage) {\n this.originalOnMessage = this.webrtcManager.dataChannel.onmessage;\n }\n\n this.webrtcManager.dataChannel.onmessage = async (event) => {\n try {\n if (event.data.length > MessageSizeValidator.MAX_MESSAGE_SIZE) {\n console.warn('\uD83D\uDD12 Message too large, ignoring');\n SecurityErrorHandler.logSecurityEvent('oversized_message_blocked');\n return;\n }\n \n if (typeof event.data === 'string') {\n try {\n const parsed = JSON.parse(event.data);\n \n MessageSizeValidator.isMessageSizeValid(parsed);\n \n if (this.isFileTransferMessage(parsed)) {\n await this.handleFileMessage(parsed);\n return; \n }\n } catch (parseError) {\n if (parseError.message === 'Message too large') {\n return; \n }\n }\n }\n\n if (this.originalOnMessage) {\n return this.originalOnMessage.call(this.webrtcManager.dataChannel, event);\n }\n } catch (error) {\n console.error('\u274C Error in file system message interception:', error);\n if (this.originalOnMessage) {\n return this.originalOnMessage.call(this.webrtcManager.dataChannel, event);\n }\n }\n };\n } catch (error) {\n console.error('\u274C Failed to set up message interception:', error);\n }\n }\n\n isFileTransferMessage(message) {\n if (!message || typeof message !== 'object' || !message.type) {\n return false;\n }\n \n const fileMessageTypes = [\n 'file_transfer_start',\n 'file_transfer_response', \n 'file_chunk',\n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error'\n ];\n \n return fileMessageTypes.includes(message.type);\n }\n\n async handleFileMessage(message) {\n try {\n if (!this.webrtcManager.fileTransferSystem) {\n try {\n if (typeof this.webrtcManager.initializeFileTransfer === 'function') {\n this.webrtcManager.initializeFileTransfer();\n \n let attempts = 0;\n const maxAttempts = 50; \n while (!this.webrtcManager.fileTransferSystem && attempts < maxAttempts) {\n await new Promise(resolve => setTimeout(resolve, 100));\n attempts++;\n }\n \n if (!this.webrtcManager.fileTransferSystem) {\n throw new Error('File transfer system initialization timeout');\n }\n } else {\n throw new Error('initializeFileTransfer method not available');\n }\n } catch (initError) {\n console.error('\u274C Failed to initialize file transfer system:', initError);\n if (message.fileId) {\n const errorMessage = {\n type: 'file_transfer_error',\n fileId: message.fileId,\n error: 'File transfer system not available',\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n }\n return;\n }\n }\n \n switch (message.type) {\n case 'file_transfer_start':\n await this.handleFileTransferStart(message);\n break;\n \n case 'file_transfer_response':\n this.handleTransferResponse(message);\n break;\n \n case 'file_chunk':\n await this.handleFileChunk(message);\n break;\n \n case 'chunk_confirmation':\n this.handleChunkConfirmation(message);\n break;\n \n case 'file_transfer_complete':\n this.handleTransferComplete(message);\n break;\n \n case 'file_transfer_error':\n this.handleTransferError(message);\n break;\n \n default:\n console.warn('\u26A0\uFE0F Unknown file message type:', message.type);\n }\n \n } catch (error) {\n console.error('\u274C Error handling file message:', error);\n\n if (message.fileId) {\n const errorMessage = {\n type: 'file_transfer_error',\n fileId: message.fileId,\n error: error.message,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n }\n }\n }\n\n // ============================================\n // SIMPLIFIED KEY DERIVATION - USE SHARED DATA\n // ============================================\n\n async deriveFileSessionKey(fileId) {\n try {\n \n if (!this.webrtcManager.keyFingerprint || !this.webrtcManager.sessionSalt) {\n throw new Error('WebRTC session data not available');\n }\n\n const fileSalt = crypto.getRandomValues(new Uint8Array(32));\n\n const encoder = new TextEncoder();\n const fingerprintData = encoder.encode(this.webrtcManager.keyFingerprint);\n const fileIdData = encoder.encode(fileId);\n\n const sessionSaltArray = new Uint8Array(this.webrtcManager.sessionSalt);\n const combinedSeed = new Uint8Array(\n fingerprintData.length + \n sessionSaltArray.length + \n fileSalt.length + \n fileIdData.length\n );\n \n let offset = 0;\n combinedSeed.set(fingerprintData, offset);\n offset += fingerprintData.length;\n combinedSeed.set(sessionSaltArray, offset);\n offset += sessionSaltArray.length;\n combinedSeed.set(fileSalt, offset);\n offset += fileSalt.length;\n combinedSeed.set(fileIdData, offset);\n\n const keyMaterial = await crypto.subtle.digest('SHA-256', combinedSeed);\n\n const fileSessionKey = await crypto.subtle.importKey(\n 'raw',\n keyMaterial,\n { name: 'AES-GCM' },\n false,\n ['encrypt', 'decrypt']\n );\n\n this.sessionKeys.set(fileId, {\n key: fileSessionKey,\n salt: Array.from(fileSalt),\n created: Date.now()\n });\n\n return { key: fileSessionKey, salt: Array.from(fileSalt) };\n\n } catch (error) {\n console.error('\u274C Failed to derive file session key:', error);\n throw error;\n }\n }\n\n async deriveFileSessionKeyFromSalt(fileId, saltArray) {\n try {\n if (!saltArray || !Array.isArray(saltArray) || saltArray.length !== 32) {\n throw new Error(`Invalid salt: ${saltArray?.length || 0} bytes`);\n }\n \n if (!this.webrtcManager.keyFingerprint || !this.webrtcManager.sessionSalt) {\n throw new Error('WebRTC session data not available');\n }\n\n const encoder = new TextEncoder();\n const fingerprintData = encoder.encode(this.webrtcManager.keyFingerprint);\n const fileIdData = encoder.encode(fileId);\n\n const fileSalt = new Uint8Array(saltArray);\n const sessionSaltArray = new Uint8Array(this.webrtcManager.sessionSalt);\n\n const combinedSeed = new Uint8Array(\n fingerprintData.length + \n sessionSaltArray.length + \n fileSalt.length + \n fileIdData.length\n );\n \n let offset = 0;\n combinedSeed.set(fingerprintData, offset);\n offset += fingerprintData.length;\n combinedSeed.set(sessionSaltArray, offset);\n offset += sessionSaltArray.length;\n combinedSeed.set(fileSalt, offset);\n offset += fileSalt.length;\n combinedSeed.set(fileIdData, offset);\n\n const keyMaterial = await crypto.subtle.digest('SHA-256', combinedSeed);\n\n const fileSessionKey = await crypto.subtle.importKey(\n 'raw',\n keyMaterial,\n { name: 'AES-GCM' },\n false,\n ['encrypt', 'decrypt']\n );\n\n this.sessionKeys.set(fileId, {\n key: fileSessionKey,\n salt: saltArray,\n created: Date.now()\n });\n\n return fileSessionKey;\n\n } catch (error) {\n console.error('\u274C Failed to derive session key from salt:', error);\n throw error;\n }\n }\n\n // ============================================\n // FILE TRANSFER IMPLEMENTATION\n // ============================================\n\n async sendFile(file) {\n try {\n // Validate webrtcManager\n if (!this.webrtcManager) {\n throw new Error('WebRTC Manager not initialized');\n }\n\n const clientId = this.getClientIdentifier();\n if (!this.rateLimiter.isAllowed(clientId)) {\n SecurityErrorHandler.logSecurityEvent('rate_limit_exceeded', { clientId });\n throw new Error('Rate limit exceeded. Please wait before sending another file.');\n }\n\n if (!file || !file.size) {\n throw new Error('Invalid file object');\n }\n\n const validation = this.validateFile(file);\n if (!validation.isValid) {\n const errorMessage = validation.errors.join('. ');\n throw new Error(errorMessage);\n }\n\n if (this.activeTransfers.size >= this.MAX_CONCURRENT_TRANSFERS) {\n throw new Error('Maximum concurrent transfers reached');\n }\n\n // Generate unique file ID\n const fileId = `file_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n \n // Calculate file hash for integrity verification\n const fileHash = await this.calculateFileHash(file);\n \n // Derive session key for this file\n const keyResult = await this.deriveFileSessionKey(fileId);\n const sessionKey = keyResult.key;\n const salt = keyResult.salt;\n \n // Create transfer state\n const transferState = {\n fileId: fileId,\n file: file,\n fileHash: fileHash,\n sessionKey: sessionKey,\n salt: salt, \n totalChunks: Math.ceil(file.size / this.CHUNK_SIZE),\n sentChunks: 0,\n confirmedChunks: 0,\n startTime: Date.now(),\n status: 'preparing',\n retryCount: 0,\n lastChunkTime: Date.now()\n };\n\n this.activeTransfers.set(fileId, transferState);\n this.transferNonces.set(fileId, 0);\n\n // Send file metadata first\n await this.sendFileMetadata(transferState);\n \n // Start chunk transmission\n await this.startChunkTransmission(transferState);\n \n return fileId;\n\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C File sending failed:', safeError);\n if (this.onError) this.onError(safeError);\n throw new Error(safeError);\n }\n }\n\n async sendFileMetadata(transferState) {\n try {\n const metadata = {\n type: 'file_transfer_start',\n fileId: transferState.fileId,\n fileName: transferState.file.name,\n fileSize: transferState.file.size,\n fileType: transferState.file.type || 'application/octet-stream',\n fileHash: transferState.fileHash,\n totalChunks: transferState.totalChunks,\n chunkSize: this.CHUNK_SIZE,\n salt: transferState.salt, \n timestamp: Date.now(),\n version: '2.0'\n };\n\n if (this.signingKey) {\n try {\n metadata.signature = await FileMetadataSigner.signFileMetadata(metadata, this.signingKey);\n console.log('\uD83D\uDD12 File metadata signed successfully');\n } catch (signError) {\n SecurityErrorHandler.logSecurityEvent('signature_failed', { \n fileId: transferState.fileId, \n error: signError.message \n });\n }\n }\n\n // Send metadata through secure channel\n await this.sendSecureMessage(metadata);\n \n transferState.status = 'metadata_sent';\n\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to send file metadata:', safeError);\n transferState.status = 'failed';\n throw new Error(safeError);\n }\n }\n\n async startChunkTransmission(transferState) {\n try {\n transferState.status = 'transmitting';\n \n const file = transferState.file;\n const totalChunks = transferState.totalChunks;\n \n for (let chunkIndex = 0; chunkIndex < totalChunks; chunkIndex++) {\n const start = chunkIndex * this.CHUNK_SIZE;\n const end = Math.min(start + this.CHUNK_SIZE, file.size);\n \n // Read chunk from file\n const chunkData = await this.readFileChunk(file, start, end);\n \n // Send chunk (\u0441 \u0443\u0447\u0451\u0442\u043E\u043C backpressure)\n await this.sendFileChunk(transferState, chunkIndex, chunkData);\n \n // Update progress\n transferState.sentChunks++;\n const progress = Math.round((transferState.sentChunks / totalChunks) * 95) + 5; // 5-100%\n\n await this.waitForBackpressure();\n }\n \n transferState.status = 'waiting_confirmation';\n \n // Timeout for completion confirmation\n setTimeout(() => {\n if (this.activeTransfers.has(transferState.fileId)) {\n const state = this.activeTransfers.get(transferState.fileId);\n if (state.status === 'waiting_confirmation') {\n this.cleanupTransfer(transferState.fileId);\n }\n }\n }, 30000);\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Chunk transmission failed:', safeError);\n transferState.status = 'failed';\n throw new Error(safeError);\n }\n }\n\n async readFileChunk(file, start, end) {\n try {\n const blob = file.slice(start, end);\n return await blob.arrayBuffer();\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to read file chunk:', safeError);\n throw new Error(safeError);\n }\n }\n\n async sendFileChunk(transferState, chunkIndex, chunkData) {\n try {\n const sessionKey = transferState.sessionKey;\n const nonce = crypto.getRandomValues(new Uint8Array(12));\n \n // Encrypt chunk data\n const encryptedChunk = await crypto.subtle.encrypt(\n {\n name: 'AES-GCM',\n iv: nonce\n },\n sessionKey,\n chunkData\n );\n \n // Use Base64 to drastically reduce JSON overhead\n const encryptedB64 = this.arrayBufferToBase64(new Uint8Array(encryptedChunk));\n const chunkMessage = {\n type: 'file_chunk',\n fileId: transferState.fileId,\n chunkIndex: chunkIndex,\n totalChunks: transferState.totalChunks,\n nonce: Array.from(nonce),\n encryptedDataB64: encryptedB64,\n chunkSize: chunkData.byteLength,\n timestamp: Date.now()\n };\n\n await this.waitForBackpressure();\n // Send chunk through secure channel\n await this.sendSecureMessage(chunkMessage);\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to send file chunk:', safeError);\n throw new Error(safeError);\n }\n }\n\n async sendSecureMessage(message) {\n\n const messageString = JSON.stringify(message);\n const dc = this.webrtcManager?.dataChannel;\n const maxRetries = 10;\n let attempt = 0;\n const wait = (ms) => new Promise(r => setTimeout(r, ms));\n\n while (true) {\n try {\n if (!dc || dc.readyState !== 'open') {\n throw new Error('Data channel not ready');\n }\n await this.waitForBackpressure();\n dc.send(messageString);\n return; // success\n } catch (error) {\n const msg = String(error?.message || '');\n const queueFull = msg.includes('send queue is full') || msg.includes('bufferedAmount');\n const opErr = error?.name === 'OperationError';\n if ((queueFull || opErr) && attempt < maxRetries) {\n attempt++;\n await this.waitForBackpressure();\n await wait(Math.min(50 * attempt, 500));\n continue;\n }\n console.error('\u274C Failed to send secure message:', error);\n throw error;\n }\n }\n }\n\n async waitForBackpressure() {\n try {\n const dc = this.webrtcManager?.dataChannel;\n if (!dc) return;\n\n if (typeof dc.bufferedAmountLowThreshold === 'number') {\n if (dc.bufferedAmount > dc.bufferedAmountLowThreshold) {\n await new Promise(resolve => {\n const handler = () => {\n dc.removeEventListener('bufferedamountlow', handler);\n resolve();\n };\n dc.addEventListener('bufferedamountlow', handler, { once: true });\n });\n }\n return;\n }\n\n const softLimit = 4 * 1024 * 1024;\n while (dc.bufferedAmount > softLimit) {\n await new Promise(r => setTimeout(r, 20));\n }\n } catch (_) {\n // ignore\n }\n }\n\n async calculateFileHash(file) {\n try {\n const arrayBuffer = await file.arrayBuffer();\n const hashBuffer = await crypto.subtle.digest('SHA-256', arrayBuffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n } catch (error) {\n console.error('\u274C File hash calculation failed:', error);\n throw error;\n }\n }\n\n // ============================================\n // MESSAGE HANDLERS\n // ============================================\n\n async handleFileTransferStart(metadata) {\n try {\n // Validate metadata\n if (!metadata.fileId || !metadata.fileName || !metadata.fileSize) {\n throw new Error('Invalid file transfer metadata');\n }\n\n if (metadata.signature && this.verificationKey) {\n try {\n const isValid = await FileMetadataSigner.verifyFileMetadata(\n metadata, \n metadata.signature, \n this.verificationKey\n );\n \n if (!isValid) {\n SecurityErrorHandler.logSecurityEvent('invalid_metadata_signature', { \n fileId: metadata.fileId \n });\n throw new Error('Invalid file metadata signature');\n }\n \n console.log('\uD83D\uDD12 File metadata signature verified successfully');\n } catch (verifyError) {\n SecurityErrorHandler.logSecurityEvent('verification_failed', { \n fileId: metadata.fileId, \n error: verifyError.message \n });\n throw new Error('File metadata verification failed');\n }\n }\n \n // Check if we already have this transfer\n if (this.receivingTransfers.has(metadata.fileId)) {\n return;\n }\n \n // Derive session key from salt\n const sessionKey = await this.deriveFileSessionKeyFromSalt(\n metadata.fileId,\n metadata.salt\n );\n \n // Create receiving transfer state\n const receivingState = {\n fileId: metadata.fileId,\n fileName: metadata.fileName,\n fileSize: metadata.fileSize,\n fileType: metadata.fileType || 'application/octet-stream',\n fileHash: metadata.fileHash,\n totalChunks: metadata.totalChunks,\n chunkSize: metadata.chunkSize || this.CHUNK_SIZE,\n sessionKey: sessionKey,\n salt: metadata.salt,\n receivedChunks: new Map(),\n receivedCount: 0,\n startTime: Date.now(),\n lastChunkTime: Date.now(),\n status: 'receiving'\n };\n \n this.receivingTransfers.set(metadata.fileId, receivingState);\n \n // Send acceptance response\n const response = {\n type: 'file_transfer_response',\n fileId: metadata.fileId,\n accepted: true,\n timestamp: Date.now()\n };\n \n await this.sendSecureMessage(response);\n\n // Process buffered chunks if any\n if (this.pendingChunks.has(metadata.fileId)) {\n const bufferedChunks = this.pendingChunks.get(metadata.fileId);\n \n for (const [chunkIndex, chunkMessage] of bufferedChunks.entries()) {\n await this.handleFileChunk(chunkMessage);\n }\n \n this.pendingChunks.delete(metadata.fileId);\n }\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to handle file transfer start:', safeError);\n \n // Send error response\n const errorResponse = {\n type: 'file_transfer_response',\n fileId: metadata.fileId,\n accepted: false,\n error: safeError, \n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorResponse);\n }\n }\n\n async handleFileChunk(chunkMessage) {\n return this.atomicOps.withLock(\n `chunk-${chunkMessage.fileId}`, \n async () => {\n try {\n let receivingState = this.receivingTransfers.get(chunkMessage.fileId);\n \n // Buffer early chunks if transfer not yet initialized\n if (!receivingState) {\n if (!this.pendingChunks.has(chunkMessage.fileId)) {\n this.pendingChunks.set(chunkMessage.fileId, new Map());\n }\n \n this.pendingChunks.get(chunkMessage.fileId).set(chunkMessage.chunkIndex, chunkMessage);\n return;\n }\n \n // Update last chunk time\n receivingState.lastChunkTime = Date.now();\n \n // Check if chunk already received\n if (receivingState.receivedChunks.has(chunkMessage.chunkIndex)) {\n return;\n }\n \n // Validate chunk\n if (chunkMessage.chunkIndex < 0 || chunkMessage.chunkIndex >= receivingState.totalChunks) {\n throw new Error(`Invalid chunk index: ${chunkMessage.chunkIndex}`);\n }\n \n // Decrypt chunk\n const nonce = new Uint8Array(chunkMessage.nonce);\n // Backward compatible: prefer Base64, fallback to numeric array\n let encryptedData;\n if (chunkMessage.encryptedDataB64) {\n encryptedData = this.base64ToUint8Array(chunkMessage.encryptedDataB64);\n } else if (chunkMessage.encryptedData) {\n encryptedData = new Uint8Array(chunkMessage.encryptedData);\n } else {\n throw new Error('Missing encrypted data');\n }\n \n const decryptedChunk = await crypto.subtle.decrypt(\n {\n name: 'AES-GCM',\n iv: nonce\n },\n receivingState.sessionKey,\n encryptedData\n );\n \n // Verify chunk size\n if (decryptedChunk.byteLength !== chunkMessage.chunkSize) {\n throw new Error(`Chunk size mismatch: expected ${chunkMessage.chunkSize}, got ${decryptedChunk.byteLength}`);\n }\n \n // Store chunk\n receivingState.receivedChunks.set(chunkMessage.chunkIndex, decryptedChunk);\n receivingState.receivedCount++;\n \n // Send chunk confirmation\n const confirmation = {\n type: 'chunk_confirmation',\n fileId: chunkMessage.fileId,\n chunkIndex: chunkMessage.chunkIndex,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(confirmation);\n \n // Check if all chunks received\n if (receivingState.receivedCount === receivingState.totalChunks) {\n await this.assembleFile(receivingState);\n }\n \n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to handle file chunk:', safeError);\n \n // Send error notification\n const errorMessage = {\n type: 'file_transfer_error',\n fileId: chunkMessage.fileId,\n error: safeError, \n chunkIndex: chunkMessage.chunkIndex,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n \n // Mark transfer as failed\n const receivingState = this.receivingTransfers.get(chunkMessage.fileId);\n if (receivingState) {\n receivingState.status = 'failed';\n }\n \n if (this.onError) {\n this.onError(`Chunk processing failed: ${safeError}`);\n }\n }\n }\n );\n }\n\n async assembleFile(receivingState) {\n try {\n receivingState.status = 'assembling';\n \n // Verify we have all chunks\n for (let i = 0; i < receivingState.totalChunks; i++) {\n if (!receivingState.receivedChunks.has(i)) {\n throw new Error(`Missing chunk ${i}`);\n }\n }\n \n // Combine all chunks in order\n const chunks = [];\n for (let i = 0; i < receivingState.totalChunks; i++) {\n const chunk = receivingState.receivedChunks.get(i);\n chunks.push(new Uint8Array(chunk));\n }\n \n // Calculate total size\n const totalSize = chunks.reduce((sum, chunk) => sum + chunk.length, 0);\n \n // Verify total size matches expected\n if (totalSize !== receivingState.fileSize) {\n throw new Error(`File size mismatch: expected ${receivingState.fileSize}, got ${totalSize}`);\n }\n \n // Combine into single array\n const fileData = new Uint8Array(totalSize);\n let offset = 0;\n for (const chunk of chunks) {\n fileData.set(chunk, offset);\n offset += chunk.length;\n }\n \n // Verify file integrity\n const receivedHash = await this.calculateFileHashFromData(fileData);\n if (receivedHash !== receivingState.fileHash) {\n throw new Error('File integrity check failed - hash mismatch');\n }\n\n const fileBuffer = fileData.buffer;\n const fileBlob = new Blob([fileBuffer], { type: receivingState.fileType });\n \n receivingState.endTime = Date.now();\n receivingState.status = 'completed';\n\n this.receivedFileBuffers.set(receivingState.fileId, {\n buffer: fileBuffer,\n type: receivingState.fileType,\n name: receivingState.fileName,\n size: receivingState.fileSize\n });\n\n if (this.onFileReceived) {\n const getBlob = async () => new Blob([this.receivedFileBuffers.get(receivingState.fileId).buffer], { type: receivingState.fileType });\n const getObjectURL = async () => {\n const blob = await getBlob();\n return URL.createObjectURL(blob);\n };\n const revokeObjectURL = (url) => {\n try { URL.revokeObjectURL(url); } catch (_) {}\n };\n\n this.onFileReceived({\n fileId: receivingState.fileId,\n fileName: receivingState.fileName,\n fileSize: receivingState.fileSize,\n mimeType: receivingState.fileType,\n transferTime: receivingState.endTime - receivingState.startTime,\n // backward-compatibility for existing UIs\n fileBlob,\n getBlob,\n getObjectURL,\n revokeObjectURL\n });\n }\n \n // Send completion confirmation\n const completionMessage = {\n type: 'file_transfer_complete',\n fileId: receivingState.fileId,\n success: true,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(completionMessage);\n \n // Cleanup\n if (this.receivingTransfers.has(receivingState.fileId)) {\n const rs = this.receivingTransfers.get(receivingState.fileId);\n if (rs && rs.receivedChunks) rs.receivedChunks.clear();\n }\n this.receivingTransfers.delete(receivingState.fileId);\n \n } catch (error) {\n console.error('\u274C File assembly failed:', error);\n receivingState.status = 'failed';\n \n if (this.onError) {\n this.onError(`File assembly failed: ${error.message}`);\n }\n \n // Send error notification\n const errorMessage = {\n type: 'file_transfer_complete',\n fileId: receivingState.fileId,\n success: false,\n error: error.message,\n timestamp: Date.now()\n };\n await this.sendSecureMessage(errorMessage);\n \n // Cleanup failed transfer\n this.cleanupReceivingTransfer(receivingState.fileId);\n }\n }\n\n async calculateFileHashFromData(data) {\n try {\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 } catch (error) {\n console.error('\u274C Hash calculation failed:', error);\n throw error;\n }\n }\n\n handleTransferResponse(response) {\n try {\n const transferState = this.activeTransfers.get(response.fileId);\n \n if (!transferState) {\n return;\n }\n \n if (response.accepted) {\n transferState.status = 'accepted';\n } else {\n transferState.status = 'rejected';\n \n if (this.onError) {\n this.onError(`Transfer rejected: ${response.error || 'Unknown reason'}`);\n }\n \n this.cleanupTransfer(response.fileId);\n }\n } catch (error) {\n console.error('\u274C Failed to handle transfer response:', error);\n }\n }\n\n handleChunkConfirmation(confirmation) {\n try {\n const transferState = this.activeTransfers.get(confirmation.fileId);\n if (!transferState) {\n return;\n }\n \n transferState.confirmedChunks++;\n transferState.lastChunkTime = Date.now();\n } catch (error) {\n console.error('\u274C Failed to handle chunk confirmation:', error);\n }\n }\n\n handleTransferComplete(completion) {\n try {\n const transferState = this.activeTransfers.get(completion.fileId);\n if (!transferState) {\n return;\n }\n \n if (completion.success) {\n transferState.status = 'completed';\n transferState.endTime = Date.now();\n \n if (this.onComplete) {\n this.onComplete({\n fileId: transferState.fileId,\n fileName: transferState.file.name,\n fileSize: transferState.file.size,\n transferTime: transferState.endTime - transferState.startTime,\n status: 'completed'\n });\n }\n } else {\n transferState.status = 'failed';\n \n if (this.onError) {\n this.onError(`Transfer failed: ${completion.error || 'Unknown error'}`);\n }\n }\n \n this.cleanupTransfer(completion.fileId);\n \n } catch (error) {\n console.error('\u274C Failed to handle transfer completion:', error);\n }\n }\n\n handleTransferError(errorMessage) {\n try {\n const transferState = this.activeTransfers.get(errorMessage.fileId);\n if (transferState) {\n transferState.status = 'failed';\n this.cleanupTransfer(errorMessage.fileId);\n }\n \n const receivingState = this.receivingTransfers.get(errorMessage.fileId);\n if (receivingState) {\n receivingState.status = 'failed';\n this.cleanupReceivingTransfer(errorMessage.fileId);\n }\n \n if (this.onError) {\n this.onError(`Transfer error: ${errorMessage.error || 'Unknown error'}`);\n }\n \n } catch (error) {\n console.error('\u274C Failed to handle transfer error:', error);\n }\n }\n\n // ============================================\n // UTILITY METHODS\n // ============================================\n\n getActiveTransfers() {\n return Array.from(this.activeTransfers.values()).map(transfer => ({\n fileId: transfer.fileId,\n fileName: transfer.file?.name || 'Unknown',\n fileSize: transfer.file?.size || 0,\n progress: Math.round((transfer.sentChunks / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n }));\n }\n\n getReceivingTransfers() {\n return Array.from(this.receivingTransfers.values()).map(transfer => ({\n fileId: transfer.fileId,\n fileName: transfer.fileName || 'Unknown',\n fileSize: transfer.fileSize || 0,\n progress: Math.round((transfer.receivedCount / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n }));\n }\n\n cancelTransfer(fileId) {\n try {\n if (this.activeTransfers.has(fileId)) {\n this.cleanupTransfer(fileId);\n return true;\n }\n if (this.receivingTransfers.has(fileId)) {\n this.cleanupReceivingTransfer(fileId);\n return true;\n }\n return false;\n } catch (error) {\n console.error('\u274C Failed to cancel transfer:', error);\n return false;\n }\n }\n\n cleanupTransfer(fileId) {\n this.activeTransfers.delete(fileId);\n this.sessionKeys.delete(fileId);\n this.transferNonces.delete(fileId);\n \n // Remove processed chunk IDs for this transfer\n for (const chunkId of this.processedChunks) {\n if (chunkId.startsWith(fileId)) {\n this.processedChunks.delete(chunkId);\n }\n }\n }\n\n // \u2705 \u0423\u041B\u0423\u0427\u0428\u0415\u041D\u041D\u0410\u042F \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u043F\u0430\u043C\u044F\u0442\u0438 \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0435\u043D\u0438\u044F use-after-free\n cleanupReceivingTransfer(fileId) {\n try {\n // \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E \u043E\u0447\u0438\u0449\u0430\u0435\u043C pending chunks\n this.pendingChunks.delete(fileId);\n \n const receivingState = this.receivingTransfers.get(fileId);\n if (receivingState) {\n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 receivedChunks \u0441 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0439 \u0437\u0430\u0449\u0438\u0442\u043E\u0439\n if (receivingState.receivedChunks && receivingState.receivedChunks.size > 0) {\n for (const [index, chunk] of receivingState.receivedChunks) {\n try {\n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430 \u0432\u0430\u043B\u0438\u0434\u043D\u043E\u0441\u0442\u044C chunk\n if (chunk && (chunk instanceof ArrayBuffer || chunk instanceof Uint8Array)) {\n SecureMemoryManager.secureWipe(chunk);\n \n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 - \u0437\u0430\u043F\u043E\u043B\u043D\u044F\u0435\u043C \u043D\u0443\u043B\u044F\u043C\u0438 \u043F\u0435\u0440\u0435\u0434 \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u0435\u043C\n if (chunk instanceof ArrayBuffer) {\n const view = new Uint8Array(chunk);\n view.fill(0);\n } else if (chunk instanceof Uint8Array) {\n chunk.fill(0);\n }\n }\n } catch (chunkError) {\n console.warn('\u26A0\uFE0F Failed to securely wipe chunk:', chunkError);\n }\n }\n receivingState.receivedChunks.clear();\n }\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 session key\n if (receivingState.sessionKey) {\n try {\n // \u0414\u043B\u044F CryptoKey \u043D\u0435\u043B\u044C\u0437\u044F \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E \u043E\u0447\u0438\u0441\u0442\u0438\u0442\u044C, \u043D\u043E \u043C\u043E\u0436\u0435\u043C \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443\n receivingState.sessionKey = null;\n } catch (keyError) {\n console.warn('\u26A0\uFE0F Failed to clear session key:', keyError);\n }\n }\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\n if (receivingState.salt) {\n try {\n if (Array.isArray(receivingState.salt)) {\n receivingState.salt.fill(0);\n }\n receivingState.salt = null;\n } catch (saltError) {\n console.warn('\u26A0\uFE0F Failed to clear salt:', saltError);\n }\n }\n \n // \u041E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 receivingState\n for (const [key, value] of Object.entries(receivingState)) {\n if (value && typeof value === 'object') {\n if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n SecureMemoryManager.secureWipe(value);\n } else if (Array.isArray(value)) {\n value.fill(0);\n }\n receivingState[key] = null;\n }\n }\n }\n \n // \u0423\u0434\u0430\u043B\u044F\u0435\u043C \u0438\u0437 \u043E\u0441\u043D\u043E\u0432\u043D\u044B\u0445 \u043A\u043E\u043B\u043B\u0435\u043A\u0446\u0438\u0439\n this.receivingTransfers.delete(fileId);\n this.sessionKeys.delete(fileId);\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u0444\u0438\u043D\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0431\u0443\u0444\u0435\u0440\u0430 \u0444\u0430\u0439\u043B\u0430\n const fileBuffer = this.receivedFileBuffers.get(fileId);\n if (fileBuffer) {\n try {\n if (fileBuffer.buffer) {\n SecureMemoryManager.secureWipe(fileBuffer.buffer);\n \n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 - \u0437\u0430\u043F\u043E\u043B\u043D\u044F\u0435\u043C \u043D\u0443\u043B\u044F\u043C\u0438\n const view = new Uint8Array(fileBuffer.buffer);\n view.fill(0);\n }\n \n // \u041E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 fileBuffer\n for (const [key, value] of Object.entries(fileBuffer)) {\n if (value && typeof value === 'object') {\n if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n SecureMemoryManager.secureWipe(value);\n }\n fileBuffer[key] = null;\n }\n }\n \n this.receivedFileBuffers.delete(fileId);\n } catch (bufferError) {\n console.warn('\u26A0\uFE0F Failed to securely clear file buffer:', bufferError);\n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u044F\u0435\u043C \u0434\u0430\u0436\u0435 \u043F\u0440\u0438 \u043E\u0448\u0438\u0431\u043A\u0435\n this.receivedFileBuffers.delete(fileId);\n }\n }\n \n // \u2705 \u0411\u0415\u0417\u041E\u041F\u0410\u0421\u041D\u0410\u042F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 processed chunks\n const chunksToRemove = [];\n for (const chunkId of this.processedChunks) {\n if (chunkId.startsWith(fileId)) {\n chunksToRemove.push(chunkId);\n }\n }\n \n // \u0423\u0434\u0430\u043B\u044F\u0435\u043C \u0432 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u043C \u0446\u0438\u043A\u043B\u0435 \u0434\u043B\u044F \u0438\u0437\u0431\u0435\u0436\u0430\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043A\u043E\u043B\u043B\u0435\u043A\u0446\u0438\u0438 \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438\n for (const chunkId of chunksToRemove) {\n this.processedChunks.delete(chunkId);\n }\n \n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u043F\u0430\u043C\u044F\u0442\u0438\n if (typeof global !== 'undefined' && global.gc) {\n try {\n global.gc();\n } catch (gcError) {\n // \u0418\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u0435\u043C \u043E\u0448\u0438\u0431\u043A\u0438 GC\n }\n }\n \n console.log(`\uD83D\uDD12 Memory safely cleaned for file transfer: ${fileId}`);\n \n } catch (error) {\n console.error('\u274C Error during secure memory cleanup:', error);\n \n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043E\u0447\u0438\u0441\u0442\u043A\u0430 \u0434\u0430\u0436\u0435 \u043F\u0440\u0438 \u043E\u0448\u0438\u0431\u043A\u0435\n this.receivingTransfers.delete(fileId);\n this.sessionKeys.delete(fileId);\n this.receivedFileBuffers.delete(fileId);\n this.pendingChunks.delete(fileId);\n \n throw new Error(`Memory cleanup failed: ${error.message}`);\n }\n }\n\n getTransferStatus(fileId) {\n if (this.activeTransfers.has(fileId)) {\n const transfer = this.activeTransfers.get(fileId);\n return {\n type: 'sending',\n fileId: transfer.fileId,\n fileName: transfer.file.name,\n progress: Math.round((transfer.sentChunks / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n };\n }\n \n if (this.receivingTransfers.has(fileId)) {\n const transfer = this.receivingTransfers.get(fileId);\n return {\n type: 'receiving',\n fileId: transfer.fileId,\n fileName: transfer.fileName,\n progress: Math.round((transfer.receivedCount / transfer.totalChunks) * 100),\n status: transfer.status,\n startTime: transfer.startTime\n };\n }\n \n return null;\n }\n\n getSystemStatus() {\n return {\n initialized: true,\n activeTransfers: this.activeTransfers.size,\n receivingTransfers: this.receivingTransfers.size,\n totalTransfers: this.activeTransfers.size + this.receivingTransfers.size,\n maxConcurrentTransfers: this.MAX_CONCURRENT_TRANSFERS,\n maxFileSize: this.MAX_FILE_SIZE,\n chunkSize: this.CHUNK_SIZE,\n hasWebrtcManager: !!this.webrtcManager,\n isConnected: this.webrtcManager?.isConnected?.() || false,\n hasDataChannel: !!this.webrtcManager?.dataChannel,\n dataChannelState: this.webrtcManager?.dataChannel?.readyState,\n isVerified: this.webrtcManager?.isVerified,\n hasEncryptionKey: !!this.webrtcManager?.encryptionKey,\n hasMacKey: !!this.webrtcManager?.macKey,\n linkedToWebRTCManager: this.webrtcManager?.fileTransferSystem === this,\n supportedFileTypes: this.getSupportedFileTypes(),\n fileTypeInfo: this.getFileTypeInfo()\n };\n }\n\n cleanup() {\n SecureFileTransferContext.getInstance().deactivate();\n\n if (this.webrtcManager && this.webrtcManager.dataChannel && this.originalOnMessage) {\n this.webrtcManager.dataChannel.onmessage = this.originalOnMessage;\n this.originalOnMessage = null;\n }\n \n if (this.webrtcManager && this.originalProcessMessage) {\n this.webrtcManager.processMessage = this.originalProcessMessage;\n this.originalProcessMessage = null;\n }\n \n if (this.webrtcManager && this.originalRemoveSecurityLayers) {\n this.webrtcManager.removeSecurityLayers = this.originalRemoveSecurityLayers;\n this.originalRemoveSecurityLayers = null;\n }\n \n // Cleanup all active transfers with secure memory wiping\n for (const fileId of this.activeTransfers.keys()) {\n this.cleanupTransfer(fileId);\n }\n \n for (const fileId of this.receivingTransfers.keys()) {\n this.cleanupReceivingTransfer(fileId);\n }\n\n if (this.atomicOps) {\n this.atomicOps.locks.clear();\n }\n \n if (this.rateLimiter) {\n this.rateLimiter.requests.clear();\n }\n \n // Clear all state\n this.pendingChunks.clear();\n this.activeTransfers.clear();\n this.receivingTransfers.clear();\n this.transferQueue.length = 0;\n this.sessionKeys.clear();\n this.transferNonces.clear();\n this.processedChunks.clear();\n\n this.clearKeys();\n }\n\n // ============================================\n // SESSION UPDATE HANDLER - FIXED\n // ============================================\n \n onSessionUpdate(sessionData) {\n // Clear session keys cache for resync\n this.sessionKeys.clear();\n }\n\n // ============================================\n // DEBUGGING AND DIAGNOSTICS\n // ============================================\n\n diagnoseFileTransferIssue() {\n const diagnosis = {\n timestamp: new Date().toISOString(),\n fileTransferSystem: {\n initialized: !!this,\n hasWebrtcManager: !!this.webrtcManager,\n webrtcManagerType: this.webrtcManager?.constructor?.name,\n linkedToWebRTCManager: this.webrtcManager?.fileTransferSystem === this\n },\n webrtcManager: {\n hasDataChannel: !!this.webrtcManager?.dataChannel,\n dataChannelState: this.webrtcManager?.dataChannel?.readyState,\n isConnected: this.webrtcManager?.isConnected?.() || false,\n isVerified: this.webrtcManager?.isVerified,\n hasEncryptionKey: !!this.webrtcManager?.encryptionKey,\n hasMacKey: !!this.webrtcManager?.macKey,\n hasKeyFingerprint: !!this.webrtcManager?.keyFingerprint,\n hasSessionSalt: !!this.webrtcManager?.sessionSalt\n },\n securityContext: {\n contextActive: SecureFileTransferContext.getInstance().isActive(),\n securityLevel: SecureFileTransferContext.getInstance().getSecurityLevel(),\n hasAtomicOps: !!this.atomicOps,\n hasRateLimiter: !!this.rateLimiter\n },\n transfers: {\n activeTransfers: this.activeTransfers.size,\n receivingTransfers: this.receivingTransfers.size,\n pendingChunks: this.pendingChunks.size,\n sessionKeys: this.sessionKeys.size\n },\n fileTypeSupport: {\n supportedTypes: this.getSupportedFileTypes(),\n generalMaxSize: this.formatFileSize(this.MAX_FILE_SIZE),\n restrictions: Object.keys(this.FILE_TYPE_RESTRICTIONS)\n }\n };\n \n return diagnosis;\n }\n\n async debugKeyDerivation(fileId) {\n try {\n if (!this.webrtcManager.keyFingerprint || !this.webrtcManager.sessionSalt) {\n throw new Error('Session data not available');\n }\n \n // Test sender derivation\n const senderResult = await this.deriveFileSessionKey(fileId);\n \n // Test receiver derivation with same salt\n const receiverKey = await this.deriveFileSessionKeyFromSalt(fileId, senderResult.salt);\n \n // Test encryption/decryption\n const testData = new TextEncoder().encode('test data');\n const nonce = crypto.getRandomValues(new Uint8Array(12));\n \n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: nonce },\n senderResult.key,\n testData\n );\n \n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: nonce },\n receiverKey,\n encrypted\n );\n \n const decryptedText = new TextDecoder().decode(decrypted);\n \n if (decryptedText === 'test data') {\n return { success: true, message: 'All tests passed' };\n } else {\n throw new Error('Decryption verification failed');\n }\n \n } catch (error) {\n console.error('\u274C Key derivation test failed:', error);\n return { success: false, error: error.message };\n }\n }\n\n // ============================================\n // ALTERNATIVE METHOD OF INITIALIZING HANDLERS\n // ============================================\n\n registerWithWebRTCManager() {\n if (!this.webrtcManager) {\n throw new Error('WebRTC manager not available');\n }\n\n this.webrtcManager.fileTransferSystem = this;\n\n this.webrtcManager.setFileMessageHandler = (handler) => {\n this.webrtcManager._fileMessageHandler = handler;\n };\n\n this.webrtcManager.setFileMessageHandler((message) => {\n return this.handleFileMessage(message);\n });\n }\n\n static createFileMessageFilter(fileTransferSystem) {\n return async (event) => {\n try {\n if (typeof event.data === 'string') {\n const parsed = JSON.parse(event.data);\n \n if (fileTransferSystem.isFileTransferMessage(parsed)) {\n await fileTransferSystem.handleFileMessage(parsed);\n return true; \n }\n }\n } catch (error) {\n }\n \n return false; \n };\n }\n\n // ============================================\n // SECURITY KEY MANAGEMENT\n // ============================================\n\n setSigningKey(privateKey) {\n if (!privateKey || !(privateKey instanceof CryptoKey)) {\n throw new Error('Invalid private key for signing');\n }\n this.signingKey = privateKey;\n console.log('\uD83D\uDD12 Signing key set successfully');\n }\n\n setVerificationKey(publicKey) {\n if (!publicKey || !(publicKey instanceof CryptoKey)) {\n throw new Error('Invalid public key for verification');\n }\n this.verificationKey = publicKey;\n console.log('\uD83D\uDD12 Verification key set successfully');\n }\n\n async generateSigningKeyPair() {\n try {\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: 2048,\n publicExponent: new Uint8Array([1, 0, 1]),\n hash: 'SHA-256'\n },\n true, // extractable\n ['sign', 'verify']\n );\n \n this.signingKey = keyPair.privateKey;\n this.verificationKey = keyPair.publicKey;\n \n console.log('\uD83D\uDD12 RSA key pair generated successfully');\n return keyPair;\n } catch (error) {\n const safeError = SecurityErrorHandler.sanitizeError(error);\n console.error('\u274C Failed to generate signing key pair:', safeError);\n throw new Error(safeError);\n }\n }\n\n clearKeys() {\n this.signingKey = null;\n this.verificationKey = null;\n console.log('\uD83D\uDD12 Security keys cleared');\n }\n\n getSecurityStatus() {\n return {\n signingEnabled: this.signingKey !== null,\n verificationEnabled: this.verificationKey !== null,\n contextActive: SecureFileTransferContext.getInstance().isActive(),\n securityLevel: SecureFileTransferContext.getInstance().getSecurityLevel()\n };\n }\n\n getClientIdentifier() {\n return this.webrtcManager?.connectionId || \n this.webrtcManager?.keyFingerprint?.substring(0, 16) || \n 'default-client';\n }\n \n destroy() {\n SecureFileTransferContext.getInstance().deactivate();\n this.clearKeys();\n console.log('\uD83D\uDD12 File transfer system destroyed safely');\n }\n}\n\nexport { EnhancedSecureFileTransfer };", "// Import EnhancedSecureFileTransfer\nimport { EnhancedSecureFileTransfer } from '../transfer/EnhancedSecureFileTransfer.js';\n\n// MUTEX SYSTEM FIXES - RESOLVING MESSAGE DELIVERY ISSUES\n// ============================================\n// Issue: After introducing the Mutex system, messages stopped being delivered between users\n// Fix: Simplified locking logic \u2014 mutex is used ONLY for critical operations\n// - Regular messages are processed WITHOUT mutex\n// - File messages are processed WITHOUT mutex \n// - Mutex is used ONLY for cryptographic operations\n// ============================================\n\nclass EnhancedSecureWebRTCManager {\n // ============================================\n // CONSTANTS\n // ============================================\n \n static TIMEOUTS = {\n KEY_ROTATION_INTERVAL: 300000, // 5 minutes\n CONNECTION_TIMEOUT: 10000, // 10 seconds \n HEARTBEAT_INTERVAL: 30000, // 30 seconds\n SECURITY_CALC_DELAY: 1000, // 1 second\n SECURITY_CALC_RETRY_DELAY: 3000, // 3 seconds\n CLEANUP_INTERVAL: 300000, // 5 minutes (periodic cleanup)\n CLEANUP_CHECK_INTERVAL: 60000, // 1 minute (cleanup check)\n ICE_GATHERING_TIMEOUT: 10000, // 10 seconds\n DISCONNECT_CLEANUP_DELAY: 500, // 500ms\n PEER_DISCONNECT_CLEANUP: 2000, // 2 seconds\n STAGE2_ACTIVATION_DELAY: 10000, // 10 seconds\n STAGE3_ACTIVATION_DELAY: 15000, // 15 seconds \n STAGE4_ACTIVATION_DELAY: 20000, // 20 seconds\n FILE_TRANSFER_INIT_DELAY: 1000, // 1 second\n FAKE_TRAFFIC_MIN_INTERVAL: 15000, // 15 seconds\n FAKE_TRAFFIC_MAX_INTERVAL: 30000, // 30 seconds\n DECOY_INITIAL_DELAY: 5000, // 5 seconds\n DECOY_TRAFFIC_MIN: 10000, // 10 seconds\n DECOY_TRAFFIC_MAX: 25000, // 25 seconds\n REORDER_TIMEOUT: 3000, // 3 seconds\n RETRY_CONNECTION_DELAY: 2000 // 2 seconds\n };\n\n static LIMITS = {\n MAX_CONNECTION_ATTEMPTS: 3,\n MAX_OLD_KEYS: 3,\n MAX_PROCESSED_MESSAGE_IDS: 1000,\n MAX_OUT_OF_ORDER_PACKETS: 5,\n MAX_DECOY_CHANNELS: 1,\n MESSAGE_RATE_LIMIT: 60, // messages per minute\n MAX_KEY_AGE: 900000, // 15 minutes\n OFFER_MAX_AGE: 3600000, // 1 hour\n SALT_SIZE_V3: 32, // bytes\n SALT_SIZE_V4: 64 // bytes\n };\n\n static SIZES = {\n VERIFICATION_CODE_MIN_LENGTH: 6,\n FAKE_TRAFFIC_MIN_SIZE: 32,\n FAKE_TRAFFIC_MAX_SIZE: 128,\n PACKET_PADDING_MIN: 64,\n PACKET_PADDING_MAX: 512,\n CHUNK_SIZE_MAX: 2048,\n CHUNK_DELAY_MIN: 100,\n CHUNK_DELAY_MAX: 500,\n FINGERPRINT_DISPLAY_LENGTH: 8,\n SESSION_ID_LENGTH: 16,\n NESTED_ENCRYPTION_IV_SIZE: 12\n };\n\n static MESSAGE_TYPES = {\n // Regular messages\n MESSAGE: 'message',\n ENHANCED_MESSAGE: 'enhanced_message',\n \n // System messages\n HEARTBEAT: 'heartbeat',\n VERIFICATION: 'verification',\n VERIFICATION_RESPONSE: 'verification_response',\n VERIFICATION_CONFIRMED: 'verification_confirmed',\n VERIFICATION_BOTH_CONFIRMED: 'verification_both_confirmed',\n PEER_DISCONNECT: 'peer_disconnect',\n SECURITY_UPGRADE: 'security_upgrade',\n KEY_ROTATION_SIGNAL: 'key_rotation_signal',\n KEY_ROTATION_READY: 'key_rotation_ready',\n \n // File transfer messages\n FILE_TRANSFER_START: 'file_transfer_start',\n FILE_TRANSFER_RESPONSE: 'file_transfer_response',\n FILE_CHUNK: 'file_chunk',\n CHUNK_CONFIRMATION: 'chunk_confirmation',\n FILE_TRANSFER_COMPLETE: 'file_transfer_complete',\n FILE_TRANSFER_ERROR: 'file_transfer_error',\n \n // Fake traffic\n FAKE: 'fake'\n };\n\n static FILTERED_RESULTS = {\n FAKE_MESSAGE: 'FAKE_MESSAGE_FILTERED',\n FILE_MESSAGE: 'FILE_MESSAGE_FILTERED', \n SYSTEM_MESSAGE: 'SYSTEM_MESSAGE_FILTERED'\n };\n\n // Static debug flag instead of this._debugMode\n static DEBUG_MODE = true; // Set to true during development, false in production\n\n\n constructor(onMessage, onStatusChange, onKeyExchange, onVerificationRequired, onAnswerError = null, onVerificationStateChange = null, config = {}) {\n // Determine runtime mode\n this._isProductionMode = this._detectProductionMode();\n // Use static flag instead of this._debugMode\n this._debugMode = !this._isProductionMode && EnhancedSecureWebRTCManager.DEBUG_MODE;\n \n // Configuration from constructor parameters instead of global flags\n this._config = {\n fakeTraffic: {\n enabled: config.fakeTraffic?.enabled ?? true,\n minInterval: config.fakeTraffic?.minInterval ?? EnhancedSecureWebRTCManager.TIMEOUTS.FAKE_TRAFFIC_MIN_INTERVAL,\n maxInterval: config.fakeTraffic?.maxInterval ?? EnhancedSecureWebRTCManager.TIMEOUTS.FAKE_TRAFFIC_MAX_INTERVAL,\n minSize: config.fakeTraffic?.minSize ?? EnhancedSecureWebRTCManager.SIZES.FAKE_TRAFFIC_MIN_SIZE,\n maxSize: config.fakeTraffic?.maxSize ?? EnhancedSecureWebRTCManager.SIZES.FAKE_TRAFFIC_MAX_SIZE,\n patterns: config.fakeTraffic?.patterns ?? ['heartbeat', 'status', 'sync']\n },\n decoyChannels: {\n enabled: config.decoyChannels?.enabled ?? true,\n maxDecoyChannels: config.decoyChannels?.maxDecoyChannels ?? EnhancedSecureWebRTCManager.LIMITS.MAX_DECOY_CHANNELS,\n decoyChannelNames: config.decoyChannels?.decoyChannelNames ?? ['heartbeat'],\n sendDecoyData: config.decoyChannels?.sendDecoyData ?? true,\n randomDecoyIntervals: config.decoyChannels?.randomDecoyIntervals ?? true\n },\n packetPadding: {\n enabled: config.packetPadding?.enabled ?? true,\n minPadding: config.packetPadding?.minPadding ?? EnhancedSecureWebRTCManager.SIZES.PACKET_PADDING_MIN,\n maxPadding: config.packetPadding?.maxPadding ?? EnhancedSecureWebRTCManager.SIZES.PACKET_PADDING_MAX,\n useRandomPadding: config.packetPadding?.useRandomPadding ?? true,\n preserveMessageSize: config.packetPadding?.preserveMessageSize ?? false\n },\n antiFingerprinting: {\n enabled: config.antiFingerprinting?.enabled ?? false,\n randomizeTiming: config.antiFingerprinting?.randomizeTiming ?? true,\n randomizeSizes: config.antiFingerprinting?.randomizeSizes ?? false,\n addNoise: config.antiFingerprinting?.addNoise ?? true,\n maskPatterns: config.antiFingerprinting?.maskPatterns ?? false,\n useRandomHeaders: config.antiFingerprinting?.useRandomHeaders ?? false\n }\n };\n\n // Initialize own logging system\n this._initializeSecureLogging();\n this._setupOwnLogger();\n this._setupProductionLogging();\n \n // Store important methods first\n this._storeImportantMethods();\n \n // Setup global API after storing methods\n this._setupSecureGlobalAPI();\n if (!window.EnhancedSecureCryptoUtils) {\n throw new Error('EnhancedSecureCryptoUtils is not loaded. Please ensure the module is loaded first.');\n }\n this.getSecurityData = () => {\n // Return only public information\n return this.lastSecurityCalculation ? {\n level: this.lastSecurityCalculation.level,\n score: this.lastSecurityCalculation.score,\n timestamp: this.lastSecurityCalculation.timestamp,\n // Do NOT return check details or sensitive data\n } : null;\n };\n this._secureLog('info', '\uD83D\uDD12 Enhanced WebRTC Manager initialized with secure API');\n this.currentSessionType = null;\n this.currentSecurityLevel = 'basic';\n this.sessionConstraints = null;\n this.peerConnection = null;\n this.dataChannel = null;\n\n\n this.onMessage = onMessage;\n this.onStatusChange = onStatusChange;\n this.onKeyExchange = onKeyExchange;\n this.onVerificationStateChange = onVerificationStateChange;\n\n this.onVerificationRequired = onVerificationRequired;\n this.onAnswerError = onAnswerError; // Callback for response processing errors\n this.isInitiator = false;\n this.connectionAttempts = 0;\n this.maxConnectionAttempts = EnhancedSecureWebRTCManager.LIMITS.MAX_CONNECTION_ATTEMPTS;\n try {\n this._initializeMutexSystem();\n} catch (error) {\n this._secureLog('error', '\u274C Failed to initialize mutex system', {\n errorType: error.constructor.name\n });\n throw new Error('Critical: Mutex system initialization failed');\n}\n\n// Post-initialization validation of the mutex system\nif (!this._validateMutexSystem()) {\n this._secureLog('error', '\u274C Mutex system validation failed after initialization');\n throw new Error('Critical: Mutex system validation failed');\n}\n\nif (typeof window !== 'undefined') {\n this._secureLog('info', '\uD83D\uDD12 Emergency mutex handlers will be available through secure API');\n}\n\nthis._secureLog('info', '\uD83D\uDD12 Enhanced Mutex system fully initialized and validated');\n this.heartbeatInterval = null;\n this.messageQueue = [];\n this.ecdhKeyPair = null;\n this.ecdsaKeyPair = null;\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n this.verificationCode = null;\n this.pendingSASCode = null;\n this.isVerified = false;\n this.processedMessageIds = new Set();\n \n // Mutual verification states\n this.localVerificationConfirmed = false;\n this.remoteVerificationConfirmed = false;\n this.bothVerificationsConfirmed = false;\n \n // Store expected DTLS fingerprint for validation\n this.expectedDTLSFingerprint = null;\n this.strictDTLSValidation = true; // Can be disabled for debugging\n \n // Real Perfect Forward Secrecy implementation\n this.ephemeralKeyPairs = new Map(); // Store ephemeral keys for current session only\n this.sessionStartTime = Date.now(); // Track session lifetime for PFS\n this.messageCounter = 0;\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.sessionSalt = null;\n \n // Anti-Replay and Message Ordering Protection\n this.replayWindowSize = 64; // Sliding window for replay protection\n this.replayWindow = new Set(); // Track recent sequence numbers\n this.maxSequenceGap = 100; // Maximum allowed sequence gap\n this.replayProtectionEnabled = true; // Enable/disable replay protection\n this.sessionId = null; // MITM protection: Session identifier\n this.connectionId = Array.from(crypto.getRandomValues(new Uint8Array(8)))\n .map(b => b.toString(16).padStart(2, '0')).join(''); // Connection identifier for AAD\n this.peerPublicKey = null; // Store peer's public key for PFS\n this.rateLimiterId = null;\n this.intentionalDisconnect = false;\n this.lastCleanupTime = Date.now();\n \n // Reset notification flags for new connection\n this._resetNotificationFlags();\n \n \n\n this.verificationInitiationSent = false;\n this.disconnectNotificationSent = false;\n this.reconnectionFailedNotificationSent = false;\n this.peerDisconnectNotificationSent = false;\n this.connectionClosedNotificationSent = false;\n this.fakeTrafficDisabledNotificationSent = false;\n this.advancedFeaturesDisabledNotificationSent = false;\n this.securityUpgradeNotificationSent = false;\n this.lastSecurityUpgradeStage = null;\n this.securityCalculationNotificationSent = false;\n this.lastSecurityCalculationLevel = null;\n \n // File transfer integration\n this.fileTransferSystem = null;\n this.onFileProgress = null;\n \n // ============================================\n // IV REUSE PREVENTION SYSTEM\n // ============================================\n // IV REUSE PREVENTION SYSTEM WITH LIMITS\n // ============================================\n this._ivTrackingSystem = {\n usedIVs: new Set(), // Track all used IVs to prevent reuse\n ivHistory: new Map(), // Track IV usage with timestamps (max 10k entries)\n collisionCount: 0, // Track potential collisions\n maxIVHistorySize: 10000, // Maximum IV history size\n maxSessionIVs: 1000, // Maximum IVs per session\n entropyValidation: {\n minEntropy: 3.0, // Minimum entropy threshold\n entropyTests: 0,\n entropyFailures: 0\n },\n rngValidation: {\n testsPerformed: 0,\n weakRngDetected: false,\n lastValidation: 0\n },\n sessionIVs: new Map(), // Track IVs per session\n emergencyMode: false // Emergency mode if IV reuse detected\n };\n \n // IV cleanup tracking\n this._lastIVCleanupTime = null;\n \n // ============================================\n // SECURE ERROR HANDLING SYSTEM\n // ============================================\n this._secureErrorHandler = {\n errorCategories: {\n CRYPTOGRAPHIC: 'cryptographic',\n NETWORK: 'network',\n VALIDATION: 'validation',\n SYSTEM: 'system',\n UNKNOWN: 'unknown'\n },\n errorMappings: new Map(), // Map internal errors to safe messages\n errorCounts: new Map(), // Track error frequencies\n lastErrorTime: 0,\n errorThreshold: 10, // Max errors per minute\n isInErrorMode: false\n };\n \n // ============================================\n // SECURE MEMORY MANAGEMENT SYSTEM\n // ============================================\n this._secureMemoryManager = {\n sensitiveData: new WeakMap(), // Track sensitive data for secure cleanup\n cleanupQueue: [], // Queue for deferred cleanup operations\n isCleaning: false, // Prevent concurrent cleanup operations\n cleanupInterval: null, // Periodic cleanup timer\n memoryStats: {\n totalCleanups: 0,\n failedCleanups: 0,\n lastCleanup: 0\n }\n };\n this.onFileReceived = null;\n this.onFileError = null;\n \n // PFS (Perfect Forward Secrecy) Implementation\n this.keyRotationInterval = EnhancedSecureWebRTCManager.TIMEOUTS.KEY_ROTATION_INTERVAL;\n this.lastKeyRotation = Date.now();\n this.currentKeyVersion = 0;\n this.keyVersions = new Map(); // Store key versions for PFS\n this.oldKeys = new Map(); // Store old keys temporarily for decryption\n this.maxOldKeys = EnhancedSecureWebRTCManager.LIMITS.MAX_OLD_KEYS; // Keep last 3 key versions for decryption\n this.peerConnection = null;\n this.dataChannel = null;\n \n\n this.securityFeatures = {\n // All security features enabled by default - no payment required\n hasEncryption: true, \n hasECDH: true, \n hasECDSA: true, \n hasMutualAuth: true, \n hasMetadataProtection: true, \n hasEnhancedReplayProtection: true, \n hasNonExtractableKeys: true, \n hasRateLimiting: true, \n hasEnhancedValidation: true, \n hasPFS: true, // Real Perfect Forward Secrecy enabled \n \n // Advanced Features - All enabled by default\n hasNestedEncryption: true, \n hasPacketPadding: true, \n hasPacketReordering: true, \n hasAntiFingerprinting: true, \n hasFakeTraffic: true, \n hasDecoyChannels: true, \n hasMessageChunking: true \n };\n this._secureLog('info', '\uD83D\uDD12 Enhanced WebRTC Manager initialized with tiered security');\n \n // Log configuration for debugging\n this._secureLog('info', '\uD83D\uDD12 Configuration loaded from constructor parameters', {\n fakeTraffic: this._config.fakeTraffic.enabled,\n decoyChannels: this._config.decoyChannels.enabled,\n packetPadding: this._config.packetPadding.enabled,\n antiFingerprinting: this._config.antiFingerprinting.enabled\n });\n \n // XSS Hardening - replace all window.DEBUG_MODE references\n this._hardenDebugModeReferences();\n \n // Initialize unified scheduler for all maintenance tasks\n this._initializeUnifiedScheduler();\n \n this._syncSecurityFeaturesWithTariff();\n \n if (!this._validateCryptographicSecurity()) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Cryptographic security validation failed after tariff sync');\n throw new Error('Critical cryptographic features are missing after tariff synchronization');\n }\n // ============================================\n // ENHANCED SECURITY FEATURES\n // ============================================\n \n // 1. Nested Encryption Layer\n this.nestedEncryptionKey = null;\n // Removed nestedEncryptionIV and nestedEncryptionCounter\n // Each nested encryption now generates fresh random IV for maximum security\n \n // 2. Packet Padding\n this.paddingConfig = {\n enabled: this._config.packetPadding.enabled,\n minPadding: this._config.packetPadding.minPadding,\n maxPadding: this._config.packetPadding.maxPadding,\n useRandomPadding: this._config.packetPadding.useRandomPadding,\n preserveMessageSize: this._config.packetPadding.preserveMessageSize\n };\n \n // 3. Fake Traffic Generation\n this.fakeTrafficConfig = {\n enabled: this._config.fakeTraffic.enabled,\n minInterval: this._config.fakeTraffic.minInterval,\n maxInterval: this._config.fakeTraffic.maxInterval,\n minSize: this._config.fakeTraffic.minSize,\n maxSize: this._config.fakeTraffic.maxSize,\n patterns: this._config.fakeTraffic.patterns\n };\n this.fakeTrafficTimer = null;\n this.lastFakeTraffic = 0;\n \n // 4. Message Chunking\n this.chunkingConfig = {\n enabled: false,\n maxChunkSize: EnhancedSecureWebRTCManager.SIZES.CHUNK_SIZE_MAX, \n minDelay: EnhancedSecureWebRTCManager.SIZES.CHUNK_DELAY_MIN,\n maxDelay: EnhancedSecureWebRTCManager.SIZES.CHUNK_DELAY_MAX,\n useRandomDelays: true,\n addChunkHeaders: true\n };\n this.chunkQueue = [];\n this.chunkingInProgress = false;\n \n // 5. Decoy Channels\n this.decoyChannels = new Map();\n this.decoyChannelConfig = {\n enabled: this._config.decoyChannels.enabled,\n maxDecoyChannels: this._config.decoyChannels.maxDecoyChannels,\n decoyChannelNames: this._config.decoyChannels.decoyChannelNames,\n sendDecoyData: this._config.decoyChannels.sendDecoyData,\n randomDecoyIntervals: this._config.decoyChannels.randomDecoyIntervals\n };\n this.decoyTimers = new Map();\n \n // 6. Packet Reordering Protection\n this.reorderingConfig = {\n enabled: false, \n maxOutOfOrder: EnhancedSecureWebRTCManager.LIMITS.MAX_OUT_OF_ORDER_PACKETS, \n reorderTimeout: EnhancedSecureWebRTCManager.TIMEOUTS.REORDER_TIMEOUT, \n useSequenceNumbers: true,\n useTimestamps: true\n };\n this.packetBuffer = new Map(); // sequence -> {data, timestamp}\n this.lastProcessedSequence = -1;\n \n // 7. Anti-Fingerprinting\n this.antiFingerprintingConfig = {\n enabled: this._config.antiFingerprinting.enabled,\n randomizeTiming: this._config.antiFingerprinting.randomizeTiming,\n randomizeSizes: this._config.antiFingerprinting.randomizeSizes,\n addNoise: this._config.antiFingerprinting.addNoise,\n maskPatterns: this._config.antiFingerprinting.maskPatterns,\n useRandomHeaders: this._config.antiFingerprinting.useRandomHeaders\n };\n this.fingerprintMask = this.generateFingerprintMask();\n \n // Initialize rate limiter ID\n this.rateLimiterId = `webrtc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n \n // Start periodic cleanup\n this.startPeriodicCleanup();\n \n this.initializeEnhancedSecurity(); \n \n // ============================================\n // MUTEX SYSTEM TO PREVENT RACE CONDITIONS\n // ============================================\n\n // Mutex for key operations\n this._keyOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null\n };\n\n // Mutex for encryption/decryption operations\n this._cryptoOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null\n };\n\n // Mutex for connection initialization\n this._connectionOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null\n };\n\n // Key system state\n this._keySystemState = {\n isInitializing: false,\n isRotating: false,\n isDestroying: false,\n lastOperation: null,\n lastOperationTime: Date.now()\n };\n\n // Operation counters\n this._operationCounters = {\n keyOperations: 0,\n cryptoOperations: 0,\n connectionOperations: 0\n };\n\n }\n \n /**\n * Create AAD with sequence number for anti-replay protection\n * This binds each message to its sequence number and prevents replay attacks\n */\n _createMessageAAD(messageType, messageData = null, isFileMessage = false) {\n try {\n const aad = {\n sessionId: this.currentSession?.sessionId || this.sessionId || 'unknown',\n keyFingerprint: this.keyFingerprint || 'unknown',\n sequenceNumber: this._generateNextSequenceNumber(),\n messageType: messageType,\n timestamp: Date.now(),\n connectionId: this.connectionId || 'unknown',\n isFileMessage: isFileMessage\n };\n\n // Add message-specific data if available\n if (messageData && typeof messageData === 'object') {\n if (messageData.fileId) aad.fileId = messageData.fileId;\n if (messageData.chunkIndex !== undefined) aad.chunkIndex = messageData.chunkIndex;\n if (messageData.totalChunks !== undefined) aad.totalChunks = messageData.totalChunks;\n }\n\n return JSON.stringify(aad);\n } catch (error) {\n this._secureLog('error', '\u274C Failed to create message AAD', {\n errorType: error.constructor.name,\n message: error.message,\n messageType: messageType\n });\n // Fallback to basic AAD\n return JSON.stringify({\n sessionId: 'unknown',\n keyFingerprint: 'unknown',\n sequenceNumber: Date.now(),\n messageType: messageType,\n timestamp: Date.now(),\n connectionId: 'unknown',\n isFileMessage: isFileMessage\n });\n }\n }\n \n /**\n * Generate next sequence number for outgoing messages\n * This ensures unique ordering and prevents replay attacks\n */\n _generateNextSequenceNumber() {\n const nextSeq = this.sequenceNumber++;\n \n // Reset sequence number if it gets too large\n if (this.sequenceNumber > Number.MAX_SAFE_INTEGER - 1000) {\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.replayWindow.clear();\n this._secureLog('warn', '\u26A0\uFE0F Sequence number reset due to overflow', {\n timestamp: Date.now()\n });\n }\n \n return nextSeq;\n }\n \n /**\n * Enhanced mutex system initialization with atomic protection\n */\n _initializeMutexSystem() {\n // Initialize standard mutexes with enhanced state tracking\n this._keyOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null,\n lockTime: null,\n operationCount: 0\n };\n\n this._cryptoOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null,\n lockTime: null,\n operationCount: 0\n };\n\n this._connectionOperationMutex = {\n locked: false,\n queue: [],\n lockId: null,\n lockTimeout: null,\n lockTime: null,\n operationCount: 0\n };\n\n // Enhanced key system state with atomic operation tracking\n this._keySystemState = {\n isInitializing: false,\n isRotating: false,\n isDestroying: false,\n lastOperation: null,\n lastOperationTime: Date.now(),\n operationId: null,\n concurrentOperations: 0,\n maxConcurrentOperations: 1\n };\n\n // Operation counters with atomic increments\n this._operationCounters = {\n keyOperations: 0,\n cryptoOperations: 0,\n connectionOperations: 0,\n totalOperations: 0,\n failedOperations: 0\n };\n\n this._secureLog('info', '\uD83D\uDD12 Enhanced mutex system initialized with atomic protection', {\n mutexes: ['keyOperation', 'cryptoOperation', 'connectionOperation'],\n timestamp: Date.now(),\n features: ['atomic_operations', 'race_condition_protection', 'enhanced_state_tracking']\n });\n }\n\n /**\n * XSS Hardening - Debug mode references validation\n * This method is called during initialization to ensure XSS hardening\n */\n _hardenDebugModeReferences() {\n // Log that we're hardening debug mode references\n this._secureLog('info', '\uD83D\uDD12 XSS Hardening: Debug mode references already replaced');\n }\n\n /**\n * Unified scheduler for all maintenance tasks\n * Replaces multiple setInterval calls with a single, controlled scheduler\n */\n _initializeUnifiedScheduler() {\n // Single scheduler interval for all maintenance tasks\n this._maintenanceScheduler = setInterval(() => {\n this._executeMaintenanceCycle();\n }, 300000); // Every 5 minutes\n \n // Log scheduler initialization\n this._secureLog('info', '\uD83D\uDD27 Unified maintenance scheduler initialized (5-minute cycle)');\n \n // Store scheduler reference for cleanup\n this._activeTimers = new Set([this._maintenanceScheduler]);\n }\n\n /**\n * Execute all maintenance tasks in a single cycle\n */\n _executeMaintenanceCycle() {\n try {\n this._secureLog('info', '\uD83D\uDD27 Starting maintenance cycle');\n \n // 1. Log cleanup and security audit\n this._cleanupLogs();\n this._auditLoggingSystemSecurity();\n \n // 2. Security monitoring\n this._verifyAPIIntegrity();\n this._validateCryptographicSecurity();\n this._syncSecurityFeaturesWithTariff();\n \n // 3. Resource cleanup\n this._cleanupResources();\n this._enforceResourceLimits();\n \n // 4. Key monitoring (if connected)\n if (this.isConnected && this.isVerified) {\n this._monitorKeySecurity();\n }\n \n // 5. Global exposure monitoring (debug mode only)\n if (this._debugMode) {\n this._monitorGlobalExposure();\n }\n \n // 6. Heartbeat (if enabled and connected)\n if (this._heartbeatConfig && this._heartbeatConfig.enabled && this.isConnected()) {\n this._sendHeartbeat();\n }\n \n this._secureLog('info', '\uD83D\uDD27 Maintenance cycle completed successfully');\n \n } catch (error) {\n this._secureLog('error', '\u274C Maintenance cycle failed', {\n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n \n // Emergency cleanup on failure\n this._emergencyCleanup();\n }\n }\n\n /**\n * Enforce hard resource limits with emergency cleanup\n */\n _enforceResourceLimits() {\n const violations = [];\n \n // Check log entries\n if (this._logCounts.size > this._resourceLimits.maxLogEntries) {\n violations.push('log_entries');\n }\n \n // Check message queue\n if (this.messageQueue.length > this._resourceLimits.maxMessageQueue) {\n violations.push('message_queue');\n }\n \n // Check IV history\n if (this._ivTrackingSystem && this._ivTrackingSystem.ivHistory.size > this._resourceLimits.maxIVHistory) {\n violations.push('iv_history');\n }\n \n // Check processed message IDs\n if (this.processedMessageIds.size > this._resourceLimits.maxProcessedMessageIds) {\n violations.push('processed_message_ids');\n }\n \n // Check decoy channels\n if (this.decoyChannels.size > this._resourceLimits.maxDecoyChannels) {\n violations.push('decoy_channels');\n }\n \n // Check fake traffic messages\n if (this._fakeTrafficMessages && this._fakeTrafficMessages.length > this._resourceLimits.maxFakeTrafficMessages) {\n violations.push('fake_traffic_messages');\n }\n \n // Check chunk queue\n if (this.chunkQueue.length > this._resourceLimits.maxChunkQueue) {\n violations.push('chunk_queue');\n }\n \n // Check packet buffer\n if (this.packetBuffer && this.packetBuffer.size > this._resourceLimits.maxPacketBuffer) {\n violations.push('packet_buffer');\n }\n \n // If violations detected, trigger emergency cleanup\n if (violations.length > 0) {\n this._secureLog('warn', '\u26A0\uFE0F Resource limit violations detected', { violations });\n this._emergencyCleanup();\n }\n }\n\n /**\n * Emergency cleanup when resource limits are exceeded\n */\n _emergencyCleanup() {\n this._secureLog('warn', '\uD83D\uDEA8 EMERGENCY: Resource limits exceeded, performing emergency cleanup');\n \n try {\n // 1. Clear all logs immediately\n this._logCounts.clear();\n this._secureLog('info', '\uD83E\uDDF9 Emergency: All logs cleared');\n \n // 2. Clear message queue\n this.messageQueue.length = 0;\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Message queue cleared');\n \n // 3. Enhanced IV history cleanup\n if (this._ivTrackingSystem) {\n this._ivTrackingSystem.usedIVs.clear();\n this._ivTrackingSystem.ivHistory.clear();\n this._ivTrackingSystem.sessionIVs.clear();\n this._ivTrackingSystem.collisionCount = 0;\n this._ivTrackingSystem.emergencyMode = false;\n this._secureLog('info', '\uD83E\uDDF9 Enhanced Emergency: IV tracking system cleared');\n }\n \n // 4. Clear processed message IDs\n this.processedMessageIds.clear();\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Processed message IDs cleared');\n \n // 5. Enhanced decoy channels cleanup\n if (this.decoyChannels) {\n for (const [channelName, timer] of this.decoyTimers) {\n if (timer) clearTimeout(timer);\n }\n this.decoyChannels.clear();\n this.decoyTimers.clear();\n this._secureLog('info', '\uD83E\uDDF9 Enhanced Emergency: Decoy channels cleared');\n }\n \n // 6. Enhanced fake traffic cleanup\n if (this.fakeTrafficTimer) {\n clearTimeout(this.fakeTrafficTimer);\n this.fakeTrafficTimer = null;\n }\n if (this._fakeTrafficMessages) {\n this._fakeTrafficMessages.length = 0;\n this._secureLog('info', '\uD83E\uDDF9 Enhanced Emergency: Fake traffic messages cleared');\n }\n \n // 7. Clear chunk queue\n this.chunkQueue.length = 0;\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Chunk queue cleared');\n \n // 8. Clear packet buffer\n if (this.packetBuffer) {\n this.packetBuffer.clear();\n this._secureLog('info', '\uD83E\uDDF9 Emergency: Packet buffer cleared');\n }\n \n // 9. Enhanced memory cleanup with quantum-resistant patterns\n this._secureMemoryManager.isCleaning = true;\n this._secureMemoryManager.cleanupQueue.length = 0;\n this._secureMemoryManager.memoryStats.lastCleanup = Date.now();\n \n // Force multiple garbage collection cycles\n if (typeof window.gc === 'function') {\n try {\n // Multiple GC cycles for thorough cleanup\n for (let i = 0; i < 3; i++) {\n window.gc();\n this._secureLog('info', `\uD83E\uDDF9 Enhanced Emergency: Garbage collection cycle ${i + 1}/3`);\n // Small delay between cycles\n if (i < 2) {\n const start = Date.now();\n while (Date.now() - start < 10) {\n // Busy wait for 10ms\n }\n }\n }\n } catch (e) {\n // Ignore GC errors\n }\n }\n \n this._secureMemoryManager.isCleaning = false;\n \n this._secureLog('info', '\u2705 Enhanced emergency cleanup completed successfully');\n \n } catch (error) {\n this._secureLog('error', '\u274C Enhanced emergency cleanup failed', {\n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n \n // Rollback mechanism (simplified)\n this._secureMemoryManager.isCleaning = false;\n }\n }\n\n /**\n * Validate emergency cleanup success\n * @param {Object} originalState - Original state before cleanup\n * @returns {Object} Validation results\n */\n _validateEmergencyCleanup(originalState) {\n const currentState = {\n messageQueueSize: this.messageQueue.length,\n processedIdsSize: this.processedMessageIds.size,\n packetBufferSize: this.packetBuffer ? this.packetBuffer.size : 0,\n ivTrackingSize: this._ivTrackingSystem ? this._ivTrackingSystem.usedIVs.size : 0,\n decoyChannelsSize: this.decoyChannels ? this.decoyChannels.size : 0\n };\n \n const validation = {\n messageQueueCleared: currentState.messageQueueSize === 0,\n processedIdsCleared: currentState.processedIdsSize === 0,\n packetBufferCleared: currentState.packetBufferSize === 0,\n ivTrackingCleared: currentState.ivTrackingSize === 0,\n decoyChannelsCleared: currentState.decoyChannelsSize === 0,\n allCleared: (\n currentState.messageQueueSize === 0 &&\n currentState.processedIdsSize === 0 &&\n currentState.packetBufferSize === 0 &&\n currentState.ivTrackingSize === 0 &&\n currentState.decoyChannelsSize === 0\n )\n };\n \n return validation;\n }\n\n /**\n * Cleanup resources based on age and usage\n */\n _cleanupResources() {\n const now = Date.now();\n \n // Clean old processed message IDs (keep only last hour)\n if (this.processedMessageIds.size > this._emergencyThresholds.processedMessageIds) {\n this.processedMessageIds.clear();\n this._secureLog('info', '\uD83E\uDDF9 Old processed message IDs cleared');\n }\n \n // Clean old IVs\n if (this._ivTrackingSystem) {\n this._cleanupOldIVs();\n }\n \n // Clean old keys\n this.cleanupOldKeys();\n \n // Clean rate limiter\n if (window.EnhancedSecureCryptoUtils && window.EnhancedSecureCryptoUtils.rateLimiter) {\n window.EnhancedSecureCryptoUtils.rateLimiter.cleanup();\n }\n \n this._secureLog('info', '\uD83E\uDDF9 Resource cleanup completed');\n }\n\n /**\n * Monitor key security (replaces _startKeySecurityMonitoring)\n */\n _monitorKeySecurity() {\n if (this._keyStorageStats.activeKeys > 10) {\n this._secureLog('warn', '\u26A0\uFE0F High number of active keys detected. Consider rotation.');\n }\n \n if (Date.now() - (this._keyStorageStats.lastRotation || 0) > 3600000) {\n this._rotateKeys();\n }\n }\n\n /**\n * Send heartbeat message (called by unified scheduler)\n */\n _sendHeartbeat() {\n try {\n if (this.isConnected() && this.dataChannel && this.dataChannel.readyState === 'open') {\n this.dataChannel.send(JSON.stringify({ \n type: EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT, \n timestamp: Date.now() \n }));\n \n this._heartbeatConfig.lastHeartbeat = Date.now();\n this._secureLog('debug', '\uD83D\uDC93 Heartbeat sent');\n }\n } catch (error) {\n this._secureLog('error', '\u274C Heartbeat failed:', { \n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n }\n }\n\n /**\n * Comprehensive input validation to prevent DoS and injection attacks\n * @param {any} data - Data to validate\n * @param {string} context - Context for validation (e.g., 'sendMessage', 'sendSecureMessage')\n * @returns {Object} Validation result with isValid and sanitizedData\n */\n _validateInputData(data, context = 'unknown') {\n const validationResult = {\n isValid: false,\n sanitizedData: null,\n errors: [],\n warnings: []\n };\n\n try {\n // 1. Basic type validation\n if (data === null || data === undefined) {\n validationResult.errors.push('Data cannot be null or undefined');\n return validationResult;\n }\n\n // 2. Size validation for strings\n if (typeof data === 'string') {\n if (data.length > this._inputValidationLimits.maxStringLength) {\n validationResult.errors.push(`String too long: ${data.length} > ${this._inputValidationLimits.maxStringLength}`);\n return validationResult;\n }\n\n // 3. Malicious pattern detection for strings\n for (const pattern of this._maliciousPatterns) {\n if (pattern.test(data)) {\n validationResult.errors.push(`Malicious pattern detected: ${pattern.source}`);\n this._secureLog('warn', '\uD83D\uDEA8 Malicious pattern detected in input', {\n context: context,\n pattern: pattern.source,\n dataLength: data.length\n });\n return validationResult;\n }\n }\n\n // 4. Sanitize string data\n validationResult.sanitizedData = this._sanitizeInputString(data);\n validationResult.isValid = true;\n return validationResult;\n }\n\n // 5. Object validation\n if (typeof data === 'object') {\n // Check for circular references\n const seen = new WeakSet();\n const checkCircular = (obj, path = '') => {\n if (obj === null || typeof obj !== 'object') return;\n \n if (seen.has(obj)) {\n validationResult.errors.push(`Circular reference detected at path: ${path}`);\n return;\n }\n \n seen.add(obj);\n \n // Check object depth\n if (path.split('.').length > this._inputValidationLimits.maxObjectDepth) {\n validationResult.errors.push(`Object too deep: ${path.split('.').length} > ${this._inputValidationLimits.maxObjectDepth}`);\n return;\n }\n\n // Check array length\n if (Array.isArray(obj) && obj.length > this._inputValidationLimits.maxArrayLength) {\n validationResult.errors.push(`Array too long: ${obj.length} > ${this._inputValidationLimits.maxArrayLength}`);\n return;\n }\n\n // Recursively check all properties\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n checkCircular(obj[key], path ? `${path}.${key}` : key);\n }\n }\n };\n\n checkCircular(data);\n \n if (validationResult.errors.length > 0) {\n return validationResult;\n }\n\n // 6. Check total object size\n const objectSize = this._calculateObjectSize(data);\n if (objectSize > this._inputValidationLimits.maxMessageSize) {\n validationResult.errors.push(`Object too large: ${objectSize} bytes > ${this._inputValidationLimits.maxMessageSize} bytes`);\n return validationResult;\n }\n\n // 7. Sanitize object data\n validationResult.sanitizedData = this._sanitizeInputObject(data);\n validationResult.isValid = true;\n return validationResult;\n }\n\n // 8. ArrayBuffer validation\n if (data instanceof ArrayBuffer) {\n if (data.byteLength > this._inputValidationLimits.maxMessageSize) {\n validationResult.errors.push(`ArrayBuffer too large: ${data.byteLength} bytes > ${this._inputValidationLimits.maxMessageSize} bytes`);\n return validationResult;\n }\n \n validationResult.sanitizedData = data;\n validationResult.isValid = true;\n return validationResult;\n }\n\n // 9. Other types are not allowed\n validationResult.errors.push(`Unsupported data type: ${typeof data}`);\n return validationResult;\n\n } catch (error) {\n validationResult.errors.push(`Validation error: ${error.message}`);\n this._secureLog('error', '\u274C Input validation failed', {\n context: context,\n errorType: error?.constructor?.name || 'Unknown',\n message: error?.message || 'Unknown error'\n });\n return validationResult;\n }\n }\n\n /**\n * Calculate approximate object size in bytes\n * @param {any} obj - Object to calculate size for\n * @returns {number} Size in bytes\n */\n _calculateObjectSize(obj) {\n try {\n const jsonString = JSON.stringify(obj);\n return new TextEncoder().encode(jsonString).length;\n } catch (error) {\n // If JSON.stringify fails, estimate size\n return 1024 * 1024; // Assume 1MB to be safe\n }\n }\n\n /**\n * Sanitize string data for input validation\n * @param {string} str - String to sanitize\n * @returns {string} Sanitized string\n */\n _sanitizeInputString(str) {\n if (typeof str !== 'string') return str;\n \n // Remove null bytes\n str = str.replace(/\\0/g, '');\n \n // Normalize whitespace\n str = str.replace(/\\s+/g, ' ');\n \n // Trim\n str = str.trim();\n \n return str;\n }\n\n /**\n * Sanitize object data for input validation\n * @param {any} obj - Object to sanitize\n * @returns {any} Sanitized object\n */\n _sanitizeInputObject(obj) {\n if (obj === null || typeof obj !== 'object') return obj;\n \n if (Array.isArray(obj)) {\n return obj.map(item => this._sanitizeInputObject(item));\n }\n \n const sanitized = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n const value = obj[key];\n if (typeof value === 'string') {\n sanitized[key] = this._sanitizeInputString(value);\n } else if (typeof value === 'object') {\n sanitized[key] = this._sanitizeInputObject(value);\n } else {\n sanitized[key] = value;\n }\n }\n }\n \n return sanitized;\n }\n\n /**\n * Rate limiting for message sending\n * @param {string} context - Context for rate limiting\n * @returns {boolean} true if rate limit allows\n */\n _checkRateLimit(context = 'message') {\n const now = Date.now();\n \n // Initialize rate limiter if not exists\n if (!this._rateLimiter) {\n this._rateLimiter = {\n messageCount: 0,\n lastReset: now,\n burstCount: 0,\n lastBurstReset: now\n };\n }\n \n // Reset counters if needed\n if (now - this._rateLimiter.lastReset > 60000) { // 1 minute\n this._rateLimiter.messageCount = 0;\n this._rateLimiter.lastReset = now;\n }\n \n if (now - this._rateLimiter.lastBurstReset > 1000) { // 1 second\n this._rateLimiter.burstCount = 0;\n this._rateLimiter.lastBurstReset = now;\n }\n \n // Check burst limit\n if (this._rateLimiter.burstCount >= this._inputValidationLimits.rateLimitBurstSize) {\n this._secureLog('warn', '\u26A0\uFE0F Rate limit burst exceeded', { context });\n return false;\n }\n \n // Check overall rate limit\n if (this._rateLimiter.messageCount >= this._inputValidationLimits.rateLimitMessagesPerMinute) {\n this._secureLog('warn', '\u26A0\uFE0F Rate limit exceeded', { context });\n return false;\n }\n \n // Increment counters\n this._rateLimiter.messageCount++;\n this._rateLimiter.burstCount++;\n \n return true;\n }\n\n // ============================================\n // SECURE KEY STORAGE MANAGEMENT\n // ============================================\n\n /**\n * Initializes the secure key storage\n */\n _initializeSecureKeyStorage() {\n // Initialize with the new class\n this._secureKeyStorage = new SecureKeyStorage();\n \n // Keep the stats structure for compatibility\n this._keyStorageStats = {\n totalKeys: 0,\n activeKeys: 0,\n lastAccess: null,\n lastRotation: null,\n };\n \n this._secureLog('info', '\uD83D\uDD10 Enhanced secure key storage initialized');\n }\n\n // Helper: ensure file transfer system is ready (lazy init on receiver)\n async _ensureFileTransferReady() {\n try {\n // If already initialized \u2014 done\n if (this.fileTransferSystem) {\n return true;\n }\n // Requires an open data channel and a verified connection\n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n throw new Error('Data channel not open');\n }\n if (!this.isVerified) {\n throw new Error('Connection not verified');\n }\n // Initialization\n this.initializeFileTransfer();\n \n // \u041A\u0420\u0418\u0422\u0418\u0427\u0415\u0421\u041A\u041E\u0415 \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u0416\u0434\u0435\u043C \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0442\u0430\u0439\u043C\u0430\u0443\u0442\u043E\u043C\n let attempts = 0;\n const maxAttempts = 50; // 5 \u0441\u0435\u043A\u0443\u043D\u0434 \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C\n while (!this.fileTransferSystem && attempts < maxAttempts) {\n await new Promise(r => setTimeout(r, 100));\n attempts++;\n }\n \n if (!this.fileTransferSystem) {\n throw new Error('File transfer system initialization timeout');\n }\n \n return true;\n } catch (e) {\n this._secureLog('error', '\u274C _ensureFileTransferReady failed', { \n errorType: e?.constructor?.name || 'Unknown',\n hasMessage: !!e?.message \n });\n return false;\n }\n }\n\n _getSecureKey(keyId) {\n return this._secureKeyStorage.retrieveKey(keyId);\n }\n\n async _setSecureKey(keyId, key) {\n if (!(key instanceof CryptoKey)) {\n this._secureLog('error', '\u274C Attempt to store non-CryptoKey');\n return false;\n }\n \n const success = await this._secureKeyStorage.storeKey(keyId, key, {\n version: this.currentKeyVersion,\n type: key.algorithm.name\n });\n \n if (success) {\n this._secureLog('info', `\uD83D\uDD11 Key ${keyId} stored securely with encryption`);\n }\n \n return success;\n }\n\n /**\n * Validates a key value\n * @param {CryptoKey} key - Key to validate\n * @returns {boolean} true if the key is valid\n */\n _validateKeyValue(key) {\n return key instanceof CryptoKey &&\n key.algorithm &&\n key.usages &&\n key.usages.length > 0;\n }\n\n _secureWipeKeys() {\n this._secureKeyStorage.secureWipeAll();\n this._secureLog('info', '\uD83E\uDDF9 All keys securely wiped and encrypted storage cleared');\n }\n\n /**\n * Validates key storage state\n * @returns {boolean} true if the storage is ready\n */\n _validateKeyStorage() {\n return this._secureKeyStorage instanceof SecureKeyStorage;\n }\n\n /**\n * Returns secure key storage statistics\n * @returns {object} Storage metrics\n */\n _getKeyStorageStats() {\n const stats = this._secureKeyStorage.getStorageStats();\n return {\n totalKeysCount: stats.totalKeys,\n activeKeysCount: stats.totalKeys,\n hasLastAccess: stats.metadata.some(m => m.lastAccessed),\n hasLastRotation: !!this._keyStorageStats.lastRotation,\n storageType: 'SecureKeyStorage',\n timestamp: Date.now()\n };\n }\n\n /**\n * Performs key rotation in storage\n */\n _rotateKeys() {\n const oldKeys = Array.from(this._secureKeyStorage.keys());\n this._secureKeyStorage.clear();\n this._keyStorageStats.lastRotation = Date.now();\n this._keyStorageStats.activeKeys = 0;\n this._secureLog('info', `\uD83D\uDD04 Key rotation completed. ${oldKeys.length} keys rotated`);\n }\n\n /**\n * Emergency key wipe (e.g., upon detecting a threat)\n */\n _emergencyKeyWipe() {\n this._secureWipeKeys();\n this._secureLog('error', '\uD83D\uDEA8 EMERGENCY: All keys wiped due to security threat');\n }\n\n /**\n * Starts key security monitoring\n * @deprecated Use unified scheduler instead\n */\n _startKeySecurityMonitoring() {\n // Functionality moved to unified scheduler\n this._secureLog('info', '\uD83D\uDD27 Key security monitoring moved to unified scheduler');\n }\n\n\n // ============================================\n // HELPER METHODS\n // ============================================\n /**\n * Constant-time key validation to prevent timing attacks\n * @param {CryptoKey} key - Key to validate\n * @returns {boolean} true if key is valid\n */\n _validateKeyConstantTime(key) {\n // Constant-time validation to prevent timing attacks\n let isValid = 0;\n \n // Check if key is CryptoKey instance (constant-time)\n try {\n const isCryptoKey = key instanceof CryptoKey;\n isValid += isCryptoKey ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // Check algorithm (constant-time)\n try {\n const hasAlgorithm = !!(key && key.algorithm);\n isValid += hasAlgorithm ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // Check type (constant-time)\n try {\n const hasType = !!(key && key.type);\n isValid += hasType ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // Check extractable property (constant-time)\n try {\n const hasExtractable = key && key.extractable !== undefined;\n isValid += hasExtractable ? 1 : 0;\n } catch {\n isValid += 0;\n }\n \n // All checks must pass\n return isValid === 4;\n }\n\n /**\n * Constant-time key pair validation\n * @param {Object} keyPair - Key pair to validate\n * @returns {boolean} true if key pair is valid\n */\n _validateKeyPairConstantTime(keyPair) {\n if (!keyPair || typeof keyPair !== 'object') return false;\n \n const privateKeyValid = this._validateKeyConstantTime(keyPair.privateKey);\n const publicKeyValid = this._validateKeyConstantTime(keyPair.publicKey);\n \n // Constant-time AND operation\n return privateKeyValid && publicKeyValid;\n }\n\n /**\n * Enhanced secure logging system initialization\n */\n _initializeSecureLogging() {\n // Logging levels\n this._logLevels = {\n error: 0,\n warn: 1, \n info: 2,\n debug: 3,\n trace: 4\n };\n \n // Ultra-strict levels for production\n this._currentLogLevel = this._isProductionMode ? \n this._logLevels.error : // In production, ONLY critical errors\n this._logLevels.info; // In development, up to info\n \n // Reduced log limits to prevent data accumulation\n this._logCounts = new Map();\n this._maxLogCount = this._isProductionMode ? 5 : 50; // Reduced limits\n \n // Hard resource limits to prevent memory leaks\n this._resourceLimits = {\n maxLogEntries: this._isProductionMode ? 100 : 1000,\n maxMessageQueue: 1000,\n maxIVHistory: 10000,\n maxProcessedMessageIds: 5000,\n maxDecoyChannels: 100,\n maxFakeTrafficMessages: 500,\n maxChunkQueue: 200,\n maxPacketBuffer: 1000\n };\n \n // Emergency cleanup thresholds\n this._emergencyThresholds = {\n logEntries: this._resourceLimits.maxLogEntries * 0.8, // 80%\n messageQueue: this._resourceLimits.maxMessageQueue * 0.8,\n ivHistory: this._resourceLimits.maxIVHistory * 0.8,\n processedMessageIds: this._resourceLimits.maxProcessedMessageIds * 0.8\n };\n \n // Input validation limits to prevent DoS attacks\n this._inputValidationLimits = {\n maxStringLength: 100000, // 100KB for strings\n maxObjectDepth: 10, // Maximum object nesting depth\n maxArrayLength: 1000, // Maximum array length\n maxMessageSize: 1024 * 1024, // 1MB total message size\n maxConcurrentMessages: 10, // Maximum concurrent message processing\n rateLimitMessagesPerMinute: 60, // Rate limiting\n rateLimitBurstSize: 10 // Burst size for rate limiting\n };\n \n // Malicious pattern detection\n this._maliciousPatterns = [\n /)<[^<]*)*<\\/script>/gi, // Script tags\n /javascript:/gi, // JavaScript protocol\n /data:text\\/html/gi, // Data URLs with HTML\n /on\\w+\\s*=/gi, // Event handlers\n /eval\\s*\\(/gi, // eval() calls\n /document\\./gi, // Document object access\n /window\\./gi, // Window object access\n /localStorage/gi, // LocalStorage access\n /sessionStorage/gi, // SessionStorage access\n /fetch\\s*\\(/gi, // Fetch API calls\n /XMLHttpRequest/gi, // XHR calls\n /import\\s*\\(/gi, // Dynamic imports\n /require\\s*\\(/gi, // Require calls\n /process\\./gi, // Process object access\n /global/gi, // Global object access\n /__proto__/gi, // Prototype pollution\n /constructor/gi, // Constructor access\n /prototype/gi, // Prototype access\n /toString\\s*\\(/gi, // toString calls\n /valueOf\\s*\\(/gi // valueOf calls\n ];\n\n // Comprehensive blacklist with all sensitive patterns\n this._absoluteBlacklist = new Set([\n // Cryptographic keys\n 'encryptionKey', 'macKey', 'metadataKey', 'privateKey', 'publicKey',\n 'ecdhKeyPair', 'ecdsaKeyPair', 'peerPublicKey', 'nestedEncryptionKey',\n \n // Authentication and session data\n 'verificationCode', 'sessionSalt', 'keyFingerprint', 'sessionId',\n 'authChallenge', 'authProof', 'authToken', 'sessionToken',\n \n // Credentials and secrets\n 'password', 'token', 'secret', 'credential', 'signature',\n 'apiKey', 'accessKey', 'secretKey', 'privateKey',\n \n // Cryptographic materials\n 'hash', 'digest', 'nonce', 'iv', 'cipher', 'seed',\n 'entropy', 'random', 'salt', 'fingerprint',\n \n // JWT and session data\n 'jwt', 'bearer', 'refreshToken', 'accessToken',\n \n // File transfer sensitive data\n 'fileHash', 'fileSignature', 'transferKey', 'chunkKey'\n ]);\n\n // Minimal whitelist with strict validation\n this._safeFieldsWhitelist = new Set([\n // Basic status fields\n 'timestamp', 'type', 'status', 'state', 'level',\n 'isConnected', 'isVerified', 'isInitiator', 'version',\n \n // Counters and metrics (safe)\n 'count', 'total', 'active', 'inactive', 'success', 'failure',\n \n // Connection states (safe)\n 'readyState', 'connectionState', 'iceConnectionState',\n \n // Feature counts (safe)\n 'activeFeaturesCount', 'totalFeatures', 'stage',\n \n // Error types (safe)\n 'errorType', 'errorCode', 'phase', 'attempt'\n ]);\n \n // Initialize security monitoring\n this._initializeLogSecurityMonitoring();\n \n this._secureLog('info', `\uD83D\uDD27 Enhanced secure logging initialized (Production: ${this._isProductionMode})`);\n }\n\n /**\n * Initialize security monitoring for logging system\n */\n _initializeLogSecurityMonitoring() {\n // Security monitoring moved to unified scheduler\n this._logSecurityViolations = 0;\n this._maxLogSecurityViolations = 3;\n }\n\n /**\n * Audit logging system security\n */\n _auditLoggingSystemSecurity() {\n let violations = 0;\n \n // Check for excessive log counts (potential data leakage)\n for (const [key, count] of this._logCounts.entries()) {\n if (count > this._maxLogCount * 2) {\n violations++;\n this._originalConsole?.error?.(`\uD83D\uDEA8 LOG SECURITY: Excessive log count detected: ${key}`);\n }\n }\n \n // Check for blacklisted patterns in recent logs\n const recentLogs = Array.from(this._logCounts.keys());\n for (const logKey of recentLogs) {\n if (this._containsSensitiveContent(logKey)) {\n violations++;\n this._originalConsole?.error?.(`\uD83D\uDEA8 LOG SECURITY: Sensitive content in log key: ${logKey}`);\n }\n }\n \n // Emergency shutdown if too many violations\n this._logSecurityViolations += violations;\n if (this._logSecurityViolations >= this._maxLogSecurityViolations) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.('\uD83D\uDEA8 CRITICAL: Logging system disabled due to security violations');\n }\n }\n\n _secureLogShim(...args) {\n try {\n // Validate arguments array\n if (!Array.isArray(args) || args.length === 0) {\n return;\n }\n \n // Proper destructuring with fallback\n const message = args[0];\n const restArgs = args.slice(1);\n \n // Handle different argument patterns\n if (restArgs.length === 0) {\n this._secureLog('info', String(message || ''));\n return;\n }\n \n if (restArgs.length === 1) {\n this._secureLog('info', String(message || ''), restArgs[0]);\n return;\n }\n \n // Proper object structure for multiple args\n this._secureLog('info', String(message || ''), { \n additionalArgs: restArgs,\n argCount: restArgs.length \n });\n } catch (error) {\n // Better error handling - fallback to original console if available\n try {\n if (this._originalConsole?.log) {\n this._originalConsole.log(...args);\n }\n } catch (fallbackError) {\n // Silent failure to prevent execution disruption\n }\n }\n }\n\n /**\n * Setup own logger without touching global console\n */\n _setupOwnLogger() {\n // Create own logger without touching global console\n this.logger = {\n log: (message, data) => this._secureLog('info', message, data),\n info: (message, data) => this._secureLog('info', message, data),\n warn: (message, data) => this._secureLog('warn', message, data),\n error: (message, data) => this._secureLog('error', message, data),\n debug: (message, data) => this._secureLog('debug', message, data)\n };\n \n // In development, log to console; in production, use secure logging only\n if (EnhancedSecureWebRTCManager.DEBUG_MODE) {\n this._secureLog('info', '\uD83D\uDD12 Own logger created - development mode');\n } else {\n this._secureLog('info', '\uD83D\uDD12 Own logger created - production mode');\n }\n }\n /**\n * Production logging - use own logger with minimal output\n */\n _setupProductionLogging() {\n // In production, own logger becomes minimal\n if (this._isProductionMode) {\n this.logger = {\n log: () => {}, // No-op in production\n info: () => {}, // No-op in production\n warn: (message, data) => this._secureLog('warn', message, data),\n error: (message, data) => this._secureLog('error', message, data),\n debug: () => {} // No-op in production\n };\n \n this._secureLog('info', '\uD83D\uDD12 Production logging mode activated');\n }\n }\n /**\n * Secure logging with enhanced data protection\n * @param {string} level - Log level (error, warn, info, debug, trace)\n * @param {string} message - Message\n * @param {object} data - Optional payload (will be sanitized)\n */\n _secureLog(level, message, data = null) {\n // Pre-sanitization audit to prevent data leakage\n if (data && !this._auditLogMessage(message, data)) {\n // Log the attempt but block the actual data\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY: Logging blocked due to potential data leakage');\n return;\n }\n \n // Check log level\n if (this._logLevels[level] > this._currentLogLevel) {\n return;\n }\n \n // Prevent log spam with better key generation\n const logKey = `${level}:${message.substring(0, 50)}`;\n const currentCount = this._logCounts.get(logKey) || 0;\n \n if (currentCount >= this._maxLogCount) {\n return;\n }\n \n this._logCounts.set(logKey, currentCount + 1);\n \n // Enhanced sanitization with multiple passes\n let sanitizedData = null;\n if (data) {\n // First pass: basic sanitization\n sanitizedData = this._sanitizeLogData(data);\n \n // Second pass: check if sanitized data still contains sensitive content\n if (this._containsSensitiveContent(JSON.stringify(sanitizedData))) {\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY: Sanitized data still contains sensitive content - blocking log');\n return;\n }\n }\n \n // Production mode security - only log essential errors\n if (this._isProductionMode) {\n if (level === 'error') {\n // In production, only log error messages without sensitive data\n const safeMessage = this._sanitizeString(message);\n this._originalConsole?.error?.(safeMessage);\n }\n // Block all other log levels in production\n return;\n }\n \n // Development mode: full logging with sanitized data\n const logMethod = this._originalConsole?.[level] || this._originalConsole?.log;\n if (sanitizedData) {\n logMethod(message, sanitizedData);\n } else {\n logMethod(message);\n }\n }\n /**\n * Enhanced sanitization for log data with multiple security layers\n */\n _sanitizeLogData(data) {\n // Pre-check for sensitive content before processing\n if (typeof data === 'string') {\n return this._sanitizeString(data);\n }\n \n if (!data || typeof data !== 'object') {\n return data;\n }\n \n const sanitized = {};\n \n for (const [key, value] of Object.entries(data)) {\n const lowerKey = key.toLowerCase();\n \n // Enhanced blacklist with more comprehensive patterns\n const blacklistPatterns = [\n 'key', 'secret', 'token', 'password', 'credential', 'auth',\n 'fingerprint', 'salt', 'signature', 'private', 'encryption',\n 'mac', 'metadata', 'session', 'jwt', 'bearer', 'hash',\n 'digest', 'nonce', 'iv', 'cipher', 'seed', 'entropy'\n ];\n \n const isBlacklisted = this._absoluteBlacklist.has(key) || \n blacklistPatterns.some(pattern => lowerKey.includes(pattern));\n \n if (isBlacklisted) {\n sanitized[key] = '[SENSITIVE_DATA_BLOCKED]';\n continue;\n }\n \n // Enhanced whitelist with strict validation\n if (this._safeFieldsWhitelist.has(key)) {\n // Even whitelisted fields get sanitized if they contain sensitive data\n if (typeof value === 'string') {\n sanitized[key] = this._sanitizeString(value);\n } else {\n sanitized[key] = value;\n }\n continue;\n }\n \n // Enhanced type handling with security checks\n if (typeof value === 'boolean' || typeof value === 'number') {\n sanitized[key] = value;\n } else if (typeof value === 'string') {\n sanitized[key] = this._sanitizeString(value);\n } else if (value instanceof ArrayBuffer || value instanceof Uint8Array) {\n // Don't reveal actual byte lengths for security\n sanitized[key] = `[${value.constructor.name}( bytes)]`;\n } else if (value && typeof value === 'object') {\n // Recursive sanitization with depth limit and security check\n try {\n sanitized[key] = this._sanitizeLogData(value);\n } catch (error) {\n sanitized[key] = '[RECURSIVE_SANITIZATION_FAILED]';\n }\n } else {\n sanitized[key] = `[${typeof value}]`;\n }\n }\n \n // Final security check on sanitized data\n const sanitizedString = JSON.stringify(sanitized);\n if (this._containsSensitiveContent(sanitizedString)) {\n return { error: 'SANITIZATION_FAILED_SENSITIVE_CONTENT_DETECTED' };\n }\n \n return sanitized;\n }\n /**\n * Enhanced sanitization for strings with comprehensive pattern detection\n */\n _sanitizeString(str) {\n if (typeof str !== 'string' || str.length === 0) {\n return str;\n }\n \n // Comprehensive sensitive pattern detection\n const sensitivePatterns = [\n // Hex patterns (various lengths)\n /[a-f0-9]{16,}/i, // 16+ hex chars (covers short keys)\n /[a-f0-9]{8,}/i, // 8+ hex chars (covers shorter keys)\n \n // Base64 patterns (comprehensive)\n /[A-Za-z0-9+/]{16,}={0,2}/, // Base64 with padding\n /[A-Za-z0-9+/]{12,}/, // Base64 without padding\n /[A-Za-z0-9+/=]{10,}/, // Base64-like patterns\n \n // Base58 patterns (Bitcoin-style)\n /[1-9A-HJ-NP-Za-km-z]{16,}/, // Base58 strings\n \n // Base32 patterns\n /[A-Z2-7]{16,}={0,6}/, // Base32 with padding\n /[A-Z2-7]{12,}/, // Base32 without padding\n \n // Custom encoding patterns\n /[A-Za-z0-9\\-_]{16,}/, // URL-safe base64 variants\n /[A-Za-z0-9\\.\\-_]{16,}/, // JWT-like patterns\n \n // Long alphanumeric strings (potential keys)\n /\\b[A-Za-z0-9]{12,}\\b/, // 12+ alphanumeric chars\n /\\b[A-Za-z0-9]{8,}\\b/, // 8+ alphanumeric chars\n \n // PEM key patterns\n /BEGIN\\s+(PRIVATE|PUBLIC|RSA|DSA|EC)\\s+KEY/i,\n /END\\s+(PRIVATE|PUBLIC|RSA|DSA|EC)\\s+KEY/i,\n \n // JWT patterns\n /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n \n // API key patterns\n /(api[_-]?key|token|secret|password|credential)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n \n // UUID patterns\n /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,\n \n // Credit cards and SSN (existing patterns)\n /\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b/,\n /\\b\\d{3}-\\d{2}-\\d{4}\\b/,\n \n // Email patterns (more restrictive)\n /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/,\n \n // Crypto-specific patterns\n /(fingerprint|hash|digest|signature)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n /(encryption|mac|metadata)[\\s]*key[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n \n // Session and auth patterns\n /(session|auth|jwt|bearer)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n ];\n \n // Check for sensitive patterns with early return\n for (const pattern of sensitivePatterns) {\n if (pattern.test(str)) {\n // Always fully hide sensitive data\n return '[SENSITIVE_DATA_REDACTED]';\n }\n }\n \n // Check for suspicious entropy (high randomness indicates keys)\n if (this._hasHighEntropy(str)) {\n return '[HIGH_ENTROPY_DATA_REDACTED]';\n }\n \n // Check for suspicious character distributions\n if (this._hasSuspiciousDistribution(str)) {\n return '[SUSPICIOUS_DATA_REDACTED]';\n }\n \n // For regular strings \u2014 limit length more aggressively\n if (str.length > 50) {\n return str.substring(0, 20) + '...[TRUNCATED]';\n }\n \n return str;\n }\n /**\n * Enhanced sensitive content detection\n */\n _containsSensitiveContent(str) {\n if (typeof str !== 'string') return false;\n \n // Use the same comprehensive patterns as _sanitizeString\n const sensitivePatterns = [\n /[a-f0-9]{16,}/i,\n /[A-Za-z0-9+/]{16,}={0,2}/,\n /[1-9A-HJ-NP-Za-km-z]{16,}/,\n /[A-Z2-7]{16,}={0,6}/,\n /\\b[A-Za-z0-9]{12,}\\b/,\n /BEGIN\\s+(PRIVATE|PUBLIC|RSA|DSA|EC)\\s+KEY/i,\n /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n /(api[_-]?key|token|secret|password|credential)[\\s]*[:=][\\s]*[A-Za-z0-9\\-_]{8,}/i,\n ];\n \n return sensitivePatterns.some(pattern => pattern.test(str)) ||\n this._hasHighEntropy(str) ||\n this._hasSuspiciousDistribution(str);\n }\n\n /**\n * Check for high entropy strings (likely cryptographic keys)\n */\n _hasHighEntropy(str) {\n if (str.length < 8) return false;\n \n // Calculate character frequency\n const charCount = {};\n for (const char of str) {\n charCount[char] = (charCount[char] || 0) + 1;\n }\n \n // Calculate Shannon entropy\n const length = str.length;\n let entropy = 0;\n \n for (const count of Object.values(charCount)) {\n const probability = count / length;\n entropy -= probability * Math.log2(probability);\n }\n \n // High entropy (>4.5 bits per character) suggests cryptographic data\n return entropy > 4.5;\n }\n\n /**\n * Check for suspicious character distributions\n */\n _hasSuspiciousDistribution(str) {\n if (str.length < 8) return false;\n \n // Check for uniform distribution of hex characters\n const hexChars = str.match(/[a-f0-9]/gi) || [];\n if (hexChars.length >= str.length * 0.8) {\n // If 80%+ are hex chars, likely a key\n return true;\n }\n \n // Check for base64-like distribution\n const base64Chars = str.match(/[A-Za-z0-9+/=]/g) || [];\n if (base64Chars.length >= str.length * 0.9) {\n // If 90%+ are base64 chars, likely encoded data\n return true;\n }\n \n // Check for very low character diversity (suggests random data)\n const uniqueChars = new Set(str).size;\n const diversityRatio = uniqueChars / str.length;\n \n // If diversity is too high (>0.8) for the length, likely random data\n if (diversityRatio > 0.8 && str.length > 16) {\n return true;\n }\n \n return false;\n }\n\n\n // ============================================\n // SECURE LOGGING SYSTEM\n // ============================================\n \n /**\n * Detects production mode\n */\n _detectProductionMode() {\n // Check various production mode indicators\n return (\n // Standard env variables\n (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') ||\n // No debug flags\n (!this._debugMode) ||\n // Production domains\n (window.location.hostname && !window.location.hostname.includes('localhost') && \n !window.location.hostname.includes('127.0.0.1') && \n !window.location.hostname.includes('.local')) ||\n // Minified code (heuristic check)\n (typeof window.webpackHotUpdate === 'undefined' && !window.location.search.includes('debug'))\n );\n }\n // ============================================\n // FIXED SECURE GLOBAL API\n // ============================================\n \n /**\n * Sets up a secure global API with limited access\n */\n _setupSecureGlobalAPI() {\n // Log that we're starting API setup\n this._secureLog('info', '\uD83D\uDD12 Starting secure global API setup');\n \n // Create simple public API with safety checks\n const secureAPI = {};\n \n // Only bind methods that exist\n if (typeof this.sendMessage === 'function') {\n secureAPI.sendMessage = this.sendMessage.bind(this);\n }\n \n // Create simple getConnectionStatus method\n secureAPI.getConnectionStatus = () => ({\n isConnected: this.isConnected ? this.isConnected() : false,\n isVerified: this.isVerified || false,\n connectionState: this.peerConnection?.connectionState || 'disconnected'\n });\n \n // Create simple getSecurityStatus method\n secureAPI.getSecurityStatus = () => ({\n securityLevel: this.currentSecurityLevel || 'basic',\n stage: 'initialized',\n activeFeaturesCount: Object.values(this.securityFeatures || {}).filter(Boolean).length\n });\n \n if (typeof this.sendFile === 'function') {\n secureAPI.sendFile = this.sendFile.bind(this);\n }\n \n // Create simple getFileTransferStatus method\n secureAPI.getFileTransferStatus = () => ({\n initialized: !!this.fileTransferSystem,\n status: 'ready',\n activeTransfers: 0,\n receivingTransfers: 0\n });\n \n if (typeof this.disconnect === 'function') {\n secureAPI.disconnect = this.disconnect.bind(this);\n }\n \n // Create simple API object with safety checks\n const safeGlobalAPI = {\n ...secureAPI, // Spread only existing methods\n getConfiguration: () => ({\n fakeTraffic: this._config.fakeTraffic.enabled,\n decoyChannels: this._config.decoyChannels.enabled,\n packetPadding: this._config.packetPadding.enabled,\n antiFingerprinting: this._config.antiFingerprinting.enabled\n }),\n emergency: {}\n };\n \n // Only add emergency methods that exist\n if (typeof this._emergencyUnlockAllMutexes === 'function') {\n safeGlobalAPI.emergency.unlockAllMutexes = this._emergencyUnlockAllMutexes.bind(this);\n }\n \n if (typeof this._emergencyRecoverMutexSystem === 'function') {\n safeGlobalAPI.emergency.recoverMutexSystem = this._emergencyRecoverMutexSystem.bind(this);\n }\n \n if (typeof this._emergencyDisableLogging === 'function') {\n safeGlobalAPI.emergency.disableLogging = this._emergencyDisableLogging.bind(this);\n }\n \n if (typeof this._resetLoggingSystem === 'function') {\n safeGlobalAPI.emergency.resetLogging = this._resetLoggingSystem.bind(this);\n }\n \n // Add file transfer system status\n safeGlobalAPI.getFileTransferSystemStatus = () => ({\n initialized: !!this.fileTransferSystem,\n status: 'ready',\n activeTransfers: 0,\n receivingTransfers: 0\n });\n \n // Log available methods for debugging\n this._secureLog('info', '\uD83D\uDD12 API methods available', {\n sendMessage: !!secureAPI.sendMessage,\n getConnectionStatus: !!secureAPI.getConnectionStatus,\n getSecurityStatus: !!secureAPI.getSecurityStatus,\n sendFile: !!secureAPI.sendFile,\n getFileTransferStatus: !!secureAPI.getFileTransferStatus,\n disconnect: !!secureAPI.disconnect,\n getConfiguration: !!safeGlobalAPI.getConfiguration,\n emergencyMethods: Object.keys(safeGlobalAPI.emergency).length\n });\n\n // Apply Object.freeze to prevent modification\n Object.freeze(safeGlobalAPI);\n Object.freeze(safeGlobalAPI.emergency);\n\n // Export API once without monitoring\n this._createProtectedGlobalAPI(safeGlobalAPI);\n \n // Setup minimal protection\n this._setupMinimalGlobalProtection();\n \n // Log that API setup is complete\n this._secureLog('info', '\uD83D\uDD12 Secure global API setup completed successfully');\n }\n /**\n * Create simple global API export\n */\n _createProtectedGlobalAPI(safeGlobalAPI) {\n // Log that we're creating protected global API\n this._secureLog('info', '\uD83D\uDD12 Creating protected global API');\n \n // Simple API export without proxy or monitoring\n if (!window.secureBitChat) {\n this._exportAPI(safeGlobalAPI);\n } else {\n this._secureLog('warn', '\u26A0\uFE0F Global API already exists, skipping setup');\n }\n }\n \n /**\n * Simple API export without monitoring\n */\n _exportAPI(apiObject) {\n // Log that we're exporting API\n this._secureLog('info', '\uD83D\uDD12 Exporting API to window.secureBitChat');\n \n // Check if important methods are available\n if (!this._importantMethods || !this._importantMethods.defineProperty) {\n this._secureLog('error', '\u274C Important methods not available for API export, using fallback');\n // Fallback to direct Object.defineProperty\n Object.defineProperty(window, 'secureBitChat', {\n value: apiObject,\n writable: false,\n configurable: false,\n enumerable: true\n });\n } else {\n // One-time export with immutable properties\n this._importantMethods.defineProperty(window, 'secureBitChat', {\n value: apiObject,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n \n this._secureLog('info', '\uD83D\uDD12 Secure API exported to window.secureBitChat');\n }\n \n /**\n * Setup minimal global protection\n */\n _setupMinimalGlobalProtection() {\n // Simple protection without monitoring (methods already stored)\n this._protectGlobalAPI();\n \n this._secureLog('info', '\uD83D\uDD12 Minimal global protection activated');\n }\n \n /**\n * Store important methods in closure for local use\n */\n _storeImportantMethods() {\n // Store references to important methods locally\n this._importantMethods = {\n defineProperty: Object.defineProperty,\n getOwnPropertyDescriptor: Object.getOwnPropertyDescriptor,\n freeze: Object.freeze,\n consoleLog: console.log,\n consoleError: console.error,\n consoleWarn: console.warn\n };\n \n this._secureLog('info', '\uD83D\uDD12 Important methods stored locally', {\n defineProperty: !!this._importantMethods.defineProperty,\n getOwnPropertyDescriptor: !!this._importantMethods.getOwnPropertyDescriptor,\n freeze: !!this._importantMethods.freeze\n });\n }\n\n /**\n * Simple protection without monitoring\n */\n _setupSimpleProtection() {\n this._secureLog('info', '\uD83D\uDD12 Simple protection activated - no monitoring');\n }\n\n /**\n * No global exposure prevention needed\n */\n _preventGlobalExposure() {\n this._secureLog('info', '\uD83D\uDD12 No global exposure prevention - using secure API export only');\n }\n /**\n * API integrity check - only at initialization\n */\n _verifyAPIIntegrity() {\n try {\n if (!window.secureBitChat) {\n this._secureLog('error', '\u274C SECURITY ALERT: Secure API has been removed!');\n return false;\n }\n \n const requiredMethods = ['sendMessage', 'getConnectionStatus', 'disconnect'];\n const missingMethods = requiredMethods.filter(method => \n typeof window.secureBitChat[method] !== 'function'\n );\n \n if (missingMethods.length > 0) {\n this._secureLog('error', '\u274C SECURITY ALERT: API tampering detected, missing methods:', { errorType: missingMethods?.constructor?.name || 'Unknown' });\n return false;\n }\n \n return true;\n } catch (error) {\n this._secureLog('error', '\u274C SECURITY ALERT: API integrity check failed:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n // ============================================\n // ADDITIONAL SECURITY METHODS\n // ============================================\n \n /**\n * Simple global exposure check - only at initialization\n */\n _auditGlobalExposure() {\n // Only check once at initialization, no periodic scanning\n this._secureLog('info', '\uD83D\uDD12 Global exposure check completed at initialization');\n return [];\n }\n \n /**\n * No periodic security audits - only at initialization\n */\n _startSecurityAudit() {\n // Only audit once at initialization, no periodic checks\n this._secureLog('info', '\uD83D\uDD12 Security audit completed at initialization - no periodic monitoring');\n }\n \n /**\n * Simple global API protection\n */\n _protectGlobalAPI() {\n if (!window.secureBitChat) {\n this._secureLog('warn', '\u26A0\uFE0F Global API not found during protection setup');\n return;\n }\n\n try {\n // Validate API integrity once\n if (this._validateAPIIntegrityOnce()) {\n this._secureLog('info', '\uD83D\uDD12 Global API protection verified');\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to verify global API protection', { \n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n \n /**\n * Validate API integrity once at initialization\n */\n _validateAPIIntegrityOnce() {\n try {\n // Check if API is properly configured\n if (!this._importantMethods || !this._importantMethods.getOwnPropertyDescriptor) {\n // Fallback to direct Object.getOwnPropertyDescriptor\n const descriptor = Object.getOwnPropertyDescriptor(window, 'secureBitChat');\n \n if (!descriptor || descriptor.configurable) {\n throw new Error('secureBitChat must not be reconfigurable!');\n }\n } else {\n const descriptor = this._importantMethods.getOwnPropertyDescriptor(window, 'secureBitChat');\n \n if (!descriptor || descriptor.configurable) {\n throw new Error('secureBitChat must not be reconfigurable!');\n }\n }\n \n this._secureLog('info', '\u2705 API integrity validated');\n return true;\n \n } catch (error) {\n this._secureLog('error', '\u274C API integrity validation failed', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n return false;\n }\n }\n \n /**\n * Secure memory wipe for sensitive data\n */\n _secureWipeMemory(data, context = 'unknown') {\n if (!data) return;\n \n try {\n // Different handling for different data types\n if (data instanceof ArrayBuffer) {\n this._secureWipeArrayBuffer(data, context);\n } else if (data instanceof Uint8Array) {\n this._secureWipeUint8Array(data, context);\n } else if (Array.isArray(data)) {\n this._secureWipeArray(data, context);\n } else if (typeof data === 'string') {\n this._secureWipeString(data, context);\n } else if (data instanceof CryptoKey) {\n this._secureWipeCryptoKey(data, context);\n } else if (typeof data === 'object') {\n this._secureWipeObject(data, context);\n }\n \n this._secureMemoryManager.memoryStats.totalCleanups++;\n \n } catch (error) {\n this._secureMemoryManager.memoryStats.failedCleanups++;\n this._secureLog('error', '\u274C Secure memory wipe failed', {\n context: context,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n \n /**\n * Secure wipe for ArrayBuffer\n */\n _secureWipeArrayBuffer(buffer, context) {\n if (!buffer || buffer.byteLength === 0) return;\n \n try {\n const view = new Uint8Array(buffer);\n \n // Overwrite with random data first\n crypto.getRandomValues(view);\n \n // Overwrite with zeros\n view.fill(0);\n \n // Overwrite with ones\n view.fill(255);\n \n // Final zero overwrite\n view.fill(0);\n \n this._secureLog('debug', '\uD83D\uDD12 ArrayBuffer securely wiped', {\n context: context,\n size: buffer.byteLength\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe ArrayBuffer', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure wipe for Uint8Array\n */\n _secureWipeUint8Array(array, context) {\n if (!array || array.length === 0) return;\n \n try {\n // Overwrite with random data first\n crypto.getRandomValues(array);\n \n // Overwrite with zeros\n array.fill(0);\n \n // Overwrite with ones\n array.fill(255);\n \n // Final zero overwrite\n array.fill(0);\n \n this._secureLog('debug', '\uD83D\uDD12 Uint8Array securely wiped', {\n context: context,\n size: array.length\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe Uint8Array', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure wipe for arrays\n */\n _secureWipeArray(array, context) {\n if (!Array.isArray(array) || array.length === 0) return;\n \n try {\n // Recursively wipe each element\n array.forEach((item, index) => {\n if (item !== null && item !== undefined) {\n this._secureWipeMemory(item, `${context}[${index}]`);\n }\n });\n \n // Fill with nulls\n array.fill(null);\n \n this._secureLog('debug', '\uD83D\uDD12 Array securely wiped', {\n context: context,\n size: array.length\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe array', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * No string wiping - strings are immutable in JS\n */\n _secureWipeString(str, context) {\n // Strings are immutable in JavaScript, no need to wipe\n // Just remove the reference\n this._secureLog('debug', '\uD83D\uDD12 String reference removed (strings are immutable)', {\n context: context,\n length: str ? str.length : 0\n });\n }\n \n /**\n * CryptoKey cleanup - store in WeakMap for proper GC\n */\n _secureWipeCryptoKey(key, context) {\n if (!key || !(key instanceof CryptoKey)) return;\n \n try {\n // Store in WeakMap for proper garbage collection\n if (!this._cryptoKeyStorage) {\n this._cryptoKeyStorage = new WeakMap();\n }\n \n // Store reference for cleanup tracking\n this._cryptoKeyStorage.set(key, {\n context: context,\n timestamp: Date.now(),\n type: key.type\n });\n \n this._secureLog('debug', '\uD83D\uDD12 CryptoKey stored in WeakMap for cleanup', {\n context: context,\n type: key.type\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to store CryptoKey for cleanup', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure wipe for objects\n */\n _secureWipeObject(obj, context) {\n if (!obj || typeof obj !== 'object') return;\n \n try {\n // Recursively wipe all properties\n for (const [key, value] of Object.entries(obj)) {\n if (value !== null && value !== undefined) {\n this._secureWipeMemory(value, `${context}.${key}`);\n }\n // Set property to null\n obj[key] = null;\n }\n \n this._secureLog('debug', '\uD83D\uDD12 Object securely wiped', {\n context: context,\n properties: Object.keys(obj).length\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe object', {\n context: context,\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Secure cleanup of cryptographic materials\n */\n _secureCleanupCryptographicMaterials() {\n try {\n // Secure wipe of key pairs\n if (this.ecdhKeyPair) {\n this._secureWipeMemory(this.ecdhKeyPair, 'ecdhKeyPair');\n this.ecdhKeyPair = null;\n }\n \n if (this.ecdsaKeyPair) {\n this._secureWipeMemory(this.ecdsaKeyPair, 'ecdsaKeyPair');\n this.ecdsaKeyPair = null;\n }\n \n // Secure wipe of derived keys\n if (this.encryptionKey) {\n this._secureWipeMemory(this.encryptionKey, 'encryptionKey');\n this.encryptionKey = null;\n }\n \n if (this.macKey) {\n this._secureWipeMemory(this.macKey, 'macKey');\n this.macKey = null;\n }\n \n if (this.metadataKey) {\n this._secureWipeMemory(this.metadataKey, 'metadataKey');\n this.metadataKey = null;\n }\n \n if (this.nestedEncryptionKey) {\n this._secureWipeMemory(this.nestedEncryptionKey, 'nestedEncryptionKey');\n this.nestedEncryptionKey = null;\n }\n \n // Secure wipe of session data\n if (this.sessionSalt) {\n this._secureWipeMemory(this.sessionSalt, 'sessionSalt');\n this.sessionSalt = null;\n }\n \n if (this.sessionId) {\n this._secureWipeMemory(this.sessionId, 'sessionId');\n this.sessionId = null;\n }\n \n if (this.verificationCode) {\n this._secureWipeMemory(this.verificationCode, 'verificationCode');\n this.verificationCode = null;\n }\n \n if (this.peerPublicKey) {\n this._secureWipeMemory(this.peerPublicKey, 'peerPublicKey');\n this.peerPublicKey = null;\n }\n \n if (this.keyFingerprint) {\n this._secureWipeMemory(this.keyFingerprint, 'keyFingerprint');\n this.keyFingerprint = null;\n }\n \n if (this.connectionId) {\n this._secureWipeMemory(this.connectionId, 'connectionId');\n this.connectionId = null;\n }\n \n this._secureLog('info', '\uD83D\uDD12 Cryptographic materials securely cleaned up');\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to cleanup cryptographic materials', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n \n /**\n * Force garbage collection if available\n */\n _forceGarbageCollection() {\n try {\n // Try to force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n this._secureLog('debug', '\uD83D\uDD12 Garbage collection forced');\n } else if (typeof global.gc === 'function') {\n global.gc();\n this._secureLog('debug', '\uD83D\uDD12 Garbage collection forced (global)');\n } else {\n this._secureLog('debug', '\u26A0\uFE0F Garbage collection not available');\n }\n } catch (error) {\n this._secureLog('error', '\u274C Failed to force garbage collection', {\n errorType: error.constructor.name\n });\n }\n }\n \n /**\n * Perform periodic memory cleanup\n */\n _performPeriodicMemoryCleanup() {\n try {\n this._secureMemoryManager.isCleaning = true;\n \n // Clean up any remaining sensitive data\n this._secureCleanupCryptographicMaterials();\n \n // Clean up message queue if it's too large\n if (this.messageQueue && this.messageQueue.length > 100) {\n const excessMessages = this.messageQueue.splice(0, this.messageQueue.length - 50);\n excessMessages.forEach((message, index) => {\n this._secureWipeMemory(message, `periodicCleanup[${index}]`);\n });\n }\n \n // Clean up processed message IDs if too many\n if (this.processedMessageIds && this.processedMessageIds.size > 1000) {\n this.processedMessageIds.clear();\n }\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n this._secureLog('debug', '\uD83D\uDD12 Periodic memory cleanup completed');\n \n } catch (error) {\n this._secureLog('error', '\u274C Error during periodic memory cleanup', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n } finally {\n this._secureMemoryManager.isCleaning = false;\n }\n }\n \n /**\n * Create secure error message without information disclosure\n */\n _createSecureErrorMessage(originalError, context = 'unknown') {\n try {\n // Categorize error for appropriate handling\n const category = this._categorizeError(originalError);\n \n // Generate safe error message based on category\n const safeMessage = this._getSafeErrorMessage(category, context);\n \n // Log detailed error internally for debugging\n this._secureLog('error', 'Internal error occurred', {\n category: category,\n context: context,\n errorType: originalError?.constructor?.name || 'Unknown',\n timestamp: Date.now()\n });\n \n // Track error frequency\n this._trackErrorFrequency(category);\n \n return safeMessage;\n \n } catch (error) {\n // Fallback to generic error if error handling fails\n this._secureLog('error', 'Error handling failed', {\n originalError: originalError?.message || 'Unknown',\n handlingError: error.message\n });\n return 'An unexpected error occurred';\n }\n }\n \n /**\n * Categorize error for appropriate handling\n */\n _categorizeError(error) {\n if (!error || !error.message) {\n return this._secureErrorHandler.errorCategories.UNKNOWN;\n }\n \n const message = error.message.toLowerCase();\n \n // Cryptographic errors\n if (message.includes('crypto') || \n message.includes('key') || \n message.includes('encrypt') || \n message.includes('decrypt') ||\n message.includes('sign') ||\n message.includes('verify') ||\n message.includes('ecdh') ||\n message.includes('ecdsa')) {\n return this._secureErrorHandler.errorCategories.CRYPTOGRAPHIC;\n }\n \n // Network errors\n if (message.includes('network') || \n message.includes('connection') || \n message.includes('timeout') ||\n message.includes('webrtc') ||\n message.includes('peer')) {\n return this._secureErrorHandler.errorCategories.NETWORK;\n }\n \n // Validation errors\n if (message.includes('invalid') || \n message.includes('validation') || \n message.includes('format') ||\n message.includes('type')) {\n return this._secureErrorHandler.errorCategories.VALIDATION;\n }\n \n // System errors\n if (message.includes('system') || \n message.includes('internal') || \n message.includes('memory') ||\n message.includes('resource')) {\n return this._secureErrorHandler.errorCategories.SYSTEM;\n }\n \n return this._secureErrorHandler.errorCategories.UNKNOWN;\n }\n \n /**\n * Get safe error message based on category\n */\n _getSafeErrorMessage(category, context) {\n const safeMessages = {\n [this._secureErrorHandler.errorCategories.CRYPTOGRAPHIC]: {\n 'key_generation': 'Security initialization failed',\n 'key_import': 'Security verification failed',\n 'key_derivation': 'Security setup failed',\n 'encryption': 'Message security failed',\n 'decryption': 'Message verification failed',\n 'signature': 'Authentication failed',\n 'default': 'Security operation failed'\n },\n [this._secureErrorHandler.errorCategories.NETWORK]: {\n 'connection': 'Connection failed',\n 'timeout': 'Connection timeout',\n 'peer': 'Peer connection failed',\n 'webrtc': 'Communication failed',\n 'default': 'Network operation failed'\n },\n [this._secureErrorHandler.errorCategories.VALIDATION]: {\n 'format': 'Invalid data format',\n 'type': 'Invalid data type',\n 'structure': 'Invalid data structure',\n 'default': 'Validation failed'\n },\n [this._secureErrorHandler.errorCategories.SYSTEM]: {\n 'memory': 'System resource error',\n 'resource': 'System resource unavailable',\n 'internal': 'Internal system error',\n 'default': 'System operation failed'\n },\n [this._secureErrorHandler.errorCategories.UNKNOWN]: {\n 'default': 'An unexpected error occurred'\n }\n };\n \n const categoryMessages = safeMessages[category] || safeMessages[this._secureErrorHandler.errorCategories.UNKNOWN];\n \n // Determine specific context for more precise message\n let specificContext = 'default';\n if (context.includes('key') || context.includes('crypto')) {\n specificContext = category === this._secureErrorHandler.errorCategories.CRYPTOGRAPHIC ? 'key_generation' : 'default';\n } else if (context.includes('connection') || context.includes('peer')) {\n specificContext = category === this._secureErrorHandler.errorCategories.NETWORK ? 'connection' : 'default';\n } else if (context.includes('validation') || context.includes('format')) {\n specificContext = category === this._secureErrorHandler.errorCategories.VALIDATION ? 'format' : 'default';\n }\n \n return categoryMessages[specificContext] || categoryMessages.default;\n }\n \n /**\n * Track error frequency for security monitoring\n */\n _trackErrorFrequency(category) {\n const now = Date.now();\n \n // Clean old error counts\n if (now - this._secureErrorHandler.lastErrorTime > 60000) { // 1 minute\n this._secureErrorHandler.errorCounts.clear();\n }\n \n // Increment error count\n const currentCount = this._secureErrorHandler.errorCounts.get(category) || 0;\n this._secureErrorHandler.errorCounts.set(category, currentCount + 1);\n this._secureErrorHandler.lastErrorTime = now;\n \n // Check if we're exceeding error threshold\n const totalErrors = Array.from(this._secureErrorHandler.errorCounts.values()).reduce((sum, count) => sum + count, 0);\n \n if (totalErrors > this._secureErrorHandler.errorThreshold) {\n this._secureErrorHandler.isInErrorMode = true;\n this._secureLog('warn', '\u26A0\uFE0F High error frequency detected - entering error mode', {\n totalErrors: totalErrors,\n threshold: this._secureErrorHandler.errorThreshold\n });\n }\n }\n \n /**\n * Throw secure error without information disclosure\n */\n _throwSecureError(originalError, context = 'unknown') {\n const secureMessage = this._createSecureErrorMessage(originalError, context);\n throw new Error(secureMessage);\n }\n \n /**\n * Get error handling statistics\n */\n _getErrorHandlingStats() {\n return {\n errorCounts: Object.fromEntries(this._secureErrorHandler.errorCounts),\n isInErrorMode: this._secureErrorHandler.isInErrorMode,\n lastErrorTime: this._secureErrorHandler.lastErrorTime,\n errorThreshold: this._secureErrorHandler.errorThreshold\n };\n }\n \n /**\n * Reset error handling system\n */\n _resetErrorHandlingSystem() {\n this._secureErrorHandler.errorCounts.clear();\n this._secureErrorHandler.isInErrorMode = false;\n this._secureErrorHandler.lastErrorTime = 0;\n \n this._secureLog('info', '\uD83D\uDD04 Error handling system reset');\n }\n \n /**\n * Get memory management statistics\n */\n _getMemoryManagementStats() {\n return {\n totalCleanups: this._secureMemoryManager.memoryStats.totalCleanups,\n failedCleanups: this._secureMemoryManager.memoryStats.failedCleanups,\n lastCleanup: this._secureMemoryManager.memoryStats.lastCleanup,\n isCleaning: this._secureMemoryManager.isCleaning,\n queueLength: this._secureMemoryManager.cleanupQueue.length\n };\n }\n \n /**\n * Validate API integrity and security\n */\n _validateAPIIntegrity() {\n try {\n // Check if API exists\n if (!window.secureBitChat) {\n this._secureLog('error', '\u274C Global API not found during integrity validation');\n return false;\n }\n \n // Validate required methods exist\n const requiredMethods = ['sendMessage', 'getConnectionStatus', 'getSecurityStatus', 'sendFile', 'disconnect'];\n const missingMethods = requiredMethods.filter(method => \n !window.secureBitChat[method] || typeof window.secureBitChat[method] !== 'function'\n );\n \n if (missingMethods.length > 0) {\n this._secureLog('error', '\u274C Global API integrity validation failed - missing methods', {\n missingMethods: missingMethods\n });\n return false;\n }\n \n // Test method binding integrity\n const testContext = { test: true };\n const boundMethods = requiredMethods.map(method => {\n try {\n return window.secureBitChat[method].bind(testContext);\n } catch (error) {\n return null;\n }\n });\n \n const unboundMethods = boundMethods.filter(method => method === null);\n if (unboundMethods.length > 0) {\n this._secureLog('error', '\u274C Global API integrity validation failed - method binding issues', {\n unboundMethods: unboundMethods.length\n });\n return false;\n }\n \n // Test API immutability\n try {\n const testProp = '_integrity_test_' + Date.now();\n Object.defineProperty(window.secureBitChat, testProp, {\n value: 'test',\n writable: true,\n configurable: true\n });\n \n this._secureLog('error', '\u274C Global API integrity validation failed - API is mutable');\n delete window.secureBitChat[testProp];\n return false;\n \n } catch (immutabilityError) {\n // This is expected - API should be immutable\n this._secureLog('debug', '\u2705 Global API immutability verified');\n }\n \n this._secureLog('info', '\u2705 Global API integrity validation passed');\n return true;\n \n } catch (error) {\n this._secureLog('error', '\u274C Global API integrity validation failed', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n return false;\n }\n }\n\n _validateCryptographicSecurity() {\n // Check if basic security features are available\n const criticalFeatures = ['hasRateLimiting'];\n const missingCritical = criticalFeatures.filter(feature => !this.securityFeatures[feature]);\n \n if (missingCritical.length > 0) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Missing critical rate limiting feature', {\n missing: missingCritical,\n currentFeatures: this.securityFeatures,\n action: 'Rate limiting will be forced enabled'\n });\n\n missingCritical.forEach(feature => {\n this.securityFeatures[feature] = true;\n this._secureLog('warn', `\u26A0\uFE0F Forced enable critical: ${feature} = true`);\n });\n }\n\n // Log current security state\n const availableFeatures = Object.keys(this.securityFeatures).filter(f => this.securityFeatures[f]);\n const encryptionFeatures = ['hasEncryption', 'hasECDH', 'hasECDSA'].filter(f => this.securityFeatures[f]);\n \n this._secureLog('info', '\u2705 Cryptographic security validation passed', {\n criticalFeatures: criticalFeatures.length,\n availableFeatures: availableFeatures.length,\n encryptionFeatures: encryptionFeatures.length,\n totalSecurityFeatures: availableFeatures.length,\n note: 'Encryption features will be enabled after key generation',\n currentState: {\n hasEncryption: this.securityFeatures.hasEncryption,\n hasECDH: this.securityFeatures.hasECDH,\n hasECDSA: this.securityFeatures.hasECDSA,\n hasRateLimiting: this.securityFeatures.hasRateLimiting\n }\n });\n \n return true;\n }\n\n _syncSecurityFeaturesWithTariff() {\n // All security features are enabled by default - no payment required\n this._secureLog('info', '\u2705 All security features enabled by default - no payment required');\n \n // Ensure all features are enabled\n const allFeatures = [\n 'hasEncryption', 'hasECDH', 'hasECDSA', 'hasMutualAuth',\n 'hasMetadataProtection', 'hasEnhancedReplayProtection',\n 'hasNonExtractableKeys', 'hasRateLimiting', 'hasEnhancedValidation', 'hasPFS',\n 'hasNestedEncryption', 'hasPacketPadding', 'hasPacketReordering',\n 'hasAntiFingerprinting', 'hasFakeTraffic', 'hasDecoyChannels', 'hasMessageChunking'\n ];\n \n allFeatures.forEach(feature => {\n this.securityFeatures[feature] = true;\n });\n \n this._secureLog('info', '\u2705 All security features enabled by default', {\n enabledFeatures: Object.keys(this.securityFeatures).filter(f => this.securityFeatures[f]).length,\n totalFeatures: Object.keys(this.securityFeatures).length\n });\n \n return;\n }\n \n /**\n * Emergency shutdown for critical issues\n */\n _emergencyShutdown(reason = 'Security breach') {\n this._secureLog('error', '\u274C EMERGENCY SHUTDOWN: ${reason}');\n \n try {\n // Clear critical data\n this.encryptionKey = null;\n this.macKey = null;\n this.metadataKey = null;\n this.verificationCode = null;\n this.keyFingerprint = null;\n this.connectionId = null;\n \n // Close connections\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Clear buffers\n this.messageQueue = [];\n this.processedMessageIds.clear();\n this.packetBuffer.clear();\n \n // Notify UI\n if (this.onStatusChange) {\n this.onStatusChange('security_breach');\n }\n \n this._secureLog('info', '\uD83D\uDD12 Emergency shutdown completed');\n \n } catch (error) {\n this._secureLog('error', '\u274C Error during emergency shutdown:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n _finalizeSecureInitialization() {\n this._startKeySecurityMonitoring();\n \n // Verify API integrity\n if (!this._verifyAPIIntegrity()) {\n this._secureLog('error', '\u274C Security initialization failed');\n return;\n }\n\n this._startSecurityMonitoring();\n \n // Start periodic log cleanup\n setInterval(() => {\n this._cleanupLogs();\n }, 300000);\n \n this._secureLog('info', '\u2705 Secure WebRTC Manager initialization completed');\n this._secureLog('info', '\uD83D\uDD12 Global exposure protection: Monitoring only, no automatic removal');\n }\n /**\n * Start security monitoring\n * @deprecated Use unified scheduler instead\n */\n _startSecurityMonitoring() {\n // All security monitoring moved to unified scheduler\n this._secureLog('info', '\uD83D\uDD27 Security monitoring moved to unified scheduler');\n }\n /**\n * Validates connection readiness for sending data\n * @param {boolean} throwError - whether to throw on not ready\n * @returns {boolean} true if connection is ready\n */\n _validateConnection(throwError = true) {\n const isDataChannelReady = this.dataChannel && this.dataChannel.readyState === 'open';\n const isConnectionVerified = this.isVerified;\n const isValid = isDataChannelReady && isConnectionVerified;\n \n if (!isValid && throwError) {\n if (!isDataChannelReady) {\n throw new Error('Data channel not ready');\n }\n if (!isConnectionVerified) {\n throw new Error('Connection not verified');\n }\n }\n \n return isValid;\n }\n\n /**\n * Hard gate for traffic blocking without verification\n * This method enforces that NO traffic (including system messages and file transfers)\n * can pass through without proper cryptographic verification\n */\n _enforceVerificationGate(operation = 'unknown', throwError = true) {\n if (!this.isVerified) {\n const errorMessage = `SECURITY VIOLATION: ${operation} blocked - connection not cryptographically verified`;\n this._secureLog('error', errorMessage, {\n operation: operation,\n isVerified: this.isVerified,\n hasKeys: !!(this.encryptionKey && this.macKey),\n timestamp: Date.now()\n });\n \n if (throwError) {\n throw new Error(errorMessage);\n }\n return false;\n }\n return true;\n }\n\n /**\n * Safe method to set isVerified only after cryptographic verification\n * This is the ONLY method that should set isVerified = true\n */\n _setVerifiedStatus(verified, verificationMethod = 'unknown', verificationData = null) {\n if (verified) {\n // Validate that we have proper cryptographic verification\n if (!this.encryptionKey || !this.macKey) {\n throw new Error('Cannot set verified=true without encryption keys');\n }\n \n if (!verificationMethod || verificationMethod === 'unknown') {\n throw new Error('Cannot set verified=true without specifying verification method');\n }\n \n // Log the verification for audit trail\n this._secureLog('info', 'Connection verified through cryptographic verification', {\n verificationMethod: verificationMethod,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n keyFingerprint: this.keyFingerprint,\n timestamp: Date.now(),\n verificationData: verificationData ? 'provided' : 'none'\n });\n }\n \n this.isVerified = verified;\n \n if (verified) {\n this.onStatusChange('connected');\n } else {\n this.onStatusChange('disconnected');\n }\n }\n\n /**\n * Create AAD (Additional Authenticated Data) for file messages\n * This binds file messages to the current session and prevents replay attacks\n */\n _createFileMessageAAD(messageType, messageData = null) {\n // Verify that _createMessageAAD method is available\n if (typeof this._createMessageAAD !== 'function') {\n throw new Error('_createMessageAAD method is not available in _createFileMessageAAD. Manager may not be fully initialized.');\n }\n // Use the unified AAD creation method with file message flag\n return this._createMessageAAD(messageType, messageData, true);\n }\n\n /**\n * Validate AAD for file messages\n * This ensures file messages are bound to the correct session\n */\n _validateFileMessageAAD(aadString, expectedMessageType = null) {\n try {\n const aad = JSON.parse(aadString);\n \n // Validate session binding\n if (aad.sessionId !== (this.currentSession?.sessionId || 'unknown')) {\n throw new Error('AAD sessionId mismatch - possible replay attack');\n }\n \n if (aad.keyFingerprint !== (this.keyFingerprint || 'unknown')) {\n throw new Error('AAD keyFingerprint mismatch - possible key substitution attack');\n }\n \n // Validate message type if specified\n if (expectedMessageType && aad.messageType !== expectedMessageType) {\n throw new Error(`AAD messageType mismatch - expected ${expectedMessageType}, got ${aad.messageType}`);\n }\n \n // Validate timestamp (prevent very old messages)\n const now = Date.now();\n const messageAge = now - aad.timestamp;\n if (messageAge > 300000) { // 5 minutes\n throw new Error('AAD timestamp too old - possible replay attack');\n }\n \n return aad;\n } catch (error) {\n this._secureLog('error', 'AAD validation failed', { error: error.message, aadString });\n throw new Error(`AAD validation failed: ${error.message}`);\n }\n }\n\n /**\n * Extract DTLS fingerprint from SDP\n * This is essential for MITM protection\n */\n _extractDTLSFingerprintFromSDP(sdp) {\n try {\n if (!sdp || typeof sdp !== 'string') {\n throw new Error('Invalid SDP provided');\n }\n\n // Look for a=fingerprint lines in SDP with more flexible regex\n const fingerprintRegex = /a=fingerprint:([a-zA-Z0-9-]+)\\s+([A-Fa-f0-9:]+)/g;\n const fingerprints = [];\n let match;\n\n while ((match = fingerprintRegex.exec(sdp)) !== null) {\n fingerprints.push({\n algorithm: match[1].toLowerCase(),\n fingerprint: match[2].toLowerCase().replace(/:/g, '')\n });\n }\n\n if (fingerprints.length === 0) {\n // Try alternative fingerprint format\n const altFingerprintRegex = /fingerprint\\s*=\\s*([a-zA-Z0-9-]+)\\s+([A-Fa-f0-9:]+)/gi;\n while ((match = altFingerprintRegex.exec(sdp)) !== null) {\n fingerprints.push({\n algorithm: match[1].toLowerCase(),\n fingerprint: match[2].toLowerCase().replace(/:/g, '')\n });\n }\n }\n\n if (fingerprints.length === 0) {\n this._secureLog('warn', 'No DTLS fingerprints found in SDP - this may be normal for some WebRTC implementations', {\n sdpLength: sdp.length,\n sdpPreview: sdp.substring(0, 200) + '...'\n });\n throw new Error('No DTLS fingerprints found in SDP');\n }\n\n // Prefer SHA-256 fingerprints\n const sha256Fingerprint = fingerprints.find(fp => fp.algorithm === 'sha-256');\n if (sha256Fingerprint) {\n return sha256Fingerprint.fingerprint;\n }\n\n // Fallback to first available fingerprint\n return fingerprints[0].fingerprint;\n } catch (error) {\n this._secureLog('error', 'Failed to extract DTLS fingerprint from SDP', { \n error: error.message,\n sdpLength: sdp?.length || 0\n });\n throw new Error(`DTLS fingerprint extraction failed: ${error.message}`);\n }\n }\n\n /**\n * Validate DTLS fingerprint against expected value\n * This prevents MITM attacks by ensuring the remote peer has the expected certificate\n */\n _validateDTLSFingerprint(receivedFingerprint, expectedFingerprint, context = 'unknown') {\n try {\n if (!receivedFingerprint || !expectedFingerprint) {\n throw new Error('Missing fingerprint for validation');\n }\n\n // Normalize fingerprints (remove colons, convert to lowercase)\n const normalizedReceived = receivedFingerprint.toLowerCase().replace(/:/g, '');\n const normalizedExpected = expectedFingerprint.toLowerCase().replace(/:/g, '');\n\n if (normalizedReceived !== normalizedExpected) {\n this._secureLog('error', 'DTLS fingerprint mismatch - possible MITM attack', {\n context: context,\n received: normalizedReceived,\n expected: normalizedExpected,\n timestamp: Date.now()\n });\n \n throw new Error(`DTLS fingerprint mismatch - possible MITM attack in ${context}`);\n }\n\n this._secureLog('info', 'DTLS fingerprint validation successful', {\n context: context,\n fingerprint: normalizedReceived,\n timestamp: Date.now()\n });\n\n return true;\n } catch (error) {\n this._secureLog('error', 'DTLS fingerprint validation failed', { \n error: error.message, \n context: context \n });\n throw error;\n }\n }\n\n /**\n * Compute SAS (Short Authentication String) for MITM protection\n * Uses HKDF with DTLS fingerprints to generate a stable 7-digit verification code\n * @param {ArrayBuffer|Uint8Array} keyMaterialRaw - Shared secret or key fingerprint data\n * @param {string} localFP - Local DTLS fingerprint\n * @param {string} remoteFP - Remote DTLS fingerprint\n * @returns {Promise} 7-digit SAS code\n */\n async _computeSAS(keyMaterialRaw, localFP, remoteFP) {\n try {\n console.log('_computeSAS called with parameters:', {\n keyMaterialRaw: keyMaterialRaw ? `${keyMaterialRaw.constructor.name} (${keyMaterialRaw.length || keyMaterialRaw.byteLength} bytes)` : 'null/undefined',\n localFP: localFP ? `${localFP.substring(0, 20)}...` : 'null/undefined',\n remoteFP: remoteFP ? `${remoteFP.substring(0, 20)}...` : 'null/undefined'\n });\n \n if (!keyMaterialRaw || !localFP || !remoteFP) {\n const missing = [];\n if (!keyMaterialRaw) missing.push('keyMaterialRaw');\n if (!localFP) missing.push('localFP');\n if (!remoteFP) missing.push('remoteFP');\n throw new Error(`Missing required parameters for SAS computation: ${missing.join(', ')}`);\n }\n\n const enc = new TextEncoder();\n\n const salt = enc.encode(\n 'webrtc-sas|' + [localFP, remoteFP].sort().join('|')\n );\n\n let keyBuffer;\n if (keyMaterialRaw instanceof ArrayBuffer) {\n keyBuffer = keyMaterialRaw;\n } else if (keyMaterialRaw instanceof Uint8Array) {\n keyBuffer = keyMaterialRaw.buffer;\n } else if (typeof keyMaterialRaw === 'string') {\n // \u0415\u0441\u043B\u0438 \u044D\u0442\u043E \u0441\u0442\u0440\u043E\u043A\u0430 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, keyFingerprint), \u0434\u0435\u043A\u043E\u0434\u0438\u0440\u0443\u0435\u043C \u0435\u0451\n // \u041F\u0440\u0435\u0434\u043F\u043E\u043B\u0430\u0433\u0430\u0435\u043C, \u0447\u0442\u043E \u044D\u0442\u043E hex \u0441\u0442\u0440\u043E\u043A\u0430\n const hexString = keyMaterialRaw.replace(/:/g, '').replace(/\\s/g, '');\n const bytes = new Uint8Array(hexString.length / 2);\n for (let i = 0; i < hexString.length; i += 2) {\n bytes[i / 2] = parseInt(hexString.substr(i, 2), 16);\n }\n keyBuffer = bytes.buffer;\n } else {\n throw new Error('Invalid keyMaterialRaw type');\n }\n\n // \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C HKDF(SHA-256) \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u044B\u0435 64 \u0431\u0438\u0442\u0430 \u044D\u043D\u0442\u0440\u043E\u043F\u0438\u0438 \u0434\u043B\u044F \u043A\u043E\u0434\u0430\n const key = await crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n 'HKDF',\n false,\n ['deriveBits']\n );\n\n const info = enc.encode('p2p-sas-v1');\n const bits = await crypto.subtle.deriveBits(\n { name: 'HKDF', hash: 'SHA-256', salt, info },\n key,\n 64 // 64 \u0431\u0438\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0434\u043B\u044F 6\u20137 \u0437\u043D\u0430\u043A\u043E\u0432\n );\n\n const dv = new DataView(bits);\n const n = (dv.getUint32(0) ^ dv.getUint32(4)) >>> 0;\n const sasCode = String(n % 10_000_000).padStart(7, '0'); \n\n console.log('\uD83C\uDFAF _computeSAS computed code:', sasCode, '(type:', typeof sasCode, ')');\n\n this._secureLog('info', 'SAS code computed successfully', {\n localFP: localFP.substring(0, 16) + '...',\n remoteFP: remoteFP.substring(0, 16) + '...',\n sasLength: sasCode.length,\n timestamp: Date.now()\n });\n\n return sasCode;\n } catch (error) {\n this._secureLog('error', 'SAS computation failed', {\n error: error.message,\n keyMaterialType: typeof keyMaterialRaw,\n hasLocalFP: !!localFP,\n hasRemoteFP: !!remoteFP,\n timestamp: Date.now()\n });\n throw new Error(`SAS computation failed: ${error.message}`);\n }\n }\n\n /**\n * UTILITY: Decode hex keyFingerprint to Uint8Array for SAS computation\n * @param {string} hexString - Hex encoded keyFingerprint (e.g., \"aa:bb:cc:dd\")\n * @returns {Uint8Array} Decoded bytes\n */\n _decodeKeyFingerprint(hexString) {\n try {\n if (!hexString || typeof hexString !== 'string') {\n throw new Error('Invalid hex string provided');\n }\n\n // Use the utility from EnhancedSecureCryptoUtils\n return window.EnhancedSecureCryptoUtils.hexToUint8Array(hexString);\n } catch (error) {\n this._secureLog('error', 'Key fingerprint decoding failed', {\n error: error.message,\n inputType: typeof hexString,\n inputLength: hexString?.length || 0\n });\n throw new Error(`Key fingerprint decoding failed: ${error.message}`);\n }\n }\n\n /**\n * Emergency key wipe on fingerprint mismatch\n * This ensures no sensitive data remains if MITM is detected\n */\n _emergencyWipeOnFingerprintMismatch(reason = 'DTLS fingerprint mismatch') {\n try {\n this._secureLog('error', '\uD83D\uDEA8 EMERGENCY: Initiating security wipe due to fingerprint mismatch', {\n reason: reason,\n timestamp: Date.now()\n });\n\n // Wipe all cryptographic materials\n this._secureWipeKeys();\n this._secureWipeMemory(this.encryptionKey, 'emergency_wipe');\n this._secureWipeMemory(this.macKey, 'emergency_wipe');\n this._secureWipeMemory(this.metadataKey, 'emergency_wipe');\n \n // Wipe ephemeral keys for PFS\n this._wipeEphemeralKeys();\n \n // Hard wipe old keys for PFS\n this._hardWipeOldKeys();\n\n // Reset verification status\n this.isVerified = null;\n this.verificationCode = null;\n this.keyFingerprint = null;\n this.connectionId = null;\n this.expectedDTLSFingerprint = null;\n\n // Disconnect immediately\n this.disconnect();\n\n // Notify UI about security breach\n this.deliverMessageToUI('\uD83D\uDEA8 SECURITY BREACH: Connection terminated due to fingerprint mismatch. Possible MITM attack detected!', 'system');\n\n } catch (error) {\n this._secureLog('error', 'Failed to perform emergency wipe', { error: error.message });\n }\n }\n\n /**\n * Set expected DTLS fingerprint via out-of-band channel\n * This should be called after receiving the fingerprint through a secure channel\n * (e.g., QR code, voice call, in-person exchange, etc.)\n */\n setExpectedDTLSFingerprint(fingerprint, source = 'out_of_band') {\n try {\n if (!fingerprint || typeof fingerprint !== 'string') {\n throw new Error('Invalid fingerprint provided');\n }\n\n // Normalize fingerprint\n const normalizedFingerprint = fingerprint.toLowerCase().replace(/:/g, '');\n\n // Validate fingerprint format (should be hex string)\n if (!/^[a-f0-9]{40,64}$/.test(normalizedFingerprint)) {\n throw new Error('Invalid fingerprint format - must be hex string');\n }\n\n this.expectedDTLSFingerprint = normalizedFingerprint;\n\n this._secureLog('info', 'Expected DTLS fingerprint set via out-of-band channel', {\n source: source,\n fingerprint: normalizedFingerprint,\n timestamp: Date.now()\n });\n\n this.deliverMessageToUI(`\u2705 DTLS fingerprint set via ${source}. MITM protection enabled.`, 'system');\n\n } catch (error) {\n this._secureLog('error', 'Failed to set expected DTLS fingerprint', { error: error.message });\n throw error;\n }\n }\n\n /**\n * Get current DTLS fingerprint for out-of-band verification\n * This should be shared through a secure channel (QR code, voice, etc.)\n */\n getCurrentDTLSFingerprint() {\n try {\n if (!this.expectedDTLSFingerprint) {\n throw new Error('No DTLS fingerprint available - connection not established');\n }\n\n return this.expectedDTLSFingerprint;\n } catch (error) {\n this._secureLog('error', 'Failed to get current DTLS fingerprint', { error: error.message });\n throw error;\n }\n }\n\n /**\n * DEBUGGING: Temporarily disable strict DTLS validation\n * This should only be used for debugging connection issues\n */\n disableStrictDTLSValidation() {\n this.strictDTLSValidation = false;\n this._secureLog('warn', '\u26A0\uFE0F Strict DTLS validation disabled - security reduced', {\n timestamp: Date.now()\n });\n this.deliverMessageToUI('\u26A0\uFE0F DTLS validation disabled for debugging', 'system');\n }\n\n /**\n * SECURITY: Re-enable strict DTLS validation\n */\n enableStrictDTLSValidation() {\n this.strictDTLSValidation = true;\n this._secureLog('info', '\u2705 Strict DTLS validation re-enabled', {\n timestamp: Date.now()\n });\n this.deliverMessageToUI('\u2705 DTLS validation re-enabled', 'system');\n }\n\n /**\n * Generate ephemeral ECDH keys for Perfect Forward Secrecy\n * This ensures each session has unique, non-persistent keys\n */\n async _generateEphemeralECDHKeys() {\n try {\n this._secureLog('info', '\uD83D\uDD11 Generating ephemeral ECDH keys for PFS', {\n sessionStartTime: this.sessionStartTime,\n timestamp: Date.now()\n });\n\n // Generate new ephemeral ECDH key pair\n const ephemeralKeyPair = await window.EnhancedSecureCryptoUtils.generateECDHKeyPair();\n \n if (!ephemeralKeyPair || !this._validateKeyPairConstantTime(ephemeralKeyPair)) {\n throw new Error('Ephemeral ECDH key pair validation failed');\n }\n\n // Store ephemeral keys with session binding\n const sessionId = this.currentSession?.sessionId || `session_${Date.now()}`;\n this.ephemeralKeyPairs.set(sessionId, {\n keyPair: ephemeralKeyPair,\n timestamp: Date.now(),\n sessionId: sessionId\n });\n\n this._secureLog('info', '\u2705 Ephemeral ECDH keys generated for PFS', {\n sessionId: sessionId,\n timestamp: Date.now()\n });\n\n return ephemeralKeyPair;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to generate ephemeral ECDH keys', { error: error.message });\n throw new Error(`Ephemeral key generation failed: ${error.message}`);\n }\n }\n\n /**\n * Hard wipe old keys for real PFS\n * This prevents retrospective decryption attacks\n */\n _hardWipeOldKeys() {\n try {\n this._secureLog('info', '\uD83E\uDDF9 Performing hard wipe of old keys for PFS', {\n oldKeysCount: this.oldKeys.size,\n timestamp: Date.now()\n });\n\n // Hard wipe all old keys\n for (const [version, keySet] of this.oldKeys.entries()) {\n if (keySet.encryptionKey) {\n this._secureWipeMemory(keySet.encryptionKey, 'pfs_key_wipe');\n }\n if (keySet.macKey) {\n this._secureWipeMemory(keySet.macKey, 'pfs_key_wipe');\n }\n if (keySet.metadataKey) {\n this._secureWipeMemory(keySet.metadataKey, 'pfs_key_wipe');\n }\n \n // Clear references\n keySet.encryptionKey = null;\n keySet.macKey = null;\n keySet.metadataKey = null;\n keySet.keyFingerprint = null;\n }\n\n // Clear the oldKeys map completely\n this.oldKeys.clear();\n\n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n }\n\n this._secureLog('info', '\u2705 Hard wipe of old keys completed for PFS', {\n timestamp: Date.now()\n });\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to perform hard wipe of old keys', { error: error.message });\n }\n }\n\n /**\n * Wipe ephemeral keys when session ends\n * This ensures session-specific keys are destroyed\n */\n _wipeEphemeralKeys() {\n try {\n this._secureLog('info', '\uD83E\uDDF9 Wiping ephemeral keys for PFS', {\n ephemeralKeysCount: this.ephemeralKeyPairs.size,\n timestamp: Date.now()\n });\n\n // Wipe all ephemeral key pairs\n for (const [sessionId, keyData] of this.ephemeralKeyPairs.entries()) {\n if (keyData.keyPair?.privateKey) {\n this._secureWipeMemory(keyData.keyPair.privateKey, 'ephemeral_key_wipe');\n }\n if (keyData.keyPair?.publicKey) {\n this._secureWipeMemory(keyData.keyPair.publicKey, 'ephemeral_key_wipe');\n }\n \n // Clear references\n keyData.keyPair = null;\n keyData.timestamp = null;\n keyData.sessionId = null;\n }\n\n // Clear the ephemeral keys map\n this.ephemeralKeyPairs.clear();\n\n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n }\n\n this._secureLog('info', '\u2705 Ephemeral keys wiped for PFS', {\n timestamp: Date.now()\n });\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to wipe ephemeral keys', { error: error.message });\n }\n }\n\n /**\n * Encrypt file messages with AAD\n * This ensures file messages are properly authenticated and bound to session\n */\n async _encryptFileMessage(messageData, aad) {\n try {\n if (!this.encryptionKey) {\n throw new Error('No encryption key available for file message');\n }\n\n // Convert message to string if it's an object\n const messageString = typeof messageData === 'string' ? messageData : JSON.stringify(messageData);\n \n // Encrypt with AAD using AES-GCM\n const encryptedData = await window.EnhancedSecureCryptoUtils.encryptDataWithAAD(\n messageString, \n this.encryptionKey, \n aad\n );\n \n // Create encrypted message wrapper\n const encryptedMessage = {\n type: 'encrypted_file_message',\n encryptedData: encryptedData,\n aad: aad,\n timestamp: Date.now(),\n keyFingerprint: this.keyFingerprint\n };\n \n return JSON.stringify(encryptedMessage);\n } catch (error) {\n this._secureLog('error', 'Failed to encrypt file message', { error: error.message });\n throw new Error(`File message encryption failed: ${error.message}`);\n }\n }\n\n /**\n * Decrypt file messages with AAD validation\n * This ensures file messages are properly authenticated and bound to session\n */\n async _decryptFileMessage(encryptedMessageString) {\n try {\n const encryptedMessage = JSON.parse(encryptedMessageString);\n \n if (encryptedMessage.type !== 'encrypted_file_message') {\n throw new Error('Invalid encrypted file message type');\n }\n \n // Validate key fingerprint\n if (encryptedMessage.keyFingerprint !== this.keyFingerprint) {\n throw new Error('Key fingerprint mismatch in encrypted file message');\n }\n \n // Validate AAD with sequence number\n const aad = this._validateMessageAAD(encryptedMessage.aad, 'file_message');\n \n if (!this.encryptionKey) {\n throw new Error('No encryption key available for file message decryption');\n }\n \n // Decrypt with AAD validation\n const decryptedData = await window.EnhancedSecureCryptoUtils.decryptDataWithAAD(\n encryptedMessage.encryptedData,\n this.encryptionKey,\n encryptedMessage.aad\n );\n \n return {\n decryptedData: decryptedData,\n aad: aad\n };\n } catch (error) {\n this._secureLog('error', 'Failed to decrypt file message', { error: error.message });\n throw new Error(`File message decryption failed: ${error.message}`);\n }\n }\n\n /**\n * Validates encryption keys readiness\n * @param {boolean} throwError - whether to throw on not ready\n * @returns {boolean} true if keys are ready\n */\n _validateEncryptionKeys(throwError = true) {\n const hasAllKeys = !!(this.encryptionKey && this.macKey && this.metadataKey);\n \n if (!hasAllKeys && throwError) {\n throw new Error('Encryption keys not initialized');\n }\n \n return hasAllKeys;\n }\n\n /**\n * Checks whether a message is a file-transfer message\n * @param {string|object} data - message payload\n * @returns {boolean} true if it's a file message\n */\n _isFileMessage(data) {\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return parsed.type && parsed.type.startsWith('file_');\n } catch {\n return false;\n }\n }\n \n if (typeof data === 'object' && data.type) {\n return data.type.startsWith('file_');\n }\n \n return false;\n }\n\n /**\n * Checks whether a message is a system message\n * @param {string|object} data - message payload \n * @returns {boolean} true if it's a system message\n */\n _isSystemMessage(data) {\n const systemTypes = [\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_BOTH_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.PEER_DISCONNECT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.SECURITY_UPGRADE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_SIGNAL,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_READY\n ];\n\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return systemTypes.includes(parsed.type);\n } catch {\n return false;\n }\n }\n \n if (typeof data === 'object' && data.type) {\n return systemTypes.includes(data.type);\n }\n \n return false;\n }\n\n /**\n * Checks whether a message is fake traffic\n * @param {any} data - message payload\n * @returns {boolean} true if it's a fake message\n */\n _isFakeMessage(data) {\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return parsed.type === EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE || \n parsed.isFakeTraffic === true;\n } catch {\n return false;\n }\n }\n \n if (typeof data === 'object' && data !== null) {\n return data.type === EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE || \n data.isFakeTraffic === true;\n }\n \n return false;\n }\n\n /**\n * Safely executes an operation with error handling\n * @param {Function} operation - operation to execute\n * @param {string} errorMessage - error message to log\n * @param {any} fallback - default value on error\n * @returns {any} operation result or fallback\n */\n _withErrorHandling(operation, errorMessage, fallback = null) {\n try {\n return operation();\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C ${errorMessage}:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n return fallback;\n }\n }\n\n /**\n * Safely executes an async operation with error handling\n * @param {Function} operation - async operation\n * @param {string} errorMessage - error message to log\n * @param {any} fallback - default value on error\n * @returns {Promise} operation result or fallback\n */\n async _withAsyncErrorHandling(operation, errorMessage, fallback = null) {\n try {\n return await operation();\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C ${errorMessage}:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n return fallback;\n }\n }\n\n\n /**\n * Extracts message type from data\n * @param {string|object} data - message data\n * @returns {string|null} message type or null\n */\n _getMessageType(data) {\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n return parsed.type || null;\n } catch {\n return null;\n }\n }\n \n if (typeof data === 'object' && data !== null) {\n return data.type || null;\n }\n \n return null;\n }\n\n /**\n * Resets notification flags for a new connection\n */\n _resetNotificationFlags() {\n this.lastSecurityLevelNotification = null;\n this.verificationNotificationSent = false;\n this.verificationInitiationSent = false;\n this.disconnectNotificationSent = false;\n this.reconnectionFailedNotificationSent = false;\n this.peerDisconnectNotificationSent = false;\n this.connectionClosedNotificationSent = false;\n this.fakeTrafficDisabledNotificationSent = false;\n this.advancedFeaturesDisabledNotificationSent = false;\n this.securityUpgradeNotificationSent = false;\n this.lastSecurityUpgradeStage = null;\n this.securityCalculationNotificationSent = false;\n this.lastSecurityCalculationLevel = null;\n }\n\n /**\n * Checks whether a message was filtered out\n * @param {any} result - processing result\n * @returns {boolean} true if filtered\n */\n _isFilteredMessage(result) {\n const filteredResults = Object.values(EnhancedSecureWebRTCManager.FILTERED_RESULTS);\n return filteredResults.includes(result);\n }\n /**\n * Enhanced log cleanup with security checks\n */\n _cleanupLogs() {\n // More aggressive cleanup to prevent data accumulation\n if (this._logCounts.size > 500) {\n this._logCounts.clear();\n this._secureLog('debug', '\uD83E\uDDF9 Log counts cleared due to size limit');\n }\n \n // Clean up old log entries to prevent memory leaks\n const now = Date.now();\n const maxAge = 300000; // 5 minutes\n \n // Check for suspicious log patterns\n let suspiciousCount = 0;\n for (const [key, count] of this._logCounts.entries()) {\n if (count > 10) {\n suspiciousCount++;\n }\n }\n \n // Emergency cleanup if too many suspicious patterns\n if (suspiciousCount > 20) {\n this._logCounts.clear();\n this._secureLog('warn', '\uD83D\uDEA8 Emergency log cleanup due to suspicious patterns');\n }\n \n // Reset security violation counter if system is stable\n if (this._logSecurityViolations > 0 && suspiciousCount < 5) {\n this._logSecurityViolations = Math.max(0, this._logSecurityViolations - 1);\n }\n \n // Clean up old IVs periodically\n if (!this._lastIVCleanupTime || Date.now() - this._lastIVCleanupTime > 300000) { // Every 5 minutes\n this._cleanupOldIVs();\n this._lastIVCleanupTime = Date.now();\n }\n \n // Periodic secure memory cleanup\n if (!this._secureMemoryManager.memoryStats.lastCleanup || \n Date.now() - this._secureMemoryManager.memoryStats.lastCleanup > 600000) { // Every 10 minutes\n this._performPeriodicMemoryCleanup();\n this._secureMemoryManager.memoryStats.lastCleanup = Date.now();\n }\n }\n /**\n * Secure logging stats with sensitive data protection\n */\n _getLoggingStats() {\n // Only return safe statistics\n const stats = {\n isProductionMode: this._isProductionMode,\n debugMode: this._debugMode,\n currentLogLevel: this._currentLogLevel,\n logCountsSize: this._logCounts.size,\n maxLogCount: this._maxLogCount,\n securityViolations: this._logSecurityViolations || 0,\n maxSecurityViolations: this._maxLogSecurityViolations || 3,\n systemStatus: this._currentLogLevel === -1 ? 'DISABLED' : 'ACTIVE'\n };\n \n // Sanitize any potentially sensitive data\n const sanitizedStats = {};\n for (const [key, value] of Object.entries(stats)) {\n if (typeof value === 'string' && this._containsSensitiveContent(value)) {\n sanitizedStats[key] = '[SENSITIVE_DATA_REDACTED]';\n } else {\n sanitizedStats[key] = value;\n }\n }\n \n return sanitizedStats;\n }\n /**\n * Enhanced emergency logging disable with cleanup\n */\n _emergencyDisableLogging() {\n // Immediately disable all logging levels\n this._currentLogLevel = -1;\n \n // Clear all log data to prevent memory leaks\n this._logCounts.clear();\n \n // Clear any cached sensitive data\n if (this._logSecurityViolations) {\n this._logSecurityViolations = 0;\n }\n \n // Override _secureLog to a secure no-op\n this._secureLog = () => {\n // Only allow emergency console errors\n if (arguments[0] === 'error' && this._originalConsole?.error) {\n this._originalConsole.error('\uD83D\uDEA8 SECURITY: Logging system disabled - potential data exposure prevented');\n }\n };\n \n // Store original functions before overriding\n this._originalSanitizeString = this._sanitizeString;\n this._originalSanitizeLogData = this._sanitizeLogData;\n this._originalAuditLogMessage = this._auditLogMessage;\n this._originalContainsSensitiveContent = this._containsSensitiveContent;\n \n // Override all logging methods to prevent bypass\n this._sanitizeString = () => '[LOGGING_DISABLED]';\n this._sanitizeLogData = () => ({ error: 'LOGGING_DISABLED' });\n this._auditLogMessage = () => false;\n this._containsSensitiveContent = () => true; // Block everything\n \n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n try {\n window.gc();\n } catch (e) {\n // Ignore GC errors\n }\n }\n \n // Notify about the emergency shutdown\n this._originalConsole?.error?.('\uD83D\uDEA8 CRITICAL: Secure logging system disabled due to potential data exposure');\n }\n\n /**\n * Reset logging system after emergency shutdown\n * Use this function to restore normal logging functionality\n */\n _resetLoggingSystem() {\n this._secureLog('info', '\uD83D\uDD27 Resetting logging system after emergency shutdown');\n \n // Restore original sanitize functions\n this._sanitizeString = this._originalSanitizeString || ((str) => str);\n this._sanitizeLogData = this._originalSanitizeLogData || ((data) => data);\n this._auditLogMessage = this._originalAuditLogMessage || (() => true);\n this._containsSensitiveContent = this._originalContainsSensitiveContent || (() => false);\n \n // Reset security violation counters\n this._logSecurityViolations = 0;\n \n this._secureLog('info', '\u2705 Logging system reset successfully');\n }\n /**\n * Enhanced audit function for log message security\n */\n _auditLogMessage(message, data) {\n if (!data || typeof data !== 'object') return true;\n \n // Convert to string and check for sensitive content\n const dataString = JSON.stringify(data);\n \n // Check message itself for sensitive content\n if (this._containsSensitiveContent(message)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY BREACH: Sensitive content detected in log message');\n return false;\n }\n \n // Check data string for sensitive content\n if (this._containsSensitiveContent(dataString)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.('\uD83D\uDEA8 SECURITY BREACH: Sensitive content detected in log data');\n return false;\n }\n \n // Enhanced dangerous pattern detection\n const dangerousPatterns = [\n 'secret', 'token', 'password', 'credential', 'auth',\n 'fingerprint', 'salt', 'signature', 'private_key', 'api_key', 'private',\n 'encryption', 'mac', 'metadata', 'session', 'jwt', 'bearer',\n 'key', 'hash', 'digest', 'nonce', 'iv', 'cipher'\n ];\n \n const dataStringLower = dataString.toLowerCase();\n \n for (const pattern of dangerousPatterns) {\n if (dataStringLower.includes(pattern) && !this._safeFieldsWhitelist.has(pattern)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.(`\uD83D\uDEA8 SECURITY BREACH: Dangerous pattern detected in log: ${pattern}`);\n return false;\n }\n }\n \n // Check for high entropy values in data\n for (const [key, value] of Object.entries(data)) {\n if (typeof value === 'string' && this._hasHighEntropy(value)) {\n this._emergencyDisableLogging();\n this._originalConsole?.error?.(`\uD83D\uDEA8 SECURITY BREACH: High entropy value detected in log field: ${key}`);\n return false;\n }\n }\n \n return true;\n }\n\n initializeFileTransfer() {\n try {\n this._secureLog('info', '\uD83D\uDD27 Initializing Enhanced Secure File Transfer system...');\n\n if (this.fileTransferSystem) {\n this._secureLog('info', '\u2705 File transfer system already initialized');\n return;\n }\n \n // Step-by-step readiness check\n const channelReady = !!(this.dataChannel && this.dataChannel.readyState === 'open');\n if (!channelReady) {\n this._secureLog('warn', '\u26A0\uFE0F Data channel not open, deferring file transfer initialization');\n if (this.dataChannel) {\n const initHandler = () => {\n this._secureLog('info', '\uD83D\uDD04 DataChannel opened, initializing file transfer...');\n this.initializeFileTransfer();\n };\n this.dataChannel.addEventListener('open', initHandler, { once: true });\n }\n return;\n }\n\n if (!this.isVerified) {\n this._secureLog('warn', '\u26A0\uFE0F Connection not verified yet, deferring file transfer initialization');\n setTimeout(() => this.initializeFileTransfer(), 500);\n return;\n }\n \n // FIX: Clean up previous system if present\n if (this.fileTransferSystem) {\n this._secureLog('info', '\uD83E\uDDF9 Cleaning up existing file transfer system');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n // Ensure encryption keys are present\n if (!this.encryptionKey || !this.macKey) {\n this._secureLog('warn', '\u26A0\uFE0F Encryption keys not ready, deferring file transfer initialization');\n setTimeout(() => this.initializeFileTransfer(), 1000);\n return;\n }\n \n // IMPORTANT: callback order: (onProgress, onComplete, onError, onFileReceived)\n const safeOnComplete = (summary) => {\n // Sender: finalize transfer, no Blob handling\n try {\n this._secureLog('info', '\uD83C\uDFC1 Sender transfer summary', { summary });\n // Optionally forward as progress/UI event\n if (this.onFileProgress) {\n this.onFileProgress({ type: 'complete', ...summary });\n }\n } catch (e) {\n this._secureLog('warn', '\u26A0\uFE0F onComplete handler failed:', { details: e.message });\n }\n };\n\n this.fileTransferSystem = new EnhancedSecureFileTransfer(\n this,\n this.onFileProgress || null,\n safeOnComplete,\n this.onFileError || null,\n this.onFileReceived || null\n );\n \n this._fileTransferActive = true;\n \n this._secureLog('info', '\u2705 Enhanced Secure File Transfer system initialized successfully');\n \n // Verify the system is ready\n const status = this.fileTransferSystem.getSystemStatus();\n this._secureLog('info', '\uD83D\uDD0D File transfer system status after init', { status });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to initialize file transfer system', { errorType: error.constructor.name });\n this.fileTransferSystem = null;\n this._fileTransferActive = false;\n }\n }\n\n // ============================================\n // ENHANCED SECURITY INITIALIZATION\n // ============================================\n\n async initializeEnhancedSecurity() {\n try {\n // Generate nested encryption key\n await this.generateNestedEncryptionKey();\n \n // Initialize decoy channels\n if (this.decoyChannelConfig.enabled) {\n this.initializeDecoyChannels();\n }\n \n // Start fake traffic generation\n if (this.fakeTrafficConfig.enabled) {\n this.startFakeTrafficGeneration();\n }\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to initialize enhanced security', { errorType: error.constructor.name });\n }\n }\n \n // Generate fingerprint mask for anti-fingerprinting with enhanced randomization\n generateFingerprintMask() {\n // Enhanced randomization to prevent side-channel attacks\n const cryptoRandom = crypto.getRandomValues(new Uint8Array(128));\n \n const mask = {\n timingOffset: cryptoRandom[0] % 1000 + cryptoRandom[1] % 500, // 0-1500ms\n sizeVariation: (cryptoRandom[2] % 50 + 75) / 100, // 0.75 to 1.25\n noisePattern: Array.from(crypto.getRandomValues(new Uint8Array(64))), // Increased size\n headerVariations: [\n 'X-Client-Version', 'X-Session-ID', 'X-Request-ID', 'X-Timestamp', 'X-Signature',\n 'X-Secure', 'X-Encrypted', 'X-Protected', 'X-Safe', 'X-Anonymous', 'X-Private'\n ],\n noiseIntensity: cryptoRandom[3] % 100 + 50, // 50-150%\n sizeMultiplier: (cryptoRandom[4] % 50 + 75) / 100, // 0.75-1.25\n timingVariation: cryptoRandom[5] % 1000 + 100 // 100-1100ms\n };\n return mask;\n }\n\n // Security configuration - all features enabled by default\n configureSecurityForSession(sessionType, securityLevel) {\n this._secureLog('info', `\uD83D\uDD27 Configuring security for ${sessionType} session (${securityLevel} level)`);\n \n this.currentSessionType = sessionType;\n this.currentSecurityLevel = securityLevel;\n \n // All security features are enabled by default - no payment required\n this.sessionConstraints = {};\n \n Object.keys(this.securityFeatures).forEach(feature => {\n this.sessionConstraints[feature] = true; // All features enabled\n });\n \n this.applySessionConstraints();\n \n this._secureLog('info', `\u2705 Security configured for ${sessionType} - all features enabled`, { constraints: this.sessionConstraints });\n\n if (!this._validateCryptographicSecurity()) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Cryptographic security validation failed after session configuration');\n\n if (this.onStatusChange) {\n this.onStatusChange('security_breach', {\n type: 'crypto_security_failure',\n sessionType: sessionType,\n message: 'Cryptographic security validation failed after session configuration'\n });\n }\n }\n \n this.notifySecurityLevel();\n \n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, EnhancedSecureWebRTCManager.TIMEOUTS.SECURITY_CALC_DELAY);\n }\n\n // Applying session constraints - all features enabled by default\n applySessionConstraints() {\n if (!this.sessionConstraints) return;\n\n // All features are enabled by default - no restrictions\n Object.keys(this.sessionConstraints).forEach(feature => {\n this.securityFeatures[feature] = true; // All features enabled\n \n // Enable linked configurations\n switch (feature) {\n case 'hasFakeTraffic':\n this.fakeTrafficConfig.enabled = true;\n if (this.isConnected()) {\n this.startFakeTrafficGeneration();\n }\n break;\n case 'hasDecoyChannels':\n this.decoyChannelConfig.enabled = true;\n if (this.isConnected()) {\n this.initializeDecoyChannels();\n }\n break;\n case 'hasPacketReordering':\n this.reorderingConfig.enabled = true;\n break;\n case 'hasAntiFingerprinting':\n this.antiFingerprintingConfig.enabled = true;\n break;\n case 'hasMessageChunking':\n this.chunkingConfig.enabled = true;\n break;\n }\n });\n \n this._secureLog('info', '\u2705 All security features enabled by default', {\n constraints: this.sessionConstraints,\n currentFeatures: this.securityFeatures\n });\n }\n deliverMessageToUI(message, type = 'received') {\n try {\n // Add debug logs\n this._secureLog('debug', '\uD83D\uDCE4 deliverMessageToUI called', {\n message: message,\n type: type,\n messageType: typeof message,\n hasOnMessage: !!this.onMessage\n });\n \n // Filter out file-transfer and system messages\n if (typeof message === 'object' && message.type) {\n const blockedTypes = [\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_START,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_CHUNK,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.CHUNK_CONFIRMATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_COMPLETE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_ERROR,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_BOTH_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.PEER_DISCONNECT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_SIGNAL,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_READY,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.SECURITY_UPGRADE\n ];\n if (blockedTypes.includes(message.type)) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83D\uDED1 Blocked system/file message from UI: ${message.type}`);\n }\n return; // do not show in chat\n }\n }\n\n // Additional check for string messages containing JSON\n if (typeof message === 'string' && message.trim().startsWith('{')) {\n try {\n const parsedMessage = JSON.parse(message);\n if (parsedMessage.type) {\n const blockedTypes = [\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_START,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_CHUNK,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.CHUNK_CONFIRMATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_COMPLETE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.FILE_TRANSFER_ERROR,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.HEARTBEAT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_RESPONSE,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.VERIFICATION_BOTH_CONFIRMED,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.PEER_DISCONNECT,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_SIGNAL,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.KEY_ROTATION_READY,\n EnhancedSecureWebRTCManager.MESSAGE_TYPES.SECURITY_UPGRADE\n ];\n if (blockedTypes.includes(parsedMessage.type)) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83D\uDED1 Blocked system/file message from UI (string): ${parsedMessage.type}`);\n }\n return; // do not show in chat\n }\n }\n } catch (parseError) {\n // Not JSON \u2014 fine for plain text messages\n }\n }\n\n if (this.onMessage) {\n this._secureLog('debug', '\uD83D\uDCE4 Calling this.onMessage callback', { message, type });\n this.onMessage(message, type);\n } else {\n this._secureLog('warn', '\u26A0\uFE0F this.onMessage callback is null or undefined');\n }\n } catch (err) {\n this._secureLog('error', '\u274C Failed to deliver message to UI:', { errorType: err?.constructor?.name || 'Unknown' });\n }\n }\n\n\n // Security Level Notification\n notifySecurityLevel() {\n // Avoid duplicate notifications for the same security level\n if (this.lastSecurityLevelNotification === this.currentSecurityLevel) {\n return; // prevent duplication\n }\n \n this.lastSecurityLevelNotification = this.currentSecurityLevel;\n \n const levelMessages = {\n 'basic': '\uD83D\uDD12 Basic Security Active - Demo session with essential protection',\n 'enhanced': '\uD83D\uDD10 Enhanced Security Active - Paid session with advanced protection',\n 'maximum': '\uD83D\uDEE1\uFE0F Maximum Security Active - Premium session with complete protection'\n };\n\n const message = levelMessages[this.currentSecurityLevel] || levelMessages['basic'];\n \n if (this.onMessage) {\n this.deliverMessageToUI(message, 'system');\n }\n\n // Showing details of functions for paid sessions\n if (this.currentSecurityLevel !== 'basic' && this.onMessage) {\n const activeFeatures = Object.entries(this.securityFeatures)\n .filter(([key, value]) => value === true)\n .map(([key]) => key.replace('has', '').replace(/([A-Z])/g, ' $1').trim().toLowerCase())\n .slice(0, 5); \n\n this.deliverMessageToUI(`\uD83D\uDD27 Active: ${activeFeatures.join(', ')}...`, 'system');\n }\n }\n\n // Cleaning decoy channels\n cleanupDecoyChannels() {\n // Stopping decoy traffic\n for (const [channelName, timer] of this.decoyTimers.entries()) {\n clearTimeout(timer);\n }\n this.decoyTimers.clear();\n \n // Closing decoy channels\n for (const [channelName, channel] of this.decoyChannels.entries()) {\n if (channel.readyState === 'open') {\n channel.close();\n }\n }\n this.decoyChannels.clear();\n \n this._secureLog('info', '\uD83E\uDDF9 Decoy channels cleaned up');\n }\n\n // ============================================\n // 1. NESTED ENCRYPTION LAYER\n // ============================================\n\n async generateNestedEncryptionKey() {\n try {\n // Generate additional encryption key for nested encryption\n this.nestedEncryptionKey = await crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt', 'decrypt']\n );\n \n // Generate random IV for nested encryption\n // No need for base IV or counter - each encryption gets fresh random IV\n // This ensures maximum entropy and prevents IV reuse attacks\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to generate nested encryption key:', { errorType: error?.constructor?.name || 'Unknown' });\n throw error;\n }\n }\n\n async applyNestedEncryption(data) {\n if (!this.nestedEncryptionKey || !this.securityFeatures.hasNestedEncryption) {\n return data;\n }\n\n try {\n // Generate cryptographically secure IV with reuse prevention\n const uniqueIV = this._generateSecureIV(\n EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE, \n 'nestedEncryption'\n );\n \n // Encrypt data with nested layer\n const encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv: uniqueIV },\n this.nestedEncryptionKey,\n data\n );\n \n // Combine IV and encrypted data\n const result = new Uint8Array(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE + encrypted.byteLength);\n result.set(uniqueIV, 0);\n result.set(new Uint8Array(encrypted), EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE);\n \n this._secureLog('debug', '\u2705 Nested encryption applied with secure IV', {\n ivSize: uniqueIV.length,\n dataSize: data.byteLength,\n encryptedSize: encrypted.byteLength\n });\n \n return result.buffer;\n } catch (error) {\n this._secureLog('error', '\u274C Nested encryption failed:', { \n errorType: error?.constructor?.name || 'Unknown',\n errorMessage: error?.message || 'Unknown error'\n });\n \n // If IV generation failed due to emergency mode, disable nested encryption\n if (error.message.includes('emergency mode')) {\n this.securityFeatures.hasNestedEncryption = false;\n this._secureLog('warn', '\u26A0\uFE0F Nested encryption disabled due to IV emergency mode');\n }\n \n return data; // Fallback to original data\n }\n }\n\n async removeNestedEncryption(data) {\n if (!this.nestedEncryptionKey || !this.securityFeatures.hasNestedEncryption) {\n return data;\n }\n\n // Check that the data is actually encrypted with proper IV size\n if (!(data instanceof ArrayBuffer) || data.byteLength < EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE + 16) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Data not encrypted or too short for nested decryption (need IV + minimum encrypted data)');\n }\n return data;\n }\n\n try {\n const dataArray = new Uint8Array(data);\n const iv = dataArray.slice(0, EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE);\n const encryptedData = dataArray.slice(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE);\n \n // Check that there is data to decrypt\n if (encryptedData.length === 0) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD No encrypted data found');\n }\n return data;\n }\n \n // Decrypt nested layer\n const decrypted = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: iv },\n this.nestedEncryptionKey,\n encryptedData\n );\n \n return decrypted;\n } catch (error) {\n // FIX: Better error handling\n if (error.name === 'OperationError') {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Data not encrypted with nested encryption, skipping...');\n }\n } else {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Nested decryption failed:', { details: error.message });\n }\n }\n return data; // Fallback to original data\n }\n }\n\n // ============================================\n // 2. PACKET PADDING\n // ============================================\n\n applyPacketPadding(data) {\n if (!this.securityFeatures.hasPacketPadding) {\n return data;\n }\n\n try {\n const originalSize = data.byteLength;\n let paddingSize;\n \n if (this.paddingConfig.useRandomPadding) {\n // Generate random padding size\n paddingSize = Math.floor(Math.random() * \n (this.paddingConfig.maxPadding - this.paddingConfig.minPadding + 1)) + \n this.paddingConfig.minPadding;\n } else {\n // Use fixed padding size\n paddingSize = this.paddingConfig.minPadding;\n }\n \n // Generate random padding data\n const padding = crypto.getRandomValues(new Uint8Array(paddingSize));\n \n // Create padded message\n const paddedData = new Uint8Array(originalSize + paddingSize + 4);\n \n // Add original size (4 bytes)\n const sizeView = new DataView(paddedData.buffer, 0, 4);\n sizeView.setUint32(0, originalSize, false);\n \n // Add original data\n paddedData.set(new Uint8Array(data), 4);\n \n // Add padding\n paddedData.set(padding, 4 + originalSize);\n \n return paddedData.buffer;\n } catch (error) {\n this._secureLog('error', '\u274C Packet padding failed:', { errorType: error?.constructor?.name || 'Unknown' });\n return data; // Fallback to original data\n }\n }\n\n removePacketPadding(data) {\n if (!this.securityFeatures.hasPacketPadding) {\n return data;\n }\n\n try {\n const dataArray = new Uint8Array(data);\n \n // Check for minimum data length (4 bytes for size + minimum 1 byte of data)\n if (dataArray.length < 5) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Data too short for packet padding removal, skipping');\n }\n return data;\n }\n \n // Extract original size (first 4 bytes)\n const sizeView = new DataView(dataArray.buffer, 0, 4);\n const originalSize = sizeView.getUint32(0, false);\n \n // Checking the reasonableness of the size\n if (originalSize <= 0 || originalSize > dataArray.length - 4) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Invalid packet padding size, skipping removal');\n }\n return data;\n }\n \n // Extract original data\n const originalData = dataArray.slice(4, 4 + originalSize);\n \n return originalData.buffer;\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C Packet padding removal failed:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n return data; // Fallback to original data\n }\n }\n\n // ============================================\n // 3. FAKE TRAFFIC GENERATION\n // ============================================\n\n startFakeTrafficGeneration() {\n if (!this.fakeTrafficConfig.enabled || !this.isConnected()) {\n return;\n }\n\n // Prevent multiple fake traffic generators\n if (this.fakeTrafficTimer) {\n this._secureLog('warn', '\u26A0\uFE0F Fake traffic generation already running');\n return;\n }\n\n const sendFakeMessage = async () => {\n if (!this.isConnected()) {\n this.stopFakeTrafficGeneration();\n return;\n }\n\n try {\n const fakeMessage = this.generateFakeMessage();\n await this.sendFakeMessage(fakeMessage);\n \n // FIX: Increase intervals to reduce load\n const nextInterval = this.fakeTrafficConfig.randomDecoyIntervals ? \n Math.random() * (this.fakeTrafficConfig.maxInterval - this.fakeTrafficConfig.minInterval) + \n this.fakeTrafficConfig.minInterval :\n this.fakeTrafficConfig.minInterval;\n \n // Minimum interval 15 seconds for stability\n const safeInterval = Math.max(nextInterval, EnhancedSecureWebRTCManager.TIMEOUTS.FAKE_TRAFFIC_MIN_INTERVAL);\n \n this.fakeTrafficTimer = setTimeout(sendFakeMessage, safeInterval);\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C Fake traffic generation failed:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n this.stopFakeTrafficGeneration();\n }\n };\n\n // Start fake traffic generation with longer initial delay\n const initialDelay = Math.random() * this.fakeTrafficConfig.maxInterval + EnhancedSecureWebRTCManager.TIMEOUTS.DECOY_INITIAL_DELAY; // Add 5 seconds minimum\n this.fakeTrafficTimer = setTimeout(sendFakeMessage, initialDelay);\n }\n\n stopFakeTrafficGeneration() {\n if (this.fakeTrafficTimer) {\n clearTimeout(this.fakeTrafficTimer);\n this.fakeTrafficTimer = null;\n }\n }\n\n generateFakeMessage() {\n const pattern = this.fakeTrafficConfig.patterns[\n Math.floor(Math.random() * this.fakeTrafficConfig.patterns.length)\n ];\n \n const size = Math.floor(Math.random() * \n (this.fakeTrafficConfig.maxSize - this.fakeTrafficConfig.minSize + 1)) + \n this.fakeTrafficConfig.minSize;\n \n const fakeData = crypto.getRandomValues(new Uint8Array(size));\n \n return {\n type: EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE, \n pattern: pattern,\n data: Array.from(fakeData).map(b => b.toString(16).padStart(2, '0')).join(''),\n timestamp: Date.now(),\n size: size,\n isFakeTraffic: true, \n source: 'fake_traffic_generator',\n fakeId: crypto.getRandomValues(new Uint32Array(1))[0].toString(36) \n };\n }\n\n // ============================================\n // EMERGENCY SHUT-OFF OF ADVANCED FUNCTIONS\n // ============================================\n\n emergencyDisableAdvancedFeatures() {\n this._secureLog('error', '\uD83D\uDEA8 Emergency disabling advanced security features due to errors');\n \n // Disable problematic functions\n this.securityFeatures.hasNestedEncryption = false;\n this.securityFeatures.hasPacketReordering = false;\n this.securityFeatures.hasAntiFingerprinting = false;\n \n // Disable configurations\n this.reorderingConfig.enabled = false;\n this.antiFingerprintingConfig.enabled = false;\n \n // Clear the buffers\n this.packetBuffer.clear();\n \n // Stopping fake traffic\n this.emergencyDisableFakeTraffic();\n \n this._secureLog('info', '\u2705 Advanced features disabled, keeping basic encryption');\n \n // Check that advanced-features-disabled notification wasn't already sent\n if (!this.advancedFeaturesDisabledNotificationSent) {\n this.advancedFeaturesDisabledNotificationSent = true;\n if (this.onMessage) {\n this.deliverMessageToUI('\uD83D\uDEA8 Advanced security features temporarily disabled due to compatibility issues', 'system');\n }\n }\n }\n\n async sendFakeMessage(fakeMessage) {\n if (!this._validateConnection(false)) {\n return;\n }\n\n try {\n this._secureLog('debug', '\uD83C\uDFAD Sending fake message', {\n hasPattern: !!fakeMessage.pattern,\n sizeRange: fakeMessage.size > 100 ? 'large' : 'small'\n });\n \n const fakeData = JSON.stringify({\n ...fakeMessage,\n type: EnhancedSecureWebRTCManager.MESSAGE_TYPES.FAKE, \n isFakeTraffic: true, \n timestamp: Date.now()\n });\n \n const fakeBuffer = new TextEncoder().encode(fakeData);\n const encryptedFake = await this.applySecurityLayers(fakeBuffer, true);\n this.dataChannel.send(encryptedFake);\n \n this._secureLog('debug', '\uD83C\uDFAD Fake message sent successfully', {\n pattern: fakeMessage.pattern\n });\n } catch (error) {\n this._secureLog('error', '\u274C Failed to send fake message', {\n error: error.message\n });\n }\n }\n\ncheckFakeTrafficStatus() {\n const status = {\n fakeTrafficEnabled: this.securityFeatures.hasFakeTraffic,\n fakeTrafficConfigEnabled: this.fakeTrafficConfig.enabled,\n timerActive: !!this.fakeTrafficTimer,\n patterns: this.fakeTrafficConfig.patterns,\n intervals: {\n min: this.fakeTrafficConfig.minInterval,\n max: this.fakeTrafficConfig.maxInterval\n }\n };\n \n if (this._debugMode) {\n this._secureLog('info', '\uD83C\uDFAD Fake Traffic Status', { status });\n }\n return status;\n }\nemergencyDisableFakeTraffic() {\n if (this._debugMode) {\n this._secureLog('error', '\uD83D\uDEA8 Emergency disabling fake traffic');\n }\n \n this.securityFeatures.hasFakeTraffic = false;\n this.fakeTrafficConfig.enabled = false;\n this.stopFakeTrafficGeneration();\n \n if (this._debugMode) {\n this._secureLog('info', '\u2705 Fake traffic disabled');\n }\n \n // Check that fake-traffic-disabled notification wasn't already sent\n if (!this.fakeTrafficDisabledNotificationSent) {\n this.fakeTrafficDisabledNotificationSent = true;\n if (this.onMessage) {\n this.deliverMessageToUI('\uD83D\uDEA8 Fake traffic emergency disabled', 'system');\n }\n }\n }\n async _applySecurityLayersWithoutMutex(data, isFakeMessage = false) {\n try {\n let processedData = data;\n \n if (isFakeMessage) {\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n return processedData;\n }\n \n // Nested Encryption (if enabled)\n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey && processedData instanceof ArrayBuffer) {\n processedData = await this.applyNestedEncryption(processedData);\n }\n \n // Packet Reordering (if enabled)\n if (this.securityFeatures.hasPacketReordering && this.reorderingConfig?.enabled && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketReordering(processedData);\n }\n \n // Packet Padding (if enabled)\n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketPadding(processedData);\n }\n \n // Anti-Fingerprinting (if enabled)\n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n processedData = this.applyAntiFingerprinting(processedData);\n }\n \n // Final encryption (if keys are present)\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n \n return processedData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in applySecurityLayersWithoutMutex:', { errorType: error?.constructor?.name || 'Unknown' });\n return data; // Return original data on error\n }\n}\n // ============================================\n // 4. MESSAGE CHUNKING\n // ============================================\n\n async processChunkedMessage(chunkData) {\n try {\n if (!this.chunkingConfig.addChunkHeaders) {\n // No headers, treat as regular message\n return this.processMessage(chunkData);\n }\n\n const chunkArray = new Uint8Array(chunkData);\n if (chunkArray.length < 16) {\n // Too small to be a chunk with header\n return this.processMessage(chunkData);\n }\n\n // Extract chunk header\n const headerView = new DataView(chunkArray.buffer, 0, 16);\n const messageId = headerView.getUint32(0, false);\n const chunkIndex = headerView.getUint32(4, false);\n const totalChunks = headerView.getUint32(8, false);\n const chunkSize = headerView.getUint32(12, false);\n\n // Extract chunk data\n const chunk = chunkArray.slice(16, 16 + chunkSize);\n\n // Store chunk in buffer\n if (!this.chunkQueue[messageId]) {\n this.chunkQueue[messageId] = {\n chunks: new Array(totalChunks),\n received: 0,\n timestamp: Date.now()\n };\n }\n\n const messageBuffer = this.chunkQueue[messageId];\n messageBuffer.chunks[chunkIndex] = chunk;\n messageBuffer.received++;\n\n this._secureLog('debug', `\uD83D\uDCE6 Received chunk ${chunkIndex + 1}/${totalChunks} for message ${messageId}`);\n\n // Check if all chunks received\n if (messageBuffer.received === totalChunks) {\n // Combine all chunks\n const totalSize = messageBuffer.chunks.reduce((sum, chunk) => sum + chunk.length, 0);\n const combinedData = new Uint8Array(totalSize);\n \n let offset = 0;\n for (const chunk of messageBuffer.chunks) {\n combinedData.set(chunk, offset);\n offset += chunk.length;\n }\n\n // Process complete message\n await this.processMessage(combinedData.buffer);\n \n // Clean up\n delete this.chunkQueue[messageId];\n \n this._secureLog('info', `\uD83D\uDCE6 Chunked message ${messageId} reassembled and processed`);\n }\n } catch (error) {\n this._secureLog('error', '\u274C Chunked message processing failed:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n\n // ============================================\n // 5. DECOY CHANNELS\n // ============================================\n\n initializeDecoyChannels() {\n if (!this.decoyChannelConfig.enabled || !this.peerConnection) {\n return;\n }\n\n // Prevent multiple initializations\n if (this.decoyChannels.size > 0) {\n this._secureLog('warn', '\u26A0\uFE0F Decoy channels already initialized, skipping...');\n return;\n }\n\n try {\n const numDecoyChannels = Math.min(\n this.decoyChannelConfig.maxDecoyChannels,\n this.decoyChannelConfig.decoyChannelNames.length\n );\n\n for (let i = 0; i < numDecoyChannels; i++) {\n const channelName = this.decoyChannelConfig.decoyChannelNames[i];\n const decoyChannel = this.peerConnection.createDataChannel(channelName, {\n ordered: Math.random() > 0.5,\n maxRetransmits: Math.floor(Math.random() * 3)\n });\n\n this.setupDecoyChannel(decoyChannel, channelName);\n this.decoyChannels.set(channelName, decoyChannel);\n }\n\n if (this._debugMode) {\n this._secureLog('info', `\uD83C\uDFAD Initialized ${numDecoyChannels} decoy channels`);\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', '\u274C Failed to initialize decoy channels:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n }\n\n setupDecoyChannel(channel, channelName) {\n channel.onopen = () => {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Decoy channel \"${channelName}\" opened`);\n }\n this.startDecoyTraffic(channel, channelName);\n };\n\n channel.onmessage = (event) => {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Received decoy message on \"${channelName}\": ${event.data?.length || 'undefined'} bytes`);\n }\n };\n\n channel.onclose = () => {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Decoy channel \"${channelName}\" closed`);\n }\n this.stopDecoyTraffic(channelName);\n };\n\n channel.onerror = (error) => {\n if (this._debugMode) {\n this._secureLog('error', `\u274C Decoy channel \"${channelName}\" error`, { error: error.message });\n }\n };\n }\n\n startDecoyTraffic(channel, channelName) {\n const sendDecoyData = async () => {\n if (channel.readyState !== 'open') {\n return;\n }\n\n try {\n const decoyData = this.generateDecoyData(channelName);\n channel.send(decoyData);\n \n const interval = this.decoyChannelConfig.randomDecoyIntervals ?\n Math.random() * 15000 + 10000 : \n 20000; \n \n this.decoyTimers.set(channelName, setTimeout(() => sendDecoyData(), interval));\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('error', `\u274C Failed to send decoy data on \"${channelName}\"`, { error: error.message });\n }\n }\n };\n\n const initialDelay = Math.random() * 10000 + 5000; \n this.decoyTimers.set(channelName, setTimeout(() => sendDecoyData(), initialDelay));\n }\n\n stopDecoyTraffic(channelName) {\n const timer = this.decoyTimers.get(channelName);\n if (timer) {\n clearTimeout(timer);\n this.decoyTimers.delete(channelName);\n }\n }\n\n generateDecoyData(channelName) {\n const decoyTypes = {\n 'sync': () => JSON.stringify({\n type: 'sync',\n timestamp: Date.now(),\n sequence: Math.floor(Math.random() * 1000),\n data: Array.from(crypto.getRandomValues(new Uint8Array(32)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'status': () => JSON.stringify({\n type: 'status',\n status: ['online', 'away', 'busy'][Math.floor(Math.random() * 3)],\n uptime: Math.floor(Math.random() * 3600),\n data: Array.from(crypto.getRandomValues(new Uint8Array(16)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'heartbeat': () => JSON.stringify({\n type: 'heartbeat',\n timestamp: Date.now(),\n data: Array.from(crypto.getRandomValues(new Uint8Array(24)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'metrics': () => JSON.stringify({\n type: 'metrics',\n cpu: Math.random() * 100,\n memory: Math.random() * 100,\n network: Math.random() * 1000,\n data: Array.from(crypto.getRandomValues(new Uint8Array(20)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n }),\n 'debug': () => JSON.stringify({\n type: 'debug',\n level: ['info', 'warn', 'error'][Math.floor(Math.random() * 3)],\n message: 'Debug message',\n data: Array.from(crypto.getRandomValues(new Uint8Array(28)))\n .map(b => b.toString(16).padStart(2, '0')).join('')\n })\n };\n\n return decoyTypes[channelName] ? decoyTypes[channelName]() : \n Array.from(crypto.getRandomValues(new Uint8Array(64)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n }\n\n // ============================================\n // 6. PACKET REORDERING PROTECTION\n // ============================================\n\n addReorderingHeaders(data) {\n if (!this.reorderingConfig.enabled) {\n return data;\n }\n\n try {\n const dataArray = new Uint8Array(data);\n const headerSize = this.reorderingConfig.useTimestamps ? 12 : 8;\n const header = new ArrayBuffer(headerSize);\n const headerView = new DataView(header);\n\n // Add sequence number\n if (this.reorderingConfig.useSequenceNumbers) {\n headerView.setUint32(0, this.sequenceNumber++, false);\n }\n\n // Add timestamp\n if (this.reorderingConfig.useTimestamps) {\n headerView.setUint32(4, Date.now(), false);\n }\n\n // Add data size\n headerView.setUint32(this.reorderingConfig.useTimestamps ? 8 : 4, dataArray.length, false);\n\n // Combine header and data\n const result = new Uint8Array(headerSize + dataArray.length);\n result.set(new Uint8Array(header), 0);\n result.set(dataArray, headerSize);\n\n return result.buffer;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to add reordering headers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }\n\n async processReorderedPacket(data) {\n if (!this.reorderingConfig.enabled) {\n return this.processMessage(data);\n }\n\n try {\n const dataArray = new Uint8Array(data);\n const headerSize = this.reorderingConfig.useTimestamps ? 12 : 8;\n\n if (dataArray.length < headerSize) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Data too short for reordering headers, processing directly');\n }\n return this.processMessage(data);\n }\n\n const headerView = new DataView(dataArray.buffer, 0, headerSize);\n let sequence = 0;\n let timestamp = 0;\n let dataSize = 0;\n\n if (this.reorderingConfig.useSequenceNumbers) {\n sequence = headerView.getUint32(0, false);\n }\n\n if (this.reorderingConfig.useTimestamps) {\n timestamp = headerView.getUint32(4, false);\n }\n\n dataSize = headerView.getUint32(this.reorderingConfig.useTimestamps ? 8 : 4, false);\n\n if (dataSize > dataArray.length - headerSize || dataSize <= 0) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Invalid reordered packet data size, processing directly');\n }\n return this.processMessage(data);\n }\n\n const actualData = dataArray.slice(headerSize, headerSize + dataSize);\n\n try {\n const textData = new TextDecoder().decode(actualData);\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Reordered fake message: ${content.pattern || 'unknown'}`);\n }\n return; \n }\n } catch (e) {\n\n }\n\n this.packetBuffer.set(sequence, {\n data: actualData.buffer,\n timestamp: timestamp || Date.now()\n });\n\n await this.processOrderedPackets();\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to process reordered packet:', { errorType: error?.constructor?.name || 'Unknown' });\n return this.processMessage(data);\n }\n}\n\n// ============================================\n// IMPROVED PROCESSORDEREDPACKETS with filtering\n// ============================================\n\nasync processOrderedPackets() {\n const now = Date.now();\n const timeout = this.reorderingConfig.reorderTimeout;\n\n while (true) {\n const nextSequence = this.lastProcessedSequence + 1;\n const packet = this.packetBuffer.get(nextSequence);\n\n if (!packet) {\n const oldestPacket = this.findOldestPacket();\n if (oldestPacket && (now - oldestPacket.timestamp) > timeout) {\n this._secureLog('warn', '\u26A0\uFE0F Packet ${oldestPacket.sequence} timed out, processing out of order');\n \n try {\n const textData = new TextDecoder().decode(oldestPacket.data);\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Timed out fake message: ${content.pattern || 'unknown'}`);\n this.packetBuffer.delete(oldestPacket.sequence);\n this.lastProcessedSequence = oldestPacket.sequence;\n continue; \n }\n } catch (e) {\n }\n \n await this.processMessage(oldestPacket.data);\n this.packetBuffer.delete(oldestPacket.sequence);\n this.lastProcessedSequence = oldestPacket.sequence;\n } else {\n break; \n }\n } else {\n try {\n const textData = new TextDecoder().decode(packet.data);\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Ordered fake message: ${content.pattern || 'unknown'}`);\n this.packetBuffer.delete(nextSequence);\n this.lastProcessedSequence = nextSequence;\n continue; \n }\n } catch (e) {\n }\n \n await this.processMessage(packet.data);\n this.packetBuffer.delete(nextSequence);\n this.lastProcessedSequence = nextSequence;\n }\n }\n\n this.cleanupOldPackets(now, timeout);\n}\n\n\n findOldestPacket() {\n let oldest = null;\n for (const [sequence, packet] of this.packetBuffer.entries()) {\n if (!oldest || packet.timestamp < oldest.timestamp) {\n oldest = { sequence, ...packet };\n }\n }\n return oldest;\n }\n\n cleanupOldPackets(now, timeout) {\n for (const [sequence, packet] of this.packetBuffer.entries()) {\n if ((now - packet.timestamp) > timeout) {\n this._secureLog('warn', '\u26A0\uFE0F \uD83D\uDDD1\uFE0F Removing timed out packet ${sequence}');\n this.packetBuffer.delete(sequence);\n }\n }\n }\n\n // ============================================\n // 7. ANTI-FINGERPRINTING\n // ============================================\n\n applyAntiFingerprinting(data) {\n if (!this.antiFingerprintingConfig.enabled) {\n return data;\n }\n\n try {\n let processedData = data;\n\n // Add random noise\n if (this.antiFingerprintingConfig.addNoise) {\n processedData = this.addNoise(processedData);\n }\n\n // Randomize sizes\n if (this.antiFingerprintingConfig.randomizeSizes) {\n processedData = this.randomizeSize(processedData);\n }\n\n // Mask patterns\n if (this.antiFingerprintingConfig.maskPatterns) {\n processedData = this.maskPatterns(processedData);\n }\n\n // Add random headers\n if (this.antiFingerprintingConfig.useRandomHeaders) {\n processedData = this.addRandomHeaders(processedData);\n }\n\n return processedData;\n } catch (error) {\n this._secureLog('error', '\u274C Anti-fingerprinting failed:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }\n\n addNoise(data) {\n const dataArray = new Uint8Array(data);\n const noiseSize = Math.floor(Math.random() * 32) + 8; // 8-40 bytes\n const noise = crypto.getRandomValues(new Uint8Array(noiseSize));\n \n const result = new Uint8Array(dataArray.length + noiseSize);\n result.set(dataArray, 0);\n result.set(noise, dataArray.length);\n \n return result.buffer;\n }\n\n randomizeSize(data) {\n const dataArray = new Uint8Array(data);\n const variation = this.fingerprintMask.sizeVariation;\n const targetSize = Math.floor(dataArray.length * variation);\n \n if (targetSize > dataArray.length) {\n // Add padding to increase size\n const padding = crypto.getRandomValues(new Uint8Array(targetSize - dataArray.length));\n const result = new Uint8Array(targetSize);\n result.set(dataArray, 0);\n result.set(padding, dataArray.length);\n return result.buffer;\n } else if (targetSize < dataArray.length) {\n // Truncate to decrease size\n return dataArray.slice(0, targetSize).buffer;\n }\n \n return data;\n }\n\n maskPatterns(data) {\n const dataArray = new Uint8Array(data);\n const result = new Uint8Array(dataArray.length);\n \n // Apply XOR with noise pattern\n for (let i = 0; i < dataArray.length; i++) {\n const noiseByte = this.fingerprintMask.noisePattern[i % this.fingerprintMask.noisePattern.length];\n result[i] = dataArray[i] ^ noiseByte;\n }\n \n return result.buffer;\n }\n\n addRandomHeaders(data) {\n const dataArray = new Uint8Array(data);\n const headerCount = Math.floor(Math.random() * 3) + 1; // 1-3 headers\n let totalHeaderSize = 0;\n \n // Calculate total header size\n for (let i = 0; i < headerCount; i++) {\n totalHeaderSize += 4 + Math.floor(Math.random() * 16) + 4; // size + data + checksum\n }\n \n const result = new Uint8Array(totalHeaderSize + dataArray.length);\n let offset = 0;\n \n // Add random headers\n for (let i = 0; i < headerCount; i++) {\n const headerName = this.fingerprintMask.headerVariations[\n Math.floor(Math.random() * this.fingerprintMask.headerVariations.length)\n ];\n const headerData = crypto.getRandomValues(new Uint8Array(Math.floor(Math.random() * 16) + 4));\n \n // Header structure: [size:4][name:4][data:variable][checksum:4]\n const headerView = new DataView(result.buffer, offset);\n headerView.setUint32(0, headerData.length + 8, false); // Total header size\n headerView.setUint32(4, this.hashString(headerName), false); // Name hash\n \n result.set(headerData, offset + 8);\n \n // Add checksum\n const checksum = this.calculateChecksum(result.slice(offset, offset + 8 + headerData.length));\n const checksumView = new DataView(result.buffer, offset + 8 + headerData.length);\n checksumView.setUint32(0, checksum, false);\n \n offset += 8 + headerData.length + 4;\n }\n \n // Add original data\n result.set(dataArray, offset);\n \n return result.buffer;\n }\n\n hashString(str) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash;\n }\n return Math.abs(hash);\n }\n\n calculateChecksum(data) {\n let checksum = 0;\n for (let i = 0; i < data.length; i++) {\n checksum = (checksum + data[i]) & 0xFFFFFFFF;\n }\n return checksum;\n }\n\n // ============================================\n // ENHANCED MESSAGE SENDING AND RECEIVING\n // ============================================\n\n async removeSecurityLayers(data) {\n try {\n const status = this.getSecurityStatus();\n if (this._debugMode) {\n this._secureLog('debug', `\uD83D\uDD0D removeSecurityLayers (Stage ${status.stage})`, {\n dataType: typeof data,\n dataLength: data?.length || data?.byteLength || 0,\n activeFeatures: status.activeFeaturesCount\n });\n }\n\n if (!data) {\n this._secureLog('warn', '\u26A0\uFE0F Received empty data');\n return null;\n }\n\n let processedData = data;\n\n // IMPORTANT: Early check for fake messages\n if (typeof data === 'string') {\n try {\n const jsonData = JSON.parse(data);\n \n // PRIORITY ONE: Filtering out fake messages\n if (jsonData.type === 'fake') {\n if (this._debugMode) {\n this._secureLog('debug', `\uD83C\uDFAD Fake message filtered out: ${jsonData.pattern} (size: ${jsonData.size})`);\n }\n return 'FAKE_MESSAGE_FILTERED'; \n }\n \n // System messages \u2014 do NOT return for re-processing\n if (jsonData.type && ['heartbeat', 'verification', 'verification_response', 'peer_disconnect', 'key_rotation_signal', 'key_rotation_ready', 'security_upgrade'].includes(jsonData.type)) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDD27 System message detected, blocking from chat', { type: jsonData.type });\n }\n return 'SYSTEM_MESSAGE_FILTERED';\n }\n \n // File transfer messages \u2014 do NOT return for display\n if (jsonData.type && ['file_transfer_start', 'file_transfer_response', 'file_chunk', 'chunk_confirmation', 'file_transfer_complete', 'file_transfer_error'].includes(jsonData.type)) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCC1 File transfer message detected, blocking from chat', { type: jsonData.type });\n }\n return 'FILE_MESSAGE_FILTERED';\n }\n \n // Regular text messages - extract the actual message text\n if (jsonData.type === 'message') {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, extracting text', { data: jsonData.data });\n }\n return jsonData.data; // Return the actual message text, not the JSON\n }\n \n // Enhanced messages\n if (jsonData.type === 'enhanced_message' && jsonData.data) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDD10 Enhanced message detected, decrypting...');\n }\n \n if (!this.encryptionKey || !this.macKey || !this.metadataKey) {\n this._secureLog('error', '\u274C Missing encryption keys');\n return null;\n }\n \n const decryptedResult = await window.EnhancedSecureCryptoUtils.decryptMessage(\n jsonData.data,\n this.encryptionKey,\n this.macKey,\n this.metadataKey\n );\n \n if (this._debugMode) {\n this._secureLog('debug', '\u2705 Enhanced message decrypted, extracting...');\n this._secureLog('debug', '\uD83D\uDD0D decryptedResult', {\n type: typeof decryptedResult,\n hasMessage: !!decryptedResult?.message,\n messageType: typeof decryptedResult?.message,\n messageLength: decryptedResult?.message?.length || 0,\n messageSample: decryptedResult?.message?.substring(0, 50) || 'no message'\n });\n }\n \n // CHECKING FOR FAKE MESSAGES AFTER DECRYPTION\n try {\n const decryptedContent = JSON.parse(decryptedResult.message);\n if (decryptedContent.type === 'fake' || decryptedContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Encrypted fake message: ${decryptedContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Decrypted content is not JSON, treating as plain text message');\n }\n }\n \n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCE4 Returning decrypted message', { message: decryptedResult.message?.substring(0, 50) });\n }\n return decryptedResult.message;\n }\n \n // Regular messages\n if (jsonData.type === 'message' && jsonData.data) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, extracting data');\n }\n return jsonData.data; // Return the actual message text\n }\n \n // If it's a regular message with type 'message', let it continue processing\n if (jsonData.type === 'message') {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, returning for display');\n }\n return data; // Return the original JSON string for processing\n }\n \n // If it's not a special type, return the original data for display\n if (!jsonData.type || (jsonData.type !== 'fake' && !['heartbeat', 'verification', 'verification_response', 'peer_disconnect', 'key_rotation_signal', 'key_rotation_ready', 'enhanced_message', 'security_upgrade', 'file_transfer_start', 'file_transfer_response', 'file_chunk', 'chunk_confirmation', 'file_transfer_complete', 'file_transfer_error'].includes(jsonData.type))) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCDD Regular message detected, returning for display');\n }\n return data;\n }\n } catch (e) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDCC4 Not JSON, processing as raw data');\n }\n // If it's not JSON, it might be a plain text message - return as-is\n return data;\n }\n }\n\n // Standard Decryption\n if (this.encryptionKey && typeof processedData === 'string' && processedData.length > 50) {\n try {\n const base64Regex = /^[A-Za-z0-9+/=]+$/;\n if (base64Regex.test(processedData.trim())) {\n if (this._debugMode) {\n this._secureLog('debug', '\uD83D\uDD13 Applying standard decryption...');\n }\n processedData = await window.EnhancedSecureCryptoUtils.decryptData(processedData, this.encryptionKey);\n if (this._debugMode) {\n this._secureLog('debug', '\u2705 Standard decryption successful');\n }\n \n // CHECKING FOR FAKE MESSAGES AFTER LEGACY DECRYPTION\n if (typeof processedData === 'string') {\n try {\n const legacyContent = JSON.parse(processedData);\n if (legacyContent.type === 'fake' || legacyContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Legacy fake message: ${legacyContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n \n }\n processedData = new TextEncoder().encode(processedData).buffer;\n }\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Standard decryption failed:', { details: error.message });\n }\n return data; \n }\n }\n\n if (this.securityFeatures.hasNestedEncryption && \n this.nestedEncryptionKey && \n processedData instanceof ArrayBuffer &&\n processedData.byteLength > 12) { \n \n try {\n processedData = await this.removeNestedEncryption(processedData);\n \n if (processedData instanceof ArrayBuffer) {\n try {\n const textData = new TextDecoder().decode(processedData);\n const nestedContent = JSON.parse(textData);\n if (nestedContent.type === 'fake' || nestedContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Nested fake message: ${nestedContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n \n }\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Nested decryption failed - skipping this layer:', { details: error.message });\n }\n }\n }\n\n if (this.securityFeatures.hasPacketReordering && \n this.reorderingConfig.enabled && \n processedData instanceof ArrayBuffer) {\n try {\n const headerSize = this.reorderingConfig.useTimestamps ? 12 : 8;\n if (processedData.byteLength > headerSize) {\n return await this.processReorderedPacket(processedData);\n }\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Reordering processing failed - using direct processing:', { details: error.message });\n }\n }\n }\n\n // Packet Padding Removal\n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removePacketPadding(processedData);\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Padding removal failed:', { details: error.message });\n }\n }\n }\n\n // Anti-Fingerprinting Removal\n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removeAntiFingerprinting(processedData);\n } catch (error) {\n if (this._debugMode) {\n this._secureLog('warn', '\u26A0\uFE0F Anti-fingerprinting removal failed:', { details: error.message });\n }\n }\n }\n\n // Final transformation\n if (processedData instanceof ArrayBuffer) {\n processedData = new TextDecoder().decode(processedData);\n }\n\n if (typeof processedData === 'string') {\n try {\n const finalContent = JSON.parse(processedData);\n if (finalContent.type === 'fake' || finalContent.isFakeTraffic === true) {\n if (this._debugMode) {\n this._secureLog('warn', `\uD83C\uDFAD BLOCKED: Final check fake message: ${finalContent.pattern || 'unknown'}`);\n }\n return 'FAKE_MESSAGE_FILTERED';\n }\n } catch (e) {\n }\n }\n\n return processedData;\n\n } catch (error) {\n this._secureLog('error', '\u274C Critical error in removeSecurityLayers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n}\n\n removeAntiFingerprinting(data) {\n // This is a simplified version - in practice, you'd need to reverse all operations\n // For now, we'll just return the data as-is since the operations are mostly additive\n return data;\n }\n\n async applySecurityLayers(data, isFakeMessage = false) {\n try {\n let processedData = data;\n \n if (isFakeMessage) {\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n return processedData;\n }\n \n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey && processedData instanceof ArrayBuffer) {\n processedData = await this.applyNestedEncryption(processedData);\n }\n \n if (this.securityFeatures.hasPacketReordering && this.reorderingConfig?.enabled && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketReordering(processedData);\n }\n \n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketPadding(processedData);\n }\n \n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n processedData = this.applyAntiFingerprinting(processedData);\n }\n \n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n \n return processedData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in applySecurityLayers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }\n\n async sendMessage(data) {\n // Comprehensive input validation\n const validation = this._validateInputData(data, 'sendMessage');\n if (!validation.isValid) {\n const errorMessage = `Input validation failed: ${validation.errors.join(', ')}`;\n this._secureLog('error', '\u274C Input validation failed in sendMessage', {\n errors: validation.errors,\n dataType: typeof data,\n dataLength: data?.length || data?.byteLength || 0\n });\n throw new Error(errorMessage);\n }\n\n // Rate limiting check\n if (!this._checkRateLimit('sendMessage')) {\n throw new Error('Rate limit exceeded for message sending');\n }\n\n // Enforce verification gate\n this._enforceVerificationGate('sendMessage');\n\n // Connection validation\n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n throw new Error('Data channel not ready');\n }\n\n try {\n this._secureLog('debug', 'sendMessage called', {\n hasDataChannel: !!this.dataChannel,\n dataChannelReady: this.dataChannel?.readyState === 'open',\n isInitiator: this.isInitiator,\n isVerified: this.isVerified,\n connectionReady: this.peerConnection?.connectionState === 'connected'\n });\n\n this._secureLog('debug', '\uD83D\uDD0D sendMessage DEBUG', {\n dataType: typeof validation.sanitizedData,\n isString: typeof validation.sanitizedData === 'string',\n isArrayBuffer: validation.sanitizedData instanceof ArrayBuffer,\n dataLength: validation.sanitizedData?.length || validation.sanitizedData?.byteLength || 0,\n });\n\n // CRITICAL SECURITY FIX: File messages MUST be encrypted\n // No more bypassing encryption for file_* messages\n if (typeof validation.sanitizedData === 'string') {\n try {\n const parsed = JSON.parse(validation.sanitizedData);\n \n if (parsed.type && parsed.type.startsWith('file_')) {\n this._secureLog('debug', '\uD83D\uDCC1 File message detected - applying full encryption with AAD', { type: parsed.type });\n \n // Create AAD for file message\n const aad = this._createFileMessageAAD(parsed.type, parsed.data);\n \n // Encrypt file message with AAD\n const encryptedData = await this._encryptFileMessage(validation.sanitizedData, aad);\n \n this.dataChannel.send(encryptedData);\n return true;\n }\n } catch (jsonError) {\n // Not JSON \u2014 continue normal handling\n }\n }\n\n // For regular text messages, send via secure path with AAD\n if (typeof validation.sanitizedData === 'string') {\n // Verify that _createMessageAAD method is available\n if (typeof this._createMessageAAD !== 'function') {\n throw new Error('_createMessageAAD method is not available. Manager may not be fully initialized.');\n }\n \n // Create AAD with sequence number for anti-replay protection\n const aad = this._createMessageAAD('message', { content: validation.sanitizedData });\n \n return await this.sendSecureMessage({ \n type: 'message', \n data: validation.sanitizedData, \n timestamp: Date.now(),\n aad: aad // Include AAD for sequence number validation\n });\n }\n\n // For binary data, apply security layers with a limited mutex\n this._secureLog('debug', '\uD83D\uDD10 Applying security layers to non-string data');\n const securedData = await this._applySecurityLayersWithLimitedMutex(validation.sanitizedData, false);\n this.dataChannel.send(securedData);\n \n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to send message', { \n error: error.message,\n errorType: error.constructor.name\n });\n throw error;\n }\n }\n\n // FIX: New method applying security layers with limited mutex use\n async _applySecurityLayersWithLimitedMutex(data, isFakeMessage = false) {\n // Use mutex ONLY for cryptographic operations\n return this._withMutex('cryptoOperation', async (operationId) => {\n try {\n let processedData = data;\n \n if (isFakeMessage) {\n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n return processedData;\n }\n \n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey && processedData instanceof ArrayBuffer) {\n processedData = await this.applyNestedEncryption(processedData);\n }\n \n if (this.securityFeatures.hasPacketReordering && this.reorderingConfig?.enabled && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketReordering(processedData);\n }\n \n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n processedData = this.applyPacketPadding(processedData);\n }\n \n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n processedData = this.applyAntiFingerprinting(processedData);\n }\n \n if (this.encryptionKey && typeof processedData === 'string') {\n processedData = await window.EnhancedSecureCryptoUtils.encryptData(processedData, this.encryptionKey);\n }\n \n return processedData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in applySecurityLayers:', { errorType: error?.constructor?.name || 'Unknown' });\n return data;\n }\n }, 3000); // Short timeout for crypto operations\n}\n\n async sendSystemMessage(messageData) {\n // Block system messages without verification\n // Exception: Allow verification-related system messages\n const isVerificationMessage = messageData.type === 'verification_request' || \n messageData.type === 'verification_response' ||\n messageData.type === 'verification_required';\n \n if (!isVerificationMessage) {\n this._enforceVerificationGate('sendSystemMessage', false);\n }\n \n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n this._secureLog('warn', '\u26A0\uFE0F Cannot send system message - data channel not ready');\n return false;\n }\n\n try {\n const systemMessage = JSON.stringify({\n type: messageData.type,\n data: messageData,\n timestamp: Date.now()\n });\n\n this._secureLog('debug', '\uD83D\uDD27 Sending system message', { type: messageData.type });\n this.dataChannel.send(systemMessage);\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to send system message:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n\n // FIX 1: Simplified mutex system for message processing\nasync processMessage(data) {\n try {\n this._secureLog('debug', '\uFFFD\uFFFD Processing message', {\n dataType: typeof data,\n isArrayBuffer: data instanceof ArrayBuffer,\n hasData: !!(data?.length || data?.byteLength)\n });\n \n // CRITICAL: Early check for file messages WITHOUT mutex\n if (typeof data === 'string') {\n try {\n const parsed = JSON.parse(data);\n\n // ============================================\n // FILE MESSAGES \u2014 PRIORITY 1 (WITHOUT MUTEX)\n // ============================================\n \n const fileMessageTypes = [\n 'file_transfer_start',\n 'file_transfer_response',\n 'file_chunk', \n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error'\n ];\n\n // CRITICAL SECURITY FIX: Check for encrypted file messages first\n if (parsed.type === 'encrypted_file_message') {\n this._secureLog('debug', '\uD83D\uDCC1 Encrypted file message detected in processMessage');\n \n try {\n // Decrypt and validate file message\n const { decryptedData, aad } = await this._decryptFileMessage(data);\n \n // Parse decrypted data\n const decryptedParsed = JSON.parse(decryptedData);\n \n this._secureLog('debug', '\uD83D\uDCC1 File message decrypted successfully', { \n type: decryptedParsed.type,\n aadMessageType: aad.messageType \n });\n \n // Process decrypted file message\n if (this.fileTransferSystem && typeof this.fileTransferSystem.handleFileMessage === 'function') {\n await this.fileTransferSystem.handleFileMessage(decryptedParsed);\n return;\n }\n } catch (error) {\n this._secureLog('error', '\u274C Failed to decrypt file message', { error: error.message });\n return; // Drop invalid file message\n }\n }\n \n // Legacy unencrypted file messages - should not happen in secure mode\n if (parsed.type && fileMessageTypes.includes(parsed.type)) {\n this._secureLog('warn', '\u26A0\uFE0F Unencrypted file message detected - this should not happen in secure mode', { type: parsed.type });\n \n // Drop unencrypted file messages for security\n this._secureLog('error', '\u274C Dropping unencrypted file message for security', { type: parsed.type });\n return;\n }\n \n // ============================================\n // ENHANCED MESSAGES WITH AAD VALIDATION (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'enhanced_message') {\n this._secureLog('debug', '\uD83D\uDD10 Enhanced message detected in processMessage');\n \n try {\n // Decrypt enhanced message\n const decryptedData = await window.EnhancedSecureCryptoUtils.decryptMessage(\n parsed.data,\n this.encryptionKey,\n this.macKey,\n this.metadataKey\n );\n \n // Parse decrypted data\n const decryptedParsed = JSON.parse(decryptedData.data);\n \n // Validate AAD with sequence number\n if (decryptedData.metadata && decryptedData.metadata.sequenceNumber !== undefined) {\n if (!this._validateIncomingSequenceNumber(decryptedData.metadata.sequenceNumber, 'enhanced_message')) {\n this._secureLog('warn', '\u26A0\uFE0F Enhanced message sequence number validation failed - possible replay attack', {\n received: decryptedData.metadata.sequenceNumber,\n expected: this.expectedSequenceNumber\n });\n return; // Drop message with invalid sequence number\n }\n }\n \n // Process decrypted message\n if (decryptedParsed.type === 'message' && this.onMessage && decryptedParsed.data) {\n this.deliverMessageToUI(decryptedParsed.data, 'received');\n }\n \n return;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to decrypt enhanced message', { error: error.message });\n return; // Drop invalid enhanced message\n }\n }\n \n // ============================================\n // REGULAR USER MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'message') {\n this._secureLog('debug', '\uD83D\uDCDD Regular user message detected in processMessage');\n if (this.onMessage && parsed.data) {\n this.deliverMessageToUI(parsed.data, 'received');\n }\n return;\n }\n \n // ============================================\n // SYSTEM MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type && ['heartbeat', 'verification', 'verification_response', 'verification_confirmed', 'verification_both_confirmed', 'peer_disconnect', 'security_upgrade'].includes(parsed.type)) {\n this.handleSystemMessage(parsed);\n return;\n }\n \n // ============================================\n // FAKE MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'fake') {\n this._secureLog('warn', '\uD83C\uDFAD Fake message blocked in processMessage', { pattern: parsed.pattern });\n return;\n }\n \n } catch (jsonError) {\n // Not JSON \u2014 treat as text WITHOUT mutex\n if (this.onMessage) {\n this.deliverMessageToUI(data, 'received');\n }\n return;\n }\n }\n\n // ============================================\n // ENCRYPTED DATA PROCESSING (WITH MUTEX ONLY FOR CRYPTO)\n // ============================================\n \n // If here \u2014 apply security layers with limited mutex\n const originalData = await this._processEncryptedDataWithLimitedMutex(data);\n\n // Check processing result\n if (originalData === 'FAKE_MESSAGE_FILTERED' || \n originalData === 'FILE_MESSAGE_FILTERED' || \n originalData === 'SYSTEM_MESSAGE_FILTERED') {\n return;\n }\n \n if (!originalData) {\n this._secureLog('warn', '\u26A0\uFE0F No data returned from removeSecurityLayers');\n return;\n }\n\n // Handle result after removeSecurityLayers\n let messageText;\n \n if (typeof originalData === 'string') {\n try {\n const message = JSON.parse(originalData);\n \n // SECOND CHECK FOR FILE MESSAGES AFTER DECRYPTION\n if (message.type && fileMessageTypes.includes(message.type)) {\n this._secureLog('debug', '\uD83D\uDCC1 File message detected after decryption', { type: message.type });\n if (this.fileTransferSystem) {\n await this.fileTransferSystem.handleFileMessage(message);\n }\n return;\n }\n \n if (message.type && ['heartbeat', 'verification', 'verification_response', 'verification_confirmed', 'verification_both_confirmed', 'peer_disconnect', 'security_upgrade'].includes(message.type)) {\n this.handleSystemMessage(message);\n return;\n }\n \n if (message.type === 'fake') {\n this._secureLog('warn', `\uD83C\uDFAD Post-decryption fake message blocked: ${message.pattern}`);\n return;\n }\n \n // Regular messages\n if (message.type === 'message' && message.data) {\n messageText = message.data;\n } else {\n messageText = originalData;\n }\n } catch (e) {\n messageText = originalData;\n }\n } else if (originalData instanceof ArrayBuffer) {\n messageText = new TextDecoder().decode(originalData);\n } else if (originalData && typeof originalData === 'object' && originalData.message) {\n messageText = originalData.message;\n } else {\n this._secureLog('warn', '\u26A0\uFE0F Unexpected data type after processing:', { details: typeof originalData });\n return;\n }\n\n // Final check for fake and file messages\n if (messageText && messageText.trim().startsWith('{')) {\n try {\n const finalCheck = JSON.parse(messageText);\n if (finalCheck.type === 'fake') {\n this._secureLog('warn', `\uD83C\uDFAD Final fake message check blocked: ${finalCheck.pattern}`);\n return;\n }\n \n // Additional check for file and system messages\n const blockedTypes = [\n 'file_transfer_start', 'file_transfer_response', 'file_chunk', \n 'chunk_confirmation', 'file_transfer_complete', 'file_transfer_error',\n 'heartbeat', 'verification', 'verification_response', \n 'peer_disconnect', 'key_rotation_signal', 'key_rotation_ready', 'security_upgrade'\n ];\n \n if (finalCheck.type && blockedTypes.includes(finalCheck.type)) {\n this._secureLog('warn', `\uD83D\uDCC1 Final system/file message check blocked: ${finalCheck.type}`);\n return;\n }\n } catch (e) {\n // Not JSON \u2014 fine for plain text\n }\n }\n\n // Deliver message to the UI\n if (this.onMessage && messageText) {\n this._secureLog('debug', '\uD83D\uDCE4 Calling message handler with', { message: messageText.substring(0, 100) });\n this.deliverMessageToUI(messageText, 'received');\n }\n\n } catch (error) {\n this._secureLog('error', '\u274C Failed to process message:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n}\n\n // FIX: New method with limited mutex when processing encrypted data\n async _processEncryptedDataWithLimitedMutex(data) {\n // Use mutex ONLY for cryptographic operations\n return this._withMutex('cryptoOperation', async (operationId) => {\n this._secureLog('debug', '\uD83D\uDD10 Processing encrypted data with limited mutex', {\n operationId: operationId,\n dataType: typeof data\n });\n \n try {\n // Apply security layers\n const originalData = await this.removeSecurityLayers(data);\n return originalData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Error processing encrypted data', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n return data; // Return original data on error\n }\n }, 2000); // Short timeout for crypto operations\n }\n\n notifySecurityUpdate() {\n try {\n this._secureLog('debug', '\uD83D\uDD12 Notifying about security level update', {\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n hasKeys: !!(this.encryptionKey && this.macKey && this.metadataKey),\n hasLastCalculation: !!this.lastSecurityCalculation\n });\n \n // Send an event about security level update\n document.dispatchEvent(new CustomEvent('security-level-updated', {\n detail: { \n timestamp: Date.now(), \n manager: 'webrtc',\n webrtcManager: this,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n hasKeys: !!(this.encryptionKey && this.macKey && this.metadataKey),\n lastCalculation: this.lastSecurityCalculation\n }\n }));\n \n // FIX: Force header refresh with correct manager\n setTimeout(() => {\n // Removed global callback - use event system instead\n // if (window.forceHeaderSecurityUpdate) {\n // window.forceHeaderSecurityUpdate(this);\n // }\n }, 100);\n \n // FIX: Direct update if there is a calculation\n if (this.lastSecurityCalculation) {\n document.dispatchEvent(new CustomEvent('real-security-calculated', {\n detail: {\n securityData: this.lastSecurityCalculation,\n webrtcManager: this,\n timestamp: Date.now()\n }\n }));\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in notifySecurityUpdate', {\n error: error.message\n });\n }\n }\n\n handleSystemMessage(message) {\n this._secureLog('debug', '\uD83D\uDD27 Handling system message:', { type: message.type });\n \n switch (message.type) {\n case 'heartbeat':\n this.handleHeartbeat();\n break;\n case 'verification':\n this.handleVerificationRequest(message.data);\n break;\n case 'verification_response':\n this.handleVerificationResponse(message.data);\n break;\n case 'sas_code':\n this.handleSASCode(message.data);\n break;\n case 'verification_confirmed':\n this.handleVerificationConfirmed(message.data);\n break;\n case 'verification_both_confirmed':\n this.handleVerificationBothConfirmed(message.data);\n break;\n case 'peer_disconnect':\n this.handlePeerDisconnectNotification(message);\n break;\n case 'key_rotation_signal':\n this._secureLog('debug', '\uD83D\uDD04 Key rotation signal received (ignored for stability)');\n break;\n case 'key_rotation_ready':\n this._secureLog('debug', '\uD83D\uDD04 Key rotation ready signal received (ignored for stability)');\n break;\n case 'security_upgrade':\n this._secureLog('debug', '\uD83D\uDD12 Security upgrade notification received:', { type: message.type });\n // Security upgrade messages are handled internally, not displayed to user\n // to prevent duplicate system messages\n break;\n default:\n this._secureLog('debug', '\uD83D\uDD27 Unknown system message type:', { type: message.type });\n }\n }\n\n // ============================================\n // FUNCTION MANAGEMENT METHODS\n // ============================================\n\n // Method to enable Stage 2 functions\n enableStage2Security() {\n if (this.sessionConstraints?.hasPacketReordering) {\n this.securityFeatures.hasPacketReordering = true;\n this.reorderingConfig.enabled = true;\n }\n \n if (this.sessionConstraints?.hasAntiFingerprinting) {\n this.securityFeatures.hasAntiFingerprinting = true;\n this.antiFingerprintingConfig.enabled = true;\n if (this.currentSecurityLevel === 'enhanced') {\n this.antiFingerprintingConfig.randomizeSizes = false;\n this.antiFingerprintingConfig.maskPatterns = false;\n this.antiFingerprintingConfig.useRandomHeaders = false;\n }\n }\n \n this.notifySecurityUpgrade(2);\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, 500);\n }\n\n // Method to enable Stage 3 features (traffic obfuscation)\n enableStage3Security() {\n if (this.currentSecurityLevel !== 'maximum') {\n this._secureLog('info', '\uD83D\uDD12 Stage 3 features only available for premium sessions');\n return;\n }\n \n if (this.sessionConstraints?.hasMessageChunking) {\n this.securityFeatures.hasMessageChunking = true;\n this.chunkingConfig.enabled = true;\n }\n \n if (this.sessionConstraints?.hasFakeTraffic) {\n this.securityFeatures.hasFakeTraffic = true;\n this.fakeTrafficConfig.enabled = true;\n this.startFakeTrafficGeneration();\n }\n \n this.notifySecurityUpgrade(3);\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, 500);\n }\n\n // Method for enabling Stage 4 functions (maximum safety)\n enableStage4Security() {\n if (this.currentSecurityLevel !== 'maximum') {\n this._secureLog('info', '\uD83D\uDD12 Stage 4 features only available for premium sessions');\n return;\n }\n \n if (this.sessionConstraints?.hasDecoyChannels && this.isConnected() && this.isVerified) {\n this.securityFeatures.hasDecoyChannels = true;\n this.decoyChannelConfig.enabled = true;\n \n try {\n this.initializeDecoyChannels();\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Decoy channels initialization failed:', { details: error.message });\n this.securityFeatures.hasDecoyChannels = false;\n this.decoyChannelConfig.enabled = false;\n }\n }\n \n // Full anti-fingerprinting for maximum sessions\n if (this.sessionConstraints?.hasAntiFingerprinting) {\n this.antiFingerprintingConfig.randomizeSizes = true;\n this.antiFingerprintingConfig.maskPatterns = true;\n this.antiFingerprintingConfig.useRandomHeaders = false; \n }\n \n this.notifySecurityUpgrade(4);\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n }, 500);\n }\n\n forceSecurityUpdate() {\n setTimeout(() => {\n this.calculateAndReportSecurityLevel();\n this.notifySecurityUpdate();\n }, 100);\n }\n\n // Method for getting security status\n getSecurityStatus() {\n const activeFeatures = Object.entries(this.securityFeatures)\n .filter(([key, value]) => value === true)\n .map(([key]) => key);\n \n const stage = this.currentSecurityLevel === 'basic' ? 1 : \n this.currentSecurityLevel === 'enhanced' ? 2 :\n this.currentSecurityLevel === 'maximum' ? 4 : 1;\n \n return {\n stage: stage,\n sessionType: this.currentSessionType,\n securityLevel: this.currentSecurityLevel,\n activeFeatures: activeFeatures,\n totalFeatures: Object.keys(this.securityFeatures).length,\n activeFeaturesCount: activeFeatures.length,\n activeFeaturesNames: activeFeatures,\n sessionConstraints: this.sessionConstraints\n };\n }\n\n // Method to notify UI about security update\n notifySecurityUpgrade(stage) {\n const stageNames = {\n 1: 'Basic Enhanced',\n 2: 'Medium Security', \n 3: 'High Security',\n 4: 'Maximum Security'\n };\n \n const message = `\uD83D\uDD12 Security upgraded to Stage ${stage}: ${stageNames[stage]}`;\n \n // Avoid duplicate security-upgrade notifications\n if (!this.securityUpgradeNotificationSent || this.lastSecurityUpgradeStage !== stage) {\n this.securityUpgradeNotificationSent = true;\n this.lastSecurityUpgradeStage = stage;\n \n // Notify local UI via onMessage\n if (this.onMessage) {\n this.deliverMessageToUI(message, 'system');\n }\n }\n\n // Send security upgrade notification to peer via WebRTC\n if (this.dataChannel && this.dataChannel.readyState === 'open') {\n try {\n const securityNotification = {\n type: 'security_upgrade',\n stage: stage,\n stageName: stageNames[stage],\n message: message,\n timestamp: Date.now()\n };\n \n this._secureLog('debug', '\uD83D\uDD12 Sending security upgrade notification to peer:', { type: securityNotification.type, stage: securityNotification.stage });\n this.dataChannel.send(JSON.stringify(securityNotification));\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Failed to send security upgrade notification to peer:', { details: error.message });\n }\n }\n\n const status = this.getSecurityStatus();\n }\n\n async calculateAndReportSecurityLevel() {\n try {\n if (!window.EnhancedSecureCryptoUtils) {\n this._secureLog('warn', '\u26A0\uFE0F EnhancedSecureCryptoUtils not available for security calculation');\n return null;\n }\n\n if (!this.isConnected() || !this.isVerified || !this.encryptionKey || !this.macKey) {\n this._secureLog('debug', '\u26A0\uFE0F WebRTC not ready for security calculation', {\n connected: this.isConnected(),\n verified: this.isVerified,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey\n });\n return null;\n }\n\n this._secureLog('debug', '\uD83D\uDD0D Calculating real security level', {\n managerState: 'ready',\n hasAllKeys: !!(this.encryptionKey && this.macKey && this.metadataKey)\n });\n \n const securityData = await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(this);\n \n this._secureLog('info', '\uD83D\uDD10 Real security level calculated', {\n hasSecurityLevel: !!securityData.level,\n scoreRange: securityData.score > 80 ? 'high' : securityData.score > 50 ? 'medium' : 'low',\n checksRatio: `${securityData.passedChecks}/${securityData.totalChecks}`,\n isRealCalculation: securityData.isRealData\n });\n\n this.lastSecurityCalculation = securityData;\n\n document.dispatchEvent(new CustomEvent('real-security-calculated', {\n detail: {\n securityData: securityData,\n webrtcManager: this,\n timestamp: Date.now(),\n source: 'calculateAndReportSecurityLevel'\n }\n }));\n\n if (securityData.isRealData && this.onMessage) {\n if (!this.securityCalculationNotificationSent || this.lastSecurityCalculationLevel !== securityData.level) {\n this.securityCalculationNotificationSent = true;\n this.lastSecurityCalculationLevel = securityData.level;\n \n const message = `\uD83D\uDD12 Security Level: ${securityData.level} (${securityData.score}%) - ${securityData.passedChecks}/${securityData.totalChecks} checks passed`;\n this.deliverMessageToUI(message, 'system');\n }\n }\n \n return securityData;\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to calculate real security level', {\n errorType: error.constructor.name\n });\n return null;\n }\n }\n\n // ============================================\n // AUTOMATIC STEP-BY-STEP SWITCHING ON\n // ============================================\n\n // Method for automatic feature enablement with stability check\n async autoEnableSecurityFeatures() {\n if (this.currentSessionType === 'demo') {\n this._secureLog('info', '\uD83D\uDD12 Demo session - keeping basic security only');\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpgrade(1);\n return;\n }\n\n const checkStability = () => {\n const isStable = this.isConnected() && \n this.isVerified && \n this.connectionAttempts === 0 && \n this.messageQueue.length === 0 &&\n this.peerConnection?.connectionState === 'connected';\n return isStable;\n };\n \n this._secureLog('info', `\uD83D\uDD12 ${this.currentSessionType} session - starting graduated security activation`);\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpgrade(1);\n \n if (this.currentSecurityLevel === 'enhanced' || this.currentSecurityLevel === 'maximum') {\n setTimeout(async () => {\n if (checkStability()) {\n console.log('\u2705 Activating Stage 2 for paid session');\n this.enableStage2Security();\n await this.calculateAndReportSecurityLevel(); \n \n // For maximum sessions, turn on Stage 3 and 4\n if (this.currentSecurityLevel === 'maximum') {\n setTimeout(async () => {\n if (checkStability()) {\n console.log('\u2705 Activating Stage 3 for premium session');\n this.enableStage3Security();\n await this.calculateAndReportSecurityLevel();\n \n setTimeout(async () => {\n if (checkStability()) {\n console.log('\u2705 Activating Stage 4 for premium session');\n this.enableStage4Security();\n await this.calculateAndReportSecurityLevel();\n }\n }, 20000);\n }\n }, 15000);\n }\n }\n }, 10000);\n }\n }\n\n // ============================================\n // CONNECTION MANAGEMENT WITH ENHANCED SECURITY\n // ============================================\n\n async establishConnection() {\n try {\n // Initialize enhanced security features\n await this.initializeEnhancedSecurity();\n \n // Start fake traffic generation\n if (this.fakeTrafficConfig.enabled) {\n this.startFakeTrafficGeneration();\n }\n \n // Initialize decoy channels\n if (this.decoyChannelConfig.enabled) {\n this.initializeDecoyChannels();\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to establish enhanced connection:', { errorType: error?.constructor?.name || 'Unknown' });\n // Do not close the connection on setup errors \u2014 just log and continue\n this.onStatusChange('disconnected');\n throw error;\n }\n }\n\n disconnect() {\n try {\n console.log('\uD83D\uDD0C Disconnecting WebRTC Manager...');\n \n // Cleanup file transfer system\n if (this.fileTransferSystem) {\n console.log('\uD83E\uDDF9 Cleaning up file transfer system during disconnect...');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n // Stop fake traffic generation\n this.stopFakeTrafficGeneration();\n \n // Stop decoy traffic\n for (const [channelName, timer] of this.decoyTimers.entries()) {\n clearTimeout(timer);\n }\n this.decoyTimers.clear();\n \n // Close decoy channels\n for (const [channelName, channel] of this.decoyChannels.entries()) {\n if (channel.readyState === 'open') {\n channel.close();\n }\n }\n this.decoyChannels.clear();\n \n // Clean up packet buffer\n this.packetBuffer.clear();\n \n // Clean up chunk queue\n this.chunkQueue = [];\n \n // Wipe ephemeral keys for PFS on disconnect\n this._wipeEphemeralKeys();\n \n // Hard wipe old keys for PFS\n this._hardWipeOldKeys();\n\n // Clear verification states\n this._clearVerificationStates();\n\n } catch (error) {\n this._secureLog('error', '\u274C Error during enhanced disconnect:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n\n /**\n * Clear all verification states and data\n * Called when verification is rejected or connection is terminated\n */\n _clearVerificationStates() {\n try {\n console.log('\uD83E\uDDF9 Clearing verification states...');\n \n // Clear verification states\n this.localVerificationConfirmed = false;\n this.remoteVerificationConfirmed = false;\n this.bothVerificationsConfirmed = false;\n this.isVerified = false;\n this.verificationCode = null;\n this.pendingSASCode = null;\n \n // Clear key fingerprint and connection data\n this.keyFingerprint = null;\n this.expectedDTLSFingerprint = null;\n this.connectionId = null;\n \n // Clear processed message IDs\n this.processedMessageIds.clear();\n \n // Reset notification flags\n this.verificationNotificationSent = false;\n this.verificationInitiationSent = false;\n \n console.log('\u2705 Verification states cleared successfully');\n \n } catch (error) {\n this._secureLog('error', '\u274C Error clearing verification states:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n\n // Start periodic cleanup for rate limiting and security\n startPeriodicCleanup() {\n // Cleanup moved to unified scheduler\n this._secureLog('info', '\uD83D\uDD27 Periodic cleanup moved to unified scheduler');\n }\n\n // Calculate current security level with real verification\n async calculateSecurityLevel() {\n return await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(this);\n }\n\n // PFS: Check if key rotation is needed\n shouldRotateKeys() {\n if (!this.isConnected() || !this.isVerified) {\n return false;\n }\n \n const now = Date.now();\n const timeSinceLastRotation = now - this.lastKeyRotation;\n \n // Rotate keys every 5 minutes or after 100 messages\n return timeSinceLastRotation > this.keyRotationInterval || \n this.messageCounter % 100 === 0;\n }\n\n // PFS: Rotate encryption keys for Perfect Forward Secrecy\n async rotateKeys() {\n return this._withMutex('keyOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDD04 Starting key rotation with mutex', {\n operationId: operationId\n });\n \n // Validate state inside the critical section\n if (!this.isConnected() || !this.isVerified) {\n this._secureLog('warn', '\u26A0\uFE0F Key rotation aborted - connection not ready', {\n operationId: operationId,\n isConnected: this.isConnected(),\n isVerified: this.isVerified\n });\n return false;\n }\n \n // Ensure rotation is not already in progress\n if (this._keySystemState.isRotating) {\n this._secureLog('warn', '\u26A0\uFE0F Key rotation already in progress', {\n operationId: operationId\n });\n return false;\n }\n \n try {\n // Set rotation flag\n this._keySystemState.isRotating = true;\n this._keySystemState.lastOperation = 'rotation';\n this._keySystemState.lastOperationTime = Date.now();\n \n // Send rotation signal to peer\n const rotationSignal = {\n type: 'key_rotation_signal',\n newVersion: this.currentKeyVersion + 1,\n timestamp: Date.now(),\n operationId: operationId\n };\n \n if (this.dataChannel && this.dataChannel.readyState === 'open') {\n this.dataChannel.send(JSON.stringify(rotationSignal));\n } else {\n throw new Error('Data channel not ready for key rotation');\n }\n \n // Perform hard wipe of old keys for real PFS\n this._hardWipeOldKeys();\n \n // Wait for peer confirmation\n return new Promise((resolve) => {\n this.pendingRotation = {\n newVersion: this.currentKeyVersion + 1,\n operationId: operationId,\n resolve: resolve,\n timeout: setTimeout(() => {\n this._secureLog('error', '\u26A0\uFE0F Key rotation timeout', {\n operationId: operationId\n });\n this._keySystemState.isRotating = false;\n this.pendingRotation = null;\n resolve(false);\n }, 10000) // 10 seconds timeout\n };\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Key rotation failed in critical section', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._keySystemState.isRotating = false;\n return false;\n }\n }, 10000); // 10 seconds timeout for the entire operation\n }\n\n // Real PFS - Clean up old keys with hard wipe\n cleanupOldKeys() {\n const now = Date.now();\n const maxKeyAge = EnhancedSecureWebRTCManager.LIMITS.MAX_KEY_AGE; // 15 minutes - keys older than this are deleted\n \n let wipedKeysCount = 0;\n \n for (const [version, keySet] of this.oldKeys.entries()) {\n if (now - keySet.timestamp > maxKeyAge) {\n // Hard wipe old keys before deletion\n if (keySet.encryptionKey) {\n this._secureWipeMemory(keySet.encryptionKey, 'pfs_cleanup_wipe');\n }\n if (keySet.macKey) {\n this._secureWipeMemory(keySet.macKey, 'pfs_cleanup_wipe');\n }\n if (keySet.metadataKey) {\n this._secureWipeMemory(keySet.metadataKey, 'pfs_cleanup_wipe');\n }\n \n // Clear references\n keySet.encryptionKey = null;\n keySet.macKey = null;\n keySet.metadataKey = null;\n keySet.keyFingerprint = null;\n \n this.oldKeys.delete(version);\n wipedKeysCount++;\n \n this._secureLog('info', '\uD83E\uDDF9 Old PFS keys hard wiped and cleaned up', {\n version: version,\n age: Math.round((now - keySet.timestamp) / 1000) + 's',\n timestamp: Date.now()\n });\n }\n }\n \n if (wipedKeysCount > 0) {\n this._secureLog('info', `\u2705 PFS cleanup completed: ${wipedKeysCount} keys hard wiped`, {\n timestamp: Date.now()\n });\n }\n }\n\n // PFS: Get keys for specific version (for decryption)\n getKeysForVersion(version) {\n // First, we check the old keys (including version 0).\n const oldKeySet = this.oldKeys.get(version);\n if (oldKeySet && oldKeySet.encryptionKey && oldKeySet.macKey && oldKeySet.metadataKey) {\n return {\n encryptionKey: oldKeySet.encryptionKey,\n macKey: oldKeySet.macKey,\n metadataKey: oldKeySet.metadataKey\n };\n }\n \n // If this is the current version, return the current keys.\n if (version === this.currentKeyVersion) {\n if (this.encryptionKey && this.macKey && this.metadataKey) {\n return {\n encryptionKey: this.encryptionKey,\n macKey: this.macKey,\n metadataKey: this.metadataKey\n };\n }\n }\n \n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'No valid keys found for version', {\n requestedVersion: version,\n currentVersion: this.currentKeyVersion,\n availableVersions: Array.from(this.oldKeys.keys())\n });\n \n return null;\n }\n\n createPeerConnection() {\n const config = {\n iceServers: [\n { urls: 'stun:stun.l.google.com:19302' },\n { urls: 'stun:stun1.l.google.com:19302' },\n { urls: 'stun:stun2.l.google.com:19302' },\n { urls: 'stun:stun3.l.google.com:19302' },\n { urls: 'stun:stun4.l.google.com:19302' }\n ],\n iceCandidatePoolSize: 10,\n bundlePolicy: 'balanced'\n };\n\n this.peerConnection = new RTCPeerConnection(config);\n\n this.peerConnection.onconnectionstatechange = () => {\n const state = this.peerConnection.connectionState;\n console.log('Connection state:', state);\n \n if (state === 'connected' && !this.isVerified) {\n this.onStatusChange('verifying');\n } else if (state === 'connected' && this.isVerified) {\n this.onStatusChange('connected');\n } else if (state === 'disconnected' || state === 'closed') {\n // If this is an intentional disconnect, clear immediately.\n if (this.intentionalDisconnect) {\n this.onStatusChange('disconnected');\n setTimeout(() => this.disconnect(), 100);\n } else {\n this.onStatusChange('disconnected');\n // Clear verification states on unexpected disconnect\n this._clearVerificationStates();\n }\n } else if (state === 'failed') {\n // Do not auto-reconnect to avoid closing the session on errors\n this.onStatusChange('disconnected');\n\n } else {\n this.onStatusChange(state);\n }\n };\n\n this.peerConnection.ondatachannel = (event) => {\n console.log('\uD83D\uDD17 Data channel received:', {\n channelLabel: event.channel.label,\n channelState: event.channel.readyState,\n isInitiator: this.isInitiator,\n channelId: event.channel.id,\n protocol: event.channel.protocol\n });\n \n // CRITICAL: Store the received data channel\n if (event.channel.label === 'securechat') {\n console.log('\uD83D\uDD17 MAIN DATA CHANNEL RECEIVED (answerer side)');\n this.dataChannel = event.channel;\n this.setupDataChannel(event.channel);\n } else {\n console.log('\uD83D\uDD17 ADDITIONAL DATA CHANNEL RECEIVED:', event.channel.label);\n // Handle additional channels (heartbeat, etc.)\n if (event.channel.label === 'heartbeat') {\n this.heartbeatChannel = event.channel;\n }\n }\n };\n }\n\n setupDataChannel(channel) {\n console.log('\uD83D\uDD17 setupDataChannel called:', {\n channelLabel: channel.label,\n channelState: channel.readyState,\n isInitiator: this.isInitiator,\n isVerified: this.isVerified\n });\n\n this.dataChannel = channel;\n\n this.dataChannel.onopen = async () => {\n console.log('\uD83D\uDD17 Data channel opened:', {\n isInitiator: this.isInitiator,\n isVerified: this.isVerified,\n dataChannelState: this.dataChannel.readyState,\n dataChannelLabel: this.dataChannel.label\n });\n // Configure backpressure for large transfers\n try {\n if (this.dataChannel && typeof this.dataChannel.bufferedAmountLowThreshold === 'number') {\n // 1 MB threshold for bufferedamountlow event\n this.dataChannel.bufferedAmountLowThreshold = 1024 * 1024;\n }\n } catch (e) {\n // ignore\n }\n \n try {\n await this.establishConnection();\n\n this.initializeFileTransfer();\n \n } catch (error) {\n this._secureLog('error', '\u274C Error in establishConnection:', { errorType: error?.constructor?.name || 'Unknown' });\n // Continue despite errors\n }\n \n // CRITICAL: Send pending SAS code if available\n if (this.pendingSASCode && this.dataChannel && this.dataChannel.readyState === 'open') {\n try {\n const sasPayload = {\n type: 'sas_code',\n data: {\n code: this.pendingSASCode,\n timestamp: Date.now(),\n verificationMethod: 'SAS',\n securityLevel: 'MITM_PROTECTION_REQUIRED'\n }\n };\n console.log('\uD83D\uDCE4 Sending pending SAS code to Answer side:', this.pendingSASCode);\n this.dataChannel.send(JSON.stringify(sasPayload));\n this.pendingSASCode = null; // Clear after sending\n } catch (error) {\n console.error('Failed to send pending SAS code to Answer side:', error);\n }\n } else if (this.pendingSASCode) {\n console.log('\u26A0\uFE0F Cannot send SAS code - dataChannel not ready:', {\n hasDataChannel: !!this.dataChannel,\n readyState: this.dataChannel?.readyState,\n pendingSASCode: this.pendingSASCode\n });\n }\n \n if (this.isVerified) {\n this.onStatusChange('connected');\n this.processMessageQueue();\n \n setTimeout(async () => {\n await this.calculateAndReportSecurityLevel();\n this.autoEnableSecurityFeatures();\n this.notifySecurityUpdate();\n }, 500);\n } else {\n this.onStatusChange('verifying');\n this.initiateVerification();\n }\n this.startHeartbeat();\n };\n\n this.dataChannel.onclose = () => {\n if (!this.intentionalDisconnect) {\n this.onStatusChange('disconnected');\n // Clear verification states on data channel close\n this._clearVerificationStates();\n \n if (!this.connectionClosedNotificationSent) {\n this.connectionClosedNotificationSent = true;\n this.deliverMessageToUI('\uD83D\uDD0C Enhanced secure connection closed. Check connection status.', 'system');\n }\n } else {\n this.onStatusChange('disconnected');\n // Clear verification states on intentional disconnect\n this._clearVerificationStates();\n \n if (!this.connectionClosedNotificationSent) {\n this.connectionClosedNotificationSent = true;\n this.deliverMessageToUI('\uD83D\uDD0C Enhanced secure connection closed', 'system');\n }\n }\n \n // Wipe ephemeral keys when session ends for PFS\n this._wipeEphemeralKeys();\n \n this.stopHeartbeat();\n this.isVerified = false;\n };\n\n // FIX 2: Remove mutex entirely from message processing path\n this.dataChannel.onmessage = async (event) => {\n try {\n console.log('\uD83D\uDCE8 Raw message received:', {\n dataType: typeof event.data,\n dataLength: event.data?.length || event.data?.byteLength || 0,\n isString: typeof event.data === 'string'\n });\n\n // IMPORTANT: Process ALL messages WITHOUT mutex\n if (typeof event.data === 'string') {\n try {\n const parsed = JSON.parse(event.data);\n console.log('\uD83D\uDCE8 Parsed message:', {\n type: parsed.type,\n hasData: !!parsed.data,\n timestamp: parsed.timestamp\n });\n \n // ============================================\n // CRITICAL: FILE MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n const fileMessageTypes = [\n 'file_transfer_start',\n 'file_transfer_response', \n 'file_chunk',\n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error'\n ];\n \n if (parsed.type && fileMessageTypes.includes(parsed.type)) {\n console.log('\uD83D\uDCC1 File message intercepted at WebRTC level:', parsed.type);\n\n if (!this.fileTransferSystem) {\n try {\n if (this.isVerified && this.dataChannel && this.dataChannel.readyState === 'open') {\n this.initializeFileTransfer();\n\n let attempts = 0;\n const maxAttempts = 30;\n while (!this.fileTransferSystem && attempts < maxAttempts) {\n await new Promise(resolve => setTimeout(resolve, 100));\n attempts++;\n }\n }\n } catch (initError) {\n this._secureLog('error', '\u274C Failed to initialize file transfer system for receiver:', { errorType: initError?.constructor?.name || 'Unknown' });\n }\n }\n\n if (this.fileTransferSystem) {\n console.log('\uD83D\uDCC1 Forwarding to local file transfer system:', parsed.type);\n await this.fileTransferSystem.handleFileMessage(parsed);\n return;\n }\n // Attempt lazy initialization on receiver side\n this._secureLog('warn', '\u26A0\uFE0F File transfer system not ready, attempting lazy init...');\n try {\n await this._ensureFileTransferReady();\n if (this.fileTransferSystem) {\n await this.fileTransferSystem.handleFileMessage(parsed);\n return;\n }\n } catch (e) {\n this._secureLog('error', '\u274C Lazy init of file transfer failed:', { errorType: e?.message || e?.constructor?.name || 'Unknown' });\n }\n this._secureLog('error', '\u274C No file transfer system available for:', { errorType: parsed.type?.constructor?.name || 'Unknown' });\n return; // IMPORTANT: Do not process further\n }\n \n // ============================================\n // SYSTEM MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type && ['heartbeat', 'verification', 'verification_response', 'verification_confirmed', 'verification_both_confirmed', 'sas_code', 'peer_disconnect', 'security_upgrade'].includes(parsed.type)) {\n console.log('\uD83D\uDD27 System message detected:', parsed.type);\n this.handleSystemMessage(parsed);\n return;\n }\n \n // ============================================\n // REGULAR USER MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'message' && parsed.data) {\n console.log('\uD83D\uDCDD User message detected:', parsed.data.substring(0, 50));\n if (this.onMessage) {\n this.deliverMessageToUI(parsed.data, 'received');\n }\n return;\n }\n \n // ============================================\n // ENHANCED MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'enhanced_message' && parsed.data) {\n console.log('\uD83D\uDD10 Enhanced message detected, processing...');\n await this._processEnhancedMessageWithoutMutex(parsed);\n return;\n }\n \n // ============================================\n // FAKE MESSAGES (WITHOUT MUTEX)\n // ============================================\n \n if (parsed.type === 'fake') {\n console.log('\uD83C\uDFAD Fake message blocked:', parsed.pattern);\n return;\n }\n \n // ============================================\n // UNKNOWN MESSAGE TYPES\n // ============================================\n \n console.log('\u2753 Unknown message type:', parsed.type);\n \n } catch (jsonError) {\n // Not JSON \u2014 treat as regular text message\n console.log('\uD83D\uDCC4 Non-JSON message detected, treating as text');\n if (this.onMessage) {\n this.deliverMessageToUI(event.data, 'received');\n }\n return;\n }\n } else if (event.data instanceof ArrayBuffer) {\n // Binary data \u2014 process WITHOUT mutex\n console.log('\uD83D\uDD22 Binary data received, processing...');\n await this._processBinaryDataWithoutMutex(event.data);\n } else {\n console.log('\u2753 Unknown data type:', typeof event.data);\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to process message in onmessage:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n };\n }\n // FIX 4: New method for processing binary data WITHOUT mutex\n async _processBinaryDataWithoutMutex(data) {\n try {\n console.log('\uD83D\uDD22 Processing binary data without mutex...');\n \n // Apply security layers WITHOUT mutex\n let processedData = data;\n \n // Nested Encryption Removal (if enabled)\n if (this.securityFeatures.hasNestedEncryption && \n this.nestedEncryptionKey && \n processedData instanceof ArrayBuffer &&\n processedData.byteLength > 12) {\n \n try {\n processedData = await this.removeNestedEncryption(processedData);\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Nested decryption failed, continuing with original data');\n }\n }\n \n // Packet Padding Removal (if enabled)\n if (this.securityFeatures.hasPacketPadding && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removePacketPadding(processedData);\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Packet padding removal failed, continuing with original data');\n }\n }\n \n // Anti-Fingerprinting Removal (if enabled)\n if (this.securityFeatures.hasAntiFingerprinting && processedData instanceof ArrayBuffer) {\n try {\n processedData = this.removeAntiFingerprinting(processedData);\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F Anti-fingerprinting removal failed, continuing with original data');\n }\n }\n \n // Convert to text\n if (processedData instanceof ArrayBuffer) {\n const textData = new TextDecoder().decode(processedData);\n \n // Check for fake messages\n try {\n const content = JSON.parse(textData);\n if (content.type === 'fake' || content.isFakeTraffic === true) {\n console.log(`\uD83C\uDFAD BLOCKED: Binary fake message: ${content.pattern || 'unknown'}`);\n return;\n }\n } catch (e) {\n // Not JSON \u2014 fine for plain text\n }\n \n // Deliver message to user\n if (this.onMessage) {\n this.deliverMessageToUI(textData, 'received');\n }\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Error processing binary data:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n // FIX 3: New method for processing enhanced messages WITHOUT mutex\n async _processEnhancedMessageWithoutMutex(parsedMessage) {\n try {\n console.log('\uD83D\uDD10 Processing enhanced message without mutex...');\n \n if (!this.encryptionKey || !this.macKey || !this.metadataKey) {\n this._secureLog('error', '\u274C Missing encryption keys for enhanced message');\n return;\n }\n \n const decryptedResult = await window.EnhancedSecureCryptoUtils.decryptMessage(\n parsedMessage.data,\n this.encryptionKey,\n this.macKey,\n this.metadataKey\n );\n \n if (decryptedResult && decryptedResult.message) {\n console.log('\u2705 Enhanced message decrypted successfully');\n \n // Try parsing JSON and showing nested text if it's a chat message\n try {\n const decryptedContent = JSON.parse(decryptedResult.message);\n if (decryptedContent.type === 'fake' || decryptedContent.isFakeTraffic === true) {\n console.log(`\uFFFD\uFFFD BLOCKED: Encrypted fake message: ${decryptedContent.pattern || 'unknown'}`);\n return;\n }\n if (decryptedContent && decryptedContent.type === 'message' && typeof decryptedContent.data === 'string') {\n if (this.onMessage) {\n this.deliverMessageToUI(decryptedContent.data, 'received');\n }\n return;\n }\n } catch (e) {\n // Not JSON \u2014 fine for plain text\n }\n \n // Otherwise pass as-is\n if (this.onMessage) {\n this.deliverMessageToUI(decryptedResult.message, 'received');\n }\n } else {\n this._secureLog('warn', '\u26A0\uFE0F No message content in decrypted result');\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Error processing enhanced message:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n /**\n * Creates a unique ID for an operation\n */\n _generateOperationId() {\n return `op_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n }\n\n /**\n * Atomic mutex acquisition with enhanced race condition protection\n */\n async _acquireMutex(mutexName, operationId, timeout = 5000) {\n // Build correct mutex property name\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Unknown mutex: ${mutexName}`, {\n mutexPropertyName: mutexPropertyName,\n availableMutexes: this._getAvailableMutexes(),\n operationId: operationId\n });\n throw new Error(`Unknown mutex: ${mutexName}. Available: ${this._getAvailableMutexes().join(', ')}`);\n }\n \n // Validate operation ID\n if (!operationId || typeof operationId !== 'string') {\n throw new Error('Invalid operation ID for mutex acquisition');\n }\n \n return new Promise((resolve, reject) => {\n // Atomic lock attempt with immediate state check\n const attemptLock = () => {\n // Check if mutex is already locked by this operation\n if (mutex.lockId === operationId) {\n this._secureLog('warn', `\u26A0\uFE0F Mutex '${mutexName}' already locked by same operation`, {\n operationId: operationId\n });\n resolve();\n return;\n }\n \n // Atomic check and lock operation\n if (!mutex.locked) {\n // Set lock state atomically\n mutex.locked = true;\n mutex.lockId = operationId;\n mutex.lockTime = Date.now();\n \n this._secureLog('debug', `\uD83D\uDD12 Mutex '${mutexName}' acquired atomically`, {\n operationId: operationId,\n lockTime: mutex.lockTime\n });\n \n // Set timeout for automatic release with enhanced validation\n mutex.lockTimeout = setTimeout(() => {\n // Enhanced timeout handling with state validation\n this._handleMutexTimeout(mutexName, operationId, timeout);\n }, timeout);\n \n resolve();\n } else {\n // Add to queue with timeout\n const queueItem = { \n resolve, \n reject, \n operationId,\n timestamp: Date.now(),\n timeout: setTimeout(() => {\n // Remove from queue on timeout\n const index = mutex.queue.findIndex(item => item.operationId === operationId);\n if (index !== -1) {\n mutex.queue.splice(index, 1);\n reject(new Error(`Mutex acquisition timeout for '${mutexName}'`));\n }\n }, timeout)\n };\n \n mutex.queue.push(queueItem);\n \n this._secureLog('debug', `\u23F3 Operation queued for mutex '${mutexName}'`, {\n operationId: operationId,\n queueLength: mutex.queue.length,\n currentLockId: mutex.lockId\n });\n }\n };\n \n // Execute lock attempt immediately\n attemptLock();\n });\n }\n\n /**\n * Enhanced mutex release with strict validation and error handling\n */\n _releaseMutex(mutexName, operationId) {\n // Validate input parameters\n if (!mutexName || typeof mutexName !== 'string') {\n throw new Error('Invalid mutex name provided for release');\n }\n \n if (!operationId || typeof operationId !== 'string') {\n throw new Error('Invalid operation ID provided for mutex release');\n }\n \n // Build correct mutex property name\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Unknown mutex for release: ${mutexName}`, {\n mutexPropertyName: mutexPropertyName,\n availableMutexes: this._getAvailableMutexes(),\n operationId: operationId\n });\n throw new Error(`Unknown mutex for release: ${mutexName}`);\n }\n \n // Strict validation of lock ownership\n if (mutex.lockId !== operationId) {\n this._secureLog('error', `\u274C CRITICAL: Invalid mutex release attempt - potential race condition`, {\n mutexName: mutexName,\n expectedLockId: mutex.lockId,\n providedOperationId: operationId,\n mutexState: {\n locked: mutex.locked,\n lockTime: mutex.lockTime,\n queueLength: mutex.queue.length\n }\n });\n \n // Throw error instead of silent failure\n throw new Error(`Invalid mutex release attempt for '${mutexName}': expected '${mutex.lockId}', got '${operationId}'`);\n }\n \n // Validate mutex is actually locked\n if (!mutex.locked) {\n this._secureLog('error', `\u274C CRITICAL: Attempting to release unlocked mutex`, {\n mutexName: mutexName,\n operationId: operationId,\n mutexState: {\n locked: mutex.locked,\n lockId: mutex.lockId,\n lockTime: mutex.lockTime\n }\n });\n throw new Error(`Attempting to release unlocked mutex: ${mutexName}`);\n }\n \n try {\n // Clear timeout first\n if (mutex.lockTimeout) {\n clearTimeout(mutex.lockTimeout);\n mutex.lockTimeout = null;\n }\n \n // Calculate lock duration for monitoring\n const lockDuration = mutex.lockTime ? Date.now() - mutex.lockTime : 0;\n \n // Atomic release with state validation\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTime = null;\n \n this._secureLog('debug', `\uD83D\uDD13 Mutex released successfully: ${mutexName}`, {\n operationId: operationId,\n lockDuration: lockDuration,\n queueLength: mutex.queue.length\n });\n \n // Process next in queue with enhanced error handling\n this._processNextInQueue(mutexName);\n \n } catch (error) {\n // If queue processing fails, ensure mutex is still released\n this._secureLog('error', `\u274C Error during mutex release queue processing`, {\n mutexName: mutexName,\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Ensure mutex is released even if queue processing fails\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTime = null;\n mutex.lockTimeout = null;\n \n throw error;\n }\n }\n\n /**\n * Enhanced queue processing with comprehensive error handling\n */\n _processNextInQueue(mutexName) {\n const mutex = this[`_${mutexName}Mutex`];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Mutex not found for queue processing: ${mutexName}`);\n return;\n }\n \n if (mutex.queue.length === 0) {\n return;\n }\n \n // Validate mutex state before processing queue\n if (mutex.locked) {\n this._secureLog('warn', `\u26A0\uFE0F Mutex '${mutexName}' is still locked, skipping queue processing`, {\n lockId: mutex.lockId,\n queueLength: mutex.queue.length\n });\n return;\n }\n \n // Get next item from queue atomically with validation\n const nextItem = mutex.queue.shift();\n \n if (!nextItem) {\n this._secureLog('warn', `\u26A0\uFE0F Empty queue item for mutex '${mutexName}'`);\n return;\n }\n \n // Validate queue item structure\n if (!nextItem.operationId || !nextItem.resolve || !nextItem.reject) {\n this._secureLog('error', `\u274C Invalid queue item structure for mutex '${mutexName}'`, {\n hasOperationId: !!nextItem.operationId,\n hasResolve: !!nextItem.resolve,\n hasReject: !!nextItem.reject\n });\n return;\n }\n \n try {\n // Clear timeout for this item\n if (nextItem.timeout) {\n clearTimeout(nextItem.timeout);\n }\n \n // Attempt to acquire lock for next item\n this._secureLog('debug', `\uD83D\uDD04 Processing next operation in queue for mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n queueRemaining: mutex.queue.length,\n timestamp: Date.now()\n });\n \n // Retry lock acquisition for queued operation with enhanced error handling\n setTimeout(async () => {\n try {\n await this._acquireMutex(mutexName, nextItem.operationId, 5000);\n \n this._secureLog('debug', `\u2705 Queued operation acquired mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n acquisitionTime: Date.now()\n });\n \n nextItem.resolve();\n \n } catch (error) {\n this._secureLog('error', `\u274C Queued operation failed to acquire mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n errorType: error.constructor.name,\n errorMessage: error.message,\n timestamp: Date.now()\n });\n \n // Reject with detailed error information\n nextItem.reject(new Error(`Queue processing failed for '${mutexName}': ${error.message}`));\n \n // Continue processing queue even if one item fails\n setTimeout(() => {\n this._processNextInQueue(mutexName);\n }, 50);\n }\n }, 10); // Small delay to prevent immediate re-acquisition\n \n } catch (error) {\n this._secureLog('error', `\u274C Critical error during queue processing for mutex '${mutexName}'`, {\n operationId: nextItem.operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Reject the operation and continue processing\n try {\n nextItem.reject(new Error(`Queue processing critical error: ${error.message}`));\n } catch (rejectError) {\n this._secureLog('error', `\u274C Failed to reject queue item`, {\n originalError: error.message,\n rejectError: rejectError.message\n });\n }\n \n // Continue processing remaining queue items\n setTimeout(() => {\n this._processNextInQueue(mutexName);\n }, 100);\n }\n }\n\n _getAvailableMutexes() {\n const mutexes = [];\n const propertyNames = Object.getOwnPropertyNames(this);\n \n for (const prop of propertyNames) {\n if (prop.endsWith('Mutex') && prop.startsWith('_')) {\n // Extract mutex name without prefix/suffix\n const mutexName = prop.slice(1, -5); // Remove '_' prefix and 'Mutex' suffix\n mutexes.push(mutexName);\n }\n }\n \n return mutexes;\n }\n\n /**\n * Enhanced mutex execution with atomic operations\n */\n async _withMutex(mutexName, operation, timeout = 5000) {\n const operationId = this._generateOperationId();\n \n // Validate mutex system before operation\n if (!this._validateMutexSystem()) {\n this._secureLog('error', '\u274C Mutex system not properly initialized', {\n operationId: operationId,\n mutexName: mutexName\n });\n throw new Error('Mutex system not properly initialized. Call _initializeMutexSystem() first.');\n }\n \n // Get mutex reference with validation\n const mutex = this[`_${mutexName}Mutex`];\n if (!mutex) {\n throw new Error(`Mutex '${mutexName}' not found`);\n }\n \n let mutexAcquired = false;\n \n try {\n // Atomic mutex acquisition with timeout\n await this._acquireMutex(mutexName, operationId, timeout);\n mutexAcquired = true;\n \n // Increment operation counter atomically\n const counterKey = `${mutexName}Operations`;\n if (this._operationCounters && this._operationCounters[counterKey] !== undefined) {\n this._operationCounters[counterKey]++;\n }\n \n // Execute operation with enhanced error handling\n const result = await operation(operationId);\n \n // Validate result before returning\n if (result === undefined && operation.name !== 'cleanup') {\n this._secureLog('warn', '\u26A0\uFE0F Mutex operation returned undefined result', {\n operationId: operationId,\n mutexName: mutexName,\n operationName: operation.name\n });\n }\n \n return result;\n \n } catch (error) {\n // Enhanced error logging with context\n this._secureLog('error', '\u274C Error in mutex operation', {\n operationId: operationId,\n mutexName: mutexName,\n errorType: error.constructor.name,\n errorMessage: error.message,\n mutexAcquired: mutexAcquired,\n mutexState: mutex ? {\n locked: mutex.locked,\n lockId: mutex.lockId,\n queueLength: mutex.queue.length\n } : 'null'\n });\n \n // If this is a key operation error, trigger emergency recovery\n if (mutexName === 'keyOperation') {\n this._handleKeyOperationError(error, operationId);\n }\n \n // Trigger emergency unlock for critical mutex errors\n if (error.message.includes('timeout') || error.message.includes('race condition')) {\n this._emergencyUnlockAllMutexes('errorHandler');\n }\n \n throw error;\n } finally {\n // Always release mutex in finally block with validation\n if (mutexAcquired) {\n try {\n await this._releaseMutex(mutexName, operationId);\n \n // Verify mutex was properly released\n if (mutex.locked && mutex.lockId === operationId) {\n this._secureLog('error', '\u274C Mutex release verification failed', {\n operationId: operationId,\n mutexName: mutexName\n });\n // Force release as fallback\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n }\n \n } catch (releaseError) {\n this._secureLog('error', '\u274C Error releasing mutex in finally block', {\n operationId: operationId,\n mutexName: mutexName,\n releaseErrorType: releaseError.constructor.name,\n releaseErrorMessage: releaseError.message\n });\n \n // Force release on error\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n }\n }\n }\n }\n\n _validateMutexSystem() {\n const requiredMutexes = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n \n for (const mutexName of requiredMutexes) {\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (!mutex || typeof mutex !== 'object') {\n this._secureLog('error', `\u274C Missing or invalid mutex: ${mutexName}`, {\n mutexPropertyName: mutexPropertyName,\n mutexType: typeof mutex\n });\n return false;\n }\n \n // Validate mutex structure\n const requiredProps = ['locked', 'queue', 'lockId', 'lockTimeout'];\n for (const prop of requiredProps) {\n if (!(prop in mutex)) {\n this._secureLog('error', `\u274C Mutex ${mutexName} missing property: ${prop}`);\n return false;\n }\n }\n }\n \n return true;\n }\n\n /**\n * Enhanced emergency recovery of the mutex system\n */\n _emergencyRecoverMutexSystem() {\n this._secureLog('warn', '\uD83D\uDEA8 Emergency mutex system recovery initiated');\n \n try {\n // Emergency unlock all mutexes first\n this._emergencyUnlockAllMutexes('emergencyRecovery');\n \n // Force re-initialize the system\n this._initializeMutexSystem();\n \n // Validate recovery success\n if (!this._validateMutexSystem()) {\n throw new Error('Mutex system validation failed after recovery');\n }\n \n this._secureLog('info', '\u2705 Mutex system recovered successfully with validation');\n return true;\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to recover mutex system', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Last resort - force re-initialization\n try {\n this._initializeMutexSystem();\n this._secureLog('warn', '\u26A0\uFE0F Forced mutex system re-initialization completed');\n return true;\n } catch (reinitError) {\n this._secureLog('error', '\u274C CRITICAL: Forced re-initialization also failed', {\n originalError: error.message,\n reinitError: reinitError.message\n });\n return false;\n }\n }\n }\n\n /**\n * Atomic key generation with race condition protection\n */\n async _generateEncryptionKeys() {\n return this._withMutex('keyOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDD11 Generating encryption keys with atomic mutex', {\n operationId: operationId\n });\n \n // Atomic state check and update using mutex lock\n const currentState = this._keySystemState;\n \n // Atomic check - if already initializing, wait or fail\n if (currentState.isInitializing) {\n this._secureLog('warn', '\u26A0\uFE0F Key generation already in progress, waiting for completion', {\n operationId: operationId,\n lastOperation: currentState.lastOperation,\n lastOperationTime: currentState.lastOperationTime\n });\n \n // Wait for existing operation to complete\n let waitAttempts = 0;\n const maxWaitAttempts = 50; // 5 seconds max wait\n \n while (currentState.isInitializing && waitAttempts < maxWaitAttempts) {\n await new Promise(resolve => setTimeout(resolve, 100));\n waitAttempts++;\n }\n \n if (currentState.isInitializing) {\n throw new Error('Key generation timeout - operation still in progress after 5 seconds');\n }\n }\n \n // Atomic state update within mutex protection\n try {\n // Set state atomically within mutex\n currentState.isInitializing = true;\n currentState.lastOperation = 'generation';\n currentState.lastOperationTime = Date.now();\n currentState.operationId = operationId;\n \n this._secureLog('debug', '\uD83D\uDD12 Atomic key generation state set', {\n operationId: operationId,\n timestamp: currentState.lastOperationTime\n });\n \n // Generate keys with individual error handling\n let ecdhKeyPair = null;\n let ecdsaKeyPair = null;\n \n // Generate ephemeral ECDH keys for PFS\n try {\n ecdhKeyPair = await this._generateEphemeralECDHKeys();\n \n // Validate ECDH keys immediately\n if (!ecdhKeyPair || !ecdhKeyPair.privateKey || !ecdhKeyPair.publicKey) {\n throw new Error('Ephemeral ECDH key pair validation failed');\n }\n \n // Constant-time validation for key types\n if (!this._validateKeyPairConstantTime(ecdhKeyPair)) {\n throw new Error('Ephemeral ECDH keys are not valid CryptoKey instances');\n }\n \n this._secureLog('debug', '\u2705 Ephemeral ECDH keys generated and validated for PFS', {\n operationId: operationId,\n privateKeyType: ecdhKeyPair.privateKey.algorithm?.name,\n publicKeyType: ecdhKeyPair.publicKey.algorithm?.name,\n isEphemeral: true\n });\n \n } catch (ecdhError) {\n this._secureLog('error', '\u274C Ephemeral ECDH key generation failed', {\n operationId: operationId,\n errorType: ecdhError.constructor.name\n });\n this._throwSecureError(ecdhError, 'ephemeral_ecdh_key_generation');\n }\n \n // Generate ECDSA keys with retry mechanism\n try {\n ecdsaKeyPair = await window.EnhancedSecureCryptoUtils.generateECDSAKeyPair();\n \n // Validate ECDSA keys immediately\n if (!ecdsaKeyPair || !ecdsaKeyPair.privateKey || !ecdsaKeyPair.publicKey) {\n throw new Error('ECDSA key pair validation failed');\n }\n \n // Constant-time validation for key types\n if (!this._validateKeyPairConstantTime(ecdsaKeyPair)) {\n throw new Error('ECDSA keys are not valid CryptoKey instances');\n }\n \n this._secureLog('debug', '\u2705 ECDSA keys generated and validated', {\n operationId: operationId,\n privateKeyType: ecdsaKeyPair.privateKey.algorithm?.name,\n publicKeyType: ecdsaKeyPair.publicKey.algorithm?.name\n });\n \n } catch (ecdsaError) {\n this._secureLog('error', '\u274C ECDSA key generation failed', {\n operationId: operationId,\n errorType: ecdsaError.constructor.name\n });\n this._throwSecureError(ecdsaError, 'ecdsa_key_generation');\n }\n \n // Final validation of both key pairs\n if (!ecdhKeyPair || !ecdsaKeyPair) {\n throw new Error('One or both key pairs failed to generate');\n }\n \n // Enable security features after successful key generation\n this._enableSecurityFeaturesAfterKeyGeneration(ecdhKeyPair, ecdsaKeyPair);\n \n this._secureLog('info', '\u2705 Encryption keys generated successfully with atomic protection', {\n operationId: operationId,\n hasECDHKeys: !!(ecdhKeyPair?.privateKey && ecdhKeyPair?.publicKey),\n hasECDSAKeys: !!(ecdsaKeyPair?.privateKey && ecdsaKeyPair?.publicKey),\n generationTime: Date.now() - currentState.lastOperationTime\n });\n \n return { ecdhKeyPair, ecdsaKeyPair };\n \n } catch (error) {\n // Ensure state is reset on any error\n this._secureLog('error', '\u274C Key generation failed, resetting state', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n throw error;\n } finally {\n // Always reset state in finally block\n currentState.isInitializing = false;\n currentState.operationId = null;\n \n this._secureLog('debug', '\uD83D\uDD13 Key generation state reset', {\n operationId: operationId\n });\n }\n });\n }\n\n /**\n * Enable security features after successful key generation\n */\n _enableSecurityFeaturesAfterKeyGeneration(ecdhKeyPair, ecdsaKeyPair) {\n try {\n // Enable encryption features based on available keys\n if (ecdhKeyPair && ecdhKeyPair.privateKey && ecdhKeyPair.publicKey) {\n this.securityFeatures.hasEncryption = true;\n this.securityFeatures.hasECDH = true;\n this._secureLog('info', '\uD83D\uDD12 ECDH encryption features enabled');\n }\n \n if (ecdsaKeyPair && ecdsaKeyPair.privateKey && ecdsaKeyPair.publicKey) {\n this.securityFeatures.hasECDSA = true;\n this._secureLog('info', '\uD83D\uDD12 ECDSA signature features enabled');\n }\n \n // Enable additional features that depend on encryption\n if (this.securityFeatures.hasEncryption) {\n this.securityFeatures.hasMetadataProtection = true;\n this.securityFeatures.hasEnhancedReplayProtection = true;\n this.securityFeatures.hasNonExtractableKeys = true;\n this._secureLog('info', '\uD83D\uDD12 Additional encryption-dependent features enabled');\n }\n \n // Enable PFS after ephemeral key generation\n if (ecdhKeyPair && this.ephemeralKeyPairs.size > 0) {\n this.securityFeatures.hasPFS = true;\n this._secureLog('info', '\uD83D\uDD12 Perfect Forward Secrecy enabled with ephemeral keys');\n }\n \n this._secureLog('info', '\uD83D\uDD12 Security features updated after key generation', {\n hasEncryption: this.securityFeatures.hasEncryption,\n hasECDH: this.securityFeatures.hasECDH,\n hasECDSA: this.securityFeatures.hasECDSA,\n hasMetadataProtection: this.securityFeatures.hasMetadataProtection,\n hasEnhancedReplayProtection: this.securityFeatures.hasEnhancedReplayProtection,\n hasNonExtractableKeys: this.securityFeatures.hasNonExtractableKeys,\n hasPFS: this.securityFeatures.hasPFS\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to enable security features after key generation', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n }\n }\n\n /**\n * Enhanced emergency mutex unlocking with authorization and validation\n */\n _emergencyUnlockAllMutexes(callerContext = 'unknown') {\n // Validate caller authorization\n const authorizedCallers = [\n 'keyOperation', 'cryptoOperation', 'connectionOperation',\n 'emergencyRecovery', 'systemShutdown', 'errorHandler'\n ];\n \n if (!authorizedCallers.includes(callerContext)) {\n this._secureLog('error', `\uD83D\uDEA8 UNAUTHORIZED emergency mutex unlock attempt`, {\n callerContext: callerContext,\n authorizedCallers: authorizedCallers,\n timestamp: Date.now()\n });\n throw new Error(`Unauthorized emergency mutex unlock attempt by: ${callerContext}`);\n }\n \n const mutexes = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n \n this._secureLog('error', '\uD83D\uDEA8 EMERGENCY: Unlocking all mutexes with authorization and state cleanup', {\n callerContext: callerContext,\n timestamp: Date.now()\n });\n \n let unlockedCount = 0;\n let errorCount = 0;\n \n mutexes.forEach(mutexName => {\n const mutex = this[`_${mutexName}Mutex`];\n if (mutex) {\n try {\n // Clear timeout first\n if (mutex.lockTimeout) {\n clearTimeout(mutex.lockTimeout);\n }\n \n // Log mutex state before emergency unlock\n const previousState = {\n locked: mutex.locked,\n lockId: mutex.lockId,\n lockTime: mutex.lockTime,\n queueLength: mutex.queue.length\n };\n \n // Reset mutex state atomically\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n mutex.lockTime = null;\n \n // Clear queue with proper error handling and logging\n let queueRejectCount = 0;\n mutex.queue.forEach(item => {\n try {\n if (item.reject && typeof item.reject === 'function') {\n item.reject(new Error(`Emergency mutex unlock for ${mutexName} by ${callerContext}`));\n queueRejectCount++;\n }\n } catch (rejectError) {\n this._secureLog('warn', `\u26A0\uFE0F Failed to reject queue item during emergency unlock`, {\n mutexName: mutexName,\n errorType: rejectError.constructor.name\n });\n }\n });\n \n // Clear queue array\n mutex.queue = [];\n \n unlockedCount++;\n \n this._secureLog('debug', `\uD83D\uDD13 Emergency unlocked mutex: ${mutexName}`, {\n previousState: previousState,\n queueRejectCount: queueRejectCount,\n callerContext: callerContext\n });\n \n } catch (error) {\n errorCount++;\n this._secureLog('error', `\u274C Error during emergency unlock of mutex: ${mutexName}`, {\n errorType: error.constructor.name,\n errorMessage: error.message,\n callerContext: callerContext\n });\n }\n }\n });\n \n // Reset key system state with validation\n if (this._keySystemState) {\n try {\n const previousKeyState = { ...this._keySystemState };\n \n this._keySystemState.isInitializing = false;\n this._keySystemState.isRotating = false;\n this._keySystemState.isDestroying = false;\n this._keySystemState.operationId = null;\n this._keySystemState.concurrentOperations = 0;\n \n this._secureLog('debug', `\uD83D\uDD13 Emergency reset key system state`, {\n previousState: previousKeyState,\n callerContext: callerContext\n });\n \n } catch (error) {\n this._secureLog('error', `\u274C Error resetting key system state during emergency unlock`, {\n errorType: error.constructor.name,\n errorMessage: error.message,\n callerContext: callerContext\n });\n }\n }\n \n // Log emergency unlock summary\n this._secureLog('info', `\uD83D\uDEA8 Emergency mutex unlock completed`, {\n callerContext: callerContext,\n unlockedCount: unlockedCount,\n errorCount: errorCount,\n totalMutexes: mutexes.length,\n timestamp: Date.now()\n });\n \n // Trigger system validation after emergency unlock\n setTimeout(() => {\n this._validateMutexSystemAfterEmergencyUnlock();\n }, 100);\n }\n\n /**\n * Handle key operation errors with recovery mechanisms\n */\n _handleKeyOperationError(error, operationId) {\n this._secureLog('error', '\uD83D\uDEA8 Key operation error detected, initiating recovery', {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Reset key system state immediately\n if (this._keySystemState) {\n this._keySystemState.isInitializing = false;\n this._keySystemState.isRotating = false;\n this._keySystemState.isDestroying = false;\n this._keySystemState.operationId = null;\n }\n \n // Clear any partial key data\n this.ecdhKeyPair = null;\n this.ecdsaKeyPair = null;\n this.encryptionKey = null;\n this.macKey = null;\n this.metadataKey = null;\n \n // Trigger emergency recovery if needed\n if (error.message.includes('timeout') || error.message.includes('race condition')) {\n this._secureLog('warn', '\u26A0\uFE0F Race condition or timeout detected, triggering emergency recovery');\n this._emergencyRecoverMutexSystem();\n }\n }\n\n /**\n * Generate cryptographically secure IV with reuse prevention\n */\n _generateSecureIV(ivSize = 12, context = 'general') {\n // Check if we're in emergency mode\n if (this._ivTrackingSystem.emergencyMode) {\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: IV generation blocked - emergency mode active due to IV reuse');\n throw new Error('IV generation blocked - emergency mode active');\n }\n \n let attempts = 0;\n const maxAttempts = 100; // Prevent infinite loops\n \n while (attempts < maxAttempts) {\n attempts++;\n \n // Generate fresh IV with crypto.getRandomValues\n const iv = crypto.getRandomValues(new Uint8Array(ivSize));\n \n // Convert IV to string for tracking\n const ivString = Array.from(iv).map(b => b.toString(16).padStart(2, '0')).join('');\n \n // Check for IV reuse\n if (this._ivTrackingSystem.usedIVs.has(ivString)) {\n this._ivTrackingSystem.collisionCount++;\n this._secureLog('error', `\uD83D\uDEA8 CRITICAL: IV reuse detected!`, {\n context: context,\n attempt: attempts,\n collisionCount: this._ivTrackingSystem.collisionCount,\n ivString: ivString.substring(0, 16) + '...' // Log partial IV for debugging\n });\n \n // If too many collisions, trigger emergency mode\n if (this._ivTrackingSystem.collisionCount > 5) {\n this._ivTrackingSystem.emergencyMode = true;\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Emergency mode activated due to excessive IV reuse');\n throw new Error('Emergency mode: Excessive IV reuse detected');\n }\n \n continue; // Try again\n }\n \n // Validate IV entropy\n if (!this._validateIVEntropy(iv)) {\n this._ivTrackingSystem.entropyValidation.entropyFailures++;\n this._secureLog('warn', `\u26A0\uFE0F Low entropy IV detected`, {\n context: context,\n attempt: attempts,\n entropyFailures: this._ivTrackingSystem.entropyValidation.entropyFailures\n });\n \n // If too many entropy failures, trigger emergency mode\n if (this._ivTrackingSystem.entropyValidation.entropyFailures > 10) {\n this._ivTrackingSystem.emergencyMode = true;\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Emergency mode activated due to low entropy IVs');\n throw new Error('Emergency mode: Low entropy IVs detected');\n }\n \n continue; // Try again\n }\n \n // Track IV usage\n this._ivTrackingSystem.usedIVs.add(ivString);\n this._ivTrackingSystem.ivHistory.set(ivString, {\n timestamp: Date.now(),\n context: context,\n attempt: attempts\n });\n \n // Track per-session IVs\n if (this.sessionId) {\n if (!this._ivTrackingSystem.sessionIVs.has(this.sessionId)) {\n this._ivTrackingSystem.sessionIVs.set(this.sessionId, new Set());\n }\n this._ivTrackingSystem.sessionIVs.get(this.sessionId).add(ivString);\n }\n \n // Validate RNG periodically\n this._validateRNGQuality();\n \n this._secureLog('debug', `\u2705 Secure IV generated`, {\n context: context,\n attempt: attempts,\n ivSize: ivSize,\n totalIVs: this._ivTrackingSystem.usedIVs.size\n });\n \n return iv;\n }\n \n // If we can't generate a unique IV after max attempts\n this._secureLog('error', `\u274C Failed to generate unique IV after ${maxAttempts} attempts`, {\n context: context,\n totalIVs: this._ivTrackingSystem.usedIVs.size\n });\n throw new Error(`Failed to generate unique IV after ${maxAttempts} attempts`);\n }\n \n /**\n * Validate IV entropy to detect weak RNG\n */\n _validateIVEntropy(iv) {\n this._ivTrackingSystem.entropyValidation.entropyTests++;\n \n // Calculate byte distribution\n const byteCounts = new Array(256).fill(0);\n for (let i = 0; i < iv.length; i++) {\n byteCounts[iv[i]]++;\n }\n \n // Multi-dimensional entropy analysis\n const entropyResults = {\n shannon: 0,\n min: 0,\n collision: 0,\n compression: 0,\n quantum: 0\n };\n \n // 1. Shannon entropy calculation\n let shannonEntropy = 0;\n const totalBytes = iv.length;\n \n for (let i = 0; i < 256; i++) {\n if (byteCounts[i] > 0) {\n const probability = byteCounts[i] / totalBytes;\n shannonEntropy -= probability * Math.log2(probability);\n }\n }\n entropyResults.shannon = shannonEntropy;\n \n // 2. Min-entropy calculation (worst-case scenario)\n const maxCount = Math.max(...byteCounts);\n const maxProbability = maxCount / totalBytes;\n entropyResults.min = -Math.log2(maxProbability);\n \n // 3. Collision entropy calculation\n let collisionSum = 0;\n for (let i = 0; i < 256; i++) {\n if (byteCounts[i] > 0) {\n const probability = byteCounts[i] / totalBytes;\n collisionSum += probability * probability;\n }\n }\n entropyResults.collision = -Math.log2(collisionSum);\n \n // 4. Compression-based entropy estimation\n const ivString = Array.from(iv).map(b => String.fromCharCode(b)).join('');\n const compressedLength = this._estimateCompressedLength(ivString);\n entropyResults.compression = (1 - compressedLength / totalBytes) * 8;\n \n // 5. Quantum-resistant entropy analysis\n entropyResults.quantum = this._calculateQuantumResistantEntropy(iv);\n \n // Enhanced suspicious pattern detection\n const hasSuspiciousPatterns = this._detectAdvancedSuspiciousPatterns(iv);\n \n // Multi-criteria validation\n const minEntropyThreshold = this._ivTrackingSystem.entropyValidation.minEntropy;\n const isValid = (\n entropyResults.shannon >= minEntropyThreshold &&\n entropyResults.min >= minEntropyThreshold * 0.8 &&\n entropyResults.collision >= minEntropyThreshold * 0.9 &&\n entropyResults.compression >= minEntropyThreshold * 0.7 &&\n entropyResults.quantum >= minEntropyThreshold * 0.6 &&\n !hasSuspiciousPatterns\n );\n \n if (!isValid) {\n this._secureLog('warn', `\u26A0\uFE0F Enhanced IV entropy validation failed`, {\n shannon: entropyResults.shannon.toFixed(2),\n min: entropyResults.min.toFixed(2),\n collision: entropyResults.collision.toFixed(2),\n compression: entropyResults.compression.toFixed(2),\n quantum: entropyResults.quantum.toFixed(2),\n minThreshold: minEntropyThreshold,\n hasSuspiciousPatterns: hasSuspiciousPatterns\n });\n }\n \n return isValid;\n }\n \n /**\n * Estimate compressed length for entropy calculation\n * @param {string} data - Data to estimate compression\n * @returns {number} Estimated compressed length\n */\n _estimateCompressedLength(data) {\n // Simple LZ77-like compression estimation\n let compressedLength = 0;\n let i = 0;\n \n while (i < data.length) {\n let matchLength = 0;\n let matchDistance = 0;\n \n // Look for repeated patterns\n for (let j = Math.max(0, i - 255); j < i; j++) {\n let k = 0;\n while (i + k < data.length && data[i + k] === data[j + k] && k < 255) {\n k++;\n }\n if (k > matchLength) {\n matchLength = k;\n matchDistance = i - j;\n }\n }\n \n if (matchLength >= 3) {\n compressedLength += 3; // Distance + length + literal\n i += matchLength;\n } else {\n compressedLength += 1;\n i += 1;\n }\n }\n \n return compressedLength;\n }\n\n /**\n * Calculate quantum-resistant entropy\n * @param {Uint8Array} data - Data to analyze\n * @returns {number} Quantum-resistant entropy score\n */\n _calculateQuantumResistantEntropy(data) {\n // Quantum-resistant entropy analysis\n let quantumScore = 0;\n \n // 1. Check for quantum-vulnerable patterns\n const hasQuantumVulnerablePatterns = this._detectQuantumVulnerablePatterns(data);\n if (hasQuantumVulnerablePatterns) {\n quantumScore -= 2;\n }\n \n // 2. Analyze bit distribution\n const bitDistribution = this._analyzeBitDistribution(data);\n quantumScore += bitDistribution.score;\n \n // 3. Check for periodicity\n const periodicity = this._detectPeriodicity(data);\n quantumScore -= periodicity * 0.5;\n \n // 4. Normalize to 0-8 range\n return Math.max(0, Math.min(8, quantumScore));\n }\n\n /**\n * Detect quantum-vulnerable patterns\n * @param {Uint8Array} data - Data to analyze\n * @returns {boolean} true if quantum-vulnerable patterns found\n */\n _detectQuantumVulnerablePatterns(data) {\n // Check for patterns vulnerable to quantum attacks\n const patterns = [\n [0, 0, 0, 0, 0, 0, 0, 0], // All zeros\n [255, 255, 255, 255, 255, 255, 255, 255], // All ones\n [0, 1, 0, 1, 0, 1, 0, 1], // Alternating\n [1, 0, 1, 0, 1, 0, 1, 0] // Alternating reverse\n ];\n \n for (const pattern of patterns) {\n for (let i = 0; i <= data.length - pattern.length; i++) {\n let match = true;\n for (let j = 0; j < pattern.length; j++) {\n if (data[i + j] !== pattern[j]) {\n match = false;\n break;\n }\n }\n if (match) return true;\n }\n }\n \n return false;\n }\n\n /**\n * Analyze bit distribution\n * @param {Uint8Array} data - Data to analyze\n * @returns {Object} Bit distribution analysis\n */\n _analyzeBitDistribution(data) {\n let ones = 0;\n let totalBits = data.length * 8;\n \n for (const byte of data) {\n ones += (byte >>> 0).toString(2).split('1').length - 1;\n }\n \n const zeroRatio = (totalBits - ones) / totalBits;\n const oneRatio = ones / totalBits;\n \n // Ideal distribution is 50/50\n const deviation = Math.abs(0.5 - oneRatio);\n const score = Math.max(0, 8 - deviation * 16);\n \n return { score, zeroRatio, oneRatio, deviation };\n }\n\n /**\n * Detect periodicity in data\n * @param {Uint8Array} data - Data to analyze\n * @returns {number} Periodicity score (0-1)\n */\n _detectPeriodicity(data) {\n if (data.length < 16) return 0;\n \n let maxPeriodicity = 0;\n \n // Check for periods from 2 to data.length/2\n for (let period = 2; period <= data.length / 2; period++) {\n let matches = 0;\n let totalChecks = 0;\n \n for (let i = 0; i < data.length - period; i++) {\n if (data[i] === data[i + period]) {\n matches++;\n }\n totalChecks++;\n }\n \n if (totalChecks > 0) {\n const periodicity = matches / totalChecks;\n maxPeriodicity = Math.max(maxPeriodicity, periodicity);\n }\n }\n \n return maxPeriodicity;\n }\n\n /**\n * Enhanced suspicious pattern detection\n * @param {Uint8Array} iv - IV to check\n * @returns {boolean} true if suspicious patterns found\n */\n _detectAdvancedSuspiciousPatterns(iv) {\n // Enhanced pattern detection with quantum-resistant analysis\n const patterns = [\n // Sequential patterns\n [0, 1, 2, 3, 4, 5, 6, 7],\n [255, 254, 253, 252, 251, 250, 249, 248],\n \n // Repeated patterns\n [0, 0, 0, 0, 0, 0, 0, 0],\n [255, 255, 255, 255, 255, 255, 255, 255],\n \n // Alternating patterns\n [0, 255, 0, 255, 0, 255, 0, 255],\n [255, 0, 255, 0, 255, 0, 255, 0]\n ];\n \n for (const pattern of patterns) {\n for (let i = 0; i <= iv.length - pattern.length; i++) {\n let match = true;\n for (let j = 0; j < pattern.length; j++) {\n if (iv[i + j] !== pattern[j]) {\n match = false;\n break;\n }\n }\n if (match) return true;\n }\n }\n \n // Check for low entropy regions\n const entropyMap = this._calculateLocalEntropy(iv);\n const lowEntropyRegions = entropyMap.filter(e => e < 3.0).length;\n \n return lowEntropyRegions > iv.length * 0.3; // More than 30% low entropy\n }\n\n /**\n * Calculate local entropy for pattern detection\n * @param {Uint8Array} data - Data to analyze\n * @returns {Array} Array of local entropy values\n */\n _calculateLocalEntropy(data) {\n const windowSize = 8;\n const entropyMap = [];\n \n for (let i = 0; i <= data.length - windowSize; i++) {\n const window = data.slice(i, i + windowSize);\n const charCount = {};\n \n for (const byte of window) {\n charCount[byte] = (charCount[byte] || 0) + 1;\n }\n \n let entropy = 0;\n for (const count of Object.values(charCount)) {\n const probability = count / windowSize;\n entropy -= probability * Math.log2(probability);\n }\n \n entropyMap.push(entropy);\n }\n \n return entropyMap;\n }\n\n /**\n * Detect suspicious patterns in IVs\n */\n _detectSuspiciousIVPatterns(iv) {\n // Check for all zeros or all ones\n const allZeros = iv.every(byte => byte === 0);\n const allOnes = iv.every(byte => byte === 255);\n \n if (allZeros || allOnes) {\n return true;\n }\n \n // Check for sequential patterns\n let sequentialCount = 0;\n for (let i = 1; i < iv.length; i++) {\n if (iv[i] === iv[i-1] + 1 || iv[i] === iv[i-1] - 1) {\n sequentialCount++;\n } else {\n sequentialCount = 0;\n }\n \n if (sequentialCount >= 3) {\n return true; // Suspicious sequential pattern\n }\n }\n \n // Check for repeated patterns\n for (let patternLength = 2; patternLength <= Math.floor(iv.length / 2); patternLength++) {\n for (let start = 0; start <= iv.length - patternLength * 2; start++) {\n const pattern1 = iv.slice(start, start + patternLength);\n const pattern2 = iv.slice(start + patternLength, start + patternLength * 2);\n \n if (pattern1.every((byte, index) => byte === pattern2[index])) {\n return true; // Repeated pattern detected\n }\n }\n }\n \n return false;\n }\n \n /**\n * Clean up old IVs with strict limits\n */\n _cleanupOldIVs() {\n const now = Date.now();\n const maxAge = 1800000; // Reduced to 30 minutes for better security\n let cleanedCount = 0;\n const cleanupBatch = [];\n \n // Aggressive cleanup with quantum-resistant patterns\n // Enforce maximum IV history size with batch processing\n if (this._ivTrackingSystem.ivHistory.size > this._ivTrackingSystem.maxIVHistorySize) {\n const ivArray = Array.from(this._ivTrackingSystem.ivHistory.entries());\n const toRemove = ivArray.slice(0, ivArray.length - this._ivTrackingSystem.maxIVHistorySize);\n \n for (const [ivString] of toRemove) {\n cleanupBatch.push(ivString);\n cleanedCount++;\n \n // Process in batches to prevent memory spikes\n if (cleanupBatch.length >= 100) {\n this._processCleanupBatch(cleanupBatch);\n cleanupBatch.length = 0;\n }\n }\n }\n \n // Clean up old IVs from history by age with enhanced security\n for (const [ivString, metadata] of this._ivTrackingSystem.ivHistory.entries()) {\n if (now - metadata.timestamp > maxAge) {\n cleanupBatch.push(ivString);\n cleanedCount++;\n \n // Process in batches to prevent memory spikes\n if (cleanupBatch.length >= 100) {\n this._processCleanupBatch(cleanupBatch);\n cleanupBatch.length = 0;\n }\n }\n }\n \n // Process remaining batch\n if (cleanupBatch.length > 0) {\n this._processCleanupBatch(cleanupBatch);\n }\n \n // Enhanced session IV cleanup with entropy preservation\n for (const [sessionId, sessionIVs] of this._ivTrackingSystem.sessionIVs.entries()) {\n if (sessionIVs.size > this._ivTrackingSystem.maxSessionIVs) {\n const ivArray = Array.from(sessionIVs);\n const toRemove = ivArray.slice(0, ivArray.length - this._ivTrackingSystem.maxSessionIVs);\n \n for (const ivString of toRemove) {\n sessionIVs.delete(ivString);\n this._ivTrackingSystem.usedIVs.delete(ivString);\n this._ivTrackingSystem.ivHistory.delete(ivString);\n cleanedCount++;\n }\n }\n }\n \n // Force garbage collection if available and significant cleanup occurred\n if (typeof window.gc === 'function' && cleanedCount > 50) {\n try {\n window.gc();\n } catch (e) {\n // Ignore GC errors\n }\n }\n \n if (cleanedCount > 0) {\n this._secureLog('debug', `\uD83E\uDDF9 Enhanced cleanup: ${cleanedCount} old IVs removed`, {\n cleanedCount: cleanedCount,\n remainingIVs: this._ivTrackingSystem.usedIVs.size,\n remainingHistory: this._ivTrackingSystem.ivHistory.size,\n memoryPressure: this._calculateMemoryPressure()\n });\n }\n }\n \n /**\n * Process cleanup batch with constant-time operations\n * @param {Array} batch - Batch of items to clean up\n */\n _processCleanupBatch(batch) {\n // Constant-time batch processing\n for (const item of batch) {\n this._ivTrackingSystem.usedIVs.delete(item);\n this._ivTrackingSystem.ivHistory.delete(item);\n }\n }\n\n /**\n * Calculate memory pressure for adaptive cleanup\n * @returns {number} Memory pressure score (0-100)\n */\n _calculateMemoryPressure() {\n const totalIVs = this._ivTrackingSystem.usedIVs.size;\n const maxAllowed = this._resourceLimits.maxIVHistory;\n \n return Math.min(100, Math.floor((totalIVs / maxAllowed) * 100));\n }\n\n /**\n * Get IV tracking system statistics\n */\n _getIVTrackingStats() {\n return {\n totalIVs: this._ivTrackingSystem.usedIVs.size,\n collisionCount: this._ivTrackingSystem.collisionCount,\n entropyTests: this._ivTrackingSystem.entropyValidation.entropyTests,\n entropyFailures: this._ivTrackingSystem.entropyValidation.entropyFailures,\n rngTests: this._ivTrackingSystem.rngValidation.testsPerformed,\n weakRngDetected: this._ivTrackingSystem.rngValidation.weakRngDetected,\n emergencyMode: this._ivTrackingSystem.emergencyMode,\n sessionCount: this._ivTrackingSystem.sessionIVs.size,\n lastCleanup: this._lastIVCleanupTime || 0\n };\n }\n \n /**\n * Reset IV tracking system (for testing or emergency recovery)\n */\n _resetIVTrackingSystem() {\n this._secureLog('warn', '\uD83D\uDD04 Resetting IV tracking system');\n \n this._ivTrackingSystem.usedIVs.clear();\n this._ivTrackingSystem.ivHistory.clear();\n this._ivTrackingSystem.sessionIVs.clear();\n this._ivTrackingSystem.collisionCount = 0;\n this._ivTrackingSystem.entropyValidation.entropyTests = 0;\n this._ivTrackingSystem.entropyValidation.entropyFailures = 0;\n this._ivTrackingSystem.rngValidation.testsPerformed = 0;\n this._ivTrackingSystem.rngValidation.weakRngDetected = false;\n this._ivTrackingSystem.emergencyMode = false;\n \n this._secureLog('info', '\u2705 IV tracking system reset completed');\n }\n \n /**\n * Validate RNG quality\n */\n _validateRNGQuality() {\n const now = Date.now();\n \n // Validate RNG every 1000 IV generations\n if (this._ivTrackingSystem.rngValidation.testsPerformed % 1000 === 0) {\n try {\n // Generate test IVs and validate\n const testIVs = [];\n for (let i = 0; i < 100; i++) {\n testIVs.push(crypto.getRandomValues(new Uint8Array(12)));\n }\n \n // Check for duplicates in test set\n const testIVStrings = testIVs.map(iv => Array.from(iv).map(b => b.toString(16).padStart(2, '0')).join(''));\n const uniqueTestIVs = new Set(testIVStrings);\n \n if (uniqueTestIVs.size < 95) { // Allow some tolerance\n this._ivTrackingSystem.rngValidation.weakRngDetected = true;\n this._secureLog('error', '\uD83D\uDEA8 CRITICAL: Weak RNG detected in validation test', {\n uniqueIVs: uniqueTestIVs.size,\n totalTests: testIVs.length\n });\n }\n \n this._ivTrackingSystem.rngValidation.lastValidation = now;\n \n } catch (error) {\n this._secureLog('error', '\u274C RNG validation failed', {\n errorType: error.constructor.name\n });\n }\n }\n \n this._ivTrackingSystem.rngValidation.testsPerformed++;\n }\n \n /**\n * Handle mutex timeout with enhanced state validation\n */\n _handleMutexTimeout(mutexName, operationId, timeout) {\n const mutex = this[`_${mutexName}Mutex`];\n \n if (!mutex) {\n this._secureLog('error', `\u274C Mutex '${mutexName}' not found during timeout handling`);\n return;\n }\n \n // Validate timeout conditions\n if (mutex.lockId !== operationId) {\n this._secureLog('warn', `\u26A0\uFE0F Timeout for different operation ID on mutex '${mutexName}'`, {\n expectedOperationId: operationId,\n actualLockId: mutex.lockId,\n locked: mutex.locked\n });\n return;\n }\n \n if (!mutex.locked) {\n this._secureLog('warn', `\u26A0\uFE0F Timeout for already unlocked mutex '${mutexName}'`, {\n operationId: operationId\n });\n return;\n }\n \n try {\n // Calculate lock duration for monitoring\n const lockDuration = mutex.lockTime ? Date.now() - mutex.lockTime : 0;\n \n this._secureLog('warn', `\u26A0\uFE0F Mutex '${mutexName}' auto-released due to timeout`, {\n operationId: operationId,\n lockDuration: lockDuration,\n timeout: timeout,\n queueLength: mutex.queue.length\n });\n \n // Atomic release with state validation\n mutex.locked = false;\n mutex.lockId = null;\n mutex.lockTimeout = null;\n mutex.lockTime = null;\n \n // Process next in queue with error handling\n setTimeout(() => {\n try {\n this._processNextInQueue(mutexName);\n } catch (queueError) {\n this._secureLog('error', `\u274C Error processing queue after timeout for mutex '${mutexName}'`, {\n errorType: queueError.constructor.name,\n errorMessage: queueError.message\n });\n }\n }, 10);\n \n } catch (error) {\n this._secureLog('error', `\u274C Critical error during mutex timeout handling for '${mutexName}'`, {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n \n // Force emergency unlock if timeout handling fails\n try {\n this._emergencyUnlockAllMutexes('timeoutHandler');\n } catch (emergencyError) {\n this._secureLog('error', `\u274C Emergency unlock failed during timeout handling`, {\n originalError: error.message,\n emergencyError: emergencyError.message\n });\n }\n }\n }\n\n /**\n * Validate mutex system after emergency unlock\n */\n _validateMutexSystemAfterEmergencyUnlock() {\n const mutexes = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n let validationErrors = 0;\n \n this._secureLog('info', '\uD83D\uDD0D Validating mutex system after emergency unlock');\n \n mutexes.forEach(mutexName => {\n const mutex = this[`_${mutexName}Mutex`];\n \n if (!mutex) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' not found after emergency unlock`);\n return;\n }\n \n // Validate mutex state consistency\n if (mutex.locked) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still locked after emergency unlock`, {\n lockId: mutex.lockId,\n lockTime: mutex.lockTime\n });\n }\n \n if (mutex.lockId !== null) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still has lock ID after emergency unlock`, {\n lockId: mutex.lockId\n });\n }\n \n if (mutex.lockTimeout !== null) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still has timeout after emergency unlock`);\n }\n \n if (mutex.queue.length > 0) {\n validationErrors++;\n this._secureLog('error', `\u274C Mutex '${mutexName}' still has queue items after emergency unlock`, {\n queueLength: mutex.queue.length\n });\n }\n });\n \n // Validate key system state\n if (this._keySystemState) {\n if (this._keySystemState.isInitializing || \n this._keySystemState.isRotating || \n this._keySystemState.isDestroying) {\n validationErrors++;\n this._secureLog('error', `\u274C Key system state not properly reset after emergency unlock`, {\n isInitializing: this._keySystemState.isInitializing,\n isRotating: this._keySystemState.isRotating,\n isDestroying: this._keySystemState.isDestroying\n });\n }\n }\n \n if (validationErrors === 0) {\n this._secureLog('info', '\u2705 Mutex system validation passed after emergency unlock');\n } else {\n this._secureLog('error', `\u274C Mutex system validation failed after emergency unlock`, {\n validationErrors: validationErrors\n });\n \n // Force re-initialization if validation fails\n setTimeout(() => {\n this._emergencyRecoverMutexSystem();\n }, 1000);\n }\n }\n /**\n * NEW: Diagnostics of the mutex system state\n */\n _getMutexSystemDiagnostics() {\n const diagnostics = {\n timestamp: Date.now(),\n systemValid: this._validateMutexSystem(),\n mutexes: {},\n counters: { ...this._operationCounters },\n keySystemState: { ...this._keySystemState }\n };\n \n const mutexNames = ['keyOperation', 'cryptoOperation', 'connectionOperation'];\n \n mutexNames.forEach(mutexName => {\n const mutexPropertyName = `_${mutexName}Mutex`;\n const mutex = this[mutexPropertyName];\n \n if (mutex) {\n diagnostics.mutexes[mutexName] = {\n locked: mutex.locked,\n lockId: mutex.lockId,\n queueLength: mutex.queue.length,\n hasTimeout: !!mutex.lockTimeout\n };\n } else {\n diagnostics.mutexes[mutexName] = { error: 'not_found' };\n }\n });\n \n return diagnostics;\n }\n\n /**\n * FULLY FIXED createSecureOffer()\n * With race-condition protection and improved security\n */\n async createSecureOffer() {\n console.log('\uD83C\uDFAF createSecureOffer called');\n return this._withMutex('connectionOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDCE4 Creating secure offer with mutex', {\n operationId: operationId,\n connectionAttempts: this.connectionAttempts,\n currentState: this.peerConnection?.connectionState || 'none'\n });\n \n try {\n // ============================================\n // PHASE 1: INITIALIZATION AND VALIDATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 1: Initialization and validation');\n \n // Reset notification flags for a new connection\n this._resetNotificationFlags();\n \n // Rate limiting check\n if (!this._checkRateLimit()) {\n throw new Error('Connection rate limit exceeded. Please wait before trying again.');\n }\n \n // Reset attempt counters\n this.connectionAttempts = 0;\n \n // Generate session salt (64 bytes for v4.0)\n this.sessionSalt = window.EnhancedSecureCryptoUtils.generateSalt();\n console.log('\uD83C\uDFAF PHASE 1 completed: Session salt generated');\n \n this._secureLog('debug', '\uD83E\uDDC2 Session salt generated', {\n operationId: operationId,\n saltLength: this.sessionSalt.length,\n isValidSalt: Array.isArray(this.sessionSalt) && this.sessionSalt.length === 64\n });\n \n // ============================================\n // PHASE 2: SECURE KEY GENERATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 2: Secure key generation');\n \n // Secure key generation via mutex\n const keyPairs = await this._generateEncryptionKeys();\n this.ecdhKeyPair = keyPairs.ecdhKeyPair;\n this.ecdsaKeyPair = keyPairs.ecdsaKeyPair;\n \n // Validate generated keys\n if (!this.ecdhKeyPair?.privateKey || !this.ecdhKeyPair?.publicKey) {\n throw new Error('Failed to generate valid ECDH key pair');\n }\n \n if (!this.ecdsaKeyPair?.privateKey || !this.ecdsaKeyPair?.publicKey) {\n throw new Error('Failed to generate valid ECDSA key pair');\n }\n \n // ============================================\n // PHASE 3: MITM PROTECTION AND FINGERPRINTING\n // ============================================\n console.log('\uD83C\uDFAF PHASE 3: MITM protection and fingerprinting');\n \n // MITM Protection: Compute unique key fingerprints\n const ecdhFingerprint = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(\n await crypto.subtle.exportKey('spki', this.ecdhKeyPair.publicKey)\n );\n const ecdsaFingerprint = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(\n await crypto.subtle.exportKey('spki', this.ecdsaKeyPair.publicKey)\n );\n \n // Validate fingerprints\n if (!ecdhFingerprint || !ecdsaFingerprint) {\n throw new Error('Failed to generate key fingerprints');\n }\n \n this._secureLog('info', 'Generated unique key pairs for MITM protection', {\n operationId: operationId,\n hasECDHFingerprint: !!ecdhFingerprint,\n hasECDSAFingerprint: !!ecdsaFingerprint,\n fingerprintLength: ecdhFingerprint.length,\n timestamp: Date.now()\n });\n \n // ============================================\n // PHASE 4: EXPORT SIGNED KEYS\n // ============================================\n console.log('\uD83C\uDFAF PHASE 4: Export signed keys');\n \n // Export keys with digital signatures\n const ecdhPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdhKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDH'\n );\n \n const ecdsaPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdsaKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDSA'\n );\n\n \n if (!ecdhPublicKeyData || typeof ecdhPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDH key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export validation failed - hard abort required');\n }\n \n if (!ecdhPublicKeyData.keyData || !ecdhPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdhPublicKeyData.keyData,\n hasSignature: !!ecdhPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export incomplete - hard abort required');\n }\n \n if (!ecdsaPublicKeyData || typeof ecdsaPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDSA key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export validation failed - hard abort required');\n }\n \n if (!ecdsaPublicKeyData.keyData || !ecdsaPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdsaPublicKeyData.keyData,\n hasSignature: !!ecdsaPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export incomplete - hard abort required');\n }\n \n // ============================================\n // PHASE 5: UPDATE SECURITY FEATURES\n // ============================================\n console.log('\uD83C\uDFAF PHASE 5: Update security features');\n \n // Atomic update of security features\n this._updateSecurityFeatures({\n hasEncryption: true,\n hasECDH: true,\n hasECDSA: true,\n hasMutualAuth: true,\n hasMetadataProtection: true,\n hasEnhancedReplayProtection: true,\n hasNonExtractableKeys: true,\n hasRateLimiting: true,\n hasEnhancedValidation: true,\n hasPFS: true\n });\n \n // ============================================\n // PHASE 6: INITIALIZE PEER CONNECTION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 6: Initialize peer connection');\n \n this.isInitiator = true;\n this.onStatusChange('connecting');\n \n // Create peer connection\n this.createPeerConnection();\n \n // Create main data channel\n this.dataChannel = this.peerConnection.createDataChannel('securechat', {\n ordered: true\n });\n \n // Setup data channel\n this.setupDataChannel(this.dataChannel);\n \n this._secureLog('debug', '\uD83D\uDD17 Data channel created', {\n operationId: operationId,\n channelLabel: this.dataChannel.label,\n channelOrdered: this.dataChannel.ordered\n });\n \n // ============================================\n // PHASE 7: CREATE SDP OFFER\n // ============================================\n console.log('\uD83C\uDFAF PHASE 7: Create SDP offer');\n \n // Create WebRTC offer\n console.log('\uD83C\uDFAF Creating WebRTC offer...');\n const offer = await this.peerConnection.createOffer({\n offerToReceiveAudio: false,\n offerToReceiveVideo: false\n });\n console.log('\uD83C\uDFAF WebRTC offer created successfully');\n \n // Set local description\n console.log('\uD83C\uDFAF Setting local description...');\n await this.peerConnection.setLocalDescription(offer);\n console.log('\uD83C\uDFAF Local description set successfully');\n \n // Extract and store our DTLS fingerprint for out-of-band verification\n console.log('\uD83C\uDFAF Extracting DTLS fingerprint...');\n try {\n const ourFingerprint = this._extractDTLSFingerprintFromSDP(offer.sdp);\n this.expectedDTLSFingerprint = ourFingerprint;\n console.log('\uD83C\uDFAF DTLS fingerprint extracted successfully');\n \n this._secureLog('info', 'Generated DTLS fingerprint for out-of-band verification', {\n fingerprint: ourFingerprint,\n context: 'offer_creation'\n });\n \n // Notify UI that fingerprint is ready for out-of-band verification\n this.deliverMessageToUI(`\uD83D\uDD10 DTLS fingerprint ready for verification: ${ourFingerprint}`, 'system');\n } catch (error) {\n this._secureLog('error', 'Failed to extract DTLS fingerprint from offer', { error: error.message });\n // Continue without fingerprint validation (fallback mode)\n }\n \n // Await ICE gathering\n await this.waitForIceGathering();\n \n this._secureLog('debug', '\uD83E\uDDCA ICE gathering completed', {\n operationId: operationId,\n iceGatheringState: this.peerConnection.iceGatheringState,\n connectionState: this.peerConnection.connectionState\n });\n \n // ============================================\n // PHASE 8: GENERATE SAS FOR OUT-OF-BAND VERIFICATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 8: Generate SAS for out-of-band verification');\n\n this.verificationCode = window.EnhancedSecureCryptoUtils.generateVerificationCode();\n console.log('\uD83C\uDFAF Placeholder verification code generated:', this.verificationCode);\n \n // Validate verification code\n if (!this.verificationCode || this.verificationCode.length < EnhancedSecureWebRTCManager.SIZES.VERIFICATION_CODE_MIN_LENGTH) {\n throw new Error('Failed to generate valid verification code');\n }\n \n // ============================================\n // PHASE 9: MUTUAL AUTHENTICATION CHALLENGE\n // ============================================\n console.log('\uD83C\uDFAF PHASE 9: Mutual authentication challenge');\n \n // Generate challenge for mutual authentication\n const authChallenge = window.EnhancedSecureCryptoUtils.generateMutualAuthChallenge();\n \n if (!authChallenge) {\n throw new Error('Failed to generate mutual authentication challenge');\n }\n \n // ============================================\n // PHASE 10: SESSION ID FOR MITM PROTECTION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 10: Session ID for MITM protection');\n \n // MITM Protection: Generate session-specific ID\n this.sessionId = Array.from(crypto.getRandomValues(new Uint8Array(EnhancedSecureWebRTCManager.SIZES.SESSION_ID_LENGTH)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n \n // Validate session ID\n if (!this.sessionId || this.sessionId.length !== (EnhancedSecureWebRTCManager.SIZES.SESSION_ID_LENGTH * 2)) {\n throw new Error('Failed to generate valid session ID');\n }\n \n // Generate connection ID for AAD\n this.connectionId = Array.from(crypto.getRandomValues(new Uint8Array(8)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n \n // ============================================\n // PHASE 11: SECURITY LEVEL CALCULATION\n // ============================================\n console.log('\uD83C\uDFAF PHASE 11: Security level calculation');\n \n // All security features are enabled by default\n const securityLevel = {\n level: 'MAXIMUM',\n score: 100,\n color: 'green',\n details: 'All security features enabled by default',\n passedChecks: 10,\n totalChecks: 10,\n isRealData: true\n };\n \n // ============================================\n // PHASE 12: CREATE OFFER PACKAGE\n // ============================================\n console.log('\uD83C\uDFAF PHASE 12: Create offer package');\n \n const currentTimestamp = Date.now();\n console.log('\uD83C\uDFAF Creating offer package object...');\n \n // Create compact offer package for smaller QR codes\n const offerPackage = {\n // Core information (minimal)\n t: 'offer', // type\n s: this.peerConnection.localDescription.sdp, // sdp\n v: '4.0', // version\n ts: currentTimestamp, // timestamp\n \n // Cryptographic keys (essential)\n e: ecdhPublicKeyData, // ecdhPublicKey\n d: ecdsaPublicKeyData, // ecdsaPublicKey\n \n // Session data (essential)\n sl: this.sessionSalt, // salt\n si: this.sessionId, // sessionId\n ci: this.connectionId, // connectionId\n \n // Authentication (essential)\n vc: this.verificationCode, // verificationCode\n ac: authChallenge, // authChallenge\n \n // Security metadata (simplified)\n slv: 'MAX', // securityLevel\n \n // Key fingerprints (shortened)\n kf: {\n e: ecdhFingerprint.substring(0, 12), // ecdh (12 chars)\n d: ecdsaFingerprint.substring(0, 12) // ecdsa (12 chars)\n }\n };\n console.log('\uD83C\uDFAF Offer package object created successfully');\n \n // ============================================\n // PHASE 13: VALIDATE OFFER PACKAGE\n // ============================================\n console.log('\uD83C\uDFAF PHASE 13: Validate offer package');\n \n // Final validation of the generated package\n console.log('\uD83C\uDFAF Validating offer package...');\n try {\n const validationResult = this.validateEnhancedOfferData(offerPackage);\n console.log('\uD83C\uDFAF Validation result:', validationResult);\n if (!validationResult) {\n console.log('\uD83C\uDFAF Offer package validation FAILED');\n throw new Error('Generated offer package failed validation');\n }\n console.log('\uD83C\uDFAF Offer package validation PASSED');\n } catch (validationError) {\n console.log('\uD83C\uDFAF Validation ERROR:', validationError.message);\n throw new Error(`Offer package validation error: ${validationError.message}`);\n }\n \n // ============================================\n // PHASE 14: LOGGING AND EVENTS\n // ============================================\n console.log('\uD83C\uDFAF PHASE 14: Logging and events');\n \n this._secureLog('info', 'Enhanced secure offer created successfully', {\n operationId: operationId,\n version: offerPackage.version,\n hasECDSA: true,\n hasMutualAuth: true,\n hasSessionId: !!offerPackage.sessionId,\n securityLevel: securityLevel.level,\n timestamp: currentTimestamp,\n capabilitiesCount: 10 // All capabilities enabled by default\n });\n \n // Dispatch event about new connection\n document.dispatchEvent(new CustomEvent('new-connection', {\n detail: { \n type: 'offer',\n timestamp: currentTimestamp,\n securityLevel: securityLevel.level,\n operationId: operationId\n }\n }));\n \n // ============================================\n // PHASE 15: RETURN RESULT\n // ============================================\n console.log('\uD83C\uDFAF PHASE 15: Return result');\n \n console.log('\uD83C\uDFAF createSecureOffer completed successfully, returning offerPackage');\n return offerPackage;\n \n } catch (error) {\n // ============================================\n // ERROR HANDLING\n // ============================================\n \n this._secureLog('error', '\u274C Enhanced secure offer creation failed in critical section', {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message,\n phase: this._determineErrorPhase(error),\n connectionAttempts: this.connectionAttempts\n });\n \n // Cleanup state on error\n this._cleanupFailedOfferCreation();\n \n // Update status\n this.onStatusChange('disconnected');\n \n // Re-throw for upper-level handling\n throw error;\n }\n }, 15000); // 15 seconds timeout for the entire offer creation\n }\n\n /**\n * HELPER: Determine the phase where the error occurred\n */\n _determineErrorPhase(error) {\n const message = error.message.toLowerCase();\n \n if (message.includes('rate limit')) return 'rate_limiting';\n if (message.includes('key pair') || message.includes('generate')) return 'key_generation';\n if (message.includes('fingerprint')) return 'fingerprinting';\n if (message.includes('export') || message.includes('signature')) return 'key_export';\n if (message.includes('peer connection')) return 'webrtc_setup';\n if (message.includes('offer') || message.includes('sdp')) return 'sdp_creation';\n if (message.includes('verification')) return 'verification_setup';\n if (message.includes('session')) return 'session_setup';\n if (message.includes('validation')) return 'package_validation';\n \n return 'unknown';\n }\n\n /**\n * Secure cleanup state after failed offer creation\n */\n _cleanupFailedOfferCreation() {\n try {\n // Secure wipe of cryptographic materials\n this._secureCleanupCryptographicMaterials();\n \n // Close peer connection if it was created\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Clear data channel\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n \n // Reset flags\n this.isInitiator = false;\n this.isVerified = false;\n \n // Reset security features to baseline\n this._updateSecurityFeatures({\n hasEncryption: false,\n hasECDH: false,\n hasECDSA: false,\n hasMutualAuth: false,\n hasMetadataProtection: false,\n hasEnhancedReplayProtection: false,\n hasNonExtractableKeys: false,\n hasEnhancedValidation: false,\n hasPFS: false\n });\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n this._secureLog('debug', '\uD83D\uDD12 Failed offer creation cleanup completed with secure memory wipe');\n \n } catch (cleanupError) {\n this._secureLog('error', '\u274C Error during offer creation cleanup', {\n errorType: cleanupError.constructor.name,\n errorMessage: cleanupError.message\n });\n }\n }\n\n /**\n * HELPER: Atomic update of security features (if not added yet)\n */\n _updateSecurityFeatures(updates) {\n const oldFeatures = { ...this.securityFeatures };\n \n try {\n Object.assign(this.securityFeatures, updates);\n \n this._secureLog('debug', '\uD83D\uDD27 Security features updated', {\n updatedCount: Object.keys(updates).length,\n totalFeatures: Object.keys(this.securityFeatures).length\n });\n \n } catch (error) {\n // Roll back on error\n this.securityFeatures = oldFeatures;\n this._secureLog('error', '\u274C Security features update failed, rolled back', {\n errorType: error.constructor.name\n });\n throw error;\n }\n }\n\n /**\n * FULLY FIXED METHOD createSecureAnswer()\n * With race-condition protection and enhanced security\n */\n async createSecureAnswer(offerData) {\n console.log('\uD83C\uDFAF createSecureAnswer called with offerData:', offerData ? 'present' : 'null');\n return this._withMutex('connectionOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDCE8 Creating secure answer with mutex', {\n operationId: operationId,\n hasOfferData: !!offerData,\n offerType: offerData?.type,\n offerVersion: offerData?.version,\n offerTimestamp: offerData?.timestamp\n });\n \n try {\n // ============================================\n // PHASE 1: PRE-VALIDATION OF OFFER\n // ============================================\n \n // Reset notification flags for a new connection\n this._resetNotificationFlags();\n \n this._secureLog('debug', 'Starting enhanced offer validation', {\n operationId: operationId,\n hasOfferData: !!offerData,\n offerType: offerData?.type,\n hasECDHKey: !!offerData?.ecdhPublicKey,\n hasECDSAKey: !!offerData?.ecdsaPublicKey,\n hasSalt: !!offerData?.salt\n });\n \n // Strict input validation\n if (!this.validateEnhancedOfferData(offerData)) {\n throw new Error('Invalid connection data format - failed enhanced validation');\n }\n \n // Rate limiting check\n if (!window.EnhancedSecureCryptoUtils.rateLimiter.checkConnectionRate(this.rateLimiterId)) {\n throw new Error('Connection rate limit exceeded. Please wait before trying again.');\n }\n \n // ============================================\n // PHASE 2: SECURITY AND ANTI-REPLAY PROTECTION\n // ============================================\n \n // MITM Protection: Validate offer data structure (support both formats)\n const timestamp = offerData.ts || offerData.timestamp;\n const version = offerData.v || offerData.version;\n if (!timestamp || !version) {\n throw new Error('Missing required security fields in offer data \u2013 possible MITM attack');\n }\n \n // Replay attack protection (window reduced to 5 minutes)\n const offerAge = Date.now() - timestamp;\n const MAX_OFFER_AGE = 300000; // 5 minutes instead of 1 hour\n \n if (offerAge > MAX_OFFER_AGE) {\n this._secureLog('error', 'Offer data is too old - possible replay attack', {\n operationId: operationId,\n offerAge: Math.round(offerAge / 1000),\n maxAllowedAge: Math.round(MAX_OFFER_AGE / 1000),\n timestamp: offerData.timestamp\n });\n \n // Notify the main code about the replay attack\n if (this.onAnswerError) {\n this.onAnswerError('replay_attack', 'Offer data is too old \u2013 possible replay attack');\n }\n \n throw new Error('Offer data is too old \u2013 possible replay attack');\n }\n \n // Protocol version compatibility check (support both formats)\n const protocolVersion = version; // Use the version we already extracted\n if (protocolVersion !== '4.0') {\n this._secureLog('warn', 'Protocol version mismatch detected', {\n operationId: operationId,\n expectedVersion: '4.0',\n receivedVersion: protocolVersion\n });\n \n // For backward compatibility with v3.0, a fallback can be added\n if (protocolVersion !== '3.0') {\n throw new Error(`Unsupported protocol version: ${protocolVersion}`);\n }\n }\n \n // ============================================\n // PHASE 3: EXTRACT AND VALIDATE SESSION SALT\n // ============================================\n \n // Set session salt from offer (support both formats)\n this.sessionSalt = offerData.sl || offerData.salt;\n \n // Validate session salt\n if (!Array.isArray(this.sessionSalt)) {\n throw new Error('Invalid session salt format - must be array');\n }\n \n const expectedSaltLength = protocolVersion === '4.0' ? 64 : 32;\n if (this.sessionSalt.length !== expectedSaltLength) {\n throw new Error(`Invalid session salt length: expected ${expectedSaltLength}, got ${this.sessionSalt.length}`);\n }\n \n // MITM Protection: Check salt integrity\n const saltFingerprint = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(this.sessionSalt);\n \n this._secureLog('info', 'Session salt validated successfully', {\n operationId: operationId,\n saltLength: this.sessionSalt.length,\n saltFingerprint: saltFingerprint.substring(0, 8)\n });\n \n // ============================================\n // PHASE 4: SECURE GENERATION OF OUR KEYS\n // ============================================\n \n // Secure generation of our keys via mutex\n const keyPairs = await this._generateEncryptionKeys();\n this.ecdhKeyPair = keyPairs.ecdhKeyPair;\n this.ecdsaKeyPair = keyPairs.ecdsaKeyPair;\n \n // Additional validation of generated keys\n if (!(this.ecdhKeyPair?.privateKey instanceof CryptoKey)) {\n this._secureLog('error', 'Local ECDH private key is not a CryptoKey', {\n operationId: operationId,\n hasKeyPair: !!this.ecdhKeyPair,\n privateKeyType: typeof this.ecdhKeyPair?.privateKey,\n privateKeyAlgorithm: this.ecdhKeyPair?.privateKey?.algorithm?.name\n });\n throw new Error('Local ECDH private key is not a valid CryptoKey');\n }\n \n // ============================================\n // PHASE 5: IMPORT AND VERIFY PEER KEYS\n // ============================================\n \n // Import peer ECDSA public key for signature verification (support both formats)\n let peerECDSAPublicKey;\n \n try {\n const ecdsaKey = offerData.d || offerData.ecdsaPublicKey;\n peerECDSAPublicKey = await crypto.subtle.importKey(\n 'spki',\n new Uint8Array(ecdsaKey.keyData),\n {\n name: 'ECDSA',\n namedCurve: 'P-384'\n },\n false,\n ['verify']\n );\n } catch (error) {\n this._throwSecureError(error, 'ecdsa_key_import');\n }\n \n // ============================================\n // PHASE 6: IMPORT AND VERIFY ECDH KEY\n // ============================================\n \n // Import and verify ECDH public key using verified ECDSA key (support both formats)\n let peerECDHPublicKey;\n \n try {\n const ecdhKey = offerData.e || offerData.ecdhPublicKey;\n peerECDHPublicKey = await window.EnhancedSecureCryptoUtils.importSignedPublicKey(\n ecdhKey,\n peerECDSAPublicKey,\n 'ECDH'\n );\n } catch (error) {\n this._secureLog('error', 'Failed to import signed ECDH public key', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._throwSecureError(error, 'ecdh_key_import');\n }\n \n // Final validation of ECDH key\n if (!(peerECDHPublicKey instanceof CryptoKey)) {\n this._secureLog('error', 'Peer ECDH public key is not a CryptoKey', {\n operationId: operationId,\n publicKeyType: typeof peerECDHPublicKey,\n publicKeyAlgorithm: peerECDHPublicKey?.algorithm?.name\n });\n throw new Error('Peer ECDH public key is not a valid CryptoKey');\n }\n \n // Save peer key for PFS rotation\n this.peerPublicKey = peerECDHPublicKey;\n \n // ============================================\n // PHASE 7: DERIVE SHARED ENCRYPTION KEYS\n // ============================================\n \n // Derive shared keys with metadata protection\n let derivedKeys;\n \n try {\n derivedKeys = await window.EnhancedSecureCryptoUtils.deriveSharedKeys(\n this.ecdhKeyPair.privateKey,\n peerECDHPublicKey,\n this.sessionSalt\n );\n } catch (error) {\n this._secureLog('error', 'Failed to derive shared keys', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._throwSecureError(error, 'key_derivation');\n }\n \n // Securely set keys via helper\n await this._setEncryptionKeys(\n derivedKeys.encryptionKey,\n derivedKeys.macKey,\n derivedKeys.metadataKey,\n derivedKeys.fingerprint\n );\n \n // Additional validation of installed keys\n if (!(this.encryptionKey instanceof CryptoKey) || \n !(this.macKey instanceof CryptoKey) || \n !(this.metadataKey instanceof CryptoKey)) {\n \n this._secureLog('error', 'Invalid key types after derivation', {\n operationId: operationId,\n encryptionKeyType: typeof this.encryptionKey,\n macKeyType: typeof this.macKey,\n metadataKeyType: typeof this.metadataKey\n });\n throw new Error('Invalid key types after derivation');\n }\n \n // Set verification code from offer\n this.verificationCode = offerData.verificationCode;\n \n this._secureLog('info', 'Encryption keys derived and set successfully', {\n operationId: operationId,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n hasMetadataKey: !!this.metadataKey,\n hasKeyFingerprint: !!this.keyFingerprint,\n mitmProtection: 'enabled',\n signatureVerified: true\n });\n \n // ============================================\n // PHASE 8: UPDATE SECURITY FEATURES\n // ============================================\n \n // Atomic update of security features\n this._updateSecurityFeatures({\n hasEncryption: true,\n hasECDH: true,\n hasECDSA: true,\n hasMutualAuth: true,\n hasMetadataProtection: true,\n hasEnhancedReplayProtection: true,\n hasNonExtractableKeys: true,\n hasRateLimiting: true,\n hasEnhancedValidation: true,\n hasPFS: true\n });\n \n // PFS: Initialize key version tracking\n this.currentKeyVersion = 0;\n this.lastKeyRotation = Date.now();\n this.keyVersions.set(0, {\n salt: this.sessionSalt,\n timestamp: this.lastKeyRotation,\n messageCount: 0\n });\n \n // ============================================\n // PHASE 9: CREATE AUTHENTICATION PROOF\n // ============================================\n \n // Create proof for mutual authentication\n let authProof;\n \n if (offerData.authChallenge) {\n try {\n authProof = await window.EnhancedSecureCryptoUtils.createAuthProof(\n offerData.authChallenge,\n this.ecdsaKeyPair.privateKey,\n this.ecdsaKeyPair.publicKey\n );\n } catch (error) {\n this._secureLog('error', 'Failed to create authentication proof', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n this._throwSecureError(error, 'authentication_proof_creation');\n }\n } else {\n this._secureLog('warn', 'No auth challenge in offer - mutual auth disabled', {\n operationId: operationId\n });\n }\n \n // ============================================\n // PHASE 10: INITIALIZE WEBRTC\n // ============================================\n \n this.isInitiator = false;\n this.onStatusChange('connecting');\n \n // DEBUG: Check keyFingerprint before calling onKeyExchange\n console.log('Before onKeyExchange - keyFingerprint:', this.keyFingerprint);\n this.onKeyExchange(this.keyFingerprint);\n \n // Create peer connection first\n this.createPeerConnection();\n \n // Validate DTLS fingerprint before setting remote description\n if (this.strictDTLSValidation) {\n try {\n const receivedFingerprint = this._extractDTLSFingerprintFromSDP(offerData.sdp);\n \n if (this.expectedDTLSFingerprint) {\n this._validateDTLSFingerprint(receivedFingerprint, this.expectedDTLSFingerprint, 'offer_validation');\n } else {\n // Store fingerprint for future validation (first connection)\n this.expectedDTLSFingerprint = receivedFingerprint;\n this._secureLog('info', 'Stored DTLS fingerprint for future validation', {\n fingerprint: receivedFingerprint,\n context: 'first_connection'\n });\n }\n } catch (error) {\n this._secureLog('warn', 'DTLS fingerprint validation failed - continuing in fallback mode', { \n error: error.message,\n context: 'offer_validation'\n });\n // Continue without strict fingerprint validation for first connection\n // This allows the connection to proceed while maintaining security awareness\n }\n } else {\n this._secureLog('info', 'DTLS fingerprint validation disabled - proceeding without validation');\n }\n\n // Set remote description from offer\n try {\n this._secureLog('debug', 'Setting remote description from offer', {\n operationId: operationId,\n sdpLength: offerData.sdp?.length || 0\n });\n \n await this.peerConnection.setRemoteDescription(new RTCSessionDescription({\n type: 'offer',\n sdp: offerData.s || offerData.sdp\n }));\n \n this._secureLog('debug', 'Remote description set successfully', {\n operationId: operationId,\n signalingState: this.peerConnection.signalingState\n });\n } catch (error) {\n this._secureLog('error', 'Failed to set remote description', { \n error: error.message,\n operationId: operationId\n });\n this._throwSecureError(error, 'webrtc_remote_description');\n }\n \n this._secureLog('debug', '\uD83D\uDD17 Remote description set successfully', {\n operationId: operationId,\n connectionState: this.peerConnection.connectionState,\n signalingState: this.peerConnection.signalingState\n });\n \n // ============================================\n // PHASE 11: CREATE SDP ANSWER\n // ============================================\n \n // Create WebRTC answer\n let answer;\n \n try {\n answer = await this.peerConnection.createAnswer({\n offerToReceiveAudio: false,\n offerToReceiveVideo: false\n });\n } catch (error) {\n this._throwSecureError(error, 'webrtc_create_answer');\n }\n \n // Set local description\n try {\n await this.peerConnection.setLocalDescription(answer);\n } catch (error) {\n this._throwSecureError(error, 'webrtc_local_description');\n }\n \n // Extract and store our DTLS fingerprint for out-of-band verification\n try {\n const ourFingerprint = this._extractDTLSFingerprintFromSDP(answer.sdp);\n this.expectedDTLSFingerprint = ourFingerprint;\n \n this._secureLog('info', 'Generated DTLS fingerprint for out-of-band verification', {\n fingerprint: ourFingerprint,\n context: 'answer_creation'\n });\n \n // Notify UI that fingerprint is ready for out-of-band verification\n this.deliverMessageToUI(`\uD83D\uDD10 DTLS fingerprint ready for verification: ${ourFingerprint}`, 'system');\n } catch (error) {\n this._secureLog('error', 'Failed to extract DTLS fingerprint from answer', { error: error.message });\n // Continue without fingerprint validation (fallback mode)\n }\n \n \n // Await ICE gathering\n await this.waitForIceGathering();\n \n this._secureLog('debug', '\uD83E\uDDCA ICE gathering completed for answer', {\n operationId: operationId,\n iceGatheringState: this.peerConnection.iceGatheringState,\n connectionState: this.peerConnection.connectionState\n });\n \n // ============================================\n // PHASE 12: EXPORT OUR KEYS\n // ============================================\n \n // Export our keys with signatures\n const ecdhPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdhKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDH'\n );\n \n const ecdsaPublicKeyData = await window.EnhancedSecureCryptoUtils.exportPublicKeyWithSignature(\n this.ecdsaKeyPair.publicKey,\n this.ecdsaKeyPair.privateKey,\n 'ECDSA'\n );\n \n if (!ecdhPublicKeyData || typeof ecdhPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDH key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export validation failed - hard abort required');\n }\n \n if (!ecdhPublicKeyData.keyData || !ecdhPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdhPublicKeyData.keyData,\n hasSignature: !!ecdhPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key export incomplete - hard abort required');\n }\n \n if (!ecdsaPublicKeyData || typeof ecdsaPublicKeyData !== 'object') {\n this._secureLog('error', 'CRITICAL: ECDSA key export failed - invalid object structure', { operationId });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export validation failed - hard abort required');\n }\n \n if (!ecdsaPublicKeyData.keyData || !ecdsaPublicKeyData.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key export incomplete - missing keyData or signature', { \n operationId,\n hasKeyData: !!ecdsaPublicKeyData.keyData,\n hasSignature: !!ecdsaPublicKeyData.signature \n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key export incomplete - hard abort required');\n }\n \n // ============================================\n // PHASE 13: SECURITY LEVEL CALCULATION\n // ============================================\n \n // All security features are enabled by default\n const securityLevel = {\n level: 'MAXIMUM',\n score: 100,\n color: 'green',\n details: 'All security features enabled by default',\n passedChecks: 10,\n totalChecks: 10,\n isRealData: true\n };\n \n // ============================================\n // PHASE 14: CREATE ANSWER PACKAGE\n // ============================================\n \n const currentTimestamp = Date.now();\n \n // Create compact answer package for smaller QR codes\n const answerPackage = {\n // Core information (minimal)\n t: 'answer', // type\n s: this.peerConnection.localDescription.sdp, // sdp\n v: '4.0', // version\n ts: currentTimestamp, // timestamp\n \n // Cryptographic keys (essential)\n e: ecdhPublicKeyData, // ecdhPublicKey\n d: ecdsaPublicKeyData, // ecdsaPublicKey\n \n // Authentication (essential)\n ap: authProof, // authProof\n \n // Security metadata (simplified)\n slv: 'MAX', // securityLevel\n \n // Session confirmation (simplified)\n sc: {\n sf: saltFingerprint.substring(0, 12), // saltFingerprint (12 chars)\n kd: true, // keyDerivationSuccess\n ma: true // mutualAuthEnabled\n }\n };\n \n // ============================================\n // PHASE 15: VALIDATION AND LOGGING\n // ============================================\n \n // Final validation of the answer package (support both formats)\n const hasSDP = answerPackage.s || answerPackage.sdp;\n const hasECDH = answerPackage.e || answerPackage.ecdhPublicKey;\n const hasECDSA = answerPackage.d || answerPackage.ecdsaPublicKey;\n \n if (!hasSDP || !hasECDH || !hasECDSA) {\n throw new Error('Generated answer package is incomplete');\n }\n \n this._secureLog('info', 'Enhanced secure answer created successfully', {\n operationId: operationId,\n version: answerPackage.version,\n hasECDSA: true,\n hasMutualAuth: !!authProof,\n hasSessionConfirmation: !!answerPackage.sessionConfirmation,\n securityLevel: securityLevel.level,\n timestamp: currentTimestamp,\n processingTime: currentTimestamp - offerData.timestamp\n });\n \n // Dispatch event about new connection\n document.dispatchEvent(new CustomEvent('new-connection', {\n detail: { \n type: 'answer',\n timestamp: currentTimestamp,\n securityLevel: securityLevel.level,\n operationId: operationId\n }\n }));\n \n // ============================================\n // PHASE 16: SCHEDULE SECURITY CALCULATIONS\n // ============================================\n \n // Plan security calculation after connection\n setTimeout(async () => {\n try {\n const realSecurityData = await this.calculateAndReportSecurityLevel();\n if (realSecurityData) {\n this.notifySecurityUpdate();\n this._secureLog('info', '\u2705 Post-connection security level calculated', {\n operationId: operationId,\n level: realSecurityData.level\n });\n }\n } catch (error) {\n this._secureLog('error', '\u274C Error calculating post-connection security', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n }\n }, 1000);\n \n // Retry if the first calculation fails\n setTimeout(async () => {\n if (!this.lastSecurityCalculation || this.lastSecurityCalculation.score < 50) {\n this._secureLog('info', '\uD83D\uDD04 Retrying security calculation', {\n operationId: operationId\n });\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpdate();\n }\n }, 3000);\n \n // Final security update\n this.notifySecurityUpdate();\n \n // ============================================\n // PHASE 17: RETURN RESULT\n // ============================================\n \n return answerPackage;\n \n } catch (error) {\n // ============================================\n // ERROR HANDLING\n // ============================================\n \n this._secureLog('error', '\u274C Enhanced secure answer creation failed in critical section', {\n operationId: operationId,\n errorType: error.constructor.name,\n errorMessage: error.message,\n phase: this._determineAnswerErrorPhase(error),\n offerAge: offerData?.timestamp ? Date.now() - offerData.timestamp : 'unknown'\n });\n \n // Cleanup state on error\n this._cleanupFailedAnswerCreation();\n \n // Update status\n this.onStatusChange('disconnected');\n \n // Special handling of security errors\n if (this.onAnswerError) {\n if (error.message.includes('too old') || error.message.includes('replay')) {\n this.onAnswerError('replay_attack', error.message);\n } else if (error.message.includes('MITM') || error.message.includes('signature')) {\n this.onAnswerError('security_violation', error.message);\n } else if (error.message.includes('validation') || error.message.includes('format')) {\n this.onAnswerError('invalid_format', error.message);\n } else {\n this.onAnswerError('general_error', error.message);\n }\n }\n \n // Re-throw for upper-level handling\n throw error;\n }\n }, 20000); // 20 seconds timeout for the entire answer creation (longer than offer)\n }\n\n /**\n * HELPER: Determine error phase for answer\n */\n _determineAnswerErrorPhase(error) {\n const message = error.message.toLowerCase();\n \n if (message.includes('validation') || message.includes('format')) return 'offer_validation';\n if (message.includes('rate limit')) return 'rate_limiting';\n if (message.includes('replay') || message.includes('too old')) return 'replay_protection';\n if (message.includes('salt')) return 'salt_validation';\n if (message.includes('key pair') || message.includes('generate')) return 'key_generation';\n if (message.includes('import') || message.includes('ecdsa') || message.includes('ecdh')) return 'key_import';\n if (message.includes('signature') || message.includes('mitm')) return 'signature_verification';\n if (message.includes('derive') || message.includes('shared')) return 'key_derivation';\n if (message.includes('auth') || message.includes('proof')) return 'authentication';\n if (message.includes('remote description') || message.includes('local description')) return 'webrtc_setup';\n if (message.includes('answer') || message.includes('sdp')) return 'sdp_creation';\n if (message.includes('export')) return 'key_export';\n if (message.includes('security level')) return 'security_calculation';\n \n return 'unknown';\n }\n\n /**\n * HELPER: Cleanup state after failed answer creation\n */\n /**\n * Secure cleanup state after failed answer creation\n */\n _cleanupFailedAnswerCreation() {\n try {\n // Secure wipe of cryptographic materials\n this._secureCleanupCryptographicMaterials();\n \n // Secure wipe of PFS key versions\n this.currentKeyVersion = 0;\n this.keyVersions.clear();\n this.oldKeys.clear();\n \n // Close peer connection if created\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Clear data channel\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n \n // Reset flags and counters\n this.isInitiator = false;\n this.isVerified = false;\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.messageCounter = 0;\n this.processedMessageIds.clear();\n this.replayWindow.clear(); // Clear replay window\n \n // Reset security features to baseline\n this._updateSecurityFeatures({\n hasEncryption: false,\n hasECDH: false,\n hasECDSA: false,\n hasMutualAuth: false,\n hasMetadataProtection: false,\n hasEnhancedReplayProtection: false,\n hasNonExtractableKeys: false,\n hasEnhancedValidation: false,\n hasPFS: false\n });\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n this._secureLog('debug', '\uD83D\uDD12 Failed answer creation cleanup completed with secure memory wipe');\n \n } catch (cleanupError) {\n this._secureLog('error', '\u274C Error during answer creation cleanup', {\n errorType: cleanupError.constructor.name,\n errorMessage: cleanupError.message\n });\n }\n }\n\n /**\n * HELPER: Securely set encryption keys (if not set yet)\n */\n async _setEncryptionKeys(encryptionKey, macKey, metadataKey, keyFingerprint) {\n return this._withMutex('keyOperation', async (operationId) => {\n this._secureLog('info', '\uD83D\uDD10 Setting encryption keys with mutex', {\n operationId: operationId\n });\n \n // Validate all keys before setting\n if (!(encryptionKey instanceof CryptoKey) ||\n !(macKey instanceof CryptoKey) ||\n !(metadataKey instanceof CryptoKey)) {\n throw new Error('Invalid key types provided');\n }\n \n if (!keyFingerprint || typeof keyFingerprint !== 'string') {\n throw new Error('Invalid key fingerprint provided');\n }\n \n // Atomically set all keys\n const oldKeys = {\n encryptionKey: this.encryptionKey,\n macKey: this.macKey,\n metadataKey: this.metadataKey,\n keyFingerprint: this.keyFingerprint\n };\n \n try {\n this.encryptionKey = encryptionKey;\n this.macKey = macKey;\n this.metadataKey = metadataKey;\n this.keyFingerprint = keyFingerprint;\n \n // Reset counters\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.messageCounter = 0;\n this.processedMessageIds.clear();\n this.replayWindow.clear(); // Clear replay window\n \n this._secureLog('info', '\u2705 Encryption keys set successfully', {\n operationId: operationId,\n hasAllKeys: !!(this.encryptionKey && this.macKey && this.metadataKey),\n hasFingerprint: !!this.keyFingerprint\n });\n \n return true;\n \n } catch (error) {\n // Roll back on error\n this.encryptionKey = oldKeys.encryptionKey;\n this.macKey = oldKeys.macKey;\n this.metadataKey = oldKeys.metadataKey;\n this.keyFingerprint = oldKeys.keyFingerprint;\n \n this._secureLog('error', '\u274C Key setting failed, rolled back', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n \n throw error;\n }\n });\n }\n\n async handleSecureAnswer(answerData) {\n console.log('\uD83C\uDFAF handleSecureAnswer called with answerData:', answerData ? 'present' : 'null');\n try {\n \n if (!answerData || typeof answerData !== 'object' || Array.isArray(answerData)) {\n this._secureLog('error', 'CRITICAL: Invalid answer data structure', { \n hasAnswerData: !!answerData,\n answerDataType: typeof answerData,\n isArray: Array.isArray(answerData)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Answer data must be a non-null object');\n }\n \n // Support both compact and legacy answer formats\n const isCompactAnswer = answerData.t === 'answer' && answerData.s;\n const isLegacyAnswer = answerData.type === 'enhanced_secure_answer' && answerData.sdp;\n \n if (!isCompactAnswer && !isLegacyAnswer) {\n this._secureLog('error', 'CRITICAL: Invalid answer format', { \n type: answerData.type || answerData.t,\n hasSdp: !!(answerData.sdp || answerData.s)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Invalid answer format - hard abort required');\n }\n\n // CRITICAL: Strict validation of ECDH public key structure\n // Support both full and compact key names\n const ecdhKey = answerData.ecdhPublicKey || answerData.e;\n const ecdsaKey = answerData.ecdsaPublicKey || answerData.d;\n \n console.log('\uD83D\uDD0D Answer data structure check:', {\n hasEcdhKey: !!ecdhKey,\n ecdhKeyType: typeof ecdhKey,\n isArray: Array.isArray(ecdhKey),\n answerKeys: Object.keys(answerData),\n ecdhKeyKeys: ecdhKey ? Object.keys(ecdhKey) : 'N/A',\n fullAnswerData: answerData,\n usingCompactKeys: !answerData.ecdhPublicKey && !!answerData.e\n });\n \n if (!ecdhKey || typeof ecdhKey !== 'object' || Array.isArray(ecdhKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDH public key structure in answer', { \n hasEcdhKey: !!ecdhKey,\n ecdhKeyType: typeof ecdhKey,\n isArray: Array.isArray(ecdhKey),\n availableKeys: Object.keys(answerData)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Missing or invalid ECDH public key structure');\n }\n \n if (!ecdhKey.keyData || !ecdhKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key missing keyData or signature in answer', { \n hasKeyData: !!ecdhKey.keyData,\n hasSignature: !!ecdhKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key missing keyData or signature');\n }\n\n // CRITICAL: Strict validation of ECDSA public key structure\n if (!ecdsaKey || typeof ecdsaKey !== 'object' || Array.isArray(ecdsaKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDSA public key structure in answer', { \n hasEcdsaKey: !!ecdsaKey,\n ecdsaKeyType: typeof ecdsaKey,\n isArray: Array.isArray(ecdsaKey)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Missing or invalid ECDSA public key structure');\n }\n \n if (!ecdsaKey.keyData || !ecdsaKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key missing keyData or signature in answer', { \n hasKeyData: !!ecdsaKey.keyData,\n hasSignature: !!ecdsaKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key missing keyData or signature');\n }\n\n // Additional MITM protection: Validate answer data structure\n // Support both compact and legacy formats\n const timestamp = answerData.ts || answerData.timestamp;\n const version = answerData.v || answerData.version;\n \n if (!timestamp || !version) {\n throw new Error('Missing required fields in response data \u2013 possible MITM attack');\n }\n\n // MITM Protection: Verify session ID if present (for enhanced security)\n if (answerData.sessionId && this.sessionId && answerData.sessionId !== this.sessionId) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Session ID mismatch detected - possible MITM attack', {\n expectedSessionId: this.sessionId,\n receivedSessionId: answerData.sessionId\n });\n throw new Error('Session ID mismatch \u2013 possible MITM attack');\n }\n\n // Check for replay attacks (reject answers older than 1 hour)\n const answerAge = Date.now() - answerData.timestamp;\n if (answerAge > 3600000) { // 1 hour in milliseconds\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Answer data is too old - possible replay attack', {\n answerAge: answerAge,\n timestamp: answerData.timestamp\n });\n \n // Notify the main code about the replay attack error\n if (this.onAnswerError) {\n this.onAnswerError('replay_attack', 'Response data is too old \u2013 possible replay attack');\n }\n \n throw new Error('Response data is too old \u2013 possible replay attack');\n }\n\n // Check protocol version compatibility\n if (answerData.version !== '4.0') {\n window.EnhancedSecureCryptoUtils.secureLog.log('warn', 'Incompatible protocol version in answer', {\n expectedVersion: '4.0',\n receivedVersion: answerData.version\n });\n }\n\n // Import ECDSA public key for verification (self-signed)\n const peerECDSAPublicKey = await crypto.subtle.importKey(\n 'spki',\n new Uint8Array(ecdsaKey.keyData),\n {\n name: 'ECDSA',\n namedCurve: 'P-384'\n },\n false,\n ['verify']\n );\n\n\n // Now import and verify the ECDH public key using the verified ECDSA key\n const peerPublicKey = await window.EnhancedSecureCryptoUtils.importPublicKeyFromSignedPackage(\n ecdhKey,\n peerECDSAPublicKey\n );\n \n // Additional MITM protection: Verify session salt integrity\n if (!this.sessionSalt || this.sessionSalt.length !== 64) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Invalid session salt detected - possible session hijacking', {\n saltLength: this.sessionSalt ? this.sessionSalt.length : 0\n });\n throw new Error('Invalid session salt \u2013 possible session hijacking attempt');\n }\n\n // Verify that the session salt hasn't been tampered with\n const expectedSaltHash = await window.EnhancedSecureCryptoUtils.calculateKeyFingerprint(this.sessionSalt);\n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Session salt integrity verified', {\n saltFingerprint: expectedSaltHash.substring(0, 8)\n });\n\n // Additional validation: Ensure all keys are CryptoKey instances before derivation\n if (!(this.ecdhKeyPair?.privateKey instanceof CryptoKey)) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Local ECDH private key is not a CryptoKey in handleSecureAnswer', {\n hasKeyPair: !!this.ecdhKeyPair,\n privateKeyType: typeof this.ecdhKeyPair?.privateKey,\n privateKeyAlgorithm: this.ecdhKeyPair?.privateKey?.algorithm?.name\n });\n throw new Error('Local ECDH private key is not a CryptoKey');\n }\n \n if (!(peerPublicKey instanceof CryptoKey)) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Peer ECDH public key is not a CryptoKey in handleSecureAnswer', {\n publicKeyType: typeof peerPublicKey,\n publicKeyAlgorithm: peerPublicKey?.algorithm?.name\n });\n throw new Error('Peer ECDH public key is not a CryptoKey');\n }\n\n // Store peer's public key for PFS key rotation\n this.peerPublicKey = peerPublicKey;\n \n // Initialize connection ID if not already set\n if (!this.connectionId) {\n this.connectionId = Array.from(crypto.getRandomValues(new Uint8Array(8)))\n .map(b => b.toString(16).padStart(2, '0')).join('');\n }\n\n \n const derivedKeys = await window.EnhancedSecureCryptoUtils.deriveSharedKeys(\n this.ecdhKeyPair.privateKey,\n peerPublicKey,\n this.sessionSalt\n );\n \n this.encryptionKey = derivedKeys.encryptionKey;\n this.macKey = derivedKeys.macKey;\n this.metadataKey = derivedKeys.metadataKey;\n this.keyFingerprint = derivedKeys.fingerprint;\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.messageCounter = 0;\n this.processedMessageIds.clear();\n this.replayWindow.clear(); // Clear replay window\n // Validate that all keys are properly set\n if (!(this.encryptionKey instanceof CryptoKey) || \n !(this.macKey instanceof CryptoKey) || \n !(this.metadataKey instanceof CryptoKey)) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Invalid key types after derivation in handleSecureAnswer', {\n encryptionKeyType: typeof this.encryptionKey,\n macKeyType: typeof this.macKey,\n metadataKeyType: typeof this.metadataKey,\n encryptionKeyAlgorithm: this.encryptionKey?.algorithm?.name,\n macKeyAlgorithm: this.macKey?.algorithm?.name,\n metadataKeyAlgorithm: this.metadataKey?.algorithm?.name\n });\n throw new Error('Invalid key types after export');\n }\n \n this._secureLog('info', 'Encryption keys set in handleSecureAnswer', {\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n hasMetadataKey: !!this.metadataKey,\n hasKeyFingerprint: !!this.keyFingerprint,\n mitmProtection: 'enabled',\n signatureVerified: true\n });\n \n // Update security features for initiator after successful key exchange\n this.securityFeatures.hasMutualAuth = true;\n this.securityFeatures.hasMetadataProtection = true;\n this.securityFeatures.hasEnhancedReplayProtection = true;\n this.securityFeatures.hasPFS = true;\n \n // PFS: Initialize key version tracking\n this.currentKeyVersion = 0;\n this.lastKeyRotation = Date.now();\n this.keyVersions.set(0, {\n salt: this.sessionSalt,\n timestamp: this.lastKeyRotation,\n messageCount: 0\n });\n \n this.onKeyExchange(this.keyFingerprint);\n\n // Compute SAS for MITM protection (Offer side - Answer handler)\n try {\n console.log('Starting SAS computation for Offer side (Answer handler)');\n const remoteFP = this._extractDTLSFingerprintFromSDP(answerData.sdp || answerData.s); // \u0443\u0436\u0435 \u0435\u0441\u0442\u044C \u0432 \u043A\u043E\u0434\u0435\n const localFP = this.expectedDTLSFingerprint; // \u0442\u044B \u0435\u0433\u043E \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0448\u044C \u043F\u0440\u0438 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u0438 \u043E\u0444\u0444\u0435\u0440\u0430/\u043E\u0442\u0432\u0435\u0442\u0430\n const keyBytes = this._decodeKeyFingerprint(this.keyFingerprint); // \u0443\u0442\u0438\u043B\u0438\u0442\u0430 \u0434\u0435\u043A\u043E\u0434\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\n console.log('SAS computation parameters:', { \n remoteFP: remoteFP ? remoteFP.substring(0, 16) + '...' : 'null/undefined', \n localFP: localFP ? localFP.substring(0, 16) + '...' : 'null/undefined', \n keyBytesLength: keyBytes ? keyBytes.length : 'null/undefined',\n keyBytesType: keyBytes ? keyBytes.constructor.name : 'null/undefined'\n });\n\n this.verificationCode = await this._computeSAS(keyBytes, localFP, remoteFP);\n this.onStatusChange?.('verifying'); // \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C SAS \u0438 \u0436\u0434\u0451\u043C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F\n this.onVerificationRequired(this.verificationCode);\n \n // CRITICAL: Store SAS code to send when data channel opens\n this.pendingSASCode = this.verificationCode;\n console.log('\uD83D\uDCE4 SAS code ready to send when data channel opens:', this.verificationCode);\n \n this._secureLog('info', 'SAS verification code generated for MITM protection (Offer side)', {\n sasCode: this.verificationCode,\n localFP: localFP.substring(0, 16) + '...',\n remoteFP: remoteFP.substring(0, 16) + '...',\n timestamp: Date.now()\n });\n } catch (sasError) {\n console.error('SAS computation failed in handleSecureAnswer (Offer side):', sasError);\n this._secureLog('error', 'SAS computation failed in handleSecureAnswer (Offer side)', {\n error: sasError.message,\n stack: sasError.stack,\n timestamp: Date.now()\n });\n }\n\n // Validate DTLS fingerprint before setting remote description\n if (this.strictDTLSValidation) {\n try {\n const receivedFingerprint = this._extractDTLSFingerprintFromSDP(answerData.sdp || answerData.s);\n \n if (this.expectedDTLSFingerprint) {\n this._validateDTLSFingerprint(receivedFingerprint, this.expectedDTLSFingerprint, 'answer_validation');\n } else {\n // Store fingerprint for future validation (first connection)\n this.expectedDTLSFingerprint = receivedFingerprint;\n this._secureLog('info', 'Stored DTLS fingerprint for future validation', {\n fingerprint: receivedFingerprint,\n context: 'first_connection'\n });\n }\n } catch (error) {\n this._secureLog('warn', 'DTLS fingerprint validation failed - continuing in fallback mode', { \n error: error.message,\n context: 'answer_validation'\n });\n\n }\n } else {\n this._secureLog('info', 'DTLS fingerprint validation disabled - proceeding without validation');\n }\n\n // Support both full and compact SDP field names\n const sdpData = answerData.sdp || answerData.s;\n \n this._secureLog('debug', 'Setting remote description from answer', {\n sdpLength: sdpData?.length || 0,\n usingCompactSDP: !answerData.sdp && !!answerData.s\n });\n \n await this.peerConnection.setRemoteDescription({\n type: 'answer',\n sdp: sdpData\n });\n \n this._secureLog('debug', 'Remote description set successfully from answer', {\n signalingState: this.peerConnection.signalingState\n });\n \n console.log('Enhanced secure connection established');\n\n setTimeout(async () => {\n try {\n const securityData = await this.calculateAndReportSecurityLevel();\n if (securityData) {\n console.log('\u2705 Security level calculated after connection:', securityData.level);\n this.notifySecurityUpdate();\n }\n } catch (error) {\n this._secureLog('error', '\u274C Error calculating security after connection:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }, 1000);\n setTimeout(async () => {\n if (!this.lastSecurityCalculation || this.lastSecurityCalculation.score < 50) {\n console.log('\uD83D\uDD04 Retrying security calculation...');\n await this.calculateAndReportSecurityLevel();\n this.notifySecurityUpdate();\n }\n }, 3000);\n this.notifySecurityUpdate();\n } catch (error) {\n this._secureLog('error', 'Enhanced secure answer handling failed', {\n errorType: error.constructor.name\n });\n this.onStatusChange('failed');\n\n if (this.onAnswerError) {\n if (error.message.includes('too old') || error.message.includes('\u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0441\u0442\u0430\u0440\u044B\u0435')) {\n this.onAnswerError('replay_attack', error.message);\n } else if (error.message.includes('MITM') || error.message.includes('signature') || error.message.includes('\u043F\u043E\u0434\u043F\u0438\u0441\u044C')) {\n this.onAnswerError('security_violation', error.message);\n } else {\n this.onAnswerError('general_error', error.message);\n }\n }\n \n throw error;\n }\n }\n\n\n initiateVerification() {\n \n if (this.isInitiator) {\n // Ensure verification initiation notice wasn't already sent\n if (!this.verificationInitiationSent) {\n this.verificationInitiationSent = true;\n this.deliverMessageToUI('\uD83D\uDD10 CRITICAL: Compare verification code with peer out-of-band (voice/video/in-person) to prevent MITM attack!', 'system');\n this.deliverMessageToUI(`\uD83D\uDD10 Your verification code: ${this.verificationCode}`, 'system');\n this.deliverMessageToUI('\uD83D\uDD10 Ask peer to confirm this exact code before allowing traffic!', 'system');\n }\n } else {\n // Answer side: Wait for SAS code from Offer side\n console.log('\uD83D\uDCE5 Answer side: Waiting for SAS code from Offer side');\n this.deliverMessageToUI('\uD83D\uDCE5 Waiting for verification code from peer...', 'system');\n }\n }\n\n confirmVerification() {\n \n try {\n console.log('\uD83D\uDCE4 confirmVerification - sending local confirmation');\n \n // Mark local verification as confirmed\n this.localVerificationConfirmed = true;\n \n // Send confirmation to peer\n const confirmationPayload = {\n type: 'verification_confirmed',\n data: {\n timestamp: Date.now(),\n verificationMethod: 'SAS',\n securityLevel: 'MITM_PROTECTION_REQUIRED'\n }\n };\n \n console.log('\uD83D\uDCE4 Sending verification confirmation:', confirmationPayload);\n this.dataChannel.send(JSON.stringify(confirmationPayload));\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Check if both parties have confirmed\n this._checkBothVerificationsConfirmed();\n \n // Notify UI about local confirmation\n this.deliverMessageToUI('\u2705 You confirmed the verification code. Waiting for peer confirmation...', 'system');\n \n this.processMessageQueue();\n } catch (error) {\n this._secureLog('error', '\u274C SAS verification failed:', { errorType: error?.constructor?.name || 'Unknown' });\n this.deliverMessageToUI('\u274C SAS verification failed', 'system');\n }\n }\n\n _checkBothVerificationsConfirmed() {\n // Check if both parties have confirmed verification\n if (this.localVerificationConfirmed && this.remoteVerificationConfirmed && !this.bothVerificationsConfirmed) {\n console.log('\uD83C\uDF89 Both parties confirmed verification!');\n this.bothVerificationsConfirmed = true;\n \n // Notify both parties that verification is complete\n const bothConfirmedPayload = {\n type: 'verification_both_confirmed',\n data: {\n timestamp: Date.now(),\n verificationMethod: 'SAS',\n securityLevel: 'MITM_PROTECTION_COMPLETE'\n }\n };\n \n console.log('\uD83D\uDCE4 Sending both confirmed notification:', bothConfirmedPayload);\n this.dataChannel.send(JSON.stringify(bothConfirmedPayload));\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Set verified status and open chat after 2 second delay\n this.deliverMessageToUI('\uD83C\uDF89 Both parties confirmed! Opening secure chat in 2 seconds...', 'system');\n \n setTimeout(() => {\n this._setVerifiedStatus(true, 'MUTUAL_SAS_CONFIRMED', { \n code: this.verificationCode,\n timestamp: Date.now()\n });\n this._enforceVerificationGate('mutual_confirmed', false);\n this.onStatusChange?.('verified');\n }, 2000);\n }\n }\n\n handleVerificationConfirmed(data) {\n // Handle peer's verification confirmation\n console.log('\uD83D\uDCE5 Received verification confirmation from peer');\n this.remoteVerificationConfirmed = true;\n \n // Notify UI about peer confirmation\n this.deliverMessageToUI('\u2705 Peer confirmed the verification code. Waiting for your confirmation...', 'system');\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Check if both parties have confirmed\n this._checkBothVerificationsConfirmed();\n }\n\n handleVerificationBothConfirmed(data) {\n // Handle notification that both parties have confirmed\n console.log('\uD83D\uDCE5 Received both confirmed notification from peer');\n this.bothVerificationsConfirmed = true;\n \n // Notify UI about state change\n if (this.onVerificationStateChange) {\n this.onVerificationStateChange({\n localConfirmed: this.localVerificationConfirmed,\n remoteConfirmed: this.remoteVerificationConfirmed,\n bothConfirmed: this.bothVerificationsConfirmed\n });\n }\n \n // Set verified status and open chat after 2 second delay\n this.deliverMessageToUI('\uD83C\uDF89 Both parties confirmed! Opening secure chat in 2 seconds...', 'system');\n \n setTimeout(() => {\n this._setVerifiedStatus(true, 'MUTUAL_SAS_CONFIRMED', { \n code: this.verificationCode,\n timestamp: Date.now()\n });\n this._enforceVerificationGate('mutual_confirmed', false);\n this.onStatusChange?.('verified');\n }, 2000);\n }\n\n handleVerificationRequest(data) {\n \n console.log('\uD83D\uDD0D handleVerificationRequest called with:');\n console.log(' - receivedCode:', data.code, '(type:', typeof data.code, ')');\n console.log(' - expectedCode:', this.verificationCode, '(type:', typeof this.verificationCode, ')');\n console.log(' - codesMatch:', data.code === this.verificationCode);\n console.log(' - data object:', data);\n \n if (data.code === this.verificationCode) {\n // \u2705 SAS verification successful - MITM protection confirmed\n const responsePayload = {\n type: 'verification_response',\n data: {\n ok: true,\n timestamp: Date.now(),\n verificationMethod: 'SAS', // Indicate SAS was used\n securityLevel: 'MITM_PROTECTED'\n }\n };\n this.dataChannel.send(JSON.stringify(responsePayload));\n \n // Ensure verification success notice wasn't already sent\n if (!this.verificationNotificationSent) {\n this.verificationNotificationSent = true;\n this.deliverMessageToUI('\u2705 SAS verification successful! MITM protection confirmed. Channel is now secure!', 'system');\n }\n \n this.processMessageQueue();\n } else {\n // \u274C SAS verification failed - possible MITM attack\n console.log('\u274C SAS verification failed - codes do not match, disconnecting');\n const responsePayload = {\n type: 'verification_response',\n data: {\n ok: false,\n timestamp: Date.now(),\n reason: 'code_mismatch'\n }\n };\n this.dataChannel.send(JSON.stringify(responsePayload));\n \n this._secureLog('error', 'SAS verification failed - possible MITM attack', {\n receivedCode: data.code,\n expectedCode: this.verificationCode,\n timestamp: Date.now()\n });\n \n this.deliverMessageToUI('\u274C SAS verification failed! Possible MITM attack detected. Connection aborted for safety!', 'system');\n this.disconnect();\n }\n }\n\n handleSASCode(data) {\n \n console.log('\uD83D\uDCE5 Received SAS code from Offer side:', data.code);\n \n this.verificationCode = data.code;\n this.onStatusChange?.('verifying'); // \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C SAS \u0438 \u0436\u0434\u0451\u043C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F\n this.onVerificationRequired(this.verificationCode);\n \n this._secureLog('info', 'SAS code received from Offer side', {\n sasCode: this.verificationCode,\n timestamp: Date.now()\n });\n }\n\n handleVerificationResponse(data) {\n \n if (data.ok === true) {\n \n // Log successful mutual SAS verification\n this._secureLog('info', 'Mutual SAS verification completed - MITM protection active', {\n verificationMethod: data.verificationMethod || 'SAS',\n securityLevel: data.securityLevel || 'MITM_PROTECTED',\n timestamp: Date.now()\n });\n \n // Ensure verification success notice wasn't already sent\n if (!this.verificationNotificationSent) {\n this.verificationNotificationSent = true;\n this.deliverMessageToUI('\u2705 Mutual SAS verification complete! MITM protection active. Channel is now secure!', 'system');\n }\n \n this.processMessageQueue();\n } else {\n // \u274C Peer verification failed - connection not secure\n this._secureLog('error', 'Peer SAS verification failed - connection not secure', {\n responseData: data,\n timestamp: Date.now()\n });\n \n this.deliverMessageToUI('\u274C Peer verification failed! Connection not secure!', 'system');\n this.disconnect();\n }\n }\n\n validateOfferData(offerData) {\n return offerData &&\n offerData.type === 'enhanced_secure_offer' &&\n offerData.sdp &&\n offerData.publicKey &&\n offerData.salt &&\n offerData.verificationCode &&\n Array.isArray(offerData.publicKey) &&\n Array.isArray(offerData.salt) &&\n offerData.salt.length === 32;\n }\n\n validateEnhancedOfferData(offerData) {\n console.log('\uD83C\uDFAF validateEnhancedOfferData called with:', offerData ? 'valid object' : 'null/undefined');\n try {\n // CRITICAL: Strict type checking to prevent syntax errors\n if (!offerData || typeof offerData !== 'object' || Array.isArray(offerData)) {\n this._secureLog('error', 'CRITICAL: Invalid offer data structure', { \n hasOfferData: !!offerData,\n offerDataType: typeof offerData,\n isArray: Array.isArray(offerData)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Offer data must be a non-null object');\n }\n\n // Basic required fields will be validated after format detection\n\n // Check if this is v4.0 compact format or legacy format\n const isV4CompactFormat = offerData.v === '4.0' && offerData.e && offerData.d;\n const isV4Format = offerData.version === '4.0' && offerData.ecdhPublicKey && offerData.ecdsaPublicKey;\n \n // Validate offer type (support compact, legacy v3.0 and v4.0 formats)\n const isValidType = isV4CompactFormat ? \n ['offer'].includes(offerData.t) :\n ['enhanced_secure_offer', 'secure_offer'].includes(offerData.type);\n \n if (!isValidType) {\n throw new Error('Invalid offer type');\n }\n \n if (isV4CompactFormat) {\n // v4.0 compact format validation\n const compactRequiredFields = [\n 'e', 'd', 'sl', 'vc', 'si', 'ci', 'ac', 'slv'\n ];\n \n for (const field of compactRequiredFields) {\n if (!offerData[field]) {\n throw new Error(`Missing required v4.0 compact field: ${field}`);\n }\n }\n \n // Validate key structures\n if (!offerData.e || typeof offerData.e !== 'object' || Array.isArray(offerData.e)) {\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDH public key structure');\n }\n \n if (!offerData.d || typeof offerData.d !== 'object' || Array.isArray(offerData.d)) {\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDSA public key structure');\n }\n \n // Validate salt length\n if (!Array.isArray(offerData.sl) || offerData.sl.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes for v4.0');\n }\n \n // Validate verification code format\n if (typeof offerData.vc !== 'string' || offerData.vc.length < 6) {\n throw new Error('Invalid verification code format');\n }\n \n // Validate security level\n if (!['MAX', 'HIGH', 'MED', 'LOW'].includes(offerData.slv)) {\n throw new Error('Invalid security level');\n }\n \n // Validate timestamp (not older than 1 hour)\n const offerAge = Date.now() - offerData.ts;\n if (offerAge > 3600000) {\n throw new Error('Offer is too old (older than 1 hour)');\n }\n \n this._secureLog('info', 'v4.0 compact offer validation passed', {\n version: offerData.v,\n hasECDH: !!offerData.e,\n hasECDSA: !!offerData.d,\n hasSalt: !!offerData.sl,\n hasVerificationCode: !!offerData.vc,\n securityLevel: offerData.slv,\n offerAge: Math.round(offerAge / 1000) + 's'\n });\n } else if (isV4Format) {\n // v4.0 enhanced validation\n const v4RequiredFields = [\n 'ecdhPublicKey', 'ecdsaPublicKey', 'salt', 'verificationCode',\n 'authChallenge', 'timestamp', 'version', 'securityLevel'\n ];\n\n for (const field of v4RequiredFields) {\n if (!offerData[field]) {\n throw new Error(`Missing v4.0 field: ${field}`);\n }\n }\n\n // Validate salt (must be 64 bytes for v4.0)\n if (!Array.isArray(offerData.salt) || offerData.salt.length !== 64) {\n throw new Error('Salt must be exactly 64 bytes for v4.0');\n }\n\n // Validate timestamp (not older than 1 hour)\n const offerAge = Date.now() - offerData.timestamp;\n if (offerAge > 3600000) {\n throw new Error('Offer is too old (older than 1 hour)');\n }\n\n // CRITICAL: Strict validation of key structures to prevent syntax errors\n if (!offerData.ecdhPublicKey || typeof offerData.ecdhPublicKey !== 'object' || Array.isArray(offerData.ecdhPublicKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDH public key structure', { \n hasEcdhKey: !!offerData.ecdhPublicKey,\n ecdhKeyType: typeof offerData.ecdhPublicKey,\n isArray: Array.isArray(offerData.ecdhPublicKey)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDH public key structure - hard abort required');\n }\n\n if (!offerData.ecdsaPublicKey || typeof offerData.ecdsaPublicKey !== 'object' || Array.isArray(offerData.ecdsaPublicKey)) {\n this._secureLog('error', 'CRITICAL: Invalid ECDSA public key structure', { \n hasEcdsaKey: !!offerData.ecdsaPublicKey,\n ecdsaKeyType: typeof offerData.ecdsaPublicKey,\n isArray: Array.isArray(offerData.ecdsaPublicKey)\n });\n throw new Error('CRITICAL SECURITY FAILURE: Invalid ECDSA public key structure - hard abort required');\n }\n\n // CRITICAL: Validate key internal structure to prevent syntax errors\n if (!offerData.ecdhPublicKey.keyData || !offerData.ecdhPublicKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDH key missing keyData or signature', { \n hasKeyData: !!offerData.ecdhPublicKey.keyData,\n hasSignature: !!offerData.ecdhPublicKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDH key missing keyData or signature');\n }\n\n if (!offerData.ecdsaPublicKey.keyData || !offerData.ecdsaPublicKey.signature) {\n this._secureLog('error', 'CRITICAL: ECDSA key missing keyData or signature', { \n hasKeyData: !!offerData.ecdsaPublicKey.keyData,\n hasSignature: !!offerData.ecdsaPublicKey.signature\n });\n throw new Error('CRITICAL SECURITY FAILURE: ECDSA key missing keyData or signature');\n }\n\n if (typeof offerData.verificationCode !== 'string' || offerData.verificationCode.length < 6) {\n throw new Error('Invalid SAS verification code format - MITM protection required');\n }\n\n this._secureLog('info', 'v4.0 offer validation passed', {\n version: offerData.version,\n hasSecurityLevel: !!offerData.securityLevel?.level,\n offerAge: Math.round(offerAge / 1000) + 's'\n });\n } else {\n // v3.0 backward compatibility validation\n // NOTE: v3.0 has limited security - SAS verification is still critical\n const v3RequiredFields = ['publicKey', 'salt', 'verificationCode'];\n for (const field of v3RequiredFields) {\n if (!offerData[field]) {\n throw new Error(`Missing v3.0 field: ${field}`);\n }\n }\n\n // Validate salt (32 bytes for v3.0)\n if (!Array.isArray(offerData.salt) || offerData.salt.length !== 32) {\n throw new Error('Salt must be exactly 32 bytes for v3.0');\n }\n\n // Validate public key\n if (!Array.isArray(offerData.publicKey)) {\n throw new Error('Invalid public key format for v3.0');\n }\n\n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'v3.0 offer validation passed (backward compatibility)', {\n version: 'v3.0',\n legacy: true\n });\n }\n\n // Validate SDP structure (basic check for all versions)\n const sdp = isV4CompactFormat ? offerData.s : offerData.sdp;\n if (typeof sdp !== 'string' || !sdp.includes('v=0')) {\n throw new Error('Invalid SDP structure');\n }\n\n console.log('\uD83C\uDFAF validateEnhancedOfferData completed successfully');\n return true;\n } catch (error) {\n console.log('\uD83C\uDFAF validateEnhancedOfferData ERROR:', error.message);\n this._secureLog('error', 'CRITICAL: Security validation failed - hard abort required', {\n error: error.message,\n errorType: error.constructor.name,\n timestamp: Date.now()\n });\n\n throw new Error(`CRITICAL SECURITY VALIDATION FAILURE: ${error.message}`);\n }\n }\n\n async sendSecureMessage(message) {\n // Comprehensive input validation\n const validation = this._validateInputData(message, 'sendSecureMessage');\n if (!validation.isValid) {\n const errorMessage = `Input validation failed: ${validation.errors.join(', ')}`;\n this._secureLog('error', '\u274C Input validation failed in sendSecureMessage', {\n errors: validation.errors,\n messageType: typeof message\n });\n throw new Error(errorMessage);\n }\n\n // Rate limiting check\n if (!this._checkRateLimit('sendSecureMessage')) {\n throw new Error('Rate limit exceeded for secure message sending');\n }\n\n // Enforce verification gate\n this._enforceVerificationGate('sendSecureMessage');\n\n // Quick readiness check WITHOUT mutex\n if (!this.isConnected()) {\n if (validation.sanitizedData && typeof validation.sanitizedData === 'object' && validation.sanitizedData.type && validation.sanitizedData.type.startsWith('file_')) {\n throw new Error('Connection not ready for file transfer. Please ensure the connection is established and verified.');\n }\n this.messageQueue.push(validation.sanitizedData);\n throw new Error('Connection not ready. Message queued for sending.');\n }\n \n // Use mutex ONLY for cryptographic operations\n return this._withMutex('cryptoOperation', async (operationId) => {\n // Re-check inside critical section\n if (!this.isConnected() || !this.isVerified) {\n throw new Error('Connection lost during message preparation');\n }\n \n // Validate keys inside critical section\n if (!this.encryptionKey || !this.macKey || !this.metadataKey) {\n throw new Error('Encryption keys not initialized');\n }\n \n // Additional rate limiting check\n if (!window.EnhancedSecureCryptoUtils.rateLimiter.checkMessageRate(this.rateLimiterId)) {\n throw new Error('Message rate limit exceeded (60 messages per minute)');\n }\n \n try {\n // Accept strings and objects; stringify objects\n const textToSend = typeof validation.sanitizedData === 'string' ? validation.sanitizedData : JSON.stringify(validation.sanitizedData);\n const sanitizedMessage = window.EnhancedSecureCryptoUtils.sanitizeMessage(textToSend);\n const messageId = `msg_${Date.now()}_${this.messageCounter++}`;\n \n // Create AAD with sequence number for anti-replay protection\n if (typeof this._createMessageAAD !== 'function') {\n throw new Error('_createMessageAAD method is not available in sendSecureMessage. Manager may not be fully initialized.');\n }\n const aad = message.aad || this._createMessageAAD('enhanced_message', { content: sanitizedMessage });\n \n // Use enhanced encryption with AAD and sequence number\n const encryptedData = await window.EnhancedSecureCryptoUtils.encryptMessage(\n sanitizedMessage,\n this.encryptionKey,\n this.macKey,\n this.metadataKey,\n messageId,\n JSON.parse(aad).sequenceNumber // Use sequence number from AAD\n );\n \n const payload = {\n type: 'enhanced_message',\n data: encryptedData,\n keyVersion: this.currentKeyVersion,\n version: '4.0'\n };\n \n this.dataChannel.send(JSON.stringify(payload));\n // Locally display only plain strings to avoid UI duplication\n if (typeof validation.sanitizedData === 'string') {\n this.deliverMessageToUI(validation.sanitizedData, 'sent');\n }\n \n this._secureLog('debug', '\uD83D\uDCE4 Secure message sent successfully', {\n operationId: operationId,\n messageLength: sanitizedMessage.length,\n keyVersion: this.currentKeyVersion\n });\n \n } catch (error) {\n this._secureLog('error', '\u274C Secure message sending failed', {\n operationId: operationId,\n errorType: error.constructor.name\n });\n throw error;\n }\n }, 2000); // Reduced timeout for crypto operations\n }\n\n processMessageQueue() {\n while (this.messageQueue.length > 0 && this.isConnected() && this.isVerified) {\n const message = this.messageQueue.shift();\n this.sendSecureMessage(message).catch(console.error);\n }\n }\n\n startHeartbeat() {\n // Heartbeat moved to unified scheduler with connection validation\n this._secureLog('info', '\uD83D\uDD27 Heartbeat moved to unified scheduler');\n \n // Store heartbeat configuration for scheduler\n this._heartbeatConfig = {\n enabled: true,\n interval: EnhancedSecureWebRTCManager.TIMEOUTS.HEARTBEAT_INTERVAL,\n lastHeartbeat: 0\n };\n }\n\n stopHeartbeat() {\n // Heartbeat stopped via unified scheduler\n if (this._heartbeatConfig) {\n this._heartbeatConfig.enabled = false;\n }\n }\n\n /**\n * Stop all active timers and cleanup scheduler\n */\n _stopAllTimers() {\n this._secureLog('info', '\uD83D\uDD27 Stopping all timers and cleanup scheduler');\n \n // Stop maintenance scheduler\n if (this._maintenanceScheduler) {\n clearInterval(this._maintenanceScheduler);\n this._maintenanceScheduler = null;\n }\n \n // Stop heartbeat\n if (this._heartbeatConfig) {\n this._heartbeatConfig.enabled = false;\n }\n \n // Clear all timer references\n if (this._activeTimers) {\n this._activeTimers.forEach(timer => {\n if (timer) clearInterval(timer);\n });\n this._activeTimers.clear();\n }\n \n this._secureLog('info', '\u2705 All timers stopped successfully');\n }\n\n handleHeartbeat() {\n console.log('Heartbeat received - connection alive');\n }\n\n waitForIceGathering() {\n return new Promise((resolve) => {\n if (this.peerConnection.iceGatheringState === 'complete') {\n resolve();\n return;\n }\n\n const checkState = () => {\n if (this.peerConnection && this.peerConnection.iceGatheringState === 'complete') {\n this.peerConnection.removeEventListener('icegatheringstatechange', checkState);\n resolve();\n }\n };\n \n this.peerConnection.addEventListener('icegatheringstatechange', checkState);\n \n setTimeout(() => {\n if (this.peerConnection) {\n this.peerConnection.removeEventListener('icegatheringstatechange', checkState);\n }\n resolve();\n }, EnhancedSecureWebRTCManager.TIMEOUTS.ICE_GATHERING_TIMEOUT);\n });\n }\n\n retryConnection() {\n console.log(`Retrying connection (attempt ${this.connectionAttempts}/${this.maxConnectionAttempts})`);\n this.onStatusChange('retrying');\n }\n\n isConnected() {\n const hasDataChannel = !!this.dataChannel;\n const dataChannelState = this.dataChannel?.readyState;\n const isDataChannelOpen = dataChannelState === 'open';\n const isVerified = this.isVerified;\n const connectionState = this.peerConnection?.connectionState;\n \n return this.dataChannel && this.dataChannel.readyState === 'open' && this.isVerified;\n }\n\n getConnectionInfo() {\n return {\n fingerprint: this.keyFingerprint,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n connectionState: this.peerConnection?.connectionState,\n iceConnectionState: this.peerConnection?.iceConnectionState,\n verificationCode: this.verificationCode\n };\n }\n\n disconnect() {\n // Stop all timers first\n this._stopAllTimers();\n \n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n }\n this.intentionalDisconnect = true;\n \n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Starting intentional disconnect');\n\n this.sendDisconnectNotification();\n\n setTimeout(() => {\n this.sendDisconnectNotification(); \n }, 100);\n\n document.dispatchEvent(new CustomEvent('peer-disconnect', {\n detail: { \n reason: 'user_disconnect',\n timestamp: Date.now()\n }\n }));\n }\n \n handleUnexpectedDisconnect() {\n this.sendDisconnectNotification();\n this.isVerified = false;\n \n // Ensure disconnect notification wasn't already sent\n if (!this.disconnectNotificationSent) {\n this.disconnectNotificationSent = true;\n this.deliverMessageToUI('\uD83D\uDD0C Connection lost. Attempting to reconnect...', 'system');\n }\n \n // Cleanup file transfer system on unexpected disconnect\n if (this.fileTransferSystem) {\n console.log('\uD83E\uDDF9 Cleaning up file transfer system on unexpected disconnect...');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n document.dispatchEvent(new CustomEvent('peer-disconnect', {\n detail: { \n reason: 'connection_lost',\n timestamp: Date.now()\n }\n }));\n\n }\n \n sendDisconnectNotification() {\n try {\n if (this.dataChannel && this.dataChannel.readyState === 'open') {\n const notification = {\n type: 'peer_disconnect',\n timestamp: Date.now(),\n reason: this.intentionalDisconnect ? 'user_disconnect' : 'connection_lost'\n };\n\n for (let i = 0; i < 3; i++) {\n try {\n this.dataChannel.send(JSON.stringify(notification));\n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Disconnect notification sent', {\n reason: notification.reason,\n attempt: i + 1\n });\n break;\n } catch (sendError) {\n if (i === 2) { \n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Failed to send disconnect notification', {\n error: sendError.message\n });\n }\n }\n }\n }\n } catch (error) {\n window.EnhancedSecureCryptoUtils.secureLog.log('error', 'Could not send disconnect notification', {\n error: error.message\n });\n }\n }\n \n attemptReconnection() {\n // Ensure reconnection-failed notification wasn't already sent\n if (!this.reconnectionFailedNotificationSent) {\n this.reconnectionFailedNotificationSent = true;\n this.deliverMessageToUI('\u274C Unable to reconnect. A new connection is required.', 'system');\n }\n\n }\n \n handlePeerDisconnectNotification(data) {\n const reason = data.reason || 'unknown';\n const reasonText = reason === 'user_disconnect' ? 'manually disconnected.' : 'connection lost.';\n \n // Ensure peer-disconnect notification wasn't already sent\n if (!this.peerDisconnectNotificationSent) {\n this.peerDisconnectNotificationSent = true;\n this.deliverMessageToUI(`\uD83D\uDC4B Peer ${reasonText}`, 'system');\n }\n \n this.onStatusChange('peer_disconnected');\n \n this.intentionalDisconnect = false;\n this.isVerified = false;\n this.stopHeartbeat();\n \n this.onKeyExchange(''); \n this.onVerificationRequired(''); \n\n document.dispatchEvent(new CustomEvent('peer-disconnect', {\n detail: { \n reason: reason,\n timestamp: Date.now()\n }\n }));\n\n setTimeout(() => {\n this.disconnect();\n }, 2000);\n \n window.EnhancedSecureCryptoUtils.secureLog.log('info', 'Peer disconnect notification processed', {\n reason: reason\n });\n }\n \n /**\n * Secure disconnect with complete memory cleanup\n */\n disconnect() {\n this.stopHeartbeat();\n this.isVerified = false;\n this.processedMessageIds.clear();\n this.messageCounter = 0;\n \n // Secure cleanup of cryptographic materials\n this._secureCleanupCryptographicMaterials();\n \n // Secure wipe of PFS key versions\n this.keyVersions.clear();\n this.oldKeys.clear();\n this.currentKeyVersion = 0;\n this.lastKeyRotation = Date.now();\n \n // Reset message counters\n this.sequenceNumber = 0;\n this.expectedSequenceNumber = 0;\n this.replayWindow.clear(); // Clear replay window\n \n // Reset security features\n this.securityFeatures = {\n hasEncryption: true,\n hasECDH: true,\n hasECDSA: true, \n hasMutualAuth: true, \n hasMetadataProtection: true, \n hasEnhancedReplayProtection: true, \n hasNonExtractableKeys: true, \n hasRateLimiting: true, \n hasEnhancedValidation: true, \n hasPFS: true \n };\n \n // Close connections\n if (this.dataChannel) {\n this.dataChannel.close();\n this.dataChannel = null;\n }\n if (this.peerConnection) {\n this.peerConnection.close();\n this.peerConnection = null;\n }\n \n // Secure wipe of message queue\n if (this.messageQueue && this.messageQueue.length > 0) {\n this.messageQueue.forEach((message, index) => {\n this._secureWipeMemory(message, `messageQueue[${index}]`);\n });\n this.messageQueue = [];\n }\n \n // Force garbage collection\n this._forceGarbageCollection();\n \n document.dispatchEvent(new CustomEvent('connection-cleaned', {\n detail: { \n timestamp: Date.now(),\n reason: this.intentionalDisconnect ? 'user_cleanup' : 'automatic_cleanup'\n }\n }));\n\n // Notify UI about complete cleanup\n this.onStatusChange('disconnected');\n this.onKeyExchange('');\n this.onVerificationRequired('');\n \n this._secureLog('info', '\uD83D\uDD12 Connection securely cleaned up with complete memory wipe');\n \n // Reset the intentional disconnect flag\n this.intentionalDisconnect = false;\n }\n // Public method to send files\n async sendFile(file) {\n // Enforce verification gate for file transfers\n this._enforceVerificationGate('sendFile');\n \n if (!this.isConnected()) {\n throw new Error('Connection not ready for file transfer. Please ensure the connection is established.');\n }\n\n if (!this.fileTransferSystem) {\n console.log('\uD83D\uDD04 File transfer system not initialized, attempting to initialize...');\n this.initializeFileTransfer();\n \n // Allow time for initialization\n await new Promise(resolve => setTimeout(resolve, 500));\n \n if (!this.fileTransferSystem) {\n throw new Error('File transfer system could not be initialized. Please try reconnecting.');\n }\n }\n\n // Verify key readiness\n if (!this.encryptionKey || !this.macKey) {\n throw new Error('Encryption keys not ready. Please wait for connection to be fully established.');\n }\n\n // Debug logging for file transfer system\n console.log('\uD83D\uDD0D Debug: File transfer system in sendFile:', {\n hasFileTransferSystem: !!this.fileTransferSystem,\n fileTransferSystemType: this.fileTransferSystem.constructor?.name,\n hasWebrtcManager: !!this.fileTransferSystem.webrtcManager,\n webrtcManagerType: this.fileTransferSystem.webrtcManager?.constructor?.name\n });\n\n try {\n console.log('\uD83D\uDE80 Starting file transfer for:', file.name, `(${(file.size / 1024 / 1024).toFixed(2)} MB)`);\n const fileId = await this.fileTransferSystem.sendFile(file);\n console.log('\u2705 File transfer initiated successfully with ID:', fileId);\n return fileId;\n } catch (error) {\n this._secureLog('error', '\u274C File transfer error:', { errorType: error?.constructor?.name || 'Unknown' });\n \n // Re-throw with a clearer message\n if (error.message.includes('Connection not ready')) {\n throw new Error('Connection not ready for file transfer. Check connection status.');\n } else if (error.message.includes('Encryption keys not initialized')) {\n throw new Error('Encryption keys not initialized. Try reconnecting.');\n } else if (error.message.includes('Transfer timeout')) {\n throw new Error('File transfer timeout. Check connection and try again.');\n } else {\n throw error;\n }\n }\n }\n\n // Get active file transfers\n getFileTransfers() {\n if (!this.fileTransferSystem) {\n return { sending: [], receiving: [] };\n }\n \n try {\n // Check available methods in file transfer system\n let sending = [];\n let receiving = [];\n \n if (typeof this.fileTransferSystem.getActiveTransfers === 'function') {\n sending = this.fileTransferSystem.getActiveTransfers();\n } else {\n this._secureLog('warn', '\u26A0\uFE0F getActiveTransfers method not available in file transfer system');\n }\n \n if (typeof this.fileTransferSystem.getReceivingTransfers === 'function') {\n receiving = this.fileTransferSystem.getReceivingTransfers();\n } else {\n this._secureLog('warn', '\u26A0\uFE0F getReceivingTransfers method not available in file transfer system');\n }\n \n return {\n sending: sending || [],\n receiving: receiving || []\n };\n } catch (error) {\n this._secureLog('error', '\u274C Error getting file transfers:', { errorType: error?.constructor?.name || 'Unknown' });\n return { sending: [], receiving: [] };\n }\n }\n\n // Get file transfer system status\n getFileTransferStatus() {\n if (!this.fileTransferSystem) {\n return {\n initialized: false,\n status: 'not_initialized',\n message: 'File transfer system not initialized'\n };\n }\n \n const activeTransfers = this.fileTransferSystem.getActiveTransfers();\n const receivingTransfers = this.fileTransferSystem.getReceivingTransfers();\n \n return {\n initialized: true,\n status: 'ready',\n activeTransfers: activeTransfers.length,\n receivingTransfers: receivingTransfers.length,\n totalTransfers: activeTransfers.length + receivingTransfers.length\n };\n }\n\n // Cancel file transfer\n cancelFileTransfer(fileId) {\n if (!this.fileTransferSystem) return false;\n return this.fileTransferSystem.cancelTransfer(fileId);\n }\n\n // Force cleanup of file transfer system\n cleanupFileTransferSystem() {\n if (this.fileTransferSystem) {\n console.log('\uD83E\uDDF9 Force cleaning up file transfer system...');\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n return true;\n }\n return false;\n }\n\n // Reinitialize file transfer system\n reinitializeFileTransfer() {\n try {\n console.log('\uD83D\uDD04 Reinitializing file transfer system...');\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n }\n this.initializeFileTransfer();\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to reinitialize file transfer system:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n\n // Set file transfer callbacks\n setFileTransferCallbacks(onProgress, onReceived, onError) {\n this.onFileProgress = onProgress;\n this.onFileReceived = onReceived;\n this.onFileError = onError;\n \n console.log('\uD83D\uDD27 File transfer callbacks set:', {\n hasProgress: !!onProgress,\n hasReceived: !!onReceived,\n hasError: !!onError\n });\n \n // Reinitialize file transfer system if it exists to update callbacks\n if (this.fileTransferSystem) {\n console.log('\uD83D\uDD04 Reinitializing file transfer system with new callbacks...');\n this.initializeFileTransfer();\n }\n }\n\n // ============================================\n // SESSION ACTIVATION HANDLING\n // ============================================\n\n async handleSessionActivation(sessionData) {\n try {\n console.log('\uD83D\uDD10 Handling session activation:', sessionData);\n \n // Update session state\n this.currentSession = sessionData;\n this.sessionManager = sessionData.sessionManager;\n \n // FIX: More lenient checks for activation\n const hasKeys = !!(this.encryptionKey && this.macKey);\n const hasSession = !!(this.sessionManager && (this.sessionManager.hasActiveSession?.() || sessionData.sessionId));\n \n console.log('\uD83D\uDD0D Session activation status:', {\n hasKeys: hasKeys,\n hasSession: hasSession,\n sessionType: sessionData.sessionType,\n isDemo: sessionData.isDemo\n });\n \n // Force connection status if there is an active session\n if (hasSession) {\n console.log('\uD83D\uDD13 Session activated - forcing connection status to connected');\n this.onStatusChange('connected');\n \n console.log('\u26A0\uFE0F Session activated but NOT verified - cryptographic verification still required');\n }\n\n setTimeout(() => {\n try {\n this.initializeFileTransfer();\n } catch (error) {\n this._secureLog('warn', '\u26A0\uFE0F File transfer initialization failed during session activation:', { details: error.message });\n }\n }, 1000);\n \n console.log('\u2705 Session activation handled successfully');\n \n if (this.fileTransferSystem && this.isConnected()) {\n console.log('\uD83D\uDD04 Synchronizing file transfer keys after session activation...');\n \n if (typeof this.fileTransferSystem.onSessionUpdate === 'function') {\n this.fileTransferSystem.onSessionUpdate({\n keyFingerprint: this.keyFingerprint,\n sessionSalt: this.sessionSalt,\n hasMacKey: !!this.macKey\n });\n }\n }\n \n } catch (error) {\n this._secureLog('error', '\u274C Failed to handle session activation:', { errorType: error?.constructor?.name || 'Unknown' });\n }\n }\n // Method to check readiness of file transfers\ncheckFileTransferReadiness() {\n const status = {\n hasFileTransferSystem: !!this.fileTransferSystem,\n hasDataChannel: !!this.dataChannel,\n dataChannelState: this.dataChannel?.readyState,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n ready: false\n };\n \n status.ready = status.hasFileTransferSystem && \n status.hasDataChannel && \n status.dataChannelState === 'open' && \n status.isConnected && \n status.isVerified;\n \n console.log('\uD83D\uDD0D File transfer readiness check:', status);\n return status;\n }\n\n // Method to force re-initialize file transfer system\n forceReinitializeFileTransfer() {\n try {\n console.log('\uD83D\uDD04 Force reinitializing file transfer system...');\n \n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n \n // Small delay before reinitialization\n setTimeout(() => {\n this.initializeFileTransfer();\n }, 500);\n \n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to force reinitialize file transfer:', { errorType: error?.constructor?.name || 'Unknown' });\n return false;\n }\n }\n\n // Method to get diagnostic information\n getFileTransferDiagnostics() {\n const diagnostics = {\n timestamp: new Date().toISOString(),\n webrtcManager: {\n hasDataChannel: !!this.dataChannel,\n dataChannelState: this.dataChannel?.readyState,\n isConnected: this.isConnected(),\n isVerified: this.isVerified,\n isInitiator: this.isInitiator,\n hasEncryptionKey: !!this.encryptionKey,\n hasMacKey: !!this.macKey,\n hasMetadataKey: !!this.metadataKey,\n hasKeyFingerprint: !!this.keyFingerprint,\n hasSessionSalt: !!this.sessionSalt\n },\n fileTransferSystem: null,\n globalState: {\n fileTransferActive: this._fileTransferActive || false,\n hasFileTransferSystem: !!this.fileTransferSystem,\n fileTransferSystemType: this.fileTransferSystem ? 'EnhancedSecureFileTransfer' : 'none'\n }\n };\n \n if (this.fileTransferSystem) {\n try {\n diagnostics.fileTransferSystem = this.fileTransferSystem.getSystemStatus();\n } catch (error) {\n diagnostics.fileTransferSystem = { error: error.message };\n }\n }\n \n return diagnostics;\n }\n\n getSupportedFileTypes() {\n if (!this.fileTransferSystem) {\n return { error: 'File transfer system not initialized' };\n }\n \n try {\n return this.fileTransferSystem.getSupportedFileTypes();\n } catch (error) {\n return { error: error.message };\n }\n }\n\n validateFile(file) {\n if (!this.fileTransferSystem) {\n return { \n isValid: false, \n errors: ['File transfer system not initialized'],\n fileType: null,\n fileSize: file?.size || 0,\n formattedSize: '0 B'\n };\n }\n \n try {\n return this.fileTransferSystem.validateFile(file);\n } catch (error) {\n return { \n isValid: false, \n errors: [error.message],\n fileType: null,\n fileSize: file?.size || 0,\n formattedSize: '0 B'\n };\n }\n }\n\n getFileTypeInfo() {\n if (!this.fileTransferSystem) {\n return { error: 'File transfer system not initialized' };\n }\n \n try {\n return this.fileTransferSystem.getFileTypeInfo();\n } catch (error) {\n return { error: error.message };\n }\n }\n\n async forceInitializeFileTransfer(options = {}) {\n const abortController = new AbortController();\n const { signal = abortController.signal, timeout = 6000 } = options;\n\n if (signal && signal !== abortController.signal) {\n signal.addEventListener('abort', () => abortController.abort());\n }\n try {\n if (!this.isVerified) {\n throw new Error('Connection not verified');\n }\n \n if (!this.dataChannel || this.dataChannel.readyState !== 'open') {\n throw new Error('Data channel not open');\n }\n \n if (!this.encryptionKey || !this.macKey) {\n throw new Error('Encryption keys not ready');\n }\n\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n }\n\n this.initializeFileTransfer();\n\n let attempts = 0;\n const maxAttempts = 50;\n const checkInterval = 100; \n const maxWaitTime = maxAttempts * checkInterval; \n\n const initializationPromise = new Promise((resolve, reject) => {\n const checkInitialization = () => {\n if (abortController.signal.aborted) {\n reject(new Error('Operation cancelled'));\n return;\n }\n \n if (this.fileTransferSystem) {\n resolve(true);\n return;\n }\n \n if (attempts >= maxAttempts) {\n reject(new Error(`Initialization timeout after ${maxWaitTime}ms`));\n return;\n }\n \n attempts++;\n setTimeout(checkInitialization, checkInterval);\n };\n \n checkInitialization();\n });\n\n await Promise.race([\n initializationPromise,\n new Promise((_, reject) => \n setTimeout(() => reject(new Error(`Global timeout after ${timeout}ms`)), timeout)\n )\n ]);\n \n if (this.fileTransferSystem) {\n return true;\n } else {\n throw new Error('Force initialization timeout');\n }\n \n } catch (error) {\n if (error.name === 'AbortError' || error.message.includes('cancelled')) {\n this._secureLog('info', '\u23F9\uFE0F File transfer initialization cancelled by user');\n return { cancelled: true };\n }\n \n this._secureLog('error', '\u274C Force file transfer initialization failed:', { \n errorType: error?.constructor?.name || 'Unknown',\n message: error.message,\n attempts: attempts\n });\n return { error: error.message, attempts: attempts };\n }\n }\n\n cancelFileTransferInitialization() {\n try {\n if (this.fileTransferSystem) {\n this.fileTransferSystem.cleanup();\n this.fileTransferSystem = null;\n this._fileTransferActive = false;\n this._secureLog('info', '\u23F9\uFE0F File transfer initialization cancelled');\n return true;\n }\n return false;\n } catch (error) {\n this._secureLog('error', '\u274C Failed to cancel file transfer initialization:', { \n errorType: error?.constructor?.name || 'Unknown' \n });\n return false;\n }\n }\n \n getFileTransferSystemStatus() {\n if (!this.fileTransferSystem) {\n return { available: false, status: 'not_initialized' };\n }\n \n try {\n const status = this.fileTransferSystem.getSystemStatus();\n return {\n available: true,\n status: status.status || 'unknown',\n activeTransfers: status.activeTransfers || 0,\n receivingTransfers: status.receivingTransfers || 0,\n systemType: 'EnhancedSecureFileTransfer'\n };\n } catch (error) {\n this._secureLog('error', '\u274C Failed to get file transfer system status:', { \n errorType: error?.constructor?.name || 'Unknown' \n });\n return { available: false, status: 'error', error: error.message };\n }\n }\n\n _validateNestedEncryptionSecurity() {\n if (this.securityFeatures.hasNestedEncryption && this.nestedEncryptionKey) {\n // Test secure IV generation with reuse prevention\n try {\n const testIV1 = this._generateSecureIV(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE, 'securityTest1');\n const testIV2 = this._generateSecureIV(EnhancedSecureWebRTCManager.SIZES.NESTED_ENCRYPTION_IV_SIZE, 'securityTest2');\n \n // Verify IVs are different and properly tracked\n if (testIV1.every((byte, index) => byte === testIV2[index])) {\n this._secureLog('error', '\u274C CRITICAL: Nested encryption security validation failed - IVs are identical!');\n return false;\n }\n \n // Verify IV tracking system is working\n const stats = this._getIVTrackingStats();\n if (stats.totalIVs < 2) {\n this._secureLog('error', '\u274C CRITICAL: IV tracking system not working properly');\n return false;\n }\n \n this._secureLog('info', '\u2705 Nested encryption security validation passed - secure IV generation working');\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C CRITICAL: Nested encryption security validation failed:', {\n errorType: error.constructor.name,\n errorMessage: error.message\n });\n return false;\n }\n }\n return true;\n }\n}\n\nclass SecureKeyStorage {\n constructor() {\n // Use WeakMap for automatic garbage collection of unused keys\n this._keyStore = new WeakMap();\n this._keyMetadata = new Map(); // Metadata doesn't need WeakMap\n this._keyReferences = new Map(); // Strong references for active keys\n \n // Master encryption key for storage encryption\n this._storageMasterKey = null;\n this._initializeStorageMaster();\n\n setTimeout(() => {\n if (!this.validateStorageIntegrity()) {\n console.error('\u274C CRITICAL: Key storage integrity check failed');\n }\n }, 100);\n \n }\n\n async _initializeStorageMaster() {\n // Generate a master key for encrypting stored keys\n this._storageMasterKey = await crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n false,\n ['encrypt', 'decrypt']\n );\n }\n\n async storeKey(keyId, cryptoKey, metadata = {}) {\n if (!(cryptoKey instanceof CryptoKey)) {\n throw new Error('Only CryptoKey objects can be stored');\n }\n\n try {\n // For non-extractable keys, we can only store a reference\n if (!cryptoKey.extractable) {\n // Store the key reference directly without encryption\n this._keyReferences.set(keyId, cryptoKey);\n this._keyMetadata.set(keyId, {\n ...metadata,\n created: Date.now(),\n lastAccessed: Date.now(),\n extractable: false,\n encrypted: false // Mark as not encrypted\n });\n return true;\n }\n\n // For extractable keys, proceed with encryption\n const keyData = await crypto.subtle.exportKey('jwk', cryptoKey);\n const encryptedKeyData = await this._encryptKeyData(keyData);\n \n // Validate that extractable keys are properly encrypted\n if (!encryptedKeyData || encryptedKeyData.byteLength === 0) {\n throw new Error('Failed to encrypt extractable key data');\n }\n\n // Create a storage object\n const storageObject = {\n id: keyId,\n encryptedData: encryptedKeyData,\n algorithm: cryptoKey.algorithm,\n usages: cryptoKey.usages,\n extractable: cryptoKey.extractable,\n type: cryptoKey.type,\n timestamp: Date.now()\n };\n\n // Use WeakMap with the CryptoKey as the key\n this._keyStore.set(cryptoKey, storageObject);\n \n // Store reference for retrieval by ID\n this._keyReferences.set(keyId, cryptoKey);\n \n // Store metadata separately\n this._keyMetadata.set(keyId, {\n ...metadata,\n created: Date.now(),\n lastAccessed: Date.now(),\n extractable: true,\n encrypted: true // Mark extractable keys as encrypted\n });\n\n return true;\n } catch (error) {\n console.error('Failed to store key securely:', error);\n return false;\n }\n }\n\n async retrieveKey(keyId) {\n const metadata = this._keyMetadata.get(keyId);\n if (!metadata) {\n return null;\n }\n\n // Update access time\n metadata.lastAccessed = Date.now();\n\n // For non-encrypted keys (non-extractable), return directly\n if (!metadata.encrypted) {\n // Only non-extractable keys should be non-encrypted\n if (metadata.extractable === false) {\n return this._keyReferences.get(keyId);\n } else {\n // This should never happen - extractable keys must be encrypted\n this._secureLog('error', '\u274C SECURITY VIOLATION: Extractable key marked as non-encrypted', {\n keyId,\n extractable: metadata.extractable,\n encrypted: metadata.encrypted\n });\n return null;\n }\n }\n\n // For encrypted keys, decrypt and recreate\n try {\n const cryptoKey = this._keyReferences.get(keyId);\n const storedData = this._keyStore.get(cryptoKey);\n \n if (!storedData) {\n return null;\n }\n\n // Decrypt the key data\n const decryptedKeyData = await this._decryptKeyData(storedData.encryptedData);\n \n // Recreate the CryptoKey\n const recreatedKey = await crypto.subtle.importKey(\n 'jwk',\n decryptedKeyData,\n storedData.algorithm,\n storedData.extractable,\n storedData.usages\n );\n \n return recreatedKey;\n } catch (error) {\n console.error('Failed to retrieve key:', error);\n return null;\n }\n }\n\n async _encryptKeyData(keyData) {\n const dataToEncrypt = typeof keyData === 'object' \n ? JSON.stringify(keyData) \n : keyData;\n \n const encoder = new TextEncoder();\n const data = encoder.encode(dataToEncrypt);\n \n const iv = crypto.getRandomValues(new Uint8Array(12));\n \n const encryptedData = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n this._storageMasterKey,\n data\n );\n\n // Return IV + encrypted data\n const result = new Uint8Array(iv.length + encryptedData.byteLength);\n result.set(iv, 0);\n result.set(new Uint8Array(encryptedData), iv.length);\n \n return result;\n }\n\n async _decryptKeyData(encryptedData) {\n const iv = encryptedData.slice(0, 12);\n const data = encryptedData.slice(12);\n \n const decryptedData = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv },\n this._storageMasterKey,\n data\n );\n\n const decoder = new TextDecoder();\n const jsonString = decoder.decode(decryptedData);\n \n try {\n return JSON.parse(jsonString);\n } catch {\n return decryptedData;\n }\n }\n\n secureWipe(keyId) {\n const cryptoKey = this._keyReferences.get(keyId);\n \n if (cryptoKey) {\n // Remove from WeakMap (will be GC'd)\n this._keyStore.delete(cryptoKey);\n // Remove strong reference\n this._keyReferences.delete(keyId);\n // Remove metadata\n this._keyMetadata.delete(keyId);\n }\n\n // Overwrite memory locations if possible\n if (typeof window.gc === 'function') {\n window.gc();\n }\n }\n\n secureWipeAll() {\n // Clear all references\n this._keyReferences.clear();\n this._keyMetadata.clear();\n \n // WeakMap entries will be garbage collected\n this._keyStore = new WeakMap();\n \n // Force garbage collection if available\n if (typeof window.gc === 'function') {\n window.gc();\n }\n }\n\n // Validate storage integrity\n validateStorageIntegrity() {\n const violations = [];\n \n for (const [keyId, metadata] of this._keyMetadata.entries()) {\n // Check: extractable keys must be encrypted\n if (metadata.extractable === true && metadata.encrypted !== true) {\n violations.push({\n keyId,\n type: 'EXTRACTABLE_KEY_NOT_ENCRYPTED',\n metadata\n });\n }\n \n // Check: non-extractable keys should not be encrypted\n if (metadata.extractable === false && metadata.encrypted === true) {\n violations.push({\n keyId,\n type: 'NON_EXTRACTABLE_KEY_ENCRYPTED',\n metadata\n });\n }\n }\n \n if (violations.length > 0) {\n console.error('\u274C Storage integrity violations detected:', violations);\n return false;\n }\n \n return true;\n }\n\n getStorageStats() {\n return {\n totalKeys: this._keyReferences.size,\n metadata: Array.from(this._keyMetadata.entries()).map(([id, meta]) => ({\n id,\n created: meta.created,\n lastAccessed: meta.lastAccessed,\n age: Date.now() - meta.created\n }))\n };\n }\n\n // Method _generateNextSequenceNumber moved to constructor area for early availability\n\n /**\n * Validate incoming message sequence number\n * This prevents replay attacks and ensures message ordering\n */\n _validateIncomingSequenceNumber(receivedSeq, context = 'unknown') {\n try {\n if (!this.replayProtectionEnabled) {\n return true; // Skip validation if disabled\n }\n\n // Check if sequence number is within acceptable range\n if (receivedSeq < this.expectedSequenceNumber - this.replayWindowSize) {\n this._secureLog('warn', '\u26A0\uFE0F Sequence number too old - possible replay attack', {\n received: receivedSeq,\n expected: this.expectedSequenceNumber,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n\n // Check if sequence number is too far ahead (DoS protection)\n if (receivedSeq > this.expectedSequenceNumber + this.maxSequenceGap) {\n this._secureLog('warn', '\u26A0\uFE0F Sequence number gap too large - possible DoS attack', {\n received: receivedSeq,\n expected: this.expectedSequenceNumber,\n gap: receivedSeq - this.expectedSequenceNumber,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n\n // Check if sequence number is already in replay window\n if (this.replayWindow.has(receivedSeq)) {\n this._secureLog('warn', '\u26A0\uFE0F Duplicate sequence number detected - replay attack', {\n received: receivedSeq,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n\n // Add to replay window\n this.replayWindow.add(receivedSeq);\n \n // Maintain sliding window size\n if (this.replayWindow.size > this.replayWindowSize) {\n const oldestSeq = Math.min(...this.replayWindow);\n this.replayWindow.delete(oldestSeq);\n }\n\n // Update expected sequence number if this is the next expected\n if (receivedSeq === this.expectedSequenceNumber) {\n this.expectedSequenceNumber++;\n \n // Clean up replay window entries that are no longer needed\n while (this.replayWindow.has(this.expectedSequenceNumber - this.replayWindowSize - 1)) {\n this.replayWindow.delete(this.expectedSequenceNumber - this.replayWindowSize - 1);\n }\n }\n\n this._secureLog('debug', '\u2705 Sequence number validation successful', {\n received: receivedSeq,\n expected: this.expectedSequenceNumber,\n context: context,\n timestamp: Date.now()\n });\n\n return true;\n } catch (error) {\n this._secureLog('error', '\u274C Sequence number validation failed', {\n error: error.message,\n context: context,\n timestamp: Date.now()\n });\n return false;\n }\n }\n\n // Method _createMessageAAD moved to constructor area for early availability\n\n /**\n * Validate message AAD with sequence number\n * This ensures message integrity and prevents replay attacks\n */\n _validateMessageAAD(aadString, expectedMessageType = null) {\n try {\n const aad = JSON.parse(aadString);\n \n // Validate session binding\n if (aad.sessionId !== (this.currentSession?.sessionId || 'unknown')) {\n throw new Error('AAD sessionId mismatch - possible replay attack');\n }\n \n if (aad.keyFingerprint !== (this.keyFingerprint || 'unknown')) {\n throw new Error('AAD keyFingerprint mismatch - possible key substitution attack');\n }\n \n // Validate sequence number\n if (!this._validateIncomingSequenceNumber(aad.sequenceNumber, aad.messageType)) {\n throw new Error('Sequence number validation failed - possible replay or DoS attack');\n }\n \n // Validate message type if specified\n if (expectedMessageType && aad.messageType !== expectedMessageType) {\n throw new Error(`AAD messageType mismatch - expected ${expectedMessageType}, got ${aad.messageType}`);\n }\n \n return aad;\n } catch (error) {\n this._secureLog('error', 'AAD validation failed', { error: error.message, aadString });\n throw new Error(`AAD validation failed: ${error.message}`);\n }\n }\n\n /**\n * Get anti-replay protection status\n * This shows the current state of replay protection\n */\n getAntiReplayStatus() {\n const status = {\n replayProtectionEnabled: this.replayProtectionEnabled,\n replayWindowSize: this.replayWindowSize,\n currentReplayWindowSize: this.replayWindow.size,\n sequenceNumber: this.sequenceNumber,\n expectedSequenceNumber: this.expectedSequenceNumber,\n maxSequenceGap: this.maxSequenceGap,\n replayWindowEntries: Array.from(this.replayWindow).sort((a, b) => a - b)\n };\n\n this._secureLog('info', 'Anti-replay status retrieved', status);\n return status;\n }\n\n /**\n * Configure anti-replay protection\n * This allows fine-tuning of replay protection parameters\n */\n configureAntiReplayProtection(config) {\n try {\n if (config.windowSize !== undefined) {\n if (config.windowSize < 16 || config.windowSize > 1024) {\n throw new Error('Replay window size must be between 16 and 1024');\n }\n this.replayWindowSize = config.windowSize;\n }\n\n if (config.maxGap !== undefined) {\n if (config.maxGap < 10 || config.maxGap > 1000) {\n throw new Error('Max sequence gap must be between 10 and 1000');\n }\n this.maxSequenceGap = config.maxGap;\n }\n\n if (config.enabled !== undefined) {\n this.replayProtectionEnabled = config.enabled;\n }\n\n this._secureLog('info', 'Anti-replay protection configured', config);\n return true;\n } catch (error) {\n this._secureLog('error', 'Failed to configure anti-replay protection', { error: error.message });\n return false;\n }\n }\n\n /**\n * Get real security level with actual cryptographic tests\n * This provides real-time verification of security features\n */\n async getRealSecurityLevel() {\n try {\n const securityData = {\n // Basic security features\n ecdhKeyExchange: !!this.ecdhKeyPair,\n ecdsaSignatures: !!this.ecdsaKeyPair,\n aesEncryption: !!this.encryptionKey,\n messageIntegrity: !!this.hmacKey,\n \n // Advanced security features - using the exact property names expected by EnhancedSecureCryptoUtils\n replayProtection: this.replayProtectionEnabled,\n dtlsFingerprint: !!this.expectedDTLSFingerprint,\n sasCode: !!this.verificationCode,\n metadataProtection: true, // Always enabled\n trafficObfuscation: true, // Always enabled\n perfectForwardSecrecy: true, // Always enabled\n \n // Rate limiting\n rateLimiter: true, // Always enabled\n \n // Additional info\n connectionId: this.connectionId,\n keyFingerprint: this.keyFingerprint,\n currentSecurityLevel: this.currentSecurityLevel,\n timestamp: Date.now()\n };\n\n // Debug logging for security features\n console.log('\uD83D\uDD0D getRealSecurityLevel debug:');\n console.log(' - replayProtectionEnabled:', this.replayProtectionEnabled);\n console.log(' - expectedDTLSFingerprint:', !!this.expectedDTLSFingerprint);\n console.log(' - verificationCode:', !!this.verificationCode);\n console.log(' - ecdhKeyPair:', !!this.ecdhKeyPair);\n console.log(' - ecdsaKeyPair:', !!this.ecdsaKeyPair);\n console.log(' - encryptionKey:', !!this.encryptionKey);\n console.log(' - hmacKey:', !!this.hmacKey);\n \n this._secureLog('info', 'Real security level calculated', securityData);\n return securityData;\n } catch (error) {\n this._secureLog('error', 'Failed to calculate real security level', { error: error.message });\n throw error;\n }\n }\n\n\n}\n\nexport { EnhancedSecureWebRTCManager };", "// SessionTimer Component - v4.2.12 - ECDH + DTLS + SAS\nconst SessionTimer = ({ timeLeft, sessionType, sessionManager, onDisconnect }) => {\n const [currentTime, setCurrentTime] = React.useState(timeLeft || 0);\n const [showExpiredMessage, setShowExpiredMessage] = React.useState(false);\n const [initialized, setInitialized] = React.useState(false);\n const [connectionBroken, setConnectionBroken] = React.useState(false);\n \n\n const [loggedHidden, setLoggedHidden] = React.useState(false);\n\n React.useEffect(() => {\n if (connectionBroken) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer initialization skipped - connection broken');\n setLoggedHidden(true);\n }\n return;\n }\n \n let initialTime = 0;\n \n if (sessionManager?.hasActiveSession()) {\n initialTime = sessionManager.getTimeLeft();\n } else if (timeLeft && timeLeft > 0) {\n initialTime = timeLeft;\n }\n\n if (initialTime <= 0) {\n setCurrentTime(0);\n setInitialized(false);\n setLoggedHidden(true);\n return;\n }\n\n if (connectionBroken) {\n setCurrentTime(0);\n setInitialized(false);\n setLoggedHidden(true);\n return;\n }\n setCurrentTime(initialTime);\n setInitialized(true);\n setLoggedHidden(false); \n }, [sessionManager, connectionBroken]);\n\n React.useEffect(() => {\n if (connectionBroken) {\n if (!loggedHidden) {\n setLoggedHidden(true);\n }\n return;\n }\n \n if (timeLeft && timeLeft > 0) {\n setCurrentTime(timeLeft);\n }\n setLoggedHidden(false);\n }, [timeLeft, connectionBroken]);\n\n React.useEffect(() => {\n if (!initialized) {\n return;\n }\n\n if (connectionBroken) {\n if (!loggedHidden) {\n setLoggedHidden(true);\n }\n return;\n }\n\n if (!currentTime || currentTime <= 0 || !sessionManager) {\n return;\n }\n\n const interval = setInterval(() => {\n if (connectionBroken) {\n setCurrentTime(0);\n clearInterval(interval);\n return;\n }\n \n if (sessionManager?.hasActiveSession()) {\n const newTime = sessionManager.getTimeLeft();\n setCurrentTime(newTime);\n\n if (window.DEBUG_MODE && Math.floor(Date.now() / 30000) !== Math.floor((Date.now() - 1000) / 30000)) {\n console.log('\u23F1\uFE0F Timer tick:', Math.floor(newTime / 1000) + 's');\n }\n\n if (newTime <= 0) {\n setShowExpiredMessage(true);\n setTimeout(() => setShowExpiredMessage(false), 5000);\n clearInterval(interval);\n }\n } else {\n setCurrentTime(0);\n clearInterval(interval);\n }\n }, 1000);\n\n return () => {\n clearInterval(interval);\n };\n }, [initialized, currentTime, sessionManager, connectionBroken]);\n\n React.useEffect(() => {\n const handleSessionTimerUpdate = (event) => {\n if (connectionBroken) {\n return;\n }\n \n if (event.detail.timeLeft && event.detail.timeLeft > 0) {\n setCurrentTime(event.detail.timeLeft);\n }\n };\n\n const handleForceHeaderUpdate = (event) => {\n if (connectionBroken) {\n return;\n }\n \n if (sessionManager && sessionManager.hasActiveSession()) {\n const newTime = sessionManager.getTimeLeft();\n setCurrentTime(newTime);\n } else {\n setCurrentTime(event.detail.timeLeft);\n }\n };\n\n const handlePeerDisconnect = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setLoggedHidden(false);\n };\n\n const handleNewConnection = (event) => {\n setConnectionBroken(false);\n setLoggedHidden(false); \n };\n\n const handleConnectionCleaned = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n const handleSessionReset = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n const handleSessionCleanup = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n const handleDisconnected = (event) => {\n setConnectionBroken(true);\n setCurrentTime(0);\n setShowExpiredMessage(false);\n setInitialized(false);\n setLoggedHidden(false);\n };\n\n document.addEventListener('session-timer-update', handleSessionTimerUpdate);\n document.addEventListener('force-header-update', handleForceHeaderUpdate);\n document.addEventListener('peer-disconnect', handlePeerDisconnect);\n document.addEventListener('new-connection', handleNewConnection);\n document.addEventListener('connection-cleaned', handleConnectionCleaned);\n document.addEventListener('session-reset', handleSessionReset);\n document.addEventListener('session-cleanup', handleSessionCleanup);\n document.addEventListener('disconnected', handleDisconnected);\n\n return () => {\n document.removeEventListener('session-timer-update', handleSessionTimerUpdate);\n document.removeEventListener('force-header-update', handleForceHeaderUpdate);\n document.removeEventListener('peer-disconnect', handlePeerDisconnect);\n document.removeEventListener('new-connection', handleNewConnection);\n document.removeEventListener('connection-cleaned', handleConnectionCleaned);\n document.removeEventListener('session-reset', handleSessionReset);\n document.removeEventListener('session-cleanup', handleSessionCleanup);\n document.removeEventListener('disconnected', handleDisconnected);\n };\n }, [sessionManager]);\n\n if (showExpiredMessage) {\n return React.createElement('div', {\n className: 'session-timer expired flex items-center space-x-2 px-3 py-1.5 rounded-lg animate-pulse',\n style: { background: 'linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%)' }\n }, [\n React.createElement('i', {\n key: 'icon',\n className: 'fas fa-exclamation-triangle text-red-400'\n }),\n React.createElement('span', {\n key: 'message',\n className: 'text-red-400 text-sm font-medium'\n }, 'Session Expired!')\n ]);\n }\n\n if (!sessionManager) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer hidden - no sessionManager');\n setLoggedHidden(true);\n }\n return null;\n }\n\n if (connectionBroken) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer hidden - connection broken');\n setLoggedHidden(true);\n }\n return null;\n }\n\n if (!currentTime || currentTime <= 0) {\n if (!loggedHidden) {\n console.log('\u23F1\uFE0F SessionTimer hidden - no time left, currentTime:', currentTime);\n setLoggedHidden(true);\n }\n return null;\n }\n\n if (loggedHidden) {\n setLoggedHidden(false);\n }\n\n const totalMinutes = Math.floor(currentTime / (60 * 1000));\n const totalSeconds = Math.floor(currentTime / 1000);\n \n const isDemo = sessionType === 'demo';\n const isWarning = isDemo ? totalMinutes <= 2 : totalMinutes <= 10;\n const isCritical = isDemo ? totalSeconds <= 60 : totalMinutes <= 5;\n\n const formatTime = (ms) => {\n const hours = Math.floor(ms / (60 * 60 * 1000));\n const minutes = Math.floor((ms % (60 * 60 * 1000)) / (60 * 1000));\n const seconds = Math.floor((ms % (60 * 1000)) / 1000);\n\n if (hours > 0) {\n return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;\n } else {\n return `${minutes}:${seconds.toString().padStart(2, '0')}`;\n }\n };\n\n const getTimerStyle = () => {\n const totalDuration = sessionType === 'demo' ? 6 * 60 * 1000 : 60 * 60 * 1000;\n const timeProgress = (totalDuration - currentTime) / totalDuration;\n \n let backgroundColor, textColor, iconColor, iconClass, shouldPulse;\n \n if (timeProgress <= 0.33) {\n backgroundColor = 'linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(22, 163, 74, 0.15) 100%)';\n textColor = 'text-green-400';\n iconColor = 'text-green-400';\n iconClass = 'fas fa-clock';\n shouldPulse = false;\n } else if (timeProgress <= 0.66) {\n backgroundColor = 'linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(202, 138, 4, 0.15) 100%)';\n textColor = 'text-yellow-400';\n iconColor = 'text-yellow-400';\n iconClass = 'fas fa-clock';\n shouldPulse = false;\n } else {\n backgroundColor = 'linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.15) 100%)';\n textColor = 'text-red-400';\n iconColor = 'text-red-400';\n iconClass = 'fas fa-exclamation-triangle';\n shouldPulse = true;\n }\n \n return { backgroundColor, textColor, iconColor, iconClass, shouldPulse };\n };\n\n const timerStyle = getTimerStyle();\n \n const handleTimerClick = () => {\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n }\n };\n\n return React.createElement('div', {\n className: `session-timer flex items-center space-x-2 px-3 py-1.5 rounded-lg transition-all duration-500 cursor-pointer hover:opacity-80 ${\n isDemo ? 'demo-session' : ''\n } ${timerStyle.shouldPulse ? 'animate-pulse' : ''}`,\n style: { background: timerStyle.backgroundColor },\n onClick: handleTimerClick,\n title: 'Click to disconnect and clear session'\n }, [\n React.createElement('i', {\n key: 'icon',\n className: `${timerStyle.iconClass} ${timerStyle.iconColor}`\n }),\n React.createElement('span', {\n key: 'time',\n className: `text-sm font-mono font-semibold ${timerStyle.textColor}`\n }, formatTime(currentTime)),\n React.createElement('div', {\n key: 'progress',\n className: 'ml-2 w-16 h-1 bg-gray-700 rounded-full overflow-hidden'\n }, [\n React.createElement('div', {\n key: 'progress-bar',\n className: `${timerStyle.textColor.replace('text-', 'bg-')} h-full rounded-full transition-all duration-500`,\n style: { \n width: `${Math.max(0, Math.min(100, (currentTime / (sessionType === 'demo' ? 6 * 60 * 1000 : 60 * 60 * 1000)) * 100))}%`\n }\n })\n ])\n ]);\n};\n\nwindow.SessionTimer = SessionTimer;\n\nwindow.updateSessionTimer = (newTimeLeft, newSessionType) => {\n document.dispatchEvent(new CustomEvent('session-timer-update', {\n detail: { timeLeft: newTimeLeft, sessionType: newSessionType }\n }));\n};\n\n", "const EnhancedMinimalHeader = ({ \n status, \n fingerprint, \n verificationCode, \n onDisconnect, \n isConnected, \n securityLevel, \n sessionManager, \n sessionTimeLeft,\n webrtcManager \n}) => {\n const [currentTimeLeft, setCurrentTimeLeft] = React.useState(sessionTimeLeft || 0);\n const [hasActiveSession, setHasActiveSession] = React.useState(false);\n const [sessionType, setSessionType] = React.useState('unknown');\n const [realSecurityLevel, setRealSecurityLevel] = React.useState(null);\n const [lastSecurityUpdate, setLastSecurityUpdate] = React.useState(0);\n\n // ============================================\n // FIXED SECURITY UPDATE LOGIC\n // ============================================\n \n React.useEffect(() => {\n let isUpdating = false; \n let lastUpdateAttempt = 0; \n \n const updateRealSecurityStatus = async () => {\n const now = Date.now();\n if (now - lastUpdateAttempt < 10000) { \n return;\n }\n\n if (isUpdating) {\n return;\n }\n \n isUpdating = true;\n lastUpdateAttempt = now;\n \n try {\n if (!webrtcManager || !isConnected) {\n return;\n }\n \n const activeWebrtcManager = webrtcManager;\n \n let realSecurityData = null;\n \n if (typeof activeWebrtcManager.getRealSecurityLevel === 'function') {\n realSecurityData = await activeWebrtcManager.getRealSecurityLevel();\n } else if (typeof activeWebrtcManager.calculateAndReportSecurityLevel === 'function') {\n realSecurityData = await activeWebrtcManager.calculateAndReportSecurityLevel();\n } else {\n realSecurityData = await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(activeWebrtcManager);\n }\n \n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD10 REAL security level calculated:', {\n level: realSecurityData?.level,\n score: realSecurityData?.score,\n passedChecks: realSecurityData?.passedChecks,\n totalChecks: realSecurityData?.totalChecks,\n isRealData: realSecurityData?.isRealData,\n sessionType: realSecurityData?.sessionType,\n maxPossibleScore: realSecurityData?.maxPossibleScore,\n verificationResults: realSecurityData?.verificationResults ? Object.keys(realSecurityData.verificationResults) : []\n });\n }\n \n if (realSecurityData && realSecurityData.isRealData !== false) {\n const currentScore = realSecurityLevel?.score || 0;\n const newScore = realSecurityData.score || 0;\n\n if (currentScore !== newScore || !realSecurityLevel) {\n setRealSecurityLevel(realSecurityData);\n setLastSecurityUpdate(now);\n \n if (window.DEBUG_MODE) {\n console.log('\u2705 Security level updated in header component:', {\n oldScore: currentScore,\n newScore: newScore,\n sessionType: realSecurityData.sessionType\n });\n }\n } else if (window.DEBUG_MODE) {\n console.log('\u2139\uFE0F Security level unchanged, skipping update');\n }\n } else {\n console.warn('\u26A0\uFE0F Security calculation returned invalid data');\n }\n \n } catch (error) {\n console.error('\u274C Error in real security calculation:', error);\n } finally {\n isUpdating = false;\n }\n };\n\n if (isConnected) {\n updateRealSecurityStatus();\n \n if (!realSecurityLevel || realSecurityLevel.score < 50) {\n const retryInterval = setInterval(() => {\n if (!realSecurityLevel || realSecurityLevel.score < 50) {\n updateRealSecurityStatus();\n } else {\n clearInterval(retryInterval);\n }\n }, 5000); \n \n setTimeout(() => clearInterval(retryInterval), 30000);\n }\n }\n\n const interval = setInterval(updateRealSecurityStatus, 30000);\n \n return () => clearInterval(interval);\n }, [webrtcManager, isConnected]);\n\n // ============================================\n // FIXED EVENT HANDLERS\n // ============================================\n\n React.useEffect(() => {\n const handleSecurityUpdate = (event) => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD12 Security level update event received:', event.detail);\n }\n\n setTimeout(() => {\n setLastSecurityUpdate(0);\n }, 100);\n };\n\n const handleRealSecurityCalculated = (event) => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD10 Real security calculated event:', event.detail);\n }\n \n if (event.detail && event.detail.securityData) {\n setRealSecurityLevel(event.detail.securityData);\n setLastSecurityUpdate(Date.now());\n }\n };\n\n document.addEventListener('security-level-updated', handleSecurityUpdate);\n document.addEventListener('real-security-calculated', handleRealSecurityCalculated);\n \n window.forceHeaderSecurityUpdate = (webrtcManager) => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD04 Force header security update called');\n }\n \n if (webrtcManager && window.EnhancedSecureCryptoUtils) {\n window.EnhancedSecureCryptoUtils.calculateSecurityLevel(webrtcManager)\n .then(securityData => {\n if (securityData && securityData.isRealData !== false) {\n setRealSecurityLevel(securityData);\n setLastSecurityUpdate(Date.now());\n console.log('\u2705 Header security level force-updated');\n }\n })\n .catch(error => {\n console.error('\u274C Force update failed:', error);\n });\n } else {\n setLastSecurityUpdate(0); \n }\n };\n\n return () => {\n document.removeEventListener('security-level-updated', handleSecurityUpdate);\n document.removeEventListener('real-security-calculated', handleRealSecurityCalculated);\n };\n }, []);\n\n // ============================================\n // REST of the component logic\n // ============================================\n\n React.useEffect(() => {\n // All security features are enabled by default - no session management needed\n setHasActiveSession(true);\n setCurrentTimeLeft(0);\n setSessionType('premium'); // All features enabled\n }, []);\n\n React.useEffect(() => {\n // All security features are enabled by default\n setHasActiveSession(true);\n setCurrentTimeLeft(0);\n setSessionType('premium'); // All features enabled\n }, [sessionTimeLeft]);\n\n React.useEffect(() => {\n const handleForceUpdate = (event) => {\n // All security features are enabled by default\n setHasActiveSession(true);\n setCurrentTimeLeft(0);\n setSessionType('premium'); // All features enabled\n };\n\n // Connection cleanup handler (use existing event from module)\n const handleConnectionCleaned = () => {\n if (window.DEBUG_MODE) {\n console.log('\uD83E\uDDF9 Connection cleaned - clearing security data in header');\n }\n\n setRealSecurityLevel(null);\n setLastSecurityUpdate(0);\n\n setHasActiveSession(false);\n setCurrentTimeLeft(0);\n setSessionType('unknown');\n };\n\n const handlePeerDisconnect = () => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDC4B Peer disconnect detected - clearing security data in header');\n }\n\n setRealSecurityLevel(null);\n setLastSecurityUpdate(0);\n };\n\n const handleDisconnected = () => {\n if (window.DEBUG_MODE) {\n console.log('\uD83D\uDD0C Disconnected - clearing security data in header');\n }\n\n setRealSecurityLevel(null);\n setLastSecurityUpdate(0);\n setHasActiveSession(false);\n setCurrentTimeLeft(0);\n setSessionType('unknown');\n };\n\n document.addEventListener('force-header-update', handleForceUpdate);\n document.addEventListener('peer-disconnect', handlePeerDisconnect);\n document.addEventListener('connection-cleaned', handleConnectionCleaned);\n document.addEventListener('disconnected', handleDisconnected);\n \n return () => {\n document.removeEventListener('force-header-update', handleForceUpdate);\n document.removeEventListener('peer-disconnect', handlePeerDisconnect);\n document.removeEventListener('connection-cleaned', handleConnectionCleaned);\n document.removeEventListener('disconnected', handleDisconnected);\n };\n }, []);\n\n // ============================================\n // SECURITY INDICATOR CLICK HANDLER\n // ============================================\n\n const handleSecurityClick = async (event) => {\n // Check if it's a right-click or Ctrl+click to disconnect\n if (event && (event.button === 2 || event.ctrlKey || event.metaKey)) {\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n return;\n }\n }\n\n // Prevent default behavior\n event.preventDefault();\n event.stopPropagation();\n\n // Debug information\n console.log('\uD83D\uDD0D Security click debug:', {\n hasWebrtcManager: !!webrtcManager,\n hasCryptoUtils: !!window.EnhancedSecureCryptoUtils,\n hasRealSecurityLevel: !!realSecurityLevel,\n connectionStatus: webrtcManager?.connectionState || 'unknown'\n });\n\n // Run real security tests if webrtcManager is available\n let realTestResults = null;\n if (webrtcManager && window.EnhancedSecureCryptoUtils) {\n try {\n console.log('\uD83D\uDD0D Running real security tests...');\n realTestResults = await window.EnhancedSecureCryptoUtils.calculateSecurityLevel(webrtcManager);\n console.log('\u2705 Real security tests completed:', realTestResults);\n } catch (error) {\n console.error('\u274C Real security tests failed:', error);\n }\n } else {\n console.log('\u26A0\uFE0F Cannot run security tests:', {\n webrtcManager: !!webrtcManager,\n cryptoUtils: !!window.EnhancedSecureCryptoUtils\n });\n }\n\n // If no real test results and no existing security level, show progress message\n if (!realTestResults && !realSecurityLevel) {\n alert('Security verification in progress...\\nPlease wait for real-time cryptographic verification to complete.');\n return;\n }\n\n // Use real test results if available, otherwise fall back to current data\n let securityData = realTestResults || realSecurityLevel;\n\n // If still no security data, create a basic fallback\n if (!securityData) {\n securityData = {\n level: 'UNKNOWN',\n score: 0,\n color: 'gray',\n verificationResults: {},\n timestamp: Date.now(),\n details: 'Security verification not available',\n isRealData: false,\n passedChecks: 0,\n totalChecks: 0,\n sessionType: 'unknown'\n };\n console.log('\u26A0\uFE0F Using fallback security data:', securityData);\n }\n\n // Detailed information about the REAL security check\n let message = `\uD83D\uDD12 REAL-TIME SECURITY VERIFICATION\\n\\n`;\n message += `Security Level: ${securityData.level} (${securityData.score}%)\\n`;\n message += `Session Type: ${securityData.sessionType || 'premium'}\\n`;\n message += `Verification Time: ${new Date(securityData.timestamp).toLocaleTimeString()}\\n`;\n message += `Data Source: ${securityData.isRealData ? 'Real Cryptographic Tests' : 'Simulated Data'}\\n\\n`;\n \n if (securityData.verificationResults) {\n message += 'DETAILED CRYPTOGRAPHIC TESTS:\\n';\n message += '=' + '='.repeat(40) + '\\n';\n \n const passedTests = Object.entries(securityData.verificationResults).filter(([key, result]) => result.passed);\n const failedTests = Object.entries(securityData.verificationResults).filter(([key, result]) => !result.passed);\n \n if (passedTests.length > 0) {\n message += '\u2705 PASSED TESTS:\\n';\n passedTests.forEach(([key, result]) => {\n const testName = key.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());\n message += ` ${testName}: ${result.details || 'Test passed'}\\n`;\n });\n message += '\\n';\n }\n \n if (failedTests.length > 0) {\n message += '\u274C FAILED/UNAVAILABLE TESTS:\\n';\n failedTests.forEach(([key, result]) => {\n const testName = key.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());\n message += ` ${testName}: ${result.details || 'Test failed or unavailable'}\\n`;\n });\n message += '\\n';\n }\n \n message += `SUMMARY:\\n`;\n message += `Passed: ${securityData.passedChecks}/${securityData.totalChecks} tests\\n`;\n message += `Score: ${securityData.score}/${securityData.maxPossibleScore || 100} points\\n\\n`;\n }\n \n // Real security features status\n message += `\uD83D\uDD12 SECURITY FEATURES STATUS:\\n`;\n message += '=' + '='.repeat(40) + '\\n';\n \n if (securityData.verificationResults) {\n const features = {\n 'ECDSA Digital Signatures': securityData.verificationResults.verifyECDSASignatures?.passed || false,\n 'ECDH Key Exchange': securityData.verificationResults.verifyECDHKeyExchange?.passed || false,\n 'AES-GCM Encryption': securityData.verificationResults.verifyEncryption?.passed || false,\n 'Message Integrity (HMAC)': securityData.verificationResults.verifyMessageIntegrity?.passed || false,\n 'Perfect Forward Secrecy': securityData.verificationResults.verifyPerfectForwardSecrecy?.passed || false,\n 'Replay Protection': securityData.verificationResults.verifyReplayProtection?.passed || false,\n 'DTLS Fingerprint': securityData.verificationResults.verifyDTLSFingerprint?.passed || false,\n 'SAS Verification': securityData.verificationResults.verifySASVerification?.passed || false,\n 'Metadata Protection': securityData.verificationResults.verifyMetadataProtection?.passed || false,\n 'Traffic Obfuscation': securityData.verificationResults.verifyTrafficObfuscation?.passed || false\n };\n \n Object.entries(features).forEach(([feature, isEnabled]) => {\n message += `${isEnabled ? '\u2705' : '\u274C'} ${feature}\\n`;\n });\n } else {\n // Fallback if no verification results\n message += `\u2705 ECDSA Digital Signatures\\n`;\n message += `\u2705 ECDH Key Exchange\\n`;\n message += `\u2705 AES-GCM Encryption\\n`;\n message += `\u2705 Message Integrity (HMAC)\\n`;\n message += `\u2705 Perfect Forward Secrecy\\n`;\n message += `\u2705 Replay Protection\\n`;\n message += `\u2705 DTLS Fingerprint\\n`;\n message += `\u2705 SAS Verification\\n`;\n message += `\u2705 Metadata Protection\\n`;\n message += `\u2705 Traffic Obfuscation\\n`;\n }\n \n message += `\\n${securityData.details || 'Real cryptographic verification completed'}`;\n \n if (securityData.isRealData) {\n message += '\\n\\n\u2705 This is REAL-TIME verification using actual cryptographic functions.';\n } else {\n message += '\\n\\n\u26A0\uFE0F Warning: This data may be simulated. Connection may not be fully established.';\n }\n \n // Show in a more user-friendly way\n const modal = document.createElement('div');\n modal.style.cssText = `\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0,0,0,0.8);\n z-index: 10000;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: monospace;\n `;\n \n const content = document.createElement('div');\n content.style.cssText = `\n background: #1a1a1a;\n color: #fff;\n padding: 20px;\n border-radius: 8px;\n max-width: 80%;\n max-height: 80%;\n overflow-y: auto;\n white-space: pre-line;\n border: 1px solid #333;\n `;\n \n content.textContent = message;\n modal.appendChild(content);\n \n // Close on click outside\n modal.addEventListener('click', (e) => {\n if (e.target === modal) {\n document.body.removeChild(modal);\n }\n });\n \n // Close on Escape key\n const handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n document.body.removeChild(modal);\n document.removeEventListener('keydown', handleKeyDown);\n }\n };\n document.addEventListener('keydown', handleKeyDown);\n \n document.body.appendChild(modal);\n };\n\n // ============================================\n // DISPLAY UTILITIES\n // ============================================\n\n const getStatusConfig = () => {\n switch (status) {\n case 'connected':\n return {\n text: 'Connected',\n className: 'status-connected',\n badgeClass: 'bg-green-500/10 text-green-400 border-green-500/20'\n };\n case 'verifying':\n return {\n text: 'Verifying...',\n className: 'status-verifying',\n badgeClass: 'bg-purple-500/10 text-purple-400 border-purple-500/20'\n };\n case 'connecting':\n return {\n text: 'Connecting...',\n className: 'status-connecting',\n badgeClass: 'bg-blue-500/10 text-blue-400 border-blue-500/20'\n };\n case 'retrying':\n return {\n text: 'Retrying...',\n className: 'status-connecting',\n badgeClass: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20'\n };\n case 'failed':\n return {\n text: 'Error',\n className: 'status-failed',\n badgeClass: 'bg-red-500/10 text-red-400 border-red-500/20'\n };\n case 'reconnecting':\n return {\n text: 'Reconnecting...',\n className: 'status-connecting',\n badgeClass: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20'\n };\n case 'peer_disconnected':\n return {\n text: 'Peer disconnected',\n className: 'status-failed',\n badgeClass: 'bg-orange-500/10 text-orange-400 border-orange-500/20'\n };\n default:\n return {\n text: 'Not connected',\n className: 'status-disconnected',\n badgeClass: 'bg-gray-500/10 text-gray-400 border-gray-500/20'\n };\n }\n };\n\n const config = getStatusConfig();\n const displaySecurityLevel = isConnected ? (realSecurityLevel || securityLevel) : null;\n \n const shouldShowTimer = hasActiveSession && currentTimeLeft > 0 && window.SessionTimer;\n\n // ============================================\n // DATA RELIABILITY INDICATOR\n // ============================================\n\n const getSecurityIndicatorDetails = () => {\n if (!displaySecurityLevel) {\n return {\n tooltip: 'Security verification in progress...',\n isVerified: false,\n dataSource: 'loading'\n };\n }\n \n const isRealData = displaySecurityLevel.isRealData !== false;\n const baseTooltip = `${displaySecurityLevel.level} (${displaySecurityLevel.score}%)`;\n \n if (isRealData) {\n return {\n tooltip: `${baseTooltip} - Real-time verification \u2705\\nRight-click or Ctrl+click to disconnect`,\n isVerified: true,\n dataSource: 'real'\n };\n } else {\n return {\n tooltip: `${baseTooltip} - Estimated (connection establishing...)\\nRight-click or Ctrl+click to disconnect`,\n isVerified: false,\n dataSource: 'estimated'\n };\n }\n };\n\n const securityDetails = getSecurityIndicatorDetails();\n\n // ============================================\n // ADDING global methods for debugging\n // ============================================\n\n React.useEffect(() => {\n window.debugHeaderSecurity = () => {\n console.log('\uD83D\uDD0D Header Security Debug:', {\n realSecurityLevel,\n lastSecurityUpdate,\n isConnected,\n webrtcManagerProp: !!webrtcManager,\n windowWebrtcManager: !!window.webrtcManager,\n cryptoUtils: !!window.EnhancedSecureCryptoUtils,\n displaySecurityLevel: displaySecurityLevel,\n securityDetails: securityDetails\n });\n };\n \n return () => {\n delete window.debugHeaderSecurity;\n };\n }, [realSecurityLevel, lastSecurityUpdate, isConnected, webrtcManager, displaySecurityLevel, securityDetails]);\n\n // ============================================\n // RENDER\n // ============================================\n\n return React.createElement('header', {\n className: 'header-minimal sticky top-0 z-50'\n }, [\n React.createElement('div', {\n key: 'container',\n className: 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8'\n }, [\n React.createElement('div', {\n key: 'content',\n className: 'flex items-center justify-between h-16'\n }, [\n // Logo and Title\n React.createElement('div', {\n key: 'logo-section',\n className: 'flex items-center space-x-2 sm:space-x-3'\n }, [\n React.createElement('div', {\n key: 'logo',\n className: 'icon-container w-8 h-8 sm:w-10 sm:h-10'\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-halved accent-orange text-sm sm:text-base'\n })\n ]),\n React.createElement('div', {\n key: 'title-section'\n }, [\n React.createElement('h1', {\n key: 'title',\n className: 'text-lg sm:text-xl font-semibold text-primary'\n }, 'SecureBit.chat'),\n React.createElement('p', {\n key: 'subtitle',\n className: 'text-xs sm:text-sm text-muted hidden sm:block'\n }, 'End-to-end freedom v4.2.12')\n ])\n ]),\n\n // Status and Controls - Responsive\n React.createElement('div', {\n key: 'status-section',\n className: 'flex items-center space-x-2 sm:space-x-3'\n }, [\n // Session Timer - all features enabled by default\n shouldShowTimer && React.createElement(window.SessionTimer, {\n key: 'session-timer',\n timeLeft: currentTimeLeft,\n sessionType: sessionType,\n onDisconnect: onDisconnect\n }),\n\n displaySecurityLevel && React.createElement('div', {\n key: 'security-level',\n className: 'hidden md:flex items-center space-x-2 cursor-pointer hover:opacity-80 transition-opacity duration-200',\n onClick: handleSecurityClick,\n onContextMenu: (e) => {\n e.preventDefault();\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n }\n },\n title: securityDetails.tooltip\n }, [\n React.createElement('div', {\n key: 'security-icon',\n className: `w-6 h-6 rounded-full flex items-center justify-center relative ${\n displaySecurityLevel.color === 'green' ? 'bg-green-500/20' :\n displaySecurityLevel.color === 'orange' ? 'bg-orange-500/20' :\n displaySecurityLevel.color === 'yellow' ? 'bg-yellow-500/20' : 'bg-red-500/20'\n } ${securityDetails.isVerified ? '' : 'animate-pulse'}`\n }, [\n React.createElement('i', {\n className: `fas fa-shield-alt text-xs ${\n displaySecurityLevel.color === 'green' ? 'text-green-400' :\n displaySecurityLevel.color === 'orange' ? 'text-orange-400' :\n displaySecurityLevel.color === 'yellow' ? 'text-yellow-400' : 'text-red-400'\n }`\n })\n ]),\n React.createElement('div', {\n key: 'security-info',\n className: 'flex flex-col'\n }, [\n React.createElement('div', {\n key: 'security-level-text',\n className: 'text-xs font-medium text-primary flex items-center space-x-1'\n }, [\n React.createElement('span', {}, `${displaySecurityLevel.level} (${displaySecurityLevel.score}%)`)\n ]),\n React.createElement('div', {\n key: 'security-details',\n className: 'text-xs text-muted mt-1 hidden lg:block'\n }, securityDetails.dataSource === 'real' ? \n `${displaySecurityLevel.passedChecks || 0}/${displaySecurityLevel.totalChecks || 0} tests` :\n (displaySecurityLevel.details || `Stage ${displaySecurityLevel.stage || 1}`)\n ),\n React.createElement('div', {\n key: 'security-progress',\n className: 'w-16 h-1 bg-gray-600 rounded-full overflow-hidden'\n }, [\n React.createElement('div', {\n key: 'progress-bar',\n className: `h-full transition-all duration-500 ${\n displaySecurityLevel.color === 'green' ? 'bg-green-400' :\n displaySecurityLevel.color === 'orange' ? 'bg-orange-400' :\n displaySecurityLevel.color === 'yellow' ? 'bg-yellow-400' : 'bg-red-400'\n }`,\n style: { width: `${displaySecurityLevel.score}%` }\n })\n ])\n ])\n ]),\n\n // Mobile Security Indicator\n displaySecurityLevel && React.createElement('div', {\n key: 'mobile-security',\n className: 'md:hidden flex items-center'\n }, [\n React.createElement('div', {\n key: 'mobile-security-icon',\n className: `w-8 h-8 rounded-full flex items-center justify-center cursor-pointer hover:opacity-80 transition-opacity duration-200 relative ${\n displaySecurityLevel.color === 'green' ? 'bg-green-500/20' :\n displaySecurityLevel.color === 'orange' ? 'bg-orange-500/20' :\n displaySecurityLevel.color === 'yellow' ? 'bg-yellow-500/20' : 'bg-red-500/20'\n } ${securityDetails.isVerified ? '' : 'animate-pulse'}`,\n title: securityDetails.tooltip,\n onClick: handleSecurityClick,\n onContextMenu: (e) => {\n e.preventDefault();\n if (onDisconnect && typeof onDisconnect === 'function') {\n onDisconnect();\n }\n }\n }, [\n React.createElement('i', {\n className: `fas fa-shield-alt text-sm ${\n displaySecurityLevel.color === 'green' ? 'text-green-400' :\n displaySecurityLevel.color === 'orange' ? 'text-orange-400' :\n displaySecurityLevel.color === 'yellow' ? 'text-yellow-400' : 'text-red-400'\n }`\n })\n ])\n ]),\n\n // Status Badge\n React.createElement('div', {\n key: 'status-badge',\n className: `px-2 sm:px-3 py-1.5 rounded-lg border ${config.badgeClass} flex items-center space-x-1 sm:space-x-2`\n }, [\n React.createElement('span', {\n key: 'status-dot',\n className: `status-dot ${config.className}`\n }),\n React.createElement('span', {\n key: 'status-text',\n className: 'text-xs sm:text-sm font-medium'\n }, config.text),\n ]),\n\n // Disconnect Button\n isConnected && React.createElement('button', {\n key: 'disconnect-btn',\n onClick: onDisconnect,\n className: 'p-1.5 sm:px-3 sm:py-1.5 bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 rounded-lg transition-all duration-200 text-sm'\n }, [\n React.createElement('i', {\n className: 'fas fa-power-off sm:mr-2'\n }),\n React.createElement('span', {\n className: 'hidden sm:inline'\n }, 'Disconnect')\n ])\n ])\n ])\n ])\n ]);\n};\n\nwindow.EnhancedMinimalHeader = EnhancedMinimalHeader;\n", "const DownloadApps = () => {\r\n const apps = [\r\n { id: 'web', name: 'Web App', subtitle: 'Browser Version', icon: 'fas fa-globe', platform: 'Web', isActive: true, url: 'https://securebitchat.github.io/securebit-chat/', color: 'green' },\r\n { id: 'windows', name: 'Windows', subtitle: 'Desktop App', icon: 'fab fa-windows', platform: 'Desktop', isActive: true, url: 'https://securebit.chat/download/windows/SecureBit%20Chat%20Setup%204.1.222.exe', color: 'blue' },\r\n { id: 'macos', name: 'macOS', subtitle: 'Desktop App', icon: 'fab fa-apple', platform: 'Desktop', isActive: false, url: '#', color: 'gray' },\r\n { id: 'linux', name: 'Linux', subtitle: 'Desktop App', icon: 'fab fa-linux', platform: 'Desktop', isActive: false, url: '#', color: 'orange' },\r\n { id: 'ios', name: 'iOS', subtitle: 'iPhone & iPad', icon: 'fab fa-apple', platform: 'Mobile', isActive: false, url: 'https://apps.apple.com/app/securebit-chat/', color: 'blue' },\r\n { id: 'android', name: 'Android', subtitle: 'Google Play', icon: 'fab fa-android', platform: 'Mobile', isActive: false, url: 'https://play.google.com/store/apps/details?id=com.securebit.chat', color: 'green' }\r\n ];\r\n\r\n const handleDownload = (app) => {\r\n if (app.isActive) window.open(app.url, '_blank');\r\n };\r\n\r\n const desktopApps = apps.filter(a => a.platform !== 'Mobile');\r\n const mobileApps = apps.filter(a => a.platform === 'Mobile');\r\n\r\n const cardSize = \"w-28 h-28\"; \r\n\r\n return React.createElement('div', { className: \"mt-20 px-6\" }, [\r\n // Header\r\n React.createElement('div', { key: 'header', className: \"text-center max-w-3xl mx-auto mb-12\" }, [\r\n React.createElement('h3', { key: 'title', className: \"text-3xl font-bold text-primary mb-3\" }, 'Download SecureBit.chat'),\r\n React.createElement('p', { key: 'subtitle', className: \"text-secondary text-lg mb-5\" }, 'Stay secure on every device. Choose your platform and start chatting privately.')\r\n ]),\r\n\r\n React.createElement('div', { key: 'desktop-row', className: \"hidden sm:flex justify-center flex-wrap gap-6 mb-6\" },\r\n desktopApps.map(app =>\r\n React.createElement('div', {\r\n key: app.id,\r\n className: `group relative ${cardSize} rounded-2xl overflow-hidden card-minimal cursor-pointer`\r\n }, [\r\n React.createElement('i', {\r\n key: 'bg-icon',\r\n className: `${app.icon} absolute text-[3rem] text-white/10 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none transition-all duration-500 group-hover:scale-105`\r\n }),\r\n React.createElement('div', {\r\n key: 'overlay',\r\n className: \"absolute inset-0 bg-black/30 backdrop-blur-md flex flex-col items-center justify-center text-center opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\r\n }, [\r\n React.createElement('h4', { key: 'name', className: `text-sm font-semibold text-primary mb-1` }, app.name),\r\n React.createElement('p', { key: 'subtitle', className: `text-xs text-secondary mb-2` }, app.subtitle),\r\n app.isActive ?\r\n React.createElement('button', {\r\n key: 'btn',\r\n onClick: () => handleDownload(app),\r\n className: `px-2 py-1 rounded-xl bg-emerald-500 text-black font-medium hover:bg-emerald-600 transition-colors text-xs`\r\n }, app.id === \"web\" ? \"Launch\" : \"Download\")\r\n :\r\n React.createElement('span', { key: 'coming', className: \"text-gray-400 font-medium text-xs\" }, \"Coming Soon\")\r\n ])\r\n ])\r\n )\r\n ),\r\n\r\n React.createElement('div', { key: 'mobile-row', className: \"flex justify-center gap-6\" },\r\n mobileApps.map(app =>\r\n React.createElement('div', {\r\n key: app.id,\r\n className: `group relative ${cardSize} rounded-2xl overflow-hidden card-minimal cursor-pointer`\r\n }, [\r\n React.createElement('i', {\r\n key: 'bg-icon',\r\n className: `${app.icon} absolute text-[3rem] text-white/10 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none transition-all duration-500 group-hover:scale-105`\r\n }),\r\n React.createElement('div', {\r\n key: 'overlay',\r\n className: \"absolute inset-0 bg-black/30 backdrop-blur-md flex flex-col items-center justify-center text-center opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\r\n }, [\r\n React.createElement('h4', { key: 'name', className: `text-sm font-semibold text-primary mb-1` }, app.name),\r\n React.createElement('p', { key: 'subtitle', className: `text-xs text-secondary mb-2` }, app.subtitle),\r\n app.isActive ?\r\n React.createElement('button', {\r\n key: 'btn',\r\n onClick: () => handleDownload(app),\r\n className: `px-2 py-1 rounded-xl bg-emerald-500 text-black font-medium hover:bg-emerald-600 transition-colors text-xs`\r\n }, \"Download\")\r\n :\r\n React.createElement('span', { key: 'coming', className: \"text-gray-400 font-medium text-xs\" }, \"Coming Soon\")\r\n ])\r\n ])\r\n )\r\n )\r\n ]);\r\n};\r\n\r\nwindow.DownloadApps = DownloadApps;\r\n", "// File Transfer Component for Chat Interface - Fixed Version\r\nconst FileTransferComponent = ({ webrtcManager, isConnected }) => {\r\n const [dragOver, setDragOver] = React.useState(false);\r\n const [transfers, setTransfers] = React.useState({ sending: [], receiving: [] });\r\n const [readyFiles, setReadyFiles] = React.useState([]); // \u0444\u0430\u0439\u043B\u044B, \u0433\u043E\u0442\u043E\u0432\u044B\u0435 \u043A \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044E\r\n const fileInputRef = React.useRef(null);\r\n\r\n // Update transfers periodically\r\n React.useEffect(() => {\r\n if (!isConnected || !webrtcManager) return;\r\n\r\n const updateTransfers = () => {\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n };\r\n\r\n const interval = setInterval(updateTransfers, 500);\r\n return () => clearInterval(interval);\r\n }, [isConnected, webrtcManager]);\r\n\r\n // Setup file transfer callbacks - \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u041D\u0415 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u043F\u0440\u043E\u043C\u0435\u0436\u0443\u0442\u043E\u0447\u043D\u044B\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u0447\u0430\u0442\r\n React.useEffect(() => {\r\n if (!webrtcManager) return;\r\n\r\n webrtcManager.setFileTransferCallbacks(\r\n // Progress callback - \u0422\u041E\u041B\u042C\u041A\u041E \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C UI, \u041D\u0415 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u0432 \u0447\u0430\u0442\r\n (progress) => {\r\n // \u041E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n \r\n // \u041D\u0415 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u043C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u0447\u0430\u0442!\r\n },\r\n \r\n // File received callback - \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u043C \u043A\u043D\u043E\u043F\u043A\u0443 \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044F \u0432 UI\r\n (fileData) => {\r\n // \u0414\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u043C \u0432 \u0441\u043F\u0438\u0441\u043E\u043A \u0433\u043E\u0442\u043E\u0432\u044B\u0445 \u043A \u0441\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u044E\r\n setReadyFiles(prev => {\r\n // \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043C \u0434\u0443\u0431\u043B\u0435\u0439 \u043F\u043E fileId\r\n if (prev.some(f => f.fileId === fileData.fileId)) return prev;\r\n return [...prev, {\r\n fileId: fileData.fileId,\r\n fileName: fileData.fileName,\r\n fileSize: fileData.fileSize,\r\n mimeType: fileData.mimeType,\r\n getBlob: fileData.getBlob,\r\n getObjectURL: fileData.getObjectURL,\r\n revokeObjectURL: fileData.revokeObjectURL\r\n }];\r\n });\r\n\r\n // \u041E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0441\u043F\u0438\u0441\u043E\u043A \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0445 \u043F\u0435\u0440\u0435\u0434\u0430\u0447\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n },\r\n \r\n // Error callback\r\n (error) => {\r\n const currentTransfers = webrtcManager.getFileTransfers();\r\n setTransfers(currentTransfers);\r\n \r\n // \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u041D\u0415 \u0434\u0443\u0431\u043B\u0438\u0440\u0443\u0435\u043C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u043E\u0431 \u043E\u0448\u0438\u0431\u043A\u0430\u0445\r\n // \u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F \u043E\u0431 \u043E\u0448\u0438\u0431\u043A\u0430\u0445 \u0443\u0436\u0435 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u044E\u0442\u0441\u044F \u0432 WebRTC \u043C\u0435\u043D\u0435\u0434\u0436\u0435\u0440\u0435\r\n }\r\n );\r\n }, [webrtcManager]);\r\n\r\n const handleFileSelect = async (files) => {\r\n if (!isConnected || !webrtcManager) {\r\n alert('\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E. \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435.');\r\n return;\r\n }\r\n\r\n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u044F \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\r\n if (!webrtcManager.isConnected() || !webrtcManager.isVerified) {\r\n alert('\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043D\u0435 \u0433\u043E\u0442\u043E\u0432\u043E \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432. \u0414\u043E\u0436\u0434\u0438\u0442\u0435\u0441\u044C \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F.');\r\n return;\r\n }\r\n\r\n for (const file of files) {\r\n try {\r\n // \u041A\u0420\u0418\u0422\u0418\u0427\u0415\u0421\u041A\u041E\u0415 \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u0412\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u044F \u0444\u0430\u0439\u043B\u0430 \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u043E\u0439\r\n const validation = webrtcManager.validateFile(file);\r\n if (!validation.isValid) {\r\n const errorMessage = validation.errors.join('. ');\r\n alert(`\u0424\u0430\u0439\u043B ${file.name} \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D: ${errorMessage}`);\r\n continue;\r\n }\r\n\r\n await webrtcManager.sendFile(file);\r\n } catch (error) {\r\n // \u0411\u043E\u043B\u0435\u0435 \u043C\u044F\u0433\u043A\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A - \u043D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0441\u0435\u0441\u0441\u0438\u044E\r\n \r\n // \u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044E \u043E\u0448\u0438\u0431\u043A\u0443, \u043D\u043E \u043D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435\r\n if (error.message.includes('Connection not ready')) {\r\n alert(`\u0424\u0430\u0439\u043B ${file.name} \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u0441\u0435\u0439\u0447\u0430\u0441. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.`);\r\n } else if (error.message.includes('File too large') || error.message.includes('exceeds maximum')) {\r\n alert(`\u0424\u0430\u0439\u043B ${file.name} \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0439: ${error.message}`);\r\n } else if (error.message.includes('Maximum concurrent transfers')) {\r\n alert(`\u0414\u043E\u0441\u0442\u0438\u0433\u043D\u0443\u0442 \u043B\u0438\u043C\u0438\u0442 \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445 \u043F\u0435\u0440\u0435\u0434\u0430\u0447. \u0414\u043E\u0436\u0434\u0438\u0442\u0435\u0441\u044C \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0442\u0435\u043A\u0443\u0449\u0438\u0445 \u043F\u0435\u0440\u0435\u0434\u0430\u0447.`);\r\n } else if (error.message.includes('File type not allowed')) {\r\n alert(`\u0422\u0438\u043F \u0444\u0430\u0439\u043B\u0430 ${file.name} \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F: ${error.message}`);\r\n } else {\r\n alert(`\u041E\u0448\u0438\u0431\u043A\u0430 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u0444\u0430\u0439\u043B\u0430 ${file.name}: ${error.message}`);\r\n }\r\n }\r\n }\r\n };\r\n\r\n const handleDrop = (e) => {\r\n e.preventDefault();\r\n setDragOver(false);\r\n \r\n const files = Array.from(e.dataTransfer.files);\r\n handleFileSelect(files);\r\n };\r\n\r\n const handleDragOver = (e) => {\r\n e.preventDefault();\r\n setDragOver(true);\r\n };\r\n\r\n const handleDragLeave = (e) => {\r\n e.preventDefault();\r\n setDragOver(false);\r\n };\r\n\r\n const handleFileInputChange = (e) => {\r\n const files = Array.from(e.target.files);\r\n handleFileSelect(files);\r\n e.target.value = ''; // Reset input\r\n };\r\n\r\n const formatFileSize = (bytes) => {\r\n if (bytes === 0) return '0 B';\r\n const k = 1024;\r\n const sizes = ['B', 'KB', 'MB', 'GB'];\r\n const i = Math.floor(Math.log(bytes) / Math.log(k));\r\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\r\n };\r\n\r\n const getStatusIcon = (status) => {\r\n switch (status) {\r\n case 'metadata_sent':\r\n case 'preparing':\r\n return 'fas fa-cog fa-spin';\r\n case 'transmitting':\r\n case 'receiving':\r\n return 'fas fa-exchange-alt fa-pulse';\r\n case 'assembling':\r\n return 'fas fa-puzzle-piece fa-pulse';\r\n case 'completed':\r\n return 'fas fa-check text-green-400';\r\n case 'failed':\r\n return 'fas fa-times text-red-400';\r\n default:\r\n return 'fas fa-circle';\r\n }\r\n };\r\n\r\n const getStatusText = (status) => {\r\n switch (status) {\r\n case 'metadata_sent':\r\n return '\u041F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043A\u0430...';\r\n case 'transmitting':\r\n return '\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430...';\r\n case 'receiving':\r\n return '\u041F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435...';\r\n case 'assembling':\r\n return '\u0421\u0431\u043E\u0440\u043A\u0430 \u0444\u0430\u0439\u043B\u0430...';\r\n case 'completed':\r\n return '\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E';\r\n case 'failed':\r\n return '\u041E\u0448\u0438\u0431\u043A\u0430';\r\n default:\r\n return status;\r\n }\r\n };\r\n\r\n if (!isConnected) {\r\n return React.createElement('div', {\r\n className: \"p-4 text-center text-muted\"\r\n }, '\u041F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043B\u043E\u0432 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u043E\u043C \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0438');\r\n }\r\n\r\n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\r\n const isConnectionReady = webrtcManager && webrtcManager.isConnected() && webrtcManager.isVerified;\r\n \r\n if (!isConnectionReady) {\r\n return React.createElement('div', {\r\n className: \"p-4 text-center text-yellow-600\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-exclamation-triangle mr-2'\r\n }),\r\n '\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442\u0441\u044F... \u041F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043B\u043E\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438.'\r\n ]);\r\n }\r\n\r\n return React.createElement('div', {\r\n className: \"file-transfer-component\"\r\n }, [\r\n // File Drop Zone\r\n React.createElement('div', {\r\n key: 'drop-zone',\r\n className: `file-drop-zone ${dragOver ? 'drag-over' : ''}`,\r\n onDrop: handleDrop,\r\n onDragOver: handleDragOver,\r\n onDragLeave: handleDragLeave,\r\n onClick: () => fileInputRef.current?.click()\r\n }, [\r\n React.createElement('div', {\r\n key: 'drop-content',\r\n className: \"drop-content\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-cloud-upload-alt text-2xl mb-2 text-blue-400'\r\n }),\r\n React.createElement('p', {\r\n key: 'text',\r\n className: \"text-primary font-medium\"\r\n }, 'Drag files here or click to select'),\r\n React.createElement('p', {\r\n key: 'subtext',\r\n className: \"text-muted text-sm\"\r\n }, 'Maximum size: 100 MB per file')\r\n ])\r\n ]),\r\n\r\n // Hidden file input\r\n React.createElement('input', {\r\n key: 'file-input',\r\n ref: fileInputRef,\r\n type: 'file',\r\n multiple: true,\r\n className: 'hidden',\r\n onChange: handleFileInputChange\r\n }),\r\n\r\n // Active Transfers\r\n (transfers.sending.length > 0 || transfers.receiving.length > 0) && React.createElement('div', {\r\n key: 'transfers',\r\n className: \"active-transfers mt-4\"\r\n }, [\r\n React.createElement('h4', {\r\n key: 'title',\r\n className: \"text-primary font-medium mb-3 flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-exchange-alt mr-2'\r\n }),\r\n '\u041F\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043B\u043E\u0432'\r\n ]),\r\n\r\n // Sending files\r\n ...transfers.sending.map(transfer => \r\n React.createElement('div', {\r\n key: `send-${transfer.fileId}`,\r\n className: \"transfer-item bg-blue-500/10 border border-blue-500/20 rounded-lg p-3 mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'header',\r\n className: \"flex items-center justify-between mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'info',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-upload text-blue-400 mr-2'\r\n }),\r\n React.createElement('span', {\r\n key: 'name',\r\n className: \"text-primary font-medium text-sm\"\r\n }, transfer.fileName),\r\n React.createElement('span', {\r\n key: 'size',\r\n className: \"text-muted text-xs ml-2\"\r\n }, formatFileSize(transfer.fileSize))\r\n ]),\r\n React.createElement('button', {\r\n key: 'cancel',\r\n onClick: () => webrtcManager.cancelFileTransfer(transfer.fileId),\r\n className: \"text-red-400 hover:text-red-300 text-xs\"\r\n }, [\r\n React.createElement('i', {\r\n className: 'fas fa-times'\r\n })\r\n ])\r\n ]),\r\n React.createElement('div', {\r\n key: 'progress',\r\n className: \"progress-bar\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'fill',\r\n className: \"progress-fill bg-blue-400\",\r\n style: { width: `${transfer.progress}%` }\r\n }),\r\n React.createElement('div', {\r\n key: 'text',\r\n className: \"progress-text text-xs flex items-center justify-between\"\r\n }, [\r\n React.createElement('span', {\r\n key: 'status',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: `${getStatusIcon(transfer.status)} mr-1`\r\n }),\r\n getStatusText(transfer.status)\r\n ]),\r\n React.createElement('span', {\r\n key: 'percent'\r\n }, `${transfer.progress.toFixed(1)}%`)\r\n ])\r\n ])\r\n ])\r\n ),\r\n\r\n // Receiving files\r\n ...transfers.receiving.map(transfer => \r\n React.createElement('div', {\r\n key: `recv-${transfer.fileId}`,\r\n className: \"transfer-item bg-green-500/10 border border-green-500/20 rounded-lg p-3 mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'header',\r\n className: \"flex items-center justify-between mb-2\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'info',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: 'fas fa-download text-green-400 mr-2'\r\n }),\r\n React.createElement('span', {\r\n key: 'name',\r\n className: \"text-primary font-medium text-sm\"\r\n }, transfer.fileName),\r\n React.createElement('span', {\r\n key: 'size',\r\n className: \"text-muted text-xs ml-2\"\r\n }, formatFileSize(transfer.fileSize))\r\n ]),\r\n React.createElement('div', { key: 'actions', className: 'flex items-center space-x-2' }, [\r\n (() => {\r\n const rf = readyFiles.find(f => f.fileId === transfer.fileId);\r\n if (!rf || transfer.status !== 'completed') return null;\r\n return React.createElement('button', {\r\n key: 'download',\r\n className: 'text-green-400 hover:text-green-300 text-xs flex items-center',\r\n onClick: async () => {\r\n try {\r\n const url = await rf.getObjectURL();\r\n const a = document.createElement('a');\r\n a.href = url;\r\n a.download = rf.fileName || 'file';\r\n a.click();\r\n rf.revokeObjectURL(url);\r\n } catch (e) {\r\n alert('Failed to start download: ' + e.message);\r\n }\r\n }\r\n }, [\r\n React.createElement('i', { key: 'i', className: 'fas fa-download mr-1' }),\r\n 'Download'\r\n ]);\r\n })(),\r\n React.createElement('button', {\r\n key: 'cancel',\r\n onClick: () => webrtcManager.cancelFileTransfer(transfer.fileId),\r\n className: \"text-red-400 hover:text-red-300 text-xs\"\r\n }, [\r\n React.createElement('i', {\r\n className: 'fas fa-times'\r\n })\r\n ])\r\n ])\r\n ]),\r\n React.createElement('div', {\r\n key: 'progress',\r\n className: \"progress-bar\"\r\n }, [\r\n React.createElement('div', {\r\n key: 'fill',\r\n className: \"progress-fill bg-green-400\",\r\n style: { width: `${transfer.progress}%` }\r\n }),\r\n React.createElement('div', {\r\n key: 'text',\r\n className: \"progress-text text-xs flex items-center justify-between\"\r\n }, [\r\n React.createElement('span', {\r\n key: 'status',\r\n className: \"flex items-center\"\r\n }, [\r\n React.createElement('i', {\r\n key: 'icon',\r\n className: `${getStatusIcon(transfer.status)} mr-1`\r\n }),\r\n getStatusText(transfer.status)\r\n ]),\r\n React.createElement('span', {\r\n key: 'percent'\r\n }, `${transfer.progress.toFixed(1)}%`)\r\n ])\r\n ])\r\n ])\r\n )\r\n ])\r\n ]);\r\n};\r\n\r\n// Export\r\nwindow.FileTransferComponent = FileTransferComponent;", "import { EnhancedSecureCryptoUtils } from '../crypto/EnhancedSecureCryptoUtils.js';\r\nimport { EnhancedSecureWebRTCManager } from '../network/EnhancedSecureWebRTCManager.js';\r\nimport { EnhancedSecureFileTransfer } from '../transfer/EnhancedSecureFileTransfer.js';\r\n\r\n// Import UI components (side-effect: they attach themselves to window.*)\r\nimport '../components/ui/SessionTimer.jsx';\r\nimport '../components/ui/Header.jsx';\r\nimport '../components/ui/DownloadApps.jsx';\r\nimport '../components/ui/FileTransfer.jsx';\r\n\r\n// Expose to global for legacy usage inside app code\r\nwindow.EnhancedSecureCryptoUtils = EnhancedSecureCryptoUtils;\r\nwindow.EnhancedSecureWebRTCManager = EnhancedSecureWebRTCManager;\r\nwindow.EnhancedSecureFileTransfer = EnhancedSecureFileTransfer;\r\n\r\n// Mount application once DOM and modules are ready\r\nconst start = () => {\r\n if (typeof window.initializeApp === 'function') {\r\n window.initializeApp();\r\n } else if (window.DEBUG_MODE) {\r\n console.error('initializeApp is not defined on window');\r\n }\r\n};\r\n\r\nif (document.readyState === 'loading') {\r\n document.addEventListener('DOMContentLoaded', start);\r\n} else {\r\n start();\r\n}\r\n"], + "mappings": ";AAAA,IAAM,4BAAN,MAAM,2BAA0B;AAAA,EAE5B,OAAO,eAAe,oBAAI,QAAQ;AAAA;AAAA;AAAA,EAKlC,OAAO,eAAe,KAAK;AACvB,QAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;AACzC,aAAO;AAAA,IACX;AAEA,QAAI,MAAM,QAAQ,GAAG,GAAG;AACpB,aAAO,IAAI,IAAI,2BAA0B,cAAc;AAAA,IAC3D;AAEA,UAAM,YAAY,CAAC;AACnB,WAAO,KAAK,GAAG,EAAE,KAAK,EAAE,QAAQ,SAAO;AACnC,gBAAU,GAAG,IAAI,2BAA0B,eAAe,IAAI,GAAG,CAAC;AAAA,IACtE,CAAC;AACD,WAAO;AAAA,EACX;AAAA;AAAA,EAGA,OAAO,gBAAgB,KAAK,eAAe,MAAM,iBAAiB,CAAC,GAAG;AAClE,QAAI,EAAE,eAAe,WAAY,OAAM,IAAI,MAAM,oBAAoB;AACrE,QAAI,gBAAgB,IAAI,WAAW,SAAS,cAAc;AACtD,YAAM,IAAI,MAAM,sBAAsB,YAAY,SAAS,IAAI,WAAW,IAAI,EAAE;AAAA,IACpF;AACA,eAAW,KAAK,gBAAgB;AAC5B,UAAI,CAAC,IAAI,UAAU,CAAC,IAAI,OAAO,SAAS,CAAC,GAAG;AACxC,cAAM,IAAI,MAAM,+BAA+B,CAAC,EAAE;AAAA,MACtD;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA,EAEA,OAAO,oBAAoB,QAAQ;AAC/B,QAAI,SAAS;AACb,UAAM,QAAQ,IAAI,WAAW,MAAM;AACnC,UAAM,MAAM,MAAM;AAClB,aAAS,IAAI,GAAG,IAAI,KA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AAiB,oBAAoB,KAAK;AACrD,OAAO;AACL,QAAM;AACR;", "names": ["fileMessageTypes", "attempts", "start", "start", "attempts", "chunk", "fileMessageTypes", "window", "webrtcManager"] } diff --git a/dist/app.js b/dist/app.js index cfe04cd..a094677 100644 --- a/dist/app.js +++ b/dist/app.js @@ -314,7 +314,7 @@ var ComparisonTable = () => { /* @__PURE__ */ React.createElement("td", { className: "p-4 text-center" }, /* @__PURE__ */ React.createElement("span", { className: `${getStatusIcon(feature.threema.status).color} text-2xl` }, getStatusIcon(feature.threema.status).icon)), /* @__PURE__ */ React.createElement("td", { className: "p-4 text-center" }, /* @__PURE__ */ React.createElement("span", { className: `${getStatusIcon(feature.session.status).color} text-2xl` }, getStatusIcon(feature.session.status).icon)) ), selectedFeature === featureIndex && /* @__PURE__ */ React.createElement("tr", { className: "border-b border-gray-700/30 bg-gradient-to-r from-gray-800/20 to-gray-900/20" }, /* @__PURE__ */ React.createElement("td", { className: "p-4 text-xs text-gray-400 font-medium" }, "Technical Details:"), /* @__PURE__ */ React.createElement("td", { className: "p-4 text-center" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs text-orange-300 font-medium leading-relaxed max-w-32" }, feature.lockbit.detail)), /* @__PURE__ */ React.createElement("td", { className: "p-4 text-center" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs text-blue-300 leading-relaxed max-w-32" }, feature.signal.detail)), /* @__PURE__ */ React.createElement("td", { className: "p-4 text-center" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs text-green-300 leading-relaxed max-w-32" }, feature.threema.detail)), /* @__PURE__ */ React.createElement("td", { className: "p-4 text-center" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs text-cyan-300 leading-relaxed max-w-32" }, feature.session.detail)))))) - )), /* @__PURE__ */ React.createElement("div", { className: "mt-8 grid grid-cols-2 md:grid-cols-4 gap-4 max-w-5xl mx-auto" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-xl hover:bg-yellow-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-yellow-400 mr-2 text-xl" }, "\u{1F3C6}"), /* @__PURE__ */ React.createElement("span", { className: "text-yellow-300 text-sm font-bold" }, "Category Leader")), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-green-500/10 border border-green-500/20 rounded-xl hover:bg-green-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-green-400 mr-2 text-xl" }, "\u2705"), /* @__PURE__ */ React.createElement("span", { className: "text-green-300 text-sm font-bold" }, "Excellent")), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-xl hover:bg-yellow-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-yellow-400 mr-2 text-xl" }, "\u26A0\uFE0F"), /* @__PURE__ */ React.createElement("span", { className: "text-yellow-300 text-sm font-bold" }, "Partial/Limited")), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-red-500/10 border border-red-500/20 rounded-xl hover:bg-red-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-red-400 mr-2 text-xl" }, "\u274C"), /* @__PURE__ */ React.createElement("span", { className: "text-red-300 text-sm font-bold" }, "Not Available"))), /* @__PURE__ */ React.createElement("div", { className: "mt-10 space-y-6 max-w-6xl mx-auto" }, /* @__PURE__ */ React.createElement("div", { className: "p-6 bg-gradient-to-r from-orange-500/10 to-yellow-500/10 border border-orange-500/20 rounded-xl" }, /* @__PURE__ */ React.createElement("h4", { className: "text-xl font-bold text-orange-400 mb-4 flex items-center" }, /* @__PURE__ */ React.createElement("i", { className: "fas fa-trophy mr-3" }), "SecureBit.chat Enhanced Security Edition Summary"), /* @__PURE__ */ React.createElement("p", { className: "text-secondary leading-relaxed text-lg mb-4" }, "SecureBit.chat dominates in 11 out of 15 security categories, establishing itself as the most secure P2P messenger available. The Enhanced Security Edition introduces revolutionary 18-layer defense architecture with complete ASN.1 validation, and military-grade cryptography that exceeds government and enterprise standards."), /* @__PURE__ */ React.createElement("div", { className: "grid md:grid-cols-2 gap-4 mt-6" }, /* @__PURE__ */ React.createElement("div", { className: "p-4 bg-orange-500/5 border border-orange-500/10 rounded-lg" }, /* @__PURE__ */ React.createElement("h5", { className: "text-orange-400 font-semibold mb-2" }, "\u{1F510} Cryptographic Superiority"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-300" }, "ECDH P-384 + AES-GCM 256 + ECDSA P-384 + Complete ASN.1 Validation with non-extractable keys and 18-layer defense system")), /* @__PURE__ */ React.createElement("div", { className: "p-4 bg-orange-500/5 border border-orange-500/10 rounded-lg" }, /* @__PURE__ */ React.createElement("h5", { className: "text-orange-400 font-semibold mb-2" }, "\u{1F310} True P2P Architecture"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-300" }, "Pure WebRTC connections with zero servers, impossible to censor or shutdown, complete anonymity")), /* @__PURE__ */ React.createElement("div", { className: "p-4 bg-orange-500/5 border border-orange-500/10 rounded-lg" }, /* @__PURE__ */ React.createElement("h5", { className: "text-orange-400 font-semibold mb-2" }, "\u{1F3AD} Traffic Obfuscation"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-300" }, "Advanced fake traffic generation, packet padding, and pattern masking defeat traffic analysis"))))), /* @__PURE__ */ React.createElement("div", { className: "mt-8 text-center" }, /* @__PURE__ */ React.createElement("div", { className: "inline-flex items-center px-6 py-3 bg-gray-800/50 border border-gray-600/30 rounded-xl" }, /* @__PURE__ */ React.createElement("span", { className: "text-orange-400 mr-2" }, "\u{1F680}"), /* @__PURE__ */ React.createElement("span", { className: "text-gray-300 text-sm" }, "Enhanced Security Edition v4.02.985 - ECDH + DTLS + SAS - "), /* @__PURE__ */ React.createElement("span", { className: "text-orange-400 font-semibold text-sm" }, "Active Production Release"), /* @__PURE__ */ React.createElement("span", { className: "text-gray-400 text-sm ml-2" }, " | Next: v5.0 Post-Quantum"))))); + )), /* @__PURE__ */ React.createElement("div", { className: "mt-8 grid grid-cols-2 md:grid-cols-4 gap-4 max-w-5xl mx-auto" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-xl hover:bg-yellow-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-yellow-400 mr-2 text-xl" }, "\u{1F3C6}"), /* @__PURE__ */ React.createElement("span", { className: "text-yellow-300 text-sm font-bold" }, "Category Leader")), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-green-500/10 border border-green-500/20 rounded-xl hover:bg-green-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-green-400 mr-2 text-xl" }, "\u2705"), /* @__PURE__ */ React.createElement("span", { className: "text-green-300 text-sm font-bold" }, "Excellent")), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-xl hover:bg-yellow-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-yellow-400 mr-2 text-xl" }, "\u26A0\uFE0F"), /* @__PURE__ */ React.createElement("span", { className: "text-yellow-300 text-sm font-bold" }, "Partial/Limited")), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center p-4 bg-red-500/10 border border-red-500/20 rounded-xl hover:bg-red-500/20 transition-colors" }, /* @__PURE__ */ React.createElement("span", { className: "text-red-400 mr-2 text-xl" }, "\u274C"), /* @__PURE__ */ React.createElement("span", { className: "text-red-300 text-sm font-bold" }, "Not Available"))), /* @__PURE__ */ React.createElement("div", { className: "mt-10 space-y-6 max-w-6xl mx-auto" }, /* @__PURE__ */ React.createElement("div", { className: "p-6 bg-gradient-to-r from-orange-500/10 to-yellow-500/10 border border-orange-500/20 rounded-xl" }, /* @__PURE__ */ React.createElement("h4", { className: "text-xl font-bold text-orange-400 mb-4 flex items-center" }, /* @__PURE__ */ React.createElement("i", { className: "fas fa-trophy mr-3" }), "SecureBit.chat Enhanced Security Edition Summary"), /* @__PURE__ */ React.createElement("p", { className: "text-secondary leading-relaxed text-lg mb-4" }, "SecureBit.chat dominates in 11 out of 15 security categories, establishing itself as the most secure P2P messenger available. The Enhanced Security Edition introduces revolutionary 18-layer defense architecture with complete ASN.1 validation, and military-grade cryptography that exceeds government and enterprise standards."), /* @__PURE__ */ React.createElement("div", { className: "grid md:grid-cols-2 gap-4 mt-6" }, /* @__PURE__ */ React.createElement("div", { className: "p-4 bg-orange-500/5 border border-orange-500/10 rounded-lg" }, /* @__PURE__ */ React.createElement("h5", { className: "text-orange-400 font-semibold mb-2" }, "\u{1F510} Cryptographic Superiority"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-300" }, "ECDH P-384 + AES-GCM 256 + ECDSA P-384 + Complete ASN.1 Validation with non-extractable keys and 18-layer defense system")), /* @__PURE__ */ React.createElement("div", { className: "p-4 bg-orange-500/5 border border-orange-500/10 rounded-lg" }, /* @__PURE__ */ React.createElement("h5", { className: "text-orange-400 font-semibold mb-2" }, "\u{1F310} True P2P Architecture"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-300" }, "Pure WebRTC connections with zero servers, impossible to censor or shutdown, complete anonymity")), /* @__PURE__ */ React.createElement("div", { className: "p-4 bg-orange-500/5 border border-orange-500/10 rounded-lg" }, /* @__PURE__ */ React.createElement("h5", { className: "text-orange-400 font-semibold mb-2" }, "\u{1F3AD} Traffic Obfuscation"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-300" }, "Advanced fake traffic generation, packet padding, and pattern masking defeat traffic analysis"))))), /* @__PURE__ */ React.createElement("div", { className: "mt-8 text-center" }, /* @__PURE__ */ React.createElement("div", { className: "inline-flex items-center px-6 py-3 bg-gray-800/50 border border-gray-600/30 rounded-xl" }, /* @__PURE__ */ React.createElement("span", { className: "text-orange-400 mr-2" }, "\u{1F680}"), /* @__PURE__ */ React.createElement("span", { className: "text-gray-300 text-sm" }, "Enhanced Security Edition v4.2.12 - ECDH + DTLS + SAS - "), /* @__PURE__ */ React.createElement("span", { className: "text-orange-400 font-semibold text-sm" }, "Active Production Release"), /* @__PURE__ */ React.createElement("span", { className: "text-gray-400 text-sm ml-2" }, " | Next: v5.0 Post-Quantum"))))); }; function Roadmap() { const [selectedPhase, setSelectedPhase] = React.useState(null); @@ -392,7 +392,7 @@ function Roadmap() { }, // current and future phases { - version: "v4.02.985", + version: "v4.2.12", title: "Enhanced Security Edition", status: "current", date: "Now", @@ -2475,7 +2475,7 @@ var EnhancedSecureP2PChat = () => { handleAnswerError, handleVerificationStateChange ); - handleMessage("\u{1F680} SecureBit.chat Enhanced Security Edition v4.02.985 - ECDH + DTLS + SAS initialized. Ready to establish a secure connection with ECDH key exchange, DTLS fingerprint verification, and SAS authentication to prevent MITM attacks.", "system"); + handleMessage("\u{1F680} SecureBit.chat Enhanced Security Edition v4.2.12 - ECDH + DTLS + SAS initialized. Ready to establish a secure connection with ECDH key exchange, DTLS fingerprint verification, and SAS authentication to prevent MITM attacks.", "system"); const handleBeforeUnload = (event) => { if (event.type === "beforeunload" && !isTabSwitching) { console.log("\u{1F50C} Page unloading (closing tab) - sending disconnect notification"); diff --git a/dist/app.js.map b/dist/app.js.map index 5deeaf9..0c71445 100644 --- a/dist/app.js.map +++ b/dist/app.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/app.jsx"], - "sourcesContent": ["// QRScanner will be loaded as a script\n \n // Slider Component\n const UniqueFeatureSlider = () => {\n const [currentSlide, setCurrentSlide] = React.useState(0);\n \n const slides = [\n {\n icon: \"fas fa-shield-halved\",\n color: \"orange\",\n title: \"18-Layer Military Security\",\n description: \"Revolutionary defense system with ECDH P-384 + AES-GCM 256 + ECDSA + Complete ASN.1 Validation. Enhanced Security Edition provides military-grade protection exceeding government standards with complete key structure verification.\"\n },\n {\n icon: \"fas fa-network-wired\",\n color: \"purple\",\n title: \"Pure P2P WebRTC Architecture\",\n description: \"Direct peer-to-peer connections without any servers. Impossible to censor, block, or monitor. Complete decentralization with zero infrastructure.\"\n },\n {\n icon: \"fas fa-sync-alt\",\n color: \"green\",\n title: \"Perfect Forward Secrecy\",\n description: \"Automatic key rotation every 5 minutes or 100 messages. Non-extractable keys with hardware protection ensure past messages remain secure.\"\n },\n {\n icon: \"fas fa-user-secret\",\n color: \"cyan\",\n title: \"Advanced Traffic Obfuscation\",\n description: \"Fake traffic generation, packet padding, and pattern masking make communication indistinguishable from random noise. Defeats traffic analysis.\"\n },\n {\n icon: \"fas fa-eye-slash\",\n color: \"blue\",\n title: \"Zero Data Collection\",\n description: \"No registration, no servers, no logs. Messages exist only in browser memory. Complete anonymity with instant anonymous channels.\"\n },\n {\n icon: \"fas fa-code\",\n color: \"emerald\",\n title: \"100% Open Source Security\",\n description: \"All code is open for audit under MIT license. Uses only standard WebCrypto APIs. Cryptography runs directly in browser without server dependencies.\"\n }\n ];\n \n const nextSlide = () => setCurrentSlide((prev) => (prev + 1) % slides.length);\n const prevSlide = () => setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length);\n const goToSlide = (index) => setCurrentSlide(index);\n \n React.useEffect(() => {\n const timer = setInterval(() => {\n nextSlide();\n }, 15000);\n return () => clearInterval(timer);\n }, []);\n \n return React.createElement('div', {\n className: \"mt-12\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center mb-8\"\n }, [\n React.createElement('h3', {\n key: 'title',\n className: \"text-2xl font-semibold text-primary mb-3\"\n }, 'Why SecureBit.chat is unique'),\n React.createElement('p', {\n key: 'subtitle',\n className: \"text-secondary max-w-2xl mx-auto\"\n }, 'The only messenger with military-grade cryptography')\n ]),\n \n React.createElement('div', {\n key: 'slider-container',\n className: \"relative max-w-4xl mx-auto\"\n }, [\n React.createElement('div', {\n key: 'slider-wrapper',\n className: \"overflow-hidden rounded-xl\"\n }, [\n React.createElement('div', {\n key: 'slides',\n className: \"flex transition-transform duration-500 ease-in-out\",\n style: { transform: `translateX(-${currentSlide * 100}%)` }\n }, slides.map((slide, index) =>\n React.createElement('div', {\n key: index,\n className: \"w-full flex-shrink-0 px-4\"\n }, [\n React.createElement('div', {\n key: 'slide-content',\n className: \"card-minimal rounded-xl p-8 text-center min-h-[300px] flex flex-col justify-center relative overflow-hidden\"\n }, [\n // Background icon\n React.createElement('i', {\n key: 'bg-icon',\n className: `${slide.icon} absolute right-[-100px] top-1/2 -translate-y-1/2 opacity-10 text-[300px] pointer-events-none ${\n slide.color === 'orange' ? 'text-orange-500' :\n slide.color === 'yellow' ? 'text-yellow-500' :\n slide.color === 'purple' ? 'text-purple-500' :\n slide.color === 'green' ? 'text-green-500' :\n slide.color === 'cyan' ? 'text-cyan-500' :\n slide.color === 'blue' ? 'text-blue-500' :\n 'text-emerald-500'\n }`\n }),\n \n // Content\n React.createElement('h4', {\n key: 'slide-title',\n className: \"text-xl font-semibold text-primary mb-4 relative z-10\"\n }, slide.title),\n React.createElement('p', {\n key: 'slide-description',\n className: \"text-secondary leading-relaxed max-w-2xl mx-auto relative z-10\"\n }, slide.description)\n ])\n ])\n ))\n ]),\n \n // Navigation\n React.createElement('button', {\n key: 'prev-btn',\n onClick: prevSlide,\n className: \"absolute left-2 top-1/2 transform -translate-y-1/2 w-10 h-10 bg-gray-600/80 hover:bg-gray-500/80 text-white rounded-full flex items-center justify-center transition-all duration-200 z-10\"\n }, [\n React.createElement('i', {\n key: 'prev-icon',\n className: \"fas fa-chevron-left\"\n })\n ]),\n React.createElement('button', {\n key: 'next-btn',\n onClick: nextSlide,\n className: \"absolute right-2 top-1/2 transform -translate-y-1/2 w-10 h-10 bg-gray-600/80 hover:bg-gray-500/80 text-white rounded-full flex items-center justify-center transition-all duration-200 z-10\"\n }, [\n React.createElement('i', {\n key: 'next-icon',\n className: \"fas fa-chevron-right\"\n })\n ])\n ]),\n \n // Enhanced dots navigation (\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u043C \u0443\u043B\u0443\u0447\u0448\u0435\u043D\u043D\u044B\u0435 \u0442\u043E\u0447\u043A\u0438)\n React.createElement('div', {\n key: 'dots-container',\n className: \"flex justify-center space-x-3 mt-6\"\n }, slides.map((slide, index) =>\n React.createElement('button', {\n key: index,\n onClick: () => goToSlide(index),\n className: `relative group transition-all duration-300 ${\n index === currentSlide\n ? 'w-12 h-4 bg-orange-500 rounded-full'\n : 'w-4 h-4 bg-gray-600 hover:bg-gray-500 rounded-full hover:scale-125'\n }`\n }, [\n // Tooltip on hover\n React.createElement('div', {\n key: 'tooltip',\n className: \"absolute -top-10 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap pointer-events-none\"\n }, slide.title)\n ])\n ))\n ]);\n };\n \n \n \n const ComparisonTable = () => {\n const [selectedFeature, setSelectedFeature] = React.useState(null);\n \n const messengers = [\n {\n name: \"SecureBit.chat\",\n logo:
\n \n
,\n type: \"P2P WebRTC\",\n version: \"Latest\",\n color: \"orange\",\n },\n {\n name: \"Signal\",\n logo: (\n \n \n \n \n ),\n type: \"Centralized\",\n version: \"Latest\",\n color: \"blue\",\n },\n {\n name: \"Threema\",\n logo: (\n \n \n \n \n \n \n \n ),\n type: \"Centralized\",\n version: \"Latest\",\n color: \"green\",\n },\n {\n name: \"Session\",\n logo: (\n \n \n \n \n ),\n type: \"Onion Network\",\n version: \"Latest\",\n color: \"cyan\",\n },\n ];\n \n const features = [\n {\n name: \"Security Architecture\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"18-layer military-grade defense system with complete ASN.1 validation\" },\n signal: { status: \"\u2705\", detail: \"Signal Protocol with double ratchet\" },\n threema: { status: \"\u2705\", detail: \"Standard security implementation\" },\n session: { status: \"\u2705\", detail: \"Modified Signal Protocol + Onion routing\" },\n },\n {\n name: \"Cryptography\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"ECDH P-384 + AES-GCM 256 + ECDSA P-384\" },\n signal: { status: \"\u2705\", detail: \"Signal Protocol + Double Ratchet\" },\n threema: { status: \"\u2705\", detail: \"NaCl + XSalsa20 + Poly1305\" },\n session: { status: \"\u2705\", detail: \"Modified Signal Protocol\" },\n },\n {\n name: \"Perfect Forward Secrecy\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Auto rotation every 5 minutes or 100 messages\" },\n signal: { status: \"\u2705\", detail: \"Double Ratchet algorithm\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Partial (group chats)\" },\n session: { status: \"\u2705\", detail: \"Session Ratchet algorithm\" },\n },\n {\n name: \"Architecture\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Pure P2P WebRTC without servers\" },\n signal: { status: \"\u274C\", detail: \"Centralized Signal servers\" },\n threema: { status: \"\u274C\", detail: \"Threema servers in Switzerland\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Onion routing via network nodes\" },\n },\n {\n name: \"Registration Anonymity\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"No registration required, instant anonymous channels\" },\n signal: { status: \"\u274C\", detail: \"Phone number required\" },\n threema: { status: \"\u2705\", detail: \"ID generated locally\" },\n session: { status: \"\u2705\", detail: \"Random session ID\" },\n },\n {\n name: \"Payment Integration\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Lightning Network satoshis per session + WebLN\" },\n signal: { status: \"\u274C\", detail: \"No payment system\" },\n threema: { status: \"\u274C\", detail: \"No payment system\" },\n session: { status: \"\u274C\", detail: \"No payment system\" },\n },\n {\n name: \"Metadata Protection\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Full metadata encryption + traffic obfuscation\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Sealed Sender (partial)\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Minimal metadata\" },\n session: { status: \"\u2705\", detail: \"Onion routing hides metadata\" },\n },\n {\n name: \"Traffic Obfuscation\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Fake traffic + pattern masking + packet padding\" },\n signal: { status: \"\u274C\", detail: \"No traffic obfuscation\" },\n threema: { status: \"\u274C\", detail: \"No traffic obfuscation\" },\n session: { status: \"\u2705\", detail: \"Onion routing provides obfuscation\" },\n },\n {\n name: \"Open Source\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"100% open + auditable + MIT license\" },\n signal: { status: \"\u2705\", detail: \"Fully open\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Only clients open\" },\n session: { status: \"\u2705\", detail: \"Fully open\" },\n },\n {\n name: \"MITM Protection\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Out-of-band verification + mutual auth + ECDSA\" },\n signal: { status: \"\u2705\", detail: \"Safety numbers verification\" },\n threema: { status: \"\u2705\", detail: \"QR code scanning\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Basic key verification\" },\n },\n {\n name: \"Economic Model\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Sustainable pay-per-session model\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Donations and grants dependency\" },\n threema: { status: \"\u2705\", detail: \"One-time app purchase\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Donations dependency\" },\n },\n {\n name: \"Censorship Resistance\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Impossible to block P2P + no servers to target\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Blocked in authoritarian countries\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"May be blocked\" },\n session: { status: \"\u2705\", detail: \"Onion routing bypasses blocks\" },\n },\n {\n name: \"Data Storage\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Zero data storage - only in browser memory\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Local database storage\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Local + optional backup\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Local database storage\" },\n },\n {\n name: \"Key Security\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Non-extractable keys + hardware protection\" },\n signal: { status: \"\u2705\", detail: \"Secure key storage\" },\n threema: { status: \"\u2705\", detail: \"Local key storage\" },\n session: { status: \"\u2705\", detail: \"Secure key storage\" },\n },\n {\n name: \"Post-Quantum Roadmap\",\n lockbit: { status: \"\u2705\", detail: \"Planned v5.0 - CRYSTALS-Kyber/Dilithium\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"PQXDH in development\" },\n threema: { status: \"\u274C\", detail: \"Not announced\" },\n session: { status: \"\u274C\", detail: \"Not announced\" },\n },\n ];\n \n const getStatusIcon = (status) => {\n const statusMap = {\n \"\uD83C\uDFC6\": { icon: \"\uD83C\uDFC6\", color: \"text-yellow-400\" },\n \"\u2705\": { icon: \"\u2705\", color: \"text-green-400\" },\n \"\u26A0\uFE0F\": { icon: \"\u26A0\uFE0F\", color: \"text-yellow-400\" },\n \"\u274C\": { icon: \"\u274C\", color: \"text-red-400\" },\n };\n return statusMap[status] || { icon: status, color: \"text-gray-400\" };\n };\n \n const toggleFeatureDetail = (index) => {\n setSelectedFeature(selectedFeature === index ? null : index);\n };\n \n return (\n
\n {/* Title */}\n
\n

\n Enhanced Security Edition Comparison\n

\n

\n Enhanced Security Edition vs leading secure messengers\n

\n
\n \uD83C\uDFC6\n \n Category Leader - Military-Grade Security\n \n
\n
\n \n {/* Table container */}\n
\n {/* Mobile Alert */}\n
\n

\n \uD83D\uDCA1 Rotate your device horizontally for better viewing\n

\n
\n \n {/* Table */}\n
\n \n {/* Table Header */}\n \n \n \n Security Criterion\n \n {messengers.map((messenger, index) => (\n \n
\n
{messenger.logo}
\n
\n {messenger.name}\n
\n
{messenger.type}
\n
{messenger.version}
\n
\n \n ))}\n \n \n \n {/* Table body*/}\n \n {features.map((feature, featureIndex) => (\n \n toggleFeatureDetail(featureIndex)}\n >\n \n
\n {feature.name}\n \n
\n \n \n \n {getStatusIcon(feature.lockbit.status).icon}\n \n \n \n \n {getStatusIcon(feature.signal.status).icon}\n \n \n \n \n {getStatusIcon(feature.threema.status).icon}\n \n \n \n \n {getStatusIcon(feature.session.status).icon}\n \n \n \n \n {/* Details */}\n {selectedFeature === featureIndex && (\n \n Technical Details:\n \n
\n {feature.lockbit.detail}\n
\n \n \n
\n {feature.signal.detail}\n
\n \n \n
\n {feature.threema.detail}\n
\n \n \n
\n {feature.session.detail}\n
\n \n \n )}\n
\n ))}\n \n \n
\n \n {/* Legend */}\n
\n
\n \uD83C\uDFC6\n Category Leader\n
\n
\n \u2705\n Excellent\n
\n
\n \u26A0\uFE0F\n Partial/Limited\n
\n
\n \u274C\n Not Available\n
\n
\n \n {/* Legend */}\n
\n
\n

\n \n SecureBit.chat Enhanced Security Edition Summary\n

\n

\n SecureBit.chat dominates in 11 out of 15 security categories, establishing itself as the most secure P2P messenger available.\n The Enhanced Security Edition introduces revolutionary 18-layer defense architecture with complete ASN.1 validation, and military-grade cryptography that exceeds government and enterprise standards.\n

\n
\n
\n
\uD83D\uDD10 Cryptographic Superiority
\n

\n ECDH P-384 + AES-GCM 256 + ECDSA P-384 + Complete ASN.1 Validation with non-extractable keys and 18-layer defense system\n

\n
\n
\n
\uD83C\uDF10 True P2P Architecture
\n

\n Pure WebRTC connections with zero servers, impossible to censor or shutdown, complete anonymity\n

\n
\n
\n
\uD83C\uDFAD Traffic Obfuscation
\n

\n Advanced fake traffic generation, packet padding, and pattern masking defeat traffic analysis\n

\n
\n
\n
\n
\n \n {/* Version information */}\n
\n
\n \uD83D\uDE80\n Enhanced Security Edition v4.02.985 - ECDH + DTLS + SAS - \n Active Production Release\n | Next: v5.0 Post-Quantum\n
\n
\n
\n
\n );\n };\n \n function Roadmap() {\n const [selectedPhase, setSelectedPhase] = React.useState(null);\n const phases = [\n {\n version: \"v1.0\",\n title: \"Start of Development\",\n status: \"done\",\n date: \"Early 2025\",\n description: \"Idea, prototype, and infrastructure setup\",\n features: [\n \"Concept and requirements formation\",\n \"Stack selection: WebRTC, P2P, cryptography\",\n \"First messaging prototypes\",\n \"Repository creation and CI\",\n \"Basic encryption architecture\",\n \"UX/UI design\"\n ]\n },\n {\n version: \"v1.5\",\n title: \"Alpha Release\",\n status: \"done\",\n date: \"Spring 2025\",\n description: \"First public alpha: basic chat and key exchange\",\n features: [\n \"Basic P2P messaging via WebRTC\",\n \"Simple E2E encryption (demo scheme)\",\n \"Stable signaling and reconnection\",\n \"Minimal UX for testing\",\n \"Feedback collection from early testers\"\n ]\n },\n {\n version: \"v2.0\",\n title: \"Security Hardened\",\n status: \"done\",\n date: \"Summer 2025\",\n description: \"Security strengthening and stable branch release\",\n features: [\n \"ECDH/ECDSA implementation in production\",\n \"Perfect Forward Secrecy and key rotation\",\n \"Improved authentication checks\",\n \"File encryption and large payload transfers\",\n \"Audit of basic cryptoprocesses\"\n ]\n },\n {\n version: \"v3.0\",\n title: \"Scaling & Stability\",\n status: \"done\",\n date: \"Fall 2025\",\n description: \"Network scaling and stability improvements\",\n features: [\n \"Optimization of P2P connections and NAT traversal\",\n \"Reconnection mechanisms and message queues\",\n \"Reduced battery consumption on mobile\",\n \"Support for multi-device synchronization\",\n \"Monitoring and logging tools for developers\"\n ]\n },\n {\n version: \"v3.5\",\n title: \"Privacy-first Release\",\n status: \"done\",\n date: \"Winter 2025\",\n description: \"Focus on privacy: minimizing metadata\",\n features: [\n \"Metadata protection and fingerprint reduction\",\n \"Experiments with onion routing and DHT\",\n \"Options for anonymous connections\",\n \"Preparation for open code audit\",\n \"Improved user verification processes\"\n ]\n },\n \n // current and future phases\n {\n version: \"v4.02.985\",\n title: \"Enhanced Security Edition\",\n status: \"current\",\n date: \"Now\",\n description: \"Current version with ECDH + DTLS + SAS security, 18-layer military-grade cryptography and complete ASN.1 validation\",\n features: [\n \"ECDH + DTLS + SAS triple-layer security\",\n \"ECDH P-384 + AES-GCM 256-bit encryption\",\n \"DTLS fingerprint verification\",\n \"SAS (Short Authentication String) verification\",\n \"Perfect Forward Secrecy with key rotation\",\n \"Enhanced MITM attack prevention\",\n \"Complete ASN.1 DER validation\",\n \"OID and EC point verification\",\n \"SPKI structure validation\",\n \"P2P WebRTC architecture\",\n \"Metadata protection\",\n \"100% open source code\"\n ]\n },\n {\n version: \"v4.5\",\n title: \"Mobile & Desktop Edition\",\n status: \"development\",\n date: \"Q2 2025\",\n description: \"Native apps for all platforms\",\n features: [\n \"PWA app for mobile\",\n \"Electron app for desktop\",\n \"Real-time notifications\",\n \"Automatic reconnection\",\n \"Battery optimization\",\n \"Cross-device synchronization\",\n \"Improved UX/UI\",\n \"Support for files up to 100MB\"\n ]\n },\n {\n version: \"v5.0\",\n title: \"Quantum-Resistant Edition\",\n status: \"planned\",\n date: \"Q4 2025\",\n description: \"Protection against quantum computers\",\n features: [\n \"Post-quantum cryptography CRYSTALS-Kyber\",\n \"SPHINCS+ digital signatures\",\n \"Hybrid scheme: classic + PQ\",\n \"Quantum-safe key exchange\",\n \"Updated hashing algorithms\",\n \"Migration of existing sessions\",\n \"Compatibility with v4.x\",\n \"Quantum-resistant protocols\"\n ]\n },\n {\n version: \"v5.5\",\n title: \"Group Communications\",\n status: \"planned\",\n date: \"Q2 2026\",\n description: \"Group chats with preserved privacy\",\n features: [\n \"P2P group connections up to 8 participants\",\n \"Mesh networking for groups\",\n \"Signal Double Ratchet for groups\",\n \"Anonymous groups without metadata\",\n \"Ephemeral groups (disappear after session)\",\n \"Cryptographic group administration\",\n \"Group member auditing\"\n ]\n },\n {\n version: \"v6.0\",\n title: \"Decentralized Network\",\n status: \"research\",\n date: \"2027\",\n description: \"Fully decentralized network\",\n features: [\n \"LockBit node mesh network\",\n \"DHT for peer discovery\",\n \"Built-in onion routing\",\n \"Tokenomics and node incentives\",\n \"Governance via DAO\",\n \"Interoperability with other networks\",\n \"Cross-platform compatibility\",\n \"Self-healing network\"\n ]\n },\n {\n version: \"v7.0\",\n title: \"AI Privacy Assistant\",\n status: \"research\",\n date: \"2028+\",\n description: \"AI for privacy and security\",\n features: [\n \"Local AI threat analysis\",\n \"Automatic MITM detection\",\n \"Adaptive cryptography\",\n \"Personalized security recommendations\",\n \"Zero-knowledge machine learning\",\n \"Private AI assistant\",\n \"Predictive security\",\n \"Autonomous attack protection\"\n ]\n }\n ];\n \n \n const getStatusConfig = (status) => {\n switch (status) {\n case 'current':\n return {\n color: 'green',\n bgClass: 'bg-green-500/10 border-green-500/20',\n textClass: 'text-green-400',\n icon: 'fas fa-check-circle',\n label: 'Current Version'\n };\n case 'development':\n return {\n color: 'orange',\n bgClass: 'bg-orange-500/10 border-orange-500/20',\n textClass: 'text-orange-400',\n icon: 'fas fa-code',\n label: 'In Development'\n };\n case 'planned':\n return {\n color: 'blue',\n bgClass: 'bg-blue-500/10 border-blue-500/20',\n textClass: 'text-blue-400',\n icon: 'fas fa-calendar-alt',\n label: 'Planned'\n };\n case 'research':\n return {\n color: 'purple',\n bgClass: 'bg-purple-500/10 border-purple-500/20',\n textClass: 'text-purple-400',\n icon: 'fas fa-flask',\n label: 'Research'\n };\n case 'done':\n return {\n color: 'gray',\n bgClass: 'bg-gray-500/10 border-gray-500/20',\n textClass: 'text-gray-300',\n icon: 'fas fa-flag-checkered',\n label: 'Released'\n };\n default:\n return {\n color: 'gray',\n bgClass: 'bg-gray-500/10 border-gray-500/20',\n textClass: 'text-gray-400',\n icon: 'fas fa-question',\n label: 'Unknown'\n };\n }\n };\n \n \n const togglePhaseDetail = (index) => {\n setSelectedPhase(selectedPhase === index ? null : index);\n };\n return (\n
\n
\n

\n Development Roadmap\n

\n

\n Evolution of SecureBit.chat : from initial development to quantum-resistant decentralized network with complete ASN.1 validation\n

\n \n \n \n Click on a version for details\n \n
\n
\n \n
\n
\n {/* The line has been removed */}\n \n
\n {phases.map((phase, index) => {\n const statusConfig = getStatusConfig(phase.status);\n const isExpanded = selectedPhase === index;\n \n return (\n
\n {/* The dots are visible only on sm and larger screens */}\n \n togglePhaseDetail(index)}\n key={`phase-button-${index}`}\n className={`card-minimal rounded-xl p-4 text-left w-full transition-all duration-300 ${\n isExpanded\n ? \"ring-2 ring-\" + statusConfig.color + \"-500/30\"\n : \"\"\n }`}\n >\n \n \n \n \n {phase.version}\n \n
\n \n
\n \n {phase.title}\n \n \n {phase.description}\n

\n
\n
\n \n \n \n \n \n {statusConfig.label}\n \n
\n \n
{phase.date}
\n \n
\n
\n \n {isExpanded && (\n \n \n \n Key features:\n \n \n \n {phase.features.map((feature, featureIndex) => (\n \n \n \n {feature}\n \n \n ))}\n \n \n )}\n \n \n );\n })}\n \n \n \n \n
\n \n \n Join the future of privacy\n \n

\n SecureBit.chat grows thanks to the community. Your ideas and feedback help shape the future of secure communication with complete ASN.1 validation.\n

\n \n \n \n \n GitHub Repository\n \n \n \n \n Feedback\n \n
\n \n \n \n );\n }\n \n \n // Enhanced Copy Button with better UX\n const EnhancedCopyButton = ({ text, className = \"\", children }) => {\n const [copied, setCopied] = React.useState(false);\n \n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (error) {\n console.error('Copy failed:', error);\n // Fallback for older browsers\n const textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.select();\n document.execCommand('copy');\n document.body.removeChild(textArea);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n };\n \n return React.createElement('button', {\n onClick: handleCopy,\n className: `${className} transition-all duration-200`\n }, [\n React.createElement('i', {\n key: 'icon',\n className: `${copied ? 'fas fa-check accent-green' : 'fas fa-copy text-secondary'} mr-2`\n }),\n copied ? 'Copied!' : children\n ]);\n };\n \n // Verification Component\n const VerificationStep = ({ verificationCode, onConfirm, onReject, localConfirmed, remoteConfirmed, bothConfirmed }) => {\n return React.createElement('div', {\n className: \"card-minimal rounded-xl p-6 border-purple-500/20\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'icon',\n className: \"w-10 h-10 bg-purple-500/10 border border-purple-500/20 rounded-lg flex items-center justify-center mr-3\"\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt accent-purple'\n })\n ]),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Security verification\")\n ]),\n React.createElement('div', {\n key: 'content',\n className: \"space-y-4\"\n }, [\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm\"\n }, \"Verify the security code with your contact via another communication channel (voice, SMS, etc.):\"),\n React.createElement('div', {\n key: 'code-display',\n className: \"text-center\"\n }, [\n React.createElement('div', {\n key: 'code',\n className: \"verification-code text-2xl py-4\"\n }, verificationCode)\n ]),\n // Verification status indicators\n React.createElement('div', {\n key: 'verification-status',\n className: \"space-y-2\"\n }, [\n React.createElement('div', {\n key: 'local-status',\n className: `flex items-center justify-between p-2 rounded-lg ${localConfirmed ? 'bg-green-500/10 border border-green-500/20' : 'bg-gray-500/10 border border-gray-500/20'}`\n }, [\n React.createElement('span', {\n key: 'local-label',\n className: \"text-sm text-secondary\"\n }, \"Your confirmation:\"),\n React.createElement('div', {\n key: 'local-indicator',\n className: \"flex items-center\"\n }, [\n React.createElement('i', {\n key: 'local-icon',\n className: `fas ${localConfirmed ? 'fa-check-circle text-green-400' : 'fa-clock text-gray-400'} mr-2`\n }),\n React.createElement('span', {\n key: 'local-text',\n className: `text-sm ${localConfirmed ? 'text-green-400' : 'text-gray-400'}`\n }, localConfirmed ? 'Confirmed' : 'Pending')\n ])\n ]),\n React.createElement('div', {\n key: 'remote-status',\n className: `flex items-center justify-between p-2 rounded-lg ${remoteConfirmed ? 'bg-green-500/10 border border-green-500/20' : 'bg-gray-500/10 border border-gray-500/20'}`\n }, [\n React.createElement('span', {\n key: 'remote-label',\n className: \"text-sm text-secondary\"\n }, \"Peer confirmation:\"),\n React.createElement('div', {\n key: 'remote-indicator',\n className: \"flex items-center\"\n }, [\n React.createElement('i', {\n key: 'remote-icon',\n className: `fas ${remoteConfirmed ? 'fa-check-circle text-green-400' : 'fa-clock text-gray-400'} mr-2`\n }),\n React.createElement('span', {\n key: 'remote-text',\n className: `text-sm ${remoteConfirmed ? 'text-green-400' : 'text-gray-400'}`\n }, remoteConfirmed ? 'Confirmed' : 'Pending')\n ])\n ])\n ]),\n React.createElement('div', {\n key: 'warning',\n className: \"p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg\"\n }, [\n React.createElement('p', {\n className: \"text-yellow-400 text-sm flex items-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-exclamation-triangle mr-2'\n }),\n 'Make sure the codes match exactly.!'\n ])\n ]),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex space-x-3\"\n }, [\n React.createElement('button', {\n key: 'confirm',\n onClick: onConfirm,\n disabled: localConfirmed,\n className: `flex-1 py-3 px-4 rounded-lg font-medium transition-all duration-200 ${localConfirmed ? 'bg-gray-500/20 text-gray-400 cursor-not-allowed' : 'btn-verify text-white'}`\n }, [\n React.createElement('i', {\n className: `fas ${localConfirmed ? 'fa-check-circle' : 'fa-check'} mr-2`\n }),\n localConfirmed ? 'Confirmed' : 'The codes match'\n ]),\n React.createElement('button', {\n key: 'reject',\n onClick: onReject,\n className: \"flex-1 bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 py-3 px-4 rounded-lg font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n className: 'fas fa-times mr-2'\n }),\n 'The codes do not match'\n ])\n ])\n ])\n ]);\n };\n \n // Enhanced Chat Message with better security indicators\n const EnhancedChatMessage = ({ message, type, timestamp }) => {\n const formatTime = (ts) => {\n return new Date(ts).toLocaleTimeString('ru-RU', { \n hour: '2-digit', \n minute: '2-digit',\n second: '2-digit'\n });\n };\n \n const getMessageStyle = () => {\n switch (type) {\n case 'sent':\n return {\n container: \"ml-auto bg-orange-500/15 border-orange-500/20 text-primary\",\n icon: \"fas fa-lock accent-orange\",\n label: \"Encrypted\"\n };\n case 'received':\n return {\n container: \"mr-auto card-minimal text-primary\",\n icon: \"fas fa-unlock-alt accent-green\",\n label: \"Decrypted\"\n };\n case 'system':\n return {\n container: \"mx-auto bg-yellow-500/10 border border-yellow-500/20 text-yellow-400\",\n icon: \"fas fa-info-circle accent-yellow\",\n label: \"System\"\n };\n default:\n return {\n container: \"mx-auto card-minimal text-secondary\",\n icon: \"fas fa-circle text-muted\",\n label: \"Unknown\"\n };\n }\n };\n \n const style = getMessageStyle();\n \n return React.createElement('div', {\n className: `message-slide mb-3 p-3 rounded-lg max-w-md break-words ${style.container} border`\n }, [\n React.createElement('div', {\n key: 'content',\n className: \"flex items-start space-x-2\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: `${style.icon} text-sm mt-0.5 opacity-70`\n }),\n React.createElement('div', {\n key: 'text',\n className: \"flex-1\"\n }, [\n React.createElement('div', {\n key: 'message',\n className: \"text-sm\"\n }, message),\n timestamp && React.createElement('div', {\n key: 'meta',\n className: \"flex items-center justify-between mt-1 text-xs opacity-50\"\n }, [\n React.createElement('span', {\n key: 'time'\n }, formatTime(timestamp)),\n React.createElement('span', {\n key: 'status',\n className: \"text-xs\"\n }, style.label)\n ])\n ])\n ])\n ]);\n };\n \n // Enhanced Connection Setup with verification\n const EnhancedConnectionSetup = ({\n messages, \n onCreateOffer, \n onCreateAnswer, \n onConnect, \n onClearData,\n onVerifyConnection,\n connectionStatus,\n offerData,\n answerData,\n offerInput,\n setOfferInput,\n answerInput,\n setAnswerInput,\n showOfferStep,\n showAnswerStep,\n verificationCode,\n showVerification,\n showQRCode,\n qrCodeUrl,\n showQRScanner,\n setShowQRCode,\n setShowQRScanner,\n setShowQRScannerModal,\n offerPassword,\n answerPassword,\n localVerificationConfirmed,\n remoteVerificationConfirmed,\n bothVerificationsConfirmed,\n // QR control props\n qrFramesTotal,\n qrFrameIndex,\n qrManualMode,\n toggleQrManualMode,\n nextQrFrame,\n prevQrFrame\n }) => {\n const [mode, setMode] = React.useState('select');\n \n const resetToSelect = () => {\n setMode('select');\n onClearData();\n };\n \n const handleVerificationConfirm = () => {\n onVerifyConnection(true);\n };\n \n const handleVerificationReject = () => {\n onVerifyConnection(false);\n };\n \n if (showVerification) {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'verification',\n className: \"w-full max-w-md\"\n }, [\n React.createElement(VerificationStep, {\n verificationCode: verificationCode,\n onConfirm: handleVerificationConfirm,\n onReject: handleVerificationReject,\n localConfirmed: localVerificationConfirmed,\n remoteConfirmed: remoteVerificationConfirmed,\n bothConfirmed: bothVerificationsConfirmed\n })\n ])\n ]);\n }\n \n if (mode === 'select') {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'selector',\n className: \"w-full max-w-4xl\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center mb-8\"\n }, [\n React.createElement('h2', {\n key: 'title',\n className: \"text-2xl font-semibold text-primary mb-3\"\n }, 'Start secure communication'),\n React.createElement('p', {\n key: 'subtitle',\n className: \"text-secondary max-w-2xl mx-auto\"\n }, \"Choose a connection method for a secure channel with ECDH encryption and Perfect Forward Secrecy.\")\n ]),\n \n React.createElement('div', {\n key: 'options',\n className: \"grid md:grid-cols-2 gap-6 max-w-3xl mx-auto\"\n }, [\n // Create Connection\n React.createElement('div', {\n key: 'create',\n onClick: () => setMode('create'),\n className: \"card-minimal rounded-xl p-6 cursor-pointer group\"\n }, [\n React.createElement('div', {\n key: 'icon',\n className: \"w-12 h-12 bg-blue-500/10 border border-blue-500/20 rounded-lg flex items-center justify-center mx-auto mb-4\"\n }, [\n React.createElement('i', {\n className: 'fas fa-plus text-xl text-blue-400'\n })\n ]),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-semibold text-primary text-center mb-3\"\n }, \"Create channel\"),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-center text-sm mb-4\"\n }, \"Initiate a new secure connection with encrypted exchange\"),\n React.createElement('div', {\n key: 'features',\n className: \"space-y-2\"\n }, [\n React.createElement('div', {\n key: 'f1',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-key accent-orange mr-2 text-xs'\n }),\n 'Generating ECDH keys'\n ]),\n React.createElement('div', {\n key: 'f2',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt accent-orange mr-2 text-xs'\n }),\n 'Verification code'\n ]),\n React.createElement('div', {\n key: 'f3',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-sync-alt accent-purple mr-2 text-xs'\n }),\n 'PFS key rotation'\n ])\n ])\n ]),\n \n // Join Connection\n React.createElement('div', {\n key: 'join',\n onClick: () => setMode('join'),\n className: \"card-minimal rounded-xl p-6 cursor-pointer group\"\n }, [\n React.createElement('div', {\n key: 'icon',\n className: \"w-12 h-12 bg-green-500/10 border border-green-500/20 rounded-lg flex items-center justify-center mx-auto mb-4\"\n }, [\n React.createElement('i', {\n className: 'fas fa-link text-xl accent-green'\n })\n ]),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-semibold text-primary text-center mb-3\"\n }, \"Join\"),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-center text-sm mb-4\"\n }, \"Connect to an existing secure channel\"),\n React.createElement('div', {\n key: 'features',\n className: \"space-y-2\"\n }, [\n React.createElement('div', {\n key: 'f1',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-paste accent-green mr-2 text-xs'\n }),\n 'Paste Offer invitation'\n ]),\n React.createElement('div', {\n key: 'f2',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-check-circle accent-green mr-2 text-xs'\n }),\n 'Automatic verification'\n ]),\n React.createElement('div', {\n key: 'f3',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-sync-alt accent-purple mr-2 text-xs'\n }),\n 'PFS protection'\n ])\n ])\n ])\n ]),\n \n \n React.createElement('div', {\n key: 'security-features',\n className: \"grid grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4 max-w-6xl mx-auto mt-8\"\n }, [\n React.createElement('div', { key: 'feature1', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-green-500/10 border border-green-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-key accent-green' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"ECDH P-384 Key Exchange\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Military-grade elliptic curve key exchange\")\n ]),\n React.createElement('div', { key: 'feature2', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-purple-500/10 border border-purple-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-user-shield accent-purple' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"MITM Protection\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Out-of-band verification against attacks\")\n ]),\n React.createElement('div', { key: 'feature3', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-orange-500/10 border border-orange-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-lock accent-orange' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"AES-GCM 256 Encryption\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Authenticated encryption standard\")\n ]),\n React.createElement('div', { key: 'feature4', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-cyan-500/10 border border-cyan-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-sync-alt accent-cyan' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"Perfect Forward Secrecy\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Automatic key rotation every 5 minutes\")\n ]),\n React.createElement('div', { key: 'feature5', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-blue-500/10 border border-blue-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-signature accent-blue' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"ECDSA P-384 Signatures\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Digital signatures for message integrity\")\n ]),\n ]),\n \n React.createElement(UniqueFeatureSlider, { key: 'unique-features-slider' }),\n \n React.createElement(DownloadApps, { key: 'download-apps' }),\n \n React.createElement(ComparisonTable, { key: 'comparison-table' }), \n \n React.createElement(Roadmap, { key: 'roadmap' }),\n ])\n ]);\n }\n \n if (mode === 'create') {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'create-flow',\n className: \"w-full max-w-3xl space-y-6\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center\"\n }, [\n React.createElement('button', {\n key: 'back',\n onClick: resetToSelect,\n className: \"mb-4 text-secondary hover:text-primary transition-colors flex items-center mx-auto text-sm\"\n }, [\n React.createElement('i', {\n className: 'fas fa-arrow-left mr-2'\n }),\n 'Back to selection'\n ]),\n React.createElement('h2', {\n key: 'title',\n className: \"text-xl font-semibold text-primary mb-2\"\n }, 'Creating a secure channel')\n ]),\n \n // Step 1\n React.createElement('div', {\n key: 'step1',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"step-number mr-3\"\n }, '1'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Generating ECDH keys and verification code\")\n ]),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm mb-4\"\n }, \"Creating cryptographically strong keys and codes to protect against attacks\"),\n React.createElement('button', {\n key: 'create-btn',\n onClick: onCreateOffer,\n disabled: connectionStatus === 'connecting' || showOfferStep,\n className: `w-full btn-primary text-white py-3 px-4 rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed`\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt mr-2'\n }),\n showOfferStep ? 'Keys created \u2713' : 'Create secure keys'\n ]),\n \n showOfferStep && React.createElement('div', {\n key: 'offer-result',\n className: \"mt-6 space-y-4\"\n }, [\n React.createElement('div', {\n key: 'success',\n className: \"p-3 bg-green-500/10 border border-green-500/20 rounded-lg\"\n }, [\n React.createElement('p', {\n className: \"text-green-400 text-sm font-medium flex items-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-check-circle mr-2'\n }),\n 'Secure invitation created! Send the code to your contact:'\n ])\n ]),\n React.createElement('div', {\n key: 'offer-data',\n className: \"space-y-3\"\n }, [\n React.createElement('textarea', {\n key: 'textarea',\n value: typeof offerData === 'object' ? JSON.stringify(offerData, null, 2) : offerData,\n readOnly: true,\n rows: 8,\n className: \"w-full p-3 bg-custom-bg border border-gray-500/20 rounded-lg font-mono text-xs text-secondary resize-none custom-scrollbar\"\n }),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex gap-2\"\n }, [\n React.createElement(EnhancedCopyButton, {\n key: 'copy',\n text: typeof offerData === 'object' ? JSON.stringify(offerData, null, 2) : offerData,\n className: \"flex-1 px-3 py-2 bg-orange-500/10 hover:bg-orange-500/20 text-orange-400 border border-orange-500/20 rounded text-sm font-medium\"\n }, 'Copy invitation code'),\n React.createElement('button', {\n key: 'qr-toggle',\n onClick: async () => {\n const next = !showQRCode;\n setShowQRCode(next);\n if (next) {\n try {\n const payload = typeof offerData === 'object' ? JSON.stringify(offerData) : offerData;\n if (payload && payload.length) {\n await generateQRCode(payload);\n }\n } catch (e) {\n console.warn('QR regenerate on toggle failed:', e);\n }\n }\n },\n className: \"px-3 py-2 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border border-blue-500/20 rounded text-sm font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: showQRCode ? 'fas fa-eye-slash mr-1' : 'fas fa-qrcode mr-1'\n }),\n showQRCode ? 'Hide QR' : 'Show QR'\n ])\n ]),\n showQRCode && qrCodeUrl && React.createElement('div', {\n key: 'qr-container',\n className: \"mt-4 p-4 bg-gray-800/50 border border-gray-600/30 rounded-lg text-center\"\n }, [\n React.createElement('h4', {\n key: 'qr-title',\n className: \"text-sm font-medium text-primary mb-3\"\n }, 'Scan QR code to connect'),\n React.createElement('div', {\n key: 'qr-wrapper',\n className: \"flex justify-center\"\n }, [\n React.createElement('img', {\n key: 'qr-image',\n src: qrCodeUrl,\n alt: \"QR Code for secure connection\",\n className: \"max-w-none h-auto border border-gray-600/30 rounded w-[20rem] sm:w-[24rem] md:w-[28rem] lg:w-[32rem]\"\n })\n ]),\n \n // \u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u0438\u0436\u0435 QR \u043A\u043E\u0434\u0430\n ((qrFramesTotal || 0) >= 1) && React.createElement('div', {\n key: 'qr-controls-below',\n className: \"mt-4 flex flex-col items-center gap-2\"\n }, [\n React.createElement('div', {\n key: 'frame-indicator',\n className: \"text-xs text-gray-300\"\n }, `Frame ${Math.max(1, (qrFrameIndex || 1))}/${qrFramesTotal || 1}`),\n React.createElement('div', {\n key: 'control-buttons',\n className: \"flex gap-1\"\n }, [\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'prev-frame',\n onClick: prevQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25C0'),\n React.createElement('button', {\n key: 'toggle-manual',\n onClick: toggleQrManualMode,\n className: `px-2 py-1 rounded text-xs font-medium ${\n (qrManualMode || false)\n ? 'bg-blue-500 text-white' \n : 'bg-gray-600 text-gray-300 hover:bg-gray-500'\n }`\n }, (qrManualMode || false) ? 'Manual' : 'Auto'),\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'next-frame',\n onClick: nextQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25B6')\n ])\n ]),\n React.createElement('p', {\n key: 'qr-description',\n className: \"text-xs text-gray-400 mt-2\"\n }, 'Your contact can scan this QR code to quickly join the secure session')\n ])\n ])\n ])\n ]),\n \n // Step 2 - Session Type Selection\n // showOfferStep && React.createElement('div', {\n // key: 'step2',\n // className: \"card-minimal rounded-xl p-6\"\n // }, [\n // React.createElement('div', {\n // key: 'step-header',\n // className: \"flex items-center mb-4\"\n // }, [\n // React.createElement('div', {\n // key: 'number',\n // className: \"w-8 h-8 bg-green-500 text-white rounded-lg flex items-center justify-center font-semibold text-sm mr-3\"\n // }, '2'),\n // React.createElement('h3', {\n // key: 'title',\n // className: \"text-lg font-medium text-primary\"\n // }, \"Select session type\")\n // ]),\n // React.createElement('p', {\n // key: 'description',\n // className: \"text-secondary text-sm mb-4\"\n // }, \"Choose a session plan or use limited demo mode for testing.\"),\n // React.createElement(SessionTypeSelector, {\n // key: 'session-selector',\n // onSelectType: (sessionType) => {\n // // Save the selected session type\n // setSelectedSessionType(sessionType);\n // console.log('\uD83C\uDFAF Session type selected:', sessionType);\n \n // // FIX: For demo sessions, we immediately call automatic activation\n // if (sessionType === 'demo') {\n // console.log('\uD83C\uDFAE Demo session selected, scheduling automatic activation...');\n // // Delay activation for 2 seconds to stabilize\n // setTimeout(() => {\n // if (sessionManager) {\n // console.log('\uD83D\uDE80 Triggering demo session activation from selection...');\n // handleDemoVerification();\n // }\n // }, 2000);\n // }\n \n // // Open a modal payment window\n // if (typeof window.showPaymentModal === 'function') {\n // window.showPaymentModal(sessionType);\n // } else {\n // // Fallback - show session information\n // console.log('Selected session type:', sessionType);\n // }\n // },\n // onCancel: resetToSelect,\n // sessionManager: window.sessionManager\n // })\n // ]),\n \n // Step 3 - Waiting for response\n showOfferStep && React.createElement('div', {\n key: 'step2',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"w-8 h-8 bg-blue-500 text-white rounded-lg flex items-center justify-center font-semibold text-sm mr-3\"\n }, '2'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Waiting for the peer's response\")\n ]),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm mb-4\"\n }, \"Paste the encrypted invitation code from your contact.\"),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex gap-2 mb-4\"\n }, [\n React.createElement('button', {\n key: 'scan-btn',\n onClick: () => setShowQRScannerModal(true),\n className: \"px-4 py-2 bg-purple-500/10 hover:bg-purple-500/20 text-purple-400 border border-purple-500/20 rounded text-sm font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: 'fas fa-qrcode mr-2'\n }),\n 'Scan QR Code'\n ])\n ]),\n React.createElement('textarea', {\n key: 'input',\n value: answerInput,\n onChange: (e) => {\n setAnswerInput(e.target.value);\n // Mark answer as created when user manually enters data\n if (e.target.value.trim().length > 0) {\n markAnswerCreated();\n }\n },\n rows: 6,\n placeholder: \"Paste the encrypted response code from your contact or scan QR code...\",\n className: \"w-full p-3 bg-custom-bg border border-gray-500/20 rounded-lg resize-none mb-4 text-secondary placeholder-gray-500 focus:border-orange-500/40 focus:outline-none transition-all custom-scrollbar text-sm\"\n }),\n React.createElement('button', {\n key: 'connect-btn',\n onClick: onConnect,\n disabled: !answerInput.trim(),\n className: \"w-full btn-secondary text-white py-3 px-4 rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n }, [\n React.createElement('i', {\n className: 'fas fa-rocket mr-2'\n }),\n 'Establish connection'\n ])\n ])\n ])\n ]);\n }\n \n if (mode === 'join') {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'join-flow',\n className: \"w-full max-w-3xl space-y-6\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center\"\n }, [\n React.createElement('button', {\n key: 'back',\n onClick: resetToSelect,\n className: \"mb-4 text-secondary hover:text-primary transition-colors flex items-center mx-auto text-sm\"\n }, [\n React.createElement('i', {\n className: 'fas fa-arrow-left mr-2'\n }),\n 'Back to selection'\n ]),\n React.createElement('h2', {\n key: 'title',\n className: \"text-xl font-semibold text-primary mb-2\"\n }, 'Joining the secure channel')\n ]),\n \n // Step 1\n React.createElement('div', {\n key: 'step1',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"w-8 h-8 bg-green-500 text-white rounded-lg flex items-center justify-center font-semibold text-sm mr-3\"\n }, '1'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Paste secure invitation\")\n ]),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm mb-4\"\n }, \"Copy and paste the encrypted invitation code from the initiator.\"),\n React.createElement('textarea', {\n key: 'input',\n value: offerInput,\n onChange: (e) => {\n setOfferInput(e.target.value);\n // Mark answer as created when user manually enters data\n if (e.target.value.trim().length > 0) {\n markAnswerCreated();\n }\n },\n rows: 8,\n placeholder: \"Paste the encrypted invitation code or scan QR code...\",\n className: \"w-full p-3 bg-custom-bg border border-gray-500/20 rounded-lg resize-none mb-4 text-secondary placeholder-gray-500 focus:border-green-500/40 focus:outline-none transition-all custom-scrollbar text-sm\"\n }),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex gap-2 mb-4\"\n }, [\n React.createElement('button', {\n key: 'scan-btn',\n onClick: () => setShowQRScannerModal(true),\n className: \"px-4 py-2 bg-purple-500/10 hover:bg-purple-500/20 text-purple-400 border border-purple-500/20 rounded text-sm font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: 'fas fa-qrcode mr-2'\n }),\n 'Scan QR Code'\n ]),\n React.createElement('button', {\n key: 'process-btn',\n onClick: onCreateAnswer,\n disabled: !offerInput.trim() || connectionStatus === 'connecting',\n className: \"flex-1 btn-secondary text-white py-2 px-4 rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n }, [\n React.createElement('i', {\n className: 'fas fa-cogs mr-2'\n }),\n 'Process invitation'\n ])\n ]),\n showQRScanner && React.createElement('div', {\n key: 'qr-scanner',\n className: \"p-4 bg-gray-800/50 border border-gray-600/30 rounded-lg text-center\"\n }, [\n React.createElement('h4', {\n key: 'scanner-title',\n className: \"text-sm font-medium text-primary mb-3\"\n }, 'QR Code Scanner'),\n React.createElement('p', {\n key: 'scanner-description',\n className: \"text-xs text-gray-400 mb-3\"\n }, 'Use your device camera to scan the QR code from the invitation'),\n React.createElement('button', {\n key: 'open-scanner',\n onClick: () => {\n console.log('Open Camera Scanner clicked, showQRScannerModal will be set to true');\n console.log('QRScanner available:', !!window.QRScanner);\n console.log('setShowQRScannerModal function:', typeof setShowQRScannerModal);\n if (typeof setShowQRScannerModal === 'function') {\n setShowQRScannerModal(true);\n } else {\n console.error('setShowQRScannerModal is not a function:', setShowQRScannerModal);\n }\n },\n className: \"w-full px-4 py-3 bg-purple-600 hover:bg-purple-500 text-white rounded-lg font-medium transition-all duration-200 mb-3\"\n }, [\n React.createElement('i', {\n key: 'camera-icon',\n className: 'fas fa-camera mr-2'\n }),\n 'Open Camera Scanner'\n ]),\n React.createElement('button', {\n key: 'test-qr',\n onClick: async () => {\n console.log('Creating test QR code...');\n if (window.generateQRCode) {\n const testData = '{\"type\":\"test\",\"message\":\"Hello QR Scanner!\"}';\n const qrUrl = await window.generateQRCode(testData);\n console.log('Test QR code generated:', qrUrl);\n // Open QR code in new tab for testing\n const newWindow = window.open();\n newWindow.document.write(``);\n }\n },\n className: \"px-3 py-1 bg-green-600/20 hover:bg-green-600/30 text-green-300 border border-green-500/20 rounded text-xs font-medium transition-all duration-200 mr-2\"\n }, 'Test QR'),\n React.createElement('button', {\n key: 'close-scanner',\n onClick: () => setShowQRScanner(false),\n className: \"px-3 py-1 bg-gray-600/20 hover:bg-gray-600/30 text-gray-300 border border-gray-500/20 rounded text-xs font-medium transition-all duration-200\"\n }, 'Close Scanner')\n ])\n ]),\n \n // Step 2\n showAnswerStep && React.createElement('div', {\n key: 'step2',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"step-number mr-3\"\n }, '2'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Sending a secure response\")\n ]),\n React.createElement('div', {\n key: 'success',\n className: \"p-3 bg-green-500/10 border border-green-500/20 rounded-lg mb-4\"\n }, [\n React.createElement('p', {\n className: \"text-green-400 text-sm font-medium flex items-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-check-circle mr-2'\n }),\n 'Secure response created! Send this code to the initiator:'\n ])\n ]),\n React.createElement('div', {\n key: 'answer-data',\n className: \"space-y-3 mb-4\"\n }, [\n React.createElement('textarea', {\n key: 'textarea',\n value: typeof answerData === 'object' ? JSON.stringify(answerData, null, 2) : answerData,\n readOnly: true,\n rows: 6,\n className: \"w-full p-3 bg-custom-bg border border-green-500/20 rounded-lg font-mono text-xs text-secondary resize-none custom-scrollbar\"\n }),\n React.createElement(EnhancedCopyButton, {\n key: 'copy',\n text: typeof answerData === 'object' ? JSON.stringify(answerData, null, 2) : answerData,\n className: \"w-full px-3 py-2 bg-green-500/10 hover:bg-green-500/20 text-green-400 border border-green-500/20 rounded text-sm font-medium\"\n }, 'Copy response code')\n ]),\n // QR Code section for answer\n qrCodeUrl && React.createElement('div', {\n key: 'qr-container',\n className: \"mt-4 p-4 bg-gray-800/50 border border-gray-600/30 rounded-lg text-center\"\n }, [\n React.createElement('h4', {\n key: 'qr-title',\n className: \"text-sm font-medium text-primary mb-3\"\n }, 'Scan QR code to complete connection'),\n React.createElement('div', {\n key: 'qr-wrapper',\n className: \"flex justify-center\"\n }, [\n React.createElement('img', {\n key: 'qr-image',\n src: qrCodeUrl,\n alt: \"QR Code for secure response\",\n className: \"max-w-none h-auto border border-gray-600/30 rounded w-[20rem] sm:w-[24rem] md:w-[28rem] lg:w-[32rem]\"\n })\n ]),\n \n // \u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u0438\u0436\u0435 QR \u043A\u043E\u0434\u0430\n ((qrFramesTotal || 0) >= 1) && React.createElement('div', {\n key: 'qr-controls-below',\n className: \"mt-4 flex flex-col items-center gap-2\"\n }, [\n React.createElement('div', {\n key: 'frame-indicator',\n className: \"text-xs text-gray-300\"\n }, `Frame ${Math.max(1, (qrFrameIndex || 1))}/${qrFramesTotal || 1}`),\n React.createElement('div', {\n key: 'control-buttons',\n className: \"flex gap-1\"\n }, [\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'prev-frame',\n onClick: prevQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25C0'),\n React.createElement('button', {\n key: 'toggle-manual',\n onClick: toggleQrManualMode,\n className: `px-2 py-1 rounded text-xs font-medium ${\n qrManualMode \n ? 'bg-blue-500 text-white' \n : 'bg-gray-600 text-gray-300 hover:bg-gray-500'\n }`\n }, qrManualMode ? 'Manual' : 'Auto'),\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'next-frame',\n onClick: nextQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25B6')\n ])\n ]),\n React.createElement('p', {\n key: 'qr-description',\n className: \"text-xs text-gray-400 mt-2\"\n }, 'The initiator can scan this QR code to complete the secure connection')\n ]),\n React.createElement('div', {\n key: 'info',\n className: \"p-3 bg-purple-500/10 border border-purple-500/20 rounded-lg\"\n }, [\n React.createElement('p', {\n className: \"text-purple-400 text-sm flex items-center justify-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt mr-2'\n }),\n 'The connection will be established with verification'\n ])\n ])\n ])\n ])\n ]);\n }\n };\n \n // Global scroll function - defined outside components to ensure availability\n const createScrollToBottomFunction = (chatMessagesRef) => {\n return () => {\n console.log('\uD83D\uDD0D Global scrollToBottom called, chatMessagesRef:', chatMessagesRef.current);\n if (chatMessagesRef && chatMessagesRef.current) {\n const scrollAttempt = () => {\n if (chatMessagesRef.current) {\n chatMessagesRef.current.scrollTo({\n top: chatMessagesRef.current.scrollHeight,\n behavior: 'smooth'\n });\n }\n };\n scrollAttempt();\n \n setTimeout(scrollAttempt, 50);\n setTimeout(scrollAttempt, 150);\n setTimeout(scrollAttempt, 300);\n \n requestAnimationFrame(() => {\n setTimeout(scrollAttempt, 100);\n });\n }\n };\n };\n \n const EnhancedChatInterface = ({\n messages,\n messageInput,\n setMessageInput,\n onSendMessage,\n onDisconnect,\n keyFingerprint,\n isVerified,\n chatMessagesRef,\n scrollToBottom,\n webrtcManager\n }) => {\n const [showScrollButton, setShowScrollButton] = React.useState(false);\n const [showFileTransfer, setShowFileTransfer] = React.useState(false);\n \n // \u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u043F\u0440\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n React.useEffect(() => {\n if (chatMessagesRef.current && messages.length > 0) {\n const { scrollTop, scrollHeight, clientHeight } = chatMessagesRef.current;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n if (isNearBottom) {\n const smoothScroll = () => {\n if (chatMessagesRef.current) {\n chatMessagesRef.current.scrollTo({\n top: chatMessagesRef.current.scrollHeight,\n behavior: 'smooth'\n });\n }\n };\n smoothScroll();\n setTimeout(smoothScroll, 50);\n setTimeout(smoothScroll, 150);\n }\n }\n }, [messages, chatMessagesRef]);\n \n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0441\u043A\u0440\u043E\u043B\u043B\u0430\n const handleScroll = () => {\n if (chatMessagesRef.current) {\n const { scrollTop, scrollHeight, clientHeight } = chatMessagesRef.current;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n setShowScrollButton(!isNearBottom);\n }\n };\n \n // \u041F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u0432\u043D\u0438\u0437 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435\n const handleScrollToBottom = () => {\n console.log('\uD83D\uDD0D handleScrollToBottom called, scrollToBottom type:', typeof scrollToBottom);\n if (typeof scrollToBottom === 'function') {\n scrollToBottom();\n setShowScrollButton(false);\n } else {\n console.error('\u274C scrollToBottom is not a function:', scrollToBottom);\n // Fallback: direct scroll\n if (chatMessagesRef.current) {\n chatMessagesRef.current.scrollTo({\n top: chatMessagesRef.current.scrollHeight,\n behavior: 'smooth'\n });\n }\n setShowScrollButton(false);\n }\n };\n \n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u043D\u0430\u0436\u0430\u0442\u0438\u044F Enter\n const handleKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n onSendMessage();\n }\n };\n \n // \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0445 \u0442\u0440\u0430\u043D\u0441\u0444\u0435\u0440\u043E\u0432\n const isFileTransferReady = () => {\n if (!webrtcManager) return false;\n \n const connected = webrtcManager.isConnected ? webrtcManager.isConnected() : false;\n const verified = webrtcManager.isVerified || false;\n const hasDataChannel = webrtcManager.dataChannel && webrtcManager.dataChannel.readyState === 'open';\n \n return connected && verified && hasDataChannel;\n };\n \n // \u0412\u043E\u0437\u0432\u0440\u0430\u0442 JSX \u0447\u0435\u0440\u0435\u0437 React.createElement\n return React.createElement(\n 'div',\n {\n className: \"chat-container flex flex-col\",\n style: { backgroundColor: '#272827', height: 'calc(100vh - 64px)' }\n },\n [\n // \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n React.createElement(\n 'div',\n { className: \"flex-1 flex flex-col overflow-hidden\" },\n React.createElement(\n 'div',\n { className: \"flex-1 max-w-4xl mx-auto w-full p-4 overflow-hidden\" },\n React.createElement(\n 'div',\n {\n ref: chatMessagesRef,\n onScroll: handleScroll,\n className: \"h-full overflow-y-auto space-y-3 hide-scrollbar pr-2 scroll-smooth\"\n },\n messages.length === 0 ?\n React.createElement(\n 'div',\n { className: \"flex items-center justify-center h-full\" },\n React.createElement(\n 'div',\n { className: \"text-center max-w-md\" },\n [\n React.createElement(\n 'div',\n { className: \"w-16 h-16 bg-green-500/10 border border-green-500/20 rounded-xl flex items-center justify-center mx-auto mb-4\" },\n React.createElement(\n 'svg',\n { className: \"w-8 h-8 text-green-500\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\" },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z\"\n })\n )\n ),\n React.createElement('h3', { className: \"text-lg font-medium text-gray-300 mb-2\" }, \"Secure channel is ready!\"),\n React.createElement('p', { className: \"text-gray-400 text-sm mb-4\" }, \"All messages are protected by modern cryptographic algorithms\"),\n React.createElement(\n 'div',\n { className: \"text-left space-y-2\" },\n [\n ['End-to-end encryption', 'M5 13l4 4L19 7'],\n ['Protection against replay attacks', 'M5 13l4 4L19 7'],\n ['Integrity verification', 'M5 13l4 4L19 7'],\n ['Perfect Forward Secrecy', 'M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15']\n ].map(([text, d], i) =>\n React.createElement(\n 'div',\n { key: `f${i}`, className: \"flex items-center text-sm text-gray-400\" },\n [\n React.createElement(\n 'svg',\n {\n className: `w-4 h-4 mr-3 ${i === 3 ? 'text-purple-500' : 'text-green-500'}`,\n fill: \"none\",\n stroke: \"currentColor\",\n viewBox: \"0 0 24 24\"\n },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: d\n })\n ),\n text\n ]\n )\n )\n )\n ]\n )\n ) :\n messages.map((msg) =>\n React.createElement(EnhancedChatMessage, {\n key: msg.id,\n message: msg.message,\n type: msg.type,\n timestamp: msg.timestamp\n })\n )\n )\n )\n ),\n \n // \u041A\u043D\u043E\u043F\u043A\u0430 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0432\u043D\u0438\u0437\n showScrollButton &&\n React.createElement(\n 'button',\n {\n onClick: handleScrollToBottom,\n className: \"fixed right-6 w-12 h-12 bg-green-500/20 hover:bg-green-500/30 border border-green-500/30 text-green-400 rounded-full flex items-center justify-center transition-all duration-200 shadow-lg z-50\",\n style: { bottom: '160px' }\n },\n React.createElement(\n 'svg',\n { className: \"w-6 h-6\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\" },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M19 14l-7 7m0 0l-7-7m7 7V3\"\n })\n )\n ),\n \n // \u0421\u0435\u043A\u0446\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\n React.createElement(\n 'div',\n {\n className: \"flex-shrink-0 border-t border-gray-500/10\",\n style: { backgroundColor: '#272827' }\n },\n React.createElement(\n 'div',\n { className: \"max-w-4xl mx-auto px-4\" },\n [\n React.createElement(\n 'button',\n {\n onClick: () => setShowFileTransfer(!showFileTransfer),\n className: `flex items-center text-sm text-gray-400 hover:text-gray-300 transition-colors py-4 ${showFileTransfer ? 'mb-4' : ''}`\n },\n [\n React.createElement(\n 'svg',\n {\n className: `w-4 h-4 mr-2 transform transition-transform ${showFileTransfer ? 'rotate-180' : ''}`,\n fill: \"none\",\n stroke: \"currentColor\",\n viewBox: \"0 0 24 24\"\n },\n showFileTransfer ?\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M5 15l7-7 7 7\"\n }) :\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13\"\n })\n ),\n showFileTransfer ? 'Hide file transfer' : 'Send files'\n ]\n ),\n // \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\n showFileTransfer &&\n React.createElement(window.FileTransferComponent || (() => \n React.createElement('div', {\n className: \"p-4 text-center text-red-400\"\n }, 'FileTransferComponent not loaded')\n ), {\n webrtcManager: webrtcManager,\n isConnected: isFileTransferReady()\n })\n ]\n )\n ),\n \n // \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0432\u0432\u043E\u0434\u0430 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n React.createElement(\n 'div',\n { className: \"border-t border-gray-500/10\" },\n React.createElement(\n 'div',\n { className: \"max-w-4xl mx-auto p-4\" },\n React.createElement(\n 'div',\n { className: \"flex items-stretch space-x-3\" },\n [\n React.createElement(\n 'div',\n { className: \"flex-1 relative\" },\n [\n React.createElement('textarea', {\n value: messageInput,\n onChange: (e) => setMessageInput(e.target.value),\n onKeyDown: handleKeyPress,\n placeholder: \"Enter message to encrypt...\",\n rows: 2,\n maxLength: 2000,\n style: { backgroundColor: '#272827' },\n className: \"w-full p-3 border border-gray-600 rounded-lg resize-none text-gray-300 placeholder-gray-500 focus:border-green-500/40 focus:outline-none transition-all custom-scrollbar text-sm\"\n }),\n React.createElement(\n 'div',\n { className: \"absolute bottom-2 right-3 flex items-center space-x-2 text-xs text-gray-400\" },\n [\n React.createElement('span', null, `${messageInput.length}/2000`),\n React.createElement('span', null, \"\u2022 Enter to send\")\n ]\n )\n ]\n ),\n React.createElement(\n 'button',\n {\n onClick: onSendMessage,\n disabled: !messageInput.trim(),\n className: \"bg-green-400/20 text-green-400 p-3 rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center min-h-[72px]\"\n },\n React.createElement(\n 'svg',\n { className: \"w-6 h-6\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\" },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M12 19l9 2-9-18-9 18 9-2zm0 0v-8\"\n })\n )\n )\n ]\n )\n )\n )\n ]\n );\n };\n \n \n // Main Enhanced Application Component\n const EnhancedSecureP2PChat = () => {\n console.log('\uD83D\uDD0D EnhancedSecureP2PChat component initialized');\n console.log('\uD83C\uDFAE QR Manual Control Features Loaded!');\n const [messages, setMessages] = React.useState([]);\n const [connectionStatus, setConnectionStatus] = React.useState('disconnected');\n \n // Moved scrollToBottom logic to be available globally\n const [messageInput, setMessageInput] = React.useState('');\n const [offerData, setOfferData] = React.useState('');\n const [answerData, setAnswerData] = React.useState('');\n const [offerInput, setOfferInput] = React.useState('');\n const [answerInput, setAnswerInput] = React.useState('');\n const [keyFingerprint, setKeyFingerprint] = React.useState('');\n const [verificationCode, setVerificationCode] = React.useState('');\n const [showOfferStep, setShowOfferStep] = React.useState(false);\n const [showAnswerStep, setShowAnswerStep] = React.useState(false);\n const [showVerification, setShowVerification] = React.useState(false);\n const [showQRCode, setShowQRCode] = React.useState(false);\n const [qrCodeUrl, setQrCodeUrl] = React.useState('');\n const [showQRScanner, setShowQRScanner] = React.useState(false);\n const [showQRScannerModal, setShowQRScannerModal] = React.useState(false);\n const [isVerified, setIsVerified] = React.useState(false);\n const [securityLevel, setSecurityLevel] = React.useState(null);\n \n // Mutual verification states\n const [localVerificationConfirmed, setLocalVerificationConfirmed] = React.useState(false);\n const [remoteVerificationConfirmed, setRemoteVerificationConfirmed] = React.useState(false);\n const [bothVerificationsConfirmed, setBothVerificationsConfirmed] = React.useState(false);\n \n // PAKE password states removed - using SAS verification instead\n \n // Session state - all security features enabled by default\n const [sessionTimeLeft, setSessionTimeLeft] = React.useState(0);\n const [pendingSession, setPendingSession] = React.useState(null);\n \n // All security features are enabled by default - no payment required\n \n \n \n // ============================================\n // CENTRALIZED CONNECTION STATE MANAGEMENT\n // ============================================\n \n const [connectionState, setConnectionState] = React.useState({\n status: 'disconnected',\n hasActiveAnswer: false,\n answerCreatedAt: null,\n isUserInitiatedDisconnect: false\n });\n \n // Centralized connection state handler\n const updateConnectionState = (newState, options = {}) => {\n const { preserveAnswer = false, isUserAction = false } = options;\n \n setConnectionState(prev => ({\n ...prev,\n ...newState,\n isUserInitiatedDisconnect: isUserAction,\n hasActiveAnswer: preserveAnswer ? prev.hasActiveAnswer : false,\n answerCreatedAt: preserveAnswer ? prev.answerCreatedAt : null\n }));\n };\n \n // Check if we should preserve answer data\n const shouldPreserveAnswerData = () => {\n const now = Date.now();\n const answerAge = now - (connectionState.answerCreatedAt || 0);\n const maxPreserveTime = 300000; // 5 minutes (\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u043C \u0432\u0440\u0435\u043C\u044F \u0434\u043B\u044F QR \u043A\u043E\u0434\u0430)\n \n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u0435 \u0441\u0430\u043C\u0438\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\n const hasAnswerData = (answerData && answerData.trim().length > 0) || \n (answerInput && answerInput.trim().length > 0);\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C \u043D\u0430\u043B\u0438\u0447\u0438\u0435 QR \u043A\u043E\u0434\u0430 \u043E\u0442\u0432\u0435\u0442\u0430\n const hasAnswerQR = qrCodeUrl && qrCodeUrl.trim().length > 0;\n \n const shouldPreserve = (connectionState.hasActiveAnswer && \n answerAge < maxPreserveTime && \n !connectionState.isUserInitiatedDisconnect) ||\n (hasAnswerData && answerAge < maxPreserveTime && \n !connectionState.isUserInitiatedDisconnect) ||\n (hasAnswerQR && answerAge < maxPreserveTime && \n !connectionState.isUserInitiatedDisconnect);\n \n console.log('\uD83D\uDD0D shouldPreserveAnswerData check:', {\n hasActiveAnswer: connectionState.hasActiveAnswer,\n hasAnswerData: hasAnswerData,\n hasAnswerQR: hasAnswerQR,\n answerAge: answerAge,\n maxPreserveTime: maxPreserveTime,\n isUserInitiatedDisconnect: connectionState.isUserInitiatedDisconnect,\n shouldPreserve: shouldPreserve,\n answerData: answerData ? 'exists' : 'null',\n answerInput: answerInput ? 'exists' : 'null',\n qrCodeUrl: qrCodeUrl ? 'exists' : 'null'\n });\n \n return shouldPreserve;\n };\n \n // Mark answer as created\n const markAnswerCreated = () => {\n updateConnectionState({\n hasActiveAnswer: true,\n answerCreatedAt: Date.now()\n });\n };\n \n // Global functions for cleanup\n React.useEffect(() => {\n window.forceCleanup = () => {\n handleClearData();\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n };\n\n window.clearLogs = () => {\n if (typeof console.clear === 'function') {\n console.clear();\n }\n };\n \n return () => {\n delete window.forceCleanup;\n delete window.clearLogs;\n };\n }, []);\n \n const webrtcManagerRef = React.useRef(null);\n // Expose for modules/UI that run outside this closure (e.g., inline handlers)\n // Safe because it's a ref object and we maintain it centrally here\n window.webrtcManagerRef = webrtcManagerRef;\n \n const addMessageWithAutoScroll = React.useCallback((message, type) => {\n const newMessage = {\n message,\n type,\n id: Date.now() + Math.random(),\n timestamp: Date.now()\n };\n \n setMessages(prev => {\n const updated = [...prev, newMessage];\n \n setTimeout(() => {\n if (chatMessagesRef?.current) {\n const container = chatMessagesRef.current;\n try {\n const { scrollTop, scrollHeight, clientHeight } = container;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n \n if (isNearBottom || prev.length === 0) {\n requestAnimationFrame(() => {\n if (container && container.scrollTo) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'smooth'\n });\n }\n });\n }\n } catch (error) {\n console.warn('Scroll error:', error);\n container.scrollTop = container.scrollHeight;\n }\n }\n }, 50);\n \n return updated;\n });\n }, []);\n \n // Update security level based on real verification\n const updateSecurityLevel = React.useCallback(async () => {\n if (window.isUpdatingSecurity) {\n return;\n }\n \n window.isUpdatingSecurity = true;\n \n try {\n if (webrtcManagerRef.current) {\n // All security features are enabled by default - always show MAXIMUM level\n setSecurityLevel({\n level: 'MAXIMUM',\n score: 100,\n color: 'green',\n details: 'All security features enabled by default',\n passedChecks: 10,\n totalChecks: 10,\n isRealData: true\n });\n \n if (window.DEBUG_MODE) {\n const currentLevel = webrtcManagerRef.current.ecdhKeyPair && webrtcManagerRef.current.ecdsaKeyPair \n ? await webrtcManagerRef.current.calculateSecurityLevel()\n : {\n level: 'MAXIMUM',\n score: 100,\n sessionType: 'premium',\n passedChecks: 10,\n totalChecks: 10\n };\n console.log('\uD83D\uDD12 Security level updated:', {\n level: currentLevel.level,\n score: currentLevel.score,\n sessionType: currentLevel.sessionType,\n passedChecks: currentLevel.passedChecks,\n totalChecks: currentLevel.totalChecks\n });\n }\n }\n } catch (error) {\n console.error('Failed to update security level:', error);\n setSecurityLevel({\n level: 'ERROR',\n score: 0,\n color: 'red',\n details: 'Verification failed'\n });\n } finally {\n setTimeout(() => {\n window.isUpdatingSecurity = false;\n }, 2000);\n }\n }, []);\n \n // Session time ticker - unlimited sessions\n React.useEffect(() => {\n const timer = setInterval(() => {\n // Sessions are unlimited - no time restrictions\n setSessionTimeLeft(0);\n }, 1000);\n return () => clearInterval(timer);\n }, []);\n \n // Sessions are unlimited - no expiration handler needed\n \n // All security features are enabled by default - no demo sessions needed\n const chatMessagesRef = React.useRef(null);\n \n // Create scroll function using global helper\n const scrollToBottom = createScrollToBottomFunction(chatMessagesRef);\n \n // Auto-scroll when messages change\n React.useEffect(() => {\n if (messages.length > 0 && chatMessagesRef.current) {\n scrollToBottom();\n setTimeout(scrollToBottom, 50);\n setTimeout(scrollToBottom, 150);\n }\n }, [messages]);\n \n // PAKE password functions removed - using SAS verification instead\n \n React.useEffect(() => {\n // Prevent multiple initializations\n if (webrtcManagerRef.current) {\n console.log('\u26A0\uFE0F WebRTC Manager already initialized, skipping...');\n return;\n }\n \n const handleMessage = (message, type) => {\n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430 \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0435 \u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F\n if (typeof message === 'string' && message.trim().startsWith('{')) {\n try {\n const parsedMessage = JSON.parse(message);\n const blockedTypes = [\n 'file_transfer_start',\n 'file_transfer_response',\n 'file_chunk',\n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error',\n 'heartbeat',\n 'verification',\n 'verification_response',\n 'verification_confirmed',\n 'verification_both_confirmed',\n 'peer_disconnect',\n 'key_rotation_signal',\n 'key_rotation_ready',\n 'security_upgrade'\n ];\n if (parsedMessage.type && blockedTypes.includes(parsedMessage.type)) {\n console.log(`\uD83D\uDED1 Blocked system/file message from chat: ${parsedMessage.type}`);\n return; // \u041D\u0435 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0435 \u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u0447\u0430\u0442\u0435\n }\n } catch (parseError) {\n // \u041D\u0435 JSON - \u044D\u0442\u043E \u043D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u043E \u0434\u043B\u044F \u043E\u0431\u044B\u0447\u043D\u044B\u0445 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u044B\u0445 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n }\n }\n \n addMessageWithAutoScroll(message, type);\n };\n \n const handleStatusChange = (status) => {\n console.log('handleStatusChange called with status:', status);\n console.log('\uD83D\uDD0D Status change details:');\n console.log(' - oldStatus:', connectionStatus);\n console.log(' - newStatus:', status);\n console.log(' - isVerified:', isVerified);\n console.log(' - willShowChat:', status === 'connected' && isVerified);\n setConnectionStatus(status);\n \n if (status === 'connected') {\n document.dispatchEvent(new CustomEvent('new-connection'));\n \n // \u041D\u0435 \u0441\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044E \u043F\u0440\u0438 'connected' - \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0438 'verified'\n // setIsVerified(true);\n // setShowVerification(false);\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'verifying') {\n console.log('Setting showVerification to true for verifying status');\n setShowVerification(true);\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'verified') {\n setIsVerified(true);\n setShowVerification(false);\n setBothVerificationsConfirmed(true);\n // CRITICAL: Set connectionStatus to 'connected' to show chat\n setConnectionStatus('connected');\n // Force immediate update of isVerified state\n setTimeout(() => {\n setIsVerified(true);\n }, 0);\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'connecting') {\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'disconnected') {\n // \u041E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0446\u0435\u043D\u0442\u0440\u0430\u043B\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435\n updateConnectionState({ status: 'disconnected' });\n setConnectionStatus('disconnected');\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u043D\u0443\u0436\u043D\u043E \u043B\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0432\u0435\u0442\u0430\n if (shouldPreserveAnswerData()) {\n console.log('\uD83D\uDEE1\uFE0F Preserving answer data after recent creation');\n setIsVerified(false);\n setShowVerification(false);\n return;\n }\n \n // \u041F\u0440\u0438 \u0440\u0430\u0437\u0440\u044B\u0432\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0434\u0430\u043D\u043D\u044B\u0435\n setIsVerified(false);\n setShowVerification(false);\n \n // Dispatch disconnected event for SessionTimer\n document.dispatchEvent(new CustomEvent('disconnected'));\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // Clear connection data\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n \n // Reset session and timer\n setSessionTimeLeft(0);\n \n // Return to main page after a short delay\n setTimeout(() => {\n setConnectionStatus('disconnected');\n setShowVerification(false);\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u043D\u0443\u0436\u043D\u043E \u043B\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0432\u0435\u0442\u0430\n if (shouldPreserveAnswerData()) {\n console.log('\uD83D\uDEE1\uFE0F Preserving answer data in setTimeout after recent creation');\n return;\n }\n \n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setMessages([]);\n }, 1000);\n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u0440\u0430\u0437\u0440\u044B\u0432\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\n // \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0433 \u0432\u0438\u0434\u0435\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438\n } else if (status === 'peer_disconnected') {\n setSessionTimeLeft(0);\n \n document.dispatchEvent(new CustomEvent('peer-disconnect'));\n \n // A short delay before clearing to display the status\n setTimeout(() => {\n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n setIsVerified(false);\n setShowVerification(false);\n setConnectionStatus('disconnected');\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u043D\u0443\u0436\u043D\u043E \u043B\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0432\u0435\u0442\u0430\n if (shouldPreserveAnswerData()) {\n console.log('\uD83D\uDEE1\uFE0F Preserving answer data in peer_disconnected after recent creation');\n return;\n }\n \n // Clear connection data\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setMessages([]);\n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438 \u043F\u0438\u0440\u0430\n // \u0447\u0442\u043E\u0431\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\n // if (typeof console.clear === 'function') {\n // console.clear();\n // }\n \n // Session manager removed - all features enabled by default\n }, 2000);\n }\n };\n \n const handleKeyExchange = (fingerprint) => {\n console.log('handleKeyExchange called with fingerprint:', fingerprint);\n if (fingerprint === '') {\n setKeyFingerprint('');\n } else {\n setKeyFingerprint(fingerprint);\n console.log('Key fingerprint set in UI:', fingerprint);\n }\n };\n \n const handleVerificationRequired = (code) => {\n console.log('handleVerificationRequired called with code:', code);\n if (code === '') {\n setVerificationCode('');\n setShowVerification(false);\n } else {\n setVerificationCode(code);\n setShowVerification(true);\n console.log('Verification code set, showing verification UI');\n }\n };\n \n const handleVerificationStateChange = (state) => {\n console.log('handleVerificationStateChange called with state:', state);\n setLocalVerificationConfirmed(state.localConfirmed);\n setRemoteVerificationConfirmed(state.remoteConfirmed);\n setBothVerificationsConfirmed(state.bothConfirmed);\n };\n \n // Callback for handling response errors\n const handleAnswerError = (errorType, errorMessage) => {\n if (errorType === 'replay_attack') {\n // Reset the session upon replay attack\n setSessionTimeLeft(0);\n setPendingSession(null);\n \n addMessageWithAutoScroll('\uD83D\uDCA1 Data is outdated. Please create a new invitation or use a current response code.', 'system');\n \n if (typeof console.clear === 'function') {\n console.clear();\n }\n } else if (errorType === 'security_violation') {\n // Reset the session upon security breach\n setSessionTimeLeft(0);\n setPendingSession(null);\n \n addMessageWithAutoScroll(`\uD83D\uDD12 Security breach: ${errorMessage}`, 'system');\n \n if (typeof console.clear === 'function') {\n console.clear();\n }\n }\n };\n \n // Create WebRTC Manager only once\n console.log('\uD83D\uDD27 Initializing WebRTC Manager...');\n \n if (typeof console.clear === 'function') {\n console.clear();\n }\n \n webrtcManagerRef.current = new EnhancedSecureWebRTCManager(\n handleMessage, \n handleStatusChange, \n handleKeyExchange,\n handleVerificationRequired,\n handleAnswerError,\n handleVerificationStateChange\n );\n \n handleMessage('\uD83D\uDE80 SecureBit.chat Enhanced Security Edition v4.02.985 - ECDH + DTLS + SAS initialized. Ready to establish a secure connection with ECDH key exchange, DTLS fingerprint verification, and SAS authentication to prevent MITM attacks.', 'system');\n \n const handleBeforeUnload = (event) => {\n if (event.type === 'beforeunload' && !isTabSwitching) {\n console.log('\uD83D\uDD0C Page unloading (closing tab) - sending disconnect notification');\n \n if (webrtcManagerRef.current && webrtcManagerRef.current.isConnected()) {\n try {\n webrtcManagerRef.current.sendSystemMessage({\n type: 'peer_disconnect',\n reason: 'user_disconnect',\n timestamp: Date.now()\n });\n } catch (error) {\n console.log('Could not send disconnect notification:', error.message);\n }\n \n setTimeout(() => {\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n }, 100);\n } else if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n } else if (isTabSwitching) {\n console.log('\uD83D\uDCF1 Tab switching detected - NOT disconnecting');\n event.preventDefault();\n event.returnValue = '';\n }\n };\n \n window.addEventListener('beforeunload', handleBeforeUnload);\n \n let isTabSwitching = false;\n let tabSwitchTimeout = null;\n \n const handleVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n console.log('\uD83D\uDCF1 Page hidden (tab switch) - keeping connection alive');\n isTabSwitching = true;\n \n if (tabSwitchTimeout) {\n clearTimeout(tabSwitchTimeout);\n }\n \n tabSwitchTimeout = setTimeout(() => {\n isTabSwitching = false;\n }, 5000); \n \n } else if (document.visibilityState === 'visible') {\n console.log('\uD83D\uDCF1 Page visible (tab restored) - connection maintained');\n isTabSwitching = false;\n \n if (tabSwitchTimeout) {\n clearTimeout(tabSwitchTimeout);\n tabSwitchTimeout = null;\n }\n }\n };\n \n document.addEventListener('visibilitychange', handleVisibilityChange);\n \n // Setup file transfer callbacks\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.setFileTransferCallbacks(\n // Progress callback\n (progress) => {\n console.log('File progress:', progress);\n },\n \n // File received callback\n (fileData) => {\n const sizeMb = Math.max(1, Math.round((fileData.fileSize || 0) / (1024 * 1024)));\n const downloadMessage = React.createElement('div', {\n className: 'flex items-center space-x-2'\n }, [\n React.createElement('span', { key: 'label' }, `\uD83D\uDCE5 File received: ${fileData.fileName} (${sizeMb} MB)`),\n React.createElement('button', {\n key: 'btn',\n className: 'px-3 py-1 rounded bg-blue-600 hover:bg-blue-700 text-white text-xs',\n onClick: async () => {\n try {\n const url = await fileData.getObjectURL();\n const a = document.createElement('a');\n a.href = url;\n a.download = fileData.fileName;\n a.click();\n // \u0414\u0430\u0435\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u0432\u0440\u0435\u043C\u044F \u043D\u0430\u0447\u0430\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443, \u0437\u0430\u0442\u0435\u043C \u043E\u0441\u0432\u043E\u0431\u043E\u0436\u0434\u0430\u0435\u043C URL\n setTimeout(() => fileData.revokeObjectURL(url), 15000);\n } catch (e) {\n console.error('Download failed:', e);\n addMessageWithAutoScroll(`\u274C File upload error: ${String(e?.message || e)}`, 'system');\n }\n }\n }, 'Download')\n ]);\n \n addMessageWithAutoScroll(downloadMessage, 'system');\n },\n \n // Error callback\n (error) => {\n console.error('File transfer error:', error);\n \n if (error.includes('Connection not ready')) {\n addMessageWithAutoScroll(`\u26A0\uFE0F File transfer error: connection not ready. Try again later.`, 'system');\n } else if (error.includes('File too large')) {\n addMessageWithAutoScroll(`\u26A0\uFE0F File is too big. Maximum size: 100 MB`, 'system');\n } else {\n addMessageWithAutoScroll(`\u274C File transfer error: ${error}`, 'system');\n }\n }\n );\n }\n \n return () => {\n window.removeEventListener('beforeunload', handleBeforeUnload);\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n \n if (tabSwitchTimeout) {\n clearTimeout(tabSwitchTimeout);\n tabSwitchTimeout = null;\n }\n \n if (webrtcManagerRef.current) {\n console.log('\uD83E\uDDF9 Cleaning up WebRTC Manager...');\n webrtcManagerRef.current.disconnect();\n webrtcManagerRef.current = null;\n }\n };\n }, []); // Empty dependency array to run only once\n \n // All security features are enabled by default - no session purchase needed\n \n const compressOfferData = (offerData) => {\n try {\n // Parse the offer data if it's a string\n const offer = typeof offerData === 'string' ? JSON.parse(offerData) : offerData;\n \n // Create a minimal version with only the most essential data\n const minimalOffer = {\n type: offer.type,\n version: offer.version,\n timestamp: offer.timestamp,\n sessionId: offer.sessionId,\n connectionId: offer.connectionId,\n verificationCode: offer.verificationCode,\n salt: offer.salt,\n // Use only key fingerprints instead of full keys\n keyFingerprints: offer.keyFingerprints,\n // Add a reference to get full data\n fullDataAvailable: true,\n compressionLevel: 'minimal'\n };\n \n return JSON.stringify(minimalOffer);\n } catch (error) {\n console.error('Error compressing offer data:', error);\n return offerData; // Return original if compression fails\n }\n };\n\n const createQRReference = (offerData) => {\n try {\n // Create a unique reference ID for this offer\n const referenceId = `offer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n \n // Store the full offer data in localStorage with the reference ID\n localStorage.setItem(`qr_offer_${referenceId}`, JSON.stringify(offerData));\n \n // Create a minimal QR code with just the reference\n const qrReference = {\n type: 'secure_offer_reference',\n referenceId: referenceId,\n timestamp: Date.now(),\n message: 'Scan this QR code and use the reference ID to get full offer data'\n };\n \n return JSON.stringify(qrReference);\n } catch (error) {\n console.error('Error creating QR reference:', error);\n return null;\n }\n };\n\n const createTemplateOffer = (offer) => {\n // Minimal template to keep QR within single image capacity\n const templateOffer = {\n type: 'enhanced_secure_offer_template',\n version: '4.0',\n sessionId: offer.sessionId,\n connectionId: offer.connectionId,\n verificationCode: offer.verificationCode,\n timestamp: offer.timestamp,\n // Avoid bulky fields (SDP, raw keys); keep only fingerprints and essentials\n keyFingerprints: offer.keyFingerprints,\n // Keep concise auth hints (omit large nonces)\n authChallenge: offer?.authChallenge?.challenge,\n // Optionally include a compact capability hint if small\n capabilities: Array.isArray(offer.capabilities) && offer.capabilities.length <= 5\n ? offer.capabilities\n : undefined\n };\n \n return templateOffer;\n };\n\n // Conservative QR payload limit (characters). Adjust per error correction level.\n const MAX_QR_LEN = 800;\n const [qrFramesTotal, setQrFramesTotal] = React.useState(0);\n const [qrFrameIndex, setQrFrameIndex] = React.useState(0);\n const [qrManualMode, setQrManualMode] = React.useState(false);\n\n // Animated QR state (for multi-chunk COSE)\n const qrAnimationRef = React.useRef({ timer: null, chunks: [], idx: 0, active: false });\n const stopQrAnimation = () => {\n try { if (qrAnimationRef.current.timer) { clearInterval(qrAnimationRef.current.timer); } } catch {}\n qrAnimationRef.current = { timer: null, chunks: [], idx: 0, active: false };\n setQrFrameIndex(0);\n setQrFramesTotal(0);\n setQrManualMode(false);\n };\n\n // \u0424\u0443\u043D\u043A\u0446\u0438\u0438 \u0434\u043B\u044F \u0440\u0443\u0447\u043D\u043E\u0433\u043E \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F QR \u0430\u043D\u0438\u043C\u0430\u0446\u0438\u0435\u0439\n const toggleQrManualMode = () => {\n const newManualMode = !qrManualMode;\n setQrManualMode(newManualMode);\n \n if (newManualMode) {\n // \u041E\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u043C \u0430\u0432\u0442\u043E\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443\n if (qrAnimationRef.current.timer) {\n clearInterval(qrAnimationRef.current.timer);\n qrAnimationRef.current.timer = null;\n }\n console.log('QR Manual mode enabled - auto-scroll stopped');\n } else {\n // \u0412\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0430\u0432\u0442\u043E\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443\n if (qrAnimationRef.current.chunks.length > 1 && qrAnimationRef.current.active) {\n const intervalMs = 4000;\n qrAnimationRef.current.timer = setInterval(renderNext, intervalMs);\n }\n console.log('QR Manual mode disabled - auto-scroll resumed');\n }\n };\n\n const nextQrFrame = () => {\n console.log('\uD83C\uDFAE nextQrFrame called, qrFramesTotal:', qrFramesTotal, 'qrAnimationRef.current:', qrAnimationRef.current);\n if (qrAnimationRef.current.chunks.length > 1) {\n const nextIdx = (qrAnimationRef.current.idx + 1) % qrAnimationRef.current.chunks.length;\n qrAnimationRef.current.idx = nextIdx;\n setQrFrameIndex(nextIdx + 1);\n console.log('\uD83C\uDFAE Next frame index:', nextIdx + 1);\n renderNext();\n } else {\n console.log('\uD83C\uDFAE No multiple frames to navigate');\n }\n };\n\n const prevQrFrame = () => {\n console.log('\uD83C\uDFAE prevQrFrame called, qrFramesTotal:', qrFramesTotal, 'qrAnimationRef.current:', qrAnimationRef.current);\n if (qrAnimationRef.current.chunks.length > 1) {\n const prevIdx = (qrAnimationRef.current.idx - 1 + qrAnimationRef.current.chunks.length) % qrAnimationRef.current.chunks.length;\n qrAnimationRef.current.idx = prevIdx;\n setQrFrameIndex(prevIdx + 1);\n console.log('\uD83C\uDFAE Previous frame index:', prevIdx + 1);\n renderNext();\n } else {\n console.log('\uD83C\uDFAE No multiple frames to navigate');\n }\n };\n\n // Buffer for assembling scanned COSE chunks\n const qrChunksBufferRef = React.useRef({ id: null, total: 0, seen: new Set(), items: [] });\n\n const generateQRCode = async (data) => {\n try {\n const originalSize = typeof data === 'string' ? data.length : JSON.stringify(data).length;\n console.log(`\uD83D\uDCCA Original QR Code data size: ${originalSize} characters`);\n // Small payload: \u043F\u0440\u044F\u043C\u043E\u0439 JSON \u0432 \u043E\u0434\u0438\u043D QR (\u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044F, \u0431\u0435\u0437 \u043E\u0431\u0451\u0440\u0442\u043E\u043A)\n const payload = typeof data === 'string' ? data : JSON.stringify(data);\n const isDesktop = (typeof window !== 'undefined') && ((window.innerWidth || 0) >= 1024);\n const QR_SIZE = isDesktop ? 720 : 512;\n if (payload.length <= MAX_QR_LEN) {\n if (!window.generateQRCode) throw new Error('QR code generator unavailable');\n stopQrAnimation();\n const qrDataUrl = await window.generateQRCode(payload, { errorCorrectionLevel: 'M', size: QR_SIZE, margin: 2 });\n setQrCodeUrl(qrDataUrl);\n setQrFramesTotal(1);\n setQrFrameIndex(1);\n return;\n }\n\n // \u0411\u043E\u043B\u044C\u0448\u043E\u0439 payload: RAW \u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 QR \u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044F\n console.log('\uD83C\uDF9E\uFE0F Using RAW animated QR frames (no compression)');\n stopQrAnimation();\n const id = `raw_${Date.now()}_${Math.random().toString(36).slice(2)}`;\n \n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043C \u043D\u0430 10 \u0447\u0430\u0441\u0442\u0435\u0439 \u0434\u043B\u044F \u043B\u0443\u0447\u0448\u0435\u0433\u043E \u0441\u043A\u0430\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\n const TARGET_CHUNKS = 10;\n const FRAME_MAX = Math.max(200, Math.floor(payload.length / TARGET_CHUNKS));\n const total = Math.ceil(payload.length / FRAME_MAX);\n \n console.log(`\uD83D\uDCCA Splitting ${payload.length} chars into ${total} chunks (max ${FRAME_MAX} chars per chunk)`);\n const rawChunks = [];\n for (let i = 0; i < total; i++) {\n const seq = i + 1;\n const part = payload.slice(i * FRAME_MAX, (i + 1) * FRAME_MAX);\n rawChunks.push(JSON.stringify({ hdr: { v: 1, id, seq, total, rt: 'raw' }, body: part }));\n }\n if (!window.generateQRCode) throw new Error('QR code generator unavailable');\n if (rawChunks.length === 1) {\n const url = await window.generateQRCode(rawChunks[0], { errorCorrectionLevel: 'M', margin: 2, size: QR_SIZE });\n setQrCodeUrl(url);\n setQrFramesTotal(1);\n setQrFrameIndex(1);\n return;\n }\n qrAnimationRef.current.chunks = rawChunks;\n qrAnimationRef.current.idx = 0;\n qrAnimationRef.current.active = true;\n setQrFramesTotal(rawChunks.length);\n setQrFrameIndex(1);\n const EC_OPTS = { errorCorrectionLevel: 'M', margin: 2, size: QR_SIZE };\n const renderNext = async () => {\n const { chunks, idx, active } = qrAnimationRef.current;\n if (!active || !chunks.length) return;\n const current = chunks[idx % chunks.length];\n try {\n const url = await window.generateQRCode(current, EC_OPTS);\n setQrCodeUrl(url);\n } catch (e) {\n console.warn('Animated QR render error (raw):', e);\n }\n const nextIdx = (idx + 1) % chunks.length;\n qrAnimationRef.current.idx = nextIdx;\n setQrFrameIndex(nextIdx + 1);\n };\n await renderNext();\n \n // \u0417\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u043C \u0430\u0432\u0442\u043E\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443 \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u043D\u0435 \u0432 \u0440\u0443\u0447\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435\n if (!qrManualMode) {\n const ua = (typeof navigator !== 'undefined' && navigator.userAgent) ? navigator.userAgent : '';\n const isIOS = /iPhone|iPad|iPod/i.test(ua);\n const intervalMs = 4000; // 4 seconds per frame for better readability\n qrAnimationRef.current.timer = setInterval(renderNext, intervalMs);\n }\n return;\n } catch (error) {\n console.error('QR code generation failed:', error);\n setMessages(prev => [...prev, {\n message: `\u274C QR code generation failed: ${error.message}`,\n type: 'error'\n }]);\n }\n };\n\n const reconstructFromTemplate = (templateData) => {\n // Reconstruct full offer from template\n const fullOffer = {\n type: \"enhanced_secure_offer\",\n version: templateData.version,\n timestamp: templateData.timestamp,\n sessionId: templateData.sessionId,\n connectionId: templateData.connectionId,\n verificationCode: templateData.verificationCode,\n salt: templateData.salt,\n sdp: templateData.sdp,\n keyFingerprints: templateData.keyFingerprints,\n capabilities: templateData.capabilities,\n \n // Reconstruct ECDH key object\n ecdhPublicKey: {\n keyType: \"ECDH\",\n keyData: templateData.ecdhKeyData,\n timestamp: templateData.timestamp - 1000, // Approximate\n version: templateData.version,\n signature: templateData.ecdhSignature\n },\n \n // Reconstruct ECDSA key object\n ecdsaPublicKey: {\n keyType: \"ECDSA\",\n keyData: templateData.ecdsaKeyData,\n timestamp: templateData.timestamp - 999, // Approximate\n version: templateData.version,\n signature: templateData.ecdsaSignature\n },\n \n // Reconstruct auth challenge\n authChallenge: {\n challenge: templateData.authChallenge,\n timestamp: templateData.timestamp,\n nonce: templateData.authNonce,\n version: templateData.version\n },\n \n // Generate security level (can be recalculated)\n securityLevel: {\n level: \"CRITICAL\",\n score: 20,\n color: \"red\",\n verificationResults: {\n encryption: { passed: false, details: \"Encryption not working\", points: 0 },\n keyExchange: { passed: true, details: \"Simple key exchange verified\", points: 15 },\n messageIntegrity: { passed: false, details: \"Message integrity failed\", points: 0 },\n rateLimiting: { passed: true, details: \"Rate limiting active\", points: 5 },\n ecdsa: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n metadataProtection: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n pfs: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n nestedEncryption: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n packetPadding: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n advancedFeatures: { passed: false, details: \"Premium session required - feature not available\", points: 0 }\n },\n timestamp: templateData.timestamp,\n details: \"Real verification: 20/100 security checks passed (2/4 available)\",\n isRealData: true,\n passedChecks: 2,\n totalChecks: 4,\n sessionType: \"demo\",\n maxPossibleScore: 50\n }\n };\n \n return fullOffer;\n };\n\n const handleQRScan = async (scannedData) => {\n try {\n console.log('\uD83D\uDD0D Processing scanned QR data...');\n console.log('\uD83D\uDCCA Current mode - showOfferStep:', showOfferStep);\n console.log('\uD83D\uDCCA Scanned data length:', scannedData.length);\n console.log('\uD83D\uDCCA Scanned data first 100 chars:', scannedData.substring(0, 100));\n console.log('\uD83D\uDCCA window.receiveAndProcess available:', !!window.receiveAndProcess);\n \n // Try to parse as JSON first\n const parsedData = JSON.parse(scannedData);\n console.log('\uD83D\uDCCA Parsed data structure:', parsedData);\n \n // QR with hdr/body: COSE or RAW animated frames\n if (parsedData.hdr && parsedData.body) {\n const { hdr } = parsedData;\n // Initialize/rotate buffer by id\n if (!qrChunksBufferRef.current.id || qrChunksBufferRef.current.id !== hdr.id) {\n qrChunksBufferRef.current = { id: hdr.id, total: hdr.total || 1, seen: new Set(), items: [], lastUpdateMs: Date.now() };\n try {\n document.dispatchEvent(new CustomEvent('qr-scan-progress', { detail: { id: hdr.id, seq: 0, total: hdr.total || 1 } }));\n } catch {}\n }\n // Deduplicate & record\n if (!qrChunksBufferRef.current.seen.has(hdr.seq)) {\n qrChunksBufferRef.current.seen.add(hdr.seq);\n qrChunksBufferRef.current.items.push(scannedData);\n qrChunksBufferRef.current.lastUpdateMs = Date.now();\n }\n // Emit progress based on unique frames captured\n try {\n const uniqueCount = qrChunksBufferRef.current.seen.size;\n document.dispatchEvent(new CustomEvent('qr-scan-progress', { detail: { id: hdr.id, seq: uniqueCount, total: qrChunksBufferRef.current.total || hdr.total || 0 } }));\n } catch {}\n const isComplete = qrChunksBufferRef.current.seen.size >= (qrChunksBufferRef.current.total || 1);\n if (!isComplete) {\n // Explicitly keep scanner open\n return Promise.resolve(false);\n }\n // Completed: decide RAW vs COSE\n if (hdr.rt === 'raw') {\n try {\n // Sort by seq and concatenate bodies\n const parts = qrChunksBufferRef.current.items\n .map(s => JSON.parse(s))\n .sort((a, b) => (a.hdr.seq || 0) - (b.hdr.seq || 0))\n .map(p => p.body || '');\n const fullText = parts.join('');\n const payloadObj = JSON.parse(fullText);\n if (showOfferStep) {\n setAnswerInput(JSON.stringify(payloadObj, null, 2));\n } else {\n setOfferInput(JSON.stringify(payloadObj, null, 2));\n }\n setMessages(prev => [...prev, { message: '\u2705 All frames captured. RAW payload reconstructed.', type: 'success' }]);\n try { document.dispatchEvent(new CustomEvent('qr-scan-complete', { detail: { id: hdr.id } })); } catch {}\n // Close scanner from caller by returning true\n qrChunksBufferRef.current = { id: null, total: 0, seen: new Set(), items: [] };\n setShowQRScannerModal(false);\n return Promise.resolve(true);\n } catch (e) {\n console.warn('RAW multi-frame reconstruction failed:', e);\n return Promise.resolve(false);\n }\n } else if (window.receiveAndProcess) {\n try {\n const results = await window.receiveAndProcess(qrChunksBufferRef.current.items);\n if (results.length > 0) {\n const { payloadObj } = results[0];\n if (showOfferStep) {\n setAnswerInput(JSON.stringify(payloadObj, null, 2));\n } else {\n setOfferInput(JSON.stringify(payloadObj, null, 2));\n }\n setMessages(prev => [...prev, { message: '\u2705 All frames captured. COSE payload reconstructed.', type: 'success' }]);\n try { document.dispatchEvent(new CustomEvent('qr-scan-complete', { detail: { id: hdr.id } })); } catch {}\n qrChunksBufferRef.current = { id: null, total: 0, seen: new Set(), items: [] };\n setShowQRScannerModal(false);\n return Promise.resolve(true);\n }\n } catch (e) {\n console.warn('COSE multi-chunk processing failed:', e);\n }\n return Promise.resolve(false);\n } else {\n return Promise.resolve(false);\n }\n }\n \n // Check if this is a template-based QR code\n if (parsedData.type === 'enhanced_secure_offer_template') {\n console.log('QR scan: Template-based offer detected, reconstructing...');\n const fullOffer = reconstructFromTemplate(parsedData);\n \n // Determine which input to populate based on current mode\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n setAnswerInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Template data populated to answerInput (waiting for response mode)');\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n setOfferInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Template data populated to offerInput (paste invitation mode)');\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully! Full offer reconstructed from template.',\n type: 'success'\n }]);\n setShowQRScannerModal(false); // Close QR scanner modal\n return true;\n }\n // Check if this is a reference-based QR code\n else if (parsedData.type === 'secure_offer_reference' && parsedData.referenceId) {\n // Try to get the full offer data from localStorage\n const fullOfferData = localStorage.getItem(`qr_offer_${parsedData.referenceId}`);\n if (fullOfferData) {\n const fullOffer = JSON.parse(fullOfferData);\n // Determine which input to populate based on current mode\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n setAnswerInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Reference data populated to answerInput (waiting for response mode)');\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n setOfferInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Reference data populated to offerInput (paste invitation mode)');\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully! Full offer data retrieved.',\n type: 'success'\n }]);\n setShowQRScannerModal(false); // Close QR scanner modal\n return true;\n } else {\n setMessages(prev => [...prev, {\n message: '\u274C QR code reference found but full data not available. Please use copy/paste.',\n type: 'error'\n }]);\n return false;\n }\n } else {\n // Check if this is compressed data (missing SDP)\n if (!parsedData.sdp) {\n setMessages(prev => [...prev, {\n message: '\u26A0\uFE0F QR code contains compressed data (SDP removed). Please use copy/paste for full data.',\n type: 'warning'\n }]);\n }\n \n // Determine which input to populate based on current mode\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n console.log('QR scan: Populating answerInput with:', parsedData);\n setAnswerInput(JSON.stringify(parsedData, null, 2));\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n console.log('QR scan: Populating offerInput with:', parsedData);\n setOfferInput(JSON.stringify(parsedData, null, 2));\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully!',\n type: 'success'\n }]);\n setShowQRScannerModal(false);\n return true;\n }\n } catch (error) {\n // If not JSON, use as plain text\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n setAnswerInput(scannedData);\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n setOfferInput(scannedData);\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully!',\n type: 'success'\n }]);\n setShowQRScannerModal(false);\n return true;\n }\n };\n \n const handleCreateOffer = async () => {\n try {\n console.log('\uD83C\uDFAF handleCreateOffer called');\n // All security features are enabled by default\n \n setOfferData('');\n setShowOfferStep(false);\n setShowQRCode(false);\n setQrCodeUrl('');\n \n console.log('\uD83C\uDFAF Calling createSecureOffer...');\n const offer = await webrtcManagerRef.current.createSecureOffer();\n console.log('\uD83C\uDFAF createSecureOffer returned:', offer ? 'success' : 'null');\n \n // Store offer data directly (no encryption needed with SAS)\n setOfferData(offer);\n setShowOfferStep(true);\n \n // Generate QR code for the offer data\n // Use compact JSON (no pretty-printing) to reduce size\n const offerString = typeof offer === 'object' ? JSON.stringify(offer) : offer;\n console.log('Generating QR code for data length:', offerString.length);\n console.log('First 100 chars of offer data:', offerString.substring(0, 100));\n await generateQRCode(offerString);\n \n const existingMessages = messages.filter(m => \n m.type === 'system' && \n (m.message.includes('Secure invitation created') || m.message.includes('Send the encrypted code'))\n );\n \n if (existingMessages.length === 0) {\n setMessages(prev => [...prev, { \n message: '\uD83D\uDD10 Secure invitation created and encrypted!', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n setMessages(prev => [...prev, { \n message: '\uD83D\uDCE4 Send the invitation code to your interlocutor via a secure channel (voice call, SMS, etc.)..', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n }\n \n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } catch (error) {\n setMessages(prev => [...prev, { \n message: `\u274C Error creating invitation: ${error.message}`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n };\n \n const handleCreateAnswer = async () => {\n try {\n console.log('handleCreateAnswer called, offerInput:', offerInput);\n console.log('offerInput.trim():', offerInput.trim());\n console.log('offerInput.trim() length:', offerInput.trim().length);\n \n if (!offerInput.trim()) {\n setMessages(prev => [...prev, { \n message: '\u26A0\uFE0F You need to insert the invitation code from your interlocutor.', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n return;\n }\n \n try {\n setMessages(prev => [...prev, { \n message: '\uD83D\uDD04 Processing the secure invitation...', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n let offer;\n try {\n // Parse the offer data directly (no decryption needed with SAS)\n offer = JSON.parse(offerInput.trim());\n } catch (parseError) {\n throw new Error(`Invalid invitation format: ${parseError.message}`);\n }\n \n if (!offer || typeof offer !== 'object') {\n throw new Error('The invitation must be an object');\n }\n \n // Support both compact and legacy offer formats\n const isValidOfferType = (offer.t === 'offer') || (offer.type === 'enhanced_secure_offer');\n if (!isValidOfferType) {\n throw new Error('Invalid invitation type. Expected offer or enhanced_secure_offer');\n }\n \n console.log('Creating secure answer for offer:', offer);\n const answer = await webrtcManagerRef.current.createSecureAnswer(offer);\n console.log('Secure answer created:', answer);\n \n // Store answer data directly (no encryption needed with SAS)\n setAnswerData(answer);\n setShowAnswerStep(true);\n \n // Generate QR code for the answer data\n const answerString = typeof answer === 'object' ? JSON.stringify(answer) : answer;\n console.log('Generating QR code for answer data length:', answerString.length);\n console.log('First 100 chars of answer data:', answerString.substring(0, 100));\n await generateQRCode(answerString);\n \n // Mark answer as created for state management\n markAnswerCreated();\n \n const existingResponseMessages = messages.filter(m => \n m.type === 'system' && \n (m.message.includes('Secure response created') || m.message.includes('Send the response'))\n );\n \n if (existingResponseMessages.length === 0) {\n setMessages(prev => [...prev, { \n message: '\u2705 Secure response created!', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n setMessages(prev => [...prev, { \n message: '\uD83D\uDCE4 Send the response code to the initiator via a secure channel or let them scan the QR code below.', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n }\n \n // Update security level after creating answer\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } catch (error) {\n console.error('Error in handleCreateAnswer:', error);\n setMessages(prev => [...prev, { \n message: `\u274C Error processing the invitation: ${error.message}`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n } catch (error) {\n console.error('Error in handleCreateAnswer:', error);\n setMessages(prev => [...prev, { \n message: `\u274C Invitation processing error: ${error.message}`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n };\n \n const handleConnect = async () => {\n try {\n if (!answerInput.trim()) {\n setMessages(prev => [...prev, { \n message: '\u26A0\uFE0F You need to insert the response code from your interlocutor.', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n return;\n }\n \n try {\n setMessages(prev => [...prev, { \n message: '\uD83D\uDD04 Processing the secure response...', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n let answer;\n try {\n // Parse the answer data directly (no decryption needed with SAS)\n answer = JSON.parse(answerInput.trim());\n } catch (parseError) {\n throw new Error(`Invalid response format: ${parseError.message}`);\n }\n \n if (!answer || typeof answer !== 'object') {\n throw new Error('The response must be an object');\n }\n \n // Support both compact and legacy formats\n const answerType = answer.t || answer.type;\n if (!answerType || (answerType !== 'answer' && answerType !== 'enhanced_secure_answer')) {\n throw new Error('Invalid response type. Expected answer or enhanced_secure_answer');\n }\n \n await webrtcManagerRef.current.handleSecureAnswer(answer);\n \n // All security features are enabled by default - no session activation needed\n if (pendingSession) {\n setPendingSession(null);\n setMessages(prev => [...prev, { \n message: `\u2705 All security features enabled by default`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n \n setMessages(prev => [...prev, { \n message: '\uD83D\uDD04 Finalizing the secure connection...', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n // Update security level after handling answer\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } catch (error) {\n console.error('Error in handleConnect inner try:', error);\n \n // \u0411\u043E\u043B\u0435\u0435 \u0434\u0435\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A\n let errorMessage = 'Connection setup error';\n if (error.message.includes('CRITICAL SECURITY FAILURE')) {\n if (error.message.includes('ECDH public key structure')) {\n errorMessage = '\uD83D\uDD11 Invalid response code - missing or corrupted cryptographic key. Please check the code and try again.';\n } else if (error.message.includes('ECDSA public key structure')) {\n errorMessage = '\uD83D\uDD10 Invalid response code - missing signature verification key. Please check the code and try again.';\n } else {\n errorMessage = '\uD83D\uDD12 Security validation failed - possible attack detected';\n }\n } else if (error.message.includes('too old') || error.message.includes('replay')) {\n errorMessage = '\u23F0 Response data is outdated - please use a fresh invitation';\n } else if (error.message.includes('MITM') || error.message.includes('signature')) {\n errorMessage = '\uD83D\uDEE1\uFE0F Security breach detected - connection rejected';\n } else if (error.message.includes('Invalid') || error.message.includes('format')) {\n errorMessage = '\uD83D\uDCDD Invalid response format - please check the code';\n } else {\n errorMessage = `\u274C ${error.message}`;\n }\n \n setMessages(prev => [...prev, { \n message: errorMessage, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now(),\n showRetryButton: true\n }]);\n \n // \u0421\u0431\u0440\u043E\u0441 \u0441\u0435\u0441\u0441\u0438\u0438 \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043E\u0448\u0438\u0431\u043E\u043A \u043A\u0440\u043E\u043C\u0435 replay attack\n if (!error.message.includes('too old') && !error.message.includes('replay')) {\n setPendingSession(null);\n setSessionTimeLeft(0);\n }\n \n // \u0423\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u043C \u0441\u0442\u0430\u0442\u0443\u0441 failed \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432 \u0445\u0435\u0434\u0435\u0440\u0435\n setConnectionStatus('failed');\n \n // \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438\n console.log('\uD83D\uDEA8 Error occurred, but keeping connection status as connecting:');\n console.log(' - errorMessage:', error.message);\n console.log(' - connectionStatus:', 'connecting (kept)');\n console.log(' - isVerified:', false);\n console.log(' - willShowChat:', keyFingerprint && keyFingerprint !== '');\n } \n } catch (error) {\n console.error('Error in handleConnect outer try:', error);\n \n // \u0411\u043E\u043B\u0435\u0435 \u0434\u0435\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A\n let errorMessage = 'Connection setup error';\n if (error.message.includes('CRITICAL SECURITY FAILURE')) {\n if (error.message.includes('ECDH public key structure')) {\n errorMessage = '\uD83D\uDD11 Invalid response code - missing or corrupted cryptographic key. Please check the code and try again.';\n } else if (error.message.includes('ECDSA public key structure')) {\n errorMessage = '\uD83D\uDD10 Invalid response code - missing signature verification key. Please check the code and try again.';\n } else {\n errorMessage = '\uD83D\uDD12 Security validation failed - possible attack detected';\n }\n } else if (error.message.includes('too old') || error.message.includes('replay')) {\n errorMessage = '\u23F0 Response data is outdated - please use a fresh invitation';\n } else if (error.message.includes('MITM') || error.message.includes('signature')) {\n errorMessage = '\uD83D\uDEE1\uFE0F Security breach detected - connection rejected';\n } else if (error.message.includes('Invalid') || error.message.includes('format')) {\n errorMessage = '\uD83D\uDCDD Invalid response format - please check the code';\n } else {\n errorMessage = `\u274C ${error.message}`;\n }\n \n setMessages(prev => [...prev, { \n message: errorMessage, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now(),\n showRetryButton: true\n }]);\n \n // \u0421\u0431\u0440\u043E\u0441 \u0441\u0435\u0441\u0441\u0438\u0438 \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043E\u0448\u0438\u0431\u043E\u043A \u043A\u0440\u043E\u043C\u0435 replay attack\n if (!error.message.includes('too old') && !error.message.includes('replay')) {\n setPendingSession(null);\n setSessionTimeLeft(0);\n }\n \n // \u0423\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u043C \u0441\u0442\u0430\u0442\u0443\u0441 failed \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432 \u0445\u0435\u0434\u0435\u0440\u0435\n setConnectionStatus('failed');\n \n // \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438\n console.log('\uD83D\uDEA8 Error occurred in outer catch, but keeping connection status as connecting:');\n console.log(' - errorMessage:', error.message);\n console.log(' - connectionStatus:', 'connecting (kept)');\n console.log(' - isVerified:', false);\n console.log(' - willShowChat:', keyFingerprint && keyFingerprint !== '');\n }\n };\n \n const handleVerifyConnection = (isValid) => {\n if (isValid) {\n webrtcManagerRef.current.confirmVerification();\n // Mark local verification as confirmed\n setLocalVerificationConfirmed(true);\n } else {\n setMessages(prev => [...prev, { \n message: '\u274C Verification rejected. The connection is unsafe! Session reset..', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n setShowVerification(false);\n setVerificationCode('');\n \n // Reset UI to initial state\n setConnectionStatus('disconnected');\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setKeyFingerprint('');\n setSecurityLevel(null);\n setIsVerified(false);\n setMessages([]);\n \n setSessionTimeLeft(0);\n setPendingSession(null);\n \n // Dispatch disconnected event for SessionTimer\n document.dispatchEvent(new CustomEvent('disconnected'));\n \n handleDisconnect();\n }\n };\n \n const handleSendMessage = async () => {\n if (!messageInput.trim()) {\n return;\n }\n \n if (!webrtcManagerRef.current) {\n return;\n }\n \n if (!webrtcManagerRef.current.isConnected()) {\n return;\n }\n \n try {\n \n // Add the message to local messages immediately (sent message)\n addMessageWithAutoScroll(messageInput.trim(), 'sent');\n \n // Use sendMessage for simple text messages instead of sendSecureMessage\n await webrtcManagerRef.current.sendMessage(messageInput);\n setMessageInput('');\n } catch (error) {\n const msg = String(error?.message || error);\n if (!/queued for sending|Data channel not ready/i.test(msg)) {\n addMessageWithAutoScroll(`\u274C Sending error: ${msg}`,'system');\n }\n }\n };\n \n const handleClearData = () => {\n // \u041E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u044F \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\n setOfferData('');\n setAnswerData('');\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n \n // \u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u043C showAnswerStep \u0435\u0441\u043B\u0438 \u0435\u0441\u0442\u044C QR \u043A\u043E\u0434 \u043E\u0442\u0432\u0435\u0442\u0430\n if (!shouldPreserveAnswerData()) {\n setShowAnswerStep(false);\n }\n \n setShowVerification(false);\n setShowQRCode(false);\n setShowQRScanner(false);\n setShowQRScannerModal(false);\n \n // \u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u043C QR \u043A\u043E\u0434 \u043E\u0442\u0432\u0435\u0442\u0430, \u0435\u0441\u043B\u0438 \u043E\u043D \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D\n // (\u043D\u0435 \u0441\u0431\u0440\u0430\u0441\u044B\u0432\u0430\u0435\u043C qrCodeUrl \u0435\u0441\u043B\u0438 \u0435\u0441\u0442\u044C \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442)\n if (!shouldPreserveAnswerData()) {\n setQrCodeUrl('');\n }\n \n setVerificationCode('');\n setIsVerified(false);\n setKeyFingerprint('');\n setSecurityLevel(null);\n setConnectionStatus('disconnected');\n setMessages([]);\n setMessageInput('');\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // PAKE passwords removed - using SAS verification instead \n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u043E\u0447\u0438\u0441\u0442\u043A\u0435 \u0434\u0430\u043D\u043D\u044B\u0445\n // \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0433 \u0432\u0438\u0434\u0435\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438\n // if (typeof console.clear === 'function') {\n // console.clear();\n // }\n \n // Cleanup session state\n setSessionTimeLeft(0);\n \n setPendingSession(null);\n document.dispatchEvent(new CustomEvent('peer-disconnect'));\n // Session manager removed - all features enabled by default\n };\n \n const handleDisconnect = () => {\n setSessionTimeLeft(0);\n \n // Mark as user-initiated disconnect\n updateConnectionState({ \n status: 'disconnected',\n isUserInitiatedDisconnect: true \n });\n \n // Cleanup session state\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n \n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n setIsVerified(false);\n setShowVerification(false);\n setConnectionStatus('disconnected');\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // Reset UI to initial state (user-initiated disconnect always clears data)\n setConnectionStatus('disconnected');\n setShowVerification(false);\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n setIsVerified(false);\n \n setMessages([]);\n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438\n // \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0433 \u0432\u0438\u0434\u0435\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438\n // if (typeof console.clear === 'function') {\n // console.clear();\n // }\n \n document.dispatchEvent(new CustomEvent('peer-disconnect'));\n document.dispatchEvent(new CustomEvent('disconnected'));\n \n document.dispatchEvent(new CustomEvent('session-cleanup', {\n detail: { \n timestamp: Date.now(),\n reason: 'manual_disconnect'\n }\n }));\n \n setTimeout(() => {\n setSessionTimeLeft(0);\n }, 500);\n \n handleClearData();\n \n setTimeout(() => {\n // Session manager removed - all features enabled by default\n }, 1000);\n };\n \n const handleSessionActivated = (session) => {\n let message;\n if (session.type === 'demo') {\n message = `\uD83C\uDFAE Demo session activated for 6 minutes. You can create invitations!`;\n } else {\n message = `\u2705 All security features enabled by default. You can create invitations!`;\n }\n \n addMessageWithAutoScroll(message, 'system');\n \n };\n \n React.useEffect(() => {\n if (connectionStatus === 'connected' && isVerified) {\n addMessageWithAutoScroll('\uD83C\uDF89 Secure connection successfully established and verified! You can now communicate safely with full protection against MITM attacks and Perfect Forward Secrecy..', 'system');\n \n }\n }, [connectionStatus, isVerified]);\n \n const isConnectedAndVerified = (connectionStatus === 'connected' || connectionStatus === 'verified') && isVerified;\n \n // \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438 \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0447\u0430\u0442\u0430\n console.log('\uD83D\uDD0D Chat activation check:');\n console.log(' - connectionStatus:', connectionStatus);\n console.log(' - isVerified:', isVerified);\n console.log(' - keyFingerprint:', keyFingerprint);\n console.log(' - isConnectedAndVerified:', isConnectedAndVerified);\n console.log(' - bothVerificationsConfirmed:', bothVerificationsConfirmed);\n console.log(' - localVerificationConfirmed:', localVerificationConfirmed);\n console.log(' - remoteVerificationConfirmed:', remoteVerificationConfirmed);\n \n React.useEffect(() => {\n // All security features are enabled by default - no session activation needed\n if (isConnectedAndVerified && pendingSession && connectionStatus !== 'failed') {\n setPendingSession(null);\n setSessionTimeLeft(0); \n addMessageWithAutoScroll('\u2705 All security features enabled by default', 'system');\n }\n }, [isConnectedAndVerified, pendingSession, connectionStatus]);\n \n return React.createElement('div', { \n className: \"minimal-bg min-h-screen\" \n }, [\n React.createElement(EnhancedMinimalHeader, {\n key: 'header',\n status: connectionStatus,\n fingerprint: keyFingerprint,\n verificationCode: verificationCode,\n onDisconnect: handleDisconnect,\n isConnected: isConnectedAndVerified,\n securityLevel: securityLevel,\n // sessionManager removed - all features enabled by default\n sessionTimeLeft: sessionTimeLeft,\n webrtcManager: webrtcManagerRef.current\n }),\n \n React.createElement('main', {\n key: 'main'\n }, \n (() => {\n console.log('\uD83D\uDD0D Main render decision:', {\n isConnectedAndVerified,\n connectionStatus,\n isVerified,\n keyFingerprint: !!keyFingerprint\n });\n return isConnectedAndVerified;\n })()\n ? (() => {\n console.log('\uD83D\uDD0D Passing scrollToBottom to EnhancedChatInterface:', typeof scrollToBottom, scrollToBottom);\n return React.createElement(EnhancedChatInterface, {\n messages: messages,\n messageInput: messageInput,\n setMessageInput: setMessageInput,\n onSendMessage: handleSendMessage,\n onDisconnect: handleDisconnect,\n keyFingerprint: keyFingerprint,\n isVerified: isVerified,\n chatMessagesRef: chatMessagesRef,\n scrollToBottom: scrollToBottom,\n webrtcManager: webrtcManagerRef.current\n });\n })()\n : React.createElement(EnhancedConnectionSetup, {\n onCreateOffer: handleCreateOffer,\n onCreateAnswer: handleCreateAnswer,\n onConnect: handleConnect,\n onClearData: handleClearData,\n onVerifyConnection: handleVerifyConnection,\n connectionStatus: connectionStatus,\n offerData: offerData,\n answerData: answerData,\n offerInput: offerInput,\n setOfferInput: setOfferInput,\n answerInput: answerInput,\n setAnswerInput: setAnswerInput,\n showOfferStep: showOfferStep,\n showAnswerStep: showAnswerStep,\n verificationCode: verificationCode,\n showVerification: showVerification,\n showQRCode: showQRCode,\n qrCodeUrl: qrCodeUrl,\n showQRScanner: showQRScanner,\n setShowQRCode: setShowQRCode,\n setShowQRScanner: setShowQRScanner,\n setShowQRScannerModal: setShowQRScannerModal,\n messages: messages,\n localVerificationConfirmed: localVerificationConfirmed,\n remoteVerificationConfirmed: remoteVerificationConfirmed,\n bothVerificationsConfirmed: bothVerificationsConfirmed,\n // QR control props\n qrFramesTotal: qrFramesTotal,\n qrFrameIndex: qrFrameIndex,\n qrManualMode: qrManualMode,\n toggleQrManualMode: toggleQrManualMode,\n nextQrFrame: nextQrFrame,\n prevQrFrame: prevQrFrame,\n // PAKE passwords removed - using SAS verification instead\n })\n ),\n \n // PAKE Password Modal removed - using SAS verification instead\n \n // Payment Modal removed - all security features enabled by default\n\n (() => {\n console.log('Rendering QRScanner, showQRScannerModal:', showQRScannerModal, 'QRScanner available:', !!window.QRScanner);\n return window.QRScanner ? React.createElement(window.QRScanner, {\n key: 'qr-scanner-modal',\n onScan: handleQRScan,\n onClose: () => setShowQRScannerModal(false),\n isVisible: showQRScannerModal,\n continuous: true\n }) : React.createElement('div', {\n key: 'qr-scanner-error',\n className: \"hidden\"\n }, 'QRScanner not loaded');\n })()\n ]);\n };\n function initializeApp() {\n if (window.EnhancedSecureCryptoUtils && window.EnhancedSecureWebRTCManager) {\n ReactDOM.render(React.createElement(EnhancedSecureP2PChat), document.getElementById('root'));\n } else {\n console.error('\u274C \u041C\u043E\u0434\u0443\u043B\u0438 \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u044B:', {\n hasCrypto: !!window.EnhancedSecureCryptoUtils,\n hasWebRTC: !!window.EnhancedSecureWebRTCManager\n });\n }\n }\n // \u0413\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0439 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u043E\u0448\u0438\u0431\u043E\u043A \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u044F \u043E\u0448\u0438\u0431\u043E\u043A \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C\n if (typeof window !== 'undefined') {\n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u043D\u0435\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043D\u044B\u0445 \u043F\u0440\u043E\u043C\u0438\u0441\u043E\u0432\n window.addEventListener('unhandledrejection', (event) => {\n console.error('\uD83D\uDEA8 Unhandled promise rejection:', event.reason);\n event.preventDefault(); // \u041F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u043C \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u0435 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\n });\n \n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0445 \u043E\u0448\u0438\u0431\u043E\u043A\n window.addEventListener('error', (event) => {\n console.error('\uD83D\uDEA8 Global error:', event.error);\n event.preventDefault(); // \u041F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u043C \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u0435 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\n });\n \n if (!window.initializeApp) {\n window.initializeApp = initializeApp;\n }\n }\n // Render Enhanced Application\n ReactDOM.render(React.createElement(EnhancedSecureP2PChat), document.getElementById('root'));"], - "mappings": ";AAGQ,IAAM,sBAAsB,MAAM;AAC9B,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAS,CAAC;AAExD,QAAM,SAAS;AAAA,IACX;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAA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,SAAS,gBAAgB;AACrB,MAAI,OAAO,6BAA6B,OAAO,6BAA6B;AACxE,aAAS,OAAO,MAAM,cAAc,qBAAqB,GAAG,SAAS,eAAe,MAAM,CAAC;AAAA,EAC/F,OAAO;AACH,YAAQ,MAAM,oHAA0B;AAAA,MACpC,WAAW,CAAC,CAAC,OAAO;AAAA,MACpB,WAAW,CAAC,CAAC,OAAO;AAAA,IACxB,CAAC;AAAA,EACL;AACJ;AAEA,IAAI,OAAO,WAAW,aAAa;AAE/B,SAAO,iBAAiB,sBAAsB,CAAC,UAAU;AACrD,YAAQ,MAAM,0CAAmC,MAAM,MAAM;AAC7D,UAAM,eAAe;AAAA,EACzB,CAAC;AAGD,SAAO,iBAAiB,SAAS,CAAC,UAAU;AACxC,YAAQ,MAAM,2BAAoB,MAAM,KAAK;AAC7C,UAAM,eAAe;AAAA,EACzB,CAAC;AAED,MAAI,CAAC,OAAO,eAAe;AACvB,WAAO,gBAAgB;AAAA,EAC3B;AACJ;AAEA,SAAS,OAAO,MAAM,cAAc,qBAAqB,GAAG,SAAS,eAAe,MAAM,CAAC;", + "sourcesContent": ["// QRScanner will be loaded as a script\n \n // Slider Component\n const UniqueFeatureSlider = () => {\n const [currentSlide, setCurrentSlide] = React.useState(0);\n \n const slides = [\n {\n icon: \"fas fa-shield-halved\",\n color: \"orange\",\n title: \"18-Layer Military Security\",\n description: \"Revolutionary defense system with ECDH P-384 + AES-GCM 256 + ECDSA + Complete ASN.1 Validation. Enhanced Security Edition provides military-grade protection exceeding government standards with complete key structure verification.\"\n },\n {\n icon: \"fas fa-network-wired\",\n color: \"purple\",\n title: \"Pure P2P WebRTC Architecture\",\n description: \"Direct peer-to-peer connections without any servers. Impossible to censor, block, or monitor. Complete decentralization with zero infrastructure.\"\n },\n {\n icon: \"fas fa-sync-alt\",\n color: \"green\",\n title: \"Perfect Forward Secrecy\",\n description: \"Automatic key rotation every 5 minutes or 100 messages. Non-extractable keys with hardware protection ensure past messages remain secure.\"\n },\n {\n icon: \"fas fa-user-secret\",\n color: \"cyan\",\n title: \"Advanced Traffic Obfuscation\",\n description: \"Fake traffic generation, packet padding, and pattern masking make communication indistinguishable from random noise. Defeats traffic analysis.\"\n },\n {\n icon: \"fas fa-eye-slash\",\n color: \"blue\",\n title: \"Zero Data Collection\",\n description: \"No registration, no servers, no logs. Messages exist only in browser memory. Complete anonymity with instant anonymous channels.\"\n },\n {\n icon: \"fas fa-code\",\n color: \"emerald\",\n title: \"100% Open Source Security\",\n description: \"All code is open for audit under MIT license. Uses only standard WebCrypto APIs. Cryptography runs directly in browser without server dependencies.\"\n }\n ];\n \n const nextSlide = () => setCurrentSlide((prev) => (prev + 1) % slides.length);\n const prevSlide = () => setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length);\n const goToSlide = (index) => setCurrentSlide(index);\n \n React.useEffect(() => {\n const timer = setInterval(() => {\n nextSlide();\n }, 15000);\n return () => clearInterval(timer);\n }, []);\n \n return React.createElement('div', {\n className: \"mt-12\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center mb-8\"\n }, [\n React.createElement('h3', {\n key: 'title',\n className: \"text-2xl font-semibold text-primary mb-3\"\n }, 'Why SecureBit.chat is unique'),\n React.createElement('p', {\n key: 'subtitle',\n className: \"text-secondary max-w-2xl mx-auto\"\n }, 'The only messenger with military-grade cryptography')\n ]),\n \n React.createElement('div', {\n key: 'slider-container',\n className: \"relative max-w-4xl mx-auto\"\n }, [\n React.createElement('div', {\n key: 'slider-wrapper',\n className: \"overflow-hidden rounded-xl\"\n }, [\n React.createElement('div', {\n key: 'slides',\n className: \"flex transition-transform duration-500 ease-in-out\",\n style: { transform: `translateX(-${currentSlide * 100}%)` }\n }, slides.map((slide, index) =>\n React.createElement('div', {\n key: index,\n className: \"w-full flex-shrink-0 px-4\"\n }, [\n React.createElement('div', {\n key: 'slide-content',\n className: \"card-minimal rounded-xl p-8 text-center min-h-[300px] flex flex-col justify-center relative overflow-hidden\"\n }, [\n // Background icon\n React.createElement('i', {\n key: 'bg-icon',\n className: `${slide.icon} absolute right-[-100px] top-1/2 -translate-y-1/2 opacity-10 text-[300px] pointer-events-none ${\n slide.color === 'orange' ? 'text-orange-500' :\n slide.color === 'yellow' ? 'text-yellow-500' :\n slide.color === 'purple' ? 'text-purple-500' :\n slide.color === 'green' ? 'text-green-500' :\n slide.color === 'cyan' ? 'text-cyan-500' :\n slide.color === 'blue' ? 'text-blue-500' :\n 'text-emerald-500'\n }`\n }),\n \n // Content\n React.createElement('h4', {\n key: 'slide-title',\n className: \"text-xl font-semibold text-primary mb-4 relative z-10\"\n }, slide.title),\n React.createElement('p', {\n key: 'slide-description',\n className: \"text-secondary leading-relaxed max-w-2xl mx-auto relative z-10\"\n }, slide.description)\n ])\n ])\n ))\n ]),\n \n // Navigation\n React.createElement('button', {\n key: 'prev-btn',\n onClick: prevSlide,\n className: \"absolute left-2 top-1/2 transform -translate-y-1/2 w-10 h-10 bg-gray-600/80 hover:bg-gray-500/80 text-white rounded-full flex items-center justify-center transition-all duration-200 z-10\"\n }, [\n React.createElement('i', {\n key: 'prev-icon',\n className: \"fas fa-chevron-left\"\n })\n ]),\n React.createElement('button', {\n key: 'next-btn',\n onClick: nextSlide,\n className: \"absolute right-2 top-1/2 transform -translate-y-1/2 w-10 h-10 bg-gray-600/80 hover:bg-gray-500/80 text-white rounded-full flex items-center justify-center transition-all duration-200 z-10\"\n }, [\n React.createElement('i', {\n key: 'next-icon',\n className: \"fas fa-chevron-right\"\n })\n ])\n ]),\n \n // Enhanced dots navigation (\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u043C \u0443\u043B\u0443\u0447\u0448\u0435\u043D\u043D\u044B\u0435 \u0442\u043E\u0447\u043A\u0438)\n React.createElement('div', {\n key: 'dots-container',\n className: \"flex justify-center space-x-3 mt-6\"\n }, slides.map((slide, index) =>\n React.createElement('button', {\n key: index,\n onClick: () => goToSlide(index),\n className: `relative group transition-all duration-300 ${\n index === currentSlide\n ? 'w-12 h-4 bg-orange-500 rounded-full'\n : 'w-4 h-4 bg-gray-600 hover:bg-gray-500 rounded-full hover:scale-125'\n }`\n }, [\n // Tooltip on hover\n React.createElement('div', {\n key: 'tooltip',\n className: \"absolute -top-10 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap pointer-events-none\"\n }, slide.title)\n ])\n ))\n ]);\n };\n \n \n \n const ComparisonTable = () => {\n const [selectedFeature, setSelectedFeature] = React.useState(null);\n \n const messengers = [\n {\n name: \"SecureBit.chat\",\n logo:
\n \n
,\n type: \"P2P WebRTC\",\n version: \"Latest\",\n color: \"orange\",\n },\n {\n name: \"Signal\",\n logo: (\n \n \n \n \n ),\n type: \"Centralized\",\n version: \"Latest\",\n color: \"blue\",\n },\n {\n name: \"Threema\",\n logo: (\n \n \n \n \n \n \n \n ),\n type: \"Centralized\",\n version: \"Latest\",\n color: \"green\",\n },\n {\n name: \"Session\",\n logo: (\n \n \n \n \n ),\n type: \"Onion Network\",\n version: \"Latest\",\n color: \"cyan\",\n },\n ];\n \n const features = [\n {\n name: \"Security Architecture\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"18-layer military-grade defense system with complete ASN.1 validation\" },\n signal: { status: \"\u2705\", detail: \"Signal Protocol with double ratchet\" },\n threema: { status: \"\u2705\", detail: \"Standard security implementation\" },\n session: { status: \"\u2705\", detail: \"Modified Signal Protocol + Onion routing\" },\n },\n {\n name: \"Cryptography\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"ECDH P-384 + AES-GCM 256 + ECDSA P-384\" },\n signal: { status: \"\u2705\", detail: \"Signal Protocol + Double Ratchet\" },\n threema: { status: \"\u2705\", detail: \"NaCl + XSalsa20 + Poly1305\" },\n session: { status: \"\u2705\", detail: \"Modified Signal Protocol\" },\n },\n {\n name: \"Perfect Forward Secrecy\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Auto rotation every 5 minutes or 100 messages\" },\n signal: { status: \"\u2705\", detail: \"Double Ratchet algorithm\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Partial (group chats)\" },\n session: { status: \"\u2705\", detail: \"Session Ratchet algorithm\" },\n },\n {\n name: \"Architecture\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Pure P2P WebRTC without servers\" },\n signal: { status: \"\u274C\", detail: \"Centralized Signal servers\" },\n threema: { status: \"\u274C\", detail: \"Threema servers in Switzerland\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Onion routing via network nodes\" },\n },\n {\n name: \"Registration Anonymity\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"No registration required, instant anonymous channels\" },\n signal: { status: \"\u274C\", detail: \"Phone number required\" },\n threema: { status: \"\u2705\", detail: \"ID generated locally\" },\n session: { status: \"\u2705\", detail: \"Random session ID\" },\n },\n {\n name: \"Payment Integration\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Lightning Network satoshis per session + WebLN\" },\n signal: { status: \"\u274C\", detail: \"No payment system\" },\n threema: { status: \"\u274C\", detail: \"No payment system\" },\n session: { status: \"\u274C\", detail: \"No payment system\" },\n },\n {\n name: \"Metadata Protection\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Full metadata encryption + traffic obfuscation\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Sealed Sender (partial)\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Minimal metadata\" },\n session: { status: \"\u2705\", detail: \"Onion routing hides metadata\" },\n },\n {\n name: \"Traffic Obfuscation\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Fake traffic + pattern masking + packet padding\" },\n signal: { status: \"\u274C\", detail: \"No traffic obfuscation\" },\n threema: { status: \"\u274C\", detail: \"No traffic obfuscation\" },\n session: { status: \"\u2705\", detail: \"Onion routing provides obfuscation\" },\n },\n {\n name: \"Open Source\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"100% open + auditable + MIT license\" },\n signal: { status: \"\u2705\", detail: \"Fully open\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Only clients open\" },\n session: { status: \"\u2705\", detail: \"Fully open\" },\n },\n {\n name: \"MITM Protection\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Out-of-band verification + mutual auth + ECDSA\" },\n signal: { status: \"\u2705\", detail: \"Safety numbers verification\" },\n threema: { status: \"\u2705\", detail: \"QR code scanning\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Basic key verification\" },\n },\n {\n name: \"Economic Model\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Sustainable pay-per-session model\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Donations and grants dependency\" },\n threema: { status: \"\u2705\", detail: \"One-time app purchase\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Donations dependency\" },\n },\n {\n name: \"Censorship Resistance\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Impossible to block P2P + no servers to target\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Blocked in authoritarian countries\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"May be blocked\" },\n session: { status: \"\u2705\", detail: \"Onion routing bypasses blocks\" },\n },\n {\n name: \"Data Storage\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Zero data storage - only in browser memory\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"Local database storage\" },\n threema: { status: \"\u26A0\uFE0F\", detail: \"Local + optional backup\" },\n session: { status: \"\u26A0\uFE0F\", detail: \"Local database storage\" },\n },\n {\n name: \"Key Security\",\n lockbit: { status: \"\uD83C\uDFC6\", detail: \"Non-extractable keys + hardware protection\" },\n signal: { status: \"\u2705\", detail: \"Secure key storage\" },\n threema: { status: \"\u2705\", detail: \"Local key storage\" },\n session: { status: \"\u2705\", detail: \"Secure key storage\" },\n },\n {\n name: \"Post-Quantum Roadmap\",\n lockbit: { status: \"\u2705\", detail: \"Planned v5.0 - CRYSTALS-Kyber/Dilithium\" },\n signal: { status: \"\u26A0\uFE0F\", detail: \"PQXDH in development\" },\n threema: { status: \"\u274C\", detail: \"Not announced\" },\n session: { status: \"\u274C\", detail: \"Not announced\" },\n },\n ];\n \n const getStatusIcon = (status) => {\n const statusMap = {\n \"\uD83C\uDFC6\": { icon: \"\uD83C\uDFC6\", color: \"text-yellow-400\" },\n \"\u2705\": { icon: \"\u2705\", color: \"text-green-400\" },\n \"\u26A0\uFE0F\": { icon: \"\u26A0\uFE0F\", color: \"text-yellow-400\" },\n \"\u274C\": { icon: \"\u274C\", color: \"text-red-400\" },\n };\n return statusMap[status] || { icon: status, color: \"text-gray-400\" };\n };\n \n const toggleFeatureDetail = (index) => {\n setSelectedFeature(selectedFeature === index ? null : index);\n };\n \n return (\n
\n {/* Title */}\n
\n

\n Enhanced Security Edition Comparison\n

\n

\n Enhanced Security Edition vs leading secure messengers\n

\n
\n \uD83C\uDFC6\n \n Category Leader - Military-Grade Security\n \n
\n
\n \n {/* Table container */}\n
\n {/* Mobile Alert */}\n
\n

\n \uD83D\uDCA1 Rotate your device horizontally for better viewing\n

\n
\n \n {/* Table */}\n
\n \n {/* Table Header */}\n \n \n \n Security Criterion\n \n {messengers.map((messenger, index) => (\n \n
\n
{messenger.logo}
\n
\n {messenger.name}\n
\n
{messenger.type}
\n
{messenger.version}
\n
\n \n ))}\n \n \n \n {/* Table body*/}\n \n {features.map((feature, featureIndex) => (\n \n toggleFeatureDetail(featureIndex)}\n >\n \n
\n {feature.name}\n \n
\n \n \n \n {getStatusIcon(feature.lockbit.status).icon}\n \n \n \n \n {getStatusIcon(feature.signal.status).icon}\n \n \n \n \n {getStatusIcon(feature.threema.status).icon}\n \n \n \n \n {getStatusIcon(feature.session.status).icon}\n \n \n \n \n {/* Details */}\n {selectedFeature === featureIndex && (\n \n Technical Details:\n \n
\n {feature.lockbit.detail}\n
\n \n \n
\n {feature.signal.detail}\n
\n \n \n
\n {feature.threema.detail}\n
\n \n \n
\n {feature.session.detail}\n
\n \n \n )}\n
\n ))}\n \n \n
\n \n {/* Legend */}\n
\n
\n \uD83C\uDFC6\n Category Leader\n
\n
\n \u2705\n Excellent\n
\n
\n \u26A0\uFE0F\n Partial/Limited\n
\n
\n \u274C\n Not Available\n
\n
\n \n {/* Legend */}\n
\n
\n

\n \n SecureBit.chat Enhanced Security Edition Summary\n

\n

\n SecureBit.chat dominates in 11 out of 15 security categories, establishing itself as the most secure P2P messenger available.\n The Enhanced Security Edition introduces revolutionary 18-layer defense architecture with complete ASN.1 validation, and military-grade cryptography that exceeds government and enterprise standards.\n

\n
\n
\n
\uD83D\uDD10 Cryptographic Superiority
\n

\n ECDH P-384 + AES-GCM 256 + ECDSA P-384 + Complete ASN.1 Validation with non-extractable keys and 18-layer defense system\n

\n
\n
\n
\uD83C\uDF10 True P2P Architecture
\n

\n Pure WebRTC connections with zero servers, impossible to censor or shutdown, complete anonymity\n

\n
\n
\n
\uD83C\uDFAD Traffic Obfuscation
\n

\n Advanced fake traffic generation, packet padding, and pattern masking defeat traffic analysis\n

\n
\n
\n
\n
\n \n {/* Version information */}\n
\n
\n \uD83D\uDE80\n Enhanced Security Edition v4.2.12 - ECDH + DTLS + SAS - \n Active Production Release\n | Next: v5.0 Post-Quantum\n
\n
\n
\n
\n );\n };\n \n function Roadmap() {\n const [selectedPhase, setSelectedPhase] = React.useState(null);\n const phases = [\n {\n version: \"v1.0\",\n title: \"Start of Development\",\n status: \"done\",\n date: \"Early 2025\",\n description: \"Idea, prototype, and infrastructure setup\",\n features: [\n \"Concept and requirements formation\",\n \"Stack selection: WebRTC, P2P, cryptography\",\n \"First messaging prototypes\",\n \"Repository creation and CI\",\n \"Basic encryption architecture\",\n \"UX/UI design\"\n ]\n },\n {\n version: \"v1.5\",\n title: \"Alpha Release\",\n status: \"done\",\n date: \"Spring 2025\",\n description: \"First public alpha: basic chat and key exchange\",\n features: [\n \"Basic P2P messaging via WebRTC\",\n \"Simple E2E encryption (demo scheme)\",\n \"Stable signaling and reconnection\",\n \"Minimal UX for testing\",\n \"Feedback collection from early testers\"\n ]\n },\n {\n version: \"v2.0\",\n title: \"Security Hardened\",\n status: \"done\",\n date: \"Summer 2025\",\n description: \"Security strengthening and stable branch release\",\n features: [\n \"ECDH/ECDSA implementation in production\",\n \"Perfect Forward Secrecy and key rotation\",\n \"Improved authentication checks\",\n \"File encryption and large payload transfers\",\n \"Audit of basic cryptoprocesses\"\n ]\n },\n {\n version: \"v3.0\",\n title: \"Scaling & Stability\",\n status: \"done\",\n date: \"Fall 2025\",\n description: \"Network scaling and stability improvements\",\n features: [\n \"Optimization of P2P connections and NAT traversal\",\n \"Reconnection mechanisms and message queues\",\n \"Reduced battery consumption on mobile\",\n \"Support for multi-device synchronization\",\n \"Monitoring and logging tools for developers\"\n ]\n },\n {\n version: \"v3.5\",\n title: \"Privacy-first Release\",\n status: \"done\",\n date: \"Winter 2025\",\n description: \"Focus on privacy: minimizing metadata\",\n features: [\n \"Metadata protection and fingerprint reduction\",\n \"Experiments with onion routing and DHT\",\n \"Options for anonymous connections\",\n \"Preparation for open code audit\",\n \"Improved user verification processes\"\n ]\n },\n \n // current and future phases\n {\n version: \"v4.2.12\",\n title: \"Enhanced Security Edition\",\n status: \"current\",\n date: \"Now\",\n description: \"Current version with ECDH + DTLS + SAS security, 18-layer military-grade cryptography and complete ASN.1 validation\",\n features: [\n \"ECDH + DTLS + SAS triple-layer security\",\n \"ECDH P-384 + AES-GCM 256-bit encryption\",\n \"DTLS fingerprint verification\",\n \"SAS (Short Authentication String) verification\",\n \"Perfect Forward Secrecy with key rotation\",\n \"Enhanced MITM attack prevention\",\n \"Complete ASN.1 DER validation\",\n \"OID and EC point verification\",\n \"SPKI structure validation\",\n \"P2P WebRTC architecture\",\n \"Metadata protection\",\n \"100% open source code\"\n ]\n },\n {\n version: \"v4.5\",\n title: \"Mobile & Desktop Edition\",\n status: \"development\",\n date: \"Q2 2025\",\n description: \"Native apps for all platforms\",\n features: [\n \"PWA app for mobile\",\n \"Electron app for desktop\",\n \"Real-time notifications\",\n \"Automatic reconnection\",\n \"Battery optimization\",\n \"Cross-device synchronization\",\n \"Improved UX/UI\",\n \"Support for files up to 100MB\"\n ]\n },\n {\n version: \"v5.0\",\n title: \"Quantum-Resistant Edition\",\n status: \"planned\",\n date: \"Q4 2025\",\n description: \"Protection against quantum computers\",\n features: [\n \"Post-quantum cryptography CRYSTALS-Kyber\",\n \"SPHINCS+ digital signatures\",\n \"Hybrid scheme: classic + PQ\",\n \"Quantum-safe key exchange\",\n \"Updated hashing algorithms\",\n \"Migration of existing sessions\",\n \"Compatibility with v4.x\",\n \"Quantum-resistant protocols\"\n ]\n },\n {\n version: \"v5.5\",\n title: \"Group Communications\",\n status: \"planned\",\n date: \"Q2 2026\",\n description: \"Group chats with preserved privacy\",\n features: [\n \"P2P group connections up to 8 participants\",\n \"Mesh networking for groups\",\n \"Signal Double Ratchet for groups\",\n \"Anonymous groups without metadata\",\n \"Ephemeral groups (disappear after session)\",\n \"Cryptographic group administration\",\n \"Group member auditing\"\n ]\n },\n {\n version: \"v6.0\",\n title: \"Decentralized Network\",\n status: \"research\",\n date: \"2027\",\n description: \"Fully decentralized network\",\n features: [\n \"LockBit node mesh network\",\n \"DHT for peer discovery\",\n \"Built-in onion routing\",\n \"Tokenomics and node incentives\",\n \"Governance via DAO\",\n \"Interoperability with other networks\",\n \"Cross-platform compatibility\",\n \"Self-healing network\"\n ]\n },\n {\n version: \"v7.0\",\n title: \"AI Privacy Assistant\",\n status: \"research\",\n date: \"2028+\",\n description: \"AI for privacy and security\",\n features: [\n \"Local AI threat analysis\",\n \"Automatic MITM detection\",\n \"Adaptive cryptography\",\n \"Personalized security recommendations\",\n \"Zero-knowledge machine learning\",\n \"Private AI assistant\",\n \"Predictive security\",\n \"Autonomous attack protection\"\n ]\n }\n ];\n \n \n const getStatusConfig = (status) => {\n switch (status) {\n case 'current':\n return {\n color: 'green',\n bgClass: 'bg-green-500/10 border-green-500/20',\n textClass: 'text-green-400',\n icon: 'fas fa-check-circle',\n label: 'Current Version'\n };\n case 'development':\n return {\n color: 'orange',\n bgClass: 'bg-orange-500/10 border-orange-500/20',\n textClass: 'text-orange-400',\n icon: 'fas fa-code',\n label: 'In Development'\n };\n case 'planned':\n return {\n color: 'blue',\n bgClass: 'bg-blue-500/10 border-blue-500/20',\n textClass: 'text-blue-400',\n icon: 'fas fa-calendar-alt',\n label: 'Planned'\n };\n case 'research':\n return {\n color: 'purple',\n bgClass: 'bg-purple-500/10 border-purple-500/20',\n textClass: 'text-purple-400',\n icon: 'fas fa-flask',\n label: 'Research'\n };\n case 'done':\n return {\n color: 'gray',\n bgClass: 'bg-gray-500/10 border-gray-500/20',\n textClass: 'text-gray-300',\n icon: 'fas fa-flag-checkered',\n label: 'Released'\n };\n default:\n return {\n color: 'gray',\n bgClass: 'bg-gray-500/10 border-gray-500/20',\n textClass: 'text-gray-400',\n icon: 'fas fa-question',\n label: 'Unknown'\n };\n }\n };\n \n \n const togglePhaseDetail = (index) => {\n setSelectedPhase(selectedPhase === index ? null : index);\n };\n return (\n
\n
\n

\n Development Roadmap\n

\n

\n Evolution of SecureBit.chat : from initial development to quantum-resistant decentralized network with complete ASN.1 validation\n

\n \n \n \n Click on a version for details\n \n
\n
\n \n
\n
\n {/* The line has been removed */}\n \n
\n {phases.map((phase, index) => {\n const statusConfig = getStatusConfig(phase.status);\n const isExpanded = selectedPhase === index;\n \n return (\n
\n {/* The dots are visible only on sm and larger screens */}\n \n togglePhaseDetail(index)}\n key={`phase-button-${index}`}\n className={`card-minimal rounded-xl p-4 text-left w-full transition-all duration-300 ${\n isExpanded\n ? \"ring-2 ring-\" + statusConfig.color + \"-500/30\"\n : \"\"\n }`}\n >\n \n \n \n \n {phase.version}\n \n
\n \n
\n \n {phase.title}\n \n \n {phase.description}\n

\n
\n
\n \n \n \n \n \n {statusConfig.label}\n \n
\n \n
{phase.date}
\n \n
\n \n \n {isExpanded && (\n \n \n \n Key features:\n \n \n \n {phase.features.map((feature, featureIndex) => (\n \n \n \n {feature}\n \n \n ))}\n \n \n )}\n \n \n );\n })}\n \n \n \n \n
\n \n \n Join the future of privacy\n \n

\n SecureBit.chat grows thanks to the community. Your ideas and feedback help shape the future of secure communication with complete ASN.1 validation.\n

\n \n \n \n \n GitHub Repository\n \n \n \n \n Feedback\n \n
\n \n \n \n );\n }\n \n \n // Enhanced Copy Button with better UX\n const EnhancedCopyButton = ({ text, className = \"\", children }) => {\n const [copied, setCopied] = React.useState(false);\n \n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch (error) {\n console.error('Copy failed:', error);\n // Fallback for older browsers\n const textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.select();\n document.execCommand('copy');\n document.body.removeChild(textArea);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n };\n \n return React.createElement('button', {\n onClick: handleCopy,\n className: `${className} transition-all duration-200`\n }, [\n React.createElement('i', {\n key: 'icon',\n className: `${copied ? 'fas fa-check accent-green' : 'fas fa-copy text-secondary'} mr-2`\n }),\n copied ? 'Copied!' : children\n ]);\n };\n \n // Verification Component\n const VerificationStep = ({ verificationCode, onConfirm, onReject, localConfirmed, remoteConfirmed, bothConfirmed }) => {\n return React.createElement('div', {\n className: \"card-minimal rounded-xl p-6 border-purple-500/20\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'icon',\n className: \"w-10 h-10 bg-purple-500/10 border border-purple-500/20 rounded-lg flex items-center justify-center mr-3\"\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt accent-purple'\n })\n ]),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Security verification\")\n ]),\n React.createElement('div', {\n key: 'content',\n className: \"space-y-4\"\n }, [\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm\"\n }, \"Verify the security code with your contact via another communication channel (voice, SMS, etc.):\"),\n React.createElement('div', {\n key: 'code-display',\n className: \"text-center\"\n }, [\n React.createElement('div', {\n key: 'code',\n className: \"verification-code text-2xl py-4\"\n }, verificationCode)\n ]),\n // Verification status indicators\n React.createElement('div', {\n key: 'verification-status',\n className: \"space-y-2\"\n }, [\n React.createElement('div', {\n key: 'local-status',\n className: `flex items-center justify-between p-2 rounded-lg ${localConfirmed ? 'bg-green-500/10 border border-green-500/20' : 'bg-gray-500/10 border border-gray-500/20'}`\n }, [\n React.createElement('span', {\n key: 'local-label',\n className: \"text-sm text-secondary\"\n }, \"Your confirmation:\"),\n React.createElement('div', {\n key: 'local-indicator',\n className: \"flex items-center\"\n }, [\n React.createElement('i', {\n key: 'local-icon',\n className: `fas ${localConfirmed ? 'fa-check-circle text-green-400' : 'fa-clock text-gray-400'} mr-2`\n }),\n React.createElement('span', {\n key: 'local-text',\n className: `text-sm ${localConfirmed ? 'text-green-400' : 'text-gray-400'}`\n }, localConfirmed ? 'Confirmed' : 'Pending')\n ])\n ]),\n React.createElement('div', {\n key: 'remote-status',\n className: `flex items-center justify-between p-2 rounded-lg ${remoteConfirmed ? 'bg-green-500/10 border border-green-500/20' : 'bg-gray-500/10 border border-gray-500/20'}`\n }, [\n React.createElement('span', {\n key: 'remote-label',\n className: \"text-sm text-secondary\"\n }, \"Peer confirmation:\"),\n React.createElement('div', {\n key: 'remote-indicator',\n className: \"flex items-center\"\n }, [\n React.createElement('i', {\n key: 'remote-icon',\n className: `fas ${remoteConfirmed ? 'fa-check-circle text-green-400' : 'fa-clock text-gray-400'} mr-2`\n }),\n React.createElement('span', {\n key: 'remote-text',\n className: `text-sm ${remoteConfirmed ? 'text-green-400' : 'text-gray-400'}`\n }, remoteConfirmed ? 'Confirmed' : 'Pending')\n ])\n ])\n ]),\n React.createElement('div', {\n key: 'warning',\n className: \"p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg\"\n }, [\n React.createElement('p', {\n className: \"text-yellow-400 text-sm flex items-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-exclamation-triangle mr-2'\n }),\n 'Make sure the codes match exactly.!'\n ])\n ]),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex space-x-3\"\n }, [\n React.createElement('button', {\n key: 'confirm',\n onClick: onConfirm,\n disabled: localConfirmed,\n className: `flex-1 py-3 px-4 rounded-lg font-medium transition-all duration-200 ${localConfirmed ? 'bg-gray-500/20 text-gray-400 cursor-not-allowed' : 'btn-verify text-white'}`\n }, [\n React.createElement('i', {\n className: `fas ${localConfirmed ? 'fa-check-circle' : 'fa-check'} mr-2`\n }),\n localConfirmed ? 'Confirmed' : 'The codes match'\n ]),\n React.createElement('button', {\n key: 'reject',\n onClick: onReject,\n className: \"flex-1 bg-red-500/10 hover:bg-red-500/20 text-red-400 border border-red-500/20 py-3 px-4 rounded-lg font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n className: 'fas fa-times mr-2'\n }),\n 'The codes do not match'\n ])\n ])\n ])\n ]);\n };\n \n // Enhanced Chat Message with better security indicators\n const EnhancedChatMessage = ({ message, type, timestamp }) => {\n const formatTime = (ts) => {\n return new Date(ts).toLocaleTimeString('ru-RU', { \n hour: '2-digit', \n minute: '2-digit',\n second: '2-digit'\n });\n };\n \n const getMessageStyle = () => {\n switch (type) {\n case 'sent':\n return {\n container: \"ml-auto bg-orange-500/15 border-orange-500/20 text-primary\",\n icon: \"fas fa-lock accent-orange\",\n label: \"Encrypted\"\n };\n case 'received':\n return {\n container: \"mr-auto card-minimal text-primary\",\n icon: \"fas fa-unlock-alt accent-green\",\n label: \"Decrypted\"\n };\n case 'system':\n return {\n container: \"mx-auto bg-yellow-500/10 border border-yellow-500/20 text-yellow-400\",\n icon: \"fas fa-info-circle accent-yellow\",\n label: \"System\"\n };\n default:\n return {\n container: \"mx-auto card-minimal text-secondary\",\n icon: \"fas fa-circle text-muted\",\n label: \"Unknown\"\n };\n }\n };\n \n const style = getMessageStyle();\n \n return React.createElement('div', {\n className: `message-slide mb-3 p-3 rounded-lg max-w-md break-words ${style.container} border`\n }, [\n React.createElement('div', {\n key: 'content',\n className: \"flex items-start space-x-2\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: `${style.icon} text-sm mt-0.5 opacity-70`\n }),\n React.createElement('div', {\n key: 'text',\n className: \"flex-1\"\n }, [\n React.createElement('div', {\n key: 'message',\n className: \"text-sm\"\n }, message),\n timestamp && React.createElement('div', {\n key: 'meta',\n className: \"flex items-center justify-between mt-1 text-xs opacity-50\"\n }, [\n React.createElement('span', {\n key: 'time'\n }, formatTime(timestamp)),\n React.createElement('span', {\n key: 'status',\n className: \"text-xs\"\n }, style.label)\n ])\n ])\n ])\n ]);\n };\n \n // Enhanced Connection Setup with verification\n const EnhancedConnectionSetup = ({\n messages, \n onCreateOffer, \n onCreateAnswer, \n onConnect, \n onClearData,\n onVerifyConnection,\n connectionStatus,\n offerData,\n answerData,\n offerInput,\n setOfferInput,\n answerInput,\n setAnswerInput,\n showOfferStep,\n showAnswerStep,\n verificationCode,\n showVerification,\n showQRCode,\n qrCodeUrl,\n showQRScanner,\n setShowQRCode,\n setShowQRScanner,\n setShowQRScannerModal,\n offerPassword,\n answerPassword,\n localVerificationConfirmed,\n remoteVerificationConfirmed,\n bothVerificationsConfirmed,\n // QR control props\n qrFramesTotal,\n qrFrameIndex,\n qrManualMode,\n toggleQrManualMode,\n nextQrFrame,\n prevQrFrame\n }) => {\n const [mode, setMode] = React.useState('select');\n \n const resetToSelect = () => {\n setMode('select');\n onClearData();\n };\n \n const handleVerificationConfirm = () => {\n onVerifyConnection(true);\n };\n \n const handleVerificationReject = () => {\n onVerifyConnection(false);\n };\n \n if (showVerification) {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'verification',\n className: \"w-full max-w-md\"\n }, [\n React.createElement(VerificationStep, {\n verificationCode: verificationCode,\n onConfirm: handleVerificationConfirm,\n onReject: handleVerificationReject,\n localConfirmed: localVerificationConfirmed,\n remoteConfirmed: remoteVerificationConfirmed,\n bothConfirmed: bothVerificationsConfirmed\n })\n ])\n ]);\n }\n \n if (mode === 'select') {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'selector',\n className: \"w-full max-w-4xl\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center mb-8\"\n }, [\n React.createElement('h2', {\n key: 'title',\n className: \"text-2xl font-semibold text-primary mb-3\"\n }, 'Start secure communication'),\n React.createElement('p', {\n key: 'subtitle',\n className: \"text-secondary max-w-2xl mx-auto\"\n }, \"Choose a connection method for a secure channel with ECDH encryption and Perfect Forward Secrecy.\")\n ]),\n \n React.createElement('div', {\n key: 'options',\n className: \"grid md:grid-cols-2 gap-6 max-w-3xl mx-auto\"\n }, [\n // Create Connection\n React.createElement('div', {\n key: 'create',\n onClick: () => setMode('create'),\n className: \"card-minimal rounded-xl p-6 cursor-pointer group\"\n }, [\n React.createElement('div', {\n key: 'icon',\n className: \"w-12 h-12 bg-blue-500/10 border border-blue-500/20 rounded-lg flex items-center justify-center mx-auto mb-4\"\n }, [\n React.createElement('i', {\n className: 'fas fa-plus text-xl text-blue-400'\n })\n ]),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-semibold text-primary text-center mb-3\"\n }, \"Create channel\"),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-center text-sm mb-4\"\n }, \"Initiate a new secure connection with encrypted exchange\"),\n React.createElement('div', {\n key: 'features',\n className: \"space-y-2\"\n }, [\n React.createElement('div', {\n key: 'f1',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-key accent-orange mr-2 text-xs'\n }),\n 'Generating ECDH keys'\n ]),\n React.createElement('div', {\n key: 'f2',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt accent-orange mr-2 text-xs'\n }),\n 'Verification code'\n ]),\n React.createElement('div', {\n key: 'f3',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-sync-alt accent-purple mr-2 text-xs'\n }),\n 'PFS key rotation'\n ])\n ])\n ]),\n \n // Join Connection\n React.createElement('div', {\n key: 'join',\n onClick: () => setMode('join'),\n className: \"card-minimal rounded-xl p-6 cursor-pointer group\"\n }, [\n React.createElement('div', {\n key: 'icon',\n className: \"w-12 h-12 bg-green-500/10 border border-green-500/20 rounded-lg flex items-center justify-center mx-auto mb-4\"\n }, [\n React.createElement('i', {\n className: 'fas fa-link text-xl accent-green'\n })\n ]),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-semibold text-primary text-center mb-3\"\n }, \"Join\"),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-center text-sm mb-4\"\n }, \"Connect to an existing secure channel\"),\n React.createElement('div', {\n key: 'features',\n className: \"space-y-2\"\n }, [\n React.createElement('div', {\n key: 'f1',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-paste accent-green mr-2 text-xs'\n }),\n 'Paste Offer invitation'\n ]),\n React.createElement('div', {\n key: 'f2',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-check-circle accent-green mr-2 text-xs'\n }),\n 'Automatic verification'\n ]),\n React.createElement('div', {\n key: 'f3',\n className: \"flex items-center text-sm text-muted\"\n }, [\n React.createElement('i', {\n className: 'fas fa-sync-alt accent-purple mr-2 text-xs'\n }),\n 'PFS protection'\n ])\n ])\n ])\n ]),\n \n \n React.createElement('div', {\n key: 'security-features',\n className: \"grid grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4 max-w-6xl mx-auto mt-8\"\n }, [\n React.createElement('div', { key: 'feature1', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-green-500/10 border border-green-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-key accent-green' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"ECDH P-384 Key Exchange\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Military-grade elliptic curve key exchange\")\n ]),\n React.createElement('div', { key: 'feature2', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-purple-500/10 border border-purple-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-user-shield accent-purple' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"MITM Protection\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Out-of-band verification against attacks\")\n ]),\n React.createElement('div', { key: 'feature3', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-orange-500/10 border border-orange-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-lock accent-orange' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"AES-GCM 256 Encryption\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Authenticated encryption standard\")\n ]),\n React.createElement('div', { key: 'feature4', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-cyan-500/10 border border-cyan-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-sync-alt accent-cyan' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"Perfect Forward Secrecy\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Automatic key rotation every 5 minutes\")\n ]),\n React.createElement('div', { key: 'feature5', className: \"text-center p-3 sm:p-4\" }, [\n React.createElement('div', { key: 'icon', className: \"w-10 h-10 sm:w-12 sm:h-12 bg-blue-500/10 border border-blue-500/20 rounded-lg flex items-center justify-center mx-auto mb-2 sm:mb-3\" }, [\n React.createElement('i', { className: 'fas fa-signature accent-blue' })\n ]),\n React.createElement('h4', { key: 'title', className: \"text-xs sm:text-sm font-medium text-primary mb-1\" }, \"ECDSA P-384 Signatures\"),\n React.createElement('p', { key: 'desc', className: \"text-xs text-muted leading-tight\" }, \"Digital signatures for message integrity\")\n ]),\n ]),\n \n React.createElement(UniqueFeatureSlider, { key: 'unique-features-slider' }),\n \n React.createElement(DownloadApps, { key: 'download-apps' }),\n \n React.createElement(ComparisonTable, { key: 'comparison-table' }), \n \n React.createElement(Roadmap, { key: 'roadmap' }),\n ])\n ]);\n }\n \n if (mode === 'create') {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'create-flow',\n className: \"w-full max-w-3xl space-y-6\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center\"\n }, [\n React.createElement('button', {\n key: 'back',\n onClick: resetToSelect,\n className: \"mb-4 text-secondary hover:text-primary transition-colors flex items-center mx-auto text-sm\"\n }, [\n React.createElement('i', {\n className: 'fas fa-arrow-left mr-2'\n }),\n 'Back to selection'\n ]),\n React.createElement('h2', {\n key: 'title',\n className: \"text-xl font-semibold text-primary mb-2\"\n }, 'Creating a secure channel')\n ]),\n \n // Step 1\n React.createElement('div', {\n key: 'step1',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"step-number mr-3\"\n }, '1'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Generating ECDH keys and verification code\")\n ]),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm mb-4\"\n }, \"Creating cryptographically strong keys and codes to protect against attacks\"),\n React.createElement('button', {\n key: 'create-btn',\n onClick: onCreateOffer,\n disabled: connectionStatus === 'connecting' || showOfferStep,\n className: `w-full btn-primary text-white py-3 px-4 rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed`\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt mr-2'\n }),\n showOfferStep ? 'Keys created \u2713' : 'Create secure keys'\n ]),\n \n showOfferStep && React.createElement('div', {\n key: 'offer-result',\n className: \"mt-6 space-y-4\"\n }, [\n React.createElement('div', {\n key: 'success',\n className: \"p-3 bg-green-500/10 border border-green-500/20 rounded-lg\"\n }, [\n React.createElement('p', {\n className: \"text-green-400 text-sm font-medium flex items-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-check-circle mr-2'\n }),\n 'Secure invitation created! Send the code to your contact:'\n ])\n ]),\n React.createElement('div', {\n key: 'offer-data',\n className: \"space-y-3\"\n }, [\n React.createElement('textarea', {\n key: 'textarea',\n value: typeof offerData === 'object' ? JSON.stringify(offerData, null, 2) : offerData,\n readOnly: true,\n rows: 8,\n className: \"w-full p-3 bg-custom-bg border border-gray-500/20 rounded-lg font-mono text-xs text-secondary resize-none custom-scrollbar\"\n }),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex gap-2\"\n }, [\n React.createElement(EnhancedCopyButton, {\n key: 'copy',\n text: typeof offerData === 'object' ? JSON.stringify(offerData, null, 2) : offerData,\n className: \"flex-1 px-3 py-2 bg-orange-500/10 hover:bg-orange-500/20 text-orange-400 border border-orange-500/20 rounded text-sm font-medium\"\n }, 'Copy invitation code'),\n React.createElement('button', {\n key: 'qr-toggle',\n onClick: async () => {\n const next = !showQRCode;\n setShowQRCode(next);\n if (next) {\n try {\n const payload = typeof offerData === 'object' ? JSON.stringify(offerData) : offerData;\n if (payload && payload.length) {\n await generateQRCode(payload);\n }\n } catch (e) {\n console.warn('QR regenerate on toggle failed:', e);\n }\n }\n },\n className: \"px-3 py-2 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border border-blue-500/20 rounded text-sm font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: showQRCode ? 'fas fa-eye-slash mr-1' : 'fas fa-qrcode mr-1'\n }),\n showQRCode ? 'Hide QR' : 'Show QR'\n ])\n ]),\n showQRCode && qrCodeUrl && React.createElement('div', {\n key: 'qr-container',\n className: \"mt-4 p-4 bg-gray-800/50 border border-gray-600/30 rounded-lg text-center\"\n }, [\n React.createElement('h4', {\n key: 'qr-title',\n className: \"text-sm font-medium text-primary mb-3\"\n }, 'Scan QR code to connect'),\n React.createElement('div', {\n key: 'qr-wrapper',\n className: \"flex justify-center\"\n }, [\n React.createElement('img', {\n key: 'qr-image',\n src: qrCodeUrl,\n alt: \"QR Code for secure connection\",\n className: \"max-w-none h-auto border border-gray-600/30 rounded w-[20rem] sm:w-[24rem] md:w-[28rem] lg:w-[32rem]\"\n })\n ]),\n \n // \u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u0438\u0436\u0435 QR \u043A\u043E\u0434\u0430\n ((qrFramesTotal || 0) >= 1) && React.createElement('div', {\n key: 'qr-controls-below',\n className: \"mt-4 flex flex-col items-center gap-2\"\n }, [\n React.createElement('div', {\n key: 'frame-indicator',\n className: \"text-xs text-gray-300\"\n }, `Frame ${Math.max(1, (qrFrameIndex || 1))}/${qrFramesTotal || 1}`),\n React.createElement('div', {\n key: 'control-buttons',\n className: \"flex gap-1\"\n }, [\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'prev-frame',\n onClick: prevQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25C0'),\n React.createElement('button', {\n key: 'toggle-manual',\n onClick: toggleQrManualMode,\n className: `px-2 py-1 rounded text-xs font-medium ${\n (qrManualMode || false)\n ? 'bg-blue-500 text-white' \n : 'bg-gray-600 text-gray-300 hover:bg-gray-500'\n }`\n }, (qrManualMode || false) ? 'Manual' : 'Auto'),\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'next-frame',\n onClick: nextQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25B6')\n ])\n ]),\n React.createElement('p', {\n key: 'qr-description',\n className: \"text-xs text-gray-400 mt-2\"\n }, 'Your contact can scan this QR code to quickly join the secure session')\n ])\n ])\n ])\n ]),\n \n // Step 2 - Session Type Selection\n // showOfferStep && React.createElement('div', {\n // key: 'step2',\n // className: \"card-minimal rounded-xl p-6\"\n // }, [\n // React.createElement('div', {\n // key: 'step-header',\n // className: \"flex items-center mb-4\"\n // }, [\n // React.createElement('div', {\n // key: 'number',\n // className: \"w-8 h-8 bg-green-500 text-white rounded-lg flex items-center justify-center font-semibold text-sm mr-3\"\n // }, '2'),\n // React.createElement('h3', {\n // key: 'title',\n // className: \"text-lg font-medium text-primary\"\n // }, \"Select session type\")\n // ]),\n // React.createElement('p', {\n // key: 'description',\n // className: \"text-secondary text-sm mb-4\"\n // }, \"Choose a session plan or use limited demo mode for testing.\"),\n // React.createElement(SessionTypeSelector, {\n // key: 'session-selector',\n // onSelectType: (sessionType) => {\n // // Save the selected session type\n // setSelectedSessionType(sessionType);\n // console.log('\uD83C\uDFAF Session type selected:', sessionType);\n \n // // FIX: For demo sessions, we immediately call automatic activation\n // if (sessionType === 'demo') {\n // console.log('\uD83C\uDFAE Demo session selected, scheduling automatic activation...');\n // // Delay activation for 2 seconds to stabilize\n // setTimeout(() => {\n // if (sessionManager) {\n // console.log('\uD83D\uDE80 Triggering demo session activation from selection...');\n // handleDemoVerification();\n // }\n // }, 2000);\n // }\n \n // // Open a modal payment window\n // if (typeof window.showPaymentModal === 'function') {\n // window.showPaymentModal(sessionType);\n // } else {\n // // Fallback - show session information\n // console.log('Selected session type:', sessionType);\n // }\n // },\n // onCancel: resetToSelect,\n // sessionManager: window.sessionManager\n // })\n // ]),\n \n // Step 3 - Waiting for response\n showOfferStep && React.createElement('div', {\n key: 'step2',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"w-8 h-8 bg-blue-500 text-white rounded-lg flex items-center justify-center font-semibold text-sm mr-3\"\n }, '2'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Waiting for the peer's response\")\n ]),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm mb-4\"\n }, \"Paste the encrypted invitation code from your contact.\"),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex gap-2 mb-4\"\n }, [\n React.createElement('button', {\n key: 'scan-btn',\n onClick: () => setShowQRScannerModal(true),\n className: \"px-4 py-2 bg-purple-500/10 hover:bg-purple-500/20 text-purple-400 border border-purple-500/20 rounded text-sm font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: 'fas fa-qrcode mr-2'\n }),\n 'Scan QR Code'\n ])\n ]),\n React.createElement('textarea', {\n key: 'input',\n value: answerInput,\n onChange: (e) => {\n setAnswerInput(e.target.value);\n // Mark answer as created when user manually enters data\n if (e.target.value.trim().length > 0) {\n markAnswerCreated();\n }\n },\n rows: 6,\n placeholder: \"Paste the encrypted response code from your contact or scan QR code...\",\n className: \"w-full p-3 bg-custom-bg border border-gray-500/20 rounded-lg resize-none mb-4 text-secondary placeholder-gray-500 focus:border-orange-500/40 focus:outline-none transition-all custom-scrollbar text-sm\"\n }),\n React.createElement('button', {\n key: 'connect-btn',\n onClick: onConnect,\n disabled: !answerInput.trim(),\n className: \"w-full btn-secondary text-white py-3 px-4 rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n }, [\n React.createElement('i', {\n className: 'fas fa-rocket mr-2'\n }),\n 'Establish connection'\n ])\n ])\n ])\n ]);\n }\n \n if (mode === 'join') {\n return React.createElement('div', {\n className: \"min-h-[calc(100vh-104px)] flex items-center justify-center p-4\"\n }, [\n React.createElement('div', {\n key: 'join-flow',\n className: \"w-full max-w-3xl space-y-6\"\n }, [\n React.createElement('div', {\n key: 'header',\n className: \"text-center\"\n }, [\n React.createElement('button', {\n key: 'back',\n onClick: resetToSelect,\n className: \"mb-4 text-secondary hover:text-primary transition-colors flex items-center mx-auto text-sm\"\n }, [\n React.createElement('i', {\n className: 'fas fa-arrow-left mr-2'\n }),\n 'Back to selection'\n ]),\n React.createElement('h2', {\n key: 'title',\n className: \"text-xl font-semibold text-primary mb-2\"\n }, 'Joining the secure channel')\n ]),\n \n // Step 1\n React.createElement('div', {\n key: 'step1',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"w-8 h-8 bg-green-500 text-white rounded-lg flex items-center justify-center font-semibold text-sm mr-3\"\n }, '1'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Paste secure invitation\")\n ]),\n React.createElement('p', {\n key: 'description',\n className: \"text-secondary text-sm mb-4\"\n }, \"Copy and paste the encrypted invitation code from the initiator.\"),\n React.createElement('textarea', {\n key: 'input',\n value: offerInput,\n onChange: (e) => {\n setOfferInput(e.target.value);\n // Mark answer as created when user manually enters data\n if (e.target.value.trim().length > 0) {\n markAnswerCreated();\n }\n },\n rows: 8,\n placeholder: \"Paste the encrypted invitation code or scan QR code...\",\n className: \"w-full p-3 bg-custom-bg border border-gray-500/20 rounded-lg resize-none mb-4 text-secondary placeholder-gray-500 focus:border-green-500/40 focus:outline-none transition-all custom-scrollbar text-sm\"\n }),\n React.createElement('div', {\n key: 'buttons',\n className: \"flex gap-2 mb-4\"\n }, [\n React.createElement('button', {\n key: 'scan-btn',\n onClick: () => setShowQRScannerModal(true),\n className: \"px-4 py-2 bg-purple-500/10 hover:bg-purple-500/20 text-purple-400 border border-purple-500/20 rounded text-sm font-medium transition-all duration-200\"\n }, [\n React.createElement('i', {\n key: 'icon',\n className: 'fas fa-qrcode mr-2'\n }),\n 'Scan QR Code'\n ]),\n React.createElement('button', {\n key: 'process-btn',\n onClick: onCreateAnswer,\n disabled: !offerInput.trim() || connectionStatus === 'connecting',\n className: \"flex-1 btn-secondary text-white py-2 px-4 rounded-lg font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n }, [\n React.createElement('i', {\n className: 'fas fa-cogs mr-2'\n }),\n 'Process invitation'\n ])\n ]),\n showQRScanner && React.createElement('div', {\n key: 'qr-scanner',\n className: \"p-4 bg-gray-800/50 border border-gray-600/30 rounded-lg text-center\"\n }, [\n React.createElement('h4', {\n key: 'scanner-title',\n className: \"text-sm font-medium text-primary mb-3\"\n }, 'QR Code Scanner'),\n React.createElement('p', {\n key: 'scanner-description',\n className: \"text-xs text-gray-400 mb-3\"\n }, 'Use your device camera to scan the QR code from the invitation'),\n React.createElement('button', {\n key: 'open-scanner',\n onClick: () => {\n console.log('Open Camera Scanner clicked, showQRScannerModal will be set to true');\n console.log('QRScanner available:', !!window.QRScanner);\n console.log('setShowQRScannerModal function:', typeof setShowQRScannerModal);\n if (typeof setShowQRScannerModal === 'function') {\n setShowQRScannerModal(true);\n } else {\n console.error('setShowQRScannerModal is not a function:', setShowQRScannerModal);\n }\n },\n className: \"w-full px-4 py-3 bg-purple-600 hover:bg-purple-500 text-white rounded-lg font-medium transition-all duration-200 mb-3\"\n }, [\n React.createElement('i', {\n key: 'camera-icon',\n className: 'fas fa-camera mr-2'\n }),\n 'Open Camera Scanner'\n ]),\n React.createElement('button', {\n key: 'test-qr',\n onClick: async () => {\n console.log('Creating test QR code...');\n if (window.generateQRCode) {\n const testData = '{\"type\":\"test\",\"message\":\"Hello QR Scanner!\"}';\n const qrUrl = await window.generateQRCode(testData);\n console.log('Test QR code generated:', qrUrl);\n // Open QR code in new tab for testing\n const newWindow = window.open();\n newWindow.document.write(``);\n }\n },\n className: \"px-3 py-1 bg-green-600/20 hover:bg-green-600/30 text-green-300 border border-green-500/20 rounded text-xs font-medium transition-all duration-200 mr-2\"\n }, 'Test QR'),\n React.createElement('button', {\n key: 'close-scanner',\n onClick: () => setShowQRScanner(false),\n className: \"px-3 py-1 bg-gray-600/20 hover:bg-gray-600/30 text-gray-300 border border-gray-500/20 rounded text-xs font-medium transition-all duration-200\"\n }, 'Close Scanner')\n ])\n ]),\n \n // Step 2\n showAnswerStep && React.createElement('div', {\n key: 'step2',\n className: \"card-minimal rounded-xl p-6\"\n }, [\n React.createElement('div', {\n key: 'step-header',\n className: \"flex items-center mb-4\"\n }, [\n React.createElement('div', {\n key: 'number',\n className: \"step-number mr-3\"\n }, '2'),\n React.createElement('h3', {\n key: 'title',\n className: \"text-lg font-medium text-primary\"\n }, \"Sending a secure response\")\n ]),\n React.createElement('div', {\n key: 'success',\n className: \"p-3 bg-green-500/10 border border-green-500/20 rounded-lg mb-4\"\n }, [\n React.createElement('p', {\n className: \"text-green-400 text-sm font-medium flex items-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-check-circle mr-2'\n }),\n 'Secure response created! Send this code to the initiator:'\n ])\n ]),\n React.createElement('div', {\n key: 'answer-data',\n className: \"space-y-3 mb-4\"\n }, [\n React.createElement('textarea', {\n key: 'textarea',\n value: typeof answerData === 'object' ? JSON.stringify(answerData, null, 2) : answerData,\n readOnly: true,\n rows: 6,\n className: \"w-full p-3 bg-custom-bg border border-green-500/20 rounded-lg font-mono text-xs text-secondary resize-none custom-scrollbar\"\n }),\n React.createElement(EnhancedCopyButton, {\n key: 'copy',\n text: typeof answerData === 'object' ? JSON.stringify(answerData, null, 2) : answerData,\n className: \"w-full px-3 py-2 bg-green-500/10 hover:bg-green-500/20 text-green-400 border border-green-500/20 rounded text-sm font-medium\"\n }, 'Copy response code')\n ]),\n // QR Code section for answer\n qrCodeUrl && React.createElement('div', {\n key: 'qr-container',\n className: \"mt-4 p-4 bg-gray-800/50 border border-gray-600/30 rounded-lg text-center\"\n }, [\n React.createElement('h4', {\n key: 'qr-title',\n className: \"text-sm font-medium text-primary mb-3\"\n }, 'Scan QR code to complete connection'),\n React.createElement('div', {\n key: 'qr-wrapper',\n className: \"flex justify-center\"\n }, [\n React.createElement('img', {\n key: 'qr-image',\n src: qrCodeUrl,\n alt: \"QR Code for secure response\",\n className: \"max-w-none h-auto border border-gray-600/30 rounded w-[20rem] sm:w-[24rem] md:w-[28rem] lg:w-[32rem]\"\n })\n ]),\n \n // \u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u0438\u0436\u0435 QR \u043A\u043E\u0434\u0430\n ((qrFramesTotal || 0) >= 1) && React.createElement('div', {\n key: 'qr-controls-below',\n className: \"mt-4 flex flex-col items-center gap-2\"\n }, [\n React.createElement('div', {\n key: 'frame-indicator',\n className: \"text-xs text-gray-300\"\n }, `Frame ${Math.max(1, (qrFrameIndex || 1))}/${qrFramesTotal || 1}`),\n React.createElement('div', {\n key: 'control-buttons',\n className: \"flex gap-1\"\n }, [\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'prev-frame',\n onClick: prevQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25C0'),\n React.createElement('button', {\n key: 'toggle-manual',\n onClick: toggleQrManualMode,\n className: `px-2 py-1 rounded text-xs font-medium ${\n qrManualMode \n ? 'bg-blue-500 text-white' \n : 'bg-gray-600 text-gray-300 hover:bg-gray-500'\n }`\n }, qrManualMode ? 'Manual' : 'Auto'),\n // \u041A\u043D\u043E\u043F\u043A\u0438 \u043D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0431\u043E\u043B\u044C\u0448\u0435 1 \u0447\u0430\u0441\u0442\u0438\n (qrFramesTotal || 0) > 1 && React.createElement('button', {\n key: 'next-frame',\n onClick: nextQrFrame,\n className: \"w-6 h-6 bg-gray-600 hover:bg-gray-500 text-white rounded text-xs flex items-center justify-center\"\n }, '\u25B6')\n ])\n ]),\n React.createElement('p', {\n key: 'qr-description',\n className: \"text-xs text-gray-400 mt-2\"\n }, 'The initiator can scan this QR code to complete the secure connection')\n ]),\n React.createElement('div', {\n key: 'info',\n className: \"p-3 bg-purple-500/10 border border-purple-500/20 rounded-lg\"\n }, [\n React.createElement('p', {\n className: \"text-purple-400 text-sm flex items-center justify-center\"\n }, [\n React.createElement('i', {\n className: 'fas fa-shield-alt mr-2'\n }),\n 'The connection will be established with verification'\n ])\n ])\n ])\n ])\n ]);\n }\n };\n \n // Global scroll function - defined outside components to ensure availability\n const createScrollToBottomFunction = (chatMessagesRef) => {\n return () => {\n console.log('\uD83D\uDD0D Global scrollToBottom called, chatMessagesRef:', chatMessagesRef.current);\n if (chatMessagesRef && chatMessagesRef.current) {\n const scrollAttempt = () => {\n if (chatMessagesRef.current) {\n chatMessagesRef.current.scrollTo({\n top: chatMessagesRef.current.scrollHeight,\n behavior: 'smooth'\n });\n }\n };\n scrollAttempt();\n \n setTimeout(scrollAttempt, 50);\n setTimeout(scrollAttempt, 150);\n setTimeout(scrollAttempt, 300);\n \n requestAnimationFrame(() => {\n setTimeout(scrollAttempt, 100);\n });\n }\n };\n };\n \n const EnhancedChatInterface = ({\n messages,\n messageInput,\n setMessageInput,\n onSendMessage,\n onDisconnect,\n keyFingerprint,\n isVerified,\n chatMessagesRef,\n scrollToBottom,\n webrtcManager\n }) => {\n const [showScrollButton, setShowScrollButton] = React.useState(false);\n const [showFileTransfer, setShowFileTransfer] = React.useState(false);\n \n // \u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u043F\u0440\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n React.useEffect(() => {\n if (chatMessagesRef.current && messages.length > 0) {\n const { scrollTop, scrollHeight, clientHeight } = chatMessagesRef.current;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n if (isNearBottom) {\n const smoothScroll = () => {\n if (chatMessagesRef.current) {\n chatMessagesRef.current.scrollTo({\n top: chatMessagesRef.current.scrollHeight,\n behavior: 'smooth'\n });\n }\n };\n smoothScroll();\n setTimeout(smoothScroll, 50);\n setTimeout(smoothScroll, 150);\n }\n }\n }, [messages, chatMessagesRef]);\n \n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0441\u043A\u0440\u043E\u043B\u043B\u0430\n const handleScroll = () => {\n if (chatMessagesRef.current) {\n const { scrollTop, scrollHeight, clientHeight } = chatMessagesRef.current;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n setShowScrollButton(!isNearBottom);\n }\n };\n \n // \u041F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0430 \u0432\u043D\u0438\u0437 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435\n const handleScrollToBottom = () => {\n console.log('\uD83D\uDD0D handleScrollToBottom called, scrollToBottom type:', typeof scrollToBottom);\n if (typeof scrollToBottom === 'function') {\n scrollToBottom();\n setShowScrollButton(false);\n } else {\n console.error('\u274C scrollToBottom is not a function:', scrollToBottom);\n // Fallback: direct scroll\n if (chatMessagesRef.current) {\n chatMessagesRef.current.scrollTo({\n top: chatMessagesRef.current.scrollHeight,\n behavior: 'smooth'\n });\n }\n setShowScrollButton(false);\n }\n };\n \n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u043D\u0430\u0436\u0430\u0442\u0438\u044F Enter\n const handleKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n onSendMessage();\n }\n };\n \n // \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0433\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0445 \u0442\u0440\u0430\u043D\u0441\u0444\u0435\u0440\u043E\u0432\n const isFileTransferReady = () => {\n if (!webrtcManager) return false;\n \n const connected = webrtcManager.isConnected ? webrtcManager.isConnected() : false;\n const verified = webrtcManager.isVerified || false;\n const hasDataChannel = webrtcManager.dataChannel && webrtcManager.dataChannel.readyState === 'open';\n \n return connected && verified && hasDataChannel;\n };\n \n // \u0412\u043E\u0437\u0432\u0440\u0430\u0442 JSX \u0447\u0435\u0440\u0435\u0437 React.createElement\n return React.createElement(\n 'div',\n {\n className: \"chat-container flex flex-col\",\n style: { backgroundColor: '#272827', height: 'calc(100vh - 64px)' }\n },\n [\n // \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n React.createElement(\n 'div',\n { className: \"flex-1 flex flex-col overflow-hidden\" },\n React.createElement(\n 'div',\n { className: \"flex-1 max-w-4xl mx-auto w-full p-4 overflow-hidden\" },\n React.createElement(\n 'div',\n {\n ref: chatMessagesRef,\n onScroll: handleScroll,\n className: \"h-full overflow-y-auto space-y-3 hide-scrollbar pr-2 scroll-smooth\"\n },\n messages.length === 0 ?\n React.createElement(\n 'div',\n { className: \"flex items-center justify-center h-full\" },\n React.createElement(\n 'div',\n { className: \"text-center max-w-md\" },\n [\n React.createElement(\n 'div',\n { className: \"w-16 h-16 bg-green-500/10 border border-green-500/20 rounded-xl flex items-center justify-center mx-auto mb-4\" },\n React.createElement(\n 'svg',\n { className: \"w-8 h-8 text-green-500\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\" },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z\"\n })\n )\n ),\n React.createElement('h3', { className: \"text-lg font-medium text-gray-300 mb-2\" }, \"Secure channel is ready!\"),\n React.createElement('p', { className: \"text-gray-400 text-sm mb-4\" }, \"All messages are protected by modern cryptographic algorithms\"),\n React.createElement(\n 'div',\n { className: \"text-left space-y-2\" },\n [\n ['End-to-end encryption', 'M5 13l4 4L19 7'],\n ['Protection against replay attacks', 'M5 13l4 4L19 7'],\n ['Integrity verification', 'M5 13l4 4L19 7'],\n ['Perfect Forward Secrecy', 'M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15']\n ].map(([text, d], i) =>\n React.createElement(\n 'div',\n { key: `f${i}`, className: \"flex items-center text-sm text-gray-400\" },\n [\n React.createElement(\n 'svg',\n {\n className: `w-4 h-4 mr-3 ${i === 3 ? 'text-purple-500' : 'text-green-500'}`,\n fill: \"none\",\n stroke: \"currentColor\",\n viewBox: \"0 0 24 24\"\n },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: d\n })\n ),\n text\n ]\n )\n )\n )\n ]\n )\n ) :\n messages.map((msg) =>\n React.createElement(EnhancedChatMessage, {\n key: msg.id,\n message: msg.message,\n type: msg.type,\n timestamp: msg.timestamp\n })\n )\n )\n )\n ),\n \n // \u041A\u043D\u043E\u043F\u043A\u0430 \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0438 \u0432\u043D\u0438\u0437\n showScrollButton &&\n React.createElement(\n 'button',\n {\n onClick: handleScrollToBottom,\n className: \"fixed right-6 w-12 h-12 bg-green-500/20 hover:bg-green-500/30 border border-green-500/30 text-green-400 rounded-full flex items-center justify-center transition-all duration-200 shadow-lg z-50\",\n style: { bottom: '160px' }\n },\n React.createElement(\n 'svg',\n { className: \"w-6 h-6\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\" },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M19 14l-7 7m0 0l-7-7m7 7V3\"\n })\n )\n ),\n \n // \u0421\u0435\u043A\u0446\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\n React.createElement(\n 'div',\n {\n className: \"flex-shrink-0 border-t border-gray-500/10\",\n style: { backgroundColor: '#272827' }\n },\n React.createElement(\n 'div',\n { className: \"max-w-4xl mx-auto px-4\" },\n [\n React.createElement(\n 'button',\n {\n onClick: () => setShowFileTransfer(!showFileTransfer),\n className: `flex items-center text-sm text-gray-400 hover:text-gray-300 transition-colors py-4 ${showFileTransfer ? 'mb-4' : ''}`\n },\n [\n React.createElement(\n 'svg',\n {\n className: `w-4 h-4 mr-2 transform transition-transform ${showFileTransfer ? 'rotate-180' : ''}`,\n fill: \"none\",\n stroke: \"currentColor\",\n viewBox: \"0 0 24 24\"\n },\n showFileTransfer ?\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M5 15l7-7 7 7\"\n }) :\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13\"\n })\n ),\n showFileTransfer ? 'Hide file transfer' : 'Send files'\n ]\n ),\n // \u0418\u0421\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415: \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\n showFileTransfer &&\n React.createElement(window.FileTransferComponent || (() => \n React.createElement('div', {\n className: \"p-4 text-center text-red-400\"\n }, 'FileTransferComponent not loaded')\n ), {\n webrtcManager: webrtcManager,\n isConnected: isFileTransferReady()\n })\n ]\n )\n ),\n \n // \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0432\u0432\u043E\u0434\u0430 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n React.createElement(\n 'div',\n { className: \"border-t border-gray-500/10\" },\n React.createElement(\n 'div',\n { className: \"max-w-4xl mx-auto p-4\" },\n React.createElement(\n 'div',\n { className: \"flex items-stretch space-x-3\" },\n [\n React.createElement(\n 'div',\n { className: \"flex-1 relative\" },\n [\n React.createElement('textarea', {\n value: messageInput,\n onChange: (e) => setMessageInput(e.target.value),\n onKeyDown: handleKeyPress,\n placeholder: \"Enter message to encrypt...\",\n rows: 2,\n maxLength: 2000,\n style: { backgroundColor: '#272827' },\n className: \"w-full p-3 border border-gray-600 rounded-lg resize-none text-gray-300 placeholder-gray-500 focus:border-green-500/40 focus:outline-none transition-all custom-scrollbar text-sm\"\n }),\n React.createElement(\n 'div',\n { className: \"absolute bottom-2 right-3 flex items-center space-x-2 text-xs text-gray-400\" },\n [\n React.createElement('span', null, `${messageInput.length}/2000`),\n React.createElement('span', null, \"\u2022 Enter to send\")\n ]\n )\n ]\n ),\n React.createElement(\n 'button',\n {\n onClick: onSendMessage,\n disabled: !messageInput.trim(),\n className: \"bg-green-400/20 text-green-400 p-3 rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center min-h-[72px]\"\n },\n React.createElement(\n 'svg',\n { className: \"w-6 h-6\", fill: \"none\", stroke: \"currentColor\", viewBox: \"0 0 24 24\" },\n React.createElement('path', {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2,\n d: \"M12 19l9 2-9-18-9 18 9-2zm0 0v-8\"\n })\n )\n )\n ]\n )\n )\n )\n ]\n );\n };\n \n \n // Main Enhanced Application Component\n const EnhancedSecureP2PChat = () => {\n console.log('\uD83D\uDD0D EnhancedSecureP2PChat component initialized');\n console.log('\uD83C\uDFAE QR Manual Control Features Loaded!');\n const [messages, setMessages] = React.useState([]);\n const [connectionStatus, setConnectionStatus] = React.useState('disconnected');\n \n // Moved scrollToBottom logic to be available globally\n const [messageInput, setMessageInput] = React.useState('');\n const [offerData, setOfferData] = React.useState('');\n const [answerData, setAnswerData] = React.useState('');\n const [offerInput, setOfferInput] = React.useState('');\n const [answerInput, setAnswerInput] = React.useState('');\n const [keyFingerprint, setKeyFingerprint] = React.useState('');\n const [verificationCode, setVerificationCode] = React.useState('');\n const [showOfferStep, setShowOfferStep] = React.useState(false);\n const [showAnswerStep, setShowAnswerStep] = React.useState(false);\n const [showVerification, setShowVerification] = React.useState(false);\n const [showQRCode, setShowQRCode] = React.useState(false);\n const [qrCodeUrl, setQrCodeUrl] = React.useState('');\n const [showQRScanner, setShowQRScanner] = React.useState(false);\n const [showQRScannerModal, setShowQRScannerModal] = React.useState(false);\n const [isVerified, setIsVerified] = React.useState(false);\n const [securityLevel, setSecurityLevel] = React.useState(null);\n \n // Mutual verification states\n const [localVerificationConfirmed, setLocalVerificationConfirmed] = React.useState(false);\n const [remoteVerificationConfirmed, setRemoteVerificationConfirmed] = React.useState(false);\n const [bothVerificationsConfirmed, setBothVerificationsConfirmed] = React.useState(false);\n \n // PAKE password states removed - using SAS verification instead\n \n // Session state - all security features enabled by default\n const [sessionTimeLeft, setSessionTimeLeft] = React.useState(0);\n const [pendingSession, setPendingSession] = React.useState(null);\n \n // All security features are enabled by default - no payment required\n \n \n \n // ============================================\n // CENTRALIZED CONNECTION STATE MANAGEMENT\n // ============================================\n \n const [connectionState, setConnectionState] = React.useState({\n status: 'disconnected',\n hasActiveAnswer: false,\n answerCreatedAt: null,\n isUserInitiatedDisconnect: false\n });\n \n // Centralized connection state handler\n const updateConnectionState = (newState, options = {}) => {\n const { preserveAnswer = false, isUserAction = false } = options;\n \n setConnectionState(prev => ({\n ...prev,\n ...newState,\n isUserInitiatedDisconnect: isUserAction,\n hasActiveAnswer: preserveAnswer ? prev.hasActiveAnswer : false,\n answerCreatedAt: preserveAnswer ? prev.answerCreatedAt : null\n }));\n };\n \n // Check if we should preserve answer data\n const shouldPreserveAnswerData = () => {\n const now = Date.now();\n const answerAge = now - (connectionState.answerCreatedAt || 0);\n const maxPreserveTime = 300000; // 5 minutes (\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0432\u0430\u0435\u043C \u0432\u0440\u0435\u043C\u044F \u0434\u043B\u044F QR \u043A\u043E\u0434\u0430)\n \n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u0435 \u0441\u0430\u043C\u0438\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\n const hasAnswerData = (answerData && answerData.trim().length > 0) || \n (answerInput && answerInput.trim().length > 0);\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C \u043D\u0430\u043B\u0438\u0447\u0438\u0435 QR \u043A\u043E\u0434\u0430 \u043E\u0442\u0432\u0435\u0442\u0430\n const hasAnswerQR = qrCodeUrl && qrCodeUrl.trim().length > 0;\n \n const shouldPreserve = (connectionState.hasActiveAnswer && \n answerAge < maxPreserveTime && \n !connectionState.isUserInitiatedDisconnect) ||\n (hasAnswerData && answerAge < maxPreserveTime && \n !connectionState.isUserInitiatedDisconnect) ||\n (hasAnswerQR && answerAge < maxPreserveTime && \n !connectionState.isUserInitiatedDisconnect);\n \n console.log('\uD83D\uDD0D shouldPreserveAnswerData check:', {\n hasActiveAnswer: connectionState.hasActiveAnswer,\n hasAnswerData: hasAnswerData,\n hasAnswerQR: hasAnswerQR,\n answerAge: answerAge,\n maxPreserveTime: maxPreserveTime,\n isUserInitiatedDisconnect: connectionState.isUserInitiatedDisconnect,\n shouldPreserve: shouldPreserve,\n answerData: answerData ? 'exists' : 'null',\n answerInput: answerInput ? 'exists' : 'null',\n qrCodeUrl: qrCodeUrl ? 'exists' : 'null'\n });\n \n return shouldPreserve;\n };\n \n // Mark answer as created\n const markAnswerCreated = () => {\n updateConnectionState({\n hasActiveAnswer: true,\n answerCreatedAt: Date.now()\n });\n };\n \n // Global functions for cleanup\n React.useEffect(() => {\n window.forceCleanup = () => {\n handleClearData();\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n };\n\n window.clearLogs = () => {\n if (typeof console.clear === 'function') {\n console.clear();\n }\n };\n \n return () => {\n delete window.forceCleanup;\n delete window.clearLogs;\n };\n }, []);\n \n const webrtcManagerRef = React.useRef(null);\n // Expose for modules/UI that run outside this closure (e.g., inline handlers)\n // Safe because it's a ref object and we maintain it centrally here\n window.webrtcManagerRef = webrtcManagerRef;\n \n const addMessageWithAutoScroll = React.useCallback((message, type) => {\n const newMessage = {\n message,\n type,\n id: Date.now() + Math.random(),\n timestamp: Date.now()\n };\n \n setMessages(prev => {\n const updated = [...prev, newMessage];\n \n setTimeout(() => {\n if (chatMessagesRef?.current) {\n const container = chatMessagesRef.current;\n try {\n const { scrollTop, scrollHeight, clientHeight } = container;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n \n if (isNearBottom || prev.length === 0) {\n requestAnimationFrame(() => {\n if (container && container.scrollTo) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'smooth'\n });\n }\n });\n }\n } catch (error) {\n console.warn('Scroll error:', error);\n container.scrollTop = container.scrollHeight;\n }\n }\n }, 50);\n \n return updated;\n });\n }, []);\n \n // Update security level based on real verification\n const updateSecurityLevel = React.useCallback(async () => {\n if (window.isUpdatingSecurity) {\n return;\n }\n \n window.isUpdatingSecurity = true;\n \n try {\n if (webrtcManagerRef.current) {\n // All security features are enabled by default - always show MAXIMUM level\n setSecurityLevel({\n level: 'MAXIMUM',\n score: 100,\n color: 'green',\n details: 'All security features enabled by default',\n passedChecks: 10,\n totalChecks: 10,\n isRealData: true\n });\n \n if (window.DEBUG_MODE) {\n const currentLevel = webrtcManagerRef.current.ecdhKeyPair && webrtcManagerRef.current.ecdsaKeyPair \n ? await webrtcManagerRef.current.calculateSecurityLevel()\n : {\n level: 'MAXIMUM',\n score: 100,\n sessionType: 'premium',\n passedChecks: 10,\n totalChecks: 10\n };\n console.log('\uD83D\uDD12 Security level updated:', {\n level: currentLevel.level,\n score: currentLevel.score,\n sessionType: currentLevel.sessionType,\n passedChecks: currentLevel.passedChecks,\n totalChecks: currentLevel.totalChecks\n });\n }\n }\n } catch (error) {\n console.error('Failed to update security level:', error);\n setSecurityLevel({\n level: 'ERROR',\n score: 0,\n color: 'red',\n details: 'Verification failed'\n });\n } finally {\n setTimeout(() => {\n window.isUpdatingSecurity = false;\n }, 2000);\n }\n }, []);\n \n // Session time ticker - unlimited sessions\n React.useEffect(() => {\n const timer = setInterval(() => {\n // Sessions are unlimited - no time restrictions\n setSessionTimeLeft(0);\n }, 1000);\n return () => clearInterval(timer);\n }, []);\n \n // Sessions are unlimited - no expiration handler needed\n \n // All security features are enabled by default - no demo sessions needed\n const chatMessagesRef = React.useRef(null);\n \n // Create scroll function using global helper\n const scrollToBottom = createScrollToBottomFunction(chatMessagesRef);\n \n // Auto-scroll when messages change\n React.useEffect(() => {\n if (messages.length > 0 && chatMessagesRef.current) {\n scrollToBottom();\n setTimeout(scrollToBottom, 50);\n setTimeout(scrollToBottom, 150);\n }\n }, [messages]);\n \n // PAKE password functions removed - using SAS verification instead\n \n React.useEffect(() => {\n // Prevent multiple initializations\n if (webrtcManagerRef.current) {\n console.log('\u26A0\uFE0F WebRTC Manager already initialized, skipping...');\n return;\n }\n \n const handleMessage = (message, type) => {\n // \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0430 \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0435 \u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F\n if (typeof message === 'string' && message.trim().startsWith('{')) {\n try {\n const parsedMessage = JSON.parse(message);\n const blockedTypes = [\n 'file_transfer_start',\n 'file_transfer_response',\n 'file_chunk',\n 'chunk_confirmation',\n 'file_transfer_complete',\n 'file_transfer_error',\n 'heartbeat',\n 'verification',\n 'verification_response',\n 'verification_confirmed',\n 'verification_both_confirmed',\n 'peer_disconnect',\n 'key_rotation_signal',\n 'key_rotation_ready',\n 'security_upgrade'\n ];\n if (parsedMessage.type && blockedTypes.includes(parsedMessage.type)) {\n console.log(`\uD83D\uDED1 Blocked system/file message from chat: ${parsedMessage.type}`);\n return; // \u041D\u0435 \u043F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u043C \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0435 \u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F \u0432 \u0447\u0430\u0442\u0435\n }\n } catch (parseError) {\n // \u041D\u0435 JSON - \u044D\u0442\u043E \u043D\u043E\u0440\u043C\u0430\u043B\u044C\u043D\u043E \u0434\u043B\u044F \u043E\u0431\u044B\u0447\u043D\u044B\u0445 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u044B\u0445 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439\n }\n }\n \n addMessageWithAutoScroll(message, type);\n };\n \n const handleStatusChange = (status) => {\n console.log('handleStatusChange called with status:', status);\n console.log('\uD83D\uDD0D Status change details:');\n console.log(' - oldStatus:', connectionStatus);\n console.log(' - newStatus:', status);\n console.log(' - isVerified:', isVerified);\n console.log(' - willShowChat:', status === 'connected' && isVerified);\n setConnectionStatus(status);\n \n if (status === 'connected') {\n document.dispatchEvent(new CustomEvent('new-connection'));\n \n // \u041D\u0435 \u0441\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044E \u043F\u0440\u0438 'connected' - \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u0438 'verified'\n // setIsVerified(true);\n // setShowVerification(false);\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'verifying') {\n console.log('Setting showVerification to true for verifying status');\n setShowVerification(true);\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'verified') {\n setIsVerified(true);\n setShowVerification(false);\n setBothVerificationsConfirmed(true);\n // CRITICAL: Set connectionStatus to 'connected' to show chat\n setConnectionStatus('connected');\n // Force immediate update of isVerified state\n setTimeout(() => {\n setIsVerified(true);\n }, 0);\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'connecting') {\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } else if (status === 'disconnected') {\n // \u041E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0446\u0435\u043D\u0442\u0440\u0430\u043B\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435\n updateConnectionState({ status: 'disconnected' });\n setConnectionStatus('disconnected');\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u043D\u0443\u0436\u043D\u043E \u043B\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0432\u0435\u0442\u0430\n if (shouldPreserveAnswerData()) {\n console.log('\uD83D\uDEE1\uFE0F Preserving answer data after recent creation');\n setIsVerified(false);\n setShowVerification(false);\n return;\n }\n \n // \u041F\u0440\u0438 \u0440\u0430\u0437\u0440\u044B\u0432\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0434\u0430\u043D\u043D\u044B\u0435\n setIsVerified(false);\n setShowVerification(false);\n \n // Dispatch disconnected event for SessionTimer\n document.dispatchEvent(new CustomEvent('disconnected'));\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // Clear connection data\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n \n // Reset session and timer\n setSessionTimeLeft(0);\n \n // Return to main page after a short delay\n setTimeout(() => {\n setConnectionStatus('disconnected');\n setShowVerification(false);\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u043D\u0443\u0436\u043D\u043E \u043B\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0432\u0435\u0442\u0430\n if (shouldPreserveAnswerData()) {\n console.log('\uD83D\uDEE1\uFE0F Preserving answer data in setTimeout after recent creation');\n return;\n }\n \n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setMessages([]);\n }, 1000);\n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u0440\u0430\u0437\u0440\u044B\u0432\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\n // \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0433 \u0432\u0438\u0434\u0435\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438\n } else if (status === 'peer_disconnected') {\n setSessionTimeLeft(0);\n \n document.dispatchEvent(new CustomEvent('peer-disconnect'));\n \n // A short delay before clearing to display the status\n setTimeout(() => {\n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n setIsVerified(false);\n setShowVerification(false);\n setConnectionStatus('disconnected');\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u043D\u0443\u0436\u043D\u043E \u043B\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0432\u0435\u0442\u0430\n if (shouldPreserveAnswerData()) {\n console.log('\uD83D\uDEE1\uFE0F Preserving answer data in peer_disconnected after recent creation');\n return;\n }\n \n // Clear connection data\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setMessages([]);\n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438 \u043F\u0438\u0440\u0430\n // \u0447\u0442\u043E\u0431\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\n // if (typeof console.clear === 'function') {\n // console.clear();\n // }\n \n // Session manager removed - all features enabled by default\n }, 2000);\n }\n };\n \n const handleKeyExchange = (fingerprint) => {\n console.log('handleKeyExchange called with fingerprint:', fingerprint);\n if (fingerprint === '') {\n setKeyFingerprint('');\n } else {\n setKeyFingerprint(fingerprint);\n console.log('Key fingerprint set in UI:', fingerprint);\n }\n };\n \n const handleVerificationRequired = (code) => {\n console.log('handleVerificationRequired called with code:', code);\n if (code === '') {\n setVerificationCode('');\n setShowVerification(false);\n } else {\n setVerificationCode(code);\n setShowVerification(true);\n console.log('Verification code set, showing verification UI');\n }\n };\n \n const handleVerificationStateChange = (state) => {\n console.log('handleVerificationStateChange called with state:', state);\n setLocalVerificationConfirmed(state.localConfirmed);\n setRemoteVerificationConfirmed(state.remoteConfirmed);\n setBothVerificationsConfirmed(state.bothConfirmed);\n };\n \n // Callback for handling response errors\n const handleAnswerError = (errorType, errorMessage) => {\n if (errorType === 'replay_attack') {\n // Reset the session upon replay attack\n setSessionTimeLeft(0);\n setPendingSession(null);\n \n addMessageWithAutoScroll('\uD83D\uDCA1 Data is outdated. Please create a new invitation or use a current response code.', 'system');\n \n if (typeof console.clear === 'function') {\n console.clear();\n }\n } else if (errorType === 'security_violation') {\n // Reset the session upon security breach\n setSessionTimeLeft(0);\n setPendingSession(null);\n \n addMessageWithAutoScroll(`\uD83D\uDD12 Security breach: ${errorMessage}`, 'system');\n \n if (typeof console.clear === 'function') {\n console.clear();\n }\n }\n };\n \n // Create WebRTC Manager only once\n console.log('\uD83D\uDD27 Initializing WebRTC Manager...');\n \n if (typeof console.clear === 'function') {\n console.clear();\n }\n \n webrtcManagerRef.current = new EnhancedSecureWebRTCManager(\n handleMessage, \n handleStatusChange, \n handleKeyExchange,\n handleVerificationRequired,\n handleAnswerError,\n handleVerificationStateChange\n );\n \n handleMessage('\uD83D\uDE80 SecureBit.chat Enhanced Security Edition v4.2.12 - ECDH + DTLS + SAS initialized. Ready to establish a secure connection with ECDH key exchange, DTLS fingerprint verification, and SAS authentication to prevent MITM attacks.', 'system');\n \n const handleBeforeUnload = (event) => {\n if (event.type === 'beforeunload' && !isTabSwitching) {\n console.log('\uD83D\uDD0C Page unloading (closing tab) - sending disconnect notification');\n \n if (webrtcManagerRef.current && webrtcManagerRef.current.isConnected()) {\n try {\n webrtcManagerRef.current.sendSystemMessage({\n type: 'peer_disconnect',\n reason: 'user_disconnect',\n timestamp: Date.now()\n });\n } catch (error) {\n console.log('Could not send disconnect notification:', error.message);\n }\n \n setTimeout(() => {\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n }, 100);\n } else if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n } else if (isTabSwitching) {\n console.log('\uD83D\uDCF1 Tab switching detected - NOT disconnecting');\n event.preventDefault();\n event.returnValue = '';\n }\n };\n \n window.addEventListener('beforeunload', handleBeforeUnload);\n \n let isTabSwitching = false;\n let tabSwitchTimeout = null;\n \n const handleVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n console.log('\uD83D\uDCF1 Page hidden (tab switch) - keeping connection alive');\n isTabSwitching = true;\n \n if (tabSwitchTimeout) {\n clearTimeout(tabSwitchTimeout);\n }\n \n tabSwitchTimeout = setTimeout(() => {\n isTabSwitching = false;\n }, 5000); \n \n } else if (document.visibilityState === 'visible') {\n console.log('\uD83D\uDCF1 Page visible (tab restored) - connection maintained');\n isTabSwitching = false;\n \n if (tabSwitchTimeout) {\n clearTimeout(tabSwitchTimeout);\n tabSwitchTimeout = null;\n }\n }\n };\n \n document.addEventListener('visibilitychange', handleVisibilityChange);\n \n // Setup file transfer callbacks\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.setFileTransferCallbacks(\n // Progress callback\n (progress) => {\n console.log('File progress:', progress);\n },\n \n // File received callback\n (fileData) => {\n const sizeMb = Math.max(1, Math.round((fileData.fileSize || 0) / (1024 * 1024)));\n const downloadMessage = React.createElement('div', {\n className: 'flex items-center space-x-2'\n }, [\n React.createElement('span', { key: 'label' }, `\uD83D\uDCE5 File received: ${fileData.fileName} (${sizeMb} MB)`),\n React.createElement('button', {\n key: 'btn',\n className: 'px-3 py-1 rounded bg-blue-600 hover:bg-blue-700 text-white text-xs',\n onClick: async () => {\n try {\n const url = await fileData.getObjectURL();\n const a = document.createElement('a');\n a.href = url;\n a.download = fileData.fileName;\n a.click();\n // \u0414\u0430\u0435\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u0432\u0440\u0435\u043C\u044F \u043D\u0430\u0447\u0430\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443, \u0437\u0430\u0442\u0435\u043C \u043E\u0441\u0432\u043E\u0431\u043E\u0436\u0434\u0430\u0435\u043C URL\n setTimeout(() => fileData.revokeObjectURL(url), 15000);\n } catch (e) {\n console.error('Download failed:', e);\n addMessageWithAutoScroll(`\u274C File upload error: ${String(e?.message || e)}`, 'system');\n }\n }\n }, 'Download')\n ]);\n \n addMessageWithAutoScroll(downloadMessage, 'system');\n },\n \n // Error callback\n (error) => {\n console.error('File transfer error:', error);\n \n if (error.includes('Connection not ready')) {\n addMessageWithAutoScroll(`\u26A0\uFE0F File transfer error: connection not ready. Try again later.`, 'system');\n } else if (error.includes('File too large')) {\n addMessageWithAutoScroll(`\u26A0\uFE0F File is too big. Maximum size: 100 MB`, 'system');\n } else {\n addMessageWithAutoScroll(`\u274C File transfer error: ${error}`, 'system');\n }\n }\n );\n }\n \n return () => {\n window.removeEventListener('beforeunload', handleBeforeUnload);\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n \n if (tabSwitchTimeout) {\n clearTimeout(tabSwitchTimeout);\n tabSwitchTimeout = null;\n }\n \n if (webrtcManagerRef.current) {\n console.log('\uD83E\uDDF9 Cleaning up WebRTC Manager...');\n webrtcManagerRef.current.disconnect();\n webrtcManagerRef.current = null;\n }\n };\n }, []); // Empty dependency array to run only once\n \n // All security features are enabled by default - no session purchase needed\n \n const compressOfferData = (offerData) => {\n try {\n // Parse the offer data if it's a string\n const offer = typeof offerData === 'string' ? JSON.parse(offerData) : offerData;\n \n // Create a minimal version with only the most essential data\n const minimalOffer = {\n type: offer.type,\n version: offer.version,\n timestamp: offer.timestamp,\n sessionId: offer.sessionId,\n connectionId: offer.connectionId,\n verificationCode: offer.verificationCode,\n salt: offer.salt,\n // Use only key fingerprints instead of full keys\n keyFingerprints: offer.keyFingerprints,\n // Add a reference to get full data\n fullDataAvailable: true,\n compressionLevel: 'minimal'\n };\n \n return JSON.stringify(minimalOffer);\n } catch (error) {\n console.error('Error compressing offer data:', error);\n return offerData; // Return original if compression fails\n }\n };\n\n const createQRReference = (offerData) => {\n try {\n // Create a unique reference ID for this offer\n const referenceId = `offer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n \n // Store the full offer data in localStorage with the reference ID\n localStorage.setItem(`qr_offer_${referenceId}`, JSON.stringify(offerData));\n \n // Create a minimal QR code with just the reference\n const qrReference = {\n type: 'secure_offer_reference',\n referenceId: referenceId,\n timestamp: Date.now(),\n message: 'Scan this QR code and use the reference ID to get full offer data'\n };\n \n return JSON.stringify(qrReference);\n } catch (error) {\n console.error('Error creating QR reference:', error);\n return null;\n }\n };\n\n const createTemplateOffer = (offer) => {\n // Minimal template to keep QR within single image capacity\n const templateOffer = {\n type: 'enhanced_secure_offer_template',\n version: '4.0',\n sessionId: offer.sessionId,\n connectionId: offer.connectionId,\n verificationCode: offer.verificationCode,\n timestamp: offer.timestamp,\n // Avoid bulky fields (SDP, raw keys); keep only fingerprints and essentials\n keyFingerprints: offer.keyFingerprints,\n // Keep concise auth hints (omit large nonces)\n authChallenge: offer?.authChallenge?.challenge,\n // Optionally include a compact capability hint if small\n capabilities: Array.isArray(offer.capabilities) && offer.capabilities.length <= 5\n ? offer.capabilities\n : undefined\n };\n \n return templateOffer;\n };\n\n // Conservative QR payload limit (characters). Adjust per error correction level.\n const MAX_QR_LEN = 800;\n const [qrFramesTotal, setQrFramesTotal] = React.useState(0);\n const [qrFrameIndex, setQrFrameIndex] = React.useState(0);\n const [qrManualMode, setQrManualMode] = React.useState(false);\n\n // Animated QR state (for multi-chunk COSE)\n const qrAnimationRef = React.useRef({ timer: null, chunks: [], idx: 0, active: false });\n const stopQrAnimation = () => {\n try { if (qrAnimationRef.current.timer) { clearInterval(qrAnimationRef.current.timer); } } catch {}\n qrAnimationRef.current = { timer: null, chunks: [], idx: 0, active: false };\n setQrFrameIndex(0);\n setQrFramesTotal(0);\n setQrManualMode(false);\n };\n\n // \u0424\u0443\u043D\u043A\u0446\u0438\u0438 \u0434\u043B\u044F \u0440\u0443\u0447\u043D\u043E\u0433\u043E \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F QR \u0430\u043D\u0438\u043C\u0430\u0446\u0438\u0435\u0439\n const toggleQrManualMode = () => {\n const newManualMode = !qrManualMode;\n setQrManualMode(newManualMode);\n \n if (newManualMode) {\n // \u041E\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u043C \u0430\u0432\u0442\u043E\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443\n if (qrAnimationRef.current.timer) {\n clearInterval(qrAnimationRef.current.timer);\n qrAnimationRef.current.timer = null;\n }\n console.log('QR Manual mode enabled - auto-scroll stopped');\n } else {\n // \u0412\u043E\u0437\u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u043C \u0430\u0432\u0442\u043E\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443\n if (qrAnimationRef.current.chunks.length > 1 && qrAnimationRef.current.active) {\n const intervalMs = 4000;\n qrAnimationRef.current.timer = setInterval(renderNext, intervalMs);\n }\n console.log('QR Manual mode disabled - auto-scroll resumed');\n }\n };\n\n const nextQrFrame = () => {\n console.log('\uD83C\uDFAE nextQrFrame called, qrFramesTotal:', qrFramesTotal, 'qrAnimationRef.current:', qrAnimationRef.current);\n if (qrAnimationRef.current.chunks.length > 1) {\n const nextIdx = (qrAnimationRef.current.idx + 1) % qrAnimationRef.current.chunks.length;\n qrAnimationRef.current.idx = nextIdx;\n setQrFrameIndex(nextIdx + 1);\n console.log('\uD83C\uDFAE Next frame index:', nextIdx + 1);\n renderNext();\n } else {\n console.log('\uD83C\uDFAE No multiple frames to navigate');\n }\n };\n\n const prevQrFrame = () => {\n console.log('\uD83C\uDFAE prevQrFrame called, qrFramesTotal:', qrFramesTotal, 'qrAnimationRef.current:', qrAnimationRef.current);\n if (qrAnimationRef.current.chunks.length > 1) {\n const prevIdx = (qrAnimationRef.current.idx - 1 + qrAnimationRef.current.chunks.length) % qrAnimationRef.current.chunks.length;\n qrAnimationRef.current.idx = prevIdx;\n setQrFrameIndex(prevIdx + 1);\n console.log('\uD83C\uDFAE Previous frame index:', prevIdx + 1);\n renderNext();\n } else {\n console.log('\uD83C\uDFAE No multiple frames to navigate');\n }\n };\n\n // Buffer for assembling scanned COSE chunks\n const qrChunksBufferRef = React.useRef({ id: null, total: 0, seen: new Set(), items: [] });\n\n const generateQRCode = async (data) => {\n try {\n const originalSize = typeof data === 'string' ? data.length : JSON.stringify(data).length;\n console.log(`\uD83D\uDCCA Original QR Code data size: ${originalSize} characters`);\n // Small payload: \u043F\u0440\u044F\u043C\u043E\u0439 JSON \u0432 \u043E\u0434\u0438\u043D QR (\u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044F, \u0431\u0435\u0437 \u043E\u0431\u0451\u0440\u0442\u043E\u043A)\n const payload = typeof data === 'string' ? data : JSON.stringify(data);\n const isDesktop = (typeof window !== 'undefined') && ((window.innerWidth || 0) >= 1024);\n const QR_SIZE = isDesktop ? 720 : 512;\n if (payload.length <= MAX_QR_LEN) {\n if (!window.generateQRCode) throw new Error('QR code generator unavailable');\n stopQrAnimation();\n const qrDataUrl = await window.generateQRCode(payload, { errorCorrectionLevel: 'M', size: QR_SIZE, margin: 2 });\n setQrCodeUrl(qrDataUrl);\n setQrFramesTotal(1);\n setQrFrameIndex(1);\n return;\n }\n\n // \u0411\u043E\u043B\u044C\u0448\u043E\u0439 payload: RAW \u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 QR \u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044F\n console.log('\uD83C\uDF9E\uFE0F Using RAW animated QR frames (no compression)');\n stopQrAnimation();\n const id = `raw_${Date.now()}_${Math.random().toString(36).slice(2)}`;\n \n // \u041F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043C \u043D\u0430 10 \u0447\u0430\u0441\u0442\u0435\u0439 \u0434\u043B\u044F \u043B\u0443\u0447\u0448\u0435\u0433\u043E \u0441\u043A\u0430\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\n const TARGET_CHUNKS = 10;\n const FRAME_MAX = Math.max(200, Math.floor(payload.length / TARGET_CHUNKS));\n const total = Math.ceil(payload.length / FRAME_MAX);\n \n console.log(`\uD83D\uDCCA Splitting ${payload.length} chars into ${total} chunks (max ${FRAME_MAX} chars per chunk)`);\n const rawChunks = [];\n for (let i = 0; i < total; i++) {\n const seq = i + 1;\n const part = payload.slice(i * FRAME_MAX, (i + 1) * FRAME_MAX);\n rawChunks.push(JSON.stringify({ hdr: { v: 1, id, seq, total, rt: 'raw' }, body: part }));\n }\n if (!window.generateQRCode) throw new Error('QR code generator unavailable');\n if (rawChunks.length === 1) {\n const url = await window.generateQRCode(rawChunks[0], { errorCorrectionLevel: 'M', margin: 2, size: QR_SIZE });\n setQrCodeUrl(url);\n setQrFramesTotal(1);\n setQrFrameIndex(1);\n return;\n }\n qrAnimationRef.current.chunks = rawChunks;\n qrAnimationRef.current.idx = 0;\n qrAnimationRef.current.active = true;\n setQrFramesTotal(rawChunks.length);\n setQrFrameIndex(1);\n const EC_OPTS = { errorCorrectionLevel: 'M', margin: 2, size: QR_SIZE };\n const renderNext = async () => {\n const { chunks, idx, active } = qrAnimationRef.current;\n if (!active || !chunks.length) return;\n const current = chunks[idx % chunks.length];\n try {\n const url = await window.generateQRCode(current, EC_OPTS);\n setQrCodeUrl(url);\n } catch (e) {\n console.warn('Animated QR render error (raw):', e);\n }\n const nextIdx = (idx + 1) % chunks.length;\n qrAnimationRef.current.idx = nextIdx;\n setQrFrameIndex(nextIdx + 1);\n };\n await renderNext();\n \n // \u0417\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u043C \u0430\u0432\u0442\u043E\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443 \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u043D\u0435 \u0432 \u0440\u0443\u0447\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435\n if (!qrManualMode) {\n const ua = (typeof navigator !== 'undefined' && navigator.userAgent) ? navigator.userAgent : '';\n const isIOS = /iPhone|iPad|iPod/i.test(ua);\n const intervalMs = 4000; // 4 seconds per frame for better readability\n qrAnimationRef.current.timer = setInterval(renderNext, intervalMs);\n }\n return;\n } catch (error) {\n console.error('QR code generation failed:', error);\n setMessages(prev => [...prev, {\n message: `\u274C QR code generation failed: ${error.message}`,\n type: 'error'\n }]);\n }\n };\n\n const reconstructFromTemplate = (templateData) => {\n // Reconstruct full offer from template\n const fullOffer = {\n type: \"enhanced_secure_offer\",\n version: templateData.version,\n timestamp: templateData.timestamp,\n sessionId: templateData.sessionId,\n connectionId: templateData.connectionId,\n verificationCode: templateData.verificationCode,\n salt: templateData.salt,\n sdp: templateData.sdp,\n keyFingerprints: templateData.keyFingerprints,\n capabilities: templateData.capabilities,\n \n // Reconstruct ECDH key object\n ecdhPublicKey: {\n keyType: \"ECDH\",\n keyData: templateData.ecdhKeyData,\n timestamp: templateData.timestamp - 1000, // Approximate\n version: templateData.version,\n signature: templateData.ecdhSignature\n },\n \n // Reconstruct ECDSA key object\n ecdsaPublicKey: {\n keyType: \"ECDSA\",\n keyData: templateData.ecdsaKeyData,\n timestamp: templateData.timestamp - 999, // Approximate\n version: templateData.version,\n signature: templateData.ecdsaSignature\n },\n \n // Reconstruct auth challenge\n authChallenge: {\n challenge: templateData.authChallenge,\n timestamp: templateData.timestamp,\n nonce: templateData.authNonce,\n version: templateData.version\n },\n \n // Generate security level (can be recalculated)\n securityLevel: {\n level: \"CRITICAL\",\n score: 20,\n color: \"red\",\n verificationResults: {\n encryption: { passed: false, details: \"Encryption not working\", points: 0 },\n keyExchange: { passed: true, details: \"Simple key exchange verified\", points: 15 },\n messageIntegrity: { passed: false, details: \"Message integrity failed\", points: 0 },\n rateLimiting: { passed: true, details: \"Rate limiting active\", points: 5 },\n ecdsa: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n metadataProtection: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n pfs: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n nestedEncryption: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n packetPadding: { passed: false, details: \"Enhanced session required - feature not available\", points: 0 },\n advancedFeatures: { passed: false, details: \"Premium session required - feature not available\", points: 0 }\n },\n timestamp: templateData.timestamp,\n details: \"Real verification: 20/100 security checks passed (2/4 available)\",\n isRealData: true,\n passedChecks: 2,\n totalChecks: 4,\n sessionType: \"demo\",\n maxPossibleScore: 50\n }\n };\n \n return fullOffer;\n };\n\n const handleQRScan = async (scannedData) => {\n try {\n console.log('\uD83D\uDD0D Processing scanned QR data...');\n console.log('\uD83D\uDCCA Current mode - showOfferStep:', showOfferStep);\n console.log('\uD83D\uDCCA Scanned data length:', scannedData.length);\n console.log('\uD83D\uDCCA Scanned data first 100 chars:', scannedData.substring(0, 100));\n console.log('\uD83D\uDCCA window.receiveAndProcess available:', !!window.receiveAndProcess);\n \n // Try to parse as JSON first\n const parsedData = JSON.parse(scannedData);\n console.log('\uD83D\uDCCA Parsed data structure:', parsedData);\n \n // QR with hdr/body: COSE or RAW animated frames\n if (parsedData.hdr && parsedData.body) {\n const { hdr } = parsedData;\n // Initialize/rotate buffer by id\n if (!qrChunksBufferRef.current.id || qrChunksBufferRef.current.id !== hdr.id) {\n qrChunksBufferRef.current = { id: hdr.id, total: hdr.total || 1, seen: new Set(), items: [], lastUpdateMs: Date.now() };\n try {\n document.dispatchEvent(new CustomEvent('qr-scan-progress', { detail: { id: hdr.id, seq: 0, total: hdr.total || 1 } }));\n } catch {}\n }\n // Deduplicate & record\n if (!qrChunksBufferRef.current.seen.has(hdr.seq)) {\n qrChunksBufferRef.current.seen.add(hdr.seq);\n qrChunksBufferRef.current.items.push(scannedData);\n qrChunksBufferRef.current.lastUpdateMs = Date.now();\n }\n // Emit progress based on unique frames captured\n try {\n const uniqueCount = qrChunksBufferRef.current.seen.size;\n document.dispatchEvent(new CustomEvent('qr-scan-progress', { detail: { id: hdr.id, seq: uniqueCount, total: qrChunksBufferRef.current.total || hdr.total || 0 } }));\n } catch {}\n const isComplete = qrChunksBufferRef.current.seen.size >= (qrChunksBufferRef.current.total || 1);\n if (!isComplete) {\n // Explicitly keep scanner open\n return Promise.resolve(false);\n }\n // Completed: decide RAW vs COSE\n if (hdr.rt === 'raw') {\n try {\n // Sort by seq and concatenate bodies\n const parts = qrChunksBufferRef.current.items\n .map(s => JSON.parse(s))\n .sort((a, b) => (a.hdr.seq || 0) - (b.hdr.seq || 0))\n .map(p => p.body || '');\n const fullText = parts.join('');\n const payloadObj = JSON.parse(fullText);\n if (showOfferStep) {\n setAnswerInput(JSON.stringify(payloadObj, null, 2));\n } else {\n setOfferInput(JSON.stringify(payloadObj, null, 2));\n }\n setMessages(prev => [...prev, { message: '\u2705 All frames captured. RAW payload reconstructed.', type: 'success' }]);\n try { document.dispatchEvent(new CustomEvent('qr-scan-complete', { detail: { id: hdr.id } })); } catch {}\n // Close scanner from caller by returning true\n qrChunksBufferRef.current = { id: null, total: 0, seen: new Set(), items: [] };\n setShowQRScannerModal(false);\n return Promise.resolve(true);\n } catch (e) {\n console.warn('RAW multi-frame reconstruction failed:', e);\n return Promise.resolve(false);\n }\n } else if (window.receiveAndProcess) {\n try {\n const results = await window.receiveAndProcess(qrChunksBufferRef.current.items);\n if (results.length > 0) {\n const { payloadObj } = results[0];\n if (showOfferStep) {\n setAnswerInput(JSON.stringify(payloadObj, null, 2));\n } else {\n setOfferInput(JSON.stringify(payloadObj, null, 2));\n }\n setMessages(prev => [...prev, { message: '\u2705 All frames captured. COSE payload reconstructed.', type: 'success' }]);\n try { document.dispatchEvent(new CustomEvent('qr-scan-complete', { detail: { id: hdr.id } })); } catch {}\n qrChunksBufferRef.current = { id: null, total: 0, seen: new Set(), items: [] };\n setShowQRScannerModal(false);\n return Promise.resolve(true);\n }\n } catch (e) {\n console.warn('COSE multi-chunk processing failed:', e);\n }\n return Promise.resolve(false);\n } else {\n return Promise.resolve(false);\n }\n }\n \n // Check if this is a template-based QR code\n if (parsedData.type === 'enhanced_secure_offer_template') {\n console.log('QR scan: Template-based offer detected, reconstructing...');\n const fullOffer = reconstructFromTemplate(parsedData);\n \n // Determine which input to populate based on current mode\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n setAnswerInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Template data populated to answerInput (waiting for response mode)');\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n setOfferInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Template data populated to offerInput (paste invitation mode)');\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully! Full offer reconstructed from template.',\n type: 'success'\n }]);\n setShowQRScannerModal(false); // Close QR scanner modal\n return true;\n }\n // Check if this is a reference-based QR code\n else if (parsedData.type === 'secure_offer_reference' && parsedData.referenceId) {\n // Try to get the full offer data from localStorage\n const fullOfferData = localStorage.getItem(`qr_offer_${parsedData.referenceId}`);\n if (fullOfferData) {\n const fullOffer = JSON.parse(fullOfferData);\n // Determine which input to populate based on current mode\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n setAnswerInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Reference data populated to answerInput (waiting for response mode)');\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n setOfferInput(JSON.stringify(fullOffer, null, 2));\n console.log('\uD83D\uDCF1 Reference data populated to offerInput (paste invitation mode)');\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully! Full offer data retrieved.',\n type: 'success'\n }]);\n setShowQRScannerModal(false); // Close QR scanner modal\n return true;\n } else {\n setMessages(prev => [...prev, {\n message: '\u274C QR code reference found but full data not available. Please use copy/paste.',\n type: 'error'\n }]);\n return false;\n }\n } else {\n // Check if this is compressed data (missing SDP)\n if (!parsedData.sdp) {\n setMessages(prev => [...prev, {\n message: '\u26A0\uFE0F QR code contains compressed data (SDP removed). Please use copy/paste for full data.',\n type: 'warning'\n }]);\n }\n \n // Determine which input to populate based on current mode\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n console.log('QR scan: Populating answerInput with:', parsedData);\n setAnswerInput(JSON.stringify(parsedData, null, 2));\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n console.log('QR scan: Populating offerInput with:', parsedData);\n setOfferInput(JSON.stringify(parsedData, null, 2));\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully!',\n type: 'success'\n }]);\n setShowQRScannerModal(false);\n return true;\n }\n } catch (error) {\n // If not JSON, use as plain text\n if (showOfferStep) {\n // In \"Waiting for peer's response\" mode - populate answerInput\n setAnswerInput(scannedData);\n } else {\n // In \"Paste secure invitation\" mode - populate offerInput\n setOfferInput(scannedData);\n }\n setMessages(prev => [...prev, {\n message: '\uD83D\uDCF1 QR code scanned successfully!',\n type: 'success'\n }]);\n setShowQRScannerModal(false);\n return true;\n }\n };\n \n const handleCreateOffer = async () => {\n try {\n console.log('\uD83C\uDFAF handleCreateOffer called');\n // All security features are enabled by default\n \n setOfferData('');\n setShowOfferStep(false);\n setShowQRCode(false);\n setQrCodeUrl('');\n \n console.log('\uD83C\uDFAF Calling createSecureOffer...');\n const offer = await webrtcManagerRef.current.createSecureOffer();\n console.log('\uD83C\uDFAF createSecureOffer returned:', offer ? 'success' : 'null');\n \n // Store offer data directly (no encryption needed with SAS)\n setOfferData(offer);\n setShowOfferStep(true);\n \n // Generate QR code for the offer data\n // Use compact JSON (no pretty-printing) to reduce size\n const offerString = typeof offer === 'object' ? JSON.stringify(offer) : offer;\n console.log('Generating QR code for data length:', offerString.length);\n console.log('First 100 chars of offer data:', offerString.substring(0, 100));\n await generateQRCode(offerString);\n \n const existingMessages = messages.filter(m => \n m.type === 'system' && \n (m.message.includes('Secure invitation created') || m.message.includes('Send the encrypted code'))\n );\n \n if (existingMessages.length === 0) {\n setMessages(prev => [...prev, { \n message: '\uD83D\uDD10 Secure invitation created and encrypted!', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n setMessages(prev => [...prev, { \n message: '\uD83D\uDCE4 Send the invitation code to your interlocutor via a secure channel (voice call, SMS, etc.)..', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n }\n \n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } catch (error) {\n setMessages(prev => [...prev, { \n message: `\u274C Error creating invitation: ${error.message}`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n };\n \n const handleCreateAnswer = async () => {\n try {\n console.log('handleCreateAnswer called, offerInput:', offerInput);\n console.log('offerInput.trim():', offerInput.trim());\n console.log('offerInput.trim() length:', offerInput.trim().length);\n \n if (!offerInput.trim()) {\n setMessages(prev => [...prev, { \n message: '\u26A0\uFE0F You need to insert the invitation code from your interlocutor.', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n return;\n }\n \n try {\n setMessages(prev => [...prev, { \n message: '\uD83D\uDD04 Processing the secure invitation...', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n let offer;\n try {\n // Parse the offer data directly (no decryption needed with SAS)\n offer = JSON.parse(offerInput.trim());\n } catch (parseError) {\n throw new Error(`Invalid invitation format: ${parseError.message}`);\n }\n \n if (!offer || typeof offer !== 'object') {\n throw new Error('The invitation must be an object');\n }\n \n // Support both compact and legacy offer formats\n const isValidOfferType = (offer.t === 'offer') || (offer.type === 'enhanced_secure_offer');\n if (!isValidOfferType) {\n throw new Error('Invalid invitation type. Expected offer or enhanced_secure_offer');\n }\n \n console.log('Creating secure answer for offer:', offer);\n const answer = await webrtcManagerRef.current.createSecureAnswer(offer);\n console.log('Secure answer created:', answer);\n \n // Store answer data directly (no encryption needed with SAS)\n setAnswerData(answer);\n setShowAnswerStep(true);\n \n // Generate QR code for the answer data\n const answerString = typeof answer === 'object' ? JSON.stringify(answer) : answer;\n console.log('Generating QR code for answer data length:', answerString.length);\n console.log('First 100 chars of answer data:', answerString.substring(0, 100));\n await generateQRCode(answerString);\n \n // Mark answer as created for state management\n markAnswerCreated();\n \n const existingResponseMessages = messages.filter(m => \n m.type === 'system' && \n (m.message.includes('Secure response created') || m.message.includes('Send the response'))\n );\n \n if (existingResponseMessages.length === 0) {\n setMessages(prev => [...prev, { \n message: '\u2705 Secure response created!', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n setMessages(prev => [...prev, { \n message: '\uD83D\uDCE4 Send the response code to the initiator via a secure channel or let them scan the QR code below.', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n }\n \n // Update security level after creating answer\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } catch (error) {\n console.error('Error in handleCreateAnswer:', error);\n setMessages(prev => [...prev, { \n message: `\u274C Error processing the invitation: ${error.message}`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n } catch (error) {\n console.error('Error in handleCreateAnswer:', error);\n setMessages(prev => [...prev, { \n message: `\u274C Invitation processing error: ${error.message}`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n };\n \n const handleConnect = async () => {\n try {\n if (!answerInput.trim()) {\n setMessages(prev => [...prev, { \n message: '\u26A0\uFE0F You need to insert the response code from your interlocutor.', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n return;\n }\n \n try {\n setMessages(prev => [...prev, { \n message: '\uD83D\uDD04 Processing the secure response...', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n let answer;\n try {\n // Parse the answer data directly (no decryption needed with SAS)\n answer = JSON.parse(answerInput.trim());\n } catch (parseError) {\n throw new Error(`Invalid response format: ${parseError.message}`);\n }\n \n if (!answer || typeof answer !== 'object') {\n throw new Error('The response must be an object');\n }\n \n // Support both compact and legacy formats\n const answerType = answer.t || answer.type;\n if (!answerType || (answerType !== 'answer' && answerType !== 'enhanced_secure_answer')) {\n throw new Error('Invalid response type. Expected answer or enhanced_secure_answer');\n }\n \n await webrtcManagerRef.current.handleSecureAnswer(answer);\n \n // All security features are enabled by default - no session activation needed\n if (pendingSession) {\n setPendingSession(null);\n setMessages(prev => [...prev, { \n message: `\u2705 All security features enabled by default`, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n }\n \n setMessages(prev => [...prev, { \n message: '\uD83D\uDD04 Finalizing the secure connection...', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n // Update security level after handling answer\n if (!window.isUpdatingSecurity) {\n updateSecurityLevel().catch(console.error);\n }\n } catch (error) {\n console.error('Error in handleConnect inner try:', error);\n \n // \u0411\u043E\u043B\u0435\u0435 \u0434\u0435\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A\n let errorMessage = 'Connection setup error';\n if (error.message.includes('CRITICAL SECURITY FAILURE')) {\n if (error.message.includes('ECDH public key structure')) {\n errorMessage = '\uD83D\uDD11 Invalid response code - missing or corrupted cryptographic key. Please check the code and try again.';\n } else if (error.message.includes('ECDSA public key structure')) {\n errorMessage = '\uD83D\uDD10 Invalid response code - missing signature verification key. Please check the code and try again.';\n } else {\n errorMessage = '\uD83D\uDD12 Security validation failed - possible attack detected';\n }\n } else if (error.message.includes('too old') || error.message.includes('replay')) {\n errorMessage = '\u23F0 Response data is outdated - please use a fresh invitation';\n } else if (error.message.includes('MITM') || error.message.includes('signature')) {\n errorMessage = '\uD83D\uDEE1\uFE0F Security breach detected - connection rejected';\n } else if (error.message.includes('Invalid') || error.message.includes('format')) {\n errorMessage = '\uD83D\uDCDD Invalid response format - please check the code';\n } else {\n errorMessage = `\u274C ${error.message}`;\n }\n \n setMessages(prev => [...prev, { \n message: errorMessage, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now(),\n showRetryButton: true\n }]);\n \n // \u0421\u0431\u0440\u043E\u0441 \u0441\u0435\u0441\u0441\u0438\u0438 \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043E\u0448\u0438\u0431\u043E\u043A \u043A\u0440\u043E\u043C\u0435 replay attack\n if (!error.message.includes('too old') && !error.message.includes('replay')) {\n setPendingSession(null);\n setSessionTimeLeft(0);\n }\n \n // \u0423\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u043C \u0441\u0442\u0430\u0442\u0443\u0441 failed \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432 \u0445\u0435\u0434\u0435\u0440\u0435\n setConnectionStatus('failed');\n \n // \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438\n console.log('\uD83D\uDEA8 Error occurred, but keeping connection status as connecting:');\n console.log(' - errorMessage:', error.message);\n console.log(' - connectionStatus:', 'connecting (kept)');\n console.log(' - isVerified:', false);\n console.log(' - willShowChat:', keyFingerprint && keyFingerprint !== '');\n } \n } catch (error) {\n console.error('Error in handleConnect outer try:', error);\n \n // \u0411\u043E\u043B\u0435\u0435 \u0434\u0435\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A\n let errorMessage = 'Connection setup error';\n if (error.message.includes('CRITICAL SECURITY FAILURE')) {\n if (error.message.includes('ECDH public key structure')) {\n errorMessage = '\uD83D\uDD11 Invalid response code - missing or corrupted cryptographic key. Please check the code and try again.';\n } else if (error.message.includes('ECDSA public key structure')) {\n errorMessage = '\uD83D\uDD10 Invalid response code - missing signature verification key. Please check the code and try again.';\n } else {\n errorMessage = '\uD83D\uDD12 Security validation failed - possible attack detected';\n }\n } else if (error.message.includes('too old') || error.message.includes('replay')) {\n errorMessage = '\u23F0 Response data is outdated - please use a fresh invitation';\n } else if (error.message.includes('MITM') || error.message.includes('signature')) {\n errorMessage = '\uD83D\uDEE1\uFE0F Security breach detected - connection rejected';\n } else if (error.message.includes('Invalid') || error.message.includes('format')) {\n errorMessage = '\uD83D\uDCDD Invalid response format - please check the code';\n } else {\n errorMessage = `\u274C ${error.message}`;\n }\n \n setMessages(prev => [...prev, { \n message: errorMessage, \n type: 'system',\n id: Date.now(),\n timestamp: Date.now(),\n showRetryButton: true\n }]);\n \n // \u0421\u0431\u0440\u043E\u0441 \u0441\u0435\u0441\u0441\u0438\u0438 \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043E\u0448\u0438\u0431\u043E\u043A \u043A\u0440\u043E\u043C\u0435 replay attack\n if (!error.message.includes('too old') && !error.message.includes('replay')) {\n setPendingSession(null);\n setSessionTimeLeft(0);\n }\n \n // \u0423\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u043C \u0441\u0442\u0430\u0442\u0443\u0441 failed \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432 \u0445\u0435\u0434\u0435\u0440\u0435\n setConnectionStatus('failed');\n \n // \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438\n console.log('\uD83D\uDEA8 Error occurred in outer catch, but keeping connection status as connecting:');\n console.log(' - errorMessage:', error.message);\n console.log(' - connectionStatus:', 'connecting (kept)');\n console.log(' - isVerified:', false);\n console.log(' - willShowChat:', keyFingerprint && keyFingerprint !== '');\n }\n };\n \n const handleVerifyConnection = (isValid) => {\n if (isValid) {\n webrtcManagerRef.current.confirmVerification();\n // Mark local verification as confirmed\n setLocalVerificationConfirmed(true);\n } else {\n setMessages(prev => [...prev, { \n message: '\u274C Verification rejected. The connection is unsafe! Session reset..', \n type: 'system',\n id: Date.now(),\n timestamp: Date.now()\n }]);\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n setShowVerification(false);\n setVerificationCode('');\n \n // Reset UI to initial state\n setConnectionStatus('disconnected');\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setKeyFingerprint('');\n setSecurityLevel(null);\n setIsVerified(false);\n setMessages([]);\n \n setSessionTimeLeft(0);\n setPendingSession(null);\n \n // Dispatch disconnected event for SessionTimer\n document.dispatchEvent(new CustomEvent('disconnected'));\n \n handleDisconnect();\n }\n };\n \n const handleSendMessage = async () => {\n if (!messageInput.trim()) {\n return;\n }\n \n if (!webrtcManagerRef.current) {\n return;\n }\n \n if (!webrtcManagerRef.current.isConnected()) {\n return;\n }\n \n try {\n \n // Add the message to local messages immediately (sent message)\n addMessageWithAutoScroll(messageInput.trim(), 'sent');\n \n // Use sendMessage for simple text messages instead of sendSecureMessage\n await webrtcManagerRef.current.sendMessage(messageInput);\n setMessageInput('');\n } catch (error) {\n const msg = String(error?.message || error);\n if (!/queued for sending|Data channel not ready/i.test(msg)) {\n addMessageWithAutoScroll(`\u274C Sending error: ${msg}`,'system');\n }\n }\n };\n \n const handleClearData = () => {\n // \u041E\u0447\u0438\u0449\u0430\u0435\u043C \u0432\u0441\u0435 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u044F \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F\n setOfferData('');\n setAnswerData('');\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n \n // \u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u043C showAnswerStep \u0435\u0441\u043B\u0438 \u0435\u0441\u0442\u044C QR \u043A\u043E\u0434 \u043E\u0442\u0432\u0435\u0442\u0430\n if (!shouldPreserveAnswerData()) {\n setShowAnswerStep(false);\n }\n \n setShowVerification(false);\n setShowQRCode(false);\n setShowQRScanner(false);\n setShowQRScannerModal(false);\n \n // \u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u043C QR \u043A\u043E\u0434 \u043E\u0442\u0432\u0435\u0442\u0430, \u0435\u0441\u043B\u0438 \u043E\u043D \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D\n // (\u043D\u0435 \u0441\u0431\u0440\u0430\u0441\u044B\u0432\u0430\u0435\u043C qrCodeUrl \u0435\u0441\u043B\u0438 \u0435\u0441\u0442\u044C \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442)\n if (!shouldPreserveAnswerData()) {\n setQrCodeUrl('');\n }\n \n setVerificationCode('');\n setIsVerified(false);\n setKeyFingerprint('');\n setSecurityLevel(null);\n setConnectionStatus('disconnected');\n setMessages([]);\n setMessageInput('');\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // PAKE passwords removed - using SAS verification instead \n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u043E\u0447\u0438\u0441\u0442\u043A\u0435 \u0434\u0430\u043D\u043D\u044B\u0445\n // \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0433 \u0432\u0438\u0434\u0435\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438\n // if (typeof console.clear === 'function') {\n // console.clear();\n // }\n \n // Cleanup session state\n setSessionTimeLeft(0);\n \n setPendingSession(null);\n document.dispatchEvent(new CustomEvent('peer-disconnect'));\n // Session manager removed - all features enabled by default\n };\n \n const handleDisconnect = () => {\n setSessionTimeLeft(0);\n \n // Mark as user-initiated disconnect\n updateConnectionState({ \n status: 'disconnected',\n isUserInitiatedDisconnect: true \n });\n \n // Cleanup session state\n if (webrtcManagerRef.current) {\n webrtcManagerRef.current.disconnect();\n }\n \n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n setIsVerified(false);\n setShowVerification(false);\n setConnectionStatus('disconnected');\n \n // Clear verification states\n setLocalVerificationConfirmed(false);\n setRemoteVerificationConfirmed(false);\n setBothVerificationsConfirmed(false);\n \n // Reset UI to initial state (user-initiated disconnect always clears data)\n setConnectionStatus('disconnected');\n setShowVerification(false);\n setOfferData(null);\n setAnswerData(null);\n setOfferInput('');\n setAnswerInput('');\n setShowOfferStep(false);\n setShowAnswerStep(false);\n setKeyFingerprint('');\n setVerificationCode('');\n setSecurityLevel(null);\n setIsVerified(false);\n \n setMessages([]);\n \n // \u041D\u0435 \u043E\u0447\u0438\u0449\u0430\u0435\u043C \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u043F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438\n // \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0433 \u0432\u0438\u0434\u0435\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438\n // if (typeof console.clear === 'function') {\n // console.clear();\n // }\n \n document.dispatchEvent(new CustomEvent('peer-disconnect'));\n document.dispatchEvent(new CustomEvent('disconnected'));\n \n document.dispatchEvent(new CustomEvent('session-cleanup', {\n detail: { \n timestamp: Date.now(),\n reason: 'manual_disconnect'\n }\n }));\n \n setTimeout(() => {\n setSessionTimeLeft(0);\n }, 500);\n \n handleClearData();\n \n setTimeout(() => {\n // Session manager removed - all features enabled by default\n }, 1000);\n };\n \n const handleSessionActivated = (session) => {\n let message;\n if (session.type === 'demo') {\n message = `\uD83C\uDFAE Demo session activated for 6 minutes. You can create invitations!`;\n } else {\n message = `\u2705 All security features enabled by default. You can create invitations!`;\n }\n \n addMessageWithAutoScroll(message, 'system');\n \n };\n \n React.useEffect(() => {\n if (connectionStatus === 'connected' && isVerified) {\n addMessageWithAutoScroll('\uD83C\uDF89 Secure connection successfully established and verified! You can now communicate safely with full protection against MITM attacks and Perfect Forward Secrecy..', 'system');\n \n }\n }, [connectionStatus, isVerified]);\n \n const isConnectedAndVerified = (connectionStatus === 'connected' || connectionStatus === 'verified') && isVerified;\n \n // \u041E\u0442\u043B\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u0434\u043B\u044F \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438 \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0447\u0430\u0442\u0430\n console.log('\uD83D\uDD0D Chat activation check:');\n console.log(' - connectionStatus:', connectionStatus);\n console.log(' - isVerified:', isVerified);\n console.log(' - keyFingerprint:', keyFingerprint);\n console.log(' - isConnectedAndVerified:', isConnectedAndVerified);\n console.log(' - bothVerificationsConfirmed:', bothVerificationsConfirmed);\n console.log(' - localVerificationConfirmed:', localVerificationConfirmed);\n console.log(' - remoteVerificationConfirmed:', remoteVerificationConfirmed);\n \n React.useEffect(() => {\n // All security features are enabled by default - no session activation needed\n if (isConnectedAndVerified && pendingSession && connectionStatus !== 'failed') {\n setPendingSession(null);\n setSessionTimeLeft(0); \n addMessageWithAutoScroll('\u2705 All security features enabled by default', 'system');\n }\n }, [isConnectedAndVerified, pendingSession, connectionStatus]);\n \n return React.createElement('div', { \n className: \"minimal-bg min-h-screen\" \n }, [\n React.createElement(EnhancedMinimalHeader, {\n key: 'header',\n status: connectionStatus,\n fingerprint: keyFingerprint,\n verificationCode: verificationCode,\n onDisconnect: handleDisconnect,\n isConnected: isConnectedAndVerified,\n securityLevel: securityLevel,\n // sessionManager removed - all features enabled by default\n sessionTimeLeft: sessionTimeLeft,\n webrtcManager: webrtcManagerRef.current\n }),\n \n React.createElement('main', {\n key: 'main'\n }, \n (() => {\n console.log('\uD83D\uDD0D Main render decision:', {\n isConnectedAndVerified,\n connectionStatus,\n isVerified,\n keyFingerprint: !!keyFingerprint\n });\n return isConnectedAndVerified;\n })()\n ? (() => {\n console.log('\uD83D\uDD0D Passing scrollToBottom to EnhancedChatInterface:', typeof scrollToBottom, scrollToBottom);\n return React.createElement(EnhancedChatInterface, {\n messages: messages,\n messageInput: messageInput,\n setMessageInput: setMessageInput,\n onSendMessage: handleSendMessage,\n onDisconnect: handleDisconnect,\n keyFingerprint: keyFingerprint,\n isVerified: isVerified,\n chatMessagesRef: chatMessagesRef,\n scrollToBottom: scrollToBottom,\n webrtcManager: webrtcManagerRef.current\n });\n })()\n : React.createElement(EnhancedConnectionSetup, {\n onCreateOffer: handleCreateOffer,\n onCreateAnswer: handleCreateAnswer,\n onConnect: handleConnect,\n onClearData: handleClearData,\n onVerifyConnection: handleVerifyConnection,\n connectionStatus: connectionStatus,\n offerData: offerData,\n answerData: answerData,\n offerInput: offerInput,\n setOfferInput: setOfferInput,\n answerInput: answerInput,\n setAnswerInput: setAnswerInput,\n showOfferStep: showOfferStep,\n showAnswerStep: showAnswerStep,\n verificationCode: verificationCode,\n showVerification: showVerification,\n showQRCode: showQRCode,\n qrCodeUrl: qrCodeUrl,\n showQRScanner: showQRScanner,\n setShowQRCode: setShowQRCode,\n setShowQRScanner: setShowQRScanner,\n setShowQRScannerModal: setShowQRScannerModal,\n messages: messages,\n localVerificationConfirmed: localVerificationConfirmed,\n remoteVerificationConfirmed: remoteVerificationConfirmed,\n bothVerificationsConfirmed: bothVerificationsConfirmed,\n // QR control props\n qrFramesTotal: qrFramesTotal,\n qrFrameIndex: qrFrameIndex,\n qrManualMode: qrManualMode,\n toggleQrManualMode: toggleQrManualMode,\n nextQrFrame: nextQrFrame,\n prevQrFrame: prevQrFrame,\n // PAKE passwords removed - using SAS verification instead\n })\n ),\n \n // PAKE Password Modal removed - using SAS verification instead\n \n // Payment Modal removed - all security features enabled by default\n\n (() => {\n console.log('Rendering QRScanner, showQRScannerModal:', showQRScannerModal, 'QRScanner available:', !!window.QRScanner);\n return window.QRScanner ? React.createElement(window.QRScanner, {\n key: 'qr-scanner-modal',\n onScan: handleQRScan,\n onClose: () => setShowQRScannerModal(false),\n isVisible: showQRScannerModal,\n continuous: true\n }) : React.createElement('div', {\n key: 'qr-scanner-error',\n className: \"hidden\"\n }, 'QRScanner not loaded');\n })()\n ]);\n };\n function initializeApp() {\n if (window.EnhancedSecureCryptoUtils && window.EnhancedSecureWebRTCManager) {\n ReactDOM.render(React.createElement(EnhancedSecureP2PChat), document.getElementById('root'));\n } else {\n console.error('\u274C \u041C\u043E\u0434\u0443\u043B\u0438 \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u044B:', {\n hasCrypto: !!window.EnhancedSecureCryptoUtils,\n hasWebRTC: !!window.EnhancedSecureWebRTCManager\n });\n }\n }\n // \u0413\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0439 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u043E\u0448\u0438\u0431\u043E\u043A \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u044F \u043E\u0448\u0438\u0431\u043E\u043A \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C\n if (typeof window !== 'undefined') {\n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u043D\u0435\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043D\u044B\u0445 \u043F\u0440\u043E\u043C\u0438\u0441\u043E\u0432\n window.addEventListener('unhandledrejection', (event) => {\n console.error('\uD83D\uDEA8 Unhandled promise rejection:', event.reason);\n event.preventDefault(); // \u041F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u043C \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u0435 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\n });\n \n // \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0445 \u043E\u0448\u0438\u0431\u043E\u043A\n window.addEventListener('error', (event) => {\n console.error('\uD83D\uDEA8 Global error:', event.error);\n event.preventDefault(); // \u041F\u0440\u0435\u0434\u043E\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u043C \u043F\u043E\u043F\u0430\u0434\u0430\u043D\u0438\u0435 \u0432 \u043A\u043E\u043D\u0441\u043E\u043B\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\n });\n \n if (!window.initializeApp) {\n window.initializeApp = initializeApp;\n }\n }\n // Render Enhanced Application\n ReactDOM.render(React.createElement(EnhancedSecureP2PChat), document.getElementById('root'));"], + "mappings": ";AAGQ,IAAM,sBAAsB,MAAM;AAC9B,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAS,CAAC;AAExD,QAAM,SAAS;AAAA,IACX;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,MACI,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,aAAa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WAAW,CAAC,CAAC,OAAO;AAAA,MACpB,WAAW,CAAC,CAAC,OAAO;AAAA,IACxB,CAAC;AAAA,EACL;AACJ;AAEA,IAAI,OAAO,WAAW,aAAa;AAE/B,SAAO,iBAAiB,sBAAsB,CAAC,UAAU;AACrD,YAAQ,MAAM,0CAAmC,MAAM,MAAM;AAC7D,UAAM,eAAe;AAAA,EACzB,CAAC;AAGD,SAAO,iBAAiB,SAAS,CAAC,UAAU;AACxC,YAAQ,MAAM,2BAAoB,MAAM,KAAK;AAC7C,UAAM,eAAe;AAAA,EACzB,CAAC;AAED,MAAI,CAAC,OAAO,eAAe;AACvB,WAAO,gBAAgB;AAAA,EAC3B;AACJ;AAEA,SAAS,OAAO,MAAM,cAAc,qBAAqB,GAAG,SAAS,eAAe,MAAM,CAAC;", "names": ["markAnswerCreated", "offerData", "generateQRCode", "renderNext"] } diff --git a/index.html b/index.html index f00a2ea..341b68b 100644 --- a/index.html +++ b/index.html @@ -72,7 +72,7 @@ - + diff --git a/manifest.json b/manifest.json index 16b182a..babff8b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name": "SecureBit.chat v4.02.985 - ECDH + DTLS + SAS", + "name": "SecureBit.chat v4.2.12 - ECDH + DTLS + SAS", "short_name": "SecureBit", "description": "P2P messenger with ECDH + DTLS + SAS security, military-grade cryptography and Lightning Network payments", "start_url": "./", diff --git a/public.zip b/public.zip deleted file mode 100644 index 71f0ba4..0000000 Binary files a/public.zip and /dev/null differ diff --git a/src/app.jsx b/src/app.jsx index 31b66fd..070490e 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -532,7 +532,7 @@
🚀 - Enhanced Security Edition v4.02.985 - ECDH + DTLS + SAS - + Enhanced Security Edition v4.2.12 - ECDH + DTLS + SAS - Active Production Release | Next: v5.0 Post-Quantum
@@ -619,7 +619,7 @@ // current and future phases { - version: "v4.02.985", + version: "v4.2.12", title: "Enhanced Security Edition", status: "current", date: "Now", @@ -2937,7 +2937,7 @@ handleVerificationStateChange ); - handleMessage('🚀 SecureBit.chat Enhanced Security Edition v4.02.985 - ECDH + DTLS + SAS initialized. Ready to establish a secure connection with ECDH key exchange, DTLS fingerprint verification, and SAS authentication to prevent MITM attacks.', 'system'); + handleMessage('🚀 SecureBit.chat Enhanced Security Edition v4.2.12 - ECDH + DTLS + SAS initialized. Ready to establish a secure connection with ECDH key exchange, DTLS fingerprint verification, and SAS authentication to prevent MITM attacks.', 'system'); const handleBeforeUnload = (event) => { if (event.type === 'beforeunload' && !isTabSwitching) { diff --git a/src/components/ui/DownloadApps.jsx b/src/components/ui/DownloadApps.jsx index a7c2278..2291f86 100644 --- a/src/components/ui/DownloadApps.jsx +++ b/src/components/ui/DownloadApps.jsx @@ -1,7 +1,7 @@ const DownloadApps = () => { const apps = [ { id: 'web', name: 'Web App', subtitle: 'Browser Version', icon: 'fas fa-globe', platform: 'Web', isActive: true, url: 'https://securebitchat.github.io/securebit-chat/', color: 'green' }, - { id: 'windows', name: 'Windows', subtitle: 'Desktop App', icon: 'fab fa-windows', platform: 'Desktop', isActive: false, url: '#', color: 'blue' }, + { id: 'windows', name: 'Windows', subtitle: 'Desktop App', icon: 'fab fa-windows', platform: 'Desktop', isActive: true, url: 'https://securebit.chat/download/windows/SecureBit%20Chat%20Setup%204.1.222.exe', color: 'blue' }, { id: 'macos', name: 'macOS', subtitle: 'Desktop App', icon: 'fab fa-apple', platform: 'Desktop', isActive: false, url: '#', color: 'gray' }, { id: 'linux', name: 'Linux', subtitle: 'Desktop App', icon: 'fab fa-linux', platform: 'Desktop', isActive: false, url: '#', color: 'orange' }, { id: 'ios', name: 'iOS', subtitle: 'iPhone & iPad', icon: 'fab fa-apple', platform: 'Mobile', isActive: false, url: 'https://apps.apple.com/app/securebit-chat/', color: 'blue' }, diff --git a/src/components/ui/Header.jsx b/src/components/ui/Header.jsx index 1c0873d..5931294 100644 --- a/src/components/ui/Header.jsx +++ b/src/components/ui/Header.jsx @@ -602,7 +602,7 @@ const EnhancedMinimalHeader = ({ React.createElement('p', { key: 'subtitle', className: 'text-xs sm:text-sm text-muted hidden sm:block' - }, 'End-to-end freedom v4.02.985') + }, 'End-to-end freedom v4.2.12') ]) ]), diff --git a/src/components/ui/SessionTimer.jsx b/src/components/ui/SessionTimer.jsx index 9d69bc7..8ffa8ad 100644 --- a/src/components/ui/SessionTimer.jsx +++ b/src/components/ui/SessionTimer.jsx @@ -1,4 +1,4 @@ -// SessionTimer Component - v4.02.985 - ECDH + DTLS + SAS +// SessionTimer Component - v4.2.12 - ECDH + DTLS + SAS const SessionTimer = ({ timeLeft, sessionType, sessionManager, onDisconnect }) => { const [currentTime, setCurrentTime] = React.useState(timeLeft || 0); const [showExpiredMessage, setShowExpiredMessage] = React.useState(false); diff --git a/src/scripts/pwa-globals.js b/src/scripts/pwa-globals.js index 6ccca6b..045c3c1 100644 --- a/src/scripts/pwa-globals.js +++ b/src/scripts/pwa-globals.js @@ -65,7 +65,7 @@ window.showUpdateNotification = function showUpdateNotification() {
Update Available
-
SecureBit.chat v4.02.985 - ECDH + DTLS + SAS is ready
+
SecureBit.chat v4.2.12 - ECDH + DTLS + SAS is ready