@nathapp/nestjs-auth 3.0.0 → 3.0.1

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/.eslintignore ADDED
@@ -0,0 +1,6 @@
1
+ coverage/
2
+ dist/
3
+ node_modules/
4
+ index.ts
5
+ index.js
6
+ index.d.ts
package/CLAUDE.md CHANGED
@@ -24,6 +24,18 @@ JWT authentication + CASL authorization library for NestJS.
24
24
  - `@RefreshToken()` does NOT bypass guards. Use `@Public()` + `@UseGuards(JwtRefreshGuard)` for refresh endpoints.
25
25
  - Guards (`JwtAuthGuard`, `PermissionAuthGuard`) are registered by `nestjs-app`, not self-registered.
26
26
 
27
+ ## JWKS Mode
28
+
29
+ - Enabled by setting `JwtNestJsOptions.jwks.jwksUri`.
30
+ - Uses `jwks-rsa` (optional peer dep — install separately).
31
+ - `BaseJwtStrategyProvider` emits `secretOrKeyProvider` instead of `secretOrKey` when `jwks` is set.
32
+ - `JwksJwtStrategyProvider` is the verify-only convenience class.
33
+ - Security invariants enforced at construction by `validateJwksOptions`:
34
+ - `issuer` is required (prevents accepting any token from any key the URI serves)
35
+ - `algorithms` defaults to `['RS256']`; HMAC and `none` are rejected (key-confusion attack)
36
+ - `jwksUri` must be https unless `jwks.allowInsecure=true`
37
+ - `sign()` and `verify()` throw in JWKS mode — strategies are verify-only.
38
+
27
39
  ## IMPORTANT
28
40
  - Security-critical package — extra scrutiny on all changes.
29
41
  - `BaseJwtStrategyProvider` is the extension point for custom JWT strategies.
package/README.md CHANGED
@@ -1,9 +1,60 @@
1
- # nestjs-auth Library
1
+ # @nathapp/nestjs-auth
2
2
 
3
- note: for fastify, there is slighly different on request and response handling
3
+ JWT authentication + CASL authorization library for NestJS.
4
4
 
5
- to use this library, please run this
5
+ ## Installation
6
6
 
7
+ ```bash
8
+ npm install @nathapp/nestjs-auth @nestjs/passport
7
9
  ```
8
- npm i @nathapp/nestjs-auth @nestjs/passport
10
+
11
+ > **Note for Fastify users:** There is slightly different request/response handling for Fastify. Interceptors and middleware check `req.raw` for Fastify vs Express compatibility.
12
+
13
+ ## JWKS (Remote Identity Provider)
14
+
15
+ To verify tokens issued by an external IdP (Auth0, Cognito, Okta, Keycloak), install the optional `jwks-rsa` peer dependency:
16
+
17
+ ```bash
18
+ npm install jwks-rsa
9
19
  ```
