@coast/service-common 2.0.66 → 2.0.67

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.
@@ -4,4 +4,5 @@ export declare class HmacUtils {
4
4
  private static algorithm;
5
5
  private static encoding;
6
6
  static sign(data: string, secret: HmacSecretKey): HmacSignature;
7
+ static generateSecret(): HmacSecretKey;
7
8
  }
@@ -5,12 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HmacUtils = void 0;
7
7
  const node_crypto_1 = __importDefault(require("node:crypto"));
8
+ const HmacSecretKey_1 = require("./HmacSecretKey");
8
9
  const HmacSignature_1 = require("./HmacSignature");
9
10
  class HmacUtils {
10
11
  static sign(data, secret) {
11
12
  const hmac = node_crypto_1.default.createHmac(HmacUtils.algorithm, secret);
12
13
  return (0, HmacSignature_1.HmacSignature)(hmac.update(data).digest().toString(HmacUtils.encoding));
13
14
  }
15
+ static generateSecret() {
16
+ return (0, HmacSecretKey_1.HmacSecretKey)(node_crypto_1.default.randomBytes(32).toString('hex'));
17
+ }
14
18
  }
15
19
  exports.HmacUtils = HmacUtils;
16
20
  HmacUtils.algorithm = 'sha256';
@@ -1 +1 @@
1
- {"version":3,"file":"HmacUtils.js","sourceRoot":"","sources":["../../lib/crypto/HmacUtils.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AAGjC,mDAAgD;AAEhD,MAAa,SAAS;IAIX,MAAM,CAAC,IAAI,CAAC,IAAY,EAAE,MAAqB;QAClD,MAAM,IAAI,GAAG,qBAAM,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE5D,OAAO,IAAA,6BAAa,EAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClF,CAAC;;AARL,8BASC;AARkB,mBAAS,GAAG,QAAQ,CAAC;AACrB,kBAAQ,GAAmB,QAAQ,CAAC"}
1
+ {"version":3,"file":"HmacUtils.js","sourceRoot":"","sources":["../../lib/crypto/HmacUtils.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AAEjC,mDAAgD;AAChD,mDAAgD;AAEhD,MAAa,SAAS;IAIX,MAAM,CAAC,IAAI,CAAC,IAAY,EAAE,MAAqB;QAClD,MAAM,IAAI,GAAG,qBAAM,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE5D,OAAO,IAAA,6BAAa,EAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClF,CAAC;IAEM,MAAM,CAAC,cAAc;QACxB,OAAO,IAAA,6BAAa,EAAC,qBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;;AAZL,8BAaC;AAZkB,mBAAS,GAAG,QAAQ,CAAC;AACrB,kBAAQ,GAAmB,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coast/service-common",
3
- "version": "2.0.66",
3
+ "version": "2.0.67",
4
4
  "description": "Common service package",
5
5
  "engines": {
6
6
  "node": ">=20.0.0"
@@ -47,6 +47,7 @@
47
47
  "@types/jest": "^29.5.14",
48
48
  "@types/node": "^22.13.4",
49
49
  "@types/pino": "^7.0.5",
50
+ "fast-check": "^4.5.3",
50
51
  "jest": "^29.7.0",
51
52
  "pino-test": "^1.1.0",
52
53
  "ts-jest": "^29.2.5",