hono-sessions 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/esm/mod.d.ts +2 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/src/Middleware.d.ts +1 -11
- package/esm/src/Middleware.d.ts.map +1 -1
- package/esm/src/Middleware.js +16 -1
- package/esm/src/Session.d.ts +1 -0
- package/esm/src/Session.d.ts.map +1 -1
- package/esm/src/SessionOptions.d.ts +11 -0
- package/esm/src/SessionOptions.d.ts.map +1 -0
- package/esm/src/SessionOptions.js +1 -0
- package/package.json +2 -2
- package/script/mod.d.ts +2 -1
- package/script/mod.d.ts.map +1 -1
- package/script/src/Middleware.d.ts +1 -11
- package/script/src/Middleware.d.ts.map +1 -1
- package/script/src/Middleware.js +16 -1
- package/script/src/Session.d.ts +1 -0
- package/script/src/Session.d.ts.map +1 -1
- package/script/src/SessionOptions.d.ts +11 -0
- package/script/src/SessionOptions.d.ts.map +1 -0
- package/script/src/SessionOptions.js +2 -0
package/README.md
CHANGED
|
@@ -74,7 +74,9 @@ const store = new CookieStore()
|
|
|
74
74
|
|
|
75
75
|
app.use('*', sessionMiddleware({
|
|
76
76
|
store,
|
|
77
|
-
encryptionKey: 'password_at_least_32_characters_long', // Required for CookieStore, recommended for others
|
|
77
|
+
encryptionKey: 'password_at_least_32_characters_long', // Required for CookieStore, recommended for others.
|
|
78
|
+
// You can also supply a function instead of a plain string
|
|
79
|
+
// encryptionKey: () => 'function_that_returns_a_long_string'
|
|
78
80
|
expireAfterSeconds: 900, // Expire session after 15 minutes of inactivity
|
|
79
81
|
cookieOptions: {
|
|
80
82
|
sameSite: 'Lax', // Recommended for basic CSRF protection in modern browsers
|
|
@@ -151,6 +153,18 @@ import { sessionMiddleware, CookieStore, Session } from 'hono-sessions'
|
|
|
151
153
|
export default app
|
|
152
154
|
```
|
|
153
155
|
|
|
156
|
+
## API
|
|
157
|
+
|
|
158
|
+
The `session` object returned from `c.get('session')` has several methods:
|
|
159
|
+
|
|
160
|
+
- `get(id: string)`: Fetch the value from a given key.
|
|
161
|
+
|
|
162
|
+
- `set(id: string, value: any)`: Set a value that can be serialized with `JSON.stringify()`
|
|
163
|
+
|
|
164
|
+
- `flash(id: string, value: any)`: Similar to `set()`, however the value is deleted immediately after it's read once. Best used for one-off alerts or form validation messages (login failure, etc.)
|
|
165
|
+
|
|
166
|
+
- `forget(id: string)`: Remove a value from the session based on its key
|
|
167
|
+
|
|
154
168
|
## Troubleshooting
|
|
155
169
|
|
|
156
170
|
### TypeScript errors
|
package/esm/mod.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { sessionMiddleware } from './src/Middleware.js';
|
|
|
5
5
|
import { Session } from './src/Session.js';
|
|
6
6
|
import type { SessionData } from './src/Session.js';
|
|
7
7
|
import Store from './src/store/Store.js';
|
|
8
|
+
import type SessionOptions from './src/SessionOptions.js';
|
|
8
9
|
export { MemoryStore, CookieStore, sessionMiddleware, encrypt, decrypt, Session, };
|
|
9
|
-
export type { SessionData, Store };
|
|
10
|
+
export type { SessionData, SessionOptions, Store };
|
|
10
11
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,4BAA4B,CAAA;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EACL,OAAO,EACP,OAAO,EACR,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,4BAA4B,CAAA;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EACL,OAAO,EACP,OAAO,EACR,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EACL,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,OAAO,GACR,CAAA;AAED,YAAY,EACV,WAAW,EACX,cAAc,EACd,KAAK,EACN,CAAA"}
|
package/esm/src/Middleware.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { MiddlewareHandler } from '../deps.js';
|
|
2
|
-
import
|
|
3
|
-
import CookieStore from './store/CookieStore.js';
|
|
4
|
-
import { CookieOptions } from '../deps.js';
|
|
5
|
-
interface SessionOptions {
|
|
6
|
-
store: Store | CookieStore;
|
|
7
|
-
encryptionKey?: string;
|
|
8
|
-
expireAfterSeconds?: number;
|
|
9
|
-
cookieOptions?: CookieOptions;
|
|
10
|
-
sessionCookieName?: string;
|
|
11
|
-
}
|
|
2
|
+
import SessionOptions from './SessionOptions.js';
|
|
12
3
|
/** Function that returns a Hono-compatible session middleware */
|
|
13
4
|
export declare function sessionMiddleware(options: SessionOptions): MiddlewareHandler;
|
|
14
|
-
export {};
|
|
15
5
|
//# sourceMappingURL=Middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/src/Middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,iBAAiB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/src/Middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAGtF,OAAO,cAAc,MAAM,qBAAqB,CAAA;AAEhD,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAwJ5E"}
|
package/esm/src/Middleware.js
CHANGED
|
@@ -4,10 +4,21 @@ import { Session, encrypt, decrypt } from '../mod.js';
|
|
|
4
4
|
/** Function that returns a Hono-compatible session middleware */
|
|
5
5
|
export function sessionMiddleware(options) {
|
|
6
6
|
const store = options.store;
|
|
7
|
-
|
|
7
|
+
let encryptionKey;
|
|
8
8
|
const expireAfterSeconds = options.expireAfterSeconds;
|
|
9
9
|
const cookieOptions = options.cookieOptions;
|
|
10
10
|
const sessionCookieName = options.sessionCookieName || 'session';
|
|
11
|
+
if (options.encryptionKey !== undefined) {
|
|
12
|
+
if (typeof options.encryptionKey === 'function') {
|
|
13
|
+
encryptionKey = options.encryptionKey();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
encryptionKey = options.encryptionKey;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
encryptionKey = undefined;
|
|
21
|
+
}
|
|
11
22
|
if (store instanceof CookieStore) {
|
|
12
23
|
store.sessionCookieName = sessionCookieName;
|
|
13
24
|
if (encryptionKey) {
|
|
@@ -34,6 +45,9 @@ export function sessionMiddleware(options) {
|
|
|
34
45
|
try {
|
|
35
46
|
sid = (encryptionKey ? await decrypt(encryptionKey, sessionCookie) : sessionCookie);
|
|
36
47
|
session_data = await store.getSessionById(sid);
|
|
48
|
+
if (session_data) {
|
|
49
|
+
session_data._id = sid;
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
catch {
|
|
39
53
|
createNewSession = true;
|
|
@@ -68,6 +82,7 @@ export function sessionMiddleware(options) {
|
|
|
68
82
|
}
|
|
69
83
|
else {
|
|
70
84
|
sid = globalThis.crypto.randomUUID();
|
|
85
|
+
defaultData._id = sid;
|
|
71
86
|
await store.createSession(sid, defaultData);
|
|
72
87
|
}
|
|
73
88
|
session.setCache(defaultData);
|
package/esm/src/Session.d.ts
CHANGED
package/esm/src/Session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/src/Session.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAAa,OAAO,CAAC,CAAC,GAAG,GAAG;IAE1B,OAAO,CAAC,KAAK,CAAgB;;IAW7B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAInC,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC;IAI1B,aAAa,CAAC,UAAU,EAAE,MAAM;IAIhC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAMjD,aAAa;IAIb,YAAY,IAAI,OAAO;IAIvB,YAAY;IAIZ,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAe3C,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAA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SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IAMhC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;CAQ7C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Store from './store/Store.js';
|
|
2
|
+
import CookieStore from './store/CookieStore.js';
|
|
3
|
+
import { CookieOptions } from '../deps.js';
|
|
4
|
+
export default interface SessionOptions {
|
|
5
|
+
store: Store | CookieStore;
|
|
6
|
+
encryptionKey?: string | (() => string);
|
|
7
|
+
expireAfterSeconds?: number;
|
|
8
|
+
cookieOptions?: CookieOptions;
|
|
9
|
+
sessionCookieName?: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=SessionOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionOptions.d.ts","sourceRoot":"","sources":["../../src/src/SessionOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAA;AACpC,OAAO,WAAW,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,OAAO,WAAW,cAAc;IACrC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono-sessions",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Cookie-based sessions for Hono web framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"hono": "^4.0.0",
|
|
27
|
-
"iron-webcrypto": "
|
|
27
|
+
"iron-webcrypto": "^1.2.1"
|
|
28
28
|
},
|
|
29
29
|
"_generatedBy": "dnt@dev"
|
|
30
30
|
}
|
package/script/mod.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { sessionMiddleware } from './src/Middleware.js';
|
|
|
5
5
|
import { Session } from './src/Session.js';
|
|
6
6
|
import type { SessionData } from './src/Session.js';
|
|
7
7
|
import Store from './src/store/Store.js';
|
|
8
|
+
import type SessionOptions from './src/SessionOptions.js';
|
|
8
9
|
export { MemoryStore, CookieStore, sessionMiddleware, encrypt, decrypt, Session, };
|
|
9
|
-
export type { SessionData, Store };
|
|
10
|
+
export type { SessionData, SessionOptions, Store };
|
|
10
11
|
//# sourceMappingURL=mod.d.ts.map
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,4BAA4B,CAAA;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EACL,OAAO,EACP,OAAO,EACR,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,4BAA4B,CAAA;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EACL,OAAO,EACP,OAAO,EACR,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,MAAM,sBAAsB,CAAA;AACxC,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EACL,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,OAAO,GACR,CAAA;AAED,YAAY,EACV,WAAW,EACX,cAAc,EACd,KAAK,EACN,CAAA"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { MiddlewareHandler } from '../deps.js';
|
|
2
|
-
import
|
|
3
|
-
import CookieStore from './store/CookieStore.js';
|
|
4
|
-
import { CookieOptions } from '../deps.js';
|
|
5
|
-
interface SessionOptions {
|
|
6
|
-
store: Store | CookieStore;
|
|
7
|
-
encryptionKey?: string;
|
|
8
|
-
expireAfterSeconds?: number;
|
|
9
|
-
cookieOptions?: CookieOptions;
|
|
10
|
-
sessionCookieName?: string;
|
|
11
|
-
}
|
|
2
|
+
import SessionOptions from './SessionOptions.js';
|
|
12
3
|
/** Function that returns a Hono-compatible session middleware */
|
|
13
4
|
export declare function sessionMiddleware(options: SessionOptions): MiddlewareHandler;
|
|
14
|
-
export {};
|
|
15
5
|
//# sourceMappingURL=Middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/src/Middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,iBAAiB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/src/Middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAGtF,OAAO,cAAc,MAAM,qBAAqB,CAAA;AAEhD,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAwJ5E"}
|
package/script/src/Middleware.js
CHANGED
|
@@ -10,10 +10,21 @@ const mod_js_1 = require("../mod.js");
|
|
|
10
10
|
/** Function that returns a Hono-compatible session middleware */
|
|
11
11
|
function sessionMiddleware(options) {
|
|
12
12
|
const store = options.store;
|
|
13
|
-
|
|
13
|
+
let encryptionKey;
|
|
14
14
|
const expireAfterSeconds = options.expireAfterSeconds;
|
|
15
15
|
const cookieOptions = options.cookieOptions;
|
|
16
16
|
const sessionCookieName = options.sessionCookieName || 'session';
|
|
17
|
+
if (options.encryptionKey !== undefined) {
|
|
18
|
+
if (typeof options.encryptionKey === 'function') {
|
|
19
|
+
encryptionKey = options.encryptionKey();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
encryptionKey = options.encryptionKey;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
encryptionKey = undefined;
|
|
27
|
+
}
|
|
17
28
|
if (store instanceof CookieStore_js_1.default) {
|
|
18
29
|
store.sessionCookieName = sessionCookieName;
|
|
19
30
|
if (encryptionKey) {
|
|
@@ -40,6 +51,9 @@ function sessionMiddleware(options) {
|
|
|
40
51
|
try {
|
|
41
52
|
sid = (encryptionKey ? await (0, mod_js_1.decrypt)(encryptionKey, sessionCookie) : sessionCookie);
|
|
42
53
|
session_data = await store.getSessionById(sid);
|
|
54
|
+
if (session_data) {
|
|
55
|
+
session_data._id = sid;
|
|
56
|
+
}
|
|
43
57
|
}
|
|
44
58
|
catch {
|
|
45
59
|
createNewSession = true;
|
|
@@ -74,6 +88,7 @@ function sessionMiddleware(options) {
|
|
|
74
88
|
}
|
|
75
89
|
else {
|
|
76
90
|
sid = globalThis.crypto.randomUUID();
|
|
91
|
+
defaultData._id = sid;
|
|
77
92
|
await store.createSession(sid, defaultData);
|
|
78
93
|
}
|
|
79
94
|
session.setCache(defaultData);
|
package/script/src/Session.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/src/Session.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAAa,OAAO,CAAC,CAAC,GAAG,GAAG;IAE1B,OAAO,CAAC,KAAK,CAAgB;;IAW7B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAInC,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC;IAI1B,aAAa,CAAC,UAAU,EAAE,MAAM;IAIhC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAMjD,aAAa;IAIb,YAAY,IAAI,OAAO;IAIvB,YAAY;IAIZ,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAe3C,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAS1C,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IAMhC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC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1,11 @@
|
|
|
1
|
+
import Store from './store/Store.js';
|
|
2
|
+
import CookieStore from './store/CookieStore.js';
|
|
3
|
+
import { CookieOptions } from '../deps.js';
|
|
4
|
+
export default interface SessionOptions {
|
|
5
|
+
store: Store | CookieStore;
|
|
6
|
+
encryptionKey?: string | (() => string);
|
|
7
|
+
expireAfterSeconds?: number;
|
|
8
|
+
cookieOptions?: CookieOptions;
|
|
9
|
+
sessionCookieName?: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=SessionOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionOptions.d.ts","sourceRoot":"","sources":["../../src/src/SessionOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAA;AACpC,OAAO,WAAW,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,OAAO,WAAW,cAAc;IACrC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B"}
|