@sendhome/common 1.0.154 → 1.0.156

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.
@@ -2,6 +2,7 @@ import { Request, Response, NextFunction } from 'express';
2
2
  interface UserPayload {
3
3
  id: string;
4
4
  email: string;
5
+ sessionId: string;
5
6
  }
6
7
  declare global {
7
8
  namespace Express {
@@ -2,6 +2,7 @@ import { Request, Response, NextFunction } from 'express';
2
2
  interface UserPayload {
3
3
  id: string;
4
4
  email: string;
5
+ sessionId: string;
5
6
  }
6
7
  declare global {
7
8
  namespace Express {
@@ -2,6 +2,7 @@ import { Request, Response, NextFunction } from 'express';
2
2
  interface UserPayload {
3
3
  id: string;
4
4
  email: string;
5
+ sessionId: string;
5
6
  }
6
7
  declare global {
7
8
  namespace Express {
@@ -10,5 +11,5 @@ declare global {
10
11
  }
11
12
  }
12
13
  }
13
- export declare const requireAuth: (sessionServiceUrl: string, deviceInfo: string) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
14
+ export declare const requireAuth: (sessionServiceUrl: string) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
14
15
  export {};
@@ -16,7 +16,7 @@ exports.requireAuth = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
18
18
  // Middleware to validate user session per device
19
- const requireAuth = (sessionServiceUrl, deviceInfo) => {
19
+ const requireAuth = (sessionServiceUrl) => {
20
20
  return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
21
21
  var _a;
22
22
  try {
@@ -29,9 +29,7 @@ const requireAuth = (sessionServiceUrl, deviceInfo) => {
29
29
  // process.env.JWT_KEY!
30
30
  );
31
31
  // Call the session service to validate the session
32
- const response = yield axios_1.default.get(`${sessionServiceUrl}/${payload.id}`, {
33
- params: { device_info: deviceInfo }, // Send the device info for validation
34
- });
32
+ const response = yield axios_1.default.get(`${sessionServiceUrl}/${payload.sessionId}`);
35
33
  if (response.status !== 200) {
36
34
  res.status(401).json({ message: 'Invalid or expired session' });
37
35
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendhome/common",
3
- "version": "1.0.154",
3
+ "version": "1.0.156",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",