@coast/service-common 2.0.63 → 2.0.64

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.
@@ -0,0 +1,3 @@
1
+ import { Brand } from '@paradoxical-io/types';
2
+ export type HmacSecretKey = Brand<string, 'HmacSecretKey'>;
3
+ export declare function HmacSecretKey(value: string): HmacSecretKey;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HmacSecretKey = HmacSecretKey;
4
+ function HmacSecretKey(value) {
5
+ return value;
6
+ }
7
+ //# sourceMappingURL=HmacSecretKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HmacSecretKey.js","sourceRoot":"","sources":["../../lib/crypto/HmacSecretKey.ts"],"names":[],"mappings":";;AAKA,sCAEC;AAFD,SAAgB,aAAa,CAAC,KAAa;IACvC,OAAO,KAAsB,CAAC;AAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Brand } from '@paradoxical-io/types';
2
+ export type HmacSignature = Brand<string, 'HmacSignature'>;
3
+ export declare function HmacSignature(value: string): HmacSignature;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HmacSignature = HmacSignature;
4
+ function HmacSignature(value) {
5
+ return value;
6
+ }
7
+ //# sourceMappingURL=HmacSignature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HmacSignature.js","sourceRoot":"","sources":["../../lib/crypto/HmacSignature.ts"],"names":[],"mappings":";;AAKA,sCAEC;AAFD,SAAgB,aAAa,CAAC,KAAa;IACvC,OAAO,KAAsB,CAAC;AAClC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { HmacSecretKey } from './HmacSecretKey';
2
+ import { HmacSignature } from './HmacSignature';
3
+ export declare class HmacUtils {
4
+ private static algorithm;
5
+ private static encoding;
6
+ static sign(data: string, secret: HmacSecretKey): HmacSignature;
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HmacUtils = void 0;
7
+ const node_crypto_1 = __importDefault(require("node:crypto"));
8
+ const HmacSignature_1 = require("./HmacSignature");
9
+ class HmacUtils {
10
+ static sign(data, secret) {
11
+ const hmac = node_crypto_1.default.createHmac(HmacUtils.algorithm, secret);
12
+ return (0, HmacSignature_1.HmacSignature)(hmac.update(data).digest().toString(HmacUtils.encoding));
13
+ }
14
+ }
15
+ exports.HmacUtils = HmacUtils;
16
+ HmacUtils.algorithm = 'sha256';
17
+ HmacUtils.encoding = 'base64';
18
+ //# sourceMappingURL=HmacUtils.js.map
@@ -0,0 +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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coast/service-common",
3
- "version": "2.0.63",
3
+ "version": "2.0.64",
4
4
  "description": "Common service package",
5
5
  "engines": {
6
6
  "node": ">=20.0.0"