async def make_agent_GET_request_response( self, topic, rec_id=None, text=False, params=None ) -> (int, str): if topic == "connection" and rec_id: connection_msg = pop_resource(rec_id, "connection-msg") i = 0 while connection_msg is None and i < MAX_TIMEOUT: sleep(1) connection_msg = pop_resource(rec_id, "connection-msg") i = i + 1 resp_status = 200 if connection_msg: resp_text = json.dumps(connection_msg) else: resp_text = "{}" return (resp_status, resp_text) return (501, '501: Not Implemented\n\n'.encode('utf8'))
async def make_agent_GET_request_response( self, command: BackchannelCommand ) -> Tuple[int, str]: record_id = command.record_id if command.topic == "connection" and record_id: connection_msg = pop_resource(record_id, "connection-msg") i = 0 while connection_msg is None and i < MAX_TIMEOUT: sleep(1) connection_msg = pop_resource(record_id, "connection-msg") i = i + 1 resp_status = 200 if connection_msg: resp_text = json.dumps(connection_msg) else: resp_text = "{}" return (resp_status, resp_text) return (501, "501: Not Implemented\n\n")
async def make_agent_GET_request_response(self, topic, rec_id=None, text=False, params=None) -> (int, str): if topic == "connection" and rec_id: connection_msg = pop_resource(rec_id, "connection-msg") i = 0 while connection_msg is None and i < MAX_TIMEOUT: sleep(1) connection_msg = pop_resource(rec_id, "connection-msg") i = i + 1 resp_status = 200 if connection_msg: resp_text = json.dumps(connection_msg) else: resp_text = "{}" return (resp_status, resp_text) elif topic == "issue-credential" and rec_id: credential_msg = pop_resource(rec_id, "credential-msg") i = 0 while credential_msg is None and i < MAX_TIMEOUT: sleep(1) credential_msg = pop_resource(rec_id, "credential-msg") i = i + 1 resp_status = 200 if credential_msg: resp_text = json.dumps(credential_msg) else: resp_text = "{}" return (resp_status, resp_text) elif topic == "credential" and rec_id: credential_msg = pop_resource(rec_id, "credential-msg") i = 0 while credential_msg is None and i < MAX_TIMEOUT: sleep(1) credential_msg = pop_resource(rec_id, "credential-msg") i = i + 1 resp_status = 200 if credential_msg: resp_text = json.dumps(credential_msg) else: resp_text = "{}" return (resp_status, resp_text) elif topic == "proof" and rec_id: presentation_msg = pop_resource(rec_id, "presentation-msg") i = 0 while presentation_msg is None and i < MAX_TIMEOUT: sleep(1) presentation_msg = pop_resource(rec_id, "presentation-msg") i = i + 1 resp_status = 200 if presentation_msg: resp_text = json.dumps(presentation_msg) if resp_status == 200: resp_text = self.agent_state_translation( topic, None, resp_text) else: resp_text = "{}" return (resp_status, resp_text) elif topic == "revocation-registry" and rec_id: revocation_msg = pop_resource(rec_id, "revocation-registry-msg") i = 0 while revocation_msg is None and i < MAX_TIMEOUT: sleep(1) revocation_msg = pop_resource(rec_id, "revocation-registry-msg") i = i + 1 resp_status = 200 if revocation_msg: resp_text = json.dumps(revocation_msg) else: resp_text = "{}" return (resp_status, resp_text) return (501, '501: Not Implemented\n\n'.encode('utf8'))