Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The **UI Controller** is used to launch a UI for the user to respond to
authenticator requests for user interaction. The **Flow Controller** interacts
with the OS and hardware, like detecting available transports and
authenticators. It then relays the information needed for the UI to guide the
user through the authentication flow, like prompts for a user to enter their PIN
user through the authentication ceremony, like prompts for a user to enter their PIN
or touch the device. The UI Controller takes user input and responds back to the
Flow Controller.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ make sure that your changes can build and pass all tests, as well as running the
formatting and linting tools [mentioned above](#code-formatting-and-linting).

You should also follow the install instructions in [`BUILDING.md`](/BUILDING.md)
and execute authentication flows in a browser to ensure that everything
and execute authentication ceremonies in a browser to ensure that everything
still works as it should.

# Translations
Expand Down
16 changes: 8 additions & 8 deletions credentialsd-ui/src/dbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,30 +172,30 @@ impl CredentialPortalBackend {
app_path,
options,
};
let flow_object = FlowObject {
let ceremony = CeremonyObject {
ui_context,
request_tx: self.request_tx.clone(),
return_address: sender.to_owned().into(),
ui_events_forwarder_task: None,
bg_events_tx: None,
};
object_server.at(object_path.clone(), flow_object).await?;
object_server.at(object_path.clone(), ceremony).await?;
tracing::debug!("Received UI launch request");
Ok(object_path)
}
}

