From 4443fedb9a345e584028b1edcac2b09acee6997e Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Fri, 14 May 2021 16:04:09 -0400 Subject: [PATCH 1/5] feat: update docker and requirements Signed-off-by: Daniel Bluhm --- demo/Dockerfile.demo | 26 +++++++++++++++----------- docker/Dockerfile | 20 ++++++++++---------- docker/README.md | 2 +- docker/default.yml | 2 ++ requirements.txt | 2 +- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/demo/Dockerfile.demo b/demo/Dockerfile.demo index 3dbf4744..ec33c707 100644 --- a/demo/Dockerfile.demo +++ b/demo/Dockerfile.demo @@ -1,21 +1,25 @@ -FROM bcgovimages/aries-cloudagent:py36-1.15-0_0.6.0rc0 +FROM bcgovimages/von-image:py36-1.16-0 + +# Make ACA-Py Install location more accessible +RUN ln -s $(pyenv prefix)/lib/python3.6/site-packages site-packages USER root -ADD acapy_plugin_toolbox aries-acapy-plugin-toolbox/acapy_plugin_toolbox -ADD requirements.txt aries-acapy-plugin-toolbox -ADD setup.py aries-acapy-plugin-toolbox -ADD README.md aries-acapy-plugin-toolbox -ADD demo/configs ./configs/ -ADD demo/ngrok-wait.sh ./ngrok-wait.sh -RUN chown -R indy:indy aries-acapy-plugin-toolbox +ADD https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 ./jq +RUN chmod +x ./jq +COPY demo/ngrok-wait.sh ./ngrok-wait.sh RUN chmod +x ngrok-wait.sh -ADD https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 ./jq -RUN chmod +x ./jq +ADD acapy_plugin_toolbox acapy_plugin_toolbox +ADD requirements.txt . +ADD setup.py . +ADD README.md . +ADD demo/configs ./configs/ + +RUN chown -R indy:indy . USER $user -RUN pip3 install -e ./aries-acapy-plugin-toolbox +RUN pip3 install -e . ENTRYPOINT ["/bin/bash", "-c", "./ngrok-wait.sh \"$@\"", "--"] CMD ["aca-py", "start", "--plugin", "acapy_plugin_toolbox", "--arg-file", "configs/default.yml"] diff --git a/docker/Dockerfile b/docker/Dockerfile index f70cc3a6..12458d3c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,18 +1,18 @@ -FROM bcgovimages/aries-cloudagent:py36-1.15-0_0.6.0rc0 +FROM bcgovimages/von-image:py36-1.16-0 + +# Make ACA-Py Install location more accessible +RUN ln -s $(pyenv prefix)/lib/python3.6/site-packages site-packages USER root -ADD acapy_plugin_toolbox aries-acapy-plugin-toolbox/acapy_plugin_toolbox -ADD requirements.txt aries-acapy-plugin-toolbox -ADD setup.py aries-acapy-plugin-toolbox -ADD README.md aries-acapy-plugin-toolbox +ADD acapy_plugin_toolbox acapy_plugin_toolbox +ADD requirements.txt . +ADD setup.py . +ADD README.md . ADD docker/default.yml . -RUN chown -R indy:indy aries-acapy-plugin-toolbox +RUN chown -R indy:indy . USER $user -# Make ACA-Py Install location more accessible -RUN ln -s /home/indy/.pyenv/versions/3.6.9/lib/python3.6/site-packages site-packages - -RUN pip3 install -e ./aries-acapy-plugin-toolbox +RUN pip3 install -e . ENTRYPOINT ["/bin/bash", "-c", "aca-py \"$@\"", "--"] CMD ["start", "--plugin", "acapy_plugin_toolbox", "--arg-file", "default.yml"] diff --git a/docker/README.md b/docker/README.md index 8656466d..f099efa3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -24,7 +24,7 @@ and/or the toolbox plugin (paths must be adapted to your environment): ```sh $ docker run -it -p 3000:3000 -p 3001:3001 --rm \ -v ../aries-cloudagent-python/aries_cloudagent:/home/indy/site-packages/aries_cloudagent:z \ - -v ../aries-acapy-plugin-toolbox/acapy_plugin_toolbox:/home/indy/aries-acapy-plugin-toolbox/acapy_plugin_toolbox:z \ + -v ./acapy_plugin_toolbox:/home/indy/acapy_plugin_toolbox:z \ acapy-toolbox ``` diff --git a/docker/default.yml b/docker/default.yml index 7a640697..938a1512 100644 --- a/docker/default.yml +++ b/docker/default.yml @@ -3,6 +3,8 @@ inbound-transport: outbound-transport: http endpoint: - http://localhost:3000 +plugin: + - acapy_plugin_toolbox no-ledger: true admin: [0.0.0.0, 3001] admin-insecure-mode: true diff --git a/requirements.txt b/requirements.txt index a9b649a4..98af1424 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aries-cloudagent[indy]@git+https://github.com/hyperledger/aries-cloudagent-python@1a276b521301021f7faacdf231851983b0b4d862 +aries-cloudagent==0.6.0 marshmallow==3.5.1 flake8 python-dateutil From 75d530ad80d6ef5c7438a1e0bee9da7146385a07 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Fri, 14 May 2021 19:24:23 -0400 Subject: [PATCH 2/5] fix: mediation and routing protocols after upstream changes Signed-off-by: Daniel Bluhm --- acapy_plugin_toolbox/mediator.py | 12 ++++++------ acapy_plugin_toolbox/routing.py | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/acapy_plugin_toolbox/mediator.py b/acapy_plugin_toolbox/mediator.py index 37fee8f9..fde51f6c 100644 --- a/acapy_plugin_toolbox/mediator.py +++ b/acapy_plugin_toolbox/mediator.py @@ -2,7 +2,7 @@ # pylint: disable=invalid-name # pylint: disable=too-few-public-methods -from aries_cloudagent.core.profile import ProfileSession +from aries_cloudagent.config.injection_context import InjectionContext from aries_cloudagent.core.protocol_registry import ProtocolRegistry from aries_cloudagent.messaging.base_handler import ( BaseHandler, BaseResponder, RequestContext @@ -56,12 +56,12 @@ async def setup( - session: ProfileSession, - protocol_registry: ProblemReport = None + context: InjectionContext, + protocol_registry: ProtocolRegistry = None ): """Setup the admin-mediator v1_0 plugin.""" if not protocol_registry: - protocol_registry = session.inject(ProtocolRegistry) + protocol_registry = context.inject(ProtocolRegistry) protocol_registry.register_message_types( MESSAGE_TYPES ) @@ -134,7 +134,7 @@ class MediationGrantHandler(BaseHandler): async def handle(self, context: RequestContext, responder: BaseResponder): """Handle mediation grant request.""" session = await context.session() - manager = MediationManager(session) + manager = MediationManager(session.profile) record = await MediationRecord.retrieve_by_id( session, context.message.mediation_id ) @@ -176,7 +176,7 @@ class MediationDenyHandler(BaseHandler): async def handle(self, context: RequestContext, responder: BaseResponder): """Handle mediation deny request.""" session = await context.session() - manager = MediationManager(session) + manager = MediationManager(session.profile) record = await MediationRecord.retrieve_by_id( session, context.message.mediation_id ) diff --git a/acapy_plugin_toolbox/routing.py b/acapy_plugin_toolbox/routing.py index c54c4fb7..7c6a5d34 100644 --- a/acapy_plugin_toolbox/routing.py +++ b/acapy_plugin_toolbox/routing.py @@ -2,8 +2,8 @@ # pylint: disable=invalid-name, too-few-public-methods +from aries_cloudagent.config.injection_context import InjectionContext from aries_cloudagent.connections.models.conn_record import ConnRecord -from aries_cloudagent.core.profile import ProfileSession from aries_cloudagent.core.protocol_registry import ProtocolRegistry from aries_cloudagent.messaging.base_handler import ( BaseHandler, BaseResponder, RequestContext @@ -55,12 +55,12 @@ async def setup( - session: ProfileSession, - protocol_registry: ProblemReport = None + context: InjectionContext, + protocol_registry: ProtocolRegistry = None ): """Setup the routing plugin.""" if not protocol_registry: - protocol_registry = session.inject(ProtocolRegistry) + protocol_registry = context.inject(ProtocolRegistry) protocol_registry.register_message_types( MESSAGE_TYPES ) @@ -133,7 +133,7 @@ class SendMediationRequestHandler(BaseHandler): async def handle(self, context: RequestContext, responder: BaseResponder): # Verify connection exists session = await context.session() - manager = MediationManager(session) + manager = MediationManager(session.profile) try: connection = await ConnRecord.retrieve_by_id( session, @@ -200,7 +200,7 @@ class KeylistUpdateSendHandler(BaseHandler): async def handle(self, context: RequestContext, responder: BaseResponder): """Handle KeylistUpdateSend messages.""" session = await context.session() - manager = MediationManager(session) + manager = MediationManager(session.profile) if context.message.action == KeylistUpdateRule.RULE_ADD: update = await manager.add_key( context.message.verkey, @@ -253,7 +253,7 @@ class RoutesGetHandler(BaseHandler): async def handle(self, context: RequestContext, responder: BaseResponder): """Handle RotuesGet.""" session = await context.session() - manager = MediationManager(session) + manager = MediationManager(session.profile) routes = Routes(routes=await manager.get_my_keylist(context.message.connection_id)) routes.assign_thread_from(context.message) await responder.send_reply(routes) From 12b0a2e4c644eadfa45af16805e4bb02ac0c2585 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 26 Apr 2021 14:02:43 -0400 Subject: [PATCH 3/5] feat: add pre-commit Signed-off-by: Daniel Bluhm --- .commitlint.config.js | 3 +++ .pre-commit-config.yaml | 19 +++++++++++++++++++ requirements.dev.txt | 1 + 3 files changed, 23 insertions(+) create mode 100644 .commitlint.config.js create mode 100644 .pre-commit-config.yaml create mode 100644 requirements.dev.txt diff --git a/.commitlint.config.js b/.commitlint.config.js new file mode 100644 index 00000000..c34aa79d --- /dev/null +++ b/.commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['@commitlint/config-conventional'] +}; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..1c72e986 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +--- +repos: + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v2.2.0 + hooks: + - id: commitlint + stages: [commit-msg] + args: ["--config", ".commitlint.config.js"] + additional_dependencies: ['@commitlint/config-conventional'] + - repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + stages: [commit] + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.0 + hooks: + - id: flake8 + stages: [commit] diff --git a/requirements.dev.txt b/requirements.dev.txt new file mode 100644 index 00000000..416634f5 --- /dev/null +++ b/requirements.dev.txt @@ -0,0 +1 @@ +pre-commit From 56941cdf8ed73ffcf3b447a31dbc13aa04dba50f Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Tue, 16 Feb 2021 16:28:21 -0500 Subject: [PATCH 4/5] feat: add setup with config for flake8 Signed-off-by: Daniel Bluhm --- setup.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..8fdac056 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ +[flake8] +# https://github.com/ambv/black#line-length +max-line-length = 90 +exclude = + */tests/** +extend_ignore = D202, W503 +per_file_ignores = */__init__.py:D104 From ed5aeabd81a916c6b4ba80887469edc7a5d085fb Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Fri, 14 May 2021 19:39:58 -0400 Subject: [PATCH 5/5] fix: from_indy_dict errors Signed-off-by: Daniel Bluhm --- acapy_plugin_toolbox/issuer.py | 233 +++++++++++++++------------------ 1 file changed, 106 insertions(+), 127 deletions(-) diff --git a/acapy_plugin_toolbox/issuer.py b/acapy_plugin_toolbox/issuer.py index 183be616..1c9d3a05 100644 --- a/acapy_plugin_toolbox/issuer.py +++ b/acapy_plugin_toolbox/issuer.py @@ -7,100 +7,85 @@ from aries_cloudagent.core.protocol_registry import ProtocolRegistry from aries_cloudagent.indy.util import generate_pr_nonce from aries_cloudagent.messaging.base_handler import ( - BaseHandler, BaseResponder, RequestContext + BaseHandler, + BaseResponder, + RequestContext, ) -from aries_cloudagent.messaging.credential_definitions.util import ( - CRED_DEF_TAGS -) -from aries_cloudagent.messaging.decorators.attach_decorator import ( - AttachDecorator -) -from aries_cloudagent.protocols.issue_credential.v1_0.manager import ( - CredentialManager -) -from aries_cloudagent.protocols.issue_credential.v1_0.messages.credential_proposal import ( - CredentialProposal +from aries_cloudagent.messaging.credential_definitions.util import CRED_DEF_TAGS +from aries_cloudagent.messaging.decorators.attach_decorator import AttachDecorator +from aries_cloudagent.protocols.issue_credential.v1_0.manager import CredentialManager +from aries_cloudagent.protocols.issue_credential.v1_0.messages.credential_proposal import ( # noqa: E501 + CredentialProposal, ) from aries_cloudagent.protocols.issue_credential.v1_0.models.credential_exchange import ( - V10CredentialExchange, V10CredentialExchangeSchema + V10CredentialExchange, + V10CredentialExchangeSchema, ) from aries_cloudagent.protocols.issue_credential.v1_0.routes import ( V10CredentialExchangeListResultSchema, - V10CredentialProposalRequestMandSchema -) -from aries_cloudagent.protocols.present_proof.v1_0.manager import ( - PresentationManager + V10CredentialProposalRequestMandSchema, ) +from aries_cloudagent.protocols.present_proof.v1_0.manager import PresentationManager from aries_cloudagent.protocols.present_proof.v1_0.message_types import ( - ATTACH_DECO_IDS, PRESENTATION_REQUEST + ATTACH_DECO_IDS, + PRESENTATION_REQUEST, ) from aries_cloudagent.protocols.present_proof.v1_0.messages.presentation_request import ( - PresentationRequest + PresentationRequest, ) from aries_cloudagent.protocols.present_proof.v1_0.models.presentation_exchange import ( - V10PresentationExchange, V10PresentationExchangeSchema + V10PresentationExchange, + V10PresentationExchangeSchema, ) from aries_cloudagent.protocols.present_proof.v1_0.routes import ( - V10PresentationExchangeListSchema, V10PresentationSendRequestRequestSchema -) -from aries_cloudagent.protocols.problem_report.v1_0.message import ( - ProblemReport + V10PresentationExchangeListSchema, + V10PresentationSendRequestRequestSchema, ) +from aries_cloudagent.protocols.problem_report.v1_0.message import ProblemReport from aries_cloudagent.storage.error import StorageNotFoundError from marshmallow import fields from .util import admin_only, generate_model_schema -PROTOCOL = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/admin-issuer/0.1' +PROTOCOL = "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/admin-issuer/0.1" -SEND_CREDENTIAL = '{}/send-credential'.format(PROTOCOL) -REQUEST_PRESENTATION = '{}/request-presentation'.format(PROTOCOL) -ISSUER_CRED_EXCHANGE = '{}/credential-exchange'.format(PROTOCOL) -ISSUER_PRES_EXCHANGE = '{}/presentation-exchange'.format(PROTOCOL) -CREDENTIALS_GET_LIST = '{}/credentials-get-list'.format(PROTOCOL) -CREDENTIALS_LIST = '{}/credentials-list'.format(PROTOCOL) -PRESENTATIONS_GET_LIST = '{}/presentations-get-list'.format(PROTOCOL) -PRESENTATIONS_LIST = '{}/presentations-list'.format(PROTOCOL) +SEND_CREDENTIAL = "{}/send-credential".format(PROTOCOL) +REQUEST_PRESENTATION = "{}/request-presentation".format(PROTOCOL) +ISSUER_CRED_EXCHANGE = "{}/credential-exchange".format(PROTOCOL) +ISSUER_PRES_EXCHANGE = "{}/presentation-exchange".format(PROTOCOL) +CREDENTIALS_GET_LIST = "{}/credentials-get-list".format(PROTOCOL) +CREDENTIALS_LIST = "{}/credentials-list".format(PROTOCOL) +PRESENTATIONS_GET_LIST = "{}/presentations-get-list".format(PROTOCOL) +PRESENTATIONS_LIST = "{}/presentations-list".format(PROTOCOL) MESSAGE_TYPES = { - SEND_CREDENTIAL: - 'acapy_plugin_toolbox.issuer.SendCred', - REQUEST_PRESENTATION: - 'acapy_plugin_toolbox.issuer.RequestPres', - CREDENTIALS_GET_LIST: - 'acapy_plugin_toolbox.issuer.CredGetList', - CREDENTIALS_LIST: - 'acapy_plugin_toolbox.issuer.CredList', - PRESENTATIONS_GET_LIST: - 'acapy_plugin_toolbox.issuer.PresGetList', - PRESENTATIONS_LIST: - 'acapy_plugin_toolbox.issuer.PresList', + SEND_CREDENTIAL: "acapy_plugin_toolbox.issuer.SendCred", + REQUEST_PRESENTATION: "acapy_plugin_toolbox.issuer.RequestPres", + CREDENTIALS_GET_LIST: "acapy_plugin_toolbox.issuer.CredGetList", + CREDENTIALS_LIST: "acapy_plugin_toolbox.issuer.CredList", + PRESENTATIONS_GET_LIST: "acapy_plugin_toolbox.issuer.PresGetList", + PRESENTATIONS_LIST: "acapy_plugin_toolbox.issuer.PresList", } -async def setup( - session: ProfileSession, - protocol_registry: ProblemReport = None -): +async def setup(session: ProfileSession, protocol_registry: ProblemReport = None): """Setup the issuer plugin.""" if not protocol_registry: protocol_registry = session.inject(ProtocolRegistry) - protocol_registry.register_message_types( - MESSAGE_TYPES - ) + protocol_registry.register_message_types(MESSAGE_TYPES) SendCred, SendCredSchema = generate_model_schema( - name='SendCred', - handler='acapy_plugin_toolbox.issuer.SendCredHandler', + name="SendCred", + handler="acapy_plugin_toolbox.issuer.SendCredHandler", msg_type=SEND_CREDENTIAL, - schema=V10CredentialProposalRequestMandSchema + schema=V10CredentialProposalRequestMandSchema, ) IssuerCredExchange, IssuerCredExchangeSchema = generate_model_schema( - name='IssuerCredExchange', - handler='acapy_plugin_toolbox.util.PassHandler', + name="IssuerCredExchange", + handler="acapy_plugin_toolbox.util.PassHandler", msg_type=ISSUER_CRED_EXCHANGE, - schema=V10CredentialExchangeSchema + schema=V10CredentialExchangeSchema, ) @@ -116,14 +101,10 @@ async def handle(self, context: RequestContext, responder: BaseResponder): session = await context.session() try: - conn_record = await ConnRecord.retrieve_by_id( - session, - connection_id - ) + conn_record = await ConnRecord.retrieve_by_id(session, connection_id) except StorageNotFoundError: report = ProblemReport( - explain_ltxt='Connection not found.', - who_retries='none' + explain_ltxt="Connection not found.", who_retries="none" ) report.assign_thread_from(context.message) await responder.send_reply(report) @@ -131,8 +112,7 @@ async def handle(self, context: RequestContext, responder: BaseResponder): if not conn_record.is_ready: report = ProblemReport( - explain_ltxt='Connection invalid.', - who_retries='none' + explain_ltxt="Connection invalid.", who_retries="none" ) report.assign_thread_from(context.message) await responder.send_reply(report) @@ -143,21 +123,22 @@ async def handle(self, context: RequestContext, responder: BaseResponder): credential_proposal=preview_spec, **{ t: getattr(context.message, t) - for t in CRED_DEF_TAGS if hasattr(context.message, t) + for t in CRED_DEF_TAGS + if hasattr(context.message, t) }, ) credential_manager = CredentialManager(context.profile) - cred_exchange_record, cred_offer_message = \ - await credential_manager.prepare_send( - connection_id, - credential_proposal=credential_proposal - ) + ( + cred_exchange_record, + cred_offer_message, + ) = await credential_manager.prepare_send( + connection_id, credential_proposal=credential_proposal + ) await responder.send( - cred_offer_message, - connection_id=cred_exchange_record.connection_id + cred_offer_message, connection_id=cred_exchange_record.connection_id ) cred_exchange = IssuerCredExchange(**cred_exchange_record.serialize()) cred_exchange.assign_thread_from(context.message) @@ -165,16 +146,16 @@ async def handle(self, context: RequestContext, responder: BaseResponder): RequestPres, RequestPresSchema = generate_model_schema( - name='RequestPres', - handler='acapy_plugin_toolbox.issuer.RequestPresHandler', + name="RequestPres", + handler="acapy_plugin_toolbox.issuer.RequestPresHandler", msg_type=REQUEST_PRESENTATION, schema=V10PresentationSendRequestRequestSchema, ) IssuerPresExchange, IssuerPresExchangeSchema = generate_model_schema( - name='IssuerPresExchange', - handler='acapy_plugin_toolbox.util.PassHandler', + name="IssuerPresExchange", + handler="acapy_plugin_toolbox.util.PassHandler", msg_type=ISSUER_PRES_EXCHANGE, - schema=V10PresentationExchangeSchema + schema=V10PresentationExchangeSchema, ) @@ -188,14 +169,10 @@ async def handle(self, context: RequestContext, responder: BaseResponder): connection_id = str(context.message.connection_id) session = await context.session() try: - conn_record = await ConnRecord.retrieve_by_id( - session, - connection_id - ) + conn_record = await ConnRecord.retrieve_by_id(session, connection_id) except StorageNotFoundError: report = ProblemReport( - explain_ltxt='Connection not found.', - who_retries='none' + explain_ltxt="Connection not found.", who_retries="none" ) report.assign_thread_from(context.message) await responder.send_reply(report) @@ -203,8 +180,7 @@ async def handle(self, context: RequestContext, responder: BaseResponder): if not conn_record.is_ready: report = ProblemReport( - explain_ltxt='Connection invalid.', - who_retries='none' + explain_ltxt="Connection invalid.", who_retries="none" ) report.assign_thread_from(context.message) await responder.send_reply(report) @@ -213,17 +189,17 @@ async def handle(self, context: RequestContext, responder: BaseResponder): comment = context.message.comment indy_proof_request = context.message.proof_request - if not indy_proof_request.get('nonce'): - indy_proof_request['nonce'] = await generate_pr_nonce() + if not indy_proof_request.get("nonce"): + indy_proof_request["nonce"] = await generate_pr_nonce() presentation_request_message = PresentationRequest( comment=comment, request_presentations_attach=[ - AttachDecorator.from_indy_dict( - indy_dict=indy_proof_request, - ident=ATTACH_DECO_IDS[PRESENTATION_REQUEST] + AttachDecorator.data_base64( + mapping=indy_proof_request, + ident=ATTACH_DECO_IDS[PRESENTATION_REQUEST], ) - ] + ], ) presentation_manager = PresentationManager(context.profile) @@ -231,14 +207,11 @@ async def handle(self, context: RequestContext, responder: BaseResponder): presentation_exchange_record = ( await presentation_manager.create_exchange_for_request( connection_id=connection_id, - presentation_request_message=presentation_request_message + presentation_request_message=presentation_request_message, ) ) - await responder.send( - presentation_request_message, - connection_id=connection_id - ) + await responder.send(presentation_request_message, connection_id=connection_id) pres_exchange = IssuerPresExchange(**presentation_exchange_record.serialize()) pres_exchange.assign_thread_from(context.message) @@ -246,21 +219,21 @@ async def handle(self, context: RequestContext, responder: BaseResponder): CredGetList, CredGetListSchema = generate_model_schema( - name='CredGetList', - handler='acapy_plugin_toolbox.issuer.CredGetListHandler', + name="CredGetList", + handler="acapy_plugin_toolbox.issuer.CredGetListHandler", msg_type=CREDENTIALS_GET_LIST, schema={ - 'connection_id': fields.Str(required=False), - 'cred_def_id': fields.Str(required=False), - 'schema_id': fields.Str(required=False) - } + "connection_id": fields.Str(required=False), + "cred_def_id": fields.Str(required=False), + "schema_id": fields.Str(required=False), + }, ) CredList, CredListSchema = generate_model_schema( - name='CredList', - handler='acapy_plugin_toolbox.util.PassHandler', + name="CredList", + handler="acapy_plugin_toolbox.util.PassHandler", msg_type=CREDENTIALS_LIST, - schema=V10CredentialExchangeListResultSchema + schema=V10CredentialExchangeListResultSchema, ) @@ -272,13 +245,16 @@ async def handle(self, context: RequestContext, responder: BaseResponder): """Handle received get cred list request.""" post_filter_positive = dict( - filter(lambda item: item[1] is not None, { - # 'state': V10CredentialExchange.STATE_ISSUED, - 'role': V10CredentialExchange.ROLE_ISSUER, - 'connection_id': context.message.connection_id, - 'credential_definition_id': context.message.cred_def_id, - 'schema_id': context.message.schema_id - }.items()) + filter( + lambda item: item[1] is not None, + { + # 'state': V10CredentialExchange.STATE_ISSUED, + "role": V10CredentialExchange.ROLE_ISSUER, + "connection_id": context.message.connection_id, + "credential_definition_id": context.message.cred_def_id, + "schema_id": context.message.schema_id, + }.items(), + ) ) session = await context.session() records = await V10CredentialExchange.query( @@ -289,18 +265,18 @@ async def handle(self, context: RequestContext, responder: BaseResponder): PresGetList, PresGetListSchema = generate_model_schema( - name='PresGetList', - handler='acapy_plugin_toolbox.issuer.PresGetListHandler', + name="PresGetList", + handler="acapy_plugin_toolbox.issuer.PresGetListHandler", msg_type=PRESENTATIONS_GET_LIST, schema={ - 'connection_id': fields.Str(required=False), - 'verified': fields.Str(required=False), - } + "connection_id": fields.Str(required=False), + "verified": fields.Str(required=False), + }, ) PresList, PresListSchema = generate_model_schema( - name='PresList', - handler='acapy_plugin_toolbox.util.PassHandler', + name="PresList", + handler="acapy_plugin_toolbox.util.PassHandler", msg_type=PRESENTATIONS_LIST, schema=V10PresentationExchangeListSchema # schema={ @@ -317,12 +293,15 @@ async def handle(self, context: RequestContext, responder: BaseResponder): """Handle received get cred list request.""" post_filter_positive = dict( - filter(lambda item: item[1] is not None, { - # 'state': V10PresentialExchange.STATE_CREDENTIAL_RECEIVED, - 'role': V10PresentationExchange.ROLE_VERIFIER, - 'connection_id': context.message.connection_id, - 'verified': context.message.verified, - }.items()) + filter( + lambda item: item[1] is not None, + { + # 'state': V10PresentialExchange.STATE_CREDENTIAL_RECEIVED, + "role": V10PresentationExchange.ROLE_VERIFIER, + "connection_id": context.message.connection_id, + "verified": context.message.verified, + }.items(), + ) ) session = await context.session() records = await V10PresentationExchange.query(