From 8df92dba8bfffcd22d9648251713004cd5a39312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=C3=B3rio=20Granado=20Magalh=C3=A3es?= Date: Fri, 17 Jan 2025 19:33:13 -0300 Subject: [PATCH] Adds path to requested field (#53) * Add selective_disclosable field * Merge branch 'main' of github.com:spruceid/openid4vp into skit-723-implement-mobile-disclosure-selection-for-wallet * Remove limit disclosure from requested_fields * Update path serialization for requested field object Signed-off-by: Tiago Nascimento * Filter to only matched paths --------- Signed-off-by: Tiago Nascimento Co-authored-by: Tiago Nascimento --- .vscode/settings.json | 3 +++ src/core/input_descriptor.rs | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..69c8781 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["CHAPI"] +} diff --git a/src/core/input_descriptor.rs b/src/core/input_descriptor.rs index f404d4c..3655df4 100644 --- a/src/core/input_descriptor.rs +++ b/src/core/input_descriptor.rs @@ -537,9 +537,17 @@ impl ConstraintsField { .flat_map(|path| path.query(value).all()) .collect::>(); + let raw_path = self + .path + .iter() + .flat_map(|p| p.query_located(value).all()) + .map(|e| e.location().to_string()) + .collect::>(); + RequestedField { id: uuid::Uuid::new_v4(), name: self.name.clone(), + path: raw_path, required: self.is_required(), retained: self.intent_to_retain, purpose: self.purpose.clone(), @@ -666,6 +674,7 @@ pub struct RequestedField<'a> { // The name property is optional, since it is also // optional on the constraint field. pub name: Option, + pub path: Vec, pub required: bool, pub retained: bool, pub purpose: Option,