Permalink
Browse files

updated README

  • Loading branch information...
1 parent f7e7b3e commit ec6f15648011a4274b546289c80446f50e7da6ce @caolan committed Jul 28, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 README.md
View
@@ -0,0 +1,29 @@
+# Cookie-Sessions
+
+Secure cookie-based session middleware for
+[Connect](http://github.com/senchalabs/connect). This is a new module and I
+wouldn't recommend for production use just yet.
+
+Session data is stored on the request object in the 'session' property:
+
+ var connect = require('connect'),
+ session = require('cookie-sessions');
+
+ Connect.createServer(
+ sessions.filter({secret: '123abc'}),
+ function(req, res, next){
+ req.session = {'hello':'world'};
+ res.writeHead(200, {'Content-Type':'text/plain'});
+ res.end('session data updated');
+ }
+ ).listen(8080);
+
+The session data is JSON.stringified, encrypted and timestamped, then a HMAC
+signature is attached to test for tampering. The sessions.filter function
+accepts a number of options:
+
+ * secret -- The secret to encrypt the session data with
+ * timeout -- The amount of time in miliseconds before the cookie expires
+ (default: 24 hours)
+ * session_key -- The cookie key name to store the session data in
+ (default: _node)

0 comments on commit ec6f156

Please sign in to comment.