20
+
21
+ Then configure your module:
22
+
23
+ ```ts
24
+ import { Module } from '@nestjs/common';
25
+ import { AuthenticationModule, createJwksStrategyProvider } from '@nathapp/nestjs-auth';
26
+ import { MyAuthProvider } from './my-auth-provider';
27
+
28
+ @Module({
29
+ imports: [
30
+ AuthenticationModule.forRoot({
31
+ jwtOptions: {
32
+ signOption: { algorithm: 'RS256' },
33
+ issuer: 'https://my-tenant.auth0.com/',
34
+ audience: 'https://api.example.com',
35
+ jwks: {
36
+ jwksUri: 'https://my-tenant.auth0.com/.well-known/jwks.json',
37
+ // optional tuning:
38
+ // cacheMaxAge: 600000,
39
+ // jwksRequestsPerMinute: 10,
40
+ // algorithms: ['RS256'],
41
+ },
42
+ },
43
+ authProvider: MyAuthProvider,
44
+ }),
45
+ ],
46
+ // Override the default JwtStrategyProvider with the JWKS factory.
47
+ // Must be registered AFTER AuthenticationModule so DI resolves this provider.
48
+ providers: [createJwksStrategyProvider()],
49
+ })
50
+ export class AppModule {}
51
+ ```
52
+
53
+ > **Note:** Don't pass `strategyProvider: JwksJwtStrategyProvider` directly — this monorepo uses `useFactory` registration (see [CLAUDE.md](./CLAUDE.md)). The `createJwksStrategyProvider()` helper wires `JWT_OPTIONS` + `AUTH_PROVIDER` injection for you.
54
+
55
+ ### JWKS Security Defaults
56
+
57
+ - `issuer` is **required** when using JWKS (prevents accepting tokens from any key the URI serves).
58
+ - `algorithms` defaults to `['RS256']`. HMAC algorithms (`HS*`) and `none` are rejected.
59
+ - `jwksUri` must use HTTPS (set `allowInsecure: true` only for local dev against a mock server).
60
+ - `sign()` throws in JWKS mode — the strategy is verify-only.
@@ -5,9 +5,10 @@ import { IPrincipal } from "../auth-provider";
5
5
  import { StrategyProvider } from "./strategy-provider";
6
6
  export declare abstract class BaseJwtStrategyProvider implements StrategyProvider {
7
7
  protected readonly jwtOptions: JwtOptions;
8
- private readonly jwtProvider;
9
- readonly secretOrPrivateKey: jwt.Secret;
10
- readonly secretOrPublicKey: jwt.Secret;
8
+ private readonly jwtProvider?;
9
+ private readonly secretOrKeyProviderFn?;
10
+ readonly secretOrPrivateKey?: jwt.Secret;
11
+ readonly secretOrPublicKey?: jwt.Secret;
11
12
  readonly jwtFromRequestFunction: JwtFromRequestFunction;
12
13
  readonly ignoreExpiration: boolean;
13
14
  readonly passReqToCallback: boolean;
@@ -14,39 +14,56 @@ class BaseJwtStrategyProvider {
14
14
  isBase64AsymmetricKey: false,
15
15
  };
16
16
  const mergedDefaults = { ...baseDefaults, ...defaultOptions };
17
- this.jwtOptions = Object.assign({}, mergedDefaults, jwtOptions);
18
- this.jwtProvider = (0, utils_1.createJwtProvider)(jwtOptions);
19
- this.secretOrPrivateKey = this.jwtProvider.secretOrPrivateKey;
20
- this.secretOrPublicKey = this.jwtProvider.secretOrPublicKey;
17
+ this.jwtOptions = { ...mergedDefaults, ...jwtOptions };
18
+ if (this.jwtOptions.jwks) {
19
+ (0, utils_1.validateJwksOptions)(this.jwtOptions);
20
+ this.secretOrKeyProviderFn = (0, utils_1.createSecretOrKeyProvider)(this.jwtOptions);
21
+ }
22
+ else {
23
+ this.jwtProvider = (0, utils_1.createJwtProvider)(this.jwtOptions);
24
+ this.secretOrPrivateKey = this.jwtProvider.secretOrPrivateKey;
25
+ this.secretOrPublicKey = this.jwtProvider.secretOrPublicKey;
26
+ }
21
27
  this.jwtFromRequestFunction = this.jwtOptions.jwtFromRequestFunction || passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken();
22
28
  this.ignoreExpiration = this.jwtOptions.ignoreExpiration;
23
29
  this.passReqToCallback = this.jwtOptions.passReqToCallback;
24
30
  }
