Skip to content

Commit

Permalink
Merge pull request #23 from ayanworks/update-contract-address-testnet
Browse files Browse the repository at this point in the history
refactor: updated resolver method for deactivate did document
  • Loading branch information
sairanjit authored Feb 8, 2024
2 parents f496367 + 18cb552 commit 0fcea6b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,20 @@ export function getResolver(): Record<string, DIDResolver> {
if (!didDocument[0]) {
throw new Error(`The DID document for the given DID was not found!`)
}
const didDocumentJson = JSON.parse(didDocument[0])

if (!didDocumentJson?.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)
Expand Down

0 comments on commit 0fcea6b

Please sign in to comment.