@nauth-toolkit/core 0.1.108 → 0.1.111

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 (112) hide show
  1. package/dist/bootstrap.d.ts.map +1 -1
  2. package/dist/bootstrap.js.map +1 -1
  3. package/dist/dto/admin-remove-device.dto.d.ts +22 -0
  4. package/dist/dto/admin-remove-device.dto.d.ts.map +1 -0
  5. package/dist/dto/{admin-remove-devices.dto.js → admin-remove-device.dto.js} +21 -21
  6. package/dist/dto/admin-remove-device.dto.js.map +1 -0
  7. package/dist/dto/admin-set-preferred-device.dto.d.ts +32 -0
  8. package/dist/dto/admin-set-preferred-device.dto.d.ts.map +1 -0
  9. package/dist/dto/admin-set-preferred-device.dto.js +64 -0
  10. package/dist/dto/admin-set-preferred-device.dto.js.map +1 -0
  11. package/dist/dto/admin-signup-social.dto.d.ts +2 -2
  12. package/dist/dto/admin-signup.dto.d.ts +2 -2
  13. package/dist/dto/challenge-response.dto.d.ts +4 -0
  14. package/dist/dto/challenge-response.dto.d.ts.map +1 -1
  15. package/dist/dto/disable-user.dto.d.ts +2 -2
  16. package/dist/dto/enable-user.dto.d.ts +2 -2
  17. package/dist/dto/get-user-devices.dto.d.ts +5 -3
  18. package/dist/dto/get-user-devices.dto.d.ts.map +1 -1
  19. package/dist/dto/get-user-devices.dto.js +3 -1
  20. package/dist/dto/get-user-devices.dto.js.map +1 -1
  21. package/dist/dto/get-user-response.dto.d.ts +1 -1
  22. package/dist/dto/get-user-response.dto.js +1 -1
  23. package/dist/dto/get-users.dto.d.ts +2 -2
  24. package/dist/dto/index.d.ts +6 -4
  25. package/dist/dto/index.d.ts.map +1 -1
  26. package/dist/dto/index.js +6 -4
  27. package/dist/dto/index.js.map +1 -1
  28. package/dist/dto/mfa-device-response.dto.d.ts +68 -0
  29. package/dist/dto/mfa-device-response.dto.d.ts.map +1 -0
  30. package/dist/dto/mfa-device-response.dto.js +81 -0
  31. package/dist/dto/mfa-device-response.dto.js.map +1 -0
  32. package/dist/dto/remove-device.dto.d.ts +49 -0
  33. package/dist/dto/remove-device.dto.d.ts.map +1 -0
  34. package/dist/dto/remove-device.dto.js +76 -0
  35. package/dist/dto/remove-device.dto.js.map +1 -0
  36. package/dist/dto/respond-challenge.dto.d.ts +8 -0
  37. package/dist/dto/respond-challenge.dto.d.ts.map +1 -1
  38. package/dist/dto/respond-challenge.dto.js +14 -0
  39. package/dist/dto/respond-challenge.dto.js.map +1 -1
  40. package/dist/dto/set-preferred-device.dto.d.ts +46 -0
  41. package/dist/dto/set-preferred-device.dto.d.ts.map +1 -0
  42. package/dist/dto/set-preferred-device.dto.js +74 -0
  43. package/dist/dto/set-preferred-device.dto.js.map +1 -0
  44. package/dist/dto/setup-mfa.dto.d.ts.map +1 -1
  45. package/dist/dto/setup-mfa.dto.js.map +1 -1
  46. package/dist/dto/user-response.dto.d.ts +3 -3
  47. package/dist/dto/user-response.dto.js +5 -5
  48. package/dist/dto/verify-mfa-setup-response.dto.d.ts +18 -0
  49. package/dist/dto/verify-mfa-setup-response.dto.d.ts.map +1 -0
  50. package/dist/dto/verify-mfa-setup-response.dto.js +22 -0
  51. package/dist/dto/verify-mfa-setup-response.dto.js.map +1 -0
  52. package/dist/handlers/client-info.handler.d.ts.map +1 -1
  53. package/dist/handlers/client-info.handler.js.map +1 -1
  54. package/dist/interfaces/provider.interface.d.ts.map +1 -1
  55. package/dist/openapi/components.schemas.json +112 -140
  56. package/dist/services/admin-auth.service.d.ts +12 -5
  57. package/dist/services/admin-auth.service.d.ts.map +1 -1
  58. package/dist/services/admin-auth.service.js +46 -2
  59. package/dist/services/admin-auth.service.js.map +1 -1
  60. package/dist/services/auth-audit.service.d.ts.map +1 -1
  61. package/dist/services/auth-audit.service.js +1 -1
  62. package/dist/services/auth-audit.service.js.map +1 -1
  63. package/dist/services/auth-challenge-helper.service.d.ts.map +1 -1
  64. package/dist/services/auth-challenge-helper.service.js +34 -0
  65. package/dist/services/auth-challenge-helper.service.js.map +1 -1
  66. package/dist/services/auth-service-internal-helpers.d.ts.map +1 -1
  67. package/dist/services/auth-service-internal-helpers.js +4 -0
  68. package/dist/services/auth-service-internal-helpers.js.map +1 -1
  69. package/dist/services/auth.service.d.ts +9 -2
  70. package/dist/services/auth.service.d.ts.map +1 -1
  71. package/dist/services/auth.service.js +36 -0
  72. package/dist/services/auth.service.js.map +1 -1
  73. package/dist/services/challenge.service.d.ts.map +1 -1
  74. package/dist/services/challenge.service.js +1 -3
  75. package/dist/services/challenge.service.js.map +1 -1
  76. package/dist/services/email-verification.service.d.ts.map +1 -1
  77. package/dist/services/email-verification.service.js +3 -9
  78. package/dist/services/email-verification.service.js.map +1 -1
  79. package/dist/services/mfa-base.service.d.ts +23 -6
  80. package/dist/services/mfa-base.service.d.ts.map +1 -1
  81. package/dist/services/mfa-base.service.js +70 -18
  82. package/dist/services/mfa-base.service.js.map +1 -1
  83. package/dist/services/mfa.service.d.ts +54 -35
  84. package/dist/services/mfa.service.d.ts.map +1 -1
  85. package/dist/services/mfa.service.js +216 -168
  86. package/dist/services/mfa.service.js.map +1 -1
  87. package/dist/services/phone-verification.service.d.ts.map +1 -1
  88. package/dist/services/phone-verification.service.js +3 -8
  89. package/dist/services/phone-verification.service.js.map +1 -1
  90. package/dist/services/session.service.d.ts +1 -2
  91. package/dist/services/session.service.d.ts.map +1 -1
  92. package/dist/services/session.service.js.map +1 -1
  93. package/dist/services/user.service.d.ts +5 -5
  94. package/dist/services/user.service.d.ts.map +1 -1
  95. package/dist/services/user.service.js +16 -10
  96. package/dist/services/user.service.js.map +1 -1
  97. package/package.json +2 -2
  98. package/dist/dto/admin-remove-devices.dto.d.ts +0 -25
  99. package/dist/dto/admin-remove-devices.dto.d.ts.map +0 -1
  100. package/dist/dto/admin-remove-devices.dto.js.map +0 -1
  101. package/dist/dto/admin-set-preferred-method.dto.d.ts +0 -25
  102. package/dist/dto/admin-set-preferred-method.dto.d.ts.map +0 -1
  103. package/dist/dto/admin-set-preferred-method.dto.js +0 -50
  104. package/dist/dto/admin-set-preferred-method.dto.js.map +0 -1
  105. package/dist/dto/remove-devices.dto.d.ts +0 -48
  106. package/dist/dto/remove-devices.dto.d.ts.map +0 -1
  107. package/dist/dto/remove-devices.dto.js +0 -79
  108. package/dist/dto/remove-devices.dto.js.map +0 -1
  109. package/dist/dto/set-preferred-method.dto.d.ts +0 -44
  110. package/dist/dto/set-preferred-method.dto.d.ts.map +0 -1
  111. package/dist/dto/set-preferred-method.dto.js +0 -75
  112. package/dist/dto/set-preferred-method.dto.js.map +0 -1
