Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #100 from frostyfrog/feature/matching-creds-pres-req
Browse files Browse the repository at this point in the history
Add presentation request to the "get-matching-credentials" call
  • Loading branch information
dbluhm authored Oct 8, 2021
2 parents 43035f2 + a592142 commit 21de362
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
)
Expand All @@ -33,12 +41,14 @@ class Fields:
def __init__(
self,
presentation_exchange_id: str,
presentation_request: PresExRecord,
matching_credentials: Tuple[Any, ...],
page: Page = None,
**kwargs,
):
"""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
16 changes: 13 additions & 3 deletions acapy_plugin_toolbox/holder/v0_1/messages/pres_request_received.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down

0 comments on commit 21de362

Please sign in to comment.