@nauth-toolkit/social-google 0.1.14 → 0.1.18

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 (32) hide show
  1. package/dist/nestjs/google-social-auth.module.d.ts +38 -0
  2. package/dist/nestjs/google-social-auth.module.d.ts.map +1 -1
  3. package/dist/nestjs/google-social-auth.module.js +54 -3
  4. package/dist/nestjs/google-social-auth.module.js.map +1 -1
  5. package/dist/nestjs/index.d.ts +5 -0
  6. package/dist/nestjs/index.d.ts.map +1 -1
  7. package/dist/nestjs/index.js +6 -0
  8. package/dist/nestjs/index.js.map +1 -1
  9. package/dist/src/dto/social-login.dto.d.ts +219 -0
  10. package/dist/src/dto/social-login.dto.d.ts.map +1 -1
  11. package/dist/src/dto/social-login.dto.js +219 -0
  12. package/dist/src/dto/social-login.dto.js.map +1 -1
  13. package/dist/src/google-oauth.client.d.ts +59 -0
  14. package/dist/src/google-oauth.client.d.ts.map +1 -1
  15. package/dist/src/google-oauth.client.js +62 -0
  16. package/dist/src/google-oauth.client.js.map +1 -1
  17. package/dist/src/google-social-auth.service.d.ts +43 -1
  18. package/dist/src/google-social-auth.service.d.ts.map +1 -1
  19. package/dist/src/google-social-auth.service.js +63 -1
  20. package/dist/src/google-social-auth.service.js.map +1 -1
  21. package/dist/src/index.d.ts +6 -0
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +6 -0
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/token-verifier.service.d.ts +45 -0
  26. package/dist/src/token-verifier.service.d.ts.map +1 -1
  27. package/dist/src/token-verifier.service.js +44 -1
  28. package/dist/src/token-verifier.service.js.map +1 -1
  29. package/dist/src/verified-token-profile.interface.d.ts +24 -0
  30. package/dist/src/verified-token-profile.interface.d.ts.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +2 -2
@@ -1,10 +1,48 @@
1
1
  import { OnModuleInit } from '@nestjs/common';
2
2
  import { GoogleSocialAuthService } from '../src/google-social-auth.service';
3
3
  import { SocialProviderRegistry } from '@nauth-toolkit/core/internal';
4
+ /**
5
+ * Google Social Authentication Module (NestJS Adapter)
6
+ *
7
+ * Provides Google OAuth integration for nauth-toolkit in NestJS applications.
8
+ * Automatically registers itself with SocialAuthService when imported.
9
+ *
10
+ * **Usage:**
11
+ * ```typescript
12
+ * import { AuthModule } from '@nauth-toolkit/nestjs';
13
+ * import { GoogleSocialAuthModule } from '@nauth-toolkit/social-google/nestjs';
14
+ *
15
+ * @Module({
16
+ * imports: [
17
+ * AuthModule.forRoot(config),
18
+ * GoogleSocialAuthModule, // 👈 Auto-registers with SocialAuthService
19
+ * ],
20
+ * })
21
+ * export class AppModule {}
22
+ *
23
+ * // Use via registry (recommended for dynamic access)
24
+ * constructor(private socialAuthService: SocialAuthService) {}
25
+ *
26
+ * @Get('social/google')
27
+ * async getGoogleAuthUrl() {
28
+ * const googleProvider = this.socialAuthService.getProvider('google');
29
+ * const authUrl = await googleProvider.getAuthUrl();
30
+ * return { authUrl };
31
+ * }
32
+ *
33
+ * // Or inject directly
34
+ * constructor(private googleAuth: GoogleSocialAuthService) {}
35
+ * ```
36
+ */
4
37
  export declare class GoogleSocialAuthModule implements OnModuleInit {
5
38
  private readonly googleSocialAuthService;
6
39
  private readonly providerRegistry;
7
40
  constructor(googleSocialAuthService: GoogleSocialAuthService, providerRegistry: SocialProviderRegistry);
41
+ /**
42
+ * Auto-register Google provider with the SocialProviderRegistry
43
+ * when the module is initialized.
44
+ * Only registers if the provider is enabled in config.
45
+ */
8
46
  onModuleInit(): void;
9
47
  }
