From 0e6ad70fdd27ab379f6dca6cd7b4cae8d5796878 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 26 Nov 2024 16:38:36 +0000 Subject: [PATCH 1/3] Update the SDK. --- Podfile.lock | 12 ++++++------ matrix-ios-sdk | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 63e9f57b55..34baf860f3 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -39,16 +39,16 @@ PODS: - LoggerAPI (1.9.200): - Logging (~> 1.1) - Logging (1.4.0) - - MatrixSDK (0.27.15): - - MatrixSDK/Core (= 0.27.15) - - MatrixSDK/Core (0.27.15): + - MatrixSDK (0.27.16): + - MatrixSDK/Core (= 0.27.16) + - MatrixSDK/Core (0.27.16): - AFNetworking (~> 4.0.0) - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) - MatrixSDKCrypto (= 0.4.3) - Realm (= 10.27.0) - SwiftyBeaver (= 1.9.5) - - MatrixSDK/JingleCallStack (0.27.15): + - MatrixSDK/JingleCallStack (0.27.16): - JitsiMeetSDKLite (= 8.1.2-lite) - MatrixSDK/Core - MatrixSDKCrypto (0.4.3) @@ -179,7 +179,7 @@ SPEC CHECKSUMS: libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75 LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d Logging: beeb016c9c80cf77042d62e83495816847ef108b - MatrixSDK: 12b379749b84ab5b3662042acb1914b9f9bb692b + MatrixSDK: ce8f2cec670c2212144a129cc617d4144c89b97f MatrixSDKCrypto: 27bee960e0e8b3a3039f3f3e93dd2ec88299c77e ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d Realm: 9ca328bd7e700cc19703799785e37f77d1a130f2 @@ -198,6 +198,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5 -PODFILE CHECKSUM: 484a1cdf04951cc82156f29de196efd76d3ad893 +PODFILE CHECKSUM: 9148246fffa2c32e3c9b29a51cae4bb037497056 COCOAPODS: 1.14.3 diff --git a/matrix-ios-sdk b/matrix-ios-sdk index 07aa62ed1a..07e8d577e0 160000 --- a/matrix-ios-sdk +++ b/matrix-ios-sdk @@ -1 +1 @@ -Subproject commit 07aa62ed1acc9f91507c709471f0e1656de0b4fd +Subproject commit 07e8d577e063015ecc3408591d15298c1bfcdff7 From 514b8f68ba8ac452ede77404de561f02bd9c3b01 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 26 Nov 2024 16:40:27 +0000 Subject: [PATCH 2/3] Fix a bug where UIA for cross signing wasn't needed until after checking for it. This was due to the parameters not being present in the check, so we no longer check and instead do UIA on failure. --- .../Setup/CrossSigningSetupCoordinator.swift | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift b/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift index 2877de09d7..4be29d75c0 100644 --- a/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift +++ b/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift @@ -45,7 +45,7 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType { // MARK: - Public methods func start() { - self.showReauthentication() + setupCrossSigning() } func toPresentable() -> UIViewController { @@ -54,15 +54,14 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType { // MARK: - Private methods - private func showReauthentication() { - + private func showReauthentication(authenticationSession: MXAuthenticationSession) { let setupCrossSigningRequest = self.crossSigningService.setupCrossSigningRequest() let reauthenticationParameters = ReauthenticationCoordinatorParameters(session: parameters.session, presenter: parameters.presenter, title: parameters.title, message: parameters.message, - authenticatedEndpointRequest: setupCrossSigningRequest) + authenticationSession: authenticationSession) let coordinator = ReauthenticationCoordinator(parameters: reauthenticationParameters) coordinator.delegate = self @@ -71,21 +70,21 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType { coordinator.start() } - private func setupCrossSigning(with authenticationParameters: [String: Any]) { - guard let crossSigning = self.parameters.session.crypto?.crossSigning else { - return - } + private func setupCrossSigning(with authenticationParameters: [String: Any] = [:]) { + guard let crossSigning = parameters.session.crypto?.crossSigning else { return } crossSigning.setup(withAuthParams: authenticationParameters) { [weak self] in - guard let self = self else { - return - } - self.delegate?.crossSigningSetupCoordinatorDidComplete(self) + guard let self else { return } + delegate?.crossSigningSetupCoordinatorDidComplete(self) } failure: { [weak self] error in - guard let self = self else { - return + guard let self else { return } + + if let responseData = (error as NSError).userInfo[MXHTTPClientErrorResponseDataKey] as? [AnyHashable: Any], + let authenticationSession = MXAuthenticationSession(fromJSON: responseData) { + showReauthentication(authenticationSession: authenticationSession) + } else { + delegate?.crossSigningSetupCoordinator(self, didFailWithError: error) } - self.delegate?.crossSigningSetupCoordinator(self, didFailWithError: error) } } } From 4c0a89dc7890ca4b2abb8d8ef2af2bb4208605f3 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 26 Nov 2024 16:41:30 +0000 Subject: [PATCH 3/3] Re-arrange method other. (No other changes are made to the methods). --- .../Setup/CrossSigningSetupCoordinator.swift | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift b/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift index 4be29d75c0..74b7f967ea 100644 --- a/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift +++ b/Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift @@ -53,22 +53,6 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType { } // MARK: - Private methods - - private func showReauthentication(authenticationSession: MXAuthenticationSession) { - let setupCrossSigningRequest = self.crossSigningService.setupCrossSigningRequest() - - let reauthenticationParameters = ReauthenticationCoordinatorParameters(session: parameters.session, - presenter: parameters.presenter, - title: parameters.title, - message: parameters.message, - authenticationSession: authenticationSession) - - let coordinator = ReauthenticationCoordinator(parameters: reauthenticationParameters) - coordinator.delegate = self - self.add(childCoordinator: coordinator) - - coordinator.start() - } private func setupCrossSigning(with authenticationParameters: [String: Any] = [:]) { guard let crossSigning = parameters.session.crypto?.crossSigning else { return } @@ -87,6 +71,22 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType { } } } + + private func showReauthentication(authenticationSession: MXAuthenticationSession) { + let setupCrossSigningRequest = self.crossSigningService.setupCrossSigningRequest() + + let reauthenticationParameters = ReauthenticationCoordinatorParameters(session: parameters.session, + presenter: parameters.presenter, + title: parameters.title, + message: parameters.message, + authenticationSession: authenticationSession) + + let coordinator = ReauthenticationCoordinator(parameters: reauthenticationParameters) + coordinator.delegate = self + self.add(childCoordinator: coordinator) + + coordinator.start() + } } // MARK: - ReauthenticationCoordinatorDelegate