diff --git a/src/crypto/EnhancedSecureCryptoUtils.js b/src/crypto/EnhancedSecureCryptoUtils.js index e7fb7f1..7dbbf87 100644 --- a/src/crypto/EnhancedSecureCryptoUtils.js +++ b/src/crypto/EnhancedSecureCryptoUtils.js @@ -2,10 +2,7 @@ class EnhancedSecureCryptoUtils { static _keyMetadata = new WeakMap(); - // Initialize secure logging system - static { - EnhancedSecureCryptoUtils.secureLog.init(); - } + // Initialize secure logging system after class definition // Utility to sort object keys for deterministic serialization static sortObjectKeys(obj) { @@ -2419,6 +2416,13 @@ class EnhancedSecureCryptoUtils { return result === 0; } + + // Initialize secure logging system after class definition + static { + if (EnhancedSecureCryptoUtils.secureLog && typeof EnhancedSecureCryptoUtils.secureLog.init === 'function') { + EnhancedSecureCryptoUtils.secureLog.init(); + } + } } export { EnhancedSecureCryptoUtils }; \ No newline at end of file diff --git a/src/pwa/offline-manager.js b/src/pwa/offline-manager.js deleted file mode 100644 index 328f957..0000000 --- a/src/pwa/offline-manager.js +++ /dev/null @@ -1,552 +0,0 @@ -// PWA Offline Component for SecureBit.chat -// Handles offline functionality and user experience - -window.PWAOfflineManager = (() => { - 'use strict'; - - class PWAOfflineManager { - constructor() { - this.isOnline = navigator.onLine; - this.offlineQueue = []; - this.syncInProgress = false; - this.offlineIndicator = null; - - this.init(); - } - - init() { - console.log('📴 PWA Offline Manager initializing...'); - - this.setupEventListeners(); - this.createOfflineIndicator(); - this.setupOfflineStorage(); - this.registerBackgroundSync(); - - // Show initial status - this.updateConnectionStatus(this.isOnline); - - console.log('✅ PWA Offline Manager initialized'); - } - - setupEventListeners() { - window.addEventListener('online', () => { - console.log('🌐 Connection restored'); - this.isOnline = true; - this.updateConnectionStatus(true); - this.processOfflineQueue(); - }); - - window.addEventListener('offline', () => { - console.log('📴 Connection lost'); - this.isOnline = false; - this.updateConnectionStatus(false); - this.showOfflineGuidance(); - }); - - // Monitor WebRTC connection status - document.addEventListener('peer-disconnect', () => { - if (!this.isOnline) { - this.handleOfflineDisconnect(); - } - }); - - // Monitor failed network requests - window.addEventListener('unhandledrejection', (event) => { - if (this.isNetworkError(event.reason)) { - this.handleNetworkFailure(event.reason); - } - }); - } - - createOfflineIndicator() { - this.offlineIndicator = document.createElement('div'); - this.offlineIndicator.id = 'pwa-connection-status'; - this.offlineIndicator.className = 'hidden fixed top-4 left-1/2 transform -translate-x-1/2 z-50 transition-all duration-300'; - document.body.appendChild(this.offlineIndicator); - } - - updateConnectionStatus(isOnline) { - if (!this.offlineIndicator) return; - - if (isOnline) { - this.offlineIndicator.innerHTML = ` -
- Your internet connection was lost. SecureBit.chat requires an active connection for secure P2P communication. -
-- - Your messages and actions will be automatically synced when you're back online. -
-