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

Propose credential issue, Faber is not receiving attributes #788

Closed
ChSonendra opened this issue May 23, 2022 · 6 comments · Fixed by #798
Closed

Propose credential issue, Faber is not receiving attributes #788

ChSonendra opened this issue May 23, 2022 · 6 comments · Fixed by #798
Assignees

Comments

@ChSonendra
Copy link

ChSonendra commented May 23, 2022

So I was trying credential flow from Holder's end that is a mobile app built using AFJ framework....

After creating a connection with a ACA-py agent, i called proposeCredential with following arguments.

  1. connection id
  2. config =
 {
{"connectionId":"cc0ca9fa-8e64-448e-94ae-a493e30af08a","protocolVersion":"1.0","credentialFormats":{"indy":{"attributes":[{"mime-type":"text/plain","name":"name","value":"Bob"},{"mime-type":"text/plain","name":"date","value":"20"},{"mime-type":"text/plain","name":"timestamp","value":"frekjfhre"},{"mime-type":"text/plain","name":"degree","value":"vjhvbfvf"},{"mime-type":"text/plain","name":"birthdate_dateint","value":"Ferfregvr"}],"credentialDefinitionId":"VcBnKNRdLZg6EV6WTZj859:3:CL:132941:faber.agent.degree_schema","payload":{"schemaIssuerDid":"VcBnKNRdLZg6EV6WTZj859","schemaName":"degree schema","schemaVersion":"27.78.90","schemaId":"VcBnKNRdLZg6EV6WTZj859:2:degree schema:27.78.90","issuerDid":"VcBnKNRdLZg6EV6WTZj859"}}},"comment":"v1 propose credential test"}
}

