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

feat: create model transformers for VC and VP #3515

Conversation

paullatzelsperger
Copy link
Member

What this PR changes/adds

This PR adds transformers that can convert JSON-LD -> VerifiableCredential and VerifiablePresentation.

Why it does that

Preliminary work needed for subsequent IATP adoption tasks.

Further notes

  • The VerifiableCredential itself does not hold the raw VC anymore
  • Introduced a VerifiableCredentialContainer (name is up for discussion), that stores the raw VC (JWT or JSON-LD), the credential format and the deserialized VerifiableCredential instance.

Linked Issue(s)

Closes #3501

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

* This container object is intended to hold a {@link VerifiableCredential}, its raw representation and which format it is in.
*
* @param rawVc A String containing the VC in its raw format. This must be exactly how it was originally received by the issuer.
* @param format indicates whether the VC is present in JWT or JSON-LD format

Check notice

Code scanning / CodeQL

Spurious Javadoc @param tags Note

@param tag "format" does not match any actual type parameter of type "VerifiableCredentialContainer".
@paullatzelsperger paullatzelsperger force-pushed the feat/3501_create_iatp_model_transformers branch from 8f1c086 to b52b228 Compare October 5, 2023 15:59
@paullatzelsperger paullatzelsperger changed the title Feat/3501 create iatp model transformers feat: create model transformers for VC and VP Oct 5, 2023
@paullatzelsperger paullatzelsperger marked this pull request as ready for review October 5, 2023 16:00
/**
* This container object is intended to hold a {@link VerifiableCredential}, its raw representation and which format it is in.
*
* @param rawVp A String containing the VP in its raw format. This must be exactly how it was originally received by the holder.

Check notice

Code scanning / CodeQL

Spurious Javadoc @param tags Note

@param tag "rawVp" does not match any actual type parameter of type "VerifiablePresentationContainer".
* This container object is intended to hold a {@link VerifiableCredential}, its raw representation and which format it is in.
*
* @param rawVp A String containing the VP in its raw format. This must be exactly how it was originally received by the holder.
* @param format indicates whether the VP is present in JWT or JSON-LD format

Check notice

Code scanning / CodeQL

Spurious Javadoc @param tags Note

@param tag "format" does not match any actual type parameter of type "VerifiablePresentationContainer".
*
* @param rawVp A String containing the VP in its raw format. This must be exactly how it was originally received by the holder.
* @param format indicates whether the VP is present in JWT or JSON-LD format
* @param credential the {@link VerifiablePresentation}, as it was deserialized from the raw VP string. Note that JSON-LD and JWT VCs

Check notice

Code scanning / CodeQL

Spurious Javadoc @param tags Note

@param tag "credential" does not match any actual type parameter of type "VerifiablePresentationContainer".
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (60a5675) 72.10% compared to head (3b13ab3) 72.06%.
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3515      +/-   ##
==========================================
- Coverage   72.10%   72.06%   -0.04%     
==========================================
  Files         832      839       +7     
  Lines       16947    17017      +70     
  Branches      954      956       +2     
==========================================
+ Hits        12220    12264      +44     
- Misses       4323     4346      +23     
- Partials      404      407       +3     
Files Coverage Δ
...rm/to/JsonObjectToCredentialStatusTransformer.java 100.00% <100.00%> (ø)
...m/to/JsonObjectToCredentialSubjectTransformer.java 100.00% <100.00%> (ø)
...ipse/edc/identitytrust/model/CredentialStatus.java 0.00% <ø> (ø)
...pse/edc/identitytrust/model/CredentialSubject.java 52.94% <ø> (ø)
...dc/identitytrust/model/VerifiablePresentation.java 58.62% <100.00%> (+2.37%) ⬆️
...titytrust/model/VerifiableCredentialContainer.java 0.00% <0.00%> (ø)
...tytrust/model/VerifiablePresentationContainer.java 0.00% <0.00%> (ø)
...o/JsonObjectToVerifiableCredentialTransformer.java 90.00% <90.00%> (ø)
...JsonObjectToVerifiablePresentationTransformer.java 88.88% <88.88%> (ø)
.../edc/identitytrust/model/VerifiableCredential.java 50.00% <40.00%> (-6.82%) ⬇️
... and 1 more

... and 1 file with indirect coverage changes

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

@paullatzelsperger paullatzelsperger merged commit 9d39f5c into eclipse-edc:main Oct 6, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dcp enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IATP: create model classes and transformers
4 participants