add passphrase check before displaying wallet seed

This commit is contained in:
julian 2022-11-14 13:35:14 -06:00
parent e053764554
commit 9df0569bb1

View file

@ -1,10 +1,15 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart'; import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart';
import 'package:stackwallet/providers/desktop/storage_crypto_handler_provider.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart'; import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
@ -196,36 +201,32 @@ class _UnlockWalletKeysDesktopState
enabled: continueEnabled, enabled: continueEnabled,
onPressed: continueEnabled onPressed: continueEnabled
? () async { ? () async {
// todo: check password final verified = await ref
// Navigator.of(context).pop(); .read(storageCryptoHandlerProvider)
.verifyPassphrase(passwordController.text);
if (verified) {
final words = await ref final words = await ref
.read(walletsChangeNotifierProvider) .read(walletsChangeNotifierProvider)
.getManager(widget.walletId) .getManager(widget.walletId)
.mnemonic; .mnemonic;
await Navigator.of(context).pushReplacementNamed( if (mounted) {
await Navigator.of(context)
.pushReplacementNamed(
WalletKeysDesktopPopup.routeName, WalletKeysDesktopPopup.routeName,
arguments: words, arguments: words,
); );
// }
// await showDialog<void>( } else {
// context: context, unawaited(
// barrierDismissible: false, showFloatingFlushBar(
// builder: (context) => Navigator( type: FlushBarType.warning,
// initialRoute: WalletKeysDesktopPopup.routeName, message: "Invalid passphrase!",
// onGenerateRoute: RouteGenerator.generateRoute, context: context,
// onGenerateInitialRoutes: (_, __) { ),
// return [ );
// RouteGenerator.generateRoute( }
// RouteSettings(
// name: WalletKeysDesktopPopup.routeName,
// arguments: words,
// ),
// )
// ];
// },
// ),
// );
} }
: null, : null,
), ),