Skip to content

Commit 5a5b8af

Browse files
committed
crypto: add logging for withheld data in key bundles
1 parent 547ab31 commit 5a5b8af

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

crates/matrix-sdk-crypto/src/machine/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ impl OlmMachine {
897897
// This function is only ever called by add_room_key via
898898
// handle_decrypted_to_device_event, so sender, sender_key, and algorithm are
899899
// already recorded.
900-
fields(room_id = ? content.room_id, session_id, message_index)
900+
fields(room_id = ? content.room_id, session_id, message_index, shared_history = content.shared_history)
901901
)]
902902
async fn handle_key(
903903
&self,

crates/matrix-sdk-crypto/src/store/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,8 @@ impl Store {
17171717
bundle_info: &StoredRoomKeyBundleData,
17181718
bundle: &RoomKeyBundle,
17191719
) -> Result<(), CryptoStoreError> {
1720+
let mut session_id_to_withheld_code_map = BTreeMap::new();
1721+
17201722
let mut changes = Changes::default();
17211723
for withheld in &bundle.withheld {
17221724
let (room_id, session_id) = match withheld {
@@ -1744,9 +1746,17 @@ impl Store {
17441746
content: withheld.to_owned(),
17451747
},
17461748
);
1749+
session_id_to_withheld_code_map.insert(session_id, withheld.withheld_code());
17471750
}
1751+
17481752
self.save_changes(changes).await?;
17491753

1754+
info!(
1755+
room_id = ?bundle_info.bundle_data.room_id,
1756+
?session_id_to_withheld_code_map,
1757+
"Successfully imported withheld info from room key bundle",
1758+
);
1759+
17501760
Ok(())
17511761
}
17521762
}

0 commit comments

Comments
 (0)