@nextage/nx-frame-be 1.0.21 → 1.0.23
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.
|
@@ -212,7 +212,13 @@ class CryptoUtils {
|
|
|
212
212
|
decryptText(text, secret) {
|
|
213
213
|
if (!text || !secret)
|
|
214
214
|
return '';
|
|
215
|
-
|
|
215
|
+
try {
|
|
216
|
+
return crypto_js_1.default.AES.decrypt(text, secret).toString(crypto_js_1.default.enc.Utf8);
|
|
217
|
+
}
|
|
218
|
+
catch (e) {
|
|
219
|
+
this.logger.error(e, (0, utils_1.logClassCtx)(this, 'decryptText'));
|
|
220
|
+
return '';
|
|
221
|
+
}
|
|
216
222
|
}
|
|
217
223
|
/**
|
|
218
224
|
* Encrypt plain text string to AES using CryptoJS
|
|
@@ -224,7 +230,13 @@ class CryptoUtils {
|
|
|
224
230
|
encryptText(text, secret) {
|
|
225
231
|
if (!text || !secret)
|
|
226
232
|
return '';
|
|
227
|
-
|
|
233
|
+
try {
|
|
234
|
+
return crypto_js_1.default.AES.encrypt(text, secret).toString();
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
this.logger.error(e, (0, utils_1.logClassCtx)(this, 'encryptText'));
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
228
240
|
}
|
|
229
241
|
/**
|
|
230
242
|
* Generate an md5 hash from given string
|
package/build/common/utils.js
CHANGED
|
@@ -46,7 +46,7 @@ function generateJwt(sub, jti, iss, data, signOpts = {}, secret) {
|
|
|
46
46
|
if (!signOpts)
|
|
47
47
|
signOpts = {};
|
|
48
48
|
if (!signOpts.expiresIn)
|
|
49
|
-
signOpts.expiresIn = process.env.
|
|
49
|
+
signOpts.expiresIn = process.env.JWT_VALIDITY ? `${process.env.JWT_VALIDITY || '8h'}` : `${process.env.TOKEN_VALIDITY_DAYS}d`;
|
|
50
50
|
if (!signOpts.algorithm && process.env.JWT_ALGORITHM)
|
|
51
51
|
signOpts.algorithm = process.env.JWT_ALGORITHM;
|
|
52
52
|
if (!signOpts.algorithm)
|