diff --git a/apps/desktop-wallet/src-tauri/Cargo.toml b/apps/desktop-wallet/src-tauri/Cargo.toml index df3d890..d6410a8 100644 --- a/apps/desktop-wallet/src-tauri/Cargo.toml +++ b/apps/desktop-wallet/src-tauri/Cargo.toml @@ -55,6 +55,8 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } # Utils uuid = { version = "1", features = ["v4"] } +once_cell = "1" +md5 = "0.7" # Local crates from the monorepo (required for wallet functionality) synor-crypto = { path = "../../../crates/synor-crypto" } diff --git a/apps/desktop-wallet/src-tauri/src/commands.rs b/apps/desktop-wallet/src-tauri/src/commands.rs index 624fc91..86158d5 100644 --- a/apps/desktop-wallet/src-tauri/src/commands.rs +++ b/apps/desktop-wallet/src-tauri/src/commands.rs @@ -1978,7 +1978,6 @@ pub async fn get_network_status(state: State<'_, WalletState>) -> Result { // Mock data generators const mockGenerators = { - // Wallet commands + // Wallet commands - 24-word BIP39 mnemonic create_wallet: async (_args?: { password: string }) => ({ - mnemonic: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + mnemonic: 'abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual', address: 'tsynor1qz8v5zp2q0ew9d2k8n7j3x4c5v6b7n8m9k0l1p2q3r4s5t6u7v8w9x0y', }), diff --git a/apps/desktop-wallet/src/pages/Unlock.tsx b/apps/desktop-wallet/src/pages/Unlock.tsx index d2b9b8f..3d9f462 100644 --- a/apps/desktop-wallet/src/pages/Unlock.tsx +++ b/apps/desktop-wallet/src/pages/Unlock.tsx @@ -1,15 +1,16 @@ import { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { AlertTriangle, Lock } from 'lucide-react'; +import { useNavigate, Link } from 'react-router-dom'; +import { AlertTriangle, Lock, KeyRound, Download, Trash2 } from 'lucide-react'; import { useWalletStore } from '../store/wallet'; export default function Unlock() { const navigate = useNavigate(); - const { unlockWallet } = useWalletStore(); + const { unlockWallet, setInitialized } = useWalletStore(); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); + const [showResetConfirm, setShowResetConfirm] = useState(false); const handleUnlock = async (e: React.FormEvent) => { e.preventDefault(); @@ -31,6 +32,16 @@ export default function Unlock() { } }; + const handleResetWallet = () => { + // Clear wallet state and localStorage + setInitialized(false); + localStorage.removeItem('synor-wallet-storage'); + localStorage.removeItem('synor-node-storage'); + localStorage.removeItem('synor-mining-storage'); + // Navigate to welcome page + navigate('/'); + }; + return (
@@ -76,7 +87,72 @@ export default function Unlock() { {loading ? 'Unlocking...' : 'Unlock'} + + {/* Divider */} +
+ + {/* Alternative options */} +
+ + + Import Different Wallet + + + +
+ + {/* Reset Confirmation Modal */} + {showResetConfirm && ( +
+
+
+
+ +
+

Reset Wallet?

+
+ +
+

+ This will permanently delete your wallet data from this device. +

+
+

+ Warning: If you don't have your 24-word recovery phrase, you will lose access to your funds forever. +

+
+

+ After reset, you can create a new wallet or import an existing one using your recovery phrase. +

+
+ +
+ + +
+
+
+ )}
);