fiberx-backend-toolkit 1.0.9 → 1.0.11

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.
@@ -75,7 +75,7 @@ export interface CachedContentInterface {
75
75
  email?: Record<string, any>;
76
76
  }
77
77
  export type RSAKeySizeType = 2048 | 3072 | 4096;
78
- export type HashAlgorithmType = "sha256" | "sha384" | "sha512";
78
+ export type HashAlgorithmType = "sha256" | "sha384" | "sha512" | "RSA-SHA256" | "RSA-SHA384" | "RSA-SHA512" | "RS256" | "RS384" | "RS512";
79
79
  export type EncodingType = "base64" | "hex";
80
80
  export interface RSAKeyPairResultInterface {
81
81
  public_key: string;
@@ -1,6 +1,7 @@
1
1
  import { RSAKeySizeType, HashAlgorithmType, EncodingType, RSAKeyPairResultInterface, ECKeyPairResultInterface } from "../types/util_type";
2
2
  declare class CryptoKeyUtil {
3
3
  private constructor();
4
+ static normalizeSigningAlgorithm(algorithm?: string): HashAlgorithmType;
4
5
  static generateRSAKeyPair(modulus_length?: RSAKeySizeType): RSAKeyPairResultInterface;
5
6
  static generateECKeyPair(named_curve?: "prime256v1" | "secp384r1" | "secp521r1"): ECKeyPairResultInterface;
6
7
  static sign(payload: string, private_key: string, algorithm?: HashAlgorithmType, output_encoding?: EncodingType): string;
@@ -36,6 +36,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const crypto_1 = __importStar(require("crypto"));
37
37
  class CryptoKeyUtil {
38
38
  constructor() { }
39
+ static normalizeSigningAlgorithm(algorithm) {
40
+ const value = algorithm?.trim();
41
+ const algorithm_map = {
42
+ RS256: "RSA-SHA256",
43
+ RS384: "RSA-SHA384",
44
+ RS512: "RSA-SHA512",
45
+ SHA256: "RSA-SHA256",
46
+ "SHA-256": "RSA-SHA256",
47
+ sha256: "RSA-SHA256",
48
+ };
49
+ return algorithm_map[value ?? ""] ?? "RSA-SHA256";
50
+ }
39
51
  /* ============================================================
40
52
  RSA KEY GENERATION
41
53
  ============================================================ */
@@ -74,7 +86,7 @@ class CryptoKeyUtil {
74
86
  SIGNING
75
87
  ============================================================ */
76
88
  static sign(payload, private_key, algorithm = "sha256", output_encoding = "base64") {
77
- const signer = (0, crypto_1.createSign)(algorithm);
89
+ const signer = (0, crypto_1.createSign)(CryptoKeyUtil.normalizeSigningAlgorithm(algorithm));
78
90
  signer.update(payload);
79
91
  signer.end();
80
92
  return signer.sign(private_key, output_encoding);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "A TypeScript backend toolkit providing shared domain logic, infrastructure helpers, and utilities for FiberX server-side applications and services.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -94,7 +94,7 @@
94
94
  "license": "ISC",
95
95
  "author": "David Matt-Ojo",
96
96
  "dependencies": {
97
- "@google-cloud/storage": "^7.19.0",
97
+ "@google-cloud/storage": "^7.21.0",
98
98
  "@types/nodemailer": "^8.0.0",
99
99
  "axios": "^1.17.0",
100
100
  "bcrypt": "^6.0.0",
@@ -105,39 +105,37 @@
105
105
  "jsonwebtoken": "^9.0.3",
106
106
  "nodemailer": "^8.0.10",
107
107
  "sequelize": "^6.37.8",
108
- "sequelize-typescript": "^2.1.6",
109
108
  "uuid": "^14.0.0"
110
109
  },
111
110
  "devDependencies": {
112
111
  "@eslint/js": "^10.0.1",
113
- "@types/axios": "^0.14.4",
114
112
  "@types/bcrypt": "^6.0.0",
115
113
  "@types/ejs": "^3.1.5",
116
114
  "@types/express": "^5.0.6",
117
115
  "@types/js-yaml": "^4.0.9",
118
116
  "@types/jsonwebtoken": "^9.0.10",
119
- "@types/node": "^25.9.1",
120
- "@types/uuid": "^11.0.0",
117
+ "@types/node": "^25.9.2",
121
118
  "cspell": "^10.0.1",
122
119
  "eslint": "^10.4.1",
123
120
  "globals": "^17.6.0",
124
- "prettier": "^3.8.3",
121
+ "prettier": "^3.8.4",
125
122
  "ts-node": "^10.9.2",
126
123
  "tsc-alias": "^1.8.17",
127
124
  "tsconfig-paths": "^4.2.0",
128
125
  "tsup": "^8.5.1",
129
126
  "typescript": "^6.0.3",
130
- "typescript-eslint": "^8.60.1"
127
+ "typescript-eslint": "^8.61.0"
131
128
  },
132
129
  "overrides": {
133
130
  "qs": "^6.15.2",
134
131
  "uuid": "^14.0.0"
135
132
  },
136
133
  "engines": {
137
- "node": "26.x"
134
+ "node": ">=24 <27"
138
135
  },
139
136
  "allowScripts": {
140
137
  "bcrypt@6.0.0": true,
141
- "esbuild@0.27.7": true
138
+ "esbuild@0.27.7": true,
139
+ "fsevents@2.3.3": true
142
140
  }
143
141
  }