fix
This commit is contained in:
@@ -52,6 +52,9 @@ class SecureStorage {
|
||||
/// Key for storing username
|
||||
static const String _usernameKey = 'username';
|
||||
|
||||
/// Key for storing email
|
||||
static const String _emailKey = 'email';
|
||||
|
||||
// ==================== Token Management ====================
|
||||
|
||||
/// Save access token securely
|
||||
@@ -126,6 +129,24 @@ class SecureStorage {
|
||||
}
|
||||
}
|
||||
|
||||
/// Save email
|
||||
Future<void> saveEmail(String email) async {
|
||||
try {
|
||||
await _storage.write(key: _emailKey, value: email);
|
||||
} catch (e) {
|
||||
throw Exception('Failed to save email: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Get email
|
||||
Future<String?> getEmail() async {
|
||||
try {
|
||||
return await _storage.read(key: _emailKey);
|
||||
} catch (e) {
|
||||
throw Exception('Failed to read email: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if user is authenticated (has valid access token)
|
||||
Future<bool> isAuthenticated() async {
|
||||
final token = await getAccessToken();
|
||||
|
||||
Reference in New Issue
Block a user