Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@icgc-argo/ego-token-utils

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@icgc-argo/ego-token-utils - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

26

dist/ego-token-utils.es5.js

@@ -235,7 +235,7 @@ /**

var authorizedProgramScopes = getReadableProgramScopes(args.egoJwt);
return (isDccMember(args.egoJwt) ||
authorizedProgramScopes.some(function (_a) {
var policy = _a.policy;
return policy.includes(args.programId);
}));
var programIds = authorizedProgramScopes.map(function (_a) {
var policy = _a.policy;
return policy.replace(PROGRAM_PREFIX, '');
});
return isDccMember(args.egoJwt) || programIds.some(function (id) { return id === args.programId; });
};

@@ -251,7 +251,14 @@ /**

var policy = _a.policy, permission = _a.permission;
return policy.includes(args.programId) &&
[PERMISSIONS.WRITE, PERMISSIONS.ADMIN].includes(permission);
var programId = policy.replace(PROGRAM_PREFIX, '');
return (programId === args.programId && [PERMISSIONS.WRITE, PERMISSIONS.ADMIN].includes(permission));
}));
};
/**
* checks if a given token can read any program at all
* @param egoJwt the ego token
*/
var canReadSomeProgram = function (egoJwt) {
return isDccMember(egoJwt) || !!getReadableProgramScopes(egoJwt).length;
};
/**
* check if a given JWT has admin access to program with given id

@@ -279,7 +286,8 @@ * @param args

canWriteProgram: canWriteProgram,
isProgramAdmin: isProgramAdmin
isProgramAdmin: isProgramAdmin,
canReadSomeProgram: canReadSomeProgram
};
export default egoTokenUtils;
export { isPermission, decodeToken, isValidJwt, isDccMember, isRdpcMember, parseScope, serializeScope, getReadableProgramScopes, canReadProgram, canWriteProgram, isProgramAdmin };
export { isPermission, decodeToken, isValidJwt, isDccMember, isRdpcMember, parseScope, serializeScope, getReadableProgramScopes, canReadProgram, canWriteProgram, canReadSomeProgram, isProgramAdmin };
//# sourceMappingURL=ego-token-utils.es5.js.map

@@ -241,7 +241,7 @@ (function (global, factory) {

var authorizedProgramScopes = getReadableProgramScopes(args.egoJwt);
return (isDccMember(args.egoJwt) ||
authorizedProgramScopes.some(function (_a) {
var policy = _a.policy;
return policy.includes(args.programId);
}));
var programIds = authorizedProgramScopes.map(function (_a) {
var policy = _a.policy;
return policy.replace(PROGRAM_PREFIX, '');
});
return isDccMember(args.egoJwt) || programIds.some(function (id) { return id === args.programId; });
};

@@ -257,7 +257,14 @@ /**

var policy = _a.policy, permission = _a.permission;
return policy.includes(args.programId) &&
[PERMISSIONS.WRITE, PERMISSIONS.ADMIN].includes(permission);
var programId = policy.replace(PROGRAM_PREFIX, '');
return (programId === args.programId && [PERMISSIONS.WRITE, PERMISSIONS.ADMIN].includes(permission));
}));
};
/**
* checks if a given token can read any program at all
* @param egoJwt the ego token
*/
var canReadSomeProgram = function (egoJwt) {
return isDccMember(egoJwt) || !!getReadableProgramScopes(egoJwt).length;
};
/**
* check if a given JWT has admin access to program with given id

@@ -285,3 +292,4 @@ * @param args

canWriteProgram: canWriteProgram,
isProgramAdmin: isProgramAdmin
isProgramAdmin: isProgramAdmin,
canReadSomeProgram: canReadSomeProgram
};

@@ -299,2 +307,3 @@

exports.canWriteProgram = canWriteProgram;
exports.canReadSomeProgram = canReadSomeProgram;
exports.isProgramAdmin = isProgramAdmin;

@@ -301,0 +310,0 @@ exports.default = egoTokenUtils;

@@ -137,7 +137,7 @@ "use strict";

var authorizedProgramScopes = exports.getReadableProgramScopes(args.egoJwt);
return (exports.isDccMember(args.egoJwt) ||
authorizedProgramScopes.some(function (_a) {
var policy = _a.policy;
return policy.includes(args.programId);
}));
var programIds = authorizedProgramScopes.map(function (_a) {
var policy = _a.policy;
return policy.replace(PROGRAM_PREFIX, '');
});
return exports.isDccMember(args.egoJwt) || programIds.some(function (id) { return id === args.programId; });
};

@@ -153,7 +153,14 @@ /**

var policy = _a.policy, permission = _a.permission;
return policy.includes(args.programId) &&
[PERMISSIONS.WRITE, PERMISSIONS.ADMIN].includes(permission);
var programId = policy.replace(PROGRAM_PREFIX, '');
return (programId === args.programId && [PERMISSIONS.WRITE, PERMISSIONS.ADMIN].includes(permission));
}));
};
/**
* checks if a given token can read any program at all
* @param egoJwt the ego token
*/
exports.canReadSomeProgram = function (egoJwt) {
return exports.isDccMember(egoJwt) || !!exports.getReadableProgramScopes(egoJwt).length;
};
/**
* check if a given JWT has admin access to program with given id

@@ -181,4 +188,5 @@ * @param args

canWriteProgram: exports.canWriteProgram,
isProgramAdmin: exports.isProgramAdmin
isProgramAdmin: exports.isProgramAdmin,
canReadSomeProgram: exports.canReadSomeProgram
};
//# sourceMappingURL=ego-token-utils.js.map

@@ -94,2 +94,7 @@ declare const PERMISSIONS: {

/**
* checks if a given token can read any program at all
* @param egoJwt the ego token
*/
export declare const canReadSomeProgram: (egoJwt: string) => boolean;
/**
* check if a given JWT has admin access to program with given id

@@ -123,3 +128,4 @@ * @param args

}) => boolean;
canReadSomeProgram: (egoJwt: string) => boolean;
};
export default _default;
{
"name": "@icgc-argo/ego-token-utils",
"version": "3.1.0",
"version": "3.2.0",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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