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

Use EncryptedSharedPreferences instead of hashing string #3

Open
sondosaabed opened this issue Jan 14, 2024 · 2 comments
Open

Use EncryptedSharedPreferences instead of hashing string #3

sondosaabed opened this issue Jan 14, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sondosaabed
Copy link
Owner

https://stackoverflow.com/questions/30148729/how-to-secure-android-shared-preferences

String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);

SharedPreferences sharedPreferences = EncryptedSharedPreferences.create(
    "secret_shared_prefs",
    masterKeyAlias,
    context,
    EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
    EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);

// use the shared preferences and editor as you normally would
SharedPreferences.Editor editor = sharedPreferences.edit();
@sondosaabed sondosaabed added the enhancement New feature or request label Jan 14, 2024
@sondosaabed sondosaabed self-assigned this Jan 14, 2024
@sondosaabed
Copy link
Owner Author

implementation("androidx.security:security-app-authenticator:1.0.0-beta01")

@sondosaabed
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant