cioccarellia / ksprefs

Kotlin SharedPreferences wrapper & cryptographic android library.
https://cioccarellia.github.io/ksprefs/
Apache License 2.0
228 stars 22 forks source link

Observable property general listener does not use primitive key to access storage #24

Closed cioccarellia closed 4 years ago

cioccarellia commented 4 years ago

Observed callbacks are not being invoked correctly while using an EncryptionType different than plaintext, because the key is confronted with the key inside the observedPrefs map, and those wto keys have a different grade.

// Works for plaintext, fails for base64, aes and keystore
val observedPref = observedPrefs[key] ?: return@OnSharedPreferenceChangeListener

Integrating the incoming key will match the one inside the map.

cioccarellia commented 4 years ago

That's why encrypting the key n times isn't allowed: it would increase overhead, slow down observable properties and increase code complexity