Created
December 4, 2023 20:40
-
-
Save sergei-mikhailovskii-idf/7f1469096fefeb4a347f5141ee48484a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actual fun getSettings(context: AppContext?): Settings { | |
requireNotNull(context) | |
val masterKey = MasterKey.Builder(context) | |
.setKeyScheme(KeyScheme.AES256_GCM) | |
.build() | |
val encryptedPreferences = EncryptedSharedPreferences.create( | |
context, | |
context.packageName + "_encrypted_preferences", | |
masterKey, | |
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, | |
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM | |
) | |
return SharedPreferencesSettings(encryptedPreferences) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment