sameerkapps / SecureStorage

118 stars 32 forks source link

Data keeps stored after uninstalling the app #42

Closed feliperugai closed 6 years ago

feliperugai commented 6 years ago

Hi there, nice plugin you have here, congratulations! I used it to store sensitive data in my app. Now, it's in production and I have 2 iOS users which uninstalled the app and installed it again, so that they could erase the data stored at Secure Storage. Unfortunately, they reported that the previous data was not deleted and couldn't make it go away.

My question is, am I missing something or the data should be erased along with the app uninstall? If not, how can I achieve this?

EDIT: As of the readme.md

"iOS - The KeyChain access level is now set at AfterFirstUnlock as default. This will let app set the values in the background mode. As a result, the keys stored using the earlier versions will not be accessible with this version. To maintain backward compatibility, add a line to AppDelegate as follows:"

Sorry for my bad english reading, I couldn't undestand if the word version of the text is referring to the plugin's version or my app version.

Thanks for the attention :)

sameerkapps commented 6 years ago

Thanks for using the Plugin and for the praise. When iOS uninstalls an App, it does not delete the data from the keychain. But it is not accessible to any other app. The data that iOS definitely deletes during uninstall is the data that is stored in the NSUserDefaults.

By storing a flag in the NSUserDefaults and checking its value when the App starts, you can detect, if it is the first run. Secure data can be cleaned in the first run. You can find an example of detecting the first run here: https://stackoverflow.com/questions/19233945/how-to-tell-if-its-your-first-run/ Hope it helps.

feliperugai commented 6 years ago

Thanks for the response! Is there a way to delete the data in the keychain? Or I really need to implement this flag?

feliperugai commented 6 years ago

Well I went your way and implemented the flag in NSUserDefaults, and it works :) Thanks for your time!