@bymax-one/nest-auth 1.5.2 → 1.5.3

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.
@@ -192,12 +192,13 @@ function shannonEntropy(value) {
192
192
  }, 0);
193
193
  }
194
194
  __name(shannonEntropy, "shannonEntropy");
195
+ var AUTH_SECRET_MIN_LENGTH = 32;
195
196
  function validateSecretStrength(secret, name) {
196
197
  if (!secret) {
197
198
  throw new Error(`[BymaxAuthModule] ${name} is required and must not be empty. Generate a secure secret with: node -e "console.log(require('node:crypto').randomBytes(32).toString('base64'))"`);
198
199
  }
199
- if (secret.length < 32) {
200
- throw new Error(`[BymaxAuthModule] ${name} must be at least 32 characters long. Generate a secure secret with: node -e "console.log(require('node:crypto').randomBytes(32).toString('base64'))"`);
200
+ if (secret.length < AUTH_SECRET_MIN_LENGTH) {
201
+ throw new Error(`[BymaxAuthModule] ${name} must be at least ${AUTH_SECRET_MIN_LENGTH} characters long. Generate a secure secret with: node -e "console.log(require('node:crypto').randomBytes(32).toString('base64'))"`);
201
202
  }
202
203
  const entropy = shannonEntropy(secret);
203
204
  if (entropy < 3.5) {
@@ -365,6 +366,112 @@ __name(durationToSeconds, "durationToSeconds");
365
366
  // src/server/constants/workspace-roles.ts
366
367
  var ANY_WORKSPACE_MEMBER = /* @__PURE__ */ Symbol("ANY_WORKSPACE_MEMBER");
367
368
 
369
+ // src/server/utils/workspace-cursor.ts
370
+ var WORKSPACE_CURSOR_MAX_LENGTH = 4096;
371
+ var WORKSPACE_CURSOR_PART_MAX_LENGTH = 128;
372
+ var WORKSPACE_OWNER_ROLE_MAX_LENGTH = 32;
373
+ var INSTANT_LENGTH = 24;
374
+ var UNPAIRED_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
375
+ function hasControlCharacter(text) {
376
+ for (const character of text) {
377
+ if (character <= "" || character >= "\x7F" && character <= "\x9F") return true;
378
+ }
379
+ return false;
380
+ }
381
+ __name(hasControlCharacter, "hasControlCharacter");
382
+ function isWorkspaceOwnerRole(role) {
383
+ const length = Array.from(role).length;
384
+ return length >= 1 && length <= WORKSPACE_OWNER_ROLE_MAX_LENGTH && !hasControlCharacter(role) && !UNPAIRED_SURROGATE.test(role);
385
+ }
386
+ __name(isWorkspaceOwnerRole, "isWorkspaceOwnerRole");
387
+ function workspaceQueryKey(...parts) {
388
+ return JSON.stringify(parts);
389
+ }
390
+ __name(workspaceQueryKey, "workspaceQueryKey");
391
+ function workspacePositionOf(at, id) {
392
+ return at.toISOString() + id;
393
+ }
394
+ __name(workspacePositionOf, "workspacePositionOf");
395
+ function readWorkspacePosition(position) {
396
+ const instant = position.slice(0, INSTANT_LENGTH);
397
+ const at = new Date(instant);
398
+ if (Number.isNaN(at.getTime()) || at.toISOString() !== instant) return void 0;
399
+ return {
400
+ at,
401
+ id: position.slice(INSTANT_LENGTH)
402
+ };
403
+ }
404
+ __name(readWorkspacePosition, "readWorkspacePosition");
405
+ function describeOverflow(query, position) {
406
+ const part = keyParts(query).find(({ length }) => length > WORKSPACE_CURSOR_PART_MAX_LENGTH);
407
+ if (part !== void 0) {
408
+ return `query key part ${part.index} is ${part.length} code points, over ${WORKSPACE_CURSOR_PART_MAX_LENGTH}`;
409
+ }
410
+ return `the query key is ${query.length} characters and the position ${position.length}`;
411
+ }
412
+ __name(describeOverflow, "describeOverflow");
413
+ function whyUnreadable(position) {
414
+ if (readWorkspacePosition(position) === void 0) {
415
+ return "it is not a canonical instant followed by an id";
416
+ }
417
+ const id = position.slice(INSTANT_LENGTH);
418
+ if (id === "") return "its id is empty";
419
+ const length = Array.from(id).length;
420
+ if (length > WORKSPACE_CURSOR_PART_MAX_LENGTH) {
421
+ return `position id is ${length} code points, over ${WORKSPACE_CURSOR_PART_MAX_LENGTH}`;
422
+ }
423
+ if (hasControlCharacter(id) || UNPAIRED_SURROGATE.test(id)) {
424
+ return "its id holds a control character or an unpaired surrogate";
425
+ }
426
+ return void 0;
427
+ }
428
+ __name(whyUnreadable, "whyUnreadable");
429
+ function keyParts(query) {
430
+ try {
431
+ const parsed = JSON.parse(query);
432
+ if (!Array.isArray(parsed)) return [];
433
+ return parsed.map((part, index) => ({
434
+ index: index + 1,
435
+ length: typeof part === "string" ? Array.from(part).length : 0
436
+ }));
437
+ } catch {
438
+ return [];
439
+ }
440
+ }
441
+ __name(keyParts, "keyParts");
442
+ function encodeWorkspaceCursor(query, position) {
443
+ const reason = whyUnreadable(position);
444
+ if (reason !== void 0) {
445
+ throw new RangeError(`workspace cursor position is refused because ${reason}: the decoder reads it as the first page, so the cursor could never be followed`);
446
+ }
447
+ const cursor = Buffer.from(JSON.stringify([
448
+ query,
449
+ position
450
+ ])).toString("base64url");
451
+ if (cursor.length > WORKSPACE_CURSOR_MAX_LENGTH) {
452
+ throw new RangeError(`workspace cursor is ${cursor.length} characters, over the ${WORKSPACE_CURSOR_MAX_LENGTH} maximum: ${describeOverflow(query, position)}`);
453
+ }
454
+ return cursor;
455
+ }
456
+ __name(encodeWorkspaceCursor, "encodeWorkspaceCursor");
457
+ function decodeWorkspaceCursor(cursor, query) {
458
+ if (typeof cursor !== "string" || cursor.length > WORKSPACE_CURSOR_MAX_LENGTH) return void 0;
459
+ try {
460
+ const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
461
+ if (!Array.isArray(parsed) || parsed.length !== 2) return void 0;
462
+ const [issuedFor, position] = parsed;
463
+ if (issuedFor !== query || typeof position !== "string") return void 0;
464
+ if (whyUnreadable(position) !== void 0) return void 0;
465
+ return Buffer.from(JSON.stringify([
466
+ query,
467
+ position
468
+ ])).toString("base64url") === cursor ? position : void 0;
469
+ } catch {
470
+ return void 0;
471
+ }
472
+ }
473
+ __name(decodeWorkspaceCursor, "decodeWorkspaceCursor");
474
+
368
475
  // src/server/config/workspace-options.ts
369
476
  var WORKSPACE_INVITATION_MAX_TTL_SECONDS = 2592e3;
370
477
  var WORKSPACE_MEMBERSHIP_CACHE_MAX_TTL_SECONDS = 3600;
@@ -390,6 +497,9 @@ function validateWorkspaceRoles(roles) {
390
497
  if (typeof ownerRole !== "string" || !names.has(ownerRole)) {
391
498
  throw new Error(`[BymaxAuthModule] workspaces.roles.ownerRole must be a role of the hierarchy.`);
392
499
  }
500
+ if (!isWorkspaceOwnerRole(ownerRole)) {
501
+ throw new Error(`[BymaxAuthModule] workspaces.roles.ownerRole '${ownerRole}' must be 1 to ${WORKSPACE_OWNER_ROLE_MAX_LENGTH} code points of well-formed text with no control character (the role is part of a paging cursor).`);
502
+ }
393
503
  for (const [role, included] of Object.entries(hierarchy)) {
394
504
  if (role !== ownerRole && included.includes(ownerRole)) {
395
505
  throw new Error(`[BymaxAuthModule] workspaces.roles.hierarchy: '${role}' must not include the owner role '${ownerRole}'. A role that includes the owner holds every owner permission.`);
@@ -890,7 +1000,7 @@ function validatePreviousSecrets(jwt) {
890
1000
  if (typeof secret !== "string") {
891
1001
  throw new Error(`[BymaxAuthModule] jwt.previousSecrets[${index}] must be a string. Every entry still verifies tokens, so each is held to the same rules as jwt.secret.`);
892
1002
  }
893
- validateSecretStrength(secret, "jwt.secret");
1003
+ validateSecretStrength(secret, `jwt.previousSecrets[${index}]`);
894
1004
  if (seen.has(secret)) {
895
1005
  throw new Error(`[BymaxAuthModule] jwt.previousSecrets[${index}] repeats jwt.secret or an earlier entry. A retired secret equal to the current one means the rotation did not happen, and a configuration that reads as rotated while nothing changed is worse than one that never claimed to.`);
896
1006
  }
@@ -8943,6 +9053,14 @@ _ts_decorate24([
8943
9053
  Length(64, 64),
8944
9054
  _ts_metadata23("design:type", String)
8945
9055
  ], ConfirmEmailChangeDto.prototype, "token", void 0);
9056
+
9057
+ // src/server/constants/reproof-counter.ts
9058
+ function reproofCounterId(flow, userId, tenantId, hmacKey) {
9059
+ return hmacSha256(`reauth:${flow}:${userSubject("dashboard", userId, tenantId)}`, hmacKey);
9060
+ }
9061
+ __name(reproofCounterId, "reproofCounterId");
9062
+
9063
+ // src/server/services/email-change.service.ts
8946
9064
  function _ts_decorate25(decorators, target, key, desc) {
8947
9065
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8948
9066
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -9039,7 +9157,7 @@ var EmailChangeService = class _EmailChangeService {
9039
9157
  if (!user?.passwordHash) {
9040
9158
  throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
9041
9159
  }
9042
- const bfIdentifier = hmacSha256(`reauth:email-change:${userSubject("dashboard", userId, tenantId)}`, this.options.hmacKey);
9160
+ const bfIdentifier = reproofCounterId("email-change", userId, tenantId, this.options.hmacKey);
9043
9161
  if (await this.bruteForce.isLockedOut(bfIdentifier)) {
9044
9162
  this.logger.warn(`requestChange: account locked userId=${logSafe(userId)}`);
9045
9163
  throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
@@ -10488,52 +10606,26 @@ var MfaFlowLockoutService = class {
10488
10606
  this.bruteForce = bruteForce;
10489
10607
  }
10490
10608
  /**
10491
- * The tenant-scoped brute-force identifier for one MFA flow, and the plane-only one that pods on
10492
- * an older version count under. The two are equal on the platform plane, where the subject
10493
- * carries no tenant, and distinct on the dashboard plane, where it does.
10494
- *
10495
- * A rolling upgrade runs old and new code against one Redis at once: on the dashboard plane an
10496
- * old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
10497
- * `{flow}:{userSubject}`, and either alone leaves a hole: a lockout an old pod filled would not
10498
- * stop a new pod, and a success on one would not clear the other. So every read consults both
10499
- * and every write touches both, and the two move as one; the plane-only arm can be dropped once
10500
- * no pod writes it. On the platform plane the two ids are identical, so the plane-only arm is
10501
- * skipped: operating it would be the same key a second time, double-counting a failure and
10502
- * locking a platform admin out at half the threshold. `{flow}` (`challenge` / `disable` /
10503
- * `reauth`) keeps the three counters isolated from each other.
10609
+ * The brute-force identifier for one MFA flow: the flow and the account's length-prefixed subject,
10610
+ * which carries the tenant on the dashboard plane. Two tenants' user `1` therefore count under
10611
+ * different identifiers, so one tenant's failures can neither lock the other's account out nor be
10612
+ * cleared by it. `{flow}` (`challenge` / `disable` / `reauth`) keeps the three counters isolated
10613
+ * from each other.
10504
10614
  */
10505
- counterIds(flow, context, userId, tenantId) {
10506
- return {
10507
- legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
10508
- scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
10509
- };
10615
+ counterId(flow, context, userId, tenantId) {
10616
+ return hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey);
10510
10617
  }
10511
- /**
10512
- * Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
10513
- * neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
10514
- */
10618
+ /** Whether the account's counter for this flow has reached the lockout threshold. */
10515
10619
  async isLockedOut(flow, context, userId, tenantId) {
10516
- const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
10517
- if (await this.bruteForce.isLockedOut(scoped)) return true;
10518
- return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
10620
+ return this.bruteForce.isLockedOut(this.counterId(flow, context, userId, tenantId));
10519
10621
  }
10520
- /**
10521
- * Records the failure under both counters so the budget an attacker spends is seen by old and
10522
- * new code alike — but under the scoped id ONCE when the two coincide (platform plane).
10523
- */
10622
+ /** Records a failed attempt against the account's counter for this flow. */
10524
10623
  async recordFailure(flow, context, userId, tenantId) {
10525
- const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
10526
- await this.bruteForce.recordFailure(scoped);
10527
- if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
10624
+ await this.bruteForce.recordFailure(this.counterId(flow, context, userId, tenantId));
10528
10625
  }
10529
- /**
10530
- * Clears both counters on success — resetting only one would leave the other to lock a
10531
- * legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
10532
- */
10626
+ /** Clears the account's counter for this flow, on a success. */
10533
10627
  async reset(flow, context, userId, tenantId) {
10534
- const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
10535
- await this.bruteForce.resetFailures(scoped);
10536
- if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
10628
+ await this.bruteForce.resetFailures(this.counterId(flow, context, userId, tenantId));
10537
10629
  }
10538
10630
  };
10539
10631
  MfaFlowLockoutService = _ts_decorate37([
@@ -10790,19 +10882,9 @@ var MfaRecordService = class {
10790
10882
  * @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
10791
10883
  */
10792
10884
  async transition(context, userId, tenantId, mutate) {
10793
- const scopedLockKey = `mfalock:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
10794
- const legacyLockKey = `mfalock:${hmacSha256(`${context}:${userId}`, this.options.hmacKey)}`;
10795
- const acquireLegacy = legacyLockKey !== scopedLockKey;
10885
+ const lockKey = `mfalock:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
10796
10886
  const lockToken = randomBytes(16).toString("hex");
10797
- if (!await this.redis.setIfAbsent(scopedLockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
10798
- throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
10799
- }
10800
- if (acquireLegacy && !await this.redis.setIfAbsent(legacyLockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
10801
- await this.redis.eval(RELEASE_LOCK_LUA, [
10802
- scopedLockKey
10803
- ], [
10804
- lockToken
10805
- ]);
10887
+ if (!await this.redis.setIfAbsent(lockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
10806
10888
  throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
10807
10889
  }
10808
10890
  try {
@@ -10827,17 +10909,10 @@ var MfaRecordService = class {
10827
10909
  return true;
10828
10910
  } finally {
10829
10911
  await this.redis.eval(RELEASE_LOCK_LUA, [
10830
- scopedLockKey
10912
+ lockKey
10831
10913
  ], [
10832
10914
  lockToken
10833
10915
  ]);
10834
- if (acquireLegacy) {
10835
- await this.redis.eval(RELEASE_LOCK_LUA, [
10836
- legacyLockKey
10837
- ], [
10838
- lockToken
10839
- ]);
10840
- }
10841
10916
  }
10842
10917
  }
10843
10918
  /**
@@ -10879,21 +10954,13 @@ var MfaRecordService = class {
10879
10954
  * both the subject and the code value prevents code disclosure in Redis and cross-user,
10880
10955
  * cross-tenant and cross-plane replay alike.
10881
10956
  *
10882
- * A second marker under the plane-only preimage `{context}:{userId}:{code}` is written and
10883
- * required alongside it; see the call site for why both must be fresh while pods of two
10884
- * versions are live.
10885
- *
10886
10957
  * @returns `true` if the code is valid and has not been replayed, `false` otherwise.
10887
10958
  */
10888
10959
  async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
10889
10960
  if (!verifyTotp(secretBase32, code, window)) return false;
10890
10961
  const ttl = totpAntiReplayTtlSeconds(window);
10891
- const scopedReplayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
10892
- const legacyReplayKey = `tu:${hmacSha256(`${context}:${userId}:${code}`, this.options.hmacKey)}`;
10893
- const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
10894
- if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
10895
- const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
10896
- return scopedIsNew && legacyIsNew;
10962
+ const replayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
10963
+ return await this.redis.setnx(replayKey, ttl);
10897
10964
  }
10898
10965
  /**
10899
10966
  * Fetches a user from the correct repository based on the MFA context, and refuses one whose
@@ -13318,7 +13385,7 @@ var PasswordResetService = class _PasswordResetService {
13318
13385
  if (!user?.passwordHash) {
13319
13386
  throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
13320
13387
  }
13321
- const bfIdentifier = hmacSha256(`reauth:change-password:${userSubject("dashboard", userId, tenantId)}`, this.options.hmacKey);
13388
+ const bfIdentifier = reproofCounterId("change-password", userId, tenantId, this.options.hmacKey);
13322
13389
  if (await this.bruteForce.isLockedOut(bfIdentifier)) {
13323
13390
  this.logger.warn(`changePassword: account locked userId=${logSafe(userId)}`);
13324
13391
  throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
@@ -15203,7 +15270,8 @@ var WorkspacePageQueryDto = class {
15203
15270
  /**
15204
15271
  * The `nextCursor` of the previous page; absent for the first page.
15205
15272
  *
15206
- * `@MaxLength(512)` keeps an oversized value away from the repository.
15273
+ * The length bound is the one the cursor codec reads, so a cursor the library issues is always one
15274
+ * this accepts, and an oversized value stays away from the repository.
15207
15275
  */
15208
15276
  cursor;
15209
15277
  /**
@@ -15217,7 +15285,7 @@ _ts_decorate62([
15217
15285
  IsOptional(),
15218
15286
  IsString(),
15219
15287
  IsNotEmpty(),
15220
- MaxLength(512),
15288
+ MaxLength(WORKSPACE_CURSOR_MAX_LENGTH),
15221
15289
  Matches(NO_CONTROL_CHARACTERS, {
15222
15290
  message: "cursor must not contain control characters"
15223
15291
  }),
@@ -15287,8 +15355,8 @@ function membershipCacheKeyBase(tenantId, workspaceId, userId, hmacKey) {
15287
15355
  __name(membershipCacheKeyBase, "membershipCacheKeyBase");
15288
15356
 
15289
15357
  // src/server/utils/resolve-request-workspace.ts
15290
- var MAX_WORKSPACE_ID_LENGTH = 128;
15291
- var WORKSPACE_ID_RULE = `workspaceId must be 1 to ${MAX_WORKSPACE_ID_LENGTH} characters, not blank, with no control characters`;
15358
+ var WORKSPACE_ID_MAX_LENGTH = 128;
15359
+ var WORKSPACE_ID_RULE = `workspaceId must be 1 to ${WORKSPACE_ID_MAX_LENGTH} code points, not blank, with no control characters`;
15292
15360
  function invalidWorkspaceId(message) {
15293
15361
  throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
15294
15362
  {
@@ -15299,7 +15367,7 @@ function invalidWorkspaceId(message) {
15299
15367
  }
15300
15368
  __name(invalidWorkspaceId, "invalidWorkspaceId");
15301
15369
  function assertWorkspaceId(value) {
15302
- if (typeof value !== "string" || value.trim() === "" || exceedsCodePoints(value, MAX_WORKSPACE_ID_LENGTH) || !NO_CONTROL_CHARACTERS.test(value)) {
15370
+ if (typeof value !== "string" || value.trim() === "" || exceedsCodePoints(value, WORKSPACE_ID_MAX_LENGTH) || !NO_CONTROL_CHARACTERS.test(value)) {
15303
15371
  return invalidWorkspaceId(WORKSPACE_ID_RULE);
15304
15372
  }
15305
15373
  return value;
@@ -20209,6 +20277,32 @@ function isStoredOAuthState(value) {
20209
20277
  }
20210
20278
  __name(isStoredOAuthState, "isStoredOAuthState");
20211
20279
 
20280
+ // src/server/oauth/plugin-deadline.ts
20281
+ var OAUTH_PLUGIN_DEFAULT_TIMEOUT_MS = 1e4;
20282
+ var OAUTH_PLUGIN_MAX_TIMEOUT_MS = 12e4;
20283
+ function pluginDeadlineMs(plugin) {
20284
+ const { timeoutMs } = plugin;
20285
+ return typeof timeoutMs === "number" && Number.isInteger(timeoutMs) && timeoutMs >= 1 && timeoutMs <= OAUTH_PLUGIN_MAX_TIMEOUT_MS ? timeoutMs : OAUTH_PLUGIN_DEFAULT_TIMEOUT_MS;
20286
+ }
20287
+ __name(pluginDeadlineMs, "pluginDeadlineMs");
20288
+ async function withDeadline(work, ms) {
20289
+ let timer;
20290
+ const expiry = new Promise((_resolve, reject) => {
20291
+ timer = setTimeout(() => {
20292
+ reject(new Error(`the plugin did not answer within ${ms} ms`));
20293
+ }, ms);
20294
+ });
20295
+ try {
20296
+ return await Promise.race([
20297
+ work(),
20298
+ expiry
20299
+ ]);
20300
+ } finally {
20301
+ clearTimeout(timer);
20302
+ }
20303
+ }
20304
+ __name(withDeadline, "withDeadline");
20305
+
20212
20306
  // src/server/constants/oauth-state-cookie.ts
20213
20307
  var OAUTH_STATE_COOKIE_NAME = "oauth_state";
20214
20308
  var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
@@ -20571,12 +20665,15 @@ var OAuthService = class _OAuthService {
20571
20665
  * @param code - The authorization code.
20572
20666
  * @param codeVerifier - The PKCE verifier stored with the state.
20573
20667
  * @returns The normalized profile.
20574
- * @throws `AuthException(OAUTH_FAILED)` when the exchange or the fetch fails.
20668
+ * @throws `AuthException(OAUTH_FAILED)` when the exchange or the fetch fails, or the plugin's
20669
+ * deadline passes first.
20575
20670
  */
20576
20671
  async fetchProfile(plugin, provider, code, codeVerifier) {
20577
20672
  try {
20578
- const tokenResponse = await plugin.exchangeCode(code, codeVerifier);
20579
- return await plugin.fetchProfile(tokenResponse.access_token);
20673
+ return await withDeadline(async () => {
20674
+ const tokenResponse = await plugin.exchangeCode(code, codeVerifier);
20675
+ return await plugin.fetchProfile(tokenResponse.access_token);
20676
+ }, pluginDeadlineMs(plugin));
20580
20677
  } catch (err) {
20581
20678
  this.logger.error(`OAuth plugin '${provider}' failed during code exchange or profile fetch: ` + describeChannelStatus(err));
20582
20679
  throw new AuthException(AUTH_ERROR_CODES.OAUTH_FAILED);
@@ -21296,6 +21393,11 @@ var GoogleOAuthPlugin = class {
21296
21393
  }
21297
21394
  /** Stable provider identifier used as a route segment and storage key. */
21298
21395
  name = "google";
21396
+ /**
21397
+ * The library's deadline for the two requests together: each is bounded at 10 s by its own abort
21398
+ * signal, so the pair is 20 s and the library never cuts in before the plugin's own bound.
21399
+ */
21400
+ timeoutMs = 2e4;
21299
21401
  clientId;
21300
21402
  /** The Google client secret, withheld from serialization. */
21301
21403
  #clientSecret;
@@ -22189,7 +22291,7 @@ var REQUEST_SCHEMAS = {
22189
22291
  "cursor": {
22190
22292
  "type": "string",
22191
22293
  "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]+$",
22192
- "maxLength": 512,
22294
+ "maxLength": 4096,
22193
22295
  "minLength": 1
22194
22296
  },
22195
22297
  "limit": {
@@ -23135,6 +23237,164 @@ var NoOpEmailProvider = class _NoOpEmailProvider {
23135
23237
  NoOpEmailProvider = _ts_decorate97([
23136
23238
  Injectable()
23137
23239
  ], NoOpEmailProvider);
23240
+ function _ts_decorate98(decorators, target, key, desc) {
23241
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23242
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
23243
+ r = Reflect.decorate(decorators, target, key, desc);
23244
+ } else {
23245
+ for (var i = decorators.length - 1; i >= 0; i--) {
23246
+ if (d = decorators[i]) {
23247
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
23248
+ }
23249
+ }
23250
+ }
23251
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23252
+ }
23253
+ __name(_ts_decorate98, "_ts_decorate");
23254
+ function _ts_metadata94(metadataKey, metadataValue) {
23255
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
23256
+ return Reflect.metadata(metadataKey, metadataValue);
23257
+ }
23258
+ }
23259
+ __name(_ts_metadata94, "_ts_metadata");
23260
+ function _ts_param59(paramIndex, decorator) {
23261
+ return function(target, key) {
23262
+ decorator(target, key, paramIndex);
23263
+ };
23264
+ }
23265
+ __name(_ts_param59, "_ts_param");
23266
+ var STARTUP_PING_TIMEOUT_MS = 5e3;
23267
+ var STARTUP_PING_RETRY_MS = 250;
23268
+ var CONNECTING_STATES = [
23269
+ "connecting",
23270
+ "connect",
23271
+ "reconnecting"
23272
+ ];
23273
+ function commandTimeoutOf(client) {
23274
+ const options = client.options;
23275
+ if (typeof options !== "object" || options === null) return void 0;
23276
+ const own = options.commandTimeout;
23277
+ const nested = options.redisOptions?.commandTimeout;
23278
+ const found = typeof own === "number" ? own : nested;
23279
+ return typeof found === "number" ? found : void 0;
23280
+ }
23281
+ __name(commandTimeoutOf, "commandTimeoutOf");
23282
+ function addressOf(client) {
23283
+ const options = client.options;
23284
+ if (options?.path != null || options?.sentinels != null) return void 0;
23285
+ const host = options?.host;
23286
+ const port = options?.port;
23287
+ if (typeof host !== "string" || typeof port !== "number") return void 0;
23288
+ if (!/^[A-Za-z0-9._:%-]+$/.test(host)) return void 0;
23289
+ return host.includes(":") ? `[${host}]:${port}` : `${host}:${port}`;
23290
+ }
23291
+ __name(addressOf, "addressOf");
23292
+ function pause(ms) {
23293
+ return new Promise((resolve) => setTimeout(resolve, ms));
23294
+ }
23295
+ __name(pause, "pause");
23296
+ var RedisReadinessService = class _RedisReadinessService {
23297
+ static {
23298
+ __name(this, "RedisReadinessService");
23299
+ }
23300
+ redis;
23301
+ logger = new Logger(_RedisReadinessService.name);
23302
+ constructor(redis) {
23303
+ this.redis = redis;
23304
+ }
23305
+ /**
23306
+ * Waits for a client that is on its way to `ready`, and refuses one that has ended. A client in
23307
+ * any other state is left to the command, which is what starts a lazy connection.
23308
+ *
23309
+ * @param timeoutMs - The time left in the budget.
23310
+ * @throws {Error} When the client ends, or does not become ready in time.
23311
+ */
23312
+ whenReachable(timeoutMs) {
23313
+ const { status } = this.redis;
23314
+ if (status === "end") {
23315
+ return Promise.reject(new Error("the client is closed"));
23316
+ }
23317
+ if (!CONNECTING_STATES.includes(status)) return Promise.resolve();
23318
+ return new Promise((resolve, reject) => {
23319
+ const settle = /* @__PURE__ */ __name((done) => {
23320
+ clearTimeout(timer);
23321
+ this.redis.off("ready", onReady);
23322
+ this.redis.off("end", onEnd);
23323
+ done();
23324
+ }, "settle");
23325
+ const onReady = /* @__PURE__ */ __name(() => {
23326
+ settle(resolve);
23327
+ }, "onReady");
23328
+ const onEnd = /* @__PURE__ */ __name(() => {
23329
+ settle(() => {
23330
+ reject(new Error("the client gave up connecting"));
23331
+ });
23332
+ }, "onEnd");
23333
+ const timer = setTimeout(() => {
23334
+ settle(() => {
23335
+ reject(new Error("the client did not become ready"));
23336
+ });
23337
+ }, timeoutMs);
23338
+ this.redis.once("ready", onReady);
23339
+ this.redis.once("end", onEnd);
23340
+ });
23341
+ }
23342
+ /**
23343
+ * One PING attempt: waits for the client if it is connecting, then sends the command.
23344
+ *
23345
+ * @param timeoutMs - The time left in the budget; the attempt gives up when it runs out.
23346
+ * @throws {Error} When the client is closed, the command fails or the time runs out.
23347
+ */
23348
+ async attempt(timeoutMs) {
23349
+ let timer;
23350
+ const expiry = new Promise((_resolve, reject) => {
23351
+ timer = setTimeout(() => {
23352
+ reject(new Error("the PING did not complete in time"));
23353
+ }, timeoutMs);
23354
+ });
23355
+ try {
23356
+ await Promise.race([
23357
+ this.whenReachable(timeoutMs).then(() => this.redis.ping()),
23358
+ expiry
23359
+ ]);
23360
+ } finally {
23361
+ clearTimeout(timer);
23362
+ }
23363
+ }
23364
+ /**
23365
+ * @throws {Error} When the client cannot PING, or Redis does not answer within the budget. The
23366
+ * message names the address from the client's own `host` and `port` and never repeats what
23367
+ * ioredis raised, which can quote a connection string.
23368
+ */
23369
+ async onApplicationBootstrap() {
23370
+ if (commandTimeoutOf(this.redis) === void 0) {
23371
+ this.logger.warn("The Redis client has no commandTimeout, so a slow or unreachable Redis holds each request until ioredis gives up. Set commandTimeout, a small maxRetriesPerRequest and a bounded retryStrategy on the client you provide as BYMAX_AUTH_REDIS_CLIENT.");
23372
+ }
23373
+ if (typeof this.redis.ping !== "function") {
23374
+ throw new Error("[BymaxAuthModule] BYMAX_AUTH_REDIS_CLIENT must be an ioredis client.");
23375
+ }
23376
+ const budgetEnd = Date.now() + STARTUP_PING_TIMEOUT_MS;
23377
+ for (; ; ) {
23378
+ try {
23379
+ await this.attempt(Math.max(budgetEnd - Date.now(), 1));
23380
+ return;
23381
+ } catch {
23382
+ if (this.redis.status === "end" || budgetEnd - Date.now() <= STARTUP_PING_RETRY_MS) break;
23383
+ await pause(STARTUP_PING_RETRY_MS);
23384
+ }
23385
+ }
23386
+ const address = addressOf(this.redis);
23387
+ throw new Error(`[BymaxAuthModule] Redis${address === void 0 ? "" : ` at ${address}`} did not answer PING within ${STARTUP_PING_TIMEOUT_MS} ms at startup. Check the address, the credentials and the network.`);
23388
+ }
23389
+ };
23390
+ RedisReadinessService = _ts_decorate98([
23391
+ Injectable(),
23392
+ _ts_param59(0, Inject(BYMAX_AUTH_REDIS_CLIENT)),
23393
+ _ts_metadata94("design:type", Function),
23394
+ _ts_metadata94("design:paramtypes", [
23395
+ typeof Redis === "undefined" ? Object : Redis
23396
+ ])
23397
+ ], RedisReadinessService);
23138
23398
 
23139
23399
  // src/server/services/api-key-clock.ts
23140
23400
  var SystemApiKeyClock = class {
@@ -23146,7 +23406,7 @@ var SystemApiKeyClock = class {
23146
23406
  return /* @__PURE__ */ new Date();
23147
23407
  }
23148
23408
  };
23149
- function _ts_decorate98(decorators, target, key, desc) {
23409
+ function _ts_decorate99(decorators, target, key, desc) {
23150
23410
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23151
23411
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
23152
23412
  r = Reflect.decorate(decorators, target, key, desc);
@@ -23159,19 +23419,19 @@ function _ts_decorate98(decorators, target, key, desc) {
23159
23419
  }
23160
23420
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23161
23421
  }
23162
- __name(_ts_decorate98, "_ts_decorate");
23163
- function _ts_metadata94(metadataKey, metadataValue) {
23422
+ __name(_ts_decorate99, "_ts_decorate");
23423
+ function _ts_metadata95(metadataKey, metadataValue) {
23164
23424
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
23165
23425
  return Reflect.metadata(metadataKey, metadataValue);
23166
23426
  }
23167
23427
  }
23168
- __name(_ts_metadata94, "_ts_metadata");
23169
- function _ts_param59(paramIndex, decorator) {
23428
+ __name(_ts_metadata95, "_ts_metadata");
23429
+ function _ts_param60(paramIndex, decorator) {
23170
23430
  return function(target, key) {
23171
23431
  decorator(target, key, paramIndex);
23172
23432
  };
23173
23433
  }
23174
- __name(_ts_param59, "_ts_param");
23434
+ __name(_ts_param60, "_ts_param");
23175
23435
  var ApiKeyScopeAuditService = class {
23176
23436
  static {
23177
23437
  __name(this, "ApiKeyScopeAuditService");
@@ -23214,21 +23474,21 @@ var ApiKeyScopeAuditService = class {
23214
23474
  }
23215
23475
  }
23216
23476
  };
23217
- ApiKeyScopeAuditService = _ts_decorate98([
23477
+ ApiKeyScopeAuditService = _ts_decorate99([
23218
23478
  Injectable(),
23219
- _ts_param59(0, Inject(DiscoveryService)),
23220
- _ts_param59(1, Inject(MetadataScanner)),
23221
- _ts_param59(2, Inject(Reflector)),
23222
- _ts_param59(3, Inject(BYMAX_AUTH_OPTIONS)),
23223
- _ts_metadata94("design:type", Function),
23224
- _ts_metadata94("design:paramtypes", [
23479
+ _ts_param60(0, Inject(DiscoveryService)),
23480
+ _ts_param60(1, Inject(MetadataScanner)),
23481
+ _ts_param60(2, Inject(Reflector)),
23482
+ _ts_param60(3, Inject(BYMAX_AUTH_OPTIONS)),
23483
+ _ts_metadata95("design:type", Function),
23484
+ _ts_metadata95("design:paramtypes", [
23225
23485
  typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
23226
23486
  typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
23227
23487
  typeof Reflector === "undefined" ? Object : Reflector,
23228
23488
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
23229
23489
  ])
23230
23490
  ], ApiKeyScopeAuditService);
23231
- function _ts_decorate99(decorators, target, key, desc) {
23491
+ function _ts_decorate100(decorators, target, key, desc) {
23232
23492
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23233
23493
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
23234
23494
  r = Reflect.decorate(decorators, target, key, desc);
@@ -23241,19 +23501,19 @@ function _ts_decorate99(decorators, target, key, desc) {
23241
23501
  }
23242
23502
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23243
23503
  }
23244
- __name(_ts_decorate99, "_ts_decorate");
23245
- function _ts_metadata95(metadataKey, metadataValue) {
23504
+ __name(_ts_decorate100, "_ts_decorate");
23505
+ function _ts_metadata96(metadataKey, metadataValue) {
23246
23506
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
23247
23507
  return Reflect.metadata(metadataKey, metadataValue);
23248
23508
  }
23249
23509
  }
23250
- __name(_ts_metadata95, "_ts_metadata");
23251
- function _ts_param60(paramIndex, decorator) {
23510
+ __name(_ts_metadata96, "_ts_metadata");
23511
+ function _ts_param61(paramIndex, decorator) {
23252
23512
  return function(target, key) {
23253
23513
  decorator(target, key, paramIndex);
23254
23514
  };
23255
23515
  }
23256
- __name(_ts_param60, "_ts_param");
23516
+ __name(_ts_param61, "_ts_param");
23257
23517
  var API_KEY_MAX_LABEL_LENGTH = 128;
23258
23518
  var API_KEY_MAX_OVERLAP_SECONDS = 2592e3;
23259
23519
  var CONTROL_CHARACTERS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
@@ -23391,13 +23651,13 @@ var ApiKeyService = class {
23391
23651
  return value;
23392
23652
  }
23393
23653
  };
23394
- ApiKeyService = _ts_decorate99([
23654
+ ApiKeyService = _ts_decorate100([
23395
23655
  Injectable(),
23396
- _ts_param60(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
23397
- _ts_param60(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
23398
- _ts_param60(2, Inject(BYMAX_AUTH_OPTIONS)),
23399
- _ts_metadata95("design:type", Function),
23400
- _ts_metadata95("design:paramtypes", [
23656
+ _ts_param61(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
23657
+ _ts_param61(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
23658
+ _ts_param61(2, Inject(BYMAX_AUTH_OPTIONS)),
23659
+ _ts_metadata96("design:type", Function),
23660
+ _ts_metadata96("design:paramtypes", [
23401
23661
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
23402
23662
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
23403
23663
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -23479,7 +23739,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
23479
23739
  __name(assertTenantBinding, "assertTenantBinding");
23480
23740
 
23481
23741
  // src/server/services/auth-token-verifier.service.ts
23482
- function _ts_decorate100(decorators, target, key, desc) {
23742
+ function _ts_decorate101(decorators, target, key, desc) {
23483
23743
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23484
23744
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
23485
23745
  r = Reflect.decorate(decorators, target, key, desc);
@@ -23492,19 +23752,19 @@ function _ts_decorate100(decorators, target, key, desc) {
23492
23752
  }
23493
23753
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23494
23754
  }
23495
- __name(_ts_decorate100, "_ts_decorate");
23496
- function _ts_metadata96(metadataKey, metadataValue) {
23755
+ __name(_ts_decorate101, "_ts_decorate");
23756
+ function _ts_metadata97(metadataKey, metadataValue) {
23497
23757
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
23498
23758
  return Reflect.metadata(metadataKey, metadataValue);
23499
23759
  }
23500
23760
  }
23501
- __name(_ts_metadata96, "_ts_metadata");
23502
- function _ts_param61(paramIndex, decorator) {
23761
+ __name(_ts_metadata97, "_ts_metadata");
23762
+ function _ts_param62(paramIndex, decorator) {
23503
23763
  return function(target, key) {
23504
23764
  decorator(target, key, paramIndex);
23505
23765
  };
23506
23766
  }
23507
- __name(_ts_param61, "_ts_param");
23767
+ __name(_ts_param62, "_ts_param");
23508
23768
  var AuthTokenVerifierService = class _AuthTokenVerifierService {
23509
23769
  static {
23510
23770
  __name(this, "AuthTokenVerifierService");
@@ -23584,11 +23844,14 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
23584
23844
  };
23585
23845
  }
23586
23846
  /**
23587
- * The function that admits a caller to a workspace, or a `TypeError` when none can: on a plane
23588
- * with no workspaces, or on a deployment that has not enabled them. A programmer's error.
23847
+ * The function that admits a caller to a workspace. On a plane with no workspaces that is a
23848
+ * `TypeError` raised at once, a programmer's error. On a deployment that has not enabled them the
23849
+ * function is returned and refuses with the `auth.validation` error naming `workspaceId` when it is
23850
+ * called, which is after the token has been verified: the id came from a client, and an anonymous
23851
+ * caller must get `TOKEN_INVALID`, not a description of the deployment.
23589
23852
  *
23590
- * The returned function admits the caller as `WorkspaceGuard` would a route, with `auth.validation`
23591
- * for a malformed id and then the guard's refusals.
23853
+ * Otherwise the returned function admits the caller as `WorkspaceGuard` would a route, with
23854
+ * `auth.validation` for a malformed id and then the guard's refusals.
23592
23855
  */
23593
23856
  workspaceResolver(plane) {
23594
23857
  if (plane !== "dashboard") {
@@ -23598,7 +23861,12 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
23598
23861
  const group = this.options.workspaces;
23599
23862
  const denied = this.deniedEvents;
23600
23863
  if (access === null || group === void 0) {
23601
- throw new TypeError("verifyAccessToken: workspace needs workspaces.enabled");
23864
+ return () => Promise.reject(new AuthException(AUTH_ERROR_CODES.VALIDATION, [
23865
+ {
23866
+ field: "workspaceId",
23867
+ message: "workspaceId is not accepted: workspaces are not enabled for this deployment"
23868
+ }
23869
+ ]));
23602
23870
  }
23603
23871
  return async (payload, check) => {
23604
23872
  const workspaceId = assertWorkspaceId(check.workspaceId);
@@ -23706,18 +23974,18 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
23706
23974
  }
23707
23975
  }
23708
23976
  };
23709
- AuthTokenVerifierService = _ts_decorate100([
23977
+ AuthTokenVerifierService = _ts_decorate101([
23710
23978
  Injectable(),
23711
- _ts_param61(0, Inject(JwtService)),
23712
- _ts_param61(1, Inject(BYMAX_AUTH_OPTIONS)),
23713
- _ts_param61(2, Inject(AuthRevocationService)),
23714
- _ts_param61(3, Inject(AccountStatusService)),
23715
- _ts_param61(4, Inject(WorkspaceAccessService)),
23716
- _ts_param61(4, Optional()),
23717
- _ts_param61(5, Inject(WorkspaceDeniedEventsService)),
23718
- _ts_param61(5, Optional()),
23719
- _ts_metadata96("design:type", Function),
23720
- _ts_metadata96("design:paramtypes", [
23979
+ _ts_param62(0, Inject(JwtService)),
23980
+ _ts_param62(1, Inject(BYMAX_AUTH_OPTIONS)),
23981
+ _ts_param62(2, Inject(AuthRevocationService)),
23982
+ _ts_param62(3, Inject(AccountStatusService)),
23983
+ _ts_param62(4, Inject(WorkspaceAccessService)),
23984
+ _ts_param62(4, Optional()),
23985
+ _ts_param62(5, Inject(WorkspaceDeniedEventsService)),
23986
+ _ts_param62(5, Optional()),
23987
+ _ts_metadata97("design:type", Function),
23988
+ _ts_metadata97("design:paramtypes", [
23721
23989
  typeof JwtService === "undefined" ? Object : JwtService,
23722
23990
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
23723
23991
  typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
@@ -23728,7 +23996,7 @@ AuthTokenVerifierService = _ts_decorate100([
23728
23996
  ], AuthTokenVerifierService);
23729
23997
 
23730
23998
  // src/server/bymax-auth.module.ts
23731
- function _ts_decorate101(decorators, target, key, desc) {
23999
+ function _ts_decorate102(decorators, target, key, desc) {
23732
24000
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23733
24001
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
23734
24002
  r = Reflect.decorate(decorators, target, key, desc);
@@ -23741,7 +24009,7 @@ function _ts_decorate101(decorators, target, key, desc) {
23741
24009
  }
23742
24010
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23743
24011
  }
23744
- __name(_ts_decorate101, "_ts_decorate");
24012
+ __name(_ts_decorate102, "_ts_decorate");
23745
24013
  function hasProviderToken(providers, token) {
23746
24014
  return providers.some((p) => {
23747
24015
  if (typeof p === "function") return false;
@@ -24013,10 +24281,10 @@ var BymaxAuthModule = class _BymaxAuthModule {
24013
24281
  ...breachCheckerProviders,
24014
24282
  ...hooksProviders,
24015
24283
  // Core services.
24016
- // AuthRedisService is registered directly (not via AuthRedisModule) so that
24017
- // BYMAX_AUTH_REDIS_CLIENT and BYMAX_AUTH_OPTIONS provided via extraProviders
24018
- // are visible in the same module scope.
24284
+ // AuthRedisService is registered directly (not via AuthRedisModule) so that the client and
24285
+ // the options provided via extraProviders are visible in the same module scope.
24019
24286
  AuthRedisService,
24287
+ RedisReadinessService,
24020
24288
  AuthRevocationService,
24021
24289
  AccountStatusService,
24022
24290
  AuthTokenVerifierService,
@@ -24131,9 +24399,9 @@ var BymaxAuthModule = class _BymaxAuthModule {
24131
24399
  // exported for the same @UseGuards() reason as the entries around it: the guard is
24132
24400
  // re-instantiated in the consumer's injector, where an unexported dep fails their boot.
24133
24401
  AccountStatusService,
24134
- // AuthTokenVerifierService is exported for the consumer rather than for a guard: it is
24135
- // the one call that establishes everything a guarded route establishes, which is what a
24136
- // long-lived transport needs and cannot assemble from the exported parts alone.
24402
+ // AuthTokenVerifierService is the one call that establishes everything a guarded route
24403
+ // establishes, which is what a long-lived transport needs and cannot assemble from the
24404
+ // exported parts alone. `WsJwtGuard` depends on it, and a host may call it directly.
24137
24405
  AuthTokenVerifierService,
24138
24406
  // Same reason, for the two exported guards whose remaining constructor deps are not
24139
24407
  // covered by the entries above. Exporting the guard class is necessary but not
@@ -24142,7 +24410,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
24142
24410
  // UnknownDependenciesException even though the guard itself is exported.
24143
24411
  //
24144
24412
  // UserStatusGuard -> AccountStatusService
24145
- // WsJwtGuard -> WsTicketService
24413
+ // WsJwtGuard -> AuthTokenVerifierService, WsTicketService
24146
24414
  //
24147
24415
  // Only the DIRECT dependency needs exporting. An exported provider arrives already
24148
24416
  // instantiated, so the consumer's injector binds that instance and never re-resolves its
@@ -24186,7 +24454,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
24186
24454
  };
24187
24455
  }
24188
24456
  };
24189
- BymaxAuthModule = _ts_decorate101([
24457
+ BymaxAuthModule = _ts_decorate102([
24190
24458
  Module({})
24191
24459
  ], BymaxAuthModule);
24192
24460
 
@@ -24561,7 +24829,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
24561
24829
  }
24562
24830
  }
24563
24831
  };
24564
- function _ts_decorate102(decorators, target, key, desc) {
24832
+ function _ts_decorate103(decorators, target, key, desc) {
24565
24833
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24566
24834
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
24567
24835
  r = Reflect.decorate(decorators, target, key, desc);
@@ -24574,13 +24842,13 @@ function _ts_decorate102(decorators, target, key, desc) {
24574
24842
  }
24575
24843
  return c > 3 && r && Object.defineProperty(target, key, r), r;
24576
24844
  }
24577
- __name(_ts_decorate102, "_ts_decorate");
24578
- function _ts_metadata97(metadataKey, metadataValue) {
24845
+ __name(_ts_decorate103, "_ts_decorate");
24846
+ function _ts_metadata98(metadataKey, metadataValue) {
24579
24847
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
24580
24848
  return Reflect.metadata(metadataKey, metadataValue);
24581
24849
  }
24582
24850
  }
24583
- __name(_ts_metadata97, "_ts_metadata");
24851
+ __name(_ts_metadata98, "_ts_metadata");
24584
24852
  var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
24585
24853
  var PREFIX_LENGTH = 5;
24586
24854
  var DEFAULT_TIMEOUT_MS = 1500;
@@ -24637,10 +24905,10 @@ var HibpBreachChecker = class _HibpBreachChecker {
24637
24905
  }
24638
24906
  }
24639
24907
  };
24640
- HibpBreachChecker = _ts_decorate102([
24908
+ HibpBreachChecker = _ts_decorate103([
24641
24909
  Injectable(),
24642
- _ts_metadata97("design:type", Function),
24643
- _ts_metadata97("design:paramtypes", [
24910
+ _ts_metadata98("design:type", Function),
24911
+ _ts_metadata98("design:paramtypes", [
24644
24912
  Number
24645
24913
  ])
24646
24914
  ], HibpBreachChecker);
@@ -24653,10 +24921,10 @@ var AllowAllBreachChecker = class {
24653
24921
  return false;
24654
24922
  }
24655
24923
  };
24656
- AllowAllBreachChecker = _ts_decorate102([
24924
+ AllowAllBreachChecker = _ts_decorate103([
24657
24925
  Injectable()
24658
24926
  ], AllowAllBreachChecker);
24659
- function _ts_decorate103(decorators, target, key, desc) {
24927
+ function _ts_decorate104(decorators, target, key, desc) {
24660
24928
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24661
24929
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
24662
24930
  r = Reflect.decorate(decorators, target, key, desc);
@@ -24669,7 +24937,7 @@ function _ts_decorate103(decorators, target, key, desc) {
24669
24937
  }
24670
24938
  return c > 3 && r && Object.defineProperty(target, key, r), r;
24671
24939
  }
24672
- __name(_ts_decorate103, "_ts_decorate");
24940
+ __name(_ts_decorate104, "_ts_decorate");
24673
24941
  var OptionalAuthGuard = class extends JwtAuthGuard {
24674
24942
  static {
24675
24943
  __name(this, "OptionalAuthGuard");
@@ -24684,10 +24952,10 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
24684
24952
  return super.canActivate(context);
24685
24953
  }
24686
24954
  };
24687
- OptionalAuthGuard = _ts_decorate103([
24955
+ OptionalAuthGuard = _ts_decorate104([
24688
24956
  Injectable()
24689
24957
  ], OptionalAuthGuard);
24690
- function _ts_decorate104(decorators, target, key, desc) {
24958
+ function _ts_decorate105(decorators, target, key, desc) {
24691
24959
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24692
24960
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
24693
24961
  r = Reflect.decorate(decorators, target, key, desc);
@@ -24700,19 +24968,19 @@ function _ts_decorate104(decorators, target, key, desc) {
24700
24968
  }
24701
24969
  return c > 3 && r && Object.defineProperty(target, key, r), r;
24702
24970
  }
24703
- __name(_ts_decorate104, "_ts_decorate");
24704
- function _ts_metadata98(metadataKey, metadataValue) {
24971
+ __name(_ts_decorate105, "_ts_decorate");
24972
+ function _ts_metadata99(metadataKey, metadataValue) {
24705
24973
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
24706
24974
  return Reflect.metadata(metadataKey, metadataValue);
24707
24975
  }
24708
24976
  }
24709
- __name(_ts_metadata98, "_ts_metadata");
24710
- function _ts_param62(paramIndex, decorator) {
24977
+ __name(_ts_metadata99, "_ts_metadata");
24978
+ function _ts_param63(paramIndex, decorator) {
24711
24979
  return function(target, key) {
24712
24980
  decorator(target, key, paramIndex);
24713
24981
  };
24714
24982
  }
24715
- __name(_ts_param62, "_ts_param");
24983
+ __name(_ts_param63, "_ts_param");
24716
24984
  var SelfOrAdminGuard = class {
24717
24985
  static {
24718
24986
  __name(this, "SelfOrAdminGuard");
@@ -24748,11 +25016,11 @@ var SelfOrAdminGuard = class {
24748
25016
  throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
24749
25017
  }
24750
25018
  };
24751
- SelfOrAdminGuard = _ts_decorate104([
25019
+ SelfOrAdminGuard = _ts_decorate105([
24752
25020
  Injectable(),
24753
- _ts_param62(0, Inject(BYMAX_AUTH_OPTIONS)),
24754
- _ts_metadata98("design:type", Function),
24755
- _ts_metadata98("design:paramtypes", [
25021
+ _ts_param63(0, Inject(BYMAX_AUTH_OPTIONS)),
25022
+ _ts_metadata99("design:type", Function),
25023
+ _ts_metadata99("design:paramtypes", [
24756
25024
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
24757
25025
  ])
24758
25026
  ], SelfOrAdminGuard);
@@ -24774,7 +25042,7 @@ function isHexLooking(value) {
24774
25042
  return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
24775
25043
  }
24776
25044
  __name(isHexLooking, "isHexLooking");
24777
- function _ts_decorate105(decorators, target, key, desc) {
25045
+ function _ts_decorate106(decorators, target, key, desc) {
24778
25046
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24779
25047
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
24780
25048
  r = Reflect.decorate(decorators, target, key, desc);
@@ -24787,32 +25055,32 @@ function _ts_decorate105(decorators, target, key, desc) {
24787
25055
  }
24788
25056
  return c > 3 && r && Object.defineProperty(target, key, r), r;
24789
25057
  }
24790
- __name(_ts_decorate105, "_ts_decorate");
24791
- function _ts_metadata99(metadataKey, metadataValue) {
25058
+ __name(_ts_decorate106, "_ts_decorate");
25059
+ function _ts_metadata100(metadataKey, metadataValue) {
24792
25060
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
24793
25061
  return Reflect.metadata(metadataKey, metadataValue);
24794
25062
  }
24795
25063
  }
24796
- __name(_ts_metadata99, "_ts_metadata");
24797
- function _ts_param63(paramIndex, decorator) {
25064
+ __name(_ts_metadata100, "_ts_metadata");
25065
+ function _ts_param64(paramIndex, decorator) {
24798
25066
  return function(target, key) {
24799
25067
  decorator(target, key, paramIndex);
24800
25068
  };
24801
25069
  }
24802
- __name(_ts_param63, "_ts_param");
25070
+ __name(_ts_param64, "_ts_param");
24803
25071
  var WsJwtGuard = class {
24804
25072
  static {
24805
25073
  __name(this, "WsJwtGuard");
24806
25074
  }
24807
- jwtService;
24808
- revocation;
25075
+ verifier;
24809
25076
  wsTickets;
24810
25077
  options;
24811
- constructor(jwtService, revocation, wsTickets, options) {
24812
- this.jwtService = jwtService;
24813
- this.revocation = revocation;
25078
+ reflector;
25079
+ constructor(verifier, wsTickets, options, reflector) {
25080
+ this.verifier = verifier;
24814
25081
  this.wsTickets = wsTickets;
24815
25082
  this.options = options;
25083
+ this.reflector = reflector;
24816
25084
  }
24817
25085
  /**
24818
25086
  * Verifies that `@nestjs/websockets` is installed and throws a descriptive
@@ -24844,37 +25112,32 @@ var WsJwtGuard = class {
24844
25112
  if (!token) {
24845
25113
  throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
24846
25114
  }
24847
- let payload;
24848
- try {
24849
- payload = verifyWithRotation(this.jwtService, this.options, token);
24850
- } catch {
24851
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
24852
- }
24853
- if (typeof payload.jti !== "string") {
24854
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
24855
- }
24856
- assertTokenType(payload, "dashboard");
24857
- assertValidSub(payload.sub);
24858
- if (await this.revocation.isAccessTokenRevoked(payload)) {
24859
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
24860
- }
24861
- await assertTenantBinding(this.options, bindingInput(handshake), payload.tenantId);
24862
- client.data.user = payload;
25115
+ const skipMfa = this.reflector.getAllAndOverride(SKIP_MFA_KEY, [
25116
+ context.getHandler(),
25117
+ context.getClass()
25118
+ ]) === true;
25119
+ const verified = await this.verifier.verifyAccessToken(token, {
25120
+ plane: "dashboard",
25121
+ requireMfa: !skipMfa,
25122
+ checkStatus: true,
25123
+ request: bindingInput(handshake)
25124
+ });
25125
+ client.data.user = verified.payload;
24863
25126
  return true;
24864
25127
  }
24865
25128
  };
24866
- WsJwtGuard = _ts_decorate105([
25129
+ WsJwtGuard = _ts_decorate106([
24867
25130
  Injectable(),
24868
- _ts_param63(0, Inject(JwtService)),
24869
- _ts_param63(1, Inject(AuthRevocationService)),
24870
- _ts_param63(2, Inject(WsTicketService)),
24871
- _ts_param63(3, Inject(BYMAX_AUTH_OPTIONS)),
24872
- _ts_metadata99("design:type", Function),
24873
- _ts_metadata99("design:paramtypes", [
24874
- typeof JwtService === "undefined" ? Object : JwtService,
24875
- typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
25131
+ _ts_param64(0, Inject(AuthTokenVerifierService)),
25132
+ _ts_param64(1, Inject(WsTicketService)),
25133
+ _ts_param64(2, Inject(BYMAX_AUTH_OPTIONS)),
25134
+ _ts_param64(3, Inject(Reflector)),
25135
+ _ts_metadata100("design:type", Function),
25136
+ _ts_metadata100("design:paramtypes", [
25137
+ typeof AuthTokenVerifierService === "undefined" ? Object : AuthTokenVerifierService,
24876
25138
  typeof WsTicketService === "undefined" ? Object : WsTicketService,
24877
- typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
25139
+ typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
25140
+ typeof Reflector === "undefined" ? Object : Reflector
24878
25141
  ])
24879
25142
  ], WsJwtGuard);
24880
25143
  function assertDashboardSnapshot(snapshot) {
@@ -24910,7 +25173,7 @@ function bindingInput(handshake) {
24910
25173
  };
24911
25174
  }
24912
25175
  __name(bindingInput, "bindingInput");
24913
- function _ts_decorate106(decorators, target, key, desc) {
25176
+ function _ts_decorate107(decorators, target, key, desc) {
24914
25177
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24915
25178
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
24916
25179
  r = Reflect.decorate(decorators, target, key, desc);
@@ -24923,7 +25186,7 @@ function _ts_decorate106(decorators, target, key, desc) {
24923
25186
  }
24924
25187
  return c > 3 && r && Object.defineProperty(target, key, r), r;
24925
25188
  }
24926
- __name(_ts_decorate106, "_ts_decorate");
25189
+ __name(_ts_decorate107, "_ts_decorate");
24927
25190
  function isAuthEnvelope(body) {
24928
25191
  if (typeof body !== "object" || body === null) return false;
24929
25192
  const error = body.error;
@@ -25042,10 +25305,10 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
25042
25305
  });
25043
25306
  }
25044
25307
  };
25045
- AuthExceptionFilter = _ts_decorate106([
25308
+ AuthExceptionFilter = _ts_decorate107([
25046
25309
  Catch()
25047
25310
  ], AuthExceptionFilter);
25048
- function _ts_decorate107(decorators, target, key, desc) {
25311
+ function _ts_decorate108(decorators, target, key, desc) {
25049
25312
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25050
25313
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
25051
25314
  r = Reflect.decorate(decorators, target, key, desc);
@@ -25058,7 +25321,7 @@ function _ts_decorate107(decorators, target, key, desc) {
25058
25321
  }
25059
25322
  return c > 3 && r && Object.defineProperty(target, key, r), r;
25060
25323
  }
25061
- __name(_ts_decorate107, "_ts_decorate");
25324
+ __name(_ts_decorate108, "_ts_decorate");
25062
25325
  function isEmittingClient(client) {
25063
25326
  return typeof client?.emit === "function";
25064
25327
  }
@@ -25102,7 +25365,7 @@ var WsAuthExceptionFilter = class _WsAuthExceptionFilter {
25102
25365
  this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
25103
25366
  }
25104
25367
  };
25105
- WsAuthExceptionFilter = _ts_decorate107([
25368
+ WsAuthExceptionFilter = _ts_decorate108([
25106
25369
  Catch(AuthException)
25107
25370
  ], WsAuthExceptionFilter);
25108
25371
  var ServiceKey = /* @__PURE__ */ __name((...scopes) => applyDecorators(SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), UseGuards(ApiKeyGuard)), "ServiceKey");
@@ -25116,7 +25379,7 @@ var CurrentWsWorkspace = createParamDecorator((_data, context) => {
25116
25379
  });
25117
25380
 
25118
25381
  // src/server/utils/workspace-scoped.ts
25119
- var UNPAIRED_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
25382
+ var UNPAIRED_SURROGATE2 = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
25120
25383
  function workspaceScopedName(tenantId, workspaceId, ...parts) {
25121
25384
  const pieces = [
25122
25385
  tenantId,
@@ -25128,7 +25391,7 @@ function workspaceScopedName(tenantId, workspaceId, ...parts) {
25128
25391
  }
25129
25392
  __name(workspaceScopedName, "workspaceScopedName");
25130
25393
  function decodeWorkspaceScopedName(name) {
25131
- if (UNPAIRED_SURROGATE.test(name)) throw malformed(name);
25394
+ if (UNPAIRED_SURROGATE2.test(name)) throw malformed(name);
25132
25395
  const bytes = Buffer.from(name, "utf8");
25133
25396
  const pieces = [];
25134
25397
  let at = 0;
@@ -25169,7 +25432,7 @@ function assertPiece(piece, index) {
25169
25432
  if (hasControl(piece)) {
25170
25433
  throw new TypeError(`${label} must not contain a control character`);
25171
25434
  }
25172
- if (UNPAIRED_SURROGATE.test(piece)) throw new TypeError(`${label} must be well-formed Unicode`);
25435
+ if (UNPAIRED_SURROGATE2.test(piece)) throw new TypeError(`${label} must be well-formed Unicode`);
25173
25436
  }
25174
25437
  __name(assertPiece, "assertPiece");
25175
25438
  function malformed(name) {
@@ -25187,4 +25450,4 @@ function stampJobContext(workspace) {
25187
25450
  }
25188
25451
  __name(stampJobContext, "stampJobContext");
25189
25452
 
25190
- export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspaceScopedName };
25453
+ export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECRET_MIN_LENGTH, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_CURSOR_MAX_LENGTH, WORKSPACE_CURSOR_PART_MAX_LENGTH, WORKSPACE_ID_MAX_LENGTH, WORKSPACE_OWNER_ROLE_MAX_LENGTH, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, assertWorkspaceId, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceCursor, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encodeWorkspaceCursor, encrypt, generateSecureToken, hasRole, hmacSha256, isWorkspaceOwnerRole, readWorkspacePosition, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspacePositionOf, workspaceQueryKey, workspaceScopedName };