ksprefs
ksprefs copied to clipboard
javax.crypto.IllegalBlockSizeException when pulling value consecutively
I'm using ksprefs library and from time to time i get javax.crypto.IllegalBlockSizeException I've found that if 2 threads or 2 calls are made at the same time the app crashes with the above exception. I can easily recreate the crash using these lines on samsung galaxy tab:
for (i in 1..10){
lifecycleScope.launch(Dispatchers.Default){
val isEnabled = ZoeyApp.prefs.pull(booleanKey, true)
Log.d("Testing", isEnabled.toString())
}
}
I have the prefs set us as such:
val prefs by lazy { KsPrefs(context) {
encryptionType = EncryptionType.KeyStore("prefs")
}}
Thank you very much for the great lib!
Sorry for the delay, will look into this as soon as I get the chance. Maybe there is some synchronization issue. I don't see a clear way out since the library is basically a wrapper for shared preferences.
Better late than ever haha, just added multithreading support, pushing now