mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
CW-673: Save Haven seeds to show it to the user after Haven removal (#1518)
* haven: backup seeds * haven backup fixes * ci fix * reorder build script * disable haven * properly call cw_haven code * [skip ci] update PR * Update evm_chain_transaction_history.dart remove print --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -307,6 +307,23 @@ class CWHaven extends Haven {
|
||||
return havenTransactionInfo.accountIndex;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> backupHavenSeeds(Box<HavenSeedStore> havenSeedStore) async {
|
||||
final walletInfoSource = await CakeHive.openBox<WalletInfo>(WalletInfo.boxName);
|
||||
final wallets = walletInfoSource.values
|
||||
.where((element) => element.type == WalletType.haven);
|
||||
for (var w in wallets) {
|
||||
final walletService = HavenWalletService(walletInfoSource);
|
||||
final flutterSecureStorage = secureStorageShared;
|
||||
final keyService = KeyService(flutterSecureStorage);
|
||||
final password = await keyService.getWalletPassword(walletName: w.name);
|
||||
final wallet = await walletService.openWallet(w.name, password);
|
||||
await havenSeedStore.add(HavenSeedStore(id: wallet.id, seed: wallet.seed));
|
||||
wallet.close();
|
||||
}
|
||||
await havenSeedStore.flush();
|
||||
}
|
||||
|
||||
@override
|
||||
WalletService createHavenWalletService(Box<WalletInfo> walletInfoSource) {
|
||||
return HavenWalletService(walletInfoSource);
|
||||
|
||||
Reference in New Issue
Block a user