From 77690775a759140ea7b85c71c8291006b34c3c76 Mon Sep 17 00:00:00 2001
From: NoisyCoil <noisycoil@tutanota.com>
Date: Mon, 20 Jan 2025 19:43:37 +0100
Subject: [PATCH] Update zbus to v5

---
 src/blocking/collection.rs | 2 +-
 src/blocking/item.rs       | 2 +-
 src/collection.rs          | 2 +-
 src/item.rs                | 2 +-
 src/proxy/collection.rs    | 2 +-
 src/proxy/item.rs          | 2 +-
 src/proxy/prompt.rs        | 2 +-
 src/proxy/service.rs       | 2 +-
 src/util.rs                | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

--- a/src/blocking/collection.rs
+++ b/src/blocking/collection.rs
@@ -7,8 +7,8 @@
 
 use super::item::Item;
 use crate::error::Error;
-use crate::proxy::collection::CollectionProxyBlocking;
-use crate::proxy::service::ServiceProxyBlocking;
+use crate::proxy::collection::CollectionProxy;
+use crate::proxy::service::ServiceProxy;
 use crate::session::Session;
 use crate::ss::{SS_DBUS_NAME, SS_ITEM_ATTRIBUTES, SS_ITEM_LABEL};
 use crate::util::{exec_prompt_blocking, format_secret, lock_or_unlock_blocking, LockAction};
