Skip to content

Commit

Permalink
Merge pull request #330 from sklump/pres-repeat-cred-def
Browse files Browse the repository at this point in the history
accommodate proofs with repeat cred defs, check for bait-and-switch b…
  • Loading branch information
andrewwhitehead authored Jan 20, 2020
2 parents 10db549 + 6b24a25 commit bb86a63
Show file tree
Hide file tree
Showing 10 changed files with 1,003 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
from .....storage.error import StorageNotFoundError

from ..manager import PresentationManager
from ..messages.presentation_proposal import PresentationProposal
from ..messages.presentation_request import PresentationRequest
from ..models.presentation_exchange import V10PresentationExchange
from ..util.indy import indy_proof_request2indy_requested_creds
from ..util.indy import indy_proof_req_preview2indy_requested_creds


class PresentationRequestHandler(BaseHandler):
Expand Down Expand Up @@ -41,7 +42,7 @@ async def handle(self, context: RequestContext, responder: BaseResponder):

indy_proof_request = context.message.indy_proof_request(0)

# Get credential exchange record (holder initiated via proposal)
# Get presentation exchange record (holder initiated via proposal)
# or create it (verifier sent request first)
try:
(
Expand Down Expand Up @@ -70,9 +71,18 @@ async def handle(self, context: RequestContext, responder: BaseResponder):

# If auto_present is enabled, respond immediately with presentation
if presentation_exchange_record.auto_present:
presentation_preview = None
if presentation_exchange_record.presentation_proposal_dict:
exchange_pres_proposal = PresentationProposal.deserialize(
presentation_exchange_record.presentation_proposal_dict
)
presentation_preview = exchange_pres_proposal.presentation_proposal

try:
req_creds = await indy_proof_request2indy_requested_creds(
indy_proof_request, await context.inject(BaseHolder)
req_creds = await indy_proof_req_preview2indy_requested_creds(
indy_proof_request,
presentation_preview,
holder=await context.inject(BaseHolder)
)
except ValueError as err:
self._logger.warning(f"{err}")
Expand Down
Loading

0 comments on commit bb86a63

Please sign in to comment.