Socket
Socket
Sign inDemoInstall

@strivve/strivve-sdk

Package Overview
Dependencies
269
Maintainers
3
Versions
154
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

lib/CardsavrHelper.d.ts

6

lib/cardsavr/CardsavrJSLibrary-2.0.js

@@ -85,8 +85,8 @@ "use strict";

var package_json_1 = require("../../package.json");
var https_proxy_agent_1 = require("https-proxy-agent");
//import { HttpsProxyAgent } from "https-proxy-agent";
var CardsavrSession = /** @class */ (function () {
function CardsavrSession(baseUrl, sessionKey, appName, rejectUnauthorized, cardsavrCert, proxy, debug) {
var _this = this;
if (rejectUnauthorized === void 0) { rejectUnauthorized = true; }
if (debug === void 0) { debug = false; }
var _this = this;
this.setSessionHeaders = function (headersObject) {

@@ -172,3 +172,3 @@ Object.assign(_this._headers, headersObject);

agent = (this._proxy) ?
new https_proxy_agent_1.HttpsProxyAgent(this._proxy) :
/*new HttpsProxyAgent(this._proxy) */ undefined :
new https_1.Agent(__assign({ rejectUnauthorized: this._rejectUnauthorized }, (this._cardsavrCert && { ca: this._cardsavrCert })));

@@ -175,0 +175,0 @@ config = Object.assign(config, {

import { CardsavrSession } from "./CardsavrJSLibrary-2.0";
declare type MessageHandler = (message: jobMessage) => void;
declare type cardholder_data = {
type MessageHandler = (message: jobMessage) => void;
type cardholder_data = {
[k: string]: any;
};
declare type account = {
type account = {
[k: string]: any;
};
declare type card_data = {
type card_data = {
[k: string]: any;

@@ -35,4 +35,12 @@ };

termination_type?: string;
status_message: string;
job_duration: number;
};
error_message?: string;
account_link?: {
key_name: string;
type: string;
secret: string;
label: string;
}[];
}

@@ -39,0 +47,0 @@ interface placeCardOnSiteParams extends placeCardParams {

@@ -25,3 +25,5 @@ import { APIFilter } from "./CardsavrSessionUtilities";

private setSessionToken;
sendRequest: (path: string, method: "get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | undefined, requestBody?: any, headersToAdd?: {}) => Promise<any>;
sendRequest: (path: string, method: "get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | undefined, requestBody?: {
[key: string]: unknown;
} | undefined, headersToAdd?: {}) => Promise<any>;
get: (path: string, filter: APIFilter, headersToAdd?: {}) => Promise<any>;

@@ -58,3 +60,3 @@ post: (path: string, body: any, headersToAdd?: {}) => Promise<any>;

createCard: (body: APIFilter, safeKey?: string | null, headersToAdd?: {}) => Promise<any>;
updateCard: (id: number, body: any, safe_key: string | null, headersToAdd?: {}) => Promise<any>;
updateCard: (id: number, body: any, safeKey: string | null, headersToAdd?: {}) => Promise<any>;
deleteCard: (id: number, headersToAdd?: {}) => Promise<any>;

@@ -69,3 +71,3 @@ getCardPlacementResults: (filter: APIFilter, pagingHeader?: {}, headersToAdd?: {}) => Promise<any>;

registerForJobStatusUpdates: (jobId: number, headersToAdd?: {}) => Promise<any>;
getCardholderMessages: (cardholderId: number, cardsavrMessagingAccessKey?: string | undefined, headersToAdd?: {}) => Promise<any>;
getCardholderMessages: (cardholderId: number, cardsavrMessagingAccessKey?: string, headersToAdd?: {}) => Promise<any>;
getJobStatusUpdate: (jobId: number, cardsavrMessagingAccessKey: string, headersToAdd?: {}) => Promise<any>;

@@ -84,2 +86,9 @@ getJobInformationRequest: (jobId: number, headersToAdd?: {}) => Promise<any>;

authorizeCardholder: (grant: string, headersToAdd?: {}) => Promise<any>;
updateCardholderSession: (filter: APIFilter, body: {
cuid: string;
clickstream: {
url: string;
timestamp: string;
}[];
}) => Promise<any>;
getCardholder: (filter: number, safeKey: string | null, headersToAdd?: {}) => Promise<any>;

@@ -86,0 +95,0 @@ getCardholders: (filter: APIFilter, pagingHeader?: {}, headersToAdd?: {}) => Promise<any>;

@@ -12,13 +12,16 @@ /// <reference types="node" />

static decryptResponse(key: string, body: any): Promise<any>;
static decryptAES256(b64cipherText: string, b64IV: string, b64Key: string): Promise<any>;
static decryptAES256(b64cipherText: string, b64IV: string, b64Key: string, alg?: string): Promise<any>;
}
export declare class Signing {
static sha256Hash(inputString: string): Promise<ArrayBuffer>;
static signRequest(path: string, appName: string, sessionKey: string, body?: any): Promise<{
"x-cardsavr-authorization": string;
"x-cardsavr-nonce": string;
"x-cardsavr-signature": string;
static signRequest(path: string, appName: string, sessionKey: string, body?: {
[key: string]: unknown;
}): Promise<{
[k: string]: string;
}>;
static verifySignature(headers: {
[k: string]: string;
}, path: string, appName: string, keys: string[], body?: string): Promise<boolean>;
static signSaltWithPasswordKey(sessionSalt: string, passwordKey: string): Promise<string>;
static hmacSign(inputString: any, b64Key: string, b64InputString?: boolean): Promise<string>;
static hmacSign(inputString: string, b64Key: string, b64InputString?: boolean): Promise<string>;
}

@@ -25,0 +28,0 @@ export declare class Keys {

export declare const generateHydrationHeader: (hydrationArray: any) => any;
export declare const generateTraceValue: (bytes?: number | undefined) => string;
export declare type APIFilter = number | {
[key: string]: string | string[];
export declare const generateTraceValue: (bytes?: number) => string;
export type APIFilter = number | {
[key: string]: number[] | number | string | string[];
} | null;

@@ -6,0 +6,0 @@ export declare const formatPath: (path: string, filter: APIFilter) => string;

{
"name": "@strivve/strivve-sdk",
"version": "3.0.0",
"version": "3.0.1",
"description": "",

@@ -49,9 +49,12 @@ "directories": {

"eslint": "^8.52.0",
"https": "^1.0.0",
"https-proxy-agent": "^5.0.1",
"log-timestamp": "^0.3.0",
"net": "^1.0.2",
"node-fetch": "^2.7.0",
"node-polyfill-webpack-plugin": "^3.0.0",
"readline-sync": "^1.4.10"
},
"browser": {
"fs": false,
"tls": false
}
}

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

import {version} from "../../package.json";
import { HttpsProxyAgent } from "https-proxy-agent";
//import { HttpsProxyAgent } from "https-proxy-agent";

@@ -131,3 +131,3 @@ export class CardsavrSession {

const agent = (this._proxy) ?
new HttpsProxyAgent(this._proxy) :
/*new HttpsProxyAgent(this._proxy) */ undefined :
new HTTPSAgent({

@@ -134,0 +134,0 @@ rejectUnauthorized : this._rejectUnauthorized,

@@ -148,27 +148,28 @@ import * as crypto from "crypto";

const stringParts = body.encrypted_body.split("$");
if (stringParts[1].length != 16) {
// Not a proper 16-byte base64-encoded IV
throw new Error("Response body is not properly encrypted.");
}
const req = this.decryptAES256(stringParts[0], stringParts[1], key);
const req = this.decryptAES256(stringParts[0], stringParts[1], key, stringParts[2]);
return await req;
}
static async decryptAES256(b64cipherText: string, b64IV: string, b64Key: string) {
static async decryptAES256(b64cipherText: string, b64IV: string, b64Key: string, alg?: string) {
if (!browserCrypto) {
const binaryEncryptionKey = Buffer.alloc(32);
binaryEncryptionKey.write(b64Key, "base64");
// decryption has support for both gcm and cdc for backward compatibility (CU config.json)
const predicted_alg = b64IV.length === 16 ? "aes-256-gcm" : (b64IV.length === 24 ? "aes-256-cbc" : undefined);
if (!predicted_alg || (alg && alg != predicted_alg)) {
// Not a proper 16-byte base64-encoded IV, doesn't care about alg, not supported except in-browser
throw new Error("Response body is not properly encrypted.");
}
const binaryEncryptionKey = Buffer.from(b64Key, "base64");
const iv = Buffer.from(b64IV, "base64");
const encrypted_buf = Buffer.from(b64cipherText, "base64");
const [encoded, auth_tag] = [
const [encoded, auth_tag] = predicted_alg === "aes-256-gcm" ? [
encrypted_buf.subarray(0, encrypted_buf.length - 16),
encrypted_buf.subarray(encrypted_buf.length - 16, encrypted_buf.length)];
encrypted_buf.subarray(encrypted_buf.length - 16, encrypted_buf.length)
] : [encrypted_buf, Buffer.from("")];
const iv = Buffer.from(b64IV, "base64");
const decryptor = crypto.createDecipheriv("aes-256-gcm", binaryEncryptionKey, iv);
decryptor.setAuthTag(auth_tag);
const decryptor = crypto.createDecipheriv(predicted_alg, binaryEncryptionKey, iv);
if (auth_tag) { (decryptor as crypto.DecipherGCM).setAuthTag(auth_tag); }
const decryptedJSON = Buffer.concat([decryptor.update(encoded), decryptor.final()]);

@@ -180,2 +181,7 @@ const decryptedString = decryptedJSON.toString("utf8");

if (b64IV.length !== 16) {
// Not a proper 16-byte base64-encoded IV, doesn't care about alg, not supported except in-browser
throw new Error("Response body is not properly encrypted.");
}
const decryptKey = await browserCrypto.subtle.importKey(

@@ -182,0 +188,0 @@ "raw",

@@ -8,3 +8,3 @@ {

"outDir": "../lib/",
"rootDir": ".",
// "rootDir": ".",
"esModuleInterop": true,

@@ -11,0 +11,0 @@ "strict": true,

@@ -8,3 +8,3 @@ {

"outDir": ".",
"rootDir": ".",
// "rootDir": ".",
"esModuleInterop": true,

@@ -11,0 +11,0 @@ "strict": true,

const path = require("path");
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
entry : "./src/cardsavr/CardsavrHelper.ts",
plugins: [
new NodePolyfillPlugin()
],
module : {

@@ -6,0 +11,0 @@ rules : [

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc