auth/session
Cookie-session auth for Express: signed session middleware, bcrypt hashing and a guard.
Provides: auth, auth:session
Requires: http:express, config:env
Conflicts with: auth
Files it writes
src/lib/password.ts(whenprovides('language:typescript'))src/lib/password.js(whenprovides('language:javascript'))src/middlewares/auth.ts(whenprovides('language:typescript'))src/middlewares/auth.js(whenprovides('language:javascript'))src/types/session.d.ts(whenprovides('language:typescript'))
Dependencies
express-session@^1.18.2bcryptjs@^3.0.2
Development only:
@types/express-session@^1.18.2(whenprovides('language:typescript'))@types/bcryptjs@^3.0.0(whenprovides('language:typescript'))
Environment
| Variable | Required | Description |
|---|---|---|
SESSION_SECRET | yes | Key used to sign the session cookie; at least 32 characters |
What it contributes to other files
| File | Slot | Line |
|---|---|---|
src/config/env.ts|js | env-schema | SESSION_SECRET: z.string().min(32, 'SESSION_SECRET must be at least 32 characters'), |
src/app.ts|js | imports | import session from 'express-session'; |
src/app.ts|js | imports | import { env } from './config/env.js'; |
src/app.ts|js | middleware | app.use( |
Use it
atarashi new my-app --add auth/session
atarashi add auth/session
Version 1.0.0. Format reference: Authoring blueprints.
Part of the atarashi documentation, written and maintained by Gautam Suthar.