koajs / session

Simple session middleware for koa
MIT License
902 stars 113 forks source link

Adding an additional session #62

Closed jcalfee closed 8 years ago

jcalfee commented 8 years ago

I would like to introduce a secure session in our app changing the existing and behaviour of this.session. So, for example I might add this.secure_session and provide my own encode and decode methods.

Could this be as simple as adding a context_name configuration?

const session = require('koa-session')
const cryptoSession = require('koa-crypto-session')

app.use(session({context_name: 'session'}, app));
app.use(cryptoSession({context_name: 'secure_session'}, app));

// this.session
// this.secure_session

I found two references to 'session' .. __defineGetter__ and __defineSetter__

jcalfee commented 8 years ago

I think we are going to just use this.session as the secure session.