-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
enhancementNew feature or requestNew feature or requestpinnedan issue that may take a while to fix and should not be closed automatically.an issue that may take a while to fix and should not be closed automatically.
Description
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
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpinnedan issue that may take a while to fix and should not be closed automatically.an issue that may take a while to fix and should not be closed automatically.