blixify-server 0.1.74 → 0.1.75
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.
- package/dist/apis/crypto.d.ts.map +1 -1
- package/dist/apis/crypto.js +12 -15
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AACA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;gBAEZ,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO;IAKvD,gBAAgB,SAAU,MAAM,SAoB9B;IAEF,IAAI,UAGsC,GAAG,OAAO,GAAG,SAAS,GAAG;CAqBpE"}
|
package/dist/apis/crypto.js
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.CryptoMiddleware = void 0;
|
|
7
4
|
const CryptoJS = require("crypto-js");
|
|
8
|
-
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
5
|
class CryptoMiddleware {
|
|
10
6
|
constructor(secretKey, forceDecryption) {
|
|
11
7
|
this.secretKey = "";
|
|
12
8
|
this.forceDecryption = false;
|
|
13
9
|
this.handleDecryption = (data) => {
|
|
14
|
-
// Decrypt the data
|
|
10
|
+
//INFO : Decrypt the data
|
|
15
11
|
const bytes = CryptoJS.AES.decrypt(data, this.secretKey);
|
|
16
12
|
const decrypted = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
|
|
17
13
|
if (decrypted) {
|
|
18
14
|
if (decrypted.baseSignDate) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
//TODO : Add date timing
|
|
16
|
+
delete decrypted["baseSignDate"];
|
|
17
|
+
return decrypted;
|
|
18
|
+
// const tolerance = moment.duration(1, "minute");
|
|
19
|
+
// const startWindow = moment(decrypted.baseSignDate).utc();
|
|
20
|
+
// const endWindow = startWindow.clone().add(tolerance);
|
|
21
|
+
// const currentUTCDate = moment().utc();
|
|
22
|
+
// if (currentUTCDate.isBetween(startWindow, endWindow)) {
|
|
23
|
+
// delete decrypted["baseSignDate"];
|
|
24
|
+
// return decrypted;
|
|
25
|
+
// } else throw "Error";
|
|
29
26
|
}
|
|
30
27
|
else
|
|
31
28
|
throw "Error";
|