10
48
  //# sourceMappingURL=google-social-auth.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"google-social-auth.module.d.ts","sourceRoot":"","sources":["../../nestjs/google-social-auth.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAY5E,OAAO,EAIL,sBAAsB,EAGvB,MAAM,8BAA8B,CAAC;AAoCtC,qBAsEa,sBAAuB,YAAW,YAAY;IAEvD,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,uBAAuB,EAAE,uBAAuB,EAChD,gBAAgB,EAAE,sBAAsB;IAQ3D,YAAY,IAAI,IAAI;CAUrB"}
1
+ {"version":3,"file":"google-social-auth.module.d.ts","sourceRoot":"","sources":["../../nestjs/google-social-auth.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAY5E,OAAO,EAIL,sBAAsB,EAGvB,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAsEa,sBAAuB,YAAW,YAAY;IAEvD,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,uBAAuB,EAAE,uBAAuB,EAChD,gBAAgB,EAAE,sBAAsB;IAG3D;;;;OAIG;IACH,YAAY,IAAI,IAAI;CAUrB"}
@@ -12,9 +12,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GoogleSocialAuthModule = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const google_social_auth_service_1 = require("../src/google-social-auth.service");
15
+ // Public API imports
15
16
  const core_1 = require("@nauth-toolkit/core");
17
+ // Internal API imports (for provider implementations)
16
18
  const internal_1 = require("@nauth-toolkit/core/internal");
17
19
  const token_verifier_service_1 = require("../src/token-verifier.service");
20
+ /**
21
+ * Google Social Authentication Module (NestJS Adapter)
22
+ *
23
+ * Provides Google OAuth integration for nauth-toolkit in NestJS applications.
24
+ * Automatically registers itself with SocialAuthService when imported.
25
+ *
26
+ * **Usage:**
27
+ * ```typescript
28
+ * import { AuthModule } from '@nauth-toolkit/nestjs';
29
+ * import { GoogleSocialAuthModule } from '@nauth-toolkit/social-google/nestjs';
30
+ *
31
+ * @Module({
32
+ * imports: [
33
+ * AuthModule.forRoot(config),
34
+ * GoogleSocialAuthModule, // 👈 Auto-registers with SocialAuthService
35
+ * ],
36
+ * })
37
+ * export class AppModule {}
38
+ *
39
+ * // Use via registry (recommended for dynamic access)
40
+ * constructor(private socialAuthService: SocialAuthService) {}
41
+ *
42
+ * @Get('social/google')
43
+ * async getGoogleAuthUrl() {
44
+ * const googleProvider = this.socialAuthService.getProvider('google');
45
+ * const authUrl = await googleProvider.getAuthUrl();
46
+ * return { authUrl };
47
+ * }
48
+ *
49
+ * // Or inject directly
50
+ * constructor(private googleAuth: GoogleSocialAuthService) {}
51
+ * ```
52
+ */
18
53
  let GoogleSocialAuthModule = class GoogleSocialAuthModule {
19
54
  googleSocialAuthService;
20
55
  providerRegistry;
@@ -22,18 +57,28 @@ let GoogleSocialAuthModule = class GoogleSocialAuthModule {
22
57
  this.googleSocialAuthService = googleSocialAuthService;
23
58
  this.providerRegistry = providerRegistry;
24
59
  }
60
+ /**
61
+ * Auto-register Google provider with the SocialProviderRegistry
62
+ * when the module is initialized.
63
+ * Only registers if the provider is enabled in config.
64
+ */
25
65
  onModuleInit() {
66
+ // Check if provider is enabled by checking if oauthClient was initialized
67
+ // Service sets oauthClient to null when disabled
26
68
  const config = this.googleSocialAuthService['config'];
27
69
  const providerConfig = config.social?.google;
28
70
  if (providerConfig?.enabled) {
29
71
  this.providerRegistry.registerProvider(this.googleSocialAuthService);
30
72
  }
73
+ // If disabled, silently skip registration - module can exist but provider won't be available
31
74
  }
32
75
  };
33
76
  exports.GoogleSocialAuthModule = GoogleSocialAuthModule;
34
77
  exports.GoogleSocialAuthModule = GoogleSocialAuthModule = __decorate([
35
78
  (0, common_1.Module)({
79
+ // No imports needed - AuthModule is @Global() so its providers are available
36
80
  providers: [
81
+ // Token verifier for Google ID tokens
37
82
  {
38
83
  provide: 'GOOGLE_TOKEN_VERIFIER',
39
84
  useFactory: (config) => {
@@ -41,9 +86,15 @@ exports.GoogleSocialAuthModule = GoogleSocialAuthModule = __decorate([
41
86
  },
42
87
  inject: ['NAUTH_CONFIG'],
43
88
  },
89
+ // Google Social Auth Service (factory provider)
90
+ // Only create service if Google OAuth is enabled in config
44
91
  {
45
92
  provide: google_social_auth_service_1.GoogleSocialAuthService,
46
- useFactory: (config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService, tokenVerifier) => {
93
+ useFactory: (config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, // Optional - only available when auditLogs.enabled is true
94
+ trustedDeviceService, // Optional - only available when rememberDevices is enabled
95
+ tokenVerifier) => {
96
+ // Service can be created even when disabled - it handles gracefully
97
+ // Schema validation ensures credentials are present when enabled=true
47
98
  return new google_social_auth_service_1.GoogleSocialAuthService(config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService, tokenVerifier);
48
99
  },
49
100
  inject: [
@@ -58,8 +109,8 @@ exports.GoogleSocialAuthModule = GoogleSocialAuthModule = __decorate([
58
109
  'SOCIAL_AUTH_STATE_STORE',
59
110
  'UserRepository',
60
111
  { token: core_1.PhoneVerificationService, optional: true },
61
- { token: internal_1.AuthAuditService, optional: true },
62
- { token: internal_1.TrustedDeviceService, optional: true },
112
+ { token: internal_1.AuthAuditService, optional: true }, // Optional - only available when auditLogs.enabled is true
113
+ { token: internal_1.TrustedDeviceService, optional: true }, // Optional - only available when rememberDevices is enabled
63
114
  { token: 'GOOGLE_TOKEN_VERIFIER', optional: true },
64
115
  ],
65
116
  },
@@ -1 +1 @@
1
- {"version":3,"file":"google-social-auth.module.js","sourceRoot":"","sources":["../../nestjs/google-social-auth.module.ts"],"names":[],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AAc,EACd,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,aAAa,CACd,CAAC;gBACJ,CAAC;gBACD,MAAM,EAAE;oBACN,cAAc;oBACd,cAAc;oBACd,kBAAW;oBACX,wBAAiB;oBACjB,qBAAU;oBACV,yBAAc;oBACd,qCAA0B;oBAC1B,wBAAiB;oBACjB,yBAAyB;oBACzB,gBAAgB;oBAChB,EAAE,KAAK,EAAE,+BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACnD,EAAE,KAAK,EAAE,2BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACnD,EAAE,KAAK,EAAE,+BAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAC/C,EAAE,KAAK,EAAE,uBAAuB,EAAE,QAAQ,EAAE,IAAI,EAAE;iBACnD;aACF;SACF;QACD,OAAO,EAAE,CAAC,oDAAuB,CAAC;KACnC,CAAC;qCAG4C,oDAAuB;QAC9B,iCAAsB;GAHhD,sBAAsB,CAqBlC"}
1
+ {"version":3,"file":"google-social-auth.module.js","sourceRoot":"","sources":["../../nestjs/google-social-auth.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,kFAA4E;AAC5E,qBAAqB;AACrB,8CAQ6B;AAC7B,sDAAsD;AACtD,2DAOsC;AACtC,0EAAmG;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAuEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAEd;IACA;IAFnB,YACmB,uBAAgD,EAChD,gBAAwC;QADxC,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,qBAAgB,GAAhB,gBAAgB,CAAwB;IACxD,CAAC;IAEJ;;;;OAIG;IACH,YAAY;QACV,0EAA0E;QAC1E,iDAAiD;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAgB,CAAC;QACrE,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,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,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACnD,EAAE,KAAK,EAAE,2BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,2DAA2D;oBAChH,EAAE,KAAK,EAAE,+BAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,4DAA4D;oBAC7G,EAAE,KAAK,EAAE,uBAAuB,EAAE,QAAQ,EAAE,IAAI,EAAE;iBACnD;aACF;SACF;QACD,OAAO,EAAE,CAAC,oDAAuB,CAAC;KACnC,CAAC;qCAG4C,oDAAuB;QAC9B,iCAAsB;GAHhD,sBAAsB,CAqBlC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @nauth-toolkit/social-google/nestjs
3
+ *
4
+ * NestJS adapter for Google Social Authentication
5
+ */
1
6
  export { GoogleSocialAuthModule } from './google-social-auth.module';
2
7
  export * from '../src/google-social-auth.service';
3
8
  export * from '../src/google-oauth.client';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC"}
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * @nauth-toolkit/social-google/nestjs
4
+ *
5
+ * NestJS adapter for Google Social Authentication
6
+ */
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -17,6 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
22
  exports.GoogleSocialAuthModule = void 0;
18
23
  var google_social_auth_module_1 = require("./google-social-auth.module");
19
24
  Object.defineProperty(exports, "GoogleSocialAuthModule", { enumerable: true, get: function () { return google_social_auth_module_1.GoogleSocialAuthModule; } });
25
+ // Re-export core Google social auth components
20
26
  __exportStar(require("../src/google-social-auth.service"), exports);
21
27
  __exportStar(require("../src/google-oauth.client"), exports);
22
28
  __exportStar(require("../src/token-verifier.service"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAG/B,oEAAkD;AAClD,6DAA2C;AAC3C,gEAA8C;AAC9C,0EAAwD;AACxD,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAE/B,+CAA+C;AAC/C,oEAAkD;AAClD,6DAA2C;AAC3C,gEAA8C;AAC9C,0EAAwD;AACxD,8DAA4C"}
@@ -1,32 +1,229 @@
1
+ /**
2
+ * Social provider enum
3
+ */
1
4
  export declare enum SocialProvider {
2
5
  GOOGLE = "google",
3
6
  APPLE = "apple",
4
7
  FACEBOOK = "facebook"
5
8
  }
9
+ /**
10
+ * DTO for initiating social login
11
+ * Used to generate OAuth URLs for social providers
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Generate Google OAuth URL
16
+ * const dto = new SocialLoginDTO();
17
+ * dto.provider = 'google';
18
+ * dto.state = 'random-state-string';
19
+ * ```
20
+ */
6
21
  export declare class SocialLoginDTO {
22
+ /**
23
+ * Social provider name
24
+ * Must be one of the configured providers
25
+ *
26
+ * Validation:
27
+ * - Must be a valid SocialProvider enum value
28
+ */
7
29
  provider: SocialProvider;
30
+ /**
31
+ * Optional state parameter for OAuth flow
32
+ * Used to prevent CSRF attacks and maintain state
33
+ * If not provided, a random state will be generated
34
+ *
35
+ * Validation:
36
+ * - Must be a string if present
37
+ * - Max 500 characters (typical OAuth state length)
38
+ */
8
39
  state?: string;
9
40
  }
41
+ /**
42
+ * DTO for handling OAuth callback
43
+ * Used to process the authorization code from OAuth providers
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * // Handle Google OAuth callback
48
+ * const dto = new SocialCallbackDTO();
49
+ * dto.provider = 'google';
50
+ * dto.code = 'authorization-code-from-google';
51
+ * dto.state = 'state-from-initial-request';
52
+ * ```
53
+ */
10
54
  export declare class SocialCallbackDTO {
55
+ /**
56
+ * Social provider name
57
+ * Must match the provider used in the initial request
58
+ *
59
+ * Validation:
60
+ * - Must be a valid SocialProvider enum value
61
+ */
11
62
  provider: SocialProvider;
63
+ /**
64
+ * Authorization code from OAuth provider
65
+ * This code is exchanged for access token and user info
66
+ *
67
+ * Validation:
68
+ * - Must be a string
69
+ * - Max 1000 characters (typical OAuth code length)
70
+ */
12
71
  code: string;
72
+ /**
73
+ * State parameter from OAuth flow
74
+ * Must match the state sent in the initial request
75
+ *
76
+ * Validation:
77
+ * - Must be a string
78
+ * - Max 500 characters (typical OAuth state length)
79
+ */
13
80
  state: string;
81
+ /**
82
+ * Optional error parameter from OAuth provider
83
+ * Used when user denies permission or other errors occur
84
+ *
85
+ * Validation:
86
+ * - Must be a string if present
87
+ * - Max 100 characters
88
+ */
14
89
  error?: string;
90
+ /**
91
+ * Optional error description from OAuth provider
92
+ * Provides more details about the error
93
+ *
94
+ * Validation:
95
+ * - Must be a string if present
96
+ * - Max 500 characters
97
+ */
15
98
  error_description?: string;
16
99
  }
100
+ /**
101
+ * DTO for linking social account to existing user
102
+ * Used when an authenticated user wants to link a social provider
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // Link Google account to current user
107
+ * const dto = new LinkSocialAccountDTO();
108
+ * dto.provider = 'google';
109
+ * dto.code = 'authorization-code-from-google';
110
+ * dto.state = 'state-from-initial-request';
111
+ * ```
112
+ */
17
113
  export declare class LinkSocialAccountDTO {
114
+ /**
115
+ * Social provider name
116
+ * Must be one of the configured providers
117
+ *
118
+ * Validation:
119
+ * - Must be a valid SocialProvider enum value
120
+ */
18
121
  provider: SocialProvider;
122
+ /**
123
+ * Authorization code from OAuth provider
124
+ * This code is exchanged for access token and user info
125
+ *
126
+ * Validation:
127
+ * - Must be a string
128
+ * - Max 1000 characters (typical OAuth code length)
129
+ */
19
130
  code: string;
131
+ /**
132
+ * State parameter from OAuth flow
133
+ * Must match the state sent in the initial request
134
+ *
135
+ * Validation:
136
+ * - Must be a string
137
+ * - Max 500 characters (typical OAuth state length)
138
+ */
20
139
  state: string;
21
140
  }
141
+ /**
142
+ * DTO for unlinking social account
143
+ * Used when an authenticated user wants to remove a social provider
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * // Unlink Google account from current user
148
+ * const dto = new UnlinkSocialAccountDTO();
149
+ * dto.provider = 'google';
150
+ * ```
151
+ */
22
152
  export declare class UnlinkSocialAccountDTO {
153
+ /**
154
+ * Social provider name to unlink
155
+ * Must be one of the currently linked providers
156
+ *
157
+ * Validation:
158
+ * - Must be a valid SocialProvider enum value
159
+ */
23
160
  provider: SocialProvider;
24
161
  }
162
+ /**
163
+ * Response DTO for social login
164
+ * Contains authentication tokens and user information
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * // Response after successful social login
169
+ * {
170
+ * "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
171
+ * "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
172
+ * "expiresIn": 900,
173
+ * "user": {
174
+ * "sub": "user-uuid",
175
+ * "email": "user@example.com",
176
+ * "firstName": "John",
177
+ * "lastName": "Doe",
178
+ * "isEmailVerified": true,
179
+ * "socialProviders": ["google"]
180
+ * }
181
+ * }
182
+ * ```
183
+ */
25
184
  export declare class SocialLoginResponseDTO {
185
+ /**
186
+ * JWT access token for API authentication
187
+ *
188
+ * Validation:
189
+ * - Must be a string
190
+ * - Max 2048 characters (typical JWT length)
191
+ */
26
192
  accessToken: string;
193
+ /**
194
+ * JWT refresh token for token renewal
195
+ *
196
+ * Validation:
197
+ * - Must be a string
198
+ * - Max 2048 characters (typical JWT length)
199
+ */
27
200
  refreshToken: string;
201
+ /**
202
+ * Access token expiration timestamp (Unix timestamp in seconds)
203
+ *
204
+ * Validation:
205
+ * - Must be a number
206
+ */
28
207
  accessTokenExpiresAt: number;
208
+ /**
209
+ * Refresh token expiration timestamp (Unix timestamp in seconds)
210
+ *
211
+ * Validation:
212
+ * - Must be a number
213
+ */
29
214
  refreshTokenExpiresAt: number;
215
+ /**
216
+ * User information
217
+ *
218
+ * Validation:
219
+ * - Nested fields validated in service layer:
220
+ * - sub: UUID v4 format, max 36 chars
221
+ * - email: Valid email format, max 255 chars
222
+ * - firstName: String, max 100 chars
223
+ * - lastName: String, max 100 chars
224
+ * - isEmailVerified: Boolean
225
+ * - socialProviders: Array of strings, each max 50 chars
226
+ */
30
227
  user: {
31
228
  sub: string;
32
229
  email: string;
@@ -36,7 +233,29 @@ export declare class SocialLoginResponseDTO {
36
233
  socialProviders?: string[];
37
234
  };
38
235
  }
236
+ /**
237
+ * Response DTO for social account information
238
+ * Contains details about linked social accounts
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * // Response for user's linked social accounts
243
+ * {
244
+ * "accounts": [
245
+ * {
246
+ * "provider": "google",
247
+ * "providerEmail": "user@gmail.com",
248
+ * "linkedAt": "2023-01-01T00:00:00Z",
249
+ * "lastUsedAt": "2023-01-15T12:00:00Z"
250
+ * }
251
+ * ]
252
+ * }
253
+ * ```
254
+ */
39
255
  export declare class SocialAccountsResponseDTO {
256
+ /**
257
+ * Array of linked social accounts
258
+ */
40
259
  accounts: Array<{
41
260
  provider: string;
42
261
  providerEmail?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"social-login.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/social-login.dto.ts"],"names":[],"mappings":"AAKA,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAcD,qBAAa,cAAc;IASzB,QAAQ,EAAG,cAAc,CAAC;IAc1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAeD,qBAAa,iBAAiB;IAS5B,QAAQ,EAAG,cAAc,CAAC;IAa1B,IAAI,EAAG,MAAM,CAAC;IAad,KAAK,EAAG,MAAM,CAAC;IAaf,KAAK,CAAC,EAAE,MAAM,CAAC;IAaf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAeD,qBAAa,oBAAoB;IAS/B,QAAQ,EAAG,cAAc,CAAC;IAa1B,IAAI,EAAG,MAAM,CAAC;IAad,KAAK,EAAG,MAAM,CAAC;CAChB;AAaD,qBAAa,sBAAsB;IASjC,QAAQ,EAAG,cAAc,CAAC;CAC3B;AAwBD,qBAAa,sBAAsB;IAUjC,WAAW,EAAG,MAAM,CAAC;IAWrB,YAAY,EAAG,MAAM,CAAC;IAStB,oBAAoB,EAAG,MAAM,CAAC;IAS9B,qBAAqB,EAAG,MAAM,CAAC;IAc/B,IAAI,EAAG;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,OAAO,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;CACH;AAqBD,qBAAa,yBAAyB;IAIpC,QAAQ,EAAG,KAAK,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QAC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