Set trust requirement even if setEncryption is false. (#4823)

* fix: Set trust requirement even if `setEncryption` is `false`.

- Calls `builder.decryptionSettings` with sender trust requirement,
  even if `setEncryption` is false`.
- Fixes https://github.com/element-hq/element-x-ios/issues/4702

* docs: Add doc comment explaining necessity of fix.

* feat: Set `roomKeyRecipientStrategy` alongside trust requirement.
This commit is contained in:
Skye Elliot
2025-12-09 09:17:50 +00:00
committed by GitHub
parent ffb42752de
commit af2985c8ad
@@ -43,7 +43,11 @@ extension ClientBuilder {
.backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure) .backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure)
.enableShareHistoryOnInvite(enableShareHistoryOnInvite: enableKeyShareOnInvite) .enableShareHistoryOnInvite(enableShareHistoryOnInvite: enableKeyShareOnInvite)
.autoEnableBackups(autoEnableBackups: true) .autoEnableBackups(autoEnableBackups: true)
}
// Set recipient strategy and trust requirement even if `setupEncryption` is false to ensure messages
// from insecure devices aren't displayed in push notifications.
// See https://github.com/element-hq/element-x-ios/issues/4702.
if enableOnlySignedDeviceIsolationMode { if enableOnlySignedDeviceIsolationMode {
builder = builder builder = builder
.roomKeyRecipientStrategy(strategy: .identityBasedStrategy) .roomKeyRecipientStrategy(strategy: .identityBasedStrategy)
@@ -53,7 +57,6 @@ extension ClientBuilder {
.roomKeyRecipientStrategy(strategy: .errorOnVerifiedUserProblem) .roomKeyRecipientStrategy(strategy: .errorOnVerifiedUserProblem)
.decryptionSettings(decryptionSettings: .init(senderDeviceTrustRequirement: .untrusted)) .decryptionSettings(decryptionSettings: .init(senderDeviceTrustRequirement: .untrusted))
} }
}
if let httpProxy { if let httpProxy {
builder = builder.proxy(url: httpProxy) builder = builder.proxy(url: httpProxy)