-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: using encrypted shared preferences #29
base: main
Are you sure you want to change the base?
feat: using encrypted shared preferences #29
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR!
It's nice to see that others use this fork as well and want to contribute too =)
Thank you for resolving the things that I mentioned 👍 |
After code review we realized the used Jetpack security crypto library seems to be deprecated. Any idea if the used |
@axi92 @0x7061 I've reviewed the official Android documentation, and it appears that I upgraded the lib to use the latest version https://developer.android.com/jetpack/androidx/releases/security |
Hey @0x7061, There unique deprecated method is * @deprecated Use {@link #create(Context, String, MasterKey,
* PrefKeyEncryptionScheme, PrefValueEncryptionScheme)} instead. This means changing: String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
Log.d(LOG_TAG, "Master key alias obtained or created: " + masterKeyAlias);
preferences = EncryptedSharedPreferences.create(
PREFERENCES_FILE,
masterKeyAlias,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
); To: MasterKey masterKey = new MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build();
Log.d(LOG_TAG, "Master key alias obtained or created: ");
preferences = EncryptedSharedPreferences.create(
context,
PREFERENCES_FILE,
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);
I updated the call to use the suggested |
The key changes include enhanced handling of encrypted shared preferences and migration from older storage implementations.
Key Changes
Initialization Logic Enhancement:
Migration Support:
Encryption and Decryption Updates:
EncryptedSharedPreferences
for modern and secure storage practices.