@bymax-one/nest-auth 1.4.20 → 1.4.21

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.
@@ -1969,7 +1969,6 @@ var REFRESH_PREFIXES = {
1969
1969
  grace: "rp",
1970
1970
  consumed: "cf",
1971
1971
  family: "fam",
1972
- index: "sess",
1973
1972
  detail: "sd"
1974
1973
  },
1975
1974
  platform: {
@@ -1977,7 +1976,6 @@ var REFRESH_PREFIXES = {
1977
1976
  grace: "prp",
1978
1977
  consumed: "pcf",
1979
1978
  family: "pfam",
1980
- index: "psess",
1981
1979
  detail: "psd"
1982
1980
  }
1983
1981
  };
@@ -4657,7 +4655,7 @@ var MAX_SCRYPT_PARAMETER = 255;
4657
4655
  var MIN_KEY_LEN = 10;
4658
4656
  var MAX_KEY_LEN = 64;
4659
4657
  function toPhcB64(value) {
4660
- return value.toString("base64").replace(/=+$/, "");
4658
+ return value.toString("base64").replaceAll("=", "");
4661
4659
  }
4662
4660
  __name(toPhcB64, "toPhcB64");
4663
4661
  function fromPhcB64(value) {
@@ -9972,6 +9970,130 @@ _ts_decorate36([
9972
9970
  classValidator.IsNotEmpty(),
9973
9971
  _ts_metadata35("design:type", String)
9974
9972
  ], MfaVerifyDto.prototype, "code", void 0);
9973
+ function _ts_decorate37(decorators, target, key, desc) {
9974
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9975
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9976
+ r = Reflect.decorate(decorators, target, key, desc);
9977
+ } else {
9978
+ for (var i = decorators.length - 1; i >= 0; i--) {
9979
+ if (d = decorators[i]) {
9980
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9981
+ }
9982
+ }
9983
+ }
9984
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9985
+ }
9986
+ __name(_ts_decorate37, "_ts_decorate");
9987
+ function _ts_metadata36(metadataKey, metadataValue) {
9988
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9989
+ return Reflect.metadata(metadataKey, metadataValue);
9990
+ }
9991
+ }
9992
+ __name(_ts_metadata36, "_ts_metadata");
9993
+ function _ts_param21(paramIndex, decorator) {
9994
+ return function(target, key) {
9995
+ decorator(target, key, paramIndex);
9996
+ };
9997
+ }
9998
+ __name(_ts_param21, "_ts_param");
9999
+ var MfaFlowLockoutService = class {
10000
+ static {
10001
+ __name(this, "MfaFlowLockoutService");
10002
+ }
10003
+ options;
10004
+ bruteForce;
10005
+ constructor(options, bruteForce) {
10006
+ this.options = options;
10007
+ this.bruteForce = bruteForce;
10008
+ }
10009
+ /**
10010
+ * The tenant-scoped brute-force identifier for one MFA flow, and the plane-only one that pods on
10011
+ * an older version count under. The two are equal on the platform plane, where the subject
10012
+ * carries no tenant, and distinct on the dashboard plane, where it does.
10013
+ *
10014
+ * A rolling upgrade runs old and new code against one Redis at once: on the dashboard plane an
10015
+ * old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
10016
+ * `{flow}:{userSubject}`, and either alone leaves a hole: a lockout an old pod filled would not
10017
+ * stop a new pod, and a success on one would not clear the other. So every read consults both
10018
+ * and every write touches both, and the two move as one; the plane-only arm can be dropped once
10019
+ * no pod writes it. On the platform plane the two ids are identical, so the plane-only arm is
10020
+ * skipped: operating it would be the same key a second time, double-counting a failure and
10021
+ * locking a platform admin out at half the threshold. `{flow}` (`challenge` / `disable` /
10022
+ * `reauth`) keeps the three counters isolated from each other.
10023
+ */
10024
+ counterIds(flow, context, userId, tenantId) {
10025
+ return {
10026
+ legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
10027
+ scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
10028
+ };
10029
+ }
10030
+ /**
10031
+ * Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
10032
+ * neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
10033
+ */
10034
+ async isLockedOut(flow, context, userId, tenantId) {
10035
+ const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
10036
+ if (await this.bruteForce.isLockedOut(scoped)) return true;
10037
+ return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
10038
+ }
10039
+ /**
10040
+ * Records the failure under both counters so the budget an attacker spends is seen by old and
10041
+ * new code alike — but under the scoped id ONCE when the two coincide (platform plane).
10042
+ */
10043
+ async recordFailure(flow, context, userId, tenantId) {
10044
+ const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
10045
+ await this.bruteForce.recordFailure(scoped);
10046
+ if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
10047
+ }
10048
+ /**
10049
+ * Clears both counters on success — resetting only one would leave the other to lock a
10050
+ * legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
10051
+ */
10052
+ async reset(flow, context, userId, tenantId) {
10053
+ const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
10054
+ await this.bruteForce.resetFailures(scoped);
10055
+ if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
10056
+ }
10057
+ };
10058
+ MfaFlowLockoutService = _ts_decorate37([
10059
+ common.Injectable(),
10060
+ _ts_param21(0, common.Inject(BYMAX_AUTH_OPTIONS)),
10061
+ _ts_param21(1, common.Inject(exports.BruteForceService)),
10062
+ _ts_metadata36("design:type", Function),
10063
+ _ts_metadata36("design:paramtypes", [
10064
+ typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
10065
+ typeof exports.BruteForceService === "undefined" ? Object : exports.BruteForceService
10066
+ ])
10067
+ ], MfaFlowLockoutService);
10068
+
10069
+ // src/server/utils/mfa-plane-tenant.ts
10070
+ var PLANE_TENANT_MESSAGE = "tenantId must be a non-empty value on the dashboard plane and absent on the platform plane";
10071
+ function assertDashboardTenant(tenantId) {
10072
+ if (tenantId === void 0 || tenantId === "") {
10073
+ throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
10074
+ {
10075
+ field: "tenantId",
10076
+ message: PLANE_TENANT_MESSAGE
10077
+ }
10078
+ ]);
10079
+ }
10080
+ }
10081
+ __name(assertDashboardTenant, "assertDashboardTenant");
10082
+ function assertPlaneTenant(context, tenantId) {
10083
+ if (context === "dashboard") {
10084
+ assertDashboardTenant(tenantId);
10085
+ return;
10086
+ }
10087
+ if (tenantId !== void 0) {
10088
+ throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
10089
+ {
10090
+ field: "tenantId",
10091
+ message: PLANE_TENANT_MESSAGE
10092
+ }
10093
+ ]);
10094
+ }
10095
+ }
10096
+ __name(assertPlaneTenant, "assertPlaneTenant");
9975
10097
  var IV_LENGTH = 12;
9976
10098
  var AUTH_TAG_BYTE_LENGTH = 16;
9977
10099
  function encrypt(plaintext, keyBase64) {
@@ -10020,71 +10142,6 @@ function decrypt(ciphertext, keyBase64) {
10020
10142
  ]).toString("utf8");
10021
10143
  }
10022
10144
  __name(decrypt, "decrypt");
10023
- function digestRecoveryCode(code, hmacKey) {
10024
- return hmacSha256(code, hmacKey);
10025
- }
10026
- __name(digestRecoveryCode, "digestRecoveryCode");
10027
- function generateRecoveryCodes(count, hmacKey) {
10028
- const plainCodes = [];
10029
- const hashedCodes = [];
10030
- for (let i = 0; i < count; i++) {
10031
- const hex = crypto.randomBytes(12).toString("hex");
10032
- const groups = [];
10033
- for (let offset = 0; offset < hex.length; offset += 4) {
10034
- groups.push(hex.slice(offset, offset + 4));
10035
- }
10036
- const code = groups.join("-").toUpperCase();
10037
- plainCodes.push(code);
10038
- hashedCodes.push(digestRecoveryCode(code, hmacKey));
10039
- }
10040
- return {
10041
- plainCodes,
10042
- hashedCodes
10043
- };
10044
- }
10045
- __name(generateRecoveryCodes, "generateRecoveryCodes");
10046
- async function verifyRecoveryCode(code, hashedCodes, hmacKey, previousHmacKeys) {
10047
- const candidates = [
10048
- digestRecoveryCode(code, hmacKey),
10049
- ...previousHmacKeys.map((key) => hmacSha256(code, key))
10050
- ];
10051
- const macMatches = [];
10052
- for (const hashedCode of hashedCodes) {
10053
- const hit = candidates.reduce((found, candidate) => timingSafeCompare(candidate, hashedCode) || found, false);
10054
- macMatches.push(hit);
10055
- }
10056
- return macMatches.reduce((found, hit, index) => found === -1 && hit ? index : found, -1);
10057
- }
10058
- __name(verifyRecoveryCode, "verifyRecoveryCode");
10059
-
10060
- // src/server/utils/mfa-safe-user.ts
10061
- function toSafeUser3(user) {
10062
- const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = user;
10063
- return safe;
10064
- }
10065
- __name(toSafeUser3, "toSafeUser");
10066
- function toSafePlatformUser(admin) {
10067
- const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = admin;
10068
- return safe;
10069
- }
10070
- __name(toSafePlatformUser, "toSafePlatformUser");
10071
- function platformUserAsSafeUser(admin) {
10072
- const safe = toSafePlatformUser(admin);
10073
- return {
10074
- ...safe,
10075
- tenantId: "",
10076
- emailVerified: true
10077
- };
10078
- }
10079
- __name(platformUserAsSafeUser, "platformUserAsSafeUser");
10080
- function committedSafeUser(context, user, mfaEnabled) {
10081
- const committed = {
10082
- ...user,
10083
- mfaEnabled
10084
- };
10085
- return context === "platform" ? platformUserAsSafeUser(committed) : toSafeUser3(committed);
10086
- }
10087
- __name(committedSafeUser, "committedSafeUser");
10088
10145
 
10089
10146
  // src/server/utils/mfa-secret-cipher.ts
