Skip to content

Commit

Permalink
Merge branch 'release/0.23.16/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Aug 24, 2022
2 parents a68cb3e + fa4b3ca commit 34d6188
Show file tree
Hide file tree
Showing 143 changed files with 6,190 additions and 1,478 deletions.
4 changes: 3 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ Pierre Dubois <pierre.dubois8989 at gmail.com>
John Flanagan <john.flanagan at spok.com>
* PR #463 Fix compatibility with Swift 4.0 (issue #393)
* PR #465 SwiftMatrixSDK: Enum cleanup


Michael Redig <hybrids-07-baggage at icloud.com>
* PR #1543 (refactor) project settings update
26 changes: 26 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## Changes in 0.23.16 (2022-08-24)

✨ Features

- MXKeyBackup: Add support for symmetric key backups. ([#1542](https://github.com/matrix-org/matrix-ios-sdk/pull/1542))
- CryptoSDK: Outgoing SAS User Verification Flow ([#6443](https://github.com/vector-im/element-ios/issues/6443))

🙌 Improvements

- App Layout: Increased store version to force clear cache ([#6616](https://github.com/vector-im/element-ios/issues/6616))

🧱 Build

- Xcode project(s) updated via Xcode recommended setting ([#1543](https://github.com/matrix-org/matrix-ios-sdk/pull/1543))
- MXLog: Ensure MXLogLevel.none works if it is set after another log level has already been configured. ([#1550](https://github.com/matrix-org/matrix-ios-sdk/issues/1550))

📄 Documentation

- Update README for correct Swift usage. ([#1552](https://github.com/matrix-org/matrix-ios-sdk/issues/1552))

Others

- Crypto: User and device identity objects ([#1531](https://github.com/matrix-org/matrix-ios-sdk/pull/1531))
- Analytics: Log all errors to analytics ([#1558](https://github.com/matrix-org/matrix-ios-sdk/pull/1558))


## Changes in 0.23.15 (2022-08-10)

🐛 Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MatrixSDK"
s.version = "0.23.15"
s.version = "0.23.16"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"

s.description = <<-DESC
Expand Down
468 changes: 397 additions & 71 deletions MatrixSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1160"
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1160"
LastUpgradeVersion = "1340"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public class MXBeaconAggregations: NSObject {

room.redactEvent(relationEvent.eventId, reason: nil) { response in
if case .failure(let error) = response {
MXLog.error("[MXBeaconAggregations] Failed to redact m.beacon event with error: \(error)")
MXLog.error("[MXBeaconAggregations] Failed to redact m.beacon event", context: error)
}
}
}
Expand All @@ -182,7 +182,7 @@ public class MXBeaconAggregations: NSObject {
// Redact stopped beacon info
room.redactEvent(eventId, reason: nil) { response in
if case .failure(let error) = response {
MXLog.error("[MXBeaconAggregations] Failed to redact stopped m.beacon_info event with error: \(error)")
MXLog.error("[MXBeaconAggregations] Failed to redact stopped m.beacon_info event", context: error)
}
}
}
Expand Down Expand Up @@ -258,7 +258,9 @@ public class MXBeaconAggregations: NSObject {
existingBeaconInfoSummary.updateWithBeaconInfo(beaconInfo)
beaconInfoSummary = existingBeaconInfoSummary
} else {
MXLog.error("[MXBeaconAggregations] Fails to find beacon info summary associated to stopped beacon info event id: \(eventId)")
MXLog.error("[MXBeaconAggregations] Fails to find beacon info summary associated to stopped beacon info", context: [
"event_id": eventId
])
}

} else if let existingBeaconInfoSummary = self.getBeaconInfoSummary(withIdentifier: eventId, inRoomWithId: roomId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class MXBeaconInfoSummaryRealmStore: NSObject {
return realm
} catch {

MXLog.error("[MXBeaconInfoSummaryRealmStore] failed to create Realm store with error: \(error)")
MXLog.error("[MXBeaconInfoSummaryRealmStore] failed to create Realm store", context: error)
return nil
}
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public class MXBeaconInfoSummaryRealmStore: NSObject {
do {
try FileManager.default.createDirectory(at: realmFileFolderURL, withIntermediateDirectories: true, attributes: nil)
} catch {
MXLog.error("[MXBeaconInfoSummaryRealmStore] Fail to create Realm folder \(realmFileFolderURL) with error: \(error)")
MXLog.error("[MXBeaconInfoSummaryRealmStore] Fail to create Realm folder", context: error)
throw error
}

Expand Down Expand Up @@ -182,7 +182,7 @@ extension MXBeaconInfoSummaryRealmStore: MXBeaconInfoSummaryStoreProtocol {
realm.addOrUpdate(realmBeaconInfoSummary)
}
} catch {
MXLog.error("[MXBeaconInfoSummaryRealmStore] addOrUpdateBeaconInfoSummary failed with error: \(error)")
MXLog.error("[MXBeaconInfoSummaryRealmStore] addOrUpdateBeaconInfoSummary failed", context: error)
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ extension MXBeaconInfoSummaryRealmStore: MXBeaconInfoSummaryStoreProtocol {
realm.deleteObjects(realmBeaconInfoSummaries)
}
} catch {
MXLog.error("[MXBeaconInfoSummaryRealmStore] deleteAllBeaconInfoSummaries failed with error: \(error)")
MXLog.error("[MXBeaconInfoSummaryRealmStore] deleteAllBeaconInfoSummaries failed", context: error)
}
}

Expand All @@ -305,7 +305,7 @@ extension MXBeaconInfoSummaryRealmStore: MXBeaconInfoSummaryStoreProtocol {
realm.deleteObjects(realmBeaconInfoSummaries)
}
} catch {
MXLog.error("[MXBeaconInfoSummaryRealmStore] deleteAllBeaconInfoSummaries failed with error: \(error)")
MXLog.error("[MXBeaconInfoSummaryRealmStore] deleteAllBeaconInfoSummaries failed", context: error)
}
}

Expand All @@ -320,7 +320,7 @@ extension MXBeaconInfoSummaryRealmStore: MXBeaconInfoSummaryStoreProtocol {
realm.deleteAllObjects()
}
} catch {
MXLog.error("[MXBeaconInfoSummaryRealmStore] Failed to delete all objects: \(error)")
MXLog.error("[MXBeaconInfoSummaryRealmStore] Failed to delete all objects", context: error)
}
}
}
4 changes: 3 additions & 1 deletion MatrixSDK/Aggregations/MXAggregatedReactionsUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ - (MXHTTPOperation*)sendReaction:(NSString*)reaction
MXRoom *room = [self.mxSession roomWithRoomId:roomId];
if (!room)
{
MXLogError(@"[MXAggregations] sendReaction Error: Unknown room: %@", roomId);
MXLogErrorDetails(@"[MXAggregations] sendReaction Error: Unknown room", @{
@"room_id": roomId ?: @"unknown"
});
return nil;
}

Expand Down
6 changes: 5 additions & 1 deletion MatrixSDK/Background/MXBackgroundSyncService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ public enum MXBackgroundSyncServiceError: Error {
decryptionResult.senderCurve25519Key = olmResult.senderKey
decryptionResult.claimedEd25519Key = olmResult.keysClaimed["ed25519"] as? String
decryptionResult.forwardingCurve25519KeyChain = olmResult.forwardingCurve25519KeyChain
decryptionResult.isUntrusted = olmResult.isUntrusted
event.setClearData(decryptionResult)
} else if decryptorClass == MXOlmDecryption.self {
guard let ciphertextDict = event.content["ciphertext"] as? [AnyHashable: Any],
Expand Down Expand Up @@ -550,7 +551,10 @@ public enum MXBackgroundSyncServiceError: Error {
case .success:
MXLog.debug("[MXBackgroundSyncService] handleSyncResponse: Joined room: \(roomId)")
case .failure(let error):
MXLog.error("[MXBackgroundSyncService] handleSyncResponse: Failed to join room: \(roomId), error: \(error)")
MXLog.error("[MXBackgroundSyncService] handleSyncResponse: Failed to join room", context: [
"error": error,
"room_id": roomId
])
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions MatrixSDK/Contrib/Swift/JSONModels/MXEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public enum MXEventType: Equatable, Hashable {
case reaction
case receipt
case roomTombStone
case keyVerificationRequest
case keyVerificationReady
case keyVerificationStart
case keyVerificationAccept
case keyVerificationKey
Expand Down Expand Up @@ -122,6 +124,8 @@ public enum MXEventType: Equatable, Hashable {
case .reaction: return kMXEventTypeStringReaction
case .receipt: return kMXEventTypeStringReceipt
case .roomTombStone: return kMXEventTypeStringRoomTombStone
case .keyVerificationRequest: return kMXEventTypeStringKeyVerificationRequest
case .keyVerificationReady: return kMXEventTypeStringKeyVerificationReady
case .keyVerificationStart: return kMXEventTypeStringKeyVerificationStart
case .keyVerificationAccept: return kMXEventTypeStringKeyVerificationAccept
case .keyVerificationKey: return kMXEventTypeStringKeyVerificationKey
Expand Down
5 changes: 5 additions & 0 deletions MatrixSDK/Crypto/Algorithms/MXDecryptionResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ FOUNDATION_EXPORT NSString* const MXDecryptingErrorMissingPropertyReason;
*/
@property NSArray<NSString *> *forwardingCurve25519KeyChain;

/**
Flag indicating the decrpytion was made with an untrusted session.
*/
@property (nonatomic, getter=isUntrusted) BOOL untrusted;

@end
5 changes: 5 additions & 0 deletions MatrixSDK/Crypto/Algorithms/MXEventDecryptionResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@
*/
@property (nonatomic) NSError *error;

/**
Flag indicating the decryption was made with an untrusted session.
*/
@property (nonatomic, getter=isUntrusted) BOOL untrusted;

@end
1 change: 1 addition & 0 deletions MatrixSDK/Crypto/Algorithms/Megolm/MXMegolmDecryption.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ - (MXEventDecryptionResult *)decryptEvent:(MXEvent*)event inTimeline:(NSString*)
result.senderCurve25519Key = olmResult.senderKey;
result.claimedEd25519Key = olmResult.keysClaimed[@"ed25519"];
result.forwardingCurve25519KeyChain = olmResult.forwardingCurve25519KeyChain;
result.untrusted = olmResult.isUntrusted;
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions MatrixSDK/Crypto/CrossSigning/Data/MXCrossSigningInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#import "MXCrossSigningKey.h"
#import "MXUserTrustLevel.h"

@class MXCryptoUserIdentityWrapper;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -32,6 +33,13 @@ extern NSString *const MXCrossSigningInfoTrustLevelDidChangeNotification;
*/
@interface MXCrossSigningInfo : NSObject <NSCoding>

#if DEBUG && TARGET_OS_IPHONE
/**
Initialize cross signing with MatrixSDKCrypto user identity
*/
- (instancetype)initWithUserIdentity:(MXCryptoUserIdentityWrapper *)userIdentity;
#endif

/**
The user's id.
*/
Expand Down
28 changes: 28 additions & 0 deletions MatrixSDK/Crypto/CrossSigning/Data/MXCrossSigningInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,41 @@
*/

#import "MXCrossSigningInfo_Private.h"
#import "MatrixSDKSwiftHeader.h"

#pragma mark - Constants

NSString *const MXCrossSigningInfoTrustLevelDidChangeNotification = @"MXCrossSigningInfoTrustLevelDidChangeNotification";

@implementation MXCrossSigningInfo

#if DEBUG && TARGET_OS_IPHONE
- (instancetype)initWithUserIdentity:(MXCryptoUserIdentityWrapper *)userIdentity
{
self = [self init];
if (self)
{
_userId = userIdentity.userId;
NSMutableDictionary *keys = [NSMutableDictionary dictionary];
if (userIdentity.masterKeys)
{
keys[MXCrossSigningKeyType.master] = userIdentity.masterKeys;
}
if (userIdentity.selfSignedKeys)
{
keys[MXCrossSigningKeyType.selfSigning] = userIdentity.selfSignedKeys;
}
if (userIdentity.userSignedKeys)
{
keys[MXCrossSigningKeyType.userSigning] = userIdentity.userSignedKeys;
}
_keys = keys.copy;
_trustLevel = userIdentity.trustLevel;
}
return self;
}
#endif

- (MXCrossSigningKey *)masterKeys
{
return _keys[MXCrossSigningKeyType.master];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// Copyright 2022 The Matrix.org Foundation C.I.C
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation

#if DEBUG && os(iOS)

import MatrixSDKCrypto

/// Convenience wrapper around `MatrixSDKCrypto`'s `UserIdentity`
/// which can be used to create `MatrixSDK`s `MXCrossSigningInfo`
///
/// Note: The class is marked as final with internal initializer,
/// meaning it cannot be created or subclassed from outside the SDK.
@objcMembers public final class MXCryptoUserIdentityWrapper: NSObject {
public let userId: String
public let masterKeys: MXCrossSigningKey?
public let selfSignedKeys: MXCrossSigningKey?
public let userSignedKeys: MXCrossSigningKey?
public let trustLevel: MXUserTrustLevel

internal init(identity: UserIdentity, isVerified: Bool) {
switch identity {
case .own(let userId, _, let masterKey, let selfSigningKey, let userSigningKey):
self.userId = userId
// Note: `trustsOurOwnDevice` is not currently used, instead using second `isVerified` parameter
self.masterKeys = .init(jsonString: masterKey)
self.selfSignedKeys = .init(jsonString: selfSigningKey)
self.userSignedKeys = .init(jsonString: userSigningKey)
case .other(let userId, let masterKey, let selfSigningKey):
self.userId = userId
self.masterKeys = .init(jsonString: masterKey)
self.selfSignedKeys = .init(jsonString: selfSigningKey)
self.userSignedKeys = nil
}
trustLevel = MXUserTrustLevel(
crossSigningVerified: isVerified,
locallyVerified: false // Note: Local verification not yet implemented
)
}
}

private extension MXCrossSigningKey {
convenience init?(jsonString: String) {
guard let json = MXTools.deserialiseJSONString(jsonString) as? [AnyHashable: Any] else {
return nil
}
self.init(fromJSON: json)
}
}

#endif
Loading

0 comments on commit 34d6188

Please sign in to comment.