@t4h.framework/hmac 0.3.1 → 0.3.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @t4h.framework/hmac
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#181](https://github.com/tech4humans-brasil/framework/pull/181) [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - A credential is a `Secret`, never a string. An env entry declared with
8
+ `type: Secret` hands the workflow the name of the variable; the host binds the
9
+ value where the activity runs, so no input, output or history record holds it.
10
+
11
+ **Breaking**: every field that carries a credential now accepts only a
12
+ `Secret`. Declare the entry with `type: Secret` in your `EnvDesign` and pass it
13
+ whole; `tsc` points at each remaining string.
14
+
15
+ **core**: `Secret` (a `SerializableClass` whose `toString`, `valueOf` and
16
+ `toJSON` throw), `Secret.resolve` and `Secret.read` for hosts, `Secret.FORMAT`
17
+ for the manifest. `EnvDesign` accepts `type: Secret`, refuses a `defaultValue`
18
+ on a secret entry and throws when a `String` entry receives a secret.
19
+ `AsyncActivityCallbackAuth` carries a `Secret` in `secret`, `password`, `token`
20
+ and `value`.
21
+
22
+ **http**: `auth` accepts `{ username, password }`, `{ bearer }` or
23
+ `{ header, value }` besides an `HttpAuth`, all with a `Secret`, and the
24
+ activity writes the header on the host. `clientSecret` and `password` of the
25
+ OAuth2 grants are a `Secret`.
26
+
27
+ **smtp**, **sftp**, **orm**: `connectionString` is a `Secret`. The
28
+ `SftpConnectionString` and `ORMConnectionString` aliases are gone.
29
+
30
+ **hmac**: the callback authorizer reads the secret through `Secret.read`.
31
+
32
+ **dev**: the codec writes a `Secret` by name and binds the env value only where
33
+ an activity runs, reading the input back from the database as the runtime does.
34
+ The SFTP and SMTP claims read the value on connect.
35
+
36
+ **webhook**: documents the `Secret` in `auth`.
37
+
38
+ - Updated dependencies [[`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535), [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535)]:
39
+ - @t4h.framework/core@0.15.0
40
+
3
41
  ## 0.3.1
4
42
 
5
43
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"hmac-callback.d.ts","sourceRoot":"","sources":["../src/hmac-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,6BAA6B,EACnC,MAAM,qBAAqB,CAAA;AAI5B,wBAA8B,YAAY,CACxC,IAAI,EAAE,6BAA6B,EACnC,OAAO,EAAE,qBAAqB,CAAC,QAAQ,GACtC,OAAO,CAAC,OAAO,CAAC,CA4BlB"}
1
+ {"version":3,"file":"hmac-callback.d.ts","sourceRoot":"","sources":["../src/hmac-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,6BAA6B,EAEnC,MAAM,qBAAqB,CAAA;AAI5B,wBAA8B,YAAY,CACxC,IAAI,EAAE,6BAA6B,EACnC,OAAO,EAAE,qBAAqB,CAAC,QAAQ,GACtC,OAAO,CAAC,OAAO,CAAC,CA4BlB"}
@@ -1,4 +1,4 @@
1
- import { AsyncActivityCallback, } from '@t4h.framework/core';
1
+ import { AsyncActivityCallback, Secret, } from '@t4h.framework/core';
2
2
  import hmac from './hmac-authorize.js';
3
3
  export default async function hmacCallback(auth, request) {
4
4
  const signature = AsyncActivityCallback.getHeader(request.headers, auth.header);
@@ -13,7 +13,7 @@ export default async function hmacCallback(auth, request) {
13
13
  .replaceAll('{timestamp}', timestamp ?? '')
14
14
  .replaceAll('{body}', request.rawBody);
15
15
  return hmac({
16
- secret: auth.secret,
16
+ secret: Secret.read(auth.secret),
17
17
  signature,
18
18
  rawPayload,
19
19
  algorithm: auth.algorithm,
@@ -1 +1 @@
1
- {"version":3,"file":"hmac-callback.js","sourceRoot":"","sources":["../src/hmac-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,IAAI,MAAM,qBAAqB,CAAA;AAEtC,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CACxC,IAAmC,EACnC,OAAuC;IAEvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAC/C,OAAO,CAAC,OAAO,EACf,IAAI,CAAC,MAAM,CACZ,CAAA;IAED,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe;QACpC,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC;QACxE,CAAC,CAAC,SAAS,CAAA;IAEb,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAEpD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAC;SAChD,UAAU,CAAC,aAAa,EAAE,SAAS,IAAI,EAAE,CAAC;SAC1C,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAExC,OAAO,IAAI,CAAC;QACV,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS;QACT,UAAU;QACV,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,SAAS;QACT,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;KAC5C,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"hmac-callback.js","sourceRoot":"","sources":["../src/hmac-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAErB,MAAM,GACP,MAAM,qBAAqB,CAAA;AAE5B,OAAO,IAAI,MAAM,qBAAqB,CAAA;AAEtC,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CACxC,IAAmC,EACnC,OAAuC;IAEvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAC/C,OAAO,CAAC,OAAO,EACf,IAAI,CAAC,MAAM,CACZ,CAAA;IAED,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe;QACpC,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC;QACxE,CAAC,CAAC,SAAS,CAAA;IAEb,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAEpD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAC;SAChD,UAAU,CAAC,aAAa,EAAE,SAAS,IAAI,EAAE,CAAC;SAC1C,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAExC,OAAO,IAAI,CAAC;QACV,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,SAAS;QACT,UAAU;QACV,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,SAAS;QACT,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;KAC5C,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t4h.framework/hmac",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "HMAC module for the T4H Framework authorization",
5
5
  "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/hmac",
6
6
  "bugs": "https://github.com/tech4humans-brasil/framework/issues",
@@ -41,12 +41,12 @@
41
41
  "test:watch": "vitest"
42
42
  },
43
43
  "devDependencies": {
44
- "@t4h.framework/core": "^0.14.0",
44
+ "@t4h.framework/core": "^0.15.0",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^4.0.18"
47
47
  },
48
48
  "peerDependencies": {
49
- "@t4h.framework/core": "^0.14.0"
49
+ "@t4h.framework/core": "^0.15.0"
50
50
  },
51
51
  "packageManager": "yarn@4.12.0",
52
52
  "engines": {