{"name":"did-resolver","version":"0.0.6-alpha3","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":"b483d84ce13e21ba54a29bf99fbe899f875320e4","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-alpha3","_npmVersion":"6.4.1","_nodeVersion":"11.5.0","_npmUser":{"name":"pelleb","email":"pelleb@gmail.com"},"dist":{"integrity":"sha512-J/vgkaY9qgJy7I4EV9aSBWAPyM434n0Otpu15p4ipfyopXlQkoF78pbuMYEirPCPQfK208D7jkxNPAdHxhF/vw==","shasum":"b5d04b136fad7f3a1062da6b4f588b187569e640","tarball":"http://registry-npm.ywwl.com/did-resolver/download/did-resolver-0.0.6-alpha3.tgz","fileCount":9,"unpackedSize":21257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJCUvCRA9TVsSAnZWagAAvowP+gLvow8nMFaQunGAKGbl\nOdy6LvV/rVxL5wFPzImgKrO5RJNV3HqrlVy66I8Agh81LZhPk+CeKumA1pS1\naez5QLjwUtbwYWgkHj2/J26DiEqbDXRwZyttPEWcBvqnZIMF3P77R8Ta45H2\n7sBpDkTwRFhKLgEcjdnBTrN9fQhI0IS4qSSufPHMxJpL8CwrN2joFwk4Trsa\nsXV1jaXNV6N7PyuR78lMWrAcDVeaUQgmGmraU1ntrhrJfjycG3F0A5WohDNf\n82YRsGaVD/O23AtFgo47yXAuv/t2RgIYDWVnqf0B3iub/tS0YCcdb61hl+DQ\nray/ztOHwDSTF8BW4ZnOipbqWf6HxzuH+s0EB/tFVclHYo7+m8V4sZZ4xOWY\nsVupJdVzCZD7G8FXcL0eZ2huNQKPplIM5Sy4FSZkrJk2L7LdcsAK9dAz8QgL\nAs6pXws49VcuqbWv/+vpfQZdo9XOT6Ab0+P/Fdy/ogZ35uapaJdKKW0/YUZc\nmf4HG3e9dFPRPqMCh8NonNgg4R5Hk5uNt75ITXVAGBML93nnLOK+jSt48oXf\njDOdk4B/lwddBkImsqF57fcmKe9g4VwYouCxNYOukMoRkNuxqmPfvrLCLTW+\nTQEyPzSsIJZB0zzG60J8oGAxAgmvs7V4Ez4VWz1iWDIJIAJIollcifuw4jZV\nnzn5\r\n=ilCw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf76jAJdsTdSqqjWtFclZ2JjTEE/eLlYpRpZmMgFHHmAIgA2DRsgx5otehPxkEIAmue70o6zUlFBGVOCCunawwY9Y="}],"size":6108,"noattachment":false,"key":"/did-resolver/-/did-resolver-0.0.6-alpha3.tgz"},"maintainers":[{"name":"pelleb","email":"pelleb@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/did-resolver_0.0.6-alpha3_1545872686866_0.6551412859982353"},"_hasShrinkwrap":false,"publish_time":1545872686984,"_cnpm_publish_time":1545872686984,"dist-tags":{"alpha":"0.0.7-alpha.0","latest":"6.0.0","preview":"5.0.0-feat-publishing-maintenance.1"}}