@zodic/shared 0.0.2 → 0.0.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/middleware/index.ts +5 -5
- package/package.json +1 -1
package/middleware/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getCookie } from
|
|
2
|
-
import {
|
|
3
|
-
import { verifyToken } from
|
|
1
|
+
import { getCookie } from 'hono/cookie';
|
|
2
|
+
import { AuthCtx } from '../types';
|
|
3
|
+
import { verifyToken } from '../utils';
|
|
4
4
|
|
|
5
|
-
export const jwtMiddleware = async (c:
|
|
5
|
+
export const jwtMiddleware = async (c: AuthCtx, next: () => Promise<void>) => {
|
|
6
6
|
let token: string | undefined = undefined;
|
|
7
7
|
|
|
8
8
|
// Check for the Authorization header
|
|
@@ -29,4 +29,4 @@ export const jwtMiddleware = async (c: Ctx, next: () => Promise<void>) => {
|
|
|
29
29
|
console.error(err.message);
|
|
30
30
|
return c.json({ error: 'Unauthorized: Invalid or expired token' }, 401);
|
|
31
31
|
}
|
|
32
|
-
};
|
|
32
|
+
};
|