From 9b353a4c5e171a23566490776e2c3f3077790be8 Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Thu, 8 Feb 2024 14:54:07 +0530 Subject: [PATCH 1/2] feat: implemented deactivate did doc Signed-off-by: tipusinghaw --- src/resolver.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/resolver.ts b/src/resolver.ts index c099dc2..cf34dad 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -32,9 +32,20 @@ export function getResolver(): Record { if (!didDocument[0]) { throw new Error(`The DID document for the given DID was not found!`) } + const didDocumentJson = JSON.parse(didDocument[0]) + if (!JSON.parse(didDocument[0])?.verificationMethod) { + return { + didDocument: didDocumentJson, + didDocumentMetadata: { + linkedResourceMetadata: [], + deactivated: true, + }, + didResolutionMetadata: { contentType: 'application/did+ld+json' }, + } + } return { - didDocument: JSON.parse(didDocument[0]), + didDocument: didDocumentJson, didDocumentMetadata: { linkedResourceMetadata: didDocument[1].map((element: string) => { return JSON.parse(element) From 18cb5523e657b1a4e7f270cd80f35367eb865e55 Mon Sep 17 00:00:00 2001 From: tipusinghaw Date: Thu, 8 Feb 2024 15:35:15 +0530 Subject: [PATCH 2/2] fix: added validation by variable Signed-off-by: tipusinghaw --- src/resolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolver.ts b/src/resolver.ts index cf34dad..20090eb 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -34,7 +34,7 @@ export function getResolver(): Record { } const didDocumentJson = JSON.parse(didDocument[0]) - if (!JSON.parse(didDocument[0])?.verificationMethod) { + if (!didDocumentJson?.verificationMethod) { return { didDocument: didDocumentJson, didDocumentMetadata: {