badmfck-api-server 4.0.75 → 4.0.76

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.
@@ -95,7 +95,7 @@ async function Initializer(services) {
95
95
  }
96
96
  exports.Initializer = Initializer;
97
97
  class APIService extends BaseService_1.BaseService {
98
- version = "4.0.75";
98
+ version = "4.0.76";
99
99
  options;
100
100
  monitor = null;
101
101
  started = new Date();
@@ -43,9 +43,9 @@ class MicroserviceClient extends BaseService_1.BaseService {
43
43
  "x-microservice-ts": ts,
44
44
  "x-microservice-nonce": nonce
45
45
  };
46
- const secret = Buffer.from(this.options.securityKey, "base64");
46
+ const rawSecret = Buffer.from(this.options.securityKey, "base64");
47
+ const key = crypto_1.default.createHash("sha256").update(rawSecret).digest();
47
48
  const hash = crypto_1.default.createHash("sha256").update(nonce + ts + this.options.securityKey).digest();
48
- const key = secret;
49
49
  const iv = hash.subarray(0, 12);
50
50
  const aad = Buffer.from(`${ts}.${nonce}.${this.options.id}`, "utf8");
51
51
  const data = Buffer.from(JSON.stringify(req), "utf8");
@@ -46,9 +46,9 @@ class MicroserviceHost extends BaseService_1.BaseService {
46
46
  }
47
47
  }
48
48
  try {
49
- const secret = Buffer.from(this.options.securityKey, "base64");
49
+ const rawSecret = Buffer.from(this.options.securityKey, "base64");
50
+ const key = crypto_1.default.createHash("sha256").update(rawSecret).digest();
50
51
  const hash = crypto_1.default.createHash("sha256").update(nonce + ts + this.options.securityKey).digest();
51
- const key = secret;
52
52
  const iv = hash.subarray(0, 12);
53
53
  const aad = Buffer.from(`${ts}.${nonce}.${this.options.id}`, "utf8");
54
54
  const tag = Buffer.from(req.data.tag, "base64");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.0.75",
3
+ "version": "4.0.76",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",