Update: 2026-07-30 02:27:45

This commit is contained in:
Hamza-Ayed
2026-07-30 02:27:45 +03:00
parent 5f62455113
commit ca4a7c2e70
56 changed files with 3391 additions and 709 deletions
@@ -7,6 +7,8 @@ class SecureStorage {
static const String _keyDeviceSecret = 'device_secret';
static const String _keyUserId = 'user_id';
static const String _keyEmail = 'user_email';
static const String _keyRefreshToken = 'refresh_token';
static const String _keyDeviceId = 'device_id';
Future<void> saveToken(String token) async {
await _storage.write(key: _keyToken, value: token);
@@ -24,6 +26,25 @@ class SecureStorage {
return await _storage.read(key: _keyDeviceSecret);
}
/// Long-lived token used to mint a new access token without re-login.
Future<void> saveRefreshToken(String token) async {
await _storage.write(key: _keyRefreshToken, value: token);
}
Future<String?> getRefreshToken() async {
return await _storage.read(key: _keyRefreshToken);
}
/// The device fingerprint sent at login. Needed to refresh, because refresh
/// tokens are stored per device on the server.
Future<void> saveDeviceId(String deviceId) async {
await _storage.write(key: _keyDeviceId, value: deviceId);
}
Future<String?> getDeviceId() async {
return await _storage.read(key: _keyDeviceId);
}
Future<void> saveEmail(String email) async {
await _storage.write(key: _keyEmail, value: email);
}