25
31
  getStrategyOptions() {
32
+ var _a;
26
33
  const partialOptions = {
27
34
  ignoreExpiration: this.ignoreExpiration,
28
35
  ...(this.jwtOptions.issuer && { issuer: this.jwtOptions.issuer }),
29
36
  ...(this.jwtOptions.audience && { audience: this.jwtOptions.audience }),
37
+ ...(this.jwtOptions.jwks && { algorithms: (_a = this.jwtOptions.jwks.algorithms) !== null && _a !== void 0 ? _a : ['RS256'] }),
30
38
  };
39
+ const keyConfig = this.secretOrKeyProviderFn
40
+ ? { secretOrKeyProvider: this.secretOrKeyProviderFn }
41
+ : { secretOrKey: this.secretOrPublicKey };
31
42
  if (this.passReqToCallback) {
32
43
  return {
33
44
  ...partialOptions,
45
+ ...keyConfig,
34
46
  jwtFromRequest: this.jwtFromRequestFunction,
35
- secretOrKey: this.secretOrPublicKey,
36
47
  passReqToCallback: true,
37
48
  };
38
49
  }
39
50
  return {
40
51
  ...partialOptions,
52
+ ...keyConfig,
41
53
  jwtFromRequest: this.jwtFromRequestFunction,
42
- secretOrKey: this.secretOrPublicKey,
43
54
  passReqToCallback: false,
44
55
  };
45
56
  }
46
57
  sign(payload, options) {
58
+ if (!this.jwtProvider) {
59
+ throw new Error('sign() not supported in JWKS mode — JWKS strategies are verify-only');
60
+ }
47
61
  return this.jwtProvider.sign(payload, options);
48
62
  }
49
63
  verify(token, verifyOption) {
64
+ if (!this.jwtProvider) {
65
+ throw new Error('verify() not supported in JWKS mode — use the passport-jwt strategy for verification');
66
+ }
50
67
  return this.jwtProvider.verify(token, verifyOption);
51
68
  }
52
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base-jwt-strategy-provider.js","sourceRoot":"","sources":["../../lib/strategy/base-jwt-strategy-provider.ts"],"names":[],"mappings":";;;AACA,+CAA8I;AAG9I,0CAAmD;AAenD,MAAsB,uBAAuB;IAU3C,YAAY,UAAsB,EAAE,cAAoC;QACtE,MAAM,YAAY,GAAwB;YACxC,MAAM,EAAE,KAAK;YACb,mBAAmB,EAAE,IAAI;YACzB,gBAAgB,EAAE,IAAI;Y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GAAG,SAAS;gBACZ,cAAc,EAAE,IAAI,CAAC,sBAAsB;gBAC3C,iBAAiB,EAAE,IAAI;aACM,CAAC;QAClC,CAAC;QAED,OAAO;YACL,GAAG,cAAc;YACjB,GAAG,SAAS;YACZ,cAAc,EAAE,IAAI,CAAC,sBAAsB;YAC3C,iBAAiB,EAAE,KAAK;SACQ,CAAC;IACrC,CAAC;IAMD,IAAI,CAAC,OAAiC,EAAE,OAAyB;QAC/D,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAMD,MAAM,CAAC,KAAa,EAAE,YAAgC;QACpD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,sFAAsF,CAAC,CAAC;QAC1G,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACtD,CAAC;CAMF;AAjGD,0DAiGC"}
@@ -2,7 +2,8 @@ import { JwtRefreshStrategy } from "./jwt-refresh-strategy";
2
2
  import { DefaultJwtRefreshStrategyProvider, JwtRefreshStrategyProvider } from "./jwt-refresh-strategy-provider";
3
3
  import { JwtStrategy } from "./jwt-strategy";
4
4
  import { DefaultJwtStrategyProvider, JwtStrategyProvider, SimpleJwtStrategyProvider } from "./jwt-strategy-provider";
5
+ import { JwksJwtStrategyProvider, createJwksStrategyProvider } from "./jwks-jwt-strategy-provider";
5
6
  import { StrategyProvider } from "./strategy-provider";
