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