@konplit-services/common 1.0.399 → 1.0.400

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.
@@ -24,6 +24,18 @@ const currentUser = (req, res, next) => __awaiter(void 0, void 0, void 0, functi
24
24
  if (req.headers["authorization"]) {
25
25
  const token = req.headers["authorization"].split(" ")[1];
26
26
  const payload = yield Jwt_1.JWT.verifyToken(token);
27
+ // Add this debug logic:
28
+ const now = Math.floor(Date.now() / 1000); // Current time in seconds
29
+ const timeElapsed = (now - payload.iat);
30
+ const timeRemaining = payload.exp - now;
31
+ const tokenLifetime = payload.exp - payload.iat;
32
+ console.log({
33
+ issuedAt: new Date(payload.iat * 1000).toISOString(),
34
+ expiresAt: new Date(payload.exp * 1000).toISOString(),
35
+ timeElapsed,
36
+ timeRemaining,
37
+ tokenLifetime,
38
+ });
27
39
  if (payload.type !== Jwt_1.JWTType.ACCESS) {
28
40
  throw new notAuthorized_1.NotAuthorizedError(language_1.lang.not_authorized, error_codes_1.error_codes.INVALID_AUTHORIZATION);
29
41
  }
@@ -12,7 +12,7 @@ export interface JWT_Data {
12
12
  userType: USER_TYPES;
13
13
  accountId?: string;
14
14
  adminId?: string;
15
- iat?: string;
15
+ iat?: number;
16
16
  exp?: number;
17
17
  }
18
18
  export interface TRANSACTION_JWT_DATA {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.399",
3
+ "version": "1.0.400",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",