Skip to content

Commit a584225

Browse files
authored
Merge pull request #148 from linux-credentials/portal-api
Add Portal handler D-Bus interface
2 parents 8e14fd7 + d784de7 commit a584225

11 files changed

Lines changed: 925 additions & 400 deletions

File tree

.vscode/launch.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
"program": "${workspaceFolder}/build/credentialsd/src/credentialsd",
1212
"args": [],
1313
"env": {
14-
"RUST_LOG": "credentialsd=debug,libwebauthn=debug,libwebauthn::webauthn=debug,libwebauthn=warn,libwebauthn::proto::ctap2::preflight=debug,libwebauthn::transport::channel=debug,zbus::object_server::debug,zbus=debug"
14+
"RUST_LOG": "credentialsd=debug,libwebauthn=debug,libwebauthn::webauthn=debug,libwebauthn=warn,libwebauthn::proto::ctap2::preflight=debug,libwebauthn::transport::channel=debug,zbus::object_server::debug,zbus=debug",
15+
"CREDSD_TRUSTED_CALLERS": "/usr/bin/python3.14",
16+
"CREDSD_TRUSTED_APP_IDS": "app:xyz.iinuwa.credentialsd.DemoCredentialsUi",
1517
},
16-
"sourceLanguages": ["rust"],
18+
"sourceLanguages": [
19+
"rust"
20+
],
1721
"cwd": "${workspaceFolder}",
1822
"preLaunchTask": "Meson: Build Daemon"
1923
},
@@ -27,15 +31,20 @@
2731
"GSETTINGS_SCHEMA_DIR": "${workspaceFolder}/build/credentialsd-ui/data",
2832
"RUST_LOG": "credentialsd_ui=debug,zbus::trace,zbus::object_server::debug"
2933
},
30-
"sourceLanguages": ["rust"],
34+
"sourceLanguages": [
35+
"rust"
36+
],
3137
"cwd": "${workspaceFolder}",
3238
"preLaunchTask": "Meson: Build UI"
3339
},
3440
],
3541
"compounds": [
3642
{
3743
"name": "Server/Client",
38-
"configurations": ["Debug UI (credentialsd-ui)", "Debug Daemon (credentialsd)"]
44+
"configurations": [
45+
"Debug UI (credentialsd-ui)",
46+
"Debug Daemon (credentialsd)"
47+
]
3948
}
4049
]
41-
}
50+
}

credentialsd-common/src/model.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub struct Credential {
1010
pub username: Option<String>,
1111
}
1212

13+
/// Client Capabilities, as defined in
14+
/// [WebAuthn](https://www.w3.org/TR/webauthn-3/#enumdef-clientcapability).
1315
#[derive(SerializeDict, Type)]
1416
#[zvariant(signature = "dict", rename_all = "camelCase")]
1517
pub struct GetClientCapabilitiesResponse {
@@ -110,7 +112,7 @@ pub struct RequestingApplication {
110112
/// The name of the application.
111113
pub name: Optional<String>,
112114

113-
/// The PID of the applicatoin
115+
/// The PID of the application
114116
pub pid: u32,
115117
}
116118

credentialsd-common/src/server.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Types for serializing across D-Bus instances
22
3-
use std::fmt::Display;
3+
use std::{collections::HashMap, fmt::Display};
44

55
use serde::{
66
Deserialize, Serialize,
@@ -11,7 +11,7 @@ use zvariant::{
1111
SerializeDict, Signature, Structure, StructureBuilder, Type, Value, signature::Fields,
1212
};
1313

14-
use crate::model::{BackgroundEvent, Device, Operation, RequestingApplication};
14+
use crate::model::{BackgroundEvent, Operation, RequestingApplication};
1515

1616
const TAG_VALUE_SIGNATURE: &Signature = &Signature::Structure(Fields::Static {
1717
fields: &[&Signature::U8, &Signature::Variant],
@@ -113,6 +113,14 @@ pub struct CreateCredentialResponse {
113113
public_key: Option<CreatePublicKeyCredentialResponse>,
114114
}
115115

116+
impl NoneValue for CreateCredentialResponse {
117+
type NoneType = HashMap<String, OwnedValue>;
118+
119+
fn null_value() -> Self::NoneType {
120+
HashMap::new()
121+
}
122+
}
123+
116124
#[derive(Clone, Debug, DeserializeDict, Type)]
117125
#[zvariant(signature = "dict")]
118126
pub struct CreatePublicKeyCredentialRequest {
@@ -197,8 +205,6 @@ impl TryFrom<&Value<'_>> for crate::model::Error {
197205
pub struct GetCredentialRequest {
198206
pub origin: Option<String>,
199207
pub is_same_origin: Option<bool>,
200-
#[zvariant(rename = "type")]
201-
pub r#type: String,
202208
#[zvariant(rename = "publicKey")]
203209
pub public_key: Option<GetPublicKeyCredentialRequest>,
204210
}

0 commit comments

Comments
 (0)