@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.
@@ -377,6 +377,9 @@ function resolveOptions(userOptions) {
377
377
  rateLimit: {
378
378
  ...DEFAULT_OPTIONS.rateLimit,
379
379
  ...userOptions.rateLimit,
380
+ // Stryker disable next-line OptionalChaining: unreachable — `validateClientIpSource` has
381
+ // already run, and it only returns without throwing when `rateLimit` is an object (either
382
+ // naming a source or disabling limiting), so `rateLimit` is never undefined here
380
383
  clientIpSource: userOptions.rateLimit?.clientIpSource ?? "peer"
381
384
  },
382
385
  secureCookies: userOptions.secureCookies ?? process.env["NODE_ENV"] === "production",
@@ -409,6 +412,10 @@ function withholdSecrets(resolved) {
409
412
  withholdFromSerialization(resolved.jwt, "previousSecrets");
410
413
  withholdFromSerialization(resolved, "hmacKey");
411
414
  withholdFromSerialization(resolved, "previousHmacKeys");
415
+ if (resolved.mfa !== void 0) {
416
+ withholdFromSerialization(resolved.mfa, "encryptionKey");
417
+ withholdFromSerialization(resolved.mfa, "previousEncryptionKeys");
418
+ }
412
419
  if (resolved.oauth === void 0) return;
413
420
  const oauth = Object.fromEntries(Object.entries(resolved.oauth).map(([provider, config]) => {
414
421
  if (typeof config !== "object" || config === null) return [
@@ -1619,6 +1626,18 @@ if ARGV[3] ~= '' then
1619
1626
  end
1620
1627
  return 1
1621
1628
  `;
1629
+ var CREATE_SESSION_LUA = `
1630
+ redis.call('SET', KEYS[1], ARGV[1], 'EX', ARGV[2])
1631
+ redis.call('SADD', KEYS[2], ARGV[4] .. ':' .. ARGV[5])
1632
+ redis.call('EXPIRE', KEYS[2], ARGV[2])
1633
+ -- The family index holds bare hashes: it only ever tracks live sessions, so the prefix is
1634
+ -- implied. A session with no lineage skips it rather than writing an unkeyed member.
1635
+ if ARGV[3] ~= '' then
1636
+ redis.call('SADD', KEYS[3], ARGV[5])
1637
+ redis.call('EXPIRE', KEYS[3], ARGV[2])
1638
+ end
1639
+ return 1
1640
+ `;
1622
1641
  var ROTATE_LUA = `
1623
1642
  local old = redis.call('GET', KEYS[1])
1624
1643
  if old then
@@ -1953,6 +1972,30 @@ var AuthRedisService = class {
1953
1972
  };
1954
1973
  }
1955
1974
  /**
1975
+ * Writes a freshly-issued refresh session atomically — record, session-index member and
1976
+ * family membership, each carrying the refresh TTL.
1977
+ *
1978
+ * See {@link CREATE_SESSION_LUA} for the two windows the loose form left open.
1979
+ *
1980
+ * @param params - The session to store and the keys it belongs under.
1981
+ */
1982
+ async writeNewSession(params) {
1983
+ const p = prefixesFor(params.kind);
1984
+ await this.eval(CREATE_SESSION_LUA, [
1985
+ `${p.live}:${params.tokenHash}`,
1986
+ `${p.index}:${params.userId}`,
1987
+ // Always passed, even with no family: a Lua script's key list is fixed at the call
1988
+ // site, and the script skips the key rather than the caller skipping the argument.
1989
+ `${p.family}:${params.familyId}`
1990
+ ], [
1991
+ params.sessionJson,
1992
+ String(params.refreshTtl),
1993
+ params.familyId,
1994
+ p.live,
1995
+ params.tokenHash
1996
+ ]);
1997
+ }
1998
+ /**
1956
1999
  * Writes the session a grace recovery produced, atomically with the check that the account
1957
2000
  * has not been swept out from under it.
1958
2001
  *
@@ -2109,6 +2152,58 @@ var AuthRedisService = class {
2109
2152
  return result === "OK";
2110
2153
  }
2111
2154
  /**
2155
+ * Drops the grace-pointer members whose keys have already expired.
2156
+ *
2157
+ * A rotation removes `rt:{old}` from the index and adds two members: `rt:{new}` and
2158
+ * `rp:{old}`. The `rp:` KEY dies with the grace window — 30 seconds by default — but the
2159
+ * MEMBER was only ever removed by a full revoke-all, so the index gained one permanent
2160
+ * ~68-byte entry per rotation, and the rotation re-arms the set's own TTL each time. The set
2161
+ * never aged out while the account was in use.
2162
+ *
2163
+ * That is not merely untidy. Every reader of the index is linear in its size:
2164
+ * `listSessions` ships the whole set over the wire, `revokeAllExceptCurrent` issues two
2165
+ * sequential round trips per grace member, and `invalidateUserSessions` iterates it inside a
2166
+ * Lua script, which blocks the whole single-threaded store. An attacker holding one stolen
2167
+ * refresh token and rotating at the route limit adds ~14k members a day to their own index,
2168
+ * with no ceiling; a merely active user accrues thousands a year.
2169
+ *
2170
+ * Called from the two paths that already walk the index — a login enforcing the session cap
2171
+ * and a session listing — so the growth is bounded by how long an account can go between
2172
+ * them, and any legitimate interaction heals it. The rotation path deliberately does NOT
2173
+ * call this: it is the hot path, and an O(n) sweep there would trade a slow leak for a slow
2174
+ * refresh.
2175
+ *
2176
+ * Grace members whose key is still live are left alone. They are what lets a revoke-all also
2177
+ * kill a token that was rotated away moments earlier but can still be recovered.
2178
+ *
2179
+ * @param setKey - The un-namespaced index key (`sess:{id}` or `psess:{id}`).
2180
+ * @param gracePrefix - Member prefix for rotation grace pointers (`rp:` or `prp:`).
2181
+ * @returns How many dead members were dropped.
2182
+ */
2183
+ async pruneExpiredGraceMembers(setKey, gracePrefix) {
2184
+ const removed = await this.eval(`local members = redis.call('SMEMBERS', KEYS[1])
2185
+ local ns, grace = ARGV[1], ARGV[2]
2186
+ local removed = 0
2187
+ for _, member in ipairs(members) do
2188
+ if string.sub(member, 1, string.len(grace)) == grace then
2189
+ -- The member IS the key suffix, so its own liveness is one EXISTS away. A pointer
2190
+ -- still inside its window is left in place; only the expired ones go.
2191
+ if redis.call('EXISTS', ns .. ':' .. member) == 0 then
2192
+ redis.call('SREM', KEYS[1], member)
2193
+ removed = removed + 1
2194
+ end
2195
+ end
2196
+ end
2197
+ return removed`, [
2198
+ setKey
2199
+ ], [
2200
+ this.namespace,
2201
+ gracePrefix
2202
+ ]);
2203
+ if (typeof removed === "number") return removed;
2204
+ return typeof removed === "string" ? Number(removed) : 0;
2205
+ }
2206
+ /**
2112
2207
  * Atomically deletes every refresh session belonging to one identity plane.
2113
2208
  *
2114
2209
  * The set members are full key suffixes — `rt:{hash}`/`rp:{hash}` on the dashboard plane,
@@ -2417,7 +2512,9 @@ exports.AuthRateLimitGuard = class AuthRateLimitGuard {
2417
2512
  };
2418
2513
  exports.AuthRateLimitGuard = _ts_decorate6([
2419
2514
  common.Injectable(),
2515
+ _ts_param2(0, common.Inject(core.Reflector)),
2420
2516
  _ts_param2(1, common.Inject(BYMAX_AUTH_OPTIONS)),
2517
+ _ts_param2(2, common.Inject(AuthRedisService)),
2421
2518
  _ts_metadata6("design:type", Function),
2422
2519
  _ts_metadata6("design:paramtypes", [
2423
2520
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
@@ -2951,6 +3048,10 @@ exports.JwtAuthGuard = class JwtAuthGuard {
2951
3048
  };
2952
3049
  exports.JwtAuthGuard = _ts_decorate8([
2953
3050
  common.Injectable(),
3051
+ _ts_param4(0, common.Inject(jwt.JwtService)),
3052
+ _ts_param4(1, common.Inject(exports.TokenDeliveryService)),
3053
+ _ts_param4(2, common.Inject(AuthRedisService)),
3054
+ _ts_param4(3, common.Inject(core.Reflector)),
2954
3055
  _ts_param4(4, common.Inject(BYMAX_AUTH_OPTIONS)),
2955
3056
  _ts_metadata8("design:type", Function),
2956
3057
  _ts_metadata8("design:paramtypes", [
@@ -3075,6 +3176,7 @@ exports.UserStatusGuard = class UserStatusGuard {
3075
3176
  };
3076
3177
  exports.UserStatusGuard = _ts_decorate10([
3077
3178
  common.Injectable(),
3179
+ _ts_param6(0, common.Inject(AuthRedisService)),
3078
3180
  _ts_param6(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
3079
3181
  _ts_param6(2, common.Inject(BYMAX_AUTH_OPTIONS)),
3080
3182
  _ts_metadata10("design:type", Function),
@@ -3242,6 +3344,7 @@ exports.BruteForceService = class _BruteForceService {
3242
3344
  };
3243
3345
  exports.BruteForceService = _ts_decorate12([
3244
3346
  common.Injectable(),
3347
+ _ts_param7(0, common.Inject(AuthRedisService)),
3245
3348
  _ts_param7(1, common.Inject(BYMAX_AUTH_OPTIONS)),
3246
3349
  _ts_metadata11("design:type", Function),
3247
3350
  _ts_metadata11("design:paramtypes", [
@@ -3260,6 +3363,12 @@ function _ts_metadata12(k, v) {
3260
3363
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3261
3364
  }
3262
3365
  __name(_ts_metadata12, "_ts_metadata");
3366
+ function _ts_param8(paramIndex, decorator) {
3367
+ return function(target, key) {
3368
+ decorator(target, key, paramIndex);
3369
+ };
3370
+ }
3371
+ __name(_ts_param8, "_ts_param");
3263
3372
  var MAX_ATTEMPTS = 5;
3264
3373
  var MIN_VERIFY_MS = 100;
3265
3374
  var OTP_STORE_LUA = `
@@ -3387,6 +3496,7 @@ exports.OtpService = class OtpService {
3387
3496
  };
3388
3497
  exports.OtpService = _ts_decorate13([
3389
3498
  common.Injectable(),
3499
+ _ts_param8(0, common.Inject(AuthRedisService)),
3390
3500
  _ts_metadata12("design:type", Function),
3391
3501
  _ts_metadata12("design:paramtypes", [
3392
3502
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService
@@ -3403,41 +3513,80 @@ function _ts_metadata13(k, v) {
3403
3513
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3404
3514
  }
3405
3515
  __name(_ts_metadata13, "_ts_metadata");
3406
- function _ts_param8(paramIndex, decorator) {
3516
+ function _ts_param9(paramIndex, decorator) {
3407
3517
  return function(target, key) {
3408
3518
  decorator(target, key, paramIndex);
3409
3519
  };
3410
3520
  }
3411
- __name(_ts_param8, "_ts_param");
3521
+ __name(_ts_param9, "_ts_param");
3412
3522
  var scrypt = util.promisify(crypto.scrypt);
3413
3523
  var SCRYPT_KEY_LEN = 64;
3414
3524
  var SALT_BYTES = 16;
3415
3525
  var DUMMY_SALT = Buffer.from("d6732149f98b3938274691d8c2f3ee63", "hex");
3416
3526
  var DUMMY_EXPECTED = Buffer.alloc(SCRYPT_KEY_LEN, 90);
3417
- function parseStoredHash(hash) {
3418
- const parts = hash.split(":");
3419
- if (parts.length !== 6 || parts[0] !== "scrypt") return null;
3420
- const [, nRaw, rRaw, pRaw, saltHex, derivedHex] = parts;
3421
- if (saltHex === void 0 || derivedHex === void 0 || saltHex === "" || derivedHex === "") {
3422
- return null;
3423
- }
3424
- const derived = Buffer.from(derivedHex, "hex");
3425
- if (derived.length !== SCRYPT_KEY_LEN) return null;
3426
- const [N, r, p] = [
3427
- Number(nRaw),
3428
- Number(rRaw),
3429
- Number(pRaw)
3527
+ var MAX_SCRYPT_PARAMETER = 255;
3528
+ var MIN_KEY_LEN = 10;
3529
+ var MAX_KEY_LEN = 64;
3530
+ function toPhcB64(value) {
3531
+ return value.toString("base64").replace(/=+$/, "");
3532
+ }
3533
+ __name(toPhcB64, "toPhcB64");
3534
+ function fromPhcB64(value) {
3535
+ if (value === "") return null;
3536
+ const decoded = Buffer.from(value, "base64");
3537
+ return toPhcB64(decoded) === value ? decoded : null;
3538
+ }
3539
+ __name(fromPhcB64, "fromPhcB64");
3540
+ function parsePhcParams(text) {
3541
+ const found = /* @__PURE__ */ new Map();
3542
+ for (const pair of text.split(",")) {
3543
+ const eq = pair.indexOf("=");
3544
+ if (eq <= 0) return null;
3545
+ const key = pair.slice(0, eq);
3546
+ const raw = pair.slice(eq + 1);
3547
+ if (found.has(key)) return null;
3548
+ if (!/^(0|[1-9][0-9]*)$/.test(raw)) return null;
3549
+ found.set(key, Number(raw));
3550
+ }
3551
+ const [ln, r, p] = [
3552
+ found.get("ln"),
3553
+ found.get("r"),
3554
+ found.get("p")
3430
3555
  ];
3431
- if (!(Number.isInteger(N) && Number.isInteger(r) && Number.isInteger(p))) return null;
3432
- if (N <= 0 || r <= 0 || p <= 0) return null;
3556
+ if (ln === void 0 || r === void 0 || p === void 0) return null;
3557
+ if (ln < 1 || ln > 31) return null;
3558
+ if (r < 1 || r > MAX_SCRYPT_PARAMETER || p < 1 || p > MAX_SCRYPT_PARAMETER) return null;
3559
+ if (128 * 2 ** ln * r > MAX_KDF_BYTES_PER_DERIVATION) return null;
3433
3560
  return {
3434
- N,
3561
+ ln,
3435
3562
  r,
3436
- p,
3437
- salt: Buffer.from(saltHex, "hex"),
3563
+ p
3564
+ };
3565
+ }
3566
+ __name(parsePhcParams, "parsePhcParams");
3567
+ function parsePhcHash(hash) {
3568
+ const [leading, algorithm, paramText, saltText, hashText, extra] = hash.split("$");
3569
+ if (extra !== void 0) return null;
3570
+ if (leading !== "" || algorithm !== "scrypt") return null;
3571
+ if (paramText === void 0 || saltText === void 0 || hashText === void 0) return null;
3572
+ const params = parsePhcParams(paramText);
3573
+ if (params === null) return null;
3574
+ const salt = fromPhcB64(saltText);
3575
+ const derived = fromPhcB64(hashText);
3576
+ if (salt === null || derived === null) return null;
3577
+ if (derived.length < MIN_KEY_LEN || derived.length > MAX_KEY_LEN) return null;
3578
+ return {
3579
+ N: 2 ** params.ln,
3580
+ r: params.r,
3581
+ p: params.p,
3582
+ salt,
3438
3583
  derived
3439
3584
  };
3440
3585
  }
3586
+ __name(parsePhcHash, "parsePhcHash");
3587
+ function parseStoredHash(hash) {
3588
+ return parsePhcHash(hash);
3589
+ }
3441
3590
  __name(parseStoredHash, "parseStoredHash");
3442
3591
  var PasswordService = class _PasswordService {
3443
3592
  static {
@@ -3460,12 +3609,12 @@ var PasswordService = class _PasswordService {
3460
3609
  * Hashes a plaintext password using scrypt with a random salt.
3461
3610
  *
3462
3611
  * @param plain - Plaintext password (UTF-8 string).
3463
- * @returns Hashed password in `scrypt:{salt_hex}:{derived_hex}` format.
3612
+ * @returns Hashed password as a PHC string.
3464
3613
  *
3465
3614
  * @example
3466
3615
  * ```typescript
3467
3616
  * const hash = await passwordService.hash('my-password')
3468
- * // 'scrypt:4a3b...:{128 hex chars}'
3617
+ * // '$scrypt$ln=17,r=8,p=1$YmFzZTY0c2FsdA$…'
3469
3618
  * ```
3470
3619
  */
3471
3620
  /**
@@ -3512,7 +3661,8 @@ var PasswordService = class _PasswordService {
3512
3661
  p: this.p,
3513
3662
  maxmem: this.maxmem
3514
3663
  });
3515
- return `scrypt:${this.N}:${this.r}:${this.p}:${salt.toString("hex")}:${derived.toString("hex")}`;
3664
+ const ln = Math.log2(this.N);
3665
+ return `$scrypt$ln=${ln},r=${this.r},p=${this.p}$${toPhcB64(salt)}$${toPhcB64(derived)}`;
3516
3666
  }
3517
3667
  /**
3518
3668
  * Whether a stored hash was written under weaker parameters than the ones configured now.
@@ -3533,7 +3683,7 @@ var PasswordService = class _PasswordService {
3533
3683
  * Verifies a plaintext password against a stored scrypt hash.
3534
3684
  *
3535
3685
  * @param plain - Plaintext password supplied by the user.
3536
- * @param hash - Stored hash in `scrypt:{salt_hex}:{derived_hex}` format.
3686
+ * @param hash - Stored hash, as a PHC string.
3537
3687
  * @returns `true` if the password matches, `false` otherwise.
3538
3688
  *
3539
3689
  * @remarks
@@ -3546,11 +3696,18 @@ var PasswordService = class _PasswordService {
3546
3696
  const parsed = parseStoredHash(hash);
3547
3697
  if (parsed === null) return false;
3548
3698
  const { N, r, p } = parsed;
3549
- const candidate = await scrypt(plain, parsed.salt, SCRYPT_KEY_LEN, {
3699
+ const candidate = await scrypt(plain, parsed.salt, parsed.derived.length, {
3550
3700
  N,
3551
3701
  r,
3552
3702
  p,
3553
- // Sized for the parameters actually being used, which may exceed the configured ones.
3703
+ // Sized for the parameters actually being used, which may exceed the configured ones —
3704
+ // but never without bound: `parsePhcParams` has already refused any record whose working
3705
+ // set is above `MAX_KDF_BYTES_PER_DERIVATION`, so this cannot be widened past 2x that
3706
+ // ceiling by what the record claims.
3707
+ // Stryker disable next-line ArithmeticOperator,MethodExpression: `maxmem` is a CEILING, and
3708
+ // only its being too LOW is observable (scrypt throws). Every mutant here lowers it while
3709
+ // leaving it above what any hash these tests verify actually needs, so the derivation and
3710
+ // its result are identical — the same reason the constructor's copy carries a disable
3554
3711
  maxmem: Math.max(N * r * 128 * 2, this.maxmem)
3555
3712
  });
3556
3713
  return crypto.timingSafeEqual(candidate, parsed.derived);
@@ -3585,8 +3742,8 @@ var PasswordService = class _PasswordService {
3585
3742
  };
3586
3743
  PasswordService = _ts_decorate14([
3587
3744
  common.Injectable(),
3588
- _ts_param8(0, common.Inject(BYMAX_AUTH_OPTIONS)),
3589
- _ts_param8(1, common.Inject(BYMAX_AUTH_BREACH_CHECKER)),
3745
+ _ts_param9(0, common.Inject(BYMAX_AUTH_OPTIONS)),
3746
+ _ts_param9(1, common.Inject(BYMAX_AUTH_BREACH_CHECKER)),
3590
3747
  _ts_metadata13("design:type", Function),
3591
3748
  _ts_metadata13("design:paramtypes", [
3592
3749
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -3604,12 +3761,12 @@ function _ts_metadata14(k, v) {
3604
3761
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3605
3762
  }
3606
3763
  __name(_ts_metadata14, "_ts_metadata");
3607
- function _ts_param9(paramIndex, decorator) {
3764
+ function _ts_param10(paramIndex, decorator) {
3608
3765
  return function(target, key) {
3609
3766
  decorator(target, key, paramIndex);
3610
3767
  };
3611
3768
  }
3612
- __name(_ts_param9, "_ts_param");
3769
+ __name(_ts_param10, "_ts_param");
3613
3770
  var MAX_IP_LENGTH = 45;
3614
3771
  var SESSION_HASH_RE = /^[a-f0-9]{64}$/;
3615
3772
  var REVOKE_SESSION_LUA = `
@@ -3754,6 +3911,9 @@ exports.SessionService = class _SessionService {
3754
3911
  * @returns Array of {@link SessionInfo} sorted newest-first.
3755
3912
  */
3756
3913
  async listSessions(userId, currentSessionHash) {
3914
+ void this.redis.pruneExpiredGraceMembers(`sess:${userId}`, "rp:").catch((err) => {
3915
+ this.logger.warn("listSessions: grace-pointer prune failed", err);
3916
+ });
3757
3917
  const members = await this.redis.smembers(`sess:${userId}`);
3758
3918
  const rtMembers = members.filter((m) => m.startsWith("rt:"));
3759
3919
  const results = [];
@@ -4022,6 +4182,7 @@ exports.SessionService = class _SessionService {
4022
4182
  * @param userAgent - User-Agent string (forwarded to the `onSessionEvicted` hook context).
4023
4183
  */
4024
4184
  async enforceSessionLimit(userId, newHash, ip, userAgent) {
4185
+ await this.redis.pruneExpiredGraceMembers(`sess:${userId}`, "rp:");
4025
4186
  const members = await this.redis.smembers(`sess:${userId}`);
4026
4187
  const rtMembers = members.filter((m) => m.startsWith("rt:"));
4027
4188
  const limit = await this.resolveSessionLimit(userId);
@@ -4113,10 +4274,11 @@ exports.SessionService = class _SessionService {
4113
4274
  };
4114
4275
  exports.SessionService = _ts_decorate15([
4115
4276
  common.Injectable(),
4116
- _ts_param9(0, common.Inject(BYMAX_AUTH_OPTIONS)),
4117
- _ts_param9(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
4118
- _ts_param9(2, common.Inject(BYMAX_AUTH_HOOKS)),
4119
- _ts_param9(2, common.Optional()),
4277
+ _ts_param10(0, common.Inject(BYMAX_AUTH_OPTIONS)),
4278
+ _ts_param10(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
4279
+ _ts_param10(2, common.Inject(BYMAX_AUTH_HOOKS)),
4280
+ _ts_param10(2, common.Optional()),
4281
+ _ts_param10(3, common.Inject(AuthRedisService)),
4120
4282
  _ts_metadata14("design:type", Function),
4121
4283
  _ts_metadata14("design:paramtypes", [
4122
4284
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -4133,6 +4295,13 @@ function recentAuthKey(plane, userId, hmacKey) {
4133
4295
  }
4134
4296
  __name(recentAuthKey, "recentAuthKey");
4135
4297
 
4298
+ // src/server/utils/log-safe.ts
4299
+ var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/;
4300
+ function logSafe(value) {
4301
+ return CONTROL_CHARACTERS.test(value) ? "<malformed>" : value;
4302
+ }
4303
+ __name(logSafe, "logSafe");
4304
+
4136
4305
  // src/server/services/token-manager.service.ts
4137
4306
  function _ts_decorate16(decorators, target, key, desc) {
4138
4307
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4145,12 +4314,12 @@ function _ts_metadata15(k, v) {
4145
4314
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4146
4315
  }
4147
4316
  __name(_ts_metadata15, "_ts_metadata");
4148
- function _ts_param10(paramIndex, decorator) {
4317
+ function _ts_param11(paramIndex, decorator) {
4149
4318
  return function(target, key) {
4150
4319
  decorator(target, key, paramIndex);
4151
4320
  };
4152
4321
  }
4153
- __name(_ts_param10, "_ts_param");
4322
+ __name(_ts_param11, "_ts_param");
4154
4323
  var MFA_TEMP_TOKEN_TTL_SECONDS = 300;
4155
4324
  var MAX_SESSION_FIELD_LENGTH = 45;
4156
4325
  var TokenManagerService = class _TokenManagerService {
@@ -4268,15 +4437,17 @@ var TokenManagerService = class _TokenManagerService {
4268
4437
  });
4269
4438
  const rawRefreshToken = generateSecureToken();
4270
4439
  const tokenHash = sha256(rawRefreshToken);
4271
- const sessionKey = `rt:${tokenHash}`;
4272
4440
  const familyId = crypto.randomUUID();
4273
4441
  const session = this.buildSession(user.id, user.tenantId, user.role, ip, userAgent, user.mfaEnabled, familyId);
4274
4442
  const ttl = this.options.jwt.refreshExpiresInDays * 86400;
4275
- await this.redis.set(sessionKey, this.serializeSession(session), ttl);
4276
- await this.redis.sadd(`sess:${user.id}`, `rt:${tokenHash}`);
4277
- await this.redis.expire(`sess:${user.id}`, ttl);
4278
- await this.redis.sadd(`fam:${familyId}`, tokenHash);
4279
- await this.redis.expire(`fam:${familyId}`, ttl);
4443
+ await this.redis.writeNewSession({
4444
+ kind: "dashboard",
4445
+ tokenHash,
4446
+ sessionJson: this.serializeSession(session),
4447
+ familyId,
4448
+ userId: user.id,
4449
+ refreshTtl: ttl
4450
+ });
4280
4451
  await this.redis.set(recentAuthKey("dashboard", user.id, this.options.hmacKey), "1", RECENT_AUTH_TTL_SECONDS);
4281
4452
  return {
4282
4453
  user,
@@ -4311,15 +4482,17 @@ var TokenManagerService = class _TokenManagerService {
4311
4482
  });
4312
4483
  const rawRefreshToken = generateSecureToken();
4313
4484
  const tokenHash = sha256(rawRefreshToken);
4314
- const sessionKey = `prt:${tokenHash}`;
4315
4485
  const familyId = crypto.randomUUID();
4316
4486
  const session = this.buildSession(admin.id, "", admin.role, ip, userAgent, admin.mfaEnabled, familyId);
4317
4487
  const ttl = this.options.jwt.refreshExpiresInDays * 86400;
4318
- await this.redis.set(sessionKey, this.serializeSession(session), ttl);
4319
- await this.redis.sadd(`psess:${admin.id}`, `prt:${tokenHash}`);
4320
- await this.redis.expire(`psess:${admin.id}`, ttl);
4321
- await this.redis.sadd(`pfam:${familyId}`, tokenHash);
4322
- await this.redis.expire(`pfam:${familyId}`, ttl);
4488
+ await this.redis.writeNewSession({
4489
+ kind: "platform",
4490
+ tokenHash,
4491
+ sessionJson: this.serializeSession(session),
4492
+ familyId,
4493
+ userId: admin.id,
4494
+ refreshTtl: ttl
4495
+ });
4323
4496
  await this.writePlatformSessionDetail(tokenHash, ip, userAgent, ttl);
4324
4497
  return {
4325
4498
  admin,
@@ -4410,8 +4583,9 @@ var TokenManagerService = class _TokenManagerService {
4410
4583
  return this.rotateFromGrace(outcome.sessionJson, ip, userAgent, refreshTtl);
4411
4584
  }
4412
4585
  if (outcome.kind === "reused") {
4413
- this.logger.warn("reissueTokens: reuse of a consumed refresh token detected \u2014 revoking the token family");
4586
+ this.logger.warn(`reissueTokens: reuse of a consumed refresh token detected \u2014 revoking the token family familyId=${logSafe(outcome.familyId)}`);
4414
4587
  const { ownerId } = await this.redis.revokeFamily(outcome.familyId);
4588
+ this.logger.warn(`reissueTokens: token family revoked after reuse detection userId=${logSafe(ownerId)} familyId=${logSafe(outcome.familyId)}`);
4415
4589
  this.emitReuseDetected(ownerId, outcome.familyId);
4416
4590
  throw new AuthException(AUTH_ERROR_CODES.REFRESH_TOKEN_INVALID);
4417
4591
  }
@@ -4419,23 +4593,6 @@ var TokenManagerService = class _TokenManagerService {
4419
4593
  throw new AuthException(AUTH_ERROR_CODES.REFRESH_TOKEN_INVALID);
4420
4594
  }
4421
4595
  /**
4422
- * Refuses a rotation once the login it descends from has outlived the absolute cap.
4423
- *
4424
- * `refreshExpiresInDays` bounds a single refresh token, not a session: a client rotating
4425
- * every fifteen minutes renews that lifetime forever, so without this a session established
4426
- * once never has to be established again. The cap measures from the **family's** birth, which
4427
- * is carried unchanged through the lineage.
4428
- *
4429
- * A session with no birth time predates the field and is not capped — it ages out under the
4430
- * refresh lifetime like any other. A cap of `0` disables the check entirely.
4431
- *
4432
- * @param session - The presented session, or the placeholder when the token is not live.
4433
- * @throws {@link AuthException} with `REFRESH_TOKEN_INVALID` once the cap is passed. The
4434
- * caller cannot distinguish this from any other invalid refresh, which is deliberate: the
4435
- * remedy is the same (sign in again) and the difference would only tell a holder of a
4436
- * stolen token how old the account's session is.
4437
- */
4438
- /**
4439
4596
  * Emits {@link IAuthHooks.onRefreshTokenReuseDetected}, fire-and-forget.
4440
4597
  *
4441
4598
  * The owner is read from the stored session where it can be — a replay of a token whose live
@@ -4455,6 +4612,23 @@ var TokenManagerService = class _TokenManagerService {
4455
4612
  this.logger.error("onRefreshTokenReuseDetected hook threw synchronously", err);
4456
4613
  }
4457
4614
  }
4615
+ /**
4616
+ * Refuses a rotation once the login it descends from has outlived the absolute cap.
4617
+ *
4618
+ * `refreshExpiresInDays` bounds a single refresh token, not a session: a client rotating
4619
+ * every fifteen minutes renews that lifetime forever, so without this a session established
4620
+ * once never has to be established again. The cap measures from the **family's** birth, which
4621
+ * is carried unchanged through the lineage.
4622
+ *
4623
+ * A session with no birth time predates the field and is not capped — it ages out under the
4624
+ * refresh lifetime like any other. A cap of `0` disables the check entirely.
4625
+ *
4626
+ * @param session - The presented session, or the placeholder when the token is not live.
4627
+ * @throws {@link AuthException} with `REFRESH_TOKEN_INVALID` once the cap is passed. The
4628
+ * caller cannot distinguish this from any other invalid refresh, which is deliberate: the
4629
+ * remedy is the same (sign in again) and the difference would only tell a holder of a
4630
+ * stolen token how old the account's session is.
4631
+ */
4458
4632
  assertWithinAbsoluteLifetime(session) {
4459
4633
  const capDays = this.options.jwt.absoluteSessionLifetimeDays;
4460
4634
  if (capDays <= 0) return;
@@ -4687,8 +4861,9 @@ var TokenManagerService = class _TokenManagerService {
4687
4861
  return this.rotatePlatformFromGrace(outcome.sessionJson, oldHash, ip, userAgent, refreshTtl);
4688
4862
  }
4689
4863
  if (outcome.kind === "reused") {
4690
- this.logger.warn("reissuePlatformTokens: reuse of a consumed refresh token detected \u2014 revoking the token family");
4864
+ this.logger.warn(`reissuePlatformTokens: reuse of a consumed refresh token detected \u2014 revoking the token family familyId=${logSafe(outcome.familyId)}`);
4691
4865
  const { ownerId } = await this.redis.revokeFamily(outcome.familyId, "platform");
4866
+ this.logger.warn(`reissuePlatformTokens: token family revoked after reuse detection userId=${logSafe(ownerId)} familyId=${logSafe(outcome.familyId)}`);
4692
4867
  this.emitReuseDetected(ownerId, outcome.familyId);
4693
4868
  throw new AuthException(AUTH_ERROR_CODES.REFRESH_TOKEN_INVALID);
4694
4869
  }
@@ -4797,23 +4972,9 @@ var TokenManagerService = class _TokenManagerService {
4797
4972
  });
4798
4973
  }
4799
4974
  // ---------------------------------------------------------------------------
4800
- // Token decoding (no expiry check)
4975
+ // Verification that ignores expiry (logout only)
4801
4976
  // ---------------------------------------------------------------------------
4802
4977
  /**
4803
- * Decodes a JWT without validating its expiration or signature.
4804
- *
4805
- * @internal
4806
- * **WARNING:** This method does NOT verify the token signature or expiry.
4807
- * It must only be used for internal diagnostic purposes (e.g. reading the
4808
- * `sub` claim from an expired token to look up a session for revocation).
4809
- * Never use it to authorize requests — use `JwtService.verify()` in guards.
4810
- *
4811
- * @param token - Raw JWT string.
4812
- * @returns Decoded payload.
4813
- * @throws {@link AuthException} with `TOKEN_INVALID` if the payload is not an
4814
- * object or lacks required `jti` (string) and `sub` (string) claims.
4815
- */
4816
- /**
4817
4978
  * Verifies an access token's signature under the pinned algorithm while **ignoring its
4818
4979
  * expiry**, returning the payload.
4819
4980
  *
@@ -4849,16 +5010,6 @@ var TokenManagerService = class _TokenManagerService {
4849
5010
  ignoreExpiration: true
4850
5011
  });
4851
5012
  }
4852
- decodeToken(token) {
4853
- const raw = this.jwtService.decode(token);
4854
- if (
4855
- // 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
4856
- typeof raw !== "object" || raw === null || typeof raw["jti"] !== "string" || typeof raw["sub"] !== "string"
4857
- ) {
4858
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
4859
- }
4860
- return raw;
4861
- }
4862
5013
  // ---------------------------------------------------------------------------
4863
5014
  // MFA temp tokens
4864
5015
  // ---------------------------------------------------------------------------
@@ -4966,9 +5117,11 @@ var TokenManagerService = class _TokenManagerService {
4966
5117
  };
4967
5118
  TokenManagerService = _ts_decorate16([
4968
5119
  common.Injectable(),
4969
- _ts_param10(1, common.Inject(BYMAX_AUTH_OPTIONS)),
4970
- _ts_param10(3, common.Inject(BYMAX_AUTH_HOOKS)),
4971
- _ts_param10(3, common.Optional()),
5120
+ _ts_param11(0, common.Inject(jwt.JwtService)),
5121
+ _ts_param11(1, common.Inject(BYMAX_AUTH_OPTIONS)),
5122
+ _ts_param11(2, common.Inject(AuthRedisService)),
5123
+ _ts_param11(3, common.Inject(BYMAX_AUTH_HOOKS)),
5124
+ _ts_param11(3, common.Optional()),
4972
5125
  _ts_metadata15("design:type", Function),
4973
5126
  _ts_metadata15("design:paramtypes", [
4974
5127
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
@@ -4978,13 +5131,6 @@ TokenManagerService = _ts_decorate16([
4978
5131
  ])
4979
5132
  ], TokenManagerService);
4980
5133
 
4981
- // src/server/utils/log-safe.ts
4982
- var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/;
4983
- function logSafe(value) {
4984
- return CONTROL_CHARACTERS.test(value) ? "<malformed>" : value;
4985
- }
4986
- __name(logSafe, "logSafe");
4987
-
4988
5134
  // src/server/utils/mask-email.ts
4989
5135
  function maskEmail(email) {
4990
5136
  const atIndex = email.indexOf("@");
@@ -5027,12 +5173,12 @@ function _ts_metadata16(k, v) {
5027
5173
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5028
5174
  }
5029
5175
  __name(_ts_metadata16, "_ts_metadata");
5030
- function _ts_param11(paramIndex, decorator) {
5176
+ function _ts_param12(paramIndex, decorator) {
5031
5177
  return function(target, key) {
5032
5178
  decorator(target, key, paramIndex);
5033
5179
  };
5034
5180
  }
5035
- __name(_ts_param11, "_ts_param");
5181
+ __name(_ts_param12, "_ts_param");
5036
5182
  var ANTI_ENUM_MIN_MS = 300;
5037
5183
  exports.AuthService = class _AuthService {
5038
5184
  static {
@@ -5647,6 +5793,24 @@ exports.AuthService = class _AuthService {
5647
5793
  // Private helpers
5648
5794
  // ---------------------------------------------------------------------------
5649
5795
  /**
5796
+ * Derives the OTP-record identifier for a `tenantId + email` pair.
5797
+ *
5798
+ * HMAC rather than a bare digest because an address is low-entropy: a bare SHA-256 of one is
5799
+ * reversible by dictionary, and these identifiers are the Redis key an operator can read.
5800
+ * The preimage is pinned by `conformance/wire-contract.json` and shared byte-for-byte with
5801
+ * rust-auth, which keys the same records in the same Redis.
5802
+ *
5803
+ * Deliberately distinct from {@link lockoutIdentifier}: that one namespaces the login
5804
+ * keyspace with a `dashboard:` prefix, and the two must never collide.
5805
+ *
5806
+ * @param tenantId - Tenant scope.
5807
+ * @param email - The canonicalized address.
5808
+ * @returns Hex HMAC-SHA-256 identifier.
5809
+ */
5810
+ otpIdentifier(tenantId, email) {
5811
+ return hmacSha256(`${tenantId}:${email}`, this.options.hmacKey);
5812
+ }
5813
+ /**
5650
5814
  * The brute-force counter key for a dashboard account.
5651
5815
  *
5652
5816
  * The identity PLANE is part of the preimage, not just the tenant. Without it a tenant whose
@@ -5666,24 +5830,6 @@ exports.AuthService = class _AuthService {
5666
5830
  * @param email - The address, already normalized by the caller.
5667
5831
  * @returns The HMAC identifier, opaque and non-reversible.
5668
5832
  */
5669
- /**
5670
- * Derives the OTP-record identifier for a `tenantId + email` pair.
5671
- *
5672
- * HMAC rather than a bare digest because an address is low-entropy: a bare SHA-256 of one is
5673
- * reversible by dictionary, and these identifiers are the Redis key an operator can read.
5674
- * The preimage is pinned by `conformance/wire-contract.json` and shared byte-for-byte with
5675
- * rust-auth, which keys the same records in the same Redis.
5676
- *
5677
- * Deliberately distinct from {@link lockoutIdentifier}: that one namespaces the login
5678
- * keyspace with a `dashboard:` prefix, and the two must never collide.
5679
- *
5680
- * @param tenantId - Tenant scope.
5681
- * @param email - The canonicalized address.
5682
- * @returns Hex HMAC-SHA-256 identifier.
5683
- */
5684
- otpIdentifier(tenantId, email) {
5685
- return hmacSha256(`${tenantId}:${email}`, this.options.hmacKey);
5686
- }
5687
5833
  lockoutIdentifier(tenantId, email) {
5688
5834
  return hmacSha256(`dashboard:${tenantId}:${email}`, this.options.hmacKey);
5689
5835
  }
@@ -5768,12 +5914,18 @@ exports.AuthService = class _AuthService {
5768
5914
  };
5769
5915
  exports.AuthService = _ts_decorate17([
5770
5916
  common.Injectable(),
5771
- _ts_param11(0, common.Inject(BYMAX_AUTH_OPTIONS)),
5772
- _ts_param11(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
5773
- _ts_param11(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
5774
- _ts_param11(2, common.Optional()),
5775
- _ts_param11(3, common.Inject(BYMAX_AUTH_HOOKS)),
5776
- _ts_param11(3, common.Optional()),
5917
+ _ts_param12(0, common.Inject(BYMAX_AUTH_OPTIONS)),
5918
+ _ts_param12(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
5919
+ _ts_param12(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
5920
+ _ts_param12(2, common.Optional()),
5921
+ _ts_param12(3, common.Inject(BYMAX_AUTH_HOOKS)),
5922
+ _ts_param12(3, common.Optional()),
5923
+ _ts_param12(4, common.Inject(PasswordService)),
5924
+ _ts_param12(5, common.Inject(TokenManagerService)),
5925
+ _ts_param12(6, common.Inject(exports.BruteForceService)),
5926
+ _ts_param12(7, common.Inject(AuthRedisService)),
5927
+ _ts_param12(8, common.Inject(exports.OtpService)),
5928
+ _ts_param12(9, common.Inject(exports.SessionService)),
5777
5929
  _ts_metadata16("design:type", Function),
5778
5930
  _ts_metadata16("design:paramtypes", [
5779
5931
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -5809,12 +5961,12 @@ function _ts_metadata17(k, v) {
5809
5961
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5810
5962
  }
5811
5963
  __name(_ts_metadata17, "_ts_metadata");
5812
- function _ts_param12(paramIndex, decorator) {
5964
+ function _ts_param13(paramIndex, decorator) {
5813
5965
  return function(target, key) {
5814
5966
  decorator(target, key, paramIndex);
5815
5967
  };
5816
5968
  }
5817
- __name(_ts_param12, "_ts_param");
5969
+ __name(_ts_param13, "_ts_param");
5818
5970
  exports.WsTicketService = class _WsTicketService {
5819
5971
  static {
5820
5972
  __name(this, "WsTicketService");
@@ -5884,8 +6036,9 @@ exports.WsTicketService = class _WsTicketService {
5884
6036
  };
5885
6037
  exports.WsTicketService = _ts_decorate18([
5886
6038
  common.Injectable(),
5887
- _ts_param12(1, common.Inject(BYMAX_AUTH_OPTIONS)),
5888
- _ts_param12(2, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
6039
+ _ts_param13(0, common.Inject(AuthRedisService)),
6040
+ _ts_param13(1, common.Inject(BYMAX_AUTH_OPTIONS)),
6041
+ _ts_param13(2, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
5889
6042
  _ts_metadata17("design:type", Function),
5890
6043
  _ts_metadata17("design:paramtypes", [
5891
6044
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
@@ -5906,12 +6059,12 @@ function _ts_metadata18(k, v) {
5906
6059
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5907
6060
  }
5908
6061
  __name(_ts_metadata18, "_ts_metadata");
5909
- function _ts_param13(paramIndex, decorator) {
6062
+ function _ts_param14(paramIndex, decorator) {
5910
6063
  return function(target, key) {
5911
6064
  decorator(target, key, paramIndex);
5912
6065
  };
5913
6066
  }
5914
- __name(_ts_param13, "_ts_param");
6067
+ __name(_ts_param14, "_ts_param");
5915
6068
  function isMfaChallenge(result) {
5916
6069
  return "mfaRequired" in result && result.mfaRequired === true;
5917
6070
  }
@@ -6058,9 +6211,9 @@ _ts_decorate19([
6058
6211
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.register),
6059
6212
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
6060
6213
  common.Post("register"),
6061
- _ts_param13(0, common.Body()),
6062
- _ts_param13(1, common.Req()),
6063
- _ts_param13(2, common.Res({
6214
+ _ts_param14(0, common.Body()),
6215
+ _ts_param14(1, common.Req()),
6216
+ _ts_param14(2, common.Res({
6064
6217
  passthrough: true
6065
6218
  })),
6066
6219
  _ts_metadata18("design:type", Function),
@@ -6077,9 +6230,9 @@ _ts_decorate19([
6077
6230
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
6078
6231
  common.HttpCode(common.HttpStatus.OK),
6079
6232
  common.Post("login"),
6080
- _ts_param13(0, common.Body()),
6081
- _ts_param13(1, common.Req()),
6082
- _ts_param13(2, common.Res({
6233
+ _ts_param14(0, common.Body()),
6234
+ _ts_param14(1, common.Req()),
6235
+ _ts_param14(2, common.Res({
6083
6236
  passthrough: true
6084
6237
  })),
6085
6238
  _ts_metadata18("design:type", Function),
@@ -6096,8 +6249,8 @@ _ts_decorate19([
6096
6249
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
6097
6250
  common.HttpCode(common.HttpStatus.NO_CONTENT),
6098
6251
  common.Post("logout"),
6099
- _ts_param13(0, common.Req()),
6100
- _ts_param13(1, common.Res({
6252
+ _ts_param14(0, common.Req()),
6253
+ _ts_param14(1, common.Res({
6101
6254
  passthrough: true
6102
6255
  })),
6103
6256
  _ts_metadata18("design:type", Function),
@@ -6113,8 +6266,8 @@ _ts_decorate19([
6113
6266
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
6114
6267
  common.HttpCode(common.HttpStatus.OK),
6115
6268
  common.Post("refresh"),
6116
- _ts_param13(0, common.Req()),
6117
- _ts_param13(1, common.Res({
6269
+ _ts_param14(0, common.Req()),
6270
+ _ts_param14(1, common.Res({
6118
6271
  passthrough: true
6119
6272
  })),
6120
6273
  _ts_metadata18("design:type", Function),
@@ -6127,7 +6280,7 @@ _ts_decorate19([
6127
6280
  _ts_decorate19([
6128
6281
  common.UseGuards(exports.JwtAuthGuard),
6129
6282
  common.Get("me"),
6130
- _ts_param13(0, CurrentUser()),
6283
+ _ts_param14(0, CurrentUser()),
6131
6284
  _ts_metadata18("design:type", Function),
6132
6285
  _ts_metadata18("design:paramtypes", [
6133
6286
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
@@ -6140,7 +6293,7 @@ _ts_decorate19([
6140
6293
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
6141
6294
  common.Post("ws-ticket"),
6142
6295
  common.HttpCode(common.HttpStatus.OK),
6143
- _ts_param13(0, CurrentUser()),
6296
+ _ts_param14(0, CurrentUser()),
6144
6297
  _ts_metadata18("design:type", Function),
6145
6298
  _ts_metadata18("design:paramtypes", [
6146
6299
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
@@ -6153,8 +6306,8 @@ _ts_decorate19([
6153
6306
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
6154
6307
  common.HttpCode(common.HttpStatus.NO_CONTENT),
6155
6308
  common.Post("verify-email"),
6156
- _ts_param13(0, common.Body()),
6157
- _ts_param13(1, common.Req()),
6309
+ _ts_param14(0, common.Body()),
6310
+ _ts_param14(1, common.Req()),
6158
6311
  _ts_metadata18("design:type", Function),
6159
6312
  _ts_metadata18("design:paramtypes", [
6160
6313
  typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
@@ -6168,8 +6321,8 @@ _ts_decorate19([
6168
6321
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
6169
6322
  common.HttpCode(common.HttpStatus.NO_CONTENT),
6170
6323
  common.Post("resend-verification"),
6171
- _ts_param13(0, common.Body()),
6172
- _ts_param13(1, common.Req()),
6324
+ _ts_param14(0, common.Body()),
6325
+ _ts_param14(1, common.Req()),
6173
6326
  _ts_metadata18("design:type", Function),
6174
6327
  _ts_metadata18("design:paramtypes", [
6175
6328
  typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
@@ -6182,6 +6335,9 @@ AuthController = _ts_decorate19([
6182
6335
  common.Controller(),
6183
6336
  common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
6184
6337
  common.UsePipes(createAuthValidationPipe()),
6338
+ _ts_param14(0, common.Inject(exports.AuthService)),
6339
+ _ts_param14(1, common.Inject(exports.TokenDeliveryService)),
6340
+ _ts_param14(2, common.Inject(exports.WsTicketService)),
6185
6341
  _ts_metadata18("design:type", Function),
6186
6342
  _ts_metadata18("design:paramtypes", [
6187
6343
  typeof exports.AuthService === "undefined" ? Object : exports.AuthService,
@@ -6272,12 +6428,12 @@ function _ts_metadata21(k, v) {
6272
6428
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6273
6429
  }
6274
6430
  __name(_ts_metadata21, "_ts_metadata");
6275
- function _ts_param14(paramIndex, decorator) {
6431
+ function _ts_param15(paramIndex, decorator) {
6276
6432
  return function(target, key) {
6277
6433
  decorator(target, key, paramIndex);
6278
6434
  };
6279
6435
  }
6280
- __name(_ts_param14, "_ts_param");
6436
+ __name(_ts_param15, "_ts_param");
6281
6437
  var EMAIL_CHANGE_TOKEN_BYTES = 32;
6282
6438
  function isEmailChangeContext(value) {
6283
6439
  if (typeof value !== "object" || value === null) return false;
@@ -6492,9 +6648,12 @@ exports.EmailChangeService = class _EmailChangeService {
6492
6648
  };
6493
6649
  exports.EmailChangeService = _ts_decorate22([
6494
6650
  common.Injectable(),
6495
- _ts_param14(0, common.Inject(BYMAX_AUTH_OPTIONS)),
6496
- _ts_param14(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
6497
- _ts_param14(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6651
+ _ts_param15(0, common.Inject(BYMAX_AUTH_OPTIONS)),
6652
+ _ts_param15(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
6653
+ _ts_param15(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6654
+ _ts_param15(3, common.Inject(PasswordService)),
6655
+ _ts_param15(4, common.Inject(AuthRedisService)),
6656
+ _ts_param15(5, common.Inject(exports.BruteForceService)),
6498
6657
  _ts_metadata21("design:type", Function),
6499
6658
  _ts_metadata21("design:paramtypes", [
6500
6659
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -6518,12 +6677,12 @@ function _ts_metadata22(k, v) {
6518
6677
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6519
6678
  }
6520
6679
  __name(_ts_metadata22, "_ts_metadata");
6521
- function _ts_param15(paramIndex, decorator) {
6680
+ function _ts_param16(paramIndex, decorator) {
6522
6681
  return function(target, key) {
6523
6682
  decorator(target, key, paramIndex);
6524
6683
  };
6525
6684
  }
6526
- __name(_ts_param15, "_ts_param");
6685
+ __name(_ts_param16, "_ts_param");
6527
6686
  var EmailChangeController = class {
6528
6687
  static {
6529
6688
  __name(this, "EmailChangeController");
@@ -6576,8 +6735,8 @@ _ts_decorate23([
6576
6735
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
6577
6736
  common.HttpCode(common.HttpStatus.NO_CONTENT),
6578
6737
  common.Post("change"),
6579
- _ts_param15(0, common.Body()),
6580
- _ts_param15(1, CurrentUser()),
6738
+ _ts_param16(0, common.Body()),
6739
+ _ts_param16(1, CurrentUser()),
6581
6740
  _ts_metadata22("design:type", Function),
6582
6741
  _ts_metadata22("design:paramtypes", [
6583
6742
  typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
@@ -6591,7 +6750,7 @@ _ts_decorate23([
6591
6750
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
6592
6751
  common.HttpCode(common.HttpStatus.NO_CONTENT),
6593
6752
  common.Post("change/confirm"),
6594
- _ts_param15(0, common.Body()),
6753
+ _ts_param16(0, common.Body()),
6595
6754
  _ts_metadata22("design:type", Function),
6596
6755
  _ts_metadata22("design:paramtypes", [
6597
6756
  typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
@@ -6603,6 +6762,7 @@ EmailChangeController = _ts_decorate23([
6603
6762
  common.Controller("email"),
6604
6763
  common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
6605
6764
  common.UsePipes(createAuthValidationPipe()),
6765
+ _ts_param16(0, common.Inject(exports.EmailChangeService)),
6606
6766
  _ts_metadata22("design:type", Function),
6607
6767
  _ts_metadata22("design:paramtypes", [
6608
6768
  typeof exports.EmailChangeService === "undefined" ? Object : exports.EmailChangeService
@@ -6767,12 +6927,12 @@ function _ts_metadata26(k, v) {
6767
6927
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6768
6928
  }
6769
6929
  __name(_ts_metadata26, "_ts_metadata");
6770
- function _ts_param16(paramIndex, decorator) {
6930
+ function _ts_param17(paramIndex, decorator) {
6771
6931
  return function(target, key) {
6772
6932
  decorator(target, key, paramIndex);
6773
6933
  };
6774
6934
  }
6775
- __name(_ts_param16, "_ts_param");
6935
+ __name(_ts_param17, "_ts_param");
6776
6936
  function isStoredInvitation(value) {
6777
6937
  if (typeof value !== "object" || value === null) return false;
6778
6938
  const v = value;
@@ -7201,10 +7361,14 @@ exports.InvitationService = class _InvitationService {
7201
7361
  };
7202
7362
  exports.InvitationService = _ts_decorate27([
7203
7363
  common.Injectable(),
7204
- _ts_param16(0, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
7205
- _ts_param16(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
7206
- _ts_param16(2, common.Inject(BYMAX_AUTH_HOOKS)),
7207
- _ts_param16(7, common.Inject(BYMAX_AUTH_OPTIONS)),
7364
+ _ts_param17(0, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
7365
+ _ts_param17(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
7366
+ _ts_param17(2, common.Inject(BYMAX_AUTH_HOOKS)),
7367
+ _ts_param17(3, common.Inject(AuthRedisService)),
7368
+ _ts_param17(4, common.Inject(PasswordService)),
7369
+ _ts_param17(5, common.Inject(exports.SessionService)),
7370
+ _ts_param17(6, common.Inject(TokenManagerService)),
7371
+ _ts_param17(7, common.Inject(BYMAX_AUTH_OPTIONS)),
7208
7372
  _ts_metadata26("design:type", Function),
7209
7373
  _ts_metadata26("design:paramtypes", [
7210
7374
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
@@ -7230,12 +7394,12 @@ function _ts_metadata27(k, v) {
7230
7394
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7231
7395
  }
7232
7396
  __name(_ts_metadata27, "_ts_metadata");
7233
- function _ts_param17(paramIndex, decorator) {
7397
+ function _ts_param18(paramIndex, decorator) {
7234
7398
  return function(target, key) {
7235
7399
  decorator(target, key, paramIndex);
7236
7400
  };
7237
7401
  }
7238
- __name(_ts_param17, "_ts_param");
7402
+ __name(_ts_param18, "_ts_param");
7239
7403
  var InvitationController = class {
7240
7404
  static {
7241
7405
  __name(this, "InvitationController");
@@ -7317,8 +7481,8 @@ _ts_decorate28([
7317
7481
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
7318
7482
  common.HttpCode(common.HttpStatus.NO_CONTENT),
7319
7483
  common.Post(),
7320
- _ts_param17(0, common.Body()),
7321
- _ts_param17(1, CurrentUser()),
7484
+ _ts_param18(0, common.Body()),
7485
+ _ts_param18(1, CurrentUser()),
7322
7486
  _ts_metadata27("design:type", Function),
7323
7487
  _ts_metadata27("design:paramtypes", [
7324
7488
  typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
@@ -7332,8 +7496,8 @@ _ts_decorate28([
7332
7496
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
7333
7497
  common.HttpCode(common.HttpStatus.NO_CONTENT),
7334
7498
  common.Post("revoke"),
7335
- _ts_param17(0, common.Body()),
7336
- _ts_param17(1, CurrentUser()),
7499
+ _ts_param18(0, common.Body()),
7500
+ _ts_param18(1, CurrentUser()),
7337
7501
  _ts_metadata27("design:type", Function),
7338
7502
  _ts_metadata27("design:paramtypes", [
7339
7503
  typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
@@ -7347,9 +7511,9 @@ _ts_decorate28([
7347
7511
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
7348
7512
  common.HttpCode(common.HttpStatus.CREATED),
7349
7513
  common.Post("accept"),
7350
- _ts_param17(0, common.Body()),
7351
- _ts_param17(1, common.Req()),
7352
- _ts_param17(2, common.Res({
7514
+ _ts_param18(0, common.Body()),
7515
+ _ts_param18(1, common.Req()),
7516
+ _ts_param18(2, common.Res({
7353
7517
  passthrough: true
7354
7518
  })),
7355
7519
  _ts_metadata27("design:type", Function),
@@ -7365,6 +7529,8 @@ InvitationController = _ts_decorate28([
7365
7529
  common.Controller("invitations"),
7366
7530
  common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
7367
7531
  common.UsePipes(createAuthValidationPipe()),
7532
+ _ts_param18(0, common.Inject(exports.InvitationService)),
7533
+ _ts_param18(1, common.Inject(exports.TokenDeliveryService)),
7368
7534
  _ts_metadata27("design:type", Function),
7369
7535
  _ts_metadata27("design:paramtypes", [
7370
7536
  typeof exports.InvitationService === "undefined" ? Object : exports.InvitationService,
@@ -7639,12 +7805,12 @@ function _ts_metadata33(k, v) {
7639
7805
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7640
7806
  }
7641
7807
  __name(_ts_metadata33, "_ts_metadata");
7642
- function _ts_param18(paramIndex, decorator) {
7808
+ function _ts_param19(paramIndex, decorator) {
7643
7809
  return function(target, key) {
7644
7810
  decorator(target, key, paramIndex);
7645
7811
  };
7646
7812
  }
7647
- __name(_ts_param18, "_ts_param");
7813
+ __name(_ts_param19, "_ts_param");
7648
7814
  var MFA_SETUP_TTL_SECONDS = 600;
7649
7815
  var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
7650
7816
  function totpAntiReplayTtlSeconds(window) {
@@ -8539,12 +8705,17 @@ exports.MfaService = class _MfaService {
8539
8705
  };
8540
8706
  exports.MfaService = _ts_decorate34([
8541
8707
  common.Injectable(),
8542
- _ts_param18(0, common.Inject(BYMAX_AUTH_OPTIONS)),
8543
- _ts_param18(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
8544
- _ts_param18(2, common.Optional()),
8545
- _ts_param18(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
8546
- _ts_param18(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
8547
- _ts_param18(9, common.Inject(BYMAX_AUTH_HOOKS)),
8708
+ _ts_param19(0, common.Inject(BYMAX_AUTH_OPTIONS)),
8709
+ _ts_param19(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
8710
+ _ts_param19(2, common.Optional()),
8711
+ _ts_param19(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
8712
+ _ts_param19(3, common.Inject(AuthRedisService)),
8713
+ _ts_param19(4, common.Inject(TokenManagerService)),
8714
+ _ts_param19(5, common.Inject(exports.BruteForceService)),
8715
+ _ts_param19(6, common.Inject(PasswordService)),
8716
+ _ts_param19(7, common.Inject(exports.SessionService)),
8717
+ _ts_param19(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
8718
+ _ts_param19(9, common.Inject(BYMAX_AUTH_HOOKS)),
8548
8719
  _ts_metadata33("design:type", Function),
8549
8720
  _ts_metadata33("design:paramtypes", [
8550
8721
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -8572,12 +8743,12 @@ function _ts_metadata34(k, v) {
8572
8743
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
8573
8744
  }
8574
8745
  __name(_ts_metadata34, "_ts_metadata");
8575
- function _ts_param19(paramIndex, decorator) {
8746
+ function _ts_param20(paramIndex, decorator) {
8576
8747
  return function(target, key) {
8577
8748
  decorator(target, key, paramIndex);
8578
8749
  };
8579
8750
  }
8580
- __name(_ts_param19, "_ts_param");
8751
+ __name(_ts_param20, "_ts_param");
8581
8752
  function isPlatformResult(result) {
8582
8753
  return "admin" in result;
8583
8754
  }
@@ -8771,8 +8942,8 @@ _ts_decorate35([
8771
8942
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
8772
8943
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
8773
8944
  common.Post("setup"),
8774
- _ts_param19(0, CurrentUser()),
8775
- _ts_param19(1, common.Body()),
8945
+ _ts_param20(0, CurrentUser()),
8946
+ _ts_param20(1, common.Body()),
8776
8947
  _ts_metadata34("design:type", Function),
8777
8948
  _ts_metadata34("design:paramtypes", [
8778
8949
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8786,9 +8957,9 @@ _ts_decorate35([
8786
8957
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
8787
8958
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8788
8959
  common.Post("verify-enable"),
8789
- _ts_param19(0, CurrentUser()),
8790
- _ts_param19(1, common.Body()),
8791
- _ts_param19(2, common.Req()),
8960
+ _ts_param20(0, CurrentUser()),
8961
+ _ts_param20(1, common.Body()),
8962
+ _ts_param20(2, common.Req()),
8792
8963
  _ts_metadata34("design:type", Function),
8793
8964
  _ts_metadata34("design:paramtypes", [
8794
8965
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8804,9 +8975,9 @@ _ts_decorate35([
8804
8975
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
8805
8976
  common.HttpCode(common.HttpStatus.OK),
8806
8977
  common.Post("challenge"),
8807
- _ts_param19(0, common.Body()),
8808
- _ts_param19(1, common.Req()),
8809
- _ts_param19(2, common.Res({
8978
+ _ts_param20(0, common.Body()),
8979
+ _ts_param20(1, common.Req()),
8980
+ _ts_param20(2, common.Res({
8810
8981
  passthrough: true
8811
8982
  })),
8812
8983
  _ts_metadata34("design:type", Function),
@@ -8823,9 +8994,9 @@ _ts_decorate35([
8823
8994
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
8824
8995
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8825
8996
  common.Post("disable"),
8826
- _ts_param19(0, CurrentUser()),
8827
- _ts_param19(1, common.Body()),
8828
- _ts_param19(2, common.Req()),
8997
+ _ts_param20(0, CurrentUser()),
8998
+ _ts_param20(1, common.Body()),
8999
+ _ts_param20(2, common.Req()),
8829
9000
  _ts_metadata34("design:type", Function),
8830
9001
  _ts_metadata34("design:paramtypes", [
8831
9002
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8840,9 +9011,9 @@ _ts_decorate35([
8840
9011
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
8841
9012
  common.HttpCode(common.HttpStatus.OK),
8842
9013
  common.Post("recovery-codes"),
8843
- _ts_param19(0, CurrentUser()),
8844
- _ts_param19(1, common.Body()),
8845
- _ts_param19(2, common.Req()),
9014
+ _ts_param20(0, CurrentUser()),
9015
+ _ts_param20(1, common.Body()),
9016
+ _ts_param20(2, common.Req()),
8846
9017
  _ts_metadata34("design:type", Function),
8847
9018
  _ts_metadata34("design:paramtypes", [
8848
9019
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -8858,7 +9029,9 @@ MfaController = _ts_decorate35([
8858
9029
  common.UsePipes(createAuthValidationPipe({
8859
9030
  forbidUnknownValues: true
8860
9031
  })),
8861
- _ts_param19(2, common.Inject(BYMAX_AUTH_OPTIONS)),
9032
+ _ts_param20(0, common.Inject(exports.MfaService)),
9033
+ _ts_param20(1, common.Inject(exports.TokenDeliveryService)),
9034
+ _ts_param20(2, common.Inject(BYMAX_AUTH_OPTIONS)),
8862
9035
  _ts_metadata34("design:type", Function),
8863
9036
  _ts_metadata34("design:paramtypes", [
8864
9037
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
@@ -9149,12 +9322,12 @@ function _ts_metadata40(k, v) {
9149
9322
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9150
9323
  }
9151
9324
  __name(_ts_metadata40, "_ts_metadata");
9152
- function _ts_param20(paramIndex, decorator) {
9325
+ function _ts_param21(paramIndex, decorator) {
9153
9326
  return function(target, key) {
9154
9327
  decorator(target, key, paramIndex);
9155
9328
  };
9156
9329
  }
9157
- __name(_ts_param20, "_ts_param");
9330
+ __name(_ts_param21, "_ts_param");
9158
9331
  var ANTI_ENUM_MIN_MS2 = 300;
9159
9332
  var VERIFIED_TOKEN_TTL_SECONDS = 300;
9160
9333
  var PASSWORD_RESET_PURPOSE = "password_reset";
@@ -9669,12 +9842,17 @@ exports.PasswordResetService = class _PasswordResetService {
9669
9842
  };
9670
9843
  exports.PasswordResetService = _ts_decorate41([
9671
9844
  common.Injectable(),
9672
- _ts_param20(0, common.Inject(BYMAX_AUTH_OPTIONS)),
9673
- _ts_param20(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
9674
- _ts_param20(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
9675
- _ts_param20(2, common.Optional()),
9676
- _ts_param20(3, common.Inject(BYMAX_AUTH_HOOKS)),
9677
- _ts_param20(3, common.Optional()),
9845
+ _ts_param21(0, common.Inject(BYMAX_AUTH_OPTIONS)),
9846
+ _ts_param21(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
9847
+ _ts_param21(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
9848
+ _ts_param21(2, common.Optional()),
9849
+ _ts_param21(3, common.Inject(BYMAX_AUTH_HOOKS)),
9850
+ _ts_param21(3, common.Optional()),
9851
+ _ts_param21(4, common.Inject(exports.OtpService)),
9852
+ _ts_param21(5, common.Inject(PasswordService)),
9853
+ _ts_param21(6, common.Inject(AuthRedisService)),
9854
+ _ts_param21(7, common.Inject(exports.SessionService)),
9855
+ _ts_param21(8, common.Inject(exports.BruteForceService)),
9678
9856
  _ts_metadata40("design:type", Function),
9679
9857
  _ts_metadata40("design:paramtypes", [
9680
9858
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -9706,12 +9884,12 @@ function _ts_metadata41(k, v) {
9706
9884
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9707
9885
  }
9708
9886
  __name(_ts_metadata41, "_ts_metadata");
9709
- function _ts_param21(paramIndex, decorator) {
9887
+ function _ts_param22(paramIndex, decorator) {
9710
9888
  return function(target, key) {
9711
9889
  decorator(target, key, paramIndex);
9712
9890
  };
9713
9891
  }
9714
- __name(_ts_param21, "_ts_param");
9892
+ __name(_ts_param22, "_ts_param");
9715
9893
  var PasswordResetController = class {
9716
9894
  static {
9717
9895
  __name(this, "PasswordResetController");
@@ -9827,8 +10005,8 @@ _ts_decorate42([
9827
10005
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
9828
10006
  common.HttpCode(common.HttpStatus.OK),
9829
10007
  common.Post("forgot-password"),
9830
- _ts_param21(0, common.Body()),
9831
- _ts_param21(1, common.Req()),
10008
+ _ts_param22(0, common.Body()),
10009
+ _ts_param22(1, common.Req()),
9832
10010
  _ts_metadata41("design:type", Function),
9833
10011
  _ts_metadata41("design:paramtypes", [
9834
10012
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
@@ -9841,8 +10019,8 @@ _ts_decorate42([
9841
10019
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
9842
10020
  common.HttpCode(common.HttpStatus.NO_CONTENT),
9843
10021
  common.Post("reset-password"),
9844
- _ts_param21(0, common.Body()),
9845
- _ts_param21(1, common.Req()),
10022
+ _ts_param22(0, common.Body()),
10023
+ _ts_param22(1, common.Req()),
9846
10024
  _ts_metadata41("design:type", Function),
9847
10025
  _ts_metadata41("design:paramtypes", [
9848
10026
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
@@ -9857,9 +10035,9 @@ _ts_decorate42([
9857
10035
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
9858
10036
  common.HttpCode(common.HttpStatus.NO_CONTENT),
9859
10037
  common.Post("change"),
9860
- _ts_param21(0, CurrentUser()),
9861
- _ts_param21(1, common.Body()),
9862
- _ts_param21(2, common.Req()),
10038
+ _ts_param22(0, CurrentUser()),
10039
+ _ts_param22(1, common.Body()),
10040
+ _ts_param22(2, common.Req()),
9863
10041
  _ts_metadata41("design:type", Function),
9864
10042
  _ts_metadata41("design:paramtypes", [
9865
10043
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -9873,8 +10051,8 @@ _ts_decorate42([
9873
10051
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
9874
10052
  common.HttpCode(common.HttpStatus.OK),
9875
10053
  common.Post("verify-otp"),
9876
- _ts_param21(0, common.Body()),
9877
- _ts_param21(1, common.Req()),
10054
+ _ts_param22(0, common.Body()),
10055
+ _ts_param22(1, common.Req()),
9878
10056
  _ts_metadata41("design:type", Function),
9879
10057
  _ts_metadata41("design:paramtypes", [
9880
10058
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
@@ -9887,8 +10065,8 @@ _ts_decorate42([
9887
10065
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
9888
10066
  common.HttpCode(common.HttpStatus.OK),
9889
10067
  common.Post("resend-otp"),
9890
- _ts_param21(0, common.Body()),
9891
- _ts_param21(1, common.Req()),
10068
+ _ts_param22(0, common.Body()),
10069
+ _ts_param22(1, common.Req()),
9892
10070
  _ts_metadata41("design:type", Function),
9893
10071
  _ts_metadata41("design:paramtypes", [
9894
10072
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
@@ -9902,6 +10080,8 @@ PasswordResetController = _ts_decorate42([
9902
10080
  common.Controller("password"),
9903
10081
  common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9904
10082
  common.UsePipes(createAuthValidationPipe()),
10083
+ _ts_param22(0, common.Inject(exports.PasswordResetService)),
10084
+ _ts_param22(1, common.Inject(exports.TokenDeliveryService)),
9905
10085
  _ts_metadata41("design:type", Function),
9906
10086
  _ts_metadata41("design:paramtypes", [
9907
10087
  typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
@@ -9974,12 +10154,12 @@ function _ts_metadata43(k, v) {
9974
10154
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9975
10155
  }
9976
10156
  __name(_ts_metadata43, "_ts_metadata");
9977
- function _ts_param22(paramIndex, decorator) {
10157
+ function _ts_param23(paramIndex, decorator) {
9978
10158
  return function(target, key) {
9979
10159
  decorator(target, key, paramIndex);
9980
10160
  };
9981
10161
  }
9982
- __name(_ts_param22, "_ts_param");
10162
+ __name(_ts_param23, "_ts_param");
9983
10163
  exports.JwtPlatformGuard = class JwtPlatformGuard {
9984
10164
  static {
9985
10165
  __name(this, "JwtPlatformGuard");
@@ -10032,7 +10212,11 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
10032
10212
  };
10033
10213
  exports.JwtPlatformGuard = _ts_decorate44([
10034
10214
  common.Injectable(),
10035
- _ts_param22(4, common.Inject(BYMAX_AUTH_OPTIONS)),
10215
+ _ts_param23(0, common.Inject(jwt.JwtService)),
10216
+ _ts_param23(1, common.Inject(exports.TokenDeliveryService)),
10217
+ _ts_param23(2, common.Inject(AuthRedisService)),
10218
+ _ts_param23(3, common.Inject(core.Reflector)),
10219
+ _ts_param23(4, common.Inject(BYMAX_AUTH_OPTIONS)),
10036
10220
  _ts_metadata43("design:type", Function),
10037
10221
  _ts_metadata43("design:paramtypes", [
10038
10222
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
@@ -10053,12 +10237,12 @@ function _ts_metadata44(k, v) {
10053
10237
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10054
10238
  }
10055
10239
  __name(_ts_metadata44, "_ts_metadata");
10056
- function _ts_param23(paramIndex, decorator) {
10240
+ function _ts_param24(paramIndex, decorator) {
10057
10241
  return function(target, key) {
10058
10242
  decorator(target, key, paramIndex);
10059
10243
  };
10060
10244
  }
10061
- __name(_ts_param23, "_ts_param");
10245
+ __name(_ts_param24, "_ts_param");
10062
10246
  exports.PlatformAuthService = class _PlatformAuthService {
10063
10247
  static {
10064
10248
  __name(this, "PlatformAuthService");
@@ -10238,23 +10422,6 @@ exports.PlatformAuthService = class _PlatformAuthService {
10238
10422
  // Session revocation
10239
10423
  // ---------------------------------------------------------------------------
10240
10424
  /**
10241
- * Revokes all active platform sessions for the given admin.
10242
- *
10243
- * Delegates to {@link AuthRedisService.invalidateUserSessions} which uses an atomic
10244
- * Lua script to read the `psess:{userId}` SET, delete all session and grace-pointer
10245
- * keys, and remove the SET itself in a single Redis round-trip. This prevents the
10246
- * TOCTOU race that would arise from a non-atomic SMEMBERS + loop + DEL approach.
10247
- *
10248
- * The token epoch is then advanced, so outstanding platform **access** tokens die with
10249
- * the refresh sessions rather than working on to expiry — "log out everywhere" that
10250
- * leaves every access token alive is not what those words promise. Bumped after the
10251
- * sweep for the same reason the dashboard flow bumps last: a failure in the sweep
10252
- * leaves the epoch untouched and the operation visibly incomplete, instead of the
10253
- * reverse, which would read as done while the sessions live on.
10254
- *
10255
- * @param userId - The platform admin's internal ID.
10256
- */
10257
- /**
10258
10425
  * Derives the brute-force identifier for a platform login: `hmac('platform:{email}')`.
10259
10426
  *
10260
10427
  * HMAC rather than a bare digest keeps PII out of the Redis key and blocks dictionary
@@ -10275,6 +10442,23 @@ exports.PlatformAuthService = class _PlatformAuthService {
10275
10442
  lockoutIdentifier(email) {
10276
10443
  return hmacSha256(`platform:${email}`, this.options.hmacKey);
10277
10444
  }
10445
+ /**
10446
+ * Revokes all active platform sessions for the given admin.
10447
+ *
10448
+ * Delegates to {@link AuthRedisService.invalidateUserSessions} which uses an atomic
10449
+ * Lua script to read the `psess:{userId}` SET, delete all session and grace-pointer
10450
+ * keys, and remove the SET itself in a single Redis round-trip. This prevents the
10451
+ * TOCTOU race that would arise from a non-atomic SMEMBERS + loop + DEL approach.
10452
+ *
10453
+ * The token epoch is then advanced, so outstanding platform **access** tokens die with
10454
+ * the refresh sessions rather than working on to expiry — "log out everywhere" that
10455
+ * leaves every access token alive is not what those words promise. Bumped after the
10456
+ * sweep for the same reason the dashboard flow bumps last: a failure in the sweep
10457
+ * leaves the epoch untouched and the operation visibly incomplete, instead of the
10458
+ * reverse, which would read as done while the sessions live on.
10459
+ *
10460
+ * @param userId - The platform admin's internal ID.
10461
+ */
10278
10462
  async revokeAllPlatformSessions(userId) {
10279
10463
  await this.redis.invalidateUserSessions(userId, "platform");
10280
10464
  await this.redis.bumpUserTokenEpoch(userId, "platform");
@@ -10282,8 +10466,12 @@ exports.PlatformAuthService = class _PlatformAuthService {
10282
10466
  };
10283
10467
  exports.PlatformAuthService = _ts_decorate45([
10284
10468
  common.Injectable(),
10285
- _ts_param23(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10286
- _ts_param23(5, common.Inject(BYMAX_AUTH_OPTIONS)),
10469
+ _ts_param24(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10470
+ _ts_param24(1, common.Inject(PasswordService)),
10471
+ _ts_param24(2, common.Inject(TokenManagerService)),
10472
+ _ts_param24(3, common.Inject(exports.BruteForceService)),
10473
+ _ts_param24(4, common.Inject(AuthRedisService)),
10474
+ _ts_param24(5, common.Inject(BYMAX_AUTH_OPTIONS)),
10287
10475
  _ts_metadata44("design:type", Function),
10288
10476
  _ts_metadata44("design:paramtypes", [
10289
10477
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
@@ -10307,12 +10495,12 @@ function _ts_metadata45(k, v) {
10307
10495
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10308
10496
  }
10309
10497
  __name(_ts_metadata45, "_ts_metadata");
10310
- function _ts_param24(paramIndex, decorator) {
10498
+ function _ts_param25(paramIndex, decorator) {
10311
10499
  return function(target, key) {
10312
10500
  decorator(target, key, paramIndex);
10313
10501
  };
10314
10502
  }
10315
- __name(_ts_param24, "_ts_param");
10503
+ __name(_ts_param25, "_ts_param");
10316
10504
  function isPlatformResult2(result) {
10317
10505
  return "admin" in result;
10318
10506
  }
@@ -10478,8 +10666,8 @@ _ts_decorate46([
10478
10666
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
10479
10667
  common.HttpCode(common.HttpStatus.OK),
10480
10668
  common.Post("login"),
10481
- _ts_param24(0, common.Body()),
10482
- _ts_param24(1, common.Req()),
10669
+ _ts_param25(0, common.Body()),
10670
+ _ts_param25(1, common.Req()),
10483
10671
  _ts_metadata45("design:type", Function),
10484
10672
  _ts_metadata45("design:paramtypes", [
10485
10673
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
@@ -10493,8 +10681,8 @@ _ts_decorate46([
10493
10681
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
10494
10682
  common.HttpCode(common.HttpStatus.OK),
10495
10683
  common.Post("mfa/challenge"),
10496
- _ts_param24(0, common.Body()),
10497
- _ts_param24(1, common.Req()),
10684
+ _ts_param25(0, common.Body()),
10685
+ _ts_param25(1, common.Req()),
10498
10686
  _ts_metadata45("design:type", Function),
10499
10687
  _ts_metadata45("design:paramtypes", [
10500
10688
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
@@ -10505,7 +10693,7 @@ _ts_decorate46([
10505
10693
  _ts_decorate46([
10506
10694
  common.UseGuards(exports.JwtPlatformGuard),
10507
10695
  common.Get("me"),
10508
- _ts_param24(0, CurrentUser()),
10696
+ _ts_param25(0, CurrentUser()),
10509
10697
  _ts_metadata45("design:type", Function),
10510
10698
  _ts_metadata45("design:paramtypes", [
10511
10699
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
@@ -10518,7 +10706,7 @@ _ts_decorate46([
10518
10706
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
10519
10707
  common.HttpCode(common.HttpStatus.NO_CONTENT),
10520
10708
  common.Post("logout"),
10521
- _ts_param24(0, common.Req()),
10709
+ _ts_param25(0, common.Req()),
10522
10710
  _ts_metadata45("design:type", Function),
10523
10711
  _ts_metadata45("design:paramtypes", [
10524
10712
  typeof Request === "undefined" ? Object : Request
@@ -10531,7 +10719,7 @@ _ts_decorate46([
10531
10719
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
10532
10720
  common.HttpCode(common.HttpStatus.OK),
10533
10721
  common.Post("refresh"),
10534
- _ts_param24(0, common.Req()),
10722
+ _ts_param25(0, common.Req()),
10535
10723
  _ts_metadata45("design:type", Function),
10536
10724
  _ts_metadata45("design:paramtypes", [
10537
10725
  typeof Request === "undefined" ? Object : Request
@@ -10544,7 +10732,7 @@ _ts_decorate46([
10544
10732
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
10545
10733
  common.HttpCode(common.HttpStatus.NO_CONTENT),
10546
10734
  common.Delete("sessions"),
10547
- _ts_param24(0, CurrentUser()),
10735
+ _ts_param25(0, CurrentUser()),
10548
10736
  _ts_metadata45("design:type", Function),
10549
10737
  _ts_metadata45("design:paramtypes", [
10550
10738
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
@@ -10556,6 +10744,9 @@ PlatformAuthController = _ts_decorate46([
10556
10744
  common.Controller("platform"),
10557
10745
  common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
10558
10746
  common.UsePipes(createAuthValidationPipe()),
10747
+ _ts_param25(0, common.Inject(exports.PlatformAuthService)),
10748
+ _ts_param25(1, common.Inject(exports.MfaService)),
10749
+ _ts_param25(2, common.Inject(exports.TokenDeliveryService)),
10559
10750
  _ts_metadata45("design:type", Function),
10560
10751
  _ts_metadata45("design:paramtypes", [
10561
10752
  typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
@@ -10574,12 +10765,12 @@ function _ts_metadata46(k, v) {
10574
10765
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10575
10766
  }
10576
10767
  __name(_ts_metadata46, "_ts_metadata");
10577
- function _ts_param25(paramIndex, decorator) {
10768
+ function _ts_param26(paramIndex, decorator) {
10578
10769
  return function(target, key) {
10579
10770
  decorator(target, key, paramIndex);
10580
10771
  };
10581
10772
  }
10582
- __name(_ts_param25, "_ts_param");
10773
+ __name(_ts_param26, "_ts_param");
10583
10774
  var PlatformMfaController = class {
10584
10775
  static {
10585
10776
  __name(this, "PlatformMfaController");
@@ -10663,8 +10854,8 @@ _ts_decorate47([
10663
10854
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
10664
10855
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
10665
10856
  common.Post("setup"),
10666
- _ts_param25(0, CurrentUser()),
10667
- _ts_param25(1, common.Body()),
10857
+ _ts_param26(0, CurrentUser()),
10858
+ _ts_param26(1, common.Body()),
10668
10859
  _ts_metadata46("design:type", Function),
10669
10860
  _ts_metadata46("design:paramtypes", [
10670
10861
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10678,9 +10869,9 @@ _ts_decorate47([
10678
10869
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
10679
10870
  common.HttpCode(common.HttpStatus.NO_CONTENT),
10680
10871
  common.Post("verify-enable"),
10681
- _ts_param25(0, CurrentUser()),
10682
- _ts_param25(1, common.Body()),
10683
- _ts_param25(2, common.Req()),
10872
+ _ts_param26(0, CurrentUser()),
10873
+ _ts_param26(1, common.Body()),
10874
+ _ts_param26(2, common.Req()),
10684
10875
  _ts_metadata46("design:type", Function),
10685
10876
  _ts_metadata46("design:paramtypes", [
10686
10877
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10695,9 +10886,9 @@ _ts_decorate47([
10695
10886
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
10696
10887
  common.HttpCode(common.HttpStatus.NO_CONTENT),
10697
10888
  common.Post("disable"),
10698
- _ts_param25(0, CurrentUser()),
10699
- _ts_param25(1, common.Body()),
10700
- _ts_param25(2, common.Req()),
10889
+ _ts_param26(0, CurrentUser()),
10890
+ _ts_param26(1, common.Body()),
10891
+ _ts_param26(2, common.Req()),
10701
10892
  _ts_metadata46("design:type", Function),
10702
10893
  _ts_metadata46("design:paramtypes", [
10703
10894
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10712,9 +10903,9 @@ _ts_decorate47([
10712
10903
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
10713
10904
  common.HttpCode(common.HttpStatus.OK),
10714
10905
  common.Post("recovery-codes"),
10715
- _ts_param25(0, CurrentUser()),
10716
- _ts_param25(1, common.Body()),
10717
- _ts_param25(2, common.Req()),
10906
+ _ts_param26(0, CurrentUser()),
10907
+ _ts_param26(1, common.Body()),
10908
+ _ts_param26(2, common.Req()),
10718
10909
  _ts_metadata46("design:type", Function),
10719
10910
  _ts_metadata46("design:paramtypes", [
10720
10911
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
@@ -10730,6 +10921,7 @@ PlatformMfaController = _ts_decorate47([
10730
10921
  common.UsePipes(createAuthValidationPipe({
10731
10922
  forbidUnknownValues: true
10732
10923
  })),
10924
+ _ts_param26(0, common.Inject(exports.MfaService)),
10733
10925
  _ts_metadata46("design:type", Function),
10734
10926
  _ts_metadata46("design:paramtypes", [
10735
10927
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService
@@ -10746,12 +10938,12 @@ function _ts_metadata47(k, v) {
10746
10938
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10747
10939
  }
10748
10940
  __name(_ts_metadata47, "_ts_metadata");
10749
- function _ts_param26(paramIndex, decorator) {
10941
+ function _ts_param27(paramIndex, decorator) {
10750
10942
  return function(target, key) {
10751
10943
  decorator(target, key, paramIndex);
10752
10944
  };
10753
10945
  }
10754
- __name(_ts_param26, "_ts_param");
10946
+ __name(_ts_param27, "_ts_param");
10755
10947
  var SessionController = class {
10756
10948
  static {
10757
10949
  __name(this, "SessionController");
@@ -10831,8 +11023,8 @@ _ts_decorate48([
10831
11023
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
10832
11024
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
10833
11025
  common.Get(),
10834
- _ts_param26(0, CurrentUser()),
10835
- _ts_param26(1, common.Req()),
11026
+ _ts_param27(0, CurrentUser()),
11027
+ _ts_param27(1, common.Req()),
10836
11028
  _ts_metadata47("design:type", Function),
10837
11029
  _ts_metadata47("design:paramtypes", [
10838
11030
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -10845,8 +11037,8 @@ _ts_decorate48([
10845
11037
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
10846
11038
  common.HttpCode(common.HttpStatus.NO_CONTENT),
10847
11039
  common.Delete("all"),
10848
- _ts_param26(0, CurrentUser()),
10849
- _ts_param26(1, common.Req()),
11040
+ _ts_param27(0, CurrentUser()),
11041
+ _ts_param27(1, common.Req()),
10850
11042
  _ts_metadata47("design:type", Function),
10851
11043
  _ts_metadata47("design:paramtypes", [
10852
11044
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -10859,8 +11051,8 @@ _ts_decorate48([
10859
11051
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
10860
11052
  common.HttpCode(common.HttpStatus.NO_CONTENT),
10861
11053
  common.Delete(":id"),
10862
- _ts_param26(0, CurrentUser()),
10863
- _ts_param26(1, common.Param("id")),
11054
+ _ts_param27(0, CurrentUser()),
11055
+ _ts_param27(1, common.Param("id")),
10864
11056
  _ts_metadata47("design:type", Function),
10865
11057
  _ts_metadata47("design:paramtypes", [
10866
11058
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
@@ -10873,6 +11065,8 @@ SessionController = _ts_decorate48([
10873
11065
  common.Controller("sessions"),
10874
11066
  common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
10875
11067
  common.UsePipes(createAuthValidationPipe()),
11068
+ _ts_param27(0, common.Inject(exports.SessionService)),
11069
+ _ts_param27(1, common.Inject(exports.TokenDeliveryService)),
10876
11070
  _ts_metadata47("design:type", Function),
10877
11071
  _ts_metadata47("design:paramtypes", [
10878
11072
  typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
@@ -10890,6 +11084,12 @@ function _ts_metadata48(k, v) {
10890
11084
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10891
11085
  }
10892
11086
  __name(_ts_metadata48, "_ts_metadata");
11087
+ function _ts_param28(paramIndex, decorator) {
11088
+ return function(target, key) {
11089
+ decorator(target, key, paramIndex);
11090
+ };
11091
+ }
11092
+ __name(_ts_param28, "_ts_param");
10893
11093
  exports.MfaRequiredGuard = class MfaRequiredGuard {
10894
11094
  static {
10895
11095
  __name(this, "MfaRequiredGuard");
@@ -10918,6 +11118,7 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
10918
11118
  };
10919
11119
  exports.MfaRequiredGuard = _ts_decorate49([
10920
11120
  common.Injectable(),
11121
+ _ts_param28(0, common.Inject(core.Reflector)),
10921
11122
  _ts_metadata48("design:type", Function),
10922
11123
  _ts_metadata48("design:paramtypes", [
10923
11124
  typeof core.Reflector === "undefined" ? Object : core.Reflector
@@ -10938,12 +11139,12 @@ function _ts_metadata49(k, v) {
10938
11139
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10939
11140
  }
10940
11141
  __name(_ts_metadata49, "_ts_metadata");
10941
- function _ts_param27(paramIndex, decorator) {
11142
+ function _ts_param29(paramIndex, decorator) {
10942
11143
  return function(target, key) {
10943
11144
  decorator(target, key, paramIndex);
10944
11145
  };
10945
11146
  }
10946
- __name(_ts_param27, "_ts_param");
11147
+ __name(_ts_param29, "_ts_param");
10947
11148
  exports.PlatformRolesGuard = class PlatformRolesGuard {
10948
11149
  static {
10949
11150
  __name(this, "PlatformRolesGuard");
@@ -10979,7 +11180,8 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
10979
11180
  };
10980
11181
  exports.PlatformRolesGuard = _ts_decorate50([
10981
11182
  common.Injectable(),
10982
- _ts_param27(1, common.Inject(BYMAX_AUTH_OPTIONS)),
11183
+ _ts_param29(0, common.Inject(core.Reflector)),
11184
+ _ts_param29(1, common.Inject(BYMAX_AUTH_OPTIONS)),
10983
11185
  _ts_metadata49("design:type", Function),
10984
11186
  _ts_metadata49("design:paramtypes", [
10985
11187
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
@@ -11001,12 +11203,12 @@ function _ts_metadata50(k, v) {
11001
11203
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11002
11204
  }
11003
11205
  __name(_ts_metadata50, "_ts_metadata");
11004
- function _ts_param28(paramIndex, decorator) {
11206
+ function _ts_param30(paramIndex, decorator) {
11005
11207
  return function(target, key) {
11006
11208
  decorator(target, key, paramIndex);
11007
11209
  };
11008
11210
  }
11009
- __name(_ts_param28, "_ts_param");
11211
+ __name(_ts_param30, "_ts_param");
11010
11212
  exports.RolesGuard = class RolesGuard {
11011
11213
  static {
11012
11214
  __name(this, "RolesGuard");
@@ -11038,7 +11240,8 @@ exports.RolesGuard = class RolesGuard {
11038
11240
  };
11039
11241
  exports.RolesGuard = _ts_decorate51([
11040
11242
  common.Injectable(),
11041
- _ts_param28(1, common.Inject(BYMAX_AUTH_OPTIONS)),
11243
+ _ts_param30(0, common.Inject(core.Reflector)),
11244
+ _ts_param30(1, common.Inject(BYMAX_AUTH_OPTIONS)),
11042
11245
  _ts_metadata50("design:type", Function),
11043
11246
  _ts_metadata50("design:paramtypes", [
11044
11247
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
@@ -11118,12 +11321,12 @@ function _ts_metadata51(k, v) {
11118
11321
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11119
11322
  }
11120
11323
  __name(_ts_metadata51, "_ts_metadata");
11121
- function _ts_param29(paramIndex, decorator) {
11324
+ function _ts_param31(paramIndex, decorator) {
11122
11325
  return function(target, key) {
11123
11326
  decorator(target, key, paramIndex);
11124
11327
  };
11125
11328
  }
11126
- __name(_ts_param29, "_ts_param");
11329
+ __name(_ts_param31, "_ts_param");
11127
11330
  var OAUTH_STATE_TTL_SECONDS = 600;
11128
11331
  function isStoredOAuthState(value) {
11129
11332
  if (typeof value !== "object" || value === null) return false;
@@ -11377,11 +11580,14 @@ exports.OAuthService = class _OAuthService {
11377
11580
  };
11378
11581
  exports.OAuthService = _ts_decorate53([
11379
11582
  common.Injectable(),
11380
- _ts_param29(0, common.Inject(OAUTH_PLUGINS)),
11381
- _ts_param29(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
11382
- _ts_param29(2, common.Inject(BYMAX_AUTH_HOOKS)),
11383
- _ts_param29(2, common.Optional()),
11384
- _ts_param29(6, common.Inject(BYMAX_AUTH_OPTIONS)),
11583
+ _ts_param31(0, common.Inject(OAUTH_PLUGINS)),
11584
+ _ts_param31(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
11585
+ _ts_param31(2, common.Inject(BYMAX_AUTH_HOOKS)),
11586
+ _ts_param31(2, common.Optional()),
11587
+ _ts_param31(3, common.Inject(AuthRedisService)),
11588
+ _ts_param31(4, common.Inject(TokenManagerService)),
11589
+ _ts_param31(5, common.Inject(exports.SessionService)),
11590
+ _ts_param31(6, common.Inject(BYMAX_AUTH_OPTIONS)),
11385
11591
  _ts_metadata51("design:type", Function),
11386
11592
  _ts_metadata51("design:paramtypes", [
11387
11593
  Array,
@@ -11593,12 +11799,12 @@ function _ts_metadata54(k, v) {
11593
11799
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11594
11800
  }
11595
11801
  __name(_ts_metadata54, "_ts_metadata");
11596
- function _ts_param30(paramIndex, decorator) {
11802
+ function _ts_param32(paramIndex, decorator) {
11597
11803
  return function(target, key) {
11598
11804
  decorator(target, key, paramIndex);
11599
11805
  };
11600
11806
  }
11601
- __name(_ts_param30, "_ts_param");
11807
+ __name(_ts_param32, "_ts_param");
11602
11808
  function isOAuthMfaChallenge(result) {
11603
11809
  return "mfaRequired" in result && result.mfaRequired === true;
11604
11810
  }
@@ -11820,10 +12026,10 @@ _ts_decorate56([
11820
12026
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
11821
12027
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
11822
12028
  common.Get(":provider"),
11823
- _ts_param30(0, common.Param("provider")),
11824
- _ts_param30(1, common.Query()),
11825
- _ts_param30(2, common.Req()),
11826
- _ts_param30(3, common.Res({
12029
+ _ts_param32(0, common.Param("provider")),
12030
+ _ts_param32(1, common.Query()),
12031
+ _ts_param32(2, common.Req()),
12032
+ _ts_param32(3, common.Res({
11827
12033
  passthrough: true
11828
12034
  })),
11829
12035
  _ts_metadata54("design:type", Function),
@@ -11840,10 +12046,10 @@ _ts_decorate56([
11840
12046
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
11841
12047
  common.HttpCode(common.HttpStatus.OK),
11842
12048
  common.Get(":provider/callback"),
11843
- _ts_param30(0, common.Param("provider")),
11844
- _ts_param30(1, common.Query()),
11845
- _ts_param30(2, common.Req()),
11846
- _ts_param30(3, common.Res({
12049
+ _ts_param32(0, common.Param("provider")),
12050
+ _ts_param32(1, common.Query()),
12051
+ _ts_param32(2, common.Req()),
12052
+ _ts_param32(3, common.Res({
11847
12053
  passthrough: true
11848
12054
  })),
11849
12055
  _ts_metadata54("design:type", Function),
@@ -11864,7 +12070,9 @@ OAuthController = _ts_decorate56([
11864
12070
  common.UsePipes(createAuthValidationPipe({
11865
12071
  forbidUnknownValues: true
11866
12072
  })),
11867
- _ts_param30(2, common.Inject(BYMAX_AUTH_OPTIONS)),
12073
+ _ts_param32(0, common.Inject(exports.OAuthService)),
12074
+ _ts_param32(1, common.Inject(exports.TokenDeliveryService)),
12075
+ _ts_param32(2, common.Inject(BYMAX_AUTH_OPTIONS)),
11868
12076
  _ts_metadata54("design:type", Function),
11869
12077
  _ts_metadata54("design:paramtypes", [
11870
12078
  typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
@@ -12095,12 +12303,12 @@ function _ts_metadata55(k, v) {
12095
12303
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12096
12304
  }
12097
12305
  __name(_ts_metadata55, "_ts_metadata");
12098
- function _ts_param31(paramIndex, decorator) {
12306
+ function _ts_param33(paramIndex, decorator) {
12099
12307
  return function(target, key) {
12100
12308
  decorator(target, key, paramIndex);
12101
12309
  };
12102
12310
  }
12103
- __name(_ts_param31, "_ts_param");
12311
+ __name(_ts_param33, "_ts_param");
12104
12312
  var COMMON_BASE_WORDS = [
12105
12313
  // The perennial top of every published list.
12106
12314
  "password",
@@ -12349,7 +12557,7 @@ var LEET_MAP = /* @__PURE__ */ new Map([
12349
12557
  ]
12350
12558
  ]);
12351
12559
  function isDecoration(char) {
12352
- return /[\d\W_]/.test(char);
12560
+ return !new RegExp("\\p{L}", "u").test(char);
12353
12561
  }
12354
12562
  __name(isDecoration, "isDecoration");
12355
12563
  function stripTrailingDecoration(value) {
@@ -12363,7 +12571,7 @@ function reduceToBaseWord(password) {
12363
12571
  let reduced = "";
12364
12572
  for (const char of undecorated) {
12365
12573
  const mapped = LEET_MAP.get(char) ?? char;
12366
- if (/[a-z0-9]/.test(mapped)) reduced += mapped;
12574
+ if (/[\p{L}\p{N}]/u.test(mapped)) reduced += mapped;
12367
12575
  }
12368
12576
  return reduced;
12369
12577
  }
@@ -12397,7 +12605,9 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
12397
12605
  /** @inheritdoc */
12398
12606
  async isBreached(password) {
12399
12607
  const base = reduceToBaseWord(password);
12400
- if (base.length < 4) return true;
12608
+ if ([
12609
+ ...base
12610
+ ].length < 4) return true;
12401
12611
  if (this.blocked.has(base)) return true;
12402
12612
  if (isSequential(base)) return true;
12403
12613
  if (/^(.{1,4}?)\1{2,}$/.test(base)) return true;
@@ -12406,8 +12616,8 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
12406
12616
  };
12407
12617
  exports.CommonPasswordChecker = _ts_decorate58([
12408
12618
  common.Injectable(),
12409
- _ts_param31(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12410
- _ts_param31(0, common.Optional()),
12619
+ _ts_param33(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12620
+ _ts_param33(0, common.Optional()),
12411
12621
  _ts_metadata55("design:type", Function),
12412
12622
  _ts_metadata55("design:paramtypes", [
12413
12623
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -12867,12 +13077,12 @@ function _ts_metadata57(k, v) {
12867
13077
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12868
13078
  }
12869
13079
  __name(_ts_metadata57, "_ts_metadata");
12870
- function _ts_param32(paramIndex, decorator) {
13080
+ function _ts_param34(paramIndex, decorator) {
12871
13081
  return function(target, key) {
12872
13082
  decorator(target, key, paramIndex);
12873
13083
  };
12874
13084
  }
12875
- __name(_ts_param32, "_ts_param");
13085
+ __name(_ts_param34, "_ts_param");
12876
13086
  exports.SelfOrAdminGuard = class SelfOrAdminGuard {
12877
13087
  static {
12878
13088
  __name(this, "SelfOrAdminGuard");
@@ -12904,7 +13114,7 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
12904
13114
  };
12905
13115
  exports.SelfOrAdminGuard = _ts_decorate63([
12906
13116
  common.Injectable(),
12907
- _ts_param32(0, common.Inject(BYMAX_AUTH_OPTIONS)),
13117
+ _ts_param34(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12908
13118
  _ts_metadata57("design:type", Function),
12909
13119
  _ts_metadata57("design:paramtypes", [
12910
13120
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -12930,12 +13140,12 @@ function _ts_metadata58(k, v) {
12930
13140
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12931
13141
  }
12932
13142
  __name(_ts_metadata58, "_ts_metadata");
12933
- function _ts_param33(paramIndex, decorator) {
13143
+ function _ts_param35(paramIndex, decorator) {
12934
13144
  return function(target, key) {
12935
13145
  decorator(target, key, paramIndex);
12936
13146
  };
12937
13147
  }
12938
- __name(_ts_param33, "_ts_param");
13148
+ __name(_ts_param35, "_ts_param");
12939
13149
  exports.WsJwtGuard = class WsJwtGuard {
12940
13150
  static {
12941
13151
  __name(this, "WsJwtGuard");
@@ -13000,7 +13210,10 @@ exports.WsJwtGuard = class WsJwtGuard {
13000
13210
  };
13001
13211
  exports.WsJwtGuard = _ts_decorate64([
13002
13212
  common.Injectable(),
13003
- _ts_param33(3, common.Inject(BYMAX_AUTH_OPTIONS)),
13213
+ _ts_param35(0, common.Inject(jwt.JwtService)),
13214
+ _ts_param35(1, common.Inject(AuthRedisService)),
13215
+ _ts_param35(2, common.Inject(exports.WsTicketService)),
13216
+ _ts_param35(3, common.Inject(BYMAX_AUTH_OPTIONS)),
13004
13217
  _ts_metadata58("design:type", Function),
13005
13218
  _ts_metadata58("design:paramtypes", [
13006
13219
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,