adorsys / secure-storage-android

Store strings & credentials securely encrypted on your device
Apache License 2.0
367 stars 58 forks source link

method setValue working too long #39

Closed rovkinmax closed 5 years ago

rovkinmax commented 5 years ago

I user this library and method SecurePreferences#setValue(String, String). But the method executing too long, around 3 seconds on Samsung Galaxy s10. It is really very long. Could you help and improve it, please? Its simplest usage for me:

            log("start save token")
            SecurePreferences.setValue(TOKEN, token)
            log("token saved")

And log for that:

2019-03-25 18:02:03.054 com.my.stage : start save token
2019-03-25 18:02:06.061 com.my.stage : token saved
drilonrecica commented 5 years ago

Hey thank you for reporting this. We will look into this issue ASAP and keep you informed. Thanks again.

luckyhandler commented 5 years ago

@rovkinmax Does this happen only the first time or always?

luckyhandler commented 5 years ago

@rovkinmax which Android version are you using?

rovkinmax commented 5 years ago

It happens always, not at first time. I checked on Android 6 and 9

kahakai commented 5 years ago

It happens always, not at first time. I checked on Android 6 and 9

It's said in documentation to

make sure to move the execution into a background thread as encryption does take a little time

which you probably didn't take into account.

luckyhandler commented 5 years ago

Hey @rovkinmax, we actually cannot make the encryption faster than the system is. I couldn't find any issues on our side right now. Make sure - as @artnest suggests - to execute the encryption on a background thread. You might use registerOnSharedPreferenceChangeListener to get notified as soon as the encrypted value is stored in SecureStorage. For now I will close this issue...