Closed kenkotch closed 5 years ago
just made a new proj w/ realm. same issue: https://github.com/kenkotch/realmEncryptionTest
~~I handled the issue, though I would still like to know why the solution works.
Instead of adding the encryptionKey directly in standardObjectSchema, when I mount my first component where I import newStandardObject
in componentDidMount, I add:
newStandardObject.encryptionKey = base64js.toByteArray(string)
~~
nope. im wrong. that does not work. still getting the same error
Could this be related to https://github.com/realm/realm-core/issues/3267?
It may be. That project is long gone so I'm not actively looking into anymore
Goals
read and write to encrypted realm
Expected Results
can encrypt, read and write
Actual Results
on android: Error: Realm at path 'path/to/realm' already opened with a different encryption key. (when trying to write) on ios: Unable to open realm at path '': Realm file decryption failed Path:. (when building)
iOS: Unable to open a realm at path '/Users/iguana/Library/Developer/CoreSimulator/Devices/116618B3-440A-4852-A412-B81CC062E752/data/Containers/Data/Application/504E3B95-597C-480B-A27A-F97136CC6E94/Documents/standardObject.realm': Realm file decryption failed Path:.
Andriod: ![Screenshot_1554926299](https://user-images.githubusercontent.com/4110008/55909255-c16fd880-5b98-11e9-9389-789f4b03e26e.png) ## Steps to Reproduce on ios, fails on build on android fails on write to realm both are solved when I remove the encryptionKey ## Code Sample ``` const string = 'N60LgDmG4CuwC9Gb/qdgBvjR0bfRjN4NzPfRwmFj960//+EDlTSGpYwA1V83XDepAT+Dv/wFZL1cqvuIAZjbzw==' const encryptionKey = base64js.toByteArray(string) const standardObjectSchema = { path: 'standardObject.realm', schema: [standardObject, locationObject], schemaVersion: 0, encryptionKey } export const newStandardObject = new Realm(standardObjectSchema) ``` ## Version of Realm and Tooling - Realm JS SDK Version: ? "realm": "^2.26.0" - Node or React Native: ? "react": "16.8.3" "react-native": "0.59.3" - Client OS & Version: ? iOS: 12 Android: 9 - Which debugger for React Native: ?/None Flipper