diff --git a/lib/encryption/cross_signing.dart b/lib/encryption/cross_signing.dart index 787bb0bc..d45577bd 100644 --- a/lib/encryption/cross_signing.dart +++ b/lib/encryption/cross_signing.dart @@ -177,7 +177,27 @@ class CrossSigning { } if (signedKeys.isNotEmpty) { // post our new keys! - await client.uploadKeySignatures(signedKeys); + final payload = >>{}; + for (final key in signedKeys) { + if (key.identifier == null || + key.signatures == null || + key.signatures.isEmpty) { + continue; + } + if (!payload.containsKey(key.userId)) { + payload[key.userId] = >{}; + } + if (payload[key.userId].containsKey(key.identifier)) { + // we need to merge signature objects + payload[key.userId][key.identifier]['signatures'] + .addAll(key.signatures); + } else { + // we can just add signatures + payload[key.userId][key.identifier] = key.toJson(); + } + } + + await client.uploadCrossSigningSignatures(payload); } } diff --git a/lib/encryption/key_manager.dart b/lib/encryption/key_manager.dart index 70a6f18b..bcb62de3 100644 --- a/lib/encryption/key_manager.dart +++ b/lib/encryption/key_manager.dart @@ -608,7 +608,7 @@ class KeyManager { Future loadSingleKey(String roomId, String sessionId) async { final info = await getRoomKeysBackupInfo(); final ret = - await client.getRoomKeysSingleKey(roomId, sessionId, info.version); + await client.getRoomKeysBySessionId(roomId, sessionId, info.version); final keys = RoomKeys.fromJson({ 'rooms': { roomId: { @@ -746,7 +746,7 @@ class KeyManager { _generateUploadKeys, args); Logs().i('[Key Manager] Uploading ${dbSessions.length} room keys...'); // upload the payload... - await client.postRoomKeysKey(info.version, roomKeys); + await client.putRoomKeys(info.version, roomKeys); // and now finally mark all the keys as uploaded // no need to optimze this, as we only run it so seldomly and almost never with many keys at once for (final dbSession in dbSessions) { diff --git a/lib/encryption/utils/bootstrap.dart b/lib/encryption/utils/bootstrap.dart index 3dcd1533..b3142146 100644 --- a/lib/encryption/utils/bootstrap.dart +++ b/lib/encryption/utils/bootstrap.dart @@ -463,7 +463,7 @@ class Bootstrap { state = BootstrapState.loading; Logs().v('Upload device signing keys.'); await client.uiaRequestBackground( - (AuthenticationData auth) => client.uploadDeviceSigningKeys( + (AuthenticationData auth) => client.uploadCrossSigningKeys( masterKey: masterKey, selfSigningKey: selfSigningKey, userSigningKey: userSigningKey, diff --git a/lib/src/room.dart b/lib/src/room.dart index ebfd8d17..7f2c8f68 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1364,7 +1364,7 @@ class Room { try { Logs().v( 'Request missing user $mxID in room $displayname from the server...'); - resp = await client.requestStateContent( + resp = await client.getRoomStateWithKey( id, EventTypes.RoomMember, mxID, diff --git a/pubspec.yaml b/pubspec.yaml index 447305aa..631773e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,8 +16,7 @@ dependencies: crypto: ^3.0.0 base58check: ^2.0.0 olm: ^2.0.0 - # 0.4.3 had accidental API changes - matrix_api_lite: 0.4.2 + matrix_api_lite: ^0.4.3 hive: ^2.0.4 ffi: ^1.0.0 js: ^0.6.3