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

adding test vector #72

Merged
merged 7 commits into from
Dec 4, 2023
Merged

adding test vector #72

merged 7 commits into from
Dec 4, 2023

Conversation

nitro-neal
Copy link
Contributor

@nitro-neal nitro-neal commented Nov 29, 2023

Here is an example of what the test may look similar to that implements thsi test vector:

    @Test
    fun `web5-test-vectors/presentation-exchange/wa-license.json`() {
     val jsonString = get("https://raw.githubusercontent.com/TBD54566975/sdk-development/392de55c0992e5457d8d881f37299984f17d168c/web5-test-vectors/presentation-exchange/wa-license.json")
     
      val pd = jsonMapper.readValue(
        readPd(jsonString.vectors[0].presentationDefinition),
        PresentationDefinitionV2::class.java
      )

      val vcJwt = jsonString.vectors[0].credentialJwt

      val presentationResult = PresentationExchange.createPresentationFromCredentials([vcJwt], pd);
    
     assertEquals(presentationResult.toString(), jsonString.vectors[0].output)
    }

our PresentationExchange function takes in :
presentationDefinition and credentialJwt from the test vector, and it should generate the output from the test vector

@andresuribe87
Copy link
Contributor

This is awesome @nitro-neal

A couple of pieces of feedback.

Let me know if that all makes sense!

@nitro-neal
Copy link
Contributor Author

Sounds good and makes sense to me! Added README and I will add the errors when I complete what my error object will look like

Copy link
Contributor

@andresuribe87 andresuribe87 left a comment

Choose a reason for hiding this comment

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

Awesome stuff! I'll take another look once you include the errors.

web5-test-vectors/presentation-exchange/README.md Outdated Show resolved Hide resolved

| Property | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `presentationSubmission` | the expected [presentationSubmission](https://identity.foundation/presentation-exchange/#presentation-submission) when the `inputs` are processed by `createPresentationFromCredentials`. |
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, could you link to a "reference implementation"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@mistermoe mistermoe requested a review from amika-sq December 4, 2023 14:58
Copy link
Collaborator

@amika-sq amika-sq left a comment

Choose a reason for hiding this comment

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

lgtm! Seems like a good first test to me. I'm sure we'll add more vectors in the future, but this seems like a great start!

Comment on lines +1 to +45
{
"description":"Simple Presentation Exchange",
"vectors":[
{
"description":"presentation exchange for wa drivers license",
"input":{
"presentationDefinition":{
"id":"32f54163-7166-48f1-93d8-ff217bdb0653",
"input_descriptors":[
{
"id":"wa_driver_license",
"name":"Washington State Business License",
"purpose":"We can only allow licensed Washington State business representatives into the WA Business Conference",
"constraints":{
"fields":[
{
"path":[
"$.credentialSubject.dateOfBirth",
"$.credentialSubject.licenseNumber",
"$.credentialSubject.licenseState"
]
}
]
}
}
]
},
"credentialJwt":"eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsImtpZCI6ImRpZDprZXk6ejZNa25qSkVXZ0xzaDNSeDM3ZXpUQjJKaE1RY1kxYzN4dnRYS3cxaEF6ZmVlSnpKI3o2TWtuakpFV2dMc2gzUngzN2V6VEIySmhNUWNZMWMzeHZ0WEt3MWhBemZlZUp6SiJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtuakpFV2dMc2gzUngzN2V6VEIySmhNUWNZMWMzeHZ0WEt3MWhBemZlZUp6SiIsInN1YiI6ImRpZDprZXk6ejZNa25qSkVXZ0xzaDNSeDM3ZXpUQjJKaE1RY1kxYzN4dnRYS3cxaEF6ZmVlSnpKIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIldhRHJpdmVMaWNlbnNlIl0sImlkIjoidXJuOnV1aWQ6OGYzYmU5NjktOTEyYS00MWNjLWFjYjUtZjMzOGQ2MmQ1OGNlIiwiaXNzdWVyIjoiZGlkOmtleTp6Nk1rbmpKRVdnTHNoM1J4MzdlelRCMkpoTVFjWTFjM3h2dFhLdzFoQXpmZWVKekoiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTExLTI5VDIxOjQ5OjIxWiIsImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmtleTp6Nk1rbmpKRVdnTHNoM1J4MzdlelRCMkpoTVFjWTFjM3h2dFhLdzFoQXpmZWVKekoiLCJkYXRlT2ZCaXJ0aCI6IjExLTExLTIwMTEiLCJsaWNlbnNlTnVtYmVyIjoiMTIzNCIsImxpY2Vuc2VTdGF0ZSI6IldBIn19fQ.oGaIuZI9vRcauGI2Zi469mx8KZR1zpNV_HbmFtvWoap6CaPtn-uaG4oxswAfB4ITUs5fePKIgUvdGbBKyWx1CQ"
},
"output":{
"presentationSubmission":{
"id":"VPaHaqzslzOqisx02jMS0",
"definition_id":"32f54163-7166-48f1-93d8-ff217bdb0653",
"descriptor_map":[
{
"id":"wa_driver_license",
"format":"jwt_vc",
"path":"$.verifiableCredential[0]"
}
]
}
}
}
]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Indentation here it a little inconsistent. My editor suggested 3-space indentation, but it looks like there's also 4-space indentation as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I used this, and it lines up with no errors for me:
https://jsonformatter.curiousconcept.com/#

Copy link
Collaborator

Choose a reason for hiding this comment

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

The validation is great! Just seems like we have some inconsistent indentation.

For example, the opening and closing braces for this JSON are in different columns. Maybe that's intentional? Either way, not blocking!

Copy link
Contributor

@andresuribe87 andresuribe87 left a comment

Choose a reason for hiding this comment

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

Chatted with @nitro-neal and he's adding errors at a later point.

@nitro-neal nitro-neal merged commit 27d28b6 into main Dec 4, 2023
6 checks passed
@nitro-neal nitro-neal deleted the pex-test-vector-1 branch December 4, 2023 22:33
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