aries-framework-go icon indicating copy to clipboard operation
aries-framework-go copied to clipboard

Cannot accept credential request by Alice in the open api demo

Open MajdT51 opened this issue 2 years ago • 3 comments

What I'm trying to do

Run the open api demo and accept a credential request by alice

  • connect Alice To Bob as described in https://github.com/hyperledger/aries-framework-go/blob/main/docs/rest/openapi_demo.md#how-to-create-a-did-connection-through-the-out-of-band-protocol

  • both are connected and has "State": "completed"

  • send offer by alice curl -X 'POST' \ https://localhost:8082/issuecredential/send-offer' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "my_did": "did:peer:1zQmSvQExh5t7GEBaXZUne1iqXW1Qyvh3QKE675q5tz1hkYW", "offer_credential": {}, "their_did": "did:peer:1zQmUFw8fitQ4GH6V3gvnkVgajhDmNJvPitqCLxbHaP164AM" }' --> { "piid": "752a7a05-4a74-4840-aad7-9db3fc953c5d" }

  • Bob -> curl -X 'GET' \ 'https://localhost:9082/issuecredential/actions' \ -H 'accept: application/json' --> { "actions": [ { "PIID": "752a7a05-4a74-4840-aad7-9db3fc953c5d", "Msg": { "@id": "752a7a05-4a74-4840-aad7-9db3fc953c5d", "@type": "https://didcomm.org/issue-credential/2.0/offer-credential", "~thread": { "thid": "752a7a05-4a74-4840-aad7-9db3fc953c5d" } }, "MyDID": "did:peer:1zQmUFw8fitQ4GH6V3gvnkVgajhDmNJvPitqCLxbHaP164AM", "TheirDID": "did:peer:1zQmSvQExh5t7GEBaXZUne1iqXW1Qyvh3QKE675q5tz1hkYW" } ] }

  • Bob accept offer curl -X 'POST' \ 'https://localhost:9082/issuecredential/752a7a05-4a74-4840-aad7-9db3fc953c5d/accept-offer' \ -H 'accept: application/json' \ d '' --> {} (code 200)

  • Alice curl -X 'GET' \ 'https://localhost:8082/issuecredential/actions' \ -H 'accept: application/json' --> { "actions": [ { "PIID": "752a7a05-4a74-4840-aad7-9db3fc953c5d", "Msg": { "@id": "986bcd39-d43f-44a0-a257-896ffc039c9f", "@type": "https://didcomm.org/issue-credential/2.0/request-credential", "~thread": { "thid": "752a7a05-4a74-4840-aad7-9db3fc953c5d" } }, "MyDID": "did:peer:1zQmSvQExh5t7GEBaXZUne1iqXW1Qyvh3QKE675q5tz1hkYW", "TheirDID": "did:peer:1zQmUFw8fitQ4GH6V3gvnkVgajhDmNJvPitqCLxbHaP164AM" } ] }

  • (Problem) Alice accept request curl -X 'POST' \ 'https://localhost:8082/issuecredential/752a7a05-4a74-4840-aad7-9db3fc953c5d/accept-request' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "issue_credential":{ "credentials~attach":[ { "lastmod_time":"0001-01-01T00:00:00Z", "data":{ "json":{ "@context":[ "https://www.w3.org/2018/credentials/v1", "https://www.w3.org/2018/credentials/examples/v1" ], "credentialSubject":{ "id":"sample-credential-subject-id" }, "id":"http://example.edu/credentials/1872", "issuanceDate":"2010-01-01T19:23:24Z", "issuer":{ "id":"did:peer:1zQmSvQExh5t7GEBaXZUne1iqXW1Qyvh3QKE675q5tz1hkYW", "name":"Example University" }, "referenceNumber":83294847, "type":[ "VerifiableCredential", "UniversityDegreeCredential" ] } } } ] } }' --> {} (code 200) But in the console of the Bob agent (docker container) --> [aries-framework/issuecredential/service] 2021/11/30 10:07:50 UTC - issuecredential.(*Service).startInternalListener -> ERROR abandoning: rfc0593: failed to fetch credential spec options to validate credential: failed to fetch options from store with threadID 752a7a05-4a74-4840-aad7-9db3fc953c5d: data not found

Expected result the credential is created and it is shown and can be accepted by Bob

Actual result Error in the docker container of agent Bob --> [aries-framework/issuecredential/service] 2021/11/30 10:07:50 UTC - issuecredential.(*Service).startInternalListener -> ERROR abandoning: rfc0593: failed to fetch credential spec options to validate credential: failed to fetch options from store with threadID 752a7a05-4a74-4840-aad7-9db3fc953c5d: data not found and the actions

  • Alice ("code": "rejected") --> curl -X 'GET' \ 'https://localhost:8082/issuecredential/actions' \ -H 'accept: application/json' --> { "actions": [ { "PIID": "752a7a05-4a74-4840-aad7-9db3fc953c5d", "Msg": { "@id": "798a8d8f-f910-497b-911e-bdd23c5c5be6", "@type": "https://didcomm.org/issue-credential/2.0/problem-report", "description": { "code": "rejected" }, "~thread": { "pthid": "752a7a05-4a74-4840-aad7-9db3fc953c5d" } }, "MyDID": "did:peer:1zQmSvQExh5t7GEBaXZUne1iqXW1Qyvh3QKE675q5tz1hkYW", "TheirDID": "did:peer:1zQmUFw8fitQ4GH6V3gvnkVgajhDmNJvPitqCLxbHaP164AM" } ] }

  • Bob --> curl -X 'GET' \ 'https://localhost:9082/issuecredential/actions' \ -H 'accept: application/json' --> { "actions": [] }

