From e37c232b14bcb35923703706d2b912153716b648 Mon Sep 17 00:00:00 2001 From: Niels Klomp Date: Sun, 1 Oct 2023 03:53:42 +0200 Subject: [PATCH] fix: Fix some issues with did:key resolution --- src/did/DIDResolution.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/did/DIDResolution.ts b/src/did/DIDResolution.ts index bef3905..aa39382 100644 --- a/src/did/DIDResolution.ts +++ b/src/did/DIDResolution.ts @@ -101,7 +101,11 @@ export function mergeAllDidMethods(subjectSyntaxTypesSupported: string | string[ } export async function resolveDidDocument(did: string, opts?: ResolveOpts): Promise { - const result = await getResolver(opts).resolve(did); + // todo: The accept is only there because did:key used by Veramo requires it. According to the spec it is optional. It should not hurt, but let's test + const result = await getResolver({ ...opts }).resolve(did, { accept: 'application/did+ld+json' }); + if (result?.didResolutionMetadata?.error) { + throw Error(result.didResolutionMetadata.error); + } // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore if (!result.didDocument && result.id) {