{"name":"did-resolver","version":"0.0.6-alpha2","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","@types/node":"^10.12.18","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":"36f375dd342f3fb64278d66725c3a7d6dc059e74","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-alpha2","_npmVersion":"6.4.1","_nodeVersion":"11.5.0","_npmUser":{"name":"pelleb","email":"pelleb@gmail.com"},"dist":{"integrity":"sha512-PqMoTBm1SfG4HDp3TI0wr6kivwMTsxIGSjBYGcy/m1MNiP/KmPEvLYRzs7BfK7OooVivAF1Ud1Eo/DoEJsycow==","shasum":"19f59b6e7c3ec0b95ba550ad794e5b673b438951","tarball":"http://registry-npm.ywwl.com/did-resolver/download/did-resolver-0.0.6-alpha2.tgz","fileCount":9,"unpackedSize":20763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJBz3CRA9TVsSAnZWagAA5nQP/3s4qnRcXyTH7AO8yL5o\nJ+n0GRkGRiqWCxtJAKo35HHEd60l8B3tSVg35EYWNSfwnDO33XRDlkrGB7oZ\n+buFDNpGGM4Zm3sNHxiSakUe+UruJSiCqSYP1Kl9ZcSu3A3i2WoV2InoPJ+u\nwdChY7QJ3Kg8/xUJqqBwIkU7khv6tlB0S30padXFfcpkXVQmw0ZeYcaN0I7D\nGRTqIHCA7g1Ztlkaexaq1XpDDYJo3cSCot3+8IDyoPVWloOJVfoZi8cqj/Im\nytyE91CkKDG4WafNQdV/q0sfh7WYLl5faornr/Rio4yugnfy68eFYTigAmZC\nQC6eX6nHLZ7tJ9YSgpFfxhMOJsBDfeD8iZHkU4lZLR71baQIc3850t11emfS\nEMd0q34jZSfQaXmuKM57ytxvOvXgci8nAfe//NdiKZhq2/piFcOkDAOIakQS\nb7ZHeCNRGOZbRK0NBJ22Tl1R6dlob2dliIHIoJtlGHAI7eoM8sGd/CLBfaW0\njh2U/LPQhsDEi+HhbT6W8kH4jmgswRcN03EVCHPK0YUlPtR1LgRPO3EMsUVp\nEC31WkQWdBgQlXBOD7G8HlN4XwK/IrGkurx/NrOfOYSA49qnaAy1y13/HMhl\n5unMUnlOgUNcDT23cI5+bEYkI5r/WG9hp5tmq/MWM/Ntg2IORzYSawwhnDmP\nDWWF\r\n=pSQs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKNpWpu/186ZXoig9JZDguihMCyNfwryaisxEfVhSbDgIhANWpUU9MYFEqEy7K/bVQNxL8vIxFhThfAMjNEAWBE/SD"}],"size":6009,"noattachment":false,"key":"/did-resolver/-/did-resolver-0.0.6-alpha2.tgz"},"maintainers":[{"name":"pelleb","email":"pelleb@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/did-resolver_0.0.6-alpha2_1545870583123_0.29624854632058084"},"_hasShrinkwrap":false,"publish_time":1545870583207,"_cnpm_publish_time":1545870583207,"dist-tags":{"alpha":"0.0.7-alpha.0","latest":"6.0.0","preview":"5.0.0-feat-publishing-maintenance.1"}}