From cfac776d075294bb6d7a4ea411cd88633e86d874 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 30 Jun 2023 13:39:49 +0300 Subject: [PATCH] fix case with empty credential subject --- src/proof/proof-service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/proof/proof-service.ts b/src/proof/proof-service.ts index d86a3bb1..4dc75a49 100644 --- a/src/proof/proof-service.ts +++ b/src/proof/proof-service.ts @@ -639,7 +639,7 @@ export class ProofService implements IProofService { } let path: Path = new Path(); - if (parsedQuery.query.operator !== QueryOperators.$noop) { + if (!!parsedQuery.fieldName) { path = await Path.getContextPathKey( JSON.stringify(schema), credential.type[1], @@ -665,6 +665,12 @@ export class ProofService implements IProofService { } else { parsedQuery.query.slotIndex = 5; // value data slot b } + if (!parsedQuery.fieldName){ + const resultQuery = parsedQuery.query; + resultQuery.operator = QueryOperators.$eq; + resultQuery.values = [mtEntry]; + return { query: resultQuery }; + } if (parsedQuery.isSelectiveDisclosure) { const rawValue = mk.rawValue(path); const vp = createVerifiablePresentation( @@ -725,7 +731,7 @@ export class ProofService implements IProofService { private async parseRequest(req?: { [key: string]: unknown }): Promise { if (!req) { const query = new Query(); - query.operator = QueryOperators.$noop; + query.operator = QueryOperators.$eq; return { query, fieldName: '' }; }