I am using the following code to store some information encrypted in my app.
val masterKey = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC)
val s
My version to get secret shared preference :
private fun getSecretSharedPref(context: Context): SharedPreferences {
val masterKey = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
return EncryptedSharedPreferences.create(context,
"secret_shared_prefs",
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
}