@tpzdsp/next-toolkit 1.9.2 → 1.9.4
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/package.json +5 -1
- package/src/utils/auth.ts +1 -1
- package/src/utils/utils.ts +2 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpzdsp/next-toolkit",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "A reusable React component library for Next.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -170,6 +170,7 @@
|
|
|
170
170
|
"globals": "^16.3.0",
|
|
171
171
|
"husky": "^9.1.7",
|
|
172
172
|
"jsdom": "^26.1.0",
|
|
173
|
+
"jose": "^6.1.1",
|
|
173
174
|
"jsonwebtoken": "^9.0.2",
|
|
174
175
|
"next": "^15.4.2",
|
|
175
176
|
"ol": "^10.6.1",
|
|
@@ -253,6 +254,9 @@
|
|
|
253
254
|
"geojson": {
|
|
254
255
|
"optional": true
|
|
255
256
|
},
|
|
257
|
+
"jose": {
|
|
258
|
+
"optional": true
|
|
259
|
+
},
|
|
256
260
|
"jsonwebtoken": {
|
|
257
261
|
"optional": true
|
|
258
262
|
},
|
package/src/utils/auth.ts
CHANGED
package/src/utils/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decode } from 'jsonwebtoken';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
|
|
4
4
|
import type { Credentials, DecodedJWT } from '../types/auth';
|
|
@@ -9,14 +9,7 @@ export const decodeAuthToken = (token: string): Credentials | null => {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
const secret = process.env.JWT_SECRET;
|
|
14
|
-
|
|
15
|
-
if (!secret) {
|
|
16
|
-
throw new Error('JWT secret not set');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const user = verify(token, secret) as DecodedJWT;
|
|
12
|
+
const user = decode(token) as unknown as DecodedJWT;
|
|
20
13
|
|
|
21
14
|
return { token, user };
|
|
22
15
|
} catch (error) {
|