From b77c5c740ac96a2bb5fb2ca17348f0ffdedc5d9a Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Wed, 8 Apr 2020 16:20:55 +0300 Subject: [PATCH] fix: SDR only for sdr message type --- packages/daf-selective-disclosure/src/graphql.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/daf-selective-disclosure/src/graphql.ts b/packages/daf-selective-disclosure/src/graphql.ts index 87d570d8d..bfb89401b 100644 --- a/packages/daf-selective-disclosure/src/graphql.ts +++ b/packages/daf-selective-disclosure/src/graphql.ts @@ -2,6 +2,7 @@ import { Agent, Message, Presentation } from 'daf-core' import { DataStore } from 'daf-data-store' import { ActionTypes, ActionSignSdr, SelectiveDisclosureRequest } from './action-handler' import { findCredentialsForSdr, validatePresentationAgainstSdr } from './helper' +import { MessageTypes } from './message-handler' interface Context { agent: Agent @@ -15,7 +16,10 @@ const signSdrJwt = async (_: any, args: { data: SelectiveDisclosureRequest }, ct } as ActionSignSdr) const sdr = async (message: Message, { did }: { did: string }) => { - return findCredentialsForSdr(message.data, did) + if (message.type == MessageTypes.sdr) { + return findCredentialsForSdr(message.data, did) + } + return [] } const validateAgainstSdr = async (