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: verification of (consumer) VP (VC-JWT) #3545

Conversation

paullatzelsperger
Copy link
Member

@paullatzelsperger paullatzelsperger commented Oct 16, 2023

What this PR changes/adds

This PR adds the cryptographic verification of VerifiablePresentations for the following formats:

  • JSON-LD: verification is done based on LinkedDataProofs (edit: will come in another PR)
  • JWT: verification is done based on JWS

Why it does that

Verifiers (e.g. a provider connector) must be able to ensure the cryptographic integrity of a presenter's VP

Further notes

VPs must be homogenous, i.e. if a VP is presented as JWT, it may only contain VC's that are also encoded as JWT.
This is a restriction imposed by the Verfiable Credentials Data Model v1.1.

Linked Issue(s)

Closes #3533

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

return new MultiFormatPresentationVerifier(jwtVerifier, getOwnDid(context), typeManager.getMapper(JSON_LD));
}

private String getOwnDid(ServiceExtensionContext context) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'context' is never used.
@codecov-commenter
Copy link

Codecov Report

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

Comparison is base (9fbad3c) 72.43% compared to head (0694579) 72.45%.

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3545      +/-   ##
==========================================
+ Coverage   72.43%   72.45%   +0.01%     
==========================================
  Files         867      867              
  Lines       17387    17417      +30     
  Branches      988      993       +5     
==========================================
+ Hits        12595    12620      +25     
- Misses       4376     4380       +4     
- Partials      416      417       +1     
Files Coverage Δ
...edc/iam/identitytrust/IdentityAndTrustService.java 97.82% <100.00%> (ø)
...trust/verification/JsonLdPresentationVerifier.java 0.00% <ø> (ø)
...ytrust/verification/SelfIssuedIdTokenVerifier.java 75.00% <100.00%> (ø)
...JsonObjectToVerifiablePresentationTransformer.java 88.88% <ø> (ø)
.../identitytrust/core/IdentityAndTrustExtension.java 66.66% <0.00%> (-6.07%) ⬇️
...itytrust/verification/JwtPresentationVerifier.java 86.20% <86.20%> (+86.20%) ⬆️
.../verification/MultiFormatPresentationVerifier.java 0.00% <0.00%> (ø)

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

@paullatzelsperger
Copy link
Member Author

paullatzelsperger commented Oct 17, 2023

When implementing the JWT verifier, and starting on the LDP verifier, i noticed that adding glue code, testing etc. is going to have quite a significant impact in terms of changed files, so I decided to do it in another PR.

This one only contains the JWT verifier!!

@paullatzelsperger paullatzelsperger marked this pull request as ready for review October 17, 2023 14:24
@paullatzelsperger paullatzelsperger changed the title feat: verification of (consumer) VP feat: verification of (consumer) VP (VC-JWT) Oct 17, 2023
Copy link
Contributor

@bscholtes1A bscholtes1A left a comment

Choose a reason for hiding this comment

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

Few minor comments, but LGTM

}

} catch (ParseException | JsonProcessingException e) {
throw new RuntimeException(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really want to throw? Shouldn't we return a failed result instead?

Copy link
Member Author

@paullatzelsperger paullatzelsperger Oct 18, 2023

Choose a reason for hiding this comment

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

I was sort of undecided, but in practice this can only happen, if the key is in an invalid format, or we are not dealing with valid JSON, at which point any further processing would be pointless.

…c/main/java/org/eclipse/edc/iam/identitytrust/verification/MultiFormatPresentationVerifier.java

Co-authored-by: Benjamin Scholtes <[email protected]>
Copy link
Contributor

@wolf4ood wolf4ood left a comment

Choose a reason for hiding this comment

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

LGTM!

@paullatzelsperger paullatzelsperger merged commit e30ca41 into eclipse-edc:main Oct 18, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IATP: Verify consumer VP
4 participants