From 7d7c75ee5cfb452fc1d92f08ed4355d991fad9c7 Mon Sep 17 00:00:00 2001 From: Olli Helenius Date: Fri, 10 May 2024 13:18:48 +0300 Subject: [PATCH] Update zbus to v4 --- .github/workflows/ci.yaml | 5 +---- Cargo.toml | 4 ++-- src/proxy/collection.rs | 19 ++++++++----------- src/proxy/item.rs | 21 +++++++++------------ src/proxy/prompt.rs | 6 +++--- src/proxy/service.rs | 9 +++------ src/util.rs | 2 +- 7 files changed, 27 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b9f1587..09de8e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -117,7 +117,7 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: "1.64.0" + toolchain: "1.75.0" components: clippy - uses: actions/cache@v4 @@ -129,11 +129,8 @@ jobs: key: $clippy-cache-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - name: Generate lockfile - # XXX: Downgrade various dependencies to make them or their sub-dependencies MSRV compatible. run: | cargo generate-lockfile - cargo update -p proc-macro-crate --precise "1.3.0" - cargo update -p regex --precise "1.9.6" - name: Clippy MSRV run: cargo clippy --features=rt-tokio-crypto-rust --all-targets --all -- -D clippy::dbg_macro -D warnings -F unused_must_use diff --git a/Cargo.toml b/Cargo.toml index 8336d68..a42c073 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ name = "secret-service" repository = "https://github.com/hwchen/secret-service-rs.git" edition = "2021" version = "3.1.0" -rust-version = "1.64.0" +rust-version = "1.75.0" # The async runtime features mirror those of `zbus` for compatibility. [features] @@ -33,7 +33,7 @@ num = "0.4.0" rand = "0.8.1" serde = { version = "1.0.103", features = ["derive"] } sha2 = { version = "0.10.0", optional = true } -zbus = { version = "3.7", default-features = false } +zbus = { version = "4", default-features = false } openssl = { version = "^0.10.40", optional = true } [dev-dependencies] diff --git a/src/proxy/collection.rs b/src/proxy/collection.rs index c25b395..280a9a2 100644 --- a/src/proxy/collection.rs +++ b/src/proxy/collection.rs @@ -9,10 +9,7 @@ use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use zbus::{ - dbus_proxy, - zvariant::{ObjectPath, OwnedObjectPath, Type, Value}, -}; +use zbus::zvariant::{ObjectPath, OwnedObjectPath, Type, Value}; use super::SecretStruct; @@ -21,7 +18,7 @@ use super::SecretStruct; /// This will derive CollectionProxy /// /// Note that `Value` in the method signatures corresponds to `VARIANT` dbus type. -#[dbus_proxy( +#[zbus::proxy( interface = "org.freedesktop.Secret.Collection", default_service = "org.freedesktop.Secret.Collection" )] @@ -38,22 +35,22 @@ trait Collection { replace: bool, ) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn items(&self) -> zbus::fdo::Result>>; - #[dbus_proxy(property)] + #[zbus(property)] fn label(&self) -> zbus::fdo::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_label(&self, new_label: &str) -> zbus::fdo::Result<()>; - #[dbus_proxy(property)] + #[zbus(property)] fn locked(&self) -> zbus::fdo::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn created(&self) -> zbus::fdo::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn modified(&self) -> zbus::fdo::Result; } diff --git a/src/proxy/item.rs b/src/proxy/item.rs index d014653..ecc57a9 100644 --- a/src/proxy/item.rs +++ b/src/proxy/item.rs @@ -8,17 +8,14 @@ //! A dbus proxy for speaking with secret service's `Item` Interface. use std::collections::HashMap; -use zbus::{ - dbus_proxy, - zvariant::{ObjectPath, OwnedObjectPath}, -}; +use zbus::zvariant::{ObjectPath, OwnedObjectPath}; use super::SecretStruct; /// A dbus proxy for speaking with secret service's `Item` Interface. /// /// This will derive ItemProxy -#[dbus_proxy( +#[zbus::proxy( interface = "org.freedesktop.Secret.Item", default_service = "org.freedesktop.Secret.Item" )] @@ -30,24 +27,24 @@ trait Item { fn set_secret(&self, secret: SecretStruct) -> zbus::Result<()>; - #[dbus_proxy(property)] + #[zbus(property)] fn locked(&self) -> zbus::fdo::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn attributes(&self) -> zbus::fdo::Result>; - #[dbus_proxy(property)] + #[zbus(property)] fn set_attributes(&self, attributes: HashMap<&str, &str>) -> zbus::fdo::Result<()>; - #[dbus_proxy(property)] + #[zbus(property)] fn label(&self) -> zbus::fdo::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_label(&self, new_label: &str) -> zbus::fdo::Result<()>; - #[dbus_proxy(property)] + #[zbus(property)] fn created(&self) -> zbus::fdo::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn modified(&self) -> zbus::fdo::Result; } diff --git a/src/proxy/prompt.rs b/src/proxy/prompt.rs index c0a306a..2d8db5a 100644 --- a/src/proxy/prompt.rs +++ b/src/proxy/prompt.rs @@ -7,14 +7,14 @@ //! A dbus proxy for speaking with secret service's `Prompt` Interface. -use zbus::{dbus_proxy, zvariant::Value}; +use zbus::zvariant::Value; /// A dbus proxy for speaking with secret service's `Prompt` Interface. /// /// This will derive PromptProxy /// /// Note that `Value` in the method signatures corresponds to `VARIANT` dbus type. -#[dbus_proxy( +#[zbus::proxy( interface = "org.freedesktop.Secret.Prompt", default_service = "org.freedesktop.Secret.Prompt" )] @@ -23,6 +23,6 @@ trait Prompt { fn dismiss(&self) -> zbus::Result<()>; - #[dbus_proxy(signal)] + #[zbus(signal)] fn completed(&self, dismissed: bool, result: Value<'_>) -> zbus::Result<()>; } diff --git a/src/proxy/service.rs b/src/proxy/service.rs index 6697b17..8347da4 100644 --- a/src/proxy/service.rs +++ b/src/proxy/service.rs @@ -10,17 +10,14 @@ use super::SecretStruct; use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use zbus::{ - dbus_proxy, - zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}, -}; +use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}; /// A dbus proxy for speaking with secret service's `Service` Interface. /// /// This will derive ServiceProxy /// /// Note that `Value` in the method signatures corresponds to `VARIANT` dbus type. -#[dbus_proxy( +#[zbus::proxy( interface = "org.freedesktop.Secret.Service", default_service = "org.freedesktop.secrets", default_path = "/org/freedesktop/secrets" @@ -49,7 +46,7 @@ trait Service { fn set_alias(&self, name: &str, collection: ObjectPath<'_>) -> zbus::Result<()>; - #[dbus_proxy(property)] + #[zbus(property)] fn collections(&self) -> zbus::fdo::Result>>; } diff --git a/src/util.rs b/src/util.rs index bd4461f..1a3d982 100644 --- a/src/util.rs +++ b/src/util.rs @@ -148,7 +148,7 @@ fn handle_signal(signal: Completed) -> Result { if args.dismissed { Err(Error::Prompt) } else { - Ok(args.result.into()) + zvariant::OwnedValue::try_from(args.result).map_err(From::from) } }