rename to backupSensitiveData
MODIFY
src/storage/mongodb/SettingStorage.ts
src/storage/mongodb/SettingStorage.ts
@@ -56,7 +56,7 @@ export default class SettingStorage {
identifier: settingToSave.identifier,
content: settingToSave.content,
sensitiveData: settingToSave.sensitiveData,
- formerSensitiveData: settingToSave.formerSensitiveData
+ backupSensitiveData: settingToSave.formerSensitiveData
};
DatabaseUtils.addLastChangedCreatedProps(settingMDB, settingToSave);
// Modify
@@ -258,7 +258,7 @@ export default class SettingStorage {
id: billingSettingsToSave.id,
identifier: billingSettingsToSave.identifier,
sensitiveData: billingSettingsToSave.sensitiveData,
- formerSensitiveData: billingSettingsToSave.formerSensitiveData,
+ backupSensitiveData: billingSettingsToSave.formerSensitiveData,
lastChangedOn: new Date(),
content: {
stripe: billingSettingsToSave.stripe

MODIFY
src/types/Setting.ts
src/types/Setting.ts
@@ -5,7 +5,7 @@ export interface Setting {
id?: string;
identifier: TenantComponents;
sensitiveData?: string[];
- formerSensitiveData?: string[];
+ backupSensitiveData?: string[];
category?: 'business' | 'technical';
}

MODIFY
src/utils/Cypher.ts
src/utils/Cypher.ts
@@ -190,9 +190,9 @@ export default class Cypher {
for (const setting of settingsToMigrate) {
if (!setting.formerSensitiveData && Utils.isEmptyArray(setting.formerSensitiveData)) {
// Save former senitive data in setting
- const formerSensitiveData = Cypher.prepareFormerSenitiveData(setting);
- formerSensitiveData.push(Cypher.hash(cryptoSetting.formerKey));
- setting.formerSensitiveData = formerSensitiveData;
+ constbackupSensitiveData = Cypher.prepareFormerSenitiveData(setting);
+ backupSensitiveData.push(Cypher.hash(cryptoSetting.formerKey));
+ setting.formerSensitiveData =backupSensitiveData;
// Decrypt sensitive data with former key and key properties
await Cypher.decryptSensitiveDataInJSON(tenantID,setting, true);
// Encrypt sensitive data with new key and key properties
@@ -246,17 +246,17 @@ export default class Cypher {
}
private static prepareFormerSenitiveData(setting: SettingDB): string[] {
- const formerSensitiveData: string[] = [];
+ constbackupSensitiveData: string[] = [];
for (const property of setting.sensitiveData) {
// Check that the property does exist otherwise skip to the next property
if (_.has(setting, property)) {
const value: string = _.get(setting, property);
// If the value is undefined, null or empty then do nothing and skip to the next property
if (value && value.length > 0) {
- formerSensitiveData.push(value);
+ backupSensitiveData.push(value);
}
}
}
- return formerSensitiveData;
+ returnbackupSensitiveData;
}
}

rename to backupSensitiveData