Socket
Socket
Sign inDemoInstall

@ahi40/common

Package Overview
Dependencies
8
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.13 to 1.0.14

4

build/errors/not-authorized-error.js

@@ -21,3 +21,3 @@ "use strict";

function NotAuthorizedError() {
var _this = _super.call(this, 'Not Authorized') || this;
var _this = _super.call(this, 'Not Authorized.') || this;
_this.statusCode = 401;

@@ -28,3 +28,3 @@ Object.setPrototypeOf(_this, NotAuthorizedError.prototype);

NotAuthorizedError.prototype.serializeErrors = function () {
return [{ message: 'Not authorized' }];
return [{ message: 'Not authorized. Possibly token expired. Please try to login again' }];
};

@@ -31,0 +31,0 @@ return NotAuthorizedError;

@@ -5,2 +5,3 @@ import { Request, Response, NextFunction } from 'express';

email: string;
exp: number;
}

@@ -7,0 +8,0 @@ declare global {

@@ -15,3 +15,2 @@ "use strict";

var payload = jsonwebtoken_1.default.verify(req.session.jwt, process.env.JWT_KEY);
console.log(payload);
req.currentUser = payload;

@@ -18,0 +17,0 @@ }

@@ -9,3 +9,6 @@ "use strict";

}
if (req.currentUser.exp < Date.now().valueOf() / 1000) {
throw new not_authorized_error_1.NotAuthorizedError();
}
next();
};
{
"name": "@ahi40/common",
"version": "1.0.13",
"version": "1.0.14",
"description": "",

@@ -5,0 +5,0 @@ "main": "./build/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc