2021-01-13 16:43:34 +00:00
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:typed_data';
|
2024-05-06 19:55:05 +00:00
|
|
|
import 'package:cake_wallet/core/secure_storage.dart';
|
2024-10-16 17:27:04 +00:00
|
|
|
import 'package:cake_wallet/entities/get_encryption_key.dart';
|
2024-10-04 21:50:36 +00:00
|
|
|
import 'package:cake_wallet/entities/transaction_description.dart';
|
2023-11-14 21:56:36 +00:00
|
|
|
import 'package:cake_wallet/themes/theme_list.dart';
|
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types"
This reverts commit a49e57e3
* Re-add Bitcoin Address types
Fix conflicts with main
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* Update Monero
* not sure why it's failing
* Enable Exolix
Improve service updates indicator
New versions
* Add exolix Api token to limits api
* Ignore reporting network issues
* Change default bitcoin node
* Merge main and update linux version
* Update app version [skip ci]
* New versions
* Fix conflicts and update linux version
* minor fix
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* update linux version
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* Merge and fix main
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* update version
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* update app version [skip ci]
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* fix missing encryption utils in hardware wallet functions [skip ci]
* fix conflicts
* Include missed monero dll for windows.
* reformatting [skip ci]
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* remove tron
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* merge main and update version
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* update version
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Add Tron
Update Linux version
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* merge main
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix: Tron file write, build scripts
* - merge linux with Monero Dart
- Temporarily disable Monero
* fix other issues with linux
* linux ci
fix build script
* Update pr_test_build_linux.yml
install required packages
* add linux desktop dependencies
* don't use apk in linux build releases
* don't copy the file to test-apk
* fix linux runtime issues
* remove libc++_shared.so
* fix issues with linux
* prepare both android and linux (because otherwise it will fail)
* ci script updates
* run apt update
* bump image to ubuntu 22.04
note: remember to put it down later
* bump python version
* remove some dependencies
* remove unused import
* add missing dependencies
* fix dependencies
* some fixes
* remove print [skip ci]
* Add back RunnerBase.entitlements
minor fixes [skip ci]
* fix memory leak / infinite recurrsion when opening xmr wallet
* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083
* fix conflicts with main
* handle walletKeysFile with encryptionUtils
* update app version [skip ci]
* add wownero [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
2024-08-12 22:18:14 +00:00
|
|
|
import 'package:cw_core/root_dir.dart';
|
2023-10-09 15:18:59 +00:00
|
|
|
import 'package:cake_wallet/utils/device_info.dart';
|
2022-02-03 18:04:16 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:cryptography/cryptography.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:archive/archive_io.dart';
|
2023-08-15 00:47:25 +00:00
|
|
|
import 'package:cw_core/cake_hive.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/core/key_service.dart';
|
|
|
|
import 'package:cake_wallet/entities/encrypt.dart';
|
|
|
|
import 'package:cake_wallet/entities/preferences_key.dart';
|
|
|
|
import 'package:cake_wallet/entities/secret_store_key.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_info.dart';
|
2021-01-15 17:41:30 +00:00
|
|
|
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
2022-02-02 12:40:40 +00:00
|
|
|
import 'package:cake_wallet/wallet_types.g.dart';
|
2022-10-26 19:28:27 +00:00
|
|
|
import 'package:cake_backup/backup.dart' as cake_backup;
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
class BackupService {
|
2024-10-04 21:50:36 +00:00
|
|
|
BackupService(this._secureStorage, this._walletInfoSource, this._transactionDescriptionBox,
|
|
|
|
this._keyService, this._sharedPreferences)
|
2022-10-12 17:09:57 +00:00
|
|
|
: _cipher = Cryptography.instance.chacha20Poly1305Aead(),
|
|
|
|
_correctWallets = <WalletInfo>[];
|
2021-01-13 16:43:34 +00:00
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
static const currentVersion = _v2;
|
2021-01-15 17:41:30 +00:00
|
|
|
|
|
|
|
static const _v1 = 1;
|
2022-10-26 19:28:27 +00:00
|
|
|
static const _v2 = 2;
|
2021-01-15 17:41:30 +00:00
|
|
|
|
2021-01-13 16:43:34 +00:00
|
|
|
final Cipher _cipher;
|
2024-05-08 20:23:27 +00:00
|
|
|
final SecureStorage _secureStorage;
|
2021-01-13 16:43:34 +00:00
|
|
|
final SharedPreferences _sharedPreferences;
|
|
|
|
final Box<WalletInfo> _walletInfoSource;
|
2024-10-04 21:50:36 +00:00
|
|
|
final Box<TransactionDescription> _transactionDescriptionBox;
|
2021-01-13 16:43:34 +00:00
|
|
|
final KeyService _keyService;
|
2022-02-02 12:40:40 +00:00
|
|
|
List<WalletInfo> _correctWallets;
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
Future<void> importBackup(Uint8List data, String password,
|
2021-01-15 17:41:30 +00:00
|
|
|
{String nonce = secrets.backupSalt}) async {
|
|
|
|
final version = getVersion(data);
|
|
|
|
|
|
|
|
switch (version) {
|
|
|
|
case _v1:
|
2022-10-26 19:28:27 +00:00
|
|
|
final backupBytes = data.toList()..removeAt(0);
|
|
|
|
final backupData = Uint8List.fromList(backupBytes);
|
2021-01-15 17:41:30 +00:00
|
|
|
await _importBackupV1(backupData, password, nonce: nonce);
|
|
|
|
break;
|
2022-10-26 19:28:27 +00:00
|
|
|
case _v2:
|
|
|
|
await _importBackupV2(data, password);
|
|
|
|
break;
|
2021-01-15 17:41:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<Uint8List> exportBackup(String password,
|
|
|
|
{String nonce = secrets.backupSalt, int version = currentVersion}) async {
|
|
|
|
switch (version) {
|
|
|
|
case _v1:
|
|
|
|
return await _exportBackupV1(password, nonce: nonce);
|
2022-10-26 19:28:27 +00:00
|
|
|
case _v2:
|
|
|
|
return await _exportBackupV2(password);
|
2021-01-15 17:41:30 +00:00
|
|
|
default:
|
2022-10-12 17:09:57 +00:00
|
|
|
throw Exception('Incorrect version: $version for exportBackup');
|
2021-01-15 17:41:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
@Deprecated('Use v2 instead')
|
2023-08-04 13:49:26 +00:00
|
|
|
Future<Uint8List> _exportBackupV1(String password, {String nonce = secrets.backupSalt}) async =>
|
|
|
|
throw Exception('Deprecated. Export for backups v1 is deprecated. Please use export v2.');
|
2022-10-26 19:28:27 +00:00
|
|
|
|
|
|
|
Future<Uint8List> _exportBackupV2(String password) async {
|
2021-01-15 17:41:30 +00:00
|
|
|
final zipEncoder = ZipFileEncoder();
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2021-01-15 17:41:30 +00:00
|
|
|
final now = DateTime.now();
|
|
|
|
final tmpDir = Directory('${appDir.path}/~_BACKUP_TMP');
|
|
|
|
final archivePath = '${tmpDir.path}/backup_${now.toString()}.zip';
|
|
|
|
final fileEntities = appDir.listSync(recursive: false);
|
2022-10-26 19:28:27 +00:00
|
|
|
final keychainDump = await _exportKeychainDumpV2(password);
|
2021-01-15 17:41:30 +00:00
|
|
|
final preferencesDump = await _exportPreferencesJSON();
|
|
|
|
final preferencesDumpFile = File('${tmpDir.path}/~_preferences_dump_TMP');
|
|
|
|
final keychainDumpFile = File('${tmpDir.path}/~_keychain_dump_TMP');
|
2024-10-04 21:50:36 +00:00
|
|
|
final transactionDescriptionDumpFile =
|
|
|
|
File('${tmpDir.path}/~_transaction_descriptions_dump_TMP');
|
|
|
|
|
|
|
|
final transactionDescriptionData = _transactionDescriptionBox
|
|
|
|
.toMap()
|
|
|
|
.map((key, value) => MapEntry(key.toString(), value.toJson()));
|
|
|
|
final transactionDescriptionDump = jsonEncode(transactionDescriptionData);
|
2021-01-15 17:41:30 +00:00
|
|
|
|
|
|
|
if (tmpDir.existsSync()) {
|
|
|
|
tmpDir.deleteSync(recursive: true);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmpDir.createSync();
|
|
|
|
zipEncoder.create(archivePath);
|
|
|
|
|
|
|
|
fileEntities.forEach((entity) {
|
|
|
|
if (entity.path == archivePath || entity.path == tmpDir.path) {
|
|
|
|
return;
|
|
|
|
}
|
2024-10-16 17:27:04 +00:00
|
|
|
final filename = entity.absolute;
|
|
|
|
for (var ignore in ignoreFiles) {
|
|
|
|
final filename = entity.absolute.path;
|
|
|
|
if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
|
|
|
|
print("ignoring backup file: $filename");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print("restoring: $filename");
|
2021-01-15 17:41:30 +00:00
|
|
|
if (entity.statSync().type == FileSystemEntityType.directory) {
|
|
|
|
zipEncoder.addDirectory(Directory(entity.path));
|
|
|
|
} else {
|
|
|
|
zipEncoder.addFile(File(entity.path));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
await keychainDumpFile.writeAsBytes(keychainDump.toList());
|
|
|
|
await preferencesDumpFile.writeAsString(preferencesDump);
|
2024-10-04 21:50:36 +00:00
|
|
|
await transactionDescriptionDumpFile.writeAsString(transactionDescriptionDump);
|
2022-10-12 17:09:57 +00:00
|
|
|
await zipEncoder.addFile(preferencesDumpFile, '~_preferences_dump');
|
|
|
|
await zipEncoder.addFile(keychainDumpFile, '~_keychain_dump');
|
2024-10-04 21:50:36 +00:00
|
|
|
await zipEncoder.addFile(transactionDescriptionDumpFile, '~_transaction_descriptions_dump');
|
2021-01-15 17:41:30 +00:00
|
|
|
zipEncoder.close();
|
|
|
|
|
|
|
|
final content = File(archivePath).readAsBytesSync();
|
|
|
|
tmpDir.deleteSync(recursive: true);
|
2022-10-26 19:28:27 +00:00
|
|
|
return await _encryptV2(content, password);
|
2021-01-15 17:41:30 +00:00
|
|
|
}
|
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
Future<void> _importBackupV1(Uint8List data, String password, {required String nonce}) async {
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2022-10-26 19:28:27 +00:00
|
|
|
final decryptedData = await _decryptV1(data, password, nonce);
|
2021-01-13 16:43:34 +00:00
|
|
|
final zip = ZipDecoder().decodeBytes(decryptedData);
|
|
|
|
|
2024-10-04 21:53:55 +00:00
|
|
|
for (var file in zip.files) {
|
2021-01-13 16:43:34 +00:00
|
|
|
final filename = file.name;
|
|
|
|
|
|
|
|
if (file.isFile) {
|
2021-01-15 17:41:30 +00:00
|
|
|
final content = file.content as List<int>;
|
2021-01-13 16:43:34 +00:00
|
|
|
File('${appDir.path}/' + filename)
|
|
|
|
..createSync(recursive: true)
|
2024-10-04 21:53:55 +00:00
|
|
|
..writeAsBytesSync(content, flush: true);
|
2021-01-13 16:43:34 +00:00
|
|
|
} else {
|
|
|
|
Directory('${appDir.path}/' + filename)..create(recursive: true);
|
|
|
|
}
|
2024-10-04 21:53:55 +00:00
|
|
|
};
|
2021-01-13 16:43:34 +00:00
|
|
|
|
2022-02-02 12:40:40 +00:00
|
|
|
await _verifyWallets();
|
2022-10-26 19:28:27 +00:00
|
|
|
await _importKeychainDumpV1(password, nonce: nonce);
|
|
|
|
await _importPreferencesDump();
|
|
|
|
}
|
|
|
|
|
2024-10-16 17:27:04 +00:00
|
|
|
// checked with .endsWith - so this should be the last part of the filename
|
|
|
|
static const ignoreFiles = [
|
|
|
|
"flutter_assets/kernel_blob.bin",
|
|
|
|
"flutter_assets/vm_snapshot_data",
|
|
|
|
"flutter_assets/isolate_snapshot_data",
|
|
|
|
".lock",
|
|
|
|
];
|
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
Future<void> _importBackupV2(Uint8List data, String password) async {
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2022-10-26 19:28:27 +00:00
|
|
|
final decryptedData = await _decryptV2(data, password);
|
|
|
|
final zip = ZipDecoder().decodeBytes(decryptedData);
|
|
|
|
|
2024-10-16 17:27:04 +00:00
|
|
|
outer:
|
2024-10-04 21:53:55 +00:00
|
|
|
for (var file in zip.files) {
|
2022-10-26 19:28:27 +00:00
|
|
|
final filename = file.name;
|
2024-10-16 17:27:04 +00:00
|
|
|
for (var ignore in ignoreFiles) {
|
|
|
|
if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
|
|
|
|
print("ignoring backup file: $filename");
|
|
|
|
continue outer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print("restoring: $filename");
|
2022-10-26 19:28:27 +00:00
|
|
|
if (file.isFile) {
|
|
|
|
final content = file.content as List<int>;
|
|
|
|
File('${appDir.path}/' + filename)
|
|
|
|
..createSync(recursive: true)
|
2024-10-04 21:53:55 +00:00
|
|
|
..writeAsBytesSync(content, flush: true);
|
2022-10-26 19:28:27 +00:00
|
|
|
} else {
|
|
|
|
Directory('${appDir.path}/' + filename)..create(recursive: true);
|
|
|
|
}
|
2024-10-04 21:53:55 +00:00
|
|
|
};
|
2022-10-26 19:28:27 +00:00
|
|
|
|
|
|
|
await _verifyWallets();
|
|
|
|
await _importKeychainDumpV2(password);
|
2021-01-15 17:41:30 +00:00
|
|
|
await _importPreferencesDump();
|
2024-10-04 21:50:36 +00:00
|
|
|
await _importTransactionDescriptionDump();
|
2021-01-13 16:43:34 +00:00
|
|
|
}
|
|
|
|
|
2022-02-02 12:40:40 +00:00
|
|
|
Future<void> _verifyWallets() async {
|
|
|
|
final walletInfoSource = await _reloadHiveWalletInfoBox();
|
2023-08-04 13:49:26 +00:00
|
|
|
_correctWallets =
|
|
|
|
walletInfoSource.values.where((info) => availableWalletTypes.contains(info.type)).toList();
|
2022-02-02 12:40:40 +00:00
|
|
|
|
|
|
|
if (_correctWallets.isEmpty) {
|
|
|
|
throw Exception('Correct wallets not detected');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<Box<WalletInfo>> _reloadHiveWalletInfoBox() async {
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2023-08-15 00:47:25 +00:00
|
|
|
await CakeHive.close();
|
|
|
|
CakeHive.init(appDir.path);
|
2022-02-02 12:40:40 +00:00
|
|
|
|
2023-08-15 00:47:25 +00:00
|
|
|
if (!CakeHive.isAdapterRegistered(WalletInfo.typeId)) {
|
|
|
|
CakeHive.registerAdapter(WalletInfoAdapter());
|
2022-02-02 12:40:40 +00:00
|
|
|
}
|
|
|
|
|
2023-08-15 00:47:25 +00:00
|
|
|
return await CakeHive.openBox<WalletInfo>(WalletInfo.boxName);
|
2022-02-02 12:40:40 +00:00
|
|
|
}
|
|
|
|
|
2024-10-04 21:50:36 +00:00
|
|
|
Future<void> _importTransactionDescriptionDump() async {
|
|
|
|
final appDir = await getAppDir();
|
|
|
|
final transactionDescriptionFile = File('${appDir.path}/~_transaction_descriptions_dump');
|
|
|
|
|
|
|
|
if (!transactionDescriptionFile.existsSync()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
final jsonData =
|
|
|
|
json.decode(transactionDescriptionFile.readAsStringSync()) as Map<String, dynamic>;
|
|
|
|
final descriptionsMap = jsonData.map((key, value) =>
|
|
|
|
MapEntry(key, TransactionDescription.fromJson(value as Map<String, dynamic>)));
|
2024-10-16 17:27:04 +00:00
|
|
|
|
|
|
|
if (!_transactionDescriptionBox.isOpen) {
|
|
|
|
final transactionDescriptionsBoxKey = await getEncryptionKey(secureStorage: secureStorageShared, forKey: TransactionDescription.boxKey);
|
|
|
|
final transactionDescriptionBox = await CakeHive.openBox<TransactionDescription>(
|
|
|
|
TransactionDescription.boxName,
|
|
|
|
encryptionKey: transactionDescriptionsBoxKey,
|
|
|
|
);
|
|
|
|
await transactionDescriptionBox.putAll(descriptionsMap);
|
|
|
|
return;
|
|
|
|
}
|
2024-10-04 21:50:36 +00:00
|
|
|
await _transactionDescriptionBox.putAll(descriptionsMap);
|
|
|
|
}
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
Future<void> _importPreferencesDump() async {
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2021-01-13 16:43:34 +00:00
|
|
|
final preferencesFile = File('${appDir.path}/~_preferences_dump');
|
|
|
|
|
|
|
|
if (!preferencesFile.existsSync()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
final data = json.decode(preferencesFile.readAsStringSync()) as Map<String, dynamic>;
|
2022-02-02 12:40:40 +00:00
|
|
|
String currentWalletName = data[PreferencesKey.currentWalletName] as String;
|
|
|
|
int currentWalletType = data[PreferencesKey.currentWalletType] as int;
|
|
|
|
|
|
|
|
final isCorrentCurrentWallet = _correctWallets
|
2023-08-04 13:49:26 +00:00
|
|
|
.any((info) => info.name == currentWalletName && info.type.index == currentWalletType);
|
2022-02-02 12:40:40 +00:00
|
|
|
|
|
|
|
if (!isCorrentCurrentWallet) {
|
|
|
|
currentWalletName = _correctWallets.first.name;
|
2022-02-03 18:04:16 +00:00
|
|
|
currentWalletType = serializeToInt(_correctWallets.first.type);
|
2022-02-02 12:40:40 +00:00
|
|
|
}
|
2021-01-13 16:43:34 +00:00
|
|
|
|
2022-10-18 15:38:54 +00:00
|
|
|
final currentNodeId = data[PreferencesKey.currentNodeIdKey] as int?;
|
|
|
|
final currentBalanceDisplayMode = data[PreferencesKey.currentBalanceDisplayModeKey] as int?;
|
|
|
|
final currentFiatCurrency = data[PreferencesKey.currentFiatCurrencyKey] as String?;
|
|
|
|
final shouldSaveRecipientAddress = data[PreferencesKey.shouldSaveRecipientAddressKey] as bool?;
|
2023-04-20 09:59:59 +00:00
|
|
|
final isAppSecure = data[PreferencesKey.isAppSecureKey] as bool?;
|
2023-05-15 12:26:56 +00:00
|
|
|
final disableBuy = data[PreferencesKey.disableBuyKey] as bool?;
|
|
|
|
final disableSell = data[PreferencesKey.disableSellKey] as bool?;
|
2023-09-14 19:14:49 +00:00
|
|
|
final defaultBuyProvider = data[PreferencesKey.defaultBuyProvider] as int?;
|
2023-08-04 13:49:26 +00:00
|
|
|
final currentTransactionPriorityKeyLegacy =
|
|
|
|
data[PreferencesKey.currentTransactionPriorityKeyLegacy] as int?;
|
|
|
|
final currentBitcoinElectrumSererId =
|
|
|
|
data[PreferencesKey.currentBitcoinElectrumSererIdKey] as int?;
|
2022-10-18 15:38:54 +00:00
|
|
|
final currentLanguageCode = data[PreferencesKey.currentLanguageCode] as String?;
|
|
|
|
final displayActionListMode = data[PreferencesKey.displayActionListModeKey] as int?;
|
2022-12-06 23:38:36 +00:00
|
|
|
final fiatApiMode = data[PreferencesKey.currentFiatApiModeKey] as int?;
|
2022-10-18 15:38:54 +00:00
|
|
|
final currentPinLength = data[PreferencesKey.currentPinLength] as int?;
|
|
|
|
final currentTheme = data[PreferencesKey.currentTheme] as int?;
|
2023-03-02 15:43:42 +00:00
|
|
|
final exchangeStatus = data[PreferencesKey.exchangeStatusKey] as int?;
|
2023-08-04 13:49:26 +00:00
|
|
|
final currentDefaultSettingsMigrationVersion =
|
|
|
|
data[PreferencesKey.currentDefaultSettingsMigrationVersion] as int?;
|
2022-10-18 15:38:54 +00:00
|
|
|
final moneroTransactionPriority = data[PreferencesKey.moneroTransactionPriority] as int?;
|
|
|
|
final bitcoinTransactionPriority = data[PreferencesKey.bitcoinTransactionPriority] as int?;
|
2023-08-04 17:01:49 +00:00
|
|
|
final sortBalanceTokensBy = data[PreferencesKey.sortBalanceBy] as int?;
|
|
|
|
final pinNativeTokenAtTop = data[PreferencesKey.pinNativeTokenAtTop] as bool?;
|
|
|
|
final useEtherscan = data[PreferencesKey.useEtherscan] as bool?;
|
2023-11-17 18:35:46 +00:00
|
|
|
final defaultNanoRep = data[PreferencesKey.defaultNanoRep] as String?;
|
|
|
|
final defaultBananoRep = data[PreferencesKey.defaultBananoRep] as String?;
|
2023-11-03 19:23:11 +00:00
|
|
|
final lookupsTwitter = data[PreferencesKey.lookupsTwitter] as bool?;
|
|
|
|
final lookupsMastodon = data[PreferencesKey.lookupsMastodon] as bool?;
|
|
|
|
final lookupsYatService = data[PreferencesKey.lookupsYatService] as bool?;
|
|
|
|
final lookupsUnstoppableDomains = data[PreferencesKey.lookupsUnstoppableDomains] as bool?;
|
|
|
|
final lookupsOpenAlias = data[PreferencesKey.lookupsOpenAlias] as bool?;
|
|
|
|
final lookupsENS = data[PreferencesKey.lookupsENS] as bool?;
|
2023-08-04 17:55:56 +00:00
|
|
|
final syncAll = data[PreferencesKey.syncAllKey] as bool?;
|
|
|
|
final syncMode = data[PreferencesKey.syncModeKey] as int?;
|
2023-11-14 21:56:36 +00:00
|
|
|
final autoGenerateSubaddressStatus =
|
|
|
|
data[PreferencesKey.autoGenerateSubaddressStatusKey] as int?;
|
2023-08-04 13:49:26 +00:00
|
|
|
|
|
|
|
await _sharedPreferences.setString(PreferencesKey.currentWalletName, currentWalletName);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (currentNodeId != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentNodeIdKey, currentNodeId);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (currentBalanceDisplayMode != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(
|
|
|
|
PreferencesKey.currentBalanceDisplayModeKey, currentBalanceDisplayMode);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentWalletType, currentWalletType);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (currentFiatCurrency != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setString(
|
|
|
|
PreferencesKey.currentFiatCurrencyKey, currentFiatCurrency);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (shouldSaveRecipientAddress != null)
|
|
|
|
await _sharedPreferences.setBool(
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.shouldSaveRecipientAddressKey, shouldSaveRecipientAddress);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
2023-04-20 09:59:59 +00:00
|
|
|
if (isAppSecure != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setBool(PreferencesKey.isAppSecureKey, isAppSecure);
|
2023-04-20 09:59:59 +00:00
|
|
|
|
2023-05-15 12:26:56 +00:00
|
|
|
if (disableBuy != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setBool(PreferencesKey.disableBuyKey, disableBuy);
|
2023-05-15 12:26:56 +00:00
|
|
|
|
|
|
|
if (disableSell != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setBool(PreferencesKey.disableSellKey, disableSell);
|
2023-05-15 12:26:56 +00:00
|
|
|
|
2023-09-14 19:14:49 +00:00
|
|
|
if (defaultBuyProvider != null)
|
|
|
|
await _sharedPreferences.setInt(PreferencesKey.defaultBuyProvider, defaultBuyProvider);
|
|
|
|
|
2022-10-18 15:38:54 +00:00
|
|
|
if (currentTransactionPriorityKeyLegacy != null)
|
|
|
|
await _sharedPreferences.setInt(
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.currentTransactionPriorityKeyLegacy, currentTransactionPriorityKeyLegacy);
|
2024-05-06 19:55:05 +00:00
|
|
|
|
2022-10-18 15:38:54 +00:00
|
|
|
if (currentBitcoinElectrumSererId != null)
|
|
|
|
await _sharedPreferences.setInt(
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey, currentBitcoinElectrumSererId);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (currentLanguageCode != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setString(PreferencesKey.currentLanguageCode, currentLanguageCode);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (displayActionListMode != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(
|
|
|
|
PreferencesKey.displayActionListModeKey, displayActionListMode);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
2022-12-06 23:38:36 +00:00
|
|
|
if (fiatApiMode != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentFiatApiModeKey, fiatApiMode);
|
2023-08-29 16:11:51 +00:00
|
|
|
if (autoGenerateSubaddressStatus != null)
|
2023-11-14 21:56:36 +00:00
|
|
|
await _sharedPreferences.setInt(
|
|
|
|
PreferencesKey.autoGenerateSubaddressStatusKey, autoGenerateSubaddressStatus);
|
2022-12-06 23:38:36 +00:00
|
|
|
|
2022-10-18 15:38:54 +00:00
|
|
|
if (currentPinLength != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentPinLength, currentPinLength);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
2023-11-14 21:56:36 +00:00
|
|
|
if (currentTheme != null && DeviceInfo.instance.isMobile) {
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentTheme, currentTheme);
|
2023-11-17 18:35:46 +00:00
|
|
|
// enforce dark theme on desktop platforms until the design is ready:
|
2023-11-14 21:56:36 +00:00
|
|
|
} else if (DeviceInfo.instance.isDesktop) {
|
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentTheme, ThemeList.darkTheme.raw);
|
|
|
|
}
|
2022-10-18 15:38:54 +00:00
|
|
|
|
2023-03-02 15:13:25 +00:00
|
|
|
if (exchangeStatus != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.exchangeStatusKey, exchangeStatus);
|
2022-12-07 15:14:27 +00:00
|
|
|
|
2022-10-18 15:38:54 +00:00
|
|
|
if (currentDefaultSettingsMigrationVersion != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(PreferencesKey.currentDefaultSettingsMigrationVersion,
|
|
|
|
currentDefaultSettingsMigrationVersion);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (moneroTransactionPriority != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(
|
|
|
|
PreferencesKey.moneroTransactionPriority, moneroTransactionPriority);
|
2022-10-18 15:38:54 +00:00
|
|
|
|
|
|
|
if (bitcoinTransactionPriority != null)
|
2023-08-04 13:49:26 +00:00
|
|
|
await _sharedPreferences.setInt(
|
|
|
|
PreferencesKey.bitcoinTransactionPriority, bitcoinTransactionPriority);
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
if (sortBalanceTokensBy != null)
|
|
|
|
await _sharedPreferences.setInt(PreferencesKey.sortBalanceBy, sortBalanceTokensBy);
|
|
|
|
|
|
|
|
if (pinNativeTokenAtTop != null)
|
|
|
|
await _sharedPreferences.setBool(PreferencesKey.pinNativeTokenAtTop, pinNativeTokenAtTop);
|
|
|
|
|
|
|
|
if (useEtherscan != null)
|
|
|
|
await _sharedPreferences.setBool(PreferencesKey.useEtherscan, useEtherscan);
|
|
|
|
|
2023-11-17 18:35:46 +00:00
|
|
|
if (defaultNanoRep != null)
|
|
|
|
await _sharedPreferences.setString(PreferencesKey.defaultNanoRep, defaultNanoRep);
|
|
|
|
|
|
|
|
if (defaultBananoRep != null)
|
|
|
|
await _sharedPreferences.setString(PreferencesKey.defaultBananoRep, defaultBananoRep);
|
|
|
|
|
|
|
|
if (syncAll != null) await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
|
2023-11-03 19:23:11 +00:00
|
|
|
if (lookupsTwitter != null)
|
|
|
|
await _sharedPreferences.setBool(PreferencesKey.lookupsTwitter, lookupsTwitter);
|
|
|
|
|
|
|
|
if (lookupsMastodon != null)
|
|
|
|
await _sharedPreferences.setBool(PreferencesKey.lookupsMastodon, lookupsMastodon);
|
|
|
|
|
|
|
|
if (lookupsYatService != null)
|
|
|
|
await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService);
|
|
|
|
|
|
|
|
if (lookupsUnstoppableDomains != null)
|
2023-11-14 21:56:36 +00:00
|
|
|
await _sharedPreferences.setBool(
|
|
|
|
PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains);
|
2023-11-03 19:23:11 +00:00
|
|
|
|
|
|
|
if (lookupsOpenAlias != null)
|
|
|
|
await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias);
|
|
|
|
|
2023-11-14 21:56:36 +00:00
|
|
|
if (lookupsENS != null) await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS);
|
2023-11-03 19:23:11 +00:00
|
|
|
|
2023-11-14 21:56:36 +00:00
|
|
|
if (syncAll != null) await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
|
2023-08-04 17:55:56 +00:00
|
|
|
|
2023-11-14 21:56:36 +00:00
|
|
|
if (syncMode != null) await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode);
|
2023-08-04 17:55:56 +00:00
|
|
|
|
2021-01-13 16:43:34 +00:00
|
|
|
await preferencesFile.delete();
|
|
|
|
}
|
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
Future<void> _importKeychainDumpV1(String password,
|
2023-08-04 13:49:26 +00:00
|
|
|
{required String nonce, String keychainSalt = secrets.backupKeychainSalt}) async {
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2021-01-13 16:43:34 +00:00
|
|
|
final keychainDumpFile = File('${appDir.path}/~_keychain_dump');
|
2023-08-04 13:49:26 +00:00
|
|
|
final decryptedKeychainDumpFileData =
|
|
|
|
await _decryptV1(keychainDumpFile.readAsBytesSync(), '$keychainSalt$password', nonce);
|
|
|
|
final keychainJSON =
|
|
|
|
json.decode(utf8.decode(decryptedKeychainDumpFileData)) as Map<String, dynamic>;
|
2021-01-13 16:43:34 +00:00
|
|
|
final keychainWalletsInfo = keychainJSON['wallets'] as List;
|
|
|
|
final decodedPin = keychainJSON['pin'] as String;
|
|
|
|
final pinCodeKey = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
2023-08-04 13:49:26 +00:00
|
|
|
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
2021-01-15 17:41:30 +00:00
|
|
|
final backupPassword = keychainJSON[backupPasswordKey] as String;
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
await _secureStorage.write(key: backupPasswordKey, value: backupPassword);
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
keychainWalletsInfo.forEach((dynamic rawInfo) async {
|
|
|
|
final info = rawInfo as Map<String, dynamic>;
|
|
|
|
await importWalletKeychainInfo(info);
|
|
|
|
});
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
await _secureStorage.write(key: pinCodeKey, value: encodedPinCode(pin: decodedPin));
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
keychainDumpFile.deleteSync();
|
|
|
|
}
|
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
Future<void> _importKeychainDumpV2(String password,
|
|
|
|
{String keychainSalt = secrets.backupKeychainSalt}) async {
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
final appDir = await getAppDir();
|
2022-10-26 19:28:27 +00:00
|
|
|
final keychainDumpFile = File('${appDir.path}/~_keychain_dump');
|
2023-08-04 13:49:26 +00:00
|
|
|
final decryptedKeychainDumpFileData =
|
|
|
|
await _decryptV2(keychainDumpFile.readAsBytesSync(), '$keychainSalt$password');
|
|
|
|
final keychainJSON =
|
|
|
|
json.decode(utf8.decode(decryptedKeychainDumpFileData)) as Map<String, dynamic>;
|
2022-10-26 19:28:27 +00:00
|
|
|
final keychainWalletsInfo = keychainJSON['wallets'] as List;
|
|
|
|
final decodedPin = keychainJSON['pin'] as String;
|
|
|
|
final pinCodeKey = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
2023-08-04 13:49:26 +00:00
|
|
|
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
2022-10-26 19:28:27 +00:00
|
|
|
final backupPassword = keychainJSON[backupPasswordKey] as String;
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
await _secureStorage.write(key: backupPasswordKey, value: backupPassword);
|
2022-10-26 19:28:27 +00:00
|
|
|
|
|
|
|
keychainWalletsInfo.forEach((dynamic rawInfo) async {
|
|
|
|
final info = rawInfo as Map<String, dynamic>;
|
|
|
|
await importWalletKeychainInfo(info);
|
|
|
|
});
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
await _secureStorage.write(key: pinCodeKey, value: encodedPinCode(pin: decodedPin));
|
2022-10-26 19:28:27 +00:00
|
|
|
|
|
|
|
keychainDumpFile.deleteSync();
|
|
|
|
}
|
|
|
|
|
2021-01-13 16:43:34 +00:00
|
|
|
Future<void> importWalletKeychainInfo(Map<String, dynamic> info) async {
|
|
|
|
final name = info['name'] as String;
|
|
|
|
final password = info['password'] as String;
|
|
|
|
|
|
|
|
await _keyService.saveWalletPassword(walletName: name, password: password);
|
|
|
|
}
|
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
@Deprecated('Use v2 instead')
|
|
|
|
Future<Uint8List> _exportKeychainDumpV1(String password,
|
2023-08-04 13:49:26 +00:00
|
|
|
{required String nonce, String keychainSalt = secrets.backupKeychainSalt}) async =>
|
|
|
|
throw Exception('Deprecated');
|
2022-10-26 19:28:27 +00:00
|
|
|
|
|
|
|
Future<Uint8List> _exportKeychainDumpV2(String password,
|
|
|
|
{String keychainSalt = secrets.backupKeychainSalt}) async {
|
2021-01-13 16:43:34 +00:00
|
|
|
final key = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
2024-05-08 20:23:27 +00:00
|
|
|
final encodedPin = await _secureStorage.read(key: key);
|
2022-10-12 17:09:57 +00:00
|
|
|
final decodedPin = decodedPinCode(pin: encodedPin!);
|
2023-08-04 13:49:26 +00:00
|
|
|
final wallets = await Future.wait(_walletInfoSource.values.map((walletInfo) async {
|
2021-01-13 16:43:34 +00:00
|
|
|
return {
|
|
|
|
'name': walletInfo.name,
|
|
|
|
'type': walletInfo.type.toString(),
|
2023-08-04 13:49:26 +00:00
|
|
|
'password': await _keyService.getWalletPassword(walletName: walletInfo.name)
|
2021-01-13 16:43:34 +00:00
|
|
|
};
|
|
|
|
}));
|
2023-08-04 13:49:26 +00:00
|
|
|
final backupPasswordKey = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
2024-05-08 20:23:27 +00:00
|
|
|
final backupPassword = await _secureStorage.read(key: backupPasswordKey);
|
2023-08-04 13:49:26 +00:00
|
|
|
final data = utf8.encode(
|
|
|
|
json.encode({'pin': decodedPin, 'wallets': wallets, backupPasswordKey: backupPassword}));
|
|
|
|
final encrypted = await _encryptV2(Uint8List.fromList(data), '$keychainSalt$password');
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
return encrypted;
|
|
|
|
}
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
Future<String> _exportPreferencesJSON() async {
|
2022-10-18 15:38:54 +00:00
|
|
|
final preferences = <String, dynamic>{
|
2021-01-13 16:43:34 +00:00
|
|
|
PreferencesKey.currentWalletName:
|
2022-10-26 19:28:27 +00:00
|
|
|
_sharedPreferences.getString(PreferencesKey.currentWalletName),
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.currentNodeIdKey: _sharedPreferences.getInt(PreferencesKey.currentNodeIdKey),
|
|
|
|
PreferencesKey.currentBalanceDisplayModeKey:
|
|
|
|
_sharedPreferences.getInt(PreferencesKey.currentBalanceDisplayModeKey),
|
|
|
|
PreferencesKey.currentWalletType: _sharedPreferences.getInt(PreferencesKey.currentWalletType),
|
2021-01-13 16:43:34 +00:00
|
|
|
PreferencesKey.currentFiatCurrencyKey:
|
2022-10-26 19:28:27 +00:00
|
|
|
_sharedPreferences.getString(PreferencesKey.currentFiatCurrencyKey),
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.shouldSaveRecipientAddressKey:
|
|
|
|
_sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey),
|
|
|
|
PreferencesKey.disableBuyKey: _sharedPreferences.getBool(PreferencesKey.disableBuyKey),
|
|
|
|
PreferencesKey.disableSellKey: _sharedPreferences.getBool(PreferencesKey.disableSellKey),
|
2023-11-14 21:56:36 +00:00
|
|
|
PreferencesKey.defaultBuyProvider:
|
|
|
|
_sharedPreferences.getInt(PreferencesKey.defaultBuyProvider),
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.currentPinLength: _sharedPreferences.getInt(PreferencesKey.currentPinLength),
|
|
|
|
PreferencesKey.currentTransactionPriorityKeyLegacy:
|
|
|
|
_sharedPreferences.getInt(PreferencesKey.currentTransactionPriorityKeyLegacy),
|
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey:
|
|
|
|
_sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey),
|
2021-01-13 16:43:34 +00:00
|
|
|
PreferencesKey.currentLanguageCode:
|
2022-10-26 19:28:27 +00:00
|
|
|
_sharedPreferences.getString(PreferencesKey.currentLanguageCode),
|
2021-01-13 16:43:34 +00:00
|
|
|
PreferencesKey.displayActionListModeKey:
|
2022-10-26 19:28:27 +00:00
|
|
|
_sharedPreferences.getInt(PreferencesKey.displayActionListModeKey),
|
2023-08-04 13:49:26 +00:00
|
|
|
PreferencesKey.currentTheme: _sharedPreferences.getInt(PreferencesKey.currentTheme),
|
|
|
|
PreferencesKey.exchangeStatusKey: _sharedPreferences.getInt(PreferencesKey.exchangeStatusKey),
|
|
|
|
PreferencesKey.currentDefaultSettingsMigrationVersion:
|
|
|
|
_sharedPreferences.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion),
|
2021-01-27 17:26:26 +00:00
|
|
|
PreferencesKey.bitcoinTransactionPriority:
|
2022-10-26 19:28:27 +00:00
|
|
|
_sharedPreferences.getInt(PreferencesKey.bitcoinTransactionPriority),
|
2021-01-27 17:26:26 +00:00
|
|
|
PreferencesKey.moneroTransactionPriority:
|
2022-10-26 19:28:27 +00:00
|
|
|
_sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority),
|
2022-12-06 23:38:36 +00:00
|
|
|
PreferencesKey.currentFiatApiModeKey:
|
2023-08-04 13:49:26 +00:00
|
|
|
_sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey),
|
2023-11-14 21:56:36 +00:00
|
|
|
PreferencesKey.sortBalanceBy: _sharedPreferences.getInt(PreferencesKey.sortBalanceBy),
|
2023-08-04 17:01:49 +00:00
|
|
|
PreferencesKey.pinNativeTokenAtTop:
|
|
|
|
_sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop),
|
2023-11-14 21:56:36 +00:00
|
|
|
PreferencesKey.useEtherscan: _sharedPreferences.getBool(PreferencesKey.useEtherscan),
|
2023-11-17 18:35:46 +00:00
|
|
|
PreferencesKey.defaultNanoRep: _sharedPreferences.getString(PreferencesKey.defaultNanoRep),
|
|
|
|
PreferencesKey.defaultBananoRep:
|
|
|
|
_sharedPreferences.getString(PreferencesKey.defaultBananoRep),
|
2023-11-14 21:56:36 +00:00
|
|
|
PreferencesKey.lookupsTwitter: _sharedPreferences.getBool(PreferencesKey.lookupsTwitter),
|
|
|
|
PreferencesKey.lookupsMastodon: _sharedPreferences.getBool(PreferencesKey.lookupsMastodon),
|
2023-11-03 19:23:11 +00:00
|
|
|
PreferencesKey.lookupsYatService:
|
2023-11-14 21:56:36 +00:00
|
|
|
_sharedPreferences.getBool(PreferencesKey.lookupsYatService),
|
2023-11-03 19:23:11 +00:00
|
|
|
PreferencesKey.lookupsUnstoppableDomains:
|
2023-11-14 21:56:36 +00:00
|
|
|
_sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains),
|
|
|
|
PreferencesKey.lookupsOpenAlias: _sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias),
|
|
|
|
PreferencesKey.lookupsENS: _sharedPreferences.getBool(PreferencesKey.lookupsENS),
|
|
|
|
PreferencesKey.syncModeKey: _sharedPreferences.getInt(PreferencesKey.syncModeKey),
|
|
|
|
PreferencesKey.syncAllKey: _sharedPreferences.getBool(PreferencesKey.syncAllKey),
|
2023-08-29 16:11:51 +00:00
|
|
|
PreferencesKey.autoGenerateSubaddressStatusKey:
|
|
|
|
_sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey),
|
2021-01-13 16:43:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return json.encode(preferences);
|
|
|
|
}
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
int getVersion(Uint8List data) => data.toList().first;
|
|
|
|
|
|
|
|
Uint8List setVersion(Uint8List data, int version) {
|
|
|
|
final bytes = data.toList()..insert(0, version);
|
|
|
|
return Uint8List.fromList(bytes);
|
|
|
|
}
|
|
|
|
|
2022-10-26 19:28:27 +00:00
|
|
|
@Deprecated('Use v2 instead')
|
2023-08-04 13:49:26 +00:00
|
|
|
Future<Uint8List> _encryptV1(Uint8List data, String secretKeySource, String nonceBase64) async =>
|
|
|
|
throw Exception('Deprecated');
|
2021-01-13 16:43:34 +00:00
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
Future<Uint8List> _decryptV1(Uint8List data, String secretKeySource, String nonceBase64,
|
|
|
|
{int macLength = 16}) async {
|
2022-10-18 15:38:54 +00:00
|
|
|
final secretKeyHash = await Cryptography.instance.sha256().hash(utf8.encode(secretKeySource));
|
|
|
|
final secretKey = SecretKey(secretKeyHash.bytes);
|
|
|
|
final nonce = base64.decode(nonceBase64).toList();
|
2023-08-04 13:49:26 +00:00
|
|
|
final box = SecretBox(Uint8List.sublistView(data, 0, data.lengthInBytes - macLength).toList(),
|
|
|
|
nonce: nonce, mac: Mac(Uint8List.sublistView(data, data.lengthInBytes - macLength)));
|
2022-10-18 15:38:54 +00:00
|
|
|
final plainData = await _cipher.decrypt(box, secretKey: secretKey);
|
|
|
|
return Uint8List.fromList(plainData);
|
2021-01-13 16:43:34 +00:00
|
|
|
}
|
2022-10-26 19:28:27 +00:00
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
Future<Uint8List> _encryptV2(Uint8List data, String passphrase) async =>
|
|
|
|
cake_backup.encrypt(passphrase, data, version: _v2);
|
2022-10-26 19:28:27 +00:00
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
Future<Uint8List> _decryptV2(Uint8List data, String passphrase) async =>
|
|
|
|
cake_backup.decrypt(passphrase, data);
|
2021-01-13 16:43:34 +00:00
|
|
|
}
|