and what i got on backend (Faber's end) is

 {
      "auto_remove": false,
      "credential_proposal_dict": {
        "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/propose-credential",
        "@id": "eff2354b-5438-4c29-8025-61a48925dc49",
        "comment": "v1 propose credential test"
      },
      "connection_id": "3271e5ee-821e-4616-ab7c-e1f5d9920152",
      "thread_id": "eff2354b-5438-4c29-8025-61a48925dc49",
      "credential_exchange_id": "3f1a15ef-f95c-42a0-a791-78b9c571f11d",
      "initiator": "external",
      "state": "proposal_received",
      "updated_at": "2022-05-23T10:33:38.429209Z",
      "role": "issuer",
      "created_at": "2022-05-23T10:33:38.429209Z",
      "trace": false
    }

faber didn't got attributes and other stuff just very limited stuff that is msg type and id of message.
after that i made changes in the credentialService and manually attached schemaId cred_def_id and other required stuff..
so this faber got most of the things except attributes for credential.... so I cant get the issue why this is happening.

so I added these line in credentialServices.ts after line number 64

       proposalMessage.attributes = config.credentialFormats.indy.attributes;
        proposalMessage.schemaId = config.credentialFormats.indy.payload.schemaId;  
        proposalMessage.credentialDefinitionId = config.credentialFormats.indy.credentialDefinitionId;
        proposalMessage.schemaName = config.credentialFormats.indy.payload.schemaName;
        proposalMessage.schemaVersion = config.credentialFormats.indy.payload.schemaVersion;
        proposalMessage.issuerDid = config.credentialFormats.indy.payload.issuerDid;
        proposalMessage.schemaIssuerDid = config.credentialFormats.indy.payload.schemaIssuerDid;

this was the response at Faber's end.

{
  {
      "auto_remove": false,
      "credential_proposal_dict": {
        "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/propose-credential",
        "@id": "163453fd-6b49-4c70-bb52-bbf6e8349928",
        "comment": "v1 propose credential test",
        "schema_id": "6Yi6jBBHNiUwiMv96SSkjf:2:degree schema:84.76.25",
        "schema_version": "84.76.25",
        "schema_name": "degree schema",
        "issuer_did": "6Yi6jBBHNiUwiMv96SSkjf",
        "schema_issuer_did": "6Yi6jBBHNiUwiMv96SSkjf",
        "cred_def_id": "6Yi6jBBHNiUwiMv96SSkjf:3:CL:132168:faber.agent.degree_schema"
      },
      "connection_id": "3271e5ee-821e-4616-ab7c-e1f5d9920152",
      "thread_id": "163453fd-6b49-4c70-bb52-bbf6e8349928",
      "credential_exchange_id": "bbfceda2-855a-4ef5-a293-1fe89d566020",
      "initiator": "external",
      "state": "proposal_received",
      "updated_at": "2022-05-23T10:45:21.948607Z",
      "role": "issuer",
      "created_at": "2022-05-23T10:45:21.948607Z",
      "trace": false
    }
}

so when i tried sending a credential offer from faber's end then this expected error occurred
which is attributes not found.

AttributeError: 'NoneType' object has no attribute 'attr_dict'
Faber      | 2022-05-23 10:54:08,395 aiohttp.server ERROR Error handling request
Faber      | Traceback (most recent call last):
Faber      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
Faber      |     resp = await request_handler(request)
Faber      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiohttp/web_app.py", line 504, in _handle
Faber      |     resp = await handler(request)
Faber      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 117, in impl
Faber      |     return await handler(request)
Faber      |   File "/home/indy/aries_cloudagent/admin/server.py", line 159, in ready_middleware
Faber      |     return await handler(request)
Faber      |   File "/home/indy/aries_cloudagent/admin/server.py", line 196, in debug_middleware
Faber      |     return await handler(request)
Faber      |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiohttp_apispec/middlewares.py", line 45, in validation_middleware
Faber      |     return await handler(request)
Faber      |   File "/home/indy/aries_cloudagent/admin/server.py", line 384, in setup_context
Faber      |     return await task
Faber      |   File "/home/indy/aries_cloudagent/protocols/issue_credential/v1_0/routes.py", line 913, in credential_exchange_send_bound_offer
Faber      |     comment=None,
Faber      |   File "/home/indy/aries_cloudagent/protocols/issue_credential/v1_0/manager.py", line 285, in create_offer
Faber      |     preview_attrs = {attr for attr in credential_preview.attr_dict()}
Faber      | AttributeError: 'NoneType' object has no attribute 'attr_dict'

can anyone suggest something to make things work??

@TimoGlastra
Copy link
Contributor

@NB-MikeRichardson can you take a look at this? Looking at the V1CredentialService the values are indeed not being set correctly

@NB-MikeRichardson
Copy link
Contributor

I have investigated this and I found the issue. I have tested a fix and added new tests to ensure propose message attributes are present.

We will have the fix merged into AFJ main branch as soon as possible.

@ChSonendra
Copy link
Author

Thank You both @NB-MikeRichardson and @TimoGlastra for considering and looking into this issue.

@TimoGlastra
Copy link
Contributor

@ChSonendra this should have been fixed in v0.2.0-alpha.89. Could you please test if it works with this version? Thanks!

@ChSonendra
Copy link
Author

Yes @TimoGlastra, I will test and confirm you this at earliest. Thanks!

@ChSonendra
Copy link
Author

ChSonendra commented May 27, 2022

I did upgraded the framework to v0.2.0-alpha.90 so after that upgradation when I tried making connection with a new agent and it said cannot find this function receiveInvitationFromUrl and when i looked for it in connectionModule.js a lot of functionality was missing... couldn't really understood what exactly is going wrong.. I tried installing the framework many times but same issue. "functionality was missing "

the functionality missing in connection module is

receiveInvitation
receiveInvitationFromUrl
acceptInvitation
createConnection

so all these functionalities are missing

@TimoGlastra can You help me on this or suggest some help.

agent.connections.receiveInvitationFromUrl is not a function. (In 'agent.connections.receiveInvitationFromUrl(e.data, {
autoAcceptConnection: true
})

So some functionality in the framework is missing. this screenshot shows connectionModule.js file which is missing some functions.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants