@e-mc/types 0.10.10 → 0.10.11
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/README.md +5 -5
- package/constant.d.ts +1 -1
- package/index.js +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.11/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -197,10 +197,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
197
197
|
|
|
198
198
|
## References
|
|
199
199
|
|
|
200
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
203
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
200
|
+
- https://www.unpkg.com/@e-mc/types@0.10.11/index.d.ts
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.10.11/lib/logger.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.10.11/lib/module.d.ts
|
|
203
|
+
- https://www.unpkg.com/@e-mc/types@0.10.11/lib/object.d.ts
|
|
204
204
|
|
|
205
205
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
206
206
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -335,7 +335,6 @@ function parseStringDefault(value) {
|
|
|
335
335
|
return null;
|
|
336
336
|
}
|
|
337
337
|
const padStart = (value, char) => value > 9 ? value.toString() : char + value;
|
|
338
|
-
const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
|
|
339
338
|
const isFunction = (value) => typeof value === 'function';
|
|
340
339
|
var LOG_TYPE;
|
|
341
340
|
(function (LOG_TYPE) {
|
|
@@ -1016,22 +1015,28 @@ function getEncoding(value, fallback = 'utf-8') {
|
|
|
1016
1015
|
}
|
|
1017
1016
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
1018
1017
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
1018
|
+
let result;
|
|
1019
1019
|
try {
|
|
1020
|
-
const gcm = crypto.createCipheriv(algorithm,
|
|
1021
|
-
|
|
1020
|
+
const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
1021
|
+
result = gcm.update(data, 'utf8', encoding);
|
|
1022
|
+
result += gcm.final(encoding);
|
|
1022
1023
|
}
|
|
1023
1024
|
catch {
|
|
1024
1025
|
}
|
|
1026
|
+
return result;
|
|
1025
1027
|
}
|
|
1026
1028
|
}
|
|
1027
1029
|
function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
1028
1030
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
1031
|
+
let result;
|
|
1029
1032
|
try {
|
|
1030
|
-
const gcm = crypto.createDecipheriv(algorithm,
|
|
1031
|
-
|
|
1033
|
+
const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
1034
|
+
result = gcm.update(data, encoding, 'utf8');
|
|
1035
|
+
result += gcm.final('utf8');
|
|
1032
1036
|
}
|
|
1033
1037
|
catch {
|
|
1034
1038
|
}
|
|
1039
|
+
return result;
|
|
1035
1040
|
}
|
|
1036
1041
|
}
|
|
1037
1042
|
function randomString(format, dictionary) {
|