async def get_proof_records(cls, controller: AcaPyClient): try: presentation_exchange = await controller.present_proof_v1_0.get_records() return [record_to_model(rec) for rec in presentation_exchange.results or []] except Exception as e: logger.error(f"{e!r}") raise e from e
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)
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
async def send_proof_request( cls, controller: AcaPyClient, proof_request: SendProofRequest, ) -> PresentationExchange: presentation_exchange = await controller.present_proof_v2_0.send_request_free( body=V20PresSendRequestRequest( connection_id=proof_request.connection_id, presentation_request=V20PresRequestByFormat( dif=None, indy=proof_request.proof_request), )) return record_to_model(presentation_exchange)
async def create_proof_request( cls, controller: AcaPyClient, proof_request: CreateProofRequest, comment: Optional[str] = None, ) -> PresentationExchange: proof_record = await controller.present_proof_v2_0.create_proof_request( body=V20PresCreateRequestRequest( presentation_request=V20PresRequestByFormat( indy=proof_request.proof_request), comment=comment, trace=False, )) return record_to_model(proof_record)
async def create_proof_request( cls, controller: AcaPyClient, proof_request: CreateProofRequest, ) -> PresentationExchange: presentation_exchange = ( await controller.present_proof_v1_0.create_proof_request( body=V10PresentationCreateRequestRequest( proof_request=proof_request.proof_request, comment=proof_request.comment, trace=False, ) ) ) return record_to_model(presentation_exchange)
async def send_proof_request( cls, controller: AcaPyClient, proof_request: SendProofRequest, ) -> PresentationExchange: try: presentation_exchange = ( await controller.present_proof_v1_0.send_request_free( body=V10PresentationSendRequestRequest( connection_id=proof_request.connection_id, proof_request=proof_request.proof_request, ) ) ) return record_to_model(presentation_exchange) except Exception as e: logger.error(f"{e!r}") raise e from e