6
- import { JwtNestJsOptions, JwtOptions, JwtPayload, Req, VerifyOptions } from "./type-interface";
7
+ import { JwksOptions, JwtNestJsOptions, JwtOptions, JwtPayload, Req, VerifyOptions } from "./type-interface";
7
8
  import { BaseJwtStrategyProvider } from "./base-jwt-strategy-provider";
8
- export { Req, JwtOptions, JwtPayload, JwtNestJsOptions, VerifyOptions, StrategyProvider, BaseJwtStrategyProvider, JwtStrategyProvider, DefaultJwtStrategyProvider, SimpleJwtStrategyProvider, JwtRefreshStrategyProvider, DefaultJwtRefreshStrategyProvider, JwtStrategy, JwtRefreshStrategy, };
9
+ export { Req, JwtOptions, JwtPayload, JwtNestJsOptions, JwksOptions, VerifyOptions, StrategyProvider, BaseJwtStrategyProvider, JwtStrategyProvider, DefaultJwtStrategyProvider, SimpleJwtStrategyProvider, JwksJwtStrategyProvider, createJwksStrategyProvider, JwtRefreshStrategyProvider, DefaultJwtRefreshStrategyProvider, JwtStrategy, JwtRefreshStrategy, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JwtRefreshStrategy = exports.JwtStrategy = exports.DefaultJwtRefreshStrategyProvider = exports.JwtRefreshStrategyProvider = exports.SimpleJwtStrategyProvider = exports.DefaultJwtStrategyProvider = exports.JwtStrategyProvider = exports.BaseJwtStrategyProvider = exports.StrategyProvider = void 0;
3
+ exports.JwtRefreshStrategy = exports.JwtStrategy = exports.DefaultJwtRefreshStrategyProvider = exports.JwtRefreshStrategyProvider = exports.createJwksStrategyProvider = exports.JwksJwtStrategyProvider = exports.SimpleJwtStrategyProvider = exports.DefaultJwtStrategyProvider = exports.JwtStrategyProvider = exports.BaseJwtStrategyProvider = exports.StrategyProvider = void 0;
4
4
  const jwt_refresh_strategy_1 = require("./jwt-refresh-strategy");
5
5
  Object.defineProperty(exports, "JwtRefreshStrategy", { enumerable: true, get: function () { return jwt_refresh_strategy_1.JwtRefreshStrategy; } });
6
6
  const jwt_refresh_strategy_provider_1 = require("./jwt-refresh-strategy-provider");
@@ -12,6 +12,9 @@ const jwt_strategy_provider_1 = require("./jwt-strategy-provider");
12
12
  Object.defineProperty(exports, "DefaultJwtStrategyProvider", { enumerable: true, get: function () { return jwt_strategy_provider_1.DefaultJwtStrategyProvider; } });
13
13
  Object.defineProperty(exports, "JwtStrategyProvider", { enumerable: true, get: function () { return jwt_strategy_provider_1.JwtStrategyProvider; } });
14
14
  Object.defineProperty(exports, "SimpleJwtStrategyProvider", { enumerable: true, get: function () { return jwt_strategy_provider_1.SimpleJwtStrategyProvider; } });
15
+ const jwks_jwt_strategy_provider_1 = require("./jwks-jwt-strategy-provider");
16
+ Object.defineProperty(exports, "JwksJwtStrategyProvider", { enumerable: true, get: function () { return jwks_jwt_strategy_provider_1.JwksJwtStrategyProvider; } });
17
+ Object.defineProperty(exports, "createJwksStrategyProvider", { enumerable: true, get: function () { return jwks_jwt_strategy_provider_1.createJwksStrategyProvider; } });
15
18
  const strategy_provider_1 = require("./strategy-provider");
16
19
  Object.defineProperty(exports, "StrategyProvider", { enumerable: true, get: function () { return strategy_provider_1.StrategyProvider; } });
17
20
  const base_jwt_strategy_provider_1 = require("./base-jwt-strategy-provider");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/strategy/index.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAuB1D,mGAvBO,yCAAkB,OAuBP;AAtBpB,mFAAgH;AAoB9G,kHApBO,iEAAiC,OAoBP;AADjC,2GAnB0C,0DAA0B,OAmB1C;AAlB5B,iDAA6C;AAoB3C,4FApBO,0BAAW,OAoBP;AAnBb,mEAAqH;AAenH,2GAfO,kDAA0B,OAeP;AAD1B,oGAdmC,2CAAmB,OAcnC;AAEnB,0GAhBwD,iDAAyB,OAgBxD;AAf3B,2DAAuD;AAWrD,iGAXO,oCAAgB,OAWP;AATlB,6EAAuE;AAUrE,wGAVO,oDAAuB,OAUP"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/strategy/index.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AA2B1D,mGA3BO,yCAAkB,OA2BP;AA1BpB,mFAAgH;AAwB9G,kHAxBO,iEAAiC,OAwBP;AADjC,2GAvB0C,0DAA0B,OAuB1C;AAtB5B,iDAA6C;AAwB3C,4FAxBO,0BAAW,OAwBP;AAvBb,mEAAqH;AAiBnH,2GAjBO,kDAA0B,OAiBP;AAD1B,oGAhBmC,2CAAmB,OAgBnC;AAEnB,0GAlBwD,iDAAyB,OAkBxD;AAjB3B,6EAAmG;AAkBjG,wGAlBO,oDAAuB,OAkBP;AACvB,2GAnBgC,uDAA0B,OAmBhC;AAlB5B,2DAAuD;AAYrD,iGAZO,oCAAgB,OAYP;AAVlB,6EAAuE;AAWrE,wGAXO,oDAAuB,OAWP"}
