-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implement createPresentationFromCredentials #151
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
==========================================
+ Coverage 77.46% 77.62% +0.16%
==========================================
Files 31 30 -1
Lines 1890 1908 +18
Branches 262 264 +2
==========================================
+ Hits 1464 1481 +17
+ Misses 294 291 -3
- Partials 132 136 +4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff! Some minor comments below
credentials/src/main/kotlin/web5/sdk/credentials/PresentationExchange.kt
Outdated
Show resolved
Hide resolved
DescriptorMap( | ||
id = inputDescriptor.id, | ||
path = "$.verifiableCredential[$vcIndex]", | ||
format = "jwt_vc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use Format
as the type here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the input to the function is vcJwts: Iterable, we know that he descriptor map will be jwt_vc mapping
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public data class DescriptorMap( | ||
val id: String, | ||
val format: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use Format
as the type here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the format is a string int he DescriptorMap where it is an object in the inputDescriptor - https://identity.foundation/presentation-exchange/#presentation-submission
credentials/src/main/kotlin/web5/sdk/credentials/model/PresentationSubmission.kt
Outdated
Show resolved
Hide resolved
credentials/src/main/kotlin/web5/sdk/credentials/model/PresentationSubmission.kt
Outdated
Show resolved
Hide resolved
assertNotNull(presentationSubmission.id) | ||
assertEquals(pd.id, presentationSubmission.definitionId) | ||
|
||
assertEquals(1, presentationSubmission.descriptorMap.size) | ||
assertNotNull(presentationSubmission.descriptorMap[0].id) | ||
assertEquals("jwt_vc", presentationSubmission.descriptorMap[0].format) | ||
assertEquals("$.verifiableCredential[0]", presentationSubmission.descriptorMap[0].path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about asserting against a presentation submission loaded from a json file? Would be nice for test-vectors, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a test vector PR tee'd up after this, so we can hav ea clean PR that shows how to add test vector tests
…xchange.kt Co-authored-by: Andres Uribe <[email protected]>
…ationSubmission.kt Co-authored-by: Andres Uribe <[email protected]>
…ationSubmission.kt Co-authored-by: Andres Uribe <[email protected]>
|
||
@Test | ||
fun `throws when VC does not satisfy sanctions requirements`() { | ||
val pd = jsonMapper.readValue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan to read this from the hosted vectors in a follow up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup we will be doing the same stuff we do here in this PR decentralized-identity/web5-js#344
Overview
Implement
createPresentationFromCredentials
for full presentation exchangeDescription
Creates a Presentation Submission against a list of Verifiable Credentials (VCs) against a specified Presentation Definition.
Address this #134 and this #135
How Has This Been Tested?
New unit tests, test vector in the works