@nauth-toolkit/mfa-email 0.1.14 → 0.1.17
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/nestjs/email-mfa.module.d.ts +23 -0
- package/dist/nestjs/email-mfa.module.d.ts.map +1 -1
- package/dist/nestjs/email-mfa.module.js +29 -1
- package/dist/nestjs/email-mfa.module.js.map +1 -1
- package/dist/nestjs/index.d.ts +5 -0
- package/dist/nestjs/index.d.ts.map +1 -1
- package/dist/nestjs/index.js +6 -0
- package/dist/nestjs/index.js.map +1 -1
- package/dist/src/dto/mfa.dto.d.ts +63 -0
- package/dist/src/dto/mfa.dto.d.ts.map +1 -1
- package/dist/src/dto/mfa.dto.js +6 -0
- package/dist/src/dto/mfa.dto.js.map +1 -1
- package/dist/src/email-mfa-provider.service.d.ts +101 -1
- package/dist/src/email-mfa-provider.service.d.ts.map +1 -1
- package/dist/src/email-mfa-provider.service.js +158 -4
- package/dist/src/email-mfa-provider.service.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import { OnModuleInit } from '@nestjs/common';
|
|
2
2
|
import { EmailMFAProviderService } from '../src/email-mfa-provider.service';
|
|
3
3
|
import { MFAService } from '@nauth-toolkit/core';
|
|
4
|
+
/**
|
|
5
|
+
* Email MFA Module (NestJS Adapter)
|
|
6
|
+
*
|
|
7
|
+
* Provides Email-based MFA functionality.
|
|
8
|
+
* Auto-registers with MFAService when imported.
|
|
9
|
+
*
|
|
10
|
+
* Requires EmailVerificationService from @nauth-toolkit/core,
|
|
11
|
+
* which is available when an email provider is configured.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* @Module({
|
|
16
|
+
* imports: [
|
|
17
|
+
* AuthModule.forRoot(config), // Must have email provider configured
|
|
18
|
+
* EmailMFAModule, // Auto-registers Email provider
|
|
19
|
+
* ],
|
|
20
|
+
* })
|
|
21
|
+
* export class AppModule {}
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
4
24
|
export declare class EmailMFAModule implements OnModuleInit {
|
|
5
25
|
private readonly emailMFAProvider;
|
|
6
26
|
private readonly mfaService;
|
|
7
27
|
constructor(emailMFAProvider: EmailMFAProviderService, mfaService: MFAService);
|
|
28
|
+
/**
|
|
29
|
+
* Auto-register Email provider with MFAService
|
|
30
|
+
*/
|
|
8
31
|
onModuleInit(): void;
|
|
9
32
|
}
|
|
10
33
|
//# sourceMappingURL=email-mfa.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-mfa.module.d.ts","sourceRoot":"","sources":["../../nestjs/email-mfa.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAyE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"email-mfa.module.d.ts","sourceRoot":"","sources":["../../nestjs/email-mfa.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAyE,MAAM,qBAAqB,CAAC;AAMxH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBA2Ca,cAAe,YAAW,YAAY;IAE/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,gBAAgB,EAAE,uBAAuB,EACzC,UAAU,EAAE,UAAU;IAGzC;;OAEG;IACH,YAAY,IAAI,IAAI;CAMrB"}
|
|
@@ -12,8 +12,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.EmailMFAModule = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const email_mfa_provider_service_1 = require("../src/email-mfa-provider.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");
|
|
19
|
+
/**
|
|
20
|
+
* Email MFA Module (NestJS Adapter)
|
|
21
|
+
*
|
|
22
|
+
* Provides Email-based MFA functionality.
|
|
23
|
+
* Auto-registers with MFAService when imported.
|
|
24
|
+
*
|
|
25
|
+
* Requires EmailVerificationService from @nauth-toolkit/core,
|
|
26
|
+
* which is available when an email provider is configured.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @Module({
|
|
31
|
+
* imports: [
|
|
32
|
+
* AuthModule.forRoot(config), // Must have email provider configured
|
|
33
|
+
* EmailMFAModule, // Auto-registers Email provider
|
|
34
|
+
* ],
|
|
35
|
+
* })
|
|
36
|
+
* export class AppModule {}
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
17
39
|
let EmailMFAModule = class EmailMFAModule {
|
|
18
40
|
emailMFAProvider;
|
|
19
41
|
mfaService;
|
|
@@ -21,6 +43,9 @@ let EmailMFAModule = class EmailMFAModule {
|
|
|
21
43
|
this.emailMFAProvider = emailMFAProvider;
|
|
22
44
|
this.mfaService = mfaService;
|
|
23
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Auto-register Email provider with MFAService
|
|
48
|
+
*/
|
|
24
49
|
onModuleInit() {
|
|
25
50
|
if (!this.mfaService) {
|
|
26
51
|
throw new Error('MFAService is not available. Ensure AuthModule.forRoot() is imported before EmailMFAModule.');
|
|
@@ -32,9 +57,12 @@ exports.EmailMFAModule = EmailMFAModule;
|
|
|
32
57
|
exports.EmailMFAModule = EmailMFAModule = __decorate([
|
|
33
58
|
(0, common_1.Module)({
|
|
34
59
|
providers: [
|
|
60
|
+
// Email MFA Provider Service (factory provider)
|
|
35
61
|
{
|
|
36
62
|
provide: email_mfa_provider_service_1.EmailMFAProviderService,
|
|
37
|
-
useFactory: (mfaDeviceRepository, userRepository, config, logger, passwordService, emailVerificationService, challengeService,
|
|
63
|
+
useFactory: (mfaDeviceRepository, userRepository, config, logger, passwordService, emailVerificationService, challengeService, // ChallengeService from core
|
|
64
|
+
auditService, // AuthAuditService from core
|
|
65
|
+
clientInfoService) => {
|
|
38
66
|
return new email_mfa_provider_service_1.EmailMFAProviderService(mfaDeviceRepository, userRepository, config, logger, passwordService, emailVerificationService, challengeService, auditService, clientInfoService);
|
|
39
67
|
},
|
|
40
68
|
inject: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-mfa.module.js","sourceRoot":"","sources":["../../nestjs/email-mfa.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,kFAA4E;
|
|
1
|
+
{"version":3,"file":"email-mfa.module.js","sourceRoot":"","sources":["../../nestjs/email-mfa.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsD;AACtD,kFAA4E;AAC5E,qBAAqB;AACrB,8CAAwH;AACxH,sDAAsD;AACtD,2DAA6G;AAI7G;;;;;;;;;;;;;;;;;;;GAmBG;AA4CI,IAAM,cAAc,GAApB,MAAM,cAAc;IAEN;IACA;IAFnB,YACmB,gBAAyC,EACzC,UAAsB;QADtB,qBAAgB,GAAhB,gBAAgB,CAAyB;QACzC,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;QACjH,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC1D,CAAC;CACF,CAAA;AAfY,wCAAc;yBAAd,cAAc;IA3C1B,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,gDAAgD;YAChD;gBACE,OAAO,EAAE,oDAAuB;gBAChC,UAAU,EAAE,CACV,mBAA8C,EAC9C,cAAoC,EACpC,MAAmB,EACnB,MAAmB,EACnB,eAAgC,EAChC,wBAA8D,EAC9D,gBAAqB,EAAE,6BAA6B;gBACpD,YAAiB,EAAE,6BAA6B;gBAChD,iBAAsB,EACtB,EAAE;oBACF,OAAO,IAAI,oDAAuB,CAChC,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,MAAM,EACN,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,CAClB,CAAC;gBACJ,CAAC;gBACD,MAAM,EAAE;oBACN,qBAAqB;oBACrB,gBAAgB;oBAChB,cAAc;oBACd,cAAc;oBACd,EAAE,KAAK,EAAE,0BAAe,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAC1C,EAAE,KAAK,EAAE,+BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACnD,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAC7C,EAAE,KAAK,EAAE,2BAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACnD,EAAE,KAAK,EAAE,wBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE;iBAC7C;aACF;SACF;QACD,OAAO,EAAE,CAAC,oDAAuB,CAAC;KACnC,CAAC;qCAGqC,oDAAuB;QAC7B,iBAAU;GAH9B,cAAc,CAe1B"}
|
package/dist/nestjs/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC"}
|
package/dist/nestjs/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @nauth-toolkit/mfa-email/nestjs
|
|
4
|
+
*
|
|
5
|
+
* NestJS adapter for Email MFA
|
|
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.EmailMFAModule = void 0;
|
|
18
23
|
var email_mfa_module_1 = require("./email-mfa.module");
|
|
19
24
|
Object.defineProperty(exports, "EmailMFAModule", { enumerable: true, get: function () { return email_mfa_module_1.EmailMFAModule; } });
|
|
25
|
+
// Re-export core Email MFA components
|
|
20
26
|
__exportStar(require("../src/email-mfa-provider.service"), exports);
|
|
21
27
|
__exportStar(require("../src/dto/mfa.dto"), exports);
|
|
22
28
|
//# sourceMappingURL=index.js.map
|
package/dist/nestjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../nestjs/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AAEvB,sCAAsC;AACtC,oEAAkD;AAClD,qDAAmC"}
|
|
@@ -1,12 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MFA (Multi-Factor Authentication) DTOs
|
|
3
|
+
*
|
|
4
|
+
* Request and response types for Email MFA operations including:
|
|
5
|
+
* - Email MFA setup and verification
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Setup Email MFA DTO
|
|
9
|
+
*
|
|
10
|
+
* Configure Email as MFA method.
|
|
11
|
+
* Sends verification code to email address.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* {
|
|
16
|
+
* email: 'user@example.com',
|
|
17
|
+
* deviceName: 'My Email'
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
1
21
|
export interface SetupEmailMFADTO {
|
|
22
|
+
/**
|
|
23
|
+
* Email address for Email MFA
|
|
24
|
+
* Must be a valid email address format
|
|
25
|
+
* @example 'user@example.com'
|
|
26
|
+
*/
|
|
2
27
|
email: string;
|
|
28
|
+
/**
|
|
29
|
+
* User-friendly device name
|
|
30
|
+
* @example 'My Email', 'Work Email'
|
|
31
|
+
*/
|
|
3
32
|
deviceName?: string;
|
|
4
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Verify Email MFA Setup DTO
|
|
36
|
+
*
|
|
37
|
+
* Submit code to complete Email MFA setup.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* {
|
|
42
|
+
* email: 'user@example.com',
|
|
43
|
+
* code: '123456'
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
5
47
|
export interface VerifyEmailMFASetupDTO {
|
|
48
|
+
/**
|
|
49
|
+
* Email address receiving the code
|
|
50
|
+
*/
|
|
6
51
|
email: string;
|
|
52
|
+
/**
|
|
53
|
+
* Email verification code
|
|
54
|
+
*/
|
|
7
55
|
code: string;
|
|
8
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Send Email MFA Code DTO
|
|
59
|
+
*
|
|
60
|
+
* Request Email code during MFA challenge.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* {
|
|
65
|
+
* session: 'challenge-session-token'
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
9
69
|
export interface SendEmailMFACodeDTO {
|
|
70
|
+
/**
|
|
71
|
+
* Challenge session token
|
|
72
|
+
*/
|
|
10
73
|
session: string;
|
|
11
74
|
}
|
|
12
75
|
//# sourceMappingURL=mfa.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfa.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/mfa.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mfa.dto.d.ts","sourceRoot":"","sources":["../../../src/dto/mfa.dto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/src/dto/mfa.dto.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MFA (Multi-Factor Authentication) DTOs
|
|
4
|
+
*
|
|
5
|
+
* Request and response types for Email MFA operations including:
|
|
6
|
+
* - Email MFA setup and verification
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
//# sourceMappingURL=mfa.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfa.dto.js","sourceRoot":"","sources":["../../../src/dto/mfa.dto.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"mfa.dto.js","sourceRoot":"","sources":["../../../src/dto/mfa.dto.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1,18 +1,118 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { BaseMFADevice, BaseUser, IUser, NAuthConfig, NAuthLogger, EmailVerificationService, MFAMethod } from '@nauth-toolkit/core';
|
|
3
3
|
import { BaseMFAProviderService } from '@nauth-toolkit/core/internal';
|
|
4
|
+
/**
|
|
5
|
+
* Email MFA Provider Service
|
|
6
|
+
*
|
|
7
|
+
* Implements Email-based MFA method.
|
|
8
|
+
* Extends BaseMFAProviderService to provide Email-specific functionality.
|
|
9
|
+
*
|
|
10
|
+
* This service handles:
|
|
11
|
+
* - Email code sending during setup and authentication
|
|
12
|
+
* - Email code verification
|
|
13
|
+
* - MFA device creation for Email
|
|
14
|
+
*
|
|
15
|
+
* Requires EmailVerificationService from core (available when email provider is configured).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* @Module({
|
|
20
|
+
* imports: [EmailMFAModule],
|
|
21
|
+
* })
|
|
22
|
+
* export class AppModule {}
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
export declare class EmailMFAProviderService extends BaseMFAProviderService {
|
|
5
26
|
private readonly emailVerificationService?;
|
|
6
27
|
readonly methodName = MFAMethod.EMAIL;
|
|
7
|
-
constructor(mfaDeviceRepository: Repository<BaseMFADevice>, userRepository: Repository<BaseUser>, config: NAuthConfig, logger: NAuthLogger, passwordService: unknown, emailVerificationService?: EmailVerificationService | undefined, challengeService?: unknown,
|
|
28
|
+
constructor(mfaDeviceRepository: Repository<BaseMFADevice>, userRepository: Repository<BaseUser>, config: NAuthConfig, logger: NAuthLogger, passwordService: unknown, emailVerificationService?: EmailVerificationService | undefined, challengeService?: unknown, // ChallengeService (optional)
|
|
29
|
+
auditService?: unknown, // AuthAuditService (optional)
|
|
30
|
+
clientInfoService?: unknown);
|
|
31
|
+
/**
|
|
32
|
+
* Setup Email MFA for user
|
|
33
|
+
*
|
|
34
|
+
* Sends verification code to email address, or auto-completes setup if email is already verified.
|
|
35
|
+
* User must verify code to complete setup (unless email is already verified).
|
|
36
|
+
*
|
|
37
|
+
* @param user - User setting up Email MFA
|
|
38
|
+
* @param setupData - Setup data (must be SetupEmailMFADTO)
|
|
39
|
+
* @returns Setup result with deviceId if auto-completed, or maskedEmail if code was sent
|
|
40
|
+
* @throws {NAuthException} If Email is not enabled or email verification service unavailable
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const result = await provider.setup(user, {
|
|
45
|
+
* email: 'user@example.com',
|
|
46
|
+
* deviceName: 'My Email'
|
|
47
|
+
* });
|
|
48
|
+
* // If email verified: { deviceId: 123, autoCompleted: true }
|
|
49
|
+
* // If email not verified: { maskedEmail: 'u***r@example.com' } (Email code sent)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
8
52
|
setup(user: IUser, setupData?: unknown): Promise<{
|
|
9
53
|
deviceId: number;
|
|
10
54
|
autoCompleted: true;
|
|
11
55
|
} | {
|
|
12
56
|
maskedEmail: string;
|
|
13
57
|
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Verify and complete Email MFA setup
|
|
60
|
+
*
|
|
61
|
+
* Validates the Email code and stores the device if valid.
|
|
62
|
+
* Enables MFA for user if this is their first device.
|
|
63
|
+
*
|
|
64
|
+
* **Race Condition Safety:**
|
|
65
|
+
* Device creation uses transaction with pessimistic locking to prevent duplicates.
|
|
66
|
+
* If device already exists (e.g., from concurrent request), returns existing device.
|
|
67
|
+
* Database unique constraint (userId, type) provides final safety net.
|
|
68
|
+
*
|
|
69
|
+
* @param user - User completing Email MFA setup
|
|
70
|
+
* @param verificationData - Verification data (must be VerifyEmailMFASetupDTO)
|
|
71
|
+
* @param deviceName - Optional device name override
|
|
72
|
+
* @returns MFA device ID (created or existing)
|
|
73
|
+
* @throws {NAuthException} If code is invalid
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const deviceId = await provider.verifySetup(user, {
|
|
78
|
+
* email: 'user@example.com',
|
|
79
|
+
* code: '123456'
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
14
83
|
verifySetup(user: IUser, verificationData: unknown, deviceName?: string): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Verify Email code during authentication
|
|
86
|
+
*
|
|
87
|
+
* Validates the Email code for an existing device.
|
|
88
|
+
*
|
|
89
|
+
* @param user - User being authenticated
|
|
90
|
+
* @param code - Email code (string)
|
|
91
|
+
* @param deviceId - Optional device ID to verify against
|
|
92
|
+
* @returns True if verification succeeds
|
|
93
|
+
* @throws {NAuthException} If device not found or verification fails
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const isValid = await provider.verify(user, '123456');
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
15
100
|
verify(user: IUser, code: unknown, deviceId?: number): Promise<boolean>;
|
|
101
|
+
/**
|
|
102
|
+
* Send Email code for MFA verification
|
|
103
|
+
*
|
|
104
|
+
* Called during login MFA challenge to send code to registered email.
|
|
105
|
+
*
|
|
106
|
+
* @param user - User requesting Email code
|
|
107
|
+
* @returns Masked email address where code was sent
|
|
108
|
+
* @throws {NAuthException} If no Email device registered or email verification service unavailable
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const maskedEmail = await provider.sendChallenge(user);
|
|
113
|
+
* // Returns: 'u***r@example.com'
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
16
116
|
sendChallenge(user: IUser): Promise<string>;
|
|
17
117
|
}
|
|
18
118
|
//# sourceMappingURL=email-mfa-provider.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-mfa-provider.service.d.ts","sourceRoot":"","sources":["../../src/email-mfa-provider.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EAGX,wBAAwB,EACxB,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"email-mfa-provider.service.d.ts","sourceRoot":"","sources":["../../src/email-mfa-provider.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EAGX,wBAAwB,EACxB,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAGtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,uBAAwB,SAAQ,sBAAsB;IAS/D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAR5C,QAAQ,CAAC,UAAU,mBAAmB;gBAGpC,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,wBAAwB,CAAC,EAAE,wBAAwB,YAAA,EACpE,gBAAgB,CAAC,EAAE,OAAO,EAAE,8BAA8B;IAC1D,YAAY,CAAC,EAAE,OAAO,EAAE,8BAA8B;IACtD,iBAAiB,CAAC,EAAE,OAAO;IAc7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,KAAK,CACT,IAAI,EAAE,KAAK,EACX,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAkE/E;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmF/F;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAmE7E;;;;;;;;;;;;;;OAcG;IACG,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;CA4ClD"}
|