{
  "author": {
    "name": "Isaac Z. Schlueter",
    "email": "i@izs.me",
    "url": "http://blog.izs.me/"
  },
  "name": "redsess",
  "description": "Yet another redis session thing for node",
  "version": "0.3.2",
  "repository": {
    "type": "git",
    "url": "git://github.com/isaacs/redsess.git"
  },
  "main": "redsess.js",
  "dependencies": {
    "redis": "~0.8.1",
    "cookies": "~0.3.2",
    "keygrip": "~0.2.2"
  },
  "optionalDependencies": {
    "keygrip": "~0.2.2"
  },
  "engines": {
    "node": ">=0.7.7"
  },
  "devDependencies": {
    "tap": "~0.2.4",
    "request": "~2.9.150"
  },
  "scripts": {
    "test": "tap test/*.js"
  },
  "readme": "# redsess\n\nYet another redis session thing for node.\n\nThis is built on top of [jed/cookies](https://github.com/jed/cookies).\nYou can optionally pass in a KeyGrip instance, or an array of keys to\nuse to sign cookies.\n\n## Example\n\n```javascript\nvar RedSess = require('redsess')\n, http = require('http')\n, Cookies = require('cookies')\n, Keygrip = require('keygrip')\n, keys = new Keygrip(['some secret keys here'])\n\n// Create a client with the options that you'd pass to node_redis\nRedSess.createClient(redisOptions)\n\nhttp.createServer(function (req, res) {\n  var session = new RedSess(req, res, {\n    keys: keys, // if keys are provided, they'll be used\n    cookieName: 's',\n    expire: expirationInSeconds, // default = 2 weeks\n    client: redisClient, // defaults to RedSess.client\n    keys: [ \"this is a string key\" ], // will be made into a keygrip obj\n    keys: new KeyGrip(keys), // this way also works\n  })\n\n  // you can decorate like this if you chose\n  req.session = session\n  res.session = session\n\n  // .. and then some time later ..\n  req.session.get('auth', function (er, auth) {\n    if (!auth) {\n      // redirect to login page\n    } else {\n      // do authorized login things\n    }\n  })\n\n  // .. on the login page, if there's a post ..\n  validateLogin(postedData, function (er, isValid) {\n    if (isValid)\n      req.session.set('auth', postedData)\n  })\n\n  // .. on the logout page ..\n  req.session.del('auth', function (er) {\n    // user is now logged out\n  })\n}).listen(1337)\n```\n\n## Constructor Options\n\n* `expire` {Number} Time in seconds that sessions last Default=2 weeks\n* `cookieName` {String} Cookie name to use for session id's. Default = 's'\n* `keys` A [Keygrip](https://github.com/jed/keygrip) instance to use\n  to sign the session token cookie.  (If an array is passed in, then\n  RedSess will make a KeyGrip obj out of it.)\n* `client` If you have another redis client you'd like to use, then\n  you can do so.\n* `cookies` If you already have a Cookies object, you may pass that\n  in.  If not specified, then it'll make a new one for you.\n* `cookieOptions` an object that extends the options object that is passed to\n  `cookies.set` and `cookies.get`\n\n## Methods\n\nCallbacks are all the standard `cb(er, result)` style.\n\nDeep objects are supported, but cycles in data objects will cause\nterrible explosively bad awful undefined behavior, so DON'T DO THAT.\n\n* RedSess.createClient(opts)\n\nCalls `redis.createClient` with the supplied options.  See\n[node_redis](https://github.com/mranney/node_redis) for more details.\n(opts.host and opts.port are passed to redis.createClient as positional\narguments, not on the configuration object.)\n\nIf there's an `opts.auth` member, then it will use that string as a\npassword to redis.\n\n* session.set(k, v, cb)\n\nSets a key on the session.\n\n* session.set(object, cb)\n\nSets a hash of keys and values on the session.\n\n* session.get(k, cb)\n\nFetches the key from the session.\n\n* session.get(cb)\n\nFetches all keys from the session.  If there is no data in the\nsession, then it'll return `null`.\n\n* session.del(k, cb)\n\nDeletes a key from the session.\n\n* session.del(cb)\n\nDeletes the entire session.\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/isaacs/redsess/issues"
  },
  "_id": "redsess@0.3.2",
  "_from": "redsess@latest"
}
