Skip to content

Commit

Permalink
Merge pull request #7852 from element-hq/mauroromito/libolm_deprecate…
Browse files Browse the repository at this point in the history
…d_removal

Libolm removal
  • Loading branch information
Velin92 authored Oct 15, 2024
2 parents 11d4148 + 969aee2 commit 7da255a
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 113 deletions.
1 change: 0 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ abstract_target 'RiotPods' do

pod 'Sentry', '~> 7.15.0'

pod 'OLMKit'
pod 'zxcvbn-ios'

# Tools
Expand Down
13 changes: 2 additions & 11 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -143,7 +136,6 @@ SPEC REPOS:
- LoggerAPI
- Logging
- MatrixSDKCrypto
- OLMKit
- ReadMoreTextView
- Realm
- Reusable
Expand Down Expand Up @@ -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
Expand All @@ -207,6 +198,6 @@ SPEC CHECKSUMS:
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5

PODFILE CHECKSUM: fb3e1c62f9e35a9bdbafce743664bf4f620af028
PODFILE CHECKSUM: 484a1cdf04951cc82156f29de196efd76d3ad893

COCOAPODS: 1.15.2
4 changes: 2 additions & 2 deletions Riot/Modules/Authentication/AuthenticationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ 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
// The backup is now handled by Rust
let keyBackupNeeded = false

let softLogoutCredentials = SoftLogoutCredentials(userId: userId,
homeserverName: credentials.homeServerName() ?? "",
Expand Down
6 changes: 2 additions & 4 deletions Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1033,10 +1033,8 @@ - (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
MXRealmCryptoStore *cryptoStore = [[MXRealmCryptoStore alloc] initWithCredentials:self.softLogoutCredentials];
BOOL keyBackupNeeded = [cryptoStore inboundGroupSessionsToBackup:1].count > 0;
// Backup is now handled by Rust
BOOL keyBackupNeeded = NO;

MXFileStore *fileStore = [[MXFileStore alloc] initWithCredentials:softLogoutCredentials];
[fileStore asyncUsersWithUserIds:@[softLogoutCredentials.userId] success:^(NSArray<MXUser *> * _Nonnull users) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +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
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#import "ManageSessionViewController.h"

#import <OLMKit/OLMKit.h>

#import "AvatarGenerator.h"

#import "ThemeService.h"
Expand Down
2 changes: 0 additions & 2 deletions Riot/Modules/Settings/Security/SecurityViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#import "ManageSessionViewController.h"

#import <OLMKit/OLMKit.h>

#import "AvatarGenerator.h"

#import "ThemeService.h"
Expand Down
2 changes: 0 additions & 2 deletions Riot/Modules/Settings/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#import "SettingsViewController.h"

#import <OLMKit/OLMKit.h>

#import "AvatarGenerator.h"

#import "BugReportViewController.h"
Expand Down
80 changes: 0 additions & 80 deletions RiotTests/UserSessionsDataProviderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -166,45 +118,13 @@ 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()
}

}

/// 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
Expand Down
2 changes: 1 addition & 1 deletion matrix-ios-sdk
Submodule matrix-ios-sdk updated 150 files

0 comments on commit 7da255a

Please sign in to comment.