Socket
Socket
Sign inDemoInstall

authorized-rules

Package Overview
Dependencies
8
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.2

LICENSE

8

dist/index.d.ts

@@ -1,11 +0,11 @@

export declare type JwtToken = {
export type JwtToken = {
iss: string;
sub: string;
};
export declare type Rule = (token: JwtToken) => Promise<RuleResult>;
export declare type RuleResult = {
export type Rule = (token: JwtToken) => Promise<RuleResult>;
export type RuleResult = {
passed: boolean;
ruleName: string;
};
export declare type Request = {
export type Request = {
headers: {

@@ -12,0 +12,0 @@ authorization: string;

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

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -55,6 +55,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

catch (e) {
throw http_errors_1.default(403, 'invalid token: parse failed');
throw (0, http_errors_1.default)(403, 'invalid token: parse failed');
}
if (!token.iss) {
throw http_errors_1.default(403, 'invalid token: missing issuer');
throw (0, http_errors_1.default)(403, 'invalid token: missing issuer');
}

@@ -65,3 +65,3 @@ return [4 /*yield*/, executionRule(token)];

if (!ruleResult.passed) {
throw http_errors_1.default(403, 'operation not authorized');
throw (0, http_errors_1.default)(403, 'operation not authorized');
}

@@ -122,3 +122,3 @@ return [2 /*return*/];

exports.or = or;
var parseToken = function (token) { return jwt_decode_1.default(token); };
var parseToken = function (token) { return (0, jwt_decode_1.default)(token); };
//# sourceMappingURL=index.js.map
{
"name": "authorized-rules",
"version": "0.4.0",
"version": "0.4.2",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "rm -rf dist && tsc",
"prepublish": "yarn build",
"build": "tsc",
"prepublish": "npm run build",
"test": "jest --config=tests/jest.config.unit.js"

@@ -13,26 +13,11 @@ },

"type": "git",
"url": "git+https://github.com/guysegal/authorized-rules.git"
"url": "https://github.com/Soluto/authorized-rules.git"
},
"author": "",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/guysegal/authorized-rules/issues"
"url": "https://github.com/Soluto/authorized-rules/issues"
},
"homepage": "https://github.com/guysegal/authorized-rules#readme",
"devDependencies": {
"@types/http-errors": "^1.8.0",
"@types/jest": "^26.0.20",
"@types/jsonwebtoken": "^8.5.0",
"@typescript-eslint/eslint-plugin": "^4.13.0",
"@typescript-eslint/parser": "^4.13.0",
"eslint": "^7.17.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"husky": "^4.3.7",
"jest": "^26.6.3",
"jsonwebtoken": "^8.5.1",
"lint-staged": "^10.5.3",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
},
"files": [
"dist"
],
"dependencies": {

@@ -42,3 +27,16 @@ "@types/jwt-decode": "^3.1.0",

"jwt-decode": "^3.1.2"
},
"devDependencies": {
"@types/http-errors": "^2.0.1",
"@types/jest": "^29.5.3",
"@types/jsonwebtoken": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"eslint": "^8.47.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"jest": "^29.6.2",
"jsonwebtoken": "^8.5.1",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc