@houlak/plexo-sdk 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -212,7 +212,7 @@ var UnwrapInstrumentCallback = function (instrumentCallback) { return __awaiter(
|
|
|
212
212
|
return [4 /*yield*/, paymentGatewayClient.UnwrapInstrumentCallbackAsync(instrumentCallbackCamelCase)];
|
|
213
213
|
case 1:
|
|
214
214
|
instrumentCallbackResponse = _a.sent();
|
|
215
|
-
logger_lib_1.default.info(instrumentCallbackResponse, 'UnwrapInstrumentCallback response from
|
|
215
|
+
logger_lib_1.default.info(instrumentCallbackResponse, 'UnwrapInstrumentCallback response from us');
|
|
216
216
|
return [2 /*return*/, evaluator_service_1.Evaluator.genericEvaluator(instrumentCallback, instrumentCallbackResponse)];
|
|
217
217
|
}
|
|
218
218
|
});
|
|
@@ -234,7 +234,7 @@ var getPlexoKey = function (fingerprint) { return __awaiter(void 0, void 0, void
|
|
|
234
234
|
});
|
|
235
235
|
}); };
|
|
236
236
|
var getPlexoSignature = function (fingerprint, response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
237
|
-
var serverResponse, plexoResponse, err_1, key,
|
|
237
|
+
var serverResponse, plexoResponse, err_1, key, objectInPascalCase, objectSorted, objectBuffer, verifySignature, canonizedObject, objectInPascal, sarasas, sarasasSorted, sarasasBuffer, sarasasVerifySignature;
|
|
238
238
|
return __generator(this, function (_a) {
|
|
239
239
|
switch (_a.label) {
|
|
240
240
|
case 0:
|
|
@@ -254,13 +254,24 @@ var getPlexoSignature = function (fingerprint, response) { return __awaiter(void
|
|
|
254
254
|
return [2 /*return*/, serverResponse];
|
|
255
255
|
case 3:
|
|
256
256
|
key = (0, crypto_1.createPublicKey)("-----BEGIN CERTIFICATE-----\n".concat(plexoResponse.Object.Object.Response.Key, "\n-----END CERTIFICATE-----"));
|
|
257
|
-
|
|
258
|
-
objectInPascalCase = utils_1.caseUtils.toPascalKeys(canonizedObject);
|
|
257
|
+
objectInPascalCase = utils_1.caseUtils.toPascalKeys(response.object);
|
|
259
258
|
objectSorted = sort(objectInPascalCase);
|
|
260
259
|
objectBuffer = Buffer.from(JSON.stringify(objectSorted));
|
|
260
|
+
logger_lib_1.default.info(objectSorted, 'Objeto a verificar');
|
|
261
261
|
verifySignature = (0, crypto_1.createVerify)('SHA512')
|
|
262
262
|
.update(objectBuffer)
|
|
263
263
|
.verify(key, response.signature, 'base64');
|
|
264
|
+
logger_lib_1.default.info(verifySignature, 'Verificacion de firma clasica');
|
|
265
|
+
canonizedObject = (0, exports.canonizeJson)(response.object);
|
|
266
|
+
objectInPascal = utils_1.caseUtils.toPascalKeys(canonizedObject);
|
|
267
|
+
sarasas = (0, stringifyWithFloats_1.stringifyAmountsWithFloats)(objectInPascal);
|
|
268
|
+
sarasasSorted = sort(sarasas);
|
|
269
|
+
sarasasBuffer = Buffer.from(JSON.stringify(sarasasSorted));
|
|
270
|
+
logger_lib_1.default.info(sarasasSorted, 'Nuevo Objeto a verificar');
|
|
271
|
+
sarasasVerifySignature = (0, crypto_1.createVerify)('SHA512')
|
|
272
|
+
.update(sarasasBuffer)
|
|
273
|
+
.verify(key, response.signature, 'base64');
|
|
274
|
+
logger_lib_1.default.info(sarasasVerifySignature, 'Verificacion de firma nueva');
|
|
264
275
|
serverResponse = {
|
|
265
276
|
response: response.object.object,
|
|
266
277
|
resultCode: verifySignature ? __1.ResultCodes.Ok : __1.ResultCodes.InvalidSignature,
|