@riocrypto/common-server 1.0.693 → 1.0.694

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.
@@ -40,16 +40,13 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
40
40
  authorizationTypes.includes(common_1.AuthorizationType.UserOptional) ||
41
41
  authorizationTypes.includes(common_1.AuthorizationType.Broker)) {
42
42
  const apiKey = req.header("x-api-key");
43
- console.log("x-api-key is ", apiKey);
44
43
  if (apiKey) {
45
44
  try {
46
- console.log("x-api-key is ", apiKey);
47
45
  const hashedApiKey = yield apiKey_1.ApiKey.toHash(apiKey);
48
46
  const Auth = yield (0, auth_1.buildAuth)(mongoose);
49
47
  const auth = yield Auth.findOne({
50
48
  "apiKeys.value": hashedApiKey,
51
49
  });
52
- console.log(auth);
53
50
  if (auth) {
54
51
  const missing = [];
55
52
  if (!auth.password) {
@@ -63,7 +60,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
63
60
  phoneNumber: auth.phoneNumber,
64
61
  missing,
65
62
  };
66
- console.log(payload);
67
63
  req.currentAuth = payload;
68
64
  }
69
65
  }
@@ -99,7 +95,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
99
95
  throw new Error("Unable to get ADMIN_ACCESS_TOKEN_SECRET");
100
96
  }
101
97
  const payload = jsonwebtoken_1.default.verify(req.cookies.adminAccessToken, ADMIN_ACCESS_TOKEN_SECRET);
102
- console.log(payload);
103
98
  req.currentAdminAuth = payload;
104
99
  }
105
100
  catch (err) {
@@ -213,9 +208,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
213
208
  !req.validAdminApiKey &&
214
209
  !req.currentPartnerAuth &&
215
210
  !authorizationTypes.includes(common_1.AuthorizationType.Public))) {
216
- console.log("missing auth");
217
- console.log("currentAdminAuth, ", req.currentAdminAuth);
218
- console.log(authorizationTypes);
219
211
  if (!req.user &&
220
212
  authorizationTypes.includes(common_1.AuthorizationType.UserOptional)) {
221
213
  next();
@@ -223,14 +215,12 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
223
215
  }
224
216
  if (req.currentAdminAuth &&
225
217
  authorizationTypes.includes(common_1.AuthorizationType.Admin)) {
226
- console.log("safe");
227
218
  next();
228
219
  return;
229
220
  }
230
221
  if (missingKYC) {
231
222
  throw new common_1.MissingKYCApprovalError();
232
223
  }
233
- console.log("not safe");
234
224
  if ((authorizationTypes.includes(common_1.AuthorizationType.User) ||
235
225
  authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC)) &&
236
226
  ((_h = req.cookies) === null || _h === void 0 ? void 0 : _h.accessToken)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.693",
3
+ "version": "1.0.694",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",