@@ -0,0 +1,8 @@
1
+ import { FactoryProvider } from '@nestjs/common';
2
+ import { DefaultJwtStrategyProvider } from './jwt-strategy-provider';
3
+ import { JwtOptions } from './type-interface';
4
+ import { AuthProvider } from '../auth-provider';
5
+ export declare class JwksJwtStrategyProvider extends DefaultJwtStrategyProvider {
6
+ constructor(jwtOptions: JwtOptions, authProvider: AuthProvider);
7
+ }
8
+ export declare const createJwksStrategyProvider: () => FactoryProvider;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createJwksStrategyProvider = exports.JwksJwtStrategyProvider = void 0;
4
+ const jwt_strategy_provider_1 = require("./jwt-strategy-provider");
5
+ const module_constant_1 = require("../constant/module-constant");
6
+ class JwksJwtStrategyProvider extends jwt_strategy_provider_1.DefaultJwtStrategyProvider {
7
+ constructor(jwtOptions, authProvider) {
8
+ if (!jwtOptions.jwks) {
9
+ throw new Error('JwksJwtStrategyProvider requires jwtOptions.jwks to be configured');
10
+ }
11
+ super(jwtOptions, authProvider);
12
+ }
13
+ }
14
+ exports.JwksJwtStrategyProvider = JwksJwtStrategyProvider;
15
+ const createJwksStrategyProvider = () => ({
16
+ provide: jwt_strategy_provider_1.JwtStrategyProvider,
17
+ useFactory: (jwtOptions, authProvider) => new JwksJwtStrategyProvider(jwtOptions, authProvider),
18
+ inject: [module_constant_1.JWT_OPTIONS, module_constant_1.AUTH_PROVIDER],
19
+ });
20
+ exports.createJwksStrategyProvider = createJwksStrategyProvider;
21
+ //# sourceMappingURL=jwks-jwt-strategy-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwks-jwt-strategy-provider.js","sourceRoot":"","sources":["../../lib/strategy/jwks-jwt-strategy-provider.ts"],"names":[],"mappings":";;;AACA,mEAA0F;AAG1F,iEAAyE;AA2BzE,MAAa,uBAAwB,SAAQ,kDAA0B;IACrE,YAAY,UAAsB,EAAE,YAA0B;QAC5D,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACvF,CAAC;QACD,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAClC,CAAC;CACF;AAPD,0DAOC;AAkBM,MAAM,0BAA0B,GAAG,GAAoB,EAAE,CAAC,CAAC;IAChE,OAAO,EAAE,2CAAmB;IAC5B,UAAU,EAAE,CAAC,UAAsB,EAAE,YAA0B,EAAE,EAAE,CACjE,IAAI,uBAAuB,CAAC,UAAU,EAAE,YAAY,CAAC;IACvD,MAAM,EAAE,CAAC,6BAAW,EAAE,+BAAa,CAAC;CACrC,CAAC,CAAC;AALU,QAAA,0BAA0B,8BAKpC"}
@@ -1,6 +1,17 @@
1
1
  import * as jwt from 'jsonwebtoken';
