@skyapp-labs/blueprint-backend-core 1.8.0 → 1.9.0

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +56 -4
  2. package/dist/modules/auth/controllers/auth.controller.d.ts +2 -2
  3. package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -1
  4. package/dist/modules/auth/controllers/auth.controller.js +52 -12
  5. package/dist/modules/auth/controllers/auth.controller.js.map +1 -1
  6. package/dist/modules/auth/controllers/forgot-password.controller.d.ts.map +1 -1
  7. package/dist/modules/auth/controllers/forgot-password.controller.js +3 -1
  8. package/dist/modules/auth/controllers/forgot-password.controller.js.map +1 -1
  9. package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -1
  10. package/dist/modules/auth/controllers/otp.controller.js +44 -35
  11. package/dist/modules/auth/controllers/otp.controller.js.map +1 -1
  12. package/dist/modules/auth/controllers/pin.controller.d.ts.map +1 -1
  13. package/dist/modules/auth/controllers/pin.controller.js +17 -8
  14. package/dist/modules/auth/controllers/pin.controller.js.map +1 -1
  15. package/dist/modules/auth/controllers/session.controller.d.ts.map +1 -1
  16. package/dist/modules/auth/controllers/session.controller.js +1 -3
  17. package/dist/modules/auth/controllers/session.controller.js.map +1 -1
  18. package/dist/modules/auth/dto/index.d.ts +0 -1
  19. package/dist/modules/auth/dto/index.d.ts.map +1 -1
  20. package/dist/modules/auth/dto/index.js +0 -1
  21. package/dist/modules/auth/dto/index.js.map +1 -1
  22. package/dist/modules/auth/dto/login.dto.d.ts.map +1 -1
  23. package/dist/modules/auth/dto/login.dto.js +11 -3
  24. package/dist/modules/auth/dto/login.dto.js.map +1 -1
  25. package/dist/modules/auth/dto/otp.dto.d.ts +22 -0
  26. package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -1
  27. package/dist/modules/auth/dto/otp.dto.js +93 -4
  28. package/dist/modules/auth/dto/otp.dto.js.map +1 -1
  29. package/dist/modules/auth/dto/password.dto.d.ts.map +1 -1
  30. package/dist/modules/auth/dto/password.dto.js +3 -2
  31. package/dist/modules/auth/dto/password.dto.js.map +1 -1
  32. package/dist/modules/auth/dto/register.dto.d.ts.map +1 -1
  33. package/dist/modules/auth/dto/register.dto.js +9 -3
  34. package/dist/modules/auth/dto/register.dto.js.map +1 -1
  35. package/dist/modules/auth/dto/token.dto.d.ts +5 -0
  36. package/dist/modules/auth/dto/token.dto.d.ts.map +1 -1
  37. package/dist/modules/auth/dto/token.dto.js +25 -2
  38. package/dist/modules/auth/dto/token.dto.js.map +1 -1
  39. package/dist/modules/auth/services/pin-auth.service.d.ts.map +1 -1
  40. package/dist/modules/auth/services/pin-auth.service.js +11 -4
  41. package/dist/modules/auth/services/pin-auth.service.js.map +1 -1
  42. package/dist/modules/sessions/services/token.service.d.ts.map +1 -1
  43. package/dist/modules/sessions/services/token.service.js +8 -3
  44. package/dist/modules/sessions/services/token.service.js.map +1 -1
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +1 -1
  47. package/dist/modules/auth/dto/forgot-password.dto.d.ts +0 -12
  48. package/dist/modules/auth/dto/forgot-password.dto.d.ts.map +0 -1
  49. package/dist/modules/auth/dto/forgot-password.dto.js +0 -45
  50. package/dist/modules/auth/dto/forgot-password.dto.js.map +0 -1
  51. package/dist/modules/auth/dto/invite.dto.d.ts +0 -7
  52. package/dist/modules/auth/dto/invite.dto.d.ts.map +0 -1
  53. package/dist/modules/auth/dto/invite.dto.js +0 -39
  54. package/dist/modules/auth/dto/invite.dto.js.map +0 -1
  55. package/dist/modules/auth/dto/login-email.dto.d.ts +0 -5
  56. package/dist/modules/auth/dto/login-email.dto.d.ts.map +0 -1
  57. package/dist/modules/auth/dto/login-email.dto.js +0 -26
  58. package/dist/modules/auth/dto/login-email.dto.js.map +0 -1
  59. package/dist/modules/auth/dto/login-phone.dto.d.ts +0 -7
  60. package/dist/modules/auth/dto/login-phone.dto.d.ts.map +0 -1
  61. package/dist/modules/auth/dto/login-phone.dto.js +0 -39
  62. package/dist/modules/auth/dto/login-phone.dto.js.map +0 -1
  63. package/dist/modules/auth/dto/refresh-token.dto.d.ts +0 -4
  64. package/dist/modules/auth/dto/refresh-token.dto.d.ts.map +0 -1
  65. package/dist/modules/auth/dto/refresh-token.dto.js +0 -21
  66. package/dist/modules/auth/dto/refresh-token.dto.js.map +0 -1
  67. package/dist/modules/auth/dto/register-email.dto.d.ts +0 -7
  68. package/dist/modules/auth/dto/register-email.dto.d.ts.map +0 -1
  69. package/dist/modules/auth/dto/register-email.dto.js +0 -34
  70. package/dist/modules/auth/dto/register-email.dto.js.map +0 -1
  71. package/dist/modules/auth/dto/register-phone.dto.d.ts +0 -9
  72. package/dist/modules/auth/dto/register-phone.dto.d.ts.map +0 -1
  73. package/dist/modules/auth/dto/register-phone.dto.js +0 -46
  74. package/dist/modules/auth/dto/register-phone.dto.js.map +0 -1
  75. package/dist/modules/otp/dto/send-otp.dto.d.ts +0 -11
  76. package/dist/modules/otp/dto/send-otp.dto.d.ts.map +0 -1
  77. package/dist/modules/otp/dto/send-otp.dto.js +0 -39
  78. package/dist/modules/otp/dto/send-otp.dto.js.map +0 -1
  79. package/dist/modules/otp/dto/verify-email.dto.d.ts +0 -5
  80. package/dist/modules/otp/dto/verify-email.dto.d.ts.map +0 -1
  81. package/dist/modules/otp/dto/verify-email.dto.js +0 -27
  82. package/dist/modules/otp/dto/verify-email.dto.js.map +0 -1
  83. package/dist/modules/otp/dto/verify-otp.dto.d.ts +0 -5
  84. package/dist/modules/otp/dto/verify-otp.dto.d.ts.map +0 -1
  85. package/dist/modules/otp/dto/verify-otp.dto.js +0 -28
  86. package/dist/modules/otp/dto/verify-otp.dto.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
