drapcode-utility 1.1.6 → 1.1.8

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.
@@ -0,0 +1,16 @@
1
+ import { AwsConfig } from "./model";
2
+ export declare const processKMSEncryption: (config: AwsConfig, arn: string, plainText: string, context: any) => Promise<{
3
+ status: string;
4
+ data: string;
5
+ message: string;
6
+ }>;
7
+ export declare const processKMSDecryption: (config: AwsConfig, cipherText: string, context: any) => Promise<{
8
+ status: string;
9
+ data: string;
10
+ message: string;
11
+ }>;
12
+ export declare const processKMSGenerateDataKey: (config: AwsConfig, arn: string) => Promise<{
13
+ status: string;
14
+ dataKey: string;
15
+ message: string;
16
+ }>;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.processKMSGenerateDataKey = exports.processKMSDecryption = exports.processKMSEncryption = void 0;
40
+ var client_kms_1 = require("@aws-sdk/client-kms");
41
+ var processKMSEncryption = function (config, arn, plainText, context) { return __awaiter(void 0, void 0, void 0, function () {
42
+ var accessKeyId, secretAccessKey, region, client, input, command, response, cipherText, error_1;
43
+ return __generator(this, function (_a) {
44
+ switch (_a.label) {
45
+ case 0:
46
+ _a.trys.push([0, 2, , 3]);
47
+ accessKeyId = config.accessKeyId, secretAccessKey = config.secretAccessKey, region = config.region;
48
+ client = new client_kms_1.KMSClient({
49
+ region: region,
50
+ credentials: { accessKeyId: accessKeyId, secretAccessKey: secretAccessKey },
51
+ });
52
+ input = {
53
+ KeyId: arn,
54
+ Plaintext: Buffer.from(plainText),
55
+ EncryptionContext: context,
56
+ };
57
+ command = new client_kms_1.EncryptCommand(input);
58
+ return [4 /*yield*/, client.send(command)];
59
+ case 1:
60
+ response = _a.sent();
61
+ cipherText = Buffer.from(response.CiphertextBlob).toString("base64");
62
+ return [2 /*return*/, { status: "SUCCESS", data: cipherText, message: "" }];
63
+ case 2:
64
+ error_1 = _a.sent();
65
+ return [2 /*return*/, {
66
+ status: "FAILED",
67
+ data: "",
68
+ message: error_1.message,
69
+ }];
70
+ case 3: return [2 /*return*/];
71
+ }
72
+ });
73
+ }); };
74
+ exports.processKMSEncryption = processKMSEncryption;
75
+ var processKMSDecryption = function (config, cipherText, context) { return __awaiter(void 0, void 0, void 0, function () {
76
+ var accessKeyId, secretAccessKey, region, client, dcipherText, input, command, response, plainText, error_2;
77
+ return __generator(this, function (_a) {
78
+ switch (_a.label) {
79
+ case 0:
80
+ _a.trys.push([0, 2, , 3]);
81
+ accessKeyId = config.accessKeyId, secretAccessKey = config.secretAccessKey, region = config.region;
82
+ client = new client_kms_1.KMSClient({
83
+ region: region,
84
+ credentials: { accessKeyId: accessKeyId, secretAccessKey: secretAccessKey },
85
+ });
86
+ dcipherText = Buffer.from(cipherText, "base64");
87
+ input = {
88
+ CiphertextBlob: dcipherText,
89
+ EncryptionContext: context,
90
+ };
91
+ command = new client_kms_1.DecryptCommand(input);
92
+ return [4 /*yield*/, client.send(command)];
93
+ case 1:
94
+ response = _a.sent();
95
+ plainText = Buffer.from(response.Plaintext).toString("base64");
96
+ return [2 /*return*/, { status: "SUCCESS", data: plainText, message: "" }];
97
+ case 2:
98
+ error_2 = _a.sent();
99
+ return [2 /*return*/, { status: "FAILED", data: "", message: error_2.message }];
100
+ case 3: return [2 /*return*/];
101
+ }
102
+ });
103
+ }); };
104
+ exports.processKMSDecryption = processKMSDecryption;
105
+ var processKMSGenerateDataKey = function (config, arn) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var accessKeyId, secretAccessKey, region, input, client, command, response, cipherText, error_3;
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
109
+ case 0:
110
+ _a.trys.push([0, 2, , 3]);
111
+ accessKeyId = config.accessKeyId, secretAccessKey = config.secretAccessKey, region = config.region;
112
+ input = {
113
+ KeyId: arn,
114
+ KeySpec: "AES_256",
115
+ };
116
+ client = new client_kms_1.KMSClient({
117
+ region: region,
118
+ credentials: { accessKeyId: accessKeyId, secretAccessKey: secretAccessKey },
119
+ });
120
+ command = new client_kms_1.GenerateDataKeyCommand(input);
121
+ return [4 /*yield*/, client.send(command)];
122
+ case 1:
123
+ response = _a.sent();
124
+ cipherText = Buffer.from(response.CiphertextBlob).toString("base64");
125
+ return [2 /*return*/, { status: "SUCCESS", dataKey: cipherText, message: "" }];
126
+ case 2:
127
+ error_3 = _a.sent();
128
+ return [2 /*return*/, {
129
+ status: "FAILED",
130
+ message: error_3.message,
131
+ dataKey: "",
132
+ }];
133
+ case 3: return [2 /*return*/];
134
+ }
135
+ });
136
+ }); };
137
+ exports.processKMSGenerateDataKey = processKMSGenerateDataKey;
@@ -0,0 +1,2 @@
1
+ export declare const encryptData: (data: string, key: string) => Promise<string>;
2
+ export declare const decryptData: (data: string, key: string) => Promise<string>;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.decryptData = exports.encryptData = void 0;
43
+ var crypto_1 = __importDefault(require("crypto"));
44
+ var defaultAlgorithm = "aes-256-cbc";
45
+ var encryptData = function (data, key) { return __awaiter(void 0, void 0, void 0, function () {
46
+ var iv, keyBuffer, cipher, encryptedDataBuffer, result;
47
+ return __generator(this, function (_a) {
48
+ try {
49
+ iv = Buffer.from("i4mboZDwaNEC38YCzi77lw==", "base64");
50
+ keyBuffer = Buffer.from(key, "base64");
51
+ cipher = crypto_1.default.createCipheriv(defaultAlgorithm, keyBuffer, iv);
52
+ encryptedDataBuffer = cipher.update(data);
53
+ encryptedDataBuffer = Buffer.concat([encryptedDataBuffer, cipher.final()]);
54
+ result = encryptedDataBuffer.toString("base64");
55
+ return [2 /*return*/, handleExtraString(result, true)];
56
+ }
57
+ catch (error) {
58
+ console.log("\n Error: ", error);
59
+ return [2 /*return*/, data];
60
+ }
61
+ return [2 /*return*/];
62
+ });
63
+ }); };
64
+ exports.encryptData = encryptData;
65
+ var decryptData = function (data, key) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var iv, encryptedData, keyBuffer, decipher, decryptedBuffer;
67
+ return __generator(this, function (_a) {
68
+ try {
69
+ data = handleExtraString(data, false);
70
+ iv = Buffer.from("i4mboZDwaNEC38YCzi77lw==", "base64");
71
+ encryptedData = Buffer.from(data, "base64");
72
+ keyBuffer = Buffer.from(key, "base64");
73
+ decipher = crypto_1.default.createDecipheriv(defaultAlgorithm, keyBuffer, iv);
74
+ decryptedBuffer = decipher.update(encryptedData);
75
+ decryptedBuffer = Buffer.concat([decryptedBuffer, decipher.final()]);
76
+ return [2 /*return*/, decryptedBuffer.toString()];
77
+ }
78
+ catch (error) {
79
+ console.log("\n Error: ", error);
80
+ return [2 /*return*/, data];
81
+ }
82
+ return [2 /*return*/];
83
+ });
84
+ }); };
85
+ exports.decryptData = decryptData;
86
+ var handleExtraString = function (key, append) {
87
+ if (append === void 0) { append = true; }
88
+ if (append) {
89
+ var start = crypto_1.default.randomBytes(2).toString("hex");
90
+ var end = crypto_1.default.randomBytes(2).toString("hex");
91
+ key = "".concat(start).concat(key).concat(end);
92
+ return key;
93
+ }
94
+ else {
95
+ key = key.substring(4, key.length);
96
+ key = key.substring(0, key.length - 4);
97
+ return key;
98
+ }
99
+ };
@@ -0,0 +1,4 @@
1
+ import { Encryption } from "./model";
2
+ export declare const processFileEncryptionDecryption: (data: string, encryption: Encryption, decrypt: boolean) => Promise<string>;
3
+ export declare const encryptFile: (filePath: string, key: string) => Promise<string>;
4
+ export declare const decryptFile: (encryptedFilePath: string, key: string) => Promise<string>;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.decryptFile = exports.encryptFile = exports.processFileEncryptionDecryption = void 0;
43
+ var fs_1 = __importDefault(require("fs"));
44
+ var crypto_1 = __importDefault(require("crypto"));
45
+ var defaultAlgorithm = "aes-256-cbc";
46
+ var processFileEncryptionDecryption = function (data, encryption, decrypt) { return __awaiter(void 0, void 0, void 0, function () {
47
+ var encryptionType, dataKey, _a, result, _b;
48
+ return __generator(this, function (_c) {
49
+ switch (_c.label) {
50
+ case 0:
51
+ encryptionType = encryption.encryptionType, dataKey = encryption.dataKey;
52
+ if (!data)
53
+ return [2 /*return*/, data];
54
+ _a = encryptionType;
55
+ switch (_a) {
56
+ case "KMS": return [3 /*break*/, 1];
57
+ }
58
+ return [3 /*break*/, 6];
59
+ case 1:
60
+ if (!decrypt) return [3 /*break*/, 3];
61
+ return [4 /*yield*/, (0, exports.decryptFile)(data, dataKey)];
62
+ case 2:
63
+ _b = _c.sent();
64
+ return [3 /*break*/, 5];
65
+ case 3: return [4 /*yield*/, (0, exports.encryptFile)(data, dataKey)];
66
+ case 4:
67
+ _b = _c.sent();
68
+ _c.label = 5;
69
+ case 5:
70
+ result = _b;
71
+ return [2 /*return*/, result];
72
+ case 6: return [2 /*return*/, data];
73
+ }
74
+ });
75
+ }); };
76
+ exports.processFileEncryptionDecryption = processFileEncryptionDecryption;
77
+ var encryptFile = function (filePath, key) { return __awaiter(void 0, void 0, void 0, function () {
78
+ var iv, keyBuffer, fileContent, cipher, encryptedDataBuffer, encryptedFilePath, error_1;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0:
82
+ _a.trys.push([0, 3, , 4]);
83
+ iv = Buffer.from("i4mboZDwaNEC38YCzi77lw==", "base64");
84
+ keyBuffer = Buffer.from(key, "base64");
85
+ return [4 /*yield*/, fs_1.default.promises.readFile(filePath)];
86
+ case 1:
87
+ fileContent = _a.sent();
88
+ cipher = crypto_1.default.createCipheriv(defaultAlgorithm, keyBuffer, iv);
89
+ encryptedDataBuffer = cipher.update(fileContent);
90
+ encryptedDataBuffer = Buffer.concat([encryptedDataBuffer, cipher.final()]);
91
+ encryptedFilePath = filePath + ".enc";
92
+ return [4 /*yield*/, fs_1.default.promises.writeFile(encryptedFilePath, encryptedDataBuffer)];
93
+ case 2:
94
+ _a.sent();
95
+ console.log("File encrypted successfully.");
96
+ return [2 /*return*/, encryptedFilePath];
97
+ case 3:
98
+ error_1 = _a.sent();
99
+ console.log("\n Error: ", error_1);
100
+ throw error_1;
101
+ case 4: return [2 /*return*/];
102
+ }
103
+ });
104
+ }); };
105
+ exports.encryptFile = encryptFile;
106
+ var decryptFile = function (encryptedFilePath, key) { return __awaiter(void 0, void 0, void 0, function () {
107
+ var iv, keyBuffer, encryptedData, decipher, decryptedBuffer, decryptedFilePath, error_2;
108
+ return __generator(this, function (_a) {
109
+ switch (_a.label) {
110
+ case 0:
111
+ _a.trys.push([0, 3, , 4]);
112
+ iv = Buffer.from("i4mboZDwaNEC38YCzi77lw==", "base64");
113
+ keyBuffer = Buffer.from(key, "base64");
114
+ return [4 /*yield*/, fs_1.default.promises.readFile(encryptedFilePath)];
115
+ case 1:
116
+ encryptedData = _a.sent();
117
+ decipher = crypto_1.default.createDecipheriv(defaultAlgorithm, keyBuffer, iv);
118
+ decryptedBuffer = decipher.update(encryptedData);
119
+ decryptedBuffer = Buffer.concat([decryptedBuffer, decipher.final()]);
120
+ decryptedFilePath = "".concat(encryptedFilePath.slice(0, -4), ".dec");
121
+ return [4 /*yield*/, fs_1.default.promises.writeFile(decryptedFilePath, decryptedBuffer)];
122
+ case 2:
123
+ _a.sent();
124
+ console.log("File decrypted successfully.");
125
+ return [2 /*return*/, decryptedFilePath];
126
+ case 3:
127
+ error_2 = _a.sent();
128
+ console.log("Error:", error_2);
129
+ throw error_2;
130
+ case 4: return [2 /*return*/];
131
+ }
132
+ });
133
+ }); };
134
+ exports.decryptFile = decryptFile;
@@ -1,15 +1,53 @@
1
- declare type AwsConfig = {
2
- accessKeyId: string;
3
- secretAccessKey: string;
4
- region: string;
5
- };
6
- declare type Encryption = {
7
- encryptionType: string;
8
- algorithm: string;
9
- key: string;
10
- awsConfig: AwsConfig;
11
- };
1
+ import { AwsConfig, Encryption } from "./model";
12
2
  export declare const crypt: (data: any, fields: Array<object>, encryption: Encryption, decrypt: boolean) => Promise<any>;
