@nauth-toolkit/core 0.1.87 → 0.1.89

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 (174) hide show
  1. package/dist/dto/admin-get-mfa-status.dto.d.ts +20 -0
  2. package/dist/dto/admin-get-mfa-status.dto.d.ts.map +1 -0
  3. package/dist/dto/{change-password-request.dto.js → admin-get-mfa-status.dto.js} +22 -32
  4. package/dist/dto/admin-get-mfa-status.dto.js.map +1 -0
  5. package/dist/dto/admin-get-user-auth-history.dto.d.ts +62 -0
  6. package/dist/dto/admin-get-user-auth-history.dto.d.ts.map +1 -0
  7. package/dist/dto/admin-get-user-auth-history.dto.js +87 -0
  8. package/dist/dto/admin-get-user-auth-history.dto.js.map +1 -0
  9. package/dist/dto/admin-logout-all.dto.d.ts +48 -0
  10. package/dist/dto/admin-logout-all.dto.d.ts.map +1 -0
  11. package/dist/dto/admin-logout-all.dto.js +85 -0
  12. package/dist/dto/admin-logout-all.dto.js.map +1 -0
  13. package/dist/dto/admin-remove-devices.dto.d.ts +25 -0
  14. package/dist/dto/admin-remove-devices.dto.d.ts.map +1 -0
  15. package/dist/dto/admin-remove-devices.dto.js +50 -0
  16. package/dist/dto/admin-remove-devices.dto.js.map +1 -0
  17. package/dist/dto/admin-reset-password.dto.d.ts +15 -19
  18. package/dist/dto/admin-reset-password.dto.d.ts.map +1 -1
  19. package/dist/dto/admin-reset-password.dto.js +21 -41
  20. package/dist/dto/admin-reset-password.dto.js.map +1 -1
  21. package/dist/dto/admin-revoke-session.dto.d.ts +22 -0
  22. package/dist/dto/admin-revoke-session.dto.d.ts.map +1 -0
  23. package/dist/dto/admin-revoke-session.dto.js +48 -0
  24. package/dist/dto/admin-revoke-session.dto.js.map +1 -0
  25. package/dist/dto/admin-set-password.dto.d.ts +8 -10
  26. package/dist/dto/admin-set-password.dto.d.ts.map +1 -1
  27. package/dist/dto/admin-set-password.dto.js +11 -21
  28. package/dist/dto/admin-set-password.dto.js.map +1 -1
  29. package/dist/dto/admin-set-preferred-method.dto.d.ts +25 -0
  30. package/dist/dto/admin-set-preferred-method.dto.d.ts.map +1 -0
  31. package/dist/dto/admin-set-preferred-method.dto.js +50 -0
  32. package/dist/dto/admin-set-preferred-method.dto.js.map +1 -0
  33. package/dist/dto/admin-update-user-attributes.dto.d.ts +41 -0
  34. package/dist/dto/admin-update-user-attributes.dto.d.ts.map +1 -0
  35. package/dist/dto/{update-user-attributes-request.dto.js → admin-update-user-attributes.dto.js} +12 -17
  36. package/dist/dto/admin-update-user-attributes.dto.js.map +1 -0
  37. package/dist/dto/auth-challenge.dto.d.ts +2 -2
  38. package/dist/dto/auth-challenge.dto.d.ts.map +1 -1
  39. package/dist/dto/auth-challenge.dto.js +3 -3
  40. package/dist/dto/auth-challenge.dto.js.map +1 -1
  41. package/dist/dto/auth-response.dto.d.ts +1 -1
  42. package/dist/dto/auth-response.dto.d.ts.map +1 -1
  43. package/dist/dto/auth-response.dto.js +1 -1
  44. package/dist/dto/auth-response.dto.js.map +1 -1
  45. package/dist/dto/get-mfa-status.dto.d.ts +3 -32
  46. package/dist/dto/get-mfa-status.dto.d.ts.map +1 -1
  47. package/dist/dto/get-mfa-status.dto.js +4 -55
  48. package/dist/dto/get-mfa-status.dto.js.map +1 -1
  49. package/dist/dto/get-risk-assessment-history.dto.d.ts +3 -3
  50. package/dist/dto/get-risk-assessment-history.dto.d.ts.map +1 -1
  51. package/dist/dto/get-risk-assessment-history.dto.js +5 -5
  52. package/dist/dto/get-risk-assessment-history.dto.js.map +1 -1
  53. package/dist/dto/get-suspicious-activity.dto.d.ts +3 -3
  54. package/dist/dto/get-suspicious-activity.dto.d.ts.map +1 -1
  55. package/dist/dto/get-suspicious-activity.dto.js +5 -5
  56. package/dist/dto/get-suspicious-activity.dto.js.map +1 -1
  57. package/dist/dto/get-user-auth-history.dto.d.ts +4 -39
  58. package/dist/dto/get-user-auth-history.dto.d.ts.map +1 -1
  59. package/dist/dto/get-user-auth-history.dto.js +53 -51
  60. package/dist/dto/get-user-auth-history.dto.js.map +1 -1
  61. package/dist/dto/get-user-devices.dto.d.ts +5 -18
  62. package/dist/dto/get-user-devices.dto.d.ts.map +1 -1
  63. package/dist/dto/get-user-devices.dto.js +5 -39
  64. package/dist/dto/get-user-devices.dto.js.map +1 -1
  65. package/dist/dto/get-user-sessions-response.dto.d.ts +1 -1
  66. package/dist/dto/get-user-sessions-response.dto.js +1 -1
  67. package/dist/dto/get-user-sessions.dto.d.ts +1 -1
  68. package/dist/dto/get-user-sessions.dto.js +1 -1
  69. package/dist/dto/index.d.ts +9 -2
  70. package/dist/dto/index.d.ts.map +1 -1
  71. package/dist/dto/index.js +9 -2
  72. package/dist/dto/index.js.map +1 -1
  73. package/dist/dto/logout-all-response.dto.d.ts +1 -1
  74. package/dist/dto/logout-all-response.dto.js +1 -1
  75. package/dist/dto/logout-all.dto.d.ts +1 -18
  76. package/dist/dto/logout-all.dto.d.ts.map +1 -1
  77. package/dist/dto/logout-all.dto.js +1 -30
  78. package/dist/dto/logout-all.dto.js.map +1 -1
  79. package/dist/dto/logout-session.dto.d.ts +0 -5
  80. package/dist/dto/logout-session.dto.d.ts.map +1 -1
  81. package/dist/dto/logout-session.dto.js +0 -12
  82. package/dist/dto/logout-session.dto.js.map +1 -1
  83. package/dist/dto/logout.dto.d.ts +1 -18
  84. package/dist/dto/logout.dto.d.ts.map +1 -1
  85. package/dist/dto/logout.dto.js +1 -30
  86. package/dist/dto/logout.dto.js.map +1 -1
  87. package/dist/dto/remove-devices.dto.d.ts +4 -16
  88. package/dist/dto/remove-devices.dto.d.ts.map +1 -1
  89. package/dist/dto/remove-devices.dto.js +4 -26
  90. package/dist/dto/remove-devices.dto.js.map +1 -1
  91. package/dist/dto/set-mfa-exemption.dto.d.ts +8 -9
  92. package/dist/dto/set-mfa-exemption.dto.d.ts.map +1 -1
  93. package/dist/dto/set-mfa-exemption.dto.js +11 -13
  94. package/dist/dto/set-mfa-exemption.dto.js.map +1 -1
  95. package/dist/dto/set-must-change-password.dto.d.ts +3 -3
  96. package/dist/dto/set-must-change-password.dto.d.ts.map +1 -1
  97. package/dist/dto/set-must-change-password.dto.js +5 -5
  98. package/dist/dto/set-must-change-password.dto.js.map +1 -1
  99. package/dist/dto/set-preferred-method.dto.d.ts +4 -16
  100. package/dist/dto/set-preferred-method.dto.d.ts.map +1 -1
  101. package/dist/dto/set-preferred-method.dto.js +4 -26
  102. package/dist/dto/set-preferred-method.dto.js.map +1 -1
  103. package/dist/dto/setup-mfa.dto.d.ts +3 -18
  104. package/dist/dto/setup-mfa.dto.d.ts.map +1 -1
  105. package/dist/dto/setup-mfa.dto.js +3 -30
  106. package/dist/dto/setup-mfa.dto.js.map +1 -1
  107. package/dist/dto/social-auth.dto.d.ts +4 -34
  108. package/dist/dto/social-auth.dto.d.ts.map +1 -1
  109. package/dist/dto/social-auth.dto.js +10 -68
  110. package/dist/dto/social-auth.dto.js.map +1 -1
  111. package/dist/dto/update-user-attributes.dto.d.ts +26 -0
  112. package/dist/dto/update-user-attributes.dto.d.ts.map +1 -0
  113. package/dist/dto/update-user-attributes.dto.js +30 -0
  114. package/dist/dto/update-user-attributes.dto.js.map +1 -0
  115. package/dist/index.d.ts +5 -0
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +5 -0
  118. package/dist/index.js.map +1 -1
  119. package/dist/interfaces/hooks.interface.d.ts +2 -1
  120. package/dist/interfaces/hooks.interface.d.ts.map +1 -1
  121. package/dist/interfaces/mfa-provider.interface.d.ts +7 -8
  122. package/dist/interfaces/mfa-provider.interface.d.ts.map +1 -1
  123. package/dist/interfaces/provider.interface.d.ts +1 -1
  124. package/dist/interfaces/provider.interface.d.ts.map +1 -1
  125. package/dist/services/adaptive-mfa-decision.service.js +2 -2
  126. package/dist/services/adaptive-mfa-decision.service.js.map +1 -1
  127. package/dist/services/admin-auth.service.d.ts +307 -0
  128. package/dist/services/admin-auth.service.d.ts.map +1 -0
  129. package/dist/services/admin-auth.service.js +885 -0
  130. package/dist/services/admin-auth.service.js.map +1 -0
  131. package/dist/services/auth-audit.service.d.ts +16 -16
  132. package/dist/services/auth-audit.service.d.ts.map +1 -1
  133. package/dist/services/auth-audit.service.js +33 -33
  134. package/dist/services/auth-audit.service.js.map +1 -1
  135. package/dist/services/auth-challenge-helper.service.js +3 -3
  136. package/dist/services/auth-challenge-helper.service.js.map +1 -1
  137. package/dist/services/auth-service-internal-helpers.d.ts +13 -2
  138. package/dist/services/auth-service-internal-helpers.d.ts.map +1 -1
  139. package/dist/services/auth-service-internal-helpers.js +39 -1
  140. package/dist/services/auth-service-internal-helpers.js.map +1 -1
  141. package/dist/services/auth.service.d.ts +94 -438
  142. package/dist/services/auth.service.d.ts.map +1 -1
  143. package/dist/services/auth.service.js +388 -1255
  144. package/dist/services/auth.service.js.map +1 -1
  145. package/dist/services/mfa-base.service.d.ts +14 -4
  146. package/dist/services/mfa-base.service.d.ts.map +1 -1
  147. package/dist/services/mfa-base.service.js +22 -1
  148. package/dist/services/mfa-base.service.js.map +1 -1
  149. package/dist/services/mfa.service.d.ts +107 -33
  150. package/dist/services/mfa.service.d.ts.map +1 -1
  151. package/dist/services/mfa.service.js +456 -333
  152. package/dist/services/mfa.service.js.map +1 -1
  153. package/dist/services/social-auth.service.d.ts +7 -0
  154. package/dist/services/social-auth.service.d.ts.map +1 -1
  155. package/dist/services/social-auth.service.js +38 -26
  156. package/dist/services/social-auth.service.js.map +1 -1
  157. package/dist/services/user.service.d.ts +3 -3
  158. package/dist/services/user.service.d.ts.map +1 -1
  159. package/dist/services/user.service.js +7 -7
  160. package/dist/services/user.service.js.map +1 -1
  161. package/dist/utils/dto-validator.d.ts.map +1 -1
  162. package/dist/utils/dto-validator.js +50 -4
  163. package/dist/utils/dto-validator.js.map +1 -1
  164. package/dist/utils/setup/init-services.d.ts +2 -1
  165. package/dist/utils/setup/init-services.d.ts.map +1 -1
  166. package/dist/utils/setup/init-services.js +2 -0
  167. package/dist/utils/setup/init-services.js.map +1 -1
  168. package/package.json +1 -1
  169. package/dist/dto/change-password-request.dto.d.ts +0 -43
  170. package/dist/dto/change-password-request.dto.d.ts.map +0 -1
  171. package/dist/dto/change-password-request.dto.js.map +0 -1
  172. package/dist/dto/update-user-attributes-request.dto.d.ts +0 -44
  173. package/dist/dto/update-user-attributes-request.dto.d.ts.map +0 -1
  174. package/dist/dto/update-user-attributes-request.dto.js.map +0 -1
