crypto: rename invisible crypto flag to deviceIsolationMode (#3331)

This commit is contained in:
Valere
2024-09-26 13:24:46 +02:00
committed by GitHub
parent dc6d7f2985
commit 23ab453a1e
7 changed files with 14 additions and 14 deletions
@@ -11,7 +11,7 @@ import SwiftUI
// Common settings between app and NSE // Common settings between app and NSE
protocol CommonSettingsProtocol { protocol CommonSettingsProtocol {
var logLevel: TracingConfiguration.LogLevel { get } var logLevel: TracingConfiguration.LogLevel { get }
var invisibleCryptoEnabled: Bool { get } var enableOnlySignedDeviceIsolationMode: Bool { get }
} }
/// Store Element specific app settings. /// Store Element specific app settings.
@@ -43,7 +43,7 @@ final class AppSettings {
case publicSearchEnabled case publicSearchEnabled
case fuzzyRoomListSearchEnabled case fuzzyRoomListSearchEnabled
case pinningEnabled case pinningEnabled
case invisibleCryptoEnabled case enableOnlySignedDeviceIsolationMode
} }
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
@@ -285,9 +285,9 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.logLevel, defaultValue: TracingConfiguration.LogLevel.info, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.logLevel, defaultValue: TracingConfiguration.LogLevel.info, storageType: .userDefaults(store))
var logLevel var logLevel
/// Configuration to enable invisible crypto. In this mode only devices signed by their owner will be considered in e2ee rooms. /// Configuration to enable only signed device isolation mode for crypto. In this mode only devices signed by their owner will be considered in e2ee rooms.
@UserPreference(key: UserDefaultsKeys.invisibleCryptoEnabled, defaultValue: false, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.enableOnlySignedDeviceIsolationMode, defaultValue: false, storageType: .userDefaults(store))
var invisibleCryptoEnabled var enableOnlySignedDeviceIsolationMode
} }
extension AppSettings: CommonSettingsProtocol { } extension AppSettings: CommonSettingsProtocol { }
@@ -15,7 +15,7 @@ extension ClientBuilder {
slidingSync: ClientBuilderSlidingSync, slidingSync: ClientBuilderSlidingSync,
sessionDelegate: ClientSessionDelegate, sessionDelegate: ClientSessionDelegate,
appHooks: AppHooks, appHooks: AppHooks,
invisibleCryptoEnabled: Bool) -> ClientBuilder { enableOnlySignedDeviceIsolationMode: Bool) -> ClientBuilder {
var builder = ClientBuilder() var builder = ClientBuilder()
.enableCrossProcessRefreshLock(processId: InfoPlistReader.main.bundleIdentifier, sessionDelegate: sessionDelegate) .enableCrossProcessRefreshLock(processId: InfoPlistReader.main.bundleIdentifier, sessionDelegate: sessionDelegate)
.userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent()) .userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent())
@@ -34,7 +34,7 @@ extension ClientBuilder {
.backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure) .backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure)
.autoEnableBackups(autoEnableBackups: true) .autoEnableBackups(autoEnableBackups: true)
if invisibleCryptoEnabled { if enableOnlySignedDeviceIsolationMode {
builder = builder.roomKeyRecipientStrategy(strategy: CollectStrategy.identityBasedStrategy) builder = builder.roomKeyRecipientStrategy(strategy: CollectStrategy.identityBasedStrategy)
} else { } else {
builder = builder.roomKeyRecipientStrategy(strategy: .deviceBasedStrategy(onlyAllowTrustedDevices: false, errorOnVerifiedUserProblem: true)) builder = builder.roomKeyRecipientStrategy(strategy: .deviceBasedStrategy(onlyAllowTrustedDevices: false, errorOnVerifiedUserProblem: true))
@@ -47,7 +47,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
var elementCallBaseURLOverride: URL? { get set } var elementCallBaseURLOverride: URL? { get set }
var fuzzyRoomListSearchEnabled: Bool { get set } var fuzzyRoomListSearchEnabled: Bool { get set }
var pinningEnabled: Bool { get set } var pinningEnabled: Bool { get set }
var invisibleCryptoEnabled: Bool { get set } var enableOnlySignedDeviceIsolationMode: Bool { get set }
} }
extension AppSettings: DeveloperOptionsProtocol { } extension AppSettings: DeveloperOptionsProtocol { }
@@ -53,14 +53,14 @@ struct DeveloperOptionsScreen: View {
} }
Section { Section {
Toggle(isOn: $context.invisibleCryptoEnabled) { Toggle(isOn: $context.enableOnlySignedDeviceIsolationMode) {
Text("Enabled Invisible Crypto") Text("Exclude not secure devices when sending/receiving messages")
Text("Requires app reboot") Text("Requires app reboot")
} }
} header: { } header: {
Text("Trust and Decoration") Text("Trust and Decoration")
} footer: { } footer: {
Text("This setting controls how end-to-end encryption (E2EE) keys are shared. Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners.") Text("This setting controls how end-to-end encryption (E2EE) keys are exchanged. Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners.")
} }
Section { Section {
@@ -78,7 +78,7 @@ struct AuthenticationClientBuilder: AuthenticationClientBuilderProtocol {
slidingSync: slidingSync, slidingSync: slidingSync,
sessionDelegate: clientSessionDelegate, sessionDelegate: clientSessionDelegate,
appHooks: appHooks, appHooks: appHooks,
invisibleCryptoEnabled: appSettings.invisibleCryptoEnabled) enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode)
.sessionPaths(dataPath: sessionDirectories.dataPath, .sessionPaths(dataPath: sessionDirectories.dataPath,
cachePath: sessionDirectories.cachePath) cachePath: sessionDirectories.cachePath)
.passphrase(passphrase: passphrase) .passphrase(passphrase: passphrase)
@@ -125,7 +125,7 @@ class UserSessionStore: UserSessionStoreProtocol {
slidingSync: .restored, slidingSync: .restored,
sessionDelegate: keychainController, sessionDelegate: keychainController,
appHooks: appHooks, appHooks: appHooks,
invisibleCryptoEnabled: appSettings.invisibleCryptoEnabled) enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode)
.sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath, .sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath) cachePath: credentials.restorationToken.sessionDirectories.cachePath)
.username(username: credentials.userID) .username(username: credentials.userID)
+1 -1
View File
@@ -34,7 +34,7 @@ final class NSEUserSession {
slidingSync: .restored, slidingSync: .restored,
sessionDelegate: clientSessionDelegate, sessionDelegate: clientSessionDelegate,
appHooks: appHooks, appHooks: appHooks,
invisibleCryptoEnabled: appSettings.invisibleCryptoEnabled) enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode)
.sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath, .sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath) cachePath: credentials.restorationToken.sessionDirectories.cachePath)
.username(username: credentials.userID) .username(username: credentials.userID)