feat: add Wownero wallet seed backup during migration step 54 (#2667)
* feat: add Wownero wallet seed backup during migration step 54 * feat: add Haven wallet seed backup support in configure tool interface
Konstantin Ullrich committed
Nov 21, 2025 at 16:10 UTC
842b958f8b35c3325d6f9dd703d036175ecc7cd1
4 files changed
+35
-1
lib/entities/default_settings_migration.dart
+10
@@ -5,6 +5,7 @@ import 'package:cake_wallet/core/secure_storage.dart';
5
import 'package:cake_wallet/entities/exchange_api_mode.dart';
6
import 'package:cake_wallet/entities/fiat_api_mode.dart';
7
import 'package:cake_wallet/entities/haven_seed_store.dart';
8
+import 'package:cake_wallet/wownero/wownero.dart';
9
import 'package:cw_core/cake_hive.dart';
10
import 'package:cw_core/pathForWallet.dart';
11
import 'package:cake_wallet/entities/secret_store_key.dart';
@@ -555,6 +556,9 @@ Future<void> defaultSettingsMigration(
556
currentNodePreferenceKey: PreferencesKey.currentArbitrumNodeIdKey,
557
);
558
break;
559
+ case 54:
560
+ await _backupWowneroSeeds(havenSeedStore);
561
+ break;
562
563
default:
564
break;
@@ -740,6 +744,12 @@ Future<void> disableServiceStatusFiatDisabled(SharedPreferences sharedPreference
744
}
745
}
746
747
+Future<void> _backupWowneroSeeds(Box<HavenSeedStore> havenSeedStore) async {
748
+ final future = wownero?.backupSeeds(havenSeedStore);
749
+ if (future != null) await future;
750
+ return;
751
+}
752
+
753
Future<void> _updateMoneroPriority(SharedPreferences sharedPreferences) async {
754
final currentPriority =
755
await sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority) ??
lib/main.dart
+1
-1
@@ -266,7 +266,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
266
payjoinSessionSource: payjoinSessionSource,
267
anonpayInvoiceInfo: anonpayInvoiceInfo,
268
havenSeedStore: havenSeedStore,
269
- initialMigrationVersion: 53,
269
+ initialMigrationVersion: 54,
270
);
271
}
272
lib/wownero/cw_wownero.dart
+16
@@ -365,4 +365,20 @@ class CWWownero extends Wownero {
365
Map<String, List<int>> debugCallLength() {
366
return wownero_wallet_api.debugCallLength();
367
}
368
+
369
+ @override
370
+ Future<void> backupSeeds(Box<HavenSeedStore> havenSeedStore) async {
371
+ final wallets = await WalletInfo.selectList('type = ?', [WalletType.wownero.index]);
372
+ final unspentCoinsInfo = await CakeHive.openBox<UnspentCoinsInfo>(UnspentCoinsInfo.boxName);
373
+ for (final w in wallets) {
374
+ final walletService = WowneroWalletService(unspentCoinsInfo);
375
+ final flutterSecureStorage = secureStorageShared;
376
+ final keyService = KeyService(flutterSecureStorage);
377
+ final password = await keyService.getWalletPassword(walletName: w.name);
378
+ final wallet = await walletService.openWallet(w.name, password);
379
+ await havenSeedStore.add(HavenSeedStore(id: wallet.id, seed: wallet.seed));
380
+ wallet.close();
381
+ }
382
+ await havenSeedStore.flush();
383
+ }
384
}
tool/configure.dart
+8
@@ -517,6 +517,13 @@ import 'package:cw_core/transaction_info.dart';
517
import 'package:cw_core/balance.dart';
518
import 'package:cw_core/output_info.dart';
519
import 'package:cake_wallet/view_model/send/output.dart';
520
+import 'package:cw_core/crypto_currency.dart';
521
+import 'package:cake_wallet/core/key_service.dart';
522
+import 'package:cake_wallet/core/secure_storage.dart';
523
+import 'package:cake_wallet/entities/haven_seed_store.dart';
524
+import 'package:cw_core/cake_hive.dart';
525
+import 'package:cw_core/wallet_info.dart';
526
+import 'package:cw_core/wallet_type.dart';
527
import 'package:cw_core/wallet_service.dart';
528
import 'package:hive/hive.dart';
529
import 'package:polyseed/polyseed.dart';""";
@@ -650,6 +657,7 @@ abstract class Wownero {
657
Map<String, String> pendingTransactionInfo(Object transaction);
658
String getLegacySeed(Object wallet, String langName);
659
Map<String, List<int>> debugCallLength();
660
+ Future<void> backupSeeds(Box<HavenSeedStore> havenSeedStore);
661
}
662
663
abstract class WowneroSubaddressList {