Socket
Socket
Sign inDemoInstall

@ahi40/common

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahi40/common - npm Package Compare versions

Comparing version 1.0.26 to 1.0.27

2

build/errors/not-authorized-error.js

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

var _this = _super.call(this, 'Not Authorized.') || this;
_this.statusCode = 409;
_this.statusCode = 401;
Object.setPrototypeOf(_this, NotAuthorizedError.prototype);

@@ -25,0 +25,0 @@ return _this;

@@ -22,4 +22,3 @@ "use strict";

var _this = _super.call(this, 'Token expired.') || this;
_this.statusCode = 408;
console.log('token expired handler');
_this.statusCode = 401;
Object.setPrototypeOf(_this, TokenExpiredCustomError.prototype);

@@ -26,0 +25,0 @@ return _this;

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

var _a;
console.log('run curr user');
if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {

@@ -14,19 +13,12 @@ console.log(req.session);

}
// check if token has expired
try {
console.log('try payload');
var payload = null;
payload = jsonwebtoken_1.verify(req.session.jwt, process.env.JWT_KEY);
req.currentUser = payload;
console.log('payload jwt');
console.log(payload);
}
catch (err) {
console.log('caught err');
if (err instanceof jsonwebtoken_1.TokenExpiredError) {
throw new token_expired_error_1.TokenExpiredCustomError();
}
console.log('caught error verify');
console.log(err.message);
console.log('\n\n\n');
console.log(err);
throw err;

@@ -33,0 +25,0 @@ }

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

exports.requireAuth = function (req, res, next) {
console.log('run rq');
if (!req.currentUser) {
console.log('no user set');
throw new not_authorized_error_1.NotAuthorizedError();

@@ -11,0 +9,0 @@ }

{
"name": "@ahi40/common",
"version": "1.0.26",
"version": "1.0.27",
"description": "",

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc