feat(auth): Enhance logout flow with comprehensive data clearing

This commit is contained in:
cogwheel0
2025-11-12 13:44:05 +05:30
parent 45135d9185
commit ecf760d9ec
6 changed files with 45 additions and 11 deletions

View File

@@ -395,11 +395,15 @@ class OptimizedStorageService {
// ---------------------------------------------------------------------------
// Batch operations
// ---------------------------------------------------------------------------
/// Clear all authentication-related data including credentials, tokens,
/// server configurations, and custom headers
Future<void> clearAuthData() async {
await Future.wait([
deleteAuthToken(),
deleteSavedCredentials(),
_preferencesBox.delete(_activeServerIdKey),
// Clear server configurations (which include custom headers)
_secureCredentialStorage.clearAll(),
]);
_cache.removeWhere(
@@ -416,7 +420,7 @@ class OptimizedStorageService {
);
DebugLogger.log(
'Auth data cleared in batch operation',
'Auth data cleared in batch operation (including server configs and custom headers)',
scope: 'storage/optimized',
);
}

View File

@@ -280,11 +280,12 @@ class SecureCredentialStorage {
}
}
/// Clear all secure data
/// Clear all secure data including credentials, tokens, and server configurations
/// (which contain custom headers)
Future<void> clearAll() async {
try {
await _secureStorage.deleteAll();
DebugLogger.storage('clear-ok', scope: 'credentials');
DebugLogger.storage('clear-ok (all secure data including server configs with custom headers)', scope: 'credentials');
} catch (e) {
DebugLogger.error('clear-failed', scope: 'credentials', error: e);
}