Skip to content

Commit

Permalink
Adds path to requested field (#53)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Filter to only matched paths

---------

Signed-off-by: Tiago Nascimento <[email protected]>
Co-authored-by: Tiago Nascimento <[email protected]>
  • Loading branch information
w4ll3 and theosirian authored Jan 17, 2025
1 parent 5abf66b commit 8df92db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.words": ["CHAPI"]
}
9 changes: 9 additions & 0 deletions src/core/input_descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,17 @@ impl ConstraintsField {
.flat_map(|path| path.query(value).all())
.collect::<Vec<&'a serde_json::Value>>();

let raw_path = self
.path
.iter()
.flat_map(|p| p.query_located(value).all())
.map(|e| e.location().to_string())
.collect::<Vec<_>>();

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(),
Expand Down Expand Up @@ -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<String>,
pub path: Vec<String>,
pub required: bool,
pub retained: bool,
pub purpose: Option<String>,
Expand Down

0 comments on commit 8df92db

Please sign in to comment.