diff --git a/aries_cloudagent/admin/server.py b/aries_cloudagent/admin/server.py index 3580eb37c5..0e5c68dca8 100644 --- a/aries_cloudagent/admin/server.py +++ b/aries_cloudagent/admin/server.py @@ -30,7 +30,7 @@ class AdminModulesSchema(Schema): """Schema for the modules endpoint.""" result = fields.List( - fields.Str(description="admin module"), description="List of admin modules", + fields.Str(description="admin module"), description="List of admin modules" ) @@ -377,7 +377,11 @@ async def websocket_handler(self, request): receive = loop.create_task(ws.receive()) if send.done(): - msg = send.result() + try: + msg = send.result() + except asyncio.TimeoutError: + msg = None + if msg is None: # we send fake pings because the JS client # can't detect real ones diff --git a/aries_cloudagent/protocols/actionmenu/message_types.py b/aries_cloudagent/protocols/actionmenu/message_types.py index 9dc9907645..5a006de1aa 100644 --- a/aries_cloudagent/protocols/actionmenu/message_types.py +++ b/aries_cloudagent/protocols/actionmenu/message_types.py @@ -6,12 +6,21 @@ MENU_REQUEST = f"{PROTOCOL_URI}/menu-request" PERFORM = f"{PROTOCOL_URI}/perform" +NEW_PROTOCOL_URI = "https://didcomm.org/action-menu/1.0" + +NEW_MENU = f"{NEW_PROTOCOL_URI}/menu" +NEW_MENU_REQUEST = f"{NEW_PROTOCOL_URI}/menu-request" +NEW_PERFORM = f"{NEW_PROTOCOL_URI}/perform" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.actionmenu" MESSAGE_TYPES = { MENU: f"{PROTOCOL_PACKAGE}.messages.menu.Menu", MENU_REQUEST: (f"{PROTOCOL_PACKAGE}.messages.menu_request.MenuRequest"), PERFORM: f"{PROTOCOL_PACKAGE}.messages.perform.Perform", + NEW_MENU: f"{PROTOCOL_PACKAGE}.messages.menu.Menu", + NEW_MENU_REQUEST: (f"{PROTOCOL_PACKAGE}.messages.menu_request.MenuRequest"), + NEW_PERFORM: f"{PROTOCOL_PACKAGE}.messages.perform.Perform", } CONTROLLERS = {PROTOCOL_URI: f"{PROTOCOL_PACKAGE}.controller.Controller"} diff --git a/aries_cloudagent/protocols/actionmenu/messages/menu.py b/aries_cloudagent/protocols/actionmenu/messages/menu.py index 6c08791329..ae713a8dd3 100644 --- a/aries_cloudagent/protocols/actionmenu/messages/menu.py +++ b/aries_cloudagent/protocols/actionmenu/messages/menu.py @@ -54,7 +54,7 @@ class Meta: model_class = Menu - title = fields.Str(required=False, description="Menu title", example="My Menu",) + title = fields.Str(required=False, description="Menu title", example="My Menu") description = fields.Str( required=False, description="Introductory text for the menu", diff --git a/aries_cloudagent/protocols/basicmessage/message_types.py b/aries_cloudagent/protocols/basicmessage/message_types.py index 1a2937b31e..4c793d23eb 100644 --- a/aries_cloudagent/protocols/basicmessage/message_types.py +++ b/aries_cloudagent/protocols/basicmessage/message_types.py @@ -4,8 +4,13 @@ BASIC_MESSAGE = f"{PROTOCOL_URI}/message" +NEW_PROTOCOL_URI = "https://didcomm.org/basicmessage/1.0" + +NEW_BASIC_MESSAGE = f"{NEW_PROTOCOL_URI}/message" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.basicmessage" MESSAGE_TYPES = { - BASIC_MESSAGE: f"{PROTOCOL_PACKAGE}.messages.basicmessage.BasicMessage" + BASIC_MESSAGE: f"{PROTOCOL_PACKAGE}.messages.basicmessage.BasicMessage", + NEW_BASIC_MESSAGE: f"{PROTOCOL_PACKAGE}.messages.basicmessage.BasicMessage", } diff --git a/aries_cloudagent/protocols/connections/message_types.py b/aries_cloudagent/protocols/connections/message_types.py index 330f5b9a6e..92cae00ce4 100644 --- a/aries_cloudagent/protocols/connections/message_types.py +++ b/aries_cloudagent/protocols/connections/message_types.py @@ -7,6 +7,13 @@ CONNECTION_RESPONSE = f"{PROTOCOL_URI}/response" PROBLEM_REPORT = f"{PROTOCOL_URI}/problem_report" +NEW_PROTOCOL_URI = "https://didcomm.org/connections/1.0" + +NEW_CONNECTION_INVITATION = f"{NEW_PROTOCOL_URI}/invitation" +NEW_CONNECTION_REQUEST = f"{NEW_PROTOCOL_URI}/request" +NEW_CONNECTION_RESPONSE = f"{NEW_PROTOCOL_URI}/response" +NEW_PROBLEM_REPORT = f"{NEW_PROTOCOL_URI}/problem_report" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.connections" MESSAGE_TYPES = { @@ -20,4 +27,14 @@ f"{PROTOCOL_PACKAGE}.messages.connection_response.ConnectionResponse" ), PROBLEM_REPORT: f"{PROTOCOL_PACKAGE}.messages.problem_report.ProblemReport", + NEW_CONNECTION_INVITATION: ( + f"{PROTOCOL_PACKAGE}.messages.connection_invitation.ConnectionInvitation" + ), + NEW_CONNECTION_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.connection_request.ConnectionRequest" + ), + NEW_CONNECTION_RESPONSE: ( + f"{PROTOCOL_PACKAGE}.messages.connection_response.ConnectionResponse" + ), + NEW_PROBLEM_REPORT: f"{PROTOCOL_PACKAGE}.messages.problem_report.ProblemReport", } diff --git a/aries_cloudagent/protocols/connections/messages/connection_invitation.py b/aries_cloudagent/protocols/connections/messages/connection_invitation.py index d6286cb273..87c8b2c6dd 100644 --- a/aries_cloudagent/protocols/connections/messages/connection_invitation.py +++ b/aries_cloudagent/protocols/connections/messages/connection_invitation.py @@ -98,7 +98,7 @@ class Meta: model_class = ConnectionInvitation label = fields.Str( - required=False, description="Optional label for connection", example="Bob", + required=False, description="Optional label for connection", example="Bob" ) did = fields.Str( required=False, description="DID for connection invitation", **INDY_DID diff --git a/aries_cloudagent/protocols/connections/messages/connection_request.py b/aries_cloudagent/protocols/connections/messages/connection_request.py index a965cc069c..d30a550146 100644 --- a/aries_cloudagent/protocols/connections/messages/connection_request.py +++ b/aries_cloudagent/protocols/connections/messages/connection_request.py @@ -51,7 +51,7 @@ class Meta: model_class = ConnectionRequest - connection = fields.Nested(ConnectionDetailSchema, required=True,) + connection = fields.Nested(ConnectionDetailSchema, required=True) label = fields.Str( required=True, description="Label for connection request", diff --git a/aries_cloudagent/protocols/credentials/message_types.py b/aries_cloudagent/protocols/credentials/message_types.py index fb54c03e10..13c285cdff 100644 --- a/aries_cloudagent/protocols/credentials/message_types.py +++ b/aries_cloudagent/protocols/credentials/message_types.py @@ -7,6 +7,13 @@ CREDENTIAL_ISSUE = f"{PROTOCOL_URI}/credential-issue" CREDENTIAL_STORED = f"{PROTOCOL_URI}/credential-stored" +NEW_PROTOCOL_URI = "https://didcomm.org/credential-issuance/0.1" + +NEW_CREDENTIAL_OFFER = f"{NEW_PROTOCOL_URI}/credential-offer" +NEW_CREDENTIAL_REQUEST = f"{NEW_PROTOCOL_URI}/credential-request" +NEW_CREDENTIAL_ISSUE = f"{NEW_PROTOCOL_URI}/credential-issue" +NEW_CREDENTIAL_STORED = f"{NEW_PROTOCOL_URI}/credential-stored" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.credentials" MESSAGE_TYPES = { @@ -18,4 +25,16 @@ CREDENTIAL_STORED: ( f"{PROTOCOL_PACKAGE}.messages.credential_stored.CredentialStored" ), + NEW_CREDENTIAL_OFFER: ( + f"{PROTOCOL_PACKAGE}.messages.credential_offer.CredentialOffer" + ), + NEW_CREDENTIAL_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.credential_request.CredentialRequest" + ), + NEW_CREDENTIAL_ISSUE: ( + f"{PROTOCOL_PACKAGE}.messages.credential_issue.CredentialIssue" + ), + NEW_CREDENTIAL_STORED: ( + f"{PROTOCOL_PACKAGE}.messages.credential_stored.CredentialStored" + ), } diff --git a/aries_cloudagent/protocols/discovery/message_types.py b/aries_cloudagent/protocols/discovery/message_types.py index f02f403e7c..d7107d9e8c 100644 --- a/aries_cloudagent/protocols/discovery/message_types.py +++ b/aries_cloudagent/protocols/discovery/message_types.py @@ -5,9 +5,16 @@ DISCLOSE = f"{PROTOCOL_URI}/disclose" QUERY = f"{PROTOCOL_URI}/query" +NEW_PROTOCOL_URI = "https://didcomm.org/discover-features/1.0" + +NEW_DISCLOSE = f"{NEW_PROTOCOL_URI}/disclose" +NEW_QUERY = f"{NEW_PROTOCOL_URI}/query" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.discovery" MESSAGE_TYPES = { DISCLOSE: f"{PROTOCOL_PACKAGE}.messages.disclose.Disclose", QUERY: f"{PROTOCOL_PACKAGE}.messages.query.Query", + NEW_DISCLOSE: f"{PROTOCOL_PACKAGE}.messages.disclose.Disclose", + NEW_QUERY: f"{PROTOCOL_PACKAGE}.messages.query.Query", } diff --git a/aries_cloudagent/protocols/introduction/message_types.py b/aries_cloudagent/protocols/introduction/message_types.py index 2a2de8a7a5..c189bbe79a 100644 --- a/aries_cloudagent/protocols/introduction/message_types.py +++ b/aries_cloudagent/protocols/introduction/message_types.py @@ -6,6 +6,12 @@ INVITATION = f"{PROTOCOL_URI}/invitation" FORWARD_INVITATION = f"{PROTOCOL_URI}/forward-invitation" +NEW_PROTOCOL_URI = "https://didcomm.org/introduction-service/0.1" + +NEW_INVITATION_REQUEST = f"{NEW_PROTOCOL_URI}/invitation-request" +NEW_INVITATION = f"{NEW_PROTOCOL_URI}/invitation" +NEW_FORWARD_INVITATION = f"{NEW_PROTOCOL_URI}/forward-invitation" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.introduction" MESSAGE_TYPES = { @@ -16,4 +22,11 @@ FORWARD_INVITATION: ( f"{PROTOCOL_PACKAGE}.messages.forward_invitation.ForwardInvitation" ), + NEW_INVITATION_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.invitation_request.InvitationRequest" + ), + NEW_INVITATION: f"{PROTOCOL_PACKAGE}.messages.invitation.Invitation", + NEW_FORWARD_INVITATION: ( + f"{PROTOCOL_PACKAGE}.messages.forward_invitation.ForwardInvitation" + ), } diff --git a/aries_cloudagent/protocols/introduction/messages/forward_invitation.py b/aries_cloudagent/protocols/introduction/messages/forward_invitation.py index 5ec0f7051b..e07dddc10b 100644 --- a/aries_cloudagent/protocols/introduction/messages/forward_invitation.py +++ b/aries_cloudagent/protocols/introduction/messages/forward_invitation.py @@ -50,7 +50,7 @@ class Meta: model_class = ForwardInvitation - invitation = fields.Nested(ConnectionInvitationSchema(), required=True,) + invitation = fields.Nested(ConnectionInvitationSchema(), required=True) message = fields.Str( required=False, allow_none=True, diff --git a/aries_cloudagent/protocols/introduction/messages/invitation.py b/aries_cloudagent/protocols/introduction/messages/invitation.py index 68289b2cb4..2795849810 100644 --- a/aries_cloudagent/protocols/introduction/messages/invitation.py +++ b/aries_cloudagent/protocols/introduction/messages/invitation.py @@ -48,7 +48,7 @@ class Meta: model_class = Invitation - invitation = fields.Nested(ConnectionInvitationSchema(), required=True,) + invitation = fields.Nested(ConnectionInvitationSchema(), required=True) message = fields.Str( required=False, description="Comments on the introduction", diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/message_types.py b/aries_cloudagent/protocols/issue_credential/v1_0/message_types.py index 999b9449ed..d1b2fdee07 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/message_types.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/message_types.py @@ -10,6 +10,16 @@ CREDENTIAL_ISSUE = f"{PROTOCOL_URI}/issue-credential" CREDENTIAL_ACK = f"{PROTOCOL_URI}/ack" +NEW_PROTOCOL_URI = "https://didcomm.org/issue-credential/1.0" + +# Message types + +NEW_CREDENTIAL_PROPOSAL = f"{NEW_PROTOCOL_URI}/propose-credential" +NEW_CREDENTIAL_OFFER = f"{NEW_PROTOCOL_URI}/offer-credential" +NEW_CREDENTIAL_REQUEST = f"{NEW_PROTOCOL_URI}/request-credential" +NEW_CREDENTIAL_ISSUE = f"{NEW_PROTOCOL_URI}/issue-credential" +NEW_CREDENTIAL_ACK = f"{NEW_PROTOCOL_URI}/ack" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.issue_credential.v1_0" MESSAGE_TYPES = { @@ -21,7 +31,20 @@ f"{PROTOCOL_PACKAGE}.messages.credential_request.CredentialRequest" ), CREDENTIAL_ISSUE: f"{PROTOCOL_PACKAGE}.messages.credential_issue.CredentialIssue", - CREDENTIAL_ACK: (f"{PROTOCOL_PACKAGE}.messages.credential_ack.CredentialAck"), + CREDENTIAL_ACK: f"{PROTOCOL_PACKAGE}.messages.credential_ack.CredentialAck", + NEW_CREDENTIAL_PROPOSAL: ( + f"{PROTOCOL_PACKAGE}.messages.credential_proposal.CredentialProposal" + ), + NEW_CREDENTIAL_OFFER: ( + f"{PROTOCOL_PACKAGE}.messages.credential_offer.CredentialOffer" + ), + NEW_CREDENTIAL_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.credential_request.CredentialRequest" + ), + NEW_CREDENTIAL_ISSUE: ( + f"{PROTOCOL_PACKAGE}.messages.credential_issue.CredentialIssue" + ), + NEW_CREDENTIAL_ACK: f"{PROTOCOL_PACKAGE}.messages.credential_ack.CredentialAck", } # Inner object types diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_proposal.py b/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_proposal.py index 2c6502fbcb..23b2f35202 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_proposal.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/messages/credential_proposal.py @@ -79,36 +79,11 @@ class Meta: comment = fields.Str(required=False, allow_none=False) credential_proposal = fields.Nested( - CredentialPreviewSchema, - required=False, - allow_none=False, - ) - schema_id = fields.Str( - required=False, - allow_none=False, - **INDY_SCHEMA_ID - ) - schema_issuer_did = fields.Str( - required=False, - allow_none=False, - **INDY_DID - ) - schema_name = fields.Str( - required=False, - allow_none=False, - ) - schema_version = fields.Str( - required=False, - allow_none=False, - **INDY_VERSION - ) - cred_def_id = fields.Str( - required=False, - allow_none=False, - **INDY_CRED_DEF_ID - ) - issuer_did = fields.Str( - required=False, - allow_none=False, - **INDY_DID + CredentialPreviewSchema, required=False, allow_none=False ) + schema_id = fields.Str(required=False, allow_none=False, **INDY_SCHEMA_ID) + schema_issuer_did = fields.Str(required=False, allow_none=False, **INDY_DID) + schema_name = fields.Str(required=False, allow_none=False) + schema_version = fields.Str(required=False, allow_none=False, **INDY_VERSION) + cred_def_id = fields.Str(required=False, allow_none=False, **INDY_CRED_DEF_ID) + issuer_did = fields.Str(required=False, allow_none=False, **INDY_DID) diff --git a/aries_cloudagent/protocols/present_proof/v1_0/message_types.py b/aries_cloudagent/protocols/present_proof/v1_0/message_types.py index 89841292bd..d8b17b045b 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/message_types.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/message_types.py @@ -9,6 +9,15 @@ PRESENTATION = f"{PROTOCOL_URI}/presentation" PRESENTATION_ACK = f"{PROTOCOL_URI}/ack" +NEW_PROTOCOL_URI = "https://didcomm.org/present-proof/1.0" + +# New Message types + +NEW_PRESENTATION_PROPOSAL = f"{NEW_PROTOCOL_URI}/propose-presentation" +NEW_PRESENTATION_REQUEST = f"{NEW_PROTOCOL_URI}/request-presentation" +NEW_PRESENTATION = f"{NEW_PROTOCOL_URI}/presentation" +NEW_PRESENTATION_ACK = f"{NEW_PROTOCOL_URI}/ack" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.present_proof.v1_0" MESSAGE_TYPES = { @@ -20,6 +29,15 @@ ), PRESENTATION: f"{PROTOCOL_PACKAGE}.messages.presentation.Presentation", PRESENTATION_ACK: f"{PROTOCOL_PACKAGE}.messages.presentation_ack.PresentationAck", + NEW_PRESENTATION_PROPOSAL: ( + f"{PROTOCOL_PACKAGE}.messages.presentation_proposal.PresentationProposal" + ), + NEW_PRESENTATION_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.presentation_request.PresentationRequest" + ), + NEW_PRESENTATION: f"{PROTOCOL_PACKAGE}.messages.presentation.Presentation", + NEW_PRESENTATION_ACK: f"{PROTOCOL_PACKAGE}.messages" + + ".presentation_ack.PresentationAck", } # Inner object types diff --git a/aries_cloudagent/protocols/presentations/message_types.py b/aries_cloudagent/protocols/presentations/message_types.py index 6964f8c705..f327c9c193 100644 --- a/aries_cloudagent/protocols/presentations/message_types.py +++ b/aries_cloudagent/protocols/presentations/message_types.py @@ -5,6 +5,11 @@ PRESENTATION_REQUEST = f"{PROTOCOL_URI}/presentation-request" CREDENTIAL_PRESENTATION = f"{PROTOCOL_URI}/credential-presentation" +NEW_PROTOCOL_URI = "https://didcomm.org/credential-presentation/0.1" + +NEW_PRESENTATION_REQUEST = f"{NEW_PROTOCOL_URI}/presentation-request" +NEW_CREDENTIAL_PRESENTATION = f"{NEW_PROTOCOL_URI}/credential-presentation" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.presentations" MESSAGE_TYPES = { @@ -14,4 +19,10 @@ CREDENTIAL_PRESENTATION: ( f"{PROTOCOL_PACKAGE}.messages.credential_presentation.CredentialPresentation" ), + NEW_PRESENTATION_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.presentation_request.PresentationRequest" + ), + NEW_CREDENTIAL_PRESENTATION: ( + f"{PROTOCOL_PACKAGE}.messages.credential_presentation.CredentialPresentation" + ), } diff --git a/aries_cloudagent/protocols/problem_report/message.py b/aries_cloudagent/protocols/problem_report/message.py index 76a8fd5e3d..8588e8477b 100644 --- a/aries_cloudagent/protocols/problem_report/message.py +++ b/aries_cloudagent/protocols/problem_report/message.py @@ -85,7 +85,7 @@ class Meta: example="did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/error-codes", ) locale = fields.Str( - data_key="@locale", required=False, description="Locale", example="en-US", + data_key="@locale", required=False, description="Locale", example="en-US" ) explain_ltxt = fields.Str( data_key="explain-ltxt", diff --git a/aries_cloudagent/protocols/problem_report/message_types.py b/aries_cloudagent/protocols/problem_report/message_types.py index 67bcfbb4b7..3cedf40124 100644 --- a/aries_cloudagent/protocols/problem_report/message_types.py +++ b/aries_cloudagent/protocols/problem_report/message_types.py @@ -4,6 +4,13 @@ PROBLEM_REPORT = f"{PROTOCOL_URI}/problem-report" +NEW_PROTOCOL_URI = "https://didcomm.org/notification/1.0" + +NEW_PROBLEM_REPORT = f"{NEW_PROTOCOL_URI}/problem-report" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.problem_report" -MESSAGE_TYPES = {PROBLEM_REPORT: f"{PROTOCOL_PACKAGE}.message.ProblemReport"} +MESSAGE_TYPES = { + PROBLEM_REPORT: f"{PROTOCOL_PACKAGE}.message.ProblemReport", + NEW_PROBLEM_REPORT: f"{PROTOCOL_PACKAGE}.message.ProblemReport" +} diff --git a/aries_cloudagent/protocols/routing/message_types.py b/aries_cloudagent/protocols/routing/message_types.py index 51419998f3..051b45de5f 100644 --- a/aries_cloudagent/protocols/routing/message_types.py +++ b/aries_cloudagent/protocols/routing/message_types.py @@ -9,6 +9,15 @@ ROUTE_UPDATE_REQUEST = f"{PROTOCOL_URI}/route-update-request" ROUTE_UPDATE_RESPONSE = f"{PROTOCOL_URI}/route-update-response" +NEW_PROTOCOL_URI = "https://didcomm.org/routing/1.0" + +NEW_FORWARD = f"{NEW_PROTOCOL_URI}/forward" + +NEW_ROUTE_QUERY_REQUEST = f"{NEW_PROTOCOL_URI}/route-query-request" +NEW_ROUTE_QUERY_RESPONSE = f"{NEW_PROTOCOL_URI}/route-query-response" +NEW_ROUTE_UPDATE_REQUEST = f"{NEW_PROTOCOL_URI}/route-update-request" +NEW_ROUTE_UPDATE_RESPONSE = f"{NEW_PROTOCOL_URI}/route-update-response" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.routing" MESSAGE_TYPES = { @@ -25,4 +34,17 @@ ROUTE_UPDATE_RESPONSE: ( f"{PROTOCOL_PACKAGE}.messages.route_update_response.RouteUpdateResponse" ), + NEW_FORWARD: f"{PROTOCOL_PACKAGE}.messages.forward.Forward", + NEW_ROUTE_QUERY_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.route_query_request.RouteQueryRequest" + ), + NEW_ROUTE_QUERY_RESPONSE: ( + f"{PROTOCOL_PACKAGE}.messages.route_query_response.RouteQueryResponse" + ), + NEW_ROUTE_UPDATE_REQUEST: ( + f"{PROTOCOL_PACKAGE}.messages.route_update_request.RouteUpdateRequest" + ), + NEW_ROUTE_UPDATE_RESPONSE: ( + f"{PROTOCOL_PACKAGE}.messages.route_update_response.RouteUpdateResponse" + ), } diff --git a/aries_cloudagent/protocols/routing/messages/route_query_request.py b/aries_cloudagent/protocols/routing/messages/route_query_request.py index 5a98cf8c61..51e6bdaac2 100644 --- a/aries_cloudagent/protocols/routing/messages/route_query_request.py +++ b/aries_cloudagent/protocols/routing/messages/route_query_request.py @@ -46,7 +46,7 @@ class Meta: filter = fields.Dict( keys=fields.Str(description="field"), values=fields.List( - fields.Str(description="value"), description="List of values", + fields.Str(description="value"), description="List of values" ), required=False, allow_none=True, diff --git a/aries_cloudagent/protocols/trustping/message_types.py b/aries_cloudagent/protocols/trustping/message_types.py index 498a98efaa..19a19efcef 100644 --- a/aries_cloudagent/protocols/trustping/message_types.py +++ b/aries_cloudagent/protocols/trustping/message_types.py @@ -5,9 +5,16 @@ PING = f"{PROTOCOL_URI}/ping" PING_RESPONSE = f"{PROTOCOL_URI}/ping_response" +NEW_PROTOCOL_URI = "https://didcomm.org/trust_ping/1.0" + +NEW_PING = f"{NEW_PROTOCOL_URI}/ping" +NEW_PING_RESPONSE = f"{NEW_PROTOCOL_URI}/ping_response" + PROTOCOL_PACKAGE = "aries_cloudagent.protocols.trustping" MESSAGE_TYPES = { PING: f"{PROTOCOL_PACKAGE}.messages.ping.Ping", PING_RESPONSE: f"{PROTOCOL_PACKAGE}.messages.ping_response.PingResponse", + NEW_PING: f"{PROTOCOL_PACKAGE}.messages.ping.Ping", + NEW_PING_RESPONSE: f"{PROTOCOL_PACKAGE}.messages.ping_response.PingResponse", } diff --git a/demo/AriesOpenAPIDemo.md b/demo/AriesOpenAPIDemo.md index b4e5de269e..718e626104 100644 --- a/demo/AriesOpenAPIDemo.md +++ b/demo/AriesOpenAPIDemo.md @@ -31,7 +31,7 @@ This demo is for developers comfortable with playing around with APIs using the ## Running in a Browser -T + We will get started by getting three browser tabs ready that will be used throughout the lab. Two will be Swagger UIs for the Faber and Alice Agent and one for the Public Ledger (showing the Hyperledger Indy ledger). In your browser, go to the docker playground service [Play with VON](http://play-with-von.vonx.io) (from the BC Gov). On the title screen, click "Start". On the next screen, click (in the left menu) "+Add a new instance". That will start up a terminal in your browser. Run the following commands to start the Faber agent. It is not a typo that the last line has "faber" in it. We're just borrowing that script to get started. @@ -182,11 +182,39 @@ OK, the one time setup work for issuing a credential complete. We can now issue ## Issuing a Credential -Issuing a credential from the Faber agent to Alice’s agent is done with another API call. In the Faber browser tab, scroll down to the **`POST /issue-credential/send`** and get ready to (but don’t yet) execute the request. Before execution, you need to find some other data to complete the JSON.Keep a notepad ready to copy the data you find. +Issuing a credential from the Faber agent to Alice’s agent is done with another API call. In the Faber browser tab, scroll down to the **`POST /issue-credential/send`** and get ready to (but don’t yet) execute the request. Before execution, you need to find some other data to complete the JSON. Keep a notepad ready to copy the data you find. + +First, scroll back up to the **`GET /connections`** API endpoint and execute it. From the result, find the the `connection_id` and copy the value. + +
+ Click here to see a screenshot + Connection ID +
+ +A little trickier to find is the `cred_def_id`. Go back to the terminal where you started the Faber agent, and scroll back until you see the text `#3/4 Create a new schema/cred def on the ledger` and then just below that `Cred def ID:`. Copy the text following that label. While you are at it, copy the text following the label `Schema ID:` as well. + +
+ Show me a screenshot! + Cred Def and Schema ID +
+ +Note: Another way to get the `cred_def_id` is to find it by searching the Indy network transactions posted to the ledger browser app. That works well if you are running locally by clicking the `Domain` link and using the search feature. However, that approach is harder to do when running in the browser, because there are many credential definitions on that ledger instance. + +Now scroll up the terminal till you see the text `#1 Provision an agent and wallet, get back configuration details`. Below that you see `Public DID Information:` displayed in the Faber Agent banner. Copy the text after the label `-DID:`. This is the public did of Faber Agent. In our case, its the DID of the schema issuer. + +
+ Show me where I can find the issuer DID + Issuer DID +
+ +You'll also need this to track down the schema issued by Faber Agent on the `Domain` ledger. We'll do this next. Go to your ledger URL (It is [http://dev.greenlight.bcovrin.vonx.io](http://dev.greenlight.bcovrin.vonx.io) in case you are running this demo from the browser), refresh the page (important), and in the top right corner, select `Type:` as `SCHEMA`. This will filter out transactions of type `SCHEMA`. Typically there are thousands of them displayed in pages of 10. Go to the last page, scroll down to the end and look for the entry in which the `Signed by:` value in the `Message Wrapper` is the same as the public DID of Faber Agent. From the `Transaction` section of this entry, copy the values of `Schema name:` and `Schema version:` -First, scroll back up to the **`GET /connections`** API endpoint and execute it. From the result, find the the `connection_id` and copy the value. A little trickier to find is the `cred_def_id`. Go back to the terminal where you started the Faber agent, and scroll back until you see the text `#3/4 Create a new schema/cred def on the ledger` and then just below that `Cred def ID:`. Copy the text following that label. Another way to get the `cred_def_id` is to find it by searching the Indy network transactions posted to the ledger browser app. That works well if you are running locally by clicking the `Domain` link and using the search feature. However, that approach is harder to do when running in the browser, because there are many credential definitions on that ledger instance. While you are at it, copy the text following the label `Schema ID:` as well. Now scroll up the terminal till you see the text `#1 Provision an agent and wallet, get back configuration details`. Below that you see `Public DID Information:` displayed in the Faber Agent banner. Copy the text after the label `-DID:`. This is the public did of Faber Agent. In our case, its the DID of the schema issuer. You'll also need this to track down the schema issued by Faber Agent on the `Domain` ledger. We'll do this next. +
+ Click here to see where you can find schema related information + Schema Info +
-Go to your ledger URL (It is [http://dev.greenlight.bcovrin.vonx.io](http://dev.greenlight.bcovrin.vonx.io) in case you are running this demo from the browser), refresh the page (important), and in the top right corner, select `Type:` as `SCHEMA`. This will filter out transactions of type `SCHEMA`. Typically there are thousands of them displayed in pages of 10. Go to the last page, scroll down to the end and look for the entry in which the `Signed by:` value in the `Message Wrapper` is the same as the public DID of Faber Agent. From the `Transaction` section of this entry, copy the values of `Schema name:` and `Schema version:` We now have (almost) all the information we need to fill in the JSON. The good news is that the hard part is done. +We now have (almost) all the information we need to fill in the JSON. The good news is that the hard part is done. Use the data that you gathered in the steps above to fill in the vales for `schema_issuer_did:` (the public DID of Faber Agent), `schema_id:` (the text following `Schema ID:` that you scraped off the Faber Agent terminal), `cred_def_id:` (the text following `Cred def ID:` scraped off the Faber Agent terminal), `issuer_did:` (the public DID of Faber Agent), `schema_name` and `schema_version` (values copied from the schema entry of the `Domain` ledger). diff --git a/demo/collateral/conn-id.png b/demo/collateral/conn-id.png new file mode 100644 index 0000000000..2b2c7ca66e Binary files /dev/null and b/demo/collateral/conn-id.png differ diff --git a/demo/collateral/cred-def-id.png b/demo/collateral/cred-def-id.png new file mode 100644 index 0000000000..2ee3c110c1 Binary files /dev/null and b/demo/collateral/cred-def-id.png differ diff --git a/demo/collateral/issuer-did.png b/demo/collateral/issuer-did.png new file mode 100644 index 0000000000..e3b5cc6b7b Binary files /dev/null and b/demo/collateral/issuer-did.png differ diff --git a/demo/collateral/schema-name-version.png b/demo/collateral/schema-name-version.png new file mode 100644 index 0000000000..248699c947 Binary files /dev/null and b/demo/collateral/schema-name-version.png differ diff --git a/demo/run_demo b/demo/run_demo index 6650be5716..1fb51b5ceb 100755 --- a/demo/run_demo +++ b/demo/run_demo @@ -4,35 +4,31 @@ shopt -s nocasematch cd $(dirname $0) +AGENT="$1" +shift +ARGS="" + for i in "$@" do case $i in --events) EVENTS=1 - shift - ;; - --no-auto) - NO_AUTO=1 - shift + continue ;; - *) - AGENT="$i" - shift + --timing) + if [ ! -d "../logs" ]; then + mkdir ../logs && chmod -R uga+rws ../logs + fi + if [ "$(ls -ld ../logs | grep dr..r..rwx)" == "" ]; then + echo "Error: To use the --timing parameter, the directory '../logs' must exist and all users must be able to write to it." + echo "For example, to create the directory and then set the permissions use: 'mkdir ../logs; chmod uga+rws ../logs'" + exit 1 + fi ;; esac + ARGS="${ARGS:+$ARGS }$i" done -case "$@" in *--timing*) - if [ ! -d "../logs" ]; then - mkdir ../logs && chmod -R uga+rws ../logs - fi - if [ "$(ls -ld ../logs | grep dr..r..rwx)" == "" ]; then - echo "Error: To use the --timing parameter, the directory '../logs' must exist and all users must be able to write to it." - echo "For example, to create the directory and then set the permissions use: 'mkdir ../logs; chmod uga+rws ../logs'" - exit 1 - fi -esac - if [ "$AGENT" = "faber" ]; then AGENT_MODULE="faber" AGENT_PORT=8020 @@ -89,13 +85,9 @@ fi if ! [ -z "$GENESIS_URL" ]; then DOCKER_ENV="${DOCKER_ENV} -e GENESIS_URL=${GENESIS_URL}" fi - if ! [ -z "$EVENTS" ]; then DOCKER_ENV="${DOCKER_ENV} -e EVENTS=1" fi -if ! [ -z "$NO_AUTO" ]; then - DOCKER_ENV="${DOCKER_ENV} -e NO_AUTO=1" -fi # on Windows, docker run needs to be prefixed by winpty if [ "$OSTYPE" = "msys" ]; then @@ -108,4 +100,4 @@ $DOCKER run --name $AGENT --rm -it \ -p 0.0.0.0:$AGENT_PORT_RANGE:$AGENT_PORT_RANGE \ -v "/$(pwd)/../logs:/home/indy/logs" \ $DOCKER_ENV \ - faber-alice-demo $AGENT_MODULE --port $AGENT_PORT $@ + faber-alice-demo $AGENT_MODULE --port $AGENT_PORT $ARGS diff --git a/demo/runners/alice.py b/demo/runners/alice.py index 8cfd5b2352..f5ab30f326 100644 --- a/demo/runners/alice.py +++ b/demo/runners/alice.py @@ -25,16 +25,20 @@ class AliceAgent(DemoAgent): - def __init__(self, http_port: int, admin_port: int, **kwargs): + def __init__( + self, http_port: int, admin_port: int, no_auto: bool = False, **kwargs + ): super().__init__( "Alice Agent", http_port, admin_port, prefix="Alice", - extra_args=[] if os.getenv("NO_AUTO") else [ + extra_args=[] + if no_auto + else [ "--auto-accept-invites", "--auto-accept-requests", - "--auto-store-credential" + "--auto-store-credential", ], seed=None, **kwargs, @@ -74,12 +78,12 @@ async def handle_issue_credential(self, message): if state == "offer_received": log_status("#15 After receiving credential offer, send credential request") await self.admin_POST( - "/issue-credential/records/" f"{credential_exchange_id}/send-request" + f"/issue-credential/records/{credential_exchange_id}/send-request" ) elif state == "credential_acked": - self.log("Stored credential {cred_id} in wallet") cred_id = message["credential_id"] + self.log(f"Stored credential {cred_id} in wallet") log_status(f"#18.1 Stored credential {cred_id} in wallet") resp = await self.admin_GET(f"/credential/{cred_id}") log_json(resp, label="Credential details:") @@ -205,7 +209,7 @@ async def input_invitation(agent): await agent.detect_connection() -async def main(start_port: int, show_timing: bool = False): +async def main(start_port: int, no_auto: bool = False, show_timing: bool = False): genesis = await default_genesis_txns() if not genesis: @@ -217,7 +221,11 @@ async def main(start_port: int, show_timing: bool = False): try: log_status("#7 Provision an agent and wallet, get back configuration details") agent = AliceAgent( - start_port, start_port + 1, genesis_data=genesis, timing=show_timing + start_port, + start_port + 1, + genesis_data=genesis, + no_auto=no_auto, + timing=show_timing, ) await agent.listen_webhooks(start_port + 2) @@ -271,6 +279,7 @@ async def main(start_port: int, show_timing: bool = False): import argparse parser = argparse.ArgumentParser(description="Runs an Alice demo agent.") + parser.add_argument("--no-auto", action="store_true", help="Disable auto issuance") parser.add_argument( "-p", "--port", @@ -287,6 +296,8 @@ async def main(start_port: int, show_timing: bool = False): require_indy() try: - asyncio.get_event_loop().run_until_complete(main(args.port, args.timing)) + asyncio.get_event_loop().run_until_complete( + main(args.port, args.no_auto, args.timing) + ) except KeyboardInterrupt: os._exit(1) diff --git a/demo/runners/faber.py b/demo/runners/faber.py index 2bd60e9bbe..a68de3db27 100644 --- a/demo/runners/faber.py +++ b/demo/runners/faber.py @@ -28,16 +28,17 @@ class FaberAgent(DemoAgent): - def __init__(self, http_port: int, admin_port: int, **kwargs): + def __init__( + self, http_port: int, admin_port: int, no_auto: bool = False, **kwargs + ): super().__init__( "Faber Agent", http_port, admin_port, prefix="Faber", - extra_args=[] if os.getenv("NO_AUTO") else [ - "--auto-accept-invites", - "--auto-accept-requests" - ], + extra_args=[] + if no_auto + else ["--auto-accept-invites", "--auto-accept-requests"], **kwargs, ) self.connection_id = None @@ -117,7 +118,7 @@ async def handle_basicmessages(self, message): self.log("Received message:", message["content"]) -async def main(start_port: int, show_timing: bool = False): +async def main(start_port: int, no_auto: bool = False, show_timing: bool = False): genesis = await default_genesis_txns() if not genesis: @@ -129,7 +130,11 @@ async def main(start_port: int, show_timing: bool = False): try: log_status("#1 Provision an agent and wallet, get back configuration details") agent = FaberAgent( - start_port, start_port + 1, genesis_data=genesis, timing=show_timing + start_port, + start_port + 1, + genesis_data=genesis, + no_auto=no_auto, + timing=show_timing, ) await agent.listen_webhooks(start_port + 2) await agent.register_did() @@ -277,6 +282,7 @@ async def main(start_port: int, show_timing: bool = False): import argparse parser = argparse.ArgumentParser(description="Runs a Faber demo agent.") + parser.add_argument("--no-auto", action="store_true", help="Disable auto issuance") parser.add_argument( "-p", "--port", @@ -293,6 +299,8 @@ async def main(start_port: int, show_timing: bool = False): require_indy() try: - asyncio.get_event_loop().run_until_complete(main(args.port, args.timing)) + asyncio.get_event_loop().run_until_complete( + main(args.port, args.no_auto, args.timing) + ) except KeyboardInterrupt: os._exit(1) diff --git a/demo/runners/support/agent.py b/demo/runners/support/agent.py index cbc76e36f7..8e845133eb 100644 --- a/demo/runners/support/agent.py +++ b/demo/runners/support/agent.py @@ -24,8 +24,9 @@ event_stream_handler = logging.StreamHandler() event_stream_handler.setFormatter(logging.Formatter("\nEVENT: %(message)s")) +DEBUG_EVENTS = os.getenv("EVENTS") EVENT_LOGGER = logging.getLogger("event") -EVENT_LOGGER.setLevel(logging.DEBUG if os.getenv("EVENTS") else logging.NOTSET) +EVENT_LOGGER.setLevel(logging.DEBUG if DEBUG_EVENTS else logging.NOTSET) EVENT_LOGGER.addHandler(event_stream_handler) EVENT_LOGGER.propagate = False @@ -55,6 +56,16 @@ DEFAULT_PYTHON_PATH = "." +class repr_json: + def __init__(self, val): + self.val = val + + def __repr__(self) -> str: + if isinstance(self.val, str): + return self.val + return json.dumps(self.val, indent=4) + + async def default_genesis_txns(): genesis = None try: @@ -338,7 +349,11 @@ async def handle_webhook(self, topic: str, payload): handler = f"handle_{topic}" method = getattr(self, handler, None) if method: - EVENT_LOGGER.debug(f"Agent called controller webhook: {handler}" + f" with payload: \n{json.dumps(payload, indent=4)}" if payload else "") + EVENT_LOGGER.debug( + "Agent called controller webhook: %s%s", + handler, + (f" with payload: \n{repr_json(payload)}" if payload else ""), + ) asyncio.get_event_loop().create_task(method(payload)) else: log_msg( @@ -367,9 +382,12 @@ async def admin_request( async def admin_GET(self, path, text=False, params=None) -> ClientResponse: try: - EVENT_LOGGER.debug(f"Controller GET {path} request to Agent") + EVENT_LOGGER.debug("Controller GET %s request to Agent", path) response = await self.admin_request("GET", path, None, text, params) - EVENT_LOGGER.debug(f"Response from GET {path} received: \n{json.dumps(response, indent=4)}") + EVENT_LOGGER.debug( + "Response from GET %s received: \n%s", path, repr_json(response), + ) + return response except ClientError as e: self.log(f"Error during GET {path}: {str(e)}") raise @@ -378,9 +396,15 @@ async def admin_POST( self, path, data=None, text=False, params=None ) -> ClientResponse: try: - EVENT_LOGGER.debug(f"Controller POST {path} request to Agent" + f" with data: \n{json.dumps(data, indent=4)}" if data else ""); - response = await self.admin_request("POST", path, data, text, params) - EVENT_LOGGER.debug(f"Response from POST {path} received: \n{json.dumps(response, indent=4)}"); + EVENT_LOGGER.debug( + "Controller POST %s request to Agent%s", + path, + (" with data: \n{}".format(repr_json(data)) if data else ""), + ) + response = await self.admin_request("POST", path, data, text, params) + EVENT_LOGGER.debug( + "Response from POST %s received: \n%s", path, repr_json(response), + ) return response except ClientError as e: self.log(f"Error during POST {path}: {str(e)}")