From 38ad11ec9abf74143acda726725820c0d6e29e14 Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Mon, 16 Dec 2019 15:10:55 +0200 Subject: [PATCH] fix: Identity.isManaged --- .../daf-core/src/graphql/graphql-identity-manager.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/daf-core/src/graphql/graphql-identity-manager.ts b/packages/daf-core/src/graphql/graphql-identity-manager.ts index bdb8b83a2..9abff47fc 100644 --- a/packages/daf-core/src/graphql/graphql-identity-manager.ts +++ b/packages/daf-core/src/graphql/graphql-identity-manager.ts @@ -18,6 +18,11 @@ const managedIdentities = async (_: any, args: any, ctx: Context) => { })) } +const isManaged = async (identity: any, args: any, ctx: Context) => { + const list = await ctx.core.identityManager.listDids() + return list.indexOf(identity.did) > -1 +} + const createIdentity = async ( _: any, args: { @@ -74,6 +79,9 @@ const managedIdentitySecret = async ( // Actions export const resolvers = { + Identity: { + isManaged, + }, Query: { managedIdentityTypes, managedIdentities, @@ -101,6 +109,7 @@ export const typeDefs = ` extend type Identity { type: String + isManaged: Boolean! } `