@nauth-toolkit/mfa-email 0.1.13 → 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,38 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmailMFAProviderService = void 0;
|
|
4
|
+
// Public API imports
|
|
4
5
|
const core_1 = require("@nauth-toolkit/core");
|
|
6
|
+
// Internal API imports (for provider implementations)
|
|
5
7
|
const internal_1 = require("@nauth-toolkit/core/internal");
|
|
8
|
+
/**
|
|
9
|
+
* Email MFA Provider Service
|
|
10
|
+
*
|
|
11
|
+
* Implements Email-based MFA method.
|
|
12
|
+
* Extends BaseMFAProviderService to provide Email-specific functionality.
|
|
13
|
+
*
|
|
14
|
+
* This service handles:
|
|
15
|
+
* - Email code sending during setup and authentication
|
|
16
|
+
* - Email code verification
|
|
17
|
+
* - MFA device creation for Email
|
|
18
|
+
*
|
|
19
|
+
* Requires EmailVerificationService from core (available when email provider is configured).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* @Module({
|
|
24
|
+
* imports: [EmailMFAModule],
|
|
25
|
+
* })
|
|
26
|
+
* export class AppModule {}
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
6
29
|
class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
7
30
|
emailVerificationService;
|
|
8
31
|
methodName = core_1.MFAMethod.EMAIL;
|
|
9
|
-
constructor(mfaDeviceRepository, userRepository, config, logger, passwordService, emailVerificationService, challengeService,
|
|
32
|
+
constructor(mfaDeviceRepository, userRepository, config, logger, passwordService, emailVerificationService, challengeService, // ChallengeService (optional)
|
|
33
|
+
auditService, // AuthAuditService (optional)
|
|
34
|
+
clientInfoService) {
|
|
10
35
|
super(mfaDeviceRepository, userRepository, config, logger, passwordService, challengeService, auditService, clientInfoService);
|
|
11
36
|
this.emailVerificationService = emailVerificationService;
|
|
12
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Setup Email MFA for user
|
|
40
|
+
*
|
|
41
|
+
* Sends verification code to email address, or auto-completes setup if email is already verified.
|
|
42
|
+
* User must verify code to complete setup (unless email is already verified).
|
|
43
|
+
*
|
|
44
|
+
* @param user - User setting up Email MFA
|
|
45
|
+
* @param setupData - Setup data (must be SetupEmailMFADTO)
|
|
46
|
+
* @returns Setup result with deviceId if auto-completed, or maskedEmail if code was sent
|
|
47
|
+
* @throws {NAuthException} If Email is not enabled or email verification service unavailable
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const result = await provider.setup(user, {
|
|
52
|
+
* email: 'user@example.com',
|
|
53
|
+
* deviceName: 'My Email'
|
|
54
|
+
* });
|
|
55
|
+
* // If email verified: { deviceId: 123, autoCompleted: true }
|
|
56
|
+
* // If email not verified: { maskedEmail: 'u***r@example.com' } (Email code sent)
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
13
59
|
async setup(user, setupData) {
|
|
14
60
|
this.logger?.log?.(`Setting up Email MFA for user: ${user.sub}`);
|
|
61
|
+
// Check if Email is allowed
|
|
15
62
|
if (!this.isMethodAllowed()) {
|
|
16
63
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Email MFA is not enabled', { feature: 'email-mfa' });
|
|
17
64
|
}
|
|
18
65
|
const dto = setupData;
|
|
19
66
|
const userEntity = user;
|
|
20
67
|
const isEmailVerified = userEntity.isEmailVerified || false;
|
|
68
|
+
// Get email address from setupData or user object
|
|
21
69
|
const email = dto?.email || userEntity.email;
|
|
22
70
|
if (!email) {
|
|
23
71
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Email address is required for Email MFA setup. Please provide an email address.');
|
|
24
72
|
}
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// Special case: If email is already verified, auto-complete MFA setup
|
|
75
|
+
// No Email code needed - create device directly
|
|
76
|
+
// ============================================================================
|
|
25
77
|
if (isEmailVerified) {
|
|
26
78
|
this.logger?.log?.(`Email already verified for user ${user.sub}, auto-completing Email MFA setup`);
|
|
79
|
+
// Auto-create MFA device without code verification
|
|
27
80
|
const deviceId = await this.verifySetup(user, {
|
|
28
81
|
email,
|
|
29
|
-
code: '',
|
|
82
|
+
code: '', // Code not needed when email is verified
|
|
30
83
|
}, dto?.deviceName);
|
|
31
84
|
return { deviceId, autoCompleted: true };
|
|
32
85
|
}
|
|
86
|
+
// Email not verified - send Email verification code
|
|
87
|
+
// Check if email verification service is available
|
|
33
88
|
if (!this.emailVerificationService) {
|
|
34
89
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Email verification service is not available. Email provider must be configured.');
|
|
35
90
|
}
|
|
91
|
+
// Send Email verification code (email not verified, so code is required)
|
|
92
|
+
// Link verification token to challenge session if provided in setupData
|
|
36
93
|
const sendDto = new core_1.SendVerificationEmailDTO();
|
|
37
94
|
sendDto.sub = user.sub;
|
|
38
95
|
const setupDataWithSession = setupData;
|
|
@@ -42,8 +99,34 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
42
99
|
await this.emailVerificationService.sendVerificationEmail(sendDto);
|
|
43
100
|
const maskedEmail = this.maskEmail(email);
|
|
44
101
|
this.logger?.log?.(`Email MFA code sent to: ${maskedEmail}`);
|
|
102
|
+
// Return masked email for frontend display
|
|
45
103
|
return { maskedEmail };
|
|
46
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Verify and complete Email MFA setup
|
|
107
|
+
*
|
|
108
|
+
* Validates the Email code and stores the device if valid.
|
|
109
|
+
* Enables MFA for user if this is their first device.
|
|
110
|
+
*
|
|
111
|
+
* **Race Condition Safety:**
|
|
112
|
+
* Device creation uses transaction with pessimistic locking to prevent duplicates.
|
|
113
|
+
* If device already exists (e.g., from concurrent request), returns existing device.
|
|
114
|
+
* Database unique constraint (userId, type) provides final safety net.
|
|
115
|
+
*
|
|
116
|
+
* @param user - User completing Email MFA setup
|
|
117
|
+
* @param verificationData - Verification data (must be VerifyEmailMFASetupDTO)
|
|
118
|
+
* @param deviceName - Optional device name override
|
|
119
|
+
* @returns MFA device ID (created or existing)
|
|
120
|
+
* @throws {NAuthException} If code is invalid
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const deviceId = await provider.verifySetup(user, {
|
|
125
|
+
* email: 'user@example.com',
|
|
126
|
+
* code: '123456'
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
47
130
|
async verifySetup(user, verificationData, deviceName) {
|
|
48
131
|
this.logger?.log?.(`Verifying Email MFA setup for user: ${user.sub}`);
|
|
49
132
|
const dto = verificationData;
|
|
@@ -51,11 +134,18 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
51
134
|
const userId = userEntity.id;
|
|
52
135
|
const userMfaEnabled = userEntity.mfaEnabled || false;
|
|
53
136
|
const isEmailVerified = userEntity.isEmailVerified || false;
|
|
137
|
+
// Get email address from dto or fall back to user object
|
|
138
|
+
// This ensures email is always stored in the device, even if dto.email is undefined
|
|
54
139
|
const email = dto.email || userEntity.email;
|
|
55
140
|
if (!email) {
|
|
56
141
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Email address is required for Email MFA setup. Please provide an email address.');
|
|
57
142
|
}
|
|
143
|
+
// ============================================================================
|
|
144
|
+
// Special case: If email is already verified, skip code verification
|
|
145
|
+
// This improves UX by avoiding redundant Email verification after email verification
|
|
146
|
+
// ============================================================================
|
|
58
147
|
if (!isEmailVerified) {
|
|
148
|
+
// Email not verified - verify Email code (this will also mark email as verified)
|
|
59
149
|
if (!this.emailVerificationService) {
|
|
60
150
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Email verification service is not available. Email provider must be configured.');
|
|
61
151
|
}
|
|
@@ -63,6 +153,7 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
63
153
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Verification code is required');
|
|
64
154
|
}
|
|
65
155
|
try {
|
|
156
|
+
// Verify email with code - this will mark email as verified in the database
|
|
66
157
|
const verifyDto = new core_1.VerifyEmailWithCodeDTO();
|
|
67
158
|
verifyDto.email = user.email;
|
|
68
159
|
verifyDto.code = dto.code;
|
|
@@ -70,26 +161,52 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
70
161
|
this.logger?.log?.(`Email verified during Email MFA setup for user ${user.sub} - email is now marked as verified in database`);
|
|
71
162
|
}
|
|
72
163
|
catch (error) {
|
|
164
|
+
// Re-throw with more specific error message
|
|
73
165
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
74
166
|
this.logger?.error?.(`Failed to verify email during Email MFA setup for user ${user.sub}: ${errorMessage}`, error);
|
|
75
167
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VERIFICATION_CODE_INVALID, 'Invalid Email code');
|
|
76
168
|
}
|
|
77
169
|
}
|
|
78
170
|
else {
|
|
171
|
+
// Email already verified - skip code verification
|
|
79
172
|
this.logger?.log?.(`Email already verified for user ${user.sub}, skipping Email code verification during MFA setup`);
|
|
80
173
|
}
|
|
174
|
+
// ============================================================================
|
|
175
|
+
// Create MFA device (transaction-safe with duplicate prevention)
|
|
176
|
+
// ============================================================================
|
|
177
|
+
// createDevice() uses pessimistic locking to prevent race conditions
|
|
178
|
+
// If device already exists, returns existing device instead of creating duplicate
|
|
179
|
+
// Database unique constraint (userId, type) provides additional safety
|
|
81
180
|
const device = await this.createDevice(userId, {
|
|
82
181
|
name: deviceName || 'Email',
|
|
83
|
-
email,
|
|
182
|
+
email, // Use resolved email (dto.email or user.email)
|
|
84
183
|
isActive: true,
|
|
85
|
-
isPrimary: !userMfaEnabled,
|
|
184
|
+
isPrimary: !userMfaEnabled, // First device becomes primary
|
|
86
185
|
});
|
|
186
|
+
// Enable MFA if not already enabled
|
|
87
187
|
await this.enableMFAForUser(user);
|
|
88
188
|
this.logger?.log?.(`Email MFA setup completed for user: ${user.sub}`);
|
|
89
189
|
return device.id;
|
|
90
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Verify Email code during authentication
|
|
193
|
+
*
|
|
194
|
+
* Validates the Email code for an existing device.
|
|
195
|
+
*
|
|
196
|
+
* @param user - User being authenticated
|
|
197
|
+
* @param code - Email code (string)
|
|
198
|
+
* @param deviceId - Optional device ID to verify against
|
|
199
|
+
* @returns True if verification succeeds
|
|
200
|
+
* @throws {NAuthException} If device not found or verification fails
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const isValid = await provider.verify(user, '123456');
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
91
207
|
async verify(user, code, deviceId) {
|
|
92
208
|
this.logger?.log?.(`Verifying Email code for user: ${user.sub}`);
|
|
209
|
+
// Check if email verification service is available
|
|
93
210
|
if (!this.emailVerificationService) {
|
|
94
211
|
this.logger?.warn?.('Email verification attempted but email verification service is not available');
|
|
95
212
|
return false;
|
|
@@ -99,11 +216,21 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
99
216
|
this.logger?.warn?.('Invalid Email code format');
|
|
100
217
|
return false;
|
|
101
218
|
}
|
|
219
|
+
// Get user entity
|
|
102
220
|
const userEntity = user;
|
|
103
221
|
const userId = userEntity.id;
|
|
104
222
|
const isEmailVerified = userEntity.isEmailVerified || false;
|
|
223
|
+
// Find device (optional - Email verification uses email verification service)
|
|
105
224
|
const device = deviceId ? await this.findDevice(userId, deviceId) : null;
|
|
225
|
+
// Verify Email code using email verification service
|
|
106
226
|
try {
|
|
227
|
+
// ============================================================================
|
|
228
|
+
// MFA Verification: Verify Email code for authentication
|
|
229
|
+
// Note: verifyEmailWithCode only marks email as verified if not already verified.
|
|
230
|
+
// This avoids unnecessary database writes and updatedAt timestamp changes.
|
|
231
|
+
// 1. During MFA setup (verifySetup): We check isEmailVerified first, so it only marks if not verified
|
|
232
|
+
// 2. During MFA login (verify): If email is already verified, no user table update occurs
|
|
233
|
+
// ============================================================================
|
|
107
234
|
const verifyDto = new core_1.VerifyEmailWithCodeDTO();
|
|
108
235
|
verifyDto.email = user.email;
|
|
109
236
|
verifyDto.code = emailCode;
|
|
@@ -114,6 +241,7 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
114
241
|
else {
|
|
115
242
|
this.logger?.log?.(`Email code verified for MFA (email already verified) for user: ${user.sub}`);
|
|
116
243
|
}
|
|
244
|
+
// Update device usage if device found
|
|
117
245
|
if (device) {
|
|
118
246
|
await this.updateDeviceUsage(device.id);
|
|
119
247
|
}
|
|
@@ -121,30 +249,56 @@ class EmailMFAProviderService extends internal_1.BaseMFAProviderService {
|
|
|
121
249
|
return true;
|
|
122
250
|
}
|
|
123
251
|
catch (error) {
|
|
252
|
+
// Re-throw NAuthException to preserve specific error codes (e.g., VERIFY_TOO_MANY_ATTEMPTS)
|
|
253
|
+
// This allows the calling code to handle rate limiting and other specific errors correctly
|
|
124
254
|
if (error instanceof core_1.NAuthException) {
|
|
125
255
|
throw error;
|
|
126
256
|
}
|
|
257
|
+
// For unexpected errors, log and return false (generic failure)
|
|
127
258
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
128
259
|
const errorCode = error?.code || 'UNKNOWN';
|
|
129
260
|
this.logger?.warn?.(`Email code verification failed for user: ${user.sub}, code: ${emailCode}, error: ${errorCode} - ${errorMessage}`);
|
|
130
261
|
return false;
|
|
131
262
|
}
|
|
132
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Send Email code for MFA verification
|
|
266
|
+
*
|
|
267
|
+
* Called during login MFA challenge to send code to registered email.
|
|
268
|
+
*
|
|
269
|
+
* @param user - User requesting Email code
|
|
270
|
+
* @returns Masked email address where code was sent
|
|
271
|
+
* @throws {NAuthException} If no Email device registered or email verification service unavailable
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const maskedEmail = await provider.sendChallenge(user);
|
|
276
|
+
* // Returns: 'u***r@example.com'
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
133
279
|
async sendChallenge(user) {
|
|
134
280
|
this.logger?.log?.(`Sending Email MFA code for user: ${user.sub}`);
|
|
281
|
+
// Get user entity
|
|
135
282
|
const userEntity = user;
|
|
136
283
|
const userId = userEntity.id;
|
|
284
|
+
// Find active Email device
|
|
137
285
|
const device = await this.findDevice(userId);
|
|
138
286
|
if (!device) {
|
|
139
287
|
throw new core_1.NAuthException(core_1.AuthErrorCode.NOT_FOUND, 'No Email device registered', { deviceType: 'email' });
|
|
140
288
|
}
|
|
289
|
+
// Get email address from device or fall back to user email
|
|
290
|
+
// Fallback handles legacy devices where email field might be null
|
|
141
291
|
const emailAddress = device.email || user.email;
|
|
142
292
|
if (!emailAddress) {
|
|
143
293
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'No email address found for Email MFA. Please update your profile or re-setup Email MFA.', { deviceType: 'email' });
|
|
144
294
|
}
|
|
295
|
+
// Check if email verification service is available
|
|
145
296
|
if (!this.emailVerificationService) {
|
|
146
297
|
throw new core_1.NAuthException(core_1.AuthErrorCode.VALIDATION_FAILED, 'Email verification service is not available. Email provider must be configured.');
|
|
147
298
|
}
|
|
299
|
+
// Send Email code for MFA verification
|
|
300
|
+
// Always send codes for MFA verification (even if email is already verified)
|
|
301
|
+
// skipAlreadyVerifiedCheck=true because email is already verified but we need MFA code
|
|
148
302
|
const sendDto = new core_1.SendVerificationEmailDTO();
|
|
149
303
|
sendDto.sub = user.sub;
|
|
150
304
|
sendDto.skipAlreadyVerifiedCheck = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-mfa-provider.service.js","sourceRoot":"","sources":["../../src/email-mfa-provider.service.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"email-mfa-provider.service.js","sourceRoot":"","sources":["../../src/email-mfa-provider.service.ts"],"names":[],"mappings":";;;AACA,qBAAqB;AACrB,8CAY6B;AAC7B,sDAAsD;AACtD,2DAAsE;AAGtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,uBAAwB,SAAQ,iCAAsB;IAS9C;IARV,UAAU,GAAG,gBAAS,CAAC,KAAK,CAAC;IAEtC,YACE,mBAA8C,EAC9C,cAAoC,EACpC,MAAmB,EACnB,MAAmB,EACnB,eAAwB,EACP,wBAAmD,EACpE,gBAA0B,EAAE,8BAA8B;IAC1D,YAAsB,EAAE,8BAA8B;IACtD,iBAA2B;QAE3B,KAAK,CACH,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,MAAM,EACN,eAAe,EACf,gBAAuB,EACvB,YAAmB,EACnB,iBAAwB,CACzB,CAAC;QAde,6BAAwB,GAAxB,wBAAwB,CAA2B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oBAAa,CAAC,iBAAiB,EAC/B,yFAAyF,EACzF,EAAE,UAAU,EAAE,OAAO,EAAE,CACxB,CAAC;QACJ,CAAC;QAED,mDAAmD;QACnD,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACnC,MAAM,IAAI,qBAAc,CACtB,oBAAa,CAAC,iBAAiB,EAC/B,iFAAiF,CAClF,CAAC;QACJ,CAAC;QAED,uCAAuC;QACvC,6EAA6E;QAC7E,uFAAuF;QACvF,MAAM,OAAO,GAAG,IAAI,+BAAwB,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACvB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACxC,MAAM,IAAI,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAEnE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,iCAAiC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAEhE,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;CACF;AA9WD,0DA8WC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nauth-toolkit/mfa-email
|
|
3
|
+
*
|
|
4
|
+
* Platform-agnostic Email MFA provider for nauth-toolkit.
|
|
5
|
+
* For NestJS integration, use '@nauth-toolkit/mfa-email/nestjs'
|
|
6
|
+
*/
|
|
1
7
|
export { EmailMFAProviderService } from './email-mfa-provider.service';
|
|
2
8
|
export * from './dto/mfa.dto';
|
|
3
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,cAAc,eAAe,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @nauth-toolkit/mfa-email
|
|
4
|
+
*
|
|
5
|
+
* Platform-agnostic Email MFA provider for nauth-toolkit.
|
|
6
|
+
* For NestJS integration, use '@nauth-toolkit/mfa-email/nestjs'
|
|
7
|
+
*/
|
|
2
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
9
|
if (k2 === undefined) k2 = k;
|
|
4
10
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,gDAA8B"}
|