oo7/dbus/mod.rs
1//! A [Secret Service](https://specifications.freedesktop.org/secret-service-spec/latest/index.html) implementation.
2//!
3//! That is usually done with
4//! ```no_run
5//! use oo7::dbus::Service;
6//!
7//! # async fn run() -> oo7::Result<()> {
8//! let service = Service::new().await?;
9//!
10//! let mut attributes = std::collections::HashMap::new();
11//! attributes.insert("type", "password");
12//! attributes.insert("user_id", "some_other_identifier");
13//!
14//! let collection = service.default_collection().await?;
15//! // Store a secret
16//! collection
17//! .create_item("My App's secret", &attributes, "password", true, None)
18//! .await?;
19//!
20//! // Retrieve it later thanks to it attributes
21//! let items = collection.search_items(&attributes).await?;
22//! let item = items.first().unwrap();
23//! assert_eq!(item.secret().await?, oo7::Secret::text("password"));
24//!
25//! # Ok(())
26//! # }
27//! ```
28//!
29//! ## Timeout
30//!
31//! If a DBus method call takes longer than 30 seconds (for example, waiting for
32//! user input on a prompt), the call will fail with a
33//! `zbus::Error::InputOutput(std::io::Error(kind: ErrorKind::TimedOut))`.
34
35/// Barebone DBus API of the Secret Service specifications.
36///
37/// The API is not supposed to be used by the applications in general unless
38/// the wrapper API doesn't provide functionality you need.
39#[cfg(feature = "unstable")]
40#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
41pub mod api;
42
43#[cfg(not(feature = "unstable"))]
44#[allow(unused)]
45mod api;
46
47mod algorithm;
48#[cfg(not(feature = "unstable"))]
49pub(crate) use algorithm::Algorithm;
50#[cfg(feature = "unstable")]
51#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
52pub use algorithm::Algorithm;
53mod item;
54pub use item::Item;
55mod error;
56mod service;
57pub use error::{Error, ServiceError};
58pub use service::Service;
59mod collection;
60pub use collection::Collection;