{ "name": "cookie-session", "description": "cookie session middleware", "repository": { "type": "git", "url": "git://github.com/expressjs/cookie-session" }, "version": "1.1.0", "keywords": [ "connect", "express", "middleware", "session" ], "dependencies": { "cookies": "0.5.0", "debug": "~2.1.0", "on-headers": "~1.0.0" }, "devDependencies": { "connect": "3", "istanbul": "0.3.2", "mocha": "~2.0.1", "supertest": "~0.14.0" }, "files": [ "HISTORY.md", "LICENSE", "README.md", "index.js" ], "license": "MIT", "scripts": { "test": "mocha --check-leaks --reporter spec --bail test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" }, "readme": "# cookie-session\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n[![Gratipay][gratipay-image]][gratipay-url]\n\n Simple cookie-based session middleware.\n\n## Semantics\n\n This module provides \"guest\" sessions, meaning any visitor will have a session,\n authenticated or not. If a session is _new_ a `Set-Cookie` will be produced regardless\n of populating the session.\n\n## Install\n\n```bash\n$ npm install cookie-session\n```\n\n## API\n\n View counter example:\n\n```js\nvar express = require('express')\nvar session = require('cookie-session')\n\nvar app = express()\n\napp.set('trust proxy', 1) // trust first proxy\n\napp.use(session({\n keys: ['key1', 'key2']\n}))\n\napp.use(function (req, res, next) {\n var n = req.session.views || 0\n req.session.views = ++n\n res.end(n + ' views')\n})\n\napp.listen(3000)\n```\n\n### Options\n\n - `name` - The cookie name. Defaults to `express:sess`.\n - `keys` - Keys with which to sign the cookie. See `signed` in cookie options. Multiple keys allows for using rotating credentials.\n - `secret` - A string which will be used as single key if `keys` is not found.\n\n Other options are passed to `cookies.get()` and\n `cookies.set()` allowing you to control security, domain, path,\n and signing among other settings.\n\n#### Cookie Options\n\nThe options can also contain any of the follow (for the full list, see [cookies module documentation](https://www.npmjs.org/package/cookies#readme):\n\n - `maxAge`: a number representing the milliseconds from `Date.now()` for expiry\n - `expires`: a `Date` object indicating the cookie's expiration date (expires at the end of session by default).\n - `path`: a string indicating the path of the cookie (`/` by default).\n - `domain`: a string indicating the domain of the cookie (no default).\n - `secure`: a boolean indicating whether the cookie is only to be sent over HTTPS (`false` by default for HTTP, `true` by default for HTTPS).\n - `secureProxy`: a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process).\n - `httpOnly`: a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (`true` by default).\n - `signed`: a boolean indicating whether the cookie is to be signed (`false` by default). If this is true, another cookie of the same name with the `.sig` suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of _cookie-name_=_cookie-value_ against the first [Keygrip](https://github.com/expressjs/keygrip) key. This signature key is used to detect tampering the next time a cookie is received.\n - `overwrite`: a boolean indicating whether to overwrite previously set cookies of the same name (`false` by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.\n\n### Session.isNew\n\n Is `true` if the session is new.\n\n### Destroying a session\n\n To destroy a session simply set it to `null`:\n\n```js\nreq.session = null\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/cookie-session.svg?style=flat\n[npm-url]: https://npmjs.org/package/cookie-session\n[travis-image]: https://img.shields.io/travis/expressjs/cookie-session.svg?style=flat\n[travis-url]: https://travis-ci.org/expressjs/cookie-session\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/cookie-session.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/expressjs/cookie-session?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/cookie-session.svg?style=flat\n[downloads-url]: https://npmjs.org/package/cookie-session\n[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg?style=flat\n[gratipay-url]: https://www.gratipay.com/dougwilson/\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/expressjs/cookie-session/issues" }, "homepage": "https://github.com/expressjs/cookie-session", "_id": "cookie-session@1.1.0", "_shasum": "3bd42bfdfac360d80dd8b0842c6aa4a83e2e2470", "_from": "cookie-session@^1.0.2", "_resolved": "https://registry.npmjs.org/cookie-session/-/cookie-session-1.1.0.tgz" }