Crypho / cordova-plugin-secure-storage

Secure storage plugin for Apache Cordova
MIT License
278 stars 269 forks source link

fix(ios): Add support for reading __NSCFData key strings #154

Closed mold closed 6 years ago

mold commented 6 years ago

I'm creating a Cordova app to replace an existing native iOS app. When trying to read the existing keys from the previous app, the app crashed when trying to serialize the key strings because they had a different encoding (I think - the error message complained about the strings being of type "__NSCFData").

This commit fixes that issue for me, however I know nothing about native iOS development or Objective-C so I'm not sure my quick-fix is the optimal solution. I also don't know how to properly add tests for this change.

If I need to change anything to get this PR accepted please let me know.

Thanks for the great plugin!

ggozad commented 6 years ago

Since this is not very useful for anybody else, I am reluctant to merge. I would suggest you have a migration that checks the existing keys and migrates them before initialising secure storage.

mold commented 6 years ago

Unfortunately I won't be able to do any more builds of the current apps before it's replaced with the Cordova version, so this is the only way I could think of.

I see your point about the limited use for others though. 👍

ggozad commented 6 years ago

I would then just install the plugin and replace with the code you wrote except modified to write the values after reeconding.