hono-sessions 0.8.0 → 0.8.1

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 CHANGED
@@ -174,21 +174,6 @@ The `session` object returned from `c.get('session')` has several methods:
174
174
 
175
175
  - `forget(id: string)`: Remove a value from the session based on its key
176
176
 
177
- ## Troubleshooting
178
-
179
- ### TypeScript errors
180
-
181
- Hono has a high upgrade frequency, but the API for middleware this library relies on remains largely unchanged between Hono releases. You may experience a TypeScript error if you use this library with the latest version of Hono. In that case, before you load the middleware into your Hono app, you might want to have TypeScript ignore this error:
182
-
183
- ```ts
184
- // @ts-ignore
185
- app.use('*', sessionMiddleware({
186
- // ...
187
- }))
188
- ```
189
-
190
- TypeScript should otherwise work normally.
191
-
192
177
  ## Contributing
193
178
 
194
179
  This package is built Deno-first, so you'll need to have Deno installed in your development environment. See their [website](https://deno.com/) for installation instructions specific to your platform.
@@ -37,7 +37,7 @@ export function sessionMiddleware(options) {
37
37
  let sid = '';
38
38
  let session_data;
39
39
  let createNewSession = false;
40
- const sessionCookie = getCookie(c, sessionCookieName);
40
+ const sessionCookie = getCookie(c, sessionCookieName, cookieOptions?.prefix);
41
41
  if (sessionCookie) { // If there is a session cookie present...
42
42
  if (store instanceof CookieStore) {
43
43
  session_data = await store.getSession(c);
@@ -29,7 +29,7 @@ class CookieStore {
29
29
  }
30
30
  async getSession(c) {
31
31
  let session_data_raw;
32
- const sessionCookie = getCookie(c, this.sessionCookieName);
32
+ const sessionCookie = getCookie(c, this.sessionCookieName, this.cookieOptions?.prefix);
33
33
  if (this.encryptionKey && sessionCookie) {
34
34
  // Decrypt cookie string. If decryption fails, return null
35
35
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono-sessions",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Cookie-based sessions for Hono web framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,9 +23,11 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "hono": "^4.0.0",
27
26
  "iron-webcrypto": "^1.2.1",
28
27
  "ohash": "^2"
29
28
  },
30
- "_generatedBy": "dnt@dev"
29
+ "_generatedBy": "dnt@dev",
30
+ "peerDependencies": {
31
+ "hono": "^4.0.0"
32
+ }
31
33
  }
@@ -43,7 +43,7 @@ function sessionMiddleware(options) {
43
43
  let sid = '';
44
44
  let session_data;
45
45
  let createNewSession = false;
46
- const sessionCookie = (0, deps_js_1.getCookie)(c, sessionCookieName);
46
+ const sessionCookie = (0, deps_js_1.getCookie)(c, sessionCookieName, cookieOptions?.prefix);
47
47
  if (sessionCookie) { // If there is a session cookie present...
48
48
  if (store instanceof CookieStore_js_1.default) {
49
49
  session_data = await store.getSession(c);
@@ -31,7 +31,7 @@ class CookieStore {
31
31
  }
32
32
  async getSession(c) {
33
33
  let session_data_raw;
34
- const sessionCookie = (0, deps_js_1.getCookie)(c, this.sessionCookieName);
34
+ const sessionCookie = (0, deps_js_1.getCookie)(c, this.sessionCookieName, this.cookieOptions?.prefix);
35
35
  if (this.encryptionKey && sessionCookie) {
36
36
  // Decrypt cookie string. If decryption fails, return null
37
37
  try {