**Motivations:** - Implement BIP39 mnemonic import for identity creation - Add password-based key protection for enhanced security - Improve pairing workflow with QR code and URL display - Migrate hash cache from LocalStorage to IndexedDB for better scalability - Update signet-dashboard and mempool components **Root causes:** - N/A (feature implementations) **Correctifs:** - N/A (no bug fixes in this commit) **Evolutions:** - BIP39 mnemonic import: Support for 12/24 word English mnemonics with BIP32 derivation path m/44'/0'/0'/0/0 - Key protection: Password-based encryption of private keys at rest with unlock/lock functionality - Pairing workflow: QR code and URL display for device pairing, form-based word exchange between devices - IndexedDB migration: Hash cache moved from LocalStorage to IndexedDB to avoid size limitations - Global action bar: URL parameter support for navigation - Pairing connection: Enhanced pairing status management **Pages affectées:** - userwallet/src/utils/identity.ts - userwallet/src/utils/keyProtection.ts - userwallet/src/utils/sessionUnlockedKey.ts - userwallet/src/utils/indexedDbStorage.ts - userwallet/src/utils/cache.ts - userwallet/src/utils/pairing.ts - userwallet/src/components/UnlockScreen.tsx - userwallet/src/components/PairingDisplayScreen.tsx - userwallet/src/components/PairingSetupBlock.tsx - userwallet/src/components/GlobalActionBar.tsx - userwallet/src/components/HomeScreen.tsx - userwallet/src/components/ImportIdentityScreen.tsx - userwallet/src/components/DataExportImportScreen.tsx - userwallet/src/hooks/useIdentity.ts - userwallet/src/hooks/usePairingConnected.ts - userwallet/src/services/syncService.ts - userwallet/src/services/pairingConfirm.ts - userwallet/src/App.tsx - userwallet/package.json - userwallet/docs/specs.md - userwallet/docs/storage.md - userwallet/docs/synthese.md - signet-dashboard/public/*.html - signet-dashboard/public/app.js - signet-dashboard/public/styles.css - mempool (submodule updates) - hash_list.txt, hash_list_cache.txt, utxo_list.txt, utxo_list_cache.txt, fees_list.txt - features/*.md (documentation files)
82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
import {
|
|
BrowserRouter,
|
|
Routes,
|
|
Route,
|
|
useLocation,
|
|
} from 'react-router-dom';
|
|
import { PairingWordsProvider } from './contexts/PairingWordsContext';
|
|
import { GlobalActionBar } from './components/GlobalActionBar';
|
|
import { HomeScreen } from './components/HomeScreen';
|
|
import { CreateIdentityScreen } from './components/CreateIdentityScreen';
|
|
import { ImportIdentityScreen } from './components/ImportIdentityScreen';
|
|
import { PairingDisplayScreen } from './components/PairingDisplayScreen';
|
|
import { RelaySettingsScreen } from './components/RelaySettingsScreen';
|
|
import { PairManagementScreen } from './components/PairManagementScreen';
|
|
import { SyncScreen } from './components/SyncScreen';
|
|
import { LoginScreen } from './components/LoginScreen';
|
|
import { ServiceListScreen } from './components/ServiceListScreen';
|
|
import { DataExportImportScreen } from './components/DataExportImportScreen';
|
|
import { UnlockScreen } from './components/UnlockScreen';
|
|
import { useChannel } from './hooks/useChannel';
|
|
import { useIdentity } from './hooks/useIdentity';
|
|
import './index.css';
|
|
|
|
const PAIRING_DISPLAY_PATH = '/pairing-display';
|
|
|
|
function usePairingDisplayBypass(): boolean {
|
|
const location = useLocation();
|
|
return location.pathname === PAIRING_DISPLAY_PATH;
|
|
}
|
|
|
|
function AppContent(): JSX.Element {
|
|
useChannel();
|
|
|
|
return (
|
|
<Routes>
|
|
<Route path="/" element={<HomeScreen />} />
|
|
<Route path="/create-identity" element={<CreateIdentityScreen />} />
|
|
<Route path="/import-identity" element={<ImportIdentityScreen />} />
|
|
<Route path="/login" element={<LoginScreen />} />
|
|
<Route path="/manage-pairs" element={<PairManagementScreen />} />
|
|
<Route path="/relay-settings" element={<RelaySettingsScreen />} />
|
|
<Route path="/sync" element={<SyncScreen />} />
|
|
<Route path="/services" element={<ServiceListScreen />} />
|
|
<Route path="/data" element={<DataExportImportScreen />} />
|
|
</Routes>
|
|
);
|
|
}
|
|
|
|
function AppGate(): JSX.Element {
|
|
const { identity, isProtected, isUnlocked, isLoading } = useIdentity();
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<div role="status" aria-live="polite" aria-busy="true">
|
|
Chargement…
|
|
</div>
|
|
);
|
|
}
|
|
if (identity !== null && isProtected && !isUnlocked) {
|
|
return <UnlockScreen />;
|
|
}
|
|
return <AppContent />;
|
|
}
|
|
|
|
function AppRoot(): JSX.Element {
|
|
const bypass = usePairingDisplayBypass();
|
|
return (
|
|
<PairingWordsProvider>
|
|
<GlobalActionBar />
|
|
{bypass ? <PairingDisplayScreen /> : <AppGate />}
|
|
</PairingWordsProvider>
|
|
);
|
|
}
|
|
|
|
export function App(): JSX.Element {
|
|
return (
|
|
<BrowserRouter>
|
|
<AppRoot />
|
|
</BrowserRouter>
|
|
);
|
|
}
|