pub struct FlowObject {
pub struct CeremonyObject {
ui_context: UiContext,
pub request_tx: Sender<(ViewRequest, Arc<AsyncMutex<FlowControlClient>>)>,
pub return_address: OwnedUniqueName,
ui_events_forwarder_task: Option<JoinHandle<()>>,
bg_events_tx: Option<Sender<BackgroundEvent>>,
}

#[interface(name = "org.freedesktop.impl.portal.experimental.Credential.FlowObject")]
impl FlowObject {
/// Start the UI flow with an initial set of available credential interfaces.
#[interface(name = "org.freedesktop.impl.portal.experimental.Credential.Ceremony")]
impl CeremonyObject {
/// Start the UI ceremony with an initial set of available credential interfaces.
/// Call this method after subscribing to the signals.
async fn start(
&mut self,
Expand All @@ -218,7 +218,7 @@ impl FlowObject {
if emitter.user_interacted(&ui_event).await.is_err() {
tracing::error!("Failed to send UI event signal.");
// TODO: we need to cancel the request here, so we need a
// channel back to the flow object to send the cancellation.
// channel back to the ceremony object to send the cancellation.
break;
}
}
Expand Down Expand Up @@ -284,7 +284,7 @@ impl FlowObject {
}
if let Some(path) = header.path() {
// TODO: Send clean up task to GUI thread.
object_server.remove::<FlowObject, _>(path).await?;
object_server.remove::<CeremonyObject, _>(path).await?;
}
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions credentialsd/src/dbus/flow_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use zbus::{
};

use crate::credential_service::ManageDevice;
use crate::dbus::ui_control::Flow;
use crate::dbus::ui_control::Ceremony;
use crate::dbus::UiControlServiceClient;
use crate::{
credential_service::{hybrid::HybridState, nfc::NfcState, UsbState},
Expand Down Expand Up @@ -247,7 +247,7 @@ async fn handle<M: ManageDevice + Debug + Send + Sync + 'static, UC: UiControlle
}

fn forward_background_event_stream(
flow: Flow,
flow: Ceremony,
mut stream: impl Stream<Item = BackgroundEvent> + Send + Unpin + 'static,
) {
tokio::spawn(async move {
Expand Down
26 changes: 13 additions & 13 deletions credentialsd/src/dbus/ui_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub trait UiController {
app_pid: u32,
app_path: String,
options: PortalBackendOptions,
) -> impl Future<Output = std::result::Result<Flow, Box<dyn Error>>> + Send;
) -> impl Future<Output = std::result::Result<Ceremony, Box<dyn Error>>> + Send;
}

#[proxy(
Expand Down Expand Up @@ -74,12 +74,12 @@ trait UiControlService2 {
}

#[derive(Clone, Debug)]
pub struct Flow {
proxy: Arc<FlowObjectProxy<'static>>,
pub struct Ceremony {
proxy: Arc<CeremonyObjectProxy<'static>>,
ui_events_rx: Arc<AsyncMutex<Receiver<BackendRequest>>>,
}

impl Flow {
impl Ceremony {
pub async fn receive_ui_event(&self) -> Option<BackendRequest> {
self.ui_events_rx.lock().await.recv().await
}
Expand All @@ -99,10 +99,10 @@ impl Flow {
}
#[proxy(
gen_blocking = false,
interface = "org.freedesktop.impl.portal.experimental.Credential.FlowObject",
interface = "org.freedesktop.impl.portal.experimental.Credential.Ceremony",
default_service = "xyz.iinuwa.credentialsd.UiControl"
)]
trait FlowObject {
trait CeremonyObject {
async fn start(&self) -> fdo::Result<()>;
async fn notify_state_changed(&self, event: BackgroundEvent) -> fdo::Result<()>;

Expand Down Expand Up @@ -133,12 +133,12 @@ impl UiControlServiceClient {
async fn request_proxy(
&self,
request_id: RequestId,
) -> Result<FlowObjectProxy<'_>, zbus::Error> {
) -> Result<CeremonyObjectProxy<'_>, zbus::Error> {
let object_path = ObjectPath::from_string_unchecked(format!(
"/org/freedesktop/portal/Credential/{}",
request_id
));
FlowObjectProxy::new(&self.conn, object_path).await
CeremonyObjectProxy::new(&self.conn, object_path).await
}
}

Expand All @@ -163,7 +163,7 @@ impl UiController for UiControlServiceClient {
app_pid: u32,
app_path: String,
options: PortalBackendOptions,
) -> Result<Flow, Box<dyn Error>> {
) -> Result<Ceremony, Box<dyn Error>> {
let path = self
.proxy2()
.await?
Expand All @@ -181,15 +181,15 @@ impl UiController for UiControlServiceClient {
)
.await?;
tracing::debug!(?path, "Path initialized");
let flow_object = FlowObjectProxy::new(&self.conn, path).await?;
let flow_object = CeremonyObjectProxy::new(&self.conn, path).await?;
let (from_ui_tx, from_ui_rx) = mpsc::channel(32);
let ui_event_stream = flow_object.receive_user_interacted().await?;
tokio::task::spawn(async move {
_ = forward_ui_events(ui_event_stream, from_ui_tx).await;
});
// Mark as ready to receive messages.
flow_object.start().await?;
Ok(Flow {
Ok(Ceremony {
proxy: Arc::new(flow_object),
ui_events_rx: Arc::new(AsyncMutex::new(from_ui_rx)),
})
Expand Down Expand Up @@ -235,7 +235,7 @@ pub mod test {
Mutex as AsyncMutex, Notify,
};

use crate::dbus::ui_control::Flow;
use crate::dbus::ui_control::Ceremony;

use super::UiController;

Expand Down Expand Up @@ -270,7 +270,7 @@ pub mod test {
_app_pid: u32,
_app_path: String,
_options: PortalBackendOptions,
) -> Result<Flow, Box<dyn Error>> {
) -> Result<Ceremony, Box<dyn Error>> {
unimplemented!()
}
}
Expand Down
2 changes: 1 addition & 1 deletion doc/xyz.iinuwa.credentialsd.FlowControl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.freedesktop.impl.portal.experimental.Credential.FlowObject">
<interface name="org.freedesktop.impl.portal.experimental.Credential.Ceremony">
<!--
Start the UI flow with an initial set of available credential interfaces.
Call this method after subscribing to the signals.
Expand Down
Loading