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

@commercelayer/cli-core

Package Overview
Dependencies
Maintainers
3
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercelayer/cli-core - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

9

lib/cjs/token.d.ts

@@ -26,4 +26,11 @@ export declare type AccessTokenInfo = {

};
export declare type CustomToken = {
accessToken: string;
info: AccessTokenInfo;
expMinutes: number;
};
/** Decode a Commerce Layer access token */
declare const decodeAccessToken: (accessToken: string) => AccessTokenInfo;
export { decodeAccessToken };
/** generate a custom access token */
declare const generateAccessToken: (token: AccessTokenInfo, sharedSecret: string, minutes: number) => CustomToken;
export { decodeAccessToken, generateAccessToken };

2

lib/cjs/token.js

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

"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.decodeAccessToken=void 0;const jsonwebtoken_1=__importDefault(require("jsonwebtoken")),decodeAccessToken=e=>{const o=jsonwebtoken_1.default.decode(e);if(o===null)throw new Error("Error deconding access token");return o};exports.decodeAccessToken=decodeAccessToken;
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateAccessToken=exports.decodeAccessToken=void 0;const jsonwebtoken_1=__importDefault(require("jsonwebtoken")),config_1=__importDefault(require("./config")),decodeAccessToken=e=>{const o=jsonwebtoken_1.default.decode(e);if(o===null)throw new Error("Error deconding access token");return o};exports.decodeAccessToken=decodeAccessToken;const generateAccessToken=(e,o,t)=>{const c=Object.assign(Object.assign({},e),{exp:Math.floor(Date.now()/1e3)+t*60,rand:Math.random()}),n=config_1.default.api.token_encoding_algorithm,s=jsonwebtoken_1.default.sign(c,o,{algorithm:n,noTimestamp:!0}),r=jsonwebtoken_1.default.verify(s,o,{algorithms:[n]});return{accessToken:s,info:r,expMinutes:t}};exports.generateAccessToken=generateAccessToken;

@@ -26,4 +26,11 @@ export declare type AccessTokenInfo = {

};
export declare type CustomToken = {
accessToken: string;
info: AccessTokenInfo;
expMinutes: number;
};
/** Decode a Commerce Layer access token */
declare const decodeAccessToken: (accessToken: string) => AccessTokenInfo;
export { decodeAccessToken };
/** generate a custom access token */
declare const generateAccessToken: (token: AccessTokenInfo, sharedSecret: string, minutes: number) => CustomToken;
export { decodeAccessToken, generateAccessToken };

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

import n from"jsonwebtoken";const r=e=>{const o=n.decode(e);if(o===null)throw new Error("Error deconding access token");return o};export{r as decodeAccessToken};
import t from"jsonwebtoken";import i from"./config";const g=n=>{const o=t.decode(n);if(o===null)throw new Error("Error deconding access token");return o},f=(n,o,e)=>{const s=Object.assign(Object.assign({},n),{exp:Math.floor(Date.now()/1e3)+e*60,rand:Math.random()}),c=i.api.token_encoding_algorithm,r=t.sign(s,o,{algorithm:c,noTimestamp:!0}),a=t.verify(r,o,{algorithms:[c]});return{accessToken:r,info:a,expMinutes:e}};export{g as decodeAccessToken,f as generateAccessToken};
{
"name": "@commercelayer/cli-core",
"version": "0.1.9",
"version": "0.2.0",
"main": "lib/cjs/index.js",

@@ -5,0 +5,0 @@ "types": "lib/cjs/index.d.ts",

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