@nauth-toolkit/mfa-passkey 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.
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/mfa-passkey
2
+
3
+ Passkey/WebAuthn MFA 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/mfa-passkey@preview
15
+ # or
16
+ yarn add @nauth-toolkit/mfa-passkey@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,5 @@
1
+ export { PasskeyMFAModule } from './passkey-mfa.module';
2
+ export * from '../src/passkey.service';
3
+ export * from '../src/passkey-mfa-provider.service';
4
+ export * from '../src/dto/mfa.dto';
5
+ //# 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,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,23 @@
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.PasskeyMFAModule = void 0;
18
+ var passkey_mfa_module_1 = require("./passkey-mfa.module");
19
+ Object.defineProperty(exports, "PasskeyMFAModule", { enumerable: true, get: function () { return passkey_mfa_module_1.PasskeyMFAModule; } });
20
+ __exportStar(require("../src/passkey.service"), exports);
21
+ __exportStar(require("../src/passkey-mfa-provider.service"), exports);
22
+ __exportStar(require("../src/dto/mfa.dto"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AAGzB,yDAAuC;AACvC,sEAAoD;AACpD,qDAAmC"}
@@ -0,0 +1,10 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { PasskeyMFAProviderService } from '../src/passkey-mfa-provider.service';
3
+ import { MFAService } from '@nauth-toolkit/core';
4
+ export declare class PasskeyMFAModule implements OnModuleInit {
5
+ private readonly passkeyMFAProvider;
6
+ private readonly mfaService;
7
+ constructor(passkeyMFAProvider: PasskeyMFAProviderService, mfaService: MFAService);
8
+ onModuleInit(): void;
9
+ }
10
+ //# sourceMappingURL=passkey-mfa.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey-mfa.module.d.ts","sourceRoot":"","sources":["../../nestjs/passkey-mfa.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAGhF,OAAO,EAAE,UAAU,EAAwE,MAAM,qBAAqB,CAAC;AAwBvH,qBAmDa,gBAAiB,YAAW,YAAY;IAEjD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,kBAAkB,EAAE,yBAAyB,EAC7C,UAAU,EAAE,UAAU;IAMzC,YAAY,IAAI,IAAI;CAMrB"}
@@ -0,0 +1,66 @@
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.PasskeyMFAModule = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const passkey_mfa_provider_service_1 = require("../src/passkey-mfa-provider.service");
15
+ const passkey_service_1 = require("../src/passkey.service");
16
+ const core_1 = require("@nauth-toolkit/core");
17
+ const internal_1 = require("@nauth-toolkit/core/internal");
18
+ let PasskeyMFAModule = class PasskeyMFAModule {
19
+ passkeyMFAProvider;
20
+ mfaService;
21
+ constructor(passkeyMFAProvider, mfaService) {
22
+ this.passkeyMFAProvider = passkeyMFAProvider;
23
+ this.mfaService = mfaService;
24
+ }
25
+ onModuleInit() {
26
+ if (!this.mfaService) {
27
+ throw new Error('MFAService is not available. Ensure AuthModule.forRoot() is imported before PasskeyMFAModule.');
28
+ }
29
+ this.mfaService.registerProvider(this.passkeyMFAProvider);
30
+ }
31
+ };
32
+ exports.PasskeyMFAModule = PasskeyMFAModule;
33
+ exports.PasskeyMFAModule = PasskeyMFAModule = __decorate([
34
+ (0, common_1.Module)({
35
+ providers: [
36
+ {
37
+ provide: passkey_service_1.PasskeyService,
38
+ useFactory: (config, logger) => {
39
+ return new passkey_service_1.PasskeyService(config, logger);
40
+ },
41
+ inject: ['NAUTH_CONFIG', 'NAUTH_LOGGER'],
42
+ },
43
+ {
44
+ provide: passkey_mfa_provider_service_1.PasskeyMFAProviderService,
45
+ useFactory: (mfaDeviceRepository, userRepository, config, logger, passwordService, passkeyService, challengeService, auditService, clientInfoService) => {
46
+ return new passkey_mfa_provider_service_1.PasskeyMFAProviderService(mfaDeviceRepository, userRepository, config, logger, passwordService, passkeyService, challengeService, auditService, clientInfoService);
47
+ },
48
+ inject: [
49
+ 'MFADeviceRepository',
50
+ 'UserRepository',
51
+ 'NAUTH_CONFIG',
52
+ 'NAUTH_LOGGER',
53
+ { token: internal_1.PasswordService, optional: true },
54
+ passkey_service_1.PasskeyService,
55
+ { token: 'ChallengeService', optional: true },
56
+ { token: internal_1.AuthAuditService, optional: true },
57
+ { token: core_1.ClientInfoService, optional: true },
58
+ ],
59
+ },
60
+ ],
61
+ exports: [passkey_service_1.PasskeyService, passkey_mfa_provider_service_1.PasskeyMFAProviderService],
62
+ }),
63
+ __metadata("design:paramtypes", [passkey_mfa_provider_service_1.PasskeyMFAProviderService,
64
+ core_1.MFAService])
65
+ ], PasskeyMFAModule);
66
+ //# sourceMappingURL=passkey-mfa.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey-mfa.module.js","sourceRoot":"","sources":["../../nestjs/passkey-mfa.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,sFAAgF;AAChF,4DAAwD;AAExD,8CAAuH;AAEvH,2DAA6G;AAyEtG,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAER;IACA;IAFnB,YACmB,kBAA6C,EAC7C,UAAsB;QADtB,uBAAkB,GAAlB,kBAAkB,CAA2B;QAC7C,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAKJ,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAAC;QACnH,CAAC;QACD,IAA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@
1
+ export interface MFAChallengeResponseDTO {
2
+ challengeName: 'MFA_REQUIRED';
3
+ session: string;
4
+ challengeParameters: {
5
+ availableMethods: Array<'totp' | 'sms' | 'passkey' | 'backup'>;
6
+ preferredMethod?: 'totp' | 'sms' | 'passkey';
7
+ maskedPhone?: string;
8
+ };
9
+ }
10
+ export interface VerifyMFACodeDTO {
11
+ session: string;
12
+ method: 'totp' | 'sms' | 'backup';
13
+ code: string;
14
+ trustDevice?: boolean;
15
+ deviceId?: string;
16
+ }
17
+ export interface VerifyPasskeyDTO {
18
+ session: string;
19
+ credential: {
20
+ id: string;
21
+ rawId: string;
22
+ response: {
23
+ clientDataJSON: string;
24
+ authenticatorData: string;
25
+ signature: string;
26
+ userHandle?: string;
27
+ };
28
+ type: 'public-key';
29
+ };
30
+ trustDevice?: boolean;
31
+ }
32
+ export interface SetupTOTPResponseDTO {
33
+ secret: string;
34
+ qrCode: string;
35
+ manualEntryKey: string;
36
+ issuer: string;
37
+ accountName: string;
38
+ }
39
+ export interface VerifyTOTPSetupDTO {
40
+ secret: string;
41
+ code: string;
42
+ deviceName?: string;
43
+ }
44
+ export interface SetupSMSMFADTO {
45
+ phoneNumber: string;
46
+ deviceName?: string;
47
+ }
48
+ export interface VerifySMSMFASetupDTO {
49
+ phoneNumber: string;
50
+ code: string;
51
+ }
52
+ export interface SendSMSMFACodeDTO {
53
+ session: string;
54
+ }
55
+ export interface SetupPasskeyResponseDTO {
56
+ options: {
57
+ challenge: string;
58
+ rp: {
59
+ name: string;
60
+ id: string;
61
+ };
62
+ user: {
63
+ id: string;
64
+ name: string;
65
+ displayName: string;
66
+ };
67
+ pubKeyCredParams: Array<{
68
+ type: 'public-key';
69
+ alg: number;
70
+ }>;
71
+ timeout: number;
72
+ attestation: 'none' | 'indirect' | 'direct';
73
+ authenticatorSelection?: {
74
+ authenticatorAttachment?: 'platform' | 'cross-platform';
75
+ requireResidentKey?: boolean;
76
+ userVerification?: 'required' | 'preferred' | 'discouraged';
77
+ };
78
+ excludeCredentials?: Array<{
79
+ id: string;
80
+ type: 'public-key';
81
+ transports?: string[];
82
+ }>;
83
+ };
84
+ }
85
+ export interface VerifyPasskeySetupDTO {
86
+ credential: {
87
+ id: string;
88
+ rawId: string;
89
+ response: {
90
+ clientDataJSON: string;
91
+ attestationObject: string;
92
+ };
93
+ type: 'public-key';
94
+ };
95
+ deviceName?: string;
96
+ }
97
+ export interface GetPasskeyChallengeResponseDTO {
98
+ options: {
99
+ challenge: string;
100
+ timeout: number;
101
+ rpId: string;
102
+ allowCredentials: Array<{
103
+ id: string;
104
+ type: 'public-key';
105
+ transports?: string[];
106
+ }>;
107
+ userVerification: 'required' | 'preferred' | 'discouraged';
108
+ };
109
+ }
110
+ export interface GenerateBackupCodesResponseDTO {
111
+ codes: string[];
112
+ generated: string;
113
+ }
114
+ export interface MFADeviceDTO {
115
+ id: number;
116
+ type: 'totp' | 'sms' | 'passkey';
117
+ name: string;
118
+ isActive: boolean;
119
+ isPrimary: boolean;
120
+ lastUsedAt?: string;
121
+ createdAt: string;
122
+ maskedPhone?: string;
123
+ }
124
+ export interface ListMFADevicesResponseDTO {
125
+ devices: MFADeviceDTO[];
126
+ hasBackupCodes: boolean;
127
+ }
128
+ export interface UpdateMFADeviceDTO {
129
+ name?: string;
130
+ isPrimary?: boolean;
131
+ }
132
+ export interface DisableMFADeviceDTO {
133
+ password: string;
134
+ }
135
+ export interface MFAStatusResponseDTO {
136
+ enabled: boolean;
137
+ required: boolean;
138
+ gracePeriodEnds?: string;
139
+ configuredMethods: Array<'totp' | 'sms' | 'passkey'>;
140
+ preferredMethod?: 'totp' | 'sms' | 'passkey';
141
+ hasBackupCodes: boolean;
142
+ }
143
+ //# sourceMappingURL=mfa.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/mfa.dto.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,uBAAuB;IAItC,aAAa,EAAE,cAAc,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AO,CAAC;IAMlB,eAAe,CAAC,EAAE,MAAM,CAAC;IAKzB,iBAAiB,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC;IAKrD,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAK7C,cAAc,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=mfa.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.dto.js","sourceRoot":"","sources":["../../../src/dto/mfa.dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { PasskeyService } from './passkey.service';
2
+ export { PasskeyMFAProviderService } from './passkey-mfa-provider.service';
3
+ export * from './dto/mfa.dto';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,cAAc,eAAe,CAAC"}
@@ -0,0 +1,23 @@
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.PasskeyMFAProviderService = exports.PasskeyService = void 0;
18
+ var passkey_service_1 = require("./passkey.service");
19
+ Object.defineProperty(exports, "PasskeyService", { enumerable: true, get: function () { return passkey_service_1.PasskeyService; } });
20
+ var passkey_mfa_provider_service_1 = require("./passkey-mfa-provider.service");
21
+ Object.defineProperty(exports, "PasskeyMFAProviderService", { enumerable: true, get: function () { return passkey_mfa_provider_service_1.PasskeyMFAProviderService; } });
22
+ __exportStar(require("./dto/mfa.dto"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAOA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,+EAA2E;AAAlE,yIAAA,yBAAyB,OAAA;AAClC,gDAA8B"}
@@ -0,0 +1,15 @@
1
+ import { Repository } from 'typeorm';
2
+ import { BaseMFADevice, BaseUser, IUser, NAuthConfig, NAuthLogger, MFAMethod } from '@nauth-toolkit/core';
3
+ import { BaseMFAProviderService } from '@nauth-toolkit/core/internal';
4
+ import { PasskeyService } from './passkey.service';
5
+ import { SetupPasskeyResponseDTO, GetPasskeyChallengeResponseDTO } from './dto/mfa.dto';
6
+ export declare class PasskeyMFAProviderService extends BaseMFAProviderService {
7
+ private readonly passkeyService;
8
+ readonly methodName = MFAMethod.PASSKEY;
9
+ constructor(mfaDeviceRepository: Repository<BaseMFADevice>, userRepository: Repository<BaseUser>, config: NAuthConfig, logger: NAuthLogger, passwordService: unknown, passkeyService: PasskeyService, challengeService?: unknown, auditService?: unknown, clientInfoService?: unknown);
10
+ setup(user: IUser, _setupData?: unknown): Promise<SetupPasskeyResponseDTO>;
11
+ verifySetup(user: IUser, verificationData: unknown, deviceName?: string): Promise<number>;
12
+ verify(user: IUser, code: unknown, deviceId?: number): Promise<boolean>;
13
+ sendChallenge(user: IUser): Promise<GetPasskeyChallengeResponseDTO>;
14
+ }
15
+ //# sourceMappingURL=passkey-mfa-provider.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey-mfa-provider.service.d.ts","sourceRoot":"","sources":["../../src/passkey-mfa-provider.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EAEL,WAAW,EACX,WAAW,EAGX,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAyB,8BAA8B,EAAE,MAAM,eAAe,CAAC;AA6B/G,qBAAa,yBAA0B,SAAQ,sBAAsB;IASjE,OAAO,CAAC,QAAQ,CAAC,cAAc;IARjC,QAAQ,CAAC,UAAU,qBAAqB;gBAGtC,mBAAmB,EAAE,UAAU,CAAC,aAAa,CAAC,EAC9C,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,EACpC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,OAAO,EACP,cAAc,EAAE,cAAc,EAC/C,gBAAgB,CAAC,EAAE,OAAO,EAC1B,YAAY,CAAC,EAAE,OAAO,EACtB,iBAAiB,CAAC,EAAE,OAAO;IA+BvB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAiD1E,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAyHzF,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgFvE,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAoB1E"}
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PasskeyMFAProviderService = void 0;
4
+ const core_1 = require("@nauth-toolkit/core");
5
+ const internal_1 = require("@nauth-toolkit/core/internal");
6
+ class PasskeyMFAProviderService extends internal_1.BaseMFAProviderService {
7
+ passkeyService;
8
+ methodName = core_1.MFAMethod.PASSKEY;
9
+ constructor(mfaDeviceRepository, userRepository, config, logger, passwordService, passkeyService, challengeService, auditService, clientInfoService) {
10
+ super(mfaDeviceRepository, userRepository, config, logger, passwordService, challengeService, auditService, clientInfoService);
11
+ this.passkeyService = passkeyService;
12
+ }
13
+ async setup(user, _setupData) {
14
+ this.logger?.log?.(`Setting up passkey for user: ${user.sub}`);
15
+ if (!this.isMethodAllowed()) {
16
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Passkey is not enabled', { feature: 'passkey' });
17
+ }
18
+ const userEntity = user;
19
+ const userId = userEntity.id;
20
+ const existingDevices = await this.getUserDevices(userId);
21
+ const options = await this.passkeyService.generateRegistrationOptions(user.sub, user.email, `${userEntity.firstName || ''} ${userEntity.lastName || ''}`.trim() || user.email, existingDevices);
22
+ this.logger?.log?.(`Passkey registration options generated for user: ${user.sub}`);
23
+ return options;
24
+ }
25
+ async verifySetup(user, verificationData, deviceName) {
26
+ this.logger?.log?.(`Verifying passkey setup for user: ${user.sub}`);
27
+ let dto;
28
+ let expectedChallenge;
29
+ let transports;
30
+ if (verificationData &&
31
+ typeof verificationData === 'object' &&
32
+ 'credential' in verificationData &&
33
+ 'expectedChallenge' in verificationData) {
34
+ const wrapped = verificationData;
35
+ dto = wrapped.credential;
36
+ expectedChallenge = wrapped.expectedChallenge;
37
+ transports = wrapped.transports;
38
+ if (!expectedChallenge || typeof expectedChallenge !== 'string' || expectedChallenge.trim().length === 0) {
39
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Expected challenge is required and must be a non-empty string');
40
+ }
41
+ if (!dto.credential || typeof dto.credential !== 'object') {
42
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Credential is required and must be an object');
43
+ }
44
+ const cred = dto.credential;
45
+ if (!cred.id || !cred.rawId || !cred.response) {
46
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Credential must have id, rawId, and response fields');
47
+ }
48
+ const response = cred.response;
49
+ if (!response.clientDataJSON || !response.attestationObject) {
50
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Credential response must have clientDataJSON and attestationObject fields');
51
+ }
52
+ }
53
+ else {
54
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Passkey verification requires { credential, expectedChallenge }. Use MFAService.verifySetup or provide both.');
55
+ }
56
+ const verified = await this.passkeyService.verifyRegistration(dto.credential, expectedChallenge, transports);
57
+ if (!verified.verified) {
58
+ throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Passkey verification failed');
59
+ }
60
+ const userEntity = user;
61
+ const userId = userEntity.id;
62
+ const userMfaEnabled = userEntity.mfaEnabled || false;
63
+ const device = await this.createDevice(userId, {
64
+ name: deviceName || dto.deviceName || 'Passkey Device',
65
+ credentialId: verified.credentialId,
66
+ publicKey: verified.publicKey,
67
+ counter: verified.counter,
68
+ transports: verified.transports,
69
+ isActive: true,
70
+ isPrimary: !userMfaEnabled,
71
+ });
72
+ await this.enableMFAForUser(user);
73
+ this.logger?.log?.(`Passkey setup completed for user: ${user.sub}`);
74
+ return device.id;
75
+ }
76
+ async verify(user, code, deviceId) {
77
+ this.logger?.log?.(`Verifying passkey for user: ${user.sub}`);
78
+ let credential;
79
+ let expectedChallenge;
80
+ if (code && typeof code === 'object' && 'credential' in code && 'expectedChallenge' in code) {
81
+ const data = code;
82
+ credential = data.credential;
83
+ expectedChallenge = data.expectedChallenge;
84
+ }
85
+ else {
86
+ this.logger?.warn?.('Invalid passkey verification data format');
87
+ return false;
88
+ }
89
+ const userEntity = user;
90
+ const userId = userEntity.id;
91
+ const device = deviceId
92
+ ? await this.findDevice(userId, deviceId)
93
+ : await this.mfaDeviceRepository.findOne({
94
+ where: {
95
+ userId,
96
+ type: core_1.MFAMethod.PASSKEY,
97
+ credentialId: credential.id,
98
+ isActive: true,
99
+ },
100
+ });
101
+ if (!device) {
102
+ this.logger?.warn?.('Passkey device not found');
103
+ return false;
104
+ }
105
+ try {
106
+ const result = await this.passkeyService.verifyAuthentication(credential, expectedChallenge, device);
107
+ if (result.verified) {
108
+ const deviceEntity = device;
109
+ deviceEntity.counter = result.newCounter;
110
+ deviceEntity.lastUsedAt = new Date();
111
+ deviceEntity.usageCount = (deviceEntity.usageCount || 0) + 1;
112
+ await this.mfaDeviceRepository.save(deviceEntity);
113
+ this.logger?.log?.(`Passkey verified successfully for user: ${user.sub}`);
114
+ return true;
115
+ }
116
+ }
117
+ catch (error) {
118
+ this.logger?.error?.('Passkey verification error', error);
119
+ }
120
+ return false;
121
+ }
122
+ async sendChallenge(user) {
123
+ this.logger?.log?.(`Generating passkey challenge for user: ${user.sub}`);
124
+ const userEntity = user;
125
+ const userId = userEntity.id;
126
+ const devices = await this.getUserDevices(userId);
127
+ const passkeyDevices = devices.filter((d) => d.type === core_1.MFAMethod.PASSKEY && d.isActive);
128
+ if (passkeyDevices.length === 0) {
129
+ throw new core_1.NAuthException(core_1.AuthErrorCode.NOT_FOUND, 'No passkey devices registered', { deviceType: 'passkey' });
130
+ }
131
+ const options = await this.passkeyService.generateAuthenticationOptions(passkeyDevices);
132
+ this.logger?.log?.(`Passkey challenge generated for user: ${user.sub}`);
133
+ return options;
134
+ }
135
+ }
136
+ exports.PasskeyMFAProviderService = PasskeyMFAProviderService;
137
+ //# sourceMappingURL=passkey-mfa-provider.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey-mfa-provider.service.js","sourceRoot":"","sources":["../../src/passkey-mfa-provider.service.ts"],"names":[],"mappings":";;;AAEA,8CAU6B;AAE7B,2DAAsE;AA+BtE,MAAa,yBAA0B,SAAQ,iCAAsB;IAShD;IARV,UAAU,GAAG,gBAAS,CAAC,OAAO,CAAC;IAExC,YACE,mBAA8C,EAC9C,cAAoC,EACpC,MAAmB,EACnB,MAAmB,EACnB,eAAwB,EACP,cAA8B,EAC/C,gBAA0B,EAC1B,YAAsB,EACtB,iBAA2B;QAE3B,KAAK,CACH,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,MAAM,EACN,eAAe,EACf,gBAAuB,EACvB,YAAmB,EACnB,iBAAwB,CACzB,CAAC;QAde,mBAAc,GAAd,cAAc,CAAgB;IAejD,CAAC;IAmBD,KAAK,CAAC,KAAK,CAAC,IAAW,EAAE,UAAoB;QAC3C,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,gCAAgC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAG/D,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;YAC5B,MAAM,IAAI,qBAAc,CAAC,oBAAa,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QAC9G,CAAC;QAGD,MAAM,UAAU,GAAG,IAA0C,CAAC;QAC9D,MAAM,MAAM,GAAG,UAAU,CAAC,EAAY,CAAC;QACvC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAG1D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,2BAA2B,CACnE,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,KAAK,EACV,GAAI,UAAU,CAAC,SAAoB,IAAI,EAAE,IAAK,UAAU,CAAC,QAAmB,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,IAAI,CAA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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAS,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;QAEzF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,qBAAc,CAAC,oBAAa,CAAC,SAAS,EAAE,+BAA+B,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;QAChH,CAAC;QAGD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,6BAA6B,CAAC,cAAc,CAAC,CAAC;QAExF,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,yCAAyC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAExE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAzTD,8DAyTC"}
@@ -0,0 +1,26 @@
1
+ import type { RegistrationResponseJSON, AuthenticationResponseJSON } from '@simplewebauthn/types';
2
+ import { NAuthConfig, NAuthLogger, IMFADevice } from '@nauth-toolkit/core';
3
+ import { SetupPasskeyResponseDTO, GetPasskeyChallengeResponseDTO } from './dto/mfa.dto';
4
+ export declare class PasskeyService {
5
+ private readonly config;
6
+ private readonly logger;
7
+ private readonly defaultConfig;
8
+ constructor(config: NAuthConfig, logger: NAuthLogger);
9
+ private getPasskeyConfig;
10
+ generateRegistrationOptions(userId: string, userEmail: string, userName: string, existingDevices?: IMFADevice[]): Promise<SetupPasskeyResponseDTO>;
11
+ verifyRegistration(credential: RegistrationResponseJSON, expectedChallenge: string, transports?: string[]): Promise<{
12
+ verified: boolean;
13
+ credentialId: string;
14
+ publicKey: string;
15
+ counter: number;
16
+ transports: string[];
17
+ }>;
18
+ generateAuthenticationOptions(userDevices: IMFADevice[]): Promise<GetPasskeyChallengeResponseDTO>;
19
+ verifyAuthentication(credential: AuthenticationResponseJSON, expectedChallenge: string, device: IMFADevice): Promise<{
20
+ verified: boolean;
21
+ newCounter: number;
22
+ }>;
23
+ isSupported(): boolean;
24
+ maskCredentialId(credentialId: string): string;
25
+ }
26
+ //# sourceMappingURL=passkey.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey.service.d.ts","sourceRoot":"","sources":["../../src/passkey.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EAEX,WAAW,EAIX,UAAU,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAcxF,qBAAa,cAAc;IAOvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG5B;gBAGiB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW;IAUtC,OAAO,CAAC,gBAAgB;IA6BlB,2BAA2B,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,GAAE,UAAU,EAAO,GACjC,OAAO,CAAC,uBAAuB,CAAC;IA+C7B,kBAAkB,CACtB,UAAU,EAAE,wBAAwB,EACpC,iBAAiB,EAAE,MAAM,EACzB,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC;QACT,QAAQ,EAAE,OAAO,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IA8EI,6BAA6B,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAwDjG,oBAAoB,CACxB,UAAU,EAAE,0BAA0B,EACtC,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,UAAU,G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