diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/cn_wallet_keys.dart b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/cn_wallet_keys.dart index 14cae2ee0..ffe541b21 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/cn_wallet_keys.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/cn_wallet_keys.dart @@ -156,11 +156,13 @@ class _CNWalletKeysState extends State { SizedBox( height: Util.isDesktop ? 12 : 16, ), - QR( - data: _current(_currentDropDownValue), - size: - Util.isDesktop ? 256 : MediaQuery.of(context).size.width / 1.5, - ), + if (_current(_currentDropDownValue) != "ERROR") + QR( + data: _current(_currentDropDownValue), + size: Util.isDesktop + ? 256 + : MediaQuery.of(context).size.width / 1.5, + ), SizedBox( height: Util.isDesktop ? 12 : 16, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart index f2357448c..938e9568a 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart @@ -313,108 +313,7 @@ class _UnlockWalletKeysDesktopState child: PrimaryButton( label: "Continue", enabled: continueEnabled, - onPressed: continueEnabled - ? () async { - unawaited( - showDialog( - context: context, - builder: (context) => const Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - LoadingIndicator( - width: 200, - height: 200, - ), - ], - ), - ), - ); - - await Future.delayed( - const Duration(seconds: 1), - ); - - final verified = await ref - .read(storageCryptoHandlerProvider) - .verifyPassphrase(passwordController.text); - - if (verified) { - if (context.mounted) { - Navigator.of(context, rootNavigator: true) - .pop(); - } - - ({String keys, String config})? frostData; - List? words; - - final wallet = - ref.read(pWallets).getWallet(widget.walletId); - - // TODO: [prio=low] handle wallets that don't have a mnemonic - // All wallets currently are mnemonic based - if (wallet is! MnemonicInterface) { - if (wallet is BitcoinFrostWallet) { - frostData = ( - keys: (await wallet.getSerializedKeys())!, - config: (await wallet.getMultisigConfig())!, - ); - } else { - throw Exception("FIXME ~= see todo in code"); - } - } else { - if (wallet is ViewOnlyOptionInterface && - (wallet as ViewOnlyOptionInterface) - .isViewOnly) { - // TODO: is something needed here? - } else { - words = await wallet.getMnemonicAsWords(); - } - } - - KeyDataInterface? keyData; - if (wallet is ViewOnlyOptionInterface && - wallet.isViewOnly) { - keyData = await wallet.getViewOnlyWalletData(); - } else if (wallet is ExtendedKeysInterface) { - keyData = await wallet.getXPrivs(); - } else if (wallet is LibMoneroWallet) { - keyData = await wallet.getKeys(); - } - - if (context.mounted) { - await Navigator.of(context) - .pushReplacementNamed( - WalletKeysDesktopPopup.routeName, - arguments: ( - mnemonic: words ?? [], - walletId: widget.walletId, - frostData: frostData, - keyData: keyData, - ), - ); - } - } else { - if (context.mounted) { - Navigator.of(context, rootNavigator: true) - .pop(); - } - - await Future.delayed( - const Duration(milliseconds: 300), - ); - if (context.mounted) { - unawaited( - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Invalid passphrase!", - context: context, - ), - ); - } - } - } - : null, + onPressed: continueEnabled ? enterPassphrase : null, ), ), ], diff --git a/lib/wallets/wallet/intermediate/lib_monero_wallet.dart b/lib/wallets/wallet/intermediate/lib_monero_wallet.dart index ffcaa1560..3c3c34a6d 100644 --- a/lib/wallets/wallet/intermediate/lib_monero_wallet.dart +++ b/lib/wallets/wallet/intermediate/lib_monero_wallet.dart @@ -298,14 +298,24 @@ abstract class LibMoneroWallet if (base == null || (oldInfo != null && oldInfo.name != walletId)) { return null; } - - return CWKeyData( - walletId: walletId, - publicViewKey: base.getPublicViewKey(), - privateViewKey: base.getPrivateViewKey(), - publicSpendKey: base.getPublicSpendKey(), - privateSpendKey: base.getPrivateSpendKey(), - ); + try { + return CWKeyData( + walletId: walletId, + publicViewKey: base.getPublicViewKey(), + privateViewKey: base.getPrivateViewKey(), + publicSpendKey: base.getPublicSpendKey(), + privateSpendKey: base.getPrivateSpendKey(), + ); + } catch (e, s) { + Logging.instance.log("getKeys failed: $e\n$s", level: LogLevel.Fatal); + return CWKeyData( + walletId: walletId, + publicViewKey: "ERROR", + privateViewKey: "ERROR", + publicSpendKey: "ERROR", + privateSpendKey: "ERROR", + ); + } } Future<(String, String)>