Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve submission validation and input extraction. #35

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

timothee-haudebourg
Copy link
Contributor

@timothee-haudebourg timothee-haudebourg commented Oct 24, 2024

This PR improves the presentation submission validation in two ways:

  • Input extraction: currently we are only doing validation. But I also needed to extract the inputs provided in the submission. I added a PresentationSubmission::find_inputs function to find and extract the inputs. It returns a MatchingInputs structure containing all the inputs that matched the presentation definition.
  • Input decoding: currently the presentation submission inputs are not decoded, which is required to correctly handle nested descriptor maps. I've added a ClaimsDecoder trait that is given to the find_inputs to decode the visited input claims. I provided a "default" implementation NoClaimsDecoder that doesn't decode anything (so it behaves exactly like the current implementation).

For the validation part:

  • I added a MatchingInput::validate to validate the extracted input against the presentation definition requirements.
  • I replaced the previous validation function with PresentationSubmission::find_and_validate_inputs that just calls find_inputs and validate.

Other changes

I've set some fields public and removed some accessors.

Copy link
Contributor

@Ryanmtate Ryanmtate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timothee-haudebourg timothee-haudebourg merged commit 34827c5 into main Oct 24, 2024
2 checks passed
@timothee-haudebourg timothee-haudebourg deleted the add-find-presentations-function branch October 24, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants