From 292b199de96edbe1190a9b4ddeae3678105f4ce4 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 1 Mar 2021 21:34:26 -0500 Subject: [PATCH] fix: credential labels Signed-off-by: Daniel Bluhm --- acapy_plugin_toolbox/holder.py | 36 ++++------------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/acapy_plugin_toolbox/holder.py b/acapy_plugin_toolbox/holder.py index 0743ac3e..fcbba66a 100644 --- a/acapy_plugin_toolbox/holder.py +++ b/acapy_plugin_toolbox/holder.py @@ -240,7 +240,6 @@ async def handle(self, context: RequestContext, responder: BaseResponder): name='CredList', handler='acapy_plugin_toolbox.util.PassHandler', msg_type=CREDENTIALS_LIST, - #schema=V10CredentialExchangeListResultSchema schema={ 'results': fields.List(fields.Dict()) } @@ -253,38 +252,11 @@ class CredGetListHandler(BaseHandler): @admin_only async def handle(self, context: RequestContext, responder: BaseResponder): """Handle received get cred list request.""" - - # holder: BaseHolder = await context.inject(BaseHolder) - # credentials = await holder.get_credentials(0, 100, {}) - # cred_list = CredList(results=credentials) - # await responder.send_reply(cred_list) - - start = 0 #request.query.get("start") - count = 10 #request.query.get("count") - - # url encoded json wql - encoded_wql = "{}" #request.query.get("wql") or "{}" - wql = json.loads(encoded_wql) - - # defaults - #start = int(start) if isinstance(start, str) else 0 - #count = int(count) if isinstance(count, str) else 10 - session = await context.session() - holder: IndyHolder = session.inject(IndyHolder) - credentials = await holder.get_credentials(start, count, wql) - - # post_filter_positive = dict( - # filter(lambda item: item[1] is not None, { - # # 'state': V10CredentialExchange.STATE_CREDENTIAL_RECEIVED, - # #'role': V10CredentialExchange.ROLE_HOLDER, - # 'connection_id': context.message.connection_id, - # 'credential_definition_id': context.message.credential_definition_id, - # 'schema_id': context.message.schema_id - # }.items()) - # ) - # records = await V10CredentialExchange.query(context, {}, post_filter_positive) - cred_list = CredList(results=credentials) + credentials = await V10CredentialExchange.query(session) + cred_list = CredList( + results=[credential.serialize() for credential in credentials] + ) await responder.send_reply(cred_list)