@dynamatix/gb-schemas 0.21.17 → 0.21.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "0.21.17",
3
+ "version": "0.21.18",
4
4
  "description": "All the schemas for gatehouse bank back-end.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,6 +34,9 @@ const deriveIV = (value) => {
34
34
 
35
35
  // **Encrypt a Single Value Deterministically**
36
36
  const encryptValue = (value) => {
37
+ if(!value) {
38
+ return value;
39
+ }
37
40
  const iv = deriveIV(value); // Same IV for same value (allows searching)
38
41
  const cipher = crypto.createCipheriv('aes-256-gcm', SECRET_KEY, iv);
39
42
 
@@ -80,7 +83,8 @@ export const decryptObject = (obj, collectionName) => {
80
83
  decryptedObj[key] = obj[key]; // Keep _id and ObjectId references unchanged
81
84
  } else {
82
85
  try {
83
- if(Array.isArray(obj[key])) {
86
+ if(Array.isArray(obj[key]) || !obj[key]) {
87
+ decryptedObj[key] = obj[key];
84
88
  continue;
85
89
  }
86
90
  const [ivHex, authTagHex, encryptedData] = obj[key].split(':');