@@ -167,30 +167,22 @@
167
167
  "additionalProperties": false,
168
168
  "description": "Request DTO for admin logout all sessions"
169
169
  },
170
- "AdminRemoveDevicesDTO": {
170
+ "AdminRemoveDeviceDTO": {
171
171
  "type": "object",
172
172
  "properties": {
173
- "methodType": {
174
- "type": "string",
175
- "description": "MFA method type to remove\n\nValidation:\n- Must be one of: totp, sms, email, passkey\n- Max 50 characters\n\nSanitization:\n- Trimmed and lowercased",
173
+ "deviceId": {
174
+ "type": "number",
175
+ "description": "MFA device numeric ID.",
176
176
  "examples": [
177
- "totp"
178
- ]
179
- },
180
- "sub": {
181
- "type": "string",
182
- "description": "Target user's unique identifier (UUID v4)",
183
- "examples": [
184
- "a21b654c-2746-4168-acee-c175083a65cd"
177
+ 123
185
178
  ]
186
179
  }
187
180
  },
188
181
  "required": [
189
- "methodType",
190
- "sub"
182
+ "deviceId"
191
183
  ],
192
184
  "additionalProperties": false,
193
- "description": "Admin DTO for removing MFA devices for a specific user\n\nAdmin APIs must explicitly target a user via `sub`. This DTO mirrors {@link RemoveDevicesDTO } but adds `sub`."
185
+ "description": "Admin DTO for removing a single MFA device by device ID.\n\nAdmin APIs are allowed to target any user's device. This DTO is intentionally minimal: it only requires the `deviceId`."
194
186
  },
195
187
  "AdminResetPasswordDTO": {
196
188
  "type": "object",
@@ -368,30 +360,38 @@
368
360
  "additionalProperties": false,
369
361
  "description": "Admin Set Password Response DTO\n\nResponse DTO for admin password reset operation."
370
362
  },
371
- "AdminSetPreferredMethodDTO": {
363
+ "AdminSetPreferredDeviceDTO": {
372
364
  "type": "object",
373
365
  "properties": {
374
- "methodType": {
366
+ "sub": {
375
367
  "type": "string",
376
- "description": "MFA method type to set as preferred\n\nValidation:\n- Must be one of: totp, sms, email, passkey\n- Max 50 characters\n\nSanitization:\n- Trimmed and lowercased",
377
- "examples": [
378
- "totp"
379
- ]
368
+ "description": "User identifier (UUID)."
380
369
  },
381
- "sub": {
370
+ "deviceId": {
371
+ "type": "number",
372
+ "description": "MFA device ID to set as preferred. Automatically converted from string path parameters to number."
373
+ }
374
+ },
375
+ "required": [
376
+ "sub",
377
+ "deviceId"
378
+ ],
379
+ "additionalProperties": false,
380
+ "description": "DTO for admin setting a user's preferred MFA device."
381
+ },
382
+ "AdminSetPreferredDeviceResponseDTO": {
383
+ "type": "object",
384
+ "properties": {
385
+ "message": {
382
386
  "type": "string",
383
- "description": "Target user's unique identifier (UUID v4)",
384
- "examples": [
385
- "a21b654c-2746-4168-acee-c175083a65cd"
386
- ]
387
+ "description": "Success message."
387
388
  }
388
389
  },
389
390
  "required": [
390
- "methodType",
391
- "sub"
391
+ "message"
392
392
  ],
393
393
  "additionalProperties": false,
394
- "description": "Admin DTO for setting preferred MFA method for a specific user\n\nAdmin APIs must explicitly target a user via `sub`. This DTO mirrors {@link SetPreferredMethodDTO } but adds `sub`."
394
+ "description": "Response DTO for admin setting preferred device."
395
395
  },
396
396
  "AdminSignupDTO": {
397
397
  "type": "object",
@@ -455,7 +455,7 @@
455
455
  "type": "object",
456
456
  "properties": {
457
457
  "user": {
458
- "$ref": "#/components/schemas/UserResponseDto",
458
+ "$ref": "#/components/schemas/UserResponseDTO",
459
459
  "description": "Created user object (sanitized)\n\nUses UserResponseDto which excludes sensitive fields:\n- No passwordHash\n- No internal database ID (uses 'sub' UUID instead)\n- No MFA secrets\n- No internal tracking fields"
460
460
  },
461
461
  "generatedPassword": {
@@ -469,7 +469,7 @@
469
469
  "additionalProperties": false,
470
470
  "description": "Response DTO for admin signup\n\nReturns the created user object (sanitized, excludes sensitive fields like passwordHash) and optionally the generated password (only if generatePassword was true in the request)."
471
471
  },
472
- "UserResponseDto": {
472
+ "UserResponseDTO": {
473
473
  "type": "object",
474
474
  "properties": {
475
475
  "sub": {
@@ -677,7 +677,7 @@
677
677
  "description": "Social account information\n\nConfirms the social account linkage for the imported user."
678
678
  },
679
679
  "user": {
680
- "$ref": "#/components/schemas/UserResponseDto",
680
+ "$ref": "#/components/schemas/UserResponseDTO",
681
681
  "description": "Created user object (sanitized)\n\nUses UserResponseDto which excludes sensitive fields:\n- No passwordHash\n- No internal database ID (uses 'sub' UUID instead)\n- No MFA secrets\n- No internal tracking fields"
682
682
  }
683
683
  },
@@ -1098,6 +1098,10 @@
1098
1098
  "code": {
1099
1099
  "type": "string",
1100
1100
  "description": "Verification code"
1101
+ },
1102
+ "deviceId": {
1103
+ "type": "number",
1104
+ "description": "Optional device ID for methods that support multiple devices (TOTP)"
1101
1105
  }
1102
1106
  },
1103
1107
  "required": [
@@ -1128,6 +1132,10 @@
1128
1132
  "credential": {
1129
1133
  "$ref": "#/components/schemas/Record%3Cstring%2Cunknown%3E",
1130
1134
  "description": "WebAuthn credential from navigator.credentials.get()"
1135
+ },
1136
+ "deviceId": {
1137
+ "type": "number",
1138
+ "description": "Optional device ID for methods that support multiple devices (Passkey)"
1131
1139
  }
1132
1140
  },
1133
1141
  "required": [
@@ -1489,7 +1497,7 @@
1489
1497
  "description": "Lock success flag"
1490
1498
  },
1491
1499
  "user": {
1492
- "$ref": "#/components/schemas/UserResponseDto",
1500
+ "$ref": "#/components/schemas/UserResponseDTO",
1493
1501
  "description": "Sanitized user object with updated lock status"
1494
1502
  },
1495
1503
  "revokedSessions": {
@@ -1527,7 +1535,7 @@
1527
1535
  "description": "Unlock success flag"
1528
1536
  },
1529
1537
  "user": {
1530
- "$ref": "#/components/schemas/UserResponseDto",
1538
+ "$ref": "#/components/schemas/UserResponseDTO",
1531
1539
  "description": "Sanitized user object with updated lock status"
1532
1540
  }
1533
1541
  },
@@ -2254,118 +2262,56 @@
2254
2262
  "devices": {
2255
2263
  "type": "array",
2256
2264
  "items": {
2257
- "$ref": "#/components/schemas/IMFADevice"
2265
+ "$ref": "#/components/schemas/MFADeviceResponseDTO"
2258
2266
  },
2259
- "description": "Array of user's MFA devices"
2267
+ "description": "Array of user's MFA devices (outward-facing format)"
2260
2268
  }
2261
2269
  },
2262
2270
  "required": [
2263
2271
  "devices"
2264
2272
  ],
2265
2273
  "additionalProperties": false,
2266
- "description": "Response DTO for user MFA devices"
2274
+ "description": "Response DTO for user MFA devices\n\nUses outward-facing device DTOs with `isPreferred` instead of internal `isPrimary`"
2267
2275
  },
2268
- "IMFADevice": {
2276
+ "MFADeviceResponseDTO": {
2269
2277
  "type": "object",
2270
2278
  "properties": {
2271
2279
  "id": {
2272
- "type": "number"
2273
- },
2274
- "userId": {
2275
- "type": "number"
2280
+ "type": "number",
2281
+ "description": "Unique device identifier"
2276
2282
  },
2277
2283
  "type": {
2278
- "$ref": "#/components/schemas/MFADeviceMethod"
2284
+ "$ref": "#/components/schemas/MFADeviceMethod",
2285
+ "description": "MFA method type (totp, sms, email, passkey)"
2279
2286
  },
2280
2287
  "name": {
2281
- "type": "string"
2282
- },
2283
- "secret": {
2284
- "type": [
2285
- "string",
2286
- "null"
2287
- ]
2288
- },
2289
- "credentialId": {
2290
- "type": [
2291
- "string",
2292
- "null"
2293
- ]
2294
- },
2295
- "publicKey": {
2296
- "type": [
2297
- "string",
2298
- "null"
2299
- ]
2300
- },
2301
- "counter": {
2302
- "type": [
2303
- "number",
2304
- "null"
2305
- ]
2306
- },
2307
- "transports": {
2308
- "anyOf": [
2309
- {
2310
- "type": "array",
2311
- "items": {
2312
- "type": "string"
2313
- }
2314
- },
2315
- {
2316
- "type": "null"
2317
- }
2318
- ]
2319
- },
2320
- "phoneNumber": {
2321
- "type": [
2322
- "string",
2323
- "null"
2324
- ]
2325
- },
2326
- "email": {
2327
- "type": [
2328
- "string",
2329
- "null"
2330
- ]
2288
+ "type": "string",
2289
+ "description": "Device name (user-assigned)"
2331
2290
  },
2332
- "isPrimary": {
2333
- "type": "boolean"
2291
+ "isPreferred": {
2292
+ "type": "boolean",
2293
+ "description": "Whether this is the preferred device for this method Maps from internal `isPrimary` field"
2334
2294
  },
2335
2295
  "isActive": {
2336
- "type": "boolean"
2337
- },
2338
- "lastUsedAt": {
2339
- "anyOf": [
2340
- {
2341
- "type": "string",
2342
- "format": "date-time"
2343
- },
2344
- {
2345
- "type": "null"
2346
- }
2347
- ]
2296
+ "type": "boolean",
2297
+ "description": "Whether device is currently active"
2348
2298
  },
2349
2299
  "createdAt": {
2350
2300
  "type": "string",
2351
- "format": "date-time"
2301
+ "format": "date-time",
2302
+ "description": "Device creation timestamp"
2352
2303
  }
2353
2304
  },
2354
2305
  "required": [
2355
2306
  "id",
2356
- "userId",
2357
2307
  "type",
2358
2308
  "name",
2359
- "secret",
2360
- "credentialId",
2361
- "publicKey",
2362
- "counter",
2363
- "transports",
2309
+ "isPreferred",
2364
2310
  "isActive",
2365
- "lastUsedAt",
2366
2311
  "createdAt"
2367
2312
  ],
2368
- "additionalProperties": false
2313
+ "additionalProperties": false,
2314
+ "description": "Outward-facing MFA device information\n\nNote: Uses `isPreferred` instead of internal `isPrimary` field"
2369
2315
  },
2370
2316
  "GetUserSessionsDTO": {
2371
2317
  "type": "object",
@@ -2596,7 +2542,7 @@
2596
2542
  "users": {
2597
2543
  "type": "array",
2598
2544
  "items": {
2599
- "$ref": "#/components/schemas/UserResponseDto"
2545
+ "$ref": "#/components/schemas/UserResponseDTO"
2600
2546
  },
2601
2547
  "description": "Array of sanitized user objects"
2602
2548
  },
@@ -2989,41 +2935,46 @@
2989
2935
  "additionalProperties": false,
2990
2936
  "description": "Refresh Token DTO\n\nUsed for refreshing access tokens with a valid refresh token.\n\nSupports both JSON and cookies token delivery modes:\n- JSON mode: refreshToken must be provided in request body\n- Cookies mode: refreshToken is optional in body (read from cookie by controller)\n\nSecurity:\n- Token length validated (prevents DoS)\n- JWT tokens can be long, but we validate input length\n- Token is validated in service layer for format and signature"
2991
2937
  },
2992
- "RemoveDevicesDTO": {
2938
+ "RemoveDeviceDTO": {
2993
2939
  "type": "object",
2994
2940
  "properties": {
2995
- "methodType": {
2996
- "type": "string",
2997
- "description": "MFA method type to remove\n\nValidation:\n- Must be one of: totp, sms, email, passkey\n- Max 50 characters\n\nSanitization:\n- Trimmed and lowercased",
2941
+ "deviceId": {
2942
+ "type": "number",
2943
+ "description": "MFA device ID to remove\n\nValidation:\n- Must be a positive integer\n\nSanitization:\n- Strings are converted to numbers (useful for path params)",
2998
2944
  "examples": [
2999
- "totp"
2945
+ 123
3000
2946
  ]
3001
2947
  }
3002
2948
  },
3003
2949
  "required": [
3004
- "methodType"
2950
+ "deviceId"
3005
2951
  ],
3006
2952
  "additionalProperties": false,
3007
- "description": "DTO for removing MFA devices\n\nUser self-service DTO - no userSub field. Service gets user from authenticated context."
2953
+ "description": "DTO for removing a single MFA device"
3008
2954
  },
3009
- "RemoveDevicesResponseDTO": {
2955
+ "RemoveDeviceResponseDTO": {
3010
2956
  "type": "object",
3011
2957
  "properties": {
3012
- "deletedCount": {
2958
+ "removedDeviceId": {
3013
2959
  "type": "number",
3014
- "description": "Number of devices deleted"
2960
+ "description": "ID of the removed device"
2961
+ },
2962
+ "removedMethod": {
2963
+ "$ref": "#/components/schemas/MFADeviceMethod",
2964
+ "description": "MFA method type of the removed device"
3015
2965
  },
3016
2966
  "mfaDisabled": {
3017
2967
  "type": "boolean",
3018
- "description": "Whether MFA was disabled (if this was the last device)"
2968
+ "description": "Whether MFA was disabled (when this was the last remaining device)"
3019
2969
  }
3020
2970
  },
3021
2971
  "required": [
3022
- "deletedCount",
2972
+ "removedDeviceId",
2973
+ "removedMethod",
3023
2974
  "mfaDisabled"
3024
2975
  ],
3025
2976
  "additionalProperties": false,
3026
- "description": "Response DTO for removing devices"
2977
+ "description": "Response DTO for removing a single MFA device"
3027
2978
  },
3028
2979
  "ResendCodeDTO": {
3029
2980
  "type": "object",
@@ -3192,6 +3143,10 @@
3192
3143
  "$ref": "#/components/schemas/Record%3Cstring%2Cunknown%3E",
3193
3144
  "description": "Passkey credential Required for MFA_REQUIRED when method is 'passkey'\n\nValidation:\n- Must be an object\n- Contains WebAuthn credential from navigator.credentials.get()"
3194
3145
  },
3146
+ "deviceId": {
3147
+ "type": "number",
3148
+ "description": "Optional device ID for MFA_REQUIRED when method supports multiple devices (TOTP, Passkey)\n\nValidation:\n- Must be a positive integer if provided\n- Optional field (maintains backward compatibility)"
3149
+ },
3195
3150
  "setupData": {
3196
3151
  "$ref": "#/components/schemas/Record%3Cstring%2Cunknown%3E",
3197
3152
  "description": "MFA setup data (method-specific) Required for MFA_SETUP_REQUIRED challenge\n\nExpected structure by method:\n- SMS: { phone: string, code: string }\n- Email: { code: string }\n- TOTP: { code: string }\n- Passkey: { credential: Record<string, unknown> }\n\nValidation:\n- Must be an object\n- Structure validated by MFA provider services"
@@ -3418,36 +3373,39 @@
3418
3373
  "additionalProperties": false,
3419
3374
  "description": "Response DTO for setPasswordForSocialUser"
3420
3375
  },
3421
- "SetPreferredMethodDTO": {
3376
+ "SetPreferredDeviceDTO": {
3422
3377
  "type": "object",
3423
3378
  "properties": {
3424
- "methodType": {
3425
- "type": "string",
3426
- "description": "MFA method type to set as preferred\n\nValidation:\n- Must be one of: totp, sms, email, passkey\n- Max 50 characters\n\nSanitization:\n- Trimmed and lowercased",
3379
+ "deviceId": {
3380
+ "type": "number",
3381
+ "description": "MFA device ID to set as preferred\n\nValidation:\n- Must be a positive integer\n\nSanitization:\n- Strings are converted to numbers (useful for path params)",
3427
3382
  "examples": [
3428
- "totp"
3383
+ 123
3429
3384
  ]
3430
3385
  }
3431
3386
  },
3432
3387
  "required": [
3433
- "methodType"
3388
+ "deviceId"
3434
3389
  ],
3435
3390
  "additionalProperties": false,
3436
- "description": "DTO for setting preferred MFA method\n\nUser self-service DTO - no userSub field. Service gets user from authenticated context."
3391
+ "description": "DTO for setting a user's preferred MFA device.\n\nThis updates which device is used by default during MFA challenges. The preferred device is marked with `isPrimary` in the database (internal field). API responses expose this as `isPreferred` (outward-facing field)."
3437
3392
  },
3438
- "SetPreferredMethodResponseDTO": {
3393
+ "SetPreferredDeviceResponseDTO": {
3439
3394
  "type": "object",
3440
3395
  "properties": {
3441
3396
  "message": {
3442
3397
  "type": "string",
3443
- "description": "Success message"
3398
+ "description": "Success message",
3399
+ "examples": [
3400
+ "Preferred MFA device updated"
3401
+ ]
3444
3402
  }
3445
3403
  },
3446
3404
  "required": [
3447
3405
  "message"
3448
3406
  ],
3449
3407
  "additionalProperties": false,
3450
- "description": "Response DTO for setting preferred method"
3408
+ "description": "Response DTO for setting preferred MFA device."
3451
3409
  },
3452
3410
  "SetupMFADTO": {
3453
3411
  "type": "object",
@@ -4010,6 +3968,20 @@
4010
3968
  "additionalProperties": false,
4011
3969
  "description": "Response DTO for MFA code verification"
4012
3970
  },
3971
+ "VerifyMFASetupResponseDTO": {
3972
+ "type": "object",
3973
+ "properties": {
3974
+ "deviceId": {
3975
+ "type": "number",
3976
+ "description": "ID of the newly created MFA device"
3977
+ }
3978
+ },
3979
+ "required": [
3980
+ "deviceId"
3981
+ ],
3982
+ "additionalProperties": false,
3983
+ "description": "Response DTO for verifying MFA setup\n\nReturned when an authenticated user completes MFA device setup verification."
3984
+ },
4013
3985
  "VerifyPhoneResponseDTO": {
4014
3986
  "type": "object",
4015
3987
  "properties": {
@@ -18,7 +18,7 @@ import { DisableUserDTO, DisableUserResponseDTO } from '../dto/disable-user.dto'
18
18
  import { EnableUserDTO, EnableUserResponseDTO } from '../dto/enable-user.dto';
19
19
  import { GetUserByEmailDTO } from '../dto/get-user-by-email.dto';
20
20
  import { GetUserByIdDTO } from '../dto/get-user-by-id.dto';
21
- import { UserResponseDto } from '../dto/user-response.dto';
21
+ import { UserResponseDTO } from '../dto/user-response.dto';
22
22
  import { GetUserSessionsDTO } from '../dto/get-user-sessions.dto';
23
23
  import { GetUserSessionsResponseDTO } from '../dto/get-user-sessions-response.dto';
24
24
  import { LogoutAllResponseDTO } from '../dto/logout-all-response.dto';
@@ -140,7 +140,7 @@ export declare class AdminAuthService {
140
140
  * const user = await adminAuthService.getUserById({ sub: 'user-uuid' });
141
141
  * ```
142
142
  */
143
- getUserById(dto: GetUserByIdDTO): Promise<UserResponseDto | null>;
143
+ getUserById(dto: GetUserByIdDTO): Promise<UserResponseDTO | null>;
144
144
  /**
145
145
  * Get user by email address.
146
146
  *
@@ -153,7 +153,7 @@ export declare class AdminAuthService {
153
153
  * const user = await adminAuthService.getUserByEmail({ email: 'user@example.com' });
154
154
  * ```
155
155
  */
156
- getUserByEmail(dto: GetUserByEmailDTO): Promise<UserResponseDto | null>;
156
+ getUserByEmail(dto: GetUserByEmailDTO): Promise<UserResponseDTO | null>;
157
157
  /**
158
158
  * Require user to change password at next login.
159
159
  *
@@ -179,7 +179,7 @@ export declare class AdminAuthService {
179
179
  * await adminAuthService.updateVerifiedStatus({ sub: 'user-uuid', isEmailVerified: true });
180
180
  * ```
181
181
  */
182
- updateVerifiedStatus(dto: UpdateVerifiedStatusRequestDTO): Promise<UserResponseDto>;
182
+ updateVerifiedStatus(dto: UpdateVerifiedStatusRequestDTO): Promise<UserResponseDTO>;
183
183
  /**
184
184
  * Administrative user creation with override capabilities
185
185
  *
@@ -263,7 +263,7 @@ export declare class AdminAuthService {
263
263
  * const user = await adminAuthService.updateUserAttributes({ sub: 'user-uuid', email: 'new@example.com' });
264
264
  * ```
265
265
  */
266
- updateUserAttributes(dto: AdminUpdateUserAttributesDTO): Promise<UserResponseDto>;
266
+ updateUserAttributes(dto: AdminUpdateUserAttributesDTO): Promise<UserResponseDTO>;
267
267
  /**
268
268
  * Admin-only: Initiate a code-based password reset workflow.
269
269
  *
@@ -303,5 +303,12 @@ export declare class AdminAuthService {
303
303
  * ```
304
304
  */
305
305
  setPassword(dto: AdminSetPasswordDTO): Promise<AdminSetPasswordResponseDTO>;
306
+ /**
307
+ * Calculate grace period status for a user.
308
+ *
309
+ * @param user - User to check
310
+ * @returns Grace period status with isActive flag and endsAt date
311
+ */
312
+ private calculateGracePeriodForUser;
306
313
  }
307
314
  //# sourceMappingURL=admin-auth.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin-auth.service.d.ts","sourceRoot":"","sources":["../../src/services/admin-auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,wBAAwB,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,wBAA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AE,4BAA4B,GAAG,OAAO,CAAC,oCAAoC,CAAC;IAgD5G;;;;;;;;;;;OAWG;IACG,WAAW,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAgDjF;;;;;OAKG;IACH,OAAO,CAAC,2BAA2B;CA4BpC"}
@@ -294,6 +294,8 @@ class AdminAuthService {
294
294
  savedUser = (await this.userRepository.save(user));
295
295
  this.logger?.log?.(`Admin user created successfully: ${dto.email} (sub: ${savedUser.sub})`);
296
296
  try {
297
+ // Calculate grace period status for metadata
298
+ const gracePeriodData = this.calculateGracePeriodForUser(savedUser);
297
299
  await this.auditService?.recordEvent({
298
300
  userId: savedUser.id,
299
301
  eventType: auth_audit_event_type_enum_1.AuthAuditEventType.ACCOUNT_CREATED,
@@ -308,6 +310,12 @@ class AdminAuthService {
308
310
  isPhoneVerified: savedUser.isPhoneVerified,
309
311
  mustChangePassword: savedUser.mustChangePassword,
310
312
  passwordGenerated: !!generatedPassword,
313
+ ...(gracePeriodData.isActive
314
+ ? {
315
+ gracePeriodActive: true,
316
+ gracePeriodEndsAt: gracePeriodData.endsAt?.toISOString(),
317
+ }
318
+ : {}),
311
319
  },
312
320
  });
313
321
  }
@@ -349,7 +357,7 @@ class AdminAuthService {
349
357
  signupType: 'password',
350
358
  adminSignup: true,
351
359
  });
352
- const userDto = user_response_dto_1.UserResponseDto.fromEntity(savedUser);
360
+ const userDto = user_response_dto_1.UserResponseDTO.fromEntity(savedUser);
353
361
  return {
354
362
  user: userDto,
355
363
  generatedPassword,
@@ -448,6 +456,8 @@ class AdminAuthService {
448
456
  await this.socialAuthService.createOrUpdateSocialAccount(savedUser.id, dto.provider, dto.providerId, dto.providerEmail, dto.socialMetadata);
449
457
  this.logger?.log?.(`Admin social user created successfully: ${dto.email} (sub: ${savedUser.sub})`);
450
458
  try {
459
+ // Calculate grace period status for metadata
460
+ const gracePeriodData = this.calculateGracePeriodForUser(savedUser);
451
461
  await this.auditService?.recordEvent({
452
462
  userId: savedUser.id,
453
463
  eventType: auth_audit_event_type_enum_1.AuthAuditEventType.ACCOUNT_CREATED,
@@ -465,6 +475,12 @@ class AdminAuthService {
465
475
  providerId: dto.providerId,
466
476
  hasPassword: !!dto.password,
467
477
  socialImport: true,
478
+ ...(gracePeriodData.isActive
479
+ ? {
480
+ gracePeriodActive: true,
481
+ gracePeriodEndsAt: gracePeriodData.endsAt?.toISOString(),
482
+ }
483
+ : {}),
468
484
  },
469
485
  });
470
486
  }
@@ -510,7 +526,7 @@ class AdminAuthService {
510
526
  signupType: 'social',
511
527
  adminSignup: true,
512
528
  });
513
- const userDto = user_response_dto_1.UserResponseDto.fromEntity(savedUser);
529
+ const userDto = user_response_dto_1.UserResponseDTO.fromEntity(savedUser);
514
530
  return {
515
531
  user: userDto,
516
532
  socialAccount: {
@@ -881,6 +897,34 @@ class AdminAuthService {
881
897
  sessionsRevoked,
882
898
  };
883
899
  }
900
+ /**
901
+ * Calculate grace period status for a user.
902
+ *
903
+ * @param user - User to check
904
+ * @returns Grace period status with isActive flag and endsAt date
905
+ */
906
+ calculateGracePeriodForUser(user) {
907
+ const gracePeriod = this.config.mfa?.gracePeriod ?? 7;
908
+ // No grace period
909
+ if (gracePeriod === 0) {
910
+ return { isActive: false };
911
+ }
912
+ // Access createdAt from user interface
913
+ const userWithDates = user;
914
+ const createdAt = userWithDates.createdAt;
915
+ if (!createdAt) {
916
+ // No creation date - grace period not active
917
+ return { isActive: false };
918
+ }
919
+ const gracePeriodEnd = new Date(createdAt);
920
+ gracePeriodEnd.setDate(gracePeriodEnd.getDate() + gracePeriod);
921
+ const now = new Date();
922
+ const isActive = now < gracePeriodEnd;
923
+ return {
924
+ isActive,
925
+ endsAt: isActive ? gracePeriodEnd : undefined,
926
+ };
927
+ }
884
928
  }
885
929
  exports.AdminAuthService = AdminAuthService;
886
930
  //# sourceMappingURL=admin-auth.service.js.map