@neumatter/stateless-session
v1.0.1
Published
Module for using encrypted stateless sessions.
Downloads
3
Maintainers
Readme
StatelessSession
Module for using encrypted stateless sessions.
Table of Contents
Install
npm i @neumatter/stateless-session
Usage
StatelessSession.get:
import StatelessSession from '@neumatter/stateless-session'
const session = await StatelessSession.get(
req,
res,
{
secret: process.env.SESSION_SECRET,
cookieName: 'appSession',
cookieOptions: {
maxAge: 'P2W2H',
sameSite: true,
secure: process.env.NODE_ENV === 'production'
}
}
)
session.user = { isLoggedIn: false, admin: false }
await session.save()