openwallet-foundation / acapy

ACA-Py is a foundation for building decentralized identity applications and services running in non-mobile environments.
https://aca-py.org
Apache License 2.0
419 stars 512 forks source link

Error with out-of-band protocol while self-issuance #3300

Open nb-vivek-bodar opened 1 month ago

nb-vivek-bodar commented 1 month ago

I am experiencing an error with out-of-band protocol while self issuing a credential.

Step to reproduce the error:

  1. Create credential offer for out-of-band.
  2. Create out-of-band invitation.
  3. Receive the above out-of-band invitation on the same agent.
  4. The error occurs.

Traceback (most recent call last): File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/protocols/didexchange/v1_0/handlers/complete_handler.py", line 24, in handle await mgr.accept_complete(context.message, context.message_receipt) File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/protocols/didexchange/v1_0/manager.py", line 1101, in accept_complete raise DIDXManagerError( aries_cloudagent.protocols.didexchange.v1_0.manager.DIDXManagerError: No corresponding connection request found 2024-10-11 10:22:18,734 aries_cloudagent.messaging.base_handler DEBUG PingHandler called with context <RequestContext(_connection_ready=None, _connection_record=None, _context=<aries_cloudagent.config.injection_context.InjectionContext object at 0x762212f2c590>, _message=<Ping(_message_id='969693d2-dcde-45f5-9c14-acda8c35a914', _message_new_id=False, _message_decorators=<DecoratorSet{}>, _message_type='https://didcomm.org/trust_ping/1.0/ping', comment=None, response_requested=True)>, _message_receipt=<MessageReceipt(_connection_id=None, _direct_response_mode=None, _in_time='2024-10-11T10:22:18.717732Z', _raw_message='{"@type": "https://didcomm.org/trust_ping/1.0/ping", "@id": "969693d2-dcde-45f5-9c14-acda8c35a914", "response_requested": true}', _recipient_verkey='GS7289PViEv47ajYHu9PrR6FYwH4hHFe1SVPhLX1kcUC', _recipient_did='VKHp1rp9oZDk55CdNogTKV', _recipient_did_public=None, _sender_did='42kq3TrFpHW4C74m2HMrQk', _sender_verkey='2enz1XgHkDsNaVfWi2i2jP1cLBeQtFUG68XEfKUT6ADr', _thread_id='969693d2-dcde-45f5-9c14-acda8c35a914', _parent_thread_id=None, didcomm_version=<DIDCommVersion.v1: 1>)>, _profile=<AskarProfile(backend=askar, name=brijeshholder_wallet)>)> 2024-10-11 10:22:18,734 aries_cloudagent.messaging.base_handler INFO Received trust ping from: 42kq3TrFpHW4C74m2HMrQk 2024-10-11 10:22:18,734 aries_cloudagent.messaging.base_handler INFO Connection not active, skipping ping response: 42kq3TrFpHW4C74m2HMrQk

aries_cloudagent.storage.error.StorageDuplicateError: Multiple OobRecord records located for {'invi_msg_id': 'a6754ffe-ca66-4f4f-bb86-76eb8e2d8c81'} 2024-10-11 10:13:49,607 aries_cloudagent.core.conductor ERROR DON'T shutdown on StorageDuplicateError Multiple OobRecord records located for {'invi_msg_id': 'a6754ffe-ca66-4f4f-bb86-76eb8e2d8c81'} 2024-10-11 10:13:49,607 aries_cloudagent.core.dispatcher ERROR Handler error: Dispatcher.handle_v1_message Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/tasks.py", line 314, in __step_run_and_handle_result result = coro.send(None) ^^^^^^^^^^^^^^^ File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/core/dispatcher.py", line 252, in handle_v1_message await handler(context, responder) File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/protocols/issue_credential/v2_0/handlers/cred_offer_handler.py", line 46, in handle oob_record = await oob_processor.find_oob_record_for_inbound_message(context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/core/oob_processor.py", line 135, in find_oob_record_for_inbound_message oob_record = await OobRecord.retrieve_by_tag_filter( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/messaging/models/base_record.py", line 272, in retrieve_by_tag_filter

Environment

jamshale commented 1 month ago

Could you give examples of your payloads for POST /issue-credential-2.0/create-offer and POST /out-of-band/create-invitation endpoints please? Usually a connection is established first, and then that connection is used to issue the credential. You may be trying to do something that isn't tested properly, or not supported.

nb-vivek-bodar commented 1 month ago

POST /issue-credential-2.0/create-offer

Request Body:

{
    "auto_remove": true,
    "comment": "check self issuance is working with out-of-band",
    "credential_preview": {
        "@type": "issue-credential/2.0/credential-preview",
        "attributes": [
            {
                "name": "mentor",
                "value": "Brijesh"
            },
            {
                "name": "class",
                "value": "9"
            },
            {
                "name": "lecture",
                "value": "english"
            }
        ]
    },
    "filter": {
        "indy": {
            "cred_def_id": "NWa3baz2639nCDhWmyGkfq:3:CL:2284523:school_info1",
            "issuer_did": "NWa3baz2639nCDhWmyGkfq",
            "schema_id": "NWa3baz2639nCDhWmyGkfq:2:school_info:1.0",
            "schema_issuer_did": "NWa3baz2639nCDhWmyGkfq",
            "schema_name": "school_info",
            "schema_version": "1.0"
        }
    },
    "trace": true
}

POST /out-of-band/create-invitation

Request Body:


{
  "accept": [
    "didcomm/aip2;env=rfc19"
  ],
  "attachments": [
    {
      "id": "45623b15-f212-4704-bb79-eb0b39fc4ecd",
      "type": "credential-offer"
    }
  ]
}
jamshale commented 4 weeks ago

I believe self issuance and adding a credential offer as an attachment should work and this is an issue.

However, If the use case allows creating the connection with itself first and then sending a credential offer with POST /issue-credential-2.0/send-offer. Then you should be able to complete self issuance.