From 5e449016380eeb297a398591ace1a5e0caf691e5 Mon Sep 17 00:00:00 2001 From: Sofiya Tepikin Date: Wed, 10 Aug 2022 14:22:55 +0000 Subject: [PATCH] Fix deprecated way of using writeCopyTo - realm method --- db/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/db/index.js b/db/index.js index 71c5e1d..67f4ca0 100644 --- a/db/index.js +++ b/db/index.js @@ -205,12 +205,7 @@ export async function changeEncryptionAndRestartApp(hash) { const copyPath = dir.join('/') const exists = await fs.exists(copyPath) if (exists) await fs.unlink(copyPath) - // for some reason, realm complains if we give it a key with value undefined - if (key) { - db.writeCopyTo(copyPath, key) - } else { - db.writeCopyTo(copyPath) - } + db.writeCopyTo({ path: copyPath, encryptionKey: key }) db.close() await fs.unlink(defaultPath) await fs.moveFile(copyPath, defaultPath)