If I call try encryptedStore?.changeDatabasePassphrase(oldPassword, toNewPassphrase: newPassword) with the wrong oldPassword, it does throw an error, but the database probably ends up in an inconsistent state. From this point on, calling try encryptedStore?.changeDatabasePassphrase(oldPassword2, toNewPassphrase: newPassword) always fails, even if oldPassword2 is correct. This gets fixed by restarting the app.
I was able to work around this by always calling try encryptedStore?.validateDatabasePassphrase(oldPassword) before changing the passcode, however, I think we shouldnt put this requirement on the client code. Instead, changeDatabasePassphrase should perform this check internally.
Let me know if you agree and if you would accept a pull request (I can see that this repository isnt very active).
If I call
try encryptedStore?.changeDatabasePassphrase(oldPassword, toNewPassphrase: newPassword)
with the wrongoldPassword
, it does throw an error, but the database probably ends up in an inconsistent state. From this point on, callingtry encryptedStore?.changeDatabasePassphrase(oldPassword2, toNewPassphrase: newPassword)
always fails, even ifoldPassword2
is correct. This gets fixed by restarting the app.I was able to work around this by always calling
try encryptedStore?.validateDatabasePassphrase(oldPassword)
before changing the passcode, however, I think we shouldnt put this requirement on the client code. Instead,changeDatabasePassphrase
should perform this check internally.Let me know if you agree and if you would accept a pull request (I can see that this repository isnt very active).