Feature/4218 wellknown defaults

This commit is contained in:
Frank Rotermund
2023-02-28 10:07:25 +00:00
committed by Arnfried Griesert
parent cffa0c1d16
commit 7a15f43f64
3 changed files with 20 additions and 6 deletions

View File

@@ -36,19 +36,21 @@ final class HomeserverConfigurationBuilder: NSObject {
vectorWellKnownJitsiConfiguration = self.getJitsiConfiguration(from: vectorWellKnown)
}
// bwi: (#4218) the well-known defaults for bwi are different than the element defaults. E2EE decryption is true instead of false, presharingmode is .whenEnteringRoom instead of .whenTyping and our backup method is only .passphrase instead of all
// Encryption configuration
// Enable E2EE by default when there is no value
let isE2EEByDefaultEnabled = vectorWellKnownEncryptionConfiguration?.isE2EEByDefaultEnabled ?? true
// Disable mandatory secure backup when there is no value
let isSecureBackupRequired = vectorWellKnownEncryptionConfiguration?.isSecureBackupRequired ?? false
let isSecureBackupRequired = vectorWellKnownEncryptionConfiguration?.isSecureBackupRequired ?? true
// Default to `MXKKeyPreSharingWhenTyping` when there is no value
let outboundKeysPreSharingMode = vectorWellKnownEncryptionConfiguration?.outboundKeysPreSharingMode ?? .whenTyping
let outboundKeysPreSharingMode = vectorWellKnownEncryptionConfiguration?.outboundKeysPreSharingMode ?? .whenEnteringRoom
// Defaults to all secure backup methods available when there is no value
let secureBackupSetupMethods: [VectorWellKnownBackupSetupMethod]
if let backupSetupMethods = vectorWellKnownEncryptionConfiguration?.secureBackupSetupMethods {
secureBackupSetupMethods = backupSetupMethods.isEmpty ? VectorWellKnownBackupSetupMethod.allCases : backupSetupMethods
secureBackupSetupMethods = backupSetupMethods.isEmpty ? [.passphrase] : backupSetupMethods
} else {
secureBackupSetupMethods = VectorWellKnownBackupSetupMethod.allCases
secureBackupSetupMethods = [.passphrase]
}
let encryptionConfiguration = HomeserverEncryptionConfiguration(isE2EEByDefaultEnabled: isE2EEByDefaultEnabled,