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,16 +43,19 @@ extension ClientBuilder {
.backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure) .backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure)
.enableShareHistoryOnInvite(enableShareHistoryOnInvite: enableKeyShareOnInvite) .enableShareHistoryOnInvite(enableShareHistoryOnInvite: enableKeyShareOnInvite)
.autoEnableBackups(autoEnableBackups: true) .autoEnableBackups(autoEnableBackups: true)
}
if enableOnlySignedDeviceIsolationMode { // Set recipient strategy and trust requirement even if `setupEncryption` is false to ensure messages
builder = builder // from insecure devices aren't displayed in push notifications.
.roomKeyRecipientStrategy(strategy: .identityBasedStrategy) // See https://github.com/element-hq/element-x-ios/issues/4702.
.decryptionSettings(decryptionSettings: .init(senderDeviceTrustRequirement: .crossSignedOrLegacy)) if enableOnlySignedDeviceIsolationMode {
} else { builder = builder
builder = builder .roomKeyRecipientStrategy(strategy: .identityBasedStrategy)
.roomKeyRecipientStrategy(strategy: .errorOnVerifiedUserProblem) .decryptionSettings(decryptionSettings: .init(senderDeviceTrustRequirement: .crossSignedOrLegacy))
.decryptionSettings(decryptionSettings: .init(senderDeviceTrustRequirement: .untrusted)) } else {
} builder = builder
.roomKeyRecipientStrategy(strategy: .errorOnVerifiedUserProblem)
.decryptionSettings(decryptionSettings: .init(senderDeviceTrustRequirement: .untrusted))
} }
if let httpProxy { if let httpProxy {