2
+ import type { Algorithm } from 'jsonwebtoken';
2
3
  import { JwtOptions as jOption } from "@nathapp/auth";
3
4
  import { JwtFromRequestFunction } from "passport-jwt";
5
+ export interface JwksOptions {
6
+ jwksUri: string;
7
+ cache?: boolean;
8
+ cacheMaxEntries?: number;
9
+ cacheMaxAge?: number;
10
+ rateLimit?: boolean;
11
+ jwksRequestsPerMinute?: number;
12
+ algorithms?: Algorithm[];
13
+ allowInsecure?: boolean;
14
+ }
4
15
  export interface JwtNestJsOptions {
5
16
  bindIp?: boolean;
6
17
  allowDuplicateLogin?: boolean;
@@ -11,6 +22,7 @@ export interface JwtNestJsOptions {
11
22
  isBase64AsymmetricKey?: boolean;
12
23
  issuer?: string;
13
24
  audience?: string | string[];
25
+ jwks?: JwksOptions;
14
26
  }
15
27
  export declare type JwtOptions = JwtNestJsOptions & jOption;
16
28
  export declare type VerifyOptions = jwt.VerifyOptions;
@@ -8,3 +8,5 @@ export declare const isCaslPermissionAction: (val: any) => boolean;
8
8
  export declare const isRequiredCaslPermission: (permission: PermissionType) => boolean;
9
9
  export declare const createJwtProvider: (jwtOptions: JwtOptions) => JwtProvider;
10
10
  export declare const isAsymmetricAlgo: (algo: string | Algorithm) => boolean;
11
+ export declare const createSecretOrKeyProvider: (jwtOptions: JwtOptions) => any;
12
+ export declare const validateJwksOptions: (jwtOptions: JwtOptions) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAsymmetricAlgo = exports.createJwtProvider = exports.isRequiredCaslPermission = exports.isCaslPermissionAction = exports.isAuthority = exports.isCaslPermission = void 0;
3
+ exports.validateJwksOptions = exports.createSecretOrKeyProvider = exports.isAsymmetricAlgo = exports.createJwtProvider = exports.isRequiredCaslPermission = exports.isCaslPermissionAction = exports.isAuthority = exports.isCaslPermission = void 0;
4
4
  const auth_1 = require("@nathapp/auth");
5
5
  const permission_1 = require("../permission");
6
6
  const isCaslPermission = (val) => {
@@ -53,4 +53,59 @@ const isAsymmetricAlgo = (algo) => {
53
53
  }
54
54
  };
55
55
  exports.isAsymmetricAlgo = isAsymmetricAlgo;
56
+ const createSecretOrKeyProvider = (jwtOptions) => {
57
+ var _a, _b, _c, _d, _e, _f;
58
+ if (!jwtOptions.jwks) {
59
+ throw new Error('createSecretOrKeyProvider called without jwks options');
60
+ }
61
+ let passportJwtSecret;
62
+ try {
63
+ passportJwtSecret = require('jwks-rsa').passportJwtSecret;
64
+ }
65
+ catch (err) {
66
+ const installError = new Error('jwks-rsa is not installed. Install it to use JWKS: npm install jwks-rsa');
67
+ installError.cause = err;
68
+ throw installError;
69
+ }
70
+ const jwks = jwtOptions.jwks;
71
+ return passportJwtSecret({
72
+ jwksUri: jwks.jwksUri,
73
+ cache: (_a = jwks.cache) !== null && _a !== void 0 ? _a : true,
74
+ cacheMaxEntries: (_b = jwks.cacheMaxEntries) !== null && _b !== void 0 ? _b : 5,
75
+ cacheMaxAge: (_c = jwks.cacheMaxAge) !== null && _c !== void 0 ? _c : 600000,
76
+ rateLimit: (_d = jwks.rateLimit) !== null && _d !== void 0 ? _d : true,
77
+ jwksRequestsPerMinute: (_e = jwks.jwksRequestsPerMinute) !== null && _e !== void 0 ? _e : 10,
78
+ allowedSigningAlgorithms: (_f = jwks.algorithms) !== null && _f !== void 0 ? _f : ['RS256'],
79
+ });
80
+ };
81
+ exports.createSecretOrKeyProvider = createSecretOrKeyProvider;
82
+ const validateJwksOptions = (jwtOptions) => {
83
+ var _a;
84
+ const jwks = jwtOptions.jwks;
85
+ if (!jwks)
86
+ return;
87
+ if (!jwks.jwksUri || typeof jwks.jwksUri !== 'string') {
88
+ throw new Error('jwks.jwksUri is required and must be a non-empty string');
89
+ }
90
+ if (!jwtOptions.issuer) {
91
+ throw new Error('jwks: issuer is required when jwks is configured. ' +
92
+ 'JWKS without issuer pinning accepts any token signed by any key the URI serves.');
93
+ }
94
+ const isHttps = jwks.jwksUri.startsWith('https://');
95
+ if (!isHttps && !jwks.allowInsecure) {
96
+ throw new Error(`jwks.jwksUri must use https (got: ${jwks.jwksUri}). ` +
97
+ 'Set jwks.allowInsecure=true only for local development.');
98
+ }
99
+ const algorithms = (_a = jwks.algorithms) !== null && _a !== void 0 ? _a : ['RS256'];
100
+ for (const algo of algorithms) {
101
+ if (algo.toLowerCase() === 'none') {
102
+ throw new Error('jwks.algorithms must not include "none"');
103
+ }
104
+ if (typeof algo === 'string' && algo.startsWith('HS')) {
105
+ throw new Error(`jwks.algorithms must not include HMAC algorithms (got: ${algo}). ` +
106
+ 'Accepting HMAC against a public key enables the key-confusion attack.');
107
+ }
108
+ }
109
+ };
110
+ exports.validate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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nestjs-auth",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "nestjs-auth",
5
5
  "scripts": {
6
6
  "clean": "rimraf dist/ .turbo/",
@@ -18,6 +18,7 @@
18
18
  "@nathapp/typescript-config": "1.0.1",
19
19
  "@types/passport-jwt": "^4.0.1",
20
20
  "eslint": "^8.57.0",
21
+ "jwks-rsa": "^3.2.2",
21
22
  "typescript": "^5"
22
23
  },
23
24
  "types": "dist/index.d.ts",
@@ -30,9 +31,15 @@
30
31
  "passport-jwt": "^4.0.1"
31
32
  },
32
33
  "peerDependencies": {
34
+ "@casl/ability": "^6.7.1",
33
35
  "@nathapp/auth": "^1.0.2",
34
36
  "@nathapp/nestjs-common": "^3.0.0",
35
37
  "@nestjs/passport": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
36
- "@casl/ability": "^6.7.1"
38
+ "jwks-rsa": "^3.2.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "jwks-rsa": {
42
+ "optional": true
43
+ }
37
44
  }
38
45
  }