{"_id":"cookie-parser-es","_rev":"2-e199190fe057a27bdf812a54a5ccfba1","name":"cookie-parser-es","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.7":{"name":"cookie-parser-es","version":"1.0.7","keywords":["cookie","middleware"],"author":{"url":"http://tjholowaychuk.com","name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"license":"MIT","_id":"cookie-parser-es@1.0.7","maintainers":[{"name":"jeandupont24","email":"jeandupontmail24@gmail.com"}],"contributors":[{"name":"Jean Dupont","email":"jeandupontmail24@gmail.com"}],"homepage":"https://github.com/expressjs/js-cookie-parser#readme","bugs":{"url":"https://github.com/expressjs/js-cookie-parser/issues"},"dist":{"shasum":"b43e13924de6309722f43929c0835fcf70002448","tarball":"https://registry.npmjs.org/cookie-parser-es/-/cookie-parser-es-1.0.7.tgz","fileCount":4,"integrity":"sha512-h+9zb0Ja71894axxENkAuATTwW4SUuEkgwEUXqnJRiS+llDpC5gj5xsp0Igk2rXq9yxJSsE1eY3e4ilLPTLuUQ==","signatures":[{"sig":"MEUCIQDud2TFP9q2l3HWFUr7sWfim75UBuSN9z9YyZDd+I5kzAIgMKYVCs8v/0jvcC7zaDzWyTRX0ulCptc0RzBfwq3gKo0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10328},"engines":{"node":">= 0.8.0"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_npmUser":{"name":"jeandupont24","email":"jeandupontmail24@gmail.com"},"repository":{"url":"git+https://github.com/expressjs/js-cookie-parser.git","type":"git"},"_npmVersion":"11.12.1","description":"Parse HTTP request cookies","directories":{},"_nodeVersion":"24.15.0","dependencies":{"cookie":"0.7.2","set-cookie-ease":"latest","cookie-signature":"1.0.6"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.1.0","mocha":"9.2.1","eslint":"7.32.0","supertest":"6.1.6","eslint-plugin-node":"11.1.0","eslint-plugin-import":"2.25.2","eslint-plugin-promise":"4.3.1","eslint-config-standard":"14.1.1","eslint-plugin-markdown":"2.2.1","eslint-plugin-standard":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/cookie-parser-es_1.0.7_1782196477672_0.41407108010796345","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"cookie-parser-es","description":"Parse HTTP request cookies","version":"1.0.8","author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},"contributors":[{"name":"Jean Dupont","email":"jeandupontmail24@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/expressjs/js-cookie-parser.git"},"keywords":["cookie","middleware"],"dependencies":{"cookie":"0.7.2","set-cookie-ease":"latest","cookie-signature":"1.0.6"},"devDependencies":{"eslint":"7.32.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.25.2","eslint-plugin-markdown":"2.2.1","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"4.3.1","eslint-plugin-standard":"4.1.0","mocha":"9.2.1","nyc":"15.1.0","supertest":"6.1.6"},"engines":{"node":">= 0.8.0"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_id":"cookie-parser-es@1.0.8","bugs":{"url":"https://github.com/expressjs/js-cookie-parser/issues"},"homepage":"https://github.com/expressjs/js-cookie-parser#readme","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-6grCjHPF4CuNpXsrWNsumLwVGu+5bqM5KXg5zNf+eGGALH/nqzjY8BQgHVZkKBp40vUd5nop8P7Hhocl4zdqOA==","shasum":"3a1ea1373b31b5d21fca8a83cf6ae16121ce5a8f","tarball":"https://registry.npmjs.org/cookie-parser-es/-/cookie-parser-es-1.0.8.tgz","fileCount":4,"unpackedSize":10332,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIG6ZQeO+rGk4NtEQEyciKu5nVSCFJq/QnU7/7uUp+bxRAiBIP2Lu/sV7j2xigIz2DMDnXEDBS/XXqsKCMihS0pGpEw=="}]},"_npmUser":{"name":"jeandupont24","email":"jeandupontmail24@gmail.com"},"directories":{},"maintainers":[{"name":"jeandupont24","email":"jeandupontmail24@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cookie-parser-es_1.0.8_1782198179940_0.4164791768555436"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T06:34:37.602Z","modified":"2026-06-23T07:03:00.175Z","1.0.7":"2026-06-23T06:34:37.798Z","1.0.8":"2026-06-23T07:03:00.062Z"},"bugs":{"url":"https://github.com/expressjs/js-cookie-parser/issues"},"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},"license":"MIT","homepage":"https://github.com/expressjs/js-cookie-parser#readme","keywords":["cookie","middleware"],"repository":{"type":"git","url":"git+https://github.com/expressjs/js-cookie-parser.git"},"description":"Parse HTTP request cookies","contributors":[{"name":"Jean Dupont","email":"jeandupontmail24@gmail.com"}],"maintainers":[{"name":"jeandupont24","email":"jeandupontmail24@gmail.com"}],"readme":"# cookie-parser-es\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-es\n```\n\n## API\n\n```js\nvar cookieParser = require('cookie-parser-es')\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-es')\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-es/master?label=ci\n[ci-url]: https://github.com/expressjs/cookie-parser-es/actions?query=workflow%3Aci\n[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/cookie-parser-es/master\n[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser-es?branch=master\n[npm-downloads-image]: https://badgen.net/npm/dm/cookie-parser-es\n[npm-url]: https://npmjs.org/package/cookie-parser-es\n[npm-version-image]: https://badgen.net/npm/v/cookie-parser-es\n","readmeFilename":"README.md"}