From 4b2029c9a32226f3bf59dc2bede6a877ba139e8a Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 27 Sep 2024 17:09:02 +0200 Subject: [PATCH 1/7] Libolm removal --- Podfile | 1 - Podfile.lock | 13 ++----------- .../Authentication/AuthenticationCoordinator.swift | 3 +-- .../Authentication/Legacy/Views/AuthInputsView.m | 3 +-- .../KeyVerificationVerifyByScanningViewModel.swift | 11 ++++++----- .../ManageSession/ManageSessionViewController.m | 2 -- .../Settings/Security/SecurityViewController.m | 2 -- Riot/Modules/Settings/SettingsViewController.m | 2 -- matrix-ios-sdk | 2 +- 9 files changed, 11 insertions(+), 28 deletions(-) diff --git a/Podfile b/Podfile index 4035934fbc..449d21f940 100644 --- a/Podfile +++ b/Podfile @@ -37,7 +37,6 @@ abstract_target 'RiotPods' do pod 'Sentry', '~> 7.15.0' - pod 'OLMKit' pod 'zxcvbn-ios' # Tools diff --git a/Podfile.lock b/Podfile.lock index 939565c096..672f3250b5 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -46,18 +46,12 @@ PODS: - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) - MatrixSDKCrypto (= 0.4.3) - - OLMKit (~> 3.2.5) - Realm (= 10.27.0) - SwiftyBeaver (= 1.9.5) - MatrixSDK/JingleCallStack (0.27.13): - JitsiMeetSDKLite (= 8.1.2-lite) - MatrixSDK/Core - MatrixSDKCrypto (0.4.3) - - OLMKit (3.2.12): - - OLMKit/olmc (= 3.2.12) - - OLMKit/olmcpp (= 3.2.12) - - OLMKit/olmc (3.2.12) - - OLMKit/olmcpp (3.2.12) - ReadMoreTextView (3.0.1) - Realm (10.27.0): - Realm/Headers (= 10.27.0) @@ -103,7 +97,6 @@ DEPENDENCIES: - libPhoneNumber-iOS (~> 0.9.13) - MatrixSDK (from `matrix-ios-sdk/MatrixSDK.podspec`) - MatrixSDK/JingleCallStack (from `matrix-ios-sdk/MatrixSDK.podspec`) - - OLMKit - ReadMoreTextView (~> 3.0.1) - Reusable (~> 4.1) - Sentry (~> 7.15.0) @@ -143,7 +136,6 @@ SPEC REPOS: - LoggerAPI - Logging - MatrixSDKCrypto - - OLMKit - ReadMoreTextView - Realm - Reusable @@ -187,9 +179,8 @@ SPEC CHECKSUMS: libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75 LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d Logging: beeb016c9c80cf77042d62e83495816847ef108b - MatrixSDK: 1dae186c839eb145974fc1fc127ec903de60a297 + MatrixSDK: b5756a518af19296b94e3ad9b6f16648f9eb17c3 MatrixSDKCrypto: 27bee960e0e8b3a3039f3f3e93dd2ec88299c77e - OLMKit: da115f16582e47626616874e20f7bb92222c7a51 ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d Realm: 9ca328bd7e700cc19703799785e37f77d1a130f2 Reusable: 6bae6a5e8aa793c9c441db0213c863a64bce9136 @@ -207,6 +198,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5 -PODFILE CHECKSUM: fb3e1c62f9e35a9bdbafce743664bf4f620af028 +PODFILE CHECKSUM: 484a1cdf04951cc82156f29de196efd76d3ad893 COCOAPODS: 1.15.2 diff --git a/Riot/Modules/Authentication/AuthenticationCoordinator.swift b/Riot/Modules/Authentication/AuthenticationCoordinator.swift index 295a591f73..315cdd47cc 100644 --- a/Riot/Modules/Authentication/AuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/AuthenticationCoordinator.swift @@ -298,8 +298,7 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc let store = MXFileStore(credentials: credentials) let userDisplayName = await store.displayName(ofUserWithId: userId) ?? "" - let cryptoStore = MXRealmCryptoStore(credentials: credentials) - let keyBackupNeeded = (cryptoStore?.inboundGroupSessions(toBackup: 1) ?? []).count > 0 + let keyBackupNeeded = false let softLogoutCredentials = SoftLogoutCredentials(userId: userId, homeserverName: credentials.homeServerName() ?? "", diff --git a/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m b/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m index 2bd0be84da..7c3623543f 100644 --- a/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m +++ b/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m @@ -1035,8 +1035,7 @@ - (void)displaySoftLogoutMessage { // Take some shortcuts and make some assumptions (Riot uses MXFileStore and MXRealmCryptoStore) to // retrieve data to display as quick as possible - MXRealmCryptoStore *cryptoStore = [[MXRealmCryptoStore alloc] initWithCredentials:self.softLogoutCredentials]; - BOOL keyBackupNeeded = [cryptoStore inboundGroupSessionsToBackup:1].count > 0; + BOOL keyBackupNeeded = NO; MXFileStore *fileStore = [[MXFileStore alloc] initWithCredentials:softLogoutCredentials]; [fileStore asyncUsersWithUserIds:@[softLogoutCredentials.userId] success:^(NSArray * _Nonnull users) { diff --git a/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift b/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift index a8afb86b22..d3874ee115 100644 --- a/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift +++ b/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift @@ -174,11 +174,12 @@ final class KeyVerificationVerifyByScanningViewModel: KeyVerificationVerifyBySca self.removePendingQRCodeTransaction() // Check due to legacy implementation of key verification which could pass incorrect type of transaction - if keyVerificationTransaction is MXIncomingSASTransaction { - MXLog.debug("[KeyVerificationVerifyByScanningViewModel] SAS transaction should be outgoing") - self.unregisterDidStateChangeNotification() - self.update(viewState: .error(KeyVerificationVerifyByScanningViewModelError.unknown)) - } + // TODO: Not sure about commenting this code, but MXIncomingSASTransaction has been removed +// if keyVerificationTransaction is MXIncomingSASTransaction { +// MXLog.debug("[KeyVerificationVerifyByScanningViewModel] SAS transaction should be outgoing") +// self.unregisterDidStateChangeNotification() +// self.update(viewState: .error(KeyVerificationVerifyByScanningViewModelError.unknown)) +// } }, failure: { [weak self] (error) in guard let self = self else { diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index 308f33c4d4..ad5eb9f9c8 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -7,8 +7,6 @@ #import "ManageSessionViewController.h" -#import - #import "AvatarGenerator.h" #import "ThemeService.h" diff --git a/Riot/Modules/Settings/Security/SecurityViewController.m b/Riot/Modules/Settings/Security/SecurityViewController.m index 0a5fea1e20..b366259e6b 100644 --- a/Riot/Modules/Settings/Security/SecurityViewController.m +++ b/Riot/Modules/Settings/Security/SecurityViewController.m @@ -9,8 +9,6 @@ #import "ManageSessionViewController.h" -#import - #import "AvatarGenerator.h" #import "ThemeService.h" diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index fa52908a04..4c99850342 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -9,8 +9,6 @@ #import "SettingsViewController.h" -#import - #import "AvatarGenerator.h" #import "BugReportViewController.h" diff --git a/matrix-ios-sdk b/matrix-ios-sdk index 8a65ea10ef..f0f87bc3ac 160000 --- a/matrix-ios-sdk +++ b/matrix-ios-sdk @@ -1 +1 @@ -Subproject commit 8a65ea10ef8eb3b1511b1f9a0a6d5b8c018a04bc +Subproject commit f0f87bc3ac3e15645d4bae59bb3f4161740d8732 From 7519524ff6b40c1adb292d7c771a2a0e75874419 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 27 Sep 2024 18:06:17 +0200 Subject: [PATCH 2/7] fix --- RiotTests/UserSessionsDataProviderTests.swift | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/RiotTests/UserSessionsDataProviderTests.swift b/RiotTests/UserSessionsDataProviderTests.swift index 23e5859105..64fb336f96 100644 --- a/RiotTests/UserSessionsDataProviderTests.swift +++ b/RiotTests/UserSessionsDataProviderTests.swift @@ -166,11 +166,6 @@ private class MockSession: MXSession { let canCrossSign: Bool override var myDeviceId: String! { .currentDevice } - override var crypto: MXCrypto! { - get { MockCrypto(canCrossSign: canCrossSign) } - set { } - } - init(canCrossSign: Bool) { self.canCrossSign = canCrossSign super.init() @@ -178,33 +173,6 @@ private class MockSession: MXSession { } -/// A mock `MXCrypto` that can override the `canCrossSign` state. -private class MockCrypto: MXLegacyCrypto { - let canCrossSign: Bool - override var crossSigning: MXCrossSigning { MockCrossSigning(canCrossSign: canCrossSign) } - - init(canCrossSign: Bool) { - self.canCrossSign = canCrossSign - super.init() - } - -} - -/// A mock `MXCrossSigning` with an overridden `canCrossSign` property. -private class MockCrossSigning: MXLegacyCrossSigning { - let canCrossSignMock: Bool - override var canCrossSign: Bool { canCrossSignMock } - - init(canCrossSign: Bool) { - self.canCrossSignMock = canCrossSign - super.init() - } - - override var state: MXCrossSigningState { - .crossSigningExists - } -} - /// A mock `MXDeviceInfo` that can override the `isVerified` state. private class MockDeviceInfo: MXDeviceInfo { private let verified: Bool From d7e65fa1162e32b852c21c21eef0bd1a2c444f44 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Wed, 9 Oct 2024 11:53:07 +0200 Subject: [PATCH 3/7] update submodule --- matrix-ios-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix-ios-sdk b/matrix-ios-sdk index f0f87bc3ac..21f4abfc6e 160000 --- a/matrix-ios-sdk +++ b/matrix-ios-sdk @@ -1 +1 @@ -Subproject commit f0f87bc3ac3e15645d4bae59bb3f4161740d8732 +Subproject commit 21f4abfc6e8af8bfba7c079598879b77895cf10d From 9d1ba610e31dd9dd80faedb319770be35dee6c31 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Wed, 9 Oct 2024 12:11:48 +0200 Subject: [PATCH 4/7] removed unused code --- .../KeyVerificationVerifyByScanningViewModel.swift | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift b/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift index d3874ee115..3f59f4d1da 100644 --- a/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift +++ b/Riot/Modules/KeyVerification/Common/Verify/Scanning/KeyVerificationVerifyByScanningViewModel.swift @@ -172,15 +172,6 @@ final class KeyVerificationVerifyByScanningViewModel: KeyVerificationVerifyBySca // Remove pending QR code transaction, as we are going to use SAS verification self.removePendingQRCodeTransaction() - - // Check due to legacy implementation of key verification which could pass incorrect type of transaction - // TODO: Not sure about commenting this code, but MXIncomingSASTransaction has been removed -// if keyVerificationTransaction is MXIncomingSASTransaction { -// MXLog.debug("[KeyVerificationVerifyByScanningViewModel] SAS transaction should be outgoing") -// self.unregisterDidStateChangeNotification() -// self.update(viewState: .error(KeyVerificationVerifyByScanningViewModelError.unknown)) -// } - }, failure: { [weak self] (error) in guard let self = self else { return From 611a906f109513dc1034e15f9bb7d0395e70c450 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Wed, 9 Oct 2024 17:14:59 +0200 Subject: [PATCH 5/7] remove obsolete tests --- RiotTests/UserSessionsDataProviderTests.swift | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/RiotTests/UserSessionsDataProviderTests.swift b/RiotTests/UserSessionsDataProviderTests.swift index 64fb336f96..42534303f5 100644 --- a/RiotTests/UserSessionsDataProviderTests.swift +++ b/RiotTests/UserSessionsDataProviderTests.swift @@ -10,22 +10,6 @@ import XCTest @testable import Element class UserSessionCardViewDataTests: XCTestCase { - func testOtherSessionsWithCrossSigning() { - // Given a data provider for a session that can cross sign. - let mxSession = MockSession(canCrossSign: true) - let dataProvider = UserSessionsDataProvider(session: mxSession) - - // When the verification state of other sessions is requested. - let deviceA = MockDeviceInfo(deviceID: .otherDeviceA, verified: true) - let deviceB = MockDeviceInfo(deviceID: .otherDeviceB, verified: false) - let verificationStateA = dataProvider.verificationState(for: deviceA) - let verificationStateB = dataProvider.verificationState(for: deviceB) - - // Then they should match the verification state from the device info. - XCTAssertEqual(verificationStateA, .verified) - XCTAssertEqual(verificationStateB, .unverified) - } - func testOtherSessionsWithoutCrossSigning() { // Given a data provider for a session that can't cross sign. let mxSession = MockSession(canCrossSign: false) @@ -42,38 +26,6 @@ class UserSessionCardViewDataTests: XCTestCase { XCTAssertEqual(verificationStateB, .unknown) } - func testCurrentDeviceWithCrossSigning() { - // Given a data provider for a session that can cross sign. - let mxSession = MockSession(canCrossSign: true) - let dataProvider = UserSessionsDataProvider(session: mxSession) - - // When the verification state of the same session is requested. - let currentDeviceVerified = MockDeviceInfo(deviceID: .currentDevice, verified: true) - let currentDeviceUnverified = MockDeviceInfo(deviceID: .currentDevice, verified: false) - let verificationStateVerified = dataProvider.verificationState(for: currentDeviceVerified) - let verificationStateUnverified = dataProvider.verificationState(for: currentDeviceUnverified) - - // Then the verification state should be unknown. - XCTAssertEqual(verificationStateVerified, .verified) - XCTAssertEqual(verificationStateUnverified, .unverified) - } - - func testCurrentDeviceWithoutCrossSigning() { - // Given a data provider for a session that can't cross sign. - let mxSession = MockSession(canCrossSign: false) - let dataProvider = UserSessionsDataProvider(session: mxSession) - - // When the verification state of the same session is requested. - let currentDeviceVerified = MockDeviceInfo(deviceID: .currentDevice, verified: true) - let currentDeviceUnverified = MockDeviceInfo(deviceID: .currentDevice, verified: false) - let verificationStateVerified = dataProvider.verificationState(for: currentDeviceVerified) - let verificationStateUnverified = dataProvider.verificationState(for: currentDeviceUnverified) - - // Then the verification state should be unknown. - XCTAssertEqual(verificationStateVerified, .unverified) - XCTAssertEqual(verificationStateUnverified, .unverified) - } - func testDeviceNotHavingCryptoSupportOnVerifiedDevice() { let mxSession = MockSession(canCrossSign: true) let dataProvider = UserSessionsDataProvider(session: mxSession) From 6853e50e9a1029d221e59e1bf23b2d31e410fd75 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Tue, 15 Oct 2024 15:36:00 +0200 Subject: [PATCH 6/7] update submodule --- matrix-ios-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix-ios-sdk b/matrix-ios-sdk index 21f4abfc6e..bae77831f2 160000 --- a/matrix-ios-sdk +++ b/matrix-ios-sdk @@ -1 +1 @@ -Subproject commit 21f4abfc6e8af8bfba7c079598879b77895cf10d +Subproject commit bae77831f2da7834303613c2ccbb75570e856291 From 969aee242f0c526fbc2da72640a2657c7ad65f3b Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Tue, 15 Oct 2024 16:13:19 +0200 Subject: [PATCH 7/7] comments --- Riot/Modules/Authentication/AuthenticationCoordinator.swift | 1 + Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Authentication/AuthenticationCoordinator.swift b/Riot/Modules/Authentication/AuthenticationCoordinator.swift index 315cdd47cc..357a7a54a8 100644 --- a/Riot/Modules/Authentication/AuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/AuthenticationCoordinator.swift @@ -298,6 +298,7 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc let store = MXFileStore(credentials: credentials) let userDisplayName = await store.displayName(ofUserWithId: userId) ?? "" + // The backup is now handled by Rust let keyBackupNeeded = false let softLogoutCredentials = SoftLogoutCredentials(userId: userId, diff --git a/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m b/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m index 7c3623543f..e9e77f2f68 100644 --- a/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m +++ b/Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m @@ -1033,8 +1033,7 @@ - (void)setSoftLogoutCredentials:(MXCredentials *)credentials - (void)displaySoftLogoutMessage { - // Take some shortcuts and make some assumptions (Riot uses MXFileStore and MXRealmCryptoStore) to - // retrieve data to display as quick as possible + // Backup is now handled by Rust BOOL keyBackupNeeded = NO; MXFileStore *fileStore = [[MXFileStore alloc] initWithCredentials:softLogoutCredentials];