swdc-tracker
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -46,3 +46,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var hashedValue, hashValueAlreadyExists; | ||
var hashedValue; | ||
return __generator(this, function (_a) { | ||
@@ -66,10 +66,6 @@ switch (_a.label) { | ||
hashedValue = sodium.to_hex(sodium.crypto_generichash(64, value)); | ||
hashValueAlreadyExists = !!userHashedValues[dataType] && userHashedValues[dataType].includes(hashedValue); | ||
if (!!hashValueAlreadyExists) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, encryptValue(value, hashedValue, dataType, jwt)]; | ||
case 3: | ||
_a.sent(); | ||
setUserHashedValues(jwt); | ||
_a.label = 4; | ||
case 4: return [2 /*return*/, hashedValue]; | ||
return [2 /*return*/, hashedValue]; | ||
} | ||
@@ -82,3 +78,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var params, response; | ||
var hashValueAlreadyExists, params, response; | ||
return __generator(this, function (_a) { | ||
@@ -90,2 +86,4 @@ switch (_a.label) { | ||
} | ||
hashValueAlreadyExists = !!userHashedValues[dataType] && userHashedValues[dataType].includes(hashedValue); | ||
if (!!hashValueAlreadyExists) return [3 /*break*/, 2]; | ||
params = { | ||
@@ -108,3 +106,5 @@ value: value, | ||
} | ||
return [2 /*return*/]; | ||
setUserHashedValues(jwt); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
@@ -111,0 +111,0 @@ }); |
{ | ||
"name": "swdc-tracker", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "swdc event tracker", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -25,9 +25,4 @@ import { get, post } from "./http"; | ||
const hashValueAlreadyExists = !!userHashedValues[dataType] && userHashedValues[dataType].includes(hashedValue); | ||
await encryptValue(value, hashedValue, dataType, jwt); | ||
if (!hashValueAlreadyExists) { | ||
await encryptValue(value, hashedValue, dataType, jwt); | ||
setUserHashedValues(jwt); | ||
} | ||
return hashedValue; | ||
@@ -41,16 +36,23 @@ } | ||
const params = { | ||
value: value, | ||
hashed_value: hashedValue, | ||
data_type: dataType | ||
} | ||
const hashValueAlreadyExists = !!userHashedValues[dataType] && userHashedValues[dataType].includes(hashedValue); | ||
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] | ||
if(!hashValueAlreadyExists) { | ||
const params = { | ||
value: value, | ||
hashed_value: hashedValue, | ||
data_type: dataType | ||
} | ||
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] | ||
} | ||
} | ||
setUserHashedValues(jwt); | ||
} | ||
@@ -57,0 +59,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122932