@meebon/meebon-crypto 1.2.19 → 1.2.21

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -94,9 +94,9 @@ function EncryptionMiddleware({ privateKey, publicKey, forRequest }) {
94
94
  } else {
95
95
  const originalSend = res.send.bind(res);
96
96
  res.send = (body) => {
97
- let encryptData = JSON.parse(body);
97
+ let encryptData = body;
98
98
  try {
99
- if (encryptData) {
99
+ if (encryptData?.data) {
100
100
  const decrypted = MeebonCrypto.encryptData(encryptData.data, publicKey);
101
101
  try {
102
102
  encryptData.data = JSON.parse(decrypted);
@@ -107,7 +107,7 @@ function EncryptionMiddleware({ privateKey, publicKey, forRequest }) {
107
107
  } catch (error) {
108
108
  next(new Error(error?.message || "Decryption failed."));
109
109
  }
110
- return originalSend(body);
110
+ return originalSend(encryptData);
111
111
  };
112
112
  }
113
113
  next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meebon/meebon-crypto",
3
- "version": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "description": "",
5
5
  "author": "kajalanS <103587022+kajalanS@users.noreply.github.com>",
6
6
  "homepage": "https://github.com/KsoftmHub/meebon-crypto?tab=readme-ov-file#getting-started",