MajdT51 avatar Nov 30 '21 10:11 MajdT51

Did you resolve this issue? I have this same issue, I'm trying to create credential but when I make action POST request /issuecredential/104b5ec8-a61a-46a0-a49c-d132776f5bcc/accept-credential, the response is:

{ "code": 8004, "message": "get transitional payload: store get: failed to get DB entry: data not found" }

LuisaCastano avatar Jun 01 '22 16:06 LuisaCastano

I am having this issue as well using the latest release 0.1.8. The docker error is: [aries-framework/issuecredential/service] 2022/12/15 04:56:39 UTC - issuecredential.(*Service).startInternalListener -> ERROR abandoning: rfc0593: failed to fetch credential spec options to validate credential: failed to fetch options from store with threadID cb750b00-f766-4d65-a16b-eb0a5b845f87: data not found

bennichols avatar Dec 15 '22 05:12 bennichols

Hello all, please find attached the solution to this problem. We managed to resolve this issue. Apparently, when the procedure starts from the request-credential instead of offer-credential (as stated in the docs of the openapi demo) it works seamlessly. For example (let's assume that ALICE [8082] is the Holder and BOB [9082] is the Issuer). First the Holder (Alice) performs send-request:

curl -k -X 'POST' \
  'https://localhost:8082/issuecredential/send-request' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "my_did": "did:peer:1zQmfTJDjd4WkdcfgedhiAJSSnLSyM5p1J2VtzSwRyX7UBLr",
  "request_credential": {},
  "their_did": "did:peer:1zQmR8rgkf4PENHVRaPjyWQd6VdxBENEBB4nXBSVkuL1PPz1"
}

which gives a PIID. Then the Issuer (Bob) performs accept-request using the PID that found after invoking the actions endpoint:

curl -k -X POST "https://localhost:9082/issuecredential/42a9dee7-1582-49dc-a6e2-53ec6f40dc52/accept-request" \
-H  "accept: application/json" \
-H  "Content-Type: application/json" \
-d '{
   "issue_credential":{
      "credentials~attach":[
         {
            "lastmod_time":"0001-01-01T00:00:00Z",
            "data":{
               "json": {
                 "id" : "http://example.edu/credentials/1872",
                 "@context" : [
                   "https://www.w3.org/2018/credentials/v1",
                   "https://www.w3.org/2018/credentials/examples/v1"
                 ],
                 "type" : [
                   "VerifiableCredential",
                   "UniversityDegreeCredential"
                 ],
                 "issuer" : "did:peer:1zQmfTJDjd4WkdcfgedhiAJSSnLSyM5p1J2VtzSwRyX7UBLr",
                 "credentialSubject" : {
                   "firstName" : "Alice",
                   "givenName" : "Doe",
                   "email" : "[email protected]"
                 }
              }
            }
         }
      ]
   }
}'

Now the Holder (Alice) is able to find the newly issued credential after invoking the following command:

curl -k -s -X GET "https://localhost:8082/issuecredential/actions" -H  "accept: application/json" | jq -r .
{
  "actions": [
    {
      "PIID": "42a9dee7-1582-49dc-a6e2-53ec6f40dc52",
      "Msg": {
        "@id": "b4dca3be-9690-4ebd-af8b-3284ae56d22f",
        "@type": "https://didcomm.org/issue-credential/2.0/issue-credential",
        "credentials~attach": [
          {
            "data": {
              "json": {
                "@context": [
                  "https://www.w3.org/2018/credentials/v1",
                  "https://www.w3.org/2018/credentials/examples/v1"
                ],
                "credentialSubject": {
                  "email": "[email protected]",
                  "firstName": "Alice",
                  "givenName": "Doe"
                },
                "id": "http://example.edu/credentials/1872",
                "issuer": "did:peer:1zQmfTJDjd4WkdcfgedhiAJSSnLSyM5p1J2VtzSwRyX7UBLr",
                "type": [
                  "VerifiableCredential",
                  "UniversityDegreeCredential"
                ]
              }
            }
          }
        ],
        "~thread": {
          "thid": "42a9dee7-1582-49dc-a6e2-53ec6f40dc52"
        }
      },
      "MyDID": "did:peer:1zQmfTJDjd4WkdcfgedhiAJSSnLSyM5p1J2VtzSwRyX7UBLr",
      "TheirDID": "did:peer:1zQmR8rgkf4PENHVRaPjyWQd6VdxBENEBB4nXBSVkuL1PPz1"
    }
  ]
}

gmisiakoulis avatar Aug 21 '23 09:08 gmisiakoulis