secure-comms-hybrid 1.0.3 → 1.0.4
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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const CRYPTO_CONFIG = {
|
|
2
|
+
RSA: {
|
|
3
|
+
MODULUS_LENGTH: 2048,
|
|
4
|
+
PUBLIC_KEY_ENCODING: {
|
|
5
|
+
type: 'spki',
|
|
6
|
+
format: 'pem'
|
|
7
|
+
},
|
|
8
|
+
PRIVATE_KEY_ENCODING: {
|
|
9
|
+
type: 'pkcs8',
|
|
10
|
+
format: 'pem'
|
|
11
|
+
},
|
|
12
|
+
PADDING: 'RSA_PKCS1_OAEP_PADDING',
|
|
13
|
+
HASH: 'SHA-256'
|
|
14
|
+
},
|
|
15
|
+
AES: {
|
|
16
|
+
ALGORITHM: 'AES-GCM',
|
|
17
|
+
KEY_LENGTH: 256,
|
|
18
|
+
IV_LENGTH: 12,
|
|
19
|
+
TAG_LENGTH: 128
|
|
20
|
+
},
|
|
21
|
+
SESSION: {
|
|
22
|
+
EXPIRY_MS: 5 * 60 * 1000,
|
|
23
|
+
// 5 minutes
|
|
24
|
+
CLEANUP_INTERVAL: 60 * 1000 // 1 minute
|
|
25
|
+
},
|
|
26
|
+
HEADERS: {
|
|
27
|
+
ENCRYPTED: 'X-Encrypted',
|
|
28
|
+
CLIENT_ID: 'X-Client-ID',
|
|
29
|
+
ENCRYPTION_ALGORITHM: 'X-Encryption-Algorithm',
|
|
30
|
+
SESSION_EXPIRY: 'X-Session-Expiry'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const ERRORS = {
|
|
34
|
+
NOT_INITIALIZED: 'Encryption not initialized',
|
|
35
|
+
SESSION_EXPIRED: 'Session expired',
|
|
36
|
+
DECRYPTION_FAILED: 'Decryption failed',
|
|
37
|
+
ENCRYPTION_FAILED: 'Encryption failed',
|
|
38
|
+
INVALID_REQUEST: 'Invalid encrypted request',
|
|
39
|
+
MISSING_CLIENT_ID: 'Missing client ID'
|
|
40
|
+
};
|
package/package.json
CHANGED