secret_service/proxy/
collection.rs1use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5use zbus::zvariant::{ObjectPath, OwnedObjectPath, Type, Value};
6
7use super::SecretStruct;
8
9#[zbus::proxy(
15 interface = "org.freedesktop.Secret.Collection",
16 default_service = "org.freedesktop.Secret.Collection"
17)]
18pub trait Collection {
19 fn delete(&self) -> zbus::Result<OwnedObjectPath>;
21
22 fn search_items(&self, attributes: HashMap<&str, &str>) -> zbus::Result<Vec<OwnedObjectPath>>;
23
24 fn create_item(
25 &self,
26 properties: HashMap<&str, Value<'_>>,
27 secret: SecretStruct,
28 replace: bool,
29 ) -> zbus::Result<CreateItemResult>;
30
31 #[zbus(property)]
32 fn items(&self) -> zbus::fdo::Result<Vec<ObjectPath<'_>>>;
33
34 #[zbus(property)]
35 fn label(&self) -> zbus::fdo::Result<String>;
36
37 #[zbus(property)]
38 fn set_label(&self, new_label: &str) -> zbus::fdo::Result<()>;
39
40 #[zbus(property)]
41 fn locked(&self) -> zbus::fdo::Result<bool>;
42
43 #[zbus(property)]
44 fn created(&self) -> zbus::fdo::Result<u64>;
45
46 #[zbus(property)]
47 fn modified(&self) -> zbus::fdo::Result<u64>;
48}
49
50#[derive(Debug, Serialize, Deserialize, Type)]
51pub struct CreateItemResult {
52 pub(crate) item: OwnedObjectPath,
53 pub(crate) prompt: OwnedObjectPath,
54}