cioccarellia / ksprefs

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

Exists is broken when encryption is enabled #38

Closed csehtamas closed 3 years ago

csehtamas commented 3 years ago

In KspEnclosure the exists method doesn't use deriveKey which breaks the method in case of encryption is enabled.

This

    internal fun exists(
        key: String
    ) = sharedReader.exists(key)

should be

    internal fun exists(
        key: String
    ) = sharedReader.exists(deriveKey(key))

Tested with 2.2.4 and 2.2.5

cioccarellia commented 3 years ago

Thanks! Nifty catch. Will be releasing an update today to address this, along with some documentation for internal classes and possibly some testing.