@bymax-one/nest-auth 1.0.5 → 1.0.6
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/CHANGELOG.md +25 -0
- package/dist/server/index.cjs +680 -331
- package/dist/server/index.d.cts +93 -4
- package/dist/server/index.d.ts +93 -4
- package/dist/server/index.mjs +680 -332
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -4233,6 +4233,39 @@ function _ts_metadata21(k, v) {
|
|
|
4233
4233
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4234
4234
|
}
|
|
4235
4235
|
__name(_ts_metadata21, "_ts_metadata");
|
|
4236
|
+
var MfaRegenerateRecoveryCodesDto = class {
|
|
4237
|
+
static {
|
|
4238
|
+
__name(this, "MfaRegenerateRecoveryCodesDto");
|
|
4239
|
+
}
|
|
4240
|
+
/**
|
|
4241
|
+
* The 6-digit TOTP code generated by the user's authenticator app.
|
|
4242
|
+
*
|
|
4243
|
+
* Must be exactly 6 decimal digits. Recovery codes are not accepted by design.
|
|
4244
|
+
* Alphabetic characters, spaces, or other symbols are rejected before reaching
|
|
4245
|
+
* the service layer.
|
|
4246
|
+
*/
|
|
4247
|
+
code;
|
|
4248
|
+
};
|
|
4249
|
+
_ts_decorate21([
|
|
4250
|
+
MaxLength(6),
|
|
4251
|
+
Matches(/^\d{6}$/, {
|
|
4252
|
+
message: "code must be exactly 6 digits"
|
|
4253
|
+
}),
|
|
4254
|
+
IsString(),
|
|
4255
|
+
IsNotEmpty(),
|
|
4256
|
+
_ts_metadata21("design:type", String)
|
|
4257
|
+
], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
|
|
4258
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
4259
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4260
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4261
|
+
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;
|
|
4262
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4263
|
+
}
|
|
4264
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
4265
|
+
function _ts_metadata22(k, v) {
|
|
4266
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4267
|
+
}
|
|
4268
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
4236
4269
|
var MfaVerifyDto = class {
|
|
4237
4270
|
static {
|
|
4238
4271
|
__name(this, "MfaVerifyDto");
|
|
@@ -4245,14 +4278,14 @@ var MfaVerifyDto = class {
|
|
|
4245
4278
|
*/
|
|
4246
4279
|
code;
|
|
4247
4280
|
};
|
|
4248
|
-
|
|
4281
|
+
_ts_decorate22([
|
|
4249
4282
|
MaxLength(6),
|
|
4250
4283
|
Matches(/^\d{6}$/, {
|
|
4251
4284
|
message: "code must be exactly 6 digits"
|
|
4252
4285
|
}),
|
|
4253
4286
|
IsString(),
|
|
4254
4287
|
IsNotEmpty(),
|
|
4255
|
-
|
|
4288
|
+
_ts_metadata22("design:type", String)
|
|
4256
4289
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
4257
4290
|
var IV_LENGTH = 12;
|
|
4258
4291
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
@@ -4409,17 +4442,17 @@ function verifyTotp(secretBase32, code, window = 1) {
|
|
|
4409
4442
|
__name(verifyTotp, "verifyTotp");
|
|
4410
4443
|
|
|
4411
4444
|
// src/server/services/mfa.service.ts
|
|
4412
|
-
function
|
|
4445
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
4413
4446
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4414
4447
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4415
4448
|
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;
|
|
4416
4449
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4417
4450
|
}
|
|
4418
|
-
__name(
|
|
4419
|
-
function
|
|
4451
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
4452
|
+
function _ts_metadata23(k, v) {
|
|
4420
4453
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4421
4454
|
}
|
|
4422
|
-
__name(
|
|
4455
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
4423
4456
|
function _ts_param12(paramIndex, decorator) {
|
|
4424
4457
|
return function(target, key) {
|
|
4425
4458
|
decorator(target, key, paramIndex);
|
|
@@ -4610,7 +4643,7 @@ var MfaService = class _MfaService {
|
|
|
4610
4643
|
// setup — TOTP secret generation, idempotent key reservation, recovery codes
|
|
4611
4644
|
// ---------------------------------------------------------------------------
|
|
4612
4645
|
/**
|
|
4613
|
-
* Initiates the MFA setup flow for a dashboard user.
|
|
4646
|
+
* Initiates the MFA setup flow for a dashboard user or platform administrator.
|
|
4614
4647
|
*
|
|
4615
4648
|
* Generates a TOTP secret and 8 recovery codes, stores them temporarily in
|
|
4616
4649
|
* Redis (10 minutes), and returns the data needed to display the QR code and
|
|
@@ -4621,12 +4654,19 @@ var MfaService = class _MfaService {
|
|
|
4621
4654
|
* requests cannot generate different secrets.
|
|
4622
4655
|
*
|
|
4623
4656
|
* @param userId - Internal ID of the user enabling MFA.
|
|
4657
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4624
4658
|
* @returns Setup result containing the secret, QR URI, and plain recovery codes.
|
|
4625
4659
|
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
4660
|
+
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
4661
|
+
* repository was not configured at module registration. The error code is
|
|
4662
|
+
* reused (rather than introducing a new one) because the consumer-facing
|
|
4663
|
+
* meaning is the same: "platform MFA cannot operate".
|
|
4626
4664
|
*/
|
|
4627
|
-
async setup(userId) {
|
|
4628
|
-
|
|
4629
|
-
|
|
4665
|
+
async setup(userId, context = "dashboard") {
|
|
4666
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
4667
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
4668
|
+
}
|
|
4669
|
+
const user = await this.fetchUserForContext(context, userId);
|
|
4630
4670
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
4631
4671
|
const setupKey = `mfa_setup:${hmacSha256(userId, this.options.hmacKey)}`;
|
|
4632
4672
|
const existingFast = await this.redis.get(setupKey);
|
|
@@ -4671,7 +4711,7 @@ var MfaService = class _MfaService {
|
|
|
4671
4711
|
await this.redis.set(setupKey, payload, MFA_SETUP_TTL_SECONDS);
|
|
4672
4712
|
}
|
|
4673
4713
|
const qrCodeUri = buildTotpUri(secretBase32, user.email, this.mfaOptions.issuer);
|
|
4674
|
-
this.logger.log(`setup: MFA setup initiated userId=${userId}`);
|
|
4714
|
+
this.logger.log(`setup: MFA setup initiated userId=${userId} context=${context}`);
|
|
4675
4715
|
return {
|
|
4676
4716
|
secret: secretBase32,
|
|
4677
4717
|
qrCodeUri,
|
|
@@ -4694,12 +4734,17 @@ var MfaService = class _MfaService {
|
|
|
4694
4734
|
* @param code - 6-digit TOTP code from the authenticator app.
|
|
4695
4735
|
* @param ip - Client IP address (forwarded to hooks).
|
|
4696
4736
|
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
4737
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4697
4738
|
* @throws `MFA_SETUP_REQUIRED` if no pending setup data is found in Redis.
|
|
4698
4739
|
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is invalid.
|
|
4740
|
+
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
4741
|
+
* repository was not configured at module registration.
|
|
4699
4742
|
*/
|
|
4700
|
-
async verifyAndEnable(userId, code, ip, userAgent) {
|
|
4701
|
-
|
|
4702
|
-
|
|
4743
|
+
async verifyAndEnable(userId, code, ip, userAgent, context = "dashboard") {
|
|
4744
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
4745
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
4746
|
+
}
|
|
4747
|
+
const user = await this.fetchUserForContext(context, userId);
|
|
4703
4748
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
4704
4749
|
const setupKey = `mfa_setup:${hmacSha256(userId, this.options.hmacKey)}`;
|
|
4705
4750
|
const raw = await this.redis.get(setupKey);
|
|
@@ -4717,16 +4762,22 @@ var MfaService = class _MfaService {
|
|
|
4717
4762
|
this.logger.warn(`verifyAndEnable: setup key consumed by concurrent request userId=${userId}`);
|
|
4718
4763
|
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
4719
4764
|
}
|
|
4720
|
-
|
|
4765
|
+
const enableData = {
|
|
4721
4766
|
mfaEnabled: true,
|
|
4722
4767
|
mfaSecret: data.encryptedSecret,
|
|
4723
4768
|
mfaRecoveryCodes: data.hashedCodes
|
|
4724
|
-
}
|
|
4769
|
+
};
|
|
4770
|
+
if (context === "platform" && this.platformUserRepo) {
|
|
4771
|
+
await this.platformUserRepo.updateMfa(userId, enableData);
|
|
4772
|
+
} else {
|
|
4773
|
+
await this.userRepo.updateMfa(userId, enableData);
|
|
4774
|
+
}
|
|
4725
4775
|
await this.redis.invalidateUserSessions(userId);
|
|
4726
|
-
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId}`);
|
|
4776
|
+
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId} context=${context}`);
|
|
4727
4777
|
await this.emailProvider.sendMfaEnabledNotification(user.email);
|
|
4728
4778
|
if (this.hooks.afterMfaEnabled) {
|
|
4729
|
-
|
|
4779
|
+
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
4780
|
+
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
4730
4781
|
userId,
|
|
4731
4782
|
ip,
|
|
4732
4783
|
userAgent,
|
|
@@ -4905,6 +4956,95 @@ var MfaService = class _MfaService {
|
|
|
4905
4956
|
}
|
|
4906
4957
|
}
|
|
4907
4958
|
// ---------------------------------------------------------------------------
|
|
4959
|
+
// regenerateRecoveryCodes — rotate the recovery code set for an MFA-enabled user
|
|
4960
|
+
// ---------------------------------------------------------------------------
|
|
4961
|
+
/**
|
|
4962
|
+
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
4963
|
+
*
|
|
4964
|
+
* Mirrors {@link disable} in its security posture: only TOTP codes are accepted
|
|
4965
|
+
* (recovery codes cannot rotate themselves by design), the brute-force counter
|
|
4966
|
+
* is checked, and the regeneration is fired against the correct repository for
|
|
4967
|
+
* the supplied `context`. The TOTP secret on the user record is unchanged — only
|
|
4968
|
+
* the recovery code list is replaced.
|
|
4969
|
+
*
|
|
4970
|
+
* Returns the plain-text codes once. They are NOT persisted in plain form; only
|
|
4971
|
+
* scrypt hashes go into the database. The caller is responsible for showing the
|
|
4972
|
+
* codes to the user exactly once and warning them to save them safely.
|
|
4973
|
+
*
|
|
4974
|
+
* @remarks
|
|
4975
|
+
* **Sessions are intentionally NOT invalidated after this call.** Unlike
|
|
4976
|
+
* {@link verifyAndEnable} (which flips `mfaEnabled` from `false` to `true`) and
|
|
4977
|
+
* {@link disable} (which flips it back to `false`), this method does not change
|
|
4978
|
+
* the verification credential — the TOTP secret stays the same and existing
|
|
4979
|
+
* `mfaVerified: true` access tokens remain valid. Invalidating sessions here
|
|
4980
|
+
* would force a redundant re-auth on every recovery-code rotation, which is a
|
|
4981
|
+
* routine hygiene action a user might perform several times over the lifetime
|
|
4982
|
+
* of an account.
|
|
4983
|
+
*
|
|
4984
|
+
* @param userId - Internal ID of the user rotating recovery codes.
|
|
4985
|
+
* @param totpCode - 6-digit TOTP code from the authenticator app.
|
|
4986
|
+
* @param ip - Client IP address (forwarded to hooks).
|
|
4987
|
+
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
4988
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4989
|
+
* @throws `TOKEN_INVALID` if the user is not found or `mfaSecret` is missing
|
|
4990
|
+
* when `mfaEnabled` is `true` (database inconsistency).
|
|
4991
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active, or if
|
|
4992
|
+
* `context === 'platform'` and the platform user repository was not
|
|
4993
|
+
* configured at module registration.
|
|
4994
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
4995
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
4996
|
+
* @returns The freshly generated plain-text recovery codes, one-time display.
|
|
4997
|
+
*/
|
|
4998
|
+
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard") {
|
|
4999
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
5000
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
5001
|
+
}
|
|
5002
|
+
const user = await this.fetchUserForContext(context, userId);
|
|
5003
|
+
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
5004
|
+
const bfIdentifier = hmacSha256(`disable:${userId}`, this.options.hmacKey);
|
|
5005
|
+
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
5006
|
+
this.logger.warn(`regenerateRecoveryCodes: account locked userId=${userId} context=${context}`);
|
|
5007
|
+
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
5008
|
+
}
|
|
5009
|
+
if (!user.mfaSecret) {
|
|
5010
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
5011
|
+
}
|
|
5012
|
+
const secretBase32 = this.decryptSecret(user.mfaSecret);
|
|
5013
|
+
const totpWindow = this.mfaOptions.totpWindow;
|
|
5014
|
+
const codeValid = await this.verifyTotpWithAntiReplay(userId, secretBase32, totpCode, totpWindow);
|
|
5015
|
+
if (!codeValid) {
|
|
5016
|
+
await this.bruteForce.recordFailure(bfIdentifier);
|
|
5017
|
+
this.logger.warn(`regenerateRecoveryCodes: invalid MFA code userId=${userId} context=${context}`);
|
|
5018
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
5019
|
+
}
|
|
5020
|
+
await this.bruteForce.resetFailures(bfIdentifier);
|
|
5021
|
+
const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
5022
|
+
const { plainCodes, hashedCodes } = await this.hashRecoveryCodes(recoveryCount);
|
|
5023
|
+
const updateData = {
|
|
5024
|
+
mfaEnabled: true,
|
|
5025
|
+
mfaSecret: user.mfaSecret,
|
|
5026
|
+
mfaRecoveryCodes: hashedCodes
|
|
5027
|
+
};
|
|
5028
|
+
if (context === "platform" && this.platformUserRepo) {
|
|
5029
|
+
await this.platformUserRepo.updateMfa(userId, updateData);
|
|
5030
|
+
} else {
|
|
5031
|
+
await this.userRepo.updateMfa(userId, updateData);
|
|
5032
|
+
}
|
|
5033
|
+
this.logger.log(`regenerateRecoveryCodes: recovery codes regenerated userId=${userId} context=${context}`);
|
|
5034
|
+
if (this.hooks.afterMfaRecoveryCodesRegenerated) {
|
|
5035
|
+
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
5036
|
+
void Promise.resolve(this.hooks.afterMfaRecoveryCodesRegenerated(safeUser, {
|
|
5037
|
+
userId,
|
|
5038
|
+
ip,
|
|
5039
|
+
userAgent,
|
|
5040
|
+
sanitizedHeaders: {}
|
|
5041
|
+
})).catch(() => void 0);
|
|
5042
|
+
}
|
|
5043
|
+
return {
|
|
5044
|
+
recoveryCodes: plainCodes
|
|
5045
|
+
};
|
|
5046
|
+
}
|
|
5047
|
+
// ---------------------------------------------------------------------------
|
|
4908
5048
|
// Private helpers
|
|
4909
5049
|
// ---------------------------------------------------------------------------
|
|
4910
5050
|
/**
|
|
@@ -4943,7 +5083,7 @@ var MfaService = class _MfaService {
|
|
|
4943
5083
|
return admin;
|
|
4944
5084
|
}
|
|
4945
5085
|
};
|
|
4946
|
-
MfaService =
|
|
5086
|
+
MfaService = _ts_decorate23([
|
|
4947
5087
|
Injectable(),
|
|
4948
5088
|
_ts_param12(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
4949
5089
|
_ts_param12(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -4951,8 +5091,8 @@ MfaService = _ts_decorate22([
|
|
|
4951
5091
|
_ts_param12(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
4952
5092
|
_ts_param12(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
4953
5093
|
_ts_param12(9, Inject(BYMAX_AUTH_HOOKS)),
|
|
4954
|
-
|
|
4955
|
-
|
|
5094
|
+
_ts_metadata23("design:type", Function),
|
|
5095
|
+
_ts_metadata23("design:paramtypes", [
|
|
4956
5096
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
4957
5097
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
4958
5098
|
Object,
|
|
@@ -4967,17 +5107,17 @@ MfaService = _ts_decorate22([
|
|
|
4967
5107
|
], MfaService);
|
|
4968
5108
|
|
|
4969
5109
|
// src/server/controllers/mfa.controller.ts
|
|
4970
|
-
function
|
|
5110
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
4971
5111
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4972
5112
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4973
5113
|
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;
|
|
4974
5114
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4975
5115
|
}
|
|
4976
|
-
__name(
|
|
4977
|
-
function
|
|
5116
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
5117
|
+
function _ts_metadata24(k, v) {
|
|
4978
5118
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4979
5119
|
}
|
|
4980
|
-
__name(
|
|
5120
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
4981
5121
|
function _ts_param13(paramIndex, decorator) {
|
|
4982
5122
|
return function(target, key) {
|
|
4983
5123
|
decorator(target, key, paramIndex);
|
|
@@ -5076,19 +5216,44 @@ var MfaController = class {
|
|
|
5076
5216
|
const context = user.type === "platform" ? "platform" : "dashboard";
|
|
5077
5217
|
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, context);
|
|
5078
5218
|
}
|
|
5219
|
+
/**
|
|
5220
|
+
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
5221
|
+
*
|
|
5222
|
+
* Requires a valid TOTP code (recovery codes are not accepted by design — see
|
|
5223
|
+
* {@link MfaRegenerateRecoveryCodesDto} for the rationale). The freshly
|
|
5224
|
+
* generated plain-text codes are returned in the response body and are shown
|
|
5225
|
+
* once. Only their scrypt hashes are persisted.
|
|
5226
|
+
*
|
|
5227
|
+
* Shares the disable throttle config because the security posture is identical
|
|
5228
|
+
* (authenticated, TOTP-gated, MFA-affecting state change).
|
|
5229
|
+
*
|
|
5230
|
+
* @param user - JWT payload of the authenticated user.
|
|
5231
|
+
* @param dto - Contains the 6-digit TOTP code confirming the action.
|
|
5232
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
5233
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active on the account.
|
|
5234
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
5235
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
5236
|
+
* @returns The fresh plain-text recovery codes, one-time display.
|
|
5237
|
+
*/
|
|
5238
|
+
async regenerateRecoveryCodes(user, dto, req) {
|
|
5239
|
+
const ip = req.ip ?? "";
|
|
5240
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
5241
|
+
const context = user.type === "platform" ? "platform" : "dashboard";
|
|
5242
|
+
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, context);
|
|
5243
|
+
}
|
|
5079
5244
|
};
|
|
5080
|
-
|
|
5245
|
+
_ts_decorate24([
|
|
5081
5246
|
UseGuards(JwtAuthGuard),
|
|
5082
5247
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
5083
5248
|
Post("setup"),
|
|
5084
5249
|
_ts_param13(0, CurrentUser()),
|
|
5085
|
-
|
|
5086
|
-
|
|
5250
|
+
_ts_metadata24("design:type", Function),
|
|
5251
|
+
_ts_metadata24("design:paramtypes", [
|
|
5087
5252
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
5088
5253
|
]),
|
|
5089
|
-
|
|
5254
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5090
5255
|
], MfaController.prototype, "setup", null);
|
|
5091
|
-
|
|
5256
|
+
_ts_decorate24([
|
|
5092
5257
|
UseGuards(JwtAuthGuard),
|
|
5093
5258
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
5094
5259
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
@@ -5096,15 +5261,15 @@ _ts_decorate23([
|
|
|
5096
5261
|
_ts_param13(0, CurrentUser()),
|
|
5097
5262
|
_ts_param13(1, Body()),
|
|
5098
5263
|
_ts_param13(2, Req()),
|
|
5099
|
-
|
|
5100
|
-
|
|
5264
|
+
_ts_metadata24("design:type", Function),
|
|
5265
|
+
_ts_metadata24("design:paramtypes", [
|
|
5101
5266
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
5102
5267
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
5103
5268
|
typeof Request === "undefined" ? Object : Request
|
|
5104
5269
|
]),
|
|
5105
|
-
|
|
5270
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5106
5271
|
], MfaController.prototype, "verifyEnable", null);
|
|
5107
|
-
|
|
5272
|
+
_ts_decorate24([
|
|
5108
5273
|
Public(),
|
|
5109
5274
|
SkipMfa(),
|
|
5110
5275
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
@@ -5115,15 +5280,15 @@ _ts_decorate23([
|
|
|
5115
5280
|
_ts_param13(2, Res({
|
|
5116
5281
|
passthrough: true
|
|
5117
5282
|
})),
|
|
5118
|
-
|
|
5119
|
-
|
|
5283
|
+
_ts_metadata24("design:type", Function),
|
|
5284
|
+
_ts_metadata24("design:paramtypes", [
|
|
5120
5285
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
5121
5286
|
typeof Request === "undefined" ? Object : Request,
|
|
5122
5287
|
typeof Response === "undefined" ? Object : Response
|
|
5123
5288
|
]),
|
|
5124
|
-
|
|
5289
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5125
5290
|
], MfaController.prototype, "challenge", null);
|
|
5126
|
-
|
|
5291
|
+
_ts_decorate24([
|
|
5127
5292
|
UseGuards(JwtAuthGuard),
|
|
5128
5293
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
5129
5294
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
@@ -5131,38 +5296,54 @@ _ts_decorate23([
|
|
|
5131
5296
|
_ts_param13(0, CurrentUser()),
|
|
5132
5297
|
_ts_param13(1, Body()),
|
|
5133
5298
|
_ts_param13(2, Req()),
|
|
5134
|
-
|
|
5135
|
-
|
|
5299
|
+
_ts_metadata24("design:type", Function),
|
|
5300
|
+
_ts_metadata24("design:paramtypes", [
|
|
5136
5301
|
Object,
|
|
5137
5302
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
5138
5303
|
typeof Request === "undefined" ? Object : Request
|
|
5139
5304
|
]),
|
|
5140
|
-
|
|
5305
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5141
5306
|
], MfaController.prototype, "disable", null);
|
|
5142
|
-
|
|
5307
|
+
_ts_decorate24([
|
|
5308
|
+
UseGuards(JwtAuthGuard),
|
|
5309
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
5310
|
+
HttpCode(HttpStatus.OK),
|
|
5311
|
+
Post("recovery-codes"),
|
|
5312
|
+
_ts_param13(0, CurrentUser()),
|
|
5313
|
+
_ts_param13(1, Body()),
|
|
5314
|
+
_ts_param13(2, Req()),
|
|
5315
|
+
_ts_metadata24("design:type", Function),
|
|
5316
|
+
_ts_metadata24("design:paramtypes", [
|
|
5317
|
+
Object,
|
|
5318
|
+
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
5319
|
+
typeof Request === "undefined" ? Object : Request
|
|
5320
|
+
]),
|
|
5321
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5322
|
+
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
5323
|
+
MfaController = _ts_decorate24([
|
|
5143
5324
|
Controller("mfa"),
|
|
5144
5325
|
UsePipes(new ValidationPipe({
|
|
5145
5326
|
whitelist: true,
|
|
5146
5327
|
forbidNonWhitelisted: true,
|
|
5147
5328
|
forbidUnknownValues: true
|
|
5148
5329
|
})),
|
|
5149
|
-
|
|
5150
|
-
|
|
5330
|
+
_ts_metadata24("design:type", Function),
|
|
5331
|
+
_ts_metadata24("design:paramtypes", [
|
|
5151
5332
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
5152
5333
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
5153
5334
|
])
|
|
5154
5335
|
], MfaController);
|
|
5155
|
-
function
|
|
5336
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
5156
5337
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5157
5338
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5158
5339
|
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;
|
|
5159
5340
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5160
5341
|
}
|
|
5161
|
-
__name(
|
|
5162
|
-
function
|
|
5342
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
5343
|
+
function _ts_metadata25(k, v) {
|
|
5163
5344
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5164
5345
|
}
|
|
5165
|
-
__name(
|
|
5346
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
5166
5347
|
var ForgotPasswordDto = class {
|
|
5167
5348
|
static {
|
|
5168
5349
|
__name(this, "ForgotPasswordDto");
|
|
@@ -5178,29 +5359,29 @@ var ForgotPasswordDto = class {
|
|
|
5178
5359
|
*/
|
|
5179
5360
|
tenantId;
|
|
5180
5361
|
};
|
|
5181
|
-
|
|
5362
|
+
_ts_decorate25([
|
|
5182
5363
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5183
5364
|
IsEmail(),
|
|
5184
5365
|
MaxLength(255),
|
|
5185
|
-
|
|
5366
|
+
_ts_metadata25("design:type", String)
|
|
5186
5367
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
5187
|
-
|
|
5368
|
+
_ts_decorate25([
|
|
5188
5369
|
IsString(),
|
|
5189
5370
|
IsNotEmpty(),
|
|
5190
5371
|
MaxLength(128),
|
|
5191
|
-
|
|
5372
|
+
_ts_metadata25("design:type", String)
|
|
5192
5373
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
5193
|
-
function
|
|
5374
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
5194
5375
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5195
5376
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5196
5377
|
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;
|
|
5197
5378
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5198
5379
|
}
|
|
5199
|
-
__name(
|
|
5200
|
-
function
|
|
5380
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
5381
|
+
function _ts_metadata26(k, v) {
|
|
5201
5382
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5202
5383
|
}
|
|
5203
|
-
__name(
|
|
5384
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
5204
5385
|
var ResendOtpDto = class {
|
|
5205
5386
|
static {
|
|
5206
5387
|
__name(this, "ResendOtpDto");
|
|
@@ -5215,29 +5396,29 @@ var ResendOtpDto = class {
|
|
|
5215
5396
|
*/
|
|
5216
5397
|
tenantId;
|
|
5217
5398
|
};
|
|
5218
|
-
|
|
5399
|
+
_ts_decorate26([
|
|
5219
5400
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5220
5401
|
IsEmail(),
|
|
5221
5402
|
MaxLength(255),
|
|
5222
|
-
|
|
5403
|
+
_ts_metadata26("design:type", String)
|
|
5223
5404
|
], ResendOtpDto.prototype, "email", void 0);
|
|
5224
|
-
|
|
5405
|
+
_ts_decorate26([
|
|
5225
5406
|
IsString(),
|
|
5226
5407
|
IsNotEmpty(),
|
|
5227
5408
|
MaxLength(128),
|
|
5228
|
-
|
|
5409
|
+
_ts_metadata26("design:type", String)
|
|
5229
5410
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
5230
|
-
function
|
|
5411
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
5231
5412
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5232
5413
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5233
5414
|
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;
|
|
5234
5415
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5235
5416
|
}
|
|
5236
|
-
__name(
|
|
5237
|
-
function
|
|
5417
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
5418
|
+
function _ts_metadata27(k, v) {
|
|
5238
5419
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5239
5420
|
}
|
|
5240
|
-
__name(
|
|
5421
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
5241
5422
|
var ResetPasswordDto = class {
|
|
5242
5423
|
static {
|
|
5243
5424
|
__name(this, "ResetPasswordDto");
|
|
@@ -5277,54 +5458,54 @@ var ResetPasswordDto = class {
|
|
|
5277
5458
|
*/
|
|
5278
5459
|
tenantId;
|
|
5279
5460
|
};
|
|
5280
|
-
|
|
5461
|
+
_ts_decorate27([
|
|
5281
5462
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5282
5463
|
IsEmail(),
|
|
5283
5464
|
MaxLength(255),
|
|
5284
|
-
|
|
5465
|
+
_ts_metadata27("design:type", String)
|
|
5285
5466
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
5286
|
-
|
|
5467
|
+
_ts_decorate27([
|
|
5287
5468
|
IsString(),
|
|
5288
5469
|
MinLength(8),
|
|
5289
5470
|
MaxLength(128),
|
|
5290
|
-
|
|
5471
|
+
_ts_metadata27("design:type", String)
|
|
5291
5472
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
5292
|
-
|
|
5473
|
+
_ts_decorate27([
|
|
5293
5474
|
IsOptional(),
|
|
5294
5475
|
IsString(),
|
|
5295
5476
|
IsNotEmpty(),
|
|
5296
5477
|
MaxLength(2048),
|
|
5297
|
-
|
|
5478
|
+
_ts_metadata27("design:type", String)
|
|
5298
5479
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
5299
|
-
|
|
5480
|
+
_ts_decorate27([
|
|
5300
5481
|
IsOptional(),
|
|
5301
5482
|
IsString(),
|
|
5302
5483
|
Length(4, 8),
|
|
5303
|
-
|
|
5484
|
+
_ts_metadata27("design:type", String)
|
|
5304
5485
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
5305
|
-
|
|
5486
|
+
_ts_decorate27([
|
|
5306
5487
|
IsOptional(),
|
|
5307
5488
|
IsString(),
|
|
5308
5489
|
Length(64, 64),
|
|
5309
|
-
|
|
5490
|
+
_ts_metadata27("design:type", String)
|
|
5310
5491
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
5311
|
-
|
|
5492
|
+
_ts_decorate27([
|
|
5312
5493
|
IsString(),
|
|
5313
5494
|
IsNotEmpty(),
|
|
5314
5495
|
MaxLength(128),
|
|
5315
|
-
|
|
5496
|
+
_ts_metadata27("design:type", String)
|
|
5316
5497
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
5317
|
-
function
|
|
5498
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
5318
5499
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5319
5500
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5320
5501
|
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;
|
|
5321
5502
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5322
5503
|
}
|
|
5323
|
-
__name(
|
|
5324
|
-
function
|
|
5504
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
5505
|
+
function _ts_metadata28(k, v) {
|
|
5325
5506
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5326
5507
|
}
|
|
5327
|
-
__name(
|
|
5508
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
5328
5509
|
var VerifyOtpDto = class {
|
|
5329
5510
|
static {
|
|
5330
5511
|
__name(this, "VerifyOtpDto");
|
|
@@ -5346,34 +5527,34 @@ var VerifyOtpDto = class {
|
|
|
5346
5527
|
*/
|
|
5347
5528
|
tenantId;
|
|
5348
5529
|
};
|
|
5349
|
-
|
|
5530
|
+
_ts_decorate28([
|
|
5350
5531
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5351
5532
|
IsEmail(),
|
|
5352
5533
|
MaxLength(255),
|
|
5353
|
-
|
|
5534
|
+
_ts_metadata28("design:type", String)
|
|
5354
5535
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
5355
|
-
|
|
5536
|
+
_ts_decorate28([
|
|
5356
5537
|
IsString(),
|
|
5357
5538
|
Length(4, 8),
|
|
5358
|
-
|
|
5539
|
+
_ts_metadata28("design:type", String)
|
|
5359
5540
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
5360
|
-
|
|
5541
|
+
_ts_decorate28([
|
|
5361
5542
|
IsString(),
|
|
5362
5543
|
IsNotEmpty(),
|
|
5363
5544
|
MaxLength(128),
|
|
5364
|
-
|
|
5545
|
+
_ts_metadata28("design:type", String)
|
|
5365
5546
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
5366
|
-
function
|
|
5547
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
5367
5548
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5368
5549
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5369
5550
|
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;
|
|
5370
5551
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5371
5552
|
}
|
|
5372
|
-
__name(
|
|
5373
|
-
function
|
|
5553
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
5554
|
+
function _ts_metadata29(k, v) {
|
|
5374
5555
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5375
5556
|
}
|
|
5376
|
-
__name(
|
|
5557
|
+
__name(_ts_metadata29, "_ts_metadata");
|
|
5377
5558
|
function _ts_param14(paramIndex, decorator) {
|
|
5378
5559
|
return function(target, key) {
|
|
5379
5560
|
decorator(target, key, paramIndex);
|
|
@@ -5730,7 +5911,7 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
5730
5911
|
return parsed;
|
|
5731
5912
|
}
|
|
5732
5913
|
};
|
|
5733
|
-
PasswordResetService =
|
|
5914
|
+
PasswordResetService = _ts_decorate29([
|
|
5734
5915
|
Injectable(),
|
|
5735
5916
|
_ts_param14(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
5736
5917
|
_ts_param14(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -5738,8 +5919,8 @@ PasswordResetService = _ts_decorate28([
|
|
|
5738
5919
|
_ts_param14(2, Optional()),
|
|
5739
5920
|
_ts_param14(3, Inject(BYMAX_AUTH_HOOKS)),
|
|
5740
5921
|
_ts_param14(3, Optional()),
|
|
5741
|
-
|
|
5742
|
-
|
|
5922
|
+
_ts_metadata29("design:type", Function),
|
|
5923
|
+
_ts_metadata29("design:paramtypes", [
|
|
5743
5924
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
5744
5925
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
5745
5926
|
Object,
|
|
@@ -5756,17 +5937,17 @@ function toSafeUser3(user) {
|
|
|
5756
5937
|
__name(toSafeUser3, "toSafeUser");
|
|
5757
5938
|
|
|
5758
5939
|
// src/server/controllers/password-reset.controller.ts
|
|
5759
|
-
function
|
|
5940
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
5760
5941
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5761
5942
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5762
5943
|
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;
|
|
5763
5944
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5764
5945
|
}
|
|
5765
|
-
__name(
|
|
5766
|
-
function
|
|
5946
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
5947
|
+
function _ts_metadata30(k, v) {
|
|
5767
5948
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5768
5949
|
}
|
|
5769
|
-
__name(
|
|
5950
|
+
__name(_ts_metadata30, "_ts_metadata");
|
|
5770
5951
|
function _ts_param15(paramIndex, decorator) {
|
|
5771
5952
|
return function(target, key) {
|
|
5772
5953
|
decorator(target, key, paramIndex);
|
|
@@ -5850,73 +6031,73 @@ var PasswordResetController = class {
|
|
|
5850
6031
|
await this.passwordResetService.resendOtp(dto);
|
|
5851
6032
|
}
|
|
5852
6033
|
};
|
|
5853
|
-
|
|
6034
|
+
_ts_decorate30([
|
|
5854
6035
|
Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
5855
6036
|
HttpCode(HttpStatus.OK),
|
|
5856
6037
|
Post("forgot-password"),
|
|
5857
6038
|
_ts_param15(0, Body()),
|
|
5858
|
-
|
|
5859
|
-
|
|
6039
|
+
_ts_metadata30("design:type", Function),
|
|
6040
|
+
_ts_metadata30("design:paramtypes", [
|
|
5860
6041
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto
|
|
5861
6042
|
]),
|
|
5862
|
-
|
|
6043
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5863
6044
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
5864
|
-
|
|
6045
|
+
_ts_decorate30([
|
|
5865
6046
|
Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
5866
6047
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
5867
6048
|
Post("reset-password"),
|
|
5868
6049
|
_ts_param15(0, Body()),
|
|
5869
|
-
|
|
5870
|
-
|
|
6050
|
+
_ts_metadata30("design:type", Function),
|
|
6051
|
+
_ts_metadata30("design:paramtypes", [
|
|
5871
6052
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto
|
|
5872
6053
|
]),
|
|
5873
|
-
|
|
6054
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5874
6055
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
5875
|
-
|
|
6056
|
+
_ts_decorate30([
|
|
5876
6057
|
Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
5877
6058
|
HttpCode(HttpStatus.OK),
|
|
5878
6059
|
Post("verify-otp"),
|
|
5879
6060
|
_ts_param15(0, Body()),
|
|
5880
|
-
|
|
5881
|
-
|
|
6061
|
+
_ts_metadata30("design:type", Function),
|
|
6062
|
+
_ts_metadata30("design:paramtypes", [
|
|
5882
6063
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto
|
|
5883
6064
|
]),
|
|
5884
|
-
|
|
6065
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5885
6066
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
5886
|
-
|
|
6067
|
+
_ts_decorate30([
|
|
5887
6068
|
Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
5888
6069
|
HttpCode(HttpStatus.OK),
|
|
5889
6070
|
Post("resend-otp"),
|
|
5890
6071
|
_ts_param15(0, Body()),
|
|
5891
|
-
|
|
5892
|
-
|
|
6072
|
+
_ts_metadata30("design:type", Function),
|
|
6073
|
+
_ts_metadata30("design:paramtypes", [
|
|
5893
6074
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto
|
|
5894
6075
|
]),
|
|
5895
|
-
|
|
6076
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5896
6077
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
5897
|
-
PasswordResetController =
|
|
6078
|
+
PasswordResetController = _ts_decorate30([
|
|
5898
6079
|
Public(),
|
|
5899
6080
|
Controller("password"),
|
|
5900
6081
|
UsePipes(new ValidationPipe({
|
|
5901
6082
|
whitelist: true,
|
|
5902
6083
|
forbidNonWhitelisted: true
|
|
5903
6084
|
})),
|
|
5904
|
-
|
|
5905
|
-
|
|
6085
|
+
_ts_metadata30("design:type", Function),
|
|
6086
|
+
_ts_metadata30("design:paramtypes", [
|
|
5906
6087
|
typeof PasswordResetService === "undefined" ? Object : PasswordResetService
|
|
5907
6088
|
])
|
|
5908
6089
|
], PasswordResetController);
|
|
5909
|
-
function
|
|
6090
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
5910
6091
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5911
6092
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5912
6093
|
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;
|
|
5913
6094
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5914
6095
|
}
|
|
5915
|
-
__name(
|
|
5916
|
-
function
|
|
6096
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
6097
|
+
function _ts_metadata31(k, v) {
|
|
5917
6098
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5918
6099
|
}
|
|
5919
|
-
__name(
|
|
6100
|
+
__name(_ts_metadata31, "_ts_metadata");
|
|
5920
6101
|
var PlatformLoginDto = class {
|
|
5921
6102
|
static {
|
|
5922
6103
|
__name(this, "PlatformLoginDto");
|
|
@@ -5938,14 +6119,14 @@ var PlatformLoginDto = class {
|
|
|
5938
6119
|
*/
|
|
5939
6120
|
password;
|
|
5940
6121
|
};
|
|
5941
|
-
|
|
6122
|
+
_ts_decorate31([
|
|
5942
6123
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5943
6124
|
IsEmail(),
|
|
5944
6125
|
IsNotEmpty(),
|
|
5945
6126
|
MaxLength(255),
|
|
5946
|
-
|
|
6127
|
+
_ts_metadata31("design:type", String)
|
|
5947
6128
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
5948
|
-
|
|
6129
|
+
_ts_decorate31([
|
|
5949
6130
|
IsString(),
|
|
5950
6131
|
IsNotEmpty(),
|
|
5951
6132
|
Matches(/\S/, {
|
|
@@ -5953,19 +6134,19 @@ _ts_decorate30([
|
|
|
5953
6134
|
}),
|
|
5954
6135
|
MinLength(12),
|
|
5955
6136
|
MaxLength(128),
|
|
5956
|
-
|
|
6137
|
+
_ts_metadata31("design:type", String)
|
|
5957
6138
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
5958
|
-
function
|
|
6139
|
+
function _ts_decorate32(decorators, target, key, desc) {
|
|
5959
6140
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5960
6141
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5961
6142
|
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;
|
|
5962
6143
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5963
6144
|
}
|
|
5964
|
-
__name(
|
|
5965
|
-
function
|
|
6145
|
+
__name(_ts_decorate32, "_ts_decorate");
|
|
6146
|
+
function _ts_metadata32(k, v) {
|
|
5966
6147
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5967
6148
|
}
|
|
5968
|
-
__name(
|
|
6149
|
+
__name(_ts_metadata32, "_ts_metadata");
|
|
5969
6150
|
function _ts_param16(paramIndex, decorator) {
|
|
5970
6151
|
return function(target, key) {
|
|
5971
6152
|
decorator(target, key, paramIndex);
|
|
@@ -6022,11 +6203,11 @@ var JwtPlatformGuard = class {
|
|
|
6022
6203
|
return true;
|
|
6023
6204
|
}
|
|
6024
6205
|
};
|
|
6025
|
-
JwtPlatformGuard =
|
|
6206
|
+
JwtPlatformGuard = _ts_decorate32([
|
|
6026
6207
|
Injectable(),
|
|
6027
6208
|
_ts_param16(4, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6028
|
-
|
|
6029
|
-
|
|
6209
|
+
_ts_metadata32("design:type", Function),
|
|
6210
|
+
_ts_metadata32("design:paramtypes", [
|
|
6030
6211
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
6031
6212
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
6032
6213
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -6034,17 +6215,17 @@ JwtPlatformGuard = _ts_decorate31([
|
|
|
6034
6215
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6035
6216
|
])
|
|
6036
6217
|
], JwtPlatformGuard);
|
|
6037
|
-
function
|
|
6218
|
+
function _ts_decorate33(decorators, target, key, desc) {
|
|
6038
6219
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6039
6220
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6040
6221
|
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;
|
|
6041
6222
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6042
6223
|
}
|
|
6043
|
-
__name(
|
|
6044
|
-
function
|
|
6224
|
+
__name(_ts_decorate33, "_ts_decorate");
|
|
6225
|
+
function _ts_metadata33(k, v) {
|
|
6045
6226
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6046
6227
|
}
|
|
6047
|
-
__name(
|
|
6228
|
+
__name(_ts_metadata33, "_ts_metadata");
|
|
6048
6229
|
function _ts_param17(paramIndex, decorator) {
|
|
6049
6230
|
return function(target, key) {
|
|
6050
6231
|
decorator(target, key, paramIndex);
|
|
@@ -6203,12 +6384,12 @@ var PlatformAuthService = class _PlatformAuthService {
|
|
|
6203
6384
|
await this.redis.invalidateUserSessions(userId);
|
|
6204
6385
|
}
|
|
6205
6386
|
};
|
|
6206
|
-
PlatformAuthService =
|
|
6387
|
+
PlatformAuthService = _ts_decorate33([
|
|
6207
6388
|
Injectable(),
|
|
6208
6389
|
_ts_param17(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
6209
6390
|
_ts_param17(5, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6210
|
-
|
|
6211
|
-
|
|
6391
|
+
_ts_metadata33("design:type", Function),
|
|
6392
|
+
_ts_metadata33("design:paramtypes", [
|
|
6212
6393
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
6213
6394
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
6214
6395
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -6219,17 +6400,17 @@ PlatformAuthService = _ts_decorate32([
|
|
|
6219
6400
|
], PlatformAuthService);
|
|
6220
6401
|
|
|
6221
6402
|
// src/server/controllers/platform-auth.controller.ts
|
|
6222
|
-
function
|
|
6403
|
+
function _ts_decorate34(decorators, target, key, desc) {
|
|
6223
6404
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6224
6405
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6225
6406
|
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;
|
|
6226
6407
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6227
6408
|
}
|
|
6228
|
-
__name(
|
|
6229
|
-
function
|
|
6409
|
+
__name(_ts_decorate34, "_ts_decorate");
|
|
6410
|
+
function _ts_metadata34(k, v) {
|
|
6230
6411
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6231
6412
|
}
|
|
6232
|
-
__name(
|
|
6413
|
+
__name(_ts_metadata34, "_ts_metadata");
|
|
6233
6414
|
function _ts_param18(paramIndex, decorator) {
|
|
6234
6415
|
return function(target, key) {
|
|
6235
6416
|
decorator(target, key, paramIndex);
|
|
@@ -6390,111 +6571,277 @@ var PlatformAuthController = class {
|
|
|
6390
6571
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
6391
6572
|
}
|
|
6392
6573
|
};
|
|
6393
|
-
|
|
6574
|
+
_ts_decorate34([
|
|
6394
6575
|
Public(),
|
|
6395
6576
|
Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
6396
6577
|
HttpCode(HttpStatus.OK),
|
|
6397
6578
|
Post("login"),
|
|
6398
6579
|
_ts_param18(0, Body()),
|
|
6399
6580
|
_ts_param18(1, Req()),
|
|
6400
|
-
|
|
6401
|
-
|
|
6581
|
+
_ts_metadata34("design:type", Function),
|
|
6582
|
+
_ts_metadata34("design:paramtypes", [
|
|
6402
6583
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
6403
6584
|
typeof Request === "undefined" ? Object : Request
|
|
6404
6585
|
]),
|
|
6405
|
-
|
|
6586
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6406
6587
|
], PlatformAuthController.prototype, "login", null);
|
|
6407
|
-
|
|
6588
|
+
_ts_decorate34([
|
|
6408
6589
|
Public(),
|
|
6409
6590
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
6410
6591
|
HttpCode(HttpStatus.OK),
|
|
6411
6592
|
Post("mfa/challenge"),
|
|
6412
6593
|
_ts_param18(0, Body()),
|
|
6413
6594
|
_ts_param18(1, Req()),
|
|
6414
|
-
|
|
6415
|
-
|
|
6595
|
+
_ts_metadata34("design:type", Function),
|
|
6596
|
+
_ts_metadata34("design:paramtypes", [
|
|
6416
6597
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
6417
6598
|
typeof Request === "undefined" ? Object : Request
|
|
6418
6599
|
]),
|
|
6419
|
-
|
|
6600
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6420
6601
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
6421
|
-
|
|
6602
|
+
_ts_decorate34([
|
|
6422
6603
|
UseGuards(JwtPlatformGuard),
|
|
6423
6604
|
Get("me"),
|
|
6424
6605
|
_ts_param18(0, CurrentUser()),
|
|
6425
|
-
|
|
6426
|
-
|
|
6606
|
+
_ts_metadata34("design:type", Function),
|
|
6607
|
+
_ts_metadata34("design:paramtypes", [
|
|
6427
6608
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6428
6609
|
]),
|
|
6429
|
-
|
|
6610
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6430
6611
|
], PlatformAuthController.prototype, "me", null);
|
|
6431
|
-
|
|
6612
|
+
_ts_decorate34([
|
|
6432
6613
|
UseGuards(JwtPlatformGuard),
|
|
6433
6614
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6434
6615
|
Post("logout"),
|
|
6435
6616
|
_ts_param18(0, CurrentUser()),
|
|
6436
6617
|
_ts_param18(1, Req()),
|
|
6437
|
-
|
|
6438
|
-
|
|
6618
|
+
_ts_metadata34("design:type", Function),
|
|
6619
|
+
_ts_metadata34("design:paramtypes", [
|
|
6439
6620
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6440
6621
|
typeof Request === "undefined" ? Object : Request
|
|
6441
6622
|
]),
|
|
6442
|
-
|
|
6623
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6443
6624
|
], PlatformAuthController.prototype, "logout", null);
|
|
6444
|
-
|
|
6625
|
+
_ts_decorate34([
|
|
6445
6626
|
Public(),
|
|
6446
6627
|
Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6447
6628
|
HttpCode(HttpStatus.OK),
|
|
6448
6629
|
Post("refresh"),
|
|
6449
6630
|
_ts_param18(0, Req()),
|
|
6450
|
-
|
|
6451
|
-
|
|
6631
|
+
_ts_metadata34("design:type", Function),
|
|
6632
|
+
_ts_metadata34("design:paramtypes", [
|
|
6452
6633
|
typeof Request === "undefined" ? Object : Request
|
|
6453
6634
|
]),
|
|
6454
|
-
|
|
6635
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6455
6636
|
], PlatformAuthController.prototype, "refresh", null);
|
|
6456
|
-
|
|
6637
|
+
_ts_decorate34([
|
|
6457
6638
|
UseGuards(JwtPlatformGuard),
|
|
6458
6639
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
6459
6640
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6460
6641
|
Delete("sessions"),
|
|
6461
6642
|
_ts_param18(0, CurrentUser()),
|
|
6462
|
-
|
|
6463
|
-
|
|
6643
|
+
_ts_metadata34("design:type", Function),
|
|
6644
|
+
_ts_metadata34("design:paramtypes", [
|
|
6464
6645
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6465
6646
|
]),
|
|
6466
|
-
|
|
6647
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6467
6648
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
6468
|
-
PlatformAuthController =
|
|
6649
|
+
PlatformAuthController = _ts_decorate34([
|
|
6469
6650
|
Controller("platform"),
|
|
6470
6651
|
UsePipes(new ValidationPipe({
|
|
6471
6652
|
whitelist: true,
|
|
6472
6653
|
forbidNonWhitelisted: true
|
|
6473
6654
|
})),
|
|
6474
|
-
|
|
6475
|
-
|
|
6655
|
+
_ts_metadata34("design:type", Function),
|
|
6656
|
+
_ts_metadata34("design:paramtypes", [
|
|
6476
6657
|
typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
|
|
6477
6658
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
6478
6659
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
6479
6660
|
])
|
|
6480
6661
|
], PlatformAuthController);
|
|
6481
|
-
function
|
|
6662
|
+
function _ts_decorate35(decorators, target, key, desc) {
|
|
6482
6663
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6483
6664
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6484
6665
|
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;
|
|
6485
6666
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6486
6667
|
}
|
|
6487
|
-
__name(
|
|
6488
|
-
function
|
|
6668
|
+
__name(_ts_decorate35, "_ts_decorate");
|
|
6669
|
+
function _ts_metadata35(k, v) {
|
|
6489
6670
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6490
6671
|
}
|
|
6491
|
-
__name(
|
|
6672
|
+
__name(_ts_metadata35, "_ts_metadata");
|
|
6492
6673
|
function _ts_param19(paramIndex, decorator) {
|
|
6493
6674
|
return function(target, key) {
|
|
6494
6675
|
decorator(target, key, paramIndex);
|
|
6495
6676
|
};
|
|
6496
6677
|
}
|
|
6497
6678
|
__name(_ts_param19, "_ts_param");
|
|
6679
|
+
var PlatformMfaController = class {
|
|
6680
|
+
static {
|
|
6681
|
+
__name(this, "PlatformMfaController");
|
|
6682
|
+
}
|
|
6683
|
+
mfaService;
|
|
6684
|
+
constructor(mfaService) {
|
|
6685
|
+
this.mfaService = mfaService;
|
|
6686
|
+
}
|
|
6687
|
+
/**
|
|
6688
|
+
* Initiates the MFA setup flow for the authenticated platform administrator.
|
|
6689
|
+
*
|
|
6690
|
+
* Returns a TOTP secret, QR code URI, and plain-text recovery codes (shown once).
|
|
6691
|
+
* Idempotent within the 10-minute setup window — repeated calls return the
|
|
6692
|
+
* same payload until the user completes or abandons the flow.
|
|
6693
|
+
*
|
|
6694
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6695
|
+
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
6696
|
+
*/
|
|
6697
|
+
async setup(user) {
|
|
6698
|
+
return this.mfaService.setup(user.sub, "platform");
|
|
6699
|
+
}
|
|
6700
|
+
/**
|
|
6701
|
+
* Verifies the first TOTP code and permanently enables MFA on the platform
|
|
6702
|
+
* admin's account.
|
|
6703
|
+
*
|
|
6704
|
+
* After a successful call, all existing refresh sessions are invalidated so
|
|
6705
|
+
* the admin must re-authenticate through the MFA challenge endpoint.
|
|
6706
|
+
*
|
|
6707
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6708
|
+
* @param dto - Contains the 6-digit TOTP code from the authenticator app.
|
|
6709
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
6710
|
+
* @throws `MFA_SETUP_REQUIRED` if no pending setup data is found in Redis.
|
|
6711
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is invalid.
|
|
6712
|
+
*/
|
|
6713
|
+
async verifyEnable(user, dto, req) {
|
|
6714
|
+
const ip = req.ip ?? "";
|
|
6715
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
6716
|
+
await this.mfaService.verifyAndEnable(user.sub, dto.code, ip, userAgent, "platform");
|
|
6717
|
+
}
|
|
6718
|
+
/**
|
|
6719
|
+
* Disables MFA on the authenticated platform admin's account.
|
|
6720
|
+
*
|
|
6721
|
+
* Requires a valid TOTP code (recovery codes are not accepted by design).
|
|
6722
|
+
* All existing refresh sessions are invalidated after disabling.
|
|
6723
|
+
*
|
|
6724
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6725
|
+
* @param dto - Contains the 6-digit TOTP code confirming the action.
|
|
6726
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
6727
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active on the account.
|
|
6728
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
6729
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
6730
|
+
*/
|
|
6731
|
+
async disable(user, dto, req) {
|
|
6732
|
+
const ip = req.ip ?? "";
|
|
6733
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
6734
|
+
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, "platform");
|
|
6735
|
+
}
|
|
6736
|
+
/**
|
|
6737
|
+
* Regenerates the platform admin's MFA recovery codes.
|
|
6738
|
+
*
|
|
6739
|
+
* Requires a valid TOTP code (recovery codes are not accepted by design).
|
|
6740
|
+
* Returns the fresh plain-text codes once — only their scrypt hashes are
|
|
6741
|
+
* persisted.
|
|
6742
|
+
*
|
|
6743
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6744
|
+
* @param dto - Contains the 6-digit TOTP code confirming the action.
|
|
6745
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
6746
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active on the account.
|
|
6747
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
6748
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
6749
|
+
* @returns The fresh plain-text recovery codes, one-time display.
|
|
6750
|
+
*/
|
|
6751
|
+
async regenerateRecoveryCodes(user, dto, req) {
|
|
6752
|
+
const ip = req.ip ?? "";
|
|
6753
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
6754
|
+
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
6755
|
+
}
|
|
6756
|
+
};
|
|
6757
|
+
_ts_decorate35([
|
|
6758
|
+
UseGuards(JwtPlatformGuard),
|
|
6759
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
6760
|
+
Post("setup"),
|
|
6761
|
+
_ts_param19(0, CurrentUser()),
|
|
6762
|
+
_ts_metadata35("design:type", Function),
|
|
6763
|
+
_ts_metadata35("design:paramtypes", [
|
|
6764
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6765
|
+
]),
|
|
6766
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6767
|
+
], PlatformMfaController.prototype, "setup", null);
|
|
6768
|
+
_ts_decorate35([
|
|
6769
|
+
UseGuards(JwtPlatformGuard),
|
|
6770
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
6771
|
+
HttpCode(HttpStatus.NO_CONTENT),
|
|
6772
|
+
Post("verify-enable"),
|
|
6773
|
+
_ts_param19(0, CurrentUser()),
|
|
6774
|
+
_ts_param19(1, Body()),
|
|
6775
|
+
_ts_param19(2, Req()),
|
|
6776
|
+
_ts_metadata35("design:type", Function),
|
|
6777
|
+
_ts_metadata35("design:paramtypes", [
|
|
6778
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6779
|
+
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
6780
|
+
typeof Request === "undefined" ? Object : Request
|
|
6781
|
+
]),
|
|
6782
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6783
|
+
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
6784
|
+
_ts_decorate35([
|
|
6785
|
+
UseGuards(JwtPlatformGuard),
|
|
6786
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
6787
|
+
HttpCode(HttpStatus.NO_CONTENT),
|
|
6788
|
+
Post("disable"),
|
|
6789
|
+
_ts_param19(0, CurrentUser()),
|
|
6790
|
+
_ts_param19(1, Body()),
|
|
6791
|
+
_ts_param19(2, Req()),
|
|
6792
|
+
_ts_metadata35("design:type", Function),
|
|
6793
|
+
_ts_metadata35("design:paramtypes", [
|
|
6794
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6795
|
+
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
6796
|
+
typeof Request === "undefined" ? Object : Request
|
|
6797
|
+
]),
|
|
6798
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6799
|
+
], PlatformMfaController.prototype, "disable", null);
|
|
6800
|
+
_ts_decorate35([
|
|
6801
|
+
UseGuards(JwtPlatformGuard),
|
|
6802
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
6803
|
+
HttpCode(HttpStatus.OK),
|
|
6804
|
+
Post("recovery-codes"),
|
|
6805
|
+
_ts_param19(0, CurrentUser()),
|
|
6806
|
+
_ts_param19(1, Body()),
|
|
6807
|
+
_ts_param19(2, Req()),
|
|
6808
|
+
_ts_metadata35("design:type", Function),
|
|
6809
|
+
_ts_metadata35("design:paramtypes", [
|
|
6810
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6811
|
+
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
6812
|
+
typeof Request === "undefined" ? Object : Request
|
|
6813
|
+
]),
|
|
6814
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6815
|
+
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
6816
|
+
PlatformMfaController = _ts_decorate35([
|
|
6817
|
+
Controller("platform/mfa"),
|
|
6818
|
+
UsePipes(new ValidationPipe({
|
|
6819
|
+
whitelist: true,
|
|
6820
|
+
forbidNonWhitelisted: true,
|
|
6821
|
+
forbidUnknownValues: true
|
|
6822
|
+
})),
|
|
6823
|
+
_ts_metadata35("design:type", Function),
|
|
6824
|
+
_ts_metadata35("design:paramtypes", [
|
|
6825
|
+
typeof MfaService === "undefined" ? Object : MfaService
|
|
6826
|
+
])
|
|
6827
|
+
], PlatformMfaController);
|
|
6828
|
+
function _ts_decorate36(decorators, target, key, desc) {
|
|
6829
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6830
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6831
|
+
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;
|
|
6832
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6833
|
+
}
|
|
6834
|
+
__name(_ts_decorate36, "_ts_decorate");
|
|
6835
|
+
function _ts_metadata36(k, v) {
|
|
6836
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6837
|
+
}
|
|
6838
|
+
__name(_ts_metadata36, "_ts_metadata");
|
|
6839
|
+
function _ts_param20(paramIndex, decorator) {
|
|
6840
|
+
return function(target, key) {
|
|
6841
|
+
decorator(target, key, paramIndex);
|
|
6842
|
+
};
|
|
6843
|
+
}
|
|
6844
|
+
__name(_ts_param20, "_ts_param");
|
|
6498
6845
|
var STATUS_ERROR_MAP = {
|
|
6499
6846
|
banned: AUTH_ERROR_CODES.ACCOUNT_BANNED,
|
|
6500
6847
|
inactive: AUTH_ERROR_CODES.ACCOUNT_INACTIVE,
|
|
@@ -6542,12 +6889,12 @@ var UserStatusGuard = class {
|
|
|
6542
6889
|
return true;
|
|
6543
6890
|
}
|
|
6544
6891
|
};
|
|
6545
|
-
UserStatusGuard =
|
|
6892
|
+
UserStatusGuard = _ts_decorate36([
|
|
6546
6893
|
Injectable(),
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6894
|
+
_ts_param20(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
6895
|
+
_ts_param20(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6896
|
+
_ts_metadata36("design:type", Function),
|
|
6897
|
+
_ts_metadata36("design:paramtypes", [
|
|
6551
6898
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
6552
6899
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6553
6900
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -6555,23 +6902,23 @@ UserStatusGuard = _ts_decorate34([
|
|
|
6555
6902
|
], UserStatusGuard);
|
|
6556
6903
|
|
|
6557
6904
|
// src/server/controllers/session.controller.ts
|
|
6558
|
-
function
|
|
6905
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
6559
6906
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6560
6907
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6561
6908
|
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;
|
|
6562
6909
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6563
6910
|
}
|
|
6564
|
-
__name(
|
|
6565
|
-
function
|
|
6911
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
6912
|
+
function _ts_metadata37(k, v) {
|
|
6566
6913
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6567
6914
|
}
|
|
6568
|
-
__name(
|
|
6569
|
-
function
|
|
6915
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
6916
|
+
function _ts_param21(paramIndex, decorator) {
|
|
6570
6917
|
return function(target, key) {
|
|
6571
6918
|
decorator(target, key, paramIndex);
|
|
6572
6919
|
};
|
|
6573
6920
|
}
|
|
6574
|
-
__name(
|
|
6921
|
+
__name(_ts_param21, "_ts_param");
|
|
6575
6922
|
var SessionController = class {
|
|
6576
6923
|
static {
|
|
6577
6924
|
__name(this, "SessionController");
|
|
@@ -6648,68 +6995,68 @@ var SessionController = class {
|
|
|
6648
6995
|
await this.sessionService.revokeSession(user.sub, id);
|
|
6649
6996
|
}
|
|
6650
6997
|
};
|
|
6651
|
-
|
|
6998
|
+
_ts_decorate37([
|
|
6652
6999
|
Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
6653
7000
|
Get(),
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
7001
|
+
_ts_param21(0, CurrentUser()),
|
|
7002
|
+
_ts_param21(1, Req()),
|
|
7003
|
+
_ts_metadata37("design:type", Function),
|
|
7004
|
+
_ts_metadata37("design:paramtypes", [
|
|
6658
7005
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6659
7006
|
typeof Request === "undefined" ? Object : Request
|
|
6660
7007
|
]),
|
|
6661
|
-
|
|
7008
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6662
7009
|
], SessionController.prototype, "listSessions", null);
|
|
6663
|
-
|
|
7010
|
+
_ts_decorate37([
|
|
6664
7011
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
6665
7012
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6666
7013
|
Delete("all"),
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
7014
|
+
_ts_param21(0, CurrentUser()),
|
|
7015
|
+
_ts_param21(1, Req()),
|
|
7016
|
+
_ts_metadata37("design:type", Function),
|
|
7017
|
+
_ts_metadata37("design:paramtypes", [
|
|
6671
7018
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6672
7019
|
typeof Request === "undefined" ? Object : Request
|
|
6673
7020
|
]),
|
|
6674
|
-
|
|
7021
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6675
7022
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
6676
|
-
|
|
7023
|
+
_ts_decorate37([
|
|
6677
7024
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
6678
7025
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6679
7026
|
Delete(":id"),
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
7027
|
+
_ts_param21(0, CurrentUser()),
|
|
7028
|
+
_ts_param21(1, Param("id")),
|
|
7029
|
+
_ts_metadata37("design:type", Function),
|
|
7030
|
+
_ts_metadata37("design:paramtypes", [
|
|
6684
7031
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6685
7032
|
String
|
|
6686
7033
|
]),
|
|
6687
|
-
|
|
7034
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6688
7035
|
], SessionController.prototype, "revokeSession", null);
|
|
6689
|
-
SessionController =
|
|
7036
|
+
SessionController = _ts_decorate37([
|
|
6690
7037
|
Controller("sessions"),
|
|
6691
7038
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
6692
7039
|
UsePipes(new ValidationPipe({
|
|
6693
7040
|
whitelist: true,
|
|
6694
7041
|
forbidNonWhitelisted: true
|
|
6695
7042
|
})),
|
|
6696
|
-
|
|
6697
|
-
|
|
7043
|
+
_ts_metadata37("design:type", Function),
|
|
7044
|
+
_ts_metadata37("design:paramtypes", [
|
|
6698
7045
|
typeof SessionService === "undefined" ? Object : SessionService,
|
|
6699
7046
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
6700
7047
|
])
|
|
6701
7048
|
], SessionController);
|
|
6702
|
-
function
|
|
7049
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
6703
7050
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6704
7051
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6705
7052
|
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;
|
|
6706
7053
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6707
7054
|
}
|
|
6708
|
-
__name(
|
|
6709
|
-
function
|
|
7055
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
7056
|
+
function _ts_metadata38(k, v) {
|
|
6710
7057
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6711
7058
|
}
|
|
6712
|
-
__name(
|
|
7059
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
6713
7060
|
var MfaRequiredGuard = class {
|
|
6714
7061
|
static {
|
|
6715
7062
|
__name(this, "MfaRequiredGuard");
|
|
@@ -6736,10 +7083,10 @@ var MfaRequiredGuard = class {
|
|
|
6736
7083
|
return true;
|
|
6737
7084
|
}
|
|
6738
7085
|
};
|
|
6739
|
-
MfaRequiredGuard =
|
|
7086
|
+
MfaRequiredGuard = _ts_decorate38([
|
|
6740
7087
|
Injectable(),
|
|
6741
|
-
|
|
6742
|
-
|
|
7088
|
+
_ts_metadata38("design:type", Function),
|
|
7089
|
+
_ts_metadata38("design:paramtypes", [
|
|
6743
7090
|
typeof Reflector === "undefined" ? Object : Reflector
|
|
6744
7091
|
])
|
|
6745
7092
|
], MfaRequiredGuard);
|
|
@@ -6747,23 +7094,23 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
6747
7094
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
6748
7095
|
|
|
6749
7096
|
// src/server/guards/platform-roles.guard.ts
|
|
6750
|
-
function
|
|
7097
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
6751
7098
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6752
7099
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6753
7100
|
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;
|
|
6754
7101
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6755
7102
|
}
|
|
6756
|
-
__name(
|
|
6757
|
-
function
|
|
7103
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
7104
|
+
function _ts_metadata39(k, v) {
|
|
6758
7105
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6759
7106
|
}
|
|
6760
|
-
__name(
|
|
6761
|
-
function
|
|
7107
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
7108
|
+
function _ts_param22(paramIndex, decorator) {
|
|
6762
7109
|
return function(target, key) {
|
|
6763
7110
|
decorator(target, key, paramIndex);
|
|
6764
7111
|
};
|
|
6765
7112
|
}
|
|
6766
|
-
__name(
|
|
7113
|
+
__name(_ts_param22, "_ts_param");
|
|
6767
7114
|
var PlatformRolesGuard = class {
|
|
6768
7115
|
static {
|
|
6769
7116
|
__name(this, "PlatformRolesGuard");
|
|
@@ -6797,11 +7144,11 @@ var PlatformRolesGuard = class {
|
|
|
6797
7144
|
return true;
|
|
6798
7145
|
}
|
|
6799
7146
|
};
|
|
6800
|
-
PlatformRolesGuard =
|
|
7147
|
+
PlatformRolesGuard = _ts_decorate39([
|
|
6801
7148
|
Injectable(),
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
7149
|
+
_ts_param22(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7150
|
+
_ts_metadata39("design:type", Function),
|
|
7151
|
+
_ts_metadata39("design:paramtypes", [
|
|
6805
7152
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
6806
7153
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6807
7154
|
])
|
|
@@ -6810,23 +7157,23 @@ var ROLES_KEY = "roles";
|
|
|
6810
7157
|
var Roles = /* @__PURE__ */ __name((...roles) => SetMetadata(ROLES_KEY, roles), "Roles");
|
|
6811
7158
|
|
|
6812
7159
|
// src/server/guards/roles.guard.ts
|
|
6813
|
-
function
|
|
7160
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
6814
7161
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6815
7162
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6816
7163
|
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;
|
|
6817
7164
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6818
7165
|
}
|
|
6819
|
-
__name(
|
|
6820
|
-
function
|
|
7166
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
7167
|
+
function _ts_metadata40(k, v) {
|
|
6821
7168
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6822
7169
|
}
|
|
6823
|
-
__name(
|
|
6824
|
-
function
|
|
7170
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
7171
|
+
function _ts_param23(paramIndex, decorator) {
|
|
6825
7172
|
return function(target, key) {
|
|
6826
7173
|
decorator(target, key, paramIndex);
|
|
6827
7174
|
};
|
|
6828
7175
|
}
|
|
6829
|
-
__name(
|
|
7176
|
+
__name(_ts_param23, "_ts_param");
|
|
6830
7177
|
var RolesGuard = class {
|
|
6831
7178
|
static {
|
|
6832
7179
|
__name(this, "RolesGuard");
|
|
@@ -6856,22 +7203,22 @@ var RolesGuard = class {
|
|
|
6856
7203
|
return true;
|
|
6857
7204
|
}
|
|
6858
7205
|
};
|
|
6859
|
-
RolesGuard =
|
|
7206
|
+
RolesGuard = _ts_decorate40([
|
|
6860
7207
|
Injectable(),
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
7208
|
+
_ts_param23(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7209
|
+
_ts_metadata40("design:type", Function),
|
|
7210
|
+
_ts_metadata40("design:paramtypes", [
|
|
6864
7211
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
6865
7212
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6866
7213
|
])
|
|
6867
7214
|
], RolesGuard);
|
|
6868
|
-
function
|
|
7215
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
6869
7216
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6870
7217
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6871
7218
|
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;
|
|
6872
7219
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6873
7220
|
}
|
|
6874
|
-
__name(
|
|
7221
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
6875
7222
|
var NoOpAuthHooks = class {
|
|
6876
7223
|
static {
|
|
6877
7224
|
__name(this, "NoOpAuthHooks");
|
|
@@ -6911,29 +7258,29 @@ var NoOpAuthHooks = class {
|
|
|
6911
7258
|
};
|
|
6912
7259
|
}
|
|
6913
7260
|
};
|
|
6914
|
-
NoOpAuthHooks =
|
|
7261
|
+
NoOpAuthHooks = _ts_decorate41([
|
|
6915
7262
|
Injectable()
|
|
6916
7263
|
], NoOpAuthHooks);
|
|
6917
7264
|
|
|
6918
7265
|
// src/server/oauth/oauth.constants.ts
|
|
6919
7266
|
var OAUTH_PLUGINS = /* @__PURE__ */ Symbol("OAUTH_PLUGINS");
|
|
6920
|
-
function
|
|
7267
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
6921
7268
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6922
7269
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6923
7270
|
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;
|
|
6924
7271
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6925
7272
|
}
|
|
6926
|
-
__name(
|
|
6927
|
-
function
|
|
7273
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
7274
|
+
function _ts_metadata41(k, v) {
|
|
6928
7275
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6929
7276
|
}
|
|
6930
|
-
__name(
|
|
6931
|
-
function
|
|
7277
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
7278
|
+
function _ts_param24(paramIndex, decorator) {
|
|
6932
7279
|
return function(target, key) {
|
|
6933
7280
|
decorator(target, key, paramIndex);
|
|
6934
7281
|
};
|
|
6935
7282
|
}
|
|
6936
|
-
__name(
|
|
7283
|
+
__name(_ts_param24, "_ts_param");
|
|
6937
7284
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
6938
7285
|
function isStoredOAuthState(value) {
|
|
6939
7286
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -7143,15 +7490,15 @@ var OAuthService = class _OAuthService {
|
|
|
7143
7490
|
return plugin;
|
|
7144
7491
|
}
|
|
7145
7492
|
};
|
|
7146
|
-
OAuthService =
|
|
7493
|
+
OAuthService = _ts_decorate42([
|
|
7147
7494
|
Injectable(),
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7495
|
+
_ts_param24(0, Inject(OAUTH_PLUGINS)),
|
|
7496
|
+
_ts_param24(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
7497
|
+
_ts_param24(2, Inject(BYMAX_AUTH_HOOKS)),
|
|
7498
|
+
_ts_param24(2, Optional()),
|
|
7499
|
+
_ts_param24(6, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7500
|
+
_ts_metadata41("design:type", Function),
|
|
7501
|
+
_ts_metadata41("design:paramtypes", [
|
|
7155
7502
|
Array,
|
|
7156
7503
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
7157
7504
|
Object,
|
|
@@ -7161,17 +7508,17 @@ OAuthService = _ts_decorate40([
|
|
|
7161
7508
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
7162
7509
|
])
|
|
7163
7510
|
], OAuthService);
|
|
7164
|
-
function
|
|
7511
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
7165
7512
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7166
7513
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7167
7514
|
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;
|
|
7168
7515
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7169
7516
|
}
|
|
7170
|
-
__name(
|
|
7171
|
-
function
|
|
7517
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
7518
|
+
function _ts_metadata42(k, v) {
|
|
7172
7519
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7173
7520
|
}
|
|
7174
|
-
__name(
|
|
7521
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
7175
7522
|
var OAuthCallbackQueryDto = class {
|
|
7176
7523
|
static {
|
|
7177
7524
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -7225,59 +7572,59 @@ var OAuthCallbackQueryDto = class {
|
|
|
7225
7572
|
*/
|
|
7226
7573
|
hd;
|
|
7227
7574
|
};
|
|
7228
|
-
|
|
7575
|
+
_ts_decorate43([
|
|
7229
7576
|
IsString(),
|
|
7230
7577
|
IsNotEmpty(),
|
|
7231
7578
|
MaxLength(2048),
|
|
7232
|
-
|
|
7579
|
+
_ts_metadata42("design:type", String)
|
|
7233
7580
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
7234
|
-
|
|
7581
|
+
_ts_decorate43([
|
|
7235
7582
|
IsString(),
|
|
7236
7583
|
IsNotEmpty(),
|
|
7237
7584
|
MaxLength(128),
|
|
7238
|
-
|
|
7585
|
+
_ts_metadata42("design:type", String)
|
|
7239
7586
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
7240
|
-
|
|
7587
|
+
_ts_decorate43([
|
|
7241
7588
|
IsOptional(),
|
|
7242
7589
|
IsString(),
|
|
7243
7590
|
MaxLength(512),
|
|
7244
|
-
|
|
7591
|
+
_ts_metadata42("design:type", String)
|
|
7245
7592
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
7246
|
-
|
|
7593
|
+
_ts_decorate43([
|
|
7247
7594
|
IsOptional(),
|
|
7248
7595
|
IsString(),
|
|
7249
7596
|
MaxLength(2048),
|
|
7250
|
-
|
|
7597
|
+
_ts_metadata42("design:type", String)
|
|
7251
7598
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
7252
|
-
|
|
7599
|
+
_ts_decorate43([
|
|
7253
7600
|
IsOptional(),
|
|
7254
7601
|
IsString(),
|
|
7255
7602
|
MaxLength(16),
|
|
7256
|
-
|
|
7603
|
+
_ts_metadata42("design:type", String)
|
|
7257
7604
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
7258
|
-
|
|
7605
|
+
_ts_decorate43([
|
|
7259
7606
|
IsOptional(),
|
|
7260
7607
|
IsString(),
|
|
7261
7608
|
MaxLength(64),
|
|
7262
|
-
|
|
7609
|
+
_ts_metadata42("design:type", String)
|
|
7263
7610
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
7264
|
-
|
|
7611
|
+
_ts_decorate43([
|
|
7265
7612
|
IsOptional(),
|
|
7266
7613
|
IsString(),
|
|
7267
7614
|
MaxLength(253),
|
|
7268
|
-
|
|
7615
|
+
_ts_metadata42("design:type", String)
|
|
7269
7616
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
7270
|
-
function
|
|
7617
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
7271
7618
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7272
7619
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7273
7620
|
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;
|
|
7274
7621
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7275
7622
|
}
|
|
7276
|
-
__name(
|
|
7277
|
-
function
|
|
7623
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
7624
|
+
function _ts_metadata43(k, v) {
|
|
7278
7625
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7279
7626
|
}
|
|
7280
|
-
__name(
|
|
7627
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
7281
7628
|
var OAuthInitiateQueryDto = class {
|
|
7282
7629
|
static {
|
|
7283
7630
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -7294,31 +7641,31 @@ var OAuthInitiateQueryDto = class {
|
|
|
7294
7641
|
*/
|
|
7295
7642
|
tenantId;
|
|
7296
7643
|
};
|
|
7297
|
-
|
|
7644
|
+
_ts_decorate44([
|
|
7298
7645
|
IsString(),
|
|
7299
7646
|
IsNotEmpty(),
|
|
7300
7647
|
MaxLength(128),
|
|
7301
|
-
|
|
7648
|
+
_ts_metadata43("design:type", String)
|
|
7302
7649
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
7303
7650
|
|
|
7304
7651
|
// src/server/oauth/oauth.controller.ts
|
|
7305
|
-
function
|
|
7652
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
7306
7653
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7307
7654
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7308
7655
|
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;
|
|
7309
7656
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7310
7657
|
}
|
|
7311
|
-
__name(
|
|
7312
|
-
function
|
|
7658
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
7659
|
+
function _ts_metadata44(k, v) {
|
|
7313
7660
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7314
7661
|
}
|
|
7315
|
-
__name(
|
|
7316
|
-
function
|
|
7662
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
7663
|
+
function _ts_param25(paramIndex, decorator) {
|
|
7317
7664
|
return function(target, key) {
|
|
7318
7665
|
decorator(target, key, paramIndex);
|
|
7319
7666
|
};
|
|
7320
7667
|
}
|
|
7321
|
-
__name(
|
|
7668
|
+
__name(_ts_param25, "_ts_param");
|
|
7322
7669
|
var OAuthController = class {
|
|
7323
7670
|
static {
|
|
7324
7671
|
__name(this, "OAuthController");
|
|
@@ -7389,42 +7736,42 @@ var OAuthController = class {
|
|
|
7389
7736
|
return body;
|
|
7390
7737
|
}
|
|
7391
7738
|
};
|
|
7392
|
-
|
|
7739
|
+
_ts_decorate45([
|
|
7393
7740
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
7394
7741
|
Get(":provider"),
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7742
|
+
_ts_param25(0, Param("provider")),
|
|
7743
|
+
_ts_param25(1, Query()),
|
|
7744
|
+
_ts_param25(2, Res({
|
|
7398
7745
|
passthrough: true
|
|
7399
7746
|
})),
|
|
7400
|
-
|
|
7401
|
-
|
|
7747
|
+
_ts_metadata44("design:type", Function),
|
|
7748
|
+
_ts_metadata44("design:paramtypes", [
|
|
7402
7749
|
String,
|
|
7403
7750
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
7404
7751
|
typeof Response === "undefined" ? Object : Response
|
|
7405
7752
|
]),
|
|
7406
|
-
|
|
7753
|
+
_ts_metadata44("design:returntype", Promise)
|
|
7407
7754
|
], OAuthController.prototype, "initiate", null);
|
|
7408
|
-
|
|
7755
|
+
_ts_decorate45([
|
|
7409
7756
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
7410
7757
|
HttpCode(HttpStatus.OK),
|
|
7411
7758
|
Get(":provider/callback"),
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7759
|
+
_ts_param25(0, Param("provider")),
|
|
7760
|
+
_ts_param25(1, Query()),
|
|
7761
|
+
_ts_param25(2, Req()),
|
|
7762
|
+
_ts_param25(3, Res({
|
|
7416
7763
|
passthrough: true
|
|
7417
7764
|
})),
|
|
7418
|
-
|
|
7419
|
-
|
|
7765
|
+
_ts_metadata44("design:type", Function),
|
|
7766
|
+
_ts_metadata44("design:paramtypes", [
|
|
7420
7767
|
String,
|
|
7421
7768
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
7422
7769
|
typeof Request === "undefined" ? Object : Request,
|
|
7423
7770
|
typeof Response === "undefined" ? Object : Response
|
|
7424
7771
|
]),
|
|
7425
|
-
|
|
7772
|
+
_ts_metadata44("design:returntype", Promise)
|
|
7426
7773
|
], OAuthController.prototype, "callback", null);
|
|
7427
|
-
OAuthController =
|
|
7774
|
+
OAuthController = _ts_decorate45([
|
|
7428
7775
|
Public(),
|
|
7429
7776
|
SkipMfa(),
|
|
7430
7777
|
Controller("oauth"),
|
|
@@ -7433,9 +7780,9 @@ OAuthController = _ts_decorate43([
|
|
|
7433
7780
|
forbidNonWhitelisted: true,
|
|
7434
7781
|
forbidUnknownValues: true
|
|
7435
7782
|
})),
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7783
|
+
_ts_param25(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7784
|
+
_ts_metadata44("design:type", Function),
|
|
7785
|
+
_ts_metadata44("design:paramtypes", [
|
|
7439
7786
|
typeof OAuthService === "undefined" ? Object : OAuthService,
|
|
7440
7787
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
7441
7788
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -7571,13 +7918,13 @@ var GoogleOAuthPlugin = class {
|
|
|
7571
7918
|
};
|
|
7572
7919
|
|
|
7573
7920
|
// src/server/oauth/oauth.module.ts
|
|
7574
|
-
function
|
|
7921
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
7575
7922
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7576
7923
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7577
7924
|
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;
|
|
7578
7925
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7579
7926
|
}
|
|
7580
|
-
__name(
|
|
7927
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
7581
7928
|
function buildOAuthPlugins(options) {
|
|
7582
7929
|
const plugins = [];
|
|
7583
7930
|
if (options.oauth?.google) {
|
|
@@ -7647,16 +7994,16 @@ var OAuthModule = class _OAuthModule {
|
|
|
7647
7994
|
};
|
|
7648
7995
|
}
|
|
7649
7996
|
};
|
|
7650
|
-
OAuthModule =
|
|
7997
|
+
OAuthModule = _ts_decorate46([
|
|
7651
7998
|
Module({})
|
|
7652
7999
|
], OAuthModule);
|
|
7653
|
-
function
|
|
8000
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
7654
8001
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7655
8002
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7656
8003
|
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;
|
|
7657
8004
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7658
8005
|
}
|
|
7659
|
-
__name(
|
|
8006
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
7660
8007
|
var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
7661
8008
|
static {
|
|
7662
8009
|
__name(this, "NoOpEmailProvider");
|
|
@@ -7691,18 +8038,18 @@ var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
7691
8038
|
this.logger.log(`sendInvitation \u2192 ${email} (no-op)`);
|
|
7692
8039
|
}
|
|
7693
8040
|
};
|
|
7694
|
-
NoOpEmailProvider =
|
|
8041
|
+
NoOpEmailProvider = _ts_decorate47([
|
|
7695
8042
|
Injectable()
|
|
7696
8043
|
], NoOpEmailProvider);
|
|
7697
8044
|
|
|
7698
8045
|
// src/server/bymax-auth.module.ts
|
|
7699
|
-
function
|
|
8046
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
7700
8047
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7701
8048
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7702
8049
|
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;
|
|
7703
8050
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7704
8051
|
}
|
|
7705
|
-
__name(
|
|
8052
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
7706
8053
|
function hasProviderToken(providers, token) {
|
|
7707
8054
|
return providers.some((p) => {
|
|
7708
8055
|
if (typeof p === "function") return false;
|
|
@@ -7796,7 +8143,8 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
7796
8143
|
SessionController
|
|
7797
8144
|
] : [],
|
|
7798
8145
|
...includePlatform ? [
|
|
7799
|
-
PlatformAuthController
|
|
8146
|
+
PlatformAuthController,
|
|
8147
|
+
PlatformMfaController
|
|
7800
8148
|
] : [],
|
|
7801
8149
|
...includeOAuth ? [
|
|
7802
8150
|
OAuthController
|
|
@@ -7948,16 +8296,16 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
7948
8296
|
};
|
|
7949
8297
|
}
|
|
7950
8298
|
};
|
|
7951
|
-
BymaxAuthModule =
|
|
8299
|
+
BymaxAuthModule = _ts_decorate48([
|
|
7952
8300
|
Module({})
|
|
7953
8301
|
], BymaxAuthModule);
|
|
7954
|
-
function
|
|
8302
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
7955
8303
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7956
8304
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7957
8305
|
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;
|
|
7958
8306
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7959
8307
|
}
|
|
7960
|
-
__name(
|
|
8308
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
7961
8309
|
var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
7962
8310
|
static {
|
|
7963
8311
|
__name(this, "OptionalAuthGuard");
|
|
@@ -7972,26 +8320,26 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
|
7972
8320
|
return super.canActivate(context);
|
|
7973
8321
|
}
|
|
7974
8322
|
};
|
|
7975
|
-
OptionalAuthGuard =
|
|
8323
|
+
OptionalAuthGuard = _ts_decorate49([
|
|
7976
8324
|
Injectable()
|
|
7977
8325
|
], OptionalAuthGuard);
|
|
7978
|
-
function
|
|
8326
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
7979
8327
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7980
8328
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7981
8329
|
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;
|
|
7982
8330
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7983
8331
|
}
|
|
7984
|
-
__name(
|
|
7985
|
-
function
|
|
8332
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
8333
|
+
function _ts_metadata45(k, v) {
|
|
7986
8334
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7987
8335
|
}
|
|
7988
|
-
__name(
|
|
7989
|
-
function
|
|
8336
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
8337
|
+
function _ts_param26(paramIndex, decorator) {
|
|
7990
8338
|
return function(target, key) {
|
|
7991
8339
|
decorator(target, key, paramIndex);
|
|
7992
8340
|
};
|
|
7993
8341
|
}
|
|
7994
|
-
__name(
|
|
8342
|
+
__name(_ts_param26, "_ts_param");
|
|
7995
8343
|
var SelfOrAdminGuard = class {
|
|
7996
8344
|
static {
|
|
7997
8345
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -8021,11 +8369,11 @@ var SelfOrAdminGuard = class {
|
|
|
8021
8369
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE, HttpStatus.FORBIDDEN);
|
|
8022
8370
|
}
|
|
8023
8371
|
};
|
|
8024
|
-
SelfOrAdminGuard =
|
|
8372
|
+
SelfOrAdminGuard = _ts_decorate50([
|
|
8025
8373
|
Injectable(),
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8374
|
+
_ts_param26(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
8375
|
+
_ts_metadata45("design:type", Function),
|
|
8376
|
+
_ts_metadata45("design:paramtypes", [
|
|
8029
8377
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
8030
8378
|
])
|
|
8031
8379
|
], SelfOrAdminGuard);
|
|
@@ -8038,23 +8386,23 @@ function isHexLooking(value) {
|
|
|
8038
8386
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
8039
8387
|
}
|
|
8040
8388
|
__name(isHexLooking, "isHexLooking");
|
|
8041
|
-
function
|
|
8389
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
8042
8390
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8043
8391
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8044
8392
|
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;
|
|
8045
8393
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8046
8394
|
}
|
|
8047
|
-
__name(
|
|
8048
|
-
function
|
|
8395
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
8396
|
+
function _ts_metadata46(k, v) {
|
|
8049
8397
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8050
8398
|
}
|
|
8051
|
-
__name(
|
|
8052
|
-
function
|
|
8399
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
8400
|
+
function _ts_param27(paramIndex, decorator) {
|
|
8053
8401
|
return function(target, key) {
|
|
8054
8402
|
decorator(target, key, paramIndex);
|
|
8055
8403
|
};
|
|
8056
8404
|
}
|
|
8057
|
-
__name(
|
|
8405
|
+
__name(_ts_param27, "_ts_param");
|
|
8058
8406
|
var WsJwtGuard = class {
|
|
8059
8407
|
static {
|
|
8060
8408
|
__name(this, "WsJwtGuard");
|
|
@@ -8103,15 +8451,15 @@ var WsJwtGuard = class {
|
|
|
8103
8451
|
return true;
|
|
8104
8452
|
}
|
|
8105
8453
|
};
|
|
8106
|
-
WsJwtGuard =
|
|
8454
|
+
WsJwtGuard = _ts_decorate51([
|
|
8107
8455
|
Injectable(),
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8456
|
+
_ts_param27(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
8457
|
+
_ts_metadata46("design:type", Function),
|
|
8458
|
+
_ts_metadata46("design:paramtypes", [
|
|
8111
8459
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
8112
8460
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
8113
8461
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
8114
8462
|
])
|
|
8115
8463
|
], WsJwtGuard);
|
|
8116
8464
|
|
|
8117
|
-
export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AuthException, AuthService, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BymaxAuthModule, CreateInvitationDto, CurrentUser, ForgotPasswordDto, IS_PUBLIC_KEY, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, SessionService, SkipMfa, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WsJwtGuard, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
8465
|
+
export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AuthException, AuthService, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BymaxAuthModule, CreateInvitationDto, CurrentUser, ForgotPasswordDto, IS_PUBLIC_KEY, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, SessionService, SkipMfa, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WsJwtGuard, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|