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

Feature/sphereon 1183 sd jwt confomance #174

Merged
merged 4 commits into from
Nov 11, 2024

Conversation

sanderPostma
Copy link
Contributor

SPHEREON-1183 support disclosure of entire sd-jwt groups which have individual frame elements

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Project coverage is 92.59%. Comparing base (9596f9d) to head (87da1d8).
Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
...ation/handlers/limitDisclosureEvaluationHandler.ts 80.00% 3 Missing ⚠️
lib/utils/jsonPathUtils.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #174      +/-   ##
===========================================
- Coverage    92.69%   92.59%   -0.10%     
===========================================
  Files           66       66              
  Lines         2750     2769      +19     
  Branches       722      727       +5     
===========================================
+ Hits          2549     2564      +15     
- Misses         196      200       +4     
  Partials         5        5              
Flag Coverage Δ
unittest 92.59% <80.95%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sanderPostma sanderPostma marked this pull request as draft October 25, 2024 09:24
@sanderPostma
Copy link
Contributor Author

Merging blocked, unit tests need more work

@sanderPostma sanderPostma marked this pull request as ready for review October 25, 2024 13:01
Comment on lines +168 to +174
if (fieldValue !== null && typeof fieldValue === 'object') {
// For objects, recursively process all nested fields
processNestedObject(fieldValue, selectedField.path, selectedField.path);
} else {
// For literal values, just set the path to true
JsonPathUtils.setValue(presentationFrame, selectedField.path, true);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, why do we need to handle nested objects? If a PD includes $.address and address is an object, then having address: true in the disclosure frame should be enough right?

Copy link
Contributor Author

@sanderPostma sanderPostma Oct 27, 2024

Choose a reason for hiding this comment

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

@TimoGlastra
This is for the situation where a sd-jwt (not created by us) does not have a disclosure frame element on a group, but on the individual fields within a group. ie.

"electronicPassport": {
  "dataGroup1": {
     "birthdate": "{{birthdate}}",
     "expiryDate": "{{{ dateTimeAfterDays 1080 }}}",
     "passportNumberIdentifier": "{{passportNumberIdentifier}}"
  },
  "disclosureFrame": {
    "electronicPassport": {
      "dataGroup1": {
        "_sd": [
          "birthdate",
          "expiryDate",
          "passportNumberIdentifier"
        ]
      },
}

When the pd asks to disclose \$.electronicPassport.dataGroup1 instead of \$.electronicPassport.dataGroup1.* it should still disclose all disclosable fields & groups within the group.
(When you control PD or credential you can make it work by modifying either on or both, but we ran into an interoperability tests where you we do not.)
Also with the address example in the Funke PID, the @sd-jwt library (0.7.2) does not disclose anything when specifying address: true

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm okay, i think it's probably something that should be solved in @sd-jwt library then? As saying address: true is enough to know the whole address object and sub-disclosures should be resolved.

It feels like a hack to me to solve it in this was

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Forking the @sd-jwt library which is not ours is also something we would like to avoid. When I have more time I can play around with the tests in the @sd-jwt library, but have plenty of other stuff on my plate atm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For clarity, for this setup address: true does work:

 "disclosureFrame": {
    "electronicPassport": {
        "_sd": [
          "dataGroup1"
        ]
}

But then you always disclose the whole address and just field passportNumberIdentifier won't work anymore.

Copy link
Contributor

@zoemaas zoemaas left a comment

Choose a reason for hiding this comment

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

Improve the test coverage and fix conflicts

@sanderPostma
Copy link
Contributor Author

@zoemaas
develop is merged in & builds pass.
For the test coverage I had to create a ticket https://sphereon.atlassian.net/browse/VDX-340
I do not have time for that, I have to race now to get FIDS / Findy working in time.

Copy link
Contributor

@zoemaas zoemaas left a comment

Choose a reason for hiding this comment

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

Since there is a ticket to fix the coverage and the tests are passing, it LGTM. I still can see conflicts. Don't forget to fix them

…183_sd-jwt-confomance

# Conflicts:
#	test/evaluation/selectFrom.spec.ts
@sanderPostma sanderPostma merged commit a5d5107 into develop Nov 11, 2024
2 of 4 checks passed
@sanderPostma sanderPostma deleted the feature/SPHEREON-1183_sd-jwt-confomance branch November 11, 2024 09:53
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.

3 participants