diff --git a/acapy_plugin_toolbox/holder/v0_1/messages/pres_get_matching_credentials.py b/acapy_plugin_toolbox/holder/v0_1/messages/pres_get_matching_credentials.py index 7eb005e6..bc493398 100644 --- a/acapy_plugin_toolbox/holder/v0_1/messages/pres_get_matching_credentials.py +++ b/acapy_plugin_toolbox/holder/v0_1/messages/pres_get_matching_credentials.py @@ -62,6 +62,7 @@ async def handle(self, context: RequestContext, responder: BaseResponder): self.paginate.limit, extra_query={}, ), + presentation_request=pres_ex_record.presentation_request, page=Page(count_=self.paginate.limit, offset=self.paginate.offset), ) matches.assign_thread_from(self) diff --git a/acapy_plugin_toolbox/holder/v0_1/messages/pres_matching_credentials.py b/acapy_plugin_toolbox/holder/v0_1/messages/pres_matching_credentials.py index 416bf4e5..3993e414 100644 --- a/acapy_plugin_toolbox/holder/v0_1/messages/pres_matching_credentials.py +++ b/acapy_plugin_toolbox/holder/v0_1/messages/pres_matching_credentials.py @@ -6,6 +6,9 @@ from ....decorators.pagination import Page from ....util import expand_message_class, with_generic_init from .base import AdminHolderMessage +from aries_cloudagent.protocols.present_proof.v1_0.models.presentation_exchange import ( + V10PresentationExchange as PresExRecord, +) @with_generic_init @@ -21,6 +24,11 @@ class Fields: presentation_exchange_id = fields.Str( required=True, description="Exchange ID for matched credentials." ) + # TODO Use a toolbox PresentationExchangeRepresentation + presentation_request = fields.Mapping( + required=True, + description="Presentation Request associated with the Presentation Exchange ID.", + ) matching_credentials = fields.Nested( IndyCredPrecisSchema, many=True, description="Matched credentials." ) @@ -33,6 +41,7 @@ class Fields: def __init__( self, presentation_exchange_id: str, + presentation_request: PresExRecord, matching_credentials: Tuple[Any, ...], page: Page = None, **kwargs, @@ -40,5 +49,6 @@ def __init__( """Initialize PresMatchingCredentials""" super().__init__(**kwargs) self.presentation_exchange_id = presentation_exchange_id + self.presentation_request = presentation_request self.matching_credentials = matching_credentials self.page = page diff --git a/acapy_plugin_toolbox/holder/v0_1/messages/pres_request_received.py b/acapy_plugin_toolbox/holder/v0_1/messages/pres_request_received.py index 7dd25c21..d3e8bf18 100644 --- a/acapy_plugin_toolbox/holder/v0_1/messages/pres_request_received.py +++ b/acapy_plugin_toolbox/holder/v0_1/messages/pres_request_received.py @@ -27,7 +27,15 @@ class PresRequestReceived(AdminHolderMessage): class Fields: """Fields of Presentation request received message.""" - record = PresExRecordField(required=True, description="Presentation details.") + raw_repr = PresExRecordField(required=True, description="Presentation details.") + presentation_exchange_id = fields.Str( + required=True, description="Exchange ID for matched credentials." + ) + # TODO Use a toolbox PresentationExchangeRepresentation + presentation_request = fields.Mapping( + required=True, + description="Presentation Request associated with the Presentation Exchange ID.", + ) matching_credentials = fields.Nested( IndyCredPrecisSchema, many=True, @@ -39,13 +47,15 @@ class Fields: def __init__(self, record: PresExRecord, **kwargs): super().__init__(**kwargs) - self.record = record + self.raw_repr = record + self.presentation_request = record.presentation_request + self.presentation_exchange_id = record.presentation_exchange_id self.matching_credentials = [] self.page = None async def retrieve_matching_credentials(self, profile: Profile): holder = profile.inject(IndyHolder) - request = self.record.presentation_request + request = self.presentation_request if not (type(request) is dict): request = request.serialize()