@futdevpro/fsm-dynamo 1.10.51 → 1.10.52
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/build/_modules/crypto/_collections/crypto-2-non-stable.util.d.ts +48 -0
- package/build/_modules/crypto/_collections/crypto-2-non-stable.util.d.ts.map +1 -0
- package/build/_modules/crypto/_collections/crypto-2-non-stable.util.js +204 -0
- package/build/_modules/crypto/_collections/crypto-2-non-stable.util.js.map +1 -0
- package/build/_modules/crypto/_collections/crypto.util.d.ts +45 -13
- package/build/_modules/crypto/_collections/crypto.util.d.ts.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.js +96 -71
- package/build/_modules/crypto/_collections/crypto.util.js.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.spec.js +77 -77
- package/build/_modules/crypto/_collections/crypto.util.spec.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.10.52.tgz +0 -0
- package/package.json +1 -1
- package/src/_modules/crypto/_collections/crypto-2-non-stable.util.ts +224 -0
- package/src/_modules/crypto/_collections/crypto.util.spec.ts +1 -1
- package/src/_modules/crypto/_collections/crypto.util.ts +143 -82
- package/build/_modules/crypto/_collections/crypto-non-stable.util.d.ts +0 -80
- package/build/_modules/crypto/_collections/crypto-non-stable.util.d.ts.map +0 -1
- package/build/_modules/crypto/_collections/crypto-non-stable.util.js +0 -229
- package/build/_modules/crypto/_collections/crypto-non-stable.util.js.map +0 -1
- package/futdevpro-fsm-dynamo-01.10.51.tgz +0 -0
- package/src/_modules/crypto/_collections/crypto-non-stable.util.ts +0 -285
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A utility class for secure encryption and decryption of data
|
|
3
|
+
* Uses AES-256-CBC with deterministic IV and salt for consistent results
|
|
4
|
+
*/
|
|
5
|
+
export declare class DyFM_Crypto {
|
|
6
|
+
private static readonly defaultErrorUserMsg;
|
|
7
|
+
/**
|
|
8
|
+
* Validates the encryption key
|
|
9
|
+
*/
|
|
10
|
+
private static validateKey;
|
|
11
|
+
/**
|
|
12
|
+
* Safely serializes data to JSON
|
|
13
|
+
*/
|
|
14
|
+
private static safeSerialize;
|
|
15
|
+
/**
|
|
16
|
+
* Safely deserializes JSON data
|
|
17
|
+
*/
|
|
18
|
+
private static safeDeserialize;
|
|
19
|
+
/**
|
|
20
|
+
* Derives a 256-bit key from the passphrase using SHA256
|
|
21
|
+
*/
|
|
22
|
+
private static deriveKey;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a deterministic IV from the key only
|
|
25
|
+
*/
|
|
26
|
+
private static createDeterministicIV;
|
|
27
|
+
/**
|
|
28
|
+
* Encrypts data using AES-256-CBC with deterministic key and IV
|
|
29
|
+
* @param data The data to encrypt
|
|
30
|
+
* @param key The encryption key
|
|
31
|
+
* @returns URL-safe encrypted string
|
|
32
|
+
* @throws {DyFM_Error} if encryption fails
|
|
33
|
+
*/
|
|
34
|
+
static encrypt<T>(data: T, key: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Decrypts data that was encrypted using encrypt()
|
|
37
|
+
* @param encryptedData The encrypted data
|
|
38
|
+
* @param key The decryption key
|
|
39
|
+
* @returns The decrypted data
|
|
40
|
+
* @throws {DyFM_Error} if decryption fails
|
|
41
|
+
*/
|
|
42
|
+
static decrypt<T>(encryptedData: string, key: string): T;
|
|
43
|
+
/**
|
|
44
|
+
* Gets default error settings
|
|
45
|
+
*/
|
|
46
|
+
private static getDefaultErrorSettings;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=crypto-2-non-stable.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-2-non-stable.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/crypto/_collections/crypto-2-non-stable.util.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAEY;IAEvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAkB1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA6B9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAIxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IA0C/C;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAyDxD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;CAQvC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyFM_Crypto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const CryptoJS = tslib_1.__importStar(require("crypto-js"));
|
|
6
|
+
const error_control_model_1 = require("../../../_models/control-models/error.control-model");
|
|
7
|
+
/**
|
|
8
|
+
* A utility class for secure encryption and decryption of data
|
|
9
|
+
* Uses AES-256-CBC with deterministic IV and salt for consistent results
|
|
10
|
+
*/
|
|
11
|
+
class DyFM_Crypto {
|
|
12
|
+
static defaultErrorUserMsg = `We encountered an unhandled Authentication Error, ` +
|
|
13
|
+
`\nplease contact the responsible development team.`;
|
|
14
|
+
/**
|
|
15
|
+
* Validates the encryption key
|
|
16
|
+
*/
|
|
17
|
+
static validateKey(key) {
|
|
18
|
+
if (!key || typeof key !== 'string') {
|
|
19
|
+
throw new error_control_model_1.DyFM_Error({
|
|
20
|
+
status: 401,
|
|
21
|
+
message: 'Encryption key is required and must be a string',
|
|
22
|
+
errorCode: 'DyFM-CRY-KEY-REQ'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (key.trim().length === 0) {
|
|
26
|
+
throw new error_control_model_1.DyFM_Error({
|
|
27
|
+
status: 401,
|
|
28
|
+
message: 'Encryption key cannot be empty or whitespace-only',
|
|
29
|
+
errorCode: 'DyFM-CRY-KEY-EMPTY'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Safely serializes data to JSON
|
|
35
|
+
*/
|
|
36
|
+
static safeSerialize(data) {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.stringify(data);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
throw new error_control_model_1.DyFM_Error({
|
|
42
|
+
...this.getDefaultErrorSettings('safeSerialize', error),
|
|
43
|
+
errorCode: 'DyFM-CRY-SER',
|
|
44
|
+
message: 'Failed to serialize data'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Safely deserializes JSON data
|
|
50
|
+
*/
|
|
51
|
+
static safeDeserialize(data) {
|
|
52
|
+
try {
|
|
53
|
+
let parsed = JSON.parse(data);
|
|
54
|
+
// Handle double-stringified JSON
|
|
55
|
+
if (typeof parsed === 'string') {
|
|
56
|
+
try {
|
|
57
|
+
parsed = JSON.parse(parsed);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// If second parse fails, return the string as is
|
|
61
|
+
return parsed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Handle primitive values
|
|
65
|
+
if (typeof parsed === 'string' || typeof parsed === 'number' || typeof parsed === 'boolean') {
|
|
66
|
+
return parsed;
|
|
67
|
+
}
|
|
68
|
+
return parsed;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw new error_control_model_1.DyFM_Error({
|
|
72
|
+
...this.getDefaultErrorSettings('safeDeserialize', error),
|
|
73
|
+
errorCode: 'DyFM-CRY-DES',
|
|
74
|
+
message: 'Failed to deserialize data'
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Derives a 256-bit key from the passphrase using SHA256
|
|
80
|
+
*/
|
|
81
|
+
static deriveKey(key) {
|
|
82
|
+
return CryptoJS.SHA256(key);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates a deterministic IV from the key only
|
|
86
|
+
*/
|
|
87
|
+
static createDeterministicIV(key) {
|
|
88
|
+
const hash = CryptoJS.SHA256(key + ':iv');
|
|
89
|
+
return CryptoJS.lib.WordArray.create(hash.words.slice(0, 4)); // Use first 16 bytes (128 bits)
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Encrypts data using AES-256-CBC with deterministic key and IV
|
|
93
|
+
* @param data The data to encrypt
|
|
94
|
+
* @param key The encryption key
|
|
95
|
+
* @returns URL-safe encrypted string
|
|
96
|
+
* @throws {DyFM_Error} if encryption fails
|
|
97
|
+
*/
|
|
98
|
+
static encrypt(data, key) {
|
|
99
|
+
try {
|
|
100
|
+
// Validate key
|
|
101
|
+
this.validateKey(key);
|
|
102
|
+
// Validate data
|
|
103
|
+
if (data === undefined || data === null) {
|
|
104
|
+
throw new error_control_model_1.DyFM_Error({
|
|
105
|
+
status: 401,
|
|
106
|
+
message: 'Data cannot be undefined or null',
|
|
107
|
+
errorCode: 'DyFM-CRY-DATA-NULL'
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// Convert data to string
|
|
111
|
+
const dataStr = this.safeSerialize(data);
|
|
112
|
+
// Derive key and IV
|
|
113
|
+
const aesKey = this.deriveKey(key);
|
|
114
|
+
const iv = this.createDeterministicIV(key);
|
|
115
|
+
// Encrypt the data with deterministic key and IV
|
|
116
|
+
const encrypted = CryptoJS.AES.encrypt(dataStr, aesKey, {
|
|
117
|
+
iv: iv,
|
|
118
|
+
mode: CryptoJS.mode.CBC,
|
|
119
|
+
padding: CryptoJS.pad.Pkcs7
|
|
120
|
+
});
|
|
121
|
+
// Convert to URL-safe base64
|
|
122
|
+
const base64 = encrypted.ciphertext.toString(CryptoJS.enc.Base64);
|
|
123
|
+
return base64
|
|
124
|
+
.replace(/\+/g, '-')
|
|
125
|
+
.replace(/\//g, '_')
|
|
126
|
+
.replace(/=+$/, '');
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new error_control_model_1.DyFM_Error({
|
|
130
|
+
...this.getDefaultErrorSettings('encrypt', error),
|
|
131
|
+
errorCode: 'DyFM-CRY-ENC',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Decrypts data that was encrypted using encrypt()
|
|
137
|
+
* @param encryptedData The encrypted data
|
|
138
|
+
* @param key The decryption key
|
|
139
|
+
* @returns The decrypted data
|
|
140
|
+
* @throws {DyFM_Error} if decryption fails
|
|
141
|
+
*/
|
|
142
|
+
static decrypt(encryptedData, key) {
|
|
143
|
+
try {
|
|
144
|
+
// Validate key
|
|
145
|
+
this.validateKey(key);
|
|
146
|
+
// Validate encrypted data
|
|
147
|
+
if (!encryptedData || typeof encryptedData !== 'string') {
|
|
148
|
+
throw new error_control_model_1.DyFM_Error({
|
|
149
|
+
status: 401,
|
|
150
|
+
message: 'Encrypted data is required and must be a string',
|
|
151
|
+
errorCode: 'DyFM-CRY-DATA-REQ'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// Convert from URL-safe base64
|
|
155
|
+
let base64 = encryptedData
|
|
156
|
+
.replace(/-/g, '+')
|
|
157
|
+
.replace(/_/g, '/');
|
|
158
|
+
// Add padding if needed
|
|
159
|
+
const padLength = 4 - (base64.length % 4);
|
|
160
|
+
if (padLength < 4) {
|
|
161
|
+
base64 += '='.repeat(padLength);
|
|
162
|
+
}
|
|
163
|
+
// Derive key and IV
|
|
164
|
+
const aesKey = this.deriveKey(key);
|
|
165
|
+
const iv = this.createDeterministicIV(key);
|
|
166
|
+
// Decrypt the data
|
|
167
|
+
const encryptedWA = CryptoJS.enc.Base64.parse(base64);
|
|
168
|
+
const decrypted = CryptoJS.AES.decrypt({ ciphertext: encryptedWA }, aesKey, {
|
|
169
|
+
iv: iv,
|
|
170
|
+
mode: CryptoJS.mode.CBC,
|
|
171
|
+
padding: CryptoJS.pad.Pkcs7
|
|
172
|
+
});
|
|
173
|
+
// Parse JSON
|
|
174
|
+
const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
|
|
175
|
+
if (!decryptedStr) {
|
|
176
|
+
throw new error_control_model_1.DyFM_Error({
|
|
177
|
+
status: 401,
|
|
178
|
+
message: 'Failed to decrypt data - invalid key or corrupted data',
|
|
179
|
+
errorCode: 'DyFM-CRY-DEC-FAIL'
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return this.safeDeserialize(decryptedStr);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
throw new error_control_model_1.DyFM_Error({
|
|
186
|
+
...this.getDefaultErrorSettings('decrypt', error),
|
|
187
|
+
errorCode: 'DyFM-CRY-DRY',
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Gets default error settings
|
|
193
|
+
*/
|
|
194
|
+
static getDefaultErrorSettings(operation, error) {
|
|
195
|
+
return {
|
|
196
|
+
status: error?.___status ?? error?.status ?? 401,
|
|
197
|
+
message: `Crypto operation "${operation}" failed; ` + error_control_model_1.DyFM_Error.getAnyMessage(error),
|
|
198
|
+
error: error,
|
|
199
|
+
errorCode: 'DyFM-CRY-ERR'
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.DyFM_Crypto = DyFM_Crypto;
|
|
204
|
+
//# sourceMappingURL=crypto-2-non-stable.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-2-non-stable.util.js","sourceRoot":"","sources":["../../../../src/_modules/crypto/_collections/crypto-2-non-stable.util.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O,EAAE,wDAAwD;oBACjE,SAAS,EAAE,mBAAmB;iBAC/B,CAAC,CAAC;YACL,CAAC;YAED,OAAO,IAAI,CAAC,eAAe,CAAI,YAAY,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,gCAAU,CAAC;gBACnB,GAAG,IAAI,CAAC,uBAAuB,CAAC,SAAS,EAAE,KAAK,CAAC;gBACjD,SAAS,EAAE,cAAc;aAC1B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,uBAAuB,CAAC,SAAiB,EAAE,KAAW;QACnE,OAAO;YACL,MAAM,EAAG,KAAoB,EAAE,SAAS,IAAK,KAAa,EAAE,MAAM,IAAI,GAAG;YACzE,OAAO,EAAE,qBAAqB,SAAS,YAAY,GAAG,gCAAU,CAAC,aAAa,CAAC,KAAK,CAAC;YACrF,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,cAAc;SAC1B,CAAC;IACJ,CAAC;;AAnNH,kCAoNC"}
|
|
@@ -1,45 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes for crypto operations
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for encryption/decryption
|
|
6
|
+
*/
|
|
7
|
+
export interface CryptoConfig {
|
|
8
|
+
ivLength?: number;
|
|
9
|
+
saltLength?: number;
|
|
10
|
+
keyIterations?: number;
|
|
11
|
+
keySize?: number;
|
|
12
|
+
}
|
|
1
13
|
/**
|
|
2
14
|
* A utility class for secure encryption and decryption of data
|
|
3
|
-
* Uses AES-256-CBC with
|
|
15
|
+
* Uses AES-256-CBC with PBKDF2 key derivation
|
|
4
16
|
*/
|
|
5
17
|
export declare class DyFM_Crypto {
|
|
18
|
+
private static readonly DEFAULT_CONFIG;
|
|
6
19
|
private static readonly defaultErrorUserMsg;
|
|
7
20
|
/**
|
|
8
|
-
* Validates the
|
|
21
|
+
* Validates the input data and key
|
|
22
|
+
* @throws {DyFM_Error} if validation fails
|
|
9
23
|
*/
|
|
10
|
-
private static
|
|
24
|
+
private static validateInput;
|
|
11
25
|
/**
|
|
12
|
-
*
|
|
26
|
+
* Generates a deterministic IV based on the input data and key
|
|
13
27
|
*/
|
|
14
|
-
private static
|
|
28
|
+
private static generateIV;
|
|
15
29
|
/**
|
|
16
|
-
*
|
|
30
|
+
* Generates a deterministic salt based on the input data and key
|
|
17
31
|
*/
|
|
18
|
-
private static
|
|
32
|
+
private static generateSalt;
|
|
19
33
|
/**
|
|
20
|
-
* Derives a
|
|
34
|
+
* Derives a key using PBKDF2
|
|
21
35
|
*/
|
|
22
36
|
private static deriveKey;
|
|
23
37
|
/**
|
|
24
|
-
*
|
|
38
|
+
* Safely serializes data to JSON
|
|
25
39
|
*/
|
|
26
|
-
private static
|
|
40
|
+
private static safeSerialize;
|
|
41
|
+
/**
|
|
42
|
+
* Safely deserializes JSON data
|
|
43
|
+
*/
|
|
44
|
+
private static safeDeserialize;
|
|
27
45
|
/**
|
|
28
|
-
* Encrypts data using AES-256-CBC
|
|
46
|
+
* Encrypts data using AES-256-CBC
|
|
29
47
|
* @param data The data to encrypt
|
|
30
48
|
* @param key The encryption key
|
|
49
|
+
* @param config Optional configuration
|
|
31
50
|
* @returns URL-safe encrypted string
|
|
32
51
|
* @throws {DyFM_Error} if encryption fails
|
|
33
52
|
*/
|
|
34
|
-
static encrypt<T>(data: T, key: string): string;
|
|
53
|
+
static encrypt<T>(data: T, key: string, config?: CryptoConfig): string;
|
|
35
54
|
/**
|
|
36
55
|
* Decrypts data that was encrypted using encrypt()
|
|
37
56
|
* @param encryptedData The encrypted data
|
|
38
57
|
* @param key The decryption key
|
|
58
|
+
* @param config Optional configuration
|
|
39
59
|
* @returns The decrypted data
|
|
40
60
|
* @throws {DyFM_Error} if decryption fails
|
|
41
61
|
*/
|
|
42
|
-
static decrypt<T>(encryptedData: string, key: string): T;
|
|
62
|
+
static decrypt<T>(encryptedData: string, key: string, config?: CryptoConfig): T;
|
|
63
|
+
/**
|
|
64
|
+
* Generates a secure random key
|
|
65
|
+
* @param length Length of the key in bytes (default: 32)
|
|
66
|
+
* @returns A secure random key
|
|
67
|
+
*/
|
|
68
|
+
static generateKey(length?: number): string;
|
|
69
|
+
/**
|
|
70
|
+
* Validates if a string is a valid encrypted data
|
|
71
|
+
* @param encryptedData The data to validate
|
|
72
|
+
* @returns true if the data appears to be valid encrypted data
|
|
73
|
+
*/
|
|
74
|
+
static isValidEncryptedData(encryptedData: string): boolean;
|
|
43
75
|
/**
|
|
44
76
|
* Gets default error settings
|
|
45
77
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/crypto/_collections/crypto.util.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAEY;
|
|
1
|
+
{"version":3,"file":"crypto.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/crypto/_collections/crypto.util.ts"],"names":[],"mappings":"AAOA;;GAEG;AASH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAKpC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAEY;IAMvD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAkB5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAKzB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAK3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAOxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA6B9B;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM;IAsCtE;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC;IAwD/E;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAI/C;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAO3D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;CAQvC"}
|
|
@@ -6,30 +6,63 @@ const CryptoJS = tslib_1.__importStar(require("crypto-js"));
|
|
|
6
6
|
const error_control_model_1 = require("../../../_models/control-models/error.control-model");
|
|
7
7
|
/**
|
|
8
8
|
* A utility class for secure encryption and decryption of data
|
|
9
|
-
* Uses AES-256-CBC with
|
|
9
|
+
* Uses AES-256-CBC with PBKDF2 key derivation
|
|
10
10
|
*/
|
|
11
11
|
class DyFM_Crypto {
|
|
12
|
+
static DEFAULT_CONFIG = {
|
|
13
|
+
ivLength: 16, // 128 bits
|
|
14
|
+
saltLength: 16, // 128 bits
|
|
15
|
+
keyIterations: 10000,
|
|
16
|
+
keySize: 8 // 256 bits (8 * 32)
|
|
17
|
+
};
|
|
12
18
|
static defaultErrorUserMsg = `We encountered an unhandled Authentication Error, ` +
|
|
13
19
|
`\nplease contact the responsible development team.`;
|
|
20
|
+
// Tömör: kb. 60–80 karakteres token, nem 200+
|
|
21
|
+
// Nem szabványos: nehéz visszafejteni
|
|
22
|
+
// Használható cookie, header, URL-ben
|
|
14
23
|
/**
|
|
15
|
-
* Validates the
|
|
24
|
+
* Validates the input data and key
|
|
25
|
+
* @throws {DyFM_Error} if validation fails
|
|
16
26
|
*/
|
|
17
|
-
static
|
|
18
|
-
if (!key || typeof key !== 'string') {
|
|
27
|
+
static validateInput(data, key) {
|
|
28
|
+
if (!key || typeof key !== 'string' || key.trim().length === 0) {
|
|
19
29
|
throw new error_control_model_1.DyFM_Error({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
...this.getDefaultErrorSettings('validateInput'),
|
|
31
|
+
errorCode: 'DyFM-CRY-IKY',
|
|
32
|
+
message: 'Invalid encryption key'
|
|
23
33
|
});
|
|
24
34
|
}
|
|
25
|
-
if (
|
|
35
|
+
if (data === undefined || data === null) {
|
|
26
36
|
throw new error_control_model_1.DyFM_Error({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
...this.getDefaultErrorSettings('validateInput'),
|
|
38
|
+
errorCode: 'DyFM-CRY-IDT',
|
|
39
|
+
message: 'Invalid data to encrypt/decrypt'
|
|
30
40
|
});
|
|
31
41
|
}
|
|
32
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Generates a deterministic IV based on the input data and key
|
|
45
|
+
*/
|
|
46
|
+
static generateIV(data, key, config) {
|
|
47
|
+
const hash = CryptoJS.SHA256(data + key);
|
|
48
|
+
return CryptoJS.lib.WordArray.create(hash.words.slice(0, config.ivLength / 4));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generates a deterministic salt based on the input data and key
|
|
52
|
+
*/
|
|
53
|
+
static generateSalt(data, key, config) {
|
|
54
|
+
const hash = CryptoJS.SHA256(key + data);
|
|
55
|
+
return CryptoJS.lib.WordArray.create(hash.words.slice(0, config.saltLength / 4));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Derives a key using PBKDF2
|
|
59
|
+
*/
|
|
60
|
+
static deriveKey(key, salt, config) {
|
|
61
|
+
return CryptoJS.PBKDF2(key, salt, {
|
|
62
|
+
keySize: config.keySize,
|
|
63
|
+
iterations: config.keyIterations
|
|
64
|
+
});
|
|
65
|
+
}
|
|
33
66
|
/**
|
|
34
67
|
* Safely serializes data to JSON
|
|
35
68
|
*/
|
|
@@ -76,51 +109,34 @@ class DyFM_Crypto {
|
|
|
76
109
|
}
|
|
77
110
|
}
|
|
78
111
|
/**
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
static deriveKey(key) {
|
|
82
|
-
return CryptoJS.SHA256(key);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Creates a deterministic IV from the key only
|
|
86
|
-
*/
|
|
87
|
-
static createDeterministicIV(key) {
|
|
88
|
-
const hash = CryptoJS.SHA256(key + ':iv');
|
|
89
|
-
return CryptoJS.lib.WordArray.create(hash.words.slice(0, 4)); // Use first 16 bytes (128 bits)
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Encrypts data using AES-256-CBC with deterministic key and IV
|
|
112
|
+
* Encrypts data using AES-256-CBC
|
|
93
113
|
* @param data The data to encrypt
|
|
94
114
|
* @param key The encryption key
|
|
115
|
+
* @param config Optional configuration
|
|
95
116
|
* @returns URL-safe encrypted string
|
|
96
117
|
* @throws {DyFM_Error} if encryption fails
|
|
97
118
|
*/
|
|
98
|
-
static encrypt(data, key) {
|
|
119
|
+
static encrypt(data, key, config) {
|
|
99
120
|
try {
|
|
100
|
-
|
|
101
|
-
this.
|
|
102
|
-
// Validate data
|
|
103
|
-
if (data === undefined || data === null) {
|
|
104
|
-
throw new error_control_model_1.DyFM_Error({
|
|
105
|
-
status: 401,
|
|
106
|
-
message: 'Data cannot be undefined or null',
|
|
107
|
-
errorCode: 'DyFM-CRY-DATA-NULL'
|
|
108
|
-
});
|
|
109
|
-
}
|
|
121
|
+
this.validateInput(data, key);
|
|
122
|
+
const finalConfig = { ...this.DEFAULT_CONFIG, ...config };
|
|
110
123
|
// Convert data to string
|
|
111
124
|
const dataStr = this.safeSerialize(data);
|
|
112
|
-
//
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
//
|
|
116
|
-
const
|
|
125
|
+
// Generate deterministic IV and salt based on data and key
|
|
126
|
+
const iv = this.generateIV(dataStr, key, finalConfig);
|
|
127
|
+
const salt = this.generateSalt(dataStr, key, finalConfig);
|
|
128
|
+
// Derive key using PBKDF2
|
|
129
|
+
const derivedKey = this.deriveKey(key, salt, finalConfig);
|
|
130
|
+
// Encrypt the data
|
|
131
|
+
const encrypted = CryptoJS.AES.encrypt(dataStr, derivedKey, {
|
|
117
132
|
iv: iv,
|
|
118
133
|
mode: CryptoJS.mode.CBC,
|
|
119
134
|
padding: CryptoJS.pad.Pkcs7
|
|
120
135
|
});
|
|
136
|
+
// Combine IV + Salt + Ciphertext
|
|
137
|
+
const combined = iv.concat(salt).concat(encrypted.ciphertext);
|
|
121
138
|
// Convert to URL-safe base64
|
|
122
|
-
|
|
123
|
-
return base64
|
|
139
|
+
return CryptoJS.enc.Base64.stringify(combined)
|
|
124
140
|
.replace(/\+/g, '-')
|
|
125
141
|
.replace(/\//g, '_')
|
|
126
142
|
.replace(/=+$/, '');
|
|
@@ -136,49 +152,39 @@ class DyFM_Crypto {
|
|
|
136
152
|
* Decrypts data that was encrypted using encrypt()
|
|
137
153
|
* @param encryptedData The encrypted data
|
|
138
154
|
* @param key The decryption key
|
|
155
|
+
* @param config Optional configuration
|
|
139
156
|
* @returns The decrypted data
|
|
140
157
|
* @throws {DyFM_Error} if decryption fails
|
|
141
158
|
*/
|
|
142
|
-
static decrypt(encryptedData, key) {
|
|
159
|
+
static decrypt(encryptedData, key, config) {
|
|
143
160
|
try {
|
|
144
|
-
|
|
145
|
-
this.
|
|
146
|
-
// Validate encrypted data
|
|
147
|
-
if (!encryptedData || typeof encryptedData !== 'string') {
|
|
148
|
-
throw new error_control_model_1.DyFM_Error({
|
|
149
|
-
status: 401,
|
|
150
|
-
message: 'Encrypted data is required and must be a string',
|
|
151
|
-
errorCode: 'DyFM-CRY-DATA-REQ'
|
|
152
|
-
});
|
|
153
|
-
}
|
|
161
|
+
this.validateInput(encryptedData, key);
|
|
162
|
+
const finalConfig = { ...this.DEFAULT_CONFIG, ...config };
|
|
154
163
|
// Convert from URL-safe base64
|
|
155
|
-
|
|
164
|
+
const base64 = encryptedData
|
|
156
165
|
.replace(/-/g, '+')
|
|
157
166
|
.replace(/_/g, '/');
|
|
158
|
-
//
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
167
|
+
// Parse the combined data
|
|
168
|
+
const combined = CryptoJS.enc.Base64.parse(base64);
|
|
169
|
+
// Validate minimum length (IV + Salt + minimum ciphertext)
|
|
170
|
+
const minLength = (finalConfig.ivLength + finalConfig.saltLength + 16) / 4; // 16 bytes minimum for ciphertext
|
|
171
|
+
if (combined.words.length < minLength) {
|
|
172
|
+
throw new Error('Invalid encrypted data length');
|
|
162
173
|
}
|
|
163
|
-
//
|
|
164
|
-
const
|
|
165
|
-
const
|
|
174
|
+
// Extract IV, salt, and ciphertext
|
|
175
|
+
const iv = CryptoJS.lib.WordArray.create(combined.words.slice(0, finalConfig.ivLength / 4));
|
|
176
|
+
const salt = CryptoJS.lib.WordArray.create(combined.words.slice(finalConfig.ivLength / 4, (finalConfig.ivLength + finalConfig.saltLength) / 4));
|
|
177
|
+
const ciphertext = CryptoJS.lib.WordArray.create(combined.words.slice((finalConfig.ivLength + finalConfig.saltLength) / 4));
|
|
178
|
+
// Derive key using PBKDF2
|
|
179
|
+
const derivedKey = this.deriveKey(key, salt, finalConfig);
|
|
166
180
|
// Decrypt the data
|
|
167
|
-
const
|
|
168
|
-
const decrypted = CryptoJS.AES.decrypt({ ciphertext: encryptedWA }, aesKey, {
|
|
181
|
+
const decrypted = CryptoJS.AES.decrypt({ ciphertext: ciphertext }, derivedKey, {
|
|
169
182
|
iv: iv,
|
|
170
183
|
mode: CryptoJS.mode.CBC,
|
|
171
184
|
padding: CryptoJS.pad.Pkcs7
|
|
172
185
|
});
|
|
173
186
|
// Parse JSON
|
|
174
187
|
const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
|
|
175
|
-
if (!decryptedStr) {
|
|
176
|
-
throw new error_control_model_1.DyFM_Error({
|
|
177
|
-
status: 401,
|
|
178
|
-
message: 'Failed to decrypt data - invalid key or corrupted data',
|
|
179
|
-
errorCode: 'DyFM-CRY-DEC-FAIL'
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
188
|
return this.safeDeserialize(decryptedStr);
|
|
183
189
|
}
|
|
184
190
|
catch (error) {
|
|
@@ -188,6 +194,25 @@ class DyFM_Crypto {
|
|
|
188
194
|
});
|
|
189
195
|
}
|
|
190
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Generates a secure random key
|
|
199
|
+
* @param length Length of the key in bytes (default: 32)
|
|
200
|
+
* @returns A secure random key
|
|
201
|
+
*/
|
|
202
|
+
static generateKey(length = 32) {
|
|
203
|
+
return CryptoJS.lib.WordArray.random(length).toString();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Validates if a string is a valid encrypted data
|
|
207
|
+
* @param encryptedData The data to validate
|
|
208
|
+
* @returns true if the data appears to be valid encrypted data
|
|
209
|
+
*/
|
|
210
|
+
static isValidEncryptedData(encryptedData) {
|
|
211
|
+
if (!encryptedData || typeof encryptedData !== 'string') {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return /^[A-Za-z0-9\-_]+$/.test(encryptedData);
|
|
215
|
+
}
|
|
191
216
|
/**
|
|
192
217
|
* Gets default error settings
|
|
193
218
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.util.js","sourceRoot":"","sources":["../../../../src/_modules/crypto/_collections/crypto.util.ts"],"names":[],"mappings":";;;;AAAA,4DAAsC;AACtC,6FAG6D;
|
|
1
|
+
{"version":3,"file":"crypto.util.js","sourceRoot":"","sources":["../../../../src/_modules/crypto/_collections/crypto.util.ts"],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