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) { if (signedKeys.isNotEmpty) {
// post our new keys! // 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 { Future<void> loadSingleKey(String roomId, String sessionId) async {
final info = await getRoomKeysBackupInfo(); final info = await getRoomKeysBackupInfo();
final ret = final ret =
await client.getRoomKeysSingleKey(roomId, sessionId, info.version); await client.getRoomKeysBySessionId(roomId, sessionId, info.version);
final keys = RoomKeys.fromJson({ final keys = RoomKeys.fromJson({
'rooms': { 'rooms': {
roomId: { roomId: {
@ -746,7 +746,7 @@ class KeyManager {
_generateUploadKeys, args); _generateUploadKeys, args);
Logs().i('[Key Manager] Uploading ${dbSessions.length} room keys...'); Logs().i('[Key Manager] Uploading ${dbSessions.length} room keys...');
// upload the payload... // upload the payload...
await client.postRoomKeysKey(info.version, roomKeys); await client.putRoomKeys(info.version, roomKeys);
// and now finally mark all the keys as uploaded // 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 // 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) { for (final dbSession in dbSessions) {

View File

@ -463,7 +463,7 @@ class Bootstrap {
state = BootstrapState.loading; state = BootstrapState.loading;
Logs().v('Upload device signing keys.'); Logs().v('Upload device signing keys.');
await client.uiaRequestBackground( await client.uiaRequestBackground(
(AuthenticationData auth) => client.uploadDeviceSigningKeys( (AuthenticationData auth) => client.uploadCrossSigningKeys(
masterKey: masterKey, masterKey: masterKey,
selfSigningKey: selfSigningKey, selfSigningKey: selfSigningKey,
userSigningKey: userSigningKey, userSigningKey: userSigningKey,

View File

@ -1364,7 +1364,7 @@ class Room {
try { try {
Logs().v( Logs().v(
'Request missing user $mxID in room $displayname from the server...'); 'Request missing user $mxID in room $displayname from the server...');
resp = await client.requestStateContent( resp = await client.getRoomStateWithKey(
id, id,
EventTypes.RoomMember, EventTypes.RoomMember,
mxID, mxID,

View File

@ -16,8 +16,7 @@ dependencies:
crypto: ^3.0.0 crypto: ^3.0.0
base58check: ^2.0.0 base58check: ^2.0.0
olm: ^2.0.0 olm: ^2.0.0
# 0.4.3 had accidental API changes matrix_api_lite: ^0.4.3
matrix_api_lite: 0.4.2
hive: ^2.0.4 hive: ^2.0.4
ffi: ^1.0.0 ffi: ^1.0.0
js: ^0.6.3 js: ^0.6.3