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;
Map<String, dynamic>? decrypted;
try {
decrypted = json.decode(decryption.decrypt(sessionData['ephemeral'],
sessionData['mac'], sessionData['ciphertext']));
decrypted = json.decode(decryption.decrypt(
sessionData['ephemeral'] as String,
sessionData['mac'] as String,
sessionData['ciphertext'] as String));
} catch (e, s) {
Logs().e('[LibOlm] Error decrypting room key', e, s);
}

View File

@ -597,34 +597,36 @@ class OlmManager {
client.userDeviceKeys[userId]!.deviceKeys[deviceId]!.ed25519Key;
final identityKey =
client.userDeviceKeys[userId]!.deviceKeys[deviceId]!.curve25519Key;
for (final Map<String, dynamic> deviceKey
in deviceKeysEntry.value.values) {
if (fingerprintKey == null ||
identityKey == null ||
!deviceKey.checkJsonSignature(fingerprintKey, userId, deviceId)) {
Logs().w(
'Skipping invalid device key from $userId:$deviceId',
deviceKey,
);
continue;
}
Logs().v('[OlmManager] Starting session with $userId:$deviceId');
final session = olm.Session();
try {
session.create_outbound(
_olmAccount!, identityKey, deviceKey['key']);
await storeOlmSession(OlmSession(
key: client.userID!,
identityKey: identityKey,
sessionId: session.session_id(),
session: session,
lastReceived:
DateTime.now(), // we want to use a newly created session
));
} catch (e, s) {
session.free();
Logs()
.e('[LibOlm] Could not create new outbound olm session', e, s);
for (final deviceKey in deviceKeysEntry.value.values) {
if (deviceKey is Map<String, Object?>) {
if (fingerprintKey == null ||
identityKey == null ||
!deviceKey.checkJsonSignature(
fingerprintKey, userId, deviceId)) {
Logs().w(
'Skipping invalid device key from $userId:$deviceId',
deviceKey,
);
continue;
}
Logs().v('[OlmManager] Starting session with $userId:$deviceId');
final session = olm.Session();
try {
session.create_outbound(
_olmAccount!, identityKey, deviceKey['key'] as String);
await storeOlmSession(OlmSession(
key: client.userID!,
identityKey: identityKey,
sessionId: session.session_id(),
session: session,
lastReceived:
DateTime.now(), // we want to use a newly created session
));
} catch (e, s) {
session.free();
Logs().e(
'[LibOlm] Could not create new outbound olm session', e, s);
}
}
}
}