Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accommodate proofs with repeat cred defs, check for bait-and-switch b… #330

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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