Encrypt and sync iOS Swift Realm with the server

I used this configuration code for Realm Encryption

let configuration = Realm.Configuration(encryptionKey: "key" as Data) let realm = try! Realm(configuration: configuration) 

I used this configuration code for Realm Sync with the server

 let configuration = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL)) let realm = try! Realm(configuration: configuration) 

How can we encrypt and synchronize with the server using Realm?

+5
source share
1 answer

Realm.Configuration initializer can take several arguments if you want to specify several aspects of the configuration:

 let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL), encryptionKey: theKey) 
+2
source

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


All Articles