{"_id":"express-x-hub","_rev":"10-6f7bb15f48062c38a717f3db668db5c2","name":"express-x-hub","description":"X-Hub-Signature Express Middleware","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.1":{"name":"express-x-hub","version":"1.0.1","description":"X-Hub-Signature Express Middleware","main":"index.js","repository":{"type":"git","url":"https://github.com/alexcurtis/express-x-hub.git"},"keywords":["express","x-hub","xhub","signature","middleware","facebook","realtime","updates","payment"],"author":{"name":"Alex Curtis"},"license":"MIT","bugs":{"url":"https://github.com/alexcurtis/express-x-hub/issues"},"homepage":"https://github.com/alexcurtis/express-x-hub","devDependencies":{"grunt":"~0.4.4","grunt-contrib-jshint":"~0.10.0","grunt-contrib-watch":"~0.6.1"},"dependencies":{"underscore":"~1.6.0","raw-body":"~1.1.3","type-is":"~1.1.0"},"_id":"express-x-hub@1.0.1","_shasum":"bdaa79e1c7b935eb8bd10b2e1965923be8440069","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"alexcurtis","email":"alx.curtis@gmail.com"},"maintainers":[{"name":"alexcurtis","email":"alx.curtis@gmail.com"}],"dist":{"shasum":"bdaa79e1c7b935eb8bd10b2e1965923be8440069","tarball":"https://registry.npmjs.org/express-x-hub/-/express-x-hub-1.0.1.tgz","integrity":"sha512-1MqWoCWGHWfv1b5c57kz0KEpmOHNhWfczRWCehXGVw1jlROHW0KKBRCbHZJy4+qgDV+gVZV90kzO0FUR4Nfk8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCC8wy3IiKJ7LQsn6GgzbIjqTJhsg7oAVLKZwWv8I+ZXAIgXPV0rjsHiyNqfp1xJIEMry2hfFloTUfPYKPyVH+0HXI="}]}},"1.0.2":{"name":"express-x-hub","version":"1.0.2","description":"X-Hub-Signature Express Middleware","main":"index.js","repository":{"type":"git","url":"https://github.com/alexcurtis/express-x-hub.git"},"keywords":["express","x-hub","xhub","signature","middleware","facebook","realtime","updates","payment"],"author":{"name":"Alex Curtis"},"license":"MIT","bugs":{"url":"https://github.com/alexcurtis/express-x-hub/issues"},"homepage":"https://github.com/alexcurtis/express-x-hub","devDependencies":{"grunt":"~0.4.4","grunt-contrib-jshint":"~0.10.0","grunt-contrib-watch":"~0.6.1"},"dependencies":{"underscore":"~1.6.0","raw-body":"~1.1.3","type-is":"~1.1.0"},"_id":"express-x-hub@1.0.2","_shasum":"38e0d40f45cecc993a29fee8e3c3ecb06769ddd4","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"alexcurtis","email":"alx.curtis@gmail.com"},"maintainers":[{"name":"alexcurtis","email":"alx.curtis@gmail.com"}],"dist":{"shasum":"38e0d40f45cecc993a29fee8e3c3ecb06769ddd4","tarball":"https://registry.npmjs.org/express-x-hub/-/express-x-hub-1.0.2.tgz","integrity":"sha512-aYFEosBScKR0dZoomafGfC8DU4U/BIyp5jTlczVRNYQkuPfOJpDYL8XOXtfT2SpzCVKIoNB9krt/zvN+ahGgMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID/P9SzkXVC32HaySdZSKnC+M/pzFKlpVY3RcwUiivjXAiEA6bB7AHrQA1Vj/vCVGR7E+Dq5MrjfMDD8ZSz2jeLuPU4="}]}},"1.0.3":{"name":"express-x-hub","version":"1.0.3","description":"X-Hub-Signature Express Middleware","main":"index.js","scripts":{"test":"mocha -r ./test/support/env -R dot ./test","test-travis":"istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -r ./test/support/env -R spec ./test"},"repository":{"type":"git","url":"https://github.com/alexcurtis/express-x-hub.git"},"keywords":["express","x-hub","xhub","signature","middleware","facebook","realtime","updates","payment","github","webhook"],"author":{"name":"Alex Curtis"},"license":"MIT","bugs":{"url":"https://github.com/alexcurtis/express-x-hub/issues"},"homepage":"https://github.com/alexcurtis/express-x-hub","devDependencies":{"chai":"^1.9.2","express":"^4.9.7","gulp":"^3.8.7","gulp-jshint":"^1.8.4","gulp-mocha":"^1.1.1","istanbul":"^0.3.2","mocha":"^1.21.4","sinon":"^1.10.3","sinon-chai":"^2.6.0"},"dependencies":{"underscore":"~1.6.0","raw-body":"~1.1.3","type-is":"~1.1.0"},"gitHead":"908a674f92a9f37ab204f47b2e4b5337ec053a98","_id":"express-x-hub@1.0.3","_shasum":"7992eded35bb0379dc3d062c549a392e5d94718c","_from":".","_npmVersion":"2.1.3","_nodeVersion":"0.10.32","_npmUser":{"name":"alexcurtis","email":"alx.curtis@gmail.com"},"maintainers":[{"name":"alexcurtis","email":"alx.curtis@gmail.com"}],"dist":{"shasum":"7992eded35bb0379dc3d062c549a392e5d94718c","tarball":"https://registry.npmjs.org/express-x-hub/-/express-x-hub-1.0.3.tgz","integrity":"sha512-WrRLKlfvXaSWb4O0Zl/73WDXpYW5359HBGx9SwOgCbKqzBOPYD2QyUiK6Ss/NIxJhDUSrvIDJhle3bXgZ1zlig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDRYSxa+0CW2wqyOPoXEBnMHNhwklERAqi39EMDjZpCrAIhAJLxf5qHdaE0zjyTTPFaVeczhhTQFI3/8q+IxmqJJi30"}]}},"1.0.4":{"name":"express-x-hub","version":"1.0.4","description":"X-Hub-Signature Express Middleware","main":"index.js","scripts":{"test":"mocha -r ./test/support/env -R spec ./test","test-travis":"istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -r ./test/support/env -R spec ./test"},"repository":{"type":"git","url":"git+https://github.com/alexcurtis/express-x-hub.git"},"keywords":["express","x-hub","xhub","signature","middleware","facebook","realtime","updates","payment","github","webhook"],"author":{"name":"Alex Curtis"},"license":"MIT","bugs":{"url":"https://github.com/alexcurtis/express-x-hub/issues"},"homepage":"https://github.com/alexcurtis/express-x-hub","devDependencies":{"chai":"^3.3.0","express":"^4.13.3","gulp":"^3.9.0","gulp-eslint":"^1.0.0","gulp-mocha":"^2.1.3","istanbul":"^0.3.22","mocha":"^2.3.3","sinon":"^1.17.1","sinon-chai":"^2.8.0"},"dependencies":{"raw-body":"^2.1.4","type-is":"^1.6.9"},"gitHead":"65b9c6c77f91aa152f50f4b4fdaa7c25d615df09","_id":"express-x-hub@1.0.4","_shasum":"93917da478f5c517f5b74a2700795f616a2a0d1d","_from":".","_npmVersion":"2.14.6","_nodeVersion":"4.1.2","_npmUser":{"name":"alexcurtis","email":"alx.curtis@gmail.com"},"maintainers":[{"name":"alexcurtis","email":"alx.curtis@gmail.com"}],"dist":{"shasum":"93917da478f5c517f5b74a2700795f616a2a0d1d","tarball":"https://registry.npmjs.org/express-x-hub/-/express-x-hub-1.0.4.tgz","integrity":"sha512-FWxecZA5TgarOzVq+4aVIQNr7jzJ/WXh7pwduOVp/Be8YFBVClE3Bty8IcZmxLaUxCY+JpnRAeyromqZG3zolg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCx/PuAaxLOFVCfVmibFa+WalwPwajcVvZoVzld2u6RdgIgaCuGx1vd0Oaa0FlL/9HEOIeYt2PLyrat4CxWxWM+TLg="}]}}},"readme":"Express X-Hub\n=======================\n\n[![Build Status](https://travis-ci.org/alexcurtis/express-x-hub.svg?branch=master)](https://travis-ci.org/alexcurtis/express-x-hub) [![Coverage Status](https://img.shields.io/coveralls/alexcurtis/express-x-hub.svg)](https://coveralls.io/r/alexcurtis/express-x-hub?branch=master)\n\nX-Hub-Signature Express.js Middleware. A compact way to validate X-Hub requests to ensure they have not been tampered with. Particularly useful for Facebook real-time updates and GitHub web hooks.\n\n## Getting Started\nInstall the middleware with this command:\n\n```shell\nnpm install express-x-hub --save\n```\n\nThen add the middleware to Express.js. It needs to be one of the first and before `bodyParser()`.\n\n```javascript\nvar xhub = require('express-x-hub');\napp.use(xhub({ algorithm: 'sha1', secret: XHUB_SECRET_HERE }));\napp.use(bodyParser());\napp.use(methodOverride());\n```\n\nWhere `XHUB_SECRET_HERE` is your platform's (facebook, github, etc) secret.\n\nThis will add some special sauce to your `req` object:\n\n## Request Additions\n\n### isXHub ```boolean```\n\nIs the request X-Hub. Allows you to early reject any messages without XHub content.\n\n```javascript\nvar isXHub = req.isXHub;\nif(!isXHub) { return this.reject('No X-Hub Signature', req, res); }\n```\n\n### isXHubValid ```req.isXHubValid()```\n\nReturns a boolean value. Validates the request body against the X-Hub signature using your secret.\n\n```javascript\nvar isValid = req.isXHubValid();\nif(!isValid){ return this.reject('Invalid X-Hub Request', req, res); }\n```\nIf its valid, then the request has not been tampered with and you are safe to process it.\n\n\n## Build\n\n1. `npm test` - Run tests.\n2. `gulp` - Lint and run tests.\n\n## Example\n\nSome very simple examples can be found in the `example` dir.\n\nStart the server:\n\n```shell\nnode ./example/server.js\n```\n\nCurl in an emulated X-Hub post:\n\n```shell\nsh ./example/curl_valid.sh\n>> { \"success\": \"X-Hub Is Valid\" }\n\nsh ./example/curl_invalid.sh\n>> { \"error\": \"X-Hub Is Invalid\" }\n```\n\n## Options\n\n### secret ```string``` - required\n\nX-Hub secret that is used to validate the request body against the signed X-HUB signature on the header.\n\n### algorithm ```string```\n\nEncryption algorithm used to generate the signature. Defaults to `sha1`.\n\n### limit ```string```\n\nLimit on the request body size. Defaults to `100kb`.\n\n### encoding ```string```\n\nEncoding on the raw input stream. Defaults to `utf8`.\n\n### strict ```boolean```\n\nStrict demands on the JSON. Defaults to `true`.\n\n### reviver ```function```\n\nReviver used during `JSON.parse`.\n\n","maintainers":[{"name":"alexcurtis","email":"alx.curtis@gmail.com"}],"time":{"modified":"2022-06-17T22:46:01.352Z","created":"2014-05-19T10:52:39.495Z","1.0.1":"2014-05-19T10:52:39.495Z","1.0.2":"2014-10-14T13:35:25.500Z","1.0.3":"2014-10-15T09:04:06.542Z","1.0.4":"2015-10-16T12:15:19.284Z"},"homepage":"https://github.com/alexcurtis/express-x-hub","keywords":["express","x-hub","xhub","signature","middleware","facebook","realtime","updates","payment","github","webhook"],"repository":{"type":"git","url":"git+https://github.com/alexcurtis/express-x-hub.git"},"author":{"name":"Alex Curtis"},"bugs":{"url":"https://github.com/alexcurtis/express-x-hub/issues"},"license":"MIT","readmeFilename":"README.md","users":{"martinspinks":true}}