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

swdc-tracker

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swdc-tracker - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

52

dist/utils/hash.js

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

return __awaiter(this, void 0, void 0, function () {
var hashedValue, hashValueAlreadyExists, response;
var hashedValue, hashValueAlreadyExists;
return __generator(this, function (_a) {

@@ -70,2 +70,27 @@ switch (_a.label) {

case 3:
_a.sent();
setUserHashedValues(jwt);
_a.label = 4;
case 4: return [2 /*return*/, hashedValue];
}
});
});
}
exports.hashValue = hashValue;
function encryptValue(value, hashedValue, dataType, jwt) {
return __awaiter(this, void 0, void 0, function () {
var params, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!jwt) {
return [2 /*return*/, ""];
}
params = {
value: value,
hashed_value: hashedValue,
data_type: dataType
};
return [4 /*yield*/, http_1.post("/user_encrypted_data", params, jwt)];
case 1:
response = _a.sent();

@@ -80,10 +105,4 @@ if (response.status == 201) {

}
// async update the hashedValues to stay up to date with the backend
setUserHashedValues(jwt);
}
else {
console.log("swdc-tracker received an error attempting to encrypt. status code: " + response.status);
}
_a.label = 4;
case 4: return [2 /*return*/, hashedValue];
return [2 /*return*/];
}

@@ -93,19 +112,2 @@ });

}
exports.hashValue = hashValue;
function encryptValue(value, hashedValue, dataType, jwt) {
return __awaiter(this, void 0, void 0, function () {
var params;
return __generator(this, function (_a) {
if (!jwt) {
return [2 /*return*/, ""];
}
params = {
value: value,
hashed_value: hashedValue,
data_type: dataType
};
return [2 /*return*/, http_1.post("/user_encrypted_data", params, jwt)];
});
});
}
function setUserHashedValues(jwt) {

@@ -112,0 +114,0 @@ return __awaiter(this, void 0, void 0, function () {

{
"name": "swdc-tracker",
"version": "1.2.3",
"version": "1.2.4",
"description": "swdc event tracker",

@@ -5,0 +5,0 @@ "main": "dist",

@@ -28,17 +28,4 @@ import { get, post } from "./http";

if (!hashValueAlreadyExists) {
const response = await encryptValue(value, hashedValue, dataType, jwt);
if(response.status == 201) {
// update the local userHashedValues so that we don't re-encrypt it
if(userHashedValues[dataType]) {
userHashedValues[dataType].push(hashedValue);
} else {
userHashedValues[dataType] = [hashedValue]
}
// async update the hashedValues to stay up to date with the backend
setUserHashedValues(jwt);
} else {
console.log(`swdc-tracker received an error attempting to encrypt. status code: ${response.status}`)
}
await encryptValue(value, hashedValue, dataType, jwt);
setUserHashedValues(jwt);
}

@@ -60,3 +47,11 @@

return post("/user_encrypted_data", params, jwt);
const response = await post("/user_encrypted_data", params, jwt);
if(response.status == 201) {
// update the local userHashedValues so that we don't re-encrypt it
if(userHashedValues[dataType]) {
userHashedValues[dataType].push(hashedValue);
} else {
userHashedValues[dataType] = [hashedValue]
}
}
}

@@ -63,0 +58,0 @@

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