Skip to content

Commit 70f6680

Browse files
committed
crypto: use new withheldcode when we encounter unshareable sessions
1 parent 03693ae commit 70f6680

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

crates/matrix-sdk-crypto/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ All notable changes to this project will be documented in this file.
88

99
### Features
1010

11+
- Use new withheld code in key bundles for sessions not marked as
12+
`shared_history`.
13+
([#5807](https://github.com/matrix-org/matrix-rust-sdk/pull/5807)
1114
- Improve feedback support for shared history when downloading room key bundles.
1215
([#5737](https://github.com/matrix-org/matrix-rust-sdk/pull/5737))
1316
- Add `RoomKeyWithheldEntry` enum, wrapping either a received to-device `m.room_key.withheld` event or

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ impl Store {
16001600
} else {
16011601
bundle.withheld.push(RoomKeyWithheldContent::new(
16021602
session.algorithm().to_owned(),
1603-
WithheldCode::Unauthorised,
1603+
WithheldCode::HistoryNotShared,
16041604
session.room_id().to_owned(),
16051605
session.session_id().to_owned(),
16061606
session.sender_key().to_owned(),
@@ -2154,11 +2154,11 @@ mod tests {
21542154
RoomKeyWithheldEntry {
21552155
#[cfg(not(feature = "experimental-algorithms"))]
21562156
content: RoomKeyWithheldContent::MegolmV1AesSha2(
2157-
MegolmV1AesSha2WithheldContent::Unauthorised(_)
2157+
MegolmV1AesSha2WithheldContent::HistoryNotShared(_)
21582158
),
21592159
#[cfg(feature = "experimental-algorithms")]
21602160
content: RoomKeyWithheldContent::MegolmV2AesSha2(
2161-
MegolmV1AesSha2WithheldContent::Unauthorised(_)
2161+
MegolmV1AesSha2WithheldContent::HistoryNotShared(_)
21622162
),
21632163
..
21642164
}

crates/matrix-sdk-crypto/src/store/snapshots/matrix_sdk_crypto__store__tests__build_room_key_bundle.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ expression: bundle
2828
"withheld": [
2929
{
3030
"algorithm": "[algorithm]",
31-
"code": "m.unauthorised",
31+
"code": "io.element.msc4268.history_not_shared",
3232
"from_device": "BOB",
33-
"reason": "You are not authorised to read the message.",
33+
"reason": "The sender disabled sharing encrypted history.",
3434
"room_id": "!room1:localhost",
3535
"sender_key": "[alice curve key]",
3636
"session_id": "lpRzTgD3Nook/Wk62Fm9ECWGnKYZgeCwO1Y+uuPJz/I"

0 commit comments

Comments
 (0)