What changed, and why it matters
This commit refactors how the app protects two sensitive screens (LWS keys and secret seed/keys). It replaces a route-level 'ReauthGate' with a new 'AppLockGate' and adds an explicit App Lock check before showing the same content as a desktop popup sheet. The change appears intended to make the protection consistent across mobile routes and desktop sheets, not to remove it. However, the actual behavior of the new AppLockGate and passAppLock helper is not visible in this diff, so we cannot confirm whether protection is stronger, weaker, or unchanged.
Review the implementation of AppLockGate and passAppLock in the wallet_fhse/security_keys_ui dependency to confirm they require a fresh, strong authentication before exposing LWS keys or the recovery seed. Verify that the desktop sheet path cannot be reached without passing the gate, and that failure paths block access rather than falling back silently.
Security signals we found
Authentication gate renamed from ReauthGate to AppLockGate
Desktop sheet paths now call passAppLock() before displaying secrets
Route-level gate still present for mobile paths
Localized error string for failed authentication removed from settings flow
Direct BiometricAuth.confirmOwner dependency removed from settings screen
Evidence from the diff
The patch swaps ReauthGate for AppLockGate on /lws_keys and /secret_keys routes, removes a direct BiometricAuth.confirmOwner() call and the associated ‘Unable to authenticate’ error string from the desktop settings sheet, and instead calls passAppLock() inside showLwsKeysSheet() and showSecretKeysSheet() before presenting desktop modal sheets. The stated rationale is that sheets are not routes, so the route-level gate did not cover desktop sheets. The implementation now centralizes the lock check in the sheet helpers. Because the definitions of AppLockGate and passAppLock are not included in the diff, we cannot verify whether they enforce device authentication, app PIN, or any authentication at all.
Changed components
lib/main.dartlib/screens/lws_keys.dartlib/screens/secret_keys.dartlib/screens/settings.dartlib/l10n/app_en.arblib/l10n/app_pt.arblib/l10n/app_localizations.dartlib/l10n/app_localizations_en.dartlib/l10n/app_localizations_pt.dartInspect captured patch +21 / −44
### lib/l10n/app_en.arb
@@ -254,7 +254,6 @@
"settingsNotifyNewTxsDescription": "Show a notification when you receive a transaction. When connected to a Monero node, Background Sync must also be enabled.",
"settingsNotifyNewTxsDescriptionIos": "Notifications will be delayed for Tor LWS connections.",
"settingsAppLockUnlockReason": "Unlock Wallet",
- "settingsAppLockUnableToAuthError": "Unable to authenticate. Make sure you have device unlock set up.",
"settingsLoggingLabel": "Diagnostic Logs",
"settingsLoggingDescription": "Log wallet operations to a text file in the app's data folder for debugging purposes.",
"settingsLoggingDescriptionIos": "Log wallet operations and allow the logs to be exported to a text file.",
### lib/l10n/app_localizations.dart
@@ -1365,12 +1365,6 @@ abstract class AppLocalizations {
/// **'Unlock Wallet'**
String get settingsAppLockUnlockReason;
- /// No description provided for @settingsAppLockUnableToAuthError.
- ///
- /// In en, this message translates to:
- /// **'Unable to authenticate. Make sure you have device unlock set up.'**
- String get settingsAppLockUnableToAuthError;
-
/// No description provided for @settingsLoggingLabel.
///
/// In en, this message translates to:
### lib/l10n/app_localizations_en.dart
@@ -699,10 +699,6 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get settingsAppLockUnlockReason => 'Unlock Wallet';
- @override
- String get settingsAppLockUnableToAuthError =>
- 'Unable to authenticate. Make sure you have device unlock set up.';
-
@override
String get settingsLoggingLabel => 'Diagnostic Logs';
### lib/l10n/app_localizations_pt.dart
@@ -703,10 +703,6 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get settingsAppLockUnlockReason => 'Desbloquear carteira';
- @override
- String get settingsAppLockUnableToAuthError =>
- 'Não foi possível autenticar. Verifique se o desbloqueio de tela está configurado.';
-
@override
String get settingsLoggingLabel => 'Logs de Diagnóstico';
### lib/l10n/app_pt.arb
@@ -248,7 +248,6 @@
"settingsNotifyNewTxsDescription": "Mostrar uma notificação quando você receber uma transação. Ao conectar-se a um nó Monero, a Sincronização em Segundo Plano também precisa estar ativada.",
"settingsNotifyNewTxsDescriptionIos": "As notificações serão atrasadas para conexões LWS via Tor.",
"settingsAppLockUnlockReason": "Desbloquear carteira",
- "settingsAppLockUnableToAuthError": "Não foi possível autenticar. Verifique se o desbloqueio de tela está configurado.",
"settingsLoggingLabel": "Logs de Diagnóstico",
"settingsLoggingDescription": "Registrar operações da carteira em um arquivo de texto na pasta de dados do app para fins de depuração.",
"settingsLoggingDescriptionIos": "Registrar operações da carteira e permitir exportar os logs para um arquivo de texto.",
### lib/main.dart
@@ -215,11 +215,11 @@ class _AppRootState extends State<_AppRoot> with WidgetsBindingObserver {
'/verify_seed': (context) => const VerifySeedScreen(),
'/wallet_home': (context) => WalletHomeScreen(),
'/settings': (context) => SettingsScreen(),
- '/lws_keys': (context) => ReauthGate(
+ '/lws_keys': (context) => AppLockGate(
reason: AppLocalizations.of(context)!.settingsAppLockUnlockReason,
child: LwsKeysScreen(),
),
- '/secret_keys': (context) => ReauthGate(
+ '/secret_keys': (context) => AppLockGate(
reason: AppLocalizations.of(context)!.revealSeedAuthReason,
child: SecretKeysScreen(),
),
### lib/screens/lws_keys.dart
@@ -5,10 +5,14 @@ import 'package:skylight_wallet/util/secure_clipboard.dart';
import 'package:skylight_wallet/util/secure_screen.dart';
import 'package:skylight_wallet/wallet_core_glue.dart';
import 'package:skylight_wallet/widgets/ui/ui.dart';
+import 'package:wallet_fhse/security_keys_ui.dart' show passAppLock;
-/// Desktop: LWS keys as a centered modal (opened from Settings); mobile keeps
-/// the full-screen route.
-Future<void> showLwsKeysSheet(BuildContext context) {
+/// Desktop: LWS keys as a centered modal (opened from Settings), once App Lock
+/// passes ([passAppLock]): a sheet is not a route, so the `/lws_keys`
+/// AppLockGate does not cover it. Mobile keeps that route.
+Future<void> showLwsKeysSheet(BuildContext context) async {
+ final reason = AppLocalizations.of(context)!.settingsAppLockUnlockReason;
+ if (!await passAppLock(context, reason: reason) || !context.mounted) return;
return showBrandSheet<void>(
context: context,
isScrollControlled: true,
### lib/screens/secret_keys.dart
@@ -5,10 +5,14 @@ import 'package:skylight_wallet/util/secure_clipboard.dart';
import 'package:skylight_wallet/util/secure_screen.dart';
import 'package:skylight_wallet/wallet_core_glue.dart';
import 'package:skylight_wallet/widgets/ui/ui.dart';
+import 'package:wallet_fhse/security_keys_ui.dart' show passAppLock;
-/// Desktop: secret keys as a centered modal (opened from Settings); mobile keeps
-/// the full-screen route.
-Future<void> showSecretKeysSheet(BuildContext context) {
+/// Desktop: secret keys as a centered modal (opened from Settings), once App
+/// Lock passes ([passAppLock]): a sheet is not a route, so the `/secret_keys`
+/// AppLockGate does not cover it. Mobile keeps that route.
+Future<void> showSecretKeysSheet(BuildContext context) async {
+ final reason = AppLocalizations.of(context)!.revealSeedAuthReason;
+ if (!await passAppLock(context, reason: reason) || !context.mounted) return;
return showBrandSheet<void>(
context: context,
isScrollControlled: true,
### lib/screens/settings.dart
@@ -29,7 +29,6 @@ import 'package:skylight_wallet/widgets/language_sheet.dart';
import 'package:skylight_wallet/widgets/privacy_settings_sheets.dart';
import 'package:skylight_wallet/widgets/ui/ui.dart';
import 'package:skylight_wallet/widgets/wallet_navigation_bar.dart';
-import 'package:wallet_infra/wallet_infra.dart' show BiometricAuth, BiometricAuthResult;
/// Desktop: settings as a wide centered modal (opened from the sidebar); mobile
/// keeps the full-screen tab.
@@ -257,14 +256,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
}
- /// Gate the seed behind a device auth even though the app is already
- /// unlocked. Reaching this screen hands over the seed and secret spend key,
- /// which is total, irreversible control of the funds; the warning sheet alone
- /// stops nobody holding the phone.
- ///
- /// Only when app lock is on, though -- turning it off is the user saying this
- /// app does not ask the device who is holding the phone, and a prompt that
- /// appears anyway reads as the setting being ignored.
+ /// The recovery phrase and secret spend key are total, irreversible control of
+ /// the funds, so the warning alone is not enough: the screen (or desktop
+ /// sheet) needs a passing App Lock, asked again even though the app is
+ /// already unlocked (`/secret_keys` is an AppLockGate route;
+ /// [showSecretKeysSheet] asks itself).
Future<void> _showViewSecretKeysDialog() async {
final i18n = AppLocalizations.of(context)!;
@@ -280,17 +276,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
if (ok != true || !mounted) return;
if (isDesktop) {
- // The sheet is not a route, so the /secret_keys ReauthGate does not cover
- // it: where App Lock is the device's prompt (macOS, the iOS build on a
- // Mac) it prompts here; on Linux and Windows it stays behind the unlock.
- if (usesDeviceLock) {
- final result = await BiometricAuth.confirmOwner(reason: i18n.revealSeedAuthReason);
- if (result != BiometricAuthResult.authenticated) {
- if (mounted) showBrandToast(context, i18n.settingsAppLockUnableToAuthError);
- return;
- }
- if (!mounted) return;
- }
await showSecretKeysSheet(context);
} else {
await Navigator.pushNamed(context, '/secret_keys');Why this scored 32/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.