@meebon/meebon-crypto 1.2.17 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -85,7 +85,7 @@ function EncryptionMiddleware({ privateKey, publicKey, forRequest }) {
85
85
  if (req.body && req.body.data) {
86
86
  try {
87
87
  const plainText = JSON.stringify(req.body.data);
88
- const encrypted = MeebonCrypto.encryptData(plainText, publicKey);
88
+ const encrypted = MeebonCrypto.decryptData(plainText, privateKey);
89
89
  req.body.data = encrypted;
90
90
  } catch (error) {
91
91
  next(new Error(error?.message || "Encryption failed."));
@@ -96,7 +96,7 @@ function EncryptionMiddleware({ privateKey, publicKey, forRequest }) {
96
96
  res.send = (body) => {
97
97
  try {
98
98
  if (typeof body === "string" && body) {
99
- const decrypted = MeebonCrypto.decryptData(body, privateKey);
99
+ const decrypted = MeebonCrypto.encryptData(body, publicKey);
100
100
  try {
101
101
  body = JSON.parse(decrypted);
102
102
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meebon/meebon-crypto",
3
- "version": "1.2.17",
3
+ "version": "1.2.18",
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",