Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-session

Package Overview
Dependencies
Maintainers
8
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-session - npm Package Compare versions

Comparing version 5.5.0 to 5.5.1

8

History.md
5.5.1 / 2017-11-17
==================
**others**
* [[`b976b10`](http://github.com/koajs/session/commit/b976b10212f522b675711badb7ce1bc9a909d19d)] - perf: no need to assign opts (#103) (Yiyu He <<dead_horse@qq.com>>)
* [[`c040b59`](http://github.com/koajs/session/commit/c040b5997d35267a3a65becf91e327615ff17fa5)] - chore: fix example bug and use syntactic sugar (#97) (Runrioter Wung <<runrioter@gmail.com>>)
* [[`906277a`](http://github.com/koajs/session/commit/906277a3c9995ed4f07d2cee55e3020af0c75168)] - docs: copyediting (#85) (Nate Silva <<natesilva@users.noreply.github.com>>)
5.5.0 / 2017-08-04

@@ -3,0 +11,0 @@ ==================

4

index.js

@@ -27,5 +27,3 @@ 'use strict';

if (opts && typeof opts.use === 'function') {
const tmp = app;
app = opts;
opts = tmp;
[ app, opts ] = [ opts, app ];
}

@@ -32,0 +30,0 @@ // app required

@@ -17,3 +17,3 @@ 'use strict';

this.ctx = ctx;
this.opts = Object.assign({}, opts);
this.opts = opts || {};
this.store = this.opts.ContextStore ? new this.opts.ContextStore(ctx) : this.opts.store;

@@ -20,0 +20,0 @@ }

@@ -5,3 +5,3 @@ {

"repository": "koajs/session",
"version": "5.5.0",
"version": "5.5.1",
"keywords": [

@@ -43,2 +43,2 @@ "koa",

}
}
}

@@ -29,3 +29,3 @@ # koa-session

Simple session middleware for Koa. default is cookie-based session and support external store.
Simple session middleware for Koa. Defaults to cookie-based sessions and supports external stores.

@@ -99,9 +99,9 @@ *Requires Node 7.6 or greater for async/await support*

Session will store in cookie by default, but it has some disadvantages:
The session is stored in a cookie by default, but it has some disadvantages:
- Session stored in client side unencrypted.
- [Browser cookie always have length limit](http://browsercookielimits.squawky.net/).
- Session is stored on client side unencrypted
- [Browser cookies always have length limits](http://browsercookielimits.squawky.net/)
You can store the session content in external stores(redis, mongodb or other DBs) by pass `options.store` with three methods(need to be async function):
You can store the session content in external stores (Redis, MongoDB or other DBs) by passing `options.store` with three methods (these need to be async functions):

@@ -113,4 +113,5 @@ - `get(key, maxAge, { rolling })`: get session object by key

Once you passed `options.store`, session is strong dependent on your external store, you can't access session if your external store is down. **Use external session stores only if necessary, avoid use session as a cache, keep session lean and stored by cookie!**
Once you pass `options.store`, session storage is dependent on your external store -- you can't access the session if your external store is down. **Use external session stores only if necessary, avoid uisng session as a cache, keep the session lean, and store it in a cookie if possible!**
The way of generating external session id is controlled by the `options.genid`, which defaults to `uid.sync(24)`.

@@ -117,0 +118,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc