Where to get the encryption key for a Realm application in Swift

I have a Swift application that uses a Realm object server running remotely on a Linux server. Everything works, including real-time synchronization.

Sometimes I want to check the contents of a local Realm file used by an iOS simulator, so I can do some debugging. When I browse here:

~/.../CoreSimulator/.../Documents/realm-object-server/<unique id>/

... and I'm trying to open this file: realm%3A%2F%2F104%2E236%2E129%2E235%3A9080%2F%7E%2Fmyapp.realm

I will be prompted: Enter the correct encryption key for this Realm file. enter image description here Where can I get this encryption key? I tried using the admin token from the server, but it doesn't seem to work.

Also, can I turn off encryption everywhere? Or is it mandatory for any application that uses a Realm object server?

+4
3

Realm Browser, .

+1
byte[] key = new byte[64]; 
new SecureRandom().nextBytes(key); 
String encryptionKey = byteArrayToHexString(key); 
//encryptionKey is what you want byteArrayToHexString see
Log.d("test", "encryptionKey:"+encryptionKey);

byteArrayToHexString () you can see: How to convert byte array to hexadecimal string in Java?

0
source

Source: https://habr.com/ru/post/1658890/


All Articles