From 6f60fda990ddd7d60a2d49e7110b86e5b111891a Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Fri, 23 Jan 2026 23:06:35 -0600 Subject: [PATCH 1/2] Make app name optional --- credentialsd-common/src/model.rs | 6 +++--- credentialsd-ui/src/gui/view_model/mod.rs | 26 ++++++++++++++--------- credentialsd/src/dbus/gateway.rs | 8 +++---- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/credentialsd-common/src/model.rs b/credentialsd-common/src/model.rs index d750fcb..062de21 100644 --- a/credentialsd-common/src/model.rs +++ b/credentialsd-common/src/model.rs @@ -1,7 +1,7 @@ use std::fmt::Display; use serde::{Deserialize, Serialize}; -use zvariant::{SerializeDict, Type}; +use zvariant::{Optional, SerializeDict, Type}; #[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct Credential { @@ -98,8 +98,8 @@ impl Transport { #[derive(Debug, Default, Clone, Serialize, Deserialize, Type)] pub struct RequestingApplication { - pub name: String, - pub path: String, + pub path_or_app_id: String, + pub name: Optional, pub pid: u32, } diff --git a/credentialsd-ui/src/gui/view_model/mod.rs b/credentialsd-ui/src/gui/view_model/mod.rs index 78015be..d3113ef 100644 --- a/credentialsd-ui/src/gui/view_model/mod.rs +++ b/credentialsd-ui/src/gui/view_model/mod.rs @@ -33,7 +33,9 @@ where subtitle: String, operation: Operation, rp_id: String, - requesting_app: RequestingApplication, + app_name: String, + app_path_or_id: String, + app_pid: u32, // This includes devices like platform authenticator, USB, hybrid devices: Vec, @@ -52,13 +54,22 @@ impl ViewModel { rx_event: Receiver, tx_update: Sender, ) -> Self { + let RequestingApplication { + name: app_name, + path_or_app_id: path, + pid, + } = request.requesting_app; + + let app_name: Option = app_name.into(); Self { flow_controller, rx_event, tx_update, operation: request.operation, rp_id: request.rp_id, - requesting_app: request.requesting_app, + app_name: app_name.unwrap_or_else(|| gettext("unknown application")), + app_path_or_id: path, + app_pid: pid, title: String::default(), subtitle: String::default(), devices: Vec::new(), @@ -69,11 +80,6 @@ impl ViewModel { } async fn update_title(&mut self) { - let mut requesting_app = self.requesting_app.clone(); - - if requesting_app.name.is_empty() { - requesting_app.name = gettext("unknown application"); - }; let mut title = match self.operation { Operation::Create => { // TRANSLATORS: %s1 is the "relying party" (think: domain name) where the request is coming from @@ -105,9 +111,9 @@ impl ViewModel { } .to_string(); subtitle = subtitle.replace("%s1", &self.rp_id); - subtitle = subtitle.replace("%i1", &format!("{}", requesting_app.pid)); - subtitle = subtitle.replace("%s2", &requesting_app.name); - subtitle = subtitle.replace("%s3", &requesting_app.path); + subtitle = subtitle.replace("%i1", &format!("{}", self.app_pid)); + subtitle = subtitle.replace("%s2", &self.app_name); + subtitle = subtitle.replace("%s3", &self.app_path_or_id); self.title = title; self.subtitle = subtitle; self.tx_update diff --git a/credentialsd/src/dbus/gateway.rs b/credentialsd/src/dbus/gateway.rs index f92dfd4..7230f6f 100644 --- a/credentialsd/src/dbus/gateway.rs +++ b/credentialsd/src/dbus/gateway.rs @@ -208,8 +208,8 @@ async fn query_connection_peer_binary( tracing::debug!("Request is from: {exe_path:?}"); Some(RequestingApplication { - name: command_name, - path: exe_path.to_string_lossy().to_string(), + name: Some(command_name).into(), + path_or_app_id: exe_path.to_string_lossy().to_string(), pid, }) } @@ -451,8 +451,8 @@ async fn validate_app_details( NavigationContext::SameOrigin(Origin::AppId(app_id)) }; let app_details = RequestingApplication { - name: display_name, - path: claimed_app_id, + name: Some(display_name).into(), + path_or_app_id: claimed_app_id, pid, }; Ok((app_details, request_env)) From 35cb36210217ef9f3ec5c84b4dfe218aec5cd869 Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Fri, 20 Feb 2026 16:51:48 -0600 Subject: [PATCH 2/2] docs: Document RequestingApplication struct --- CHANGELOG.md | 6 ++++++ credentialsd-common/src/model.rs | 7 +++++++ doc/api.md | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3723a7..8ee59a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # [unreleased] +## Breaking Changes + +### UI Controller API + +- Reordered parameters in RequestingApplication, and made app name optional. + # [0.2.0] - 2025-02-18 ## Breaking Changes diff --git a/credentialsd-common/src/model.rs b/credentialsd-common/src/model.rs index 062de21..6ebbc43 100644 --- a/credentialsd-common/src/model.rs +++ b/credentialsd-common/src/model.rs @@ -96,10 +96,17 @@ impl Transport { } } +/// Details about the calling application to be displayed in the UI. #[derive(Debug, Default, Clone, Serialize, Deserialize, Type)] pub struct RequestingApplication { + /// The App ID (if called on the portal interface) or path (if called on the + /// internal interface). pub path_or_app_id: String, + + /// The name of the application. pub name: Optional, + + /// The PID of the applicatoin pub pid: u32, } diff --git a/doc/api.md b/doc/api.md index ecebc68..a0453d8 100644 --- a/doc/api.md +++ b/doc/api.md @@ -881,6 +881,9 @@ This method should be called when a new credential request begins. ViewRequest: [a{sv}] { id: u, operation: Operation, + rp_id: s, + requesting_app: RequestingApplication, + window_handle: s, // Optional } ``` @@ -891,6 +894,15 @@ Operation[s] [ ] ``` +``` +RequestingApplication { + name: s, // Optional + path_or_app_id: s, + pid: u32, + +} +``` + ### Response None.