@t4h.framework/jwks 0.7.5 → 0.7.7

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.
@@ -99,9 +99,9 @@ Optional manifest fields are still present as `undefined` when omitted (`toManif
99
99
  | `rawPayload` | Yes | Payload bytes as string for non-JWT verification; for JWT path, tests pass the same string as `signature` (handler only uses `signature` on JWT path). |
100
100
  | `issuer` | No | When set, passed to `jwt.verify` as expected `iss`. Mismatch **rejects** (throws). |
101
101
  | `audience` | No | When set, passed to `jwt.verify` as expected `aud`. |
102
- | `kid` | Conditional | Required when `signature` is **not** a decodable JWT (non-JWT path). |
103
- | `algorithm` | Conditional | Non-JWT path: **enum key** on `JWKSAlgorithm` (e.g. `RS256`), not the Node crypto string. |
104
- | `signatureFormat` | Conditional | Non-JWT path: encoding for the signature buffer (`hex`, `base64`, etc.—`BinaryToTextEncoding`). |
102
+ | `kid` | Non-JWT path | Key id to look up in the JWKS. Used when `signature` is **not** a decodable JWT. |
103
+ | `algorithm` | Non-JWT path | **Enum key** on `JWKSAlgorithm` (e.g. `RS256`), not the Node crypto string. |
104
+ | `signatureFormat` | Non-JWT path | Encoding for the signature buffer (`hex`, `base64`, etc.—`BinaryToTextEncoding`). |
105
105
 
106
106
  ---
107
107
 
@@ -119,7 +119,7 @@ Behavior (from `jwks-authorize.ts` and tests):
119
119
  2. Build `JwksClient({ jwksUri: options.url })`.
120
120
  3. `jwt.decode(signature, { complete: true })`:
121
121
  - **Decoded (JWT path)** → `validateJwt(signature, client, { issuer, audience })`.
122
- - **Not decoded (non-JWT path)** → require `kid`, `algorithm`, `signatureFormat`; else **throw** with fixed messages (see below).
122
+ - **Not decoded (non-JWT path)** → verify the detached signature with `kid`, `algorithm` and `signatureFormat`.
123
123
 
124
124
  ### JWT path (`validateJwt`)
125
125
 
@@ -137,13 +137,7 @@ authorizer.update(options.rawPayload)
137
137
  authorizer.verify(signingKey, options.signature, signatureFormat)
138
138
  ```
139
139
 
140
- Throws if any required field is missing:
141
-
142
- | Missing | Error message |
143
- |---------|----------------|
144
- | `kid` | `KID is required for payload verification` |
145
- | `algorithm` | `Algorithm is required for payload verification` |
146
- | `signatureFormat` | `Signature format is required for payload verification` |
140
+ A missing `kid`, `algorithm` or `signatureFormat` throws (`jwks-authorize.ts`).
147
141
 
148
142
  `algorithm` must be a **key** of `JWKSAlgorithm`:
149
143
 
@@ -210,7 +204,6 @@ If `signature` accidentally looks like a JWT to `jwt.decode`, the JWT path runs
210
204
  | Valid RS256 JWT, matching JWKS key | `true` |
211
205
  | JWT wrong alg (e.g. HS256), no `kid`, undecodable token | `false` |
212
206
  | Expired JWT, issuer mismatch, signature mismatch | **Rejected** (throw from `jwt.verify`) |
213
- | Non-JWT missing `kid` / `algorithm` / `signatureFormat` | **Throw** (configuration error) |
214
207
  | Non-JWT verify fails | `false` |
215
208
 
216
209
  Design callers so manifest context is complete **before** the handler runs; missing non-JWT fields are programmer errors, not silent denials.
@@ -271,6 +264,4 @@ For workflow orchestration and claims use **framework-core**; for the `TestWorkf
271
264
  2. Build `JWKSAuthorizationContext` with `url`, `signature`, `rawPayload` at minimum.
272
265
  3. Attach `new JWKSAuthorization(context)` to `Workflow` and/or `App` `authorization` option.
273
266
  4. JWT: ensure RS256 + `kid`; optional `issuer` / `audience`.
274
- 5. Non-JWT: set `kid`, `algorithm` (`JWKSAlgorithm` key), `signatureFormat`.
275
- 6. Expect `false` for deny, throws for misconfiguration or JWT verify failures (expired, wrong iss).
276
- 7. Do not reference APIs absent from `src/` and tests.
267
+ 5. Expect `false` for deny, throws for misconfiguration or JWT verify failures (expired, wrong iss).
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @t4h.framework/jwks
2
2
 
3
+ ## 0.7.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#243](https://github.com/tech4humans-brasil/framework/pull/243) [`0ffd663`](https://github.com/tech4humans-brasil/framework/commit/0ffd663ce8369edd7b54206cb3216568ad1de471) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The README examples read each value from `environments`, an `EnvDesign` in `src/constants/environments.ts`, and pass each credential as a `Secret`. They no longer use `process.env`, the raw `env` from the core or a literal in a `Secret` field. The jwks README describes the real context fields (`signature`, `rawPayload`) and says that a token that `jwt.verify` rejects throws.
8
+
9
+ - [#240](https://github.com/tech4humans-brasil/framework/pull/240) [`0606115`](https://github.com/tech4humans-brasil/framework/commit/0606115e2e0baa994e9f0ed3559ee54ecac88e44) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The skills do not repeat a rule that a lint rule, `tsc` or a runtime error already enforces. Each such rule is now one line that names the gate. The examples that broke a gate (`process.env`, `as any`, an inline secret, an `EnvDesign` in a workflow file, `ref.output` before `wait()`) are correct now.
10
+
11
+ - [#228](https://github.com/tech4humans-brasil/framework/pull/228) [`d29e1ab`](https://github.com/tech4humans-brasil/framework/commit/d29e1ab29a039b13c3e4b075472bd615566ae75e) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Uses exact types and `unknown` in place of `any`, and checks external data with guards.
12
+ - harness: the fix-issues prompt lists each sensor as `- checkTypes: PASS`. Before, it printed `- 0: [object Object]`.
13
+ - hmac: an algorithm name such as `constructor` throws `Unsupported algorithm`.
14
+ - oidc: a discovery response with no `introspection_endpoint`, or a null introspection body, throws a clear error.
15
+ - `HttpRequestActivity.toOutput` takes `HttpRequestActivityOutput` in place of `any`.
16
+
17
+ ## 0.7.6
18
+
3
19
  ## 0.7.5
4
20
 
5
21
  ## 0.7.4
package/README.md CHANGED
@@ -18,21 +18,22 @@ Requires `@t4h.framework/core` (same major line as this package).
18
18
 
19
19
  Subclass of [`Authorization`](https://github.com/tech4humans-brasil/framework/tree/main/packages/core) from core. `toManifest()` points the runtime at `@t4h.framework/jwks/authorize` and passes a `JWKSAuthorizationContext`.
20
20
 
21
- Construct it with a full `JWKSAuthorizationContext` (including `url` and `value`). How you obtain `value`—headers, query, env, or runtime injection—is up to your app and deployment pipeline; this package does not read HTTP or env by itself.
21
+ Construct it with a full `JWKSAuthorizationContext`. `url`, `signature` and `rawPayload` are required. Your app or deployment pipeline supplies `signature` and `rawPayload`, for example from a request header or by runtime injection. This package does not read HTTP or env.
22
22
 
23
23
  ## Context: `JWKSAuthorizationContext`
24
24
 
25
25
  | Field | Required | Description |
26
26
  |-------|----------|-------------|
27
27
  | `url` | Yes | JWKS document URL (`jwks-rsa` `jwksUri`). |
28
- | `value` | Yes | Credential to verify (Bearer token, raw payload, etc., depending on your app). Empty string yields `false`. |
29
- | `issuer` | No | If set, passed to JWT verification as expected `iss`. |
30
- | `audience` | No | If set, passed to JWT verification as expected `aud`. |
31
- | `kid` | Conditional | Required when `value` is **not** a decodable JWT (see below). |
32
- | `algorithm` | Conditional | Same as `kid` for non-JWT `value`. |
33
- | `signatureFormat` | Conditional | Same as `kid` for non-JWT `value` (encoding for the signature buffer, e.g. `hex` or `base64`). |
28
+ | `signature` | Yes | Credential to verify: a JWT, or a detached signature for the non-JWT path. An empty string gives `false`. |
29
+ | `rawPayload` | Yes | The signed payload for the non-JWT path. The JWT path does not use it; pass an empty string. |
30
+ | `issuer` | No | JWT path: the expected `iss`. |
31
+ | `audience` | No | JWT path: the expected `aud`. |
32
+ | `kid` | Non-JWT path | Key id to find in the JWKS. Required when `signature` is **not** a JWT that decodes. |
33
+ | `algorithm` | Non-JWT path | A key of `JWKSAlgorithm` (`RS256`, `PS256`, `ES256`, …). |
34
+ | `signatureFormat` | Non-JWT path | Encoding of `signature` (`hex`, `base64`, …). |
34
35
 
35
- There is no built-in OIDC discovery (`JWKS_ISSUER`), no environment-variable mapping in this package, and no `credentialSource` helper—you choose where `value` comes from in your application or hosting layer.
36
+ There is no OIDC discovery (`JWKS_ISSUER`), no environment-variable mapping in this package, and no `credentialSource` helper. Your application or hosting layer gives `signature` and `rawPayload`.
36
37
 
37
38
  ## Runtime handler (`jwks/authorize`)
38
39
 
@@ -42,21 +43,22 @@ The default export is an async function:
42
43
  (options: JWKSAuthorizationContext) => Promise<boolean>
43
44
  ```
44
45
 
45
- - Returns `false` if `value` is missing or verification fails.
46
+ - Returns `false` if `signature` is empty.
46
47
  - Returns `true` if verification succeeds.
47
48
 
48
49
  ### JWT path
49
50
 
50
- If `value` decodes as a JWT (`jsonwebtoken` `decode` with `complete: true` succeeds), verification uses `validateJwt` ([source](https://github.com/tech4humans-brasil/framework/blob/main/packages/jwks/src/helpers/validateJwt.ts)):
51
+ If `signature` decodes as a JWT (`jsonwebtoken` `decode` with `complete: true` succeeds), the handler verifies it with `validateJwt` ([source](https://github.com/tech4humans-brasil/framework/blob/main/packages/jwks/src/helpers/validateJwt.ts)):
51
52
 
52
- - Algorithm **RS256** only (`alg` in the header must be `RS256`).
53
- - Header must include `kid` (used to fetch the signing key from JWKS).
54
- - `exp` is enforced (token must not be expired).
55
- - Optional `issuer` and `audience` from the context are applied when present.
53
+ - The algorithm must be **RS256**. A different `alg` in the header gives `false`.
54
+ - The header must have a `kid`, which selects the signing key in the JWKS. No `kid` gives `false`.
55
+ - `exp` is enforced.
56
+ - `issuer` and `audience` from the context apply when you set them.
57
+ - An expired token, an `issuer` or `audience` mismatch, or a bad signature makes `jwt.verify` throw, so the handler throws.
56
58
 
57
59
  ### Non-JWT path
58
60
 
59
- If `value` is not treated as a JWT by the decoder, the handler expects `kid`, `algorithm`, and `signatureFormat` on the context. If any of these are missing, it **throws** with a clear error. It loads the public key from JWKS by `kid` and verifies using Node’s `crypto.createVerify`.
61
+ If `signature` does not decode as a JWT, the handler needs `kid`, `algorithm` and `signatureFormat` on the context. If one of them is missing, it **throws**. It gets the public key from the JWKS by `kid`, and verifies `signature` over `rawPayload` with Node `crypto.createVerify`. A signature that does not match gives `false`.
60
62
 
61
63
  ## Example
62
64
 
@@ -65,7 +67,8 @@ import { JWKSAuthorization } from '@t4h.framework/jwks'
65
67
 
66
68
  const authorization = new JWKSAuthorization({
67
69
  url: 'https://auth.example.com/.well-known/jwks.json',
68
- value: '<token-or-payload-from-runtime>',
70
+ signature: '<credential-from-runtime>',
71
+ rawPayload: '',
69
72
  audience: 'https://api.example.com',
70
73
  })
71
74
  ```
@@ -9,7 +9,7 @@ export async function validateJwt(token, client, options) {
9
9
  return false;
10
10
  const key = await client.getSigningKey(decoded.header.kid);
11
11
  const publicKey = key.getPublicKey();
12
- const isValid = await jwt.verify(token, publicKey, {
12
+ const isValid = jwt.verify(token, publicKey, {
13
13
  algorithms: ['RS256'],
14
14
  ignoreExpiration: false,
15
15
  issuer: options?.issuer,
@@ -1 +1 @@
1
- {"version":3,"file":"validateJwt.js","sourceRoot":"","sources":["../../src/helpers/validateJwt.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAA;AAQ9B,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAa,EACb,MAAkB,EAClB,OAA4B;IAE5B,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IAErD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAE1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;QAAE,OAAO,KAAK,CAAA;IAErC,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO;QAAE,OAAO,KAAK,CAAA;IAEhD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAE1D,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,EAAE,CAAA;IAEpC,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE;QACjD,UAAU,EAAE,CAAC,OAAO,CAAC;QACrB,gBAAgB,EAAE,KAAK;QACvB,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,QAAQ,EAAE,OAAO,EAAE,QAAQ;KAC5B,CAAC,CAAA;IAEF,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAA;AACpC,CAAC"}
1
+ {"version":3,"file":"validateJwt.js","sourceRoot":"","sources":["../../src/helpers/validateJwt.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAA;AAQ9B,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAa,EACb,MAAkB,EAClB,OAA4B;IAE5B,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IAErD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAE1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;QAAE,OAAO,KAAK,CAAA;IAErC,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO;QAAE,OAAO,KAAK,CAAA;IAEhD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAE1D,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,EAAE,CAAA;IAEpC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE;QAC3C,UAAU,EAAE,CAAC,OAAO,CAAC;QACrB,gBAAgB,EAAE,KAAK;QACvB,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,QAAQ,EAAE,OAAO,EAAE,QAAQ;KAC5B,CAAC,CAAA;IAEF,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAA;AACpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"jwks-callback.d.ts","sourceRoot":"","sources":["../src/jwks-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAClC,MAAM,qBAAqB,CAAA;AAyG5B,wBAA8B,YAAY,CACxC,IAAI,EAAE,4BAA4B,GAAG,6BAA6B,EAClE,QAAQ,EAAE,qBAAqB,CAAC,QAAQ,GACvC,OAAO,CAAC,OAAO,CAAC,CAIlB"}
1
+ {"version":3,"file":"jwks-callback.d.ts","sourceRoot":"","sources":["../src/jwks-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAClC,MAAM,qBAAqB,CAAA;AA+G5B,wBAA8B,YAAY,CACxC,IAAI,EAAE,4BAA4B,GAAG,6BAA6B,EAClE,QAAQ,EAAE,qBAAqB,CAAC,QAAQ,GACvC,OAAO,CAAC,OAAO,CAAC,CAIlB"}
@@ -1,14 +1,18 @@
1
1
  import { AsyncActivityCallback, } from '@t4h.framework/core';
2
2
  import jwks from './jwks-authorize.js';
3
+ function toEpochMilliseconds(timestamp) {
4
+ if (!/^\d+$/.test(timestamp))
5
+ return Date.parse(timestamp);
6
+ const isAlreadyInMilliseconds = timestamp.length >= 13;
7
+ if (isAlreadyInMilliseconds)
8
+ return Number(timestamp);
9
+ return Number(timestamp) * 1000;
10
+ }
3
11
  function isWithinTolerance(timestamp, toleranceInSeconds) {
4
12
  const value = timestamp.trim();
5
13
  if (!value)
6
14
  return false;
7
- const signedAt = /^\d+$/.test(value)
8
- ? value.length >= 13
9
- ? Number(value)
10
- : Number(value) * 1000
11
- : Date.parse(value);
15
+ const signedAt = toEpochMilliseconds(value);
12
16
  if (Number.isNaN(signedAt))
13
17
  return false;
14
18
  return Math.abs(Date.now() - signedAt) / 1000 <= toleranceInSeconds;
@@ -1 +1 @@
1
- {"version":3,"file":"jwks-callback.js","sourceRoot":"","sources":["../src/jwks-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAGtB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,IAAI,MAAM,qBAAqB,CAAA;AAEtC,SAAS,iBAAiB,CAAC,SAAiB,EAAE,kBAA0B;IACtE,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,CAAA;IAE9B,IAAI,CAAC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K,SAAS;QACrC,CAAC,iBAAiB,CAAC,SAAS,IAAI,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC;QAE5D,OAAO,KAAK,CAAA;IAEd,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAC;SAChD,UAAU,CAAC,aAAa,EAAE,SAAS,IAAI,EAAE,CAAC;SAC1C,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEzC,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAC;YAChB,GAAG,EAAE,IAAI,CAAC,OAAO;YACjB,SAAS;YACT,UAAU;YACV,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC;YACzD,SAAS,EAAE,iBAAiB,CAC1B,OAAO,EACP,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,eAAe,CACrB;YACD,eAAe,EACb,iBAAiB,CACf,OAAO,EACP,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,qBAAqB,CAC3B,IAAI,KAAK;SACb,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CACxC,IAAkE,EAClE,QAAwC;IAExC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAExE,OAAO,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC"}
@@ -8,7 +8,7 @@ export type JWKSAuthorizationContext = {
8
8
  audience?: string;
9
9
  kid?: string;
10
10
  algorithm?: string;
11
- signatureFormat?: BinaryToTextEncoding | string;
11
+ signatureFormat?: BinaryToTextEncoding | (string & {});
12
12
  };
13
13
  export type JWKSAuthorizationManifest = AuthorizationManifest<JWKSAuthorizationContext>;
14
14
  export declare class JWKSAuthorization extends Authorization<JWKSAuthorizationContext> {
@@ -1 +1 @@
1
- {"version":3,"file":"JWKSAuthorization.d.ts","sourceRoot":"","sources":["../../src/models/JWKSAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,yBAAyB,GACnC,qBAAqB,CAAC,wBAAwB,CAAC,CAAA;AAEjD,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,wBAAwB,CAAC;IAChE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,wBAAwB;IAIvD,UAAU,IAAI,yBAAyB;CAe/C"}
1
+ {"version":3,"file":"JWKSAuthorization.d.ts","sourceRoot":"","sources":["../../src/models/JWKSAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,oBAAoB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;CACvD,CAAA;AAED,MAAM,MAAM,yBAAyB,GACnC,qBAAqB,CAAC,wBAAwB,CAAC,CAAA;AAEjD,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,wBAAwB,CAAC;IAChE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,wBAAwB;IAIvD,UAAU,IAAI,yBAAyB;CAe/C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t4h.framework/jwks",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "JWKS module for the T4H Framework authorization",
5
5
  "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/jwks",
6
6
  "bugs": "https://github.com/tech4humans-brasil/framework/issues",
@@ -36,12 +36,14 @@
36
36
  "scripts": {
37
37
  "build": "tsc --project tsconfig.build.json",
38
38
  "check-types": "tsc --noEmit",
39
+ "check-package": "publint --strict && attw --pack . --profile esm-only",
40
+ "lint": "eslint . --max-warnings 0",
39
41
  "prepublishOnly": "yarn build",
40
42
  "test": "vitest run",
41
43
  "test:watch": "vitest"
42
44
  },
43
45
  "devDependencies": {
44
- "@t4h.framework/core": "^0.18.0",
46
+ "@t4h.framework/core": "^0.20.0",
45
47
  "@types/jsonwebtoken": "^9",
46
48
  "typescript": "^5.9.3",
47
49
  "vitest": "^4.0.18"