Skip to content

Commit 3b57e4e

Browse files
authored
Fix a bug where UIA for cross signing wasn't needed until after checking for it. (#7874)
* Update the SDK. * 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.
1 parent 91b2c84 commit 3b57e4e

File tree

3 files changed

+28
-29
lines changed

3 files changed

+28
-29
lines changed

Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ PODS:
3939
- LoggerAPI (1.9.200):
4040
- Logging (~> 1.1)
4141
- Logging (1.4.0)
42-
- MatrixSDK (0.27.15):
43-
- MatrixSDK/Core (= 0.27.15)
44-
- MatrixSDK/Core (0.27.15):
42+
- MatrixSDK (0.27.16):
43+
- MatrixSDK/Core (= 0.27.16)
44+
- MatrixSDK/Core (0.27.16):
4545
- AFNetworking (~> 4.0.0)
4646
- GZIP (~> 1.3.0)
4747
- libbase58 (~> 0.1.4)
4848
- MatrixSDKCrypto (= 0.4.3)
4949
- Realm (= 10.27.0)
5050
- SwiftyBeaver (= 1.9.5)
51-
- MatrixSDK/JingleCallStack (0.27.15):
51+
- MatrixSDK/JingleCallStack (0.27.16):
5252
- JitsiMeetSDKLite (= 8.1.2-lite)
5353
- MatrixSDK/Core
5454
- MatrixSDKCrypto (0.4.3)
@@ -179,7 +179,7 @@ SPEC CHECKSUMS:
179179
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
180180
LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d
181181
Logging: beeb016c9c80cf77042d62e83495816847ef108b
182-
MatrixSDK: 12b379749b84ab5b3662042acb1914b9f9bb692b
182+
MatrixSDK: ce8f2cec670c2212144a129cc617d4144c89b97f
183183
MatrixSDKCrypto: 27bee960e0e8b3a3039f3f3e93dd2ec88299c77e
184184
ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d
185185
Realm: 9ca328bd7e700cc19703799785e37f77d1a130f2
@@ -198,6 +198,6 @@ SPEC CHECKSUMS:
198198
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
199199
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5
200200

201-
PODFILE CHECKSUM: 484a1cdf04951cc82156f29de196efd76d3ad893
201+
PODFILE CHECKSUM: 9148246fffa2c32e3c9b29a51cae4bb037497056
202202

203203
COCOAPODS: 1.14.3

Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,49 +45,48 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType {
4545
// MARK: - Public methods
4646

4747
func start() {
48-
self.showReauthentication()
48+
setupCrossSigning()
4949
}
5050

5151
func toPresentable() -> UIViewController {
5252
return self.parameters.presenter.toPresentable()
5353
}
5454

5555
// MARK: - Private methods
56-
57-
private func showReauthentication() {
56+
57+
private func setupCrossSigning(with authenticationParameters: [String: Any] = [:]) {
58+
guard let crossSigning = parameters.session.crypto?.crossSigning else { return }
5859

60+
crossSigning.setup(withAuthParams: authenticationParameters) { [weak self] in
61+
guard let self else { return }
62+
delegate?.crossSigningSetupCoordinatorDidComplete(self)
63+
} failure: { [weak self] error in
64+
guard let self else { return }
65+
66+
if let responseData = (error as NSError).userInfo[MXHTTPClientErrorResponseDataKey] as? [AnyHashable: Any],
67+
let authenticationSession = MXAuthenticationSession(fromJSON: responseData) {
68+
showReauthentication(authenticationSession: authenticationSession)
69+
} else {
70+
delegate?.crossSigningSetupCoordinator(self, didFailWithError: error)
71+
}
72+
}
73+
}
74+
75+
private func showReauthentication(authenticationSession: MXAuthenticationSession) {
5976
let setupCrossSigningRequest = self.crossSigningService.setupCrossSigningRequest()
6077

6178
let reauthenticationParameters = ReauthenticationCoordinatorParameters(session: parameters.session,
6279
presenter: parameters.presenter,
6380
title: parameters.title,
6481
message: parameters.message,
65-
authenticatedEndpointRequest: setupCrossSigningRequest)
82+
authenticationSession: authenticationSession)
6683

6784
let coordinator = ReauthenticationCoordinator(parameters: reauthenticationParameters)
6885
coordinator.delegate = self
6986
self.add(childCoordinator: coordinator)
7087

7188
coordinator.start()
7289
}
73-
74-
private func setupCrossSigning(with authenticationParameters: [String: Any]) {
75-
guard let crossSigning = self.parameters.session.crypto?.crossSigning else {
76-
return
77-
}
78-
79-
crossSigning.setup(withAuthParams: authenticationParameters) { [weak self] in
80-
guard let self = self else {
81-
return
82-
}
83-
self.delegate?.crossSigningSetupCoordinatorDidComplete(self)
84-
} failure: { [weak self] error in
85-
guard let self = self else {
86-
return
87-
}
88-
self.delegate?.crossSigningSetupCoordinator(self, didFailWithError: error)
89-
}
90-
}
9190
}
9291

9392
// MARK: - ReauthenticationCoordinatorDelegate

0 commit comments

Comments
 (0)