Fixed DB record decrypt.

This commit is contained in:
Ylian Saint-Hilaire 2022-05-23 16:46:56 -07:00
parent d0ee9ff74f
commit 82a4c472e0
2 changed files with 5 additions and 10 deletions

Binary file not shown.

15
db.js
View File

@ -501,16 +501,11 @@ module.exports.CreateDB = function (parent, func) {
function performTypedRecordDecrypt(data) { function performTypedRecordDecrypt(data) {
if ((data == null) || (obj.dbRecordsDecryptKey == null) || (typeof data != 'object')) return data; if ((data == null) || (obj.dbRecordsDecryptKey == null) || (typeof data != 'object')) return data;
for (var i in data) { for (var i in data) {
if (data[i] == null) continue; if ((data[i] == null) || (typeof data[i] != 'object')) continue;
if (data[i].type == 'user') { data[i] = performPartialRecordDecrypt(data[i]);
data[i] = performPartialRecordDecrypt(data[i]); if ((data[i].intelamt != null) && (typeof data[i].intelamt == 'object') && (data[i].intelamt._CRYPT)) { data[i].intelamt = performPartialRecordDecrypt(data[i].intelamt); }
} else if (data[i].type == 'node') { if ((data[i].amt != null) && (typeof data[i].amt == 'object') && (data[i].amt._CRYPT)) { data[i].amt = performPartialRecordDecrypt(data[i].amt); }
data[i] = performPartialRecordDecrypt(data[i]); if ((data[i].kvm != null) && (typeof data[i].kvm == 'object') && (data[i].kvm._CRYPT)) { data[i].kvm = performPartialRecordDecrypt(data[i].kvm); }
if (data[i].intelamt) { data[i].intelamt = performPartialRecordDecrypt(data[i].intelamt); }
} else if ((data[i].type == 'mesh') && (data[i].amt || data[i].kvm)) {
data[i].amt = performPartialRecordDecrypt(data[i].amt);
data[i].kvm = performPartialRecordDecrypt(data[i].kvm);
}
} }
return data; return data;
} }