From 3d6c4936803757d4d524767945b00fcdd4259db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Mon, 13 Mar 2023 17:41:39 +0100 Subject: [PATCH] chore: Update matrix-sdk and ruma --- Cargo.lock | 49 ++++++++++++++------------------ Cargo.toml | 8 ++++-- src/session/room/mod.rs | 16 ++--------- src/session/room_creation/mod.rs | 23 +++------------ 4 files changed, 32 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5d8c48f..400ae3db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1026,14 +1026,12 @@ dependencies = [ [[package]] name = "eyeball" -version = "0.1.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3609348664c9c1b07d9ff3933a466beaa4d197fb393b5d41ffda349458867626" +checksum = "3c7be1d67275032c662cadf525a79aef6909469579c5d81c69c148f7257257af" dependencies = [ "futures-core", "readlock", - "tokio", - "tokio-stream", ] [[package]] @@ -2679,7 +2677,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.6.2" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "anymap2", "async-once-cell", @@ -2724,7 +2722,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.6.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "async-stream", "async-trait", @@ -2747,7 +2745,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.6.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "async-lock", "futures-core", @@ -2764,7 +2762,7 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.6.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "aes", "async-trait", @@ -2779,10 +2777,12 @@ dependencies = [ "futures-core", "futures-util", "hmac", + "itertools", "matrix-sdk-common", "matrix-sdk-qrcode", "pbkdf2", "rand 0.8.5", + "rmp-serde", "ruma", "serde", "serde_json", @@ -2797,7 +2797,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "anyhow", "async-trait", @@ -2822,7 +2822,7 @@ dependencies = [ [[package]] name = "matrix-sdk-qrcode" version = "0.4.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "base64 0.21.0", "byteorder", @@ -2835,7 +2835,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sled" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "async-stream", "async-trait", @@ -2859,7 +2859,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.2.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=2f974c11f775a4e940e5765893f2585f801b5c00#2f974c11f775a4e940e5765893f2585f801b5c00" +source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a8204987be9a2696be183c3954a8569fa2141661#a8204987be9a2696be183c3954a8569fa2141661" dependencies = [ "blake3", "chacha20poly1305", @@ -3866,9 +3866,9 @@ dependencies = [ [[package]] name = "readlock" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13315927ce42fd86abcad193525f68b60a8132804329179dca3c731c0f3b0956" +checksum = "35c8a22130504d1f661d1bc373b424f2d45910fa5319132d903a4074e1527b2e" [[package]] name = "redox_syscall" @@ -3981,8 +3981,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6429e3fae5d6ab07742bcf9a1705f68f97d082801cc5afe9290579bf7abcf053" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "assign", "js_int", @@ -3996,8 +3995,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b35700529224d167697ce575c71ca26c489af5774756843e335af767f6fdf" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "assign", "bytes", @@ -4014,8 +4012,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3b4ec3f70ea9afeae96a6c1e5eb86ed02760d5c28a167b5d9a433cefaaf815c" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "base64 0.21.0", "bytes", @@ -4048,8 +4045,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d05ebbed580138816c3d564f9191e576acf96441e1faca9dcefe7092db6979" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "js_int", "ruma-common", @@ -4060,8 +4056,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebefdab34311af44d07cd2cd91c36cfe6a8c770647c6b00f6ab47f1186b2bb72" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "js_int", "thiserror", @@ -4070,8 +4065,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e883799456b6213da90fe065d4234f282b89afe161af3e5fcc854e44e8f582" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "once_cell", "proc-macro-crate", @@ -4086,8 +4080,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02fac59c8be44a129213394269d7c72cc9adef1f2ce16dc16ebbe4b3dc7bb78" +source = "git+https://github.com/ruma/ruma.git?rev=8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5#8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" dependencies = [ "js_int", "ruma-common", diff --git a/Cargo.toml b/Cargo.toml index b94188dd..d606327d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ features = ["v4_6"] [dependencies.matrix-sdk] git = "https://github.com/matrix-org/matrix-rust-sdk.git" -rev = "2f974c11f775a4e940e5765893f2585f801b5c00" +rev = "a8204987be9a2696be183c3954a8569fa2141661" features = [ "socks", "sso-login", @@ -87,11 +87,13 @@ features = [ [dependencies.matrix-sdk-sled] git = "https://github.com/matrix-org/matrix-rust-sdk.git" -rev = "2f974c11f775a4e940e5765893f2585f801b5c00" +rev = "a8204987be9a2696be183c3954a8569fa2141661" features = ["crypto-store"] [dependencies.ruma] -version = "0.8.2" +# version = "0.8.2" +git = "https://github.com/ruma/ruma.git" +rev = "8eea3e05490fa9a318f9ed66c3a75272e6ef0ee5" features = ["unstable-unspecified", "client-api-c", "unstable-sanitize"] [dependencies.shumate] diff --git a/src/session/room/mod.rs b/src/session/room/mod.rs index aacb6576..a4f10a1c 100644 --- a/src/session/room/mod.rs +++ b/src/session/room/mod.rs @@ -215,20 +215,8 @@ mod imp { "notification-count" => obj.notification_count().to_value(), "latest-unread" => obj.latest_unread().to_value(), "latest-read" => obj.latest_read().to_value(), - "predecessor" => obj.predecessor().map_or_else( - || { - let none: Option<&str> = None; - none.to_value() - }, - |id| id.as_ref().to_value(), - ), - "successor" => obj.successor().map_or_else( - || { - let none: Option<&str> = None; - none.to_value() - }, - |id| id.as_ref().to_value(), - ), + "predecessor" => obj.predecessor().map(|id| id.as_str()).to_value(), + "successor" => obj.successor().map(|id| id.as_str()).to_value(), "verification" => obj.verification().to_value(), "encrypted" => obj.is_encrypted().to_value(), "typing-list" => obj.typing_list().to_value(), diff --git a/src/session/room_creation/mod.rs b/src/session/room_creation/mod.rs index 179192c3..c24d1968 100644 --- a/src/session/room_creation/mod.rs +++ b/src/session/room_creation/mod.rs @@ -15,11 +15,7 @@ use matrix_sdk::{ }, HttpError, RumaApiError, }; -use ruma::{ - events::{room::encryption::RoomEncryptionEventContent, EmptyStateKey, InitialStateEvent}, - serde::Raw, - uint, EventEncryptionAlgorithm, -}; +use ruma::events::{room::encryption::RoomEncryptionEventContent, InitialStateEvent}; use crate::{ components::SpinnerButton, @@ -191,20 +187,9 @@ impl RoomCreation { request.visibility = Visibility::Private; if imp.encryption.is_active() { - let content = assign!( - RoomEncryptionEventContent::new(EventEncryptionAlgorithm::MegolmV1AesSha2), - { - // Values from the recommended defaults of the spec. - rotation_period_ms: Some(uint!(604800000)), - rotation_period_msgs: Some(uint!(100)), - } - ); - let event = InitialStateEvent { - content, - state_key: EmptyStateKey, - }; - let raw_event = Raw::new(&event).unwrap().cast(); - request.initial_state = vec![raw_event]; + let event = + InitialStateEvent::new(RoomEncryptionEventContent::with_recommended_defaults()); + request.initial_state = vec![event.to_raw_any()]; } } else { // The room is public.