@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 CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.7.20',
2
+ VERSION = '0.7.21',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
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, convertScrypt(key, iv, data), iv);
837
- return gcm.update(data, 'utf-8', encoding) + gcm.final(encoding);
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, convertScrypt(key, iv, data), iv);
848
- return gcm.update(data, encoding, 'utf-8') + gcm.final('utf-8');
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 | ws.WebSocket): boolean;
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<typeof ws, number>;
62
- checkTimeout(client: ws | ws.WebSocket): boolean;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.7.20",
3
+ "version": "0.7.21",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",