@riocrypto/common-server 1.0.2745 → 1.0.2747

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.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,8 +33,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
33
  };
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
35
  exports.getIsFireblocksWebhookValid = void 0;
13
- const jose_1 = require("jose");
14
- const JWKS = (0, jose_1.createRemoteJWKSet)(new URL("https://keys.fireblocks.io/.well-known/jwks.json"));
36
+ let jwks = null;
37
+ function getJWKS() {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ if (!jwks) {
40
+ const { createRemoteJWKSet } = yield Promise.resolve().then(() => __importStar(require("jose")));
41
+ jwks = createRemoteJWKSet(new URL("https://keys.fireblocks.io/.well-known/jwks.json"));
42
+ }
43
+ return jwks;
44
+ });
45
+ }
15
46
  const getIsFireblocksWebhookValid = (req) => __awaiter(void 0, void 0, void 0, function* () {
16
47
  const jwsSignature = req.headers["fireblocks-webhook-signature"];
17
48
  if (!jwsSignature || typeof jwsSignature !== "string") {
@@ -22,10 +53,12 @@ const getIsFireblocksWebhookValid = (req) => __awaiter(void 0, void 0, void 0, f
22
53
  return false;
23
54
  }
24
55
  try {
56
+ const { compactVerify } = yield Promise.resolve().then(() => __importStar(require("jose")));
57
+ const JWKS = yield getJWKS();
25
58
  const [header, , sig] = jwsSignature.split(".");
26
59
  const payload = Buffer.from(rawBody).toString("base64url");
27
60
  const fullJws = `${header}.${payload}.${sig}`;
28
- yield (0, jose_1.compactVerify)(fullJws, JWKS);
61
+ yield compactVerify(fullJws, JWKS);
29
62
  return true;
30
63
  }
31
64
  catch (_a) {
@@ -67,6 +67,9 @@ interface InternalBalancesDoc extends mongoose.Document {
67
67
  transnetworkPaymentAccount: {
68
68
  [key in Fiat & Crypto]: number;
69
69
  };
70
+ stoneXPaymentAccount: {
71
+ [key in Fiat & Crypto]: number;
72
+ };
70
73
  }
71
74
  interface InternalBalancesModel extends mongoose.Model<InternalBalancesDoc> {
72
75
  build(attrs: InternalBalancesAttrs): InternalBalancesDoc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2745",
3
+ "version": "1.0.2747",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.2537",
31
+ "@riocrypto/common": "^1.0.2539",
32
32
  "@slack/web-api": "^7.9.2",
33
33
  "@types/express": "^4.17.13",
34
34
  "axios": "^1.7.4",