mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Fix secrets not being properly rewritten when passphrase is removed
This commit is contained in:
parent
4fc95833e5
commit
e32ee4da2f
1 changed files with 15 additions and 3 deletions
|
@ -36,9 +36,21 @@ public class DataStoreSecret {
|
|||
}
|
||||
|
||||
public boolean requiresRewrite() {
|
||||
return AppPrefs.get() != null
|
||||
&& AppPrefs.get().getLockCrypt().get() != null
|
||||
&& !Objects.equals(AppPrefs.get().getLockCrypt().get(), usedPasswordLockCrypt);
|
||||
if (AppPrefs.get() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Special check for empty passphrases
|
||||
var wasEmpty = usedPasswordLockCrypt == null || usedPasswordLockCrypt.isEmpty();
|
||||
var isEmpty = AppPrefs.get().getLockCrypt().get() == null || AppPrefs.get().getLockCrypt().get().isEmpty();
|
||||
if (wasEmpty && isEmpty) {
|
||||
return false;
|
||||
}
|
||||
if (wasEmpty != isEmpty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !Objects.equals(AppPrefs.get().getLockCrypt().get(), usedPasswordLockCrypt);
|
||||
}
|
||||
|
||||
public char[] getSecret() {
|
||||
|
|
Loading…
Reference in a new issue