MCPcopy
hub / github.com/chartbrew/chartbrew / checkEncryptionKeys

Function checkEncryptionKeys

server/modules/cbCrypto.js:40–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40function checkEncryptionKeys() {
41 const productionKey = process.env.CB_ENCRYPTION_KEY;
42 const developmentKey = process.env.CB_ENCRYPTION_KEY_DEV;
43
44 // Validate production key
45 if (!isValidAES256Key(productionKey) && process.env.NODE_ENV === "production") {
46 console.error("Invalid AES-256 encryption key in CB_ENCRYPTION_KEY. It must be a 64-character hexadecimal string."); // eslint-disable-line
47 process.exit(1); // Exit with an error code
48 }
49
50 // Validate development key
51 if (!isValidAES256Key(developmentKey) && process.env.NODE_ENV !== "production") {
52 console.error("Invalid AES-256 encryption key in CB_ENCRYPTION_KEY_DEV. It must be a 64-character hexadecimal string."); // eslint-disable-line
53 process.exit(1); // Exit with an error code
54 }
55}
56
57module.exports = { encrypt, decrypt, checkEncryptionKeys };

Callers 1

index.jsFile · 0.85

Calls 1

isValidAES256KeyFunction · 0.85

Tested by

no test coverage detected