Merge pull request #3569 from element-hq/feature/valere/only_signed_decryption_mode

crypto: Use OnlySigned isolation flag to setup decryption trust req.
This commit is contained in:
Valere 2024-10-04 18:02:43 +02:00 committed by GitHub
commit b919781b8e
2 changed files with 9 additions and 1 deletions

View file

@ -125,7 +125,7 @@ enum class FeatureFlags(
), ),
OnlySignedDeviceIsolationMode( OnlySignedDeviceIsolationMode(
key = "feature.onlySignedDeviceIsolationMode", key = "feature.onlySignedDeviceIsolationMode",
title = "Exclude not secure devices when sending/receiving messages", title = "Exclude insecure devices when sending/receiving messages",
description = "This setting controls how end-to-end encryption (E2E) keys are shared." + description = "This setting controls how end-to-end encryption (E2E) keys are shared." +
" Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners." + " Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners." +
" You'll have to stop and re-open the app manually for that setting to take effect.", " You'll have to stop and re-open the app manually for that setting to take effect.",

View file

@ -32,6 +32,7 @@ import org.matrix.rustcomponents.sdk.SlidingSyncVersionBuilder
import org.matrix.rustcomponents.sdk.use import org.matrix.rustcomponents.sdk.use
import timber.log.Timber import timber.log.Timber
import uniffi.matrix_sdk_crypto.CollectStrategy import uniffi.matrix_sdk_crypto.CollectStrategy
import uniffi.matrix_sdk_crypto.TrustRequirement
import java.io.File import java.io.File
import javax.inject.Inject import javax.inject.Inject
@ -108,6 +109,13 @@ class RustMatrixClientFactory @Inject constructor(
CollectStrategy.DeviceBasedStrategy(onlyAllowTrustedDevices = false, errorOnVerifiedUserProblem = true) CollectStrategy.DeviceBasedStrategy(onlyAllowTrustedDevices = false, errorOnVerifiedUserProblem = true)
} }
) )
.roomDecryptionTrustRequirement(
trustRequirement = if (featureFlagService.isFeatureEnabled(FeatureFlags.OnlySignedDeviceIsolationMode)) {
TrustRequirement.CROSS_SIGNED_OR_LEGACY
} else {
TrustRequirement.UNTRUSTED
}
)
.run { .run {
// Apply sliding sync version settings // Apply sliding sync version settings
when (slidingSyncType) { when (slidingSyncType) {