@riocrypto/common-server 1.0.2757 → 1.0.2758

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.
@@ -12,6 +12,7 @@ declare global {
12
12
  user?: UserDoc;
13
13
  validClusterApiKey?: boolean;
14
14
  validGenisisAdminKey?: boolean;
15
+ validFXPricePusherApiKey?: boolean;
15
16
  isAuthMissing2FA?: boolean;
16
17
  indicativeQuoteAuth?: {
17
18
  email: string;
@@ -58,6 +58,22 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
58
58
  }))());
59
59
  }
60
60
  }
61
+ // Check for FX price pusher API key - only if needed
62
+ if (authorizationTypes.includes(common_1.AuthorizationType.FXPricePusher)) {
63
+ const fxPricePusherApiKey = req.header("x-fx-price-pusher-api-key");
64
+ if (fxPricePusherApiKey) {
65
+ promises.push((() => __awaiter(void 0, void 0, void 0, function* () {
66
+ const FX_PRICE_PUSHER_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("FX_PRICE_PUSHER_API_KEY");
67
+ if (!FX_PRICE_PUSHER_API_KEY) {
68
+ throw new common_1.SecretManagerError();
69
+ }
70
+ if (fxPricePusherApiKey.length === FX_PRICE_PUSHER_API_KEY.length &&
71
+ crypto_1.default.timingSafeEqual(Buffer.from(fxPricePusherApiKey), Buffer.from(FX_PRICE_PUSHER_API_KEY))) {
72
+ req.validFXPricePusherApiKey = true;
73
+ }
74
+ }))());
75
+ }
76
+ }
61
77
  // Check for admin auth - only if needed
62
78
  if (authorizationTypes.includes(common_1.AuthorizationType.AdminAuth)) {
63
79
  const adminApiKey = req.header("x-admin-api-key");
@@ -266,6 +282,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
266
282
  req.validClusterApiKey) ||
267
283
  (authorizationTypes.includes(common_1.AuthorizationType.GenesisAdmin) &&
268
284
  req.validGenisisAdminKey) ||
285
+ (authorizationTypes.includes(common_1.AuthorizationType.FXPricePusher) &&
286
+ req.validFXPricePusherApiKey) ||
269
287
  (authorizationTypes.includes(common_1.AuthorizationType.Auth) && req.auth) ||
270
288
  (authorizationTypes.includes(common_1.AuthorizationType.AuthMissing2FA) &&
271
289
  req.auth &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2757",
3
+ "version": "1.0.2758",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@google-cloud/secret-manager": "^5.6.0",
25
25
  "@google-cloud/storage": "^7.19.0",
26
26
  "@hyperdx/node-opentelemetry": "^0.10.3",
27
- "@riocrypto/common": "^1.0.2546",
27
+ "@riocrypto/common": "^1.0.2552",
28
28
  "@slack/web-api": "^7.15.0",
29
29
  "@types/express": "^4.17.25",
30
30
  "axios": "1.13.6",
@@ -38,6 +38,7 @@
38
38
  "jose": "^6.2.2",
39
39
  "jsonwebtoken": "^9.0.3",
40
40
  "lodash": "^4.17.23",
41
+ "logform": "2.7.0",
41
42
  "mongoose": "^8.23.0",
42
43
  "node-cache": "^5.1.2",
43
44
  "uuid": "^9.0.1",