exodus-framework 2.0.754 → 2.0.756

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.
Files changed (72) hide show
  1. package/lib/app/core.d.ts +1 -0
  2. package/lib/app/core.d.ts.map +1 -1
  3. package/lib/{services → app}/error.d.ts +11 -12
  4. package/lib/app/error.d.ts.map +1 -0
  5. package/lib/app/index.d.ts +1 -0
  6. package/lib/app/index.d.ts.map +1 -1
  7. package/lib/controllers/messaging/application.d.ts.map +1 -1
  8. package/lib/controllers/messaging/database.d.ts.map +1 -1
  9. package/lib/controllers/messaging/environment.d.ts.map +1 -1
  10. package/lib/middlewares/access.d.ts.map +1 -1
  11. package/lib/services/express.d.ts.map +1 -1
  12. package/lib/services/rabitmq.d.ts.map +1 -1
  13. package/lib/services/redis.d.ts.map +1 -1
  14. package/lib/services/security.d.ts.map +1 -1
  15. package/lib/services/sequelize.d.ts.map +1 -1
  16. package/lib/services/socket.d.ts.map +1 -1
  17. package/lib/services/task.d.ts.map +1 -1
  18. package/lib/utils/api.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/lib/app/app.js +0 -84
  21. package/lib/app/controller.js +0 -95
  22. package/lib/app/core.js +0 -66
  23. package/lib/app/index.js +0 -60
  24. package/lib/app/service.js +0 -24
  25. package/lib/app/settings.js +0 -138
  26. package/lib/app/singleton.js +0 -29
  27. package/lib/contracts/console.js +0 -5
  28. package/lib/contracts/entity.js +0 -5
  29. package/lib/contracts/http.js +0 -50
  30. package/lib/contracts/index.js +0 -104
  31. package/lib/contracts/messaging.js +0 -25
  32. package/lib/contracts/security.js +0 -5
  33. package/lib/contracts/service.js +0 -5
  34. package/lib/contracts/session.js +0 -5
  35. package/lib/contracts/settings.js +0 -5
  36. package/lib/contracts/singleton.js +0 -5
  37. package/lib/contracts/socket.js +0 -11
  38. package/lib/controllers/api/file.js +0 -24
  39. package/lib/controllers/api/index.js +0 -13
  40. package/lib/controllers/index.js +0 -16
  41. package/lib/controllers/messaging/application.js +0 -72
  42. package/lib/controllers/messaging/database.js +0 -72
  43. package/lib/controllers/messaging/environment.js +0 -98
  44. package/lib/express.d.js +0 -5
  45. package/lib/index.js +0 -92
  46. package/lib/middlewares/access.js +0 -78
  47. package/lib/middlewares/authentication.js +0 -21
  48. package/lib/middlewares/file.js +0 -41
  49. package/lib/middlewares/index.js +0 -27
  50. package/lib/models/Application.js +0 -61
  51. package/lib/models/DatabaseHost.js +0 -62
  52. package/lib/models/EnvConnection.js +0 -41
  53. package/lib/models/index.js +0 -46
  54. package/lib/routes/index.js +0 -16
  55. package/lib/routes/messaging/index.js +0 -34
  56. package/lib/services/error.d.ts.map +0 -1
  57. package/lib/services/error.js +0 -52
  58. package/lib/services/express.js +0 -152
  59. package/lib/services/file.js +0 -65
  60. package/lib/services/index.js +0 -88
  61. package/lib/services/rabitmq.js +0 -102
  62. package/lib/services/redis.js +0 -60
  63. package/lib/services/security.js +0 -230
  64. package/lib/services/sequelize.js +0 -284
  65. package/lib/services/socket.js +0 -56
  66. package/lib/services/task.js +0 -165
  67. package/lib/utils/api.js +0 -50
  68. package/lib/utils/database.js +0 -157
  69. package/lib/utils/date.js +0 -28
  70. package/lib/utils/index.js +0 -60
  71. package/lib/utils/logger.js +0 -51
  72. package/lib/utils/session.js +0 -23
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _service = _interopRequireDefault(require("../app/service"));
8
- var _logger = _interopRequireDefault(require("../utils/logger"));
9
- var fs = _interopRequireWildcard(require("fs"));
10
- var fsPromisses = _interopRequireWildcard(require("fs/promises"));
11
- var _app = require("../app");
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- class FileService extends _service.default {
16
- async init() {
17
- await this.checkPaths();
18
- await this.cleanTemp();
19
- }
20
- async checkPaths() {
21
- for (const path of Object.values(_app.Core.settings.getAppication().filePaths)) {
22
- !fs.existsSync(path) && fs.mkdirSync(path, {
23
- recursive: true
24
- });
25
- }
26
- }
27
- async cleanTemp() {
28
- this.listFiles('temporary', files => {
29
- files.forEach(file => {
30
- const p = _app.Core.settings.getAppication().filePaths.temporary + '/' + file;
31
- fs.rmSync(p, {
32
- recursive: true
33
- });
34
- });
35
- });
36
- }
37
- async save(filename, destiny) {
38
- const p = _app.Core.settings.getAppication().filePaths.temporary + '/' + filename;
39
- const d = _app.Core.settings.getAppication().filePaths[destiny] + '/' + filename;
40
- return await fsPromisses.rename(p, d).then(() => d).catch(e => {
41
- (0, _logger.default)().error({
42
- filename,
43
- destiny,
44
- erro: e
45
- }, 'Não foi possível salvar o arquivo');
46
- return false;
47
- });
48
- }
49
- async delete(filename, destiny) {
50
- const d = _app.Core.settings.getAppication().filePaths[destiny] + '/' + filename;
51
- return await fsPromisses.unlink(d).then(() => true).catch(e => {
52
- (0, _logger.default)().error({
53
- filename,
54
- destiny,
55
- erro: e
56
- }, 'Não foi possível deletar o arquivo');
57
- return false;
58
- });
59
- }
60
- listFiles(origin, cb) {
61
- const p = _app.Core.settings.getAppication().filePaths[origin];
62
- fs.readdir(p, (_, file) => cb(file));
63
- }
64
- }
65
- var _default = exports.default = FileService;
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- ExpressService: true,
8
- FileService: true,
9
- RabbitMQService: true,
10
- RedisService: true,
11
- SequelizeService: true,
12
- SocketIOService: true,
13
- SecurityService: true
14
- };
15
- Object.defineProperty(exports, "ExpressService", {
16
- enumerable: true,
17
- get: function () {
18
- return _express.default;
19
- }
20
- });
21
- Object.defineProperty(exports, "FileService", {
22
- enumerable: true,
23
- get: function () {
24
- return _file.default;
25
- }
26
- });
27
- Object.defineProperty(exports, "RabbitMQService", {
28
- enumerable: true,
29
- get: function () {
30
- return _rabitmq.default;
31
- }
32
- });
33
- Object.defineProperty(exports, "RedisService", {
34
- enumerable: true,
35
- get: function () {
36
- return _redis.default;
37
- }
38
- });
39
- Object.defineProperty(exports, "SecurityService", {
40
- enumerable: true,
41
- get: function () {
42
- return _security.default;
43
- }
44
- });
45
- Object.defineProperty(exports, "SequelizeService", {
46
- enumerable: true,
47
- get: function () {
48
- return _sequelize.default;
49
- }
50
- });
51
- Object.defineProperty(exports, "SocketIOService", {
52
- enumerable: true,
53
- get: function () {
54
- return _socket.default;
55
- }
56
- });
57
- var _error = require("./error");
58
- Object.keys(_error).forEach(function (key) {
59
- if (key === "default" || key === "__esModule") return;
60
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
61
- if (key in exports && exports[key] === _error[key]) return;
62
- Object.defineProperty(exports, key, {
63
- enumerable: true,
64
- get: function () {
65
- return _error[key];
66
- }
67
- });
68
- });
69
- var _express = _interopRequireDefault(require("./express"));
70
- var _file = _interopRequireDefault(require("./file"));
71
- var _rabitmq = _interopRequireDefault(require("./rabitmq"));
72
- var _redis = _interopRequireDefault(require("./redis"));
73
- var _sequelize = _interopRequireDefault(require("./sequelize"));
74
- var _socket = _interopRequireDefault(require("./socket"));
75
- var _security = _interopRequireDefault(require("./security"));
76
- var _task = require("./task");
77
- Object.keys(_task).forEach(function (key) {
78
- if (key === "default" || key === "__esModule") return;
79
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
80
- if (key in exports && exports[key] === _task[key]) return;
81
- Object.defineProperty(exports, key, {
82
- enumerable: true,
83
- get: function () {
84
- return _task[key];
85
- }
86
- });
87
- });
88
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -1,102 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _amqplib = _interopRequireDefault(require("amqplib"));
8
- var _app = require("../app");
9
- var _service = _interopRequireDefault(require("../app/service"));
10
- var _messaging = _interopRequireDefault(require("../routes/messaging"));
11
- var _error = require("./error");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- /**
14
- * Serviço de Mensageria
15
- *
16
- * @class RabbitMQService
17
- * @extends {Service}
18
- * @implements {IService}
19
- */
20
- class RabbitMQService extends _service.default {
21
- connection;
22
- channel;
23
- connected;
24
- mainRouter;
25
-
26
- //# Initialization
27
- constructor() {
28
- super();
29
- }
30
- async init() {
31
- if (!this.mainRouter) throw new _error.ApplicationException('Need router'); //!sem router
32
-
33
- this.mainRouter = {
34
- ..._messaging.default,
35
- ...this.mainRouter
36
- }; // # Register native router
37
- await this.connect();
38
- }
39
- async registerHandles() {
40
- for (const topic of Object.keys(this.mainRouter)) {
41
- await this.channel.bindQueue(_app.Core.settings.getAppication().appId, _app.Core.settings.getMessaging().exchanges.main, topic);
42
- }
43
- await this.channel.consume(_app.Core.settings.getAppication().appId, this.consumeFromQueue.bind(this), {
44
- noAck: false
45
- });
46
- }
47
- async connect() {
48
- if (this.connected && this.channel) return;else this.connected = true;
49
- try {
50
- this.log(`⌛️ Connecting to Rabbit-MQ Server`);
51
- this.connection = await _amqplib.default.connect(`amqp://${_app.Core.settings.getMessaging().user}:${_app.Core.settings.getMessaging().pass}@${_app.Core.settings.getMessaging().host}:5672`);
52
- this.log(`✅ Rabbit MQ Connection is ready`);
53
- this.channel = await this.connection.createChannel();
54
- await this.channel.assertExchange(_app.Core.settings.getMessaging().exchanges.main, 'topic', {
55
- durable: true
56
- });
57
- await this.channel.assertQueue(_app.Core.settings.getAppication().appId, {
58
- durable: true
59
- });
60
- this.log(`🛸 Created RabbitMQ Channel successfully`);
61
- this.registerHandles();
62
- } catch (error) {
63
- new _error.ApplicationException(`Not connected to MQ Server`, error);
64
- }
65
- }
66
-
67
- //# Common
68
- async sendToQueue(topic, data) {
69
- try {
70
- if (!this.channel) {
71
- await this.connect();
72
- }
73
- this.channel.publish(_app.Core.settings.getMessaging().exchanges.main, topic, Buffer.from(JSON.stringify({
74
- ...data,
75
- serviceId: _app.Core.settings.getAppication().appId
76
- })), {
77
- messageId: new Date().toDateString(),
78
- persistent: true
79
- });
80
- } catch (error) {
81
- new _error.ApplicationException('Houve um erro no envio de uma mensagem para o rabitmq', error);
82
- }
83
- }
84
- async consumeFromQueue(msg) {
85
- if (!msg) {
86
- return this.log(`Invalid incoming message in`);
87
- }
88
- try {
89
- const topic = msg.fields.routingKey;
90
- const content = JSON.parse(msg.content.toString());
91
- const callBack = this.mainRouter[topic];
92
- callBack(content.data, () => this.channel.ack(msg), content.serviceId);
93
- } catch (error) {
94
- this.channel.ack(msg);
95
- new _error.ApplicationException('Error on parsing message from queue', error);
96
- }
97
- }
98
- registerRouter(router) {
99
- this.mainRouter = router;
100
- }
101
- }
102
- var _default = exports.default = RabbitMQService;
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _service = _interopRequireDefault(require("../app/service"));
8
- var _redis = require("redis");
9
- var _error = require("./error");
10
- var _app = require("../app");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * Serviço de cache
14
- *
15
- * @class RedisService
16
- * @extends {Service}
17
- * @implements {IService}
18
- */
19
- class RedisService extends _service.default {
20
- client;
21
-
22
- //* Initialization
23
- async init() {
24
- this.client = (0, _redis.createClient)({
25
- url: `redis://${_app.Core.settings.getCache().host}:${_app.Core.settings.getCache().port}`,
26
- password: _app.Core.settings.getCache().password
27
- });
28
- await this.connect();
29
- }
30
- connect() {
31
- this.client.on('error', this.onClientError.bind(this));
32
- return new Promise(resolve => {
33
- this.client.connect().then(() => {
34
- this.log('Redis client connected.', 'success');
35
- resolve(true);
36
- });
37
- });
38
- }
39
- async disconnect() {
40
- await this.client.quit();
41
- }
42
-
43
- //* Common
44
- async setValue(key, value) {
45
- await this.client.set(key, value);
46
- }
47
- async getValue(key) {
48
- const value = await this.client.get(key);
49
- return value;
50
- }
51
- async deleteValue(key) {
52
- await this.client.del(key);
53
- }
54
-
55
- //* Events
56
- onClientError(err) {
57
- new _error.ApplicationException('Error on init redis client', err);
58
- }
59
- }
60
- var _default = exports.default = RedisService;
@@ -1,230 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var crypto = _interopRequireWildcard(require("crypto"));
8
- var fs = _interopRequireWildcard(require("fs"));
9
- var _nodeJose = require("node-jose");
10
- var _path = _interopRequireDefault(require("path"));
11
- var _app = require("../app");
12
- var _error = require("./error");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- class SecurityService extends _app.Service {
17
- privateKey;
18
- publicKey;
19
- servicePublicKey;
20
- async init() {
21
- this.checkPaths();
22
- await this.loadPrivateKey();
23
- await this.loadPublicKey();
24
- await this.loadServicePublicKey();
25
- }
26
- checkPaths() {
27
- !fs.existsSync(_app.Core.settings.getAuthentication().certPath) && fs.mkdirSync(_app.Core.settings.getAuthentication().certPath, {
28
- recursive: true
29
- });
30
- }
31
-
32
- /* Key Pair */
33
- async loadPrivateKey() {
34
- const privateKeyPath = _path.default.join(_app.Core.settings.getAuthentication().certPath, 'private_key.pem');
35
- if (fs.existsSync(privateKeyPath)) {
36
- const pem = fs.readFileSync(privateKeyPath, 'utf8');
37
- this.privateKey = await _nodeJose.JWK.asKey(pem, 'pem');
38
- } else {
39
- const {
40
- privateKey
41
- } = await this.createKeyPairs();
42
- this.privateKey = await _nodeJose.JWK.asKey(privateKey, 'pem');
43
- const pem = this.privateKey.toPEM(true);
44
- fs.writeFileSync(privateKeyPath, pem, 'utf8');
45
- }
46
- }
47
- async loadPublicKey() {
48
- const publicKeyPath = _path.default.join(_app.Core.settings.getAuthentication().certPath, 'public_key.pem');
49
- const pem = this.privateKey.toPEM(false);
50
- this.publicKey = await _nodeJose.JWK.asKey(pem, 'pem');
51
- fs.writeFileSync(publicKeyPath, pem, 'utf8');
52
- }
53
- async createKeyPairs() {
54
- const keyPair = await _nodeJose.JWK.createKey('RSA', 2048, {
55
- alg: 'RS256',
56
- use: 'sig',
57
- iss: _app.Core.settings.getAuthentication().issuer
58
- });
59
- return {
60
- publicKey: keyPair.toPEM(false),
61
- privateKey: keyPair.toPEM(true)
62
- };
63
- }
64
- async loadServicePublicKey() {
65
- if (fs.existsSync(_app.Core.settings.getAuthentication().servicePublicKeyPath)) {
66
- const pem = fs.readFileSync(_app.Core.settings.getAuthentication().servicePublicKeyPath, 'utf8');
67
- this.servicePublicKey = await _nodeJose.JWK.asKey(pem, 'pem');
68
- } else {
69
- throw new _error.ApplicationException('Não foi possível localizar o certificado de serviço. Verifique o caminho nas configurações');
70
- }
71
- }
72
- async loadKeyByStr(data) {
73
- return await _nodeJose.JWK.asKey(data, 'pem');
74
- }
75
-
76
- /**
77
- * Chave privada emitida por este serviço
78
- *
79
- * @memberof SecurityService
80
- */
81
- getPrivateKey() {
82
- return this.privateKey;
83
- }
84
- /**
85
- * Chave publica emitida por este serviço
86
- *
87
- * @memberof SecurityService
88
- */
89
- getPublicKey() {
90
- return this.publicKey;
91
- }
92
- /**
93
- * Chave publica emitida pelo serviço do hub se sessões
94
- *
95
- * @memberof SecurityService
96
- */
97
- getServicePublicKey() {
98
- return this.servicePublicKey;
99
- }
100
- /**
101
- * Criptografía utilizando chave publica
102
- *
103
- * @param {TSignData} data
104
- * @memberof SecurityService
105
- */
106
- async encrypt(data, publicKey) {
107
- const currentTime = Math.floor(Date.now() / 1000);
108
- const defaults = {
109
- iat: currentTime,
110
- exp: currentTime + _app.Core.settings.getAuthentication().signExpirationSecs,
111
- iss: _app.Core.settings.getAuthentication().issuer
112
- };
113
- const payload = JSON.stringify({
114
- ...defaults,
115
- ...data
116
- });
117
- try {
118
- const encrypted = await _nodeJose.JWE.createEncrypt({
119
- format: 'compact'
120
- }, publicKey).update(payload).final();
121
- return encrypted;
122
- } catch (error) {
123
- new _error.ApplicationException('Não foi possível criptografar os dados', error);
124
- return false;
125
- }
126
- }
127
- /**
128
- * Descriptografia utilizando chave privada
129
- *
130
- * @param {string} encryptedData
131
- * @memberof SecurityService
132
- */
133
- async decrypt(encryptedData, privateKey) {
134
- try {
135
- const decrypted = await _nodeJose.JWE.createDecrypt(privateKey).decrypt(encryptedData);
136
- const result = decrypted.plaintext.toString();
137
- const parserd = JSON.parse(result);
138
- // Tenta parsear como JSON se for objeto
139
- return parserd.payload;
140
- } catch (error) {
141
- new _error.ApplicationException('Não foi possível descriptografar os dados', error);
142
- return false;
143
- }
144
- }
145
- /**
146
- * Realiza uma assinatura usando chave privada
147
- *
148
- * @param {TSignData} data
149
- * @memberof SecurityService
150
- */
151
- async sign(data, privateKey) {
152
- const currentTime = Math.floor(Date.now() / 1000);
153
- const defaults = {
154
- iat: currentTime,
155
- exp: currentTime + _app.Core.settings.getAuthentication().signExpirationSecs,
156
- iss: _app.Core.settings.getAuthentication().issuer
157
- };
158
- try {
159
- const payload = JSON.stringify({
160
- ...defaults,
161
- ...data
162
- });
163
- const signature = await _nodeJose.JWS.createSign({
164
- compact: true,
165
- fields: {
166
- typ: 'jwt'
167
- }
168
- }, privateKey).update(payload, 'utf8').final();
169
- return signature;
170
- } catch (error) {
171
- throw new _error.ApplicationException('Erro ao assinar os dados', error);
172
- }
173
- }
174
-
175
- /**
176
- * Verifica assinatura utilizando chave publica
177
- *
178
- * @param {string} signature
179
- * @memberof SecurityService
180
- */
181
- async verifySignature(signature, publicKey) {
182
- try {
183
- const result = await _nodeJose.JWS.createVerify(publicKey).verify(signature);
184
- const payload = result.payload.toString();
185
- return JSON.parse(payload);
186
- } catch (error) {
187
- new _error.ApplicationException('Assinatura inválida ou erro durante a verificação', error);
188
- }
189
- }
190
-
191
- /**
192
- * Criptografía de dados utilizando um buffer automático ao invés de chaves
193
- *
194
- * @param {(string | object)} data
195
- * @memberof SecurityService
196
- */
197
- simpleEncrypt(data) {
198
- if (process.versions.openssl <= '1.0.1f') {
199
- throw new Error('OpenSSL Version too old, vulnerability to Heartbleed');
200
- }
201
- const key = crypto.randomBytes(32);
202
- const iv = crypto.randomBytes(16);
203
- const cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(key), iv);
204
- let encrypted = cipher.update(data);
205
- encrypted = Buffer.concat([encrypted, cipher.final()]);
206
- return [iv.toString('hex') + ':' + encrypted.toString('hex'), key];
207
- }
208
- /**
209
- * Utiliza um buffer para descriptografar dados criptografados através de simpleEncrypt()
210
- *
211
- * @param {string} data
212
- * @param {Buffer} key
213
- * @memberof SecurityService
214
- */
215
- simpleDecrypt(data, key) {
216
- try {
217
- const textParts = data.split(':');
218
- const iv = Buffer.from(textParts.shift(), 'hex');
219
- const encryptedText = Buffer.from(textParts.join(':'), 'hex');
220
- const decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from(key), iv);
221
- let decrypted = decipher.update(encryptedText);
222
- decrypted = Buffer.concat([decrypted, decipher.final()]);
223
- return decrypted;
224
- } catch (error) {
225
- new _error.ApplicationException('Erro durante a descriptografia de dados', error);
226
- return false;
227
- }
228
- }
229
- }
230
- var _default = exports.default = SecurityService;