k9crypt 1.0.8 → 1.1.0

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 CHANGED
@@ -3,16 +3,8 @@
3
3
  This is a special encryption algorithm created for K9Crypt.
4
4
 
5
5
  ## Updates
6
- **v1.0.8**
7
- - Enhanced encryption security with 5-layer encryption system
8
- - Added multiple AES encryption modes in sequence:
9
- - AES-256-GCM
10
- - AES-256-CBC
11
- - AES-256-CFB
12
- - AES-256-OFB
13
- - AES-256-CTR
14
- - Each layer now uses its own initialization vector (IV)
15
- - Improved data integrity with comprehensive authentication
6
+ **v1.1.0**
7
+ - Modules have been updated to the latest version.
16
8
 
17
9
  ## Installation
18
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k9crypt",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "A special encryption algorithm created for K9Crypt.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,13 +18,13 @@
18
18
  "author": "K9Crypt Team",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "bcrypt": "^5.1.1",
22
- "crypto-js": "^4.2.0",
23
- "lz4": "^0.6.5",
24
- "node-forge": "^1.3.1",
25
- "xxhash": "^0.3.0"
21
+ "bcrypt": "5.1.1",
22
+ "crypto-js": "4.2.0",
23
+ "lz4": "0.6.5",
24
+ "lzma-native": "8.0.6",
25
+ "node-forge": "1.3.1",
26
+ "xxhash": "0.3.0"
26
27
  },
27
- "devDependencies": {},
28
28
  "repository": {
29
29
  "type": "git",
30
30
  "url": "git+https://github.com/K9Crypt/module.git"
@@ -1,19 +1,44 @@
1
1
  const zlib = require('zlib');
2
+ const lzma = require('lzma-native');
2
3
 
3
- exports.compress = (data) => {
4
- return new Promise((resolve, reject) => {
5
- zlib.brotliCompress(Buffer.from(data, 'utf8'), (err, compressed) => {
6
- if (err) reject(err);
7
- else resolve(compressed);
4
+ exports.compress = async (data) => {
5
+ try {
6
+ const brotliParams = {
7
+ params: {
8
+ [zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,
9
+ [zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY,
10
+ [zlib.constants.BROTLI_PARAM_SIZE_HINT]: Buffer.byteLength(data, 'utf8'),
11
+ [zlib.constants.BROTLI_PARAM_LGWIN]: 24
12
+ }
13
+ };
14
+
15
+ const brotliCompressed = await new Promise((resolve, reject) => {
16
+ zlib.brotliCompress(Buffer.from(data, 'utf8'), brotliParams, (err, compressed) => {
17
+ if (err) reject(err);
18
+ else resolve(compressed);
19
+ });
8
20
  });
9
- });
21
+
22
+ const lzmaCompressed = await lzma.compress(brotliCompressed, 9);
23
+ return lzmaCompressed;
24
+ } catch (error) {
25
+ throw new Error(`Compression error: ${error.message}`);
26
+ }
10
27
  };
11
28
 
12
- exports.decompress = (data) => {
13
- return new Promise((resolve, reject) => {
14
- zlib.brotliDecompress(data, (err, decompressed) => {
15
- if (err) reject(err);
16
- else resolve(decompressed);
29
+ exports.decompress = async (data) => {
30
+ try {
31
+ const lzmaDecompressed = await lzma.decompress(data);
32
+
33
+ const brotliDecompressed = await new Promise((resolve, reject) => {
34
+ zlib.brotliDecompress(lzmaDecompressed, (err, decompressed) => {
35
+ if (err) reject(err);
36
+ else resolve(decompressed);
37
+ });
17
38
  });
18
- });
19
- };
39
+
40
+ return brotliDecompressed;
41
+ } catch (error) {
42
+ throw new Error(`Decompression error: ${error.message}`);
43
+ }
44
+ };