**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)
2.3 KiB
2.3 KiB
UserWallet – IndexedDB pour hash_cache
Author: Équipe 4NK
Date: 2026-01-26
Objectif
Stocker le cache des hash vus (userwallet_hash_cache) dans IndexedDB au lieu de LocalStorage, pour éviter les limites de taille et permettre un volume plus important sans dégradation.
Impacts
- Fonctionnels : Comportement identique (déduplication des messages sync). Pruning à 10k entrées conservé.
- Techniques : Nouveau module
indexedDbStorage(idbGet, idbSet, idbRemove).HashCacheutilise IndexedDB,init()async,markSeenBatchasync.SyncServiceinit avant sync, collecte des nouveaux hashes puis un seulmarkSeenBatch. Export/import lisent/écriventhash_cachevia IndexedDB (export/import async).
Modifications
utils/indexedDbStorage.ts (nouveau)
- DB
userwallet, version 1, storekv(keyPathkey). idbGet(key),idbSet(key, value),idbRemove(key). Toutes async.
utils/cache.ts
HashCache: plus de chargement dans le constructeur.async init()charge depuis IndexedDB (et migre depuis localStorage si présent).markSeen: en mémoire uniquement.markSeenBatch(hashes): ajoute + persiste via IndexedDB.clear()async, utiliseidbRemove.- Sauvegarde avec pruning à 10k entrées.
services/syncService.ts
async init(): délègue àhashCache.init().- Dans
sync(): collecte desnewHashes, puisawait hashCache.markSeenBatch(newHashes)en fin de sync.
Composants
- SyncScreen, ServiceListScreen :
await syncService.init()avantsync().
exportImport
exportUserWalletDataasync : lithash_cacheviaidbGet.importUserWalletDataasync : écrithash_cacheviaidbSet.- DataExportImportScreen :
handleExportasync,handleImportFileonload async.
Migration
- Au premier
HashCache.init(), si IndexedDB n’a pasuserwallet_hash_cacheet que localStorage l’a, copie vers IndexedDB puis suppression du localStorage.
Modalités de déploiement
- Rebuild frontend, déploiement des assets. Migration automatique au premier sync.
Modalités d’analyse
- Effectuer une sync : vérifier qu’aucune régression. Exporter puis réimporter : vérifier que
hash_cacheest bien présent après import. - Vérifier en DevTools (Application → IndexedDB → userwallet) la présence du store
kvet de la cléuserwallet_hash_cache.