Is your feature request related to a problem? Please describe.
I'm currently using the web-did-resolver in a custom document loader and it works very well, but i still have to query key fragments separately like so:
const [did, keyFragment] = url.split('#')
// fetch document
const didDocument: any = (await getResolver().resolve(url)).didDocument
// if a keyFragment of the DID document is queried
if (keyFragment && didDocument) {
// TODO allow query of other fields than verification method as well
const keyFragmentDoc: any | undefined = didDocument.verificationMethod.filter(function(method: any) {
return method.id === url || method.id === verificationMethod;
})[0];
if (!keyFragmentDoc)
throw new jsonldSignatures.VerificationError(
new Error(`${verificationMethod} is an unknown key fragment for ${did}`)
);
return {
contextUrl: null,
documentUrl: url,
// deliver keyFragment with the DID doc context
document: Object.assign(verificationMethodDoc, {'@context': didDocument['@context']}),
};
}
return {
contextUrl: null,
documentUrl: url,
document: didDocument,
};
Describe the solution you'd like
If the key fragment is specified the resolver should not return the DID document, but the key fragment document. (See code above)
Describe alternatives you've considered
See code above
Moved here from decentralized-identity/web-did-resolver#121
Is your feature request related to a problem? Please describe.
I'm currently using the web-did-resolver in a custom document loader and it works very well, but i still have to query key fragments separately like so:
Describe the solution you'd like
If the key fragment is specified the resolver should not return the DID document, but the key fragment document. (See code above)
Describe alternatives you've considered
See code above
Moved here from decentralized-identity/web-did-resolver#121