New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mojaloop/security-bc-client-lib

Package Overview
Dependencies
Maintainers
5
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mojaloop/security-bc-client-lib - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

3

dist/token_helper.d.ts
import { ILogger } from "@mojaloop/logging-bc-public-types-lib";
import { ITokenHelper } from "@mojaloop/security-bc-public-types-lib";
import { CallSecurityContext, ITokenHelper } from "@mojaloop/security-bc-public-types-lib";
export declare const DEFAULT_JWKS_PATH = "/.well-known/jwks.json";

@@ -28,2 +28,3 @@ export declare class TokenHelper implements ITokenHelper {

verifyToken(accessToken: string): Promise<boolean>;
getCallSecurityContextFromAccessToken(accessToken: string): Promise<CallSecurityContext | null>;
}

@@ -115,4 +115,29 @@ /*****

}
async getCallSecurityContextFromAccessToken(accessToken) {
try {
const verified = await this.verifyToken(accessToken);
if (!verified) {
return null;
}
const decoded = this.decodeToken(accessToken);
if (!decoded.sub || decoded.sub.indexOf("::") == -1) {
return null;
}
const subSplit = decoded.sub.split("::");
const subjectType = subSplit[0];
const subject = subSplit[1];
return {
accessToken: accessToken,
clientId: subjectType.toUpperCase().startsWith("APP") ? subject : null,
username: subjectType.toUpperCase().startsWith("USER") ? subject : null,
platformRoleIds: decoded.platformRoles,
};
}
catch (err) {
this._logger.error(err, "unable to verify token");
return null;
}
}
}
exports.TokenHelper = TokenHelper;
//# sourceMappingURL=token_helper.js.map
{
"name": "@mojaloop/security-bc-client-lib",
"version": "0.3.2",
"version": "0.3.3",
"description": "Mojaloop security authentication and authorization client library",

@@ -41,3 +41,3 @@ "license": "Apache-2.0",

"@mojaloop/logging-bc-public-types-lib": "~0.1.20",
"@mojaloop/security-bc-public-types-lib": "~0.3.0",
"@mojaloop/security-bc-public-types-lib": "~0.3.2",
"axios": "^1.3.4",

@@ -44,0 +44,0 @@ "jsonwebtoken": "^9.0.0",

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