Skip to content

Commit 271ad16

Browse files
authored
Merge pull request #146 from linux-credentials/iinuwa/refactor-gateway-service
Refactor gateway service
2 parents 2f0fdf2 + b177ddb commit 271ad16

12 files changed

Lines changed: 752 additions & 653 deletions

File tree

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"tasks": [
44
{
55
"type": "meson",
6-
"target": "credentialsd",
6+
"target": "credentialsd/src/credentialsd:custom",
77
"mode": "build",
88
"problemMatcher": [
99
"$meson-gcc"
@@ -13,7 +13,7 @@
1313
},
1414
{
1515
"type": "meson",
16-
"target": "credentialsd-ui",
16+
"target": "credentialsd-ui/src/credentialsd-ui:custom",
1717
"mode": "build",
1818
"problemMatcher": [
1919
"$meson-gcc"

ARCHITECTURE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ Actual interaction I/O is performed in the [libwebauthn][libwebauthn] library.
103103

104104
[libwebauthn]: https://github.com/linux-credentials/libwebauthn
105105

106+
### `credentialsd/src/gateway/`
107+
108+
The Gateway service is defined here, along with its D-Bus interface.
109+
106110
### `credentialsd/src/dbus/`
107111

108112
D-Bus clients and services.
109113

110-
The Gateway and Flow Controller services are defined here, as well as a client
114+
The Flow Controller services are defined here, as well as a client
111115
for the UI Controller.
112116

113117
The `model` module contains some methods to convert from D-Bus types to internal

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

credentialsd/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ license = "LGPL-3.0-only"
77

88
[dependencies]
99
async-stream = "0.3.6"
10+
async-trait = "0.1.89"
1011
base64 = "0.22.1"
1112
credentialsd-common = { path = "../credentialsd-common" }
1213
futures-lite.workspace = true

credentialsd/src/dbus/flow_control.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! This module implements the service to allow the user to control the flow of
22
//! the credential request through the trusted UI.
33
4-
use std::future::Future;
54
use std::{collections::VecDeque, fmt::Debug, sync::Arc};
65

6+
use async_trait::async_trait;
77
use credentialsd_common::model::{
88
BackgroundEvent, Device, Error as CredentialServiceError, RequestingApplication, WebAuthnError,
99
};
@@ -341,13 +341,16 @@ enum SignalState {
341341
Active,
342342
}
343343

344+
/// Coordinates between user and various devices connected to the machine to
345+
/// fulfill credential requests.
346+
#[async_trait]
344347
pub trait CredentialRequestController {
345-
fn request_credential(
348+
async fn request_credential(
346349
&self,
347350
requesting_app: Option<RequestingApplication>,
348351
request: CredentialRequest,
349352
window_handle: Option<WindowHandle>,
350-
) -> impl Future<Output = Result<CredentialResponse, WebAuthnError>> + Send;
353+
) -> Result<CredentialResponse, WebAuthnError>;
351354
}
352355

353356
pub struct CredentialRequestControllerClient {
@@ -359,6 +362,7 @@ pub struct CredentialRequestControllerClient {
359362
)>,
360363
}
361364

365+
#[async_trait]
362366
impl CredentialRequestController for CredentialRequestControllerClient {
363367
async fn request_credential(
364368
&self,

0 commit comments

Comments
 (0)