diff --git a/index.html b/index.html index 2804302..5489094 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + SeedPGP v__APP_VERSION__ diff --git a/src/App.tsx b/src/App.tsx index 293d8d0..d93a1bf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -68,7 +68,7 @@ function App() { const [showQRScanner, setShowQRScanner] = useState(false); const [isDragging, setIsDragging] = useState(false); const [isReadOnly, setIsReadOnly] = useState(false); - const [encryptedMnemonicCache, setEncryptedMnemonicCache] = useState(null); + const [_encryptedMnemonicCache, _setEncryptedMnemonicCache] = useState(null); const [showSecurityModal, setShowSecurityModal] = useState(false); const [showStorageModal, setShowStorageModal] = useState(false); const [showClipboardModal, setShowClipboardModal] = useState(false); @@ -88,6 +88,9 @@ function App() { const [seedForBlender, setSeedForBlender] = useState(''); const [blenderResetKey, setBlenderResetKey] = useState(0); + // Network blocking state + const [isNetworkBlocked, setIsNetworkBlocked] = useState(false); + // Entropy generation states const [entropySource, setEntropySource] = useState<'camera' | 'dice' | 'audio' | null>(null); const [entropyStats, setEntropyStats] = useState(null); @@ -335,7 +338,7 @@ function App() { await getSessionKey(); // Encrypt mnemonic with session key and clear plaintext state const blob = await encryptJsonToBlob({ mnemonic, timestamp: Date.now() }); - setEncryptedMnemonicCache(blob); + _setEncryptedMnemonicCache(blob); setMnemonic(''); // Clear plaintext mnemonic // Clear password after successful encryption (security best practice) @@ -441,7 +444,7 @@ function App() { // Encrypt the restored mnemonic with the session key await getSessionKey(); const blob = await encryptJsonToBlob({ mnemonic: result.w, timestamp: Date.now() }); - setEncryptedMnemonicCache(blob); + _setEncryptedMnemonicCache(blob); // Temporarily display the mnemonic and then clear it setDecryptedRestoredMnemonic(result.w); @@ -462,21 +465,28 @@ function App() { } }; - const handleToggleLock = () => { - if (!isReadOnly) { - // About to lock - show confirmation - setShowLockConfirm(true); + const handleToggleNetwork = () => { + setIsNetworkBlocked(!isNetworkBlocked); + + if (!isNetworkBlocked) { + // Block network + console.log('🚫 Network BLOCKED - No external requests allowed'); + // Optional: Override fetch/XMLHttpRequest + if (typeof window !== 'undefined') { + (window as any).__originalFetch = window.fetch; + // Create a mock fetch function with proper type assertion + const mockFetch = (async () => Promise.reject(new Error('Network blocked by user'))) as unknown as typeof window.fetch; + window.fetch = mockFetch; + } } else { - // Unlocking - no confirmation needed - setIsReadOnly(false); + // Unblock network + console.log('🌐 Network ACTIVE'); + if ((window as any).__originalFetch) { + window.fetch = (window as any).__originalFetch; + } } }; - const confirmLock = () => { - setIsReadOnly(true); - setShowLockConfirm(false); - }; - const handleRequestTabChange = (newTab: 'create' | 'backup' | 'restore' | 'seedblender') => { // Allow free navigation - no warnings // User can manually reset Seed Blender with "Reset All" button @@ -501,7 +511,7 @@ function App() { setSeedForBlender(''); // Clear session destroySessionKey(); - setEncryptedMnemonicCache(null); + _setEncryptedMnemonicCache(null); // Go to Create tab (fresh start) // Force SeedBlender to remount (resets its internal state) setBlenderResetKey(prev => prev + 1); @@ -558,10 +568,9 @@ function App() { onOpenClipboardModal={() => setShowClipboardModal(true)} activeTab={activeTab} onRequestTabChange={handleRequestTabChange} - encryptedMnemonicCache={encryptedMnemonicCache} appVersion={__APP_VERSION__} - isLocked={isReadOnly} - onToggleLock={handleToggleLock} + isNetworkBlocked={isNetworkBlocked} + onToggleNetwork={handleToggleNetwork} onResetAll={handleResetAll} />
@@ -725,10 +734,17 @@ function App() { Generated Successfully -
-

+

+

{generatedSeed}

+

+ 👆 Hover to reveal - Write down securely +

@@ -770,20 +786,29 @@ function App() {
-