@nauth-toolkit/social-apple 0.1.3

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 (36) hide show
  1. package/LICENSE +90 -0
  2. package/README.md +30 -0
  3. package/dist/nestjs/apple-social-auth.module.d.ts +10 -0
  4. package/dist/nestjs/apple-social-auth.module.d.ts.map +1 -0
  5. package/dist/nestjs/apple-social-auth.module.js +72 -0
  6. package/dist/nestjs/apple-social-auth.module.js.map +1 -0
  7. package/dist/nestjs/index.d.ts +7 -0
  8. package/dist/nestjs/index.d.ts.map +1 -0
  9. package/dist/nestjs/index.js +25 -0
  10. package/dist/nestjs/index.js.map +1 -0
  11. package/dist/src/apple-oauth.client.d.ts +15 -0
  12. package/dist/src/apple-oauth.client.d.ts.map +1 -0
  13. package/dist/src/apple-oauth.client.js +97 -0
  14. package/dist/src/apple-oauth.client.js.map +1 -0
  15. package/dist/src/apple-social-auth.service.d.ts +16 -0
  16. package/dist/src/apple-social-auth.service.d.ts.map +1 -0
  17. package/dist/src/apple-social-auth.service.js +91 -0
  18. package/dist/src/apple-social-auth.service.js.map +1 -0
  19. package/dist/src/dto/social-login.dto.d.ts +47 -0
  20. package/dist/src/dto/social-login.dto.d.ts.map +1 -0
  21. package/dist/src/dto/social-login.dto.js +131 -0
  22. package/dist/src/dto/social-login.dto.js.map +1 -0
  23. package/dist/src/index.d.ts +6 -0
  24. package/dist/src/index.d.ts.map +1 -0
  25. package/dist/src/index.js +25 -0
  26. package/dist/src/index.js.map +1 -0
  27. package/dist/src/token-verifier.service.d.ts +9 -0
  28. package/dist/src/token-verifier.service.d.ts.map +1 -0
  29. package/dist/src/token-verifier.service.js +38 -0
  30. package/dist/src/token-verifier.service.js.map +1 -0
  31. package/dist/src/verified-token-profile.interface.d.ts +7 -0
  32. package/dist/src/verified-token-profile.interface.d.ts.map +1 -0
  33. package/dist/src/verified-token-profile.interface.js +3 -0
  34. package/dist/src/verified-token-profile.interface.js.map +1 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -0
  36. package/package.json +63 -0
