fix: compilation against newer matrix_api_lite

This commit is contained in:
Nicolas Werner 2021-09-10 16:18:52 +02:00
parent 8c22c0108b
commit e000fbf9be
5 changed files with 26 additions and 7 deletions

View File

@ -177,7 +177,27 @@ class CrossSigning {
}
if (signedKeys.isNotEmpty) {
// post our new keys!
await client.uploadKeySignatures(signedKeys);
final payload = <String, Map<String, Map<String, dynamic>>>{};
for (final key in signedKeys) {
if (key.identifier == null ||
key.signatures == null ||
key.signatures.isEmpty) {
continue;
}
if (!payload.containsKey(key.userId)) {
payload[key.userId] = <String, Map<String, dynamic>>{};
}
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);
}
}

View File

@ -608,7 +608,7 @@ class KeyManager {
Future<void> 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) {

View File

@ -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,

View File

@ -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,

View File

@ -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