@bymax-one/nest-auth 1.3.0 → 1.3.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.
@@ -2686,6 +2686,100 @@ AuthRateLimitGuard = _ts_decorate6([
2686
2686
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService
2687
2687
  ])
2688
2688
  ], AuthRateLimitGuard);
2689
+
2690
+ // src/server/utils/assert-not-blocked.ts
2691
+ var BLOCKED_STATUS_CODES = /* @__PURE__ */ new Map([
2692
+ [
2693
+ "banned",
2694
+ AUTH_ERROR_CODES.ACCOUNT_BANNED
2695
+ ],
2696
+ [
2697
+ "suspended",
2698
+ AUTH_ERROR_CODES.ACCOUNT_SUSPENDED
2699
+ ],
2700
+ [
2701
+ "pending",
2702
+ AUTH_ERROR_CODES.PENDING_APPROVAL
2703
+ ],
2704
+ [
2705
+ "pending_approval",
2706
+ AUTH_ERROR_CODES.PENDING_APPROVAL
2707
+ ]
2708
+ ]);
2709
+ function assertNotBlocked(status, blockedStatuses) {
2710
+ const canonical = status.toLowerCase();
2711
+ if (!blockedStatuses.some((blocked) => blocked.toLowerCase() === canonical)) {
2712
+ return;
2713
+ }
2714
+ throw new AuthException(BLOCKED_STATUS_CODES.get(canonical) ?? AUTH_ERROR_CODES.ACCOUNT_INACTIVE, 403);
2715
+ }
2716
+ __name(assertNotBlocked, "assertNotBlocked");
2717
+
2718
+ // src/server/utils/stamped-epoch.ts
2719
+ function readStampedEpoch(payload) {
2720
+ const { epoch } = payload;
2721
+ return typeof epoch === "number" && Number.isInteger(epoch) ? Math.max(0, epoch) : 0;
2722
+ }
2723
+ __name(readStampedEpoch, "readStampedEpoch");
2724
+
2725
+ // src/server/utils/sanitize-headers.ts
2726
+ var BLOCKED_HEADERS = /* @__PURE__ */ new Set([
2727
+ "authorization",
2728
+ "cookie",
2729
+ "proxy-authorization",
2730
+ "www-authenticate",
2731
+ // Stryker disable next-line StringLiteral: 'x-api-key' is also matched by SENSITIVE_HEADER_PATTERN (ends with -key), so removing it from the Set does not change the filter result
2732
+ "x-api-key",
2733
+ // Stryker disable next-line StringLiteral: 'x-auth-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
2734
+ "x-auth-token",
2735
+ // Stryker disable next-line StringLiteral: 'x-csrf-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
2736
+ "x-csrf-token",
2737
+ "x-session-id",
2738
+ "x-forwarded-for",
2739
+ "x-forwarded-host",
2740
+ "x-real-ip",
2741
+ "x-original-forwarded-for",
2742
+ "cf-connecting-ip",
2743
+ "true-client-ip",
2744
+ "x-cluster-client-ip"
2745
+ ]);
2746
+ var SENSITIVE_HEADER_PATTERN = /^x-.*-(token|secret|key|password|credential|auth|bearer|signature|hmac)$/i;
2747
+ function sanitizeHeaders(headers) {
2748
+ return Object.fromEntries(Object.entries(headers).map(([key, value]) => [
2749
+ key.toLowerCase(),
2750
+ value
2751
+ ]).filter(([key]) => !BLOCKED_HEADERS.has(key) && !SENSITIVE_HEADER_PATTERN.test(key)));
2752
+ }
2753
+ __name(sanitizeHeaders, "sanitizeHeaders");
2754
+ function createEmptyHookContext() {
2755
+ return {
2756
+ ip: "",
2757
+ userAgent: "",
2758
+ sanitizedHeaders: {}
2759
+ };
2760
+ }
2761
+ __name(createEmptyHookContext, "createEmptyHookContext");
2762
+
2763
+ // src/server/utils/sleep.ts
2764
+ var MAX_SLEEP_MS = 1e4;
2765
+ function sleep(ms) {
2766
+ const clamped = Math.min(Math.max(0, ms), MAX_SLEEP_MS);
2767
+ return new Promise((resolve) => {
2768
+ setTimeout(resolve, clamped);
2769
+ });
2770
+ }
2771
+ __name(sleep, "sleep");
2772
+
2773
+ // src/server/utils/roles.util.ts
2774
+ function hasRole(userRole, requiredRole, hierarchy) {
2775
+ if (userRole === requiredRole) return true;
2776
+ if (!Object.hasOwn(hierarchy, userRole)) return false;
2777
+ const inherited = hierarchy[userRole];
2778
+ return inherited !== void 0 && inherited.includes(requiredRole);
2779
+ }
2780
+ __name(hasRole, "hasRole");
2781
+
2782
+ // src/server/services/auth-revocation.service.ts
2689
2783
  function _ts_decorate7(decorators, target, key, desc) {
2690
2784
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2691
2785
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -2703,6 +2797,58 @@ function _ts_param3(paramIndex, decorator) {
2703
2797
  };
2704
2798
  }
2705
2799
  __name(_ts_param3, "_ts_param");
2800
+ var AuthRevocationService = class {
2801
+ static {
2802
+ __name(this, "AuthRevocationService");
2803
+ }
2804
+ redis;
2805
+ /**
2806
+ * @param redis - The auth module's Redis service, holding both revocation channels.
2807
+ */
2808
+ constructor(redis) {
2809
+ this.redis = redis;
2810
+ }
2811
+ /**
2812
+ * Whether a verified access token has been revoked.
2813
+ *
2814
+ * @param payload - The verified token's `jti`, `sub` and stamped `epoch`.
2815
+ * @param kind - Which plane the token belongs to; selects the epoch namespace, defaulting to the
2816
+ * dashboard plane an ordinary user token uses. The per-token blacklist is shared across planes.
2817
+ * @returns `true` when the token is on the blacklist or predates the user's current epoch.
2818
+ */
2819
+ async isAccessTokenRevoked(payload, kind = "dashboard") {
2820
+ if (await this.redis.get(`rv:${payload.jti}`) !== null) {
2821
+ return true;
2822
+ }
2823
+ const epoch = await this.redis.getUserTokenEpoch(payload.sub, kind);
2824
+ return readStampedEpoch(payload) < epoch;
2825
+ }
2826
+ };
2827
+ AuthRevocationService = _ts_decorate7([
2828
+ Injectable(),
2829
+ _ts_param3(0, Inject(AuthRedisService)),
2830
+ _ts_metadata7("design:type", Function),
2831
+ _ts_metadata7("design:paramtypes", [
2832
+ typeof AuthRedisService === "undefined" ? Object : AuthRedisService
2833
+ ])
2834
+ ], AuthRevocationService);
2835
+ function _ts_decorate8(decorators, target, key, desc) {
2836
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2837
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2838
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2839
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2840
+ }
2841
+ __name(_ts_decorate8, "_ts_decorate");
2842
+ function _ts_metadata8(k, v) {
2843
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2844
+ }
2845
+ __name(_ts_metadata8, "_ts_metadata");
2846
+ function _ts_param4(paramIndex, decorator) {
2847
+ return function(target, key) {
2848
+ decorator(target, key, paramIndex);
2849
+ };
2850
+ }
2851
+ __name(_ts_param4, "_ts_param");
2706
2852
  var HOSTNAME_RE = /^[a-z0-9.-]+$/i;
