Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][auth] Used memLimitInteractive instead of memLimitSensitive to avoid delay

Aman Raj Singh Mourya0ce9ceba12b2
diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_password.dart b/auth/lib/ui/settings/lock_screen/lock_screen_password.dart
index 1c43ff8229..5252a2def9 100644
--- a/auth/lib/ui/settings/lock_screen/lock_screen_password.dart
+++ b/auth/lib/ui/settings/lock_screen/lock_screen_password.dart
@@ -201,7 +201,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
final hash = cryptoPwHash(
utf8.encode(inputtedPassword),
salt!,
- sodium.crypto.pwhash.memLimitSensitive,
+ sodium.crypto.pwhash.memLimitInteractive,
sodium.crypto.pwhash.opsLimitSensitive,
sodium,
);
diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_pin.dart b/auth/lib/ui/settings/lock_screen/lock_screen_pin.dart
index e45ec75ac0..c4b8a6070e 100644
--- a/auth/lib/ui/settings/lock_screen/lock_screen_pin.dart
+++ b/auth/lib/ui/settings/lock_screen/lock_screen_pin.dart
@@ -63,7 +63,7 @@ class _LockScreenPinState extends State<LockScreenPin> {
final hash = cryptoPwHash(
utf8.encode(inputtedPin),
salt!,
- sodium.crypto.pwhash.memLimitSensitive,
+ sodium.crypto.pwhash.memLimitInteractive,
sodium.crypto.pwhash.opsLimitSensitive,
sodium,
);
diff --git a/auth/lib/utils/lock_screen_settings.dart b/auth/lib/utils/lock_screen_settings.dart
index e1b88bd040..8153e6b99f 100644
--- a/auth/lib/utils/lock_screen_settings.dart
+++ b/auth/lib/utils/lock_screen_settings.dart
@@ -72,14 +72,12 @@ class LockScreenSettings {
Future<void> setPin(String userPin) async {
await _secureStorage.delete(key: saltKey);
- await _preferences.setString(pin, userPin);
- await _preferences.remove(password);
final salt = _generateSalt();
final hash = cryptoPwHash(
utf8.encode(userPin),
salt,
- sodium.crypto.pwhash.memLimitSensitive,
+ sodium.crypto.pwhash.memLimitInteractive,
sodium.crypto.pwhash.opsLimitSensitive,
sodium,
);
@@ -104,16 +102,13 @@ class LockScreenSettings {
}
Future<void> setPassword(String pass) async {
- await _preferences.setString(password, pass);
- await _preferences.remove(pin);
await _secureStorage.delete(key: saltKey);
-
final salt = _generateSalt();
final hash = cryptoPwHash(
utf8.encode(pass),
salt,
- sodium.crypto.pwhash.memLimitSensitive,
+ sodium.crypto.pwhash.memLimitInteractive,
sodium.crypto.pwhash.opsLimitSensitive,
sodium,
);
@@ -133,8 +128,6 @@ class LockScreenSettings {
}
Future<void> removePinAndPassword() async {
- await _preferences.remove(pin);
- await _preferences.remove(password);
await _secureStorage.delete(key: saltKey);
await _secureStorage.delete(key: pin);
await _secureStorage.delete(key: password);