Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to EncryptedSharedPreferences for Android? #13

Open
tehnrd opened this issue Jan 30, 2020 · 4 comments
Open

Change to EncryptedSharedPreferences for Android? #13

tehnrd opened this issue Jan 30, 2020 · 4 comments

Comments

@tehnrd
Copy link

tehnrd commented Jan 30, 2020

Disclaimer, I'm fairly new to Android and Capacitor development.

For Android, is there a reason EncryptedSharedPreferences aren't used? It seems like this would greatly simplify the plugin and essentially remove the need for the entire PasswordStorageHelper.java class.

@martinkasa
Copy link
Owner

There is no any specific reason. As is stated in README, code for android is based of https://www.apriorit.com/dev-blog/432-using-androidkeystore
. If we want to change the way passwords are stored, then we would need to create some migration process, so users do not lost their data.

@tehnrd
Copy link
Author

tehnrd commented Jan 31, 2020

True, the migration piece probably doesn't make this worth the effort. I appreciate the response. I might take a stab and creating a similar plugin as I need to learn this stuff anyway.

@tehnrd tehnrd closed this as completed Jan 31, 2020
@tehnrd
Copy link
Author

tehnrd commented Mar 9, 2020

Hey @martinkasa , I'd like to reopen this discussion and take a stab at delivering this feature. I see two main advantages.

The first being it would greatly simplify the encryption process for Android and use the standard encryption methods/practices provided by Android.

The second and primary driver is that it would also allow for much easier access to the storage if you need to access values from a background process. For example, 90% of the app might be an Ionic/Capacitor app, but perhaps there are some background processes that need to get an acessToken/refreshToken for to sync background data with an external API.

Implementation seems pretty straightforward but curious your thoughts on the best way to run a migration? Or perhaps not run a migration and have a flag to determine what time of encryption process is used. This way the app could decide and control if/when it wants to migrate the data and be in full control of that process.

@tehnrd tehnrd reopened this Mar 9, 2020
@SavageCore
Copy link

I would say on data access perform the migration, if you set an existing key it would remove from the old store then add to Encrypted, similarily if you get the data it would be moved. That way the API stays the same and the transition is seamless.

aalzehla pushed a commit to aalzehla/capacitor-secure-storage-plugin that referenced this issue Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants