コード例 #1
0
 async def delete_proof(cls, controller: AcaPyClient, proof_id: str):
     try:
         pres_ex_id = pres_id_no_version(proof_id=proof_id)
         await controller.present_proof_v1_0.delete_record(pres_ex_id=pres_ex_id)
     except Exception as e:
         logger.error(f"{e!r}")
         raise e from e
コード例 #2
0
 async def accept_proof_request(
     cls, controller: AcaPyClient, proof_request: AcceptProofRequest
 ) -> PresentationExchange:
     proof_id = pres_id_no_version(proof_id=proof_request.proof_id)
     presentation_record = await controller.present_proof_v1_0.send_presentation(
         pres_ex_id=proof_id, body=proof_request.presentation_spec
     )
     return record_to_model(presentation_record)
コード例 #3
0
 async def get_credentials_for_request(cls, controller: AcaPyClient,
                                       proof_id: str):
     try:
         pres_ex_id = pres_id_no_version(proof_id=proof_id)
         return await controller.present_proof_v2_0.get_matching_credentials(
             pres_ex_id=pres_ex_id)
     except Exception as e:
         logger.error(f"{e!r}")
         raise e from e
コード例 #4
0
 async def get_proof_record(cls, controller: AcaPyClient, proof_id: str):
     try:
         pres_ex_id = pres_id_no_version(proof_id)
         presentation_exchange = await controller.present_proof_v2_0.get_record(
             pres_ex_id=pres_ex_id)
         return record_to_model(presentation_exchange)
     except Exception as e:
         logger.error(f"{e!r}")
         raise e from e
コード例 #5
0
    async def reject_proof_request(cls, controller: AcaPyClient,
                                   proof_request: RejectProofRequest) -> None:
        # get the record
        pres_ex_id = pres_id_no_version(proof_id=proof_request.proof_id)
        # Report problem if desired
        if proof_request.problem_report:
            try:
                await controller.present_proof_v2_0.report_problem(
                    pres_ex_id=pres_ex_id,
                    body=V20PresProblemReportRequest(
                        description=proof_request.problem_report),
                )
            except Exception as e:
                raise e from e

        try:
            # delete exchange record
            await controller.present_proof_v2_0.delete_record(
                pres_ex_id=pres_ex_id)
        except:
            raise HTTPException(status_code=500,
                                detail="Failed to delete record")