Realm decryption failed on ios device but not on emulator (ios 13 & react native)


We have been trying to get a realm encryption solution created across our whole application. This has worked successfully across the application in android and on an ios emulator. However, when we try to launch the application on an ios device, the first realm we try to open throws an error:

_ERROR: Connection[2]: Session[2]: In finalize_state_transfer, the realm /path_to_file/partially_downloaded.realm could not be opened, msg = Realm file decryption failed Path: /path_to_file/partially_downloaded.realm

Since the realm decryption fails, we cannot access the local realm file and so we can’t progress into the application. The code used:

const userConfig = user.createConfiguration({
sync: { url: REALM_URL + “/~/userProfile”, error: (err) => console.log(err), fullSynchronization: true },
schema: userSchema
userConfig.encryptionKey = key; => {

We get the key from the ios keychain using the react-native-sensitive-info package. What do you think could be the issue we are facing? Is there a workaround or solution to the problem?

Thanks in advance!

Have you had any solution for this issue?