10090
10147
  function holdsSecret(stored, secretBase32, keys) {
@@ -10125,57 +10182,8 @@ function decryptWithRotation(encrypted, keys) {
10125
10182
  }
10126
10183
  __name(decryptWithRotation, "decryptWithRotation");
10127
10184
 
10128
- // src/server/utils/mfa-setup-data.ts
10129
- function isMfaSetupData(value) {
10130
- if (value === null) return false;
10131
- if (typeof value !== "object") return false;
10132
- const v = value;
10133
- return typeof v["encryptedSecret"] === "string" && typeof v["encryptedPlainCodes"] === "string" && Array.isArray(v["hashedCodes"]) && v["hashedCodes"].every((code) => typeof code === "string");
10134
- }
10135
- __name(isMfaSetupData, "isMfaSetupData");
10136
- function parseSetupData(raw, userId, logger) {
10137
- let parsed;
10138
- try {
10139
- parsed = JSON.parse(raw);
10140
- } catch {
10141
- logger.warn(`parseSetupData: pending-setup payload is not valid JSON userId=${logSafe(userId)}`);
10142
- throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10143
- }
10144
- if (!isMfaSetupData(parsed)) {
10145
- throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10146
- }
10147
- return parsed;
10148
- }
10149
- __name(parseSetupData, "parseSetupData");
10150
- function parsePlainRecoveryCodes(raw, userId, logger) {
10151
- let parsed;
10152
- try {
10153
- parsed = JSON.parse(raw);
10154
- } catch {
10155
- logger.warn(`parsePlainRecoveryCodes: decrypted payload is not valid JSON userId=${logSafe(userId)}`);
10156
- throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10157
- }
10158
- if (!Array.isArray(parsed) || parsed.some((code) => typeof code !== "string")) {
10159
- throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10160
- }
10161
- return parsed;
10162
- }
10163
- __name(parsePlainRecoveryCodes, "parsePlainRecoveryCodes");
10164
-
10165
- // src/server/utils/run-detached.ts
10166
- function runDetached(logger, run, failure) {
10167
- try {
10168
- void Promise.resolve(run()).catch((err) => {
10169
- logger.error(`${failure}: ${describeChannelStatus(err)}`);
10170
- });
10171
- } catch (err) {
10172
- logger.error(`${failure}: ${describeChannelStatus(err)}`);
10173
- }
10174
- }
10175
- __name(runDetached, "runDetached");
10176
-
10177
- // src/server/services/mfa.service.ts
10178
- function _ts_decorate37(decorators, target, key, desc) {
10185
+ // src/server/services/mfa-record.service.ts
10186
+ function _ts_decorate38(decorators, target, key, desc) {
10179
10187
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10180
10188
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
10181
10189
  r = Reflect.decorate(decorators, target, key, desc);
@@ -10188,25 +10196,19 @@ function _ts_decorate37(decorators, target, key, desc) {
10188
10196
  }
10189
10197
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10190
10198
  }
10191
- __name(_ts_decorate37, "_ts_decorate");
10192
- function _ts_metadata36(metadataKey, metadataValue) {
10199
+ __name(_ts_decorate38, "_ts_decorate");
10200
+ function _ts_metadata37(metadataKey, metadataValue) {
10193
10201
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
10194
10202
  return Reflect.metadata(metadataKey, metadataValue);
10195
10203
  }
10196
10204
  }
10197
- __name(_ts_metadata36, "_ts_metadata");
10198
- function _ts_param21(paramIndex, decorator) {
10205
+ __name(_ts_metadata37, "_ts_metadata");
10206
+ function _ts_param22(paramIndex, decorator) {
10199
10207
  return function(target, key) {
10200
10208
  decorator(target, key, paramIndex);
10201
10209
  };
10202
10210
  }
10203
- __name(_ts_param21, "_ts_param");
10204
- var PLATFORM_EMAIL_TENANT = "platform";
10205
- function emailTenantOf(user) {
10206
- return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
10207
- }
10208
- __name(emailTenantOf, "emailTenantOf");
10209
- var MFA_SETUP_TTL_SECONDS = 600;
10211
+ __name(_ts_param22, "_ts_param");
10210
10212
  var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
10211
10213
  function totpAntiReplayTtlSeconds(window) {
10212
10214
  const effective = Math.min(Math.max(window, 0), MAX_VERIFY_WINDOW);
@@ -10218,51 +10220,21 @@ var RELEASE_LOCK_LUA = `if redis.call('GET', KEYS[1]) == ARGV[1] then
10218
10220
  return redis.call('DEL', KEYS[1])
10219
10221
  end
10220
10222
  return 0`;
10221
- var DEFAULT_RECOVERY_CODE_COUNT = 8;
10222
- var PLANE_TENANT_MESSAGE = "tenantId must be a non-empty value on the dashboard plane and absent on the platform plane";
10223
- exports.MfaService = class _MfaService {
10223
+ var MfaRecordService = class _MfaRecordService {
10224
10224
  static {
10225
- __name(this, "MfaService");
10225
+ __name(this, "MfaRecordService");
10226
10226
  }
10227
10227
  options;
10228
10228
  userRepo;
10229
10229
  platformUserRepo;
10230
10230
  redis;
10231
- tokenManager;
10232
- bruteForce;
10233
- passwordService;
10234
- sessionService;
10235
- emailProvider;
10236
- hooks;
10237
- logger = new common.Logger(_MfaService.name);
10238
- constructor(options, userRepo, platformUserRepo, redis, tokenManager, bruteForce, passwordService, sessionService, emailProvider, hooks) {
10231
+ logger = new common.Logger(_MfaRecordService.name);
10232
+ constructor(options, userRepo, platformUserRepo, redis) {
10239
10233
  this.options = options;
10240
10234
  this.userRepo = userRepo;
10241
10235
  this.platformUserRepo = platformUserRepo;
10242
10236
  this.redis = redis;
10243
- this.tokenManager = tokenManager;
10244
- this.bruteForce = bruteForce;
10245
- this.passwordService = passwordService;
10246
- this.sessionService = sessionService;
10247
- this.emailProvider = emailProvider;
10248
- this.hooks = hooks;
10249
- }
10250
- // ---------------------------------------------------------------------------
10251
- // Private accessor — options.mfa is guaranteed non-null when service is active
10252
- // ---------------------------------------------------------------------------
10253
- /**
10254
- * Returns the resolved MFA configuration. `options.mfa` is always present when `MfaService` is registered.
10255
- *
10256
- * `options.mfa` is always present when `MfaService` is registered — the module
10257
- * only registers the service when `mfa` is configured. The single suppression
10258
- * here eliminates repetitive `!` assertions throughout the class.
10259
- */
10260
- get mfaOptions() {
10261
- return this.options.mfa;
10262
10237
  }
10263
- // ---------------------------------------------------------------------------
10264
- // Private crypto helpers
10265
- // ---------------------------------------------------------------------------
10266
10238
  /**
10267
10239
  * Store the TOTP secret re-encrypted under the current key.
10268
10240
  *
@@ -10280,14 +10252,15 @@ exports.MfaService = class _MfaService {
10280
10252
  * @param context - Which identity plane the account belongs to.
10281
10253
  * @param secretBase32 - The decrypted secret.
10282
10254
  * @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
10255
+ * @param keys - The secret-cipher keys; the secret is written under the current one.
10283
10256
  */
10284
- async reencryptSecret(userId, context, secretBase32, tenantId) {
10257
+ async reencryptSecret(userId, context, secretBase32, tenantId, keys) {
10285
10258
  try {
10286
- await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10287
- if (!current.mfaEnabled || !holdsSecret(current.mfaSecret, secretBase32, this.mfaOptions)) return null;
10259
+ await this.transition(context, userId, tenantId, (current) => {
10260
+ if (!current.mfaEnabled || !holdsSecret(current.mfaSecret, secretBase32, keys)) return null;
10288
10261
  return {
10289
10262
  mfaEnabled: true,
10290
- mfaSecret: encryptMfaSecret(secretBase32, this.mfaOptions),
10263
+ mfaSecret: encryptMfaSecret(secretBase32, keys),
10291
10264
  mfaRecoveryCodes: current.mfaRecoveryCodes ?? []
10292
10265
  };
10293
10266
  });
@@ -10332,7 +10305,7 @@ exports.MfaService = class _MfaService {
10332
10305
  * @returns `true` when a write happened, `false` when `mutate` abandoned the transition.
10333
10306
  * @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
10334
10307
  */
10335
- async transitionMfaRecord(context, userId, tenantId, mutate) {
10308
+ async transition(context, userId, tenantId, mutate) {
10336
10309
  const scopedLockKey = `mfalock:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
10337
10310
  const legacyLockKey = `mfalock:${hmacSha256(`${context}:${userId}`, this.options.hmacKey)}`;
10338
10311
  const acquireLegacy = legacyLockKey !== scopedLockKey;
@@ -10349,7 +10322,7 @@ exports.MfaService = class _MfaService {
10349
10322
  throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
10350
10323
  }
10351
10324
  try {
10352
- const current = await this.fetchUserForContext(context, userId, tenantId);
10325
+ const current = await this.loadAccount(context, userId, tenantId);
10353
10326
  const update = mutate(current);
10354
10327
  if (update === null) return false;
10355
10328
  const write = {
@@ -10360,7 +10333,7 @@ exports.MfaService = class _MfaService {
10360
10333
  if (context === "platform" && this.platformUserRepo) {
10361
10334
  await this.platformUserRepo.updateMfa(userId, write);
10362
10335
  } else {
10363
- this.assertDashboardTenant(tenantId);
10336
+ assertDashboardTenant(tenantId);
10364
10337
  await this.userRepo.updateMfa({
10365
10338
  id: userId,
10366
10339
  tenantId,
@@ -10404,16 +10377,398 @@ exports.MfaService = class _MfaService {
10404
10377
  * write by much would turn a failed write into a permanently unusable code that is still
10405
10378
  * sitting in the account's list.
10406
10379
  *
10407
- * @param context - The identity plane the challenge belongs to.
10408
- * @param userId - The account the code belongs to.
10409
- * @param code - The submitted code, never stored — only its keyed MAC becomes a key.
10410
- * @returns `true` when this challenge is the one that claimed it.
10380
+ * @param context - The identity plane the challenge belongs to.
10381
+ * @param userId - The account the code belongs to.
10382
+ * @param code - The submitted code, never stored — only its keyed MAC becomes a key.
10383
+ * @returns `true` when this challenge is the one that claimed it.
10384
+ */
10385
+ async claimRecoveryCode(context, userId, code, tenantId) {
10386
+ const claimKey = `rcu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
10387
+ return await this.redis.setnx(claimKey, RECOVERY_CODE_CLAIM_TTL_SECONDS);
10388
+ }
10389
+ /**
10390
+ * Verifies a TOTP code and enforces anti-replay within the validation window.
10391
+ *
10392
+ * Stores a Redis key `tu:{hmac}` where `hmac = hmacSha256("{userSubject}:{code}", hmacKey)` —
10393
+ * so the marker is scoped to the plane and, on the dashboard plane, to the tenant. A second
10394
+ * submission of the same code within the TTL is rejected as a replay. Binding the marker to
10395
+ * both the subject and the code value prevents code disclosure in Redis and cross-user,
10396
+ * cross-tenant and cross-plane replay alike.
10397
+ *
10398
+ * A second marker under the plane-only preimage `{context}:{userId}:{code}` is written and
10399
+ * required alongside it; see the call site for why both must be fresh while pods of two
10400
+ * versions are live.
10401
+ *
10402
+ * @returns `true` if the code is valid and has not been replayed, `false` otherwise.
10403
+ */
10404
+ async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
10405
+ if (!verifyTotp(secretBase32, code, window)) return false;
10406
+ const ttl = totpAntiReplayTtlSeconds(window);
10407
+ const scopedReplayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
10408
+ const legacyReplayKey = `tu:${hmacSha256(`${context}:${userId}:${code}`, this.options.hmacKey)}`;
10409
+ const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
10410
+ if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
10411
+ const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
10412
+ return scopedIsNew && legacyIsNew;
10413
+ }
10414
+ /**
10415
+ * Fetches a user from the correct repository based on the MFA context, and refuses one whose
10416
+ * account is blocked.
10417
+ *
10418
+ * The status gate lives here rather than in each caller because every entry point that
10419
+ * reaches this method changes or spends an authentication factor, and every one of them
10420
+ * must refuse a suspended or banned account. A gate in `challenge` alone would leave `setup`,
10421
+ * `verifyAndEnable`, `disable` and `regenerateRecoveryCodes` open: an operator who suspended a
10422
+ * compromised account would buy nothing against an attacker still holding an unexpired access
10423
+ * token, who could turn the second factor off — or enrol their own authenticator over it — for
10424
+ * the token's remaining lifetime. Nothing else covers that window: no status change bumps the
10425
+ * token epoch, so the per-request check is the only defence, and neither MFA controller
10426
+ * composes `UserStatusGuard` (the platform plane has no status guard at all). Every other
10427
+ * authority-bearing route in the library does gate on status; changing an authentication
10428
+ * factor is at least as privileged as minting an invitation.
10429
+ *
10430
+ * Gating the fetch rather than the callers is deliberate: a method added later inherits the
10431
+ * check instead of having to remember it.
10432
+ *
10433
+ * @param context - Which identity plane the caller is acting on.
10434
+ * @param userId - The subject taken from the verified token.
10435
+ * @param tenantId - The tenant the caller was authenticated in, on the dashboard plane;
10436
+ * absent on the platform plane, whose admins belong to none.
10437
+ * @returns The account record, guaranteed to be in good standing.
10438
+ * @throws `TOKEN_INVALID` if the user is not found.
10439
+ * @throws {@link AuthException} the status error when the account is blocked.
10440
+ */
10441
+ async loadAccount(context, userId, tenantId) {
10442
+ if (context === "dashboard") {
10443
+ assertDashboardTenant(tenantId);
10444
+ const user = await this.userRepo.findById({
10445
+ id: userId,
10446
+ tenantId
10447
+ });
10448
+ if (!user) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
10449
+ assertNotBlocked(user.status, this.options.blockedStatuses);
10450
+ return user;
10451
+ }
10452
+ if (!this.platformUserRepo) {
10453
+ throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
10454
+ }
10455
+ const admin = await this.platformUserRepo.findById(userId);
10456
+ if (!admin) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
10457
+ assertNotBlocked(admin.status, this.options.blockedStatuses);
10458
+ return admin;
10459
+ }
10460
+ };
10461
+ MfaRecordService = _ts_decorate38([
10462
+ common.Injectable(),
10463
+ _ts_param22(0, common.Inject(BYMAX_AUTH_OPTIONS)),
10464
+ _ts_param22(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
10465
+ _ts_param22(2, common.Optional()),
10466
+ _ts_param22(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10467
+ _ts_param22(3, common.Inject(AuthRedisService)),
10468
+ _ts_metadata37("design:type", Function),
10469
+ _ts_metadata37("design:paramtypes", [
10470
+ typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
10471
+ typeof IUserRepository === "undefined" ? Object : IUserRepository,
10472
+ Object,
10473
+ typeof AuthRedisService === "undefined" ? Object : AuthRedisService
10474
+ ])
10475
+ ], MfaRecordService);
10476
+ function _ts_decorate39(decorators, target, key, desc) {
10477
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10478
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
10479
+ r = Reflect.decorate(decorators, target, key, desc);
10480
+ } else {
10481
+ for (var i = decorators.length - 1; i >= 0; i--) {
10482
+ if (d = decorators[i]) {
10483
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10484
+ }
10485
+ }
10486
+ }
10487
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10488
+ }
10489
+ __name(_ts_decorate39, "_ts_decorate");
10490
+ function _ts_metadata38(metadataKey, metadataValue) {
10491
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
10492
+ return Reflect.metadata(metadataKey, metadataValue);
10493
+ }
10494
+ }
10495
+ __name(_ts_metadata38, "_ts_metadata");
10496
+ function _ts_param23(paramIndex, decorator) {
10497
+ return function(target, key) {
10498
+ decorator(target, key, paramIndex);
10499
+ };
10500
+ }
10501
+ __name(_ts_param23, "_ts_param");
10502
+ exports.ReauthenticationService = class _ReauthenticationService {
10503
+ static {
10504
+ __name(this, "ReauthenticationService");
10505
+ }
10506
+ options;
10507
+ redis;
10508
+ passwordService;
10509
+ lockout;
10510
+ logger = new common.Logger(_ReauthenticationService.name);
10511
+ constructor(options, redis, passwordService, lockout) {
10512
+ this.options = options;
10513
+ this.redis = redis;
10514
+ this.passwordService = passwordService;
10515
+ this.lockout = lockout;
10516
+ }
10517
+ /**
10518
+ * Requires the caller to re-prove the account password before a factor is changed.
10519
+ *
10520
+ * Counted like a login, and for the same reason. `login` refuses an account after N wrong
10521
+ * passwords, and this door asks for the same secret, so it carries the same lockout: without
10522
+ * one, a caller holding a stolen access token but not the password could guess it here
10523
+ * indefinitely, bounded only by the per-route IP limit, which a distributed caller sidesteps.
10524
+ * Winning the guess buys the whole account: enrol a factor, change the password, move the
10525
+ * address.
10526
+ *
10527
+ * The identifier is namespaced by flow and by plane. Sharing one counter with `login` would
10528
+ * let an authenticated caller lock the owner out of their own sign-in, and sharing it across
10529
+ * planes would let a dashboard user and a platform admin holding the same id exhaust each
10530
+ * other's budget — the same two reasons the challenge and disable counters are split.
10531
+ *
10532
+ * @param context - The authentication plane, part of the counter's key.
10533
+ * @param userId - The account being changed, part of the counter's key.
10534
+ * @param passwordHash - The account's stored hash, or `null` for an OAuth-only account.
10535
+ * @param password - The password the caller submitted, if any.
10536
+ * @throws {@link AuthException} `ACCOUNT_LOCKED` once the failure budget for this flow is
10537
+ * spent, or `INVALID_CREDENTIALS` when the account has a password and the submitted one is
10538
+ * absent or wrong. The latter is deliberately the same code a failed login returns: an
10539
+ * attacker holding a stolen token learns nothing from it that a failed login does not tell them.
10540
+ */
10541
+ async assertReauthenticated(context, userId, passwordHash, password, tenantId) {
10542
+ if (passwordHash === null) {
10543
+ const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey, tenantId));
10544
+ if (recent === null) {
10545
+ this.logger.warn(`reauthenticate: no recent authentication userId=${logSafe(userId)} context=${context}`);
10546
+ throw new AuthException(AUTH_ERROR_CODES.REAUTHENTICATION_REQUIRED);
10547
+ }
10548
+ return;
10549
+ }
10550
+ if (await this.lockout.isLockedOut("reauth", context, userId, tenantId)) {
10551
+ this.logger.warn(`reauthenticate: account locked userId=${logSafe(userId)} context=${context}`);
10552
+ throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
10553
+ }
10554
+ const supplied = password ?? "";
10555
+ const matches = await this.passwordService.compare(supplied, passwordHash);
10556
+ if (!matches) {
10557
+ await this.lockout.recordFailure("reauth", context, userId, tenantId);
10558
+ throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
10559
+ }
10560
+ await this.lockout.reset("reauth", context, userId, tenantId);
10561
+ }
10562
+ };
10563
+ exports.ReauthenticationService = _ts_decorate39([
10564
+ common.Injectable(),
10565
+ _ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
10566
+ _ts_param23(1, common.Inject(AuthRedisService)),
10567
+ _ts_param23(2, common.Inject(PasswordService)),
10568
+ _ts_param23(3, common.Inject(MfaFlowLockoutService)),
10569
+ _ts_metadata38("design:type", Function),
10570
+ _ts_metadata38("design:paramtypes", [
10571
+ typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
10572
+ typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
10573
+ typeof PasswordService === "undefined" ? Object : PasswordService,
10574
+ typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService
10575
+ ])
10576
+ ], exports.ReauthenticationService);
10577
+ function digestRecoveryCode(code, hmacKey) {
10578
+ return hmacSha256(code, hmacKey);
10579
+ }
10580
+ __name(digestRecoveryCode, "digestRecoveryCode");
10581
+ function generateRecoveryCodes(count, hmacKey) {
10582
+ const plainCodes = [];
10583
+ const hashedCodes = [];
10584
+ for (let i = 0; i < count; i++) {
10585
+ const hex = crypto.randomBytes(12).toString("hex");
10586
+ const groups = [];
10587
+ for (let offset = 0; offset < hex.length; offset += 4) {
10588
+ groups.push(hex.slice(offset, offset + 4));
10589
+ }
10590
+ const code = groups.join("-").toUpperCase();
10591
+ plainCodes.push(code);
10592
+ hashedCodes.push(digestRecoveryCode(code, hmacKey));
10593
+ }
10594
+ return {
10595
+ plainCodes,
10596
+ hashedCodes
10597
+ };
10598
+ }
10599
+ __name(generateRecoveryCodes, "generateRecoveryCodes");
10600
+ async function verifyRecoveryCode(code, hashedCodes, hmacKey, previousHmacKeys) {
10601
+ const candidates = [
10602
+ digestRecoveryCode(code, hmacKey),
10603
+ ...previousHmacKeys.map((key) => hmacSha256(code, key))
10604
+ ];
10605
+ const macMatches = [];
10606
+ for (const hashedCode of hashedCodes) {
10607
+ const hit = candidates.reduce((found, candidate) => timingSafeCompare(candidate, hashedCode) || found, false);
10608
+ macMatches.push(hit);
10609
+ }
10610
+ return macMatches.reduce((found, hit, index) => found === -1 && hit ? index : found, -1);
10611
+ }
10612
+ __name(verifyRecoveryCode, "verifyRecoveryCode");
10613
+
10614
+ // src/server/utils/mfa-safe-user.ts
10615
+ function toSafeUser3(user) {
10616
+ const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = user;
10617
+ return safe;
10618
+ }
10619
+ __name(toSafeUser3, "toSafeUser");
10620
+ function toSafePlatformUser(admin) {
10621
+ const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = admin;
10622
+ return safe;
10623
+ }
10624
+ __name(toSafePlatformUser, "toSafePlatformUser");
10625
+ function platformUserAsSafeUser(admin) {
10626
+ const safe = toSafePlatformUser(admin);
10627
+ return {
10628
+ ...safe,
10629
+ tenantId: "",
10630
+ emailVerified: true
10631
+ };
10632
+ }
10633
+ __name(platformUserAsSafeUser, "platformUserAsSafeUser");
10634
+ function committedSafeUser(context, user, mfaEnabled) {
10635
+ const committed = {
10636
+ ...user,
10637
+ mfaEnabled
10638
+ };
10639
+ return context === "platform" ? platformUserAsSafeUser(committed) : toSafeUser3(committed);
10640
+ }
10641
+ __name(committedSafeUser, "committedSafeUser");
10642
+
10643
+ // src/server/utils/mfa-setup-data.ts
10644
+ function isMfaSetupData(value) {
10645
+ if (value === null) return false;
10646
+ if (typeof value !== "object") return false;
10647
+ const v = value;
10648
+ return typeof v["encryptedSecret"] === "string" && typeof v["encryptedPlainCodes"] === "string" && Array.isArray(v["hashedCodes"]) && v["hashedCodes"].every((code) => typeof code === "string");
10649
+ }
10650
+ __name(isMfaSetupData, "isMfaSetupData");
10651
+ function parseSetupData(raw, userId, logger) {
10652
+ let parsed;
10653
+ try {
10654
+ parsed = JSON.parse(raw);
10655
+ } catch {
10656
+ logger.warn(`parseSetupData: pending-setup payload is not valid JSON userId=${logSafe(userId)}`);
10657
+ throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10658
+ }
10659
+ if (!isMfaSetupData(parsed)) {
10660
+ throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10661
+ }
10662
+ return parsed;
10663
+ }
10664
+ __name(parseSetupData, "parseSetupData");
10665
+ function parsePlainRecoveryCodes(raw, userId, logger) {
10666
+ let parsed;
10667
+ try {
10668
+ parsed = JSON.parse(raw);
10669
+ } catch {
10670
+ logger.warn(`parsePlainRecoveryCodes: decrypted payload is not valid JSON userId=${logSafe(userId)}`);
10671
+ throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10672
+ }
10673
+ if (!Array.isArray(parsed) || parsed.some((code) => typeof code !== "string")) {
10674
+ throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10675
+ }
10676
+ return parsed;
10677
+ }
10678
+ __name(parsePlainRecoveryCodes, "parsePlainRecoveryCodes");
10679
+
10680
+ // src/server/utils/run-detached.ts
10681
+ function runDetached(logger, run, failure) {
10682
+ try {
10683
+ void Promise.resolve(run()).catch((err) => {
10684
+ logger.error(`${failure}: ${describeChannelStatus(err)}`);
10685
+ });
10686
+ } catch (err) {
10687
+ logger.error(`${failure}: ${describeChannelStatus(err)}`);
10688
+ }
10689
+ }
10690
+ __name(runDetached, "runDetached");
10691
+
10692
+ // src/server/services/mfa.service.ts
10693
+ function _ts_decorate40(decorators, target, key, desc) {
10694
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10695
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
10696
+ r = Reflect.decorate(decorators, target, key, desc);
10697
+ } else {
10698
+ for (var i = decorators.length - 1; i >= 0; i--) {
10699
+ if (d = decorators[i]) {
10700
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10701
+ }
10702
+ }
10703
+ }
10704
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10705
+ }
10706
+ __name(_ts_decorate40, "_ts_decorate");
10707
+ function _ts_metadata39(metadataKey, metadataValue) {
10708
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
10709
+ return Reflect.metadata(metadataKey, metadataValue);
10710
+ }
10711
+ }
10712
+ __name(_ts_metadata39, "_ts_metadata");
10713
+ function _ts_param24(paramIndex, decorator) {
10714
+ return function(target, key) {
10715
+ decorator(target, key, paramIndex);
10716
+ };
10717
+ }
10718
+ __name(_ts_param24, "_ts_param");
10719
+ var PLATFORM_EMAIL_TENANT = "platform";
10720
+ function emailTenantOf(user) {
10721
+ return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
10722
+ }
10723
+ __name(emailTenantOf, "emailTenantOf");
10724
+ var MFA_SETUP_TTL_SECONDS = 600;
10725
+ var DEFAULT_RECOVERY_CODE_COUNT = 8;
10726
+ exports.MfaService = class _MfaService {
10727
+ static {
10728
+ __name(this, "MfaService");
10729
+ }
10730
+ options;
10731
+ userRepo;
10732
+ platformUserRepo;
10733
+ redis;
10734
+ tokenManager;
10735
+ records;
10736
+ flowLockout;
10737
+ reauthentication;
10738
+ sessionService;
10739
+ emailProvider;
10740
+ hooks;
10741
+ logger = new common.Logger(_MfaService.name);
10742
+ constructor(options, userRepo, platformUserRepo, redis, tokenManager, records, flowLockout, reauthentication, sessionService, emailProvider, hooks) {
10743
+ this.options = options;
10744
+ this.userRepo = userRepo;
10745
+ this.platformUserRepo = platformUserRepo;
10746
+ this.redis = redis;
10747
+ this.tokenManager = tokenManager;
10748
+ this.records = records;
10749
+ this.flowLockout = flowLockout;
10750
+ this.reauthentication = reauthentication;
10751
+ this.sessionService = sessionService;
10752
+ this.emailProvider = emailProvider;
10753
+ this.hooks = hooks;
10754
+ }
10755
+ // ---------------------------------------------------------------------------
10756
+ // Private accessor — options.mfa is guaranteed non-null when service is active
10757
+ // ---------------------------------------------------------------------------
10758
+ /**
10759
+ * Returns the resolved MFA configuration. `options.mfa` is always present when `MfaService` is registered.
10760
+ *
10761
+ * `options.mfa` is always present when `MfaService` is registered — the module
10762
+ * only registers the service when `mfa` is configured. The single suppression
10763
+ * here eliminates repetitive `!` assertions throughout the class.
10411
10764
  */
10412
- async claimRecoveryCode(context, userId, code, tenantId) {
10413
- const claimKey = `rcu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
10414
- return await this.redis.setnx(claimKey, RECOVERY_CODE_CLAIM_TTL_SECONDS);
10765
+ get mfaOptions() {
10766
+ return this.options.mfa;
10415
10767
  }
10416
10768
  // ---------------------------------------------------------------------------
10769
+ // Private crypto helpers
10770
+ // ---------------------------------------------------------------------------
10771
+ // ---------------------------------------------------------------------------
10417
10772
  // setup — TOTP secret generation, idempotent key reservation, recovery codes
10418
10773
  // ---------------------------------------------------------------------------
10419
10774
  /**
@@ -10437,13 +10792,13 @@ exports.MfaService = class _MfaService {
10437
10792
  * meaning is the same: "platform MFA cannot operate".
10438
10793
  */
10439
10794
  async setup(userId, context = "dashboard", password, tenantId) {
10440
- this.assertPlaneTenant(context, tenantId);
10795
+ assertPlaneTenant(context, tenantId);
10441
10796
  if (context === "platform" && !this.platformUserRepo) {
10442
10797
  throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
10443
10798
  }
10444
- const user = await this.fetchUserForContext(context, userId, tenantId);
10799
+ const user = await this.records.loadAccount(context, userId, tenantId);
10445
10800
  if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
10446
- await this.assertReauthenticated(context, userId, user.passwordHash, password, tenantId);
10801
+ await this.reauthentication.assertReauthenticated(context, userId, user.passwordHash, password, tenantId);
10447
10802
  const setupKey = `mfa_setup:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
10448
10803
  const existingFast = await this.redis.get(setupKey);
10449
10804
  if (existingFast !== null) {
@@ -10518,11 +10873,11 @@ exports.MfaService = class _MfaService {
10518
10873
  * repository was not configured at module registration.
10519
10874
  */
10520
10875
  async verifyAndEnable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
10521
- this.assertPlaneTenant(context, tenantId);
10876
+ assertPlaneTenant(context, tenantId);
10522
10877
  if (context === "platform" && !this.platformUserRepo) {
10523
10878
  throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
10524
10879
  }
10525
- const user = await this.fetchUserForContext(context, userId, tenantId);
10880
+ const user = await this.records.loadAccount(context, userId, tenantId);
10526
10881
  if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
10527
10882
  const setupKey = `mfa_setup:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
10528
10883
  const raw = await this.redis.get(setupKey);
@@ -10530,7 +10885,7 @@ exports.MfaService = class _MfaService {
10530
10885
  const data = parseSetupData(raw, userId, this.logger);
10531
10886
  const secretBase32 = decryptMfaSecret(data.encryptedSecret, this.mfaOptions);
10532
10887
  const totpWindow = this.mfaOptions.totpWindow;
10533
- const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
10888
+ const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
10534
10889
  if (!codeValid) {
10535
10890
  this.logger.warn(`verifyAndEnable: invalid TOTP code userId=${logSafe(userId)}`);
10536
10891
  throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
@@ -10540,7 +10895,7 @@ exports.MfaService = class _MfaService {
10540
10895
  this.logger.warn(`verifyAndEnable: setup key consumed by concurrent request userId=${logSafe(userId)}`);
10541
10896
  throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
10542
10897
  }
10543
- await this.transitionMfaRecord(context, userId, tenantId, () => ({
10898
+ await this.records.transition(context, userId, tenantId, () => ({
10544
10899
  mfaEnabled: true,
10545
10900
  mfaSecret: data.encryptedSecret,
10546
10901
  mfaRecoveryCodes: data.hashedCodes
@@ -10584,11 +10939,11 @@ exports.MfaService = class _MfaService {
10584
10939
  */
10585
10940
  async challenge(mfaTempToken, code, ip, userAgent) {
10586
10941
  const { userId, context, tenantId, jti: tempTokenJti } = await this.tokenManager.verifyMfaTempToken(mfaTempToken);
10587
- if (await this.isMfaFlowLockedOut("challenge", context, userId, tenantId)) {
10942
+ if (await this.flowLockout.isLockedOut("challenge", context, userId, tenantId)) {
10588
10943
  this.logger.warn(`challenge: account locked userId=${logSafe(userId)}`);
10589
10944
  throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
10590
10945
  }
10591
- const user = await this.fetchUserForContext(context, userId, tenantId);
10946
+ const user = await this.records.loadAccount(context, userId, tenantId);
10592
10947
  if (!user.mfaEnabled || !user.mfaSecret) {
10593
10948
  throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
10594
10949
  }
@@ -10598,18 +10953,18 @@ exports.MfaService = class _MfaService {
10598
10953
  let codeValid = false;
10599
10954
  let usedRecoveryIndex = -1;
10600
10955
  if (isTotpCode) {
10601
- codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
10956
+ codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
10602
10957
  } else {
10603
10958
  const recoveryCodes = user.mfaRecoveryCodes ?? [];
10604
10959
  usedRecoveryIndex = await verifyRecoveryCode(code, recoveryCodes, this.options.hmacKey, this.options.previousHmacKeys);
10605
- codeValid = usedRecoveryIndex >= 0 && await this.claimRecoveryCode(context, userId, code, tenantId);
10960
+ codeValid = usedRecoveryIndex >= 0 && await this.records.claimRecoveryCode(context, userId, code, tenantId);
10606
10961
  }
10607
10962
  if (!codeValid) {
10608
- await this.recordMfaFlowFailure("challenge", context, userId, tenantId);
10963
+ await this.flowLockout.recordFailure("challenge", context, userId, tenantId);
10609
10964
  this.logger.warn(`challenge: invalid MFA code userId=${logSafe(userId)} context=${context}`);
10610
10965
  throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
10611
10966
  }
10612
- await this.resetMfaFlowFailures("challenge", context, userId, tenantId);
10967
+ await this.flowLockout.reset("challenge", context, userId, tenantId);
10613
10968
  if (!await this.tokenManager.consumeMfaTempToken(tempTokenJti)) {
10614
10969
  throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
10615
10970
  }
@@ -10618,7 +10973,7 @@ exports.MfaService = class _MfaService {
10618
10973
  // Stryker disable next-line ArrayDeclaration: unreachable — this branch is only taken
10619
10974
  // when `verifyRecoveryCode` matched a code inside an array it had to iterate first.
10620
10975
  [];
10621
- await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10976
+ await this.records.transition(context, userId, tenantId, (current) => {
10622
10977
  if (!current.mfaEnabled) return null;
10623
10978
  if (!holdsSecret(current.mfaSecret, secretBase32, this.mfaOptions)) return null;
10624
10979
  const currentCodes = current.mfaRecoveryCodes ?? [];
@@ -10638,7 +10993,7 @@ exports.MfaService = class _MfaService {
10638
10993
  };
10639
10994
  });
10640
10995
  } else if (encryptedUnderRetiredKey) {
10641
- void this.reencryptSecret(userId, context, secretBase32, tenantId);
10996
+ void this.records.reencryptSecret(userId, context, secretBase32, tenantId, this.mfaOptions);
10642
10997
  }
10643
10998
  this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
10644
10999
  if (context === "dashboard") {
@@ -10747,10 +11102,10 @@ exports.MfaService = class _MfaService {
10747
11102
  * @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
10748
11103
  */
10749
11104
  async disable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
10750
- this.assertPlaneTenant(context, tenantId);
10751
- const user = await this.fetchUserForContext(context, userId, tenantId);
11105
+ assertPlaneTenant(context, tenantId);
11106
+ const user = await this.records.loadAccount(context, userId, tenantId);
10752
11107
  if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
10753
- if (await this.isMfaFlowLockedOut("disable", context, userId, tenantId)) {
11108
+ if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
10754
11109
  this.logger.warn(`disable: account locked userId=${logSafe(userId)} context=${context}`);
10755
11110
  throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
10756
11111
  }
@@ -10759,14 +11114,14 @@ exports.MfaService = class _MfaService {
10759
11114
  }
10760
11115
  const secretBase32 = decryptMfaSecret(user.mfaSecret, this.mfaOptions);
10761
11116
  const totpWindow = this.mfaOptions.totpWindow;
10762
- const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
11117
+ const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
10763
11118
  if (!codeValid) {
10764
- await this.recordMfaFlowFailure("disable", context, userId, tenantId);
11119
+ await this.flowLockout.recordFailure("disable", context, userId, tenantId);
10765
11120
  this.logger.warn(`disable: invalid MFA code userId=${logSafe(userId)} context=${context}`);
10766
11121
  throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
10767
11122
  }
10768
- await this.resetMfaFlowFailures("disable", context, userId, tenantId);
10769
- await this.transitionMfaRecord(context, userId, tenantId, () => ({
11123
+ await this.flowLockout.reset("disable", context, userId, tenantId);
11124
+ await this.records.transition(context, userId, tenantId, () => ({
10770
11125
  mfaEnabled: false,
10771
11126
  mfaSecret: null,
10772
11127
  mfaRecoveryCodes: null
@@ -10828,13 +11183,13 @@ exports.MfaService = class _MfaService {
10828
11183
  * @throws `TOKEN_INVALID` if no user with that ID exists in the given plane.
10829
11184
  */
10830
11185
  async resetMfa(userId, context = "dashboard", tenantId) {
10831
- this.assertPlaneTenant(context, tenantId);
10832
- const user = await this.fetchUserForContext(context, userId, tenantId);
11186
+ assertPlaneTenant(context, tenantId);
11187
+ const user = await this.records.loadAccount(context, userId, tenantId);
10833
11188
  if (!user.mfaEnabled) {
10834
11189
  this.logger.log(`resetMfa: no second factor to remove userId=${logSafe(userId)} context=${context}`);
10835
11190
  return;
10836
11191
  }
10837
- await this.transitionMfaRecord(context, userId, tenantId, () => ({
11192
+ await this.records.transition(context, userId, tenantId, () => ({
10838
11193
  mfaEnabled: false,
10839
11194
  mfaSecret: null,
10840
11195
  mfaRecoveryCodes: null
@@ -10897,13 +11252,13 @@ exports.MfaService = class _MfaService {
10897
11252
  * @returns The freshly generated plain-text recovery codes, one-time display.
10898
11253
  */
10899
11254
  async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard", tenantId) {
10900
- this.assertPlaneTenant(context, tenantId);
11255
+ assertPlaneTenant(context, tenantId);
10901
11256
  if (context === "platform" && !this.platformUserRepo) {
10902
11257
  throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
10903
11258
  }
10904
- const user = await this.fetchUserForContext(context, userId, tenantId);
11259
+ const user = await this.records.loadAccount(context, userId, tenantId);
10905
11260
  if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
10906
- if (await this.isMfaFlowLockedOut("disable", context, userId, tenantId)) {
11261
+ if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
10907
11262
  this.logger.warn(`regenerateRecoveryCodes: account locked userId=${logSafe(userId)} context=${context}`);
10908
11263
  throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
10909
11264
  }
@@ -10912,16 +11267,16 @@ exports.MfaService = class _MfaService {
10912
11267
  }
10913
11268
  const secretBase32 = decryptMfaSecret(user.mfaSecret, this.mfaOptions);
10914
11269
  const totpWindow = this.mfaOptions.totpWindow;
10915
- const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow, tenantId);
11270
+ const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow, tenantId);
10916
11271
  if (!codeValid) {
10917
- await this.recordMfaFlowFailure("disable", context, userId, tenantId);
11272
+ await this.flowLockout.recordFailure("disable", context, userId, tenantId);
10918
11273
  this.logger.warn(`regenerateRecoveryCodes: invalid MFA code userId=${logSafe(userId)} context=${context}`);
10919
11274
  throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
10920
11275
  }
10921
- await this.resetMfaFlowFailures("disable", context, userId, tenantId);
11276
+ await this.flowLockout.reset("disable", context, userId, tenantId);
10922
11277
  const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
10923
11278
  const { plainCodes, hashedCodes } = generateRecoveryCodes(recoveryCount, this.options.hmacKey);
10924
- const replaced = await this.transitionMfaRecord(context, userId, tenantId, (current) => {
11279
+ const replaced = await this.records.transition(context, userId, tenantId, (current) => {
10925
11280
  if (!current.mfaEnabled) return null;
10926
11281
  return {
10927
11282
  mfaEnabled: true,
@@ -10949,175 +11304,6 @@ exports.MfaService = class _MfaService {
10949
11304
  // Private helpers
10950
11305
  // ---------------------------------------------------------------------------
10951
11306
  /**
10952
- * Verifies a TOTP code and enforces anti-replay within the validation window.
10953
- *
10954
- * Stores a Redis key `tu:{hmac}` where `hmac = hmacSha256("{userSubject}:{code}", hmacKey)` —
10955
- * so the marker is scoped to the plane and, on the dashboard plane, to the tenant. A second
10956
- * submission of the same code within the TTL is rejected as a replay. Binding the marker to
10957
- * both the subject and the code value prevents code disclosure in Redis and cross-user,
10958
- * cross-tenant and cross-plane replay alike.
10959
- *
10960
- * A second marker under the pre-scoping preimage `{context}:{userId}:{code}` is written and
10961
- * required alongside it; see the call site for why both must be fresh during a rolling upgrade.
10962
- *
10963
- * @returns `true` if the code is valid and has not been replayed, `false` otherwise.
10964
- */
10965
- async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
10966
- if (!verifyTotp(secretBase32, code, window)) return false;
10967
- const ttl = totpAntiReplayTtlSeconds(window);
10968
- const scopedReplayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
10969
- const legacyReplayKey = `tu:${hmacSha256(`${context}:${userId}:${code}`, this.options.hmacKey)}`;
10970
- const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
10971
- if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
10972
- const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
10973
- return scopedIsNew && legacyIsNew;
10974
- }
10975
- /**
10976
- * Requires the caller to re-prove the account password before a factor is changed.
10977
- *
10978
- * Counted like a login, and for the same reason. `login` refuses an account after N wrong
10979
- * passwords; this door asks for the same secret and used to refuse nothing, so a caller
10980
- * holding a stolen access token but not the password could guess it here indefinitely. The
10981
- * only control left was the per-route IP limit, which a distributed caller sidesteps — and
10982
- * winning the guess buys the whole account: enrol a factor, change the password, move the
10983
- * address. A door that takes the password has to carry the password's lockout.
10984
- *
10985
- * The identifier is namespaced by flow and by plane. Sharing one counter with `login` would
10986
- * let an authenticated caller lock the owner out of their own sign-in, and sharing it across
10987
- * planes would let a dashboard user and a platform admin holding the same id exhaust each
10988
- * other's budget — the same two reasons the challenge and disable counters are split.
10989
- *
10990
- * @param context - The authentication plane, part of the counter's key.
10991
- * @param userId - The account being changed, part of the counter's key.
10992
- * @param passwordHash - The account's stored hash, or `null` for an OAuth-only account.
10993
- * @param password - The password the caller submitted, if any.
10994
- * @throws {@link AuthException} `ACCOUNT_LOCKED` once the failure budget for this flow is
10995
- * spent, or `INVALID_CREDENTIALS` when the account has a password and the submitted one is
10996
- * absent or wrong. The latter is deliberately the same code a failed login returns: an
10997
- * attacker holding a stolen token learns nothing from it beyond what they already knew.
10998
- */
10999
- async assertReauthenticated(context, userId, passwordHash, password, tenantId) {
11000
- if (passwordHash === null) {
11001
- const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey, tenantId));
11002
- if (recent === null) {
11003
- this.logger.warn(`reauthenticate: no recent authentication userId=${logSafe(userId)} context=${context}`);
11004
- throw new AuthException(AUTH_ERROR_CODES.REAUTHENTICATION_REQUIRED);
11005
- }
11006
- return;
11007
- }
11008
- if (await this.isMfaFlowLockedOut("reauth", context, userId, tenantId)) {
11009
- this.logger.warn(`reauthenticate: account locked userId=${logSafe(userId)} context=${context}`);
11010
- throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
11011
- }
11012
- const supplied = password ?? "";
11013
- const matches = await this.passwordService.compare(supplied, passwordHash);
11014
- if (!matches) {
11015
- await this.recordMfaFlowFailure("reauth", context, userId, tenantId);
11016
- throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
11017
- }
11018
- await this.resetMfaFlowFailures("reauth", context, userId, tenantId);
11019
- }
11020
- /**
11021
- * Asserts a dashboard-plane call carries a tenant, narrowing it to `string` for the caller.
11022
- *
11023
- * This is the dashboard half of {@link assertPlaneTenant}, split out for one reason: an
11024
- * assertion signature is the only way to state "past this point the tenant is present" to the
11025
- * type system. `IUserRepository.findById` requires the tenant, and the account read behind the
11026
- * MFA flows sits under a `context === 'dashboard'` branch where a `void` guard run earlier in
11027
- * the caller has narrowed nothing. Without this the branch had to pass `string | undefined`
11028
- * into a `string` parameter, which is precisely the tenant-blind read the guard exists to stop.
11029
- *
11030
- * @param tenantId - The tenant supplied by the caller, if any.
11031
- * @throws {@link AuthException} `VALIDATION` (400) when it is missing or blank.
11032
- */
11033
- assertDashboardTenant(tenantId) {
11034
- if (tenantId === void 0 || tenantId === "") {
11035
- throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
11036
- {
11037
- field: "tenantId",
11038
- message: PLANE_TENANT_MESSAGE
11039
- }
11040
- ]);
11041
- }
11042
- }
11043
- /**
11044
- * A dashboard MFA flow MUST carry the tenant it was authenticated in; a platform flow MUST NOT.
11045
- *
11046
- * The controller sources the tenant from the verified JWT, which always carries a validated
11047
- * `tenantId`, so this never trips through the HTTP surface. It guards the OTHER caller:
11048
- * `MfaService` is a public API, and a host wiring it directly — or a future SSO path — could hand
11049
- * a dashboard `userId` with no tenant, which would silently reach the tenant-blind account read
11050
- * and key derivation. Refuse it here, naming the field, rather than let it degrade to the
11051
- * pre-tenant behaviour, which is exactly the fallback an attacker would aim for.
11052
- *
11053
- * @param context - The identity plane the call is on.
11054
- * @param tenantId - The tenant supplied by the caller, if any.
11055
- * @throws {@link AuthException} `VALIDATION` (400) when a dashboard call omits the tenant, or a
11056
- * platform call supplies one.
11057
- */
11058
- assertPlaneTenant(context, tenantId) {
11059
- if (context === "dashboard") {
11060
- this.assertDashboardTenant(tenantId);
11061
- return;
11062
- }
11063
- if (tenantId !== void 0) {
11064
- throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
11065
- {
11066
- field: "tenantId",
11067
- message: PLANE_TENANT_MESSAGE
11068
- }
11069
- ]);
11070
- }
11071
- }
11072
- /**
11073
- * The tenant-scoped brute-force identifier for one MFA flow, and the legacy plane-only one it
11074
- * replaces — equal on the platform plane, where the subject never carried a tenant, and distinct
11075
- * on the dashboard plane, where it now does.
11076
- *
11077
- * A rolling upgrade runs old and new code against one Redis at once: on the dashboard plane an
11078
- * old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
11079
- * `{flow}:{userSubject}`, and either alone leaves a hole — a lockout an old pod filled would not
11080
- * stop a new pod, and a success on one would not clear the other. For one release every read
11081
- * consults both and every write touches both, so the two move as one; a later release drops the
11082
- * legacy arm. On the platform plane the two ids are identical (no tenant ever entered the
11083
- * subject), so the legacy arm is skipped — operating it would just be the same key a second time,
11084
- * double-counting a failure and locking a platform admin out at half the threshold. `{flow}`
11085
- * (`challenge` / `disable` / `reauth`) keeps the three counters isolated, exactly as before.
11086
- */
11087
- mfaFlowCounterIds(flow, context, userId, tenantId) {
11088
- return {
11089
- legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
11090
- scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
11091
- };
11092
- }
11093
- /**
11094
- * Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
11095
- * neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
11096
- */
11097
- async isMfaFlowLockedOut(flow, context, userId, tenantId) {
11098
- const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
11099
- if (await this.bruteForce.isLockedOut(scoped)) return true;
11100
- return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
11101
- }
11102
- /**
11103
- * Records the failure under both counters so the budget an attacker spends is seen by old and
11104
- * new code alike — but under the scoped id ONCE when the two coincide (platform plane).
11105
- */
11106
- async recordMfaFlowFailure(flow, context, userId, tenantId) {
11107
- const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
11108
- await this.bruteForce.recordFailure(scoped);
11109
- if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
11110
- }
11111
- /**
11112
- * Clears both counters on success — resetting only one would leave the other to lock a
11113
- * legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
11114
- */
11115
- async resetMfaFlowFailures(flow, context, userId, tenantId) {
11116
- const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
11117
- await this.bruteForce.resetFailures(scoped);
11118
- if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
11119
- }
11120
- /**
11121
11307
  * Sends an MFA state-change notice, fire-and-forget, with the recipient kept out of the log.
11122
11308
  *
11123
11309
  * **Not awaited, and that is the fix, not a shortcut.** These three sends used to be awaited
@@ -11155,76 +11341,31 @@ exports.MfaService = class _MfaService {
11155
11341
  }
11156
11342
  })();
11157
11343
  }
11158
- /**
11159
- * Fetches a user from the correct repository based on the MFA context, and refuses one whose
11160
- * account is blocked.
11161
- *
11162
- * The status gate lives here rather than in each caller because every entry point that
11163
- * reaches this method changes or spends an authentication factor, and every one of them
11164
- * must refuse a suspended or banned account. It used to live in `challenge` alone, so
11165
- * `setup`, `verifyAndEnable`, `disable` and `regenerateRecoveryCodes` had no gate at all:
11166
- * an operator who suspended a compromised account bought nothing against an attacker still
11167
- * holding an unexpired access token, who could turn the second factor off — or enrol their
11168
- * own authenticator over it — for the token's remaining lifetime. Nothing else covers that
11169
- * window: no status change bumps the token epoch, so the per-request check is the only
11170
- * defence, and neither MFA controller composes `UserStatusGuard` (the platform plane has no
11171
- * status guard at all). Every other authority-bearing route in the library does gate on
11172
- * status; changing an authentication factor is at least as privileged as minting an
11173
- * invitation.
11174
- *
11175
- * Gating the fetch rather than the callers is deliberate: a method added later inherits the
11176
- * check instead of having to remember it.
11177
- *
11178
- * @param context - Which identity plane the caller is acting on.
11179
- * @param userId - The subject taken from the verified token.
11180
- * @param tenantId - The tenant the caller was authenticated in, on the dashboard plane;
11181
- * absent on the platform plane, whose admins belong to none.
11182
- * @returns The account record, guaranteed to be in good standing.
11183
- * @throws `TOKEN_INVALID` if the user is not found.
11184
- * @throws {@link AuthException} the status error when the account is blocked.
11185
- */
11186
- async fetchUserForContext(context, userId, tenantId) {
11187
- if (context === "dashboard") {
11188
- this.assertDashboardTenant(tenantId);
11189
- const user = await this.userRepo.findById({
11190
- id: userId,
11191
- tenantId
11192
- });
11193
- if (!user) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
11194
- assertNotBlocked(user.status, this.options.blockedStatuses);
11195
- return user;
11196
- }
11197
- if (!this.platformUserRepo) {
11198
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
11199
- }
11200
- const admin = await this.platformUserRepo.findById(userId);
11201
- if (!admin) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
11202
- assertNotBlocked(admin.status, this.options.blockedStatuses);
11203
- return admin;
11204
- }
11205
11344
  };
11206
- exports.MfaService = _ts_decorate37([
11345
+ exports.MfaService = _ts_decorate40([
11207
11346
  common.Injectable(),
11208
- _ts_param21(0, common.Inject(BYMAX_AUTH_OPTIONS)),
11209
- _ts_param21(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
11210
- _ts_param21(2, common.Optional()),
11211
- _ts_param21(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
11212
- _ts_param21(3, common.Inject(AuthRedisService)),
11213
- _ts_param21(4, common.Inject(TokenManagerService)),
11214
- _ts_param21(5, common.Inject(exports.BruteForceService)),
11215
- _ts_param21(6, common.Inject(PasswordService)),
11216
- _ts_param21(7, common.Inject(exports.SessionService)),
11217
- _ts_param21(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
11218
- _ts_param21(9, common.Inject(BYMAX_AUTH_HOOKS)),
11219
- _ts_metadata36("design:type", Function),
11220
- _ts_metadata36("design:paramtypes", [
11347
+ _ts_param24(0, common.Inject(BYMAX_AUTH_OPTIONS)),
11348
+ _ts_param24(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
11349
+ _ts_param24(2, common.Optional()),
11350
+ _ts_param24(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
11351
+ _ts_param24(3, common.Inject(AuthRedisService)),
11352
+ _ts_param24(4, common.Inject(TokenManagerService)),
11353
+ _ts_param24(5, common.Inject(MfaRecordService)),
11354
+ _ts_param24(6, common.Inject(MfaFlowLockoutService)),
11355
+ _ts_param24(7, common.Inject(exports.ReauthenticationService)),
11356
+ _ts_param24(8, common.Inject(exports.SessionService)),
11357
+ _ts_param24(9, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
11358
+ _ts_param24(10, common.Inject(BYMAX_AUTH_HOOKS)),
11359
+ _ts_metadata39("design:type", Function),
11360
+ _ts_metadata39("design:paramtypes", [
11221
11361
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
11222
11362
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
11223
11363
  Object,
11224
11364
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
11225
11365
  typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
11226
- typeof exports.BruteForceService === "undefined" ? Object : exports.BruteForceService,
11227
- typeof PasswordService === "undefined" ? Object : PasswordService,
11366
+ typeof MfaRecordService === "undefined" ? Object : MfaRecordService,
11367
+ typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService,
11368
+ typeof exports.ReauthenticationService === "undefined" ? Object : exports.ReauthenticationService,
11228
11369
  typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
11229
11370
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
11230
11371
  typeof IAuthHooks === "undefined" ? Object : IAuthHooks
@@ -11232,7 +11373,7 @@ exports.MfaService = _ts_decorate37([
11232
11373
  ], exports.MfaService);
11233
11374
 
11234
11375
  // src/server/controllers/mfa.controller.ts
11235
- function _ts_decorate38(decorators, target, key, desc) {
11376
+ function _ts_decorate41(decorators, target, key, desc) {
11236
11377
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11237
11378
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11238
11379
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11245,19 +11386,19 @@ function _ts_decorate38(decorators, target, key, desc) {
11245
11386
  }
11246
11387
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11247
11388
  }
11248
- __name(_ts_decorate38, "_ts_decorate");
11249
- function _ts_metadata37(metadataKey, metadataValue) {
11389
+ __name(_ts_decorate41, "_ts_decorate");
11390
+ function _ts_metadata40(metadataKey, metadataValue) {
11250
11391
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11251
11392
  return Reflect.metadata(metadataKey, metadataValue);
11252
11393
  }
11253
11394
  }
11254
- __name(_ts_metadata37, "_ts_metadata");
11255
- function _ts_param22(paramIndex, decorator) {
11395
+ __name(_ts_metadata40, "_ts_metadata");
11396
+ function _ts_param25(paramIndex, decorator) {
11256
11397
  return function(target, key) {
11257
11398
  decorator(target, key, paramIndex);
11258
11399
  };
11259
11400
  }
11260
- __name(_ts_param22, "_ts_param");
11401
+ __name(_ts_param25, "_ts_param");
11261
11402
  function isPlatformResult(result) {
11262
11403
  return "admin" in result;
11263
11404
  }
@@ -11446,111 +11587,111 @@ var MfaController = class {
11446
11587
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
11447
11588
  }
11448
11589
  };
11449
- _ts_decorate38([
11590
+ _ts_decorate41([
11450
11591
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11451
11592
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
11452
11593
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
11453
11594
  RequestEncoding("when-body"),
11454
11595
  common.Post("setup"),
11455
- _ts_param22(0, CurrentUser()),
11456
- _ts_param22(1, common.Body()),
11457
- _ts_metadata37("design:type", Function),
11458
- _ts_metadata37("design:paramtypes", [
11596
+ _ts_param25(0, CurrentUser()),
11597
+ _ts_param25(1, common.Body()),
11598
+ _ts_metadata40("design:type", Function),
11599
+ _ts_metadata40("design:paramtypes", [
11459
11600
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11460
11601
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
11461
11602
  ]),
11462
- _ts_metadata37("design:returntype", Promise)
11603
+ _ts_metadata40("design:returntype", Promise)
11463
11604
  ], MfaController.prototype, "setup", null);
11464
- _ts_decorate38([
11605
+ _ts_decorate41([
11465
11606
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11466
11607
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11467
11608
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11468
11609
  common.HttpCode(common.HttpStatus.NO_CONTENT),
11469
11610
  common.Post("verify-enable"),
11470
- _ts_param22(0, CurrentUser()),
11471
- _ts_param22(1, common.Body()),
11472
- _ts_param22(2, common.Req()),
11473
- _ts_metadata37("design:type", Function),
11474
- _ts_metadata37("design:paramtypes", [
11611
+ _ts_param25(0, CurrentUser()),
11612
+ _ts_param25(1, common.Body()),
11613
+ _ts_param25(2, common.Req()),
11614
+ _ts_metadata40("design:type", Function),
11615
+ _ts_metadata40("design:paramtypes", [
11475
11616
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11476
11617
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
11477
11618
  typeof Request === "undefined" ? Object : Request
11478
11619
  ]),
11479
- _ts_metadata37("design:returntype", Promise)
11620
+ _ts_metadata40("design:returntype", Promise)
11480
11621
  ], MfaController.prototype, "verifyEnable", null);
11481
- _ts_decorate38([
11622
+ _ts_decorate41([
11482
11623
  Public(),
11483
11624
  SkipMfa(),
11484
11625
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
11485
11626
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
11486
11627
  common.HttpCode(common.HttpStatus.OK),
11487
11628
  common.Post("challenge"),
11488
- _ts_param22(0, common.Body()),
11489
- _ts_param22(1, common.Req()),
11490
- _ts_param22(2, common.Res({
11629
+ _ts_param25(0, common.Body()),
11630
+ _ts_param25(1, common.Req()),
11631
+ _ts_param25(2, common.Res({
11491
11632
  passthrough: true
11492
11633
  })),
11493
- _ts_metadata37("design:type", Function),
11494
- _ts_metadata37("design:paramtypes", [
11634
+ _ts_metadata40("design:type", Function),
11635
+ _ts_metadata40("design:paramtypes", [
11495
11636
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
11496
11637
  typeof Request === "undefined" ? Object : Request,
11497
11638
  typeof Response === "undefined" ? Object : Response
11498
11639
  ]),
11499
- _ts_metadata37("design:returntype", Promise)
11640
+ _ts_metadata40("design:returntype", Promise)
11500
11641
  ], MfaController.prototype, "challenge", null);
11501
- _ts_decorate38([
11642
+ _ts_decorate41([
11502
11643
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11503
11644
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11504
11645
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
11505
11646
  common.HttpCode(common.HttpStatus.NO_CONTENT),
11506
11647
  common.Post("disable"),
11507
- _ts_param22(0, CurrentUser()),
11508
- _ts_param22(1, common.Body()),
11509
- _ts_param22(2, common.Req()),
11510
- _ts_metadata37("design:type", Function),
11511
- _ts_metadata37("design:paramtypes", [
11648
+ _ts_param25(0, CurrentUser()),
11649
+ _ts_param25(1, common.Body()),
11650
+ _ts_param25(2, common.Req()),
11651
+ _ts_metadata40("design:type", Function),
11652
+ _ts_metadata40("design:paramtypes", [
11512
11653
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11513
11654
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
11514
11655
  typeof Request === "undefined" ? Object : Request
11515
11656
  ]),
11516
- _ts_metadata37("design:returntype", Promise)
11657
+ _ts_metadata40("design:returntype", Promise)
11517
11658
  ], MfaController.prototype, "disable", null);
11518
- _ts_decorate38([
11659
+ _ts_decorate41([
11519
11660
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11520
11661
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11521
11662
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
11522
11663
  common.HttpCode(common.HttpStatus.OK),
11523
11664
  common.Post("recovery-codes"),
11524
- _ts_param22(0, CurrentUser()),
11525
- _ts_param22(1, common.Body()),
11526
- _ts_param22(2, common.Req()),
11527
- _ts_metadata37("design:type", Function),
11528
- _ts_metadata37("design:paramtypes", [
11665
+ _ts_param25(0, CurrentUser()),
11666
+ _ts_param25(1, common.Body()),
11667
+ _ts_param25(2, common.Req()),
11668
+ _ts_metadata40("design:type", Function),
11669
+ _ts_metadata40("design:paramtypes", [
11529
11670
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11530
11671
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
11531
11672
  typeof Request === "undefined" ? Object : Request
11532
11673
  ]),
11533
- _ts_metadata37("design:returntype", Promise)
11674
+ _ts_metadata40("design:returntype", Promise)
11534
11675
  ], MfaController.prototype, "regenerateRecoveryCodes", null);
11535
- MfaController = _ts_decorate38([
11676
+ MfaController = _ts_decorate41([
11536
11677
  common.UseInterceptors(NoStoreInterceptor),
11537
11678
  common.Controller("mfa"),
11538
11679
  common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11539
11680
  common.UsePipes(createAuthValidationPipe({
11540
11681
  forbidUnknownValues: true
11541
11682
  })),
11542
- _ts_param22(0, common.Inject(exports.MfaService)),
11543
- _ts_param22(1, common.Inject(exports.TokenDeliveryService)),
11544
- _ts_param22(2, common.Inject(BYMAX_AUTH_OPTIONS)),
11545
- _ts_metadata37("design:type", Function),
11546
- _ts_metadata37("design:paramtypes", [
11683
+ _ts_param25(0, common.Inject(exports.MfaService)),
11684
+ _ts_param25(1, common.Inject(exports.TokenDeliveryService)),
11685
+ _ts_param25(2, common.Inject(BYMAX_AUTH_OPTIONS)),
11686
+ _ts_metadata40("design:type", Function),
11687
+ _ts_metadata40("design:paramtypes", [
11547
11688
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
11548
11689
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
11549
11690
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11550
11691
  ])
11551
11692
  ], MfaController);
11552
11693
  var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
11553
- function _ts_decorate39(decorators, target, key, desc) {
11694
+ function _ts_decorate42(decorators, target, key, desc) {
11554
11695
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11555
11696
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11556
11697
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11563,13 +11704,13 @@ function _ts_decorate39(decorators, target, key, desc) {
11563
11704
  }
11564
11705
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11565
11706
  }
11566
- __name(_ts_decorate39, "_ts_decorate");
11567
- function _ts_metadata38(metadataKey, metadataValue) {
11707
+ __name(_ts_decorate42, "_ts_decorate");
11708
+ function _ts_metadata41(metadataKey, metadataValue) {
11568
11709
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11569
11710
  return Reflect.metadata(metadataKey, metadataValue);
11570
11711
  }
11571
11712
  }
11572
- __name(_ts_metadata38, "_ts_metadata");
11713
+ __name(_ts_metadata41, "_ts_metadata");
11573
11714
  var ChangePasswordDto = class {
11574
11715
  static {
11575
11716
  __name(this, "ChangePasswordDto");
@@ -11622,26 +11763,26 @@ var ChangePasswordDto = class {
11622
11763
  */
11623
11764
  refreshToken;
11624
11765
  };
11625
- _ts_decorate39([
11766
+ _ts_decorate42([
11626
11767
  classValidator.IsString(),
11627
11768
  classValidator.MinLength(1),
11628
11769
  classValidator.MaxLength(128),
11629
- _ts_metadata38("design:type", String)
11770
+ _ts_metadata41("design:type", String)
11630
11771
  ], ChangePasswordDto.prototype, "currentPassword", void 0);
11631
- _ts_decorate39([
11772
+ _ts_decorate42([
11632
11773
  classValidator.IsString(),
11633
11774
  classValidator.MinLength(8),
11634
11775
  classValidator.MaxLength(128),
11635
- _ts_metadata38("design:type", String)
11776
+ _ts_metadata41("design:type", String)
11636
11777
  ], ChangePasswordDto.prototype, "newPassword", void 0);
11637
- _ts_decorate39([
11778
+ _ts_decorate42([
11638
11779
  classValidator.IsOptional(),
11639
11780
  classValidator.IsString(),
11640
11781
  classValidator.IsNotEmpty(),
11641
11782
  classValidator.MaxLength(2048),
11642
- _ts_metadata38("design:type", String)
11783
+ _ts_metadata41("design:type", String)
11643
11784
  ], ChangePasswordDto.prototype, "refreshToken", void 0);
11644
- function _ts_decorate40(decorators, target, key, desc) {
11785
+ function _ts_decorate43(decorators, target, key, desc) {
11645
11786
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11646
11787
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11647
11788
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11654,13 +11795,13 @@ function _ts_decorate40(decorators, target, key, desc) {
11654
11795
  }
11655
11796
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11656
11797
  }
11657
- __name(_ts_decorate40, "_ts_decorate");
11658
- function _ts_metadata39(metadataKey, metadataValue) {
11798
+ __name(_ts_decorate43, "_ts_decorate");
11799
+ function _ts_metadata42(metadataKey, metadataValue) {
11659
11800
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11660
11801
  return Reflect.metadata(metadataKey, metadataValue);
11661
11802
  }
11662
11803
  }
11663
- __name(_ts_metadata39, "_ts_metadata");
11804
+ __name(_ts_metadata42, "_ts_metadata");
11664
11805
  var ForgotPasswordDto = class {
11665
11806
  static {
11666
11807
  __name(this, "ForgotPasswordDto");
@@ -11676,13 +11817,13 @@ var ForgotPasswordDto = class {
11676
11817
  */
11677
11818
  tenantId;
11678
11819
  };
11679
- _ts_decorate40([
11820
+ _ts_decorate43([
11680
11821
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11681
11822
  classValidator.IsEmail(),
11682
11823
  classValidator.MaxLength(255),
11683
- _ts_metadata39("design:type", String)
11824
+ _ts_metadata42("design:type", String)
11684
11825
  ], ForgotPasswordDto.prototype, "email", void 0);
11685
- _ts_decorate40([
11826
+ _ts_decorate43([
11686
11827
  classValidator.IsOptional(),
11687
11828
  classValidator.IsString(),
11688
11829
  classValidator.IsNotEmpty(),
@@ -11690,9 +11831,9 @@ _ts_decorate40([
11690
11831
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11691
11832
  message: "tenantId must not contain control characters"
11692
11833
  }),
11693
- _ts_metadata39("design:type", String)
11834
+ _ts_metadata42("design:type", String)
11694
11835
  ], ForgotPasswordDto.prototype, "tenantId", void 0);
11695
- function _ts_decorate41(decorators, target, key, desc) {
11836
+ function _ts_decorate44(decorators, target, key, desc) {
11696
11837
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11697
11838
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11698
11839
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11705,13 +11846,13 @@ function _ts_decorate41(decorators, target, key, desc) {
11705
11846
  }
11706
11847
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11707
11848
  }
11708
- __name(_ts_decorate41, "_ts_decorate");
11709
- function _ts_metadata40(metadataKey, metadataValue) {
11849
+ __name(_ts_decorate44, "_ts_decorate");
11850
+ function _ts_metadata43(metadataKey, metadataValue) {
11710
11851
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11711
11852
  return Reflect.metadata(metadataKey, metadataValue);
11712
11853
  }
11713
11854
  }
11714
- __name(_ts_metadata40, "_ts_metadata");
11855
+ __name(_ts_metadata43, "_ts_metadata");
11715
11856
  var ResendOtpDto = class {
11716
11857
  static {
11717
11858
  __name(this, "ResendOtpDto");
@@ -11726,13 +11867,13 @@ var ResendOtpDto = class {
11726
11867
  */
11727
11868
  tenantId;
11728
11869
  };
11729
- _ts_decorate41([
11870
+ _ts_decorate44([
11730
11871
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11731
11872
  classValidator.IsEmail(),
11732
11873
  classValidator.MaxLength(255),
11733
- _ts_metadata40("design:type", String)
11874
+ _ts_metadata43("design:type", String)
11734
11875
  ], ResendOtpDto.prototype, "email", void 0);
11735
- _ts_decorate41([
11876
+ _ts_decorate44([
11736
11877
  classValidator.IsOptional(),
11737
11878
  classValidator.IsString(),
11738
11879
  classValidator.IsNotEmpty(),
@@ -11740,9 +11881,9 @@ _ts_decorate41([
11740
11881
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11741
11882
  message: "tenantId must not contain control characters"
11742
11883
  }),
11743
- _ts_metadata40("design:type", String)
11884
+ _ts_metadata43("design:type", String)
11744
11885
  ], ResendOtpDto.prototype, "tenantId", void 0);
11745
- function _ts_decorate42(decorators, target, key, desc) {
11886
+ function _ts_decorate45(decorators, target, key, desc) {
11746
11887
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11747
11888
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11748
11889
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11755,13 +11896,13 @@ function _ts_decorate42(decorators, target, key, desc) {
11755
11896
  }
11756
11897
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11757
11898
  }
11758
- __name(_ts_decorate42, "_ts_decorate");
11759
- function _ts_metadata41(metadataKey, metadataValue) {
11899
+ __name(_ts_decorate45, "_ts_decorate");
11900
+ function _ts_metadata44(metadataKey, metadataValue) {
11760
11901
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11761
11902
  return Reflect.metadata(metadataKey, metadataValue);
11762
11903
  }
11763
11904
  }
11764
- __name(_ts_metadata41, "_ts_metadata");
11905
+ __name(_ts_metadata44, "_ts_metadata");
11765
11906
  var ResetPasswordDto = class {
11766
11907
  static {
11767
11908
  __name(this, "ResetPasswordDto");
@@ -11808,38 +11949,38 @@ var ResetPasswordDto = class {
11808
11949
  */
11809
11950
  tenantId;
11810
11951
  };
11811
- _ts_decorate42([
11952
+ _ts_decorate45([
11812
11953
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11813
11954
  classValidator.IsEmail(),
11814
11955
  classValidator.MaxLength(255),
11815
- _ts_metadata41("design:type", String)
11956
+ _ts_metadata44("design:type", String)
11816
11957
  ], ResetPasswordDto.prototype, "email", void 0);
11817
- _ts_decorate42([
11958
+ _ts_decorate45([
11818
11959
  classValidator.IsString(),
11819
11960
  classValidator.MinLength(8),
11820
11961
  classValidator.MaxLength(128),
11821
- _ts_metadata41("design:type", String)
11962
+ _ts_metadata44("design:type", String)
11822
11963
  ], ResetPasswordDto.prototype, "newPassword", void 0);
11823
- _ts_decorate42([
11964
+ _ts_decorate45([
11824
11965
  classValidator.IsOptional(),
11825
11966
  classValidator.IsString(),
11826
11967
  classValidator.IsNotEmpty(),
11827
11968
  classValidator.MaxLength(2048),
11828
- _ts_metadata41("design:type", String)
11969
+ _ts_metadata44("design:type", String)
11829
11970
  ], ResetPasswordDto.prototype, "token", void 0);
11830
- _ts_decorate42([
11971
+ _ts_decorate45([
11831
11972
  classValidator.IsOptional(),
11832
11973
  classValidator.IsString(),
11833
11974
  classValidator.Length(4, 8),
11834
- _ts_metadata41("design:type", String)
11975
+ _ts_metadata44("design:type", String)
11835
11976
  ], ResetPasswordDto.prototype, "otp", void 0);
11836
- _ts_decorate42([
11977
+ _ts_decorate45([
11837
11978
  classValidator.IsOptional(),
11838
11979
  classValidator.IsString(),
11839
11980
  classValidator.Length(64, 64),
11840
- _ts_metadata41("design:type", String)
11981
+ _ts_metadata44("design:type", String)
11841
11982
  ], ResetPasswordDto.prototype, "verifiedToken", void 0);
11842
- _ts_decorate42([
11983
+ _ts_decorate45([
11843
11984
  classValidator.IsOptional(),
11844
11985
  classValidator.IsString(),
11845
11986
  classValidator.IsNotEmpty(),
@@ -11847,9 +11988,9 @@ _ts_decorate42([
11847
11988
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11848
11989
  message: "tenantId must not contain control characters"
11849
11990
  }),
11850
- _ts_metadata41("design:type", String)
11991
+ _ts_metadata44("design:type", String)
11851
11992
  ], ResetPasswordDto.prototype, "tenantId", void 0);
11852
- function _ts_decorate43(decorators, target, key, desc) {
11993
+ function _ts_decorate46(decorators, target, key, desc) {
11853
11994
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11854
11995
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11855
11996
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11862,13 +12003,13 @@ function _ts_decorate43(decorators, target, key, desc) {
11862
12003
  }
11863
12004
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11864
12005
  }
11865
- __name(_ts_decorate43, "_ts_decorate");
11866
- function _ts_metadata42(metadataKey, metadataValue) {
12006
+ __name(_ts_decorate46, "_ts_decorate");
12007
+ function _ts_metadata45(metadataKey, metadataValue) {
11867
12008
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11868
12009
  return Reflect.metadata(metadataKey, metadataValue);
11869
12010
  }
11870
12011
  }
11871
- __name(_ts_metadata42, "_ts_metadata");
12012
+ __name(_ts_metadata45, "_ts_metadata");
11872
12013
  var VerifyOtpDto = class {
11873
12014
  static {
11874
12015
  __name(this, "VerifyOtpDto");
@@ -11890,18 +12031,18 @@ var VerifyOtpDto = class {
11890
12031
  */
11891
12032
  tenantId;
11892
12033
  };
11893
- _ts_decorate43([
12034
+ _ts_decorate46([
11894
12035
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11895
12036
  classValidator.IsEmail(),
11896
12037
  classValidator.MaxLength(255),
11897
- _ts_metadata42("design:type", String)
12038
+ _ts_metadata45("design:type", String)
11898
12039
  ], VerifyOtpDto.prototype, "email", void 0);
11899
- _ts_decorate43([
12040
+ _ts_decorate46([
11900
12041
  classValidator.IsString(),
11901
12042
  classValidator.Length(4, 8),
11902
- _ts_metadata42("design:type", String)
12043
+ _ts_metadata45("design:type", String)
11903
12044
  ], VerifyOtpDto.prototype, "otp", void 0);
11904
- _ts_decorate43([
12045
+ _ts_decorate46([
11905
12046
  classValidator.IsOptional(),
11906
12047
  classValidator.IsString(),
11907
12048
  classValidator.IsNotEmpty(),
@@ -11909,7 +12050,7 @@ _ts_decorate43([
11909
12050
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11910
12051
  message: "tenantId must not contain control characters"
11911
12052
  }),
11912
- _ts_metadata42("design:type", String)
12053
+ _ts_metadata45("design:type", String)
11913
12054
  ], VerifyOtpDto.prototype, "tenantId", void 0);
11914
12055
 
11915
12056
  // src/server/utils/answer-reset-request.ts
@@ -11956,7 +12097,7 @@ async function answerResetRequest(deps, request) {
11956
12097
  __name(answerResetRequest, "answerResetRequest");
11957
12098
 
11958
12099
  // src/server/services/password-reset.service.ts
11959
- function _ts_decorate44(decorators, target, key, desc) {
12100
+ function _ts_decorate47(decorators, target, key, desc) {
11960
12101
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11961
12102
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11962
12103
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11969,19 +12110,19 @@ function _ts_decorate44(decorators, target, key, desc) {
11969
12110
  }
11970
12111
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11971
12112
  }
11972
- __name(_ts_decorate44, "_ts_decorate");
11973
- function _ts_metadata43(metadataKey, metadataValue) {
12113
+ __name(_ts_decorate47, "_ts_decorate");
12114
+ function _ts_metadata46(metadataKey, metadataValue) {
11974
12115
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11975
12116
  return Reflect.metadata(metadataKey, metadataValue);
11976
12117
  }
11977
12118
  }
11978
- __name(_ts_metadata43, "_ts_metadata");
11979
- function _ts_param23(paramIndex, decorator) {
12119
+ __name(_ts_metadata46, "_ts_metadata");
12120
+ function _ts_param26(paramIndex, decorator) {
11980
12121
  return function(target, key) {
11981
12122
  decorator(target, key, paramIndex);
11982
12123
  };
11983
12124
  }
11984
- __name(_ts_param23, "_ts_param");
12125
+ __name(_ts_param26, "_ts_param");
11985
12126
  var ANTI_ENUM_MIN_MS2 = 300;
11986
12127
  var VERIFIED_TOKEN_TTL_SECONDS = 300;
11987
12128
  var PASSWORD_RESET_PURPOSE = "password_reset";
@@ -12575,21 +12716,21 @@ exports.PasswordResetService = class _PasswordResetService {
12575
12716
  };
12576
12717
  }
12577
12718
  };
12578
- exports.PasswordResetService = _ts_decorate44([
12719
+ exports.PasswordResetService = _ts_decorate47([
12579
12720
  common.Injectable(),
12580
- _ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12581
- _ts_param23(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
12582
- _ts_param23(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
12583
- _ts_param23(2, common.Optional()),
12584
- _ts_param23(3, common.Inject(BYMAX_AUTH_HOOKS)),
12585
- _ts_param23(3, common.Optional()),
12586
- _ts_param23(4, common.Inject(exports.OtpService)),
12587
- _ts_param23(5, common.Inject(PasswordService)),
12588
- _ts_param23(6, common.Inject(AuthRedisService)),
12589
- _ts_param23(7, common.Inject(exports.SessionService)),
12590
- _ts_param23(8, common.Inject(exports.BruteForceService)),
12591
- _ts_metadata43("design:type", Function),
12592
- _ts_metadata43("design:paramtypes", [
12721
+ _ts_param26(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12722
+ _ts_param26(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
12723
+ _ts_param26(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
12724
+ _ts_param26(2, common.Optional()),
12725
+ _ts_param26(3, common.Inject(BYMAX_AUTH_HOOKS)),
12726
+ _ts_param26(3, common.Optional()),
12727
+ _ts_param26(4, common.Inject(exports.OtpService)),
12728
+ _ts_param26(5, common.Inject(PasswordService)),
12729
+ _ts_param26(6, common.Inject(AuthRedisService)),
12730
+ _ts_param26(7, common.Inject(exports.SessionService)),
12731
+ _ts_param26(8, common.Inject(exports.BruteForceService)),
12732
+ _ts_metadata46("design:type", Function),
12733
+ _ts_metadata46("design:paramtypes", [
12593
12734
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
12594
12735
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
12595
12736
  Object,
@@ -12608,7 +12749,7 @@ function toSafeUser4(user) {
12608
12749
  __name(toSafeUser4, "toSafeUser");
12609
12750
 
12610
12751
  // src/server/controllers/password-reset.controller.ts
12611
- function _ts_decorate45(decorators, target, key, desc) {
12752
+ function _ts_decorate48(decorators, target, key, desc) {
12612
12753
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12613
12754
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12614
12755
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12621,19 +12762,19 @@ function _ts_decorate45(decorators, target, key, desc) {
12621
12762
  }
12622
12763
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12623
12764
  }
12624
- __name(_ts_decorate45, "_ts_decorate");
12625
- function _ts_metadata44(metadataKey, metadataValue) {
12765
+ __name(_ts_decorate48, "_ts_decorate");
12766
+ function _ts_metadata47(metadataKey, metadataValue) {
12626
12767
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12627
12768
  return Reflect.metadata(metadataKey, metadataValue);
12628
12769
  }
12629
12770
  }
12630
- __name(_ts_metadata44, "_ts_metadata");
12631
- function _ts_param24(paramIndex, decorator) {
12771
+ __name(_ts_metadata47, "_ts_metadata");
12772
+ function _ts_param27(paramIndex, decorator) {
12632
12773
  return function(target, key) {
12633
12774
  decorator(target, key, paramIndex);
12634
12775
  };
12635
12776
  }
12636
- __name(_ts_param24, "_ts_param");
12777
+ __name(_ts_param27, "_ts_param");
12637
12778
  var PasswordResetController = class {
12638
12779
  static {
12639
12780
  __name(this, "PasswordResetController");
@@ -12752,95 +12893,95 @@ var PasswordResetController = class {
12752
12893
  return {};
12753
12894
  }
12754
12895
  };
12755
- _ts_decorate45([
12896
+ _ts_decorate48([
12756
12897
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
12757
12898
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
12758
12899
  common.HttpCode(common.HttpStatus.OK),
12759
12900
  common.Post("forgot-password"),
12760
- _ts_param24(0, common.Body()),
12761
- _ts_param24(1, common.Req()),
12762
- _ts_metadata44("design:type", Function),
12763
- _ts_metadata44("design:paramtypes", [
12901
+ _ts_param27(0, common.Body()),
12902
+ _ts_param27(1, common.Req()),
12903
+ _ts_metadata47("design:type", Function),
12904
+ _ts_metadata47("design:paramtypes", [
12764
12905
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
12765
12906
  typeof Request === "undefined" ? Object : Request
12766
12907
  ]),
12767
- _ts_metadata44("design:returntype", Promise)
12908
+ _ts_metadata47("design:returntype", Promise)
12768
12909
  ], PasswordResetController.prototype, "forgotPassword", null);
12769
- _ts_decorate45([
12910
+ _ts_decorate48([
12770
12911
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
12771
12912
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
12772
12913
  common.HttpCode(common.HttpStatus.NO_CONTENT),
12773
12914
  common.Post("reset-password"),
12774
- _ts_param24(0, common.Body()),
12775
- _ts_param24(1, common.Req()),
12776
- _ts_metadata44("design:type", Function),
12777
- _ts_metadata44("design:paramtypes", [
12915
+ _ts_param27(0, common.Body()),
12916
+ _ts_param27(1, common.Req()),
12917
+ _ts_metadata47("design:type", Function),
12918
+ _ts_metadata47("design:paramtypes", [
12778
12919
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
12779
12920
  typeof Request === "undefined" ? Object : Request
12780
12921
  ]),
12781
- _ts_metadata44("design:returntype", Promise)
12922
+ _ts_metadata47("design:returntype", Promise)
12782
12923
  ], PasswordResetController.prototype, "resetPassword", null);
12783
- _ts_decorate45([
12924
+ _ts_decorate48([
12784
12925
  Authenticated(),
12785
12926
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
12786
12927
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
12787
12928
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
12788
12929
  common.HttpCode(common.HttpStatus.NO_CONTENT),
12789
12930
  common.Post("change"),
12790
- _ts_param24(0, CurrentUser()),
12791
- _ts_param24(1, common.Body()),
12792
- _ts_param24(2, common.Req()),
12793
- _ts_metadata44("design:type", Function),
12794
- _ts_metadata44("design:paramtypes", [
12931
+ _ts_param27(0, CurrentUser()),
12932
+ _ts_param27(1, common.Body()),
12933
+ _ts_param27(2, common.Req()),
12934
+ _ts_metadata47("design:type", Function),
12935
+ _ts_metadata47("design:paramtypes", [
12795
12936
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
12796
12937
  typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
12797
12938
  typeof Request === "undefined" ? Object : Request
12798
12939
  ]),
12799
- _ts_metadata44("design:returntype", Promise)
12940
+ _ts_metadata47("design:returntype", Promise)
12800
12941
  ], PasswordResetController.prototype, "changePassword", null);
12801
- _ts_decorate45([
12942
+ _ts_decorate48([
12802
12943
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
12803
12944
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
12804
12945
  common.HttpCode(common.HttpStatus.OK),
12805
12946
  common.Post("verify-otp"),
12806
- _ts_param24(0, common.Body()),
12807
- _ts_param24(1, common.Req()),
12808
- _ts_metadata44("design:type", Function),
12809
- _ts_metadata44("design:paramtypes", [
12947
+ _ts_param27(0, common.Body()),
12948
+ _ts_param27(1, common.Req()),
12949
+ _ts_metadata47("design:type", Function),
12950
+ _ts_metadata47("design:paramtypes", [
12810
12951
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
12811
12952
  typeof Request === "undefined" ? Object : Request
12812
12953
  ]),
12813
- _ts_metadata44("design:returntype", Promise)
12954
+ _ts_metadata47("design:returntype", Promise)
12814
12955
  ], PasswordResetController.prototype, "verifyOtp", null);
12815
- _ts_decorate45([
12956
+ _ts_decorate48([
12816
12957
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12817
12958
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12818
12959
  common.HttpCode(common.HttpStatus.OK),
12819
12960
  common.Post("resend-otp"),
12820
- _ts_param24(0, common.Body()),
12821
- _ts_param24(1, common.Req()),
12822
- _ts_metadata44("design:type", Function),
12823
- _ts_metadata44("design:paramtypes", [
12961
+ _ts_param27(0, common.Body()),
12962
+ _ts_param27(1, common.Req()),
12963
+ _ts_metadata47("design:type", Function),
12964
+ _ts_metadata47("design:paramtypes", [
12824
12965
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
12825
12966
  typeof Request === "undefined" ? Object : Request
12826
12967
  ]),
12827
- _ts_metadata44("design:returntype", Promise)
12968
+ _ts_metadata47("design:returntype", Promise)
12828
12969
  ], PasswordResetController.prototype, "resendOtp", null);
12829
- PasswordResetController = _ts_decorate45([
12970
+ PasswordResetController = _ts_decorate48([
12830
12971
  Public(),
12831
12972
  common.UseInterceptors(NoStoreInterceptor),
12832
12973
  common.Controller("password"),
12833
12974
  common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12834
12975
  common.UsePipes(createAuthValidationPipe()),
12835
- _ts_param24(0, common.Inject(exports.PasswordResetService)),
12836
- _ts_param24(1, common.Inject(exports.TokenDeliveryService)),
12837
- _ts_metadata44("design:type", Function),
12838
- _ts_metadata44("design:paramtypes", [
12976
+ _ts_param27(0, common.Inject(exports.PasswordResetService)),
12977
+ _ts_param27(1, common.Inject(exports.TokenDeliveryService)),
12978
+ _ts_metadata47("design:type", Function),
12979
+ _ts_metadata47("design:paramtypes", [
12839
12980
  typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
12840
12981
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
12841
12982
  ])
12842
12983
  ], PasswordResetController);
12843
- function _ts_decorate46(decorators, target, key, desc) {
12984
+ function _ts_decorate49(decorators, target, key, desc) {
12844
12985
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12845
12986
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12846
12987
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12853,13 +12994,13 @@ function _ts_decorate46(decorators, target, key, desc) {
12853
12994
  }
12854
12995
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12855
12996
  }
12856
- __name(_ts_decorate46, "_ts_decorate");
12857
- function _ts_metadata45(metadataKey, metadataValue) {
12997
+ __name(_ts_decorate49, "_ts_decorate");
12998
+ function _ts_metadata48(metadataKey, metadataValue) {
12858
12999
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12859
13000
  return Reflect.metadata(metadataKey, metadataValue);
12860
13001
  }
12861
13002
  }
12862
- __name(_ts_metadata45, "_ts_metadata");
13003
+ __name(_ts_metadata48, "_ts_metadata");
12863
13004
  var PlatformLoginDto = class {
12864
13005
  static {
12865
13006
  __name(this, "PlatformLoginDto");
@@ -12887,14 +13028,14 @@ var PlatformLoginDto = class {
12887
13028
  */
12888
13029
  password;
12889
13030
  };
12890
- _ts_decorate46([
13031
+ _ts_decorate49([
12891
13032
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
12892
13033
  classValidator.IsEmail(),
12893
13034
  classValidator.IsNotEmpty(),
12894
13035
  classValidator.MaxLength(255),
12895
- _ts_metadata45("design:type", String)
13036
+ _ts_metadata48("design:type", String)
12896
13037
  ], PlatformLoginDto.prototype, "email", void 0);
12897
- _ts_decorate46([
13038
+ _ts_decorate49([
12898
13039
  classValidator.IsString(),
12899
13040
  classValidator.IsNotEmpty(),
12900
13041
  classValidator.Matches(/\S/, {
@@ -12902,9 +13043,9 @@ _ts_decorate46([
12902
13043
  }),
12903
13044
  classValidator.MinLength(1),
12904
13045
  classValidator.MaxLength(128),
12905
- _ts_metadata45("design:type", String)
13046
+ _ts_metadata48("design:type", String)
12906
13047
  ], PlatformLoginDto.prototype, "password", void 0);
12907
- function _ts_decorate47(decorators, target, key, desc) {
13048
+ function _ts_decorate50(decorators, target, key, desc) {
12908
13049
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12909
13050
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12910
13051
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12917,19 +13058,19 @@ function _ts_decorate47(decorators, target, key, desc) {
12917
13058
  }
12918
13059
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12919
13060
  }
12920
- __name(_ts_decorate47, "_ts_decorate");
12921
- function _ts_metadata46(metadataKey, metadataValue) {
13061
+ __name(_ts_decorate50, "_ts_decorate");
13062
+ function _ts_metadata49(metadataKey, metadataValue) {
12922
13063
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12923
13064
  return Reflect.metadata(metadataKey, metadataValue);
12924
13065
  }
12925
13066
  }
12926
- __name(_ts_metadata46, "_ts_metadata");
12927
- function _ts_param25(paramIndex, decorator) {
13067
+ __name(_ts_metadata49, "_ts_metadata");
13068
+ function _ts_param28(paramIndex, decorator) {
12928
13069
  return function(target, key) {
12929
13070
  decorator(target, key, paramIndex);
12930
13071
  };
12931
13072
  }
12932
- __name(_ts_param25, "_ts_param");
13073
+ __name(_ts_param28, "_ts_param");
12933
13074
  exports.JwtPlatformGuard = class JwtPlatformGuard {
12934
13075
  static {
12935
13076
  __name(this, "JwtPlatformGuard");
@@ -12975,15 +13116,15 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
12975
13116
  return true;
12976
13117
  }
12977
13118
  };
12978
- exports.JwtPlatformGuard = _ts_decorate47([
13119
+ exports.JwtPlatformGuard = _ts_decorate50([
12979
13120
  common.Injectable(),
12980
- _ts_param25(0, common.Inject(jwt.JwtService)),
12981
- _ts_param25(1, common.Inject(exports.TokenDeliveryService)),
12982
- _ts_param25(2, common.Inject(exports.AuthRevocationService)),
12983
- _ts_param25(3, common.Inject(core.Reflector)),
12984
- _ts_param25(4, common.Inject(BYMAX_AUTH_OPTIONS)),
12985
- _ts_metadata46("design:type", Function),
12986
- _ts_metadata46("design:paramtypes", [
13121
+ _ts_param28(0, common.Inject(jwt.JwtService)),
13122
+ _ts_param28(1, common.Inject(exports.TokenDeliveryService)),
13123
+ _ts_param28(2, common.Inject(exports.AuthRevocationService)),
13124
+ _ts_param28(3, common.Inject(core.Reflector)),
13125
+ _ts_param28(4, common.Inject(BYMAX_AUTH_OPTIONS)),
13126
+ _ts_metadata49("design:type", Function),
13127
+ _ts_metadata49("design:paramtypes", [
12987
13128
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
12988
13129
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
12989
13130
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -12991,7 +13132,7 @@ exports.JwtPlatformGuard = _ts_decorate47([
12991
13132
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
12992
13133
  ])
12993
13134
  ], exports.JwtPlatformGuard);
12994
- function _ts_decorate48(decorators, target, key, desc) {
13135
+ function _ts_decorate51(decorators, target, key, desc) {
12995
13136
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12996
13137
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12997
13138
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13004,19 +13145,19 @@ function _ts_decorate48(decorators, target, key, desc) {
13004
13145
  }
13005
13146
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13006
13147
  }
13007
- __name(_ts_decorate48, "_ts_decorate");
13008
- function _ts_metadata47(metadataKey, metadataValue) {
13148
+ __name(_ts_decorate51, "_ts_decorate");
13149
+ function _ts_metadata50(metadataKey, metadataValue) {
13009
13150
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13010
13151
  return Reflect.metadata(metadataKey, metadataValue);
13011
13152
  }
13012
13153
  }
13013
- __name(_ts_metadata47, "_ts_metadata");
13014
- function _ts_param26(paramIndex, decorator) {
13154
+ __name(_ts_metadata50, "_ts_metadata");
13155
+ function _ts_param29(paramIndex, decorator) {
13015
13156
  return function(target, key) {
13016
13157
  decorator(target, key, paramIndex);
13017
13158
  };
13018
13159
  }
13019
- __name(_ts_param26, "_ts_param");
13160
+ __name(_ts_param29, "_ts_param");
13020
13161
  exports.PlatformAuthService = class _PlatformAuthService {
13021
13162
  static {
13022
13163
  __name(this, "PlatformAuthService");
@@ -13309,18 +13450,18 @@ exports.PlatformAuthService = class _PlatformAuthService {
13309
13450
  await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
13310
13451
  }
13311
13452
  };
13312
- exports.PlatformAuthService = _ts_decorate48([
13453
+ exports.PlatformAuthService = _ts_decorate51([
13313
13454
  common.Injectable(),
13314
- _ts_param26(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
13315
- _ts_param26(1, common.Inject(PasswordService)),
13316
- _ts_param26(2, common.Inject(TokenManagerService)),
13317
- _ts_param26(3, common.Inject(exports.BruteForceService)),
13318
- _ts_param26(4, common.Inject(AuthRedisService)),
13319
- _ts_param26(5, common.Inject(BYMAX_AUTH_OPTIONS)),
13320
- _ts_param26(6, common.Inject(BYMAX_AUTH_HOOKS)),
13321
- _ts_param26(6, common.Optional()),
13322
- _ts_metadata47("design:type", Function),
13323
- _ts_metadata47("design:paramtypes", [
13455
+ _ts_param29(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
13456
+ _ts_param29(1, common.Inject(PasswordService)),
13457
+ _ts_param29(2, common.Inject(TokenManagerService)),
13458
+ _ts_param29(3, common.Inject(exports.BruteForceService)),
13459
+ _ts_param29(4, common.Inject(AuthRedisService)),
13460
+ _ts_param29(5, common.Inject(BYMAX_AUTH_OPTIONS)),
13461
+ _ts_param29(6, common.Inject(BYMAX_AUTH_HOOKS)),
13462
+ _ts_param29(6, common.Optional()),
13463
+ _ts_metadata50("design:type", Function),
13464
+ _ts_metadata50("design:paramtypes", [
13324
13465
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
13325
13466
  typeof PasswordService === "undefined" ? Object : PasswordService,
13326
13467
  typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
@@ -13332,7 +13473,7 @@ exports.PlatformAuthService = _ts_decorate48([
13332
13473
  ], exports.PlatformAuthService);
13333
13474
 
13334
13475
  // src/server/controllers/platform-auth.controller.ts
13335
- function _ts_decorate49(decorators, target, key, desc) {
13476
+ function _ts_decorate52(decorators, target, key, desc) {
13336
13477
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13337
13478
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13338
13479
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13345,19 +13486,19 @@ function _ts_decorate49(decorators, target, key, desc) {
13345
13486
  }
13346
13487
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13347
13488
  }
13348
- __name(_ts_decorate49, "_ts_decorate");
13349
- function _ts_metadata48(metadataKey, metadataValue) {
13489
+ __name(_ts_decorate52, "_ts_decorate");
13490
+ function _ts_metadata51(metadataKey, metadataValue) {
13350
13491
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13351
13492
  return Reflect.metadata(metadataKey, metadataValue);
13352
13493
  }
13353
13494
  }
13354
- __name(_ts_metadata48, "_ts_metadata");
13355
- function _ts_param27(paramIndex, decorator) {
13495
+ __name(_ts_metadata51, "_ts_metadata");
13496
+ function _ts_param30(paramIndex, decorator) {
13356
13497
  return function(target, key) {
13357
13498
  decorator(target, key, paramIndex);
13358
13499
  };
13359
13500
  }
13360
- __name(_ts_param27, "_ts_param");
13501
+ __name(_ts_param30, "_ts_param");
13361
13502
  function isMfaChallenge2(result) {
13362
13503
  return "mfaRequired" in result && result.mfaRequired === true;
13363
13504
  }
@@ -13503,103 +13644,103 @@ var PlatformAuthController = class {
13503
13644
  await this.platformAuthService.revokeAllPlatformSessions(user.sub);
13504
13645
  }
13505
13646
  };
13506
- _ts_decorate49([
13647
+ _ts_decorate52([
13507
13648
  Public(),
13508
13649
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
13509
13650
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
13510
13651
  common.HttpCode(common.HttpStatus.OK),
13511
13652
  common.Post("login"),
13512
- _ts_param27(0, common.Body()),
13513
- _ts_param27(1, common.Req()),
13514
- _ts_metadata48("design:type", Function),
13515
- _ts_metadata48("design:paramtypes", [
13653
+ _ts_param30(0, common.Body()),
13654
+ _ts_param30(1, common.Req()),
13655
+ _ts_metadata51("design:type", Function),
13656
+ _ts_metadata51("design:paramtypes", [
13516
13657
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
13517
13658
  typeof Request === "undefined" ? Object : Request
13518
13659
  ]),
13519
- _ts_metadata48("design:returntype", Promise)
13660
+ _ts_metadata51("design:returntype", Promise)
13520
13661
  ], PlatformAuthController.prototype, "login", null);
13521
- _ts_decorate49([
13662
+ _ts_decorate52([
13522
13663
  Public(),
13523
13664
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
13524
13665
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
13525
13666
  common.HttpCode(common.HttpStatus.OK),
13526
13667
  common.Post("mfa/challenge"),
13527
- _ts_param27(0, common.Body()),
13528
- _ts_param27(1, common.Req()),
13529
- _ts_metadata48("design:type", Function),
13530
- _ts_metadata48("design:paramtypes", [
13668
+ _ts_param30(0, common.Body()),
13669
+ _ts_param30(1, common.Req()),
13670
+ _ts_metadata51("design:type", Function),
13671
+ _ts_metadata51("design:paramtypes", [
13531
13672
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
13532
13673
  typeof Request === "undefined" ? Object : Request
13533
13674
  ]),
13534
- _ts_metadata48("design:returntype", Promise)
13675
+ _ts_metadata51("design:returntype", Promise)
13535
13676
  ], PlatformAuthController.prototype, "mfaChallenge", null);
13536
- _ts_decorate49([
13677
+ _ts_decorate52([
13537
13678
  common.UseGuards(exports.JwtPlatformGuard),
13538
13679
  common.Get("me"),
13539
- _ts_param27(0, CurrentUser()),
13540
- _ts_metadata48("design:type", Function),
13541
- _ts_metadata48("design:paramtypes", [
13680
+ _ts_param30(0, CurrentUser()),
13681
+ _ts_metadata51("design:type", Function),
13682
+ _ts_metadata51("design:paramtypes", [
13542
13683
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13543
13684
  ]),
13544
- _ts_metadata48("design:returntype", Promise)
13685
+ _ts_metadata51("design:returntype", Promise)
13545
13686
  ], PlatformAuthController.prototype, "me", null);
13546
- _ts_decorate49([
13687
+ _ts_decorate52([
13547
13688
  Public(),
13548
13689
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
13549
13690
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
13550
13691
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13551
13692
  RequestEncoding("unchecked"),
13552
13693
  common.Post("logout"),
13553
- _ts_param27(0, common.Req()),
13554
- _ts_metadata48("design:type", Function),
13555
- _ts_metadata48("design:paramtypes", [
13694
+ _ts_param30(0, common.Req()),
13695
+ _ts_metadata51("design:type", Function),
13696
+ _ts_metadata51("design:paramtypes", [
13556
13697
  typeof Request === "undefined" ? Object : Request
13557
13698
  ]),
13558
- _ts_metadata48("design:returntype", Promise)
13699
+ _ts_metadata51("design:returntype", Promise)
13559
13700
  ], PlatformAuthController.prototype, "logout", null);
13560
- _ts_decorate49([
13701
+ _ts_decorate52([
13561
13702
  Public(),
13562
13703
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
13563
13704
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
13564
13705
  common.HttpCode(common.HttpStatus.OK),
13565
13706
  RequestEncoding("unchecked"),
13566
13707
  common.Post("refresh"),
13567
- _ts_param27(0, common.Req()),
13568
- _ts_metadata48("design:type", Function),
13569
- _ts_metadata48("design:paramtypes", [
13708
+ _ts_param30(0, common.Req()),
13709
+ _ts_metadata51("design:type", Function),
13710
+ _ts_metadata51("design:paramtypes", [
13570
13711
  typeof Request === "undefined" ? Object : Request
13571
13712
  ]),
13572
- _ts_metadata48("design:returntype", Promise)
13713
+ _ts_metadata51("design:returntype", Promise)
13573
13714
  ], PlatformAuthController.prototype, "refresh", null);
13574
- _ts_decorate49([
13715
+ _ts_decorate52([
13575
13716
  common.UseGuards(exports.JwtPlatformGuard),
13576
13717
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13577
13718
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13578
13719
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13579
13720
  common.Delete("sessions"),
13580
- _ts_param27(0, CurrentUser()),
13581
- _ts_metadata48("design:type", Function),
13582
- _ts_metadata48("design:paramtypes", [
13721
+ _ts_param30(0, CurrentUser()),
13722
+ _ts_metadata51("design:type", Function),
13723
+ _ts_metadata51("design:paramtypes", [
13583
13724
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13584
13725
  ]),
13585
- _ts_metadata48("design:returntype", Promise)
13726
+ _ts_metadata51("design:returntype", Promise)
13586
13727
  ], PlatformAuthController.prototype, "revokeSessions", null);
13587
- PlatformAuthController = _ts_decorate49([
13728
+ PlatformAuthController = _ts_decorate52([
13588
13729
  common.UseInterceptors(NoStoreInterceptor),
13589
13730
  common.Controller("platform"),
13590
13731
  common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13591
13732
  common.UsePipes(createAuthValidationPipe()),
13592
- _ts_param27(0, common.Inject(exports.PlatformAuthService)),
13593
- _ts_param27(1, common.Inject(exports.MfaService)),
13594
- _ts_param27(2, common.Inject(exports.TokenDeliveryService)),
13595
- _ts_metadata48("design:type", Function),
13596
- _ts_metadata48("design:paramtypes", [
13733
+ _ts_param30(0, common.Inject(exports.PlatformAuthService)),
13734
+ _ts_param30(1, common.Inject(exports.MfaService)),
13735
+ _ts_param30(2, common.Inject(exports.TokenDeliveryService)),
13736
+ _ts_metadata51("design:type", Function),
13737
+ _ts_metadata51("design:paramtypes", [
13597
13738
  typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
13598
13739
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
13599
13740
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13600
13741
  ])
13601
13742
  ], PlatformAuthController);
13602
- function _ts_decorate50(decorators, target, key, desc) {
13743
+ function _ts_decorate53(decorators, target, key, desc) {
13603
13744
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13604
13745
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13605
13746
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13612,19 +13753,19 @@ function _ts_decorate50(decorators, target, key, desc) {
13612
13753
  }
13613
13754
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13614
13755
  }
13615
- __name(_ts_decorate50, "_ts_decorate");
13616
- function _ts_metadata49(metadataKey, metadataValue) {
13756
+ __name(_ts_decorate53, "_ts_decorate");
13757
+ function _ts_metadata52(metadataKey, metadataValue) {
13617
13758
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13618
13759
  return Reflect.metadata(metadataKey, metadataValue);
13619
13760
  }
13620
13761
  }
13621
- __name(_ts_metadata49, "_ts_metadata");
13622
- function _ts_param28(paramIndex, decorator) {
13762
+ __name(_ts_metadata52, "_ts_metadata");
13763
+ function _ts_param31(paramIndex, decorator) {
13623
13764
  return function(target, key) {
13624
13765
  decorator(target, key, paramIndex);
13625
13766
  };
13626
13767
  }
13627
- __name(_ts_param28, "_ts_param");
13768
+ __name(_ts_param31, "_ts_param");
13628
13769
  var PlatformMfaController = class {
13629
13770
  static {
13630
13771
  __name(this, "PlatformMfaController");
@@ -13703,86 +13844,86 @@ var PlatformMfaController = class {
13703
13844
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
13704
13845
  }
13705
13846
  };
13706
- _ts_decorate50([
13847
+ _ts_decorate53([
13707
13848
  common.UseGuards(exports.JwtPlatformGuard),
13708
13849
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
13709
13850
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
13710
13851
  RequestEncoding("when-body"),
13711
13852
  common.Post("setup"),
13712
- _ts_param28(0, CurrentUser()),
13713
- _ts_param28(1, common.Body()),
13714
- _ts_metadata49("design:type", Function),
13715
- _ts_metadata49("design:paramtypes", [
13853
+ _ts_param31(0, CurrentUser()),
13854
+ _ts_param31(1, common.Body()),
13855
+ _ts_metadata52("design:type", Function),
13856
+ _ts_metadata52("design:paramtypes", [
13716
13857
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13717
13858
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
13718
13859
  ]),
13719
- _ts_metadata49("design:returntype", Promise)
13860
+ _ts_metadata52("design:returntype", Promise)
13720
13861
  ], PlatformMfaController.prototype, "setup", null);
13721
- _ts_decorate50([
13862
+ _ts_decorate53([
13722
13863
  common.UseGuards(exports.JwtPlatformGuard),
13723
13864
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
13724
13865
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
13725
13866
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13726
13867
  common.Post("verify-enable"),
13727
- _ts_param28(0, CurrentUser()),
13728
- _ts_param28(1, common.Body()),
13729
- _ts_param28(2, common.Req()),
13730
- _ts_metadata49("design:type", Function),
13731
- _ts_metadata49("design:paramtypes", [
13868
+ _ts_param31(0, CurrentUser()),
13869
+ _ts_param31(1, common.Body()),
13870
+ _ts_param31(2, common.Req()),
13871
+ _ts_metadata52("design:type", Function),
13872
+ _ts_metadata52("design:paramtypes", [
13732
13873
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13733
13874
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
13734
13875
  typeof Request === "undefined" ? Object : Request
13735
13876
  ]),
13736
- _ts_metadata49("design:returntype", Promise)
13877
+ _ts_metadata52("design:returntype", Promise)
13737
13878
  ], PlatformMfaController.prototype, "verifyEnable", null);
13738
- _ts_decorate50([
13879
+ _ts_decorate53([
13739
13880
  common.UseGuards(exports.JwtPlatformGuard),
13740
13881
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13741
13882
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
13742
13883
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13743
13884
  common.Post("disable"),
13744
- _ts_param28(0, CurrentUser()),
13745
- _ts_param28(1, common.Body()),
13746
- _ts_param28(2, common.Req()),
13747
- _ts_metadata49("design:type", Function),
13748
- _ts_metadata49("design:paramtypes", [
13885
+ _ts_param31(0, CurrentUser()),
13886
+ _ts_param31(1, common.Body()),
13887
+ _ts_param31(2, common.Req()),
13888
+ _ts_metadata52("design:type", Function),
13889
+ _ts_metadata52("design:paramtypes", [
13749
13890
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13750
13891
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
13751
13892
  typeof Request === "undefined" ? Object : Request
13752
13893
  ]),
13753
- _ts_metadata49("design:returntype", Promise)
13894
+ _ts_metadata52("design:returntype", Promise)
13754
13895
  ], PlatformMfaController.prototype, "disable", null);
13755
- _ts_decorate50([
13896
+ _ts_decorate53([
13756
13897
  common.UseGuards(exports.JwtPlatformGuard),
13757
13898
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13758
13899
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
13759
13900
  common.HttpCode(common.HttpStatus.OK),
13760
13901
  common.Post("recovery-codes"),
13761
- _ts_param28(0, CurrentUser()),
13762
- _ts_param28(1, common.Body()),
13763
- _ts_param28(2, common.Req()),
13764
- _ts_metadata49("design:type", Function),
13765
- _ts_metadata49("design:paramtypes", [
13902
+ _ts_param31(0, CurrentUser()),
13903
+ _ts_param31(1, common.Body()),
13904
+ _ts_param31(2, common.Req()),
13905
+ _ts_metadata52("design:type", Function),
13906
+ _ts_metadata52("design:paramtypes", [
13766
13907
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13767
13908
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
13768
13909
  typeof Request === "undefined" ? Object : Request
13769
13910
  ]),
13770
- _ts_metadata49("design:returntype", Promise)
13911
+ _ts_metadata52("design:returntype", Promise)
13771
13912
  ], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
13772
- PlatformMfaController = _ts_decorate50([
13913
+ PlatformMfaController = _ts_decorate53([
13773
13914
  common.UseInterceptors(NoStoreInterceptor),
13774
13915
  common.Controller("platform/mfa"),
13775
13916
  common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13776
13917
  common.UsePipes(createAuthValidationPipe({
13777
13918
  forbidUnknownValues: true
13778
13919
  })),
13779
- _ts_param28(0, common.Inject(exports.MfaService)),
13780
- _ts_metadata49("design:type", Function),
13781
- _ts_metadata49("design:paramtypes", [
13920
+ _ts_param31(0, common.Inject(exports.MfaService)),
13921
+ _ts_metadata52("design:type", Function),
13922
+ _ts_metadata52("design:paramtypes", [
13782
13923
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService
13783
13924
  ])
13784
13925
  ], PlatformMfaController);
13785
- function _ts_decorate51(decorators, target, key, desc) {
13926
+ function _ts_decorate54(decorators, target, key, desc) {
13786
13927
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13787
13928
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13788
13929
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13795,19 +13936,19 @@ function _ts_decorate51(decorators, target, key, desc) {
13795
13936
  }
13796
13937
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13797
13938
  }
13798
- __name(_ts_decorate51, "_ts_decorate");
13799
- function _ts_metadata50(metadataKey, metadataValue) {
13939
+ __name(_ts_decorate54, "_ts_decorate");
13940
+ function _ts_metadata53(metadataKey, metadataValue) {
13800
13941
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13801
13942
  return Reflect.metadata(metadataKey, metadataValue);
13802
13943
  }
13803
13944
  }
13804
- __name(_ts_metadata50, "_ts_metadata");
13805
- function _ts_param29(paramIndex, decorator) {
13945
+ __name(_ts_metadata53, "_ts_metadata");
13946
+ function _ts_param32(paramIndex, decorator) {
13806
13947
  return function(target, key) {
13807
13948
  decorator(target, key, paramIndex);
13808
13949
  };
13809
13950
  }
13810
- __name(_ts_param29, "_ts_param");
13951
+ __name(_ts_param32, "_ts_param");
13811
13952
  var SessionController = class {
13812
13953
  static {
13813
13954
  __name(this, "SessionController");
@@ -13907,64 +14048,64 @@ var SessionController = class {
13907
14048
  });
13908
14049
  }
13909
14050
  };
13910
- _ts_decorate51([
14051
+ _ts_decorate54([
13911
14052
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
13912
14053
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
13913
14054
  common.Get(),
13914
- _ts_param29(0, CurrentUser()),
13915
- _ts_param29(1, common.Req()),
13916
- _ts_metadata50("design:type", Function),
13917
- _ts_metadata50("design:paramtypes", [
14055
+ _ts_param32(0, CurrentUser()),
14056
+ _ts_param32(1, common.Req()),
14057
+ _ts_metadata53("design:type", Function),
14058
+ _ts_metadata53("design:paramtypes", [
13918
14059
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13919
14060
  typeof Request === "undefined" ? Object : Request
13920
14061
  ]),
13921
- _ts_metadata50("design:returntype", Promise)
14062
+ _ts_metadata53("design:returntype", Promise)
13922
14063
  ], SessionController.prototype, "listSessions", null);
13923
- _ts_decorate51([
14064
+ _ts_decorate54([
13924
14065
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13925
14066
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13926
14067
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13927
14068
  RequestEncoding("unchecked"),
13928
14069
  common.Post("revoke-all"),
13929
- _ts_param29(0, CurrentUser()),
13930
- _ts_param29(1, common.Req()),
13931
- _ts_metadata50("design:type", Function),
13932
- _ts_metadata50("design:paramtypes", [
14070
+ _ts_param32(0, CurrentUser()),
14071
+ _ts_param32(1, common.Req()),
14072
+ _ts_metadata53("design:type", Function),
14073
+ _ts_metadata53("design:paramtypes", [
13933
14074
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13934
14075
  typeof Request === "undefined" ? Object : Request
13935
14076
  ]),
13936
- _ts_metadata50("design:returntype", Promise)
14077
+ _ts_metadata53("design:returntype", Promise)
13937
14078
  ], SessionController.prototype, "revokeAllSessions", null);
13938
- _ts_decorate51([
14079
+ _ts_decorate54([
13939
14080
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
13940
14081
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
13941
14082
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13942
14083
  common.Delete(":id"),
13943
- _ts_param29(0, CurrentUser()),
13944
- _ts_param29(1, common.Param("id")),
13945
- _ts_metadata50("design:type", Function),
13946
- _ts_metadata50("design:paramtypes", [
14084
+ _ts_param32(0, CurrentUser()),
14085
+ _ts_param32(1, common.Param("id")),
14086
+ _ts_metadata53("design:type", Function),
14087
+ _ts_metadata53("design:paramtypes", [
13947
14088
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13948
14089
  String
13949
14090
  ]),
13950
- _ts_metadata50("design:returntype", Promise)
14091
+ _ts_metadata53("design:returntype", Promise)
13951
14092
  ], SessionController.prototype, "revokeSession", null);
13952
- SessionController = _ts_decorate51([
14093
+ SessionController = _ts_decorate54([
13953
14094
  common.UseInterceptors(NoStoreInterceptor),
13954
14095
  common.Controller("sessions"),
13955
14096
  common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
13956
14097
  common.UsePipes(createAuthValidationPipe()),
13957
- _ts_param29(0, common.Inject(exports.SessionService)),
13958
- _ts_param29(1, common.Inject(exports.TokenDeliveryService)),
13959
- _ts_metadata50("design:type", Function),
13960
- _ts_metadata50("design:paramtypes", [
14098
+ _ts_param32(0, common.Inject(exports.SessionService)),
14099
+ _ts_param32(1, common.Inject(exports.TokenDeliveryService)),
14100
+ _ts_metadata53("design:type", Function),
14101
+ _ts_metadata53("design:paramtypes", [
13961
14102
  typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
13962
14103
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13963
14104
  ])
13964
14105
  ], SessionController);
13965
14106
  var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
13966
14107
  var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => common.SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
13967
- function _ts_decorate52(decorators, target, key, desc) {
14108
+ function _ts_decorate55(decorators, target, key, desc) {
13968
14109
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13969
14110
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13970
14111
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13977,19 +14118,19 @@ function _ts_decorate52(decorators, target, key, desc) {
13977
14118
  }
13978
14119
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13979
14120
  }
13980
- __name(_ts_decorate52, "_ts_decorate");
13981
- function _ts_metadata51(metadataKey, metadataValue) {
14121
+ __name(_ts_decorate55, "_ts_decorate");
14122
+ function _ts_metadata54(metadataKey, metadataValue) {
13982
14123
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13983
14124
  return Reflect.metadata(metadataKey, metadataValue);
13984
14125
  }
13985
14126
  }
13986
- __name(_ts_metadata51, "_ts_metadata");
13987
- function _ts_param30(paramIndex, decorator) {
14127
+ __name(_ts_metadata54, "_ts_metadata");
14128
+ function _ts_param33(paramIndex, decorator) {
13988
14129
  return function(target, key) {
13989
14130
  decorator(target, key, paramIndex);
13990
14131
  };
13991
14132
  }
13992
- __name(_ts_param30, "_ts_param");
14133
+ __name(_ts_param33, "_ts_param");
13993
14134
  var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
13994
14135
  static {
13995
14136
  __name(this, "ApiKeyLastUsedService");
@@ -14050,12 +14191,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
14050
14191
  await this.flush();
14051
14192
  }
14052
14193
  };
14053
- ApiKeyLastUsedService = _ts_decorate52([
14194
+ ApiKeyLastUsedService = _ts_decorate55([
14054
14195
  common.Injectable(),
14055
- _ts_param30(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
14056
- _ts_param30(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14057
- _ts_metadata51("design:type", Function),
14058
- _ts_metadata51("design:paramtypes", [
14196
+ _ts_param33(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
14197
+ _ts_param33(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14198
+ _ts_metadata54("design:type", Function),
14199
+ _ts_metadata54("design:paramtypes", [
14059
14200
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
14060
14201
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14061
14202
  ])
@@ -14104,7 +14245,7 @@ function digestsMatch(computed, stored) {
14104
14245
  __name(digestsMatch, "digestsMatch");
14105
14246
 
14106
14247
  // src/server/services/api-key-verifier.service.ts
14107
- function _ts_decorate53(decorators, target, key, desc) {
14248
+ function _ts_decorate56(decorators, target, key, desc) {
14108
14249
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14109
14250
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14110
14251
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14117,19 +14258,19 @@ function _ts_decorate53(decorators, target, key, desc) {
14117
14258
  }
14118
14259
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14119
14260
  }
14120
- __name(_ts_decorate53, "_ts_decorate");
14121
- function _ts_metadata52(metadataKey, metadataValue) {
14261
+ __name(_ts_decorate56, "_ts_decorate");
14262
+ function _ts_metadata55(metadataKey, metadataValue) {
14122
14263
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14123
14264
  return Reflect.metadata(metadataKey, metadataValue);
14124
14265
  }
14125
14266
  }
14126
- __name(_ts_metadata52, "_ts_metadata");
14127
- function _ts_param31(paramIndex, decorator) {
14267
+ __name(_ts_metadata55, "_ts_metadata");
14268
+ function _ts_param34(paramIndex, decorator) {
14128
14269
  return function(target, key) {
14129
14270
  decorator(target, key, paramIndex);
14130
14271
  };
14131
14272
  }
14132
- __name(_ts_param31, "_ts_param");
14273
+ __name(_ts_param34, "_ts_param");
14133
14274
  var ApiKeyVerifierService = class {
14134
14275
  static {
14135
14276
  __name(this, "ApiKeyVerifierService");
@@ -14189,14 +14330,14 @@ var ApiKeyVerifierService = class {
14189
14330
  return null;
14190
14331
  }
14191
14332
  };
14192
- ApiKeyVerifierService = _ts_decorate53([
14333
+ ApiKeyVerifierService = _ts_decorate56([
14193
14334
  common.Injectable(),
14194
- _ts_param31(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
14195
- _ts_param31(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
14196
- _ts_param31(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14197
- _ts_param31(3, common.Inject(ApiKeyLastUsedService)),
14198
- _ts_metadata52("design:type", Function),
14199
- _ts_metadata52("design:paramtypes", [
14335
+ _ts_param34(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
14336
+ _ts_param34(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
14337
+ _ts_param34(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14338
+ _ts_param34(3, common.Inject(ApiKeyLastUsedService)),
14339
+ _ts_metadata55("design:type", Function),
14340
+ _ts_metadata55("design:paramtypes", [
14200
14341
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
14201
14342
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
14202
14343
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14205,7 +14346,7 @@ ApiKeyVerifierService = _ts_decorate53([
14205
14346
  ], ApiKeyVerifierService);
14206
14347
 
14207
14348
  // src/server/guards/api-key.guard.ts
14208
- function _ts_decorate54(decorators, target, key, desc) {
14349
+ function _ts_decorate57(decorators, target, key, desc) {
14209
14350
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14210
14351
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14211
14352
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14218,19 +14359,19 @@ function _ts_decorate54(decorators, target, key, desc) {
14218
14359
  }
14219
14360
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14220
14361
  }
14221
- __name(_ts_decorate54, "_ts_decorate");
14222
- function _ts_metadata53(metadataKey, metadataValue) {
14362
+ __name(_ts_decorate57, "_ts_decorate");
14363
+ function _ts_metadata56(metadataKey, metadataValue) {
14223
14364
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14224
14365
  return Reflect.metadata(metadataKey, metadataValue);
14225
14366
  }
14226
14367
  }
14227
- __name(_ts_metadata53, "_ts_metadata");
14228
- function _ts_param32(paramIndex, decorator) {
14368
+ __name(_ts_metadata56, "_ts_metadata");
14369
+ function _ts_param35(paramIndex, decorator) {
14229
14370
  return function(target, key) {
14230
14371
  decorator(target, key, paramIndex);
14231
14372
  };
14232
14373
  }
14233
- __name(_ts_param32, "_ts_param");
14374
+ __name(_ts_param35, "_ts_param");
14234
14375
  exports.ApiKeyGuard = class _ApiKeyGuard {
14235
14376
  static {
14236
14377
  __name(this, "ApiKeyGuard");
@@ -14370,15 +14511,15 @@ exports.ApiKeyGuard = class _ApiKeyGuard {
14370
14511
  };
14371
14512
  }
14372
14513
  };
14373
- exports.ApiKeyGuard = _ts_decorate54([
14514
+ exports.ApiKeyGuard = _ts_decorate57([
14374
14515
  common.Injectable(),
14375
- _ts_param32(0, common.Inject(core.Reflector)),
14376
- _ts_param32(1, common.Inject(ApiKeyVerifierService)),
14377
- _ts_param32(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14378
- _ts_param32(3, common.Inject(BYMAX_AUTH_HOOKS)),
14379
- _ts_param32(3, common.Optional()),
14380
- _ts_metadata53("design:type", Function),
14381
- _ts_metadata53("design:paramtypes", [
14516
+ _ts_param35(0, common.Inject(core.Reflector)),
14517
+ _ts_param35(1, common.Inject(ApiKeyVerifierService)),
14518
+ _ts_param35(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14519
+ _ts_param35(3, common.Inject(BYMAX_AUTH_HOOKS)),
14520
+ _ts_param35(3, common.Optional()),
14521
+ _ts_metadata56("design:type", Function),
14522
+ _ts_metadata56("design:paramtypes", [
14382
14523
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14383
14524
  typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
14384
14525
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14390,7 +14531,7 @@ function routePattern(request) {
14390
14531
  return typeof path === "string" ? path : "";
14391
14532
  }
14392
14533
  __name(routePattern, "routePattern");
14393
- function _ts_decorate55(decorators, target, key, desc) {
14534
+ function _ts_decorate58(decorators, target, key, desc) {
14394
14535
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14395
14536
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14396
14537
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14403,19 +14544,19 @@ function _ts_decorate55(decorators, target, key, desc) {
14403
14544
  }
14404
14545
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14405
14546
  }
14406
- __name(_ts_decorate55, "_ts_decorate");
14407
- function _ts_metadata54(metadataKey, metadataValue) {
14547
+ __name(_ts_decorate58, "_ts_decorate");
14548
+ function _ts_metadata57(metadataKey, metadataValue) {
14408
14549
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14409
14550
  return Reflect.metadata(metadataKey, metadataValue);
14410
14551
  }
14411
14552
  }
14412
- __name(_ts_metadata54, "_ts_metadata");
14413
- function _ts_param33(paramIndex, decorator) {
14553
+ __name(_ts_metadata57, "_ts_metadata");
14554
+ function _ts_param36(paramIndex, decorator) {
14414
14555
  return function(target, key) {
14415
14556
  decorator(target, key, paramIndex);
14416
14557
  };
14417
14558
  }
14418
- __name(_ts_param33, "_ts_param");
14559
+ __name(_ts_param36, "_ts_param");
14419
14560
  exports.MfaRequiredGuard = class MfaRequiredGuard {
14420
14561
  static {
14421
14562
  __name(this, "MfaRequiredGuard");
@@ -14442,11 +14583,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
14442
14583
  return true;
14443
14584
  }
14444
14585
  };
14445
- exports.MfaRequiredGuard = _ts_decorate55([
14586
+ exports.MfaRequiredGuard = _ts_decorate58([
14446
14587
  common.Injectable(),
14447
- _ts_param33(0, common.Inject(core.Reflector)),
14448
- _ts_metadata54("design:type", Function),
14449
- _ts_metadata54("design:paramtypes", [
14588
+ _ts_param36(0, common.Inject(core.Reflector)),
14589
+ _ts_metadata57("design:type", Function),
14590
+ _ts_metadata57("design:paramtypes", [
14450
14591
  typeof core.Reflector === "undefined" ? Object : core.Reflector
14451
14592
  ])
14452
14593
  ], exports.MfaRequiredGuard);
@@ -14454,7 +14595,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
14454
14595
  var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
14455
14596
 
14456
14597
  // src/server/guards/platform-roles.guard.ts
14457
- function _ts_decorate56(decorators, target, key, desc) {
14598
+ function _ts_decorate59(decorators, target, key, desc) {
14458
14599
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14459
14600
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14460
14601
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14467,19 +14608,19 @@ function _ts_decorate56(decorators, target, key, desc) {
14467
14608
  }
14468
14609
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14469
14610
  }
14470
- __name(_ts_decorate56, "_ts_decorate");
14471
- function _ts_metadata55(metadataKey, metadataValue) {
14611
+ __name(_ts_decorate59, "_ts_decorate");
14612
+ function _ts_metadata58(metadataKey, metadataValue) {
14472
14613
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14473
14614
  return Reflect.metadata(metadataKey, metadataValue);
14474
14615
  }
14475
14616
  }
14476
- __name(_ts_metadata55, "_ts_metadata");
14477
- function _ts_param34(paramIndex, decorator) {
14617
+ __name(_ts_metadata58, "_ts_metadata");
14618
+ function _ts_param37(paramIndex, decorator) {
14478
14619
  return function(target, key) {
14479
14620
  decorator(target, key, paramIndex);
14480
14621
  };
14481
14622
  }
14482
- __name(_ts_param34, "_ts_param");
14623
+ __name(_ts_param37, "_ts_param");
14483
14624
  exports.PlatformRolesGuard = class PlatformRolesGuard {
14484
14625
  static {
14485
14626
  __name(this, "PlatformRolesGuard");
@@ -14513,12 +14654,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
14513
14654
  return true;
14514
14655
  }
14515
14656
  };
14516
- exports.PlatformRolesGuard = _ts_decorate56([
14657
+ exports.PlatformRolesGuard = _ts_decorate59([
14517
14658
  common.Injectable(),
14518
- _ts_param34(0, common.Inject(core.Reflector)),
14519
- _ts_param34(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14520
- _ts_metadata55("design:type", Function),
14521
- _ts_metadata55("design:paramtypes", [
14659
+ _ts_param37(0, common.Inject(core.Reflector)),
14660
+ _ts_param37(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14661
+ _ts_metadata58("design:type", Function),
14662
+ _ts_metadata58("design:paramtypes", [
14522
14663
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14523
14664
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14524
14665
  ])
@@ -14527,7 +14668,7 @@ var ROLES_KEY = "roles";
14527
14668
  var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
14528
14669
 
14529
14670
  // src/server/guards/roles.guard.ts
14530
- function _ts_decorate57(decorators, target, key, desc) {
14671
+ function _ts_decorate60(decorators, target, key, desc) {
14531
14672
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14532
14673
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14533
14674
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14540,19 +14681,19 @@ function _ts_decorate57(decorators, target, key, desc) {
14540
14681
  }
14541
14682
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14542
14683
  }
14543
- __name(_ts_decorate57, "_ts_decorate");
14544
- function _ts_metadata56(metadataKey, metadataValue) {
14684
+ __name(_ts_decorate60, "_ts_decorate");
14685
+ function _ts_metadata59(metadataKey, metadataValue) {
14545
14686
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14546
14687
  return Reflect.metadata(metadataKey, metadataValue);
14547
14688
  }
14548
14689
  }
14549
- __name(_ts_metadata56, "_ts_metadata");
14550
- function _ts_param35(paramIndex, decorator) {
14690
+ __name(_ts_metadata59, "_ts_metadata");
14691
+ function _ts_param38(paramIndex, decorator) {
14551
14692
  return function(target, key) {
14552
14693
  decorator(target, key, paramIndex);
14553
14694
  };
14554
14695
  }
14555
- __name(_ts_param35, "_ts_param");
14696
+ __name(_ts_param38, "_ts_param");
14556
14697
  exports.RolesGuard = class RolesGuard {
14557
14698
  static {
14558
14699
  __name(this, "RolesGuard");
@@ -14582,17 +14723,17 @@ exports.RolesGuard = class RolesGuard {
14582
14723
  return true;
14583
14724
  }
14584
14725
  };
14585
- exports.RolesGuard = _ts_decorate57([
14726
+ exports.RolesGuard = _ts_decorate60([
14586
14727
  common.Injectable(),
14587
- _ts_param35(0, common.Inject(core.Reflector)),
14588
- _ts_param35(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14589
- _ts_metadata56("design:type", Function),
14590
- _ts_metadata56("design:paramtypes", [
14728
+ _ts_param38(0, common.Inject(core.Reflector)),
14729
+ _ts_param38(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14730
+ _ts_metadata59("design:type", Function),
14731
+ _ts_metadata59("design:paramtypes", [
14591
14732
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14592
14733
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14593
14734
  ])
14594
14735
  ], exports.RolesGuard);
14595
- function _ts_decorate58(decorators, target, key, desc) {
14736
+ function _ts_decorate61(decorators, target, key, desc) {
14596
14737
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14597
14738
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14598
14739
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14605,7 +14746,7 @@ function _ts_decorate58(decorators, target, key, desc) {
14605
14746
  }
14606
14747
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14607
14748
  }
14608
- __name(_ts_decorate58, "_ts_decorate");
14749
+ __name(_ts_decorate61, "_ts_decorate");
14609
14750
  exports.NoOpAuthHooks = class NoOpAuthHooks {
14610
14751
  static {
14611
14752
  __name(this, "NoOpAuthHooks");
@@ -14654,7 +14795,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
14654
14795
  };
14655
14796
  }
14656
14797
  };
14657
- exports.NoOpAuthHooks = _ts_decorate58([
14798
+ exports.NoOpAuthHooks = _ts_decorate61([
14658
14799
  common.Injectable()
14659
14800
  ], exports.NoOpAuthHooks);
14660
14801
 
@@ -14667,7 +14808,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
14667
14808
  var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
14668
14809
 
14669
14810
  // src/server/oauth/oauth.service.ts
14670
- function _ts_decorate59(decorators, target, key, desc) {
14811
+ function _ts_decorate62(decorators, target, key, desc) {
14671
14812
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14672
14813
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14673
14814
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14680,19 +14821,19 @@ function _ts_decorate59(decorators, target, key, desc) {
14680
14821
  }
14681
14822
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14682
14823
  }
14683
- __name(_ts_decorate59, "_ts_decorate");
14684
- function _ts_metadata57(metadataKey, metadataValue) {
14824
+ __name(_ts_decorate62, "_ts_decorate");
14825
+ function _ts_metadata60(metadataKey, metadataValue) {
14685
14826
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14686
14827
  return Reflect.metadata(metadataKey, metadataValue);
14687
14828
  }
14688
14829
  }
14689
- __name(_ts_metadata57, "_ts_metadata");
14690
- function _ts_param36(paramIndex, decorator) {
14830
+ __name(_ts_metadata60, "_ts_metadata");
14831
+ function _ts_param39(paramIndex, decorator) {
14691
14832
  return function(target, key) {
14692
14833
  decorator(target, key, paramIndex);
14693
14834
  };
14694
14835
  }
14695
- __name(_ts_param36, "_ts_param");
14836
+ __name(_ts_param39, "_ts_param");
14696
14837
  var OAUTH_STATE_TTL_SECONDS = 600;
14697
14838
  function isStoredOAuthState(value) {
14698
14839
  if (typeof value !== "object" || value === null) return false;
@@ -14986,18 +15127,18 @@ exports.OAuthService = class _OAuthService {
14986
15127
  return plugin;
14987
15128
  }
14988
15129
  };
14989
- exports.OAuthService = _ts_decorate59([
15130
+ exports.OAuthService = _ts_decorate62([
14990
15131
  common.Injectable(),
14991
- _ts_param36(0, common.Inject(OAUTH_PLUGINS)),
14992
- _ts_param36(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
14993
- _ts_param36(2, common.Inject(BYMAX_AUTH_HOOKS)),
14994
- _ts_param36(2, common.Optional()),
14995
- _ts_param36(3, common.Inject(AuthRedisService)),
14996
- _ts_param36(4, common.Inject(TokenManagerService)),
14997
- _ts_param36(5, common.Inject(exports.SessionService)),
14998
- _ts_param36(6, common.Inject(BYMAX_AUTH_OPTIONS)),
14999
- _ts_metadata57("design:type", Function),
15000
- _ts_metadata57("design:paramtypes", [
15132
+ _ts_param39(0, common.Inject(OAUTH_PLUGINS)),
15133
+ _ts_param39(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
15134
+ _ts_param39(2, common.Inject(BYMAX_AUTH_HOOKS)),
15135
+ _ts_param39(2, common.Optional()),
15136
+ _ts_param39(3, common.Inject(AuthRedisService)),
15137
+ _ts_param39(4, common.Inject(TokenManagerService)),
15138
+ _ts_param39(5, common.Inject(exports.SessionService)),
15139
+ _ts_param39(6, common.Inject(BYMAX_AUTH_OPTIONS)),
15140
+ _ts_metadata60("design:type", Function),
15141
+ _ts_metadata60("design:paramtypes", [
15001
15142
  Array,
15002
15143
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
15003
15144
  Object,
@@ -15007,7 +15148,7 @@ exports.OAuthService = _ts_decorate59([
15007
15148
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
15008
15149
  ])
15009
15150
  ], exports.OAuthService);
15010
- function _ts_decorate60(decorators, target, key, desc) {
15151
+ function _ts_decorate63(decorators, target, key, desc) {
15011
15152
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15012
15153
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15013
15154
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15020,13 +15161,13 @@ function _ts_decorate60(decorators, target, key, desc) {
15020
15161
  }
15021
15162
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15022
15163
  }
15023
- __name(_ts_decorate60, "_ts_decorate");
15024
- function _ts_metadata58(metadataKey, metadataValue) {
15164
+ __name(_ts_decorate63, "_ts_decorate");
15165
+ function _ts_metadata61(metadataKey, metadataValue) {
15025
15166
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15026
15167
  return Reflect.metadata(metadataKey, metadataValue);
15027
15168
  }
15028
15169
  }
15029
- __name(_ts_metadata58, "_ts_metadata");
15170
+ __name(_ts_metadata61, "_ts_metadata");
15030
15171
  var OAuthCallbackQueryDto = class {
15031
15172
  static {
15032
15173
  __name(this, "OAuthCallbackQueryDto");
@@ -15125,69 +15266,69 @@ var OAuthCallbackQueryDto = class {
15125
15266
  */
15126
15267
  hd;
15127
15268
  };
15128
- _ts_decorate60([
15269
+ _ts_decorate63([
15129
15270
  classValidator.ValidateIf((query) => query.error === void 0 || query.error === null),
15130
15271
  classValidator.IsOptional(),
15131
15272
  classValidator.IsString(),
15132
15273
  classValidator.IsNotEmpty(),
15133
15274
  classValidator.MaxLength(2048),
15134
- _ts_metadata58("design:type", String)
15275
+ _ts_metadata61("design:type", String)
15135
15276
  ], OAuthCallbackQueryDto.prototype, "code", void 0);
15136
- _ts_decorate60([
15277
+ _ts_decorate63([
15137
15278
  classValidator.IsOptional(),
15138
15279
  classValidator.IsString(),
15139
15280
  classValidator.MaxLength(128),
15140
- _ts_metadata58("design:type", String)
15281
+ _ts_metadata61("design:type", String)
15141
15282
  ], OAuthCallbackQueryDto.prototype, "error", void 0);
15142
- _ts_decorate60([
15283
+ _ts_decorate63([
15143
15284
  classValidator.IsOptional(),
15144
15285
  classValidator.IsString(),
15145
15286
  classValidator.MaxLength(512),
15146
- _ts_metadata58("design:type", String)
15287
+ _ts_metadata61("design:type", String)
15147
15288
  ], OAuthCallbackQueryDto.prototype, "error_description", void 0);
15148
- _ts_decorate60([
15289
+ _ts_decorate63([
15149
15290
  classValidator.IsOptional(),
15150
15291
  classValidator.IsString(),
15151
15292
  classValidator.MaxLength(512),
15152
- _ts_metadata58("design:type", String)
15293
+ _ts_metadata61("design:type", String)
15153
15294
  ], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
15154
- _ts_decorate60([
15295
+ _ts_decorate63([
15155
15296
  classValidator.IsString(),
15156
15297
  classValidator.IsNotEmpty(),
15157
15298
  classValidator.MaxLength(128),
15158
- _ts_metadata58("design:type", String)
15299
+ _ts_metadata61("design:type", String)
15159
15300
  ], OAuthCallbackQueryDto.prototype, "state", void 0);
15160
- _ts_decorate60([
15301
+ _ts_decorate63([
15161
15302
  classValidator.IsOptional(),
15162
15303
  classValidator.IsString(),
15163
15304
  classValidator.MaxLength(512),
15164
- _ts_metadata58("design:type", String)
15305
+ _ts_metadata61("design:type", String)
15165
15306
  ], OAuthCallbackQueryDto.prototype, "iss", void 0);
15166
- _ts_decorate60([
15307
+ _ts_decorate63([
15167
15308
  classValidator.IsOptional(),
15168
15309
  classValidator.IsString(),
15169
15310
  classValidator.MaxLength(2048),
15170
- _ts_metadata58("design:type", String)
15311
+ _ts_metadata61("design:type", String)
15171
15312
  ], OAuthCallbackQueryDto.prototype, "scope", void 0);
15172
- _ts_decorate60([
15313
+ _ts_decorate63([
15173
15314
  classValidator.IsOptional(),
15174
15315
  classValidator.IsString(),
15175
15316
  classValidator.MaxLength(16),
15176
- _ts_metadata58("design:type", String)
15317
+ _ts_metadata61("design:type", String)
15177
15318
  ], OAuthCallbackQueryDto.prototype, "authuser", void 0);
15178
- _ts_decorate60([
15319
+ _ts_decorate63([
15179
15320
  classValidator.IsOptional(),
15180
15321
  classValidator.IsString(),
15181
15322
  classValidator.MaxLength(64),
15182
- _ts_metadata58("design:type", String)
15323
+ _ts_metadata61("design:type", String)
15183
15324
  ], OAuthCallbackQueryDto.prototype, "prompt", void 0);
15184
- _ts_decorate60([
15325
+ _ts_decorate63([
15185
15326
  classValidator.IsOptional(),
15186
15327
  classValidator.IsString(),
15187
15328
  classValidator.MaxLength(253),
15188
- _ts_metadata58("design:type", String)
15329
+ _ts_metadata61("design:type", String)
15189
15330
  ], OAuthCallbackQueryDto.prototype, "hd", void 0);
15190
- function _ts_decorate61(decorators, target, key, desc) {
15331
+ function _ts_decorate64(decorators, target, key, desc) {
15191
15332
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15192
15333
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15193
15334
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15200,13 +15341,13 @@ function _ts_decorate61(decorators, target, key, desc) {
15200
15341
  }
15201
15342
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15202
15343
  }
15203
- __name(_ts_decorate61, "_ts_decorate");
15204
- function _ts_metadata59(metadataKey, metadataValue) {
15344
+ __name(_ts_decorate64, "_ts_decorate");
15345
+ function _ts_metadata62(metadataKey, metadataValue) {
15205
15346
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15206
15347
  return Reflect.metadata(metadataKey, metadataValue);
15207
15348
  }
15208
15349
  }
15209
- __name(_ts_metadata59, "_ts_metadata");
15350
+ __name(_ts_metadata62, "_ts_metadata");
15210
15351
  var OAuthInitiateQueryDto = class {
15211
15352
  static {
15212
15353
  __name(this, "OAuthInitiateQueryDto");
@@ -15223,7 +15364,7 @@ var OAuthInitiateQueryDto = class {
15223
15364
  */
15224
15365
  tenantId;
15225
15366
  };
15226
- _ts_decorate61([
15367
+ _ts_decorate64([
15227
15368
  classValidator.IsOptional(),
15228
15369
  classValidator.IsString(),
15229
15370
  classValidator.IsNotEmpty(),
@@ -15231,11 +15372,11 @@ _ts_decorate61([
15231
15372
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
15232
15373
  message: "tenantId must not contain control characters"
15233
15374
  }),
15234
- _ts_metadata59("design:type", String)
15375
+ _ts_metadata62("design:type", String)
15235
15376
  ], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
15236
15377
 
15237
15378
  // src/server/oauth/oauth.controller.ts
15238
- function _ts_decorate62(decorators, target, key, desc) {
15379
+ function _ts_decorate65(decorators, target, key, desc) {
15239
15380
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15240
15381
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15241
15382
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15248,19 +15389,19 @@ function _ts_decorate62(decorators, target, key, desc) {
15248
15389
  }
15249
15390
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15250
15391
  }
15251
- __name(_ts_decorate62, "_ts_decorate");
15252
- function _ts_metadata60(metadataKey, metadataValue) {
15392
+ __name(_ts_decorate65, "_ts_decorate");
15393
+ function _ts_metadata63(metadataKey, metadataValue) {
15253
15394
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15254
15395
  return Reflect.metadata(metadataKey, metadataValue);
15255
15396
  }
15256
15397
  }
15257
- __name(_ts_metadata60, "_ts_metadata");
15258
- function _ts_param37(paramIndex, decorator) {
15398
+ __name(_ts_metadata63, "_ts_metadata");
15399
+ function _ts_param40(paramIndex, decorator) {
15259
15400
  return function(target, key) {
15260
15401
  decorator(target, key, paramIndex);
15261
15402
  };
15262
15403
  }
15263
- __name(_ts_param37, "_ts_param");
15404
+ __name(_ts_param40, "_ts_param");
15264
15405
  function isOAuthMfaChallenge(result) {
15265
15406
  return "mfaRequired" in result && result.mfaRequired === true;
15266
15407
  }
@@ -15478,46 +15619,46 @@ var OAuthController = class _OAuthController {
15478
15619
  });
15479
15620
  }
15480
15621
  };
15481
- _ts_decorate62([
15622
+ _ts_decorate65([
15482
15623
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15483
15624
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15484
15625
  common.Get(":provider"),
15485
- _ts_param37(0, common.Param("provider")),
15486
- _ts_param37(1, common.Query()),
15487
- _ts_param37(2, common.Req()),
15488
- _ts_param37(3, common.Res({
15626
+ _ts_param40(0, common.Param("provider")),
15627
+ _ts_param40(1, common.Query()),
15628
+ _ts_param40(2, common.Req()),
15629
+ _ts_param40(3, common.Res({
15489
15630
  passthrough: true
15490
15631
  })),
15491
- _ts_metadata60("design:type", Function),
15492
- _ts_metadata60("design:paramtypes", [
15632
+ _ts_metadata63("design:type", Function),
15633
+ _ts_metadata63("design:paramtypes", [
15493
15634
  String,
15494
15635
  typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
15495
15636
  typeof Request === "undefined" ? Object : Request,
15496
15637
  typeof Response === "undefined" ? Object : Response
15497
15638
  ]),
15498
- _ts_metadata60("design:returntype", Promise)
15639
+ _ts_metadata63("design:returntype", Promise)
15499
15640
  ], OAuthController.prototype, "initiate", null);
15500
- _ts_decorate62([
15641
+ _ts_decorate65([
15501
15642
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
15502
15643
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
15503
15644
  common.HttpCode(common.HttpStatus.OK),
15504
15645
  common.Get(":provider/callback"),
15505
- _ts_param37(0, common.Param("provider")),
15506
- _ts_param37(1, common.Query()),
15507
- _ts_param37(2, common.Req()),
15508
- _ts_param37(3, common.Res({
15646
+ _ts_param40(0, common.Param("provider")),
15647
+ _ts_param40(1, common.Query()),
15648
+ _ts_param40(2, common.Req()),
15649
+ _ts_param40(3, common.Res({
15509
15650
  passthrough: true
15510
15651
  })),
15511
- _ts_metadata60("design:type", Function),
15512
- _ts_metadata60("design:paramtypes", [
15652
+ _ts_metadata63("design:type", Function),
15653
+ _ts_metadata63("design:paramtypes", [
15513
15654
  String,
15514
15655
  typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
15515
15656
  typeof Request === "undefined" ? Object : Request,
15516
15657
  typeof Response === "undefined" ? Object : Response
15517
15658
  ]),
15518
- _ts_metadata60("design:returntype", Promise)
15659
+ _ts_metadata63("design:returntype", Promise)
15519
15660
  ], OAuthController.prototype, "callback", null);
15520
- OAuthController = _ts_decorate62([
15661
+ OAuthController = _ts_decorate65([
15521
15662
  Public(),
15522
15663
  SkipMfa(),
15523
15664
  common.UseInterceptors(NoStoreInterceptor),
@@ -15526,11 +15667,11 @@ OAuthController = _ts_decorate62([
15526
15667
  common.UsePipes(createAuthValidationPipe({
15527
15668
  forbidUnknownValues: true
15528
15669
  })),
15529
- _ts_param37(0, common.Inject(exports.OAuthService)),
15530
- _ts_param37(1, common.Inject(exports.TokenDeliveryService)),
15531
- _ts_param37(2, common.Inject(BYMAX_AUTH_OPTIONS)),
15532
- _ts_metadata60("design:type", Function),
15533
- _ts_metadata60("design:paramtypes", [
15670
+ _ts_param40(0, common.Inject(exports.OAuthService)),
15671
+ _ts_param40(1, common.Inject(exports.TokenDeliveryService)),
15672
+ _ts_param40(2, common.Inject(BYMAX_AUTH_OPTIONS)),
15673
+ _ts_metadata63("design:type", Function),
15674
+ _ts_metadata63("design:paramtypes", [
15534
15675
  typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
15535
15676
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
15536
15677
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -15669,7 +15810,7 @@ var GoogleOAuthPlugin = class {
15669
15810
  };
15670
15811
 
15671
15812
  // src/server/oauth/oauth.module.ts
15672
- function _ts_decorate63(decorators, target, key, desc) {
15813
+ function _ts_decorate66(decorators, target, key, desc) {
15673
15814
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15674
15815
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15675
15816
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15682,7 +15823,7 @@ function _ts_decorate63(decorators, target, key, desc) {
15682
15823
  }
15683
15824
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15684
15825
  }
15685
- __name(_ts_decorate63, "_ts_decorate");
15826
+ __name(_ts_decorate66, "_ts_decorate");
15686
15827
  function buildOAuthPlugins(options) {
15687
15828
  const plugins = [];
15688
15829
  if (options.oauth?.google) {
@@ -15752,7 +15893,7 @@ var OAuthModule = class _OAuthModule {
15752
15893
  };
15753
15894
  }
15754
15895
  };
15755
- OAuthModule = _ts_decorate63([
15896
+ OAuthModule = _ts_decorate66([
15756
15897
  common.Module({})
15757
15898
  ], OAuthModule);
15758
15899
 
@@ -16647,7 +16788,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
16647
16788
  __name(schemesFor, "schemesFor");
16648
16789
 
16649
16790
  // src/server/openapi/auth-openapi.contributor.ts
16650
- function _ts_decorate64(decorators, target, key, desc) {
16791
+ function _ts_decorate67(decorators, target, key, desc) {
16651
16792
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16652
16793
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16653
16794
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16660,19 +16801,19 @@ function _ts_decorate64(decorators, target, key, desc) {
16660
16801
  }
16661
16802
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16662
16803
  }
16663
- __name(_ts_decorate64, "_ts_decorate");
16664
- function _ts_metadata61(metadataKey, metadataValue) {
16804
+ __name(_ts_decorate67, "_ts_decorate");
16805
+ function _ts_metadata64(metadataKey, metadataValue) {
16665
16806
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16666
16807
  return Reflect.metadata(metadataKey, metadataValue);
16667
16808
  }
16668
16809
  }
16669
- __name(_ts_metadata61, "_ts_metadata");
16670
- function _ts_param38(paramIndex, decorator) {
16810
+ __name(_ts_metadata64, "_ts_metadata");
16811
+ function _ts_param41(paramIndex, decorator) {
16671
16812
  return function(target, key) {
16672
16813
  decorator(target, key, paramIndex);
16673
16814
  };
16674
16815
  }
16675
- __name(_ts_param38, "_ts_param");
16816
+ __name(_ts_param41, "_ts_param");
16676
16817
  var AuthOpenApiContributor = class {
16677
16818
  static {
16678
16819
  __name(this, "AuthOpenApiContributor");
@@ -16692,18 +16833,18 @@ var AuthOpenApiContributor = class {
16692
16833
  return buildAuthOpenApiFragment(this.options, this.registered);
16693
16834
  }
16694
16835
  };
16695
- AuthOpenApiContributor = _ts_decorate64([
16836
+ AuthOpenApiContributor = _ts_decorate67([
16696
16837
  common.Injectable(),
16697
16838
  common.SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
16698
- _ts_param38(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16699
- _ts_param38(1, common.Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
16700
- _ts_metadata61("design:type", Function),
16701
- _ts_metadata61("design:paramtypes", [
16839
+ _ts_param41(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16840
+ _ts_param41(1, common.Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
16841
+ _ts_metadata64("design:type", Function),
16842
+ _ts_metadata64("design:paramtypes", [
16702
16843
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
16703
16844
  typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
16704
16845
  ])
16705
16846
  ], AuthOpenApiContributor);
16706
- function _ts_decorate65(decorators, target, key, desc) {
16847
+ function _ts_decorate68(decorators, target, key, desc) {
16707
16848
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16708
16849
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16709
16850
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16716,19 +16857,19 @@ function _ts_decorate65(decorators, target, key, desc) {
16716
16857
  }
16717
16858
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16718
16859
  }
16719
- __name(_ts_decorate65, "_ts_decorate");
16720
- function _ts_metadata62(metadataKey, metadataValue) {
16860
+ __name(_ts_decorate68, "_ts_decorate");
16861
+ function _ts_metadata65(metadataKey, metadataValue) {
16721
16862
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16722
16863
  return Reflect.metadata(metadataKey, metadataValue);
16723
16864
  }
16724
16865
  }
16725
- __name(_ts_metadata62, "_ts_metadata");
16726
- function _ts_param39(paramIndex, decorator) {
16866
+ __name(_ts_metadata65, "_ts_metadata");
16867
+ function _ts_param42(paramIndex, decorator) {
16727
16868
  return function(target, key) {
16728
16869
  decorator(target, key, paramIndex);
16729
16870
  };
16730
16871
  }
16731
- __name(_ts_param39, "_ts_param");
16872
+ __name(_ts_param42, "_ts_param");
16732
16873
  var COMMON_BASE_WORDS = [
16733
16874
  // The perennial top of every published list.
16734
16875
  "password",
@@ -17034,16 +17175,16 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
17034
17175
  return false;
17035
17176
  }
17036
17177
  };
17037
- exports.CommonPasswordChecker = _ts_decorate65([
17178
+ exports.CommonPasswordChecker = _ts_decorate68([
17038
17179
  common.Injectable(),
17039
- _ts_param39(0, common.Inject(BYMAX_AUTH_OPTIONS)),
17040
- _ts_param39(0, common.Optional()),
17041
- _ts_metadata62("design:type", Function),
17042
- _ts_metadata62("design:paramtypes", [
17180
+ _ts_param42(0, common.Inject(BYMAX_AUTH_OPTIONS)),
17181
+ _ts_param42(0, common.Optional()),
17182
+ _ts_metadata65("design:type", Function),
17183
+ _ts_metadata65("design:paramtypes", [
17043
17184
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
17044
17185
  ])
17045
17186
  ], exports.CommonPasswordChecker);
17046
- function _ts_decorate66(decorators, target, key, desc) {
17187
+ function _ts_decorate69(decorators, target, key, desc) {
17047
17188
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17048
17189
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17049
17190
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17056,7 +17197,7 @@ function _ts_decorate66(decorators, target, key, desc) {
17056
17197
  }
17057
17198
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17058
17199
  }
17059
- __name(_ts_decorate66, "_ts_decorate");
17200
+ __name(_ts_decorate69, "_ts_decorate");
17060
17201
  exports.NoOpEmailProvider = class _NoOpEmailProvider {
17061
17202
  static {
17062
17203
  __name(this, "NoOpEmailProvider");
@@ -17091,7 +17232,7 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
17091
17232
  this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
17092
17233
  }
17093
17234
  };
17094
- exports.NoOpEmailProvider = _ts_decorate66([
17235
+ exports.NoOpEmailProvider = _ts_decorate69([
17095
17236
  common.Injectable()
17096
17237
  ], exports.NoOpEmailProvider);
17097
17238
 
@@ -17105,7 +17246,7 @@ var SystemApiKeyClock = class {
17105
17246
  return /* @__PURE__ */ new Date();
17106
17247
  }
17107
17248
  };
17108
- function _ts_decorate67(decorators, target, key, desc) {
17249
+ function _ts_decorate70(decorators, target, key, desc) {
17109
17250
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17110
17251
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17111
17252
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17118,19 +17259,19 @@ function _ts_decorate67(decorators, target, key, desc) {
17118
17259
  }
17119
17260
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17120
17261
  }
17121
- __name(_ts_decorate67, "_ts_decorate");
17122
- function _ts_metadata63(metadataKey, metadataValue) {
17262
+ __name(_ts_decorate70, "_ts_decorate");
17263
+ function _ts_metadata66(metadataKey, metadataValue) {
17123
17264
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17124
17265
  return Reflect.metadata(metadataKey, metadataValue);
17125
17266
  }
17126
17267
  }
17127
- __name(_ts_metadata63, "_ts_metadata");
17128
- function _ts_param40(paramIndex, decorator) {
17268
+ __name(_ts_metadata66, "_ts_metadata");
17269
+ function _ts_param43(paramIndex, decorator) {
17129
17270
  return function(target, key) {
17130
17271
  decorator(target, key, paramIndex);
17131
17272
  };
17132
17273
  }
17133
- __name(_ts_param40, "_ts_param");
17274
+ __name(_ts_param43, "_ts_param");
17134
17275
  var ApiKeyScopeAuditService = class {
17135
17276
  static {
17136
17277
  __name(this, "ApiKeyScopeAuditService");
@@ -17173,21 +17314,21 @@ var ApiKeyScopeAuditService = class {
17173
17314
  }
17174
17315
  }
17175
17316
  };
17176
- ApiKeyScopeAuditService = _ts_decorate67([
17317
+ ApiKeyScopeAuditService = _ts_decorate70([
17177
17318
  common.Injectable(),
17178
- _ts_param40(0, common.Inject(core.DiscoveryService)),
17179
- _ts_param40(1, common.Inject(core.MetadataScanner)),
17180
- _ts_param40(2, common.Inject(core.Reflector)),
17181
- _ts_param40(3, common.Inject(BYMAX_AUTH_OPTIONS)),
17182
- _ts_metadata63("design:type", Function),
17183
- _ts_metadata63("design:paramtypes", [
17319
+ _ts_param43(0, common.Inject(core.DiscoveryService)),
17320
+ _ts_param43(1, common.Inject(core.MetadataScanner)),
17321
+ _ts_param43(2, common.Inject(core.Reflector)),
17322
+ _ts_param43(3, common.Inject(BYMAX_AUTH_OPTIONS)),
17323
+ _ts_metadata66("design:type", Function),
17324
+ _ts_metadata66("design:paramtypes", [
17184
17325
  typeof core.DiscoveryService === "undefined" ? Object : core.DiscoveryService,
17185
17326
  typeof core.MetadataScanner === "undefined" ? Object : core.MetadataScanner,
17186
17327
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
17187
17328
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
17188
17329
  ])
17189
17330
  ], ApiKeyScopeAuditService);
17190
- function _ts_decorate68(decorators, target, key, desc) {
17331
+ function _ts_decorate71(decorators, target, key, desc) {
17191
17332
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17192
17333
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17193
17334
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17200,19 +17341,19 @@ function _ts_decorate68(decorators, target, key, desc) {
17200
17341
  }
17201
17342
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17202
17343
  }
17203
- __name(_ts_decorate68, "_ts_decorate");
17204
- function _ts_metadata64(metadataKey, metadataValue) {
17344
+ __name(_ts_decorate71, "_ts_decorate");
17345
+ function _ts_metadata67(metadataKey, metadataValue) {
17205
17346
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17206
17347
  return Reflect.metadata(metadataKey, metadataValue);
17207
17348
  }
17208
17349
  }
17209
- __name(_ts_metadata64, "_ts_metadata");
17210
- function _ts_param41(paramIndex, decorator) {
17350
+ __name(_ts_metadata67, "_ts_metadata");
17351
+ function _ts_param44(paramIndex, decorator) {
17211
17352
  return function(target, key) {
17212
17353
  decorator(target, key, paramIndex);
17213
17354
  };
17214
17355
  }
17215
- __name(_ts_param41, "_ts_param");
17356
+ __name(_ts_param44, "_ts_param");
17216
17357
  var API_KEY_MAX_LABEL_LENGTH = 128;
17217
17358
  var API_KEY_MAX_OVERLAP_SECONDS = 2592e3;
17218
17359
  var CONTROL_CHARACTERS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
@@ -17273,6 +17414,11 @@ exports.ApiKeyService = class ApiKeyService {
17273
17414
  * The new key is issued first and the old one retired second, so a failure between the two
17274
17415
  * leaves both valid — the safe direction — rather than neither.
17275
17416
  *
17417
+ * With an overlap the old key's deadline is lowered through the repository's optional
17418
+ * `limitExpiry`, an atomic minimum, so concurrent rotations of one key cannot push a shorter
17419
+ * deadline back. A repository without it gets a read followed by `setExpiry`, which two
17420
+ * rotations of the same key can interleave; such a host must serialize rotation per key.
17421
+ *
17276
17422
  * @param id - The active key to replace.
17277
17423
  * @param input - The overlap and an optional expiry for the new key.
17278
17424
  * @returns The new key, plaintext once.
@@ -17302,11 +17448,15 @@ exports.ApiKeyService = class ApiKeyService {
17302
17448
  await this.repository.markRevoked(old.id, now);
17303
17449
  } else {
17304
17450
  const retireAt = new Date(now.getTime() + overlap * 1e3);
17305
- const sooner = (
17306
- // Stryker disable next-line EqualityOperator: at equal instants both arms yield a Date of the same time, so `<` and `<=` store the same expiry
17307
- old.expiresAt !== null && old.expiresAt.getTime() < retireAt.getTime() ? old.expiresAt : retireAt
17308
- );
17309
- await this.repository.setExpiry(old.id, sooner);
17451
+ if (this.repository.limitExpiry !== void 0) {
17452
+ await this.repository.limitExpiry(old.id, retireAt);
17453
+ } else {
17454
+ const sooner = (
17455
+ // Stryker disable next-line EqualityOperator: at equal instants both arms yield a Date of the same time, so `<` and `<=` store the same expiry
17456
+ old.expiresAt !== null && old.expiresAt.getTime() < retireAt.getTime() ? old.expiresAt : retireAt
17457
+ );
17458
+ await this.repository.setExpiry(old.id, sooner);
17459
+ }
17310
17460
  }
17311
17461
  return issued;
17312
17462
  }
@@ -17341,13 +17491,13 @@ exports.ApiKeyService = class ApiKeyService {
17341
17491
  return value;
17342
17492
  }
17343
17493
  };
17344
- exports.ApiKeyService = _ts_decorate68([
17494
+ exports.ApiKeyService = _ts_decorate71([
17345
17495
  common.Injectable(),
17346
- _ts_param41(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
17347
- _ts_param41(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
17348
- _ts_param41(2, common.Inject(BYMAX_AUTH_OPTIONS)),
17349
- _ts_metadata64("design:type", Function),
17350
- _ts_metadata64("design:paramtypes", [
17496
+ _ts_param44(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
17497
+ _ts_param44(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
17498
+ _ts_param44(2, common.Inject(BYMAX_AUTH_OPTIONS)),
17499
+ _ts_metadata67("design:type", Function),
17500
+ _ts_metadata67("design:paramtypes", [
17351
17501
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
17352
17502
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
17353
17503
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -17429,7 +17579,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
17429
17579
  __name(assertTenantBinding, "assertTenantBinding");
17430
17580
 
17431
17581
  // src/server/services/auth-token-verifier.service.ts
17432
- function _ts_decorate69(decorators, target, key, desc) {
17582
+ function _ts_decorate72(decorators, target, key, desc) {
17433
17583
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17434
17584
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17435
17585
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17442,19 +17592,19 @@ function _ts_decorate69(decorators, target, key, desc) {
17442
17592
  }
17443
17593
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17444
17594
  }
17445
- __name(_ts_decorate69, "_ts_decorate");
17446
- function _ts_metadata65(metadataKey, metadataValue) {
17595
+ __name(_ts_decorate72, "_ts_decorate");
17596
+ function _ts_metadata68(metadataKey, metadataValue) {
17447
17597
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17448
17598
  return Reflect.metadata(metadataKey, metadataValue);
17449
17599
  }
17450
17600
  }
17451
- __name(_ts_metadata65, "_ts_metadata");
17452
- function _ts_param42(paramIndex, decorator) {
17601
+ __name(_ts_metadata68, "_ts_metadata");
17602
+ function _ts_param45(paramIndex, decorator) {
17453
17603
  return function(target, key) {
17454
17604
  decorator(target, key, paramIndex);
17455
17605
  };
17456
17606
  }
17457
- __name(_ts_param42, "_ts_param");
17607
+ __name(_ts_param45, "_ts_param");
17458
17608
  exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
17459
17609
  static {
17460
17610
  __name(this, "AuthTokenVerifierService");
@@ -17638,14 +17788,14 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
17638
17788
  }
17639
17789
  }
17640
17790
  };
17641
- exports.AuthTokenVerifierService = _ts_decorate69([
17791
+ exports.AuthTokenVerifierService = _ts_decorate72([
17642
17792
  common.Injectable(),
17643
- _ts_param42(0, common.Inject(jwt.JwtService)),
17644
- _ts_param42(1, common.Inject(BYMAX_AUTH_OPTIONS)),
17645
- _ts_param42(2, common.Inject(exports.AuthRevocationService)),
17646
- _ts_param42(3, common.Inject(exports.AccountStatusService)),
17647
- _ts_metadata65("design:type", Function),
17648
- _ts_metadata65("design:paramtypes", [
17793
+ _ts_param45(0, common.Inject(jwt.JwtService)),
17794
+ _ts_param45(1, common.Inject(BYMAX_AUTH_OPTIONS)),
17795
+ _ts_param45(2, common.Inject(exports.AuthRevocationService)),
17796
+ _ts_param45(3, common.Inject(exports.AccountStatusService)),
17797
+ _ts_metadata68("design:type", Function),
17798
+ _ts_metadata68("design:paramtypes", [
17649
17799
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
17650
17800
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
17651
17801
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -17654,7 +17804,7 @@ exports.AuthTokenVerifierService = _ts_decorate69([
17654
17804
  ], exports.AuthTokenVerifierService);
17655
17805
 
17656
17806
  // src/server/bymax-auth.module.ts
17657
- function _ts_decorate70(decorators, target, key, desc) {
17807
+ function _ts_decorate73(decorators, target, key, desc) {
17658
17808
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17659
17809
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17660
17810
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17667,7 +17817,7 @@ function _ts_decorate70(decorators, target, key, desc) {
17667
17817
  }
17668
17818
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17669
17819
  }
17670
- __name(_ts_decorate70, "_ts_decorate");
17820
+ __name(_ts_decorate73, "_ts_decorate");
17671
17821
  function hasProviderToken(providers, token) {
17672
17822
  return providers.some((p) => {
17673
17823
  if (typeof p === "function") return false;
@@ -17918,6 +18068,11 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17918
18068
  exports.TokenDeliveryService,
17919
18069
  exports.WsTicketService,
17920
18070
  exports.BruteForceService,
18071
+ // Registered unconditionally: it depends only on services that are always present, and
18072
+ // it is the one place a caller re-proves the password before a sensitive change.
18073
+ MfaFlowLockoutService,
18074
+ MfaRecordService,
18075
+ exports.ReauthenticationService,
17921
18076
  exports.OtpService,
17922
18077
  // SessionService is always registered (not gated on includeSessions) because
17923
18078
  // AuthService.login() and AuthService.refresh() call session methods. Registering
@@ -17971,6 +18126,9 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17971
18126
  // Host-app modules that extend the auth flow (e.g. custom logout logic) can
17972
18127
  // inject SessionService without re-registering it.
17973
18128
  exports.SessionService,
18129
+ // Export ReauthenticationService so a host module can guard its own destructive routes
18130
+ // with the same password check and lockout counter the library uses.
18131
+ exports.ReauthenticationService,
17974
18132
  // Export MFA components when enabled — allows host-app modules to inject
17975
18133
  // MfaService and apply MfaRequiredGuard without re-registering them.
17976
18134
  // Spreads mfaProviders directly so providers and exports always stay in sync.
@@ -18059,7 +18217,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
18059
18217
  };
18060
18218
  }
18061
18219
  };
18062
- exports.BymaxAuthModule = _ts_decorate70([
18220
+ exports.BymaxAuthModule = _ts_decorate73([
18063
18221
  common.Module({})
18064
18222
  ], exports.BymaxAuthModule);
18065
18223
 
@@ -18387,7 +18545,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
18387
18545
  }
18388
18546
  }
18389
18547
  };
18390
- function _ts_decorate71(decorators, target, key, desc) {
18548
+ function _ts_decorate74(decorators, target, key, desc) {
18391
18549
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18392
18550
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18393
18551
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18400,13 +18558,13 @@ function _ts_decorate71(decorators, target, key, desc) {
18400
18558
  }
18401
18559
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18402
18560
  }
18403
- __name(_ts_decorate71, "_ts_decorate");
18404
- function _ts_metadata66(metadataKey, metadataValue) {
18561
+ __name(_ts_decorate74, "_ts_decorate");
18562
+ function _ts_metadata69(metadataKey, metadataValue) {
18405
18563
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18406
18564
  return Reflect.metadata(metadataKey, metadataValue);
18407
18565
  }
18408
18566
  }
18409
- __name(_ts_metadata66, "_ts_metadata");
18567
+ __name(_ts_metadata69, "_ts_metadata");
18410
18568
  var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
18411
18569
  var PREFIX_LENGTH = 5;
18412
18570
  var DEFAULT_TIMEOUT_MS = 1500;
@@ -18463,10 +18621,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
18463
18621
  }
18464
18622
  }
18465
18623
  };
18466
- exports.HibpBreachChecker = _ts_decorate71([
18624
+ exports.HibpBreachChecker = _ts_decorate74([
18467
18625
  common.Injectable(),
18468
- _ts_metadata66("design:type", Function),
18469
- _ts_metadata66("design:paramtypes", [
18626
+ _ts_metadata69("design:type", Function),
18627
+ _ts_metadata69("design:paramtypes", [
18470
18628
  Number
18471
18629
  ])
18472
18630
  ], exports.HibpBreachChecker);
@@ -18479,10 +18637,10 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
18479
18637
  return false;
18480
18638
  }
18481
18639
  };
18482
- exports.AllowAllBreachChecker = _ts_decorate71([
18640
+ exports.AllowAllBreachChecker = _ts_decorate74([
18483
18641
  common.Injectable()
18484
18642
  ], exports.AllowAllBreachChecker);
18485
- function _ts_decorate72(decorators, target, key, desc) {
18643
+ function _ts_decorate75(decorators, target, key, desc) {
18486
18644
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18487
18645
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18488
18646
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18495,7 +18653,7 @@ function _ts_decorate72(decorators, target, key, desc) {
18495
18653
  }
18496
18654
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18497
18655
  }
18498
- __name(_ts_decorate72, "_ts_decorate");
18656
+ __name(_ts_decorate75, "_ts_decorate");
18499
18657
  exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
18500
18658
  static {
18501
18659
  __name(this, "OptionalAuthGuard");
@@ -18510,10 +18668,10 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
18510
18668
  return super.canActivate(context);
18511
18669
  }
18512
18670
  };
18513
- exports.OptionalAuthGuard = _ts_decorate72([
18671
+ exports.OptionalAuthGuard = _ts_decorate75([
18514
18672
  common.Injectable()
18515
18673
  ], exports.OptionalAuthGuard);
18516
- function _ts_decorate73(decorators, target, key, desc) {
18674
+ function _ts_decorate76(decorators, target, key, desc) {
18517
18675
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18518
18676
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18519
18677
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18526,19 +18684,19 @@ function _ts_decorate73(decorators, target, key, desc) {
18526
18684
  }
18527
18685
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18528
18686
  }
18529
- __name(_ts_decorate73, "_ts_decorate");
18530
- function _ts_metadata67(metadataKey, metadataValue) {
18687
+ __name(_ts_decorate76, "_ts_decorate");
18688
+ function _ts_metadata70(metadataKey, metadataValue) {
18531
18689
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18532
18690
  return Reflect.metadata(metadataKey, metadataValue);
18533
18691
  }
18534
18692
  }
18535
- __name(_ts_metadata67, "_ts_metadata");
18536
- function _ts_param43(paramIndex, decorator) {
18693
+ __name(_ts_metadata70, "_ts_metadata");
18694
+ function _ts_param46(paramIndex, decorator) {
18537
18695
  return function(target, key) {
18538
18696
  decorator(target, key, paramIndex);
18539
18697
  };
18540
18698
  }
18541
- __name(_ts_param43, "_ts_param");
18699
+ __name(_ts_param46, "_ts_param");
18542
18700
  exports.SelfOrAdminGuard = class SelfOrAdminGuard {
18543
18701
  static {
18544
18702
  __name(this, "SelfOrAdminGuard");
@@ -18574,11 +18732,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
18574
18732
  throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
18575
18733
  }
18576
18734
  };
18577
- exports.SelfOrAdminGuard = _ts_decorate73([
18735
+ exports.SelfOrAdminGuard = _ts_decorate76([
18578
18736
  common.Injectable(),
18579
- _ts_param43(0, common.Inject(BYMAX_AUTH_OPTIONS)),
18580
- _ts_metadata67("design:type", Function),
18581
- _ts_metadata67("design:paramtypes", [
18737
+ _ts_param46(0, common.Inject(BYMAX_AUTH_OPTIONS)),
18738
+ _ts_metadata70("design:type", Function),
18739
+ _ts_metadata70("design:paramtypes", [
18582
18740
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
18583
18741
  ])
18584
18742
  ], exports.SelfOrAdminGuard);
@@ -18600,7 +18758,7 @@ function isHexLooking(value) {
18600
18758
  return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
18601
18759
  }
18602
18760
  __name(isHexLooking, "isHexLooking");
18603
- function _ts_decorate74(decorators, target, key, desc) {
18761
+ function _ts_decorate77(decorators, target, key, desc) {
18604
18762
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18605
18763
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18606
18764
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18613,19 +18771,19 @@ function _ts_decorate74(decorators, target, key, desc) {
18613
18771
  }
18614
18772
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18615
18773
  }
18616
- __name(_ts_decorate74, "_ts_decorate");
18617
- function _ts_metadata68(metadataKey, metadataValue) {
18774
+ __name(_ts_decorate77, "_ts_decorate");
18775
+ function _ts_metadata71(metadataKey, metadataValue) {
18618
18776
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18619
18777
  return Reflect.metadata(metadataKey, metadataValue);
18620
18778
  }
18621
18779
  }
18622
- __name(_ts_metadata68, "_ts_metadata");
18623
- function _ts_param44(paramIndex, decorator) {
18780
+ __name(_ts_metadata71, "_ts_metadata");
18781
+ function _ts_param47(paramIndex, decorator) {
18624
18782
  return function(target, key) {
18625
18783
  decorator(target, key, paramIndex);
18626
18784
  };
18627
18785
  }
18628
- __name(_ts_param44, "_ts_param");
18786
+ __name(_ts_param47, "_ts_param");
18629
18787
  exports.WsJwtGuard = class WsJwtGuard {
18630
18788
  static {
18631
18789
  __name(this, "WsJwtGuard");
@@ -18689,14 +18847,14 @@ exports.WsJwtGuard = class WsJwtGuard {
18689
18847
  return true;
18690
18848
  }
18691
18849
  };
18692
- exports.WsJwtGuard = _ts_decorate74([
18850
+ exports.WsJwtGuard = _ts_decorate77([
18693
18851
  common.Injectable(),
18694
- _ts_param44(0, common.Inject(jwt.JwtService)),
18695
- _ts_param44(1, common.Inject(exports.AuthRevocationService)),
18696
- _ts_param44(2, common.Inject(exports.WsTicketService)),
18697
- _ts_param44(3, common.Inject(BYMAX_AUTH_OPTIONS)),
18698
- _ts_metadata68("design:type", Function),
18699
- _ts_metadata68("design:paramtypes", [
18852
+ _ts_param47(0, common.Inject(jwt.JwtService)),
18853
+ _ts_param47(1, common.Inject(exports.AuthRevocationService)),
18854
+ _ts_param47(2, common.Inject(exports.WsTicketService)),
18855
+ _ts_param47(3, common.Inject(BYMAX_AUTH_OPTIONS)),
18856
+ _ts_metadata71("design:type", Function),
18857
+ _ts_metadata71("design:paramtypes", [
18700
18858
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
18701
18859
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
18702
18860
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
@@ -18736,7 +18894,7 @@ function bindingInput(handshake) {
18736
18894
  };
18737
18895
  }
18738
18896
  __name(bindingInput, "bindingInput");
18739
- function _ts_decorate75(decorators, target, key, desc) {
18897
+ function _ts_decorate78(decorators, target, key, desc) {
18740
18898
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18741
18899
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18742
18900
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18749,7 +18907,7 @@ function _ts_decorate75(decorators, target, key, desc) {
18749
18907
  }
18750
18908
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18751
18909
  }
18752
- __name(_ts_decorate75, "_ts_decorate");
18910
+ __name(_ts_decorate78, "_ts_decorate");
18753
18911
  function isAuthEnvelope(body) {
18754
18912
  if (typeof body !== "object" || body === null) return false;
18755
18913
  const error = body.error;
@@ -18868,10 +19026,10 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18868
19026
  });
18869
19027
  }
18870
19028
  };
18871
- exports.AuthExceptionFilter = _ts_decorate75([
19029
+ exports.AuthExceptionFilter = _ts_decorate78([
18872
19030
  common.Catch()
18873
19031
  ], exports.AuthExceptionFilter);
18874
- function _ts_decorate76(decorators, target, key, desc) {
19032
+ function _ts_decorate79(decorators, target, key, desc) {
18875
19033
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18876
19034
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18877
19035
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18884,7 +19042,7 @@ function _ts_decorate76(decorators, target, key, desc) {
18884
19042
  }
18885
19043
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18886
19044
  }
18887
- __name(_ts_decorate76, "_ts_decorate");
19045
+ __name(_ts_decorate79, "_ts_decorate");
18888
19046
  function isEmittingClient(client) {
18889
19047
  return typeof client?.emit === "function";
18890
19048
  }
@@ -18928,7 +19086,7 @@ exports.WsAuthExceptionFilter = class _WsAuthExceptionFilter {
18928
19086
  this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
18929
19087
  }
18930
19088
  };
18931
- exports.WsAuthExceptionFilter = _ts_decorate76([
19089
+ exports.WsAuthExceptionFilter = _ts_decorate79([
18932
19090
  common.Catch(AuthException)
18933
19091
  ], exports.WsAuthExceptionFilter);
18934
19092
  var ServiceKey = /* @__PURE__ */ __name((...scopes) => common.applyDecorators(common.SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), common.UseGuards(exports.ApiKeyGuard)), "ServiceKey");