-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdbus.rs
More file actions
43 lines (35 loc) · 1.54 KB
/
dbus.rs
File metadata and controls
43 lines (35 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use async_std::channel::Sender;
use credentialsd_common::server::{BackgroundEvent, Device, RequestId, ViewRequest};
use zbus::{fdo, interface, proxy};
#[proxy(
gen_blocking = false,
interface = "xyz.iinuwa.credentialsd.FlowControl1",
default_path = "/xyz/iinuwa/credentialsd/FlowControl",
default_service = "xyz.iinuwa.credentialsd.FlowControl"
)]
pub trait FlowControlService {
async fn initiate_event_stream(&self) -> fdo::Result<()>;
async fn get_available_public_key_devices(&self) -> fdo::Result<Vec<Device>>;
async fn get_hybrid_credential(&self) -> fdo::Result<()>;
async fn get_usb_credential(&self) -> fdo::Result<()>;
async fn select_device(&self, device_id: String) -> fdo::Result<()>;
async fn enter_client_pin(&self, pin: String) -> fdo::Result<()>;
async fn select_credential(&self, credential_id: String) -> fdo::Result<()>;
async fn cancel_request(&self, request_id: RequestId) -> fdo::Result<()>;
#[zbus(signal)]
async fn state_changed(update: BackgroundEvent) -> zbus::Result<()>;
}
pub struct UiControlService {
pub request_tx: Sender<ViewRequest>,
}
/// These methods are called by the credential service to control the UI.
#[interface(name = "xyz.iinuwa.credentialsd.UiControl1")]
impl UiControlService {
async fn launch_ui(&self, request: ViewRequest) -> fdo::Result<()> {
tracing::debug!("Received UI launch request");
self.request_tx
.send(request)
.await
.map_err(|_| fdo::Error::Failed("UI failed to launch".to_string()))
}
}