@nauth-toolkit/core 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dto/admin-signup-social.dto.d.ts +257 -0
- package/dist/dto/admin-signup-social.dto.d.ts.map +1 -0
- package/dist/dto/admin-signup-social.dto.js +389 -0
- package/dist/dto/admin-signup-social.dto.js.map +1 -0
- package/dist/dto/delete-user.dto.d.ts +71 -0
- package/dist/dto/delete-user.dto.d.ts.map +1 -0
- package/dist/dto/delete-user.dto.js +82 -0
- package/dist/dto/delete-user.dto.js.map +1 -0
- package/dist/dto/disable-user.dto.d.ts +61 -0
- package/dist/dto/disable-user.dto.d.ts.map +1 -0
- package/dist/dto/disable-user.dto.js +86 -0
- package/dist/dto/disable-user.dto.js.map +1 -0
- package/dist/dto/enable-user.dto.d.ts +44 -0
- package/dist/dto/enable-user.dto.d.ts.map +1 -0
- package/dist/dto/enable-user.dto.js +63 -0
- package/dist/dto/enable-user.dto.js.map +1 -0
- package/dist/dto/get-users.dto.d.ts +154 -0
- package/dist/dto/get-users.dto.d.ts.map +1 -0
- package/dist/dto/get-users.dto.js +250 -0
- package/dist/dto/get-users.dto.js.map +1 -0
- package/dist/dto/index.d.ts +5 -0
- package/dist/dto/index.d.ts.map +1 -1
- package/dist/dto/index.js +5 -0
- package/dist/dto/index.js.map +1 -1
- package/dist/dto/user-response.dto.d.ts +5 -0
- package/dist/dto/user-response.dto.d.ts.map +1 -1
- package/dist/dto/user-response.dto.js +6 -0
- package/dist/dto/user-response.dto.js.map +1 -1
- package/dist/dto/verify-email.dto.d.ts +10 -0
- package/dist/dto/verify-email.dto.d.ts.map +1 -1
- package/dist/dto/verify-email.dto.js +16 -0
- package/dist/dto/verify-email.dto.js.map +1 -1
- package/dist/entities/user.entity.d.ts +18 -2
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +18 -2
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/enums/auth-audit-event-type.enum.d.ts +5 -0
- package/dist/enums/auth-audit-event-type.enum.d.ts.map +1 -1
- package/dist/enums/auth-audit-event-type.enum.js +5 -0
- package/dist/enums/auth-audit-event-type.enum.js.map +1 -1
- package/dist/enums/error-codes.enum.d.ts +13 -0
- package/dist/enums/error-codes.enum.d.ts.map +1 -1
- package/dist/enums/error-codes.enum.js +13 -0
- package/dist/enums/error-codes.enum.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/services/auth.service.d.ts +172 -2
- package/dist/services/auth.service.d.ts.map +1 -1
- package/dist/services/auth.service.js +862 -2
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/email-verification.service.d.ts.map +1 -1
- package/dist/services/email-verification.service.js +7 -7
- package/dist/services/email-verification.service.js.map +1 -1
- package/dist/services/social-auth-base.service.d.ts +5 -1
- package/dist/services/social-auth-base.service.d.ts.map +1 -1
- package/dist/services/social-auth-base.service.js +62 -2
- package/dist/services/social-auth-base.service.js.map +1 -1
- package/dist/services/social-auth.service.d.ts +2 -1
- package/dist/services/social-auth.service.d.ts.map +1 -1
- package/dist/services/social-auth.service.js +5 -1
- package/dist/services/social-auth.service.js.map +1 -1
- package/dist/{handlers → services}/social-redirect.handler.d.ts.map +1 -1
- package/dist/{handlers → services}/social-redirect.handler.js.map +1 -1
- package/dist/utils/setup/init-services.d.ts.map +1 -1
- package/dist/utils/setup/init-services.js +2 -1
- package/dist/utils/setup/init-services.js.map +1 -1
- package/package.json +1 -1
- /package/dist/{handlers → services}/social-redirect.handler.d.ts +0 -0
- /package/dist/{handlers → services}/social-redirect.handler.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.enum.js","sourceRoot":"","sources":["../../src/enums/error-codes.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"error-codes.enum.js","sourceRoot":"","sources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AIG;IACH,kDAAiC,CAAA;IAEjC;;;;OAIG;IACH,kDAAiC,CAAA;IAEjC;;;;OAIG;IACH,wCAAuB,CAAA;IAEvB;;;;OAIG;IACH,4DAA2C,CAAA;IAE3C,+EAA+E;IAC/E,mCAAmC;IACnC,+EAA+E;IAE/E;;;;;;;;;;OAUG;IACH,sEAAqD,CAAA;AACvD,CAAC,EAvbW,aAAa,6BAAb,aAAa,QAubxB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -58,5 +58,5 @@ export * from './bootstrap';
|
|
|
58
58
|
export * from './platform/interfaces';
|
|
59
59
|
export * from './adapters';
|
|
60
60
|
export * from './adapters/storage.factory';
|
|
61
|
-
export * from './
|
|
61
|
+
export * from './services/social-redirect.handler';
|
|
62
62
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -118,5 +118,5 @@ __exportStar(require("./adapters/storage.factory"), exports);
|
|
|
118
118
|
// ============================================================================
|
|
119
119
|
// Framework-neutral Handlers (for consumer backends to delegate to)
|
|
120
120
|
// ============================================================================
|
|
121
|
-
__exportStar(require("./
|
|
121
|
+
__exportStar(require("./services/social-redirect.handler"), exports);
|
|
122
122
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { IUser } from '../interfaces/entities.interface';
|
|
3
|
-
import { BaseUser, BaseLoginAttempt, BaseMFADevice } from '../entities';
|
|
3
|
+
import { BaseUser, BaseLoginAttempt, BaseMFADevice, BaseChallengeSession, BaseVerificationToken, BaseSocialAccount, BaseAuthAudit, BaseTrustedDevice, BaseSession } from '../entities';
|
|
4
4
|
import { PasswordService } from './password.service';
|
|
5
5
|
import { JwtService } from './jwt.service';
|
|
6
6
|
import { SessionService } from './session.service';
|
|
@@ -15,6 +15,11 @@ import { TrustedDeviceService } from './trusted-device.service';
|
|
|
15
15
|
import { MFAService } from './mfa.service';
|
|
16
16
|
import { SignupDTO } from '../dto/signup.dto';
|
|
17
17
|
import { AdminSignupDTO, AdminSignupResponseDTO } from '../dto/admin-signup.dto';
|
|
18
|
+
import { AdminSignupSocialDTO, AdminSignupSocialResponseDTO } from '../dto/admin-signup-social.dto';
|
|
19
|
+
import { DeleteUserDTO, DeleteUserResponseDTO } from '../dto/delete-user.dto';
|
|
20
|
+
import { GetUsersDTO, GetUsersResponseDTO } from '../dto/get-users.dto';
|
|
21
|
+
import { DisableUserDTO, DisableUserResponseDTO } from '../dto/disable-user.dto';
|
|
22
|
+
import { EnableUserDTO, EnableUserResponseDTO } from '../dto/enable-user.dto';
|
|
18
23
|
import { LoginDTO } from '../dto/login.dto';
|
|
19
24
|
import { ChangePasswordRequestDTO } from '../dto/change-password-request.dto';
|
|
20
25
|
import { ChangePasswordResponseDTO } from '../dto/change-password-response.dto';
|
|
@@ -39,6 +44,7 @@ import { ConfirmForgotPasswordDTO, ConfirmForgotPasswordResponseDTO } from '../d
|
|
|
39
44
|
import { TrustDeviceResponseDTO } from '../dto/trust-device-response.dto';
|
|
40
45
|
import { IsTrustedDeviceResponseDTO } from '../dto/is-trusted-device-response.dto';
|
|
41
46
|
import { PasswordResetService } from './password-reset.service';
|
|
47
|
+
import { SocialAuthService } from './social-auth.service';
|
|
42
48
|
import { NAuthConfig } from '../interfaces/config.interface';
|
|
43
49
|
import { NAuthLogger } from '../utils/nauth-logger';
|
|
44
50
|
export declare class AuthService {
|
|
@@ -60,12 +66,26 @@ export declare class AuthService {
|
|
|
60
66
|
private readonly mfaDeviceRepository?;
|
|
61
67
|
private readonly trustedDeviceService?;
|
|
62
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?;
|
|
63
76
|
constructor(userRepository: Repository<BaseUser>, loginAttemptRepository: Repository<BaseLoginAttempt>, passwordService: PasswordService, jwtService: JwtService, sessionService: SessionService, challengeService: ChallengeService, challengeHelper: AuthChallengeHelperService, emailVerificationService: EmailVerificationService, clientInfoService: ClientInfoService, accountLockoutStorage: AccountLockoutStorageService, config: NAuthConfig, logger: NAuthLogger, auditService?: AuthAuditService | undefined, // Optional - audit trail service (enabled via config.auditLogs.enabled)
|
|
64
77
|
phoneVerificationService?: PhoneVerificationService | undefined, // Optional - only available when SMS provider is configured
|
|
65
78
|
mfaService?: MFAService | undefined, // Optional - available when MFA modules are imported
|
|
66
79
|
mfaDeviceRepository?: Repository<BaseMFADevice> | undefined, // Optional - available when MFA modules are imported
|
|
67
80
|
trustedDeviceService?: TrustedDeviceService | undefined, // Optional - only available when rememberDevices is not 'never'
|
|
68
|
-
passwordResetService?: PasswordResetService | undefined
|
|
81
|
+
passwordResetService?: PasswordResetService | undefined, // Optional - only available when configured by framework adapter
|
|
82
|
+
socialAuthService?: SocialAuthService | undefined, // Optional - only available when social auth is configured
|
|
83
|
+
sessionRepository?: Repository<BaseSession> | undefined, // Optional - for cascade deletion
|
|
84
|
+
verificationTokenRepository?: Repository<BaseVerificationToken> | undefined, // Optional - for cascade deletion
|
|
85
|
+
socialAccountRepository?: Repository<BaseSocialAccount> | undefined, // Optional - for cascade deletion
|
|
86
|
+
challengeSessionRepository?: Repository<BaseChallengeSession> | undefined, // Optional - for cascade deletion
|
|
87
|
+
authAuditRepository?: Repository<BaseAuthAudit> | undefined, // Optional - for cascade deletion
|
|
88
|
+
trustedDeviceRepository?: Repository<BaseTrustedDevice> | undefined);
|
|
69
89
|
/**
|
|
70
90
|
* Register a new user.
|
|
71
91
|
*
|
|
@@ -124,6 +144,156 @@ export declare class AuthService {
|
|
|
124
144
|
* ```
|
|
125
145
|
*/
|
|
126
146
|
adminSignup(dto: AdminSignupDTO): Promise<AdminSignupResponseDTO>;
|
|
147
|
+
/**
|
|
148
|
+
* Administrative social user import with override capabilities
|
|
149
|
+
*
|
|
150
|
+
* Allows administrators to import existing social users from external platforms
|
|
151
|
+
* (e.g., Cognito, Auth0) into nauth with:
|
|
152
|
+
* - Bypass email/phone verification requirements
|
|
153
|
+
* - Optional password for hybrid social+password accounts
|
|
154
|
+
* - Social account linkage (provider + providerId)
|
|
155
|
+
* - Automatic user flag updates (hasSocialAuth)
|
|
156
|
+
*
|
|
157
|
+
* Use case: Migrating users from external authentication platforms while
|
|
158
|
+
* preserving their social login connections for transparent future logins.
|
|
159
|
+
*
|
|
160
|
+
* Security:
|
|
161
|
+
* - No built-in authentication - endpoint must be protected by framework adapter
|
|
162
|
+
* - All duplicate checks enforced (email, username, phone, provider+providerId)
|
|
163
|
+
* - Password policy enforced if password provided
|
|
164
|
+
* - Audit trail records admin-imported social accounts
|
|
165
|
+
*
|
|
166
|
+
* @param dto - Admin social signup DTO with social account details
|
|
167
|
+
* @returns User object and social account confirmation
|
|
168
|
+
* @throws {NAuthException} EMAIL_EXISTS | USERNAME_EXISTS | PHONE_EXISTS | SOCIAL_ACCOUNT_EXISTS | WEAK_PASSWORD
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* // Import social-only user from Cognito
|
|
173
|
+
* // Note: Email is automatically verified for social imports (like normal social signup)
|
|
174
|
+
* const result = await authService.adminSignupSocial({
|
|
175
|
+
* email: 'user@example.com',
|
|
176
|
+
* provider: 'google',
|
|
177
|
+
* providerId: 'google_12345',
|
|
178
|
+
* providerEmail: 'user@gmail.com',
|
|
179
|
+
* socialMetadata: { sub: 'google_12345', given_name: 'John' },
|
|
180
|
+
* });
|
|
181
|
+
*
|
|
182
|
+
* // Import hybrid user with password + social
|
|
183
|
+
* const result = await authService.adminSignupSocial({
|
|
184
|
+
* email: 'user@example.com',
|
|
185
|
+
* password: 'SecurePass123!',
|
|
186
|
+
* provider: 'apple',
|
|
187
|
+
* providerId: 'apple_67890',
|
|
188
|
+
* });
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
adminSignupSocial(dto: AdminSignupSocialDTO): Promise<AdminSignupSocialResponseDTO>;
|
|
192
|
+
/**
|
|
193
|
+
* Administrative user deletion with complete cascade cleanup
|
|
194
|
+
*
|
|
195
|
+
* HARD DELETE - Permanently removes user and ALL associated data including:
|
|
196
|
+
* - Sessions, verification tokens, MFA devices, trusted devices
|
|
197
|
+
* - Social accounts, login attempts, challenge sessions, audit logs
|
|
198
|
+
*
|
|
199
|
+
* Security:
|
|
200
|
+
* - NO built-in authentication - endpoint MUST be protected by admin guards
|
|
201
|
+
* - Records admin action in separate audit log (not deleted with user)
|
|
202
|
+
* - Irreversible operation - all data permanently removed
|
|
203
|
+
*
|
|
204
|
+
* @param dto - User sub to delete
|
|
205
|
+
* @returns Deletion confirmation with cascade counts
|
|
206
|
+
* @throws {NAuthException} USER_NOT_FOUND
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* const result = await authService.deleteUser({ sub: 'user-uuid-123' });
|
|
211
|
+
* console.log(`Deleted user: ${result.deletedUserId}`);
|
|
212
|
+
* console.log(`Deleted ${result.deletedRecords.sessions} sessions`);
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
deleteUser(dto: DeleteUserDTO): Promise<DeleteUserResponseDTO>;
|
|
216
|
+
/**
|
|
217
|
+
* Get paginated list of users with advanced filtering
|
|
218
|
+
*
|
|
219
|
+
* Supports pagination, boolean filters, exact match filters,
|
|
220
|
+
* date filters with operators (gt, gte, lt, lte, eq), and flexible sorting.
|
|
221
|
+
*
|
|
222
|
+
* Security:
|
|
223
|
+
* - NO built-in authentication - endpoint MUST be protected by admin guards
|
|
224
|
+
* - Returns sanitized user data (no passwordHash, secrets)
|
|
225
|
+
*
|
|
226
|
+
* @param dto - Filters, pagination, sorting
|
|
227
|
+
* @returns Paginated user list with metadata
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* const result = await authService.getUsers({
|
|
232
|
+
* page: 1,
|
|
233
|
+
* limit: 20,
|
|
234
|
+
* isEmailVerified: true,
|
|
235
|
+
* hasSocialAuth: true,
|
|
236
|
+
* createdAt: { operator: 'gte', value: new Date('2024-01-01') },
|
|
237
|
+
* sortBy: 'createdAt',
|
|
238
|
+
* sortOrder: 'DESC'
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
getUsers(dto: GetUsersDTO): Promise<GetUsersResponseDTO>;
|
|
243
|
+
/**
|
|
244
|
+
* Administrative permanent account locking
|
|
245
|
+
*
|
|
246
|
+
* Sets permanent lock (lockedUntil=NULL) and immediately revokes all active sessions.
|
|
247
|
+
* Reuses existing rate-limit lock fields (isLocked, lockReason, lockedAt, lockedUntil).
|
|
248
|
+
*
|
|
249
|
+
* Permanent vs Temporary locks:
|
|
250
|
+
* - Rate limiting: lockedUntil = future date (temporary auto-unlock)
|
|
251
|
+
* - Admin disableUser: lockedUntil = NULL (permanent manual lock)
|
|
252
|
+
*
|
|
253
|
+
* Security:
|
|
254
|
+
* - NO built-in authentication - endpoint MUST be protected by admin guards
|
|
255
|
+
* - Revokes all sessions immediately (forced logout)
|
|
256
|
+
* - Records ACCOUNT_DISABLED audit event with admin identifier
|
|
257
|
+
*
|
|
258
|
+
* @param dto - User sub and optional reason
|
|
259
|
+
* @returns User object with updated lock status and revoked session count
|
|
260
|
+
* @throws {NAuthException} USER_NOT_FOUND
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```typescript
|
|
264
|
+
* const result = await authService.disableUser({
|
|
265
|
+
* sub: 'user-uuid-123',
|
|
266
|
+
* reason: 'Suspicious activity detected'
|
|
267
|
+
* });
|
|
268
|
+
* console.log(`Revoked ${result.revokedSessions} sessions`);
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
disableUser(dto: DisableUserDTO): Promise<DisableUserResponseDTO>;
|
|
272
|
+
/**
|
|
273
|
+
* Enable (unlock) user account
|
|
274
|
+
*
|
|
275
|
+
* Unlocks a previously locked user account by clearing all lock fields.
|
|
276
|
+
* This reverses the effect of disableUser() or rate-limit lockouts.
|
|
277
|
+
*
|
|
278
|
+
* Security:
|
|
279
|
+
* - NO built-in authentication - endpoint MUST be protected by admin guards
|
|
280
|
+
* - Clears lock fields (isLocked, lockReason, lockedAt, lockedUntil)
|
|
281
|
+
* - Resets failed login attempts counter
|
|
282
|
+
* - Records ACCOUNT_ENABLED audit event with admin identifier
|
|
283
|
+
*
|
|
284
|
+
* @param dto - User sub to enable
|
|
285
|
+
* @returns User object with updated lock status
|
|
286
|
+
* @throws {NAuthException} USER_NOT_FOUND
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const result = await authService.enableUser({
|
|
291
|
+
* sub: 'user-uuid-123'
|
|
292
|
+
* });
|
|
293
|
+
* console.log(`User unlocked: ${result.user.email}`);
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
enableUser(dto: EnableUserDTO): Promise<EnableUserResponseDTO>;
|
|
127
297
|
/**
|
|
128
298
|
* Log in a user with identifier (email, username, or phone) and password.
|
|
129
299
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAY,MAAM,kCAAkC,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAY,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,qBAAqB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