From 3ff958de4ec219e7d46f676dcee3123fff42bdba Mon Sep 17 00:00:00 2001 From: Sorunome Date: Tue, 29 Dec 2020 14:37:09 +0100 Subject: [PATCH] fix: properly handle changed cross-signing keys --- lib/src/client.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/client.dart b/lib/src/client.dart index 06f710af..14dad06d 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1508,6 +1508,11 @@ sort order of ${prevState.sortOrder}. This should never happen...'''); if (!oldEntry.value.usage.contains(keyType)) { _userDeviceKeys[userId].crossSigningKeys[oldEntry.key] = oldEntry.value; + } else if (database != null) { + // There is a previous cross-signing key with this usage, that we no + // longer need/use. Clear it from the database. + dbActions.add(() => database.removeUserCrossSigningKey( + id, userId, oldEntry.key)); } } final entry = CrossSigningKey.fromMatrixCrossSigningKey(