Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to encrypt the sessiondata in the database #111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ See [Changelog.md](Changelog.md)
- `knex` knex instance to use. Defaults to a new knex instance, using sqlite3 with a file named 'connect-session-knex.sqlite'
- `tableName='sessions'` Tablename to use. Defaults to 'sessions'.
- `sidFieldName='sid'` Field name in table to use for storing session ids. Defaults to 'sid'.
- `pass='password'` (optional, if set and vi is set encryption will apply) password for database encryption.
- `iv='1234567890123456'` (optional, if set and vi is set encryption will apply) initialization vector (must be 16 char).
- `salt='salt'` (optional) salt key.

If the table does not exist in the schema, this module will attempt to create it unless the `createTable` option is false.

Expand Down
8 changes: 8 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="node" />
/// <reference types="node" />
import { Knex } from "knex";
import { SessionData, Store } from "express-session";
interface Options {
Expand All @@ -8,12 +9,19 @@ interface Options {
onDbCleanupError: (err: unknown) => void;
tableName: string;
sidFieldName: string;
pass: string;
salt: string;
iv: string;
encryptionkey: Buffer;
encryption: boolean;
}
export declare class ConnectSessionKnexStore extends Store {
options: Options;
nextDbCleanup: NodeJS.Timeout | undefined;
ready: Promise<unknown>;
constructor(incomingOptions: Partial<Options>);
encrypt(sess: string): string;
decrypt(sess: string): SessionData;
get(sid: string, callback: (err: any, session?: SessionData | null) => void): Promise<SessionData | null>;
set(sid: string, session: SessionData, callback?: (err?: any) => void): Promise<void>;
touch(sid: string, session: SessionData, callback?: () => void): Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 36 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading