diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index c1b403ccf..af88796d5 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit c1b403ccf6f4fffc9f7c233038c3df40f997c2b3 +Subproject commit af88796d5e4988c03422320c3842af5cf6c049ef diff --git a/lib/main.dart b/lib/main.dart index 8296d739a..493347263 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -344,12 +344,12 @@ class _MaterialAppWithThemeState extends ConsumerState case "oceanBreeze": colorTheme = OceanBreezeColors(); break; - case "light": - colorTheme = LightColors(); - break; case "fruitSorbet": - default: colorTheme = FruitSorbetColors(); + break; + case "light": + default: + colorTheme = LightColors(); } loadingCompleter = Completer(); WidgetsBinding.instance.addObserver(this); diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart index b638d72a1..9b98d4aa8 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart @@ -46,10 +46,15 @@ class _WalletTableState extends ConsumerState { VoidCallback? expandOverride; if (providers.length == 1) { - expandOverride = () { - Navigator.of(context).pushNamed( + expandOverride = () async { + final manager = ref.read(providers.first); + if (manager.coin == Coin.monero || + manager.coin == Coin.wownero) { + await manager.initializeExisting(); + } + await Navigator.of(context).pushNamed( DesktopWalletView.routeName, - arguments: ref.read(providers.first).walletId, + arguments: manager.walletId, ); }; } diff --git a/lib/utilities/desktop_password_service.dart b/lib/utilities/desktop_password_service.dart index 9ef83932b..6263eb33b 100644 --- a/lib/utilities/desktop_password_service.dart +++ b/lib/utilities/desktop_password_service.dart @@ -4,9 +4,12 @@ import 'package:stackwallet/hive/db.dart'; import 'package:stackwallet/utilities/logger.dart'; const String _kKeyBlobKey = "swbKeyBlobKeyStringID"; +const String _kKeyBlobVersionKey = "swbKeyBlobVersionKeyStringID"; + +const int kLatestBlobVersion = 2; String _getMessageFromException(Object exception) { - if (exception is IncorrectPassphrase) { + if (exception is IncorrectPassphraseOrVersion) { return exception.errMsg(); } if (exception is BadDecryption) { @@ -18,6 +21,9 @@ String _getMessageFromException(Object exception) { if (exception is EncodingError) { return exception.errMsg(); } + if (exception is VersionError) { + return exception.errMsg(); + } return exception.toString(); } @@ -41,7 +47,10 @@ class DPS { } try { - _handler = await StorageCryptoHandler.fromNewPassphrase(passphrase); + _handler = await StorageCryptoHandler.fromNewPassphrase( + passphrase, + kLatestBlobVersion, + ); final box = await Hive.openBox(DB.boxNameDesktopData); await DB.instance.put( @@ -49,6 +58,7 @@ class DPS { key: _kKeyBlobKey, value: await _handler!.getKeyBlob(), ); + await _updateStoredKeyBlobVersion(kLatestBlobVersion); await box.close(); } catch (e, s) { Logging.instance.log( @@ -78,7 +88,24 @@ class DPS { } try { - _handler = await StorageCryptoHandler.fromExisting(passphrase, keyBlob); + final blobVersion = await _getStoredKeyBlobVersion(); + _handler = await StorageCryptoHandler.fromExisting( + passphrase, + keyBlob, + blobVersion, + ); + if (blobVersion < kLatestBlobVersion) { + // update blob + await _handler!.resetPassphrase(passphrase, kLatestBlobVersion); + final box = await Hive.openBox(DB.boxNameDesktopData); + await DB.instance.put( + boxName: DB.boxNameDesktopData, + key: _kKeyBlobKey, + value: await _handler!.getKeyBlob(), + ); + await _updateStoredKeyBlobVersion(kLatestBlobVersion); + await box.close(); + } } catch (e, s) { Logging.instance.log( "${_getMessageFromException(e)}\n$s", @@ -102,7 +129,8 @@ class DPS { } try { - await StorageCryptoHandler.fromExisting(passphrase, keyBlob); + final blobVersion = await _getStoredKeyBlobVersion(); + await StorageCryptoHandler.fromExisting(passphrase, keyBlob, blobVersion); // existing passphrase matches key blob return true; } catch (e, s) { @@ -135,8 +163,10 @@ class DPS { return false; } + final blobVersion = await _getStoredKeyBlobVersion(); + try { - await _handler!.resetPassphrase(passphraseNew); + await _handler!.resetPassphrase(passphraseNew, blobVersion); final box = await Hive.openBox(DB.boxNameDesktopData); await DB.instance.put( @@ -144,6 +174,7 @@ class DPS { key: _kKeyBlobKey, value: await _handler!.getKeyBlob(), ); + await _updateStoredKeyBlobVersion(blobVersion); await box.close(); // successfully updated passphrase @@ -164,4 +195,22 @@ class DPS { ); return keyBlob != null; } + + Future _getStoredKeyBlobVersion() async { + final box = await Hive.openBox(DB.boxNameDesktopData); + final keyBlobVersionString = DB.instance.get( + boxName: DB.boxNameDesktopData, + key: _kKeyBlobVersionKey, + ); + await box.close(); + return int.tryParse(keyBlobVersionString ?? "1") ?? 1; + } + + Future _updateStoredKeyBlobVersion(int version) async { + await DB.instance.put( + boxName: DB.boxNameDesktopData, + key: _kKeyBlobVersionKey, + value: version.toString(), + ); + } } diff --git a/lib/utilities/theme/fruit_sorbet_colors.dart b/lib/utilities/theme/fruit_sorbet_colors.dart index 6f0a81e82..3394b3a9c 100644 --- a/lib/utilities/theme/fruit_sorbet_colors.dart +++ b/lib/utilities/theme/fruit_sorbet_colors.dart @@ -327,7 +327,7 @@ class FruitSorbetColors extends StackColorTheme { @override Color get rateTypeToggleDesktopColorOn => const Color(0xFFFFD8CE); @override - Color get rateTypeToggleDesktopColorOff => buttonBackSecondary; + Color get rateTypeToggleDesktopColorOff => popupBG; @override BoxShadow get standardBoxShadow => BoxShadow( diff --git a/pubspec.lock b/pubspec.lock index 8364e6ec9..43c38602b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1408,8 +1408,8 @@ packages: dependency: "direct main" description: path: "." - ref: "6ada1204a4e0cf84d932b568e6150550478db69b" - resolved-ref: "6ada1204a4e0cf84d932b568e6150550478db69b" + ref: "93e2687bcc10fc7258c7dab038c363fc9ff8ba5d" + resolved-ref: "93e2687bcc10fc7258c7dab038c363fc9ff8ba5d" url: "https://github.com/cypherstack/stack_wallet_backup.git" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index e87083899..69ddc1111 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,7 @@ dependencies: stack_wallet_backup: git: url: https://github.com/cypherstack/stack_wallet_backup.git - ref: 6ada1204a4e0cf84d932b568e6150550478db69b + ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 bip47: git: