@konplit-services/common 1.0.337 → 1.0.339
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.
|
@@ -5,7 +5,7 @@ export declare enum BUSINESS_CLASS {
|
|
|
5
5
|
BUSINESS_NAME_REGISTRATION = "BUSINESS_NAME_REGISTRATION",
|
|
6
6
|
INCORPORATED_TRUSTEE = "INCORPORATED_TRUSTEE",
|
|
7
7
|
GOVERNMENT_BODY = "GOVERNMENT_BODY",
|
|
8
|
-
|
|
8
|
+
PRIVATE_BODY_BY_GOVERNMENT_APPROVAL = "PRIVATE_BODY_BY_GOVERNMENT_APPROVAL",
|
|
9
9
|
COORPORATIVE_SOCIETY = "COORPORATIVE_SOCIETY"
|
|
10
10
|
}
|
|
11
11
|
export declare enum INDIVIDUAL_REQUIRED_TYPE {
|
|
@@ -9,7 +9,7 @@ var BUSINESS_CLASS;
|
|
|
9
9
|
BUSINESS_CLASS["BUSINESS_NAME_REGISTRATION"] = "BUSINESS_NAME_REGISTRATION";
|
|
10
10
|
BUSINESS_CLASS["INCORPORATED_TRUSTEE"] = "INCORPORATED_TRUSTEE";
|
|
11
11
|
BUSINESS_CLASS["GOVERNMENT_BODY"] = "GOVERNMENT_BODY";
|
|
12
|
-
BUSINESS_CLASS["
|
|
12
|
+
BUSINESS_CLASS["PRIVATE_BODY_BY_GOVERNMENT_APPROVAL"] = "PRIVATE_BODY_BY_GOVERNMENT_APPROVAL";
|
|
13
13
|
BUSINESS_CLASS["COORPORATIVE_SOCIETY"] = "COORPORATIVE_SOCIETY";
|
|
14
14
|
})(BUSINESS_CLASS = exports.BUSINESS_CLASS || (exports.BUSINESS_CLASS = {}));
|
|
15
15
|
var INDIVIDUAL_REQUIRED_TYPE;
|
|
@@ -24,6 +24,12 @@ exports.generateAesKeyAndIv = generateAesKeyAndIv;
|
|
|
24
24
|
* @returns base 64 of the iv and encrypted data in iv:data
|
|
25
25
|
*/
|
|
26
26
|
const encryptWithAes = (data, aesKey, iv) => {
|
|
27
|
+
if (aesKey.length !== 32) {
|
|
28
|
+
throw new Error("AES key must be 32 bytes for AES-256.");
|
|
29
|
+
}
|
|
30
|
+
if (iv.length !== 16) {
|
|
31
|
+
throw new Error("Initialization vector (IV) must be 16 bytes for AES-CBC.");
|
|
32
|
+
}
|
|
27
33
|
const cipher = crypto_1.default.createCipheriv("aes-256-cbc", aesKey, iv);
|
|
28
34
|
let encrypted = cipher.update(data, "utf8", "base64");
|
|
29
35
|
encrypted += cipher.final("base64");
|
|
@@ -42,6 +42,7 @@ const errorHandler = (err, req, res, next) => {
|
|
|
42
42
|
//@ts-ignore
|
|
43
43
|
if (err instanceof SyntaxError && err.status === 400 && "body" in err) {
|
|
44
44
|
// Handle JSON parsing error
|
|
45
|
+
console.log(err);
|
|
45
46
|
return res.status(400).send({
|
|
46
47
|
status: helper_1.Status.Failed,
|
|
47
48
|
errors: [
|