fix(security): require a fresh PIN or biometric check for sensitive actions

An unlocked phone was enough to read the 24-word recovery phrase. The
phrase, backup export and import, the duress PIN, a longer auto-lock,
turning off screen security, enabling biometrics and deleting the
account now ask for the PIN (or biometrics with biometricOnly) every
time. The duress session never shows the phrase. PIN checks outside the
lock screen count towards the same failure throttle.
This commit is contained in:
Julius Joska
2026-10-23 10:50:16 +02:00
parent 5b237c82f2
commit 2f6b542f24
19 changed files with 1442 additions and 45 deletions
+14
View File
@@ -83,6 +83,20 @@ class ScreenSecurityNotifier extends AsyncNotifier<bool> {
state = AsyncData(value);
}
/// Po dobu [body] drží ochranu zapnutou bez ohledu na nastavení a pak
/// vrátí uložený stav. Pro 24 slov: vypnutý přepínač nesmí pustit frázi
/// do screenshotu ani do náhledu v přepínači aplikací. Ladicí build
/// výjimku má stejně jako MainActivity — QA potřebuje snímky z emulátoru.
Future<T> enforceWhile<T>(Future<T> Function() body) async {
if (kDebugMode) return body();
await _apply(true);
try {
return await body();
} finally {
await _apply(state.valueOrNull ?? vychozi);
}
}
Future<void> _apply(bool on) async {
try {
if (on) {