@bymax-one/nest-auth 1.1.0 → 1.1.1

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.
@@ -375,6 +375,9 @@ function resolveOptions(userOptions) {
375
375
  rateLimit: {
376
376
  ...DEFAULT_OPTIONS.rateLimit,
377
377
  ...userOptions.rateLimit,
378
+ // Stryker disable next-line OptionalChaining: unreachable — `validateClientIpSource` has
379
+ // already run, and it only returns without throwing when `rateLimit` is an object (either
380
+ // naming a source or disabling limiting), so `rateLimit` is never undefined here
378
381
  clientIpSource: userOptions.rateLimit?.clientIpSource ?? "peer"
379
382
  },
380
383
  secureCookies: userOptions.secureCookies ?? process.env["NODE_ENV"] === "production",
@@ -407,6 +410,10 @@ function withholdSecrets(resolved) {
407
410
  withholdFromSerialization(resolved.jwt, "previousSecrets");
408
411
  withholdFromSerialization(resolved, "hmacKey");
409
412
  withholdFromSerialization(resolved, "previousHmacKeys");
413
+ if (resolved.mfa !== void 0) {
414
+ withholdFromSerialization(resolved.mfa, "encryptionKey");
415
+ withholdFromSerialization(resolved.mfa, "previousEncryptionKeys");
416
+ }
410
417
  if (resolved.oauth === void 0) return;
411
418
  const oauth = Object.fromEntries(Object.entries(resolved.oauth).map(([provider, config]) => {
412
419
  if (typeof config !== "object" || config === null) return [
@@ -1617,6 +1624,18 @@ if ARGV[3] ~= '' then
1617
1624
  end
1618
1625
  return 1
1619
1626
  `;
1627
+ var CREATE_SESSION_LUA = `
1628
+ redis.call('SET', KEYS[1], ARGV[1], 'EX', ARGV[2])
1629
+ redis.call('SADD', KEYS[2], ARGV[4] .. ':' .. ARGV[5])
1630
+ redis.call('EXPIRE', KEYS[2], ARGV[2])
1631
+ -- The family index holds bare hashes: it only ever tracks live sessions, so the prefix is
1632
+ -- implied. A session with no lineage skips it rather than writing an unkeyed member.
1633
+ if ARGV[3] ~= '' then
1634
+ redis.call('SADD', KEYS[3], ARGV[5])
1635
+ redis.call('EXPIRE', KEYS[3], ARGV[2])
1636
+ end
1637
+ return 1
1638
+ `;
1620
1639
  var ROTATE_LUA = `
1621
1640
  local old = redis.call('GET', KEYS[1])
1622
1641
  if old then
@@ -1951,6 +1970,30 @@ var AuthRedisService = class {
1951
1970
  };
1952
1971
  }
1953
1972
  /**
1973
+ * Writes a freshly-issued refresh session atomically — record, session-index member and
1974
+ * family membership, each carrying the refresh TTL.
1975
+ *
1976
+ * See {@link CREATE_SESSION_LUA} for the two windows the loose form left open.
1977
+ *
1978
+ * @param params - The session to store and the keys it belongs under.
1979
+ */
1980
+ async writeNewSession(params) {
1981
+ const p = prefixesFor(params.kind);
1982
+ await this.eval(CREATE_SESSION_LUA, [
1983
+ `${p.live}:${params.tokenHash}`,
1984
+ `${p.index}:${params.userId}`,
1985
+ // Always passed, even with no family: a Lua script's key list is fixed at the call
1986
+ // site, and the script skips the key rather than the caller skipping the argument.
1987
+ `${p.family}:${params.familyId}`
1988
+ ], [
1989
+ params.sessionJson,
1990
+ String(params.refreshTtl),
1991
+ params.familyId,
1992
+ p.live,
1993
+ params.tokenHash
1994
+ ]);
1995
+ }
1996
+ /**
1954
1997
  * Writes the session a grace recovery produced, atomically with the check that the account
1955
1998
  * has not been swept out from under it.
1956
1999
  *
@@ -2107,6 +2150,58 @@ var AuthRedisService = class {
2107
2150
  return result === "OK";
2108
2151
  }
2109
2152
  /**
2153
+ * Drops the grace-pointer members whose keys have already expired.
2154
+ *
2155
+ * A rotation removes `rt:{old}` from the index and adds two members: `rt:{new}` and
2156
+ * `rp:{old}`. The `rp:` KEY dies with the grace window — 30 seconds by default — but the
2157
+ * MEMBER was only ever removed by a full revoke-all, so the index gained one permanent
2158
+ * ~68-byte entry per rotation, and the rotation re-arms the set's own TTL each time. The set
2159
+ * never aged out while the account was in use.
2160
+ *
2161
+ * That is not merely untidy. Every reader of the index is linear in its size:
2162
+ * `listSessions` ships the whole set over the wire, `revokeAllExceptCurrent` issues two
2163
+ * sequential round trips per grace member, and `invalidateUserSessions` iterates it inside a
2164
+ * Lua script, which blocks the whole single-threaded store. An attacker holding one stolen
2165
+ * refresh token and rotating at the route limit adds ~14k members a day to their own index,
2166
+ * with no ceiling; a merely active user accrues thousands a year.
2167
+ *
2168
+ * Called from the two paths that already walk the index — a login enforcing the session cap
2169
+ * and a session listing — so the growth is bounded by how long an account can go between
2170
+ * them, and any legitimate interaction heals it. The rotation path deliberately does NOT
2171
+ * call this: it is the hot path, and an O(n) sweep there would trade a slow leak for a slow
2172
+ * refresh.
2173
+ *
2174
+ * Grace members whose key is still live are left alone. They are what lets a revoke-all also
2175
+ * kill a token that was rotated away moments earlier but can still be recovered.
2176
+ *
2177
+ * @param setKey - The un-namespaced index key (`sess:{id}` or `psess:{id}`).
2178
+ * @param gracePrefix - Member prefix for rotation grace pointers (`rp:` or `prp:`).
2179
+ * @returns How many dead members were dropped.
2180
+ */
2181
+ async pruneExpiredGraceMembers(setKey, gracePrefix) {
2182
+ const removed = await this.eval(`local members = redis.call('SMEMBERS', KEYS[1])
2183
+ local ns, grace = ARGV[1], ARGV[2]
2184
+ local removed = 0
2185
+ for _, member in ipairs(members) do
2186
+ if string.sub(member, 1, string.len(grace)) == grace then
2187
+ -- The member IS the key suffix, so its own liveness is one EXISTS away. A pointer
2188
+ -- still inside its window is left in place; only the expired ones go.
2189
+ if redis.call('EXISTS', ns .. ':' .. member) == 0 then
2190
+ redis.call('SREM', KEYS[1], member)
2191
+ removed = removed + 1
2192
+ end
2193
+ end
2194
+ end
2195
+ return removed`, [
2196
+ setKey
2197
+ ], [
2198
+ this.namespace,
2199
+ gracePrefix
2200
+ ]);
2201
+ if (typeof removed === "number") return removed;
2202
+ return typeof removed === "string" ? Number(removed) : 0;
2203
+ }
2204
+ /**
2110
2205
  * Atomically deletes every refresh session belonging to one identity plane.
2111
2206
  *
2112
2207
  * The set members are full key suffixes — `rt:{hash}`/`rp:{hash}` on the dashboard plane,
@@ -2415,7 +2510,9 @@ var AuthRateLimitGuard = class {
2415
2510
  };
2416
2511
  AuthRateLimitGuard = _ts_decorate6([
2417
2512
  Injectable(),
2513
+ _ts_param2(0, Inject(Reflector)),
2418
2514
  _ts_param2(1, Inject(BYMAX_AUTH_OPTIONS)),
2515
+ _ts_param2(2, Inject(AuthRedisService)),
2419
2516
  _ts_metadata6("design:type", Function),
2420
2517
  _ts_metadata6("design:paramtypes", [
2421
2518
  typeof Reflector === "undefined" ? Object : Reflector,
@@ -2949,6 +3046,10 @@ var JwtAuthGuard = class {
2949
3046
  };
2950
3047
  JwtAuthGuard = _ts_decorate8([
2951
3048
  Injectable(),
3049
+ _ts_param4(0, Inject(JwtService)),
3050
+ _ts_param4(1, Inject(TokenDeliveryService)),
3051
+ _ts_param4(2, Inject(AuthRedisService)),
3052
+ _ts_param4(3, Inject(Reflector)),
2952
3053
  _ts_param4(4, Inject(BYMAX_AUTH_OPTIONS)),
2953
3054
  _ts_metadata8("design:type", Function),
2954
3055
  _ts_metadata8("design:paramtypes", [
@@ -3073,6 +3174,7 @@ var UserStatusGuard = class {
3073
3174
  };
3074
3175
  UserStatusGuard = _ts_decorate10([
3075
3176
  Injectable(),
3177
+ _ts_param6(0, Inject(AuthRedisService)),
3076
3178
  _ts_param6(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
3077
3179
  _ts_param6(2, Inject(BYMAX_AUTH_OPTIONS)),
3078
3180
  _ts_metadata10("design:type", Function),
@@ -3240,6 +3342,7 @@ var BruteForceService = class _BruteForceService {
3240
3342
  };
3241
3343
  BruteForceService = _ts_decorate12([
3242
3344
  Injectable(),
3345
+ _ts_param7(0, Inject(AuthRedisService)),
3243
3346
  _ts_param7(1, Inject(BYMAX_AUTH_OPTIONS)),
3244
3347
  _ts_metadata11("design:type", Function),
3245
3348
  _ts_metadata11("design:paramtypes", [
@@ -3258,6 +3361,12 @@ function _ts_metadata12(k, v) {
3258
3361
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3259
3362
  }
3260
3363
  __name(_ts_metadata12, "_ts_metadata");
3364
+ function _ts_param8(paramIndex, decorator) {
3365
+ return function(target, key) {
3366
+ decorator(target, key, paramIndex);
3367
+ };
3368
+ }
3369
+ __name(_ts_param8, "_ts_param");
3261
3370
  var MAX_ATTEMPTS = 5;
3262
3371
  var MIN_VERIFY_MS = 100;
3263
3372
  var OTP_STORE_LUA = `
@@ -3385,6 +3494,7 @@ var OtpService = class {
3385
3494
  };
3386
3495
  OtpService = _ts_decorate13([
3387
3496
  Injectable(),
3497
+ _ts_param8(0, Inject(AuthRedisService)),
3388
3498
  _ts_metadata12("design:type", Function),
3389
3499
  _ts_metadata12("design:paramtypes", [
3390
3500
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService
@@ -3401,41 +3511,80 @@ function _ts_metadata13(k, v) {
3401
3511
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3402
3512
  }
3403
3513
  __name(_ts_metadata13, "_ts_metadata");
3404
- function _ts_param8(paramIndex, decorator) {
3514
+ function _ts_param9(paramIndex, decorator) {
3405
3515
  return function(target, key) {
3406
3516
  decorator(target, key, paramIndex);
3407
3517
  };
3408
3518
  }
3409
- __name(_ts_param8, "_ts_param");
3519
+ __name(_ts_param9, "_ts_param");
3410
3520
  var scrypt = promisify(scrypt$1);
3411
3521
  var SCRYPT_KEY_LEN = 64;
3412
3522
  var SALT_BYTES = 16;
3413
3523
  var DUMMY_SALT = Buffer.from("d6732149f98b3938274691d8c2f3ee63", "hex");
3414
3524
  var DUMMY_EXPECTED = Buffer.alloc(SCRYPT_KEY_LEN, 90);
3415
- function parseStoredHash(hash) {
3416
- const parts = hash.split(":");
3417
- if (parts.length !== 6 || parts[0] !== "scrypt") return null;
3418
- const [, nRaw, rRaw, pRaw, saltHex, derivedHex] = parts;
3419
- if (saltHex === void 0 || derivedHex === void 0 || saltHex === "" || derivedHex === "") {
3420
- return null;
3421
- }
3422
- const derived = Buffer.from(derivedHex, "hex");
3423
- if (derived.length !== SCRYPT_KEY_LEN) return null;
3424
- const [N, r, p] = [
3425
- Number(nRaw),
3426
- Number(rRaw),
3427
- Number(pRaw)
3525
+ var MAX_SCRYPT_PARAMETER = 255;
3526
+ var MIN_KEY_LEN = 10;
3527
+ var MAX_KEY_LEN = 64;
3528
+ function toPhcB64(value) {
3529
+ return value.toString("base64").replace(/=+$/, "");
3530
+ }
3531
+ __name(toPhcB64, "toPhcB64");
3532
+ function fromPhcB64(value) {
3533
+ if (value === "") return null;
3534
+ const decoded = Buffer.from(value, "base64");
3535
+ return toPhcB64(decoded) === value ? decoded : null;
3536
+ }
3537
+ __name(fromPhcB64, "fromPhcB64");
3538
+ function parsePhcParams(text) {
3539
+ const found = /* @__PURE__ */ new Map();
3540
+ for (const pair of text.split(",")) {
3541
+ const eq = pair.indexOf("=");
3542
+ if (eq <= 0) return null;
3543
+ const key = pair.slice(0, eq);
3544
+ const raw = pair.slice(eq + 1);
3545
+ if (found.has(key)) return null;
3546
+ if (!/^(0|[1-9][0-9]*)$/.test(raw)) return null;
3547
+ found.set(key, Number(raw));
3548
+ }
3549
+ const [ln, r, p] = [
3550
+ found.get("ln"),
3551
+ found.get("r"),
3552
+ found.get("p")
3428
3553
  ];
3429
- if (!(Number.isInteger(N) && Number.isInteger(r) && Number.isInteger(p))) return null;
3430
- if (N <= 0 || r <= 0 || p <= 0) return null;
3554
+ if (ln === void 0 || r === void 0 || p === void 0) return null;
3555
+ if (ln < 1 || ln > 31) return null;
3556
+ if (r < 1 || r > MAX_SCRYPT_PARAMETER || p < 1 || p > MAX_SCRYPT_PARAMETER) return null;
3557
+ if (128 * 2 ** ln * r > MAX_KDF_BYTES_PER_DERIVATION) return null;
3431
3558
  return {
3432
- N,
3559
+ ln,
3433
3560
  r,
3434
- p,
3435
- salt: Buffer.from(saltHex, "hex"),
3561
+ p
3562
+ };
3563
+ }
3564
+ __name(parsePhcParams, "parsePhcParams");
3565
+ function parsePhcHash(hash) {
3566
+ const [leading, algorithm, paramText, saltText, hashText, extra] = hash.split("$");
3567
+ if (extra !== void 0) return null;
3568
+ if (leading !== "" || algorithm !== "scrypt") return null;
3569
+ if (paramText === void 0 || saltText === void 0 || hashText === void 0) return null;
3570
+ const params = parsePhcParams(paramText);
3571
+ if (params === null) return null;
3572
+ const salt = fromPhcB64(saltText);
3573
+ const derived = fromPhcB64(hashText);
3574
+ if (salt === null || derived === null) return null;
3575
+ if (derived.length < MIN_KEY_LEN || derived.length > MAX_KEY_LEN) return null;
3576
+ return {
3577
+ N: 2 ** params.ln,
3578
+ r: params.r,
3579
+ p: params.p,
3580
+ salt,
3436
3581
  derived
3437
3582
  };
3438
3583
  }
3584
+ __name(parsePhcHash, "parsePhcHash");
3585
+ function parseStoredHash(hash) {
3586
+ return parsePhcHash(hash);
3587
+ }
3439
3588
  __name(parseStoredHash, "parseStoredHash");
3440
3589
  var PasswordService = class _PasswordService {
3441
3590
  static {
@@ -3458,12 +3607,12 @@ var PasswordService = class _PasswordService {
3458
3607
  * Hashes a plaintext password using scrypt with a random salt.
3459
3608
  *
3460
3609
  * @param plain - Plaintext password (UTF-8 string).
3461
- * @returns Hashed password in `scrypt:{salt_hex}:{derived_hex}` format.
3610
+ * @returns Hashed password as a PHC string.
3462
3611
  *
3463
3612
  * @example
3464
3613
  * ```typescript
3465
3614
  * const hash = await passwordService.hash('my-password')
3466
- * // 'scrypt:4a3b...:{128 hex chars}'
3615
+ * // '$scrypt$ln=17,r=8,p=1$YmFzZTY0c2FsdA$…'
3467
3616
  * ```
3468
3617
  */
3469
3618
  /**
@@ -3510,7 +3659,8 @@ var PasswordService = class _PasswordService {
3510
3659
  p: this.p,
3511
3660
  maxmem: this.maxmem
3512
3661
  });
3513
- return `scrypt:${this.N}:${this.r}:${this.p}:${salt.toString("hex")}:${derived.toString("hex")}`;
3662
+ const ln = Math.log2(this.N);
3663
+ return `$scrypt$ln=${ln},r=${this.r},p=${this.p}$${toPhcB64(salt)}$${toPhcB64(derived)}`;
3514
3664
  }
3515
3665
  /**
3516
3666
  * Whether a stored hash was written under weaker parameters than the ones configured now.
@@ -3531,7 +3681,7 @@ var PasswordService = class _PasswordService {
3531
3681
  * Verifies a plaintext password against a stored scrypt hash.
3532
3682
  *
3533
3683
  * @param plain - Plaintext password supplied by the user.
3534
- * @param hash - Stored hash in `scrypt:{salt_hex}:{derived_hex}` format.
3684
+ * @param hash - Stored hash, as a PHC string.
3535
3685
  * @returns `true` if the password matches, `false` otherwise.
3536
3686
  *
3537
3687
  * @remarks
@@ -3544,11 +3694,18 @@ var PasswordService = class _PasswordService {
3544
3694
  const parsed = parseStoredHash(hash);
3545
3695
  if (parsed === null) return false;
3546
3696
  const { N, r, p } = parsed;
3547
- const candidate = await scrypt(plain, parsed.salt, SCRYPT_KEY_LEN, {
3697
+ const candidate = await scrypt(plain, parsed.salt, parsed.derived.length, {
3548
3698
  N,
3549
3699
  r,
3550
3700
  p,
3551
- // Sized for the parameters actually being used, which may exceed the configured ones.
3701
+ // Sized for the parameters actually being used, which may exceed the configured ones —
3702
+ // but never without bound: `parsePhcParams` has already refused any record whose working
3703
+ // set is above `MAX_KDF_BYTES_PER_DERIVATION`, so this cannot be widened past 2x that
3704
+ // ceiling by what the record claims.
3705
+ // Stryker disable next-line ArithmeticOperator,MethodExpression: `maxmem` is a CEILING, and
3706
+ // only its being too LOW is observable (scrypt throws). Every mutant here lowers it while
3707
+ // leaving it above what any hash these tests verify actually needs, so the derivation and
3708
+ // its result are identical — the same reason the constructor's copy carries a disable
3552
3709
  maxmem: Math.max(N * r * 128 * 2, this.maxmem)
3553
3710
  });
3554
3711
  return timingSafeEqual(candidate, parsed.derived);
@@ -3583,8 +3740,8 @@ var PasswordService = class _PasswordService {
3583
3740
  };
3584
3741
  PasswordService = _ts_decorate14([
3585
3742
  Injectable(),
3586
- _ts_param8(0, Inject(BYMAX_AUTH_OPTIONS)),
3587
- _ts_param8(1, Inject(BYMAX_AUTH_BREACH_CHECKER)),
3743
+ _ts_param9(0, Inject(BYMAX_AUTH_OPTIONS)),
3744
+ _ts_param9(1, Inject(BYMAX_AUTH_BREACH_CHECKER)),
3588
3745
  _ts_metadata13("design:type", Function),
3589
3746
  _ts_metadata13("design:paramtypes", [
3590
3747
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -3602,12 +3759,12 @@ function _ts_metadata14(k, v) {
3602
3759
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3603
3760
  }
3604
3761
  __name(_ts_metadata14, "_ts_metadata");
3605
- function _ts_param9(paramIndex, decorator) {
3762
+ function _ts_param10(paramIndex, decorator) {
3606
3763
  return function(target, key) {
3607
3764
  decorator(target, key, paramIndex);
3608
3765
  };
3609
3766
  }
3610
- __name(_ts_param9, "_ts_param");
3767
+ __name(_ts_param10, "_ts_param");
3611
3768
  var MAX_IP_LENGTH = 45;
3612
3769
  var SESSION_HASH_RE = /^[a-f0-9]{64}$/;
3613
3770
  var REVOKE_SESSION_LUA = `
@@ -3752,6 +3909,9 @@ var SessionService = class _SessionService {
3752
3909
  * @returns Array of {@link SessionInfo} sorted newest-first.
3753
3910
  */
3754
3911
  async listSessions(userId, currentSessionHash) {
3912
+ void this.redis.pruneExpiredGraceMembers(`sess:${userId}`, "rp:").catch((err) => {
3913
+ this.logger.warn("listSessions: grace-pointer prune failed", err);
3914
+ });
3755
3915
  const members = await this.redis.smembers(`sess:${userId}`);
3756
3916
  const rtMembers = members.filter((m) => m.startsWith("rt:"));
3757
3917
  const results = [];
@@ -4020,6 +4180,7 @@ var SessionService = class _SessionService {
4020
4180
  * @param userAgent - User-Agent string (forwarded to the `onSessionEvicted` hook context).
4021
4181
  */
4022
4182
  async enforceSessionLimit(userId, newHash, ip, userAgent) {
4183
+ await this.redis.pruneExpiredGraceMembers(`sess:${userId}`, "rp:");
4023
4184
  const members = await this.redis.smembers(`sess:${userId}`);
4024
4185
  const rtMembers = members.filter((m) => m.startsWith("rt:"));
4025
4186
  const limit = await this.resolveSessionLimit(userId);
@@ -4111,10 +4272,11 @@ var SessionService = class _SessionService {
4111
4272
  };
4112
4273
  SessionService = _ts_decorate15([
4113
4274
  Injectable(),
4114
- _ts_param9(0, Inject(BYMAX_AUTH_OPTIONS)),
4115
- _ts_param9(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
4116
- _ts_param9(2, Inject(BYMAX_AUTH_HOOKS)),
4117
- _ts_param9(2, Optional()),
4275
+ _ts_param10(0, Inject(BYMAX_AUTH_OPTIONS)),
4276
+ _ts_param10(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
4277
+ _ts_param10(2, Inject(BYMAX_AUTH_HOOKS)),
4278
+ _ts_param10(2, Optional()),
4279
+ _ts_param10(3, Inject(AuthRedisService)),
4118
4280
  _ts_metadata14("design:type", Function),
4119
4281
  _ts_metadata14("design:paramtypes", [
4120
4282
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -4131,6 +4293,13 @@ function recentAuthKey(plane, userId, hmacKey) {
4131
4293
  }
4132
4294
  __name(recentAuthKey, "recentAuthKey");
4133
4295
 
4296
+ // src/server/utils/log-safe.ts
4297
+ var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/;
4298
+ function logSafe(value) {
4299
+ return CONTROL_CHARACTERS.test(value) ? "<malformed>" : value;
4300
+ }
4301
+ __name(logSafe, "logSafe");
4302
+
4134
4303
  // src/server/services/token-manager.service.ts
4135
4304
  function _ts_decorate16(decorators, target, key, desc) {
4136
4305
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4143,12 +4312,12 @@ function _ts_metadata15(k, v) {
4143
4312
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4144
4313
  }
4145
4314
  __name(_ts_metadata15, "_ts_metadata");
4146
- function _ts_param10(paramIndex, decorator) {
4315
+ function _ts_param11(paramIndex, decorator) {
4147
4316
  return function(target, key) {
4148
4317
  decorator(target, key, paramIndex);
4149
4318
  };
4150
4319
  }
4151
- __name(_ts_param10, "_ts_param");
4320
+ __name(_ts_param11, "_ts_param");
4152
4321
  var MFA_TEMP_TOKEN_TTL_SECONDS = 300;
4153
4322
  var MAX_SESSION_FIELD_LENGTH = 45;
4154
4323
  var TokenManagerService = class _TokenManagerService {
@@ -4266,15 +4435,17 @@ var TokenManagerService = class _TokenManagerService {
4266
4435
  });
4267
4436
  const rawRefreshToken = generateSecureToken();
4268
4437
  const tokenHash = sha256(rawRefreshToken);
4269
- const sessionKey = `rt:${tokenHash}`;
4270
4438
  const familyId = randomUUID();
4271
4439
  const session = this.buildSession(user.id, user.tenantId, user.role, ip, userAgent, user.mfaEnabled, familyId);
4272
4440
  const ttl = this.options.jwt.refreshExpiresInDays * 86400;
4273
- await this.redis.set(sessionKey, this.serializeSession(session), ttl);
4274
- await this.redis.sadd(`sess:${user.id}`, `rt:${tokenHash}`);
4275
- await this.redis.expire(`sess:${user.id}`, ttl);
4276
- await this.redis.sadd(`fam:${familyId}`, tokenHash);
4277
- await this.redis.expire(`fam:${familyId}`, ttl);
4441
+ await this.redis.writeNewSession({
4442
+ kind: "dashboard",
4443
+ tokenHash,
4444
+ sessionJson: this.serializeSession(session),
4445
+ familyId,
4446
+ userId: user.id,
4447
+ refreshTtl: ttl
4448
+ });
4278
4449
  await this.redis.set(recentAuthKey("dashboard", user.id, this.options.hmacKey), "1", RECENT_AUTH_TTL_SECONDS);
4279
4450
  return {
4280
4451
  user,
@@ -4309,15 +4480,17 @@ var TokenManagerService = class _TokenManagerService {
4309
4480
  });
4310
4481
  const rawRefreshToken = generateSecureToken();
4311
4482
  const tokenHash = sha256(rawRefreshToken);
4312
- const sessionKey = `prt:${tokenHash}`;
4313
4483
  const familyId = randomUUID();
4314
4484
  const session = this.buildSession(admin.id, "", admin.role, ip, userAgent, admin.mfaEnabled, familyId);
4315
4485
  const ttl = this.options.jwt.refreshExpiresInDays * 86400;
4316
- await this.redis.set(sessionKey, this.serializeSession(session), ttl);
4317
- await this.redis.sadd(`psess:${admin.id}`, `prt:${tokenHash}`);
4318
- await this.redis.expire(`psess:${admin.id}`, ttl);
4319
- await this.redis.sadd(`pfam:${familyId}`, tokenHash);
4320
- await this.redis.expire(`pfam:${familyId}`, ttl);
4486
+ await this.redis.writeNewSession({
4487
+ kind: "platform",
4488
+ tokenHash,
4489
+ sessionJson: this.serializeSession(session),
4490
+ familyId,
4491
+ userId: admin.id,
4492
+ refreshTtl: ttl
4493
+ });
4321
4494
  await this.writePlatformSessionDetail(tokenHash, ip, userAgent, ttl);
4322
4495
  return {
4323
4496
  admin,
@@ -4408,8 +4581,9 @@ var TokenManagerService = class _TokenManagerService {
4408
4581
  return this.rotateFromGrace(outcome.sessionJson, ip, userAgent, refreshTtl);
4409
4582
  }
4410
4583
  if (outcome.kind === "reused") {
4411
- this.logger.warn("reissueTokens: reuse of a consumed refresh token detected \u2014 revoking the token family");
4584
+ this.logger.warn(`reissueTokens: reuse of a consumed refresh token detected \u2014 revoking the token family familyId=${logSafe(outcome.familyId)}`);
4412
4585
  const { ownerId } = await this.redis.revokeFamily(outcome.familyId);
4586
+ this.logger.warn(`reissueTokens: token family revoked after reuse detection userId=${logSafe(ownerId)} familyId=${logSafe(outcome.familyId)}`);
4413
4587
  this.emitReuseDetected(ownerId, outcome.familyId);
4414
4588
  throw new AuthException(AUTH_ERROR_CODES.REFRESH_TOKEN_INVALID);
4415
4589
  }
@@ -4417,23 +4591,6 @@ var TokenManagerService = class _TokenManagerService {
4417
4591
  throw new AuthException(AUTH_ERROR_CODES.REFRESH_TOKEN_INVALID);
4418
4592
  }
4419
4593
  /**
4420
- * Refuses a rotation once the login it descends from has outlived the absolute cap.
4421
- *
4422
- * `refreshExpiresInDays` bounds a single refresh token, not a session: a client rotating
4423
- * every fifteen minutes renews that lifetime forever, so without this a session established
4424
- * once never has to be established again. The cap measures from the **family's** birth, which
4425
- * is carried unchanged through the lineage.
4426
- *
4427
- * A session with no birth time predates the field and is not capped — it ages out under the
4428
- * refresh lifetime like any other. A cap of `0` disables the check entirely.
4429
- *
4430
- * @param session - The presented session, or the placeholder when the token is not live.
4431
- * @throws {@link AuthException} with `REFRESH_TOKEN_INVALID` once the cap is passed. The
4432
- * caller cannot distinguish this from any other invalid refresh, which is deliberate: the
4433
- * remedy is the same (sign in again) and the difference would only tell a holder of a
4434
- * stolen token how old the account's session is.
4435
- */
4436
- /**
4437
4594
  * Emits {@link IAuthHooks.onRefreshTokenReuseDetected}, fire-and-forget.
4438
4595
  *
4439
4596
  * The owner is read from the stored session where it can be — a replay of a token whose live
@@ -4453,6 +4610,23 @@ var TokenManagerService = class _TokenManagerService {
4453
4610
  this.logger.error("onRefreshTokenReuseDetected hook threw synchronously", err);
4454
4611
  }
4455
4612
  }
4613
+ /**
4614
+ * Refuses a rotation once the login it descends from has outlived the absolute cap.
4615
+ *
4616
+ * `refreshExpiresInDays` bounds a single refresh token, not a session: a client rotating
4617
+ * every fifteen minutes renews that lifetime forever, so without this a session established
4618
+ * once never has to be established again. The cap measures from the **family's** birth, which
4619
+ * is carried unchanged through the lineage.
4620
+ *
4621
+ * A session with no birth time predates the field and is not capped — it ages out under the
4622
+ * refresh lifetime like any other. A cap of `0` disables the check entirely.
4623
+ *
4624
+ * @param session - The presented session, or the placeholder when the token is not live.
4625
+ * @throws {@link AuthException} with `REFRESH_TOKEN_INVALID` once the cap is passed. The
4626
+ * caller cannot distinguish this from any other invalid refresh, which is deliberate: the
4627
+ * remedy is the same (sign in again) and the difference would only tell a holder of a
4628
+ * stolen token how old the account's session is.
4629
+ */
4456
4630
  assertWithinAbsoluteLifetime(session) {
4457
4631
  const capDays = this.options.jwt.absoluteSessionLifetimeDays;
4458
4632
  if (capDays <= 0) return;
@@ -4685,8 +4859,9 @@ var TokenManagerService = class _TokenManagerService {
4685
4859
  return this.rotatePlatformFromGrace(outcome.sessionJson, oldHash, ip, userAgent, refreshTtl);
4686
4860
  }
4687
4861
  if (outcome.kind === "reused") {
4688
- this.logger.warn("reissuePlatformTokens: reuse of a consumed refresh token detected \u2014 revoking the token family");
4862
+ this.logger.warn(`reissuePlatformTokens: reuse of a consumed refresh token detected \u2014 revoking the token family familyId=${logSafe(outcome.familyId)}`);
4689
4863
  const { ownerId } = await this.redis.revokeFamily(outcome.familyId, "platform");
4864
+ this.logger.warn(`reissuePlatformTokens: token family revoked after reuse detection userId=${logSafe(ownerId)} familyId=${logSafe(outcome.familyId)}`);
4690
4865
  this.emitReuseDetected(ownerId, outcome.familyId);
4691
4866
  throw new AuthException(AUTH_ERROR_CODES.REFRESH_TOKEN_INVALID);
4692
4867
  }
@@ -4795,23 +4970,9 @@ var TokenManagerService = class _TokenManagerService {
4795
4970
  });
4796
4971
  }
4797
4972
  // ---------------------------------------------------------------------------
4798
- // Token decoding (no expiry check)
4973
+ // Verification that ignores expiry (logout only)
4799
4974
  // ---------------------------------------------------------------------------
4800
4975
  /**
4801
- * Decodes a JWT without validating its expiration or signature.
4802
- *
4803
- * @internal
4804
- * **WARNING:** This method does NOT verify the token signature or expiry.
4805
- * It must only be used for internal diagnostic purposes (e.g. reading the
4806
- * `sub` claim from an expired token to look up a session for revocation).
4807
- * Never use it to authorize requests — use `JwtService.verify()` in guards.
4808
- *
4809
- * @param token - Raw JWT string.
4810
- * @returns Decoded payload.
4811
- * @throws {@link AuthException} with `TOKEN_INVALID` if the payload is not an
4812
- * object or lacks required `jti` (string) and `sub` (string) claims.
4813
- */
4814
- /**
4815
4976
  * Verifies an access token's signature under the pinned algorithm while **ignoring its
4816
4977
  * expiry**, returning the payload.
4817
4978
  *
@@ -4847,16 +5008,6 @@ var TokenManagerService = class _TokenManagerService {
4847
5008
  ignoreExpiration: true
4848
5009
  });
4849
5010
  }
4850
- decodeToken(token) {
4851
- const raw = this.jwtService.decode(token);
4852
- if (
4853
- // Stryker disable next-line ConditionalExpression: the object-type clause is redundant: every reachable non-object value also fails the sibling field checks, so dropping it changes nothing
4854
- typeof raw !== "object" || raw === null || typeof raw["jti"] !== "string" || typeof raw["sub"] !== "string"
4855
- ) {
4856
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
4857
- }
4858
- return raw;
4859
- }
4860
5011
  // ---------------------------------------------------------------------------
4861
5012
  // MFA temp tokens
4862
5013
  // ---------------------------------------------------------------------------
@@ -4964,9 +5115,11 @@ var TokenManagerService = class _TokenManagerService {
4964
5115
  };
4965
5116
  TokenManagerService = _ts_decorate16([
4966
5117
  Injectable(),
4967
- _ts_param10(1, Inject(BYMAX_AUTH_OPTIONS)),
4968
- _ts_param10(3, Inject(BYMAX_AUTH_HOOKS)),
4969
- _ts_param10(3, Optional()),
5118
+ _ts_param11(0, Inject(JwtService)),
5119
+ _ts_param11(1, Inject(BYMAX_AUTH_OPTIONS)),
5120
+ _ts_param11(2, Inject(AuthRedisService)),
5121
+ _ts_param11(3, Inject(BYMAX_AUTH_HOOKS)),
5122
+ _ts_param11(3, Optional()),
4970
5123
  _ts_metadata15("design:type", Function),
4971
5124
  _ts_metadata15("design:paramtypes", [
4972
5125
  typeof JwtService === "undefined" ? Object : JwtService,
@@ -4976,13 +5129,6 @@ TokenManagerService = _ts_decorate16([
4976
5129
  ])
4977
5130
  ], TokenManagerService);
4978
5131
 
4979
- // src/server/utils/log-safe.ts
4980
- var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/;
4981
- function logSafe(value) {
4982
- return CONTROL_CHARACTERS.test(value) ? "<malformed>" : value;
4983
- }
4984
- __name(logSafe, "logSafe");
4985
-
4986
5132
  // src/server/utils/mask-email.ts
4987
5133
  function maskEmail(email) {
4988
5134
  const atIndex = email.indexOf("@");
@@ -5025,12 +5171,12 @@ function _ts_metadata16(k, v) {
5025
5171
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5026
5172
  }
5027
5173
  __name(_ts_metadata16, "_ts_metadata");
5028
- function _ts_param11(paramIndex, decorator) {
5174
+ function _ts_param12(paramIndex, decorator) {
5029
5175
  return function(target, key) {
5030
5176
  decorator(target, key, paramIndex);
5031
5177
  };
5032
5178
  }
5033
- __name(_ts_param11, "_ts_param");
5179
+ __name(_ts_param12, "_ts_param");
5034
5180
  var ANTI_ENUM_MIN_MS = 300;
5035
5181
  var AuthService = class _AuthService {
5036
5182
  static {
@@ -5645,6 +5791,24 @@ var AuthService = class _AuthService {
5645
5791
  // Private helpers
5646
5792
  // ---------------------------------------------------------------------------
5647
5793
  /**
5794
+ * Derives the OTP-record identifier for a `tenantId + email` pair.
5795
+ *
5796
+ * HMAC rather than a bare digest because an address is low-entropy: a bare SHA-256 of one is
5797
+ * reversible by dictionary, and these identifiers are the Redis key an operator can read.
5798
+ * The preimage is pinned by `conformance/wire-contract.json` and shared byte-for-byte with
5799
+ * rust-auth, which keys the same records in the same Redis.
5800
+ *
5801
+ * Deliberately distinct from {@link lockoutIdentifier}: that one namespaces the login
5802
+ * keyspace with a `dashboard:` prefix, and the two must never collide.
5803
+ *
5804
+ * @param tenantId - Tenant scope.
5805
+ * @param email - The canonicalized address.
5806
+ * @returns Hex HMAC-SHA-256 identifier.
5807
+ */
5808
+ otpIdentifier(tenantId, email) {
5809
+ return hmacSha256(`${tenantId}:${email}`, this.options.hmacKey);
5810
+ }
5811
+ /**
5648
5812
  * The brute-force counter key for a dashboard account.
5649
5813
  *
5650
5814
  * The identity PLANE is part of the preimage, not just the tenant. Without it a tenant whose
@@ -5664,24 +5828,6 @@ var AuthService = class _AuthService {
5664
5828
  * @param email - The address, already normalized by the caller.
5665
5829
  * @returns The HMAC identifier, opaque and non-reversible.
5666
5830
  */
5667
- /**
5668
- * Derives the OTP-record identifier for a `tenantId + email` pair.
5669
- *
5670
- * HMAC rather than a bare digest because an address is low-entropy: a bare SHA-256 of one is
5671
- * reversible by dictionary, and these identifiers are the Redis key an operator can read.
5672
- * The preimage is pinned by `conformance/wire-contract.json` and shared byte-for-byte with
5673
- * rust-auth, which keys the same records in the same Redis.
5674
- *
5675
- * Deliberately distinct from {@link lockoutIdentifier}: that one namespaces the login
5676
- * keyspace with a `dashboard:` prefix, and the two must never collide.
5677
- *
5678
- * @param tenantId - Tenant scope.
5679
- * @param email - The canonicalized address.
5680
- * @returns Hex HMAC-SHA-256 identifier.
5681
- */
5682
- otpIdentifier(tenantId, email) {
5683
- return hmacSha256(`${tenantId}:${email}`, this.options.hmacKey);
5684
- }
5685
5831
  lockoutIdentifier(tenantId, email) {
5686
5832
  return hmacSha256(`dashboard:${tenantId}:${email}`, this.options.hmacKey);
5687
5833
  }
@@ -5766,12 +5912,18 @@ var AuthService = class _AuthService {
5766
5912
  };
5767
5913
  AuthService = _ts_decorate17([
5768
5914
  Injectable(),
5769
- _ts_param11(0, Inject(BYMAX_AUTH_OPTIONS)),
5770
- _ts_param11(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
5771
- _ts_param11(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
5772
- _ts_param11(2, Optional()),
5773
- _ts_param11(3, Inject(BYMAX_AUTH_HOOKS)),
5774
- _ts_param11(3, Optional()),
5915
+ _ts_param12(0, Inject(BYMAX_AUTH_OPTIONS)),
5916
+ _ts_param12(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
5917
+ _ts_param12(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
5918
+ _ts_param12(2, Optional()),
5919
+ _ts_param12(3, Inject(BYMAX_AUTH_HOOKS)),
5920
+ _ts_param12(3, Optional()),
5921
+ _ts_param12(4, Inject(PasswordService)),
5922
+ _ts_param12(5, Inject(TokenManagerService)),
5923
+ _ts_param12(6, Inject(BruteForceService)),
5924
+ _ts_param12(7, Inject(AuthRedisService)),
5925
+ _ts_param12(8, Inject(OtpService)),
5926
+ _ts_param12(9, Inject(SessionService)),
5775
5927
  _ts_metadata16("design:type", Function),
5776
5928
  _ts_metadata16("design:paramtypes", [
5777
5929
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -5807,12 +5959,12 @@ function _ts_metadata17(k, v) {
5807
5959
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5808
5960
  }
5809
5961
  __name(_ts_metadata17, "_ts_metadata");
5810
- function _ts_param12(paramIndex, decorator) {
5962
+ function _ts_param13(paramIndex, decorator) {
5811
5963
  return function(target, key) {
5812
5964
  decorator(target, key, paramIndex);
5813
5965
  };
5814
5966
  }
5815
- __name(_ts_param12, "_ts_param");
5967
+ __name(_ts_param13, "_ts_param");
5816
5968
  var WsTicketService = class _WsTicketService {
5817
5969
  static {
5818
5970
  __name(this, "WsTicketService");
@@ -5882,8 +6034,9 @@ var WsTicketService = class _WsTicketService {
5882
6034
  };
5883
6035
  WsTicketService = _ts_decorate18([
5884
6036
  Injectable(),
5885
- _ts_param12(1, Inject(BYMAX_AUTH_OPTIONS)),
5886
- _ts_param12(2, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6037
+ _ts_param13(0, Inject(AuthRedisService)),
6038
+ _ts_param13(1, Inject(BYMAX_AUTH_OPTIONS)),
6039
+ _ts_param13(2, Inject(BYMAX_AUTH_USER_REPOSITORY)),
5887
6040
  _ts_metadata17("design:type", Function),
5888
6041
  _ts_metadata17("design:paramtypes", [
5889
6042
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
@@ -5904,12 +6057,12 @@ function _ts_metadata18(k, v) {
5904
6057
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5905
6058
  }
5906
6059
  __name(_ts_metadata18, "_ts_metadata");
5907
- function _ts_param13(paramIndex, decorator) {
6060
+ function _ts_param14(paramIndex, decorator) {
5908
6061
  return function(target, key) {
5909
6062
  decorator(target, key, paramIndex);
5910
6063
  };
5911
6064
  }
5912
- __name(_ts_param13, "_ts_param");
6065
+ __name(_ts_param14, "_ts_param");
5913
6066
  function isMfaChallenge(result) {
5914
6067
  return "mfaRequired" in result && result.mfaRequired === true;
5915
6068
  }
@@ -6056,9 +6209,9 @@ _ts_decorate19([
6056
6209
  Throttle(AUTH_THROTTLE_CONFIGS.register),
6057
6210
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
6058
6211
  Post("register"),
6059
- _ts_param13(0, Body()),
6060
- _ts_param13(1, Req()),
6061
- _ts_param13(2, Res({
6212
+ _ts_param14(0, Body()),
6213
+ _ts_param14(1, Req()),
6214
+ _ts_param14(2, Res({
6062
6215
  passthrough: true
6063
6216
  })),
6064
6217
  _ts_metadata18("design:type", Function),
@@ -6075,9 +6228,9 @@ _ts_decorate19([
6075
6228
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
6076
6229
  HttpCode(HttpStatus.OK),
6077
6230
  Post("login"),
6078
- _ts_param13(0, Body()),
6079
- _ts_param13(1, Req()),
6080
- _ts_param13(2, Res({
6231
+ _ts_param14(0, Body()),
6232
+ _ts_param14(1, Req()),
6233
+ _ts_param14(2, Res({
6081
6234
  passthrough: true
6082
6235
  })),
6083
6236
  _ts_metadata18("design:type", Function),
@@ -6094,8 +6247,8 @@ _ts_decorate19([
6094
6247
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
6095
6248
  HttpCode(HttpStatus.NO_CONTENT),
6096
6249
  Post("logout"),
6097
- _ts_param13(0, Req()),
6098
- _ts_param13(1, Res({
6250
+ _ts_param14(0, Req()),
6251
+ _ts_param14(1, Res({
6099
6252
  passthrough: true
6100
6253
  })),
6101
6254
  _ts_metadata18("design:type", Function),
@@ -6111,8 +6264,8 @@ _ts_decorate19([
6111
6264
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
6112
6265
  HttpCode(HttpStatus.OK),
6113
6266
  Post("refresh"),
6114
- _ts_param13(0, Req()),
6115
- _ts_param13(1, Res({
6267
+ _ts_param14(0, Req()),
6268
+ _ts_param14(1, Res({
6116
6269
  passthrough: true
6117
6270
  })),
6118
6271
  _ts_metadata18("design:type", Function),
@@ -6125,7 +6278,7 @@ _ts_decorate19([
6125
6278
  _ts_decorate19([
6126
6279
  UseGuards(JwtAuthGuard),
6127
6280
  Get("me"),
6128
- _ts_param13(0, CurrentUser()),
6281
+ _ts_param14(0, CurrentUser()),
6129
6282
  _ts_metadata18("design:type", Function),
6130
6283
  _ts_metadata18("design:paramtypes", [
6131
6284
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
@@ -6138,7 +6291,7 @@ _ts_decorate19([
6138
6291
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
6139
6292
  Post("ws-ticket"),
6140
6293
  HttpCode(HttpStatus.OK),
6141
- _ts_param13(0, CurrentUser()),
6294
+ _ts_param14(0, CurrentUser()),
6142
6295
  _ts_metadata18("design:type", Function),
6143
6296
  _ts_metadata18("design:paramtypes", [
6144
6297
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
@@ -6151,8 +6304,8 @@ _ts_decorate19([
6151
6304
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
6152
6305
  HttpCode(HttpStatus.NO_CONTENT),
6153
6306
  Post("verify-email"),
6154
- _ts_param13(0, Body()),
6155
- _ts_param13(1, Req()),
6307
+ _ts_param14(0, Body()),
6308
+ _ts_param14(1, Req()),
6156
6309
  _ts_metadata18("design:type", Function),
6157
6310
  _ts_metadata18("design:paramtypes", [
6158
6311
  typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
@@ -6166,8 +6319,8 @@ _ts_decorate19([
6166
6319
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
6167
6320
  HttpCode(HttpStatus.NO_CONTENT),
6168
6321
  Post("resend-verification"),
6169
- _ts_param13(0, Body()),
6170
- _ts_param13(1, Req()),
6322
+ _ts_param14(0, Body()),
6323
+ _ts_param14(1, Req()),
6171
6324
  _ts_metadata18("design:type", Function),
6172
6325
  _ts_metadata18("design:paramtypes", [
6173
6326
  typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
@@ -6180,6 +6333,9 @@ AuthController = _ts_decorate19([
6180
6333
  Controller(),
6181
6334
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
6182
6335
  UsePipes(createAuthValidationPipe()),
6336
+ _ts_param14(0, Inject(AuthService)),
6337
+ _ts_param14(1, Inject(TokenDeliveryService)),
6338
+ _ts_param14(2, Inject(WsTicketService)),
6183
6339
  _ts_metadata18("design:type", Function),
6184
6340
  _ts_metadata18("design:paramtypes", [
6185
6341
  typeof AuthService === "undefined" ? Object : AuthService,
@@ -6270,12 +6426,12 @@ function _ts_metadata21(k, v) {
6270
6426
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6271
6427
  }
6272
6428
  __name(_ts_metadata21, "_ts_metadata");
6273
- function _ts_param14(paramIndex, decorator) {
6429
+ function _ts_param15(paramIndex, decorator) {
6274
6430
  return function(target, key) {
6275
6431
  decorator(target, key, paramIndex);
6276
6432
  };
6277
6433
  }
6278
- __name(_ts_param14, "_ts_param");
6434
+ __name(_ts_param15, "_ts_param");
6279
6435
  var EMAIL_CHANGE_TOKEN_BYTES = 32;
6280
6436
  function isEmailChangeContext(value) {
6281
6437
  if (typeof value !== "object" || value === null) return false;
@@ -6490,9 +6646,12 @@ var EmailChangeService = class _EmailChangeService {
6490
6646
  };
6491
6647
  EmailChangeService = _ts_decorate22([
6492
6648
  Injectable(),
6493
- _ts_param14(0, Inject(BYMAX_AUTH_OPTIONS)),
6494
- _ts_param14(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6495
- _ts_param14(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6649
+ _ts_param15(0, Inject(BYMAX_AUTH_OPTIONS)),
6650
+ _ts_param15(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6651
+ _ts_param15(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6652
+ _ts_param15(3, Inject(PasswordService)),
6653
+ _ts_param15(4, Inject(AuthRedisService)),
6654
+ _ts_param15(5, Inject(BruteForceService)),
6496
6655
  _ts_metadata21("design:type", Function),
6497
6656
  _ts_metadata21("design:paramtypes", [
6498
6657
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -6516,12 +6675,12 @@ function _ts_metadata22(k, v) {
6516
6675
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6517
6676
  }
6518
6677
  __name(_ts_metadata22, "_ts_metadata");
6519
- function _ts_param15(paramIndex, decorator) {
6678
+ function _ts_param16(paramIndex, decorator) {
6520
6679
  return function(target, key) {
6521
6680
  decorator(target, key, paramIndex);
6522
6681
  };
6523
6682
  }
6524
- __name(_ts_param15, "_ts_param");
6683
+ __name(_ts_param16, "_ts_param");
6525
6684
  var EmailChangeController = class {
6526
6685
  static {
6527
6686
  __name(this, "EmailChangeController");
@@ -6574,8 +6733,8 @@ _ts_decorate23([
6574
6733
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
6575
6734
  HttpCode(HttpStatus.NO_CONTENT),
6576
6735
  Post("change"),
6577
- _ts_param15(0, Body()),
6578
- _ts_param15(1, CurrentUser()),
6736
+ _ts_param16(0, Body()),
6737
+ _ts_param16(1, CurrentUser()),
6579
6738
  _ts_metadata22("design:type", Function),
6580
6739
  _ts_metadata22("design:paramtypes", [
6581
6740
  typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
@@ -6589,7 +6748,7 @@ _ts_decorate23([
6589
6748
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
6590
6749
  HttpCode(HttpStatus.NO_CONTENT),
6591
6750
  Post("change/confirm"),
6592
- _ts_param15(0, Body()),
6751
+ _ts_param16(0, Body()),
6593
6752
  _ts_metadata22("design:type", Function),
6594
6753
  _ts_metadata22("design:paramtypes", [
6595
6754
  typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
@@ -6601,6 +6760,7 @@ EmailChangeController = _ts_decorate23([
6601
6760
  Controller("email"),
6602
6761
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
6603
6762
  UsePipes(createAuthValidationPipe()),
6763
+ _ts_param16(0, Inject(EmailChangeService)),
6604
6764
  _ts_metadata22("design:type", Function),
6605
6765
  _ts_metadata22("design:paramtypes", [
6606
6766
  typeof EmailChangeService === "undefined" ? Object : EmailChangeService
@@ -6765,12 +6925,12 @@ function _ts_metadata26(k, v) {
6765
6925
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6766
6926
  }
6767
6927
  __name(_ts_metadata26, "_ts_metadata");
6768
- function _ts_param16(paramIndex, decorator) {
6928
+ function _ts_param17(paramIndex, decorator) {
6769
6929
  return function(target, key) {
6770
6930
  decorator(target, key, paramIndex);
6771
6931
  };
6772
6932
  }
6773
- __name(_ts_param16, "_ts_param");
6933
+ __name(_ts_param17, "_ts_param");
6774
6934
  function isStoredInvitation(value) {
6775
6935
  if (typeof value !== "object" || value === null) return false;
6776
6936
  const v = value;
@@ -7199,10 +7359,14 @@ var InvitationService = class _InvitationService {
7199
7359
  };
7200
7360
  InvitationService = _ts_decorate27([
7201
7361
  Injectable(),
7202
- _ts_param16(0, Inject(BYMAX_AUTH_USER_REPOSITORY)),
7203
- _ts_param16(1, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
7204
- _ts_param16(2, Inject(BYMAX_AUTH_HOOKS)),
7205
- _ts_param16(7, Inject(BYMAX_AUTH_OPTIONS)),
7362
+ _ts_param17(0, Inject(BYMAX_AUTH_USER_REPOSITORY)),
7363
+ _ts_param17(1, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
7364
+ _ts_param17(2, Inject(BYMAX_AUTH_HOOKS)),
7365
+ _ts_param17(3, Inject(AuthRedisService)),
7366
+ _ts_param17(4, Inject(PasswordService)),
7367
+ _ts_param17(5, Inject(SessionService)),
7368
+ _ts_param17(6, Inject(TokenManagerService)),
7369
+ _ts_param17(7, Inject(BYMAX_AUTH_OPTIONS)),
7206
7370
  _ts_metadata26("design:type", Function),
7207
7371
  _ts_metadata26("design:paramtypes", [
7208
7372
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
@@ -7228,12 +7392,12 @@ function _ts_metadata27(k, v) {
7228
7392
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7229
7393
  }
7230
7394
  __name(_ts_metadata27, "_ts_metadata");
7231
- function _ts_param17(paramIndex, decorator) {
7395
+ function _ts_param18(paramIndex, decorator) {
7232
7396
  return function(target, key) {
7233
7397
  decorator(target, key, paramIndex);
7234
7398
  };
7235
7399
  }
7236
- __name(_ts_param17, "_ts_param");
7400
+ __name(_ts_param18, "_ts_param");
7237
7401
  var InvitationController = class {
7238
7402
  static {
7239
7403
  __name(this, "InvitationController");
@@ -7315,8 +7479,8 @@ _ts_decorate28([
7315
7479
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
7316
7480
  HttpCode(HttpStatus.NO_CONTENT),
7317
7481
  Post(),
7318
- _ts_param17(0, Body()),
7319
- _ts_param17(1, CurrentUser()),
7482
+ _ts_param18(0, Body()),
7483
+ _ts_param18(1, CurrentUser()),
7320
7484
  _ts_metadata27("design:type", Function),
7321
7485
  _ts_metadata27("design:paramtypes", [
7322
7486
  typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
@@ -7330,8 +7494,8 @@ _ts_decorate28([
7330
7494
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
7331
7495
  HttpCode(HttpStatus.NO_CONTENT),
7332
7496
  Post("revoke"),
7333
- _ts_param17(0, Body()),
7334
- _ts_param17(1, CurrentUser()),
7497
+ _ts_param18(0, Body()),
7498
+ _ts_param18(1, CurrentUser()),
7335
7499
  _ts_metadata27("design:type", Function),
7336
7500
  _ts_metadata27("design:paramtypes", [
7337
7501
  typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
@@ -7345,9 +7509,9 @@ _ts_decorate28([
7345
7509
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
7346
7510
  HttpCode(HttpStatus.CREATED),
7347
7511
  Post("accept"),
7348
- _ts_param17(0, Body()),
7349
- _ts_param17(1, Req()),
7350
- _ts_param17(2, Res({
7512
+ _ts_param18(0, Body()),
7513
+ _ts_param18(1, Req()),
7514
+ _ts_param18(2, Res({
7351
7515
  passthrough: true
7352
7516
  })),
7353
7517
  _ts_metadata27("design:type", Function),
@@ -7363,6 +7527,8 @@ InvitationController = _ts_decorate28([
7363
7527
  Controller("invitations"),
7364
7528
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
7365
7529
  UsePipes(createAuthValidationPipe()),
7530
+ _ts_param18(0, Inject(InvitationService)),
7531
+ _ts_param18(1, Inject(TokenDeliveryService)),
7366
7532
  _ts_metadata27("design:type", Function),
7367
7533
  _ts_metadata27("design:paramtypes", [
7368
7534
  typeof InvitationService === "undefined" ? Object : InvitationService,
@@ -7637,12 +7803,12 @@ function _ts_metadata33(k, v) {
7637
7803
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7638
7804
  }
7639
7805
  __name(_ts_metadata33, "_ts_metadata");
7640
- function _ts_param18(paramIndex, decorator) {
7806
+ function _ts_param19(paramIndex, decorator) {
7641
7807
  return function(target, key) {
7642
7808
  decorator(target, key, paramIndex);
7643
7809
  };
7644
7810
  }
7645
- __name(_ts_param18, "_ts_param");
7811
+ __name(_ts_param19, "_ts_param");
7646
7812
  var MFA_SETUP_TTL_SECONDS = 600;
7647
7813
  var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
7648
7814
  function totpAntiReplayTtlSeconds(window) {
@@ -8537,12 +8703,17 @@ var MfaService = class _MfaService {
8537
8703
  };
8538
8704
  MfaService = _ts_decorate34([
8539
8705
  Injectable(),
8540
- _ts_param18(0, Inject(BYMAX_AUTH_OPTIONS)),
8541
- _ts_param18(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
8542
- _ts_param18(2, Optional()),
8543
- _ts_param18(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
8544
- _ts_param18(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
8545
- _ts_param18(9, Inject(BYMAX_AUTH_HOOKS)),
8706
+ _ts_param19(0, Inject(BYMAX_AUTH_OPTIONS)),
8707
+ _ts_param19(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
8708
+ _ts_param19(2, Optional()),
8709
+ _ts_param19(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
8710
+ _ts_param19(3, Inject(AuthRedisService)),
8711
+ _ts_param19(4, Inject(TokenManagerService)),
8712
+ _ts_param19(5, Inject(BruteForceService)),
8713
+ _ts_param19(6, Inject(PasswordService)),
8714
+ _ts_param19(7, Inject(SessionService)),
8715
+ _ts_param19(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
8716
+ _ts_param19(9, Inject(BYMAX_AUTH_HOOKS)),
8546
8717
  _ts_metadata33("design:type", Function),
8547
8718
  _ts_metadata33("design:paramtypes", [
8548
8719
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -8570,12 +8741,12 @@ function _ts_metadata34(k, v) {
8570
8741
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
8571
8742
  }
8572
8743
  __name(_ts_metadata34, "_ts_metadata");
8573
- function _ts_param19(paramIndex, decorator) {
8744
+ function _ts_param20(paramIndex, decorator) {
8574
8745
  return function(target, key) {
8575
8746
  decorator(target, key, paramIndex);
8576
8747
  };
8577
8748
  }
8578
- __name(_ts_param19, "_ts_param");
8749
+ __name(_ts_param20, "_ts_param");
8579
8750
  function isPlatformResult(result) {
8580
8751
  return "admin" in result;
8581
8752
  }
@@ -8769,8 +8940,8 @@ _ts_decorate35([
8769
8940
  Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
8770
8941
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
8771
8942
  Post("setup"),
8772
- _ts_param19(0, CurrentUser()),
8773
- _ts_param19(1, Body()),
8943
+ _ts_param20(0, CurrentUser()),
8944
+ _ts_param20(1, Body()),
8774
8945
  _ts_metadata34("design:type", Function),
8775
8946
  _ts_metadata34("design:paramtypes", [
8776
8947
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8784,9 +8955,9 @@ _ts_decorate35([
8784
8955
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
8785
8956
  HttpCode(HttpStatus.NO_CONTENT),
8786
8957
  Post("verify-enable"),
8787
- _ts_param19(0, CurrentUser()),
8788
- _ts_param19(1, Body()),
8789
- _ts_param19(2, Req()),
8958
+ _ts_param20(0, CurrentUser()),
8959
+ _ts_param20(1, Body()),
8960
+ _ts_param20(2, Req()),
8790
8961
  _ts_metadata34("design:type", Function),
8791
8962
  _ts_metadata34("design:paramtypes", [
8792
8963
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8802,9 +8973,9 @@ _ts_decorate35([
8802
8973
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
8803
8974
  HttpCode(HttpStatus.OK),
8804
8975
  Post("challenge"),
8805
- _ts_param19(0, Body()),
8806
- _ts_param19(1, Req()),
8807
- _ts_param19(2, Res({
8976
+ _ts_param20(0, Body()),
8977
+ _ts_param20(1, Req()),
8978
+ _ts_param20(2, Res({
8808
8979
  passthrough: true
8809
8980
  })),
8810
8981
  _ts_metadata34("design:type", Function),
@@ -8821,9 +8992,9 @@ _ts_decorate35([
8821
8992
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
8822
8993
  HttpCode(HttpStatus.NO_CONTENT),
8823
8994
  Post("disable"),
8824
- _ts_param19(0, CurrentUser()),
8825
- _ts_param19(1, Body()),
8826
- _ts_param19(2, Req()),
8995
+ _ts_param20(0, CurrentUser()),
8996
+ _ts_param20(1, Body()),
8997
+ _ts_param20(2, Req()),
8827
8998
  _ts_metadata34("design:type", Function),
8828
8999
  _ts_metadata34("design:paramtypes", [
8829
9000
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8838,9 +9009,9 @@ _ts_decorate35([
8838
9009
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
8839
9010
  HttpCode(HttpStatus.OK),
8840
9011
  Post("recovery-codes"),
8841
- _ts_param19(0, CurrentUser()),
8842
- _ts_param19(1, Body()),
8843
- _ts_param19(2, Req()),
9012
+ _ts_param20(0, CurrentUser()),
9013
+ _ts_param20(1, Body()),
9014
+ _ts_param20(2, Req()),
8844
9015
  _ts_metadata34("design:type", Function),
8845
9016
  _ts_metadata34("design:paramtypes", [
8846
9017
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8856,7 +9027,9 @@ MfaController = _ts_decorate35([
8856
9027
  UsePipes(createAuthValidationPipe({
8857
9028
  forbidUnknownValues: true
8858
9029
  })),
8859
- _ts_param19(2, Inject(BYMAX_AUTH_OPTIONS)),
9030
+ _ts_param20(0, Inject(MfaService)),
9031
+ _ts_param20(1, Inject(TokenDeliveryService)),
9032
+ _ts_param20(2, Inject(BYMAX_AUTH_OPTIONS)),
8860
9033
  _ts_metadata34("design:type", Function),
8861
9034
  _ts_metadata34("design:paramtypes", [
8862
9035
  typeof MfaService === "undefined" ? Object : MfaService,
@@ -9147,12 +9320,12 @@ function _ts_metadata40(k, v) {
9147
9320
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9148
9321
  }
9149
9322
  __name(_ts_metadata40, "_ts_metadata");
9150
- function _ts_param20(paramIndex, decorator) {
9323
+ function _ts_param21(paramIndex, decorator) {
9151
9324
  return function(target, key) {
9152
9325
  decorator(target, key, paramIndex);
9153
9326
  };
9154
9327
  }
9155
- __name(_ts_param20, "_ts_param");
9328
+ __name(_ts_param21, "_ts_param");
9156
9329
  var ANTI_ENUM_MIN_MS2 = 300;
9157
9330
  var VERIFIED_TOKEN_TTL_SECONDS = 300;
9158
9331
  var PASSWORD_RESET_PURPOSE = "password_reset";
@@ -9667,12 +9840,17 @@ var PasswordResetService = class _PasswordResetService {
9667
9840
  };
9668
9841
  PasswordResetService = _ts_decorate41([
9669
9842
  Injectable(),
9670
- _ts_param20(0, Inject(BYMAX_AUTH_OPTIONS)),
9671
- _ts_param20(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
9672
- _ts_param20(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
9673
- _ts_param20(2, Optional()),
9674
- _ts_param20(3, Inject(BYMAX_AUTH_HOOKS)),
9675
- _ts_param20(3, Optional()),
9843
+ _ts_param21(0, Inject(BYMAX_AUTH_OPTIONS)),
9844
+ _ts_param21(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
9845
+ _ts_param21(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
9846
+ _ts_param21(2, Optional()),
9847
+ _ts_param21(3, Inject(BYMAX_AUTH_HOOKS)),
9848
+ _ts_param21(3, Optional()),
9849
+ _ts_param21(4, Inject(OtpService)),
9850
+ _ts_param21(5, Inject(PasswordService)),
9851
+ _ts_param21(6, Inject(AuthRedisService)),
9852
+ _ts_param21(7, Inject(SessionService)),
9853
+ _ts_param21(8, Inject(BruteForceService)),
9676
9854
  _ts_metadata40("design:type", Function),
9677
9855
  _ts_metadata40("design:paramtypes", [
9678
9856
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -9704,12 +9882,12 @@ function _ts_metadata41(k, v) {
9704
9882
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9705
9883
  }
9706
9884
  __name(_ts_metadata41, "_ts_metadata");
9707
- function _ts_param21(paramIndex, decorator) {
9885
+ function _ts_param22(paramIndex, decorator) {
9708
9886
  return function(target, key) {
9709
9887
  decorator(target, key, paramIndex);
9710
9888
  };
9711
9889
  }
9712
- __name(_ts_param21, "_ts_param");
9890
+ __name(_ts_param22, "_ts_param");
9713
9891
  var PasswordResetController = class {
9714
9892
  static {
9715
9893
  __name(this, "PasswordResetController");
@@ -9825,8 +10003,8 @@ _ts_decorate42([
9825
10003
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
9826
10004
  HttpCode(HttpStatus.OK),
9827
10005
  Post("forgot-password"),
9828
- _ts_param21(0, Body()),
9829
- _ts_param21(1, Req()),
10006
+ _ts_param22(0, Body()),
10007
+ _ts_param22(1, Req()),
9830
10008
  _ts_metadata41("design:type", Function),
9831
10009
  _ts_metadata41("design:paramtypes", [
9832
10010
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
@@ -9839,8 +10017,8 @@ _ts_decorate42([
9839
10017
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
9840
10018
  HttpCode(HttpStatus.NO_CONTENT),
9841
10019
  Post("reset-password"),
9842
- _ts_param21(0, Body()),
9843
- _ts_param21(1, Req()),
10020
+ _ts_param22(0, Body()),
10021
+ _ts_param22(1, Req()),
9844
10022
  _ts_metadata41("design:type", Function),
9845
10023
  _ts_metadata41("design:paramtypes", [
9846
10024
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
@@ -9855,9 +10033,9 @@ _ts_decorate42([
9855
10033
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
9856
10034
  HttpCode(HttpStatus.NO_CONTENT),
9857
10035
  Post("change"),
9858
- _ts_param21(0, CurrentUser()),
9859
- _ts_param21(1, Body()),
9860
- _ts_param21(2, Req()),
10036
+ _ts_param22(0, CurrentUser()),
10037
+ _ts_param22(1, Body()),
10038
+ _ts_param22(2, Req()),
9861
10039
  _ts_metadata41("design:type", Function),
9862
10040
  _ts_metadata41("design:paramtypes", [
9863
10041
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -9871,8 +10049,8 @@ _ts_decorate42([
9871
10049
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
9872
10050
  HttpCode(HttpStatus.OK),
9873
10051
  Post("verify-otp"),
9874
- _ts_param21(0, Body()),
9875
- _ts_param21(1, Req()),
10052
+ _ts_param22(0, Body()),
10053
+ _ts_param22(1, Req()),
9876
10054
  _ts_metadata41("design:type", Function),
9877
10055
  _ts_metadata41("design:paramtypes", [
9878
10056
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
@@ -9885,8 +10063,8 @@ _ts_decorate42([
9885
10063
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
9886
10064
  HttpCode(HttpStatus.OK),
9887
10065
  Post("resend-otp"),
9888
- _ts_param21(0, Body()),
9889
- _ts_param21(1, Req()),
10066
+ _ts_param22(0, Body()),
10067
+ _ts_param22(1, Req()),
9890
10068
  _ts_metadata41("design:type", Function),
9891
10069
  _ts_metadata41("design:paramtypes", [
9892
10070
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
@@ -9900,6 +10078,8 @@ PasswordResetController = _ts_decorate42([
9900
10078
  Controller("password"),
9901
10079
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
9902
10080
  UsePipes(createAuthValidationPipe()),
10081
+ _ts_param22(0, Inject(PasswordResetService)),
10082
+ _ts_param22(1, Inject(TokenDeliveryService)),
9903
10083
  _ts_metadata41("design:type", Function),
9904
10084
  _ts_metadata41("design:paramtypes", [
9905
10085
  typeof PasswordResetService === "undefined" ? Object : PasswordResetService,
@@ -9972,12 +10152,12 @@ function _ts_metadata43(k, v) {
9972
10152
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9973
10153
  }
9974
10154
  __name(_ts_metadata43, "_ts_metadata");
9975
- function _ts_param22(paramIndex, decorator) {
10155
+ function _ts_param23(paramIndex, decorator) {
9976
10156
  return function(target, key) {
9977
10157
  decorator(target, key, paramIndex);
9978
10158
  };
9979
10159
  }
9980
- __name(_ts_param22, "_ts_param");
10160
+ __name(_ts_param23, "_ts_param");
9981
10161
  var JwtPlatformGuard = class {
9982
10162
  static {
9983
10163
  __name(this, "JwtPlatformGuard");
@@ -10030,7 +10210,11 @@ var JwtPlatformGuard = class {
10030
10210
  };
10031
10211
  JwtPlatformGuard = _ts_decorate44([
10032
10212
  Injectable(),
10033
- _ts_param22(4, Inject(BYMAX_AUTH_OPTIONS)),
10213
+ _ts_param23(0, Inject(JwtService)),
10214
+ _ts_param23(1, Inject(TokenDeliveryService)),
10215
+ _ts_param23(2, Inject(AuthRedisService)),
10216
+ _ts_param23(3, Inject(Reflector)),
10217
+ _ts_param23(4, Inject(BYMAX_AUTH_OPTIONS)),
10034
10218
  _ts_metadata43("design:type", Function),
10035
10219
  _ts_metadata43("design:paramtypes", [
10036
10220
  typeof JwtService === "undefined" ? Object : JwtService,
@@ -10051,12 +10235,12 @@ function _ts_metadata44(k, v) {
10051
10235
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10052
10236
  }
10053
10237
  __name(_ts_metadata44, "_ts_metadata");
10054
- function _ts_param23(paramIndex, decorator) {
10238
+ function _ts_param24(paramIndex, decorator) {
10055
10239
  return function(target, key) {
10056
10240
  decorator(target, key, paramIndex);
10057
10241
  };
10058
10242
  }
10059
- __name(_ts_param23, "_ts_param");
10243
+ __name(_ts_param24, "_ts_param");
10060
10244
  var PlatformAuthService = class _PlatformAuthService {
10061
10245
  static {
10062
10246
  __name(this, "PlatformAuthService");
@@ -10236,23 +10420,6 @@ var PlatformAuthService = class _PlatformAuthService {
10236
10420
  // Session revocation
10237
10421
  // ---------------------------------------------------------------------------
10238
10422
  /**
10239
- * Revokes all active platform sessions for the given admin.
10240
- *
10241
- * Delegates to {@link AuthRedisService.invalidateUserSessions} which uses an atomic
10242
- * Lua script to read the `psess:{userId}` SET, delete all session and grace-pointer
10243
- * keys, and remove the SET itself in a single Redis round-trip. This prevents the
10244
- * TOCTOU race that would arise from a non-atomic SMEMBERS + loop + DEL approach.
10245
- *
10246
- * The token epoch is then advanced, so outstanding platform **access** tokens die with
10247
- * the refresh sessions rather than working on to expiry — "log out everywhere" that
10248
- * leaves every access token alive is not what those words promise. Bumped after the
10249
- * sweep for the same reason the dashboard flow bumps last: a failure in the sweep
10250
- * leaves the epoch untouched and the operation visibly incomplete, instead of the
10251
- * reverse, which would read as done while the sessions live on.
10252
- *
10253
- * @param userId - The platform admin's internal ID.
10254
- */
10255
- /**
10256
10423
  * Derives the brute-force identifier for a platform login: `hmac('platform:{email}')`.
10257
10424
  *
10258
10425
  * HMAC rather than a bare digest keeps PII out of the Redis key and blocks dictionary
@@ -10273,6 +10440,23 @@ var PlatformAuthService = class _PlatformAuthService {
10273
10440
  lockoutIdentifier(email) {
10274
10441
  return hmacSha256(`platform:${email}`, this.options.hmacKey);
10275
10442
  }
10443
+ /**
10444
+ * Revokes all active platform sessions for the given admin.
10445
+ *
10446
+ * Delegates to {@link AuthRedisService.invalidateUserSessions} which uses an atomic
10447
+ * Lua script to read the `psess:{userId}` SET, delete all session and grace-pointer
10448
+ * keys, and remove the SET itself in a single Redis round-trip. This prevents the
10449
+ * TOCTOU race that would arise from a non-atomic SMEMBERS + loop + DEL approach.
10450
+ *
10451
+ * The token epoch is then advanced, so outstanding platform **access** tokens die with
10452
+ * the refresh sessions rather than working on to expiry — "log out everywhere" that
10453
+ * leaves every access token alive is not what those words promise. Bumped after the
10454
+ * sweep for the same reason the dashboard flow bumps last: a failure in the sweep
10455
+ * leaves the epoch untouched and the operation visibly incomplete, instead of the
10456
+ * reverse, which would read as done while the sessions live on.
10457
+ *
10458
+ * @param userId - The platform admin's internal ID.
10459
+ */
10276
10460
  async revokeAllPlatformSessions(userId) {
10277
10461
  await this.redis.invalidateUserSessions(userId, "platform");
10278
10462
  await this.redis.bumpUserTokenEpoch(userId, "platform");
@@ -10280,8 +10464,12 @@ var PlatformAuthService = class _PlatformAuthService {
10280
10464
  };
10281
10465
  PlatformAuthService = _ts_decorate45([
10282
10466
  Injectable(),
10283
- _ts_param23(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10284
- _ts_param23(5, Inject(BYMAX_AUTH_OPTIONS)),
10467
+ _ts_param24(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10468
+ _ts_param24(1, Inject(PasswordService)),
10469
+ _ts_param24(2, Inject(TokenManagerService)),
10470
+ _ts_param24(3, Inject(BruteForceService)),
10471
+ _ts_param24(4, Inject(AuthRedisService)),
10472
+ _ts_param24(5, Inject(BYMAX_AUTH_OPTIONS)),
10285
10473
  _ts_metadata44("design:type", Function),
10286
10474
  _ts_metadata44("design:paramtypes", [
10287
10475
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
@@ -10305,12 +10493,12 @@ function _ts_metadata45(k, v) {
10305
10493
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10306
10494
  }
10307
10495
  __name(_ts_metadata45, "_ts_metadata");
10308
- function _ts_param24(paramIndex, decorator) {
10496
+ function _ts_param25(paramIndex, decorator) {
10309
10497
  return function(target, key) {
10310
10498
  decorator(target, key, paramIndex);
10311
10499
  };
10312
10500
  }
10313
- __name(_ts_param24, "_ts_param");
10501
+ __name(_ts_param25, "_ts_param");
10314
10502
  function isPlatformResult2(result) {
10315
10503
  return "admin" in result;
10316
10504
  }
@@ -10476,8 +10664,8 @@ _ts_decorate46([
10476
10664
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
10477
10665
  HttpCode(HttpStatus.OK),
10478
10666
  Post("login"),
10479
- _ts_param24(0, Body()),
10480
- _ts_param24(1, Req()),
10667
+ _ts_param25(0, Body()),
10668
+ _ts_param25(1, Req()),
10481
10669
  _ts_metadata45("design:type", Function),
10482
10670
  _ts_metadata45("design:paramtypes", [
10483
10671
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
@@ -10491,8 +10679,8 @@ _ts_decorate46([
10491
10679
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
10492
10680
  HttpCode(HttpStatus.OK),
10493
10681
  Post("mfa/challenge"),
10494
- _ts_param24(0, Body()),
10495
- _ts_param24(1, Req()),
10682
+ _ts_param25(0, Body()),
10683
+ _ts_param25(1, Req()),
10496
10684
  _ts_metadata45("design:type", Function),
10497
10685
  _ts_metadata45("design:paramtypes", [
10498
10686
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
@@ -10503,7 +10691,7 @@ _ts_decorate46([
10503
10691
  _ts_decorate46([
10504
10692
  UseGuards(JwtPlatformGuard),
10505
10693
  Get("me"),
10506
- _ts_param24(0, CurrentUser()),
10694
+ _ts_param25(0, CurrentUser()),
10507
10695
  _ts_metadata45("design:type", Function),
10508
10696
  _ts_metadata45("design:paramtypes", [
10509
10697
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
@@ -10516,7 +10704,7 @@ _ts_decorate46([
10516
10704
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
10517
10705
  HttpCode(HttpStatus.NO_CONTENT),
10518
10706
  Post("logout"),
10519
- _ts_param24(0, Req()),
10707
+ _ts_param25(0, Req()),
10520
10708
  _ts_metadata45("design:type", Function),
10521
10709
  _ts_metadata45("design:paramtypes", [
10522
10710
  typeof Request === "undefined" ? Object : Request
@@ -10529,7 +10717,7 @@ _ts_decorate46([
10529
10717
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
10530
10718
  HttpCode(HttpStatus.OK),
10531
10719
  Post("refresh"),
10532
- _ts_param24(0, Req()),
10720
+ _ts_param25(0, Req()),
10533
10721
  _ts_metadata45("design:type", Function),
10534
10722
  _ts_metadata45("design:paramtypes", [
10535
10723
  typeof Request === "undefined" ? Object : Request
@@ -10542,7 +10730,7 @@ _ts_decorate46([
10542
10730
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
10543
10731
  HttpCode(HttpStatus.NO_CONTENT),
10544
10732
  Delete("sessions"),
10545
- _ts_param24(0, CurrentUser()),
10733
+ _ts_param25(0, CurrentUser()),
10546
10734
  _ts_metadata45("design:type", Function),
10547
10735
  _ts_metadata45("design:paramtypes", [
10548
10736
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
@@ -10554,6 +10742,9 @@ PlatformAuthController = _ts_decorate46([
10554
10742
  Controller("platform"),
10555
10743
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
10556
10744
  UsePipes(createAuthValidationPipe()),
10745
+ _ts_param25(0, Inject(PlatformAuthService)),
10746
+ _ts_param25(1, Inject(MfaService)),
10747
+ _ts_param25(2, Inject(TokenDeliveryService)),
10557
10748
  _ts_metadata45("design:type", Function),
10558
10749
  _ts_metadata45("design:paramtypes", [
10559
10750
  typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
@@ -10572,12 +10763,12 @@ function _ts_metadata46(k, v) {
10572
10763
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10573
10764
  }
10574
10765
  __name(_ts_metadata46, "_ts_metadata");
10575
- function _ts_param25(paramIndex, decorator) {
10766
+ function _ts_param26(paramIndex, decorator) {
10576
10767
  return function(target, key) {
10577
10768
  decorator(target, key, paramIndex);
10578
10769
  };
10579
10770
  }
10580
- __name(_ts_param25, "_ts_param");
10771
+ __name(_ts_param26, "_ts_param");
10581
10772
  var PlatformMfaController = class {
10582
10773
  static {
10583
10774
  __name(this, "PlatformMfaController");
@@ -10661,8 +10852,8 @@ _ts_decorate47([
10661
10852
  Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
10662
10853
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
10663
10854
  Post("setup"),
10664
- _ts_param25(0, CurrentUser()),
10665
- _ts_param25(1, Body()),
10855
+ _ts_param26(0, CurrentUser()),
10856
+ _ts_param26(1, Body()),
10666
10857
  _ts_metadata46("design:type", Function),
10667
10858
  _ts_metadata46("design:paramtypes", [
10668
10859
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10676,9 +10867,9 @@ _ts_decorate47([
10676
10867
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
10677
10868
  HttpCode(HttpStatus.NO_CONTENT),
10678
10869
  Post("verify-enable"),
10679
- _ts_param25(0, CurrentUser()),
10680
- _ts_param25(1, Body()),
10681
- _ts_param25(2, Req()),
10870
+ _ts_param26(0, CurrentUser()),
10871
+ _ts_param26(1, Body()),
10872
+ _ts_param26(2, Req()),
10682
10873
  _ts_metadata46("design:type", Function),
10683
10874
  _ts_metadata46("design:paramtypes", [
10684
10875
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10693,9 +10884,9 @@ _ts_decorate47([
10693
10884
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
10694
10885
  HttpCode(HttpStatus.NO_CONTENT),
10695
10886
  Post("disable"),
10696
- _ts_param25(0, CurrentUser()),
10697
- _ts_param25(1, Body()),
10698
- _ts_param25(2, Req()),
10887
+ _ts_param26(0, CurrentUser()),
10888
+ _ts_param26(1, Body()),
10889
+ _ts_param26(2, Req()),
10699
10890
  _ts_metadata46("design:type", Function),
10700
10891
  _ts_metadata46("design:paramtypes", [
10701
10892
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10710,9 +10901,9 @@ _ts_decorate47([
10710
10901
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
10711
10902
  HttpCode(HttpStatus.OK),
10712
10903
  Post("recovery-codes"),
10713
- _ts_param25(0, CurrentUser()),
10714
- _ts_param25(1, Body()),
10715
- _ts_param25(2, Req()),
10904
+ _ts_param26(0, CurrentUser()),
10905
+ _ts_param26(1, Body()),
10906
+ _ts_param26(2, Req()),
10716
10907
  _ts_metadata46("design:type", Function),
10717
10908
  _ts_metadata46("design:paramtypes", [
10718
10909
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10728,6 +10919,7 @@ PlatformMfaController = _ts_decorate47([
10728
10919
  UsePipes(createAuthValidationPipe({
10729
10920
  forbidUnknownValues: true
10730
10921
  })),
10922
+ _ts_param26(0, Inject(MfaService)),
10731
10923
  _ts_metadata46("design:type", Function),
10732
10924
  _ts_metadata46("design:paramtypes", [
10733
10925
  typeof MfaService === "undefined" ? Object : MfaService
@@ -10744,12 +10936,12 @@ function _ts_metadata47(k, v) {
10744
10936
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10745
10937
  }
10746
10938
  __name(_ts_metadata47, "_ts_metadata");
10747
- function _ts_param26(paramIndex, decorator) {
10939
+ function _ts_param27(paramIndex, decorator) {
10748
10940
  return function(target, key) {
10749
10941
  decorator(target, key, paramIndex);
10750
10942
  };
10751
10943
  }
10752
- __name(_ts_param26, "_ts_param");
10944
+ __name(_ts_param27, "_ts_param");
10753
10945
  var SessionController = class {
10754
10946
  static {
10755
10947
  __name(this, "SessionController");
@@ -10829,8 +11021,8 @@ _ts_decorate48([
10829
11021
  Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
10830
11022
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
10831
11023
  Get(),
10832
- _ts_param26(0, CurrentUser()),
10833
- _ts_param26(1, Req()),
11024
+ _ts_param27(0, CurrentUser()),
11025
+ _ts_param27(1, Req()),
10834
11026
  _ts_metadata47("design:type", Function),
10835
11027
  _ts_metadata47("design:paramtypes", [
10836
11028
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -10843,8 +11035,8 @@ _ts_decorate48([
10843
11035
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
10844
11036
  HttpCode(HttpStatus.NO_CONTENT),
10845
11037
  Delete("all"),
10846
- _ts_param26(0, CurrentUser()),
10847
- _ts_param26(1, Req()),
11038
+ _ts_param27(0, CurrentUser()),
11039
+ _ts_param27(1, Req()),
10848
11040
  _ts_metadata47("design:type", Function),
10849
11041
  _ts_metadata47("design:paramtypes", [
10850
11042
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -10857,8 +11049,8 @@ _ts_decorate48([
10857
11049
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
10858
11050
  HttpCode(HttpStatus.NO_CONTENT),
10859
11051
  Delete(":id"),
10860
- _ts_param26(0, CurrentUser()),
10861
- _ts_param26(1, Param("id")),
11052
+ _ts_param27(0, CurrentUser()),
11053
+ _ts_param27(1, Param("id")),
10862
11054
  _ts_metadata47("design:type", Function),
10863
11055
  _ts_metadata47("design:paramtypes", [
10864
11056
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -10871,6 +11063,8 @@ SessionController = _ts_decorate48([
10871
11063
  Controller("sessions"),
10872
11064
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard, JwtAuthGuard, UserStatusGuard),
10873
11065
  UsePipes(createAuthValidationPipe()),
11066
+ _ts_param27(0, Inject(SessionService)),
11067
+ _ts_param27(1, Inject(TokenDeliveryService)),
10874
11068
  _ts_metadata47("design:type", Function),
10875
11069
  _ts_metadata47("design:paramtypes", [
10876
11070
  typeof SessionService === "undefined" ? Object : SessionService,
@@ -10888,6 +11082,12 @@ function _ts_metadata48(k, v) {
10888
11082
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10889
11083
  }
10890
11084
  __name(_ts_metadata48, "_ts_metadata");
11085
+ function _ts_param28(paramIndex, decorator) {
11086
+ return function(target, key) {
11087
+ decorator(target, key, paramIndex);
11088
+ };
11089
+ }
11090
+ __name(_ts_param28, "_ts_param");
10891
11091
  var MfaRequiredGuard = class {
10892
11092
  static {
10893
11093
  __name(this, "MfaRequiredGuard");
@@ -10916,6 +11116,7 @@ var MfaRequiredGuard = class {
10916
11116
  };
10917
11117
  MfaRequiredGuard = _ts_decorate49([
10918
11118
  Injectable(),
11119
+ _ts_param28(0, Inject(Reflector)),
10919
11120
  _ts_metadata48("design:type", Function),
10920
11121
  _ts_metadata48("design:paramtypes", [
10921
11122
  typeof Reflector === "undefined" ? Object : Reflector
@@ -10936,12 +11137,12 @@ function _ts_metadata49(k, v) {
10936
11137
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10937
11138
  }
10938
11139
  __name(_ts_metadata49, "_ts_metadata");
10939
- function _ts_param27(paramIndex, decorator) {
11140
+ function _ts_param29(paramIndex, decorator) {
10940
11141
  return function(target, key) {
10941
11142
  decorator(target, key, paramIndex);
10942
11143
  };
10943
11144
  }
10944
- __name(_ts_param27, "_ts_param");
11145
+ __name(_ts_param29, "_ts_param");
10945
11146
  var PlatformRolesGuard = class {
10946
11147
  static {
10947
11148
  __name(this, "PlatformRolesGuard");
@@ -10977,7 +11178,8 @@ var PlatformRolesGuard = class {
10977
11178
  };
10978
11179
  PlatformRolesGuard = _ts_decorate50([
10979
11180
  Injectable(),
10980
- _ts_param27(1, Inject(BYMAX_AUTH_OPTIONS)),
11181
+ _ts_param29(0, Inject(Reflector)),
11182
+ _ts_param29(1, Inject(BYMAX_AUTH_OPTIONS)),
10981
11183
  _ts_metadata49("design:type", Function),
10982
11184
  _ts_metadata49("design:paramtypes", [
10983
11185
  typeof Reflector === "undefined" ? Object : Reflector,
@@ -10999,12 +11201,12 @@ function _ts_metadata50(k, v) {
10999
11201
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11000
11202
  }
11001
11203
  __name(_ts_metadata50, "_ts_metadata");
11002
- function _ts_param28(paramIndex, decorator) {
11204
+ function _ts_param30(paramIndex, decorator) {
11003
11205
  return function(target, key) {
11004
11206
  decorator(target, key, paramIndex);
11005
11207
  };
11006
11208
  }
11007
- __name(_ts_param28, "_ts_param");
11209
+ __name(_ts_param30, "_ts_param");
11008
11210
  var RolesGuard = class {
11009
11211
  static {
11010
11212
  __name(this, "RolesGuard");
@@ -11036,7 +11238,8 @@ var RolesGuard = class {
11036
11238
  };
11037
11239
  RolesGuard = _ts_decorate51([
11038
11240
  Injectable(),
11039
- _ts_param28(1, Inject(BYMAX_AUTH_OPTIONS)),
11241
+ _ts_param30(0, Inject(Reflector)),
11242
+ _ts_param30(1, Inject(BYMAX_AUTH_OPTIONS)),
11040
11243
  _ts_metadata50("design:type", Function),
11041
11244
  _ts_metadata50("design:paramtypes", [
11042
11245
  typeof Reflector === "undefined" ? Object : Reflector,
@@ -11116,12 +11319,12 @@ function _ts_metadata51(k, v) {
11116
11319
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11117
11320
  }
11118
11321
  __name(_ts_metadata51, "_ts_metadata");
11119
- function _ts_param29(paramIndex, decorator) {
11322
+ function _ts_param31(paramIndex, decorator) {
11120
11323
  return function(target, key) {
11121
11324
  decorator(target, key, paramIndex);
11122
11325
  };
11123
11326
  }
11124
- __name(_ts_param29, "_ts_param");
11327
+ __name(_ts_param31, "_ts_param");
11125
11328
  var OAUTH_STATE_TTL_SECONDS = 600;
11126
11329
  function isStoredOAuthState(value) {
11127
11330
  if (typeof value !== "object" || value === null) return false;
@@ -11375,11 +11578,14 @@ var OAuthService = class _OAuthService {
11375
11578
  };
11376
11579
  OAuthService = _ts_decorate53([
11377
11580
  Injectable(),
11378
- _ts_param29(0, Inject(OAUTH_PLUGINS)),
11379
- _ts_param29(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
11380
- _ts_param29(2, Inject(BYMAX_AUTH_HOOKS)),
11381
- _ts_param29(2, Optional()),
11382
- _ts_param29(6, Inject(BYMAX_AUTH_OPTIONS)),
11581
+ _ts_param31(0, Inject(OAUTH_PLUGINS)),
11582
+ _ts_param31(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
11583
+ _ts_param31(2, Inject(BYMAX_AUTH_HOOKS)),
11584
+ _ts_param31(2, Optional()),
11585
+ _ts_param31(3, Inject(AuthRedisService)),
11586
+ _ts_param31(4, Inject(TokenManagerService)),
11587
+ _ts_param31(5, Inject(SessionService)),
11588
+ _ts_param31(6, Inject(BYMAX_AUTH_OPTIONS)),
11383
11589
  _ts_metadata51("design:type", Function),
11384
11590
  _ts_metadata51("design:paramtypes", [
11385
11591
  Array,
@@ -11591,12 +11797,12 @@ function _ts_metadata54(k, v) {
11591
11797
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11592
11798
  }
11593
11799
  __name(_ts_metadata54, "_ts_metadata");
11594
- function _ts_param30(paramIndex, decorator) {
11800
+ function _ts_param32(paramIndex, decorator) {
11595
11801
  return function(target, key) {
11596
11802
  decorator(target, key, paramIndex);
11597
11803
  };
11598
11804
  }
11599
- __name(_ts_param30, "_ts_param");
11805
+ __name(_ts_param32, "_ts_param");
11600
11806
  function isOAuthMfaChallenge(result) {
11601
11807
  return "mfaRequired" in result && result.mfaRequired === true;
11602
11808
  }
@@ -11818,10 +12024,10 @@ _ts_decorate56([
11818
12024
  Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
11819
12025
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
11820
12026
  Get(":provider"),
11821
- _ts_param30(0, Param("provider")),
11822
- _ts_param30(1, Query()),
11823
- _ts_param30(2, Req()),
11824
- _ts_param30(3, Res({
12027
+ _ts_param32(0, Param("provider")),
12028
+ _ts_param32(1, Query()),
12029
+ _ts_param32(2, Req()),
12030
+ _ts_param32(3, Res({
11825
12031
  passthrough: true
11826
12032
  })),
11827
12033
  _ts_metadata54("design:type", Function),
@@ -11838,10 +12044,10 @@ _ts_decorate56([
11838
12044
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
11839
12045
  HttpCode(HttpStatus.OK),
11840
12046
  Get(":provider/callback"),
11841
- _ts_param30(0, Param("provider")),
11842
- _ts_param30(1, Query()),
11843
- _ts_param30(2, Req()),
11844
- _ts_param30(3, Res({
12047
+ _ts_param32(0, Param("provider")),
12048
+ _ts_param32(1, Query()),
12049
+ _ts_param32(2, Req()),
12050
+ _ts_param32(3, Res({
11845
12051
  passthrough: true
11846
12052
  })),
11847
12053
  _ts_metadata54("design:type", Function),
@@ -11862,7 +12068,9 @@ OAuthController = _ts_decorate56([
11862
12068
  UsePipes(createAuthValidationPipe({
11863
12069
  forbidUnknownValues: true
11864
12070
  })),
11865
- _ts_param30(2, Inject(BYMAX_AUTH_OPTIONS)),
12071
+ _ts_param32(0, Inject(OAuthService)),
12072
+ _ts_param32(1, Inject(TokenDeliveryService)),
12073
+ _ts_param32(2, Inject(BYMAX_AUTH_OPTIONS)),
11866
12074
  _ts_metadata54("design:type", Function),
11867
12075
  _ts_metadata54("design:paramtypes", [
11868
12076
  typeof OAuthService === "undefined" ? Object : OAuthService,
@@ -12093,12 +12301,12 @@ function _ts_metadata55(k, v) {
12093
12301
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12094
12302
  }
12095
12303
  __name(_ts_metadata55, "_ts_metadata");
12096
- function _ts_param31(paramIndex, decorator) {
12304
+ function _ts_param33(paramIndex, decorator) {
12097
12305
  return function(target, key) {
12098
12306
  decorator(target, key, paramIndex);
12099
12307
  };
12100
12308
  }
12101
- __name(_ts_param31, "_ts_param");
12309
+ __name(_ts_param33, "_ts_param");
12102
12310
  var COMMON_BASE_WORDS = [
12103
12311
  // The perennial top of every published list.
12104
12312
  "password",
@@ -12347,7 +12555,7 @@ var LEET_MAP = /* @__PURE__ */ new Map([
12347
12555
  ]
12348
12556
  ]);
12349
12557
  function isDecoration(char) {
12350
- return /[\d\W_]/.test(char);
12558
+ return !new RegExp("\\p{L}", "u").test(char);
12351
12559
  }
12352
12560
  __name(isDecoration, "isDecoration");
12353
12561
  function stripTrailingDecoration(value) {
@@ -12361,7 +12569,7 @@ function reduceToBaseWord(password) {
12361
12569
  let reduced = "";
12362
12570
  for (const char of undecorated) {
12363
12571
  const mapped = LEET_MAP.get(char) ?? char;
12364
- if (/[a-z0-9]/.test(mapped)) reduced += mapped;
12572
+ if (/[\p{L}\p{N}]/u.test(mapped)) reduced += mapped;
12365
12573
  }
12366
12574
  return reduced;
12367
12575
  }
@@ -12395,7 +12603,9 @@ var CommonPasswordChecker = class {
12395
12603
  /** @inheritdoc */
12396
12604
  async isBreached(password) {
12397
12605
  const base = reduceToBaseWord(password);
12398
- if (base.length < 4) return true;
12606
+ if ([
12607
+ ...base
12608
+ ].length < 4) return true;
12399
12609
  if (this.blocked.has(base)) return true;
12400
12610
  if (isSequential(base)) return true;
12401
12611
  if (/^(.{1,4}?)\1{2,}$/.test(base)) return true;
@@ -12404,8 +12614,8 @@ var CommonPasswordChecker = class {
12404
12614
  };
12405
12615
  CommonPasswordChecker = _ts_decorate58([
12406
12616
  Injectable(),
12407
- _ts_param31(0, Inject(BYMAX_AUTH_OPTIONS)),
12408
- _ts_param31(0, Optional()),
12617
+ _ts_param33(0, Inject(BYMAX_AUTH_OPTIONS)),
12618
+ _ts_param33(0, Optional()),
12409
12619
  _ts_metadata55("design:type", Function),
12410
12620
  _ts_metadata55("design:paramtypes", [
12411
12621
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -12865,12 +13075,12 @@ function _ts_metadata57(k, v) {
12865
13075
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12866
13076
  }
12867
13077
  __name(_ts_metadata57, "_ts_metadata");
12868
- function _ts_param32(paramIndex, decorator) {
13078
+ function _ts_param34(paramIndex, decorator) {
12869
13079
  return function(target, key) {
12870
13080
  decorator(target, key, paramIndex);
12871
13081
  };
12872
13082
  }
12873
- __name(_ts_param32, "_ts_param");
13083
+ __name(_ts_param34, "_ts_param");
12874
13084
  var SelfOrAdminGuard = class {
12875
13085
  static {
12876
13086
  __name(this, "SelfOrAdminGuard");
@@ -12902,7 +13112,7 @@ var SelfOrAdminGuard = class {
12902
13112
  };
12903
13113
  SelfOrAdminGuard = _ts_decorate63([
12904
13114
  Injectable(),
12905
- _ts_param32(0, Inject(BYMAX_AUTH_OPTIONS)),
13115
+ _ts_param34(0, Inject(BYMAX_AUTH_OPTIONS)),
12906
13116
  _ts_metadata57("design:type", Function),
12907
13117
  _ts_metadata57("design:paramtypes", [
12908
13118
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -12928,12 +13138,12 @@ function _ts_metadata58(k, v) {
12928
13138
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12929
13139
  }
12930
13140
  __name(_ts_metadata58, "_ts_metadata");
12931
- function _ts_param33(paramIndex, decorator) {
13141
+ function _ts_param35(paramIndex, decorator) {
12932
13142
  return function(target, key) {
12933
13143
  decorator(target, key, paramIndex);
12934
13144
  };
12935
13145
  }
12936
- __name(_ts_param33, "_ts_param");
13146
+ __name(_ts_param35, "_ts_param");
12937
13147
  var WsJwtGuard = class {
12938
13148
  static {
12939
13149
  __name(this, "WsJwtGuard");
@@ -12998,7 +13208,10 @@ var WsJwtGuard = class {
12998
13208
  };
12999
13209
  WsJwtGuard = _ts_decorate64([
13000
13210
  Injectable(),
13001
- _ts_param33(3, Inject(BYMAX_AUTH_OPTIONS)),
13211
+ _ts_param35(0, Inject(JwtService)),
13212
+ _ts_param35(1, Inject(AuthRedisService)),
13213
+ _ts_param35(2, Inject(WsTicketService)),
13214
+ _ts_param35(3, Inject(BYMAX_AUTH_OPTIONS)),
13002
13215
  _ts_metadata58("design:type", Function),
13003
13216
  _ts_metadata58("design:paramtypes", [
13004
13217
  typeof JwtService === "undefined" ? Object : JwtService,