blixify-server 0.1.73 → 0.1.74
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
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export declare class CryptoMiddleware {
|
|
2
2
|
secretKey: string;
|
|
3
3
|
forceDecryption: boolean;
|
|
4
|
-
|
|
5
|
-
constructor(secretKey: string, forceDecryption: boolean, nextJs: boolean);
|
|
4
|
+
constructor(secretKey: string, forceDecryption: boolean);
|
|
6
5
|
handleDecryption: (data: string) => any;
|
|
7
6
|
init(): (req: any, res: any, next?: any) => any;
|
|
8
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;gBAEZ,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO;IAKvD,gBAAgB,SAAU,MAAM,SAiB9B;IAEF,IAAI,UAGsC,GAAG,OAAO,GAAG,SAAS,GAAG;CAqBpE"}
|
package/dist/apis/crypto.js
CHANGED
|
@@ -7,10 +7,9 @@ exports.CryptoMiddleware = void 0;
|
|
|
7
7
|
const CryptoJS = require("crypto-js");
|
|
8
8
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
9
|
class CryptoMiddleware {
|
|
10
|
-
constructor(secretKey, forceDecryption
|
|
10
|
+
constructor(secretKey, forceDecryption) {
|
|
11
11
|
this.secretKey = "";
|
|
12
12
|
this.forceDecryption = false;
|
|
13
|
-
this.nextJs = false;
|
|
14
13
|
this.handleDecryption = (data) => {
|
|
15
14
|
// Decrypt the data
|
|
16
15
|
const bytes = CryptoJS.AES.decrypt(data, this.secretKey);
|
|
@@ -35,7 +34,6 @@ class CryptoMiddleware {
|
|
|
35
34
|
};
|
|
36
35
|
this.secretKey = secretKey;
|
|
37
36
|
this.forceDecryption = forceDecryption;
|
|
38
|
-
this.nextJs = nextJs;
|
|
39
37
|
}
|
|
40
38
|
init() {
|
|
41
39
|
// eslint-disable-next-line
|
|
@@ -53,15 +51,14 @@ class CryptoMiddleware {
|
|
|
53
51
|
catch (err) {
|
|
54
52
|
throw new Error("Wrong Signature");
|
|
55
53
|
}
|
|
54
|
+
if (next)
|
|
55
|
+
next();
|
|
56
56
|
}
|
|
57
57
|
catch (err) {
|
|
58
|
-
if (
|
|
59
|
-
|
|
58
|
+
if (next)
|
|
59
|
+
next(err);
|
|
60
60
|
return res.status(400).json({ error: (_b = err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : "" });
|
|
61
61
|
}
|
|
62
|
-
if (next) {
|
|
63
|
-
next();
|
|
64
|
-
}
|
|
65
62
|
};
|
|
66
63
|
return cryptoMiddleware;
|
|
67
64
|
}
|