blixify-server 0.1.70 → 0.1.72

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.
@@ -4,6 +4,6 @@ export declare class CryptoMiddleware {
4
4
  nextJs: boolean;
5
5
  constructor(secretKey: string, forceDecryption: boolean, nextJs: boolean);
6
6
  handleDecryption: (data: string) => any;
7
- init(): (req: any, res: any) => Promise<any>;
7
+ init(): (req: any, res: any, next?: any) => any;
8
8
  }
9
9
  //# sourceMappingURL=crypto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;IACxB,MAAM,UAAS;gBAEH,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IAMxE,gBAAgB,SAAU,MAAM,SAiB9B;IAEF,IAAI,UAG4C,GAAG,OAAO,GAAG;CAmB9D"}
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/apis/crypto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,SAAS,SAAM;IACf,eAAe,UAAS;IACxB,MAAM,UAAS;gBAEH,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IAMxE,gBAAgB,SAAU,MAAM,SAiB9B;IAEF,IAAI,UAGsC,GAAG,OAAO,GAAG,SAAS,GAAG;CAuBpE"}
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -49,27 +40,28 @@ class CryptoMiddleware {
49
40
  init() {
50
41
  // eslint-disable-next-line
51
42
  const wrapper = this;
52
- const cryptoMiddleware = function (req, res) {
43
+ const cryptoMiddleware = function (req, res, next) {
53
44
  var _a, _b;
54
- return __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ if (wrapper.forceDecryption && !req.body.sign) {
47
+ throw new Error("Missing signature for signing");
48
+ }
55
49
  try {
56
- if (wrapper.forceDecryption && !req.body.sign) {
57
- throw new Error("Missing signature for signing");
58
- }
59
- try {
60
- if ((_a = req.body) === null || _a === void 0 ? void 0 : _a.sign)
61
- req.body = wrapper.handleDecryption(req.body.sign);
62
- }
63
- catch (err) {
64
- throw new Error("Wrong Signature");
65
- }
50
+ if ((_a = req.body) === null || _a === void 0 ? void 0 : _a.sign)
51
+ req.body = wrapper.handleDecryption(req.body.sign);
66
52
  }
67
53
  catch (err) {
68
- if (wrapper.nextJs)
69
- return err;
70
- return res.status(400).json({ error: (_b = err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : "" });
54
+ throw new Error("Wrong Signature");
55
+ }
56
+ if (next) {
57
+ next();
71
58
  }
72
- });
59
+ }
60
+ catch (err) {
61
+ if (wrapper.nextJs)
62
+ return err;
63
+ return res.status(400).json({ error: (_b = err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : "" });
64
+ }
73
65
  };
74
66
  return cryptoMiddleware;
75
67
  }
@@ -1,6 +1,7 @@
1
+ export { CryptoMiddleware } from "./crypto";
1
2
  export { FirebaseWrapper } from "./fbWrapper";
2
- export { MongoWrapper } from "./mongoWrapper";
3
3
  export { MondayWrapper } from "./mondayWrapper";
4
+ export { MongoWrapper } from "./mongoWrapper";
4
5
  export { SecurityMiddleware } from "./security";
5
6
  export { UploadWrapper } from "./uploadWrapper";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UploadWrapper = exports.SecurityMiddleware = exports.MondayWrapper = exports.MongoWrapper = exports.FirebaseWrapper = void 0;
3
+ exports.UploadWrapper = exports.SecurityMiddleware = exports.MongoWrapper = exports.MondayWrapper = exports.FirebaseWrapper = exports.CryptoMiddleware = void 0;
4
+ var crypto_1 = require("./crypto");
5
+ Object.defineProperty(exports, "CryptoMiddleware", { enumerable: true, get: function () { return crypto_1.CryptoMiddleware; } });
4
6
  var fbWrapper_1 = require("./fbWrapper");
5
7
  Object.defineProperty(exports, "FirebaseWrapper", { enumerable: true, get: function () { return fbWrapper_1.FirebaseWrapper; } });
6
- var mongoWrapper_1 = require("./mongoWrapper");
7
- Object.defineProperty(exports, "MongoWrapper", { enumerable: true, get: function () { return mongoWrapper_1.MongoWrapper; } });
8
8
  var mondayWrapper_1 = require("./mondayWrapper");
9
9
  Object.defineProperty(exports, "MondayWrapper", { enumerable: true, get: function () { return mondayWrapper_1.MondayWrapper; } });
10
+ var mongoWrapper_1 = require("./mongoWrapper");
11
+ Object.defineProperty(exports, "MongoWrapper", { enumerable: true, get: function () { return mongoWrapper_1.MongoWrapper; } });
10
12
  var security_1 = require("./security");
11
13
  Object.defineProperty(exports, "SecurityMiddleware", { enumerable: true, get: function () { return security_1.SecurityMiddleware; } });
12
14
  var uploadWrapper_1 = require("./uploadWrapper");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blixify-server",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
4
4
  "license": "MIT",
5
5
  "main": "dist/apis/index.js",
6
6
  "private": false,