You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val aead = AndroidKeysetManager.Builder()
.withSharedPref(context, "master_keyset", "master_key_preference")
.withKeyTemplate(KeyTemplates.get("AES256_GCM"))
.withMasterKeyUri("android-keystore://master_key")
.build()
.keysetHandle
.getPrimitive(Aead::class.java)
val dataStore = PreferenceDataStoreFactory.createEncrypted(
encryptionOptions = {
// Specify fallback Aead to make it possible to decrypt data encrypted with it
fallbackAead = aead
}
) {
EncryptedFile.Builder(
context.dataStoreFile(prefName!!), // Keep the same file
context,
MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC),
EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
).build()
}
This option works, but i previously didn't use the library before.
Oh. I see there is a bug that PreferenceDataStoreFactory.createEncrypted has no default value for the encryptionOptions parameter. I'll fix it in the nexts version, but for now you can pass empty lambda as a workaround
PreferenceDataStoreFactory.createEncrypted {
EncryptedFile(
context,
context.dataStoreFile(prefName!!),
masterKey = it,
// TODO: Remove this parameter when issue in encrypted-datastore will be fixed// https://github.com/osipxd/encrypted-datastore/issues/12
encryptionOptions = {}
)
}
The text was updated successfully, but these errors were encountered: