Update Saqel Platform: 2026-09-08 17:51:07
This commit is contained in:
@@ -6,6 +6,9 @@ import '../utils/app_logger.dart';
|
||||
|
||||
/// Enterprise Storage Service with Device-Bound Payload Obfuscation & Secure KeyStore/Keychain
|
||||
class StorageService {
|
||||
// Keeps a newly issued session available during this app run if the macOS
|
||||
// debug runner has no Keychain entitlement. Production still uses Keychain.
|
||||
static final Map<String, String> _volatileStore = <String, String>{};
|
||||
final FlutterSecureStorage _secureStorage;
|
||||
|
||||
StorageService({FlutterSecureStorage? secureStorage})
|
||||
@@ -26,6 +29,7 @@ class StorageService {
|
||||
static const String _keyDeviceId = 'saqel_device_id';
|
||||
|
||||
Future<void> _writeSafe(String key, String value) async {
|
||||
_volatileStore[key] = value;
|
||||
try {
|
||||
await _secureStorage.write(key: key, value: value);
|
||||
} on PlatformException catch (e) {
|
||||
@@ -38,10 +42,11 @@ class StorageService {
|
||||
final val = await _secureStorage.read(key: key);
|
||||
if (val != null && val.isNotEmpty) return val;
|
||||
} catch (_) {}
|
||||
return null;
|
||||
return _volatileStore[key];
|
||||
}
|
||||
|
||||
Future<void> _deleteSafe(String key) async {
|
||||
_volatileStore.remove(key);
|
||||
try {
|
||||
await _secureStorage.delete(key: key);
|
||||
} catch (_) {}
|
||||
|
||||
Reference in New Issue
Block a user