blixify-server 0.1.15 → 0.1.16

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.
@@ -6,10 +6,10 @@
6
6
  * 4. Prevent DDOS from rate limiting
7
7
  */
8
8
  export declare class SecurityMiddleware {
9
- checkAuthentication: (token: string) => string;
10
- checkRole: (userId: string) => string;
11
- checkAPIToken: (apiToken: string) => boolean;
12
- constructor(checkAuthentication: (token: string) => string, checkRole: (userId: string) => string, checkAPIToken: (apiToken: string) => boolean);
9
+ checkAuthentication: (token: string) => Promise<string>;
10
+ checkRole: (userId: string) => Promise<string>;
11
+ checkAPIToken: (apiToken: string) => Promise<boolean>;
12
+ constructor(checkAuthentication: (token: string) => Promise<string>, checkRole: (userId: string) => Promise<string>, checkAPIToken: (apiToken: string) => Promise<boolean>);
13
13
  /**
14
14
  * 1. Check User Authentication
15
15
  * 2. Check User Role
@@ -1 +1 @@
1
- {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/apis/security.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAE7B,mBAAmB,UAAW,MAAM,YAElC;IACF,SAAS,WAAY,MAAM,YAEzB;IACF,aAAa,aAAc,MAAM,aAE/B;gBAIA,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAC9C,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,EACrC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO;IAO9C;;;;OAIG;IACH,IAAI,UAG8C,GAAG,OAAO,GAAG,SAAS,GAAG;CA6B5E"}
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/apis/security.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAE7B,mBAAmB,UAAiB,MAAM,qBAExC;IACF,SAAS,WAAkB,MAAM,qBAE/B;IACF,aAAa,aAAoB,MAAM,sBAErC;gBAIA,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EACvD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EAC9C,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;IAOvD;;;;OAIG;IACH,IAAI,UAG8C,GAAG,OAAO,GAAG,SAAS,GAAG;CA6B5E"}
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,r,u,d){return new(u=u||Promise)(function(o,t){function i(e){try{c(d.next(e))}catch(e){t(e)}}function n(e){try{c(d.throw(e))}catch(e){t(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof u?t:new u(function(e){e(t)})).then(i,n)}c((d=d.apply(e,r||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecurityMiddleware=void 0;class SecurityMiddleware{constructor(e,t,o){this.checkAuthentication=e=>"",this.checkRole=e=>"",this.checkAPIToken=e=>!1,this.checkAuthentication=e,this.checkRole=t,this.checkAPIToken=o}init(){const i=this;return function(t,e,o){return __awaiter(this,void 0,void 0,function*(){var e;delete t.body.bm_userId,delete t.body.bm_userRole,delete t.body.bm_apiToken,t.body.userToken&&(e=i.checkAuthentication(t.body.userToken))&&(t.body.bm_userId=e,e=i.checkRole(e))&&(t.body.bm_userRole=e),t.body.apiToken&&(e=t.body.apiToken,e=i.checkAPIToken(e),t.body.bm_apiToken=e),o&&o()})}}}exports.SecurityMiddleware=SecurityMiddleware;
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,r,d,u){return new(d=d||Promise)(function(i,t){function o(e){try{c(u.next(e))}catch(e){t(e)}}function n(e){try{c(u.throw(e))}catch(e){t(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof d?t:new d(function(e){e(t)})).then(o,n)}c((u=u.apply(e,r||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecurityMiddleware=void 0;class SecurityMiddleware{constructor(e,t,i){this.checkAuthentication=e=>__awaiter(this,void 0,void 0,function*(){return""}),this.checkRole=e=>__awaiter(this,void 0,void 0,function*(){return""}),this.checkAPIToken=e=>__awaiter(this,void 0,void 0,function*(){return!1}),this.checkAuthentication=e,this.checkRole=t,this.checkAPIToken=i}init(){const o=this;return function(t,e,i){return __awaiter(this,void 0,void 0,function*(){var e;delete t.body.bm_userId,delete t.body.bm_userRole,delete t.body.bm_apiToken,t.body.userToken&&(e=yield o.checkAuthentication(t.body.userToken))&&(t.body.bm_userId=e,e=yield o.checkRole(e))&&(t.body.bm_userRole=e),t.body.apiToken&&(e=t.body.apiToken,e=yield o.checkAPIToken(e),t.body.bm_apiToken=e),i&&i()})}}}exports.SecurityMiddleware=SecurityMiddleware;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blixify-server",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "license": "MIT",
5
5
  "main": "dist/apis/index.js",
6
6
  "private": false,