@qlover/fe-corekit 1.2.5 → 1.2.9
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.es.js +1 -7421
- package/dist/index.umd.js +1 -7446
- package/dist/interface/index.es.js +1 -269
- package/dist/interface/index.umd.js +1 -279
- package/dist/server/index.cjs.js +1 -170
- package/dist/server/index.es.js +1 -167
- package/package.json +10 -10
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
- package/dist/interface/index.es.js.map +0 -1
- package/dist/interface/index.umd.js.map +0 -1
- package/dist/server/index.cjs.js.map +0 -1
- package/dist/server/index.es.js.map +0 -1
package/dist/server/index.cjs.js
CHANGED
|
@@ -1,170 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var crypto = require('crypto');
|
|
4
|
-
var buffer = require('buffer');
|
|
5
|
-
var zlib = require('zlib');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* String encryption implementation with Zlib compression
|
|
9
|
-
* Combines AES encryption with data compression
|
|
10
|
-
*
|
|
11
|
-
* Features:
|
|
12
|
-
* - AES-128-CBC encryption
|
|
13
|
-
* - Zlib compression
|
|
14
|
-
* - IV support
|
|
15
|
-
* - Configurable encoding
|
|
16
|
-
*
|
|
17
|
-
* @implements {Encryptor<string, string>}
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const encryptor = new StringZlibEncrypt('my-16-char-key!!');
|
|
22
|
-
*
|
|
23
|
-
* // Encrypt and compress
|
|
24
|
-
* const encrypted = encryptor.encrypt('large text data');
|
|
25
|
-
*
|
|
26
|
-
* // Decrypt and decompress
|
|
27
|
-
* const decrypted = encryptor.decrypt(encrypted);
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
var StringZlibEncrypt = /** @class */ (function () {
|
|
31
|
-
/**
|
|
32
|
-
* Creates a new StringZlibEncrypt instance
|
|
33
|
-
* @param encryptionKey - Key used for encryption/decryption
|
|
34
|
-
* @param encoding - Output encoding format
|
|
35
|
-
* @throws {RangeError} If key length is invalid
|
|
36
|
-
*/
|
|
37
|
-
function StringZlibEncrypt(encryptionKey, encoding) {
|
|
38
|
-
if (encoding === void 0) { encoding = 'base64'; }
|
|
39
|
-
this.encoding = encoding;
|
|
40
|
-
this.ALGORITHM = 'aes-128-cbc';
|
|
41
|
-
this.IV_LENGTH = 16;
|
|
42
|
-
this.KEY_LENGTH = 16;
|
|
43
|
-
this.KEY = this.validateKey(encryptionKey);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Validates and processes encryption key
|
|
47
|
-
* Ensures key meets length requirements
|
|
48
|
-
*
|
|
49
|
-
* @param key - Raw encryption key
|
|
50
|
-
* @returns Validated key buffer
|
|
51
|
-
* @throws {RangeError} If key length is invalid
|
|
52
|
-
*/
|
|
53
|
-
StringZlibEncrypt.prototype.validateKey = function (key) {
|
|
54
|
-
var keyBuffer = buffer.Buffer.from(key.slice(0, this.KEY_LENGTH));
|
|
55
|
-
if (keyBuffer.length !== this.KEY_LENGTH) {
|
|
56
|
-
throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH, " bytes, got ").concat(keyBuffer.length, " bytes"));
|
|
57
|
-
}
|
|
58
|
-
return keyBuffer;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Encrypts and compresses a string value
|
|
62
|
-
* Applies compression before encryption
|
|
63
|
-
*
|
|
64
|
-
* @param value - String to encrypt
|
|
65
|
-
* @returns Encrypted and compressed string with IV
|
|
66
|
-
*/
|
|
67
|
-
StringZlibEncrypt.prototype.encrypt = function (value) {
|
|
68
|
-
var iv = crypto.randomBytes(this.IV_LENGTH);
|
|
69
|
-
var cipher = crypto.createCipheriv(this.ALGORITHM, this.KEY, iv);
|
|
70
|
-
var compressedValue = zlib.deflateSync(value);
|
|
71
|
-
var encrypted = cipher.update(compressedValue, undefined, this.encoding);
|
|
72
|
-
encrypted += cipher.final(this.encoding);
|
|
73
|
-
return "".concat(encrypted, ":").concat(iv.toString(this.encoding));
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Decrypts and decompresses an encrypted string
|
|
77
|
-
* Applies decryption before decompression
|
|
78
|
-
*
|
|
79
|
-
* @param encryptedData - Encrypted string with IV
|
|
80
|
-
* @returns Original string
|
|
81
|
-
*/
|
|
82
|
-
StringZlibEncrypt.prototype.decrypt = function (encryptedData) {
|
|
83
|
-
var _a = encryptedData.split(':'), encrypted = _a[0], iv = _a[1];
|
|
84
|
-
var decipher = crypto.createDecipheriv(this.ALGORITHM, this.KEY, buffer.Buffer.from(iv, this.encoding));
|
|
85
|
-
var decrypted = buffer.Buffer.from(decipher.update(encrypted, this.encoding, 'binary'), 'binary');
|
|
86
|
-
// console.log(decrypted);
|
|
87
|
-
// console.log(decipher.final());
|
|
88
|
-
decrypted = buffer.Buffer.concat([decrypted, decipher.final()]);
|
|
89
|
-
var decompressedValue = zlib.inflateSync(decrypted);
|
|
90
|
-
return decompressedValue.toString();
|
|
91
|
-
};
|
|
92
|
-
return StringZlibEncrypt;
|
|
93
|
-
}());
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Represents a string encryption utility using AES-256-CBC algorithm.
|
|
97
|
-
*
|
|
98
|
-
* This class provides methods to encrypt and decrypt string values securely.
|
|
99
|
-
* It ensures that the encryption key meets the required length for AES-256.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* const encryptor = new StringEntrypt('your-encryption-key');
|
|
104
|
-
* const encrypted = encryptor.encrypt('your-string');
|
|
105
|
-
* const decrypted = encryptor.decrypt(encrypted);
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
var StringEntrypt = /** @class */ (function () {
|
|
109
|
-
/**
|
|
110
|
-
* Creates a new StringEntrypt instance
|
|
111
|
-
* @param encryptionKey - Key used for encryption/decryption
|
|
112
|
-
* @param encoding - Output encoding format
|
|
113
|
-
* @throws {RangeError} If key length is invalid
|
|
114
|
-
*/
|
|
115
|
-
function StringEntrypt(encryptionKey, encoding) {
|
|
116
|
-
if (encoding === void 0) { encoding = 'base64'; }
|
|
117
|
-
this.encoding = encoding;
|
|
118
|
-
this.ALGORITHM = 'aes-256-cbc';
|
|
119
|
-
this.KEY_LENGTH = 32; // AES-256 needs 32 bytes key
|
|
120
|
-
this.KEY = this.validateKey(encryptionKey);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Validates and processes encryption key
|
|
124
|
-
* Ensures key meets length requirements
|
|
125
|
-
*
|
|
126
|
-
* @param key - Raw encryption key
|
|
127
|
-
* @returns Validated key buffer
|
|
128
|
-
* @throws {RangeError} If key length is invalid
|
|
129
|
-
*/
|
|
130
|
-
StringEntrypt.prototype.validateKey = function (key) {
|
|
131
|
-
var keyBuffer = buffer.Buffer.from(key.slice(0, this.KEY_LENGTH));
|
|
132
|
-
if (keyBuffer.length !== this.KEY_LENGTH) {
|
|
133
|
-
throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH, " bytes, got ").concat(keyBuffer.length, " bytes"));
|
|
134
|
-
}
|
|
135
|
-
return keyBuffer;
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Encrypts a string value
|
|
139
|
-
* Uses random IV for each encryption
|
|
140
|
-
*
|
|
141
|
-
* @param value - String to encrypt
|
|
142
|
-
* @returns Encrypted string with IV
|
|
143
|
-
*/
|
|
144
|
-
StringEntrypt.prototype.encrypt = function (value) {
|
|
145
|
-
var iv = crypto.randomBytes(16);
|
|
146
|
-
var cipher = crypto.createCipheriv(this.ALGORITHM, this.KEY, iv);
|
|
147
|
-
var encrypted = cipher.update(value, 'utf8', this.encoding);
|
|
148
|
-
encrypted += cipher.final(this.encoding);
|
|
149
|
-
return "".concat(encrypted, ":").concat(iv.toString(this.encoding));
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Decrypts an encrypted string
|
|
153
|
-
* Extracts IV from encrypted data
|
|
154
|
-
*
|
|
155
|
-
* @param encryptedData - Encrypted string with IV
|
|
156
|
-
* @returns Original string
|
|
157
|
-
*/
|
|
158
|
-
StringEntrypt.prototype.decrypt = function (encryptedData) {
|
|
159
|
-
var _a = encryptedData.split(':'), encrypted = _a[0], iv = _a[1];
|
|
160
|
-
var decipher = crypto.createDecipheriv(this.ALGORITHM, this.KEY, buffer.Buffer.from(iv, this.encoding));
|
|
161
|
-
var decrypted = decipher.update(encrypted, this.encoding, 'utf8');
|
|
162
|
-
decrypted += decipher.final('utf8');
|
|
163
|
-
return decrypted;
|
|
164
|
-
};
|
|
165
|
-
return StringEntrypt;
|
|
166
|
-
}());
|
|
167
|
-
|
|
168
|
-
exports.StringEntrypt = StringEntrypt;
|
|
169
|
-
exports.StringZlibEncrypt = StringZlibEncrypt;
|
|
170
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
1
|
+
"use strict";var t=require("crypto"),e=require("buffer"),i=require("zlib"),n=function(){function n(t,e){void 0===e&&(e="base64"),this.encoding=e,this.ALGORITHM="aes-128-cbc",this.IV_LENGTH=16,this.KEY_LENGTH=16,this.KEY=this.validateKey(t)}return n.prototype.validateKey=function(t){var i=e.Buffer.from(t.slice(0,this.KEY_LENGTH));if(i.length!==this.KEY_LENGTH)throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH," bytes, got ").concat(i.length," bytes"));return i},n.prototype.encrypt=function(e){var n=t.randomBytes(this.IV_LENGTH),r=t.createCipheriv(this.ALGORITHM,this.KEY,n),o=i.deflateSync(e),c=r.update(o,void 0,this.encoding);return c+=r.final(this.encoding),"".concat(c,":").concat(n.toString(this.encoding))},n.prototype.decrypt=function(n){var r=n.split(":"),o=r[0],c=r[1],s=t.createDecipheriv(this.ALGORITHM,this.KEY,e.Buffer.from(c,this.encoding)),a=e.Buffer.from(s.update(o,this.encoding,"binary"),"binary");return a=e.Buffer.concat([a,s.final()]),i.inflateSync(a).toString()},n}(),r=function(){function i(t,e){void 0===e&&(e="base64"),this.encoding=e,this.ALGORITHM="aes-256-cbc",this.KEY_LENGTH=32,this.KEY=this.validateKey(t)}return i.prototype.validateKey=function(t){var i=e.Buffer.from(t.slice(0,this.KEY_LENGTH));if(i.length!==this.KEY_LENGTH)throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH," bytes, got ").concat(i.length," bytes"));return i},i.prototype.encrypt=function(e){var i=t.randomBytes(16),n=t.createCipheriv(this.ALGORITHM,this.KEY,i),r=n.update(e,"utf8",this.encoding);return r+=n.final(this.encoding),"".concat(r,":").concat(i.toString(this.encoding))},i.prototype.decrypt=function(i){var n=i.split(":"),r=n[0],o=n[1],c=t.createDecipheriv(this.ALGORITHM,this.KEY,e.Buffer.from(o,this.encoding)),s=c.update(r,this.encoding,"utf8");return s+=c.final("utf8")},i}();exports.StringEntrypt=r,exports.StringZlibEncrypt=n;
|
package/dist/server/index.es.js
CHANGED
|
@@ -1,167 +1 @@
|
|
|
1
|
-
import crypto from
|
|
2
|
-
import { Buffer } from 'buffer';
|
|
3
|
-
import zlib from 'zlib';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* String encryption implementation with Zlib compression
|
|
7
|
-
* Combines AES encryption with data compression
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - AES-128-CBC encryption
|
|
11
|
-
* - Zlib compression
|
|
12
|
-
* - IV support
|
|
13
|
-
* - Configurable encoding
|
|
14
|
-
*
|
|
15
|
-
* @implements {Encryptor<string, string>}
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const encryptor = new StringZlibEncrypt('my-16-char-key!!');
|
|
20
|
-
*
|
|
21
|
-
* // Encrypt and compress
|
|
22
|
-
* const encrypted = encryptor.encrypt('large text data');
|
|
23
|
-
*
|
|
24
|
-
* // Decrypt and decompress
|
|
25
|
-
* const decrypted = encryptor.decrypt(encrypted);
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
var StringZlibEncrypt = /** @class */ (function () {
|
|
29
|
-
/**
|
|
30
|
-
* Creates a new StringZlibEncrypt instance
|
|
31
|
-
* @param encryptionKey - Key used for encryption/decryption
|
|
32
|
-
* @param encoding - Output encoding format
|
|
33
|
-
* @throws {RangeError} If key length is invalid
|
|
34
|
-
*/
|
|
35
|
-
function StringZlibEncrypt(encryptionKey, encoding) {
|
|
36
|
-
if (encoding === void 0) { encoding = 'base64'; }
|
|
37
|
-
this.encoding = encoding;
|
|
38
|
-
this.ALGORITHM = 'aes-128-cbc';
|
|
39
|
-
this.IV_LENGTH = 16;
|
|
40
|
-
this.KEY_LENGTH = 16;
|
|
41
|
-
this.KEY = this.validateKey(encryptionKey);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Validates and processes encryption key
|
|
45
|
-
* Ensures key meets length requirements
|
|
46
|
-
*
|
|
47
|
-
* @param key - Raw encryption key
|
|
48
|
-
* @returns Validated key buffer
|
|
49
|
-
* @throws {RangeError} If key length is invalid
|
|
50
|
-
*/
|
|
51
|
-
StringZlibEncrypt.prototype.validateKey = function (key) {
|
|
52
|
-
var keyBuffer = Buffer.from(key.slice(0, this.KEY_LENGTH));
|
|
53
|
-
if (keyBuffer.length !== this.KEY_LENGTH) {
|
|
54
|
-
throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH, " bytes, got ").concat(keyBuffer.length, " bytes"));
|
|
55
|
-
}
|
|
56
|
-
return keyBuffer;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Encrypts and compresses a string value
|
|
60
|
-
* Applies compression before encryption
|
|
61
|
-
*
|
|
62
|
-
* @param value - String to encrypt
|
|
63
|
-
* @returns Encrypted and compressed string with IV
|
|
64
|
-
*/
|
|
65
|
-
StringZlibEncrypt.prototype.encrypt = function (value) {
|
|
66
|
-
var iv = crypto.randomBytes(this.IV_LENGTH);
|
|
67
|
-
var cipher = crypto.createCipheriv(this.ALGORITHM, this.KEY, iv);
|
|
68
|
-
var compressedValue = zlib.deflateSync(value);
|
|
69
|
-
var encrypted = cipher.update(compressedValue, undefined, this.encoding);
|
|
70
|
-
encrypted += cipher.final(this.encoding);
|
|
71
|
-
return "".concat(encrypted, ":").concat(iv.toString(this.encoding));
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Decrypts and decompresses an encrypted string
|
|
75
|
-
* Applies decryption before decompression
|
|
76
|
-
*
|
|
77
|
-
* @param encryptedData - Encrypted string with IV
|
|
78
|
-
* @returns Original string
|
|
79
|
-
*/
|
|
80
|
-
StringZlibEncrypt.prototype.decrypt = function (encryptedData) {
|
|
81
|
-
var _a = encryptedData.split(':'), encrypted = _a[0], iv = _a[1];
|
|
82
|
-
var decipher = crypto.createDecipheriv(this.ALGORITHM, this.KEY, Buffer.from(iv, this.encoding));
|
|
83
|
-
var decrypted = Buffer.from(decipher.update(encrypted, this.encoding, 'binary'), 'binary');
|
|
84
|
-
// console.log(decrypted);
|
|
85
|
-
// console.log(decipher.final());
|
|
86
|
-
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
87
|
-
var decompressedValue = zlib.inflateSync(decrypted);
|
|
88
|
-
return decompressedValue.toString();
|
|
89
|
-
};
|
|
90
|
-
return StringZlibEncrypt;
|
|
91
|
-
}());
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Represents a string encryption utility using AES-256-CBC algorithm.
|
|
95
|
-
*
|
|
96
|
-
* This class provides methods to encrypt and decrypt string values securely.
|
|
97
|
-
* It ensures that the encryption key meets the required length for AES-256.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* const encryptor = new StringEntrypt('your-encryption-key');
|
|
102
|
-
* const encrypted = encryptor.encrypt('your-string');
|
|
103
|
-
* const decrypted = encryptor.decrypt(encrypted);
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
var StringEntrypt = /** @class */ (function () {
|
|
107
|
-
/**
|
|
108
|
-
* Creates a new StringEntrypt instance
|
|
109
|
-
* @param encryptionKey - Key used for encryption/decryption
|
|
110
|
-
* @param encoding - Output encoding format
|
|
111
|
-
* @throws {RangeError} If key length is invalid
|
|
112
|
-
*/
|
|
113
|
-
function StringEntrypt(encryptionKey, encoding) {
|
|
114
|
-
if (encoding === void 0) { encoding = 'base64'; }
|
|
115
|
-
this.encoding = encoding;
|
|
116
|
-
this.ALGORITHM = 'aes-256-cbc';
|
|
117
|
-
this.KEY_LENGTH = 32; // AES-256 needs 32 bytes key
|
|
118
|
-
this.KEY = this.validateKey(encryptionKey);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Validates and processes encryption key
|
|
122
|
-
* Ensures key meets length requirements
|
|
123
|
-
*
|
|
124
|
-
* @param key - Raw encryption key
|
|
125
|
-
* @returns Validated key buffer
|
|
126
|
-
* @throws {RangeError} If key length is invalid
|
|
127
|
-
*/
|
|
128
|
-
StringEntrypt.prototype.validateKey = function (key) {
|
|
129
|
-
var keyBuffer = Buffer.from(key.slice(0, this.KEY_LENGTH));
|
|
130
|
-
if (keyBuffer.length !== this.KEY_LENGTH) {
|
|
131
|
-
throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH, " bytes, got ").concat(keyBuffer.length, " bytes"));
|
|
132
|
-
}
|
|
133
|
-
return keyBuffer;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Encrypts a string value
|
|
137
|
-
* Uses random IV for each encryption
|
|
138
|
-
*
|
|
139
|
-
* @param value - String to encrypt
|
|
140
|
-
* @returns Encrypted string with IV
|
|
141
|
-
*/
|
|
142
|
-
StringEntrypt.prototype.encrypt = function (value) {
|
|
143
|
-
var iv = crypto.randomBytes(16);
|
|
144
|
-
var cipher = crypto.createCipheriv(this.ALGORITHM, this.KEY, iv);
|
|
145
|
-
var encrypted = cipher.update(value, 'utf8', this.encoding);
|
|
146
|
-
encrypted += cipher.final(this.encoding);
|
|
147
|
-
return "".concat(encrypted, ":").concat(iv.toString(this.encoding));
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Decrypts an encrypted string
|
|
151
|
-
* Extracts IV from encrypted data
|
|
152
|
-
*
|
|
153
|
-
* @param encryptedData - Encrypted string with IV
|
|
154
|
-
* @returns Original string
|
|
155
|
-
*/
|
|
156
|
-
StringEntrypt.prototype.decrypt = function (encryptedData) {
|
|
157
|
-
var _a = encryptedData.split(':'), encrypted = _a[0], iv = _a[1];
|
|
158
|
-
var decipher = crypto.createDecipheriv(this.ALGORITHM, this.KEY, Buffer.from(iv, this.encoding));
|
|
159
|
-
var decrypted = decipher.update(encrypted, this.encoding, 'utf8');
|
|
160
|
-
decrypted += decipher.final('utf8');
|
|
161
|
-
return decrypted;
|
|
162
|
-
};
|
|
163
|
-
return StringEntrypt;
|
|
164
|
-
}());
|
|
165
|
-
|
|
166
|
-
export { StringEntrypt, StringZlibEncrypt };
|
|
167
|
-
//# sourceMappingURL=index.es.js.map
|
|
1
|
+
import t from"crypto";import{Buffer as i}from"buffer";import e from"zlib";var n=function(){function n(t,i){void 0===i&&(i="base64"),this.encoding=i,this.ALGORITHM="aes-128-cbc",this.IV_LENGTH=16,this.KEY_LENGTH=16,this.KEY=this.validateKey(t)}return n.prototype.validateKey=function(t){var e=i.from(t.slice(0,this.KEY_LENGTH));if(e.length!==this.KEY_LENGTH)throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH," bytes, got ").concat(e.length," bytes"));return e},n.prototype.encrypt=function(i){var n=t.randomBytes(this.IV_LENGTH),o=t.createCipheriv(this.ALGORITHM,this.KEY,n),r=e.deflateSync(i),c=o.update(r,void 0,this.encoding);return c+=o.final(this.encoding),"".concat(c,":").concat(n.toString(this.encoding))},n.prototype.decrypt=function(n){var o=n.split(":"),r=o[0],c=o[1],a=t.createDecipheriv(this.ALGORITHM,this.KEY,i.from(c,this.encoding)),s=i.from(a.update(r,this.encoding,"binary"),"binary");return s=i.concat([s,a.final()]),e.inflateSync(s).toString()},n}(),o=function(){function e(t,i){void 0===i&&(i="base64"),this.encoding=i,this.ALGORITHM="aes-256-cbc",this.KEY_LENGTH=32,this.KEY=this.validateKey(t)}return e.prototype.validateKey=function(t){var e=i.from(t.slice(0,this.KEY_LENGTH));if(e.length!==this.KEY_LENGTH)throw new RangeError("Invalid key length. Expected ".concat(this.KEY_LENGTH," bytes, got ").concat(e.length," bytes"));return e},e.prototype.encrypt=function(i){var e=t.randomBytes(16),n=t.createCipheriv(this.ALGORITHM,this.KEY,e),o=n.update(i,"utf8",this.encoding);return o+=n.final(this.encoding),"".concat(o,":").concat(e.toString(this.encoding))},e.prototype.decrypt=function(e){var n=e.split(":"),o=n[0],r=n[1],c=t.createDecipheriv(this.ALGORITHM,this.KEY,i.from(r,this.encoding)),a=c.update(o,this.encoding,"utf8");return a+=c.final("utf8")},e}();export{o as StringEntrypt,n as StringZlibEncrypt};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlover/fe-corekit",
|
|
3
3
|
"description": "A corekit for frontwork",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.9",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -46,20 +46,20 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"scripts": {
|
|
50
|
-
"build": "rollup -c",
|
|
51
|
-
"build:common:docs": "fe-code2md -p ./common/index.ts -g ./docs -o ./docs/.output/common.json -t ./docs/.output/common.tpl.json",
|
|
52
|
-
"build:server:docs": "fe-code2md -p ./server/index.ts -g ./docs -o ./docs/.output/server.json -t ./docs/.output/server.tpl.json",
|
|
53
|
-
"build:docs": "npm run build:common:docs && npm run build:server:docs",
|
|
54
|
-
"build:docs:debug": "npm run build:common:docs -- --debug && npm run build:server:docs -- --debug"
|
|
55
|
-
},
|
|
56
49
|
"dependencies": {
|
|
57
50
|
"lodash": "^4.17.21",
|
|
58
51
|
"merge": "^2.1.1"
|
|
59
52
|
},
|
|
60
53
|
"devDependencies": {
|
|
61
|
-
"@qlover/env-loader": "^0.0.
|
|
54
|
+
"@qlover/env-loader": "^0.0.7",
|
|
62
55
|
"@types/lodash": "^4.17.12",
|
|
63
56
|
"axios": "^1.7.9"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rollup -c",
|
|
60
|
+
"build:common:docs": "fe-code2md -p ./common/index.ts -g ./docs -o ./docs/.output/common.json -t ./docs/.output/common.tpl.json",
|
|
61
|
+
"build:server:docs": "fe-code2md -p ./server/index.ts -g ./docs -o ./docs/.output/server.json -t ./docs/.output/server.tpl.json",
|
|
62
|
+
"build:docs": "npm run build:common:docs && npm run build:server:docs",
|
|
63
|
+
"build:docs:debug": "npm run build:common:docs -- --debug && npm run build:server:docs -- --debug"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|