@nathapp/nestjs-auth-2fa 4.0.0 → 4.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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @nathapp/nestjs-auth-2fa@4.0.0 build
2
+ > @nathapp/nestjs-auth-2fa@4.0.1 build
3
3
  > rimraf dist && tsc -p tsconfig.json
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nestjs-auth-2fa",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "nestjs-auth-2fa",
5
5
  "scripts": {
6
6
  "clean": "rimraf dist/ .turbo/",
@@ -32,8 +32,8 @@
32
32
  "lib": "lib"
33
33
  },
34
34
  "dependencies": {
35
- "@nathapp/nestjs-auth": "^4.0.0",
36
- "@nathapp/nestjs-common": "^4.0.0"
35
+ "@nathapp/nestjs-auth": "^4.0.1",
36
+ "@nathapp/nestjs-common": "^4.0.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@nathapp/nestjs-auth": "^4.0.0-rc.0",
package/.eslintrc.js DELETED
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- project: 'tsconfig.json',
5
- sourceType: 'module',
6
- },
7
- plugins: ['@typescript-eslint/eslint-plugin'],
8
- extends: [
9
- 'plugin:@typescript-eslint/recommended',
10
- 'plugin:prettier/recommended',
11
- ],
12
- root: true,
13
- env: {
14
- node: true,
15
- jest: true,
16
- },
17
- ignorePatterns: ['.eslintrc.js'],
18
- rules: {
19
- '@typescript-eslint/interface-name-prefix': 'off',
20
- '@typescript-eslint/explicit-function-return-type': 'off',
21
- '@typescript-eslint/explicit-module-boundary-types': 'off',
22
- '@typescript-eslint/no-explicit-any': 'off',
23
- },
24
- };
package/CHANGELOG.md DELETED
@@ -1,447 +0,0 @@
1
- # @nathapp/nestjs-auth-2fa
2
-
3
- ## 4.0.0
4
-
5
- ### Major Changes
6
-
7
- - 2319e9d: BREAKING: drop NestJS 8/9 peer ranges and require Node ^20.19.0 || >=22.12.0. Support NestJS 12. Peer ranges now cover NestJS 10, 11 and 12 (Node ^20.19.0 || >=22.12.0 is required because NestJS 12 is ESM-only). The configurable module builder no longer deep-imports a directory that is unresolvable on NestJS 12, and TwoFactorGuard / TwoFactorForceGuard redeclare their constructor DI metadata because NestJS 12 no longer inherits @Optional() from base classes.
8
-
9
- Other consumer-facing changes:
10
-
11
- - `@nathapp/nestjs-health`: `@nestjs/terminus` moved from `dependencies` to `peerDependencies` (`^11.0.0 || ^12.0.0`) so NestJS 12 apps can use terminus 12. Install `@nestjs/terminus` in your app.
12
- - Optional-package loading (`loadPackage`) now throws a descriptive `Error` (original error on `cause`) instead of logging and calling `process.exit(1)` when an optional package is missing.
13
-
14
- ### Patch Changes
15
-
16
- - Updated dependencies [668055b]
17
- - Updated dependencies [2319e9d]
18
- - @nathapp/nestjs-common@4.0.0
19
- - @nathapp/nestjs-auth@4.0.0
20
-
21
- ## 4.0.0-rc.0
22
-
23
- ### Major Changes
24
-
25
- - c3aeb46: BREAKING: drop NestJS 8/9 peer ranges and require Node ^20.19.0 || >=22.12.0. Support NestJS 12. Peer ranges now cover NestJS 10, 11 and 12 (Node ^20.19.0 || >=22.12.0 is required because NestJS 12 is ESM-only). The configurable module builder no longer deep-imports a directory that is unresolvable on NestJS 12, and TwoFactorGuard / TwoFactorForceGuard redeclare their constructor DI metadata because NestJS 12 no longer inherits @Optional() from base classes.
26
-
27
- Other consumer-facing changes:
28
-
29
- - `@nathapp/nestjs-health`: `@nestjs/terminus` moved from `dependencies` to `peerDependencies` (`^11.0.0 || ^12.0.0`) so NestJS 12 apps can use terminus 12. Install `@nestjs/terminus` in your app.
30
- - Optional-package loading (`loadPackage`) now throws a descriptive `Error` (original error on `cause`) instead of logging and calling `process.exit(1)` when an optional package is missing.
31
-
32
- ### Patch Changes
33
-
34
- - Updated dependencies [c3aeb46]
35
- - @nathapp/nestjs-auth@4.0.0-rc.0
36
- - @nathapp/nestjs-common@4.0.0-rc.0
37
-
38
- ## 3.3.0
39
-
40
- ### Patch Changes
41
-
42
- - @nathapp/nestjs-auth@3.3.0
43
- - @nathapp/nestjs-common@3.3.0
44
-
45
- ## 3.2.1
46
-
47
- ### Patch Changes
48
-
49
- - 0610b83: Fix Exception Bug on nestjs-common
50
- - Updated dependencies [0610b83]
51
- - @nathapp/nestjs-auth@3.2.1
52
- - @nathapp/nestjs-common@3.2.1
53
-
54
- ## 3.2.0
55
-
56
- ### Minor Changes
57
-
58
- - 1876b9a: ### nestjs-auth
59
-
60
- - Add JWKS support via `JwksJwtStrategyProvider` and `createJwksStrategyProvider` factory — enables remote key resolution through `jwks-rsa` (optional peer dep)
61
- - Add `validateJwksOptions` security guard and `JwksOptions` interface
62
- - Export `JwksJwtStrategyProvider` and `JwksOptions` from the public API
63
- - Fix permission guard and JWT module immutability issues from code review
64
-
65
- ### nestjs-typeorm
66
-
67
- - Add `AbstractTypeOrmRepository<TDomain, TEntity, TId>` — portable `IRepository` implementation decoupled from TypeORM internals
68
- - Add `TYPEORM_TRANSACTION_ALS` DI token and publish it from `forRoot`/`forRootAsync`
69
- - `forCustomRepository` now instantiates `AbstractTypeOrmRepository` subclasses with the correct per-DataSource tx manager token
70
- - Add `getTypeOrmTransactionManagerToken(name?)` helper for multi-DataSource wiring
71
- - Named DataSource tx tokens no longer collide; default DataSource still aliases the global `TRANSACTION_MANAGER` symbol
72
-
73
- ### nestjs-prisma
74
-
75
- - Add `getPrismaTransactionManagerToken(name?)` helper for multi-DataSource wiring
76
- - `forRoot` / `forRootAsync` register named tx manager token + default-only guard to prevent collision
77
-
78
- ### nestjs-data
79
-
80
- - Add `IRepository<TDomain, TId>` portable repository contract
81
- - Fix missing `@nathapp/nestjs-common` peer dep for turborepo build resolution
82
-
83
- ### nestjs-common
84
-
85
- - Add `request-ip` utility for extracting client IP across Express and Fastify adapters
86
-
87
- ### nestjs-cache
88
-
89
- - Fix cache interceptor, cache manager, and cache tag registry immutability and type issues
90
-
91
- ### nestjs-app
92
-
93
- - Fix `nathapp.ts` and `app-factory.ts` code review findings (immutability, error handling)
94
-
95
- ### nestjs-queue
96
-
97
- - Upgrade `uuid` dependency from `^9.0.0` to `^11.1.1` (security)
98
- - Fix BullMQ health check to use `IRedisClient.info()` (aligned with BullMQ interface)
99
-
100
- ### nestjs-notification
101
-
102
- - Upgrade `nodemailer` dev dep from `^7` to `^8` — resolves SMTP command injection CVEs (GHSA-c7w3-x93f-qmm8, GHSA-vvjj-xcjg-gr5g)
103
-
104
- ### nestjs-storage
105
-
106
- - Fix code review findings (immutability, validation)
107
-
108
- ### nestjs-throttler
109
-
110
- - Fix code review findings
111
-
112
- ### All packages
113
-
114
- - Upgrade AJV to v8 (removes root override that broke `@fastify/ajv-compiler`)
115
- - Align all package versions to 3.1.3 as baseline for this minor release
116
-
117
- ### Patch Changes
118
-
119
- - Updated dependencies [1876b9a]
120
- - @nathapp/nestjs-auth@3.2.0
121
- - @nathapp/nestjs-common@3.2.0
122
-
123
- ## 3.0.0
124
-
125
- ### Major Changes
126
-
127
- - 86a36b8: # 🚀 v3.0.0 Monorepo Enterprise Upgrade
128
-
129
- This release brings significant security hardening, strict typing, improved observability, and comprehensive documentation across the entire Nathapp NestJS ecosystem.
130
-
131
- ## ⚠️ Breaking Changes
132
-
133
- ### nestjs-common
134
-
135
- - **Trust Proxy (Fail-Closed)**: Trust proxy is now disabled by default. Production deployments behind a reverse proxy MUST configure `trustedProxies` or use a preset (`cloudflare`, `aws-alb`, `nginx-local`, etc.). See `docs/trust-proxy-security.md`.
136
- - **SerializableInterceptor**: Now uses pure transformation — original response objects are no longer mutated. Primitives in arrays are preserved correctly.
137
- - **AppException**: Now generic `AppException<T>` for strict argument typing.
138
-
139
- ### nestjs-logging
140
-
141
- - **Redaction**: Default redact paths are now constrained to 3 levels deep (`*.*.key`).
142
- - **Structured Logs**: Standardized field names for ELK/Loki/Datadog compatibility.
143
- - **Graceful Drain**: Logger now implements `OnModuleDestroy` to flush pending writes on shutdown.
144
-
145
- ### nestjs-typeorm
146
-
147
- - **Connection Validation**: `TypeOrmExModule.forRoot()` now throws `"Connection Not Supported"` when no valid connection type is provided (previously defaulted silently to MySQL).
148
-
149
- ## 🔒 Security
150
-
151
- - **nestjs-common**: Trust proxy fail-closed default prevents IP spoofing when misconfigured. Comprehensive security documentation with provider presets.
152
- - **nestjs-storage**: GDrive refreshToken security best practices documented. Provider capability matrix added.
153
- - **nestjs-throttler**: Documented that `getTracker()` executes synchronously — no async TOCTOU race condition in rate limiting.
154
- - **nestjs-typeorm**: Stored procedure name validation with whitelist pattern (`/^[a-zA-Z_][a-zA-Z0-9_.]*$/`) prevents SQL injection.
155
- - **nestjs-cache**: Tag registry now receives TTL for proper expiration of tag-to-key mappings.
156
- - **nestjs-microservices**: Fixed gRPC Bearer token extraction whitespace bug. Full test coverage for all guards.
157
- - **nestjs-auth-2fa**: Timing-safe TOTP verification prevents timing attacks.
158
-
159
- ## ✨ Features & Improvements
160
-
161
- - **nestjs-storage**: Added native support for **Azure Blob Storage** and **Google Cloud Storage**. Provider capability matrix documents supported methods per provider.
162
- - **nestjs-microservices**: Full guard coverage (100%), Service Identity JWT + HMAC authentication, `ServicePermissionRegistry` for fine-grained access control.
163
- - **nestjs-typeorm**: Automatic mapping of database errors to `AppException` via `TypeOrmExceptionFilter`.
164
- - **nestjs-auth-2fa**: `BaseTwoFactorGuard` with flexible policy engine. DI-aware provider factory with comprehensive architectural documentation.
165
- - **nestjs-cache**: Deep-cloning of cached objects to prevent cross-request state leakage. Touch fallback avoided for distributed strategies (race condition prevention).
166
- - **nestjs-queue**: Race-condition fixes in BullMQ/RabbitMQ batch accumulators.
167
- - **nestjs-prisma**: `PrismaExceptionFilter` and transaction helper. Parallel query execution validated.
168
- - **nestjs-auth**: Comprehensive JSDoc on all public APIs. All TODO comments resolved.
169
- - **nestjs-common**: `ConfigurableModuleBuilder` with `externallyConfigured()` support.
170
- - **Global**: 2,500+ tests across all 13 packages. Comprehensive JSDoc for all public APIs.
171
-
172
- ## 📚 Documentation
173
-
174
- - `nestjs-common/docs/trust-proxy-security.md` — IP spoofing risks, preset configurations, verification steps
175
- - `nestjs-storage/docs/gdrive-security.md` — refreshToken security best practices
176
- - `nestjs-storage/docs/provider-capabilities.md` — method support matrix per provider
177
- - All packages: JSDoc on public APIs, MIGRATION.md guides where applicable
178
-
179
- ### Patch Changes
180
-
181
- - Updated dependencies [86a36b8]
182
- - @nathapp/nestjs-common@3.0.0
183
- - @nathapp/nestjs-auth@3.0.0
184
-
185
- ## 3.0.0-rc.0
186
-
187
- ### Major Changes
188
-
189
- - # 🚀 v3.0.0-rc Monorepo Enterprise Upgrade
190
-
191
- This release brings significant security, reliability, and observability improvements across the entire Nathapp ecosystem.
192
-
193
- ## ⚠️ [BREAKING CHANGES]
194
-
195
- ### nestjs-common
196
-
197
- - **Trust Proxy (Fail-Closed)**: Trust proxy is now disabled by default. Production deployments MUST configure `trustedProxies` or use a preset (`cloudflare`, `aws-alb`, etc.).
198
- - **SerializableInterceptor**: Now uses pure transformation. Original response objects are no longer mutated.
199
- - **AppException**: Now generic `AppException<T>` for strict argument typing.
200
-
201
- ### nestjs-logging
202
-
203
- - **Redaction**: Default redact paths are now constrained to 3 levels deep (`*.*.key`).
204
- - **Structured Logs**: Standardized field names for ELK/Loki/Datadog compatibility.
205
-
206
- ## ✨ Features & Improvements
207
-
208
- - **nestjs-storage**: Added native support for **Azure Blob Storage** and **Google Cloud Storage**.
209
- - **nestjs-microservices**: Full guard coverage and secured gRPC Bearer token extraction.
210
- - **nestjs-typeorm**: Automatic mapping of database errors to `AppException`.
211
- - **nestjs-auth-2fa**: Timing-safe TOTP verification and flexible policy engine.
212
- - **nestjs-cache**: Deep-cloning of cached objects to prevent cross-request state leakage.
213
- - **nestjs-queue**: Race-condition fixes in BullMQ/RabbitMQ batch accumulators.
214
- - **nestjs-throttler**: Added async trust proxy support.
215
- - **Global**: Comprehensive JSDoc for all public APIs across all packages.
216
-
217
- ### Patch Changes
218
-
219
- - Updated dependencies
220
- - @nathapp/nestjs-common@3.0.0-rc.0
221
- - @nathapp/nestjs-auth@3.0.0-rc.0
222
-
223
- ## 2.1.5
224
-
225
- ### Patch Changes
226
-
227
- - # @nathapp/nestjs-notification v2.2.0 - Enterprise-Grade Upgrade
228
-
229
- Major enterprise enhancements to the notification system with 9 phases of improvements:
230
-
231
- ## New Features
232
-
233
- ### Phase 1: Pluggable Template Engine
234
-
235
- - `TemplateEngine` interface for custom template rendering
236
- - `StringFormatEngine` as default (backwards compatible)
237
- - Apps can now inject Handlebars, EJS, or custom engines
238
-
239
- ### Phase 2: Configurable Strict Mode
240
-
241
- - `strict: true` (default) throws errors when services aren't configured
242
- - `strict: false` for graceful degradation (returns `{ success: false }`)
243
- - Clear error messages via `NotificationConfigError`
244
-
245
- ### Phase 3: Unified `send()` Method
246
-
247
- - Single method dispatches to multiple channels
248
- - `NotificationPayload` with `channels: ['email', 'push', 'sms']`
249
- - Aggregated results across all channels
250
-
251
- ### Phase 4: Platform Alias
252
-
253
- - Added `platform` field (deprecated `paltform` typo)
254
- - Backwards compatible with fallback
255
-
256
- ### Phase 5: SMS Integration
257
-
258
- - `SmsService` wired into `NotificationModule`
259
- - `sendSms()` with full template support
260
- - Ready for provider packages (Twilio, SNS)
261
-
262
- ### Phase 6: Interceptors & Hooks
263
-
264
- - `NotificationInterceptor` interface
265
- - `beforeSend`, `afterSend`, `onError` hooks
266
- - Global logging, auditing, message modification
267
-
268
- ### Phase 7: WhatsApp Channel
269
-
270
- - `WhatsAppService` abstract class
271
- - `WhatsAppMessage` interface with Meta Business API support
272
- - Template-based WhatsApp notifications
273
-
274
- ### Phase 8: Channel Fallback
275
-
276
- - `fallback: ['sms']` on `NotificationPayload`
277
- - Auto-retry through fallback channels when primary fails
278
- - Interceptors receive `isFallback` + `failedChannel` context
279
-
280
- ### Phase 9: Unified Provider Registry (⚠️ Breaking)
281
-
282
- - Replaced per-channel modules with unified `providers` array
283
- - `NotificationProviderFactory` validates provider ↔ channel match
284
- - `NotificationModuleOptionsFactory` for async configuration
285
- - Simplified API: `NotificationModule.forRoot({ providers: [...] })`
286
-
287
- ## Breaking Changes (Phase 9)
288
-
289
- - `emailOptions` → removed (use `providers` array)
290
- - `pushNotificationOptions` → removed (use `providers` array)
291
- - `smsService` → removed (use `providers` array)
292
- - `whatsAppService` → removed (use `providers` array)
293
- - `EmailModule`, `PushNotificationModule` no longer exported from main index
294
-
295
- ## Migration Guide
296
-
297
- ### Before
298
-
299
- ```typescript
300
- NotificationModule.forRoot({
301
- emailOptions: EmailModule.forRoot({ option: { type: 'smtp', options: {...} } }),
302
- templateLoader: MyLoader,
303
- })
304
- ```
305
-
306
- ### After
307
-
308
- ```typescript
309
- NotificationModule.forRoot({
310
- providers: [
311
- {
312
- channel: "email",
313
- provider: SmtpEmailProvider,
314
- options: { url: "...", from: "..." },
315
- },
316
- ],
317
- templateLoader: MyLoader,
318
- });
319
- ```
320
-
321
- ## Stats
322
-
323
- - **159 tests** (all passing)
324
- - **88.5% code coverage**
325
- - Fully backwards compatible (except Phase 9 breaking changes)
326
-
327
- - Updated dependencies
328
- - @nathapp/nestjs-auth@2.1.5
329
- - @nathapp/nestjs-common@2.1.5
330
-
331
- ## 2.1.1
332
-
333
- ### Patch Changes
334
-
335
- - 1244520: fix: correct main/types paths to dist/ directory
336
- - Updated dependencies [1244520]
337
- - @nathapp/nestjs-auth@2.1.1
338
- - @nathapp/nestjs-common@2.1.1
339
-
340
- ## 3.0.0-rc.4
341
-
342
- ### Minor Changes
343
-
344
- - de7078f: bump version
345
-
346
- ### Patch Changes
347
-
348
- - Updated dependencies [de7078f]
349
- - @nathapp/nestjs-auth@3.0.0-rc.4
350
- - @nathapp/nestjs-common@3.0.0-rc.4
351
-
352
- ## 2.0.4
353
-
354
- ### Patch Changes
355
-
356
- - 65148c4: security patch
357
- - Updated dependencies [65148c4]
358
- - @nathapp/nestjs-auth@2.0.4
359
- - @nathapp/nestjs-common@2.0.4
360
-
361
- ## 2.0.3
362
-
363
- ### Patch Changes
364
-
365
- - 9da9d5a: add createClassTypeOrAsyncOptionsProvider, createAsyncOptionsProvider
366
- - Updated dependencies [9da9d5a]
367
- - @nathapp/nestjs-common@2.0.3
368
- - @nathapp/nestjs-auth@2.0.3
369
-
370
- ## 2.0.3-rc.0
371
-
372
- ### Patch Changes
373
-
374
- - 9da9d5a: add createClassTypeOrAsyncOptionsProvider, createAsyncOptionsProvider
375
- - Updated dependencies [9da9d5a]
376
- - @nathapp/nestjs-common@2.0.3-rc.0
377
- - @nathapp/nestjs-auth@2.0.3-rc.0
378
-
379
- ## 2.0.2
380
-
381
- ### Patch Changes
382
-
383
- - 07fb6ad: fix nathapp i18nService & patch package security
384
-
385
- ## 2.0.1-rc.1
386
-
387
- ### Patch Changes
388
-
389
- - 07fb6ad: fix nathapp i18nService & patch package security
390
-
391
- ## 2.0.1-rc.0
392
-
393
- ### Patch Changes
394
-
395
- - Updated dependencies [ea53607]
396
- - @nathapp/nestjs-common@2.0.1-rc.0
397
- - @nathapp/nestjs-auth@2.0.1-rc.0
398
-
399
- ## 2.0.0
400
-
401
- ### Major Changes
402
-
403
- - c8d545b: upgrade to nestjs 11
404
-
405
- ### Patch Changes
406
-
407
- - Updated dependencies [c8d545b]
408
- - @nathapp/nestjs-common@2.0.0
409
- - @nathapp/nestjs-auth@2.0.0
410
-
411
- ## 2.0.0-rc.0
412
-
413
- ### Major Changes
414
-
415
- - c8d545b: upgrade to nestjs 11
416
-
417
- ### Patch Changes
418
-
419
- - Updated dependencies [c8d545b]
420
- - @nathapp/nestjs-common@2.0.0-rc.0
421
- - @nathapp/nestjs-auth@2.0.0-rc.0
422
-
423
- ## 1.0.0
424
-
425
- ### Patch Changes
426
-
427
- - 7e62204: fix two factor bug
428
- - 5370d3a: Add Two Factor Module & Two Factor Exception
429
- - 748e227: make otplib as optional
430
-
431
- ## 1.0.0-rc.3
432
-
433
- ### Patch Changes
434
-
435
- - 748e227: make otplib as optional
436
-
437
- ## 1.0.0-rc.2
438
-
439
- ### Patch Changes
440
-
441
- - 7e62204: fix two factor bug
442
-
443
- ## 1.0.0-rc.1
444
-
445
- ### Patch Changes
446
-
447
- - 5370d3a: Add Two Factor Module & Two Factor Exception