Skip to content

Commit ae7f0fe

Browse files
authored
feat: Experimental encrypted state feature flag with CI support (#5537)
This PR makes some non-domain-specific changes across multiple crates that are required for proper testing of features implemented for #5397. * Adds a `experimental-encrypted-state-events` feature flag across the SDK. * Introduces a feature set into xtask to ensure feature-gated tests are run during CI. * Minor fix to a test that would otherwise fail with the newly introduced CI.
1 parent d9f4e7c commit ae7f0fe

File tree

8 files changed

+38
-1
lines changed

8 files changed

+38
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- no-sqlite
3535
- no-encryption-and-sqlite
3636
- sqlite-cryptostore
37+
- experimental-encrypted-state-events
3738
- rustls-tls
3839
- markdown
3940
- socks

crates/matrix-sdk-base/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ automatic-room-key-forwarding = [
3131
experimental-send-custom-to-device = [
3232
"matrix-sdk-crypto?/experimental-send-custom-to-device",
3333
]
34+
35+
# Enable experimental support for encrypting state events; see
36+
# https://github.com/matrix-org/matrix-rust-sdk/issues/5397.
37+
experimental-encrypted-state-events = [
38+
"e2e-encryption",
39+
"ruma/unstable-msc3414",
40+
"matrix-sdk-crypto?/experimental-encrypted-state-events"
41+
]
42+
3443
uniffi = ["dep:uniffi", "matrix-sdk-crypto?/uniffi", "matrix-sdk-common/uniffi"]
3544

3645
# Private feature, see

crates/matrix-sdk-common/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ uniffi = ["dep:uniffi"]
2424
# details.
2525
test-send-sync = []
2626

27+
# Enable experimental support for encrypting state events; see
28+
# https://github.com/matrix-org/matrix-rust-sdk/issues/5397.
29+
experimental-encrypted-state-events = []
30+
2731
[dependencies]
2832
eyeball-im.workspace = true
2933
futures-core.workspace = true

crates/matrix-sdk-crypto/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ experimental-send-custom-to-device = []
2121

2222
# Enable experimental support for encrypting state events; see
2323
# https://github.com/matrix-org/matrix-rust-sdk/issues/5397.
24-
experimental-encrypted-state-events = []
24+
experimental-encrypted-state-events = [
25+
"matrix-sdk-common/experimental-encrypted-state-events"
26+
]
2527

2628
js = ["ruma/js", "vodozemac/js", "matrix-sdk-common/js"]
2729
qrcode = ["dep:matrix-sdk-qrcode"]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,8 @@ macro_rules! cryptostore_integration_tests {
11631163
let room_1 = room_id!("!test_1:localhost");
11641164
let settings_1 = RoomSettings {
11651165
algorithm: EventEncryptionAlgorithm::MegolmV1AesSha2,
1166+
#[cfg(feature = "experimental-encrypted-state-events")]
1167+
encrypt_state_events: false,
11661168
only_allow_trusted_devices: true,
11671169
session_rotation_period: Some(Duration::from_secs(10)),
11681170
session_rotation_period_messages: Some(123),

crates/matrix-sdk-sqlite/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ crypto-store = ["dep:matrix-sdk-crypto"]
1919
event-cache = ["dep:matrix-sdk-base"]
2020
state-store = ["dep:matrix-sdk-base"]
2121

22+
experimental-encrypted-state-events = [
23+
"matrix-sdk-crypto?/experimental-encrypted-state-events"
24+
]
25+
2226
[dependencies]
2327
as_variant.workspace = true
2428
async-trait.workspace = true

crates/matrix-sdk/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ indexeddb = ["matrix-sdk-indexeddb/state-store"]
4646
qrcode = ["e2e-encryption", "matrix-sdk-base/qrcode"]
4747
automatic-room-key-forwarding = ["e2e-encryption", "matrix-sdk-base/automatic-room-key-forwarding"]
4848
experimental-send-custom-to-device = ["e2e-encryption", "matrix-sdk-base/experimental-send-custom-to-device"]
49+
50+
# Enable experimental support for encrypting state events; see
51+
# https://github.com/matrix-org/matrix-rust-sdk/issues/5397.
52+
experimental-encrypted-state-events = [
53+
"e2e-encryption",
54+
"matrix-sdk-base/experimental-encrypted-state-events",
55+
"matrix-sdk-sqlite/experimental-encrypted-state-events"
56+
]
57+
4958
markdown = ["ruma/markdown"]
5059
native-tls = ["reqwest/native-tls"]
5160
rustls-tls = ["reqwest/rustls-tls"]

xtask/src/ci.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ enum FeatureSet {
100100
NoSqlite,
101101
NoEncryptionAndSqlite,
102102
SqliteCryptostore,
103+
ExperimentalEncryptedStateEvents,
103104
RustlsTls,
104105
Markdown,
105106
Socks,
@@ -262,6 +263,10 @@ fn run_feature_tests(cmd: Option<FeatureSet>) -> Result<()> {
262263
FeatureSet::SqliteCryptostore,
263264
"--no-default-features --features e2e-encryption,sqlite,native-tls,testing",
264265
),
266+
(
267+
FeatureSet::ExperimentalEncryptedStateEvents,
268+
"--no-default-features --features experimental-encrypted-state-events,e2e-encryption,sqlite,native-tls,testing",
269+
),
265270
(FeatureSet::RustlsTls, "--no-default-features --features rustls-tls,testing"),
266271
(FeatureSet::Markdown, "--features markdown,testing"),
267272
(FeatureSet::Socks, "--features socks,testing"),
@@ -313,6 +318,7 @@ fn run_crypto_tests() -> Result<()> {
313318
"rustup run stable cargo test --doc -p matrix-sdk-crypto --features=experimental-algorithms,testing"
314319
)
315320
.run()?;
321+
cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk-crypto --features=experimental-encrypted-state-events").run()?;
316322

317323
cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk-crypto-ffi").run()?;
318324

0 commit comments

Comments
 (0)