aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

JSON-LD Request Presentation Example is not working

Open shashidharar opened this issue 2 years ago • 2 comments

I am following this site: https://github.com/hyperledger/aries-cloudagent-python/blob/main/demo/AliceWantsAJsonCredential.md to Issue and verify JSON-LD credentials using ACA-PY (Faber-Alice setup) using Swagger API end points. JSON-LD credential issue is working fine and I am facing the issue with JSON-LD credential verification.

Request Presentation Example To request a proof, submit the following (with appropriate connection_id) to Faber's /present-proof-2.0/send-request endpoint:

{ "comment": "string", "connection_id": "41acd909-9f45-4c69-8641-8146e0444a57", "presentation_request": { "dif": { "options": { "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa7", "domain": "4jt78h47fh47" }, "presentation_definition": { "id": "32f54163-7166-48f1-93d8-ff217bdb0654", "format": { "ldp_vp": { "proof_type": [ "BbsBlsSignature2020" ] } }, "input_descriptors": [ { "id": "citizenship_input_1", "name": "EU Driver's License", "schema": [ { "uri": "https://www.w3.org/2018/credentials#VerifiableCredential" }, { "uri": "https://w3id.org/citizenship#PermanentResident" } ], "constraints": { "limit_disclosure": "required", "is_holder": [ { "directive": "required", "field_id": [ "1f44d55f-f161-4938-a659-f8026467f126" ], } ], "fields": [ { "id": "1f44d55f-f161-4938-a659-f8026467f126", "path": [ "$.credentialSubject.familyName" ], "purpose": "The claim must be from one of the specified issuers", "filter": { "const": "SMITH" } }, { "path": [ "$.credentialSubject.givenName" ], "purpose": "The claim must be from one of the specified issuers" } ] } } ] } } } }

After changing the connection ID and I am trying to execute the given endpoint but I am not getting any response.

shashidharar avatar Feb 27 '23 06:02 shashidharar

The issue is a trailing comma in the JSON. Swagger silently doesn’t process a message when there are extra commas in the JSON. Here is the correct JSON for that. Likely a Pr is needed to fix the example — I’ll take a look. Here is prettified JSON with the comma removed. It is the comma in the is_holder section.

{
   "comment":"string",
   "connection_id":"41acd909-9f45-4c69-8641-8146e0444a57",
   "presentation_request":{
      "dif":{
         "options":{
            "challenge":"3fa85f64-5717-4562-b3fc-2c963f66afa7",
            "domain":"4jt78h47fh47"
         },
         "presentation_definition":{
            "id":"32f54163-7166-48f1-93d8-ff217bdb0654",
            "format":{
               "ldp_vp":{
                  "proof_type":[
                     "BbsBlsSignature2020"
                  ]
               }
            },
            "input_descriptors":[
               {
                  "id":"citizenship_input_1",
                  "name":"EU Driver's License",
                  "schema":[
                     {
                        "uri":"https://www.w3.org/2018/credentials#VerifiableCredential"
                     },
                     {
                        "uri":"https://w3id.org/citizenship#PermanentResident"
                     }
                  ],
                  "constraints":{
                     "limit_disclosure":"required",
                     "is_holder":[
                        {
                           "directive":"required",
                           "field_id":[
                              "1f44d55f-f161-4938-a659-f8026467f126"
                           ]
                        }
                     ],
                     "fields":[
                        {
                           "id":"1f44d55f-f161-4938-a659-f8026467f126",
                           "path":[
                              "$.credentialSubject.familyName"
                           ],
                           "purpose":"The claim must be from one of the specified issuers",
                           "filter":{
                              "const":"SMITH"
                           }
                        },
                        {
                           "path":[
                              "$.credentialSubject.givenName"
                           ],
                           "purpose":"The claim must be from one of the specified issuers"
                        }
                     ]
                  }
               }
            ]
         }
      }
   }
}

swcurran avatar Feb 27 '23 17:02 swcurran

PR submitted #2149

swcurran avatar Feb 27 '23 17:02 swcurran