- # [1.8.0](https://github.com/Skyapp-Labs/blueprint-backend-core/compare/v1.7.0...v1.8.0) (2026-06-22)
1
+ # [1.9.0](https://github.com/Skyapp-Labs/blueprint-backend-core/compare/v1.8.1...v1.9.0) (2026-06-23)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * add configurable PIN length to PIN status responses ([5939b38](https://github.com/Skyapp-Labs/blueprint-backend-core/commit/5939b38bad96044363823348a26e075604ccd15e))
6
+ * enhance authentication and OTP flow documentation ([01e5188](https://github.com/Skyapp-Labs/blueprint-backend-core/commit/01e5188a4915f6ab046d18303fd7107eab3f5aba))
7
7
 
8
8
  # Changelog
9
9
 
@@ -13,20 +13,49 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
13
13
 
14
14
  ---
15
15
 
16
- ## [1.7.1] - 2026-06-19
16
+ ## [1.8.2] - 2026-06-23
17
17
 
18
18
  ### Fixed
19
+
20
+ - **PIN validation** — wired `ConfigAwareValidationPipe` on all PIN body endpoints (`set`, `change`, `verify`, `remove`) so `@IsConfiguredPinLength()` reads the runtime `pin.length` setting instead of the hardcoded default.
21
+ - **Signup/register tokens** — clearer errors when `verifyPhoneVerifiedToken()` fails: **409** when an existing account’s login token is sent to `/auth/register`, and **401** guidance when `verificationId` is used instead of `verificationToken` or the token is expired/reused.
22
+
23
+ ### Changed
24
+
25
+ - **Swagger documentation** — updated auth, OTP, PIN, session, and password controllers with step-by-step phone/email flows, request examples, and typed response schemas (`TokenResponseDto`, `OtpVerifyResponseDto`, etc.).
26
+
27
+ ### Removed
28
+
29
+ - **Unused DTOs** — removed duplicate/legacy files: `login-phone`, `login-email`, `register-phone`, `register-email`, `refresh-token`, `forgot-password`, `invite`, and legacy `otp/dto/*` stubs superseded by `auth/dto/otp.dto.ts`.
30
+
31
+ ## [1.8.1] - 2026-06-22
32
+
33
+ ### Fixed
34
+
35
+ - **PIN verify/change/remove** — fixed `loadPinRecord()` using `.addSelect('pin.pinHash')` instead of the DB column name `pin.pin_hash`, which left `record.pinHash` undefined and caused argon2 to throw `pchstr must be a non-empty string` on verify.
36
+ - **PIN hash guard** — return a clear 400 when a PIN row exists but has no stored hash, instead of a 500 from argon2.
37
+
38
+ ### Changed
39
+
40
+ - **PIN status responses** — `GET /auth/pin/status` and `GET /auth/pin/status/:type` now include a `length` field reflecting the configured `pin.length` setting so clients know how many digits to collect.
41
+
42
+ ## [1.8.0] - 2026-06-19
43
+
44
+ ### Fixed
45
+
19
46
  - **OTP verify/resend validation** — restored `@IsString()` / `@IsConfiguredOtpLength()` on `VerifyOtpDto.otp` and wired `verify-otp` / `resend-otp` through `ConfigAwareValidationPipe` so the `otp` field is not stripped when using a global `ValidationPipe` with `whitelist: true`.
20
47
  - **OTP length handling** — capped codes at **4–6 digits**; generation respects `otp.code_length` from settings while verify accepts test codes (e.g. `123456`) even when configured length differs.
21
48
  - **Test OTP identities** — `test.otp_identifiers` entries use their fixed configured code on send; invalid entries are skipped with a warning instead of breaking the flow.
22
49
 
23
50
  ### Changed
51
+
24
52
  - **OTP session code resolution** — added `resolveSessionOtpCode()` helper; clearer errors when a test setting code is outside the allowed digit range.
25
53
  - **Settings seed** — `test.otp_identifiers` schema allows 4–6 digit test codes (was fixed at 6).
26
54
 
27
55
  ## [1.7.0] - 2026-06-19
28
56
 
29
57
  ### Added
58
+
30
59
  - **PIN Authentication** — complete PIN-based auth module with `UserPin` entity, `PinAuthService`, and `PinController` for managing user-specific PINs (e.g., authentication, transaction PINs).
31
60
  - **PIN status by type** — `GET /auth/pin/status/:type` returns whether the authenticated user has a PIN set for a given type, including lock state and timestamps.
32
61
  - **Configurable code lengths** — new `otp.code_length` and `pin.length` app settings (default **6**); OTP generation and PIN/OTP DTO validation respect the configured lengths at runtime.
@@ -36,6 +65,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
36
65
  - **Repository Structure** — documented `src/` layout and submodule setup in README.
37
66
 
38
67
  ### Changed
68
+
39
69
  - **Invitations** — implemented permission checks in `InvitationsController` and refactored `CreateInvitationDto` to use transformed delivery channels.
40
70
  - **Sessions** — included `UsersModule` in sessions module imports.
41
71
  - **Settings** — updated settings seed with additional test OTP entries, OTP code length, and PIN length entries.
@@ -43,24 +73,27 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
43
73
  - **Validation** — `ConfigAwareValidationPipe` injects configured PIN/OTP lengths into DTOs; replaced hardcoded 4–8 digit PIN and 6-digit OTP regexes with settings-aware validators.
44
74
 
45
75
  ### Removed
76
+
46
77
  - Removed `CoreModule` and related files to improve project structure.
47
78
  - Removed `ManifestSyncService` from the roles module.
48
79
  - Removed hardcoded `OTP_CODE_LENGTH` constant — length is now driven by `otp.code_length` setting.
49
80
 
50
-
51
81
  ## [1.5.0] - 2026-05-25
52
82
 
53
83
  ### Added
84
+
54
85
  - **InvitationsModule** — new pluggable module for managing user invitations; wired into `CoreModule`.
55
86
  - `.dockerignore` — added to reduce Docker build context size.
56
87
 
57
88
  ### Changed
89
+
58
90
  - **Permissions cache** — `RolesService` now exposes a synchronous `getPermissions(roleSlug)` and `hasPermission(roleSlug, permissionSlug)` API backed by an in-memory cache loaded at boot (after manifest sync) and kept in sync on every `create`, `update`, `delete`, and `assignPermissions` mutation.
59
91
  - **PermissionsService** — `update()` and `delete()` now trigger a full `RolesService.reloadCache()` so that permission slug renames and removals are immediately reflected across all role cache entries.
60
92
  - **PermissionsGuard** — rewritten to use the synchronous `RolesService.getPermissions()` cache instead of issuing a database query per request; the guard is now fully synchronous. Fixed a broken bare module import (`modules/roles/services` → relative path) that caused `MODULE_NOT_FOUND` errors in the compiled output.
61
93
  - **Email template handling** — refactored template key usage across notification services; improved error logging when templates are missing.
62
94
 
63
95
  ### Fixed
96
+
64
97
  - `package-lock.json` regenerated to include missing transitive dependencies (`@emnapi/core`, `@emnapi/runtime`) that caused `npm ci` to fail inside Docker.
65
98
 
66
99
  ---
@@ -68,6 +101,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
68
101
  ## [1.4.0] - 2026-05-19
69
102
 
70
103
  ### Changed
104
+
71
105
  - **JWT payload** — enriched to include user profile details (name, avatar, etc.) and resolved permission slugs so consumers can read identity and access data directly from the token without additional API calls.
72
106
 
73
107
  ---
@@ -75,6 +109,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
75
109
  ## [1.3.1] - 2026-05-13
76
110
 
77
111
  ### Fixed
112
+
78
113
  - Auth provider test-entry lookup replaced with a more flexible strategy that is not tied to a specific credential format.
79
114
 
80
115
  ---
@@ -82,6 +117,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
82
117
  ## [1.3.0] - 2026-05-12
83
118
 
84
119
  ### Added
120
+
85
121
  - **Full-schema migration** — consolidated database schema migration (`full-schema`) covering all core entities (users, roles, permissions, settings, OTP, invitations, notifications). Removed the earlier piecemeal migration files.
86
122
 
87
123
  ---
@@ -89,6 +125,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
89
125
  ## [1.2.0] - 2026-05-05
90
126
 
91
127
  ### Added
128
+
92
129
  - `schema` column on `app_settings` table to describe the shape of complex setting values.
93
130
  - New `arrayOfObject` setting type — parsed as `JSON.parse()` and intended for arrays of structured objects; the `schema` field documents the expected shape.
94
131
 
@@ -97,9 +134,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
97
134
  ## [1.1.0] - 2026-04-18
98
135
 
99
136
  ### Changed
137
+
100
138
  - Security hardening across authentication flows.
101
139
 
102
140
  ### Fixed
141
+
103
142
  - Various bug fixes related to session handling and credential validation.
104
143
 
105
144
  ---
@@ -107,9 +146,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
107
146
  ## [1.0.10] - 2026-04-04
108
147
 
109
148
  ### Added
149
+
110
150
  - `discoverManifestsFromPaths` utility for manifest-based module discovery.
111
151
 
112
152
  ### Changed
153
+
113
154
  - Enabled `formatOnSave` in editor config.
114
155
 
115
156
  ---
@@ -117,6 +158,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
117
158
  ## [1.0.9] - 2026-04-04
118
159
 
119
160
  ### Fixed
161
+
120
162
  - Publishing target migrated from GitHub Packages to the npm registry (second attempt — registry URL corrected).
121
163
 
122
164
  ---
@@ -124,6 +166,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
124
166
  ## [1.0.8] - 2026-04-04
125
167
 
126
168
  ### Fixed
169
+
127
170
  - Publishing target migrated from GitHub Packages to the npm registry.
128
171
 
129
172
  ---
@@ -131,6 +174,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
131
174
  ## [1.0.7] - 2026-04-04
132
175
 
133
176
  ### Fixed
177
+
134
178
  - npm publish registry URL corrected (second attempt).
135
179
 
136
180
  ---
@@ -138,6 +182,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
138
182
  ## [1.0.6] - 2026-04-04
139
183
 
140
184
  ### Fixed
185
+
141
186
  - npm publish registry URL corrected.
142
187
 
143
188
  ---
@@ -145,6 +190,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
145
190
  ## [1.0.5] - 2026-04-04
146
191
 
147
192
  ### Fixed
193
+
148
194
  - Seed runner was being executed automatically on startup; now only runs when explicitly invoked.
149
195
 
150
196
  ---
@@ -152,11 +198,13 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
152
198
  ## [1.0.4] - 2026-04-03
153
199
 
154
200
  ### Changed
201
+
155
202
  - Major internal refactor: flattened module structure for all core modules.
156
203
  - Code formatting pass across the entire codebase.
157
204
  - Added README.
158
205
 
159
206
  ### Fixed
207
+
160
208
  - Added missing database migration, schema, and seed scripts.
161
209
 
162
210
  ---
@@ -164,6 +212,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
164
212
  ## [1.0.3] - 2026-04-03
165
213
 
166
214
  ### Fixed
215
+
167
216
  - `runSeed` was not exported from the package entry point.
168
217
 
169
218
  ---
@@ -171,6 +220,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
171
220
  ## [1.0.2] - 2026-04-03
172
221
 
173
222
  ### Fixed
223
+
174
224
  - Package publish access set to `public`.
175
225
 
176
226
  ---
@@ -178,6 +228,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
178
228
  ## [1.0.1] - 2026-04-03
179
229
 
180
230
  ### Changed
231
+
181
232
  - Package renamed to `@skyapp-labs/blueprint-backend-core`.
182
233
 
183
234
  ---
@@ -185,6 +236,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
185
236
  ## [1.0.0] - 2026-04-02
186
237
 
187
238
  ### Added
239
+
188
240
  - Initial release of `@skyapp-labs/blueprint-backend-core`.
189
241
  - Core pluggable NestJS modules: Auth, Users, Roles & Permissions, Notifications, OTP, Settings, Profile, Health.
190
242
  - JWT-based authentication with native (email/password) and OAuth (Google) providers.
@@ -13,7 +13,7 @@ export declare class AuthController {
13
13
  authMethod: "email" | "phone";
14
14
  passwordResetEnabled: boolean;
15
15
  };
16
- login(body: LoginDto, req: Request): Promise<import("..").TokenResponse>;
17
- register(body: RegisterDto, req: Request): Promise<import("..").TokenResponse>;
16
+ login(body: LoginDto, req: Request): Promise<import("../dto/token.dto").TokenResponse>;
17
+ register(body: RegisterDto, req: Request): Promise<import("../dto/token.dto").TokenResponse>;
18
18
  }
19
19
  //# sourceMappingURL=auth.controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/auth.controller.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAG3E,qBAGa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAFf,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe;IAoBlD,SAAS;;;;IA2BT,KAAK,CAAkC,IAAI,EAAE,QAAQ,EAAS,GAAG,EAAE,OAAO;IAoB1E,QAAQ,CAAkC,IAAI,EAAE,WAAW,EAAS,GAAG,EAAE,OAAO;CAIhF"}
1
+ {"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/auth.controller.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAG3E,qBAGa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAFf,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe;IAkBlD,SAAS;;;;IAuCT,KAAK,CAAkC,IAAI,EAAE,QAAQ,EAAS,GAAG,EAAE,OAAO;IA8C1E,QAAQ,CAAkC,IAAI,EAAE,WAAW,EAAS,GAAG,EAAE,OAAO;CAIhF"}
@@ -22,6 +22,7 @@ const login_service_1 = require("../services/login.service");
22
22
  const registration_service_1 = require("../services/registration.service");
23
23
  const login_dto_1 = require("../dto/login.dto");
24
24
  const register_dto_1 = require("../dto/register.dto");
25
+ const token_dto_1 = require("../dto/token.dto");
25
26
  const config_aware_validation_pipe_1 = require("../../../common/pipes/config-aware-validation.pipe");
26
27
  const settings_service_1 = require("../../settings/services/settings.service");
27
28
  const settings_keys_1 = require("../../settings/constants/settings.keys");
@@ -53,7 +54,7 @@ __decorate([
53
54
  (0, swagger_1.ApiOperation)({
54
55
  summary: 'Auth configuration',
55
56
  description: 'Returns the active authentication configuration. ' +
56
- 'Clients should call this on startup to determine which login/registration UI to present.',
57
+ 'Call on app startup to determine which login/registration UI to present.',
57
58
  }),
58
59
  (0, swagger_1.ApiOkResponse)({
59
60
  schema: {
@@ -73,13 +74,26 @@ __decorate([
73
74
  (0, common_1.UseGuards)(guards_1.LoginIpRateLimitGuard),
74
75
  (0, swagger_1.ApiOperation)({
75
76
  summary: 'Login',
76
- description: 'Login with phone or email and password.',
77
+ description: '**Phone auth (auth.method=phone):** complete OTP first, then send `{ verificationToken }` from verify-otp when hasAccount=true.\n\n' +
78
+ '**Email auth (auth.method=email):** send `{ email, password }`.',
77
79
  }),
78
- (0, swagger_1.ApiBody)({ type: login_dto_1.LoginDto }),
79
- (0, swagger_1.ApiOkResponse)({
80
- schema: { example: { accessToken: 'jwt', refreshToken: 'id.secret', expiresIn: 900000 } },
80
+ (0, swagger_1.ApiBody)({
81
+ type: login_dto_1.LoginDto,
82
+ examples: {
83
+ phone: {
84
+ summary: 'Phone OTP login (hasAccount=true)',
85
+ value: { verificationToken: 'c498758c-eec1-4a3b-b496-a6eddf498d4c' },
86
+ },
87
+ email: {
88
+ summary: 'Email + password login',
89
+ value: { email: 'user@example.com', password: 'P@ssw0rd!' },
90
+ },
91
+ },
92
+ }),
93
+ (0, swagger_1.ApiOkResponse)({ type: token_dto_1.TokenResponseDto }),
94
+ (0, swagger_1.ApiUnauthorizedResponse)({
95
+ description: 'Invalid or expired verificationToken (phone), or invalid credentials (email)',
81
96
  }),
82
- (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Invalid or expired temporary token' }),
83
97
  (0, swagger_1.ApiTooManyRequestsResponse)({
84
98
  description: 'Too many login attempts from this IP or identifier is locked',
85
99
  }),
@@ -94,14 +108,40 @@ __decorate([
94
108
  (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
95
109
  (0, swagger_1.ApiOperation)({
96
110
  summary: 'Register new account',
97
- description: 'Create a new account using the phoneVerifiedToken from verify-otp. Issues access + refresh tokens immediately.',
111
+ description: '**Phone auth flow:**\n' +
112
+ '1. POST /auth/send-otp → `verificationId`\n' +
113
+ '2. POST /auth/verify-otp → `verificationToken` (when hasAccount=false)\n' +
114
+ '3. POST /auth/register → `{ verificationToken, profile }`\n\n' +
115
+ 'Use **verificationToken** from step 2 — not verificationId. Token is single-use and expires per tokens.temporary_ttl_seconds.\n\n' +
116
+ '**Email auth:** send `{ email, password, profile }` — no OTP token required.',
117
+ }),
118
+ (0, swagger_1.ApiBody)({
119
+ type: register_dto_1.RegisterDto,
120
+ examples: {
121
+ phone: {
122
+ summary: 'Phone signup (after verify-otp, hasAccount=false)',
123
+ value: {
124
+ verificationToken: 'c498758c-eec1-4a3b-b496-a6eddf498d4c',
125
+ profile: { firstName: 'Ada', lastName: 'Lovelace' },
126
+ },
127
+ },
128
+ email: {
129
+ summary: 'Email + password signup',
130
+ value: {
131
+ email: 'new.user@example.com',
132
+ password: 'P@ssw0rd!',
133
+ profile: { firstName: 'Ada', lastName: 'Lovelace' },
134
+ },
135
+ },
136
+ },
137
+ }),
138
+ (0, swagger_1.ApiCreatedResponse)({ type: token_dto_1.TokenResponseDto }),
139
+ (0, swagger_1.ApiConflictResponse)({
140
+ description: 'Phone or email already registered, or verificationToken belongs to an existing account (use /auth/login instead)',
98
141
  }),
99
- (0, swagger_1.ApiBody)({ type: register_dto_1.RegisterDto }),
100
- (0, swagger_1.ApiCreatedResponse)({
101
- schema: { example: { accessToken: 'jwt', refreshToken: 'id.secret', expiresIn: 900000 } },
142
+ (0, swagger_1.ApiUnauthorizedResponse)({
143
+ description: 'Invalid, expired, or already-used verificationToken. Use verificationToken from verify-otp (hasAccount=false), not verificationId.',
102
144
  }),
103
- (0, swagger_1.ApiConflictResponse)({ description: 'Phone number or email already registered' }),
104
- (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Invalid or expired phone-verified token' }),
105
145
  __param(0, (0, common_1.Body)(config_aware_validation_pipe_1.ConfigAwareValidationPipe)),
106
146
  __param(1, (0, common_1.Req)()),
107
147
  __metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmG;AACnG,6CASyB;AAEzB,2DAAoD;AACpD,uEAAyE;AACzE,mDAA+D;AAC/D,6DAAyD;AACzD,2EAAuE;AACvE,gDAA4C;AAC5C,sDAAkD;AAClD,qGAA+F;AAC/F,+EAA2E;AAC3E,0EAAsE;AAK/D,IAAM,cAAc,GAApB,MAAM,cAAc;IAC1B,YACkB,YAA0B,EAC1B,mBAAwC,EACxC,eAAgC;QAFhC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,oBAAe,GAAf,eAAe,CAAiB;IAC/C,CAAC;IAmBJ,SAAS;QACR,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAS,4BAAY,CAAC,WAAW,CAElE,CAAC;QACX,OAAO;YACN,UAAU;YACV,oBAAoB,EAAE,UAAU,KAAK,OAAO;SAC5C,CAAC;IACH,CAAC;IAmBD,KAAK,CAAkC,IAAc,EAAS,GAAY;QACzE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,IAAA,kCAAkB,EAAC,GAAG,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,EAA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AAA;;qCAAhB,oBAAQ;;2CAGpD;AAiBD;IAbC,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,OAAO,CAAC;IAC5B,IAAA,sBAAY,EAAC;QACb,OAAO,EAAE,sBAAsB;QAC/B,WAAW,EACV,gHAAgH;KACjH,CAAC;IACD,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,0BAAW,EAAE,CAAC;IAC9B,IAAA,4BAAkB,EAAC;QACnB,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;KACzF,CAAC;IACD,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAChF,IAAA,iCAAuB,EAAC,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAC1E,WAAA,IAAA,aAAI,EAAC,wDAAyB,CAAC,CAAA;IAAqB,WAAA,IAAA,YAAG,GAAE,CAAA;;qCAAnB,0BAAW;;8CAG1D;yBA1EW,cAAc;IAH1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;IAClB,IAAA,mBAAM,GAAE;qCAGwB,4BAAY;QACL,0CAAmB;QACvB,kCAAe;GAJtC,cAAc,CA2E1B"}
1
+ {"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmG;AACnG,6CASyB;AAEzB,2DAAoD;AACpD,uEAAyE;AACzE,mDAA+D;AAC/D,6DAAyD;AACzD,2EAAuE;AACvE,gDAA4C;AAC5C,sDAAkD;AAClD,gDAAoD;AACpD,qGAA+F;AAC/F,+EAA2E;AAC3E,0EAAsE;AAK/D,IAAM,cAAc,GAApB,MAAM,cAAc;IAC1B,YACkB,YAA0B,EAC1B,mBAAwC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ACD;YACD,KAAK,EAAE;gBACN,OAAO,EAAE,yBAAyB;gBAClC,KAAK,EAAE;oBACN,KAAK,EAAE,sBAAsB;oBAC7B,QAAQ,EAAE,WAAW;oBACrB,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE;iBACnD;aACD;SACD;KACD,CAAC;IACD,IAAA,4BAAkB,EAAC,EAAE,IAAI,EAAE,4BAAgB,EAAE,CAAC;IAC9C,IAAA,6BAAmB,EAAC;QACpB,WAAW,EACV,kHAAkH;KACnH,CAAC;IACD,IAAA,iCAAuB,EAAC;QACxB,WAAW,EACV,oIAAoI;KACrI,CAAC;IACQ,WAAA,IAAA,aAAI,EAAC,wDAAyB,CAAC,CAAA;IAAqB,WAAA,IAAA,YAAG,GAAE,CAAA;;qCAAnB,0BAAW;;8CAG1D;yBA9GW,cAAc;IAH1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;IAClB,IAAA,mBAAM,GAAE;qCAGwB,4BAAY;QACL,0CAAmB;QACvB,kCAAe;GAJtC,cAAc,CA+G1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"forgot-password.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/forgot-password.controller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,qBAGa,wBAAwB;IACxB,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAe7D,cAAc,CAAS,IAAI,EAAE,iBAAiB;;;IAa9C,aAAa,CAAS,IAAI,EAAE,gBAAgB,EAAS,GAAG,EAAE,OAAO;;;IAejE,sBAAsB,CAAS,IAAI,EAAE,yBAAyB,EAAS,GAAG,EAAE,OAAO;;;CAInF"}
1
+ {"version":3,"file":"forgot-password.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/forgot-password.controller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,qBAGa,wBAAwB;IACxB,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAe7D,cAAc,CAAS,IAAI,EAAE,iBAAiB;;;IAa9C,aAAa,CAAS,IAAI,EAAE,gBAAgB,EAAS,GAAG,EAAE,OAAO;;;IAkBjE,sBAAsB,CAAS,IAAI,EAAE,yBAAyB,EAAS,GAAG,EAAE,OAAO;;;CAInF"}
@@ -79,7 +79,9 @@ __decorate([
79
79
  }),
80
80
  (0, swagger_1.ApiBody)({ type: password_dto_1.ResetPasswordWithPhoneDto }),
81
81
  (0, swagger_1.ApiOkResponse)({ schema: { example: { message: 'Password reset successfully.' } } }),
82
- (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Invalid or expired phone-verified token' }),
82
+ (0, swagger_1.ApiUnauthorizedResponse)({
83
+ description: 'Invalid or expired verificationToken, or token belongs to an existing account (use /auth/login)',
84
+ }),
83
85
  __param(0, (0, common_1.Body)()),
84
86
  __param(1, (0, common_1.Req)()),
85
87
  __metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"forgot-password.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/forgot-password.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmF;AACnF,6CAMyB;AAEzB,2DAAoD;AACpD,uEAAyE;AACzE,mEAA+D;AAC/D,sDAI6B;AAKtB,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC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C,EAAE,IAAI,EAAE,+BAAgB,EAAE,CAAC;IACnC,IAAA,uBAAa,EAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE,EAAE,EAAE,CAAC;IACnF,IAAA,iCAAuB,EAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAC5D,WAAA,IAAA,aAAI,GAAE,CAAA;IAA0B,WAAA,IAAA,YAAG,GAAE,CAAA;;qCAAxB,+BAAgB;;6DAG3C;AAYD;IAVC,IAAA,aAAI,EAAC,sBAAsB,CAAC;IAC5B,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,sBAAY,EAAC;QACb,OAAO,EAAE,4BAA4B;QACrC,WAAW,EACV,oGAAoG;KACrG,CAAC;IACD,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,wCAAyB,EAAE,CAAC;IAC5C,IAAA,uBAAa,EAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE,EAAE,EAAE,CAAC;IACnF,IAAA,iCAAuB,EAAC,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAC5D,WAAA,IAAA,aAAI,GAAE,CAAA;IAAmC,WAAA,IAAA,YAAG,GAAE,CAAA;;qCAAjC,wCAAyB;;sEAG7D;mCA/CW,wBAAwB;IAHpC,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;IAClB,IAAA,mBAAM,GAAE;qCAEsC,kCAAe;GADjD,wBAAwB,CAgDpC"}
1
+ {"version":3,"file":"forgot-password.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/forgot-password.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmF;AACnF,6CAMyB;AAEzB,2DAAoD;AACpD,uEAAyE;AACzE,mEAA+D;AAC/D,sDAI6B;AAKtB,IAAM,wBAAwB,GAA9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,MAAM,gBAAgB,CAAC;AAExF,qBAGa,aAAa;IACb,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAmD3D,OAAO,CAAkC,IAAI,EAAE,UAAU;IAkCzD,SAAS,CAAkC,IAAI,EAAE,YAAY;IA0B7D,SAAS,CAAkC,IAAI,EAAE,YAAY;CAG7D"}
1
+ {"version":3,"file":"otp.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/otp.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACN,UAAU,EACV,YAAY,EACZ,YAAY,EAIZ,MAAM,gBAAgB,CAAC;AAExB,qBAGa,aAAa;IACb,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IA2C3D,OAAO,CAAkC,IAAI,EAAE,UAAU;IAwDzD,SAAS,CAAkC,IAAI,EAAE,YAAY;IAmB7D,SAAS,CAAkC,IAAI,EAAE,YAAY;CAG7D"}
@@ -43,17 +43,19 @@ __decorate([
43
43
  (0, common_1.UseGuards)(guards_1.OtpIpRateLimitGuard),
44
44
  (0, swagger_1.ApiOperation)({
45
45
  summary: 'Send OTP',
46
- description: 'Generates an OTP using otp.code_length from settings (4–6 digits), delivers it via the requested channel (SMS or email), and returns an opaque verification ID. Test identifiers in test.otp_identifiers use their configured fixed code instead.',
46
+ description: 'Step 1 of phone/email verification. Generates an OTP (length from otp.code_length setting, 4–6 digits), ' +
47
+ 'delivers it via SMS or email, and returns a **verificationId** for verify-otp/resend-otp. ' +
48
+ 'Test identifiers in test.otp_identifiers use a fixed code in non-production environments.',
47
49
  }),
48
50
  (0, swagger_1.ApiBody)({
49
51
  type: otp_dto_1.SendOtpDto,
50
52
  examples: {
51
53
  sms_default: {
52
- summary: 'Send via SMS (default when AUTH_METHOD=phone)',
54
+ summary: 'Send via SMS (default when auth.method=phone)',
53
55
  value: { phone: '+2348012345678' },
54
56
  },
55
57
  email_default: {
56
- summary: 'Send via email (default when AUTH_METHOD=email)',
58
+ summary: 'Send via email (default when auth.method=email)',
57
59
  value: { email: 'user@example.com' },
58
60
  },
59
61
  sms_override: {
@@ -66,15 +68,7 @@ __decorate([
66
68
  },
67
69
  },
68
70
  }),
69
- (0, swagger_1.ApiOkResponse)({
70
- schema: {
71
- example: {
72
- success: true,
73
- message: 'OTP generated successfully',
74
- data: { verificationId: 'uuid-v4', expiresAt: 1700000300000, resendIn: 60000 },
75
- },
76
- },
77
- }),
71
+ (0, swagger_1.ApiOkResponse)({ type: otp_dto_1.OtpGenerateResponseDto }),
78
72
  (0, swagger_1.ApiBadRequestResponse)({
79
73
  description: 'Invalid phone number or email format, or missing identifier for chosen channel',
80
74
  }),
@@ -93,20 +87,42 @@ __decorate([
93
87
  (0, common_1.UseGuards)(guards_1.OtpIpRateLimitGuard),
94
88
  (0, swagger_1.ApiOperation)({
95
89
  summary: 'Verify OTP',
96
- description: 'Verifies the OTP code. Returns a verificationToken (existing user proceed to login) or a verificationToken seeded with the verified identifier (new user → proceed to /auth/register).',
90
+ description: 'Step 2 of phone/email verification. Submit the **verificationId** from send-otp/resend-otp and the OTP code.\n\n' +
91
+ 'Returns a **verificationToken** for the next step:\n' +
92
+ '- `hasAccount: true` → POST /auth/login\n' +
93
+ '- `hasAccount: false` → POST /auth/register (phone auth)\n\n' +
94
+ 'Do not confuse verificationId (input) with verificationToken (output).',
97
95
  }),
98
96
  (0, swagger_1.ApiBody)({ type: otp_dto_1.VerifyOtpDto }),
99
97
  (0, swagger_1.ApiOkResponse)({
100
- schema: {
101
- example: {
102
- success: true,
103
- message: 'OTP verified successfully',
104
- data: {
105
- subject: '+2348012345678',
106
- channel: 'sms',
107
- verificationToken: 'uuid-v4',
108
- expiresAt: 1700000300000,
109
- hasAccount: true,
98
+ type: otp_dto_1.OtpVerifyResponseDto,
99
+ examples: {
100
+ existing_user: {
101
+ summary: 'Existing account — proceed to login',
102
+ value: {
103
+ success: true,
104
+ message: 'OTP verified successfully',
105
+ data: {
106
+ subject: '+2348012345678',
107
+ channel: 'sms',
108
+ verificationToken: 'e860bc81-245b-470b-9fac-a484cf93f457',
109
+ expiresAt: 1782245811728,
110
+ hasAccount: true,
111
+ },
112
+ },
113
+ },
114
+ new_user: {
115
+ summary: 'New user — proceed to register',
116
+ value: {
117
+ success: true,
118
+ message: 'OTP verified successfully',
119
+ data: {
120
+ subject: '+2349023456789',
121
+ channel: 'sms',
122
+ verificationToken: 'c498758c-eec1-4a3b-b496-a6eddf498d4c',
123
+ expiresAt: 1782245803859,
124
+ hasAccount: false,
125
+ },
110
126
  },
111
127
  },
112
128
  },
@@ -126,21 +142,14 @@ __decorate([
126
142
  (0, common_1.UseGuards)(guards_1.OtpIpRateLimitGuard),
127
143
  (0, swagger_1.ApiOperation)({
128
144
  summary: 'Resend OTP',
129
- description: 'Invalidates the current session and sends a new OTP. Subject to 60-second cooldown.',
145
+ description: 'Invalidates the current OTP session and sends a new code. Returns a new **verificationId**. ' +
146
+ 'Subject to otp.resend_cooldown_seconds between resends.',
130
147
  }),
131
148
  (0, swagger_1.ApiBody)({ type: otp_dto_1.ResendOtpDto }),
132
- (0, swagger_1.ApiOkResponse)({
133
- schema: {
134
- example: {
135
- success: true,
136
- message: 'OTP generated successfully',
137
- data: { verificationId: 'new-uuid-v4', expiresAt: 1700000300000, resendIn: 60000 },
138
- },
139
- },
140
- }),
141
- (0, swagger_1.ApiBadRequestResponse)({ description: 'Invalid or expired session token' }),
149
+ (0, swagger_1.ApiOkResponse)({ type: otp_dto_1.OtpGenerateResponseDto }),
150
+ (0, swagger_1.ApiBadRequestResponse)({ description: 'Invalid or expired verificationId' }),
142
151
  (0, swagger_1.ApiTooManyRequestsResponse)({
143
- description: 'Resend cooldown active — must wait 60 seconds between resends',
152
+ description: 'Resend cooldown active — wait before requesting another code',
144
153
  }),
145
154
  __param(0, (0, common_1.Body)(config_aware_validation_pipe_1.ConfigAwareValidationPipe)),
146
155
  __metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"otp.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/otp.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyF;AACzF,6CAQyB;AACzB,2DAAoD;AACpD,mDAA6D;AAC7D,qGAA+F;AAC/F,mEAA8D;AAC9D,4CAAwF;AAKjF,IAAM,aAAa,GAAnB,MAAM,aAAa;IACzB,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAmD/D,OAAO,CAAkC,IAAgB;QACxD,MAAM,OAAO,GAAG,IAAA,wBAAc,EAAC,IAAI,CAAC,CAAC;QACrC,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAC;QACjE,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IA8BD,SAAS,CAAkC,IAAkB;QAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAwBD,SAAS,CAAkC,IAAkB;QAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;CACD,CAAA;AAnHY,sCAAa;AAoDzB;IA/CC,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,kBAAS,EAAC,4BAAmB,CAAC;IAC9B,IAAA,sBAAY,EAAC;QACb,OAAO,EAAE,UAAU;QACnB,WAAW,EACV,mPAAmP;KACpP,CAAC;IACD,IAAA,iBAAO,EAAC;QACR,IAAI,EAAE,oBAAU;QAChB,QAAQ,EAAE;YACT,W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A,uBAAa,EAAC,EAAE,IAAI,EAAE,gCAAsB,EAAE,CAAC;IAC/C,IAAA,+BAAqB,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;IAC3E,IAAA,oCAA0B,EAAC;QAC3B,WAAW,EAAE,8DAA8D;KAC3E,CAAC;IACS,WAAA,IAAA,aAAI,EAAC,wDAAyB,CAAC,CAAA;;qCAAO,sBAAY;;8CAE5D;wBAzHW,aAAa;IAHzB,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;IAClB,IAAA,mBAAM,GAAE;qCAEqC,iCAAc;GAD/C,aAAa,CA0HzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"pin.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/pin.controller.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnG,qBAIa,aAAa;IACb,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IA4B3D,SAAS,CAAgB,IAAI,EAAE,IAAI;IA+BnC,gBAAgB,CAAgB,IAAI,EAAE,IAAI,EAAiB,IAAI,EAAE,MAAM;IAoBvE,MAAM,CAAgB,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,SAAS;;;IAkBxD,SAAS,CAAgB,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,YAAY;;;IAuB9D,SAAS,CAAgB,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,YAAY;;;IAoB9D,SAAS,CAAgB,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,YAAY;;;CAG9D"}
1
+ {"version":3,"file":"pin.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/controllers/pin.controller.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnG,qBAIa,aAAa;IACb,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IA4B3D,SAAS,CAAgB,IAAI,EAAE,IAAI;IA+BnC,gBAAgB,CAAgB,IAAI,EAAE,IAAI,EAAiB,IAAI,EAAE,MAAM;IAsBvE,MAAM,CAAgB,IAAI,EAAE,IAAI,EAAmC,GAAG,EAAE,SAAS;;;IAoBjF,SAAS,CAAgB,IAAI,EAAE,IAAI,EAAmC,GAAG,EAAE,YAAY;;;IAyBvF,SAAS,CAAgB,IAAI,EAAE,IAAI,EAAmC,GAAG,EAAE,YAAY;;;IAsBvF,SAAS,CAAgB,IAAI,EAAE,IAAI,EAAmC,GAAG,EAAE,YAAY;;;CAGvF"}
@@ -17,6 +17,7 @@ const common_1 = require("@nestjs/common");
17
17
  const swagger_1 = require("@nestjs/swagger");
18
18
  const auth_guard_1 = require("../../../common/guards/auth.guard");
19
19
  const decorators_1 = require("../../../common/decorators");
20
+ const config_aware_validation_pipe_1 = require("../../../common/pipes/config-aware-validation.pipe");
20
21
  const user_entity_1 = require("../../users/entities/user.entity");
21
22
  const pin_auth_service_1 = require("../services/pin-auth.service");
22
23
  const pin_dto_1 = require("../dto/pin.dto");
@@ -119,9 +120,11 @@ __decorate([
119
120
  schema: { example: { message: 'authentication PIN set successfully.' } },
120
121
  }),
121
122
  (0, swagger_1.ApiConflictResponse)({ description: 'A PIN for this type is already set' }),
122
- (0, swagger_1.ApiBadRequestResponse)({ description: 'Invalid PIN type or PIN format' }),
123
+ (0, swagger_1.ApiBadRequestResponse)({
124
+ description: 'Invalid PIN type, or PIN length does not match pin.length setting',
125
+ }),
123
126
  __param(0, (0, decorators_1.CurrentUser)()),
124
- __param(1, (0, common_1.Body)()),
127
+ __param(1, (0, common_1.Body)(config_aware_validation_pipe_1.ConfigAwareValidationPipe)),
125
128
  __metadata("design:type", Function),
126
129
  __metadata("design:paramtypes", [user_entity_1.User, pin_dto_1.SetPinDto]),
127
130
  __metadata("design:returntype", void 0)
@@ -138,9 +141,11 @@ __decorate([
138
141
  (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Current PIN is incorrect' }),
139
142
  (0, swagger_1.ApiForbiddenResponse)({ description: 'PIN is locked due to too many failed attempts' }),
140
143
  (0, swagger_1.ApiNotFoundResponse)({ description: 'No PIN found for this type — use /auth/pin/set first' }),
141
- (0, swagger_1.ApiBadRequestResponse)({ description: 'Invalid PIN type or PIN format' }),
144
+ (0, swagger_1.ApiBadRequestResponse)({
145
+ description: 'Invalid PIN type, or PIN length does not match pin.length setting',
146
+ }),
142
147
  __param(0, (0, decorators_1.CurrentUser)()),
143
- __param(1, (0, common_1.Body)()),
148
+ __param(1, (0, common_1.Body)(config_aware_validation_pipe_1.ConfigAwareValidationPipe)),
144
149
  __metadata("design:type", Function),
145
150
  __metadata("design:paramtypes", [user_entity_1.User, pin_dto_1.ChangePinDto]),
146
151
  __metadata("design:returntype", void 0)
@@ -161,9 +166,11 @@ __decorate([
161
166
  (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Incorrect PIN' }),
162
167
  (0, swagger_1.ApiForbiddenResponse)({ description: 'PIN is locked — too many wrong attempts' }),
163
168
  (0, swagger_1.ApiNotFoundResponse)({ description: 'No PIN found for this type' }),
164
- (0, swagger_1.ApiBadRequestResponse)({ description: 'Invalid PIN type or PIN format' }),
169
+ (0, swagger_1.ApiBadRequestResponse)({
170
+ description: 'Invalid PIN type, or PIN length does not match pin.length setting',
171
+ }),
165
172
  __param(0, (0, decorators_1.CurrentUser)()),
166
- __param(1, (0, common_1.Body)()),
173
+ __param(1, (0, common_1.Body)(config_aware_validation_pipe_1.ConfigAwareValidationPipe)),
167
174
  __metadata("design:type", Function),
168
175
  __metadata("design:paramtypes", [user_entity_1.User, pin_dto_1.VerifyPinDto]),
169
176
  __metadata("design:returntype", void 0)
@@ -181,9 +188,11 @@ __decorate([
181
188
  (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Current PIN is incorrect' }),
182
189
  (0, swagger_1.ApiForbiddenResponse)({ description: 'PIN is locked' }),
183
190
  (0, swagger_1.ApiNotFoundResponse)({ description: 'No PIN found for this type' }),
184
- (0, swagger_1.ApiBadRequestResponse)({ description: 'Invalid PIN type or PIN format' }),
191
+ (0, swagger_1.ApiBadRequestResponse)({
192
+ description: 'Invalid PIN type, or PIN length does not match pin.length setting',
193
+ }),
185
194
  __param(0, (0, decorators_1.CurrentUser)()),
186
- __param(1, (0, common_1.Body)()),
195
+ __param(1, (0, common_1.Body)(config_aware_validation_pipe_1.ConfigAwareValidationPipe)),
187
196
  __metadata("design:type", Function),
188
197
  __metadata("design:paramtypes", [user_entity_1.User, pin_dto_1.RemovePinDto]),
189
198
  __metadata("design:returntype", void 0)