@riocrypto/common-server 1.0.1914 → 1.0.1919

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,4 @@
1
- import { Quote, Fiat, Crypto, BitsoBankAccount, Side, Country, Order, CryptoAddress, BankAccount, ChainedQuote, AuthRole, Auth } from "@riocrypto/common";
1
+ import { Quote, Fiat, Crypto, BitsoBankAccount, Side, Country, Order, CryptoAddress, BankAccount, ChainedQuote, AuthRole, Auth, ImportOrderData } from "@riocrypto/common";
2
2
  declare class ClusterClient {
3
3
  private baseUrl;
4
4
  private clusterApiKey;
@@ -44,6 +44,7 @@ declare class ClusterClient {
44
44
  deleteInvoice(id: string): Promise<void>;
45
45
  deleteRecord(id: string): Promise<void>;
46
46
  registerUserWithCoincover(userId: string): Promise<void>;
47
+ importOrder(orderToImport: ImportOrderData): Promise<void>;
47
48
  }
48
49
  export declare const buildClusterClient: () => Promise<ClusterClient>;
49
50
  export {};
@@ -334,6 +334,15 @@ class ClusterClient {
334
334
  });
335
335
  });
336
336
  }
337
+ importOrder(orderToImport) {
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ yield this.axios.post(`${this.baseUrl}/api/orders/import`, { orderToImport }, {
340
+ headers: {
341
+ "x-cluster-api-key": this.clusterApiKey,
342
+ },
343
+ });
344
+ });
345
+ }
337
346
  }
338
347
  const buildClusterClient = () => __awaiter(void 0, void 0, void 0, function* () {
339
348
  // Retrieve secrets asynchronously
@@ -38,7 +38,7 @@ class LoggerService {
38
38
  key === "refreshToken" ||
39
39
  key === "adminRefreshToken" ||
40
40
  key === "phoneVerifiedJWT") {
41
- return `${key}=${this.maskValue(value)}`; // Mask the sensitive cookie
41
+ return `${key}=${this.maskValue(value, true)}`; // Mask the sensitive cookie
42
42
  }
43
43
  return cookie; // Return unmodified if not sensitive
44
44
  })
@@ -47,18 +47,25 @@ class LoggerService {
47
47
  }
48
48
  // Mask sensitive request body fields
49
49
  if (info.meta && info.meta.req && info.meta.req.body) {
50
- const requestBodyFieldsToMask = [
50
+ const requestBodyFieldsToMaskWithLastFour = [
51
+ "accountNumber",
52
+ "routingNumber",
53
+ ];
54
+ requestBodyFieldsToMaskWithLastFour.forEach((field) => {
55
+ if (info.meta.req.body.hasOwnProperty(field)) {
56
+ info.meta.req.body[field] = this.maskValue(info.meta.req.body[field], true);
57
+ }
58
+ });
59
+ const requestBodyFieldsToMaskWithoutLastFour = [
51
60
  "password",
52
61
  "newPassword",
53
62
  "securityAnswer",
54
- "accountNumber",
55
- "routingNumber",
56
63
  "code",
57
64
  "authenticatorCode",
58
65
  ];
59
- requestBodyFieldsToMask.forEach((field) => {
66
+ requestBodyFieldsToMaskWithoutLastFour.forEach((field) => {
60
67
  if (info.meta.req.body.hasOwnProperty(field)) {
61
- info.meta.req.body[field] = this.maskValue(info.meta.req.body[field]); // Use maskValue function
68
+ info.meta.req.body[field] = this.maskValue(info.meta.req.body[field]);
62
69
  }
63
70
  });
64
71
  }
@@ -89,10 +96,13 @@ class LoggerService {
89
96
  });
90
97
  this.logger = null;
91
98
  }
92
- maskValue(value) {
93
- return value.length > 4
94
- ? "*".repeat(value.length - 4) + value.slice(-4)
95
- : value;
99
+ maskValue(value, showLastFour = false) {
100
+ if (showLastFour) {
101
+ return value.length > 4 ? "*".repeat(12) + value.slice(-4) : value;
102
+ }
103
+ else {
104
+ return "************";
105
+ }
96
106
  }
97
107
  getLogger() {
98
108
  if (!this.logger) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1914",
3
+ "version": "1.0.1919",
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.1698",
31
+ "@riocrypto/common": "^1.0.1700",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",