Skip to content

Commit

Permalink
Remove /1.0/identifiers from DID resolver (consider it opaque).
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Mar 18, 2024
1 parent 33d43b2 commit d3006eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/documentLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ async function _resolve({didResolver, didUrl}) {
// split on `?` query or `#` fragment
const [did] = didUrl.split(/(?=[\?#])/);

// fetch DID document using DID resolver;
// assume a universal DID resolver 1.0 API in this version
const url = `${didResolver.url}/1.0/identifiers/${encodeURIComponent(did)}`;
// fetch DID document using DID resolver, assume DID param is prepended
const url = didResolver.url.endsWith('/') ?
`${didResolver.url}${encodeURIComponent(did)}` :
`${didResolver.url}/${encodeURIComponent(did)}`;
const data = await httpClientHandler.get({url});

if(data?.id !== did) {
Expand Down
2 changes: 1 addition & 1 deletion test/mocha/40-did-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('did resolver option', () => {
verifyOptions: {
didResolver: {
// use mocked universal DID resolver on own server
url: baseUrl
url: `${baseUrl}/1.0/identifiers`
}
}
};
Expand Down

0 comments on commit d3006eb

Please sign in to comment.