SYNC: send encryption key to child processes

This commit is contained in:
SPRINX0\prochazka
2025-04-08 16:30:08 +02:00
committed by Diflow
parent ef1eff2ecb
commit e35f9eb75b
2 changed files with 16 additions and 0 deletions

View File

@@ -5,12 +5,16 @@ const path = require('path');
const _ = require('lodash');
const { datadir } = require('./directories');
const { encryptionKeyArg } = require('./processArgs');
const defaultEncryptionKey = 'mQAUaXhavRGJDxDTXSCg7Ej0xMmGCrx6OKA07DIMBiDcYYkvkaXjTAzPUEHEHEf9';
let _encryptionKey = null;
function loadEncryptionKey() {
if (encryptionKeyArg) {
return encryptionKeyArg;
}
if (_encryptionKey) {
return _encryptionKey;
}
@@ -131,6 +135,11 @@ function pickSafeConnectionInfo(connection) {
function setEncryptionKey(encryptionKey) {
_encryptionKey = encryptionKey;
_encryptor = null;
global.ENCRYPTION_KEY = encryptionKey;
}
function getEncryptionKey() {
return _encryptionKey;
}
module.exports = {
@@ -142,4 +151,6 @@ module.exports = {
maskConnection,
pickSafeConnectionInfo,
loadEncryptionKeyFromExternal,
getEncryptionKey,
setEncryptionKey,
};