{"name":"cookie-parser","version":"1.4.4","keywords":["cookie","middleware"],"author":{"url":"http://tjholowaychuk.com","name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"license":"MIT","_id":"cookie-parser@1.4.4","maintainers":[{"name":"defunctzombie","email":"shtylman@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"}],"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"homepage":"https://github.com/expressjs/cookie-parser#readme","bugs":{"url":"https://github.com/expressjs/cookie-parser/issues"},"dist":{"shasum":"e6363de4ea98c3def9697b93421c09f30cf5d188","tarball":"http://registry-npm.ywwl.com/cookie-parser/download/cookie-parser-1.4.4.tgz","fileCount":5,"integrity":"sha512-lo13tqF3JEtFO7FyA49CqbhaFkskRJ0u/UAiINgrIXeRCY41c88/zxtrECl8AKH3B0hj9q10+h3Kt8I7KlW4tw==","signatures":[{"sig":"MEQCIF0TMaCHSrgIfaec9ZY8Z7VQ+ALU1N9OKGqONOzUcELFAiA538eY24vwu5I2qYMCg+o52Vvxz3bzXA+3BQunC9Ddng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcY2g2CRA9TVsSAnZWagAAX2cP/RbT7W+Gn9S7Yb2avxwJ\n3GR/wLvtEbQ08VkeAkxeQTc5Ysdiy2vTi/UTjTcz7vAJb2Ly9jGY+g6wvzis\naiv8pY4YT2ES1jDbv+F55P+FAbPsRY8mQF9crg0BoL5yZ5zaU4VCWyfnJW8u\ngT9kfOLYtQKXGJAIMiEUGukxnlbHd4LUAEQF8I1eiRd8ceVmkrswcqBLYfu3\nEwZke+8mTWaFEdQ1sz9uACEXzBIOIuId7J93EOO0e8Mh7g4NRc0z5hTtqAdY\naqBQY8lchOBFoQ/VXU+dtfUVr5oBR2uZtfLCP3npmUJfPvJ/68jzuN0W6kAO\nq3EU6lnPSABCRDPPwTDP2wjbHrme+zPdfGlM7jrmCnRq1dKgu+/7LrYvqbdl\nBi8HG6fS0kcdbuKw1Bu80oKIsxWuCHlmImuGnJoppXfEjP4jxutxr2Gkx0Yh\nlPwxKV30vIbNcCcYAhziZGBalChSrJioi1kkOdSTxDtmy/dceLX5mvyUR/q8\n4FNn4u+6/axopl2md6AUTw0Q0x8jZZHZqEQK0+9cGAQdgKHA2xnjZMMcjA9I\n9w7rk0AI+mdzJboBy0R/PJTLZd9IoqTmuMdTJ3cIjIUl79bZLCt40kWZMz0x\nDuB0OlYXh0LbbI9K0aB9vzWaWrlHZQRZRJf1jPEitlVBuzmEwUomJYzIC2nB\ndtMP\r\n=5E/c\r\n-----END PGP SIGNATURE-----\r\n","size":3971,"noattachment":false,"key":"/cookie-parser/-/cookie-parser-1.4.4.tgz"},"engines":{"node":">= 0.8.0"},"gitHead":"1dc306b0ebe86ab98521811cc090740b4bef48e7","scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --reporter spec --bail --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"repository":{"url":"git+https://github.com/expressjs/cookie-parser.git","type":"git"},"_npmVersion":"6.4.1","description":"Parse HTTP request cookies","directories":{},"_nodeVersion":"8.15.0","dependencies":{"cookie":"0.3.1","cookie-signature":"1.0.6"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"5.2.0","eslint":"5.13.0","istanbul":"0.4.5","supertest":"3.4.2","deep-equal":"1.0.1","eslint-plugin-node":"7.0.1","eslint-plugin-import":"2.16.0","eslint-plugin-promise":"4.0.1","eslint-config-standard":"12.0.0","eslint-plugin-markdown":"1.0.0","eslint-plugin-standard":"4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/cookie-parser_1.4.4_1550018613583_0.3382367471226304","host":"s3://npm-registry-packages"},"readme":"# cookie-parser\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-url]\n[![Build Status][ci-image]][ci-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nParse `Cookie` header and populate `req.cookies` with an object keyed by the\ncookie names. Optionally you may enable signed cookie support by passing a\n`secret` string, which assigns `req.secret` so it may be used by other\nmiddleware.\n\n## Installation\n\n```sh\n$ npm install cookie-parser\n```\n\n## API\n\n```js\nvar cookieParser = require('cookie-parser')\n```\n\n### cookieParser(secret, options)\n\nCreate a new cookie parser middleware function using the given `secret` and\n`options`.\n\n- `secret` a string or array used for signing cookies. This is optional and if\n  not specified, will not parse signed cookies. If a string is provided, this\n  is used as the secret. If an array is provided, an attempt will be made to\n  unsign the cookie with each secret in order.\n- `options` an object that is passed to `cookie.parse` as the second option. See\n  [cookie](https://www.npmjs.org/package/cookie) for more information.\n  - `decode` a function to decode the value of the cookie\n\nThe middleware will parse the `Cookie` header on the request and expose the\ncookie data as the property `req.cookies` and, if a `secret` was provided, as\nthe property `req.signedCookies`. These properties are name value pairs of the\ncookie name to cookie value.\n\nWhen `secret` is provided, this module will unsign and validate any signed cookie\nvalues and move those name value pairs from `req.cookies` into `req.signedCookies`.\nA signed cookie is a cookie that has a value prefixed with `s:`. Signed cookies\nthat fail signature validation will have the value `false` instead of the tampered\nvalue.\n\nIn addition, this module supports special \"JSON cookies\". These are cookie where\nthe value is prefixed with `j:`. When these values are encountered, the value will\nbe exposed as the result of `JSON.parse`. If parsing fails, the original value will\nremain.\n\n### cookieParser.JSONCookie(str)\n\nParse a cookie value as a JSON cookie. This will return the parsed JSON value\nif it was a JSON cookie, otherwise, it will return the passed value.\n\n### cookieParser.JSONCookies(cookies)\n\nGiven an object, this will iterate over the keys and call `JSONCookie` on each\nvalue, replacing the original value with the parsed value. This returns the\nsame object that was passed in.\n\n### cookieParser.signedCookie(str, secret)\n\nParse a cookie value as a signed cookie. This will return the parsed unsigned\nvalue if it was a signed cookie and the signature was valid. If the value was\nnot signed, the original value is returned. If the value was signed but the\nsignature could not be validated, `false` is returned.\n\nThe `secret` argument can be an array or string. If a string is provided, this\nis used as the secret. If an array is provided, an attempt will be made to\nunsign the cookie with each secret in order.\n\n### cookieParser.signedCookies(cookies, secret)\n\nGiven an object, this will iterate over the keys and check if any value is a\nsigned cookie. If it is a signed cookie and the signature is valid, the key\nwill be deleted from the object and added to the new object that is returned.\n\nThe `secret` argument can be an array or string. If a string is provided, this\nis used as the secret. If an array is provided, an attempt will be made to\nunsign the cookie with each secret in order.\n\n## Example\n\n```js\nvar express = require('express')\nvar cookieParser = require('cookie-parser')\n\nvar app = express()\napp.use(cookieParser())\n\napp.get('/', function (req, res) {\n  // Cookies that have not been signed\n  console.log('Cookies: ', req.cookies)\n\n  // Cookies that have been signed\n  console.log('Signed Cookies: ', req.signedCookies)\n})\n\napp.listen(8080)\n\n// curl command that sends an HTTP request with two cookies\n// curl http://127.0.0.1:8080 --cookie \"Cho=Kim;Greet=Hello\"\n```\n\n## License\n\n[MIT](LICENSE)\n\n[ci-image]: https://badgen.net/github/checks/expressjs/cookie-parser/master?label=ci\n[ci-url]: https://github.com/expressjs/cookie-parser/actions?query=workflow%3Aci\n[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/cookie-parser/master\n[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master\n[npm-downloads-image]: https://badgen.net/npm/dm/cookie-parser\n[npm-url]: https://npmjs.org/package/cookie-parser\n[npm-version-image]: https://badgen.net/npm/v/cookie-parser\n","publish_time":1550018613732,"_cnpm_publish_time":1550018613732,"dist-tags":{"latest":"1.4.7"}}