Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Refactor secure storage key management in Configuration classes to ensure proper key handling on logout

AmanRajSinghMourya1623466d0b89
diff --git a/mobile/apps/auth/lib/core/configuration.dart b/mobile/apps/auth/lib/core/configuration.dart
index 026fbf6578..e6613a5758 100644
--- a/mobile/apps/auth/lib/core/configuration.dart
+++ b/mobile/apps/auth/lib/core/configuration.dart
@@ -41,10 +41,13 @@ class Configuration extends BaseConfiguration {
}
@override
- // Also remove the auth secret key so cached sessions are fully revoked.
+ // This includes both base keys (key, secretKey) and auth-specific keys.
List<String> get secureStorageKeys => [
- ...super.secureStorageKeys,
+ BaseConfiguration.keyKey,
+ BaseConfiguration.secretKeyKey,
authSecretKeyKey,
+ // Note: offlineAuthSecretKey is intentionally not included here
+ // as it persists across logouts
];
@override
diff --git a/mobile/apps/locker/lib/services/configuration.dart b/mobile/apps/locker/lib/services/configuration.dart
index f1a0b6d97d..2a7b30a5f1 100644
--- a/mobile/apps/locker/lib/services/configuration.dart
+++ b/mobile/apps/locker/lib/services/configuration.dart
@@ -3,4 +3,12 @@ import 'package:ente_configuration/base_configuration.dart';
class Configuration extends BaseConfiguration {
Configuration._privateConstructor();
static final Configuration instance = Configuration._privateConstructor();
+
+ @override
+ // Provide all secure storage keys that should be wiped on logout.
+ // Locker app uses the standard keys defined in BaseConfiguration.
+ List<String> get secureStorageKeys => [
+ BaseConfiguration.keyKey,
+ BaseConfiguration.secretKeyKey,
+ ];
}
diff --git a/mobile/packages/configuration/lib/base_configuration.dart b/mobile/packages/configuration/lib/base_configuration.dart
index 6d4bfb6bb0..f85bc7eb11 100644
--- a/mobile/packages/configuration/lib/base_configuration.dart
+++ b/mobile/packages/configuration/lib/base_configuration.dart
@@ -52,14 +52,8 @@ class BaseConfiguration {
String? _volatilePassword;
- // Default secure storage keys that should be wiped when the user logs out.
- static const List<String> _defaultSecureStorageKeysToDelete = [
- keyKey,
- secretKeyKey,
- ];
-
- // Descendants can override to append additional keys that must be cleared.
- List<String> get secureStorageKeys => _defaultSecureStorageKeysToDelete;
+ // Descendants can override to append keys that must be cleared.
+ List<String> get secureStorageKeys => [];
Future<void> init(List<EnteBaseDatabase> dbs) async {
_databases = dbs;