FakeMatrixApi constructor
FakeMatrixApi()
Implementation
FakeMatrixApi() {
currentApi = this;
api['POST']?['/client/v3/keys/device_signing/upload'] = (var reqI) {
if (_client != null) {
final jsonBody = decodeJson(reqI);
for (final keyType in {
'master_key',
'self_signing_key',
'user_signing_key',
}) {
if (jsonBody[keyType] != null) {
final key =
sdk.CrossSigningKey.fromJson(jsonBody[keyType], _client!);
_client!.userDeviceKeys[_client!.userID!]?.crossSigningKeys
.removeWhere((k, v) => v.usage.contains(key.usage.first));
_client!.userDeviceKeys[_client!.userID!]
?.crossSigningKeys[key.publicKey!] = key;
}
}
// and generate a fake sync
// ignore: discarded_futures
_client!.handleSync(sdk.SyncUpdate(nextBatch: ''));
}
return {};
};
}