Skip to content

Commit

Permalink
Remove limit disclosure from requested_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
w4ll3 authored and theosirian committed Jan 17, 2025
1 parent 2697d01 commit 4db4d1a
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/core/input_descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ impl InputDescriptor {
self.constraints
.fields
.iter()
.map(|field| {
field.requested_fields(self.id.clone(), self.constraints.limit_disclosure(), value)
})
.map(|field| field.requested_fields(self.id.clone(), value))
.map(|mut requested_field| {
// Set the purpose of the requested field to the input descriptor `purpose`,
// if it is no value is set from the constraint field's `purpose`.
Expand Down Expand Up @@ -246,13 +244,6 @@ impl Constraints {
self.limit_disclosure.as_ref()
}

/// Returns if the fields are selective disclosable
pub fn selective_disclosable(&self) -> bool {
self.fields
.iter()
.any(|field| field.is_selective_disclosable(self.limit_disclosure()))
}

/// Returns if the constraints fields contain non-optional
/// fields that must be satisfied.
pub fn is_required(&self) -> bool {
Expand Down Expand Up @@ -501,17 +492,6 @@ impl ConstraintsField {
!self.is_optional()
}

/// Given limit_disclosure returns wether the property is selective disclosable
fn is_selective_disclosable(
&self,
limit_disclosure: Option<&ConstraintsLimitDisclosure>,
) -> bool {
match limit_disclosure {
Some(_) => self.is_optional(),
None => false,
}
}

/// Field query.
///
/// See: <https://identity.foundation/presentation-exchange/spec/v2.0.0/#input-evaluation>
Expand Down Expand Up @@ -549,7 +529,6 @@ impl ConstraintsField {
pub fn requested_fields<'a>(
&self,
input_descriptor_id: String,
limit_disclosure: Option<&ConstraintsLimitDisclosure>,
value: &'a serde_json::Value,
) -> RequestedField<'a> {
let raw_fields = self
Expand All @@ -570,7 +549,6 @@ impl ConstraintsField {
.collect(),
required: self.is_required(),
retained: self.intent_to_retain,
selective_disclosable: self.is_selective_disclosable(limit_disclosure),
purpose: self.purpose.clone(),
input_descriptor_id,
raw_fields,
Expand Down Expand Up @@ -698,7 +676,6 @@ pub struct RequestedField<'a> {
pub path: String,
pub required: bool,
pub retained: bool,
pub selective_disclosable: bool,
pub purpose: Option<String>,
// the `raw_field` represents the actual field(s)
// being selected by the input descriptor JSON path
Expand Down

0 comments on commit 4db4d1a

Please sign in to comment.