refactor: Added type casts for refactored dart_openapi_codegen

This commit is contained in:
Malin Errenst 2023-06-07 17:38:29 +02:00
parent ec84af679e
commit 17df38b874
No known key found for this signature in database
2 changed files with 34 additions and 30 deletions

View File

@ -640,8 +640,10 @@ class KeyManager {
final sessionData = session.sessionData; final sessionData = session.sessionData;
Map<String, dynamic>? decrypted; Map<String, dynamic>? decrypted;
try { try {
decrypted = json.decode(decryption.decrypt(sessionData['ephemeral'], decrypted = json.decode(decryption.decrypt(
sessionData['mac'], sessionData['ciphertext'])); sessionData['ephemeral'] as String,
sessionData['mac'] as String,
sessionData['ciphertext'] as String));
} catch (e, s) { } catch (e, s) {
Logs().e('[LibOlm] Error decrypting room key', e, s); Logs().e('[LibOlm] Error decrypting room key', e, s);
} }

View File

@ -597,11 +597,12 @@ class OlmManager {
client.userDeviceKeys[userId]!.deviceKeys[deviceId]!.ed25519Key; client.userDeviceKeys[userId]!.deviceKeys[deviceId]!.ed25519Key;
final identityKey = final identityKey =
client.userDeviceKeys[userId]!.deviceKeys[deviceId]!.curve25519Key; client.userDeviceKeys[userId]!.deviceKeys[deviceId]!.curve25519Key;
for (final Map<String, dynamic> deviceKey for (final deviceKey in deviceKeysEntry.value.values) {
in deviceKeysEntry.value.values) { if (deviceKey is Map<String, Object?>) {
if (fingerprintKey == null || if (fingerprintKey == null ||
identityKey == null || identityKey == null ||
!deviceKey.checkJsonSignature(fingerprintKey, userId, deviceId)) { !deviceKey.checkJsonSignature(
fingerprintKey, userId, deviceId)) {
Logs().w( Logs().w(
'Skipping invalid device key from $userId:$deviceId', 'Skipping invalid device key from $userId:$deviceId',
deviceKey, deviceKey,
@ -612,7 +613,7 @@ class OlmManager {
final session = olm.Session(); final session = olm.Session();
try { try {
session.create_outbound( session.create_outbound(
_olmAccount!, identityKey, deviceKey['key']); _olmAccount!, identityKey, deviceKey['key'] as String);
await storeOlmSession(OlmSession( await storeOlmSession(OlmSession(
key: client.userID!, key: client.userID!,
identityKey: identityKey, identityKey: identityKey,
@ -623,8 +624,9 @@ class OlmManager {
)); ));
} catch (e, s) { } catch (e, s) {
session.free(); session.free();
Logs() Logs().e(
.e('[LibOlm] Could not create new outbound olm session', e, s); '[LibOlm] Could not create new outbound olm session', e, s);
}
} }
} }
} }