{"name":"did-resolver","version":"0.0.6-alpha1","description":"Resolve DID documents","main":"lib/resolver.js","types":"lib/resolver.d.ts","repository":{"type":"git","url":"git+https://github.com/uport-project/did-resolver.git"},"author":{"name":"Pelle Braendgaard","email":"pelle.braendgaard@consensys.net"},"license":"MIT","scripts":{"build":"tsc","test":"jest","dev":"tsc --watch","format":"prettier"},"devDependencies":{"@types/jest":"^23.3.10","jest":"^23.6.0","prettier":"^1.15.3","regenerator-runtime":"^0.12.1","ts-jest":"^23.10.5","tslint":"^5.12.0","tslint-config-prettier":"^1.17.0","tslint-eslint-rules":"^5.4.0","typescript":"^3.2.2"},"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## Resolving a DID document\n\nThe resolver presents a simple `resolver()` function that returns a ES6 Promise returning the DID document.\n\n```js\nimport resolve from 'did-resolver'\n\nresolve('did:uport:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX/some/path#fragment=123').then(doc => console.log)\n\n// You can also use ES7 async/await syntax\nconst doc = await 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\nimport { registerMethod } from 'did-resolver'\nregisterMethod('mymethod', (did, parsed) => new Promise(resolve, reject) => {\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  resolve(didDoc)\n})\n```\n\nThe method resolver should register this so that just requiring it will register the method:\n\n```js\nimport resolve from 'did-resolver'\nimport MyMethod from 'mymethod-did-resolver'\n\nresolve('did:mymethod:abcdefg/some/path#fragment=123').then(doc => console.log)\n```\n\n","readmeFilename":"README.md","gitHead":"e347d6d4b01efdb9aa764e617a5afa3dc4aba689","bugs":{"url":"https://github.com/uport-project/did-resolver/issues"},"homepage":"https://github.com/uport-project/did-resolver#readme","_id":"did-resolver@0.0.6-alpha1","_npmVersion":"6.4.1","_nodeVersion":"11.5.0","_npmUser":{"name":"pelleb","email":"pelleb@gmail.com"},"dist":{"integrity":"sha512-HQi3tDhYp/8nK37EdPSIvymvv+aQmqJpzXJTZ7Q0I6RZ6Kk6z3wHCa/qNEq2WCj97waA34bt3HB80vGCVGbaMQ==","shasum":"4b500731d35bf4bcf2095700e4b32c12804bfcfa","tarball":"http://registry-npm.ywwl.com/did-resolver/download/did-resolver-0.0.6-alpha1.tgz","fileCount":9,"unpackedSize":19764,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcI/1wCRA9TVsSAnZWagAA4M8QAJ/2CD8aOffXTuZKnE+Y\nTfC7/XPzxrvRId3ixonnUlmVbWLiTUQ9HdXorzPKNI0e4qySTVlQwC59bKLb\n62oQAOTHMO+S1bUMLBsOkHxndBAk0Th71yVx9kRW6aZ19wdPtU96ofmGIya7\nwPj1OEZ5fbsh8NxBgK7zZPgzN/Eg5SKixMBC51hcoJ8/VjwhbxzTAuNOB5XR\nzhQIu2IzrFxfJtQLyfIaS8vwRC5a2vMRQQ/uxcbA2/2Ohb4KmER73sLIb9vd\nUFhJg79c4ObIPim96kIYKNLmeLjb9Q2wRejaI9cKAWajYT89gmlk/5UX6dww\nfHmIEApVnPdXQvATzL3Rjgmq6ley5wIeAS1TUU5g9IDBQHlvRlkOpGjrHbo2\nCEnTSebrJXEMiUruoArXq+wGToJ4fYnUVV06uuytVWDJpOuH1Vbn7hwv8Je5\n9A3tQ1qYVMHfIo+j3EFYVu8Ap1QuCl4cet0CO7Lbbf10IuVsQRJ5drW+CiAK\nokoUlb6qRkLupYREtFO7UcDwkedfxzDOtg19wj/zot++bwqykc8f65x//P/i\nWVSGOIbFxir5fD0rfUH8s7GHQIkd9Iu2aP9sKDLgfzzPXkwlwVq/TxdXNu4q\nbWG/mKaNxG5PfyO3wVRaQDhXAIfxz7iaUITGIm8eaIPZLo1r5zKjetq0JUeD\nZ1p2\r\n=cbSW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEsErgefq9x1yVpnnkEzJ0SjPH+TobFXFUa0qWpJ2bN0AiAo1tvit27CNLsBoL0khYSa6cXDny8HXUyTmLKz0/4Nig=="}],"size":5789,"noattachment":false,"key":"/did-resolver/-/did-resolver-0.0.6-alpha1.tgz"},"maintainers":[{"name":"pelleb","email":"pelleb@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/did-resolver_0.0.6-alpha1_1545862511491_0.7044552410158409"},"_hasShrinkwrap":false,"publish_time":1545862511615,"_cnpm_publish_time":1545862511615,"dist-tags":{"alpha":"0.0.7-alpha.0","latest":"6.0.0","preview":"5.0.0-feat-publishing-maintenance.1"}}