@e-mc/types 0.7.20 → 0.7.21
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/constant.d.ts +1 -1
- package/index.js +10 -5
- package/lib/index.d.ts +1 -1
- package/lib/watch.d.ts +2 -2
- package/package.json +1 -1
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -146,7 +146,6 @@ function recurseObject(data, parseString, completed, cache) {
|
|
|
146
146
|
}
|
|
147
147
|
return data;
|
|
148
148
|
}
|
|
149
|
-
const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
|
|
150
149
|
const isFunction = (value) => typeof value === 'function';
|
|
151
150
|
var LOG_TYPE;
|
|
152
151
|
(function (LOG_TYPE) {
|
|
@@ -832,23 +831,29 @@ function getEncoding(value, fallback = 'utf-8') {
|
|
|
832
831
|
exports.getEncoding = getEncoding;
|
|
833
832
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
834
833
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
834
|
+
let result;
|
|
835
835
|
try {
|
|
836
|
-
const gcm = crypto.createCipheriv(algorithm,
|
|
837
|
-
|
|
836
|
+
const gcm = crypto.createCipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
837
|
+
result = gcm.update(data, 'utf8', encoding);
|
|
838
|
+
result += gcm.final(encoding);
|
|
838
839
|
}
|
|
839
840
|
catch {
|
|
840
841
|
}
|
|
842
|
+
return result;
|
|
841
843
|
}
|
|
842
844
|
}
|
|
843
845
|
exports.encryptUTF8 = encryptUTF8;
|
|
844
846
|
function decryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
845
847
|
if (checkCipherType(algorithm) && isString(data)) {
|
|
848
|
+
let result;
|
|
846
849
|
try {
|
|
847
|
-
const gcm = crypto.createDecipheriv(algorithm,
|
|
848
|
-
|
|
850
|
+
const gcm = crypto.createDecipheriv(algorithm, crypto.scryptSync(key, iv, 32), iv);
|
|
851
|
+
result = gcm.update(data, encoding, 'utf8');
|
|
852
|
+
result += gcm.final('utf8');
|
|
849
853
|
}
|
|
850
854
|
catch {
|
|
851
855
|
}
|
|
856
|
+
return result;
|
|
852
857
|
}
|
|
853
858
|
}
|
|
854
859
|
exports.decryptUTF8 = decryptUTF8;
|
package/lib/index.d.ts
CHANGED
|
@@ -286,7 +286,7 @@ declare namespace functions {
|
|
|
286
286
|
createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
|
|
287
287
|
shutdown(): void;
|
|
288
288
|
setTimeout(value: NumString): void;
|
|
289
|
-
checkTimeout(client: ws
|
|
289
|
+
checkTimeout(client: ws.WebSocket): boolean;
|
|
290
290
|
readonly prototype: IWatch<T, U, V, W>;
|
|
291
291
|
new(module?: V): IWatch<T, U, V, W>;
|
|
292
292
|
new(interval?: number, port?: number, securePort?: number, extensions?: unknown[]): IWatch<T, U, V, W>;
|
package/lib/watch.d.ts
CHANGED
|
@@ -58,8 +58,8 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
|
|
|
58
58
|
|
|
59
59
|
export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
|
|
60
60
|
CONNECTION_TIMEOUT: number;
|
|
61
|
-
CLIENT_SESSION: Map<
|
|
62
|
-
checkTimeout(client: ws
|
|
61
|
+
CLIENT_SESSION: Map<ws.WebSocket, number>;
|
|
62
|
+
checkTimeout(client: ws.WebSocket): boolean;
|
|
63
63
|
cloneAsset(asset: T): T;
|
|
64
64
|
readonly prototype: IFileGroup<T>;
|
|
65
65
|
new(uri: string, assets: T[], abortable: boolean): IFileGroup<T>;
|