13
- export declare const createKMSDataKey: (awsConfig: object, KeyId: string) => Promise<any>;
14
- export declare const decryptDataKey: (dataKey: string, awsConfig: object) => Promise<any>;
15
- export {};
3
+ export declare const processItemEncryptDecrypt: (item: any, fields: Array<object>, encryption: Encryption, decrypt: boolean) => Promise<any>;
4
+ export declare const processDataEncryptionDecryption: (data: string, encryption: Encryption, decrypt: boolean) => Promise<string>;
5
+ /**
6
+ * This method is used to generate private KEY for KMS ARN
7
+ * It requires KMS config and ARN
8
+ * @param config AWS config
9
+ * @param arn KMS Key
10
+ * @returns {status: string, dataKey: string, message: ""}
11
+ */
12
+ export declare const createKMSDataKey: (config: AwsConfig, arn: string) => Promise<{
13
+ status: string;
14
+ dataKey: string;
15
+ message: string;
16
+ }>;
17
+ /**
18
+ * This method is used to encrypt plaintext upto 4KB
19
+ * It requires KMS config and ARN
20
+ * @param config AWS Config
21
+ * @param arn KMS Key
22
+ * @param plainText Text to be encrypted
23
+ * @param context Extra setting for extra security
24
+ * @returns {status: string, message: string, cipherText: string}
25
+ */
26
+ export declare const encryptDataWithKMS: (config: AwsConfig, arn: string, plainText: string, context: any) => Promise<{
27
+ status: string;
28
+ data: string;
29
+ message: string;
30
+ }>;
31
+ /**
32
+ * This method is used to decrypt secure text
33
+ * It requires KMS config
34
+ * @param config AWS Config
35
+ * @param cipherText Encrypted Text
36
+ * @param context Extra setting which given for extra security
37
+ * @returns {status: string, message: string, plainText: string}
38
+ */
39
+ export declare const decryptDataWithKMS: (config: AwsConfig, cipherText: string, context: any) => Promise<{
40
+ status: string;
41
+ data: string;
42
+ message: string;
43
+ }>;
44
+ export declare const drapcodeEncryptDecrypt: (data: string, encrypt: boolean) => Promise<{
45
+ status: string;
46
+ data: string;
47
+ message: string;
48
+ }>;
49
+ export declare const cryptFile: (filePath: any, encryption: Encryption, decrypt: boolean) => Promise<string | {
50
+ status: string;
51
+ data: string;
52
+ message: string;
53
+ }>;