MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / _encrypt

Function _encrypt

services/cloudObjects.js:1156–1173  ·  view source on GitHub ↗
(data, encryption_key)

Source from the content-addressed store, hash-verified

1154}
1155
1156function _encrypt(data, encryption_key) {
1157 try {
1158 const cipher_alg = 'aes-256-ctr';
1159 if (encryption_key && encryption_key.iv && encryption_key.key) {
1160 // to decrypt text use this
1161 // var encryptedText = encryptText(cipher_alg, encryption_key.key, encryption_key.iv, data);
1162 //
1163 return encryptText(cipher_alg, encryption_key.key, encryption_key.iv, data);
1164 }
1165 return crypto.pbkdf2Sync(data, config.secureKey, 10000, 64, 'sha1').toString('base64');
1166 } catch (err) {
1167 winston.log('error', {
1168 error: String(err),
1169 stack: new Error().stack,
1170 });
1171 return null;
1172 }
1173}
1174
1175function _recursiveModifyQuery(query, columnNames, type, encryptionKey) {
1176 for (var key in query) {

Callers 2

_isSchemaValidFunction · 0.85
_recursiveModifyQueryFunction · 0.85

Calls 1

encryptTextFunction · 0.70

Tested by

no test coverage detected