package/LICENSE ADDED
@@ -0,0 +1,90 @@
1
+ NAUTH TOOLKIT EARLY ACCESS LICENSE
2
+ Version 1.0 (December 2025)
3
+
4
+ ================================================================================
5
+ FUTURE OPEN SOURCE NOTICE
6
+ ================================================================================
7
+ NAuth Toolkit will transition to an open-source license (MIT or Apache 2.0) for
8
+ core authentication features once the project reaches production readiness.
9
+
10
+ This Early Access License is temporary and designed to:
11
+ • Allow developers to build with nauth-toolkit during preview/beta
12
+ • Provide clear expectations during the pre-release phase
13
+ • Enable feedback and real-world testing before GA
14
+
15
+ We're committed to keeping core auth free and open source. Premium features
16
+ (enterprise SSO, advanced compliance, hosted options) will be offered separately
17
+ under fair commercial terms.
18
+
19
+ ================================================================================
20
+ EARLY ACCESS LICENSE TERMS
21
+ ================================================================================
22
+
23
+ 1. Grant of Use
24
+ You are granted a free, non-exclusive, non-transferable license to:
25
+ - Install and use nauth-toolkit packages in development, testing, staging,
26
+ and production environments
27
+ - Modify the code for your own internal use
28
+ - Deploy applications using nauth-toolkit to serve your users
29
+
30
+ You may NOT:
31
+ - Redistribute NAuth Toolkit as a standalone product or service
32
+ - Sell, sublicense, or offer NAuth Toolkit as part of a competing auth
33
+ platform or toolkit
34
+ - Remove or alter copyright notices
35
+
36
+ 2. No Fees During Early Access
37
+ There are no license fees, subscription costs, or usage charges during the
38
+ Early Access period. You may use nauth-toolkit freely for commercial and
39
+ non-commercial purposes within the terms of this license.
40
+
41
+ 3. Production Use
42
+ Production use is permitted but comes with standard early-access caveats:
43
+ - Features and APIs may change between preview releases
44
+ - Support is community-based (GitHub issues/discussions)
45
+ - No SLA or guaranteed uptime (you run it on your infrastructure)
46
+
47
+ We recommend thorough testing and having rollback plans for critical systems.
48
+
49
+ 4. Future Transition
50
+ When nauth-toolkit releases v1.0 GA:
51
+ - Core packages will adopt an open-source license (MIT or Apache 2.0)
52
+ - Your existing deployments will continue to work
53
+ - Premium features (if any) will be clearly documented with separate licensing
54
+ - No forced upgrades or surprise fees
55
+
56
+ 5. Ownership
57
+ NAuth Toolkit is developed and maintained by Noorix Digital Solutions.
58
+ You retain full ownership of your applications and data.
59
+
60
+ 6. Data and Privacy
61
+ NAuth Toolkit runs in YOUR infrastructure and database. You control all data.
62
+ You are responsible for compliance with applicable data protection laws.
63
+
64
+ 7. Disclaimer of Warranty
65
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
66
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
67
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
68
+
69
+ 8. Limitation of Liability
70
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
71
+ SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS
72
+ OF PROFITS, REVENUE, DATA, OR USE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
73
+ DAMAGES.
74
+
75
+ 9. Termination
76
+ This license remains in effect until:
77
+ - You stop using nauth-toolkit, or
78
+ - The project transitions to open source (at which point the new license applies)
79
+
80
+ If you breach these terms, your license terminates and you must stop using the
81
+ software.
82
+
83
+ 10. Contact and Support
84
+ - Documentation: https://nauth.dev
85
+ - Issues/Discussions: GitHub (when public repository launches)
86
+ - Commercial inquiries: Contact admin@noorix.com
87
+
88
+ ================================================================================
89
+ Thank you for being an early adopter. Your feedback shapes the future of NAuth.
90
+ ================================================================================
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @nauth-toolkit/social-apple
2
+
3
+ Apple OAuth provider for nauth-toolkit
4
+
5
+ ## ⚠️ Preview Release Notice
6
+
7
+ **This is a preview release for internal testing. Do not use in production yet.**
8
+
9
+ This package is part of nauth-toolkit and is currently in early access/preview. Features and APIs may change between releases. For production use, please wait for the stable v1.0 release.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @nauth-toolkit/social-apple@preview
15
+ # or
16
+ yarn add @nauth-toolkit/social-apple@preview
17
+ ```
18
+
19
+ ## License
20
+
21
+ See LICENSE file in the package root for full license terms.
22
+
23
+ ## Documentation
24
+
25
+ Full documentation: https://nauth.dev
26
+
27
+ ## Support
28
+
29
+ - Issues/Discussions: GitHub (when repository is public)
30
+ - Documentation: https://nauth.dev
@@ -0,0 +1,10 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { AppleSocialAuthService } from '../src/apple-social-auth.service';
3
+ import { SocialProviderRegistry } from '@nauth-toolkit/core/internal';
4
+ export declare class AppleSocialAuthModule implements OnModuleInit {
5
+ private readonly appleSocialAuthService;
6
+ private readonly providerRegistry;
7
+ constructor(appleSocialAuthService: AppleSocialAuthService, providerRegistry: SocialProviderRegistry);
8
+ onModuleInit(): void;
9
+ }
10
+ //# sourceMappingURL=apple-social-auth.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-social-auth.module.d.ts","sourceRoot":"","sources":["../../nestjs/apple-social-auth.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAY1E,OAAO,EAIL,sBAAsB,EAGvB,MAAM,8BAA8B,CAAC;AAoCtC,qBAmEa,qBAAsB,YAAW,YAAY;IAEtD,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,EAAE,sBAAsB;IAO3D,YAAY,IAAI,IAAI;CAOrB"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AppleSocialAuthModule = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const apple_social_auth_service_1 = require("../src/apple-social-auth.service");
15
+ const core_1 = require("@nauth-toolkit/core");
16
+ const internal_1 = require("@nauth-toolkit/core/internal");
17
+ const token_verifier_service_1 = require("../src/token-verifier.service");
18
+ let AppleSocialAuthModule = class AppleSocialAuthModule {
19
+ appleSocialAuthService;
20
+ providerRegistry;
21
+ constructor(appleSocialAuthService, providerRegistry) {
22
+ this.appleSocialAuthService = appleSocialAuthService;
23
+ this.providerRegistry = providerRegistry;
24
+ }
25
+ onModuleInit() {
26
+ const config = this.appleSocialAuthService['config'];
27
+ const providerConfig = config.social?.apple;
28
+ if (providerConfig?.enabled) {
29
+ this.providerRegistry.registerProvider(this.appleSocialAuthService);
30
+ }
31
+ }
32
+ };
33
+ exports.AppleSocialAuthModule = AppleSocialAuthModule;
34
+ exports.AppleSocialAuthModule = AppleSocialAuthModule = __decorate([
35
+ (0, common_1.Module)({
36
+ providers: [
37
+ {
38
+ provide: 'APPLE_TOKEN_VERIFIER',
39
+ useFactory: (config) => {
40
+ return new token_verifier_service_1.TokenVerifierService(config);
41
+ },
42
+ inject: ['NAUTH_CONFIG'],
43
+ },
44
+ {
45
+ provide: apple_social_auth_service_1.AppleSocialAuthService,
46
+ useFactory: (config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService, tokenVerifier) => {
47
+ return new apple_social_auth_service_1.AppleSocialAuthService(config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService, tokenVerifier);
48
+ },
49
+ inject: [
50
+ 'NAUTH_CONFIG',
51
+ 'NAUTH_LOGGER',
52
+ core_1.AuthService,
53
+ core_1.SocialAuthService,
54
+ internal_1.JwtService,
55
+ internal_1.SessionService,
56
+ internal_1.AuthChallengeHelperService,
57
+ core_1.ClientInfoService,
58
+ 'SOCIAL_AUTH_STATE_STORE',
59
+ 'UserRepository',
60
+ { token: core_1.PhoneVerificationService, optional: true },
61
+ { token: internal_1.AuthAuditService, optional: true },
62
+ { token: internal_1.TrustedDeviceService, optional: true },
63
+ { token: 'APPLE_TOKEN_VERIFIER', optional: true },
64
+ ],
65
+ },
66
+ ],
67
+ exports: [apple_social_auth_service_1.AppleSocialAuthService],
68
+ }),
69
+ __metadata("design:paramtypes", [apple_social_auth_service_1.AppleSocialAuthService,
70
+ internal_1.SocialProviderRegistry])
71
+ ], AppleSocialAuthModule);
72
+ //# sourceMappingURL=apple-social-auth.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-social-auth.module.js","sourceRoot":"","sources":["../../nestjs/apple-social-auth.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,gFAA0E;AAE1E,8CAQ6B;AAE7B,2DAOsC;AACtC,0EAAkG;AAsG3F,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAEb;IACA;IAFnB,YACmB,sBAA8C,EAC9C,gBAAwC;QADxC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,qBAAgB,GAAhB,gBAAgB,CAAwB;IACxD,CAAC;IAMJ,YAAY;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAgB,CAAC;QACpE,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,E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oB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAC/C,EAAE,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,IAAI,EAAE;iBAClD;aACF;SACF;QACD,OAAO,EAAE,CAAC,kDAAsB,CAAC;KAClC,CAAC;qCAG2C,kDAAsB;QAC5B,iCAAsB;GAHhD,qBAAqB,CAiBjC"}
@@ -0,0 +1,7 @@
1
+ export { AppleSocialAuthModule } from './apple-social-auth.module';
2
+ export * from '../src/apple-social-auth.service';
3
+ export * from '../src/apple-oauth.client';
4
+ export * from '../src/token-verifier.service';
5
+ export * from '../src/verified-token-profile.interface';
6
+ export * from '../src/dto/social-login.dto';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.AppleSocialAuthModule = void 0;
18
+ var apple_social_auth_module_1 = require("./apple-social-auth.module");
19
+ Object.defineProperty(exports, "AppleSocialAuthModule", { enumerable: true, get: function () { return apple_social_auth_module_1.AppleSocialAuthModule; } });
20
+ __exportStar(require("../src/apple-social-auth.service"), exports);
21
+ __exportStar(require("../src/apple-oauth.client"), exports);
22
+ __exportStar(require("../src/token-verifier.service"), exports);
23
+ __exportStar(require("../src/verified-token-profile.interface"), exports);
24
+ __exportStar(require("../src/dto/social-login.dto"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA;AAG9B,mEAAiD;AACjD,4DAA0C;AAC1C,gEAA8C;AAC9C,0EAAwD;AACxD,8DAA4C"}
@@ -0,0 +1,15 @@
1
+ import { OAuthClient, OAuthConfig, OAuthUserProfile } from '@nauth-toolkit/core';
2
+ export declare class AppleOAuthClient implements OAuthClient {
3
+ private readonly config;
4
+ private readonly tokenEndpoint;
5
+ private readonly userInfoEndpoint;
6
+ constructor(config: OAuthConfig);
7
+ exchangeCodeForToken(code: string, redirectUri: string): Promise<{
8
+ accessToken: string;
9
+ refreshToken?: string;
10
+ expiresIn?: number;
11
+ }>;
12
+ getUserProfile(accessToken: string): Promise<OAuthUserProfile>;
13
+ getAuthorizationUrl(state?: string): string;
14
+ }
15
+ //# sourceMappingURL=apple-oauth.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-oauth.client.d.ts","sourceRoot":"","sources":["../../src/apple-oauth.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAiC,MAAM,qBAAqB,CAAC;AAqBhH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6C;gBAElE,MAAM,EAAE,WAAW;IAqBzB,oBAAoB,CACxB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QACT,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAuDI,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsDpE,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;CAe5C"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppleOAuthClient = void 0;
4
+ const core_1 = require("@nauth-toolkit/core");
5
+ class AppleOAuthClient {
6
+ config;
7
+ tokenEndpoint = 'https://appleid.apple.com/auth/token';
8
+ userInfoEndpoint = 'https://appleid.apple.com/auth/userinfo';
9
+ constructor(config) {
10
+ this.config = {
11
+ scopes: ['name', 'email'],
12
+ ...config,
13
+ };
14
+ }
15
+ async exchangeCodeForToken(code, redirectUri) {
16
+ const params = new URLSearchParams({
17
+ client_id: this.config.clientId,
18
+ client_secret: this.config.clientSecret,
19
+ code,
20
+ grant_type: 'authorization_code',
21
+ redirect_uri: redirectUri,
22
+ });
23
+ try {
24
+ const response = await fetch(this.tokenEndpoint, {
25
+ method: 'POST',
26
+ headers: {
27
+ 'Content-Type': 'application/x-www-form-urlencoded',
28
+ },
29
+ body: params.toString(),
30
+ });
31
+ if (!response.ok) {
32
+ const errorData = (await response.json());
33
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_TOKEN_INVALID, `Token exchange failed: ${errorData.error_description || errorData.error}`);
34
+ }
35
+ const data = (await response.json());
36
+ return {
37
+ accessToken: data.access_token,
38
+ refreshToken: data.refresh_token,
39
+ expiresIn: data.expires_in,
40
+ };
41
+ }
42
+ catch (error) {
43
+ if (error instanceof Error) {
44
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_TOKEN_INVALID, `Apple token exchange failed: ${error.message}`);
45
+ }
46
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_TOKEN_INVALID, 'Apple token exchange failed: Unknown error');
47
+ }
48
+ }
49
+ async getUserProfile(accessToken) {
50
+ try {
51
+ const response = await fetch(this.userInfoEndpoint, {
52
+ headers: {
53
+ Authorization: `Bearer ${accessToken}`,
54
+ },
55
+ });
56
+ if (!response.ok) {
57
+ if (response.status === 401) {
58
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_TOKEN_INVALID, 'Invalid or expired access token');
59
+ }
60
+ throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, `Apple API call failed: ${response.status} ${response.statusText}`);
61
+ }
62
+ const data = (await response.json());
63
+ const firstName = data.name?.firstName || null;
64
+ const lastName = data.name?.lastName || null;
65
+ return {
66
+ id: data.sub,
67
+ email: data.email || null,
68
+ firstName,
69
+ lastName,
70
+ picture: null,
71
+ verified: data.email_verified || false,
72
+ raw: data,
73
+ };
74
+ }
75
+ catch (error) {
76
+ if (error instanceof Error) {
77
+ throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, `Apple profile fetch failed: ${error.message}`);
78
+ }
79
+ throw new core_1.NAuthException(core_1.AuthErrorCode.INTERNAL_ERROR, 'Apple profile fetch failed: Unknown error');
80
+ }
81
+ }
82
+ getAuthorizationUrl(state) {
83
+ const params = new URLSearchParams({
84
+ client_id: this.config.clientId,
85
+ redirect_uri: this.config.redirectUri,
86
+ scope: this.config.scopes?.join(' ') || 'name email',
87
+ response_type: 'code',
88
+ response_mode: 'form_post',
89
+ });
90
+ if (state) {
91
+ params.append('state', state);
92
+ }
93
+ return `https://appleid.apple.com/auth/authorize?${params.toString()}`;
94
+ }
95
+ }
96
+ exports.AppleOAuthClient = AppleOAuthClient;
97
+ //# sourceMappingURL=apple-oauth.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-oauth.client.js","sourceRoot":"","sources":["../../src/apple-oauth.client.ts"],"names":[],"mappings":";;;AAAA,8CAAgH;AAqBhH,MAAa,gBAAgB;IACV,MAAM,CAAc;IACpB,aAAa,GAAG,sCAAsC,CAAC;IACvD,gBAAgB,GAAG,yCAAyC,CAAC;IAE9E,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACzB,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAgBD,KAAK,CAAC,oBAAoB,CACxB,IAAY,EACZ,WAAmB;QAMnB,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;YACvC,IAAI;YACJ,UAAU,EAAE,oBAAoB;YAChC,YAAY,EAAE,WAAW;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE;gBAC/C,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE;aACxB,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAQ,CAAC;gBACjD,MAAM,IAAI,qBAAc,CACtB,oBAAa,CAAC,oBAAoB,EAClC,0BAA0B,SAAS,CAAC,iBAAiB,IAAI,SAAS,CAAC,KAAK,EAAE,CAC3E,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAA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YAE7C,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,GAAG;gBACZ,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI;gBACzB,SAAS;gBACT,QAAQ;gBACR,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI,CAAC,cAAc,IAAI,KAAK;gBACtC,GAAG,EAAE,IAAI;aACV,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,IAAI,qBAAc,CAAC,oBAAa,CAAC,cAAc,EAAE,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACzG,CAAC;YACD,MAAM,IAAI,qBAAc,CAAC,oBAAa,CAAC,cAAc,EAAE,2CAA2C,CAAC,CAAC;QACtG,CAAC;IACH,CAAC;IAcD,mBAAmB,CAAC,KAAc;QAChC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;YACrC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,YAAY;YACpD,aAAa,EAAE,MAAM;YACrB,aAAa,EAAE,WAAW;SAC3B,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,4CAA4C,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IACzE,CAAC;CACF;AA7JD,4CA6JC"}
@@ -0,0 +1,16 @@
1
+ import { AuthService, SocialAuthService, ClientInfoService, NAuthConfig, NAuthLogger, OAuthUserProfile, PhoneVerificationService, ISocialAuthProviderService, ITokenVerifierService, BaseUser } from '@nauth-toolkit/core';
2
+ import { BaseSocialAuthProviderService, JwtService, SessionService, AuthChallengeHelperService, AuthAuditService, TrustedDeviceService } from '@nauth-toolkit/core/internal';
3
+ import { Repository } from 'typeorm';
4
+ export declare class AppleSocialAuthService extends BaseSocialAuthProviderService implements ISocialAuthProviderService {
5
+ readonly providerName = "apple";
6
+ private readonly oauthClient;
7
+ private readonly tokenVerifier;
8
+ constructor(config: NAuthConfig, logger: NAuthLogger, authService: AuthService, socialAuthService: SocialAuthService, jwtService: JwtService, sessionService: SessionService, challengeHelper: AuthChallengeHelperService, clientInfoService: ClientInfoService, stateStore: Map<string, {
9
+ timestamp: number;
10
+ provider: string;
11
+ }>, userRepository: Repository<BaseUser>, phoneVerificationService?: PhoneVerificationService, auditService?: AuthAuditService, trustedDeviceService?: TrustedDeviceService, tokenVerifier?: ITokenVerifierService);
12
+ getAuthUrl(state?: string): Promise<string>;
13
+ protected getOAuthProfile(code: string, _state: string): Promise<OAuthUserProfile>;
14
+ protected verifyNativeToken(idToken: string, _accessToken?: string, profileData?: unknown): Promise<OAuthUserProfile>;
15
+ }
16
+ //# sourceMappingURL=apple-social-auth.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-social-auth.service.d.ts","sourceRoot":"","sources":["../../src/apple-social-auth.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,gBAAgB,EAGhB,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,6BAA6B,EAC7B,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmCrC,qBAAa,sBAAuB,SAAQ,6BAA8B,YAAW,0BAA0B;IAC7G,QAAQ,CAAC,YAAY,WAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+B;gBAG3D,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,0BAA0B,EAC3C,iBAAiB,EAAE,iBAAiB,EAEpC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,EAChE,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,EAEpC,wBAAwB,CAAC,EAAE,wBAAwB,EAEnD,YAAY,CAAC,EAAE,gBAAgB,EAE/B,oBAAoB,CAAC,EAAE,oBAAoB,EAE3C,aAAa,CAAC,EAAE,qBAAqB;IA0DjC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAkBjC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;cAyBxE,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,gBAAgB,CAAC;CAwC7B"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppleSocialAuthService = void 0;
4
+ const core_1 = require("@nauth-toolkit/core");
5
+ const internal_1 = require("@nauth-toolkit/core/internal");
6
+ const apple_oauth_client_1 = require("./apple-oauth.client");
7
+ const token_verifier_service_1 = require("./token-verifier.service");
8
+ class AppleSocialAuthService extends internal_1.BaseSocialAuthProviderService {
9
+ providerName = 'apple';
10
+ oauthClient;
11
+ tokenVerifier;
12
+ constructor(config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService, tokenVerifier) {
13
+ super(config, logger, authService, socialAuthService, jwtService, sessionService, challengeHelper, clientInfoService, stateStore, userRepository, phoneVerificationService, auditService, trustedDeviceService);
14
+ const providerConfig = this.getProviderConfig();
15
+ if (!providerConfig || !providerConfig.enabled) {
16
+ this.oauthClient = null;
17
+ this.tokenVerifier = null;
18
+ return;
19
+ }
20
+ if (!providerConfig.clientId) {
21
+ this.oauthClient = null;
22
+ this.tokenVerifier = null;
23
+ return;
24
+ }
25
+ this.oauthClient = new apple_oauth_client_1.AppleOAuthClient({
26
+ clientId: providerConfig.clientId,
27
+ clientSecret: providerConfig.clientSecret || '',
28
+ redirectUri: providerConfig.callbackUrl || '',
29
+ scopes: providerConfig.scopes || ['name', 'email'],
30
+ });
31
+ this.tokenVerifier =
32
+ tokenVerifier ||
33
+ new token_verifier_service_1.TokenVerifierService(config) ||
34
+ this.config.tokenVerifier ||
35
+ null;
36
+ this.logger?.debug?.('AppleSocialAuthService initialized');
37
+ }
38
+ async getAuthUrl(state) {
39
+ if (!this.oauthClient) {
40
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_CONFIG_MISSING, 'Apple OAuth is not enabled');
41
+ }
42
+ const finalState = state || this.generateState();
43
+ return this.oauthClient.getAuthorizationUrl(finalState);
44
+ }
45
+ async getOAuthProfile(code, _state) {
46
+ if (!this.oauthClient) {
47
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_CONFIG_MISSING, 'Apple OAuth is not enabled');
48
+ }
49
+ const providerConfig = this.getProviderConfig();
50
+ if (!providerConfig || !providerConfig.callbackUrl) {
51
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_CONFIG_MISSING, 'Apple OAuth callback URL is not configured');
52
+ }
53
+ const tokens = await this.oauthClient.exchangeCodeForToken(code, providerConfig.callbackUrl);
54
+ return await this.oauthClient.getUserProfile(tokens.accessToken);
55
+ }
56
+ async verifyNativeToken(idToken, _accessToken, profileData) {
57
+ if (!this.tokenVerifier) {
58
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_CONFIG_MISSING, 'Apple OAuth is not enabled');
59
+ }
60
+ const providerConfig = this.getProviderConfig();
61
+ if (!providerConfig) {
62
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_CONFIG_MISSING, 'Apple OAuth is not configured');
63
+ }
64
+ const clientId = providerConfig.clientId || '';
65
+ if (!this.tokenVerifier.verifyAppleToken) {
66
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_CONFIG_MISSING, 'Apple token verifier is not available');
67
+ }
68
+ const verified = (await this.tokenVerifier.verifyAppleToken(idToken, clientId));
69
+ this.logger?.debug?.(`Verified Apple token for: ${verified.email}`);
70
+ if (!verified.email || !verified.email_verified) {
71
+ throw new core_1.NAuthException(core_1.AuthErrorCode.SOCIAL_EMAIL_REQUIRED, 'Email is required and must be verified by Apple.');
72
+ }
73
+ const profileDataTyped = profileData;
74
+ return {
75
+ id: verified.sub,
76
+ email: verified.email,
77
+ firstName: profileDataTyped?.firstName || null,
78
+ lastName: profileDataTyped?.lastName || null,
79
+ picture: null,
80
+ verified: verified.email_verified,
81
+ raw: {
82
+ sub: verified.sub,
83
+ email: verified.email,
84
+ email_verified: verified.email_verified,
85
+ is_private_email: verified.is_private_email,
86
+ },
87
+ };
88
+ }
89
+ }
90
+ exports.AppleSocialAuthService = AppleSocialAuthService;
91
+ //# sourceMappingURL=apple-social-auth.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apple-social-auth.service.js","sourceRoot":"","sources":["../../src/apple-social-auth.service.ts"],"names":[],"mappings":";;;AACA,8CAa6B;AAE7B,2DAOsC;AAEtC,6DAAwD;AACxD,qEAA6F;AAiC7F,MAAa,sBAAuB,SAAQ,wCAA6B;IAC9D,YAAY,GAAG,OAAO,CAAC;IACf,WAAW,CAA0B;IACrC,aAAa,CAA+B;IAE7D,YACE,M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
@@ -0,0 +1,47 @@
1
+ export declare enum SocialProvider {
2
+ GOOGLE = "google",
3
+ APPLE = "apple",
4
+ FACEBOOK = "facebook"
5
+ }
6
+ export declare class SocialLoginDTO {
7
+ provider: SocialProvider;
8
+ state?: string;
9
+ }
10
+ export declare class SocialCallbackDTO {
11
+ provider: SocialProvider;
12
+ code: string;
13
+ state: string;
14
+ error?: string;
15
+ error_description?: string;
16
+ }
17
+ export declare class LinkSocialAccountDTO {
18
+ provider: SocialProvider;
19
+ code: string;
20
+ state: string;
21
+ }
22
+ export declare class UnlinkSocialAccountDTO {
23
+ provider: SocialProvider;
24
+ }
25
+ export declare class SocialLoginResponseDTO {
26
+ accessToken: string;
27
+ refreshToken: string;
28
+ accessTokenExpiresAt: number;
29
+ refreshTokenExpiresAt: number;
30
+ user: {
31
+ sub: string;
32
+ email: string;
33
+ firstName?: string;
34
+ lastName?: string;
35
+ isEmailVerified: boolean;
36
+ socialProviders?: string[];
37
+ };
38
+ }
39
+ export declare class SocialAccountsResponseDTO {
40
+ accounts: Array<{
41
+ provider: string;
42
+ providerEmail?: string;
43
+ linkedAt: Date;
44
+ lastUsedAt?: Date;
45
+ }>;
46
+ }
47
+ //# sourceMappingURL=social-login.dto.d.ts.map
@@ -0,0 +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;C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