@@ -0,0 +1,307 @@
1
+ import { Repository } from 'typeorm';
2
+ import { BaseUser, BaseLoginAttempt, BaseMFADevice, BaseChallengeSession, BaseVerificationToken, BaseSocialAccount, BaseAuthAudit, BaseTrustedDevice, BaseSession } from '../entities';
3
+ import { PasswordService } from './password.service';
4
+ import { SessionService } from './session.service';
5
+ import { EmailVerificationService } from './email-verification.service';
6
+ import { PhoneVerificationService } from './phone-verification.service';
7
+ import { ClientInfoService } from './client-info.service';
8
+ import { ChallengeService } from './challenge.service';
9
+ import { AuthChallengeHelperService } from './auth-challenge-helper.service';
10
+ import { AccountLockoutStorageService } from '../storage/account-lockout-storage.service';
11
+ import { InternalAuthAuditService as AuthAuditService } from './auth-audit.service';
12
+ import { TrustedDeviceService } from './trusted-device.service';
13
+ import { AdminSignupDTO, AdminSignupResponseDTO } from '../dto/admin-signup.dto';
14
+ import { AdminSignupSocialDTO, AdminSignupSocialResponseDTO } from '../dto/admin-signup-social.dto';
15
+ import { DeleteUserDTO, DeleteUserResponseDTO } from '../dto/delete-user.dto';
16
+ import { GetUsersDTO, GetUsersResponseDTO } from '../dto/get-users.dto';
17
+ import { DisableUserDTO, DisableUserResponseDTO } from '../dto/disable-user.dto';
18
+ import { EnableUserDTO, EnableUserResponseDTO } from '../dto/enable-user.dto';
19
+ import { GetUserByEmailDTO } from '../dto/get-user-by-email.dto';
20
+ import { GetUserByIdDTO } from '../dto/get-user-by-id.dto';
21
+ import { UserResponseDto } from '../dto/user-response.dto';
22
+ import { GetUserSessionsDTO } from '../dto/get-user-sessions.dto';
23
+ import { GetUserSessionsResponseDTO } from '../dto/get-user-sessions-response.dto';
24
+ import { LogoutAllResponseDTO } from '../dto/logout-all-response.dto';
25
+ import { AdminLogoutAllDTO } from '../dto/admin-logout-all.dto';
26
+ import { AdminRevokeSessionDTO } from '../dto/admin-revoke-session.dto';
27
+ import { LogoutSessionResponseDTO } from '../dto/logout-session-response.dto';
28
+ import { SetMustChangePasswordDTO } from '../dto/set-must-change-password.dto';
29
+ import { SetMustChangePasswordResponseDTO } from '../dto/set-must-change-password-response.dto';
30
+ import { AdminSetPasswordDTO, AdminSetPasswordResponseDTO } from '../dto/admin-set-password.dto';
31
+ import { AdminResetPasswordDTO, AdminResetPasswordResponseDTO, ConfirmAdminResetPasswordDTO, ConfirmAdminResetPasswordResponseDTO } from '../dto/admin-reset-password.dto';
32
+ import { UpdateVerifiedStatusRequestDTO } from '../dto/update-verified-status-request.dto';
33
+ import { NAuthConfig } from '../interfaces/config.interface';
34
+ import { NAuthLogger } from '../utils/nauth-logger';
35
+ import { HookRegistryService } from './hook-registry.service';
36
+ import { PasswordResetService } from './password-reset.service';
37
+ import { SocialAuthService } from './social-auth.service';
38
+ import { AdminUpdateUserAttributesDTO } from '../dto/admin-update-user-attributes.dto';
39
+ /**
40
+ * Administrative authentication service
41
+ *
42
+ * Provides admin-only operations for managing users, sessions, and password workflows.
43
+ * This service is intentionally separate from AuthService to keep user self-service
44
+ * APIs isolated from admin actions.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const result = await adminAuthService.disableUser({ sub: 'user-uuid' });
49
+ * ```
50
+ */
51
+ export declare class AdminAuthService {
52
+ private readonly userRepository;
53
+ private readonly loginAttemptRepository;
54
+ private readonly passwordService;
55
+ private readonly sessionService;
56
+ private readonly challengeService;
57
+ private readonly challengeHelper;
58
+ private readonly emailVerificationService;
59
+ private readonly clientInfoService;
60
+ private readonly accountLockoutStorage;
61
+ private readonly config;
62
+ private readonly logger;
63
+ private readonly hookRegistry;
64
+ private readonly auditService?;
65
+ private readonly phoneVerificationService?;
66
+ private readonly mfaDeviceRepository?;
67
+ private readonly trustedDeviceService?;
68
+ private readonly passwordResetService?;
69
+ private readonly socialAuthService?;
70
+ private readonly sessionRepository?;
71
+ private readonly verificationTokenRepository?;
72
+ private readonly socialAccountRepository?;
73
+ private readonly challengeSessionRepository?;
74
+ private readonly authAuditRepository?;
75
+ private readonly trustedDeviceRepository?;
76
+ private readonly helpers;
77
+ private readonly userService;
78
+ constructor(userRepository: Repository<BaseUser>, loginAttemptRepository: Repository<BaseLoginAttempt>, passwordService: PasswordService, sessionService: SessionService, challengeService: ChallengeService, challengeHelper: AuthChallengeHelperService, emailVerificationService: EmailVerificationService, clientInfoService: ClientInfoService, accountLockoutStorage: AccountLockoutStorageService, config: NAuthConfig, logger: NAuthLogger, hookRegistry: HookRegistryService, auditService?: AuthAuditService | undefined, phoneVerificationService?: PhoneVerificationService | undefined, mfaDeviceRepository?: Repository<BaseMFADevice> | undefined, trustedDeviceService?: TrustedDeviceService | undefined, passwordResetService?: PasswordResetService | undefined, socialAuthService?: SocialAuthService | undefined, sessionRepository?: Repository<BaseSession> | undefined, verificationTokenRepository?: Repository<BaseVerificationToken> | undefined, socialAccountRepository?: Repository<BaseSocialAccount> | undefined, challengeSessionRepository?: Repository<BaseChallengeSession> | undefined, authAuditRepository?: Repository<BaseAuthAudit> | undefined, trustedDeviceRepository?: Repository<BaseTrustedDevice> | undefined);
79
+ /**
80
+ * Administrative user deletion with complete cascade cleanup
81
+ *
82
+ * @param dto - User sub to delete
83
+ * @returns Deletion confirmation with cascade counts
84
+ * @throws {NAuthException} USER_NOT_FOUND
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const result = await adminAuthService.deleteUser({ sub: 'user-uuid-123' });
89
+ * ```
90
+ */
91
+ deleteUser(dto: DeleteUserDTO): Promise<DeleteUserResponseDTO>;
92
+ /**
93
+ * Get paginated list of users with advanced filtering
94
+ *
95
+ * @param dto - Filters, pagination, sorting
96
+ * @returns Paginated user list with metadata
97
+ * @throws {NAuthException} When validation fails
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * const result = await adminAuthService.getUsers({ page: 1, limit: 20 });
102
+ * ```
103
+ */
104
+ getUsers(dto: GetUsersDTO): Promise<GetUsersResponseDTO>;
105
+ /**
106
+ * Administrative permanent account locking
107
+ *
108
+ * @param dto - User sub and optional reason
109
+ * @returns User object with updated lock status and revoked session count
110
+ * @throws {NAuthException} USER_NOT_FOUND
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * const result = await adminAuthService.disableUser({ sub: 'user-uuid-123' });
115
+ * ```
116
+ */
117
+ disableUser(dto: DisableUserDTO): Promise<DisableUserResponseDTO>;
118
+ /**
119
+ * Enable (unlock) user account
120
+ *
121
+ * @param dto - User sub to enable
122
+ * @returns User object with updated lock status
123
+ * @throws {NAuthException} USER_NOT_FOUND
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * const result = await adminAuthService.enableUser({ sub: 'user-uuid-123' });
128
+ * ```
129
+ */
130
+ enableUser(dto: EnableUserDTO): Promise<EnableUserResponseDTO>;
131
+ /**
132
+ * Get user by ID (sub)
133
+ *
134
+ * @param dto - GetUserByIdDTO containing sub
135
+ * @returns User response DTO or null if not found
136
+ * @throws {NAuthException} When validation fails
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * const user = await adminAuthService.getUserById({ sub: 'user-uuid' });
141
+ * ```
142
+ */
143
+ getUserById(dto: GetUserByIdDTO): Promise<UserResponseDto | null>;
144
+ /**
145
+ * Get user by email address.
146
+ *
147
+ * @param dto - GetUserByEmailDTO containing email and optional requireEmailVerified
148
+ * @returns User response DTO or null if not found
149
+ * @throws {NAuthException} When validation fails
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * const user = await adminAuthService.getUserByEmail({ email: 'user@example.com' });
154
+ * ```
155
+ */
156
+ getUserByEmail(dto: GetUserByEmailDTO): Promise<UserResponseDto | null>;
157
+ /**
158
+ * Require user to change password at next login.
159
+ *
160
+ * @param dto - SetMustChangePasswordDTO containing sub
161
+ * @returns Success response
162
+ * @throws {NAuthException} If user is not found or cannot change password
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * await adminAuthService.setMustChangePassword({ sub: 'user-uuid-123' });
167
+ * ```
168
+ */
169
+ setMustChangePassword(dto: SetMustChangePasswordDTO): Promise<SetMustChangePasswordResponseDTO>;
170
+ /**
171
+ * Update email and/or phone verification status.
172
+ *
173
+ * @param dto - Request DTO containing sub and verification status flags
174
+ * @returns Updated user object
175
+ * @throws {NAuthException} If user not found or trying to verify non-existent email/phone
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * await adminAuthService.updateVerifiedStatus({ sub: 'user-uuid', isEmailVerified: true });
180
+ * ```
181
+ */
182
+ updateVerifiedStatus(dto: UpdateVerifiedStatusRequestDTO): Promise<UserResponseDto>;
183
+ /**
184
+ * Administrative user creation with override capabilities
185
+ *
186
+ * @param dto - Admin signup DTO with override flags
187
+ * @returns User object and optionally generated password
188
+ * @throws {NAuthException} EMAIL_EXISTS | USERNAME_EXISTS | PHONE_EXISTS | WEAK_PASSWORD
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const result = await adminAuthService.signup({ email: 'user@example.com', generatePassword: true });
193
+ * ```
194
+ */
195
+ signup(dto: AdminSignupDTO): Promise<AdminSignupResponseDTO>;
196
+ /**
197
+ * Administrative social user import with override capabilities
198
+ *
199
+ * @param dto - Admin social signup DTO with social account details
200
+ * @returns User object and social account confirmation
201
+ * @throws {NAuthException} EMAIL_EXISTS | USERNAME_EXISTS | PHONE_EXISTS | SOCIAL_ACCOUNT_EXISTS | WEAK_PASSWORD
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * const result = await adminAuthService.signupSocial({
206
+ * email: 'user@example.com',
207
+ * provider: 'google',
208
+ * providerId: 'google_12345',
209
+ * });
210
+ * ```
211
+ */
212
+ signupSocial(dto: AdminSignupSocialDTO): Promise<AdminSignupSocialResponseDTO>;
213
+ /**
214
+ * Global signout (admin-initiated)
215
+ *
216
+ * @param dto - Target user sub and optional forgetDevices flag
217
+ * @returns Number of sessions revoked
218
+ * @throws {NAuthException} NOT_FOUND if user not found
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * const result = await adminAuthService.logoutAll({ sub: 'user-uuid', forgetDevices: true });
223
+ * ```
224
+ */
225
+ logoutAll(dto: AdminLogoutAllDTO): Promise<LogoutAllResponseDTO>;
226
+ /**
227
+ * Get all active sessions for a user (admin)
228
+ *
229
+ * @param dto - Contains target user sub
230
+ * @returns Array of sessions with device info, auth method, and isCurrent flag
231
+ * @throws {NAuthException} NOT_FOUND if user not found
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const result = await adminAuthService.getUserSessions({ sub: 'user-uuid' });
236
+ * ```
237
+ */
238
+ getUserSessions(dto: GetUserSessionsDTO): Promise<GetUserSessionsResponseDTO>;
239
+ /**
240
+ * Revoke a specific user session by ID (admin)
241
+ *
242
+ * @param dto - Contains sessionId and user sub
243
+ * @returns Success status and whether it was the current session
244
+ * @throws {NAuthException} NOT_FOUND if user not found
245
+ * @throws {NAuthException} SESSION_NOT_FOUND if session not found
246
+ * @throws {NAuthException} FORBIDDEN if session doesn't belong to user
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * await adminAuthService.revokeUserSession({ sub: 'user-uuid', sessionId: '123' });
251
+ * ```
252
+ */
253
+ revokeUserSession(dto: AdminRevokeSessionDTO): Promise<LogoutSessionResponseDTO>;
254
+ /**
255
+ * Update user profile attributes (admin)
256
+ *
257
+ * @param dto - AdminUpdateUserAttributesDTO containing sub and fields to update
258
+ * @returns Updated user object
259
+ * @throws {NAuthException} If user not found or unique constraint violated
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * const user = await adminAuthService.updateUserAttributes({ sub: 'user-uuid', email: 'new@example.com' });
264
+ * ```
265
+ */
266
+ updateUserAttributes(dto: AdminUpdateUserAttributesDTO): Promise<UserResponseDto>;
267
+ /**
268
+ * Admin-only: Initiate a code-based password reset workflow.
269
+ *
270
+ * @param dto - Admin reset password request
271
+ * @returns Response with masked destination, expiry, and sessions revoked count
272
+ * @throws {NAuthException} NOT_FOUND when user not found
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * const result = await adminAuthService.resetPassword({ sub: 'user-uuid', deliveryMethod: 'email' });
277
+ * ```
278
+ */
279
+ resetPassword(dto: AdminResetPasswordDTO): Promise<AdminResetPasswordResponseDTO>;
280
+ /**
281
+ * Complete admin-initiated password reset with a verification code.
282
+ *
283
+ * @param dto - Confirm admin reset password request
284
+ * @returns Success response
285
+ * @throws {NAuthException} NOT_FOUND | PASSWORD_RESET_CODE_INVALID | PASSWORD_RESET_CODE_EXPIRED | PASSWORD_RESET_MAX_ATTEMPTS | WEAK_PASSWORD | PASSWORD_REUSED | INVALID_CREDENTIALS
286
+ *
287
+ * @example
288
+ * ```typescript
289
+ * await adminAuthService.confirmResetPassword({ sub: 'user-uuid', code: '123456', newPassword: 'NewPass123!' });
290
+ * ```
291
+ */
292
+ confirmResetPassword(dto: ConfirmAdminResetPasswordDTO): Promise<ConfirmAdminResetPasswordResponseDTO>;
293
+ /**
294
+ * Admin-only: Reset a user's password by sub.
295
+ *
296
+ * @param dto - Admin reset password request
297
+ * @returns Response with success status and session revocation count
298
+ * @throws {NAuthException} If user not found, user has no password (social-only), or password validation fails
299
+ *
300
+ * @example
301
+ * ```typescript
302
+ * const result = await adminAuthService.setPassword({ sub: 'user-uuid', newPassword: 'NewPass123!' });
303
+ * ```
304
+ */
305
+ setPassword(dto: AdminSetPasswordDTO): Promise<AdminSetPasswordResponseDTO>;
306
+ }
307
+ //# sourceMappingURL=admin-auth.service.d.ts.map
@@ -0,0 +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,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