qsu 1.0.0 → 1.0.3
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/index.js +8 -2
- package/package.json +11 -7
- package/.idea/git_toolbox_prj.xml +0 -15
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/qsu.iml +0 -12
- package/.idea/vcs.xml +0 -6
package/dist/index.js
CHANGED
|
@@ -158,8 +158,8 @@ export default class Qsu {
|
|
|
158
158
|
const totalStrLength = currentStr.length;
|
|
159
159
|
while ((hideCount < blindLength) && (currentStrLength < totalStrLength)) {
|
|
160
160
|
tempIdx = this.numRandom(0, totalStrLength);
|
|
161
|
-
if (/[a-zA-Z가-힣]/.test(currentStr.
|
|
162
|
-
currentStr = `${currentStr.
|
|
161
|
+
if (/[a-zA-Z가-힣]/.test(currentStr.substring(tempIdx, tempIdx + 1))) {
|
|
162
|
+
currentStr = `${currentStr.substring(0, tempIdx + 1)}${blindStr}${currentStr.substring(tempIdx + 2)}`;
|
|
163
163
|
hideCount += 1;
|
|
164
164
|
}
|
|
165
165
|
currentStrLength += 1;
|
|
@@ -174,6 +174,9 @@ export default class Qsu {
|
|
|
174
174
|
return convStr;
|
|
175
175
|
}
|
|
176
176
|
static encrypt(str, secret, algorithm = 'aes-256-cbc', ivSize = 16) {
|
|
177
|
+
if (!str || str.length < 1) {
|
|
178
|
+
return '';
|
|
179
|
+
}
|
|
177
180
|
const iv = crypto.randomBytes(ivSize);
|
|
178
181
|
const cipher = crypto.createCipheriv(algorithm, secret, iv);
|
|
179
182
|
let enc = cipher.update(str);
|
|
@@ -181,6 +184,9 @@ export default class Qsu {
|
|
|
181
184
|
return `${iv.toString('hex')}:${enc.toString('hex')}`;
|
|
182
185
|
}
|
|
183
186
|
static decrypt(str, secret, algorithm = 'aes-256-cbc') {
|
|
187
|
+
if (!str || str.length < 1) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
184
190
|
const arrStr = str.split(':');
|
|
185
191
|
const decipher = crypto.createDecipheriv(algorithm, secret, Buffer.from(arrStr.shift(), 'hex'));
|
|
186
192
|
let decrypted = decipher.update(Buffer.from(arrStr.join(':'), 'hex'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qsu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Quick and Simple Utility for javascript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,17 +36,21 @@
|
|
|
36
36
|
"tool",
|
|
37
37
|
"underscore",
|
|
38
38
|
"website",
|
|
39
|
-
"helper"
|
|
39
|
+
"helper",
|
|
40
|
+
"array",
|
|
41
|
+
"string",
|
|
42
|
+
"date",
|
|
43
|
+
"math"
|
|
40
44
|
],
|
|
41
45
|
"devDependencies": {
|
|
42
|
-
"@types/node": "^17.0.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
44
|
-
"@typescript-eslint/parser": "^5.
|
|
45
|
-
"eslint": "^8.
|
|
46
|
+
"@types/node": "^17.0.35",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
|
48
|
+
"@typescript-eslint/parser": "^5.25.0",
|
|
49
|
+
"eslint": "^8.16.0",
|
|
46
50
|
"eslint-config-airbnb": "^19.0.4",
|
|
47
51
|
"eslint-plugin-import": "^2.26.0",
|
|
48
52
|
"mocha": "^10.0.0",
|
|
49
|
-
"ts-node": "^10.
|
|
53
|
+
"ts-node": "^10.8.0",
|
|
50
54
|
"typescript": "^4.6.4"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="GitToolBoxProjectSettings">
|
|
4
|
-
<option name="commitMessageIssueKeyValidationOverride">
|
|
5
|
-
<BoolValueOverride>
|
|
6
|
-
<option name="enabled" value="true" />
|
|
7
|
-
</BoolValueOverride>
|
|
8
|
-
</option>
|
|
9
|
-
<option name="commitMessageValidationEnabledOverride">
|
|
10
|
-
<BoolValueOverride>
|
|
11
|
-
<option name="enabled" value="true" />
|
|
12
|
-
</BoolValueOverride>
|
|
13
|
-
</option>
|
|
14
|
-
</component>
|
|
15
|
-
</project>
|
package/.idea/modules.xml
DELETED
package/.idea/qsu.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|