2707
2853
  var TokenDeliveryService = class {
2708
2854
  static {
@@ -2991,107 +3137,15 @@ var TokenDeliveryService = class {
2991
3137
  return typeof value === "string" ? value : void 0;
2992
3138
  }
2993
3139
  };
2994
- TokenDeliveryService = _ts_decorate7([
3140
+ TokenDeliveryService = _ts_decorate8([
2995
3141
  Injectable(),
2996
- _ts_param3(0, Inject(BYMAX_AUTH_OPTIONS)),
2997
- _ts_metadata7("design:type", Function),
2998
- _ts_metadata7("design:paramtypes", [
3142
+ _ts_param4(0, Inject(BYMAX_AUTH_OPTIONS)),
3143
+ _ts_metadata8("design:type", Function),
3144
+ _ts_metadata8("design:paramtypes", [
2999
3145
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3000
3146
  ])
3001
3147
  ], TokenDeliveryService);
3002
3148
 
3003
- // src/server/utils/assert-not-blocked.ts
3004
- var BLOCKED_STATUS_CODES = /* @__PURE__ */ new Map([
3005
- [
3006
- "banned",
3007
- AUTH_ERROR_CODES.ACCOUNT_BANNED
3008
- ],
3009
- [
3010
- "suspended",
3011
- AUTH_ERROR_CODES.ACCOUNT_SUSPENDED
3012
- ],
3013
- [
3014
- "pending",
3015
- AUTH_ERROR_CODES.PENDING_APPROVAL
3016
- ],
3017
- [
3018
- "pending_approval",
3019
- AUTH_ERROR_CODES.PENDING_APPROVAL
3020
- ]
3021
- ]);
3022
- function assertNotBlocked(status, blockedStatuses) {
3023
- const canonical = status.toLowerCase();
3024
- if (!blockedStatuses.some((blocked) => blocked.toLowerCase() === canonical)) {
3025
- return;
3026
- }
3027
- throw new AuthException(BLOCKED_STATUS_CODES.get(canonical) ?? AUTH_ERROR_CODES.ACCOUNT_INACTIVE, 403);
3028
- }
3029
- __name(assertNotBlocked, "assertNotBlocked");
3030
-
3031
- // src/server/utils/stamped-epoch.ts
3032
- function readStampedEpoch(payload) {
3033
- const { epoch } = payload;
3034
- return typeof epoch === "number" && Number.isInteger(epoch) ? Math.max(0, epoch) : 0;
3035
- }
3036
- __name(readStampedEpoch, "readStampedEpoch");
3037
-
3038
- // src/server/utils/sanitize-headers.ts
3039
- var BLOCKED_HEADERS = /* @__PURE__ */ new Set([
3040
- "authorization",
3041
- "cookie",
3042
- "proxy-authorization",
3043
- "www-authenticate",
3044
- // Stryker disable next-line StringLiteral: 'x-api-key' is also matched by SENSITIVE_HEADER_PATTERN (ends with -key), so removing it from the Set does not change the filter result
3045
- "x-api-key",
3046
- // Stryker disable next-line StringLiteral: 'x-auth-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
3047
- "x-auth-token",
3048
- // Stryker disable next-line StringLiteral: 'x-csrf-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
3049
- "x-csrf-token",
3050
- "x-session-id",
3051
- "x-forwarded-for",
3052
- "x-forwarded-host",
3053
- "x-real-ip",
3054
- "x-original-forwarded-for",
3055
- "cf-connecting-ip",
3056
- "true-client-ip",
3057
- "x-cluster-client-ip"
3058
- ]);
3059
- var SENSITIVE_HEADER_PATTERN = /^x-.*-(token|secret|key|password|credential|auth|bearer|signature|hmac)$/i;
3060
- function sanitizeHeaders(headers) {
3061
- return Object.fromEntries(Object.entries(headers).map(([key, value]) => [
3062
- key.toLowerCase(),
3063
- value
3064
- ]).filter(([key]) => !BLOCKED_HEADERS.has(key) && !SENSITIVE_HEADER_PATTERN.test(key)));
3065
- }
3066
- __name(sanitizeHeaders, "sanitizeHeaders");
3067
- function createEmptyHookContext() {
3068
- return {
3069
- ip: "",
3070
- userAgent: "",
3071
- sanitizedHeaders: {}
3072
- };
3073
- }
3074
- __name(createEmptyHookContext, "createEmptyHookContext");
3075
-
3076
- // src/server/utils/sleep.ts
3077
- var MAX_SLEEP_MS = 1e4;
3078
- function sleep(ms) {
3079
- const clamped = Math.min(Math.max(0, ms), MAX_SLEEP_MS);
3080
- return new Promise((resolve) => {
3081
- setTimeout(resolve, clamped);
3082
- });
3083
- }
3084
- __name(sleep, "sleep");
3085
-
3086
- // src/server/utils/roles.util.ts
3087
- function hasRole(userRole, requiredRole, hierarchy) {
3088
- if (userRole === requiredRole) return true;
3089
- if (!Object.hasOwn(hierarchy, userRole)) return false;
3090
- const inherited = hierarchy[userRole];
3091
- return inherited !== void 0 && inherited.includes(requiredRole);
3092
- }
3093
- __name(hasRole, "hasRole");
3094
-
3095
3149
  // src/server/utils/verify-with-rotation.ts
3096
3150
  function verifyWithRotation(jwtService, options, token, { ignoreExpiration = false } = {}) {
3097
3151
  const algorithms = [
@@ -3145,36 +3199,36 @@ function assertValidSub(sub) {
3145
3199
  __name(assertValidSub, "assertValidSub");
3146
3200
 
3147
3201
  // src/server/guards/jwt-auth.guard.ts
3148
- function _ts_decorate8(decorators, target, key, desc) {
3202
+ function _ts_decorate9(decorators, target, key, desc) {
3149
3203
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3150
3204
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3151
3205
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3152
3206
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3153
3207
  }
3154
- __name(_ts_decorate8, "_ts_decorate");
3155
- function _ts_metadata8(k, v) {
3208
+ __name(_ts_decorate9, "_ts_decorate");
3209
+ function _ts_metadata9(k, v) {
3156
3210
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3157
3211
  }
3158
- __name(_ts_metadata8, "_ts_metadata");
3159
- function _ts_param4(paramIndex, decorator) {
3212
+ __name(_ts_metadata9, "_ts_metadata");
3213
+ function _ts_param5(paramIndex, decorator) {
3160
3214
  return function(target, key) {
3161
3215
  decorator(target, key, paramIndex);
3162
3216
  };
3163
3217
  }
3164
- __name(_ts_param4, "_ts_param");
3218
+ __name(_ts_param5, "_ts_param");
3165
3219
  var JwtAuthGuard = class {
3166
3220
  static {
3167
3221
  __name(this, "JwtAuthGuard");
3168
3222
  }
3169
3223
  jwtService;
3170
3224
  tokenDelivery;
3171
- redis;
3225
+ revocation;
3172
3226
  reflector;
3173
3227
  options;
3174
- constructor(jwtService, tokenDelivery, redis, reflector, options) {
3228
+ constructor(jwtService, tokenDelivery, revocation, reflector, options) {
3175
3229
  this.jwtService = jwtService;
3176
3230
  this.tokenDelivery = tokenDelivery;
3177
- this.redis = redis;
3231
+ this.revocation = revocation;
3178
3232
  this.reflector = reflector;
3179
3233
  this.options = options;
3180
3234
  }
@@ -3198,51 +3252,46 @@ var JwtAuthGuard = class {
3198
3252
  assertValidJti(payload.jti);
3199
3253
  assertValidSub(payload.sub);
3200
3254
  assertTokenType(payload, "dashboard");
3201
- const revoked = await this.redis.get(`rv:${payload.jti}`);
3202
- if (revoked !== null) {
3203
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
3204
- }
3205
- const epoch = await this.redis.getUserTokenEpoch(payload.sub);
3206
- if (readStampedEpoch(payload) < epoch) {
3255
+ if (await this.revocation.isAccessTokenRevoked(payload)) {
3207
3256
  throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
3208
3257
  }
3209
3258
  request.user = payload;
3210
3259
  return true;
3211
3260
  }
3212
3261
  };
3213
- JwtAuthGuard = _ts_decorate8([
3262
+ JwtAuthGuard = _ts_decorate9([
3214
3263
  Injectable(),
3215
- _ts_param4(0, Inject(JwtService)),
3216
- _ts_param4(1, Inject(TokenDeliveryService)),
3217
- _ts_param4(2, Inject(AuthRedisService)),
3218
- _ts_param4(3, Inject(Reflector)),
3219
- _ts_param4(4, Inject(BYMAX_AUTH_OPTIONS)),
3220
- _ts_metadata8("design:type", Function),
3221
- _ts_metadata8("design:paramtypes", [
3264
+ _ts_param5(0, Inject(JwtService)),
3265
+ _ts_param5(1, Inject(TokenDeliveryService)),
3266
+ _ts_param5(2, Inject(AuthRevocationService)),
3267
+ _ts_param5(3, Inject(Reflector)),
3268
+ _ts_param5(4, Inject(BYMAX_AUTH_OPTIONS)),
3269
+ _ts_metadata9("design:type", Function),
3270
+ _ts_metadata9("design:paramtypes", [
3222
3271
  typeof JwtService === "undefined" ? Object : JwtService,
3223
3272
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
3224
- typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
3273
+ typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
3225
3274
  typeof Reflector === "undefined" ? Object : Reflector,
3226
3275
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3227
3276
  ])
3228
3277
  ], JwtAuthGuard);
3229
- function _ts_decorate9(decorators, target, key, desc) {
3278
+ function _ts_decorate10(decorators, target, key, desc) {
3230
3279
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3231
3280
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3232
3281
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3233
3282
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3234
3283
  }
3235
- __name(_ts_decorate9, "_ts_decorate");
3236
- function _ts_metadata9(k, v) {
3284
+ __name(_ts_decorate10, "_ts_decorate");
3285
+ function _ts_metadata10(k, v) {
3237
3286
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3238
3287
  }
3239
- __name(_ts_metadata9, "_ts_metadata");
3240
- function _ts_param5(paramIndex, decorator) {
3288
+ __name(_ts_metadata10, "_ts_metadata");
3289
+ function _ts_param6(paramIndex, decorator) {
3241
3290
  return function(target, key) {
3242
3291
  decorator(target, key, paramIndex);
3243
3292
  };
3244
3293
  }
3245
- __name(_ts_param5, "_ts_param");
3294
+ __name(_ts_param6, "_ts_param");
3246
3295
  var SAFE_METHODS = /* @__PURE__ */ new Set([
3247
3296
  "GET",
3248
3297
  "HEAD",
@@ -3280,31 +3329,31 @@ var TrustedOriginGuard = class {
3280
3329
  return true;
3281
3330
  }
3282
3331
  };
3283
- TrustedOriginGuard = _ts_decorate9([
3332
+ TrustedOriginGuard = _ts_decorate10([
3284
3333
  Injectable(),
3285
- _ts_param5(0, Inject(BYMAX_AUTH_OPTIONS)),
3286
- _ts_metadata9("design:type", Function),
3287
- _ts_metadata9("design:paramtypes", [
3334
+ _ts_param6(0, Inject(BYMAX_AUTH_OPTIONS)),
3335
+ _ts_metadata10("design:type", Function),
3336
+ _ts_metadata10("design:paramtypes", [
3288
3337
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3289
3338
  ])
3290
3339
  ], TrustedOriginGuard);
3291
- function _ts_decorate10(decorators, target, key, desc) {
3340
+ function _ts_decorate11(decorators, target, key, desc) {
3292
3341
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3293
3342
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3294
3343
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3295
3344
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3296
3345
  }
3297
- __name(_ts_decorate10, "_ts_decorate");
3298
- function _ts_metadata10(k, v) {
3346
+ __name(_ts_decorate11, "_ts_decorate");
3347
+ function _ts_metadata11(k, v) {
3299
3348
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3300
3349
  }
3301
- __name(_ts_metadata10, "_ts_metadata");
3302
- function _ts_param6(paramIndex, decorator) {
3350
+ __name(_ts_metadata11, "_ts_metadata");
3351
+ function _ts_param7(paramIndex, decorator) {
3303
3352
  return function(target, key) {
3304
3353
  decorator(target, key, paramIndex);
3305
3354
  };
3306
3355
  }
3307
- __name(_ts_param6, "_ts_param");
3356
+ __name(_ts_param7, "_ts_param");
3308
3357
  var UserStatusGuard = class {
3309
3358
  static {
3310
3359
  __name(this, "UserStatusGuard");
@@ -3337,25 +3386,25 @@ var UserStatusGuard = class {
3337
3386
  return true;
3338
3387
  }
3339
3388
  };
3340
- UserStatusGuard = _ts_decorate10([
3389
+ UserStatusGuard = _ts_decorate11([
3341
3390
  Injectable(),
3342
- _ts_param6(0, Inject(AuthRedisService)),
3343
- _ts_param6(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
3344
- _ts_param6(2, Inject(BYMAX_AUTH_OPTIONS)),
3345
- _ts_metadata10("design:type", Function),
3346
- _ts_metadata10("design:paramtypes", [
3391
+ _ts_param7(0, Inject(AuthRedisService)),
3392
+ _ts_param7(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
3393
+ _ts_param7(2, Inject(BYMAX_AUTH_OPTIONS)),
3394
+ _ts_metadata11("design:type", Function),
3395
+ _ts_metadata11("design:paramtypes", [
3347
3396
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
3348
3397
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
3349
3398
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3350
3399
  ])
3351
3400
  ], UserStatusGuard);
3352
- function _ts_decorate11(decorators, target, key, desc) {
3401
+ function _ts_decorate12(decorators, target, key, desc) {
3353
3402
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3354
3403
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3355
3404
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3356
3405
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3357
3406
  }
3358
- __name(_ts_decorate11, "_ts_decorate");
3407
+ __name(_ts_decorate12, "_ts_decorate");
3359
3408
  var NoStoreInterceptor = class {
3360
3409
  static {
3361
3410
  __name(this, "NoStoreInterceptor");
@@ -3370,7 +3419,7 @@ var NoStoreInterceptor = class {
3370
3419
  return next.handle();
3371
3420
  }
3372
3421
  };
3373
- NoStoreInterceptor = _ts_decorate11([
3422
+ NoStoreInterceptor = _ts_decorate12([
3374
3423
  Injectable()
3375
3424
  ], NoStoreInterceptor);
3376
3425
  function flattenValidationErrors(errors, parentPath = "") {
@@ -3399,23 +3448,23 @@ function createAuthValidationPipe(options = {}) {
3399
3448
  });
3400
3449
  }
3401
3450
  __name(createAuthValidationPipe, "createAuthValidationPipe");
3402
- function _ts_decorate12(decorators, target, key, desc) {
3451
+ function _ts_decorate13(decorators, target, key, desc) {
3403
3452
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3404
3453
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3405
3454
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3406
3455
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3407
3456
  }
3408
- __name(_ts_decorate12, "_ts_decorate");
3409
- function _ts_metadata11(k, v) {
3457
+ __name(_ts_decorate13, "_ts_decorate");
3458
+ function _ts_metadata12(k, v) {
3410
3459
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3411
3460
  }
3412
- __name(_ts_metadata11, "_ts_metadata");
3413
- function _ts_param7(paramIndex, decorator) {
3461
+ __name(_ts_metadata12, "_ts_metadata");
3462
+ function _ts_param8(paramIndex, decorator) {
3414
3463
  return function(target, key) {
3415
3464
  decorator(target, key, paramIndex);
3416
3465
  };
3417
3466
  }
3418
- __name(_ts_param7, "_ts_param");
3467
+ __name(_ts_param8, "_ts_param");
3419
3468
  var LOCKOUT_PREFIX = "lf:";
3420
3469
  var MAX_IDENTIFIER_LENGTH = 512;
3421
3470
  var BruteForceService = class _BruteForceService {
@@ -3505,33 +3554,33 @@ var BruteForceService = class _BruteForceService {
3505
3554
  }
3506
3555
  }
3507
3556
  };
3508
- BruteForceService = _ts_decorate12([
3557
+ BruteForceService = _ts_decorate13([
3509
3558
  Injectable(),
3510
- _ts_param7(0, Inject(AuthRedisService)),
3511
- _ts_param7(1, Inject(BYMAX_AUTH_OPTIONS)),
3512
- _ts_metadata11("design:type", Function),
3513
- _ts_metadata11("design:paramtypes", [
3559
+ _ts_param8(0, Inject(AuthRedisService)),
3560
+ _ts_param8(1, Inject(BYMAX_AUTH_OPTIONS)),
3561
+ _ts_metadata12("design:type", Function),
3562
+ _ts_metadata12("design:paramtypes", [
3514
3563
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
3515
3564
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3516
3565
  ])
3517
3566
  ], BruteForceService);
3518
- function _ts_decorate13(decorators, target, key, desc) {
3567
+ function _ts_decorate14(decorators, target, key, desc) {
3519
3568
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3520
3569
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3521
3570
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3522
3571
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3523
3572
  }
3524
- __name(_ts_decorate13, "_ts_decorate");
3525
- function _ts_metadata12(k, v) {
3573
+ __name(_ts_decorate14, "_ts_decorate");
3574
+ function _ts_metadata13(k, v) {
3526
3575
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3527
3576
  }
3528
- __name(_ts_metadata12, "_ts_metadata");
3529
- function _ts_param8(paramIndex, decorator) {
3577
+ __name(_ts_metadata13, "_ts_metadata");
3578
+ function _ts_param9(paramIndex, decorator) {
3530
3579
  return function(target, key) {
3531
3580
  decorator(target, key, paramIndex);
3532
3581
  };
3533
3582
  }
3534
- __name(_ts_param8, "_ts_param");
3583
+ __name(_ts_param9, "_ts_param");
3535
3584
  var MAX_ATTEMPTS = 5;
3536
3585
  var MIN_VERIFY_MS = 100;
3537
3586
  var OTP_STORE_LUA = `
@@ -3668,31 +3717,31 @@ var OtpService = class {
3668
3717
  await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
3669
3718
  }
3670
3719
  };
3671
- OtpService = _ts_decorate13([
3720
+ OtpService = _ts_decorate14([
3672
3721
  Injectable(),
3673
- _ts_param8(0, Inject(AuthRedisService)),
3674
- _ts_metadata12("design:type", Function),
3675
- _ts_metadata12("design:paramtypes", [
3722
+ _ts_param9(0, Inject(AuthRedisService)),
3723
+ _ts_metadata13("design:type", Function),
3724
+ _ts_metadata13("design:paramtypes", [
3676
3725
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService
3677
3726
  ])
3678
3727
  ], OtpService);
3679
- function _ts_decorate14(decorators, target, key, desc) {
3728
+ function _ts_decorate15(decorators, target, key, desc) {
3680
3729
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3681
3730
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3682
3731
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3683
3732
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3684
3733
  }
3685
- __name(_ts_decorate14, "_ts_decorate");
3686
- function _ts_metadata13(k, v) {
3734
+ __name(_ts_decorate15, "_ts_decorate");
3735
+ function _ts_metadata14(k, v) {
3687
3736
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3688
3737
  }
3689
- __name(_ts_metadata13, "_ts_metadata");
3690
- function _ts_param9(paramIndex, decorator) {
3738
+ __name(_ts_metadata14, "_ts_metadata");
3739
+ function _ts_param10(paramIndex, decorator) {
3691
3740
  return function(target, key) {
3692
3741
  decorator(target, key, paramIndex);
3693
3742
  };
3694
3743
  }
3695
- __name(_ts_param9, "_ts_param");
3744
+ __name(_ts_param10, "_ts_param");
3696
3745
  var scrypt = promisify(scrypt$1);
3697
3746
  var SCRYPT_KEY_LEN = 64;
3698
3747
  var SALT_BYTES = 16;
@@ -3976,33 +4025,33 @@ var PasswordService = class _PasswordService {
3976
4025
  return timingSafeEqual(candidate, DUMMY_EXPECTED);
3977
4026
  }
3978
4027
  };
3979
- PasswordService = _ts_decorate14([
4028
+ PasswordService = _ts_decorate15([
3980
4029
  Injectable(),
3981
- _ts_param9(0, Inject(BYMAX_AUTH_OPTIONS)),
3982
- _ts_param9(1, Inject(BYMAX_AUTH_BREACH_CHECKER)),
3983
- _ts_metadata13("design:type", Function),
3984
- _ts_metadata13("design:paramtypes", [
4030
+ _ts_param10(0, Inject(BYMAX_AUTH_OPTIONS)),
4031
+ _ts_param10(1, Inject(BYMAX_AUTH_BREACH_CHECKER)),
4032
+ _ts_metadata14("design:type", Function),
4033
+ _ts_metadata14("design:paramtypes", [
3985
4034
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
3986
4035
  typeof IPasswordBreachChecker === "undefined" ? Object : IPasswordBreachChecker
3987
4036
  ])
3988
4037
  ], PasswordService);
3989
- function _ts_decorate15(decorators, target, key, desc) {
4038
+ function _ts_decorate16(decorators, target, key, desc) {
3990
4039
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3991
4040
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3992
4041
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3993
4042
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3994
4043
  }
3995
- __name(_ts_decorate15, "_ts_decorate");
3996
- function _ts_metadata14(k, v) {
4044
+ __name(_ts_decorate16, "_ts_decorate");
4045
+ function _ts_metadata15(k, v) {
3997
4046
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3998
4047
  }
3999
- __name(_ts_metadata14, "_ts_metadata");
4000
- function _ts_param10(paramIndex, decorator) {
4048
+ __name(_ts_metadata15, "_ts_metadata");
4049
+ function _ts_param11(paramIndex, decorator) {
4001
4050
  return function(target, key) {
4002
4051
  decorator(target, key, paramIndex);
4003
4052
  };
4004
4053
  }
4005
- __name(_ts_param10, "_ts_param");
4054
+ __name(_ts_param11, "_ts_param");
4006
4055
  var MAX_IP_LENGTH = 45;
4007
4056
  var SESSION_HASH_RE = /^[a-f0-9]{64}$/;
4008
4057
  var REVOKE_SESSION_LUA = `
@@ -4508,15 +4557,15 @@ var SessionService = class _SessionService {
4508
4557
  }
4509
4558
  }
4510
4559
  };
4511
- SessionService = _ts_decorate15([
4560
+ SessionService = _ts_decorate16([
4512
4561
  Injectable(),
4513
- _ts_param10(0, Inject(BYMAX_AUTH_OPTIONS)),
4514
- _ts_param10(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
4515
- _ts_param10(2, Inject(BYMAX_AUTH_HOOKS)),
4516
- _ts_param10(2, Optional()),
4517
- _ts_param10(3, Inject(AuthRedisService)),
4518
- _ts_metadata14("design:type", Function),
4519
- _ts_metadata14("design:paramtypes", [
4562
+ _ts_param11(0, Inject(BYMAX_AUTH_OPTIONS)),
4563
+ _ts_param11(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
4564
+ _ts_param11(2, Inject(BYMAX_AUTH_HOOKS)),
4565
+ _ts_param11(2, Optional()),
4566
+ _ts_param11(3, Inject(AuthRedisService)),
4567
+ _ts_metadata15("design:type", Function),
4568
+ _ts_metadata15("design:paramtypes", [
4520
4569
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
4521
4570
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
4522
4571
  Object,
@@ -4539,23 +4588,23 @@ function logSafe(value) {
4539
4588
  __name(logSafe, "logSafe");
4540
4589
 
4541
4590
  // src/server/services/token-manager.service.ts
4542
- function _ts_decorate16(decorators, target, key, desc) {
4591
+ function _ts_decorate17(decorators, target, key, desc) {
4543
4592
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4544
4593
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4545
4594
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4546
4595
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4547
4596
  }
4548
- __name(_ts_decorate16, "_ts_decorate");
4549
- function _ts_metadata15(k, v) {
4597
+ __name(_ts_decorate17, "_ts_decorate");
4598
+ function _ts_metadata16(k, v) {
4550
4599
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4551
4600
  }
4552
- __name(_ts_metadata15, "_ts_metadata");
4553
- function _ts_param11(paramIndex, decorator) {
4601
+ __name(_ts_metadata16, "_ts_metadata");
4602
+ function _ts_param12(paramIndex, decorator) {
4554
4603
  return function(target, key) {
4555
4604
  decorator(target, key, paramIndex);
4556
4605
  };
4557
4606
  }
4558
- __name(_ts_param11, "_ts_param");
4607
+ __name(_ts_param12, "_ts_param");
4559
4608
  var MFA_TEMP_TOKEN_TTL_SECONDS = 300;
4560
4609
  var MAX_SESSION_FIELD_LENGTH = 45;
4561
4610
  var TokenManagerService = class _TokenManagerService {
@@ -5351,15 +5400,15 @@ var TokenManagerService = class _TokenManagerService {
5351
5400
  return await this.redis.del(`mfa:${sha256(jti)}`);
5352
5401
  }
5353
5402
  };
5354
- TokenManagerService = _ts_decorate16([
5403
+ TokenManagerService = _ts_decorate17([
5355
5404
  Injectable(),
5356
- _ts_param11(0, Inject(JwtService)),
5357
- _ts_param11(1, Inject(BYMAX_AUTH_OPTIONS)),
5358
- _ts_param11(2, Inject(AuthRedisService)),
5359
- _ts_param11(3, Inject(BYMAX_AUTH_HOOKS)),
5360
- _ts_param11(3, Optional()),
5361
- _ts_metadata15("design:type", Function),
5362
- _ts_metadata15("design:paramtypes", [
5405
+ _ts_param12(0, Inject(JwtService)),
5406
+ _ts_param12(1, Inject(BYMAX_AUTH_OPTIONS)),
5407
+ _ts_param12(2, Inject(AuthRedisService)),
5408
+ _ts_param12(3, Inject(BYMAX_AUTH_HOOKS)),
5409
+ _ts_param12(3, Optional()),
5410
+ _ts_metadata16("design:type", Function),
5411
+ _ts_metadata16("design:paramtypes", [
5363
5412
  typeof JwtService === "undefined" ? Object : JwtService,
5364
5413
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
5365
5414
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
@@ -5404,23 +5453,23 @@ function tenantScoped(user, tenantId) {
5404
5453
  __name(tenantScoped, "tenantScoped");
5405
5454
 
5406
5455
  // src/server/services/auth.service.ts
5407
- function _ts_decorate17(decorators, target, key, desc) {
5456
+ function _ts_decorate18(decorators, target, key, desc) {
5408
5457
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5409
5458
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5410
5459
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5411
5460
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5412
5461
  }
5413
- __name(_ts_decorate17, "_ts_decorate");
5414
- function _ts_metadata16(k, v) {
5462
+ __name(_ts_decorate18, "_ts_decorate");
5463
+ function _ts_metadata17(k, v) {
5415
5464
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5416
5465
  }
5417
- __name(_ts_metadata16, "_ts_metadata");
5418
- function _ts_param12(paramIndex, decorator) {
5466
+ __name(_ts_metadata17, "_ts_metadata");
5467
+ function _ts_param13(paramIndex, decorator) {
5419
5468
  return function(target, key) {
5420
5469
  decorator(target, key, paramIndex);
5421
5470
  };
5422
5471
  }
5423
- __name(_ts_param12, "_ts_param");
5472
+ __name(_ts_param13, "_ts_param");
5424
5473
  var ANTI_ENUM_MIN_MS = 300;
5425
5474
  var AuthService = class _AuthService {
5426
5475
  static {
@@ -6149,27 +6198,27 @@ var AuthService = class _AuthService {
6149
6198
  const ttl = this.options.emailVerification.otpTtlSeconds;
6150
6199
  const otp = this.otpService.generate(length);
6151
6200
  await this.otpService.store("email_verification", identifier, otp, ttl);
6152
- void this.emailProvider.sendEmailVerificationOtp(email, otp).catch((err) => {
6201
+ void this.emailProvider.sendEmailVerificationOtp(tenantId, email, otp).catch((err) => {
6153
6202
  this.logger.error(`sendEmailVerificationOtp failed for user ${userId}`, err);
6154
6203
  });
6155
6204
  }
6156
6205
  };
6157
- AuthService = _ts_decorate17([
6206
+ AuthService = _ts_decorate18([
6158
6207
  Injectable(),
6159
- _ts_param12(0, Inject(BYMAX_AUTH_OPTIONS)),
6160
- _ts_param12(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6161
- _ts_param12(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6162
- _ts_param12(2, Optional()),
6163
- _ts_param12(3, Inject(BYMAX_AUTH_HOOKS)),
6164
- _ts_param12(3, Optional()),
6165
- _ts_param12(4, Inject(PasswordService)),
6166
- _ts_param12(5, Inject(TokenManagerService)),
6167
- _ts_param12(6, Inject(BruteForceService)),
6168
- _ts_param12(7, Inject(AuthRedisService)),
6169
- _ts_param12(8, Inject(OtpService)),
6170
- _ts_param12(9, Inject(SessionService)),
6171
- _ts_metadata16("design:type", Function),
6172
- _ts_metadata16("design:paramtypes", [
6208
+ _ts_param13(0, Inject(BYMAX_AUTH_OPTIONS)),
6209
+ _ts_param13(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6210
+ _ts_param13(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6211
+ _ts_param13(2, Optional()),
6212
+ _ts_param13(3, Inject(BYMAX_AUTH_HOOKS)),
6213
+ _ts_param13(3, Optional()),
6214
+ _ts_param13(4, Inject(PasswordService)),
6215
+ _ts_param13(5, Inject(TokenManagerService)),
6216
+ _ts_param13(6, Inject(BruteForceService)),
6217
+ _ts_param13(7, Inject(AuthRedisService)),
6218
+ _ts_param13(8, Inject(OtpService)),
6219
+ _ts_param13(9, Inject(SessionService)),
6220
+ _ts_metadata17("design:type", Function),
6221
+ _ts_metadata17("design:paramtypes", [
6173
6222
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
6174
6223
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
6175
6224
  Object,
@@ -6192,23 +6241,23 @@ __name(toSafeUser2, "toSafeUser");
6192
6241
  var WS_TICKET_TTL_SECONDS = 30;
6193
6242
 
6194
6243
  // src/server/services/ws-ticket.service.ts
6195
- function _ts_decorate18(decorators, target, key, desc) {
6244
+ function _ts_decorate19(decorators, target, key, desc) {
6196
6245
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6197
6246
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6198
6247
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6199
6248
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6200
6249
  }
6201
- __name(_ts_decorate18, "_ts_decorate");
6202
- function _ts_metadata17(k, v) {
6250
+ __name(_ts_decorate19, "_ts_decorate");
6251
+ function _ts_metadata18(k, v) {
6203
6252
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6204
6253
  }
6205
- __name(_ts_metadata17, "_ts_metadata");
6206
- function _ts_param13(paramIndex, decorator) {
6254
+ __name(_ts_metadata18, "_ts_metadata");
6255
+ function _ts_param14(paramIndex, decorator) {
6207
6256
  return function(target, key) {
6208
6257
  decorator(target, key, paramIndex);
6209
6258
  };
6210
6259
  }
6211
- __name(_ts_param13, "_ts_param");
6260
+ __name(_ts_param14, "_ts_param");
6212
6261
  var WsTicketService = class _WsTicketService {
6213
6262
  static {
6214
6263
  __name(this, "WsTicketService");
@@ -6276,13 +6325,13 @@ var WsTicketService = class _WsTicketService {
6276
6325
  return snapshot;
6277
6326
  }
6278
6327
  };
6279
- WsTicketService = _ts_decorate18([
6328
+ WsTicketService = _ts_decorate19([
6280
6329
  Injectable(),
6281
- _ts_param13(0, Inject(AuthRedisService)),
6282
- _ts_param13(1, Inject(BYMAX_AUTH_OPTIONS)),
6283
- _ts_param13(2, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6284
- _ts_metadata17("design:type", Function),
6285
- _ts_metadata17("design:paramtypes", [
6330
+ _ts_param14(0, Inject(AuthRedisService)),
6331
+ _ts_param14(1, Inject(BYMAX_AUTH_OPTIONS)),
6332
+ _ts_param14(2, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6333
+ _ts_metadata18("design:type", Function),
6334
+ _ts_metadata18("design:paramtypes", [
6286
6335
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
6287
6336
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
6288
6337
  typeof IUserRepository === "undefined" ? Object : IUserRepository
@@ -6290,23 +6339,23 @@ WsTicketService = _ts_decorate18([
6290
6339
  ], WsTicketService);
6291
6340
 
6292
6341
  // src/server/controllers/auth.controller.ts
6293
- function _ts_decorate19(decorators, target, key, desc) {
6342
+ function _ts_decorate20(decorators, target, key, desc) {
6294
6343
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6295
6344
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6296
6345
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6297
6346
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6298
6347
  }
6299
- __name(_ts_decorate19, "_ts_decorate");
6300
- function _ts_metadata18(k, v) {
6348
+ __name(_ts_decorate20, "_ts_decorate");
6349
+ function _ts_metadata19(k, v) {
6301
6350
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6302
6351
  }
6303
- __name(_ts_metadata18, "_ts_metadata");
6304
- function _ts_param14(paramIndex, decorator) {
6352
+ __name(_ts_metadata19, "_ts_metadata");
6353
+ function _ts_param15(paramIndex, decorator) {
6305
6354
  return function(target, key) {
6306
6355
  decorator(target, key, paramIndex);
6307
6356
  };
6308
6357
  }
6309
- __name(_ts_param14, "_ts_param");
6358
+ __name(_ts_param15, "_ts_param");
6310
6359
  function isMfaChallenge(result) {
6311
6360
  return "mfaRequired" in result && result.mfaRequired === true;
6312
6361
  }
@@ -6448,156 +6497,156 @@ var AuthController = class {
6448
6497
  await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
6449
6498
  }
6450
6499
  };
6451
- _ts_decorate19([
6500
+ _ts_decorate20([
6452
6501
  Public(),
6453
6502
  Throttle(AUTH_THROTTLE_CONFIGS.register),
6454
6503
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
6455
6504
  Post("register"),
6456
- _ts_param14(0, Body()),
6457
- _ts_param14(1, Req()),
6458
- _ts_param14(2, Res({
6505
+ _ts_param15(0, Body()),
6506
+ _ts_param15(1, Req()),
6507
+ _ts_param15(2, Res({
6459
6508
  passthrough: true
6460
6509
  })),
6461
- _ts_metadata18("design:type", Function),
6462
- _ts_metadata18("design:paramtypes", [
6510
+ _ts_metadata19("design:type", Function),
6511
+ _ts_metadata19("design:paramtypes", [
6463
6512
  typeof RegisterDto === "undefined" ? Object : RegisterDto,
6464
6513
  typeof Request === "undefined" ? Object : Request,
6465
6514
  typeof Response === "undefined" ? Object : Response
6466
6515
  ]),
6467
- _ts_metadata18("design:returntype", Promise)
6516
+ _ts_metadata19("design:returntype", Promise)
6468
6517
  ], AuthController.prototype, "register", null);
6469
- _ts_decorate19([
6518
+ _ts_decorate20([
6470
6519
  Public(),
6471
6520
  Throttle(AUTH_THROTTLE_CONFIGS.login),
6472
6521
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
6473
6522
  HttpCode(HttpStatus.OK),
6474
6523
  Post("login"),
6475
- _ts_param14(0, Body()),
6476
- _ts_param14(1, Req()),
6477
- _ts_param14(2, Res({
6524
+ _ts_param15(0, Body()),
6525
+ _ts_param15(1, Req()),
6526
+ _ts_param15(2, Res({
6478
6527
  passthrough: true
6479
6528
  })),
6480
- _ts_metadata18("design:type", Function),
6481
- _ts_metadata18("design:paramtypes", [
6529
+ _ts_metadata19("design:type", Function),
6530
+ _ts_metadata19("design:paramtypes", [
6482
6531
  typeof LoginDto === "undefined" ? Object : LoginDto,
6483
6532
  typeof Request === "undefined" ? Object : Request,
6484
6533
  typeof Response === "undefined" ? Object : Response
6485
6534
  ]),
6486
- _ts_metadata18("design:returntype", Promise)
6535
+ _ts_metadata19("design:returntype", Promise)
6487
6536
  ], AuthController.prototype, "login", null);
6488
- _ts_decorate19([
6537
+ _ts_decorate20([
6489
6538
  Public(),
6490
6539
  Throttle(AUTH_THROTTLE_CONFIGS.logout),
6491
6540
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
6492
6541
  HttpCode(HttpStatus.NO_CONTENT),
6493
6542
  Post("logout"),
6494
- _ts_param14(0, Req()),
6495
- _ts_param14(1, Res({
6543
+ _ts_param15(0, Req()),
6544
+ _ts_param15(1, Res({
6496
6545
  passthrough: true
6497
6546
  })),
6498
- _ts_metadata18("design:type", Function),
6499
- _ts_metadata18("design:paramtypes", [
6547
+ _ts_metadata19("design:type", Function),
6548
+ _ts_metadata19("design:paramtypes", [
6500
6549
  typeof Request === "undefined" ? Object : Request,
6501
6550
  typeof Response === "undefined" ? Object : Response
6502
6551
  ]),
6503
- _ts_metadata18("design:returntype", Promise)
6552
+ _ts_metadata19("design:returntype", Promise)
6504
6553
  ], AuthController.prototype, "logout", null);
6505
- _ts_decorate19([
6554
+ _ts_decorate20([
6506
6555
  Public(),
6507
6556
  Throttle(AUTH_THROTTLE_CONFIGS.refresh),
6508
6557
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
6509
6558
  HttpCode(HttpStatus.OK),
6510
6559
  Post("refresh"),
6511
- _ts_param14(0, Req()),
6512
- _ts_param14(1, Res({
6560
+ _ts_param15(0, Req()),
6561
+ _ts_param15(1, Res({
6513
6562
  passthrough: true
6514
6563
  })),
6515
- _ts_metadata18("design:type", Function),
6516
- _ts_metadata18("design:paramtypes", [
6564
+ _ts_metadata19("design:type", Function),
6565
+ _ts_metadata19("design:paramtypes", [
6517
6566
  typeof Request === "undefined" ? Object : Request,
6518
6567
  typeof Response === "undefined" ? Object : Response
6519
6568
  ]),
6520
- _ts_metadata18("design:returntype", Promise)
6569
+ _ts_metadata19("design:returntype", Promise)
6521
6570
  ], AuthController.prototype, "refresh", null);
6522
- _ts_decorate19([
6571
+ _ts_decorate20([
6523
6572
  UseGuards(JwtAuthGuard),
6524
6573
  Get("me"),
6525
- _ts_param14(0, CurrentUser()),
6526
- _ts_metadata18("design:type", Function),
6527
- _ts_metadata18("design:paramtypes", [
6574
+ _ts_param15(0, CurrentUser()),
6575
+ _ts_metadata19("design:type", Function),
6576
+ _ts_metadata19("design:paramtypes", [
6528
6577
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
6529
6578
  ]),
6530
- _ts_metadata18("design:returntype", Promise)
6579
+ _ts_metadata19("design:returntype", Promise)
6531
6580
  ], AuthController.prototype, "me", null);
6532
- _ts_decorate19([
6581
+ _ts_decorate20([
6533
6582
  UseGuards(JwtAuthGuard, UserStatusGuard),
6534
6583
  Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
6535
6584
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
6536
6585
  Post("ws-ticket"),
6537
6586
  HttpCode(HttpStatus.OK),
6538
- _ts_param14(0, CurrentUser()),
6539
- _ts_metadata18("design:type", Function),
6540
- _ts_metadata18("design:paramtypes", [
6587
+ _ts_param15(0, CurrentUser()),
6588
+ _ts_metadata19("design:type", Function),
6589
+ _ts_metadata19("design:paramtypes", [
6541
6590
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
6542
6591
  ]),
6543
- _ts_metadata18("design:returntype", Promise)
6592
+ _ts_metadata19("design:returntype", Promise)
6544
6593
  ], AuthController.prototype, "wsTicket", null);
6545
- _ts_decorate19([
6594
+ _ts_decorate20([
6546
6595
  Public(),
6547
6596
  Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
6548
6597
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
6549
6598
  HttpCode(HttpStatus.NO_CONTENT),
6550
6599
  Post("verify-email"),
6551
- _ts_param14(0, Body()),
6552
- _ts_param14(1, Req()),
6553
- _ts_metadata18("design:type", Function),
6554
- _ts_metadata18("design:paramtypes", [
6600
+ _ts_param15(0, Body()),
6601
+ _ts_param15(1, Req()),
6602
+ _ts_metadata19("design:type", Function),
6603
+ _ts_metadata19("design:paramtypes", [
6555
6604
  typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
6556
6605
  typeof Request === "undefined" ? Object : Request
6557
6606
  ]),
6558
- _ts_metadata18("design:returntype", Promise)
6607
+ _ts_metadata19("design:returntype", Promise)
6559
6608
  ], AuthController.prototype, "verifyEmail", null);
6560
- _ts_decorate19([
6609
+ _ts_decorate20([
6561
6610
  Public(),
6562
6611
  Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
6563
6612
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
6564
6613
  HttpCode(HttpStatus.NO_CONTENT),
6565
6614
  Post("resend-verification"),
6566
- _ts_param14(0, Body()),
6567
- _ts_param14(1, Req()),
6568
- _ts_metadata18("design:type", Function),
6569
- _ts_metadata18("design:paramtypes", [
6615
+ _ts_param15(0, Body()),
6616
+ _ts_param15(1, Req()),
6617
+ _ts_metadata19("design:type", Function),
6618
+ _ts_metadata19("design:paramtypes", [
6570
6619
  typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
6571
6620
  typeof Request === "undefined" ? Object : Request
6572
6621
  ]),
6573
- _ts_metadata18("design:returntype", Promise)
6622
+ _ts_metadata19("design:returntype", Promise)
6574
6623
  ], AuthController.prototype, "resendVerification", null);
6575
- AuthController = _ts_decorate19([
6624
+ AuthController = _ts_decorate20([
6576
6625
  UseInterceptors(NoStoreInterceptor),
6577
6626
  Controller(),
6578
6627
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
6579
6628
  UsePipes(createAuthValidationPipe()),
6580
- _ts_param14(0, Inject(AuthService)),
6581
- _ts_param14(1, Inject(TokenDeliveryService)),
6582
- _ts_param14(2, Inject(WsTicketService)),
6583
- _ts_metadata18("design:type", Function),
6584
- _ts_metadata18("design:paramtypes", [
6629
+ _ts_param15(0, Inject(AuthService)),
6630
+ _ts_param15(1, Inject(TokenDeliveryService)),
6631
+ _ts_param15(2, Inject(WsTicketService)),
6632
+ _ts_metadata19("design:type", Function),
6633
+ _ts_metadata19("design:paramtypes", [
6585
6634
  typeof AuthService === "undefined" ? Object : AuthService,
6586
6635
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
6587
6636
  typeof WsTicketService === "undefined" ? Object : WsTicketService
6588
6637
  ])
6589
6638
  ], AuthController);
6590
- function _ts_decorate20(decorators, target, key, desc) {
6639
+ function _ts_decorate21(decorators, target, key, desc) {
6591
6640
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6592
6641
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6593
6642
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6594
6643
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6595
6644
  }
6596
- __name(_ts_decorate20, "_ts_decorate");
6597
- function _ts_metadata19(k, v) {
6645
+ __name(_ts_decorate21, "_ts_decorate");
6646
+ function _ts_metadata20(k, v) {
6598
6647
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6599
6648
  }
6600
- __name(_ts_metadata19, "_ts_metadata");
6649
+ __name(_ts_metadata20, "_ts_metadata");
6601
6650
  var ChangeEmailDto = class {
6602
6651
  static {
6603
6652
  __name(this, "ChangeEmailDto");
@@ -6617,30 +6666,30 @@ var ChangeEmailDto = class {
6617
6666
  */
6618
6667
  currentPassword;
6619
6668
  };
6620
- _ts_decorate20([
6669
+ _ts_decorate21([
6621
6670
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
6622
6671
  IsEmail(),
6623
6672
  IsNotEmpty(),
6624
6673
  MaxLength(255),
6625
- _ts_metadata19("design:type", String)
6674
+ _ts_metadata20("design:type", String)
6626
6675
  ], ChangeEmailDto.prototype, "newEmail", void 0);
6627
- _ts_decorate20([
6676
+ _ts_decorate21([
6628
6677
  IsString(),
6629
6678
  MinLength(1),
6630
6679
  MaxLength(128),
6631
- _ts_metadata19("design:type", String)
6680
+ _ts_metadata20("design:type", String)
6632
6681
  ], ChangeEmailDto.prototype, "currentPassword", void 0);
6633
- function _ts_decorate21(decorators, target, key, desc) {
6682
+ function _ts_decorate22(decorators, target, key, desc) {
6634
6683
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6635
6684
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6636
6685
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6637
6686
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6638
6687
  }
6639
- __name(_ts_decorate21, "_ts_decorate");
6640
- function _ts_metadata20(k, v) {
6688
+ __name(_ts_decorate22, "_ts_decorate");
6689
+ function _ts_metadata21(k, v) {
6641
6690
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6642
6691
  }
6643
- __name(_ts_metadata20, "_ts_metadata");
6692
+ __name(_ts_metadata21, "_ts_metadata");
6644
6693
  var ConfirmEmailChangeDto = class {
6645
6694
  static {
6646
6695
  __name(this, "ConfirmEmailChangeDto");
@@ -6653,29 +6702,29 @@ var ConfirmEmailChangeDto = class {
6653
6702
  */
6654
6703
  token;
6655
6704
  };
6656
- _ts_decorate21([
6705
+ _ts_decorate22([
6657
6706
  IsString(),
6658
6707
  IsNotEmpty(),
6659
6708
  Length(64, 64),
6660
- _ts_metadata20("design:type", String)
6709
+ _ts_metadata21("design:type", String)
6661
6710
  ], ConfirmEmailChangeDto.prototype, "token", void 0);
6662
- function _ts_decorate22(decorators, target, key, desc) {
6711
+ function _ts_decorate23(decorators, target, key, desc) {
6663
6712
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6664
6713
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6665
6714
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6666
6715
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6667
6716
  }
6668
- __name(_ts_decorate22, "_ts_decorate");
6669
- function _ts_metadata21(k, v) {
6717
+ __name(_ts_decorate23, "_ts_decorate");
6718
+ function _ts_metadata22(k, v) {
6670
6719
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6671
6720
  }
6672
- __name(_ts_metadata21, "_ts_metadata");
6673
- function _ts_param15(paramIndex, decorator) {
6721
+ __name(_ts_metadata22, "_ts_metadata");
6722
+ function _ts_param16(paramIndex, decorator) {
6674
6723
  return function(target, key) {
6675
6724
  decorator(target, key, paramIndex);
6676
6725
  };
6677
6726
  }
6678
- __name(_ts_param15, "_ts_param");
6727
+ __name(_ts_param16, "_ts_param");
6679
6728
  var EMAIL_CHANGE_TOKEN_BYTES = 32;
6680
6729
  function isEmailChangeContext(value) {
6681
6730
  if (typeof value !== "object" || value === null) return false;
@@ -6765,7 +6814,7 @@ var EmailChangeService = class _EmailChangeService {
6765
6814
  passwordFingerprint: sha256(user.passwordHash)
6766
6815
  };
6767
6816
  await this.redis.set(`ec:${sha256(rawToken)}`, JSON.stringify(context), this.options.emailChange.tokenTtlSeconds);
6768
- await this.emailProvider.sendEmailChangeVerification?.(newEmail, rawToken);
6817
+ await this.emailProvider.sendEmailChangeVerification?.(user.tenantId, newEmail, rawToken);
6769
6818
  this.logger.log(`requestChange: verification sent userId=${userId} newEmail=${maskEmail(newEmail)}`);
6770
6819
  }
6771
6820
  // ---------------------------------------------------------------------------
@@ -6799,7 +6848,7 @@ var EmailChangeService = class _EmailChangeService {
6799
6848
  const oldEmail = user.email;
6800
6849
  await this.userRepo.updateEmail(context.userId, context.newEmail);
6801
6850
  this.logger.log(`confirmChange: address changed userId=${context.userId} from=${maskEmail(oldEmail)} to=${maskEmail(context.newEmail)}`);
6802
- await this.notifyOldAddress(oldEmail, context.newEmail);
6851
+ await this.notifyOldAddress(user.tenantId, oldEmail, context.newEmail);
6803
6852
  }
6804
6853
  // ---------------------------------------------------------------------------
6805
6854
  // Private helpers
@@ -6879,25 +6928,25 @@ var EmailChangeService = class _EmailChangeService {
6879
6928
  * @param oldEmail - The address the account is leaving.
6880
6929
  * @param newEmail - The address it moved to.
6881
6930
  */
6882
- async notifyOldAddress(oldEmail, newEmail) {
6931
+ async notifyOldAddress(tenantId, oldEmail, newEmail) {
6883
6932
  if (!this.emailProvider.sendEmailChangedNotification) return;
6884
6933
  try {
6885
- await this.emailProvider.sendEmailChangedNotification(oldEmail, newEmail);
6934
+ await this.emailProvider.sendEmailChangedNotification(tenantId, oldEmail, newEmail);
6886
6935
  } catch (err) {
6887
6936
  this.logger.error("confirmChange: notification to the previous address failed", err);
6888
6937
  }
6889
6938
  }
6890
6939
  };
6891
- EmailChangeService = _ts_decorate22([
6940
+ EmailChangeService = _ts_decorate23([
6892
6941
  Injectable(),
6893
- _ts_param15(0, Inject(BYMAX_AUTH_OPTIONS)),
6894
- _ts_param15(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6895
- _ts_param15(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6896
- _ts_param15(3, Inject(PasswordService)),
6897
- _ts_param15(4, Inject(AuthRedisService)),
6898
- _ts_param15(5, Inject(BruteForceService)),
6899
- _ts_metadata21("design:type", Function),
6900
- _ts_metadata21("design:paramtypes", [
6942
+ _ts_param16(0, Inject(BYMAX_AUTH_OPTIONS)),
6943
+ _ts_param16(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
6944
+ _ts_param16(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
6945
+ _ts_param16(3, Inject(PasswordService)),
6946
+ _ts_param16(4, Inject(AuthRedisService)),
6947
+ _ts_param16(5, Inject(BruteForceService)),
6948
+ _ts_metadata22("design:type", Function),
6949
+ _ts_metadata22("design:paramtypes", [
6901
6950
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
6902
6951
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
6903
6952
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
@@ -6908,23 +6957,23 @@ EmailChangeService = _ts_decorate22([
6908
6957
  ], EmailChangeService);
6909
6958
 
6910
6959
  // src/server/controllers/email-change.controller.ts
6911
- function _ts_decorate23(decorators, target, key, desc) {
6960
+ function _ts_decorate24(decorators, target, key, desc) {
6912
6961
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6913
6962
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6914
6963
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6915
6964
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6916
6965
  }
6917
- __name(_ts_decorate23, "_ts_decorate");
6918
- function _ts_metadata22(k, v) {
6966
+ __name(_ts_decorate24, "_ts_decorate");
6967
+ function _ts_metadata23(k, v) {
6919
6968
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6920
6969
  }
6921
- __name(_ts_metadata22, "_ts_metadata");
6922
- function _ts_param16(paramIndex, decorator) {
6970
+ __name(_ts_metadata23, "_ts_metadata");
6971
+ function _ts_param17(paramIndex, decorator) {
6923
6972
  return function(target, key) {
6924
6973
  decorator(target, key, paramIndex);
6925
6974
  };
6926
6975
  }
6927
- __name(_ts_param16, "_ts_param");
6976
+ __name(_ts_param17, "_ts_param");
6928
6977
  var EmailChangeController = class {
6929
6978
  static {
6930
6979
  __name(this, "EmailChangeController");
@@ -6971,56 +7020,56 @@ var EmailChangeController = class {
6971
7020
  await this.emailChangeService.confirmChange(dto);
6972
7021
  }
6973
7022
  };
6974
- _ts_decorate23([
7023
+ _ts_decorate24([
6975
7024
  UseGuards(JwtAuthGuard, UserStatusGuard),
6976
7025
  Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
6977
7026
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
6978
7027
  HttpCode(HttpStatus.NO_CONTENT),
6979
7028
  Post("change"),
6980
- _ts_param16(0, Body()),
6981
- _ts_param16(1, CurrentUser()),
6982
- _ts_metadata22("design:type", Function),
6983
- _ts_metadata22("design:paramtypes", [
7029
+ _ts_param17(0, Body()),
7030
+ _ts_param17(1, CurrentUser()),
7031
+ _ts_metadata23("design:type", Function),
7032
+ _ts_metadata23("design:paramtypes", [
6984
7033
  typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
6985
7034
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
6986
7035
  ]),
6987
- _ts_metadata22("design:returntype", Promise)
7036
+ _ts_metadata23("design:returntype", Promise)
6988
7037
  ], EmailChangeController.prototype, "requestChange", null);
6989
- _ts_decorate23([
7038
+ _ts_decorate24([
6990
7039
  Public(),
6991
7040
  Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
6992
7041
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
6993
7042
  HttpCode(HttpStatus.NO_CONTENT),
6994
7043
  Post("change/confirm"),
6995
- _ts_param16(0, Body()),
6996
- _ts_metadata22("design:type", Function),
6997
- _ts_metadata22("design:paramtypes", [
7044
+ _ts_param17(0, Body()),
7045
+ _ts_metadata23("design:type", Function),
7046
+ _ts_metadata23("design:paramtypes", [
6998
7047
  typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
6999
7048
  ]),
7000
- _ts_metadata22("design:returntype", Promise)
7049
+ _ts_metadata23("design:returntype", Promise)
7001
7050
  ], EmailChangeController.prototype, "confirmChange", null);
7002
- EmailChangeController = _ts_decorate23([
7051
+ EmailChangeController = _ts_decorate24([
7003
7052
  UseInterceptors(NoStoreInterceptor),
7004
7053
  Controller("email"),
7005
7054
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
7006
7055
  UsePipes(createAuthValidationPipe()),
7007
- _ts_param16(0, Inject(EmailChangeService)),
7008
- _ts_metadata22("design:type", Function),
7009
- _ts_metadata22("design:paramtypes", [
7056
+ _ts_param17(0, Inject(EmailChangeService)),
7057
+ _ts_metadata23("design:type", Function),
7058
+ _ts_metadata23("design:paramtypes", [
7010
7059
  typeof EmailChangeService === "undefined" ? Object : EmailChangeService
7011
7060
  ])
7012
7061
  ], EmailChangeController);
7013
- function _ts_decorate24(decorators, target, key, desc) {
7062
+ function _ts_decorate25(decorators, target, key, desc) {
7014
7063
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7015
7064
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7016
7065
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7017
7066
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7018
7067
  }
7019
- __name(_ts_decorate24, "_ts_decorate");
7020
- function _ts_metadata23(k, v) {
7068
+ __name(_ts_decorate25, "_ts_decorate");
7069
+ function _ts_metadata24(k, v) {
7021
7070
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7022
7071
  }
7023
- __name(_ts_metadata23, "_ts_metadata");
7072
+ __name(_ts_metadata24, "_ts_metadata");
7024
7073
  var AcceptInvitationDto = class {
7025
7074
  static {
7026
7075
  __name(this, "AcceptInvitationDto");
@@ -7058,34 +7107,34 @@ var AcceptInvitationDto = class {
7058
7107
  */
7059
7108
  password;
7060
7109
  };
7061
- _ts_decorate24([
7110
+ _ts_decorate25([
7062
7111
  IsString(),
7063
7112
  IsNotEmpty(),
7064
7113
  Length(64, 64),
7065
- _ts_metadata23("design:type", String)
7114
+ _ts_metadata24("design:type", String)
7066
7115
  ], AcceptInvitationDto.prototype, "token", void 0);
7067
- _ts_decorate24([
7116
+ _ts_decorate25([
7068
7117
  IsString(),
7069
7118
  IsNotEmpty(),
7070
7119
  Length(2, 100),
7071
- _ts_metadata23("design:type", String)
7120
+ _ts_metadata24("design:type", String)
7072
7121
  ], AcceptInvitationDto.prototype, "name", void 0);
7073
- _ts_decorate24([
7122
+ _ts_decorate25([
7074
7123
  IsString(),
7075
7124
  Length(8, 128),
7076
- _ts_metadata23("design:type", String)
7125
+ _ts_metadata24("design:type", String)
7077
7126
  ], AcceptInvitationDto.prototype, "password", void 0);
7078
- function _ts_decorate25(decorators, target, key, desc) {
7127
+ function _ts_decorate26(decorators, target, key, desc) {
7079
7128
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7080
7129
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7081
7130
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7082
7131
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7083
7132
  }
7084
- __name(_ts_decorate25, "_ts_decorate");
7085
- function _ts_metadata24(k, v) {
7133
+ __name(_ts_decorate26, "_ts_decorate");
7134
+ function _ts_metadata25(k, v) {
7086
7135
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7087
7136
  }
7088
- __name(_ts_metadata24, "_ts_metadata");
7137
+ __name(_ts_metadata25, "_ts_metadata");
7089
7138
  var CreateInvitationDto = class {
7090
7139
  static {
7091
7140
  __name(this, "CreateInvitationDto");
@@ -7116,37 +7165,37 @@ var CreateInvitationDto = class {
7116
7165
  */
7117
7166
  tenantName;
7118
7167
  };
7119
- _ts_decorate25([
7168
+ _ts_decorate26([
7120
7169
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
7121
7170
  IsEmail(),
7122
7171
  IsNotEmpty(),
7123
7172
  MaxLength(255),
7124
- _ts_metadata24("design:type", String)
7173
+ _ts_metadata25("design:type", String)
7125
7174
  ], CreateInvitationDto.prototype, "email", void 0);
7126
- _ts_decorate25([
7175
+ _ts_decorate26([
7127
7176
  IsString(),
7128
7177
  IsNotEmpty(),
7129
7178
  MaxLength(64),
7130
- _ts_metadata24("design:type", String)
7179
+ _ts_metadata25("design:type", String)
7131
7180
  ], CreateInvitationDto.prototype, "role", void 0);
7132
- _ts_decorate25([
7181
+ _ts_decorate26([
7133
7182
  IsOptional(),
7134
7183
  IsString(),
7135
7184
  IsNotEmpty(),
7136
7185
  MaxLength(128),
7137
- _ts_metadata24("design:type", String)
7186
+ _ts_metadata25("design:type", String)
7138
7187
  ], CreateInvitationDto.prototype, "tenantName", void 0);
7139
- function _ts_decorate26(decorators, target, key, desc) {
7188
+ function _ts_decorate27(decorators, target, key, desc) {
7140
7189
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7141
7190
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7142
7191
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7143
7192
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7144
7193
  }
7145
- __name(_ts_decorate26, "_ts_decorate");
7146
- function _ts_metadata25(k, v) {
7194
+ __name(_ts_decorate27, "_ts_decorate");
7195
+ function _ts_metadata26(k, v) {
7147
7196
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7148
7197
  }
7149
- __name(_ts_metadata25, "_ts_metadata");
7198
+ __name(_ts_metadata26, "_ts_metadata");
7150
7199
  var RevokeInvitationDto = class {
7151
7200
  static {
7152
7201
  __name(this, "RevokeInvitationDto");
@@ -7158,30 +7207,30 @@ var RevokeInvitationDto = class {
7158
7207
  */
7159
7208
  email;
7160
7209
  };
7161
- _ts_decorate26([
7210
+ _ts_decorate27([
7162
7211
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
7163
7212
  IsEmail(),
7164
7213
  IsNotEmpty(),
7165
7214
  MaxLength(255),
7166
- _ts_metadata25("design:type", String)
7215
+ _ts_metadata26("design:type", String)
7167
7216
  ], RevokeInvitationDto.prototype, "email", void 0);
7168
- function _ts_decorate27(decorators, target, key, desc) {
7217
+ function _ts_decorate28(decorators, target, key, desc) {
7169
7218
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7170
7219
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7171
7220
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7172
7221
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7173
7222
  }
7174
- __name(_ts_decorate27, "_ts_decorate");
7175
- function _ts_metadata26(k, v) {
7223
+ __name(_ts_decorate28, "_ts_decorate");
7224
+ function _ts_metadata27(k, v) {
7176
7225
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7177
7226
  }
7178
- __name(_ts_metadata26, "_ts_metadata");
7179
- function _ts_param17(paramIndex, decorator) {
7227
+ __name(_ts_metadata27, "_ts_metadata");
7228
+ function _ts_param18(paramIndex, decorator) {
7180
7229
  return function(target, key) {
7181
7230
  decorator(target, key, paramIndex);
7182
7231
  };
7183
7232
  }
7184
- __name(_ts_param17, "_ts_param");
7233
+ __name(_ts_param18, "_ts_param");
7185
7234
  function isStoredInvitation(value) {
7186
7235
  if (typeof value !== "object" || value === null) return false;
7187
7236
  const v = value;
@@ -7272,7 +7321,7 @@ var InvitationService = class _InvitationService {
7272
7321
  await this.redis.set(tokenKey, JSON.stringify(stored), ttl);
7273
7322
  const displayTenantName = tenantName ?? tenantId;
7274
7323
  const expiresAt = new Date(Date.now() + ttl * 1e3);
7275
- await this.emailProvider.sendInvitation(normalizedEmail, {
7324
+ await this.emailProvider.sendInvitation(tenantId, normalizedEmail, {
7276
7325
  inviterName: inviter.name,
7277
7326
  tenantName: displayTenantName,
7278
7327
  inviteToken: rawToken,
@@ -7608,18 +7657,18 @@ var InvitationService = class _InvitationService {
7608
7657
  return result;
7609
7658
  }
7610
7659
  };
7611
- InvitationService = _ts_decorate27([
7660
+ InvitationService = _ts_decorate28([
7612
7661
  Injectable(),
7613
- _ts_param17(0, Inject(BYMAX_AUTH_USER_REPOSITORY)),
7614
- _ts_param17(1, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
7615
- _ts_param17(2, Inject(BYMAX_AUTH_HOOKS)),
7616
- _ts_param17(3, Inject(AuthRedisService)),
7617
- _ts_param17(4, Inject(PasswordService)),
7618
- _ts_param17(5, Inject(SessionService)),
7619
- _ts_param17(6, Inject(TokenManagerService)),
7620
- _ts_param17(7, Inject(BYMAX_AUTH_OPTIONS)),
7621
- _ts_metadata26("design:type", Function),
7622
- _ts_metadata26("design:paramtypes", [
7662
+ _ts_param18(0, Inject(BYMAX_AUTH_USER_REPOSITORY)),
7663
+ _ts_param18(1, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
7664
+ _ts_param18(2, Inject(BYMAX_AUTH_HOOKS)),
7665
+ _ts_param18(3, Inject(AuthRedisService)),
7666
+ _ts_param18(4, Inject(PasswordService)),
7667
+ _ts_param18(5, Inject(SessionService)),
7668
+ _ts_param18(6, Inject(TokenManagerService)),
7669
+ _ts_param18(7, Inject(BYMAX_AUTH_OPTIONS)),
7670
+ _ts_metadata27("design:type", Function),
7671
+ _ts_metadata27("design:paramtypes", [
7623
7672
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
7624
7673
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
7625
7674
  typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
@@ -7632,23 +7681,23 @@ InvitationService = _ts_decorate27([
7632
7681
  ], InvitationService);
7633
7682
 
7634
7683
  // src/server/controllers/invitation.controller.ts
7635
- function _ts_decorate28(decorators, target, key, desc) {
7684
+ function _ts_decorate29(decorators, target, key, desc) {
7636
7685
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7637
7686
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7638
7687
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7639
7688
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7640
7689
  }
7641
- __name(_ts_decorate28, "_ts_decorate");
7642
- function _ts_metadata27(k, v) {
7690
+ __name(_ts_decorate29, "_ts_decorate");
7691
+ function _ts_metadata28(k, v) {
7643
7692
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7644
7693
  }
7645
- __name(_ts_metadata27, "_ts_metadata");
7646
- function _ts_param18(paramIndex, decorator) {
7694
+ __name(_ts_metadata28, "_ts_metadata");
7695
+ function _ts_param19(paramIndex, decorator) {
7647
7696
  return function(target, key) {
7648
7697
  decorator(target, key, paramIndex);
7649
7698
  };
7650
7699
  }
7651
- __name(_ts_param18, "_ts_param");
7700
+ __name(_ts_param19, "_ts_param");
7652
7701
  var InvitationController = class {
7653
7702
  static {
7654
7703
  __name(this, "InvitationController");
@@ -7724,64 +7773,64 @@ var InvitationController = class {
7724
7773
  return this.tokenDelivery.deliverAuthResponse(res, result, req);
7725
7774
  }
7726
7775
  };
7727
- _ts_decorate28([
7776
+ _ts_decorate29([
7728
7777
  UseGuards(JwtAuthGuard, UserStatusGuard),
7729
7778
  Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
7730
7779
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
7731
7780
  HttpCode(HttpStatus.NO_CONTENT),
7732
7781
  Post(),
7733
- _ts_param18(0, Body()),
7734
- _ts_param18(1, CurrentUser()),
7735
- _ts_metadata27("design:type", Function),
7736
- _ts_metadata27("design:paramtypes", [
7782
+ _ts_param19(0, Body()),
7783
+ _ts_param19(1, CurrentUser()),
7784
+ _ts_metadata28("design:type", Function),
7785
+ _ts_metadata28("design:paramtypes", [
7737
7786
  typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
7738
7787
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
7739
7788
  ]),
7740
- _ts_metadata27("design:returntype", Promise)
7789
+ _ts_metadata28("design:returntype", Promise)
7741
7790
  ], InvitationController.prototype, "invite", null);
7742
- _ts_decorate28([
7791
+ _ts_decorate29([
7743
7792
  UseGuards(JwtAuthGuard, UserStatusGuard),
7744
7793
  Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
7745
7794
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
7746
7795
  HttpCode(HttpStatus.NO_CONTENT),
7747
7796
  Post("revoke"),
7748
- _ts_param18(0, Body()),
7749
- _ts_param18(1, CurrentUser()),
7750
- _ts_metadata27("design:type", Function),
7751
- _ts_metadata27("design:paramtypes", [
7797
+ _ts_param19(0, Body()),
7798
+ _ts_param19(1, CurrentUser()),
7799
+ _ts_metadata28("design:type", Function),
7800
+ _ts_metadata28("design:paramtypes", [
7752
7801
  typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
7753
7802
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
7754
7803
  ]),
7755
- _ts_metadata27("design:returntype", Promise)
7804
+ _ts_metadata28("design:returntype", Promise)
7756
7805
  ], InvitationController.prototype, "revoke", null);
7757
- _ts_decorate28([
7806
+ _ts_decorate29([
7758
7807
  Public(),
7759
7808
  Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
7760
7809
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
7761
7810
  HttpCode(HttpStatus.CREATED),
7762
7811
  Post("accept"),
7763
- _ts_param18(0, Body()),
7764
- _ts_param18(1, Req()),
7765
- _ts_param18(2, Res({
7812
+ _ts_param19(0, Body()),
7813
+ _ts_param19(1, Req()),
7814
+ _ts_param19(2, Res({
7766
7815
  passthrough: true
7767
7816
  })),
7768
- _ts_metadata27("design:type", Function),
7769
- _ts_metadata27("design:paramtypes", [
7817
+ _ts_metadata28("design:type", Function),
7818
+ _ts_metadata28("design:paramtypes", [
7770
7819
  typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
7771
7820
  typeof Request === "undefined" ? Object : Request,
7772
7821
  typeof Response === "undefined" ? Object : Response
7773
7822
  ]),
7774
- _ts_metadata27("design:returntype", Promise)
7823
+ _ts_metadata28("design:returntype", Promise)
7775
7824
  ], InvitationController.prototype, "accept", null);
7776
- InvitationController = _ts_decorate28([
7825
+ InvitationController = _ts_decorate29([
7777
7826
  UseInterceptors(NoStoreInterceptor),
7778
7827
  Controller("invitations"),
7779
7828
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
7780
7829
  UsePipes(createAuthValidationPipe()),
7781
- _ts_param18(0, Inject(InvitationService)),
7782
- _ts_param18(1, Inject(TokenDeliveryService)),
7783
- _ts_metadata27("design:type", Function),
7784
- _ts_metadata27("design:paramtypes", [
7830
+ _ts_param19(0, Inject(InvitationService)),
7831
+ _ts_param19(1, Inject(TokenDeliveryService)),
7832
+ _ts_metadata28("design:type", Function),
7833
+ _ts_metadata28("design:paramtypes", [
7785
7834
  typeof InvitationService === "undefined" ? Object : InvitationService,
7786
7835
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
7787
7836
  ])
@@ -7792,17 +7841,17 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
7792
7841
  var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
7793
7842
  var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
7794
7843
  var SkipMfa = /* @__PURE__ */ __name(() => SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
7795
- function _ts_decorate29(decorators, target, key, desc) {
7844
+ function _ts_decorate30(decorators, target, key, desc) {
7796
7845
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7797
7846
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7798
7847
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7799
7848
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7800
7849
  }
7801
- __name(_ts_decorate29, "_ts_decorate");
7802
- function _ts_metadata28(k, v) {
7850
+ __name(_ts_decorate30, "_ts_decorate");
7851
+ function _ts_metadata29(k, v) {
7803
7852
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7804
7853
  }
7805
- __name(_ts_metadata28, "_ts_metadata");
7854
+ __name(_ts_metadata29, "_ts_metadata");
7806
7855
  var MfaChallengeDto = class {
7807
7856
  static {
7808
7857
  __name(this, "MfaChallengeDto");
@@ -7838,33 +7887,33 @@ var MfaChallengeDto = class {
7838
7887
  */
7839
7888
  code;
7840
7889
  };
7841
- _ts_decorate29([
7890
+ _ts_decorate30([
7842
7891
  IsOptional(),
7843
7892
  IsString(),
7844
7893
  IsNotEmpty(),
7845
7894
  MaxLength(512),
7846
- _ts_metadata28("design:type", String)
7895
+ _ts_metadata29("design:type", String)
7847
7896
  ], MfaChallengeDto.prototype, "mfaTempToken", void 0);
7848
- _ts_decorate29([
7897
+ _ts_decorate30([
7849
7898
  Matches(/^(\d{6}|[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4})$/, {
7850
7899
  message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
7851
7900
  }),
7852
7901
  IsString(),
7853
7902
  IsNotEmpty(),
7854
7903
  MaxLength(29),
7855
- _ts_metadata28("design:type", String)
7904
+ _ts_metadata29("design:type", String)
7856
7905
  ], MfaChallengeDto.prototype, "code", void 0);
7857
- function _ts_decorate30(decorators, target, key, desc) {
7906
+ function _ts_decorate31(decorators, target, key, desc) {
7858
7907
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7859
7908
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7860
7909
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7861
7910
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7862
7911
  }
7863
- __name(_ts_decorate30, "_ts_decorate");
7864
- function _ts_metadata29(k, v) {
7912
+ __name(_ts_decorate31, "_ts_decorate");
7913
+ function _ts_metadata30(k, v) {
7865
7914
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7866
7915
  }
7867
- __name(_ts_metadata29, "_ts_metadata");
7916
+ __name(_ts_metadata30, "_ts_metadata");
7868
7917
  var MfaDisableDto = class {
7869
7918
  static {
7870
7919
  __name(this, "MfaDisableDto");
@@ -7878,26 +7927,26 @@ var MfaDisableDto = class {
7878
7927
  */
7879
7928
  code;
7880
7929
  };
7881
- _ts_decorate30([
7930
+ _ts_decorate31([
7882
7931
  MaxLength(6),
7883
7932
  Matches(/^\d{6}$/, {
7884
7933
  message: "code must be exactly 6 digits"
7885
7934
  }),
7886
7935
  IsString(),
7887
7936
  IsNotEmpty(),
7888
- _ts_metadata29("design:type", String)
7937
+ _ts_metadata30("design:type", String)
7889
7938
  ], MfaDisableDto.prototype, "code", void 0);
7890
- function _ts_decorate31(decorators, target, key, desc) {
7939
+ function _ts_decorate32(decorators, target, key, desc) {
7891
7940
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7892
7941
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7893
7942
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7894
7943
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7895
7944
  }
7896
- __name(_ts_decorate31, "_ts_decorate");
7897
- function _ts_metadata30(k, v) {
7945
+ __name(_ts_decorate32, "_ts_decorate");
7946
+ function _ts_metadata31(k, v) {
7898
7947
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7899
7948
  }
7900
- __name(_ts_metadata30, "_ts_metadata");
7949
+ __name(_ts_metadata31, "_ts_metadata");
7901
7950
  var MfaRegenerateRecoveryCodesDto = class {
7902
7951
  static {
7903
7952
  __name(this, "MfaRegenerateRecoveryCodesDto");
@@ -7911,26 +7960,26 @@ var MfaRegenerateRecoveryCodesDto = class {
7911
7960
  */
7912
7961
  code;
7913
7962
  };
7914
- _ts_decorate31([
7963
+ _ts_decorate32([
7915
7964
  MaxLength(6),
7916
7965
  Matches(/^\d{6}$/, {
7917
7966
  message: "code must be exactly 6 digits"
7918
7967
  }),
7919
7968
  IsString(),
7920
7969
  IsNotEmpty(),
7921
- _ts_metadata30("design:type", String)
7970
+ _ts_metadata31("design:type", String)
7922
7971
  ], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
7923
- function _ts_decorate32(decorators, target, key, desc) {
7972
+ function _ts_decorate33(decorators, target, key, desc) {
7924
7973
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7925
7974
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7926
7975
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7927
7976
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7928
7977
  }
7929
- __name(_ts_decorate32, "_ts_decorate");
7930
- function _ts_metadata31(k, v) {
7978
+ __name(_ts_decorate33, "_ts_decorate");
7979
+ function _ts_metadata32(k, v) {
7931
7980
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7932
7981
  }
7933
- __name(_ts_metadata31, "_ts_metadata");
7982
+ __name(_ts_metadata32, "_ts_metadata");
7934
7983
  var MfaSetupDto = class {
7935
7984
  static {
7936
7985
  __name(this, "MfaSetupDto");
@@ -7954,24 +8003,24 @@ var MfaSetupDto = class {
7954
8003
  */
7955
8004
  password;
7956
8005
  };
7957
- _ts_decorate32([
8006
+ _ts_decorate33([
7958
8007
  IsOptional(),
7959
8008
  IsString(),
7960
8009
  MinLength(1),
7961
8010
  MaxLength(128),
7962
- _ts_metadata31("design:type", String)
8011
+ _ts_metadata32("design:type", String)
7963
8012
  ], MfaSetupDto.prototype, "password", void 0);
7964
- function _ts_decorate33(decorators, target, key, desc) {
8013
+ function _ts_decorate34(decorators, target, key, desc) {
7965
8014
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7966
8015
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7967
8016
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7968
8017
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7969
8018
  }
7970
- __name(_ts_decorate33, "_ts_decorate");
7971
- function _ts_metadata32(k, v) {
8019
+ __name(_ts_decorate34, "_ts_decorate");
8020
+ function _ts_metadata33(k, v) {
7972
8021
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
7973
8022
  }
7974
- __name(_ts_metadata32, "_ts_metadata");
8023
+ __name(_ts_metadata33, "_ts_metadata");
7975
8024
  var MfaVerifyDto = class {
7976
8025
  static {
7977
8026
  __name(this, "MfaVerifyDto");
@@ -7984,14 +8033,14 @@ var MfaVerifyDto = class {
7984
8033
  */
7985
8034
  code;
7986
8035
  };
7987
- _ts_decorate33([
8036
+ _ts_decorate34([
7988
8037
  MaxLength(6),
7989
8038
  Matches(/^\d{6}$/, {
7990
8039
  message: "code must be exactly 6 digits"
7991
8040
  }),
7992
8041
  IsString(),
7993
8042
  IsNotEmpty(),
7994
- _ts_metadata32("design:type", String)
8043
+ _ts_metadata33("design:type", String)
7995
8044
  ], MfaVerifyDto.prototype, "code", void 0);
7996
8045
  var IV_LENGTH = 12;
7997
8046
  var AUTH_TAG_BYTE_LENGTH = 16;
@@ -8043,23 +8092,28 @@ function decrypt(ciphertext, keyBase64) {
8043
8092
  __name(decrypt, "decrypt");
8044
8093
 
8045
8094
  // src/server/services/mfa.service.ts
8046
- function _ts_decorate34(decorators, target, key, desc) {
8095
+ function _ts_decorate35(decorators, target, key, desc) {
8047
8096
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8048
8097
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8049
8098
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8050
8099
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8051
8100
  }
8052
- __name(_ts_decorate34, "_ts_decorate");
8053
- function _ts_metadata33(k, v) {
8101
+ __name(_ts_decorate35, "_ts_decorate");
8102
+ function _ts_metadata34(k, v) {
8054
8103
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
8055
8104
  }
8056
- __name(_ts_metadata33, "_ts_metadata");
8057
- function _ts_param19(paramIndex, decorator) {
8105
+ __name(_ts_metadata34, "_ts_metadata");
8106
+ function _ts_param20(paramIndex, decorator) {
8058
8107
  return function(target, key) {
8059
8108
  decorator(target, key, paramIndex);
8060
8109
  };
8061
8110
  }
8062
- __name(_ts_param19, "_ts_param");
8111
+ __name(_ts_param20, "_ts_param");
8112
+ var PLATFORM_EMAIL_TENANT = "platform";
8113
+ function emailTenantOf(user) {
8114
+ return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
8115
+ }
8116
+ __name(emailTenantOf, "emailTenantOf");
8063
8117
  var MFA_SETUP_TTL_SECONDS = 600;
8064
8118
  var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
8065
8119
  function totpAntiReplayTtlSeconds(window) {
@@ -8571,7 +8625,7 @@ var MfaService = class _MfaService {
8571
8625
  await this.redis.invalidateUserSessions(userId, context);
8572
8626
  await this.redis.bumpUserTokenEpoch(userId, context);
8573
8627
  this.logger.log(`verifyAndEnable: MFA enabled userId=${userId} context=${context}`);
8574
- await this.emailProvider.sendMfaEnabledNotification(user.email);
8628
+ await this.emailProvider.sendMfaEnabledNotification(emailTenantOf(user), user.email);
8575
8629
  if (this.hooks.afterMfaEnabled) {
8576
8630
  const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
8577
8631
  void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
@@ -8748,7 +8802,7 @@ var MfaService = class _MfaService {
8748
8802
  await this.redis.invalidateUserSessions(userId, context);
8749
8803
  await this.redis.bumpUserTokenEpoch(userId, context);
8750
8804
  this.logger.log(`disable: MFA disabled userId=${userId} context=${context}`);
8751
- await this.emailProvider.sendMfaDisabledNotification(user.email);
8805
+ await this.emailProvider.sendMfaDisabledNotification(emailTenantOf(user), user.email);
8752
8806
  const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
8753
8807
  if (this.hooks.afterMfaDisabled) {
8754
8808
  void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
@@ -8814,7 +8868,7 @@ var MfaService = class _MfaService {
8814
8868
  await this.redis.invalidateUserSessions(userId, context);
8815
8869
  await this.redis.bumpUserTokenEpoch(userId, context);
8816
8870
  this.logger.warn(`resetMfa: MFA removed administratively userId=${userId} context=${context}`);
8817
- await this.emailProvider.sendMfaDisabledNotification(user.email);
8871
+ await this.emailProvider.sendMfaDisabledNotification(emailTenantOf(user), user.email);
8818
8872
  const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
8819
8873
  if (this.hooks.afterMfaDisabled) {
8820
8874
  void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
@@ -9023,21 +9077,21 @@ var MfaService = class _MfaService {
9023
9077
  return admin;
9024
9078
  }
9025
9079
  };
9026
- MfaService = _ts_decorate34([
9080
+ MfaService = _ts_decorate35([
9027
9081
  Injectable(),
9028
- _ts_param19(0, Inject(BYMAX_AUTH_OPTIONS)),
9029
- _ts_param19(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
9030
- _ts_param19(2, Optional()),
9031
- _ts_param19(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
9032
- _ts_param19(3, Inject(AuthRedisService)),
9033
- _ts_param19(4, Inject(TokenManagerService)),
9034
- _ts_param19(5, Inject(BruteForceService)),
9035
- _ts_param19(6, Inject(PasswordService)),
9036
- _ts_param19(7, Inject(SessionService)),
9037
- _ts_param19(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
9038
- _ts_param19(9, Inject(BYMAX_AUTH_HOOKS)),
9039
- _ts_metadata33("design:type", Function),
9040
- _ts_metadata33("design:paramtypes", [
9082
+ _ts_param20(0, Inject(BYMAX_AUTH_OPTIONS)),
9083
+ _ts_param20(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
9084
+ _ts_param20(2, Optional()),
9085
+ _ts_param20(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
9086
+ _ts_param20(3, Inject(AuthRedisService)),
9087
+ _ts_param20(4, Inject(TokenManagerService)),
9088
+ _ts_param20(5, Inject(BruteForceService)),
9089
+ _ts_param20(6, Inject(PasswordService)),
9090
+ _ts_param20(7, Inject(SessionService)),
9091
+ _ts_param20(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
9092
+ _ts_param20(9, Inject(BYMAX_AUTH_HOOKS)),
9093
+ _ts_metadata34("design:type", Function),
9094
+ _ts_metadata34("design:paramtypes", [
9041
9095
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
9042
9096
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
9043
9097
  Object,
@@ -9052,23 +9106,23 @@ MfaService = _ts_decorate34([
9052
9106
  ], MfaService);
9053
9107
 
9054
9108
  // src/server/controllers/mfa.controller.ts
9055
- function _ts_decorate35(decorators, target, key, desc) {
9109
+ function _ts_decorate36(decorators, target, key, desc) {
9056
9110
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9057
9111
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9058
9112
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9059
9113
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9060
9114
  }
9061
- __name(_ts_decorate35, "_ts_decorate");
9062
- function _ts_metadata34(k, v) {
9115
+ __name(_ts_decorate36, "_ts_decorate");
9116
+ function _ts_metadata35(k, v) {
9063
9117
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9064
9118
  }
9065
- __name(_ts_metadata34, "_ts_metadata");
9066
- function _ts_param20(paramIndex, decorator) {
9119
+ __name(_ts_metadata35, "_ts_metadata");
9120
+ function _ts_param21(paramIndex, decorator) {
9067
9121
  return function(target, key) {
9068
9122
  decorator(target, key, paramIndex);
9069
9123
  };
9070
9124
  }
9071
- __name(_ts_param20, "_ts_param");
9125
+ __name(_ts_param21, "_ts_param");
9072
9126
  function isPlatformResult(result) {
9073
9127
  return "admin" in result;
9074
9128
  }
@@ -9257,120 +9311,120 @@ var MfaController = class {
9257
9311
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard");
9258
9312
  }
9259
9313
  };
9260
- _ts_decorate35([
9314
+ _ts_decorate36([
9261
9315
  UseGuards(JwtAuthGuard),
9262
9316
  Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
9263
9317
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
9264
9318
  Post("setup"),
9265
- _ts_param20(0, CurrentUser()),
9266
- _ts_param20(1, Body()),
9267
- _ts_metadata34("design:type", Function),
9268
- _ts_metadata34("design:paramtypes", [
9319
+ _ts_param21(0, CurrentUser()),
9320
+ _ts_param21(1, Body()),
9321
+ _ts_metadata35("design:type", Function),
9322
+ _ts_metadata35("design:paramtypes", [
9269
9323
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
9270
9324
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
9271
9325
  ]),
9272
- _ts_metadata34("design:returntype", Promise)
9326
+ _ts_metadata35("design:returntype", Promise)
9273
9327
  ], MfaController.prototype, "setup", null);
9274
- _ts_decorate35([
9328
+ _ts_decorate36([
9275
9329
  UseGuards(JwtAuthGuard),
9276
9330
  Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
9277
9331
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
9278
9332
  HttpCode(HttpStatus.NO_CONTENT),
9279
9333
  Post("verify-enable"),
9280
- _ts_param20(0, CurrentUser()),
9281
- _ts_param20(1, Body()),
9282
- _ts_param20(2, Req()),
9283
- _ts_metadata34("design:type", Function),
9284
- _ts_metadata34("design:paramtypes", [
9334
+ _ts_param21(0, CurrentUser()),
9335
+ _ts_param21(1, Body()),
9336
+ _ts_param21(2, Req()),
9337
+ _ts_metadata35("design:type", Function),
9338
+ _ts_metadata35("design:paramtypes", [
9285
9339
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
9286
9340
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
9287
9341
  typeof Request === "undefined" ? Object : Request
9288
9342
  ]),
9289
- _ts_metadata34("design:returntype", Promise)
9343
+ _ts_metadata35("design:returntype", Promise)
9290
9344
  ], MfaController.prototype, "verifyEnable", null);
9291
- _ts_decorate35([
9345
+ _ts_decorate36([
9292
9346
  Public(),
9293
9347
  SkipMfa(),
9294
9348
  Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
9295
9349
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
9296
9350
  HttpCode(HttpStatus.OK),
9297
9351
  Post("challenge"),
9298
- _ts_param20(0, Body()),
9299
- _ts_param20(1, Req()),
9300
- _ts_param20(2, Res({
9352
+ _ts_param21(0, Body()),
9353
+ _ts_param21(1, Req()),
9354
+ _ts_param21(2, Res({
9301
9355
  passthrough: true
9302
9356
  })),
9303
- _ts_metadata34("design:type", Function),
9304
- _ts_metadata34("design:paramtypes", [
9357
+ _ts_metadata35("design:type", Function),
9358
+ _ts_metadata35("design:paramtypes", [
9305
9359
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
9306
9360
  typeof Request === "undefined" ? Object : Request,
9307
9361
  typeof Response === "undefined" ? Object : Response
9308
9362
  ]),
9309
- _ts_metadata34("design:returntype", Promise)
9363
+ _ts_metadata35("design:returntype", Promise)
9310
9364
  ], MfaController.prototype, "challenge", null);
9311
- _ts_decorate35([
9365
+ _ts_decorate36([
9312
9366
  UseGuards(JwtAuthGuard),
9313
9367
  Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
9314
9368
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
9315
9369
  HttpCode(HttpStatus.NO_CONTENT),
9316
9370
  Post("disable"),
9317
- _ts_param20(0, CurrentUser()),
9318
- _ts_param20(1, Body()),
9319
- _ts_param20(2, Req()),
9320
- _ts_metadata34("design:type", Function),
9321
- _ts_metadata34("design:paramtypes", [
9371
+ _ts_param21(0, CurrentUser()),
9372
+ _ts_param21(1, Body()),
9373
+ _ts_param21(2, Req()),
9374
+ _ts_metadata35("design:type", Function),
9375
+ _ts_metadata35("design:paramtypes", [
9322
9376
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
9323
9377
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
9324
9378
  typeof Request === "undefined" ? Object : Request
9325
9379
  ]),
9326
- _ts_metadata34("design:returntype", Promise)
9380
+ _ts_metadata35("design:returntype", Promise)
9327
9381
  ], MfaController.prototype, "disable", null);
9328
- _ts_decorate35([
9382
+ _ts_decorate36([
9329
9383
  UseGuards(JwtAuthGuard),
9330
9384
  Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
9331
9385
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
9332
9386
  HttpCode(HttpStatus.OK),
9333
9387
  Post("recovery-codes"),
9334
- _ts_param20(0, CurrentUser()),
9335
- _ts_param20(1, Body()),
9336
- _ts_param20(2, Req()),
9337
- _ts_metadata34("design:type", Function),
9338
- _ts_metadata34("design:paramtypes", [
9388
+ _ts_param21(0, CurrentUser()),
9389
+ _ts_param21(1, Body()),
9390
+ _ts_param21(2, Req()),
9391
+ _ts_metadata35("design:type", Function),
9392
+ _ts_metadata35("design:paramtypes", [
9339
9393
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
9340
9394
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
9341
9395
  typeof Request === "undefined" ? Object : Request
9342
9396
  ]),
9343
- _ts_metadata34("design:returntype", Promise)
9397
+ _ts_metadata35("design:returntype", Promise)
9344
9398
  ], MfaController.prototype, "regenerateRecoveryCodes", null);
9345
- MfaController = _ts_decorate35([
9399
+ MfaController = _ts_decorate36([
9346
9400
  UseInterceptors(NoStoreInterceptor),
9347
9401
  Controller("mfa"),
9348
9402
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
9349
9403
  UsePipes(createAuthValidationPipe({
9350
9404
  forbidUnknownValues: true
9351
9405
  })),
9352
- _ts_param20(0, Inject(MfaService)),
9353
- _ts_param20(1, Inject(TokenDeliveryService)),
9354
- _ts_param20(2, Inject(BYMAX_AUTH_OPTIONS)),
9355
- _ts_metadata34("design:type", Function),
9356
- _ts_metadata34("design:paramtypes", [
9406
+ _ts_param21(0, Inject(MfaService)),
9407
+ _ts_param21(1, Inject(TokenDeliveryService)),
9408
+ _ts_param21(2, Inject(BYMAX_AUTH_OPTIONS)),
9409
+ _ts_metadata35("design:type", Function),
9410
+ _ts_metadata35("design:paramtypes", [
9357
9411
  typeof MfaService === "undefined" ? Object : MfaService,
9358
9412
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
9359
9413
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
9360
9414
  ])
9361
9415
  ], MfaController);
9362
9416
  var Authenticated = /* @__PURE__ */ __name(() => SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
9363
- function _ts_decorate36(decorators, target, key, desc) {
9417
+ function _ts_decorate37(decorators, target, key, desc) {
9364
9418
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9365
9419
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9366
9420
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9367
9421
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9368
9422
  }
9369
- __name(_ts_decorate36, "_ts_decorate");
9370
- function _ts_metadata35(k, v) {
9423
+ __name(_ts_decorate37, "_ts_decorate");
9424
+ function _ts_metadata36(k, v) {
9371
9425
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9372
9426
  }
9373
- __name(_ts_metadata35, "_ts_metadata");
9427
+ __name(_ts_metadata36, "_ts_metadata");
9374
9428
  var ChangePasswordDto = class {
9375
9429
  static {
9376
9430
  __name(this, "ChangePasswordDto");
@@ -9403,29 +9457,29 @@ var ChangePasswordDto = class {
9403
9457
  */
9404
9458
  newPassword;
9405
9459
  };
9406
- _ts_decorate36([
9460
+ _ts_decorate37([
9407
9461
  IsString(),
9408
9462
  MinLength(1),
9409
9463
  MaxLength(128),
9410
- _ts_metadata35("design:type", String)
9464
+ _ts_metadata36("design:type", String)
9411
9465
  ], ChangePasswordDto.prototype, "currentPassword", void 0);
9412
- _ts_decorate36([
9466
+ _ts_decorate37([
9413
9467
  IsString(),
9414
9468
  MinLength(8),
9415
9469
  MaxLength(128),
9416
- _ts_metadata35("design:type", String)
9470
+ _ts_metadata36("design:type", String)
9417
9471
  ], ChangePasswordDto.prototype, "newPassword", void 0);
9418
- function _ts_decorate37(decorators, target, key, desc) {
9472
+ function _ts_decorate38(decorators, target, key, desc) {
9419
9473
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9420
9474
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9421
9475
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9422
9476
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9423
9477
  }
9424
- __name(_ts_decorate37, "_ts_decorate");
9425
- function _ts_metadata36(k, v) {
9478
+ __name(_ts_decorate38, "_ts_decorate");
9479
+ function _ts_metadata37(k, v) {
9426
9480
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9427
9481
  }
9428
- __name(_ts_metadata36, "_ts_metadata");
9482
+ __name(_ts_metadata37, "_ts_metadata");
9429
9483
  var ForgotPasswordDto = class {
9430
9484
  static {
9431
9485
  __name(this, "ForgotPasswordDto");
@@ -9441,13 +9495,13 @@ var ForgotPasswordDto = class {
9441
9495
  */
9442
9496
  tenantId;
9443
9497
  };
9444
- _ts_decorate37([
9498
+ _ts_decorate38([
9445
9499
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
9446
9500
  IsEmail(),
9447
9501
  MaxLength(255),
9448
- _ts_metadata36("design:type", String)
9502
+ _ts_metadata37("design:type", String)
9449
9503
  ], ForgotPasswordDto.prototype, "email", void 0);
9450
- _ts_decorate37([
9504
+ _ts_decorate38([
9451
9505
  IsOptional(),
9452
9506
  IsString(),
9453
9507
  IsNotEmpty(),
@@ -9455,19 +9509,19 @@ _ts_decorate37([
9455
9509
  Matches(NO_CONTROL_CHARACTERS, {
9456
9510
  message: "tenantId must not contain control characters"
9457
9511
  }),
9458
- _ts_metadata36("design:type", String)
9512
+ _ts_metadata37("design:type", String)
9459
9513
  ], ForgotPasswordDto.prototype, "tenantId", void 0);
9460
- function _ts_decorate38(decorators, target, key, desc) {
9514
+ function _ts_decorate39(decorators, target, key, desc) {
9461
9515
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9462
9516
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9463
9517
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9464
9518
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9465
9519
  }
9466
- __name(_ts_decorate38, "_ts_decorate");
9467
- function _ts_metadata37(k, v) {
9520
+ __name(_ts_decorate39, "_ts_decorate");
9521
+ function _ts_metadata38(k, v) {
9468
9522
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9469
9523
  }
9470
- __name(_ts_metadata37, "_ts_metadata");
9524
+ __name(_ts_metadata38, "_ts_metadata");
9471
9525
  var ResendOtpDto = class {
9472
9526
  static {
9473
9527
  __name(this, "ResendOtpDto");
@@ -9482,13 +9536,13 @@ var ResendOtpDto = class {
9482
9536
  */
9483
9537
  tenantId;
9484
9538
  };
9485
- _ts_decorate38([
9539
+ _ts_decorate39([
9486
9540
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
9487
9541
  IsEmail(),
9488
9542
  MaxLength(255),
9489
- _ts_metadata37("design:type", String)
9543
+ _ts_metadata38("design:type", String)
9490
9544
  ], ResendOtpDto.prototype, "email", void 0);
9491
- _ts_decorate38([
9545
+ _ts_decorate39([
9492
9546
  IsOptional(),
9493
9547
  IsString(),
9494
9548
  IsNotEmpty(),
@@ -9496,19 +9550,19 @@ _ts_decorate38([
9496
9550
  Matches(NO_CONTROL_CHARACTERS, {
9497
9551
  message: "tenantId must not contain control characters"
9498
9552
  }),
9499
- _ts_metadata37("design:type", String)
9553
+ _ts_metadata38("design:type", String)
9500
9554
  ], ResendOtpDto.prototype, "tenantId", void 0);
9501
- function _ts_decorate39(decorators, target, key, desc) {
9555
+ function _ts_decorate40(decorators, target, key, desc) {
9502
9556
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9503
9557
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9504
9558
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9505
9559
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9506
9560
  }
9507
- __name(_ts_decorate39, "_ts_decorate");
9508
- function _ts_metadata38(k, v) {
9561
+ __name(_ts_decorate40, "_ts_decorate");
9562
+ function _ts_metadata39(k, v) {
9509
9563
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9510
9564
  }
9511
- __name(_ts_metadata38, "_ts_metadata");
9565
+ __name(_ts_metadata39, "_ts_metadata");
9512
9566
  var ResetPasswordDto = class {
9513
9567
  static {
9514
9568
  __name(this, "ResetPasswordDto");
@@ -9555,38 +9609,38 @@ var ResetPasswordDto = class {
9555
9609
  */
9556
9610
  tenantId;
9557
9611
  };
9558
- _ts_decorate39([
9612
+ _ts_decorate40([
9559
9613
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
9560
9614
  IsEmail(),
9561
9615
  MaxLength(255),
9562
- _ts_metadata38("design:type", String)
9616
+ _ts_metadata39("design:type", String)
9563
9617
  ], ResetPasswordDto.prototype, "email", void 0);
9564
- _ts_decorate39([
9618
+ _ts_decorate40([
9565
9619
  IsString(),
9566
9620
  MinLength(8),
9567
9621
  MaxLength(128),
9568
- _ts_metadata38("design:type", String)
9622
+ _ts_metadata39("design:type", String)
9569
9623
  ], ResetPasswordDto.prototype, "newPassword", void 0);
9570
- _ts_decorate39([
9624
+ _ts_decorate40([
9571
9625
  IsOptional(),
9572
9626
  IsString(),
9573
9627
  IsNotEmpty(),
9574
9628
  MaxLength(2048),
9575
- _ts_metadata38("design:type", String)
9629
+ _ts_metadata39("design:type", String)
9576
9630
  ], ResetPasswordDto.prototype, "token", void 0);
9577
- _ts_decorate39([
9631
+ _ts_decorate40([
9578
9632
  IsOptional(),
9579
9633
  IsString(),
9580
9634
  Length(4, 8),
9581
- _ts_metadata38("design:type", String)
9635
+ _ts_metadata39("design:type", String)
9582
9636
  ], ResetPasswordDto.prototype, "otp", void 0);
9583
- _ts_decorate39([
9637
+ _ts_decorate40([
9584
9638
  IsOptional(),
9585
9639
  IsString(),
9586
9640
  Length(64, 64),
9587
- _ts_metadata38("design:type", String)
9641
+ _ts_metadata39("design:type", String)
9588
9642
  ], ResetPasswordDto.prototype, "verifiedToken", void 0);
9589
- _ts_decorate39([
9643
+ _ts_decorate40([
9590
9644
  IsOptional(),
9591
9645
  IsString(),
9592
9646
  IsNotEmpty(),
@@ -9594,19 +9648,19 @@ _ts_decorate39([
9594
9648
  Matches(NO_CONTROL_CHARACTERS, {
9595
9649
  message: "tenantId must not contain control characters"
9596
9650
  }),
9597
- _ts_metadata38("design:type", String)
9651
+ _ts_metadata39("design:type", String)
9598
9652
  ], ResetPasswordDto.prototype, "tenantId", void 0);
9599
- function _ts_decorate40(decorators, target, key, desc) {
9653
+ function _ts_decorate41(decorators, target, key, desc) {
9600
9654
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9601
9655
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9602
9656
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9603
9657
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9604
9658
  }
9605
- __name(_ts_decorate40, "_ts_decorate");
9606
- function _ts_metadata39(k, v) {
9659
+ __name(_ts_decorate41, "_ts_decorate");
9660
+ function _ts_metadata40(k, v) {
9607
9661
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9608
9662
  }
9609
- __name(_ts_metadata39, "_ts_metadata");
9663
+ __name(_ts_metadata40, "_ts_metadata");
9610
9664
  var VerifyOtpDto = class {
9611
9665
  static {
9612
9666
  __name(this, "VerifyOtpDto");
@@ -9628,18 +9682,18 @@ var VerifyOtpDto = class {
9628
9682
  */
9629
9683
  tenantId;
9630
9684
  };
9631
- _ts_decorate40([
9685
+ _ts_decorate41([
9632
9686
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
9633
9687
  IsEmail(),
9634
9688
  MaxLength(255),
9635
- _ts_metadata39("design:type", String)
9689
+ _ts_metadata40("design:type", String)
9636
9690
  ], VerifyOtpDto.prototype, "email", void 0);
9637
- _ts_decorate40([
9691
+ _ts_decorate41([
9638
9692
  IsString(),
9639
9693
  Length(4, 8),
9640
- _ts_metadata39("design:type", String)
9694
+ _ts_metadata40("design:type", String)
9641
9695
  ], VerifyOtpDto.prototype, "otp", void 0);
9642
- _ts_decorate40([
9696
+ _ts_decorate41([
9643
9697
  IsOptional(),
9644
9698
  IsString(),
9645
9699
  IsNotEmpty(),
@@ -9647,25 +9701,25 @@ _ts_decorate40([
9647
9701
  Matches(NO_CONTROL_CHARACTERS, {
9648
9702
  message: "tenantId must not contain control characters"
9649
9703
  }),
9650
- _ts_metadata39("design:type", String)
9704
+ _ts_metadata40("design:type", String)
9651
9705
  ], VerifyOtpDto.prototype, "tenantId", void 0);
9652
- function _ts_decorate41(decorators, target, key, desc) {
9706
+ function _ts_decorate42(decorators, target, key, desc) {
9653
9707
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9654
9708
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9655
9709
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9656
9710
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9657
9711
  }
9658
- __name(_ts_decorate41, "_ts_decorate");
9659
- function _ts_metadata40(k, v) {
9712
+ __name(_ts_decorate42, "_ts_decorate");
9713
+ function _ts_metadata41(k, v) {
9660
9714
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9661
9715
  }
9662
- __name(_ts_metadata40, "_ts_metadata");
9663
- function _ts_param21(paramIndex, decorator) {
9716
+ __name(_ts_metadata41, "_ts_metadata");
9717
+ function _ts_param22(paramIndex, decorator) {
9664
9718
  return function(target, key) {
9665
9719
  decorator(target, key, paramIndex);
9666
9720
  };
9667
9721
  }
9668
- __name(_ts_param21, "_ts_param");
9722
+ __name(_ts_param22, "_ts_param");
9669
9723
  var ANTI_ENUM_MIN_MS2 = 300;
9670
9724
  var VERIFIED_TOKEN_TTL_SECONDS = 300;
9671
9725
  var PASSWORD_RESET_PURPOSE = "password_reset";
@@ -10027,7 +10081,7 @@ var PasswordResetService = class _PasswordResetService {
10027
10081
  async notifyPasswordChanged(user) {
10028
10082
  const send = this.emailProvider?.sendPasswordChangedNotification;
10029
10083
  if (send === void 0) return;
10030
- void Promise.resolve(send.call(this.emailProvider, user.email)).catch((err) => {
10084
+ void Promise.resolve(send.call(this.emailProvider, user.tenantId, user.email)).catch((err) => {
10031
10085
  this.logger.error("notifyPasswordChanged: delivery failed", err);
10032
10086
  });
10033
10087
  }
@@ -10098,7 +10152,7 @@ var PasswordResetService = class _PasswordResetService {
10098
10152
  passwordFingerprint: await this.passwordFingerprintOf(userId)
10099
10153
  };
10100
10154
  await this.redis.set(tokenKey, JSON.stringify(context), this.options.passwordReset.tokenTtlSeconds);
10101
- void Promise.resolve(this.emailProvider.sendPasswordResetToken(email, rawToken)).catch((err) => {
10155
+ void Promise.resolve(this.emailProvider.sendPasswordResetToken(tenantId, email, rawToken)).catch((err) => {
10102
10156
  this.logger.error(`sendPasswordResetToken failed for user ${userId}`, err);
10103
10157
  void this.redis.del(tokenKey).catch((delErr) => {
10104
10158
  this.logger.error(`pw_reset rollback delete failed for user ${userId}`, delErr);
@@ -10118,7 +10172,7 @@ var PasswordResetService = class _PasswordResetService {
10118
10172
  const identifier = this.otpIdentifier(tenantId, email);
10119
10173
  const otp = this.otpService.generate(otpLength);
10120
10174
  await this.otpService.store(PASSWORD_RESET_PURPOSE, identifier, otp, otpTtlSeconds);
10121
- void Promise.resolve(this.emailProvider.sendPasswordResetOtp(email, otp)).catch((err) => {
10175
+ void Promise.resolve(this.emailProvider.sendPasswordResetOtp(tenantId, email, otp)).catch((err) => {
10122
10176
  this.logger.error(`sendPasswordResetOtp failed for user ${userId}`, err);
10123
10177
  });
10124
10178
  }
@@ -10178,21 +10232,21 @@ var PasswordResetService = class _PasswordResetService {
10178
10232
  };
10179
10233
  }
10180
10234
  };
10181
- PasswordResetService = _ts_decorate41([
10235
+ PasswordResetService = _ts_decorate42([
10182
10236
  Injectable(),
10183
- _ts_param21(0, Inject(BYMAX_AUTH_OPTIONS)),
10184
- _ts_param21(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
10185
- _ts_param21(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
10186
- _ts_param21(2, Optional()),
10187
- _ts_param21(3, Inject(BYMAX_AUTH_HOOKS)),
10188
- _ts_param21(3, Optional()),
10189
- _ts_param21(4, Inject(OtpService)),
10190
- _ts_param21(5, Inject(PasswordService)),
10191
- _ts_param21(6, Inject(AuthRedisService)),
10192
- _ts_param21(7, Inject(SessionService)),
10193
- _ts_param21(8, Inject(BruteForceService)),
10194
- _ts_metadata40("design:type", Function),
10195
- _ts_metadata40("design:paramtypes", [
10237
+ _ts_param22(0, Inject(BYMAX_AUTH_OPTIONS)),
10238
+ _ts_param22(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
10239
+ _ts_param22(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
10240
+ _ts_param22(2, Optional()),
10241
+ _ts_param22(3, Inject(BYMAX_AUTH_HOOKS)),
10242
+ _ts_param22(3, Optional()),
10243
+ _ts_param22(4, Inject(OtpService)),
10244
+ _ts_param22(5, Inject(PasswordService)),
10245
+ _ts_param22(6, Inject(AuthRedisService)),
10246
+ _ts_param22(7, Inject(SessionService)),
10247
+ _ts_param22(8, Inject(BruteForceService)),
10248
+ _ts_metadata41("design:type", Function),
10249
+ _ts_metadata41("design:paramtypes", [
10196
10250
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
10197
10251
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
10198
10252
  Object,
@@ -10211,23 +10265,23 @@ function toSafeUser3(user) {
10211
10265
  __name(toSafeUser3, "toSafeUser");
10212
10266
 
10213
10267
  // src/server/controllers/password-reset.controller.ts
10214
- function _ts_decorate42(decorators, target, key, desc) {
10268
+ function _ts_decorate43(decorators, target, key, desc) {
10215
10269
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10216
10270
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10217
10271
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10218
10272
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10219
10273
  }
10220
- __name(_ts_decorate42, "_ts_decorate");
10221
- function _ts_metadata41(k, v) {
10274
+ __name(_ts_decorate43, "_ts_decorate");
10275
+ function _ts_metadata42(k, v) {
10222
10276
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10223
10277
  }
10224
- __name(_ts_metadata41, "_ts_metadata");
10225
- function _ts_param22(paramIndex, decorator) {
10278
+ __name(_ts_metadata42, "_ts_metadata");
10279
+ function _ts_param23(paramIndex, decorator) {
10226
10280
  return function(target, key) {
10227
10281
  decorator(target, key, paramIndex);
10228
10282
  };
10229
10283
  }
10230
- __name(_ts_param22, "_ts_param");
10284
+ __name(_ts_param23, "_ts_param");
10231
10285
  var PasswordResetController = class {
10232
10286
  static {
10233
10287
  __name(this, "PasswordResetController");
@@ -10338,105 +10392,105 @@ var PasswordResetController = class {
10338
10392
  await this.passwordResetService.resendOtp(dto, req);
10339
10393
  }
10340
10394
  };
10341
- _ts_decorate42([
10395
+ _ts_decorate43([
10342
10396
  Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
10343
10397
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
10344
10398
  HttpCode(HttpStatus.OK),
10345
10399
  Post("forgot-password"),
10346
- _ts_param22(0, Body()),
10347
- _ts_param22(1, Req()),
10348
- _ts_metadata41("design:type", Function),
10349
- _ts_metadata41("design:paramtypes", [
10400
+ _ts_param23(0, Body()),
10401
+ _ts_param23(1, Req()),
10402
+ _ts_metadata42("design:type", Function),
10403
+ _ts_metadata42("design:paramtypes", [
10350
10404
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
10351
10405
  typeof Request === "undefined" ? Object : Request
10352
10406
  ]),
10353
- _ts_metadata41("design:returntype", Promise)
10407
+ _ts_metadata42("design:returntype", Promise)
10354
10408
  ], PasswordResetController.prototype, "forgotPassword", null);
10355
- _ts_decorate42([
10409
+ _ts_decorate43([
10356
10410
  Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
10357
10411
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
10358
10412
  HttpCode(HttpStatus.NO_CONTENT),
10359
10413
  Post("reset-password"),
10360
- _ts_param22(0, Body()),
10361
- _ts_param22(1, Req()),
10362
- _ts_metadata41("design:type", Function),
10363
- _ts_metadata41("design:paramtypes", [
10414
+ _ts_param23(0, Body()),
10415
+ _ts_param23(1, Req()),
10416
+ _ts_metadata42("design:type", Function),
10417
+ _ts_metadata42("design:paramtypes", [
10364
10418
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
10365
10419
  typeof Request === "undefined" ? Object : Request
10366
10420
  ]),
10367
- _ts_metadata41("design:returntype", Promise)
10421
+ _ts_metadata42("design:returntype", Promise)
10368
10422
  ], PasswordResetController.prototype, "resetPassword", null);
10369
- _ts_decorate42([
10423
+ _ts_decorate43([
10370
10424
  Authenticated(),
10371
10425
  UseGuards(JwtAuthGuard, UserStatusGuard),
10372
10426
  Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
10373
10427
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
10374
10428
  HttpCode(HttpStatus.NO_CONTENT),
10375
10429
  Post("change"),
10376
- _ts_param22(0, CurrentUser()),
10377
- _ts_param22(1, Body()),
10378
- _ts_param22(2, Req()),
10379
- _ts_metadata41("design:type", Function),
10380
- _ts_metadata41("design:paramtypes", [
10430
+ _ts_param23(0, CurrentUser()),
10431
+ _ts_param23(1, Body()),
10432
+ _ts_param23(2, Req()),
10433
+ _ts_metadata42("design:type", Function),
10434
+ _ts_metadata42("design:paramtypes", [
10381
10435
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
10382
10436
  typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
10383
10437
  typeof Request === "undefined" ? Object : Request
10384
10438
  ]),
10385
- _ts_metadata41("design:returntype", Promise)
10439
+ _ts_metadata42("design:returntype", Promise)
10386
10440
  ], PasswordResetController.prototype, "changePassword", null);
10387
- _ts_decorate42([
10441
+ _ts_decorate43([
10388
10442
  Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
10389
10443
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
10390
10444
  HttpCode(HttpStatus.OK),
10391
10445
  Post("verify-otp"),
10392
- _ts_param22(0, Body()),
10393
- _ts_param22(1, Req()),
10394
- _ts_metadata41("design:type", Function),
10395
- _ts_metadata41("design:paramtypes", [
10446
+ _ts_param23(0, Body()),
10447
+ _ts_param23(1, Req()),
10448
+ _ts_metadata42("design:type", Function),
10449
+ _ts_metadata42("design:paramtypes", [
10396
10450
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
10397
10451
  typeof Request === "undefined" ? Object : Request
10398
10452
  ]),
10399
- _ts_metadata41("design:returntype", Promise)
10453
+ _ts_metadata42("design:returntype", Promise)
10400
10454
  ], PasswordResetController.prototype, "verifyOtp", null);
10401
- _ts_decorate42([
10455
+ _ts_decorate43([
10402
10456
  Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
10403
10457
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
10404
10458
  HttpCode(HttpStatus.OK),
10405
10459
  Post("resend-otp"),
10406
- _ts_param22(0, Body()),
10407
- _ts_param22(1, Req()),
10408
- _ts_metadata41("design:type", Function),
10409
- _ts_metadata41("design:paramtypes", [
10460
+ _ts_param23(0, Body()),
10461
+ _ts_param23(1, Req()),
10462
+ _ts_metadata42("design:type", Function),
10463
+ _ts_metadata42("design:paramtypes", [
10410
10464
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
10411
10465
  typeof Request === "undefined" ? Object : Request
10412
10466
  ]),
10413
- _ts_metadata41("design:returntype", Promise)
10467
+ _ts_metadata42("design:returntype", Promise)
10414
10468
  ], PasswordResetController.prototype, "resendOtp", null);
10415
- PasswordResetController = _ts_decorate42([
10469
+ PasswordResetController = _ts_decorate43([
10416
10470
  Public(),
10417
10471
  UseInterceptors(NoStoreInterceptor),
10418
10472
  Controller("password"),
10419
10473
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
10420
10474
  UsePipes(createAuthValidationPipe()),
10421
- _ts_param22(0, Inject(PasswordResetService)),
10422
- _ts_param22(1, Inject(TokenDeliveryService)),
10423
- _ts_metadata41("design:type", Function),
10424
- _ts_metadata41("design:paramtypes", [
10475
+ _ts_param23(0, Inject(PasswordResetService)),
10476
+ _ts_param23(1, Inject(TokenDeliveryService)),
10477
+ _ts_metadata42("design:type", Function),
10478
+ _ts_metadata42("design:paramtypes", [
10425
10479
  typeof PasswordResetService === "undefined" ? Object : PasswordResetService,
10426
10480
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
10427
10481
  ])
10428
10482
  ], PasswordResetController);
10429
- function _ts_decorate43(decorators, target, key, desc) {
10483
+ function _ts_decorate44(decorators, target, key, desc) {
10430
10484
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10431
10485
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10432
10486
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10433
10487
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10434
10488
  }
10435
- __name(_ts_decorate43, "_ts_decorate");
10436
- function _ts_metadata42(k, v) {
10489
+ __name(_ts_decorate44, "_ts_decorate");
10490
+ function _ts_metadata43(k, v) {
10437
10491
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10438
10492
  }
10439
- __name(_ts_metadata42, "_ts_metadata");
10493
+ __name(_ts_metadata43, "_ts_metadata");
10440
10494
  var PlatformLoginDto = class {
10441
10495
  static {
10442
10496
  __name(this, "PlatformLoginDto");
@@ -10464,14 +10518,14 @@ var PlatformLoginDto = class {
10464
10518
  */
10465
10519
  password;
10466
10520
  };
10467
- _ts_decorate43([
10521
+ _ts_decorate44([
10468
10522
  Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
10469
10523
  IsEmail(),
10470
10524
  IsNotEmpty(),
10471
10525
  MaxLength(255),
10472
- _ts_metadata42("design:type", String)
10526
+ _ts_metadata43("design:type", String)
10473
10527
  ], PlatformLoginDto.prototype, "email", void 0);
10474
- _ts_decorate43([
10528
+ _ts_decorate44([
10475
10529
  IsString(),
10476
10530
  IsNotEmpty(),
10477
10531
  Matches(/\S/, {
@@ -10479,38 +10533,38 @@ _ts_decorate43([
10479
10533
  }),
10480
10534
  MinLength(1),
10481
10535
  MaxLength(128),
10482
- _ts_metadata42("design:type", String)
10536
+ _ts_metadata43("design:type", String)
10483
10537
  ], PlatformLoginDto.prototype, "password", void 0);
10484
- function _ts_decorate44(decorators, target, key, desc) {
10538
+ function _ts_decorate45(decorators, target, key, desc) {
10485
10539
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10486
10540
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10487
10541
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10488
10542
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10489
10543
  }
10490
- __name(_ts_decorate44, "_ts_decorate");
10491
- function _ts_metadata43(k, v) {
10544
+ __name(_ts_decorate45, "_ts_decorate");
10545
+ function _ts_metadata44(k, v) {
10492
10546
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10493
10547
  }
10494
- __name(_ts_metadata43, "_ts_metadata");
10495
- function _ts_param23(paramIndex, decorator) {
10548
+ __name(_ts_metadata44, "_ts_metadata");
10549
+ function _ts_param24(paramIndex, decorator) {
10496
10550
  return function(target, key) {
10497
10551
  decorator(target, key, paramIndex);
10498
10552
  };
10499
10553
  }
10500
- __name(_ts_param23, "_ts_param");
10554
+ __name(_ts_param24, "_ts_param");
10501
10555
  var JwtPlatformGuard = class {
10502
10556
  static {
10503
10557
  __name(this, "JwtPlatformGuard");
10504
10558
  }
10505
10559
  jwtService;
10506
10560
  tokenDelivery;
10507
- redis;
10561
+ revocation;
10508
10562
  reflector;
10509
10563
  options;
10510
- constructor(jwtService, tokenDelivery, redis, reflector, options) {
10564
+ constructor(jwtService, tokenDelivery, revocation, reflector, options) {
10511
10565
  this.jwtService = jwtService;
10512
10566
  this.tokenDelivery = tokenDelivery;
10513
- this.redis = redis;
10567
+ this.revocation = revocation;
10514
10568
  this.reflector = reflector;
10515
10569
  this.options = options;
10516
10570
  }
@@ -10536,51 +10590,46 @@ var JwtPlatformGuard = class {
10536
10590
  if (payload.type !== "platform") {
10537
10591
  throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
10538
10592
  }
10539
- const revoked = await this.redis.get(`rv:${payload.jti}`);
10540
- if (revoked !== null) {
10541
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
10542
- }
10543
- const epoch = await this.redis.getUserTokenEpoch(payload.sub, "platform");
10544
- if (readStampedEpoch(payload) < epoch) {
10593
+ if (await this.revocation.isAccessTokenRevoked(payload, "platform")) {
10545
10594
  throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
10546
10595
  }
10547
10596
  request.user = payload;
10548
10597
  return true;
10549
10598
  }
10550
10599
  };
10551
- JwtPlatformGuard = _ts_decorate44([
10600
+ JwtPlatformGuard = _ts_decorate45([
10552
10601
  Injectable(),
10553
- _ts_param23(0, Inject(JwtService)),
10554
- _ts_param23(1, Inject(TokenDeliveryService)),
10555
- _ts_param23(2, Inject(AuthRedisService)),
10556
- _ts_param23(3, Inject(Reflector)),
10557
- _ts_param23(4, Inject(BYMAX_AUTH_OPTIONS)),
10558
- _ts_metadata43("design:type", Function),
10559
- _ts_metadata43("design:paramtypes", [
10602
+ _ts_param24(0, Inject(JwtService)),
10603
+ _ts_param24(1, Inject(TokenDeliveryService)),
10604
+ _ts_param24(2, Inject(AuthRevocationService)),
10605
+ _ts_param24(3, Inject(Reflector)),
10606
+ _ts_param24(4, Inject(BYMAX_AUTH_OPTIONS)),
10607
+ _ts_metadata44("design:type", Function),
10608
+ _ts_metadata44("design:paramtypes", [
10560
10609
  typeof JwtService === "undefined" ? Object : JwtService,
10561
10610
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
10562
- typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
10611
+ typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
10563
10612
  typeof Reflector === "undefined" ? Object : Reflector,
10564
10613
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
10565
10614
  ])
10566
10615
  ], JwtPlatformGuard);
10567
- function _ts_decorate45(decorators, target, key, desc) {
10616
+ function _ts_decorate46(decorators, target, key, desc) {
10568
10617
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10569
10618
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10570
10619
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10571
10620
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10572
10621
  }
10573
- __name(_ts_decorate45, "_ts_decorate");
10574
- function _ts_metadata44(k, v) {
10622
+ __name(_ts_decorate46, "_ts_decorate");
10623
+ function _ts_metadata45(k, v) {
10575
10624
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10576
10625
  }
10577
- __name(_ts_metadata44, "_ts_metadata");
10578
- function _ts_param24(paramIndex, decorator) {
10626
+ __name(_ts_metadata45, "_ts_metadata");
10627
+ function _ts_param25(paramIndex, decorator) {
10579
10628
  return function(target, key) {
10580
10629
  decorator(target, key, paramIndex);
10581
10630
  };
10582
10631
  }
10583
- __name(_ts_param24, "_ts_param");
10632
+ __name(_ts_param25, "_ts_param");
10584
10633
  var PlatformAuthService = class _PlatformAuthService {
10585
10634
  static {
10586
10635
  __name(this, "PlatformAuthService");
@@ -10802,16 +10851,16 @@ var PlatformAuthService = class _PlatformAuthService {
10802
10851
  await this.redis.bumpUserTokenEpoch(userId, "platform");
10803
10852
  }
10804
10853
  };
10805
- PlatformAuthService = _ts_decorate45([
10854
+ PlatformAuthService = _ts_decorate46([
10806
10855
  Injectable(),
10807
- _ts_param24(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10808
- _ts_param24(1, Inject(PasswordService)),
10809
- _ts_param24(2, Inject(TokenManagerService)),
10810
- _ts_param24(3, Inject(BruteForceService)),
10811
- _ts_param24(4, Inject(AuthRedisService)),
10812
- _ts_param24(5, Inject(BYMAX_AUTH_OPTIONS)),
10813
- _ts_metadata44("design:type", Function),
10814
- _ts_metadata44("design:paramtypes", [
10856
+ _ts_param25(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
10857
+ _ts_param25(1, Inject(PasswordService)),
10858
+ _ts_param25(2, Inject(TokenManagerService)),
10859
+ _ts_param25(3, Inject(BruteForceService)),
10860
+ _ts_param25(4, Inject(AuthRedisService)),
10861
+ _ts_param25(5, Inject(BYMAX_AUTH_OPTIONS)),
10862
+ _ts_metadata45("design:type", Function),
10863
+ _ts_metadata45("design:paramtypes", [
10815
10864
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
10816
10865
  typeof PasswordService === "undefined" ? Object : PasswordService,
10817
10866
  typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
@@ -10822,23 +10871,23 @@ PlatformAuthService = _ts_decorate45([
10822
10871
  ], PlatformAuthService);
10823
10872
 
10824
10873
  // src/server/controllers/platform-auth.controller.ts
10825
- function _ts_decorate46(decorators, target, key, desc) {
10874
+ function _ts_decorate47(decorators, target, key, desc) {
10826
10875
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10827
10876
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10828
10877
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10829
10878
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10830
10879
  }
10831
- __name(_ts_decorate46, "_ts_decorate");
10832
- function _ts_metadata45(k, v) {
10880
+ __name(_ts_decorate47, "_ts_decorate");
10881
+ function _ts_metadata46(k, v) {
10833
10882
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10834
10883
  }
10835
- __name(_ts_metadata45, "_ts_metadata");
10836
- function _ts_param25(paramIndex, decorator) {
10884
+ __name(_ts_metadata46, "_ts_metadata");
10885
+ function _ts_param26(paramIndex, decorator) {
10837
10886
  return function(target, key) {
10838
10887
  decorator(target, key, paramIndex);
10839
10888
  };
10840
10889
  }
10841
- __name(_ts_param25, "_ts_param");
10890
+ __name(_ts_param26, "_ts_param");
10842
10891
  function isPlatformResult2(result) {
10843
10892
  return "admin" in result;
10844
10893
  }
@@ -10998,117 +11047,117 @@ var PlatformAuthController = class {
10998
11047
  await this.platformAuthService.revokeAllPlatformSessions(user.sub);
10999
11048
  }
11000
11049
  };
11001
- _ts_decorate46([
11050
+ _ts_decorate47([
11002
11051
  Public(),
11003
11052
  Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
11004
11053
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
11005
11054
  HttpCode(HttpStatus.OK),
11006
11055
  Post("login"),
11007
- _ts_param25(0, Body()),
11008
- _ts_param25(1, Req()),
11009
- _ts_metadata45("design:type", Function),
11010
- _ts_metadata45("design:paramtypes", [
11056
+ _ts_param26(0, Body()),
11057
+ _ts_param26(1, Req()),
11058
+ _ts_metadata46("design:type", Function),
11059
+ _ts_metadata46("design:paramtypes", [
11011
11060
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
11012
11061
  typeof Request === "undefined" ? Object : Request
11013
11062
  ]),
11014
- _ts_metadata45("design:returntype", Promise)
11063
+ _ts_metadata46("design:returntype", Promise)
11015
11064
  ], PlatformAuthController.prototype, "login", null);
11016
- _ts_decorate46([
11065
+ _ts_decorate47([
11017
11066
  Public(),
11018
11067
  Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
11019
11068
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
11020
11069
  HttpCode(HttpStatus.OK),
11021
11070
  Post("mfa/challenge"),
11022
- _ts_param25(0, Body()),
11023
- _ts_param25(1, Req()),
11024
- _ts_metadata45("design:type", Function),
11025
- _ts_metadata45("design:paramtypes", [
11071
+ _ts_param26(0, Body()),
11072
+ _ts_param26(1, Req()),
11073
+ _ts_metadata46("design:type", Function),
11074
+ _ts_metadata46("design:paramtypes", [
11026
11075
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
11027
11076
  typeof Request === "undefined" ? Object : Request
11028
11077
  ]),
11029
- _ts_metadata45("design:returntype", Promise)
11078
+ _ts_metadata46("design:returntype", Promise)
11030
11079
  ], PlatformAuthController.prototype, "mfaChallenge", null);
11031
- _ts_decorate46([
11080
+ _ts_decorate47([
11032
11081
  UseGuards(JwtPlatformGuard),
11033
11082
  Get("me"),
11034
- _ts_param25(0, CurrentUser()),
11035
- _ts_metadata45("design:type", Function),
11036
- _ts_metadata45("design:paramtypes", [
11083
+ _ts_param26(0, CurrentUser()),
11084
+ _ts_metadata46("design:type", Function),
11085
+ _ts_metadata46("design:paramtypes", [
11037
11086
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
11038
11087
  ]),
11039
- _ts_metadata45("design:returntype", Promise)
11088
+ _ts_metadata46("design:returntype", Promise)
11040
11089
  ], PlatformAuthController.prototype, "me", null);
11041
- _ts_decorate46([
11090
+ _ts_decorate47([
11042
11091
  Public(),
11043
11092
  Throttle(AUTH_THROTTLE_CONFIGS.logout),
11044
11093
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
11045
11094
  HttpCode(HttpStatus.NO_CONTENT),
11046
11095
  Post("logout"),
11047
- _ts_param25(0, Req()),
11048
- _ts_metadata45("design:type", Function),
11049
- _ts_metadata45("design:paramtypes", [
11096
+ _ts_param26(0, Req()),
11097
+ _ts_metadata46("design:type", Function),
11098
+ _ts_metadata46("design:paramtypes", [
11050
11099
  typeof Request === "undefined" ? Object : Request
11051
11100
  ]),
11052
- _ts_metadata45("design:returntype", Promise)
11101
+ _ts_metadata46("design:returntype", Promise)
11053
11102
  ], PlatformAuthController.prototype, "logout", null);
11054
- _ts_decorate46([
11103
+ _ts_decorate47([
11055
11104
  Public(),
11056
11105
  Throttle(AUTH_THROTTLE_CONFIGS.refresh),
11057
11106
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
11058
11107
  HttpCode(HttpStatus.OK),
11059
11108
  Post("refresh"),
11060
- _ts_param25(0, Req()),
11061
- _ts_metadata45("design:type", Function),
11062
- _ts_metadata45("design:paramtypes", [
11109
+ _ts_param26(0, Req()),
11110
+ _ts_metadata46("design:type", Function),
11111
+ _ts_metadata46("design:paramtypes", [
11063
11112
  typeof Request === "undefined" ? Object : Request
11064
11113
  ]),
11065
- _ts_metadata45("design:returntype", Promise)
11114
+ _ts_metadata46("design:returntype", Promise)
11066
11115
  ], PlatformAuthController.prototype, "refresh", null);
11067
- _ts_decorate46([
11116
+ _ts_decorate47([
11068
11117
  UseGuards(JwtPlatformGuard),
11069
11118
  Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
11070
11119
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
11071
11120
  HttpCode(HttpStatus.NO_CONTENT),
11072
11121
  Delete("sessions"),
11073
- _ts_param25(0, CurrentUser()),
11074
- _ts_metadata45("design:type", Function),
11075
- _ts_metadata45("design:paramtypes", [
11122
+ _ts_param26(0, CurrentUser()),
11123
+ _ts_metadata46("design:type", Function),
11124
+ _ts_metadata46("design:paramtypes", [
11076
11125
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
11077
11126
  ]),
11078
- _ts_metadata45("design:returntype", Promise)
11127
+ _ts_metadata46("design:returntype", Promise)
11079
11128
  ], PlatformAuthController.prototype, "revokeSessions", null);
11080
- PlatformAuthController = _ts_decorate46([
11129
+ PlatformAuthController = _ts_decorate47([
11081
11130
  UseInterceptors(NoStoreInterceptor),
11082
11131
  Controller("platform"),
11083
11132
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
11084
11133
  UsePipes(createAuthValidationPipe()),
11085
- _ts_param25(0, Inject(PlatformAuthService)),
11086
- _ts_param25(1, Inject(MfaService)),
11087
- _ts_param25(2, Inject(TokenDeliveryService)),
11088
- _ts_metadata45("design:type", Function),
11089
- _ts_metadata45("design:paramtypes", [
11134
+ _ts_param26(0, Inject(PlatformAuthService)),
11135
+ _ts_param26(1, Inject(MfaService)),
11136
+ _ts_param26(2, Inject(TokenDeliveryService)),
11137
+ _ts_metadata46("design:type", Function),
11138
+ _ts_metadata46("design:paramtypes", [
11090
11139
  typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
11091
11140
  typeof MfaService === "undefined" ? Object : MfaService,
11092
11141
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
11093
11142
  ])
11094
11143
  ], PlatformAuthController);
11095
- function _ts_decorate47(decorators, target, key, desc) {
11144
+ function _ts_decorate48(decorators, target, key, desc) {
11096
11145
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11097
11146
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11098
11147
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11099
11148
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11100
11149
  }
11101
- __name(_ts_decorate47, "_ts_decorate");
11102
- function _ts_metadata46(k, v) {
11150
+ __name(_ts_decorate48, "_ts_decorate");
11151
+ function _ts_metadata47(k, v) {
11103
11152
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11104
11153
  }
11105
- __name(_ts_metadata46, "_ts_metadata");
11106
- function _ts_param26(paramIndex, decorator) {
11154
+ __name(_ts_metadata47, "_ts_metadata");
11155
+ function _ts_param27(paramIndex, decorator) {
11107
11156
  return function(target, key) {
11108
11157
  decorator(target, key, paramIndex);
11109
11158
  };
11110
11159
  }
11111
- __name(_ts_param26, "_ts_param");
11160
+ __name(_ts_param27, "_ts_param");
11112
11161
  var PlatformMfaController = class {
11113
11162
  static {
11114
11163
  __name(this, "PlatformMfaController");
@@ -11187,101 +11236,101 @@ var PlatformMfaController = class {
11187
11236
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
11188
11237
  }
11189
11238
  };
11190
- _ts_decorate47([
11239
+ _ts_decorate48([
11191
11240
  UseGuards(JwtPlatformGuard),
11192
11241
  Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
11193
11242
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
11194
11243
  Post("setup"),
11195
- _ts_param26(0, CurrentUser()),
11196
- _ts_param26(1, Body()),
11197
- _ts_metadata46("design:type", Function),
11198
- _ts_metadata46("design:paramtypes", [
11244
+ _ts_param27(0, CurrentUser()),
11245
+ _ts_param27(1, Body()),
11246
+ _ts_metadata47("design:type", Function),
11247
+ _ts_metadata47("design:paramtypes", [
11199
11248
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
11200
11249
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
11201
11250
  ]),
11202
- _ts_metadata46("design:returntype", Promise)
11251
+ _ts_metadata47("design:returntype", Promise)
11203
11252
  ], PlatformMfaController.prototype, "setup", null);
11204
- _ts_decorate47([
11253
+ _ts_decorate48([
11205
11254
  UseGuards(JwtPlatformGuard),
11206
11255
  Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11207
11256
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11208
11257
  HttpCode(HttpStatus.NO_CONTENT),
11209
11258
  Post("verify-enable"),
11210
- _ts_param26(0, CurrentUser()),
11211
- _ts_param26(1, Body()),
11212
- _ts_param26(2, Req()),
11213
- _ts_metadata46("design:type", Function),
11214
- _ts_metadata46("design:paramtypes", [
11259
+ _ts_param27(0, CurrentUser()),
11260
+ _ts_param27(1, Body()),
11261
+ _ts_param27(2, Req()),
11262
+ _ts_metadata47("design:type", Function),
11263
+ _ts_metadata47("design:paramtypes", [
11215
11264
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
11216
11265
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
11217
11266
  typeof Request === "undefined" ? Object : Request
11218
11267
  ]),
11219
- _ts_metadata46("design:returntype", Promise)
11268
+ _ts_metadata47("design:returntype", Promise)
11220
11269
  ], PlatformMfaController.prototype, "verifyEnable", null);
11221
- _ts_decorate47([
11270
+ _ts_decorate48([
11222
11271
  UseGuards(JwtPlatformGuard),
11223
11272
  Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11224
11273
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
11225
11274
  HttpCode(HttpStatus.NO_CONTENT),
11226
11275
  Post("disable"),
11227
- _ts_param26(0, CurrentUser()),
11228
- _ts_param26(1, Body()),
11229
- _ts_param26(2, Req()),
11230
- _ts_metadata46("design:type", Function),
11231
- _ts_metadata46("design:paramtypes", [
11276
+ _ts_param27(0, CurrentUser()),
11277
+ _ts_param27(1, Body()),
11278
+ _ts_param27(2, Req()),
11279
+ _ts_metadata47("design:type", Function),
11280
+ _ts_metadata47("design:paramtypes", [
11232
11281
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
11233
11282
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
11234
11283
  typeof Request === "undefined" ? Object : Request
11235
11284
  ]),
11236
- _ts_metadata46("design:returntype", Promise)
11285
+ _ts_metadata47("design:returntype", Promise)
11237
11286
  ], PlatformMfaController.prototype, "disable", null);
11238
- _ts_decorate47([
11287
+ _ts_decorate48([
11239
11288
  UseGuards(JwtPlatformGuard),
11240
11289
  Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11241
11290
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
11242
11291
  HttpCode(HttpStatus.OK),
11243
11292
  Post("recovery-codes"),
11244
- _ts_param26(0, CurrentUser()),
11245
- _ts_param26(1, Body()),
11246
- _ts_param26(2, Req()),
11247
- _ts_metadata46("design:type", Function),
11248
- _ts_metadata46("design:paramtypes", [
11293
+ _ts_param27(0, CurrentUser()),
11294
+ _ts_param27(1, Body()),
11295
+ _ts_param27(2, Req()),
11296
+ _ts_metadata47("design:type", Function),
11297
+ _ts_metadata47("design:paramtypes", [
11249
11298
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
11250
11299
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
11251
11300
  typeof Request === "undefined" ? Object : Request
11252
11301
  ]),
11253
- _ts_metadata46("design:returntype", Promise)
11302
+ _ts_metadata47("design:returntype", Promise)
11254
11303
  ], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
11255
- PlatformMfaController = _ts_decorate47([
11304
+ PlatformMfaController = _ts_decorate48([
11256
11305
  UseInterceptors(NoStoreInterceptor),
11257
11306
  Controller("platform/mfa"),
11258
11307
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
11259
11308
  UsePipes(createAuthValidationPipe({
11260
11309
  forbidUnknownValues: true
11261
11310
  })),
11262
- _ts_param26(0, Inject(MfaService)),
11263
- _ts_metadata46("design:type", Function),
11264
- _ts_metadata46("design:paramtypes", [
11311
+ _ts_param27(0, Inject(MfaService)),
11312
+ _ts_metadata47("design:type", Function),
11313
+ _ts_metadata47("design:paramtypes", [
11265
11314
  typeof MfaService === "undefined" ? Object : MfaService
11266
11315
  ])
11267
11316
  ], PlatformMfaController);
11268
- function _ts_decorate48(decorators, target, key, desc) {
11317
+ function _ts_decorate49(decorators, target, key, desc) {
11269
11318
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11270
11319
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11271
11320
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11272
11321
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11273
11322
  }
11274
- __name(_ts_decorate48, "_ts_decorate");
11275
- function _ts_metadata47(k, v) {
11323
+ __name(_ts_decorate49, "_ts_decorate");
11324
+ function _ts_metadata48(k, v) {
11276
11325
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11277
11326
  }
11278
- __name(_ts_metadata47, "_ts_metadata");
11279
- function _ts_param27(paramIndex, decorator) {
11327
+ __name(_ts_metadata48, "_ts_metadata");
11328
+ function _ts_param28(paramIndex, decorator) {
11280
11329
  return function(target, key) {
11281
11330
  decorator(target, key, paramIndex);
11282
11331
  };
11283
11332
  }
11284
- __name(_ts_param27, "_ts_param");
11333
+ __name(_ts_param28, "_ts_param");
11285
11334
  var SessionController = class {
11286
11335
  static {
11287
11336
  __name(this, "SessionController");
@@ -11357,77 +11406,77 @@ var SessionController = class {
11357
11406
  await this.sessionService.revokeOtherSession(user.sub, id);
11358
11407
  }
11359
11408
  };
11360
- _ts_decorate48([
11409
+ _ts_decorate49([
11361
11410
  Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
11362
11411
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
11363
11412
  Get(),
11364
- _ts_param27(0, CurrentUser()),
11365
- _ts_param27(1, Req()),
11366
- _ts_metadata47("design:type", Function),
11367
- _ts_metadata47("design:paramtypes", [
11413
+ _ts_param28(0, CurrentUser()),
11414
+ _ts_param28(1, Req()),
11415
+ _ts_metadata48("design:type", Function),
11416
+ _ts_metadata48("design:paramtypes", [
11368
11417
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11369
11418
  typeof Request === "undefined" ? Object : Request
11370
11419
  ]),
11371
- _ts_metadata47("design:returntype", Promise)
11420
+ _ts_metadata48("design:returntype", Promise)
11372
11421
  ], SessionController.prototype, "listSessions", null);
11373
- _ts_decorate48([
11422
+ _ts_decorate49([
11374
11423
  Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
11375
11424
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
11376
11425
  HttpCode(HttpStatus.NO_CONTENT),
11377
11426
  Delete("all"),
11378
- _ts_param27(0, CurrentUser()),
11379
- _ts_param27(1, Req()),
11380
- _ts_metadata47("design:type", Function),
11381
- _ts_metadata47("design:paramtypes", [
11427
+ _ts_param28(0, CurrentUser()),
11428
+ _ts_param28(1, Req()),
11429
+ _ts_metadata48("design:type", Function),
11430
+ _ts_metadata48("design:paramtypes", [
11382
11431
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11383
11432
  typeof Request === "undefined" ? Object : Request
11384
11433
  ]),
11385
- _ts_metadata47("design:returntype", Promise)
11434
+ _ts_metadata48("design:returntype", Promise)
11386
11435
  ], SessionController.prototype, "revokeAllSessions", null);
11387
- _ts_decorate48([
11436
+ _ts_decorate49([
11388
11437
  Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
11389
11438
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
11390
11439
  HttpCode(HttpStatus.NO_CONTENT),
11391
11440
  Delete(":id"),
11392
- _ts_param27(0, CurrentUser()),
11393
- _ts_param27(1, Param("id")),
11394
- _ts_metadata47("design:type", Function),
11395
- _ts_metadata47("design:paramtypes", [
11441
+ _ts_param28(0, CurrentUser()),
11442
+ _ts_param28(1, Param("id")),
11443
+ _ts_metadata48("design:type", Function),
11444
+ _ts_metadata48("design:paramtypes", [
11396
11445
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11397
11446
  String
11398
11447
  ]),
11399
- _ts_metadata47("design:returntype", Promise)
11448
+ _ts_metadata48("design:returntype", Promise)
11400
11449
  ], SessionController.prototype, "revokeSession", null);
11401
- SessionController = _ts_decorate48([
11450
+ SessionController = _ts_decorate49([
11402
11451
  UseInterceptors(NoStoreInterceptor),
11403
11452
  Controller("sessions"),
11404
11453
  UseGuards(TrustedOriginGuard, AuthRateLimitGuard, JwtAuthGuard, UserStatusGuard),
11405
11454
  UsePipes(createAuthValidationPipe()),
11406
- _ts_param27(0, Inject(SessionService)),
11407
- _ts_param27(1, Inject(TokenDeliveryService)),
11408
- _ts_metadata47("design:type", Function),
11409
- _ts_metadata47("design:paramtypes", [
11455
+ _ts_param28(0, Inject(SessionService)),
11456
+ _ts_param28(1, Inject(TokenDeliveryService)),
11457
+ _ts_metadata48("design:type", Function),
11458
+ _ts_metadata48("design:paramtypes", [
11410
11459
  typeof SessionService === "undefined" ? Object : SessionService,
11411
11460
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
11412
11461
  ])
11413
11462
  ], SessionController);
11414
- function _ts_decorate49(decorators, target, key, desc) {
11463
+ function _ts_decorate50(decorators, target, key, desc) {
11415
11464
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11416
11465
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11417
11466
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11418
11467
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11419
11468
  }
11420
- __name(_ts_decorate49, "_ts_decorate");
11421
- function _ts_metadata48(k, v) {
11469
+ __name(_ts_decorate50, "_ts_decorate");
11470
+ function _ts_metadata49(k, v) {
11422
11471
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11423
11472
  }
11424
- __name(_ts_metadata48, "_ts_metadata");
11425
- function _ts_param28(paramIndex, decorator) {
11473
+ __name(_ts_metadata49, "_ts_metadata");
11474
+ function _ts_param29(paramIndex, decorator) {
11426
11475
  return function(target, key) {
11427
11476
  decorator(target, key, paramIndex);
11428
11477
  };
11429
11478
  }
11430
- __name(_ts_param28, "_ts_param");
11479
+ __name(_ts_param29, "_ts_param");
11431
11480
  var MfaRequiredGuard = class {
11432
11481
  static {
11433
11482
  __name(this, "MfaRequiredGuard");
@@ -11454,11 +11503,11 @@ var MfaRequiredGuard = class {
11454
11503
  return true;
11455
11504
  }
11456
11505
  };
11457
- MfaRequiredGuard = _ts_decorate49([
11506
+ MfaRequiredGuard = _ts_decorate50([
11458
11507
  Injectable(),
11459
- _ts_param28(0, Inject(Reflector)),
11460
- _ts_metadata48("design:type", Function),
11461
- _ts_metadata48("design:paramtypes", [
11508
+ _ts_param29(0, Inject(Reflector)),
11509
+ _ts_metadata49("design:type", Function),
11510
+ _ts_metadata49("design:paramtypes", [
11462
11511
  typeof Reflector === "undefined" ? Object : Reflector
11463
11512
  ])
11464
11513
  ], MfaRequiredGuard);
@@ -11466,23 +11515,23 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
11466
11515
  var PlatformRoles = /* @__PURE__ */ __name((...roles) => SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
11467
11516
 
11468
11517
  // src/server/guards/platform-roles.guard.ts
11469
- function _ts_decorate50(decorators, target, key, desc) {
11518
+ function _ts_decorate51(decorators, target, key, desc) {
11470
11519
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11471
11520
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11472
11521
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11473
11522
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11474
11523
  }
11475
- __name(_ts_decorate50, "_ts_decorate");
11476
- function _ts_metadata49(k, v) {
11524
+ __name(_ts_decorate51, "_ts_decorate");
11525
+ function _ts_metadata50(k, v) {
11477
11526
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11478
11527
  }
11479
- __name(_ts_metadata49, "_ts_metadata");
11480
- function _ts_param29(paramIndex, decorator) {
11528
+ __name(_ts_metadata50, "_ts_metadata");
11529
+ function _ts_param30(paramIndex, decorator) {
11481
11530
  return function(target, key) {
11482
11531
  decorator(target, key, paramIndex);
11483
11532
  };
11484
11533
  }
11485
- __name(_ts_param29, "_ts_param");
11534
+ __name(_ts_param30, "_ts_param");
11486
11535
  var PlatformRolesGuard = class {
11487
11536
  static {
11488
11537
  __name(this, "PlatformRolesGuard");
@@ -11516,12 +11565,12 @@ var PlatformRolesGuard = class {
11516
11565
  return true;
11517
11566
  }
11518
11567
  };
11519
- PlatformRolesGuard = _ts_decorate50([
11568
+ PlatformRolesGuard = _ts_decorate51([
11520
11569
  Injectable(),
11521
- _ts_param29(0, Inject(Reflector)),
11522
- _ts_param29(1, Inject(BYMAX_AUTH_OPTIONS)),
11523
- _ts_metadata49("design:type", Function),
11524
- _ts_metadata49("design:paramtypes", [
11570
+ _ts_param30(0, Inject(Reflector)),
11571
+ _ts_param30(1, Inject(BYMAX_AUTH_OPTIONS)),
11572
+ _ts_metadata50("design:type", Function),
11573
+ _ts_metadata50("design:paramtypes", [
11525
11574
  typeof Reflector === "undefined" ? Object : Reflector,
11526
11575
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11527
11576
  ])
@@ -11530,23 +11579,23 @@ var ROLES_KEY = "roles";
11530
11579
  var Roles = /* @__PURE__ */ __name((...roles) => SetMetadata(ROLES_KEY, roles), "Roles");
11531
11580
 
11532
11581
  // src/server/guards/roles.guard.ts
11533
- function _ts_decorate51(decorators, target, key, desc) {
11582
+ function _ts_decorate52(decorators, target, key, desc) {
11534
11583
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11535
11584
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11536
11585
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11537
11586
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11538
11587
  }
11539
- __name(_ts_decorate51, "_ts_decorate");
11540
- function _ts_metadata50(k, v) {
11588
+ __name(_ts_decorate52, "_ts_decorate");
11589
+ function _ts_metadata51(k, v) {
11541
11590
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11542
11591
  }
11543
- __name(_ts_metadata50, "_ts_metadata");
11544
- function _ts_param30(paramIndex, decorator) {
11592
+ __name(_ts_metadata51, "_ts_metadata");
11593
+ function _ts_param31(paramIndex, decorator) {
11545
11594
  return function(target, key) {
11546
11595
  decorator(target, key, paramIndex);
11547
11596
  };
11548
11597
  }
11549
- __name(_ts_param30, "_ts_param");
11598
+ __name(_ts_param31, "_ts_param");
11550
11599
  var RolesGuard = class {
11551
11600
  static {
11552
11601
  __name(this, "RolesGuard");
@@ -11576,23 +11625,23 @@ var RolesGuard = class {
11576
11625
  return true;
11577
11626
  }
11578
11627
  };
11579
- RolesGuard = _ts_decorate51([
11628
+ RolesGuard = _ts_decorate52([
11580
11629
  Injectable(),
11581
- _ts_param30(0, Inject(Reflector)),
11582
- _ts_param30(1, Inject(BYMAX_AUTH_OPTIONS)),
11583
- _ts_metadata50("design:type", Function),
11584
- _ts_metadata50("design:paramtypes", [
11630
+ _ts_param31(0, Inject(Reflector)),
11631
+ _ts_param31(1, Inject(BYMAX_AUTH_OPTIONS)),
11632
+ _ts_metadata51("design:type", Function),
11633
+ _ts_metadata51("design:paramtypes", [
11585
11634
  typeof Reflector === "undefined" ? Object : Reflector,
11586
11635
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11587
11636
  ])
11588
11637
  ], RolesGuard);
11589
- function _ts_decorate52(decorators, target, key, desc) {
11638
+ function _ts_decorate53(decorators, target, key, desc) {
11590
11639
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11591
11640
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11592
11641
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11593
11642
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11594
11643
  }
11595
- __name(_ts_decorate52, "_ts_decorate");
11644
+ __name(_ts_decorate53, "_ts_decorate");
11596
11645
  var NoOpAuthHooks = class {
11597
11646
  static {
11598
11647
  __name(this, "NoOpAuthHooks");
@@ -11635,7 +11684,7 @@ var NoOpAuthHooks = class {
11635
11684
  };
11636
11685
  }
11637
11686
  };
11638
- NoOpAuthHooks = _ts_decorate52([
11687
+ NoOpAuthHooks = _ts_decorate53([
11639
11688
  Injectable()
11640
11689
  ], NoOpAuthHooks);
11641
11690
 
@@ -11648,23 +11697,23 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
11648
11697
  var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
11649
11698
 
11650
11699
  // src/server/oauth/oauth.service.ts
11651
- function _ts_decorate53(decorators, target, key, desc) {
11700
+ function _ts_decorate54(decorators, target, key, desc) {
11652
11701
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11653
11702
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11654
11703
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11655
11704
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11656
11705
  }
11657
- __name(_ts_decorate53, "_ts_decorate");
11658
- function _ts_metadata51(k, v) {
11706
+ __name(_ts_decorate54, "_ts_decorate");
11707
+ function _ts_metadata52(k, v) {
11659
11708
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11660
11709
  }
11661
- __name(_ts_metadata51, "_ts_metadata");
11662
- function _ts_param31(paramIndex, decorator) {
11710
+ __name(_ts_metadata52, "_ts_metadata");
11711
+ function _ts_param32(paramIndex, decorator) {
11663
11712
  return function(target, key) {
11664
11713
  decorator(target, key, paramIndex);
11665
11714
  };
11666
11715
  }
11667
- __name(_ts_param31, "_ts_param");
11716
+ __name(_ts_param32, "_ts_param");
11668
11717
  var OAUTH_STATE_TTL_SECONDS = 600;
11669
11718
  function isStoredOAuthState(value) {
11670
11719
  if (typeof value !== "object" || value === null) return false;
@@ -11924,18 +11973,18 @@ var OAuthService = class _OAuthService {
11924
11973
  return plugin;
11925
11974
  }
11926
11975
  };
11927
- OAuthService = _ts_decorate53([
11976
+ OAuthService = _ts_decorate54([
11928
11977
  Injectable(),
11929
- _ts_param31(0, Inject(OAUTH_PLUGINS)),
11930
- _ts_param31(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
11931
- _ts_param31(2, Inject(BYMAX_AUTH_HOOKS)),
11932
- _ts_param31(2, Optional()),
11933
- _ts_param31(3, Inject(AuthRedisService)),
11934
- _ts_param31(4, Inject(TokenManagerService)),
11935
- _ts_param31(5, Inject(SessionService)),
11936
- _ts_param31(6, Inject(BYMAX_AUTH_OPTIONS)),
11937
- _ts_metadata51("design:type", Function),
11938
- _ts_metadata51("design:paramtypes", [
11978
+ _ts_param32(0, Inject(OAUTH_PLUGINS)),
11979
+ _ts_param32(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
11980
+ _ts_param32(2, Inject(BYMAX_AUTH_HOOKS)),
11981
+ _ts_param32(2, Optional()),
11982
+ _ts_param32(3, Inject(AuthRedisService)),
11983
+ _ts_param32(4, Inject(TokenManagerService)),
11984
+ _ts_param32(5, Inject(SessionService)),
11985
+ _ts_param32(6, Inject(BYMAX_AUTH_OPTIONS)),
11986
+ _ts_metadata52("design:type", Function),
11987
+ _ts_metadata52("design:paramtypes", [
11939
11988
  Array,
11940
11989
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
11941
11990
  Object,
@@ -11945,17 +11994,17 @@ OAuthService = _ts_decorate53([
11945
11994
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11946
11995
  ])
11947
11996
  ], OAuthService);
11948
- function _ts_decorate54(decorators, target, key, desc) {
11997
+ function _ts_decorate55(decorators, target, key, desc) {
11949
11998
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11950
11999
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11951
12000
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11952
12001
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11953
12002
  }
11954
- __name(_ts_decorate54, "_ts_decorate");
11955
- function _ts_metadata52(k, v) {
12003
+ __name(_ts_decorate55, "_ts_decorate");
12004
+ function _ts_metadata53(k, v) {
11956
12005
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11957
12006
  }
11958
- __name(_ts_metadata52, "_ts_metadata");
12007
+ __name(_ts_metadata53, "_ts_metadata");
11959
12008
  var OAuthCallbackQueryDto = class {
11960
12009
  static {
11961
12010
  __name(this, "OAuthCallbackQueryDto");
@@ -12035,78 +12084,78 @@ var OAuthCallbackQueryDto = class {
12035
12084
  */
12036
12085
  hd;
12037
12086
  };
12038
- _ts_decorate54([
12087
+ _ts_decorate55([
12039
12088
  ValidateIf((query) => query.error === void 0),
12040
12089
  IsString(),
12041
12090
  IsNotEmpty(),
12042
12091
  MaxLength(2048),
12043
- _ts_metadata52("design:type", String)
12092
+ _ts_metadata53("design:type", String)
12044
12093
  ], OAuthCallbackQueryDto.prototype, "code", void 0);
12045
- _ts_decorate54([
12094
+ _ts_decorate55([
12046
12095
  IsOptional(),
12047
12096
  IsString(),
12048
12097
  MaxLength(128),
12049
- _ts_metadata52("design:type", String)
12098
+ _ts_metadata53("design:type", String)
12050
12099
  ], OAuthCallbackQueryDto.prototype, "error", void 0);
12051
- _ts_decorate54([
12100
+ _ts_decorate55([
12052
12101
  IsOptional(),
12053
12102
  IsString(),
12054
12103
  MaxLength(512),
12055
- _ts_metadata52("design:type", String)
12104
+ _ts_metadata53("design:type", String)
12056
12105
  ], OAuthCallbackQueryDto.prototype, "error_description", void 0);
12057
- _ts_decorate54([
12106
+ _ts_decorate55([
12058
12107
  IsOptional(),
12059
12108
  IsString(),
12060
12109
  MaxLength(512),
12061
- _ts_metadata52("design:type", String)
12110
+ _ts_metadata53("design:type", String)
12062
12111
  ], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
12063
- _ts_decorate54([
12112
+ _ts_decorate55([
12064
12113
  IsString(),
12065
12114
  IsNotEmpty(),
12066
12115
  MaxLength(128),
12067
- _ts_metadata52("design:type", String)
12116
+ _ts_metadata53("design:type", String)
12068
12117
  ], OAuthCallbackQueryDto.prototype, "state", void 0);
12069
- _ts_decorate54([
12118
+ _ts_decorate55([
12070
12119
  IsOptional(),
12071
12120
  IsString(),
12072
12121
  MaxLength(512),
12073
- _ts_metadata52("design:type", String)
12122
+ _ts_metadata53("design:type", String)
12074
12123
  ], OAuthCallbackQueryDto.prototype, "iss", void 0);
12075
- _ts_decorate54([
12124
+ _ts_decorate55([
12076
12125
  IsOptional(),
12077
12126
  IsString(),
12078
12127
  MaxLength(2048),
12079
- _ts_metadata52("design:type", String)
12128
+ _ts_metadata53("design:type", String)
12080
12129
  ], OAuthCallbackQueryDto.prototype, "scope", void 0);
12081
- _ts_decorate54([
12130
+ _ts_decorate55([
12082
12131
  IsOptional(),
12083
12132
  IsString(),
12084
12133
  MaxLength(16),
12085
- _ts_metadata52("design:type", String)
12134
+ _ts_metadata53("design:type", String)
12086
12135
  ], OAuthCallbackQueryDto.prototype, "authuser", void 0);
12087
- _ts_decorate54([
12136
+ _ts_decorate55([
12088
12137
  IsOptional(),
12089
12138
  IsString(),
12090
12139
  MaxLength(64),
12091
- _ts_metadata52("design:type", String)
12140
+ _ts_metadata53("design:type", String)
12092
12141
  ], OAuthCallbackQueryDto.prototype, "prompt", void 0);
12093
- _ts_decorate54([
12142
+ _ts_decorate55([
12094
12143
  IsOptional(),
12095
12144
  IsString(),
12096
12145
  MaxLength(253),
12097
- _ts_metadata52("design:type", String)
12146
+ _ts_metadata53("design:type", String)
12098
12147
  ], OAuthCallbackQueryDto.prototype, "hd", void 0);
12099
- function _ts_decorate55(decorators, target, key, desc) {
12148
+ function _ts_decorate56(decorators, target, key, desc) {
12100
12149
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12101
12150
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12102
12151
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12103
12152
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12104
12153
  }
12105
- __name(_ts_decorate55, "_ts_decorate");
12106
- function _ts_metadata53(k, v) {
12154
+ __name(_ts_decorate56, "_ts_decorate");
12155
+ function _ts_metadata54(k, v) {
12107
12156
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12108
12157
  }
12109
- __name(_ts_metadata53, "_ts_metadata");
12158
+ __name(_ts_metadata54, "_ts_metadata");
12110
12159
  var OAuthInitiateQueryDto = class {
12111
12160
  static {
12112
12161
  __name(this, "OAuthInitiateQueryDto");
@@ -12123,7 +12172,7 @@ var OAuthInitiateQueryDto = class {
12123
12172
  */
12124
12173
  tenantId;
12125
12174
  };
12126
- _ts_decorate55([
12175
+ _ts_decorate56([
12127
12176
  IsOptional(),
12128
12177
  IsString(),
12129
12178
  IsNotEmpty(),
@@ -12131,27 +12180,27 @@ _ts_decorate55([
12131
12180
  Matches(NO_CONTROL_CHARACTERS, {
12132
12181
  message: "tenantId must not contain control characters"
12133
12182
  }),
12134
- _ts_metadata53("design:type", String)
12183
+ _ts_metadata54("design:type", String)
12135
12184
  ], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
12136
12185
 
12137
12186
  // src/server/oauth/oauth.controller.ts
12138
- function _ts_decorate56(decorators, target, key, desc) {
12187
+ function _ts_decorate57(decorators, target, key, desc) {
12139
12188
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12140
12189
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12141
12190
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12142
12191
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12143
12192
  }
12144
- __name(_ts_decorate56, "_ts_decorate");
12145
- function _ts_metadata54(k, v) {
12193
+ __name(_ts_decorate57, "_ts_decorate");
12194
+ function _ts_metadata55(k, v) {
12146
12195
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12147
12196
  }
12148
- __name(_ts_metadata54, "_ts_metadata");
12149
- function _ts_param32(paramIndex, decorator) {
12197
+ __name(_ts_metadata55, "_ts_metadata");
12198
+ function _ts_param33(paramIndex, decorator) {
12150
12199
  return function(target, key) {
12151
12200
  decorator(target, key, paramIndex);
12152
12201
  };
12153
12202
  }
12154
- __name(_ts_param32, "_ts_param");
12203
+ __name(_ts_param33, "_ts_param");
12155
12204
  function isOAuthMfaChallenge(result) {
12156
12205
  return "mfaRequired" in result && result.mfaRequired === true;
12157
12206
  }
@@ -12369,46 +12418,46 @@ var OAuthController = class _OAuthController {
12369
12418
  });
12370
12419
  }
12371
12420
  };
12372
- _ts_decorate56([
12421
+ _ts_decorate57([
12373
12422
  Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
12374
12423
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
12375
12424
  Get(":provider"),
12376
- _ts_param32(0, Param("provider")),
12377
- _ts_param32(1, Query()),
12378
- _ts_param32(2, Req()),
12379
- _ts_param32(3, Res({
12425
+ _ts_param33(0, Param("provider")),
12426
+ _ts_param33(1, Query()),
12427
+ _ts_param33(2, Req()),
12428
+ _ts_param33(3, Res({
12380
12429
  passthrough: true
12381
12430
  })),
12382
- _ts_metadata54("design:type", Function),
12383
- _ts_metadata54("design:paramtypes", [
12431
+ _ts_metadata55("design:type", Function),
12432
+ _ts_metadata55("design:paramtypes", [
12384
12433
  String,
12385
12434
  typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
12386
12435
  typeof Request === "undefined" ? Object : Request,
12387
12436
  typeof Response === "undefined" ? Object : Response
12388
12437
  ]),
12389
- _ts_metadata54("design:returntype", Promise)
12438
+ _ts_metadata55("design:returntype", Promise)
12390
12439
  ], OAuthController.prototype, "initiate", null);
12391
- _ts_decorate56([
12440
+ _ts_decorate57([
12392
12441
  Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
12393
12442
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
12394
12443
  HttpCode(HttpStatus.OK),
12395
12444
  Get(":provider/callback"),
12396
- _ts_param32(0, Param("provider")),
12397
- _ts_param32(1, Query()),
12398
- _ts_param32(2, Req()),
12399
- _ts_param32(3, Res({
12445
+ _ts_param33(0, Param("provider")),
12446
+ _ts_param33(1, Query()),
12447
+ _ts_param33(2, Req()),
12448
+ _ts_param33(3, Res({
12400
12449
  passthrough: true
12401
12450
  })),
12402
- _ts_metadata54("design:type", Function),
12403
- _ts_metadata54("design:paramtypes", [
12451
+ _ts_metadata55("design:type", Function),
12452
+ _ts_metadata55("design:paramtypes", [
12404
12453
  String,
12405
12454
  typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
12406
12455
  typeof Request === "undefined" ? Object : Request,
12407
12456
  typeof Response === "undefined" ? Object : Response
12408
12457
  ]),
12409
- _ts_metadata54("design:returntype", Promise)
12458
+ _ts_metadata55("design:returntype", Promise)
12410
12459
  ], OAuthController.prototype, "callback", null);
12411
- OAuthController = _ts_decorate56([
12460
+ OAuthController = _ts_decorate57([
12412
12461
  Public(),
12413
12462
  SkipMfa(),
12414
12463
  UseInterceptors(NoStoreInterceptor),
@@ -12417,11 +12466,11 @@ OAuthController = _ts_decorate56([
12417
12466
  UsePipes(createAuthValidationPipe({
12418
12467
  forbidUnknownValues: true
12419
12468
  })),
12420
- _ts_param32(0, Inject(OAuthService)),
12421
- _ts_param32(1, Inject(TokenDeliveryService)),
12422
- _ts_param32(2, Inject(BYMAX_AUTH_OPTIONS)),
12423
- _ts_metadata54("design:type", Function),
12424
- _ts_metadata54("design:paramtypes", [
12469
+ _ts_param33(0, Inject(OAuthService)),
12470
+ _ts_param33(1, Inject(TokenDeliveryService)),
12471
+ _ts_param33(2, Inject(BYMAX_AUTH_OPTIONS)),
12472
+ _ts_metadata55("design:type", Function),
12473
+ _ts_metadata55("design:paramtypes", [
12425
12474
  typeof OAuthService === "undefined" ? Object : OAuthService,
12426
12475
  typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
12427
12476
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -12560,13 +12609,13 @@ var GoogleOAuthPlugin = class {
12560
12609
  };
12561
12610
 
12562
12611
  // src/server/oauth/oauth.module.ts
12563
- function _ts_decorate57(decorators, target, key, desc) {
12612
+ function _ts_decorate58(decorators, target, key, desc) {
12564
12613
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12565
12614
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12566
12615
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12567
12616
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12568
12617
  }
12569
- __name(_ts_decorate57, "_ts_decorate");
12618
+ __name(_ts_decorate58, "_ts_decorate");
12570
12619
  function buildOAuthPlugins(options) {
12571
12620
  const plugins = [];
12572
12621
  if (options.oauth?.google) {
@@ -12636,26 +12685,26 @@ var OAuthModule = class _OAuthModule {
12636
12685
  };
12637
12686
  }
12638
12687
  };
12639
- OAuthModule = _ts_decorate57([
12688
+ OAuthModule = _ts_decorate58([
12640
12689
  Module({})
12641
12690
  ], OAuthModule);
12642
- function _ts_decorate58(decorators, target, key, desc) {
12691
+ function _ts_decorate59(decorators, target, key, desc) {
12643
12692
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12644
12693
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12645
12694
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12646
12695
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12647
12696
  }
12648
- __name(_ts_decorate58, "_ts_decorate");
12649
- function _ts_metadata55(k, v) {
12697
+ __name(_ts_decorate59, "_ts_decorate");
12698
+ function _ts_metadata56(k, v) {
12650
12699
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
12651
12700
  }
12652
- __name(_ts_metadata55, "_ts_metadata");
12653
- function _ts_param33(paramIndex, decorator) {
12701
+ __name(_ts_metadata56, "_ts_metadata");
12702
+ function _ts_param34(paramIndex, decorator) {
12654
12703
  return function(target, key) {
12655
12704
  decorator(target, key, paramIndex);
12656
12705
  };
12657
12706
  }
12658
- __name(_ts_param33, "_ts_param");
12707
+ __name(_ts_param34, "_ts_param");
12659
12708
  var COMMON_BASE_WORDS = [
12660
12709
  // The perennial top of every published list.
12661
12710
  "password",
@@ -12961,68 +13010,68 @@ var CommonPasswordChecker = class {
12961
13010
  return false;
12962
13011
  }
12963
13012
  };
12964
- CommonPasswordChecker = _ts_decorate58([
13013
+ CommonPasswordChecker = _ts_decorate59([
12965
13014
  Injectable(),
12966
- _ts_param33(0, Inject(BYMAX_AUTH_OPTIONS)),
12967
- _ts_param33(0, Optional()),
12968
- _ts_metadata55("design:type", Function),
12969
- _ts_metadata55("design:paramtypes", [
13015
+ _ts_param34(0, Inject(BYMAX_AUTH_OPTIONS)),
13016
+ _ts_param34(0, Optional()),
13017
+ _ts_metadata56("design:type", Function),
13018
+ _ts_metadata56("design:paramtypes", [
12970
13019
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
12971
13020
  ])
12972
13021
  ], CommonPasswordChecker);
12973
- function _ts_decorate59(decorators, target, key, desc) {
13022
+ function _ts_decorate60(decorators, target, key, desc) {
12974
13023
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12975
13024
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12976
13025
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12977
13026
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12978
13027
  }
12979
- __name(_ts_decorate59, "_ts_decorate");
13028
+ __name(_ts_decorate60, "_ts_decorate");
12980
13029
  var NoOpEmailProvider = class _NoOpEmailProvider {
12981
13030
  static {
12982
13031
  __name(this, "NoOpEmailProvider");
12983
13032
  }
12984
13033
  logger = new Logger(_NoOpEmailProvider.name);
12985
13034
  /** @inheritdoc */
12986
- async sendPasswordResetToken(email, _token, _locale) {
13035
+ async sendPasswordResetToken(_tenantId, email, _token, _locale) {
12987
13036
  this.logger.log(`sendPasswordResetToken \u2192 ${maskEmail(email)} (no-op)`);
12988
13037
  }
12989
13038
  /** @inheritdoc */
12990
- async sendPasswordResetOtp(email, _otp, _locale) {
13039
+ async sendPasswordResetOtp(_tenantId, email, _otp, _locale) {
12991
13040
  this.logger.log(`sendPasswordResetOtp \u2192 ${maskEmail(email)} (no-op)`);
12992
13041
  }
12993
13042
  /** @inheritdoc */
12994
- async sendEmailVerificationOtp(email, _otp, _locale) {
13043
+ async sendEmailVerificationOtp(_tenantId, email, _otp, _locale) {
12995
13044
  this.logger.log(`sendEmailVerificationOtp \u2192 ${maskEmail(email)} (no-op)`);
12996
13045
  }
12997
13046
  /** @inheritdoc */
12998
- async sendMfaEnabledNotification(email, _locale) {
13047
+ async sendMfaEnabledNotification(_tenantId, email, _locale) {
12999
13048
  this.logger.log(`sendMfaEnabledNotification \u2192 ${maskEmail(email)} (no-op)`);
13000
13049
  }
13001
13050
  /** @inheritdoc */
13002
- async sendMfaDisabledNotification(email, _locale) {
13051
+ async sendMfaDisabledNotification(_tenantId, email, _locale) {
13003
13052
  this.logger.log(`sendMfaDisabledNotification \u2192 ${maskEmail(email)} (no-op)`);
13004
13053
  }
13005
13054
  /** @inheritdoc */
13006
- async sendNewSessionAlert(email, _sessionInfo, _locale) {
13055
+ async sendNewSessionAlert(_tenantId, email, _sessionInfo, _locale) {
13007
13056
  this.logger.log(`sendNewSessionAlert \u2192 ${maskEmail(email)} (no-op)`);
13008
13057
  }
13009
13058
  /** @inheritdoc */
13010
- async sendInvitation(email, _inviteData, _locale) {
13059
+ async sendInvitation(_tenantId, email, _inviteData, _locale) {
13011
13060
  this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
13012
13061
  }
13013
13062
  };
13014
- NoOpEmailProvider = _ts_decorate59([
13063
+ NoOpEmailProvider = _ts_decorate60([
13015
13064
  Injectable()
13016
13065
  ], NoOpEmailProvider);
13017
13066
 
13018
13067
  // src/server/bymax-auth.module.ts
13019
- function _ts_decorate60(decorators, target, key, desc) {
13068
+ function _ts_decorate61(decorators, target, key, desc) {
13020
13069
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13021
13070
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13022
13071
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13023
13072
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13024
13073
  }
13025
- __name(_ts_decorate60, "_ts_decorate");
13074
+ __name(_ts_decorate61, "_ts_decorate");
13026
13075
  function hasProviderToken(providers, token) {
13027
13076
  return providers.some((p) => {
13028
13077
  if (typeof p === "function") return false;
@@ -13206,6 +13255,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
13206
13255
  // BYMAX_AUTH_REDIS_CLIENT and BYMAX_AUTH_OPTIONS provided via extraProviders
13207
13256
  // are visible in the same module scope.
13208
13257
  AuthRedisService,
13258
+ AuthRevocationService,
13209
13259
  PasswordService,
13210
13260
  TokenManagerService,
13211
13261
  TokenDeliveryService,
@@ -13293,6 +13343,10 @@ var BymaxAuthModule = class _BymaxAuthModule {
13293
13343
  // NestJS auto-registers @UseGuards() guards as local providers in the controller's
13294
13344
  // module; all constructor deps must be resolvable from that module's context.
13295
13345
  AuthRedisService,
13346
+ // Export AuthRevocationService for the same @UseGuards() reason — the exported guards now
13347
+ // depend on it — and so a host bridging a realtime transport can inject it and consult
13348
+ // both revocation channels rather than granting a stream that outlives a logout.
13349
+ AuthRevocationService,
13296
13350
  // Same reason, for the two exported guards whose remaining constructor deps are not
13297
13351
  // covered by the entries above. Exporting the guard class is necessary but not
13298
13352
  // sufficient: because @UseGuards() re-instantiates the guard in the *consumer's*
@@ -13317,20 +13371,229 @@ var BymaxAuthModule = class _BymaxAuthModule {
13317
13371
  };
13318
13372
  }
13319
13373
  };
13320
- BymaxAuthModule = _ts_decorate60([
13374
+ BymaxAuthModule = _ts_decorate61([
13321
13375
  Module({})
13322
13376
  ], BymaxAuthModule);
13323
- function _ts_decorate61(decorators, target, key, desc) {
13377
+ var CODE_VALIDITY_TEXT = "It expires shortly, so use it soon.";
13378
+ var UNEXPECTED_CHANGE_TEXT = "If this was not you, secure your account immediately: change your password and sign out of every session.";
13379
+ var DEFAULT_MESSAGES = {
13380
+ passwordResetToken: /* @__PURE__ */ __name(({ token }) => ({
13381
+ subject: "Reset your password",
13382
+ text: `Use this token to reset your password: ${token}
13383
+
13384
+ ${CODE_VALIDITY_TEXT}
13385
+
13386
+ If you did not ask to reset your password, ignore this message and nothing will change.`
13387
+ }), "passwordResetToken"),
13388
+ passwordResetOtp: /* @__PURE__ */ __name(({ otp }) => ({
13389
+ subject: "Your password reset code",
13390
+ text: `Your password reset code is ${otp}.
13391
+
13392
+ ${CODE_VALIDITY_TEXT}
13393
+
13394
+ If you did not ask to reset your password, ignore this message and nothing will change.`
13395
+ }), "passwordResetOtp"),
13396
+ emailVerificationOtp: /* @__PURE__ */ __name(({ otp }) => ({
13397
+ subject: "Verify your email address",
13398
+ text: `Your verification code is ${otp}.
13399
+
13400
+ ${CODE_VALIDITY_TEXT}
13401
+
13402
+ If you did not create an account, ignore this message.`
13403
+ }), "emailVerificationOtp"),
13404
+ passwordChanged: /* @__PURE__ */ __name(() => ({
13405
+ subject: "Your password was changed",
13406
+ text: `The password on your account was changed.
13407
+
13408
+ ${UNEXPECTED_CHANGE_TEXT}`
13409
+ }), "passwordChanged"),
13410
+ emailChangeVerification: /* @__PURE__ */ __name(({ token }) => ({
13411
+ subject: "Confirm your new email address",
13412
+ text: `Your confirmation code is ${token}.
13413
+
13414
+ ${CODE_VALIDITY_TEXT}
13415
+
13416
+ If you did not ask to change your email address, ignore this message.`
13417
+ }), "emailChangeVerification"),
13418
+ emailChanged: /* @__PURE__ */ __name(({ newEmail }) => ({
13419
+ subject: "Your email address was changed",
13420
+ text: `The email address on your account was changed to ${newEmail}, and this address no longer signs in to it.
13421
+
13422
+ ${UNEXPECTED_CHANGE_TEXT}`
13423
+ }), "emailChanged"),
13424
+ mfaEnabled: /* @__PURE__ */ __name(() => ({
13425
+ subject: "Two-factor authentication is on",
13426
+ text: `Two-factor authentication was enabled on your account.
13427
+
13428
+ ${UNEXPECTED_CHANGE_TEXT}`
13429
+ }), "mfaEnabled"),
13430
+ mfaDisabled: /* @__PURE__ */ __name(() => ({
13431
+ subject: "Two-factor authentication is off",
13432
+ text: `Two-factor authentication was disabled on your account.
13433
+
13434
+ ${UNEXPECTED_CHANGE_TEXT}`
13435
+ }), "mfaDisabled"),
13436
+ newSessionAlert: /* @__PURE__ */ __name(({ sessionInfo }) => ({
13437
+ subject: "New sign-in to your account",
13438
+ text: `A new session was started on your account.
13439
+
13440
+ Device: ${sessionInfo.device}
13441
+ IP: ${sessionInfo.ip}
13442
+ Session: ${sessionInfo.sessionHash}
13443
+
13444
+ ${UNEXPECTED_CHANGE_TEXT}`
13445
+ }), "newSessionAlert"),
13446
+ invitation: /* @__PURE__ */ __name(({ invite }) => ({
13447
+ subject: `${invite.inviterName} invited you to ${invite.tenantName}`,
13448
+ text: `${invite.inviterName} invited you to join ${invite.tenantName}.
13449
+
13450
+ Use this token to accept: ${invite.inviteToken}
13451
+
13452
+ It expires on ${invite.expiresAt.toISOString()}.
13453
+
13454
+ If you were not expecting this invitation, ignore this message.`
13455
+ }), "invitation")
13456
+ };
13457
+ function escapeHtml(value) {
13458
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
13459
+ }
13460
+ __name(escapeHtml, "escapeHtml");
13461
+ function toHtml(text) {
13462
+ return text.split("\n\n").map((paragraph) => `<p>${escapeHtml(paragraph).replace(/\n/g, "<br>")}</p>`).join("\n");
13463
+ }
13464
+ __name(toHtml, "toHtml");
13465
+ function sanitizeSubject(subject) {
13466
+ return subject.replace(/[\r\n]+/g, " ");
13467
+ }
13468
+ __name(sanitizeSubject, "sanitizeSubject");
13469
+ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
13470
+ static {
13471
+ __name(this, "DefaultAuthEmailProvider");
13472
+ }
13473
+ sink;
13474
+ /** Records a delivery this provider swallowed, so a silent channel is still visible somewhere. */
13475
+ logger = new Logger(_DefaultAuthEmailProvider.name);
13476
+ /** The copy in effect: the defaults, with any provided overrides layered on top. */
13477
+ messages;
13478
+ /** Whether a rejected send is re-thrown after logging; `false` (swallow) unless asked otherwise. */
13479
+ rethrowOnError;
13480
+ /**
13481
+ * @param sink - The delivery channel to send through.
13482
+ * @param options - Optional copy overrides and delivery-error policy.
13483
+ */
13484
+ constructor(sink, options) {
13485
+ this.sink = sink;
13486
+ this.messages = {
13487
+ ...DEFAULT_MESSAGES,
13488
+ ...options?.messages
13489
+ };
13490
+ this.rethrowOnError = options?.onDeliveryError === "rethrow";
13491
+ }
13492
+ /** @inheritdoc */
13493
+ async sendPasswordResetToken(tenantId, email, token, locale) {
13494
+ await this.deliver(tenantId, email, this.messages.passwordResetToken({
13495
+ token,
13496
+ locale
13497
+ }));
13498
+ }
13499
+ /** @inheritdoc */
13500
+ async sendPasswordResetOtp(tenantId, email, otp, locale) {
13501
+ await this.deliver(tenantId, email, this.messages.passwordResetOtp({
13502
+ otp,
13503
+ locale
13504
+ }));
13505
+ }
13506
+ /** @inheritdoc */
13507
+ async sendEmailVerificationOtp(tenantId, email, otp, locale) {
13508
+ await this.deliver(tenantId, email, this.messages.emailVerificationOtp({
13509
+ otp,
13510
+ locale
13511
+ }));
13512
+ }
13513
+ /** @inheritdoc */
13514
+ async sendPasswordChangedNotification(tenantId, email, locale) {
13515
+ await this.deliver(tenantId, email, this.messages.passwordChanged({
13516
+ locale
13517
+ }));
13518
+ }
13519
+ /** @inheritdoc */
13520
+ async sendEmailChangeVerification(tenantId, newEmail, token, locale) {
13521
+ await this.deliver(tenantId, newEmail, this.messages.emailChangeVerification({
13522
+ token,
13523
+ locale
13524
+ }));
13525
+ }
13526
+ /** @inheritdoc */
13527
+ async sendEmailChangedNotification(tenantId, oldEmail, newEmail, locale) {
13528
+ await this.deliver(tenantId, oldEmail, this.messages.emailChanged({
13529
+ oldEmail,
13530
+ newEmail,
13531
+ locale
13532
+ }));
13533
+ }
13534
+ /** @inheritdoc */
13535
+ async sendMfaEnabledNotification(tenantId, email, locale) {
13536
+ await this.deliver(tenantId, email, this.messages.mfaEnabled({
13537
+ locale
13538
+ }));
13539
+ }
13540
+ /** @inheritdoc */
13541
+ async sendMfaDisabledNotification(tenantId, email, locale) {
13542
+ await this.deliver(tenantId, email, this.messages.mfaDisabled({
13543
+ locale
13544
+ }));
13545
+ }
13546
+ /** @inheritdoc */
13547
+ async sendNewSessionAlert(tenantId, email, sessionInfo, locale) {
13548
+ await this.deliver(tenantId, email, this.messages.newSessionAlert({
13549
+ sessionInfo,
13550
+ locale
13551
+ }));
13552
+ }
13553
+ /** @inheritdoc */
13554
+ async sendInvitation(tenantId, email, inviteData, locale) {
13555
+ await this.deliver(tenantId, email, this.messages.invitation({
13556
+ invite: inviteData,
13557
+ locale
13558
+ }));
13559
+ }
13560
+ /**
13561
+ * Renders the body to HTML (unless the message already carries its own), hands the message to the
13562
+ * channel, and swallows any delivery error.
13563
+ *
13564
+ * @param tenantId - Tenant the message is attributed to.
13565
+ * @param to - Recipient address.
13566
+ * @param message - The rendered subject and body, and optionally its own HTML.
13567
+ */
13568
+ async deliver(tenantId, to, message) {
13569
+ const subject = sanitizeSubject(message.subject);
13570
+ try {
13571
+ await this.sink.send({
13572
+ tenantId,
13573
+ to,
13574
+ subject,
13575
+ html: message.html ?? toHtml(message.text),
13576
+ text: message.text
13577
+ });
13578
+ } catch (error) {
13579
+ this.logger.error(`delivery failed for "${subject}"`, error);
13580
+ if (this.rethrowOnError) {
13581
+ throw error;
13582
+ }
13583
+ }
13584
+ }
13585
+ };
13586
+ function _ts_decorate62(decorators, target, key, desc) {
13324
13587
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13325
13588
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13326
13589
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13327
13590
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13328
13591
  }
13329
- __name(_ts_decorate61, "_ts_decorate");
13330
- function _ts_metadata56(k, v) {
13592
+ __name(_ts_decorate62, "_ts_decorate");
13593
+ function _ts_metadata57(k, v) {
13331
13594
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
13332
13595
  }
13333
- __name(_ts_metadata56, "_ts_metadata");
13596
+ __name(_ts_metadata57, "_ts_metadata");
13334
13597
  var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
13335
13598
  var PREFIX_LENGTH = 5;
13336
13599
  var DEFAULT_TIMEOUT_MS = 1500;
@@ -13387,10 +13650,10 @@ var HibpBreachChecker = class _HibpBreachChecker {
13387
13650
  }
13388
13651
  }
13389
13652
  };
13390
- HibpBreachChecker = _ts_decorate61([
13653
+ HibpBreachChecker = _ts_decorate62([
13391
13654
  Injectable(),
13392
- _ts_metadata56("design:type", Function),
13393
- _ts_metadata56("design:paramtypes", [
13655
+ _ts_metadata57("design:type", Function),
13656
+ _ts_metadata57("design:paramtypes", [
13394
13657
  Number
13395
13658
  ])
13396
13659
  ], HibpBreachChecker);
@@ -13403,16 +13666,16 @@ var AllowAllBreachChecker = class {
13403
13666
  return false;
13404
13667
  }
13405
13668
  };
13406
- AllowAllBreachChecker = _ts_decorate61([
13669
+ AllowAllBreachChecker = _ts_decorate62([
13407
13670
  Injectable()
13408
13671
  ], AllowAllBreachChecker);
13409
- function _ts_decorate62(decorators, target, key, desc) {
13672
+ function _ts_decorate63(decorators, target, key, desc) {
13410
13673
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13411
13674
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13412
13675
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13413
13676
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13414
13677
  }
13415
- __name(_ts_decorate62, "_ts_decorate");
13678
+ __name(_ts_decorate63, "_ts_decorate");
13416
13679
  var OptionalAuthGuard = class extends JwtAuthGuard {
13417
13680
  static {
13418
13681
  __name(this, "OptionalAuthGuard");
@@ -13427,26 +13690,26 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
13427
13690
  return super.canActivate(context);
13428
13691
  }
13429
13692
  };
13430
- OptionalAuthGuard = _ts_decorate62([
13693
+ OptionalAuthGuard = _ts_decorate63([
13431
13694
  Injectable()
13432
13695
  ], OptionalAuthGuard);
13433
- function _ts_decorate63(decorators, target, key, desc) {
13696
+ function _ts_decorate64(decorators, target, key, desc) {
13434
13697
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13435
13698
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13436
13699
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13437
13700
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13438
13701
  }
13439
- __name(_ts_decorate63, "_ts_decorate");
13440
- function _ts_metadata57(k, v) {
13702
+ __name(_ts_decorate64, "_ts_decorate");
13703
+ function _ts_metadata58(k, v) {
13441
13704
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
13442
13705
  }
13443
- __name(_ts_metadata57, "_ts_metadata");
13444
- function _ts_param34(paramIndex, decorator) {
13706
+ __name(_ts_metadata58, "_ts_metadata");
13707
+ function _ts_param35(paramIndex, decorator) {
13445
13708
  return function(target, key) {
13446
13709
  decorator(target, key, paramIndex);
13447
13710
  };
13448
13711
  }
13449
- __name(_ts_param34, "_ts_param");
13712
+ __name(_ts_param35, "_ts_param");
13450
13713
  var SelfOrAdminGuard = class {
13451
13714
  static {
13452
13715
  __name(this, "SelfOrAdminGuard");
@@ -13476,11 +13739,11 @@ var SelfOrAdminGuard = class {
13476
13739
  throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE, HttpStatus.FORBIDDEN);
13477
13740
  }
13478
13741
  };
13479
- SelfOrAdminGuard = _ts_decorate63([
13742
+ SelfOrAdminGuard = _ts_decorate64([
13480
13743
  Injectable(),
13481
- _ts_param34(0, Inject(BYMAX_AUTH_OPTIONS)),
13482
- _ts_metadata57("design:type", Function),
13483
- _ts_metadata57("design:paramtypes", [
13744
+ _ts_param35(0, Inject(BYMAX_AUTH_OPTIONS)),
13745
+ _ts_metadata58("design:type", Function),
13746
+ _ts_metadata58("design:paramtypes", [
13484
13747
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
13485
13748
  ])
13486
13749
  ], SelfOrAdminGuard);
@@ -13493,34 +13756,34 @@ function isHexLooking(value) {
13493
13756
  return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
13494
13757
  }
13495
13758
  __name(isHexLooking, "isHexLooking");
13496
- function _ts_decorate64(decorators, target, key, desc) {
13759
+ function _ts_decorate65(decorators, target, key, desc) {
13497
13760
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13498
13761
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13499
13762
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13500
13763
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13501
13764
  }
13502
- __name(_ts_decorate64, "_ts_decorate");
13503
- function _ts_metadata58(k, v) {
13765
+ __name(_ts_decorate65, "_ts_decorate");
13766
+ function _ts_metadata59(k, v) {
13504
13767
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
13505
13768
  }
13506
- __name(_ts_metadata58, "_ts_metadata");
13507
- function _ts_param35(paramIndex, decorator) {
13769
+ __name(_ts_metadata59, "_ts_metadata");
13770
+ function _ts_param36(paramIndex, decorator) {
13508
13771
  return function(target, key) {
13509
13772
  decorator(target, key, paramIndex);
13510
13773
  };
13511
13774
  }
13512
- __name(_ts_param35, "_ts_param");
13775
+ __name(_ts_param36, "_ts_param");
13513
13776
  var WsJwtGuard = class {
13514
13777
  static {
13515
13778
  __name(this, "WsJwtGuard");
13516
13779
  }
13517
13780
  jwtService;
13518
- redis;
13781
+ revocation;
13519
13782
  wsTickets;
13520
13783
  options;
13521
- constructor(jwtService, redis, wsTickets, options) {
13784
+ constructor(jwtService, revocation, wsTickets, options) {
13522
13785
  this.jwtService = jwtService;
13523
- this.redis = redis;
13786
+ this.revocation = revocation;
13524
13787
  this.wsTickets = wsTickets;
13525
13788
  this.options = options;
13526
13789
  }
@@ -13559,29 +13822,24 @@ var WsJwtGuard = class {
13559
13822
  throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
13560
13823
  }
13561
13824
  assertTokenType(payload, "dashboard");
13562
- const revoked = await this.redis.get(`rv:${payload.jti}`);
13563
- if (revoked !== null) {
13564
- throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
13565
- }
13566
13825
  assertValidSub(payload.sub);
13567
- const epoch = await this.redis.getUserTokenEpoch(payload.sub);
13568
- if (readStampedEpoch(payload) < epoch) {
13826
+ if (await this.revocation.isAccessTokenRevoked(payload)) {
13569
13827
  throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
13570
13828
  }
13571
13829
  client.data.user = payload;
13572
13830
  return true;
13573
13831
  }
13574
13832
  };
13575
- WsJwtGuard = _ts_decorate64([
13833
+ WsJwtGuard = _ts_decorate65([
13576
13834
  Injectable(),
13577
- _ts_param35(0, Inject(JwtService)),
13578
- _ts_param35(1, Inject(AuthRedisService)),
13579
- _ts_param35(2, Inject(WsTicketService)),
13580
- _ts_param35(3, Inject(BYMAX_AUTH_OPTIONS)),
13581
- _ts_metadata58("design:type", Function),
13582
- _ts_metadata58("design:paramtypes", [
13835
+ _ts_param36(0, Inject(JwtService)),
13836
+ _ts_param36(1, Inject(AuthRevocationService)),
13837
+ _ts_param36(2, Inject(WsTicketService)),
13838
+ _ts_param36(3, Inject(BYMAX_AUTH_OPTIONS)),
13839
+ _ts_metadata59("design:type", Function),
13840
+ _ts_metadata59("design:paramtypes", [
13583
13841
  typeof JwtService === "undefined" ? Object : JwtService,
13584
- typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
13842
+ typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
13585
13843
  typeof WsTicketService === "undefined" ? Object : WsTicketService,
13586
13844
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
13587
13845
  ])
@@ -13612,13 +13870,13 @@ function readUpgradeTicket(client) {
13612
13870
  return all.length === 1 && all[0] !== "" ? all[0] : void 0;
13613
13871
  }
13614
13872
  __name(readUpgradeTicket, "readUpgradeTicket");
13615
- function _ts_decorate65(decorators, target, key, desc) {
13873
+ function _ts_decorate66(decorators, target, key, desc) {
13616
13874
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13617
13875
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13618
13876
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13619
13877
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13620
13878
  }
13621
- __name(_ts_decorate65, "_ts_decorate");
13879
+ __name(_ts_decorate66, "_ts_decorate");
13622
13880
  function isAuthEnvelope(body) {
13623
13881
  if (typeof body !== "object" || body === null) return false;
13624
13882
  const error = body.error;
@@ -13670,8 +13928,8 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
13670
13928
  });
13671
13929
  }
13672
13930
  };
13673
- AuthExceptionFilter = _ts_decorate65([
13931
+ AuthExceptionFilter = _ts_decorate66([
13674
13932
  Catch()
13675
13933
  ], AuthExceptionFilter);
13676
13934
 
13677
- export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AllowAllBreachChecker, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthService, Authenticated, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentUser, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsJwtGuard, WsTicketService, createAuthValidationPipe, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
13935
+ export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AllowAllBreachChecker, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, Authenticated, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsJwtGuard, WsTicketService, createAuthValidationPipe, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };