mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 07:28:28 +02:00
Update WellKnown & HomeserverConfiguration for mandatory backup
This commit is contained in:
@@ -28,10 +28,6 @@ final class HomeserverConfigurationBuilder: NSObject {
|
||||
|
||||
/// Create an `HomeserverConfiguration` from an HS Well-Known when possible otherwise it takes hardcoded values from BuildSettings by default.
|
||||
func build(from wellKnown: MXWellKnown?) -> HomeserverConfiguration {
|
||||
|
||||
let isE2EEByDefaultEnabled: Bool
|
||||
let jitsiPreferredDomain: String
|
||||
|
||||
var vectorWellKnownEncryptionConfiguration: VectorWellKnownEncryptionConfiguration?
|
||||
var vectorWellKnownJitsiConfiguration: VectorWellKnownJitsiConfiguration?
|
||||
|
||||
@@ -39,12 +35,29 @@ final class HomeserverConfigurationBuilder: NSObject {
|
||||
vectorWellKnownEncryptionConfiguration = self.getEncryptionConfiguration(from: vectorWellKnown)
|
||||
vectorWellKnownJitsiConfiguration = self.getJitsiConfiguration(from: vectorWellKnown)
|
||||
}
|
||||
|
||||
|
||||
// Encryption configuration
|
||||
// Enable E2EE by default when there is no value
|
||||
isE2EEByDefaultEnabled = vectorWellKnownEncryptionConfiguration?.isE2EEByDefaultEnabled ?? true
|
||||
let isE2EEByDefaultEnabled = vectorWellKnownEncryptionConfiguration?.isE2EEByDefaultEnabled ?? true
|
||||
// Disable mandatory secure backup when there is no value
|
||||
let isSecureBackupRequired = vectorWellKnownEncryptionConfiguration?.isSecureBackupRequired ?? false
|
||||
// Default to `MXKKeyPreSharingWhenTyping` when there is no value
|
||||
let outboundKeysPreSharingMode = vectorWellKnownEncryptionConfiguration?.outboundKeysPreSharingMode ?? .whenTyping
|
||||
// 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
|
||||
} else {
|
||||
secureBackupSetupMethods = VectorWellKnownBackupSetupMethod.allCases
|
||||
}
|
||||
|
||||
let encryptionConfiguration = HomeserverEncryptionConfiguration(isE2EEByDefaultEnabled: isE2EEByDefaultEnabled,
|
||||
isSecureBackupRequired: isSecureBackupRequired,
|
||||
secureBackupSetupMethods: secureBackupSetupMethods,
|
||||
outboundKeysPreSharingMode: outboundKeysPreSharingMode)
|
||||
|
||||
// Jitsi configuration
|
||||
let jitsiPreferredDomain: String
|
||||
let jitsiServerURL: URL
|
||||
let hardcodedJitsiServerURL: URL = BuildSettings.jitsiServerUrl
|
||||
|
||||
@@ -77,7 +90,7 @@ final class HomeserverConfigurationBuilder: NSObject {
|
||||
serverURL: jitsiServerURL)
|
||||
|
||||
return HomeserverConfiguration(jitsi: jitsiConfiguration,
|
||||
isE2EEByDefaultEnabled: isE2EEByDefaultEnabled,
|
||||
encryption: encryptionConfiguration,
|
||||
tileServer: tileServerConfiguration)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user