From 4210821ab7d8100c266e49e608f2095f93f04c0c Mon Sep 17 00:00:00 2001 From: Andy Uhnak Date: Tue, 25 Oct 2022 12:35:52 +0100 Subject: [PATCH] Curate MXCrypto protocol methods --- Riot/Categories/MXRoom+Riot.m | 7 +++++-- .../QRLogin/Common/Service/MatrixSDK/QRLoginService.swift | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Riot/Categories/MXRoom+Riot.m b/Riot/Categories/MXRoom+Riot.m index 801221597..df47c1674 100644 --- a/Riot/Categories/MXRoom+Riot.m +++ b/Riot/Categories/MXRoom+Riot.m @@ -329,7 +329,7 @@ { if (self.mxSession.crypto) { - [self.mxSession.crypto trustLevelSummaryForUserIds:@[userId] onComplete:^(MXUsersTrustLevelSummary *usersTrustLevelSummary) { + [self.mxSession.crypto trustLevelSummaryForUserIds:@[userId] forceDownload:NO success:^(MXUsersTrustLevelSummary *usersTrustLevelSummary) { UserEncryptionTrustLevel userEncryptionTrustLevel; double trustedDevicesPercentage = usersTrustLevelSummary.trustedDevicesProgress.fractionCompleted; @@ -341,7 +341,7 @@ else if (trustedDevicesPercentage == 0.0) { // Verify if the user has the user has cross-signing enabled - if ([self.mxSession.crypto crossSigningKeysForUser:userId]) + if ([self.mxSession.crypto.crossSigning crossSigningKeysForUser:userId]) { userEncryptionTrustLevel = UserEncryptionTrustLevelNotVerified; } @@ -357,6 +357,9 @@ onComplete(userEncryptionTrustLevel); + } failure:^(NSError *error) { + MXLogErrorDetails(@"[MXRoom+Riot] Error fetching trust level summary", error); + onComplete(UserEncryptionTrustLevelUnknown); }]; } else diff --git a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift index 0dc3f78d5..64a6ab056 100644 --- a/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift +++ b/RiotSwiftUI/Modules/Authentication/QRLogin/Common/Service/MatrixSDK/QRLoginService.swift @@ -292,7 +292,7 @@ class QRLoginService: NSObject, QRLoginServiceProtocol { MXLog.debug("[QRLoginService] Received cross-signing details \(responsePayload)") if let masterKeyFromVerifyingDevice = responsePayload.masterKey, - let localMasterKey = session.crypto.crossSigningKeys(forUser: session.myUserId).masterKeys?.keys { + let localMasterKey = session.crypto.crossSigning.crossSigningKeys(forUser: session.myUserId)?.masterKeys?.keys { guard masterKeyFromVerifyingDevice == localMasterKey else { MXLog.error("[QRLoginService] Received invalid master key from verifying device") await teardownRendezvous(state: .failed(error: .rendezvousFailed))