{"name":"did-resolver","version":"0.1.0-alpha.0","description":"Resolve DID documents","main":"lib/resolver.js","types":"lib/resolver.d.ts","source":"src/resolver.ts","module":"lib/resolver.esm.js","sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/uport-project/did-resolver.git"},"author":{"name":"Pelle Braendgaard","email":"pelle.braendgaard@consensys.net"},"license":"Apache-2.0","scripts":{"build:js":"microbundle","test":"jest","format":"prettier --write src/**/*","build":"npm run format && npm test && npm run build:js","prepare":"npm run build"},"devDependencies":{"@types/jest":"^24.0.11","@types/node":"^10.12.18","jest":"^24.5.0","microbundle":"^0.11.0","prettier":"^1.16.4","regenerator-runtime":"^0.12.1","ts-jest":"^24.0.1","tslint":"^5.14.0","tslint-config-prettier":"^1.18.0","tslint-eslint-rules":"^5.4.0","typescript":"^3.4.1"},"jest":{"transform":{"^.+\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json"],"coverageDirectory":"./coverage/","collectCoverageFrom":["src/**/*.{ts,tsx}","!src/**/*.d.ts","!**/node_modules/**"]},"readme":"# Javascript DID Resolver\n\nThis library is intended as a simple common interface for javascript applications to resolve DID documents from Decentralized Identifiers (DIDs).\n\nThis is intended to support the proposed [Decentralized Identifiers](https://w3c-ccg.github.io/did-spec/) spec from the [W3C Credentials Community Group](https://w3c-ccg.github.io).\n\nThe library does not implement any specific DID method, but allows DID method implementors to release npm packages that applications can add.\n\n## Breaking changes (0.1.0)\n\nThis removes the global resolver. We've learnt that this ended up causing many problems. Instead you should now instantiate a Resolver object and use that to resolve did's within your consuming app/library.\n\n### Changes required for developers of DID resolvers\n\nYou now no longer register your DID resolvers using the global `registerMethod()` function. Instead export the resolver function and show how to configure it in a local resolver object.\n\n## Configure `Resolver` object\n\nYou are now required to preconfigure a resolver during instantiation:\n\n```js\nimport { DIDResolver } from 'did-resolver'\nimport ethr from 'ethr-did-resolver'\nimport web from 'web-did-resolver'\nimport sov from 'sov-did-resolver'\n\nconst resolver = new DIDResolver({\n  ethr,\n  web,\n  https: web // Override a did method type\n})\n```\n\n## Resolving a DID document\n\nThe resolver presents a simple `resolve()` function that returns a ES6 Promise returning the DID document.\n\n```js\nresolver.resolve('did:uport:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX/some/path#fragment=123').then(doc => console.log)\n\n// You can also use ES7 async/await syntax\nconst doc = await resolver.resolve('did:uport:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX/some/path#fragment=123')\n```\n\n## Implementing a DID method\n\nEach DID method will have it's own methods for looking up an identifier on it's respective blockchain or other decentralized storage mechanism.\n\nA method implementer calls the `registerMethod('methodname', resolver)`. where `methodname` is the method identifier. The resolver is a function that receives a DID and a parsed version of the DID. It returns a ES6 Promise that looks up the DID document.\n\n```js\nexport default async function myResolver (did, parsed, didResolver) {\n  console.log(parsed)\n  // {method: 'mymethod', id: 'abcdefg', did: 'did:mymethod:abcdefg/some/path#fragment=123', path: '/some/path', fragment: 'fragment=123'}\n  const didDoc = ...// lookup doc\n  // If you need to lookup another did as part of resolving this did document, the primary DIDResolver object is passed in as well\n  const parentDID = await didResolver.resolve(...)\n  //\n  return didDoc\n})\n```\n\n\n\nThe method resolver should register this so that just requiring it will register the method:\n\n```js\nimport { DIDResolver } from 'did-resolver'\nimport MyMethod from 'mymethod-did-resolver'\n\nconst resolver = new DIDResolver({\n  mymethod: MyMethod\n})\n```\n\n","readmeFilename":"README.md","gitHead":"72bca8dc0ff033aff189b164884726427ca68d9b","bugs":{"url":"https://github.com/uport-project/did-resolver/issues"},"homepage":"https://github.com/uport-project/did-resolver#readme","_id":"did-resolver@0.1.0-alpha.0","_nodeVersion":"11.13.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-keIETxiCR42/YeNzQwQ4kIrOstG6Gh0czXzkBGivlLYSk1uVBCUH8YL29xnytC9ogDFlY0Myp2KxJCd8W5QEsA==","shasum":"fccc243a453a8674a7ddcee293cccc4158b53a86","tarball":"http://registry-npm.ywwl.com/did-resolver/download/did-resolver-0.1.0-alpha.0.tgz","fileCount":12,"unpackedSize":35296,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcopneCRA9TVsSAnZWagAAS88P/RS9Fj80+GJAz8WM4L+h\nv6rXNFONWH4Hwq73Uo+J1wuozwre7c7+v52Fmz4JnoJfxFVaGoZrk+JI6+vN\nQXS9pSs9Ep86WRDKYJ4jMzJXjjvg1cX5mnKYoWwCbRdZxR3pkh8gSaZcZ36b\nlAtv9tTzAyTVoSfS/Rljtzqr9o66/FuUiaIciOSARs7nTZTsKPPSlf+19FKX\nXNj4vpU1r5zed7k3vMpPy/R2RZbtWTpWsCHb7zlHgsbJO2iAmxynBkrIOZJ8\nSlVkJRJMr9EoxomEp0R9PvCbaAGNF6lPGXpcK5zXtKuqyR7kHrv+/SbCvPqS\nPsDZOiDvB3aAM5xeKgnNeEe32tkc2t1T2AUS2kYsZTl01I8JK+yJ8NbRgmHY\ny2bXkpWEpKbxO/680qNNH36SYJXd6FwZYjTQF1EguGEVO8CNAuSFYAlxs0ER\nXg2QVNQ7PhvdP4ENC9brzw6mGvwhKNTcns3oddyGNCWeqeqnbp8PcRZISMTd\nF7+4Zz5rLbOekwVjkqYiFEq1A/8VFzxn42B42t67rHFtNX+0p7FU2o+JGTJs\n8HhKyrZyBSn/1x5likLETzoOObTLmHLiqgmB3amoVgQ0UlvU1e6+Suve53mE\neh+0pCzhXIslP6t8CquH8qRwY7PBgU8xq+J0qft+NCRho57WFRxZIy9ANBWM\nPx9Z\r\n=fSNo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhqOFxyy2dUDjokzvfDg9ISdNNYN9odhAtGX/yu0lS8gIhAP4YvaRj46ejEYRYRD6DFYauVy0f1S4wiUdVOXlkVV3r"}],"size":8961,"noattachment":false,"key":"/did-resolver/-/did-resolver-0.1.0-alpha.0.tgz"},"maintainers":[{"email":"aldigjo@gmail.com","name":"aldigjo"},{"email":"levi.strope@gmail.com","name":"localredhead"},{"email":"mike.xu@consensys.net","name":"mike.xu"},{"email":"pelleb@gmail.com","name":"pelleb"},{"email":"rob.whitaker.18@gmail.com","name":"rmw2"},{"email":"simonas@not.cat","name":"simonas-notcat"}],"_npmUser":{"name":"pelleb","email":"pelleb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/did-resolver_0.1.0-alpha.0_1554160093723_0.16052847632419698"},"_hasShrinkwrap":false,"publish_time":1554160093911,"_cnpm_publish_time":1554160093911,"dist-tags":{"alpha":"0.0.7-alpha.0","latest":"6.0.0","preview":"5.0.0-feat-publishing-maintenance.1"}}