Skip to content

Commit

Permalink
revert to use of ClaimFormatMap to pass presentation defintion test s…
Browse files Browse the repository at this point in the history
…uite

Signed-off-by: Ryan Tate <[email protected]>
  • Loading branch information
Ryanmtate committed Sep 13, 2024
1 parent 0e0f985 commit b8e9141
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/presentation_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pub struct PresentationDefinition {
name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
purpose: Option<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
format: Vec<ClaimFormat>,
#[serde(default, skip_serializing_if = "ClaimFormatMap::is_empty")]
format: ClaimFormatMap,
}

impl PresentationDefinition {
Expand Down Expand Up @@ -163,20 +163,20 @@ impl PresentationDefinition {
/// as noted in the Claim Format Designations section.
///
/// See: [https://identity.foundation/presentation-exchange/spec/v2.0.0/#presentation-definition](https://identity.foundation/presentation-exchange/spec/v2.0.0/#presentation-definition)
pub fn set_format(mut self, format: Vec<ClaimFormat>) -> Self {
pub fn set_format(mut self, format: ClaimFormatMap) -> Self {
self.format = format;
self
}

/// Add a new format to the presentation definition.
pub fn add_format(mut self, value: ClaimFormat) -> Self {
self.format.push(value);
pub fn add_format(mut self, key: ClaimFormatDesignation, value: ClaimFormatPayload) -> Self {
self.format.insert(key, value);
self
}

/// Return the format of the presentation definition.
pub fn format(&self) -> &Vec<ClaimFormat> {
self.format.as_ref()
pub fn format(&self) -> &ClaimFormatMap {
&self.format
}

/// Return the human-readable string representation of the fields requested
Expand Down

0 comments on commit b8e9141

Please sign in to comment.