Prevent crash in case of exception while creating the MasterKey in VFS

This commit is contained in:
Sylvain Berfini 2025-01-20 09:50:02 +01:00
parent e7a4a24eaf
commit 7f49a7756c

View file

@ -111,12 +111,12 @@ class VFS {
}
private fun getEncryptedSharedPreferences(context: Context): SharedPreferences? {
val masterKey: MasterKey = MasterKey.Builder(
context,
MasterKey.DEFAULT_MASTER_KEY_ALIAS
).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build()
return try {
val masterKey: MasterKey = MasterKey.Builder(
context,
MasterKey.DEFAULT_MASTER_KEY_ALIAS
).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build()
EncryptedSharedPreferences.create(
context,
ENCRYPTED_SHARED_PREFS_FILE,