This commit is contained in:
2026-07-27 21:32:03 +02:00
parent 160b4e4cda
commit 77c1747b40
23 changed files with 1392 additions and 87 deletions
+2 -5
View File
@@ -4,12 +4,9 @@ import 'dart:math';
import 'package:crypto/crypto.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
/// Stores and verifies a PIN. The raw PIN is never persisted — only a
/// salted SHA-256 hash of it, kept in secure storage (Keychain on iOS,
/// EncryptedSharedPreferences/Keystore on Android).
class PinLockService {
PinLockService({FlutterSecureStorage? storage})
: _storage = storage ?? const FlutterSecureStorage();
: _storage = storage ?? const FlutterSecureStorage();
static const _saltKey = 'pin_salt';
static const _hashKey = 'pin_hash';
@@ -53,4 +50,4 @@ class PinLockService {
final bytes = utf8.encode('$salt:$pin');
return sha256.convert(bytes).toString();
}
}
}