Skip to content

Feature/using encrypted shared preferences #12

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jimcase
Copy link

@jimcase jimcase commented Nov 29, 2024

Continue PR-9 by @tuanbipa.

Description of the Change

The changes focus on introducing modern secure storage practices in Android by using EncryptedSharedPreferences for Android 6.0 (Marshmallow) and above, while maintaining compatibility with older Android versions via the KeyStore system. The solution includes automatic data migration, ensuring a seamless transition without data loss.


Change List

1. Support for EncryptedSharedPreferences

  • New Feature: Utilizes EncryptedSharedPreferences for secure data storage on Android 6.0+.
  • Data Migration: Automatically transfers data from legacy SharedPreferences to EncryptedSharedPreferences.

2. Backward Compatibility for Android < 6.0

  • Retains the use of the KeyStore system for data encryption and decryption on older Android versions.

3. Introduction of migrationDone Flag

  • Purpose: Ensures that data migration happens only once, avoiding unnecessary processing.

4. Helper Method isAndroidMOrHigher

  • Purpose: Checks the device's Android version to determine if EncryptedSharedPreferences can be used.

5. Refactored getPrefs Method

  • Enhancement:
    • Manages the creation of EncryptedSharedPreferences for Android 6.0+.
    • Handles data migration from legacy SharedPreferences to EncryptedSharedPreferences.
    • Falls back to plain SharedPreferences for Android versions below 6.0.

@jimcase jimcase marked this pull request as ready for review November 29, 2024 16:02
@jimcase jimcase marked this pull request as draft November 29, 2024 22:48
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

Successfully merging this pull request may close these issues.

1 participant