@@ -16,32 +16,34 @@ use crate::util::{exec_prompt_blocking,
 use std::collections::HashMap;
 use zbus::{
     zvariant::{Dict, ObjectPath, OwnedObjectPath, Value},
-    CacheProperties,
+    proxy::CacheProperties,
 };
 
 // Collection struct.
 // Should always be created from the SecretService entry point,
 // whether through a new collection or a collection search
 pub struct Collection<'a> {
-    conn: zbus::blocking::Connection,
+    conn: zbus::Connection,
     session: &'a Session,
     pub collection_path: OwnedObjectPath,
-    collection_proxy: CollectionProxyBlocking<'a>,
-    service_proxy: &'a ServiceProxyBlocking<'a>,
+    collection_proxy: CollectionProxy<'a>,
+    service_proxy: &'a ServiceProxy<'a>,
 }
 
 impl<'a> Collection<'a> {
     pub(crate) fn new(
-        conn: zbus::blocking::Connection,
+        conn: zbus::Connection,
         session: &'a Session,
-        service_proxy: &'a ServiceProxyBlocking,
+        service_proxy: &'a ServiceProxy<'_>,
         collection_path: OwnedObjectPath,
     ) -> Result<Self, Error> {
-        let collection_proxy = CollectionProxyBlocking::builder(&conn)
-            .destination(SS_DBUS_NAME)?
-            .path(collection_path.clone())?
-            .cache_properties(CacheProperties::No)
-            .build()?;
+        let collection_proxy = zbus::block_on(
+            CollectionProxy::builder(&conn)
+                .destination(SS_DBUS_NAME)
+                .path(collection_path.clone())
+                .cache_properties(CacheProperties::No)
+                .build(),
+        )?;
         Ok(Collection {
             conn,
             session,
@@ -52,7 +54,7 @@ impl<'a> Collection<'a> {
     }
 
     pub fn is_locked(&self) -> Result<bool, Error> {
-        Ok(self.collection_proxy.locked()?)
+        Ok(zbus::block_on(self.collection_proxy.locked())?)
     }
 
     pub fn ensure_unlocked(&self) -> Result<(), Error> {
@@ -85,7 +87,7 @@ impl<'a> Collection<'a> {
     pub fn delete(&self) -> Result<(), Error> {
         // ensure_unlocked handles prompt for unlocking if necessary
         self.ensure_unlocked()?;
-        let prompt_path = self.collection_proxy.delete()?;
+        let prompt_path = zbus::block_on(self.collection_proxy.delete())?;
 
         // "/" means no prompt necessary
         if prompt_path.as_str() != "/" {
@@ -96,7 +98,7 @@ impl<'a> Collection<'a> {
     }
 
     pub fn get_all_items(&self) -> Result<Vec<Item>, Error> {
-        let items = self.collection_proxy.items()?;
+        let items = zbus::block_on(self.collection_proxy.items())?;
 
         // map array of item paths to Item
         let res = items
@@ -115,7 +117,7 @@ impl<'a> Collection<'a> {
     }
 
     pub fn search_items(&self, attributes: HashMap<&str, &str>) -> Result<Vec<Item>, Error> {
-        let items = self.collection_proxy.search_items(attributes)?;
+        let items = zbus::block_on(self.collection_proxy.search_items(attributes))?;
 
         // map array of item paths to Item
         let res = items
@@ -134,11 +136,11 @@ impl<'a> Collection<'a> {
     }
 
     pub fn get_label(&self) -> Result<String, Error> {
-        Ok(self.collection_proxy.label()?)
+        Ok(zbus::block_on(self.collection_proxy.label())?)
     }
 
     pub fn set_label(&self, new_label: &str) -> Result<(), Error> {
-        Ok(self.collection_proxy.set_label(new_label)?)
+        Ok(zbus::block_on(self.collection_proxy.set_label(new_label))?)
     }
 
     pub fn create_item(
@@ -157,9 +159,11 @@ impl<'a> Collection<'a> {
         properties.insert(SS_ITEM_LABEL, label.into());
         properties.insert(SS_ITEM_ATTRIBUTES, attributes.into());
 
-        let created_item = self
-            .collection_proxy
-            .create_item(properties, secret_struct, replace)?;
+        let created_item = zbus::block_on(self.collection_proxy.create_item(
+            properties,
+            secret_struct,
+            replace,
+        ))?;
 
         // This prompt handling is practically identical to create_collection
         let item_path: ObjectPath = {
--- a/src/blocking/item.rs
+++ b/src/blocking/item.rs
@@ -6,36 +6,38 @@
 // copied, modified, or distributed except according to those terms.
 
 use crate::error::Error;
-use crate::proxy::item::ItemProxyBlocking;
-use crate::proxy::service::ServiceProxyBlocking;
+use crate::proxy::item::ItemProxy;
+use crate::proxy::service::ServiceProxy;
 use crate::session::decrypt;
 use crate::session::Session;
 use crate::ss::SS_DBUS_NAME;
 use crate::util::{exec_prompt_blocking, format_secret, lock_or_unlock_blocking, LockAction};
 
 use std::collections::HashMap;
-use zbus::{zvariant::OwnedObjectPath, CacheProperties};
+use zbus::{zvariant::OwnedObjectPath, proxy::CacheProperties};
 
 pub struct Item<'a> {
-    conn: zbus::blocking::Connection,
+    conn: zbus::Connection,
     session: &'a Session,
     pub item_path: OwnedObjectPath,
-    item_proxy: ItemProxyBlocking<'a>,
-    service_proxy: &'a ServiceProxyBlocking<'a>,
+    item_proxy: ItemProxy<'a>,
+    service_proxy: &'a ServiceProxy<'a>,
 }
 
 impl<'a> Item<'a> {
     pub(crate) fn new(
-        conn: zbus::blocking::Connection,
+        conn: zbus::Connection,
         session: &'a Session,
-        service_proxy: &'a ServiceProxyBlocking<'a>,
+        service_proxy: &'a ServiceProxy<'a>,
         item_path: OwnedObjectPath,
     ) -> Result<Self, Error> {
-        let item_proxy = ItemProxyBlocking::builder(&conn)
-            .destination(SS_DBUS_NAME)?
-            .path(item_path.clone())?
-            .cache_properties(CacheProperties::No)
-            .build()?;
+        let item_proxy = zbus::block_on(
+            ItemProxy::builder(&conn)
+                .destination(SS_DBUS_NAME)
+                .path(item_path.clone())
+                .cache_properties(CacheProperties::No)
+                .build(),
+        )?;
         Ok(Item {
             conn,
             session,
@@ -46,7 +48,7 @@ impl<'a> Item<'a> {
     }
 
     pub fn is_locked(&self) -> Result<bool, Error> {
-        Ok(self.item_proxy.locked()?)
+        Ok(zbus::block_on(self.item_proxy.locked())?)
     }
 
     pub fn ensure_unlocked(&self) -> Result<(), Error> {
@@ -76,26 +78,26 @@ impl<'a> Item<'a> {
     }
 
     pub fn get_attributes(&self) -> Result<HashMap<String, String>, Error> {
-        Ok(self.item_proxy.attributes()?)
+        Ok(zbus::block_on(self.item_proxy.attributes())?)
     }
 
     pub fn set_attributes(&self, attributes: HashMap<&str, &str>) -> Result<(), Error> {
-        Ok(self.item_proxy.set_attributes(attributes)?)
+        Ok(zbus::block_on(self.item_proxy.set_attributes(attributes))?)
     }
 
     pub fn get_label(&self) -> Result<String, Error> {
-        Ok(self.item_proxy.label()?)
+        Ok(zbus::block_on(self.item_proxy.label())?)
     }
 
     pub fn set_label(&self, new_label: &str) -> Result<(), Error> {
-        Ok(self.item_proxy.set_label(new_label)?)
+        Ok(zbus::block_on(self.item_proxy.set_label(new_label))?)
     }
 
     /// Deletes dbus object, but struct instance still exists (current implementation)
     pub fn delete(&self) -> Result<(), Error> {
         // ensure_unlocked handles prompt for unlocking if necessary
         self.ensure_unlocked()?;
-        let prompt_path = self.item_proxy.delete()?;
+        let prompt_path = zbus::block_on(self.item_proxy.delete())?;
 
         // "/" means no prompt necessary
         if prompt_path.as_str() != "/" {
@@ -106,7 +108,8 @@ impl<'a> Item<'a> {
     }
 
     pub fn get_secret(&self) -> Result<Vec<u8>, Error> {
-        let secret_struct = self.item_proxy.get_secret(&self.session.object_path)?;
+        let secret_struct =
+            zbus::block_on(self.item_proxy.get_secret(&self.session.object_path))?;
         let secret = secret_struct.value;
 
         if let Some(session_key) = self.session.get_aes_key() {
@@ -123,7 +126,8 @@ impl<'a> Item<'a> {
     }
 
     pub fn get_secret_content_type(&self) -> Result<String, Error> {
-        let secret_struct = self.item_proxy.get_secret(&self.session.object_path)?;
+        let secret_struct =
+            zbus::block_on(self.item_proxy.get_secret(&self.session.object_path))?;
         let content_type = secret_struct.content_type;
 
         Ok(content_type)
@@ -131,15 +135,15 @@ impl<'a> Item<'a> {
 
     pub fn set_secret(&self, secret: &[u8], content_type: &str) -> Result<(), Error> {
         let secret_struct = format_secret(self.session, secret, content_type)?;
-        Ok(self.item_proxy.set_secret(secret_struct)?)
+        Ok(zbus::block_on(self.item_proxy.set_secret(secret_struct))?)
     }
 
     pub fn get_created(&self) -> Result<u64, Error> {
-        Ok(self.item_proxy.created()?)
+        Ok(zbus::block_on(self.item_proxy.created())?)
     }
 
     pub fn get_modified(&self) -> Result<u64, Error> {
-        Ok(self.item_proxy.modified()?)
+        Ok(zbus::block_on(self.item_proxy.modified())?)
     }
 }
 
--- a/src/collection.rs
+++ b/src/collection.rs
@@ -16,7 +16,7 @@ use crate::Item;
 use std::collections::HashMap;
 use zbus::{
     zvariant::{Dict, ObjectPath, OwnedObjectPath, Value},
-    CacheProperties,
+    proxy::CacheProperties,
 };
 
 // Collection struct.
@@ -38,8 +38,8 @@ impl<'a> Collection<'a> {
         collection_path: OwnedObjectPath,
     ) -> Result<Collection<'a>, Error> {
         let collection_proxy = CollectionProxy::builder(&conn)
-            .destination(SS_DBUS_NAME)?
-            .path(collection_path.clone())?
+            .destination(SS_DBUS_NAME)
+            .path(collection_path.clone())
             .cache_properties(CacheProperties::No)
             .build()
             .await?;
--- a/src/item.rs
+++ b/src/item.rs
@@ -14,7 +14,7 @@ use crate::ss::SS_DBUS_NAME;
 use crate::util::{exec_prompt, format_secret, lock_or_unlock, LockAction};
 
 use std::collections::HashMap;
-use zbus::{zvariant::OwnedObjectPath, CacheProperties};
+use zbus::{zvariant::OwnedObjectPath, proxy::CacheProperties};
 
 pub struct Item<'a> {
     conn: zbus::Connection,
@@ -32,8 +32,8 @@ impl<'a> Item<'a> {
         item_path: OwnedObjectPath,
     ) -> Result<Item<'a>, Error> {
         let item_proxy = ItemProxy::builder(&conn)
-            .destination(SS_DBUS_NAME)?
-            .path(item_path.clone())?
+            .destination(SS_DBUS_NAME)
+            .path(item_path.clone())
             .cache_properties(CacheProperties::No)
             .build()
             .await?;
--- a/src/proxy/collection.rs
+++ b/src/proxy/collection.rs
@@ -9,7 +9,7 @@
 
 use serde::{Deserialize, Serialize};
 use std::collections::HashMap;
-use zbus::zvariant::{ObjectPath, OwnedObjectPath, Type, Value};
+use zbus::zvariant::{OwnedObjectPath, Type, Value};
 
 use super::SecretStruct;
 
@@ -22,7 +22,7 @@ use super::SecretStruct;
     interface = "org.freedesktop.Secret.Collection",
     default_service = "org.freedesktop.Secret.Collection"
 )]
-trait Collection {
+pub(crate) trait Collection {
     /// Returns prompt: ObjectPath
     fn delete(&self) -> zbus::Result<OwnedObjectPath>;
 
@@ -36,7 +36,7 @@ trait Collection {
     ) -> zbus::Result<CreateItemResult>;
 
     #[zbus(property)]
-    fn items(&self) -> zbus::fdo::Result<Vec<ObjectPath<'_>>>;
+    fn items(&self) -> zbus::fdo::Result<Vec<OwnedObjectPath>>;
 
     #[zbus(property)]
     fn label(&self) -> zbus::fdo::Result<String>;
--- a/src/proxy/item.rs
+++ b/src/proxy/item.rs
@@ -19,7 +19,7 @@ use super::SecretStruct;
     interface = "org.freedesktop.Secret.Item",
     default_service = "org.freedesktop.Secret.Item"
 )]
-trait Item {
+pub(crate) trait Item {
     fn delete(&self) -> zbus::Result<OwnedObjectPath>;
 
     /// returns `Secret`
--- a/src/proxy/prompt.rs
+++ b/src/proxy/prompt.rs
@@ -18,7 +18,7 @@ use zbus::zvariant::Value;
     interface = "org.freedesktop.Secret.Prompt",
     default_service = "org.freedesktop.Secret.Prompt"
 )]
-trait Prompt {
+pub(crate) trait Prompt {
     fn prompt(&self, window_id: &str) -> zbus::Result<()>;
 
     fn dismiss(&self) -> zbus::Result<()>;
--- a/src/proxy/service.rs
+++ b/src/proxy/service.rs
@@ -22,7 +22,7 @@ use zbus::zvariant::{ObjectPath, OwnedOb
     default_service = "org.freedesktop.secrets",
     default_path = "/org/freedesktop/secrets"
 )]
-trait Service {
+pub(crate) trait Service {
     fn open_session(&self, algorithm: &str, input: Value<'_>) -> zbus::Result<OpenSessionResult>;
 
     fn create_collection(
@@ -47,7 +47,7 @@ trait Service {
     fn set_alias(&self, name: &str, collection: ObjectPath<'_>) -> zbus::Result<()>;
 
     #[zbus(property)]
-    fn collections(&self) -> zbus::fdo::Result<Vec<ObjectPath<'_>>>;
+    fn collections(&self) -> zbus::fdo::Result<Vec<OwnedObjectPath>>;
 }
 
 #[derive(Debug, Serialize, Deserialize, Type)]
--- a/src/util.rs
+++ b/src/util.rs
@@ -11,8 +11,8 @@
 //!   formatting secrets
 
 use crate::error::Error;
-use crate::proxy::prompt::{Completed, PromptProxy, PromptProxyBlocking};
-use crate::proxy::service::{ServiceProxy, ServiceProxyBlocking};
+use crate::proxy::prompt::{Completed, PromptProxy};
+use crate::proxy::service::ServiceProxy;
 use crate::proxy::SecretStruct;
 use crate::session::encrypt;
 use crate::session::Session;
@@ -22,7 +22,7 @@ use rand::{rngs::OsRng, Rng};
 use zbus::export::ordered_stream::OrderedStreamExt;
 use zbus::{
     zvariant::{self, ObjectPath},
-    CacheProperties,
+    proxy::CacheProperties,
 };
 
 // Helper enum for locking
@@ -51,22 +51,17 @@ pub(crate) async fn lock_or_unlock(
 }
 
 pub(crate) fn lock_or_unlock_blocking(
-    conn: zbus::blocking::Connection,
-    service_proxy: &ServiceProxyBlocking,
-    object_path: &ObjectPath,
+    conn: zbus::Connection,
+    service_proxy: &ServiceProxy<'_>,
+    object_path: &ObjectPath<'_>,
     lock_action: LockAction,
 ) -> Result<(), Error> {
-    let objects = vec![object_path];
-
-    let lock_action_res = match lock_action {
-        LockAction::Lock => service_proxy.lock(objects)?,
-        LockAction::Unlock => service_proxy.unlock(objects)?,
-    };
-
-    if lock_action_res.object_paths.is_empty() {
-        exec_prompt_blocking(conn, &lock_action_res.prompt)?;
-    }
-    Ok(())
+    zbus::block_on(lock_or_unlock(
+        conn,
+        service_proxy,
+        object_path,
+        lock_action,
+    ))
 }
 
 pub(crate) fn format_secret(
@@ -115,8 +110,8 @@ pub(crate) async fn exec_prompt(
     prompt: &ObjectPath<'_>,
 ) -> Result<zvariant::OwnedValue, Error> {
     let prompt_proxy = PromptProxy::builder(&conn)
-        .destination(SS_DBUS_NAME)?
-        .path(prompt)?
+        .destination(SS_DBUS_NAME)
+        .path(prompt)
         .cache_properties(CacheProperties::No)
         .build()
         .await?;
@@ -128,19 +123,10 @@ pub(crate) async fn exec_prompt(
 }
 
 pub(crate) fn exec_prompt_blocking(
-    conn: zbus::blocking::Connection,
-    prompt: &ObjectPath,
+    conn: zbus::Connection,
+    prompt: &ObjectPath<'_>,
 ) -> Result<zvariant::OwnedValue, Error> {
-    let prompt_proxy = PromptProxyBlocking::builder(&conn)
-        .destination(SS_DBUS_NAME)?
-        .path(prompt)?
-        .cache_properties(CacheProperties::No)
-        .build()?;
-
-    let mut receive_completed_iter = prompt_proxy.receive_completed()?;
-    prompt_proxy.prompt(NO_WINDOW_ID)?;
-
-    handle_signal(receive_completed_iter.next().unwrap())
+    zbus::block_on(exec_prompt(conn, prompt))
 }
 
 fn handle_signal(signal: Completed) -> Result<zvariant::OwnedValue, Error> {
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -75,8 +75,9 @@ version = "0.10.0"
 optional = true
 
 [dependencies.zbus]
-version = "4"
+version = "6"
 default-features = false
+features = ["proxy"]
 
 [dev-dependencies.test-with]
 version = "0.15"
@@ -98,11 +99,11 @@ crypto-rust = [
     "dep:hkdf",
 ]
 rt-async-io-crypto-openssl = [
-    "zbus/async-io",
+    "zbus/default-rt",
     "crypto-openssl",
 ]
 rt-async-io-crypto-rust = [
-    "zbus/async-io",
+    "zbus/default-rt",
     "crypto-rust",
 ]
 rt-tokio-crypto-openssl = [
--- a/src/blocking/mod.rs
+++ b/src/blocking/mod.rs
@@ -10,17 +10,17 @@
 //! This `SecretService` will block the current thread when making requests to the
 //! secret service server instead of returning futures.
 //!
-//! It is important to not call this these functions in an async context or otherwise the runtime
-//! may stall. See [zbus's blocking documentation] for more details. If you are in an async context,
-//! you should use the [async `SecretService`] instead.
+//! It is important to not call these functions in an async context or otherwise the runtime
+//! may stall. zbus 6 has no blocking connection, so these methods drive the async API with
+//! [`zbus::block_on`]. If you are in an async context, you should use the
+//! [async `SecretService`] instead.
 //!
-//! [zbus's blocking documentation]: https://docs.rs/zbus/latest/zbus/blocking/index.html
 //! [async `SecretService`]: crate::SecretService
 
 use crate::session::Session;
 use crate::ss::SS_COLLECTION_LABEL;
 use crate::util;
-use crate::{proxy::service::ServiceProxyBlocking, util::exec_prompt_blocking};
+use crate::{proxy::service::ServiceProxy, util::exec_prompt_blocking};
 use crate::{EncryptionType, Error, SearchItemsResult};
 use std::collections::HashMap;
 use zbus::zvariant::{ObjectPath, Value};
@@ -38,16 +38,18 @@ pub use item::Item;
 /// and negotiate a new cryptographic session
 /// ([EncryptionType::Plain] or [EncryptionType::Dh])
 pub struct SecretService<'a> {
-    conn: zbus::blocking::Connection,
+    conn: zbus::Connection,
     session: Session,
-    service_proxy: ServiceProxyBlocking<'a>,
+    service_proxy: ServiceProxy<'a>,
 }
 
 impl<'a> SecretService<'a> {
     /// Create a new `SecretService` instance
     pub fn connect(encryption: EncryptionType) -> Result<Self, Error> {
-        let conn = zbus::blocking::Connection::session().map_err(util::handle_conn_error)?;
-        let service_proxy = ServiceProxyBlocking::new(&conn).map_err(util::handle_conn_error)?;
+        let conn =
+            zbus::block_on(zbus::Connection::session()).map_err(util::handle_conn_error)?;
+        let service_proxy =
+            zbus::block_on(ServiceProxy::new(&conn)).map_err(util::handle_conn_error)?;
 
         let session = Session::new_blocking(&service_proxy, encryption)?;
 
@@ -60,7 +62,7 @@ impl<'a> SecretService<'a> {
 
     /// Get all collections
     pub fn get_all_collections(&self) -> Result<Vec<Collection>, Error> {
-        let collections = self.service_proxy.collections()?;
+        let collections = zbus::block_on(self.service_proxy.collections())?;
         collections
             .into_iter()
             .map(|object_path| {
@@ -80,7 +82,7 @@ impl<'a> SecretService<'a> {
     /// is also a specific method for getting the collection
     /// by default alias.
     pub fn get_collection_by_alias(&self, alias: &str) -> Result<Collection, Error> {
-        let object_path = self.service_proxy.read_alias(alias)?;
+        let object_path = zbus::block_on(self.service_proxy.read_alias(alias))?;
 
         if object_path.as_str() == "/" {
             Err(Error::NoResult)
@@ -124,7 +126,8 @@ impl<'a> SecretService<'a> {
         let mut properties: HashMap<&str, Value> = HashMap::new();
         properties.insert(SS_COLLECTION_LABEL, label.into());
 
-        let created_collection = self.service_proxy.create_collection(properties, alias)?;
+        let created_collection =
+            zbus::block_on(self.service_proxy.create_collection(properties, alias))?;
 
         // This prompt handling is practically identical to create_collection
         let collection_path: ObjectPath = {
@@ -157,7 +160,7 @@ impl<'a> SecretService<'a> {
         &self,
         attributes: HashMap<&str, &str>,
     ) -> Result<SearchItemsResult<Item>, Error> {
-        let items = self.service_proxy.search_items(attributes)?;
+        let items = zbus::block_on(self.service_proxy.search_items(attributes))?;
 
         let object_paths_to_items = |items: Vec<_>| {
             items
@@ -182,7 +185,7 @@ impl<'a> SecretService<'a> {
     /// Unlock all items in a batch
     pub fn unlock_all(&self, items: &[&Item<'_>]) -> Result<(), Error> {
         let objects = items.iter().map(|i| &*i.item_path).collect();
-        let lock_action_res = self.service_proxy.unlock(objects)?;
+        let lock_action_res = zbus::block_on(self.service_proxy.unlock(objects))?;
 
         if lock_action_res.object_paths.is_empty() {
             exec_prompt_blocking(self.conn.clone(), &lock_action_res.prompt)?;
--- a/src/error.rs
+++ b/src/error.rs
@@ -6,7 +6,6 @@
 // copied, modified, or distributed except according to those terms.
 
 use std::{error, fmt};
-use zbus::zvariant;
 
 /// An error that could occur interacting with the secret service dbus interface.
 #[derive(Debug)]
@@ -19,7 +18,10 @@ pub enum Error {
     /// A call into a standard dbus interface failed.
     ZbusFdo(zbus::fdo::Error),
     /// Serializing or deserializing a dbus message failed.
-    Zvariant(zvariant::Error),
+    ///
+    /// zbus 6 merged this into [`zbus::Error`]. The variant remains so existing
+    /// matches still compile; new failures use [`Error::Zbus`].
+    Zvariant(zbus::Error),
     /// A secret service interface was locked and can't return any
     /// information about its contents.
     Locked,
@@ -69,9 +71,3 @@ impl From<zbus::fdo::Error> for Error {
         Error::ZbusFdo(err)
     }
 }
-
-impl From<zvariant::Error> for Error {
-    fn from(err: zvariant::Error) -> Error {
-        Error::Zvariant(err)
-    }
-}
--- a/src/session.rs
+++ b/src/session.rs
@@ -17,7 +17,7 @@
 // 7. Format Secret: encode the secret value for the value field in secret struct.
 //      This encoding uses the aes_key from the associated Session.
 
-use crate::proxy::service::{OpenSessionResult, ServiceProxy, ServiceProxyBlocking};
+use crate::proxy::service::{OpenSessionResult, ServiceProxy};
 use crate::ss::{ALGORITHM_DH, ALGORITHM_PLAIN};
 use crate::Error;
 
@@ -164,28 +164,10 @@ impl Session {
     }
 
     pub fn new_blocking(
-        service_proxy: &ServiceProxyBlocking,
+        service_proxy: &ServiceProxy<'_>,
         encryption: EncryptionType,
     ) -> Result<Self, Error> {
-        match encryption {
-            EncryptionType::Plain => {
-                let session = service_proxy.open_session(ALGORITHM_PLAIN, "".into())?;
-                let session_path = session.result;
-
-                Ok(Session {
-                    object_path: session_path,
-                    aes_key: None,
-                })
-            }
-            EncryptionType::Dh => {
-                let keypair = Keypair::generate();
-
-                let session = service_proxy
-                    .open_session(ALGORITHM_DH, keypair.public.to_bytes_be().into())?;
-
-                Self::encrypted_session(&keypair, session)
-            }
-        }
+        zbus::block_on(Self::new(service_proxy, encryption))
     }
 
     pub async fn new(
@@ -315,16 +297,16 @@ mod test {
 
     #[test]
     fn should_create_plain_session() {
-        let conn = zbus::blocking::Connection::session().unwrap();
-        let service_proxy = ServiceProxyBlocking::new(&conn).unwrap();
+        let conn = zbus::block_on(zbus::Connection::session()).unwrap();
+        let service_proxy = zbus::block_on(ServiceProxy::new(&conn)).unwrap();
         let session = Session::new_blocking(&service_proxy, EncryptionType::Plain).unwrap();
         assert!(session.get_aes_key().is_none());
     }
 
     #[test]
     fn should_create_encrypted_session() {
-        let conn = zbus::blocking::Connection::session().unwrap();
-        let service_proxy = ServiceProxyBlocking::new(&conn).unwrap();
+        let conn = zbus::block_on(zbus::Connection::session()).unwrap();
+        let service_proxy = zbus::block_on(ServiceProxy::new(&conn)).unwrap();
         let session = Session::new_blocking(&service_proxy, EncryptionType::Dh).unwrap();
         assert!(session.get_aes_key().is_some());
     }
