From f39938d17d189d31e34b6bf84259c967c1814dbd Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 23 Oct 2020 13:51:29 +0200 Subject: [PATCH] Fix / device check was not reading up to date trust --- .../sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt index e3ac387ddc..f28fe7d642 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt @@ -152,7 +152,11 @@ internal class UpdateTrustWorker(context: Context, ?.devices val trustMap = devicesEntities?.map { device -> - device to crossSigningService.checkDeviceTrust(myCrossSigningInfo, otherInfos[it], CryptoMapper.mapToModel(device)) + // get up to date from DB has could have been updated + val otherInfo = realm.where(CrossSigningInfoEntity::class.java) + .equalTo(CrossSigningInfoEntityFields.USER_ID, it) + .findFirst()?.let { mapCrossSigningInfoEntity(it) } + device to crossSigningService.checkDeviceTrust(myCrossSigningInfo, otherInfo, CryptoMapper.mapToModel(device)) }?.toMap() // Update trust if needed