@bymax-one/nest-auth 1.4.16 → 1.4.18

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.
@@ -189,6 +189,10 @@ var LIBRARY_READ_HEADERS = [
189
189
  // The cross-site request checks of `TrustedOriginGuard`.
190
190
  "origin",
191
191
  "sec-fetch-site",
192
+ // The compressed-body refusal of `RequestEncodingGuard`, and the check of whether a body is present.
193
+ "content-encoding",
194
+ "content-length",
195
+ "transfer-encoding",
192
196
  // What the client address (`request.ip`) is derived from behind a trusted proxy.
193
197
  "x-forwarded-for",
194
198
  "x-forwarded-host",
@@ -353,6 +357,7 @@ function resolveOptions(userOptions) {
353
357
  validateOAuthErrorRedirectUrl(userOptions);
354
358
  validateRefreshCookiePath(userOptions.routePrefix, userOptions.cookies);
355
359
  validateSameSiteNoneRequiresSecure(userOptions);
360
+ validateProductionCookiesAreSecure(userOptions);
356
361
  validateCookiePrefixes(userOptions);
357
362
  validateTrustedOrigins(userOptions);
358
363
  validateRefreshGraceWindow(userOptions.jwt);
@@ -913,6 +918,11 @@ function validateSameSiteNoneRequiresSecure(userOptions) {
913
918
  }
914
919
  }
915
920
  __name(validateSameSiteNoneRequiresSecure, "validateSameSiteNoneRequiresSecure");
921
+ function validateProductionCookiesAreSecure(userOptions) {
922
+ if (userOptions.secureCookies !== false || !isProductionDeployment(userOptions)) return;
923
+ throw new Error(`[BymaxAuthModule] secureCookies is false but environment is 'production' (the default when unset). A session cookie without the Secure attribute is sent over plain HTTP. Set secureCookies: true (a TLS-terminating proxy still serves HTTPS to the browser), or declare environment: 'development' or 'test' for local HTTP.`);
924
+ }
925
+ __name(validateProductionCookiesAreSecure, "validateProductionCookiesAreSecure");
916
926
  function validateTrustedOrigins(userOptions) {
917
927
  const sameSite = userOptions.cookies?.sameSite ?? DEFAULT_OPTIONS.cookies.sameSite;
918
928
  const trustedOrigins = userOptions.cookies?.trustedOrigins ?? [];
@@ -1259,6 +1269,8 @@ var CurrentUser = common.createParamDecorator((property, ctx) => {
1259
1269
  });
1260
1270
  var IS_PUBLIC_KEY = /* @__PURE__ */ Symbol("bymax:isPublic");
1261
1271
  var Public = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, true), "Public");
1272
+ var REQUEST_ENCODING_KEY = /* @__PURE__ */ Symbol("bymax:requestEncoding");
1273
+ var RequestEncoding = /* @__PURE__ */ __name((policy) => common.SetMetadata(REQUEST_ENCODING_KEY, policy), "RequestEncoding");
1262
1274
 
1263
1275
  // src/server/dto/no-control-characters.ts
1264
1276
  var NO_CONTROL_CHARACTERS = /^[^\u0000-\u001F\u007F-\u009F]+$/;
@@ -3856,6 +3868,78 @@ function _ts_metadata10(metadataKey, metadataValue) {
3856
3868
  }
3857
3869
  }
3858
3870
  __name(_ts_metadata10, "_ts_metadata");
3871
+ var BODYLESS_METHODS = /* @__PURE__ */ new Set([
3872
+ "GET",
3873
+ "HEAD",
3874
+ "OPTIONS",
3875
+ "DELETE"
3876
+ ]);
3877
+ var UNSUPPORTED_MEDIA_TYPE_MESSAGE = "Unsupported media type";
3878
+ exports.RequestEncodingGuard = class RequestEncodingGuard {
3879
+ static {
3880
+ __name(this, "RequestEncodingGuard");
3881
+ }
3882
+ reflector;
3883
+ constructor(reflector) {
3884
+ this.reflector = reflector;
3885
+ }
3886
+ /**
3887
+ * @param context - The execution context of the request.
3888
+ * @returns `true` when the route does not check, the request declares no encoding or only
3889
+ * `identity`, or the route checks only requests with a body and this one has none.
3890
+ * @throws {@link HttpException} `415` in the `auth.validation` envelope otherwise.
3891
+ */
3892
+ canActivate(context) {
3893
+ const request = context.switchToHttp().getRequest();
3894
+ if (BODYLESS_METHODS.has(request.method)) return true;
3895
+ const policy = this.reflector.get(REQUEST_ENCODING_KEY, context.getHandler());
3896
+ if (policy === "unchecked") return true;
3897
+ const header = request.headers["content-encoding"];
3898
+ if (header === void 0) return true;
3899
+ const encodings = header.split(",").map((encoding) => encoding.trim().toLowerCase()).filter((encoding) => encoding.length > 0);
3900
+ if (encodings.every((encoding) => encoding === "identity")) return true;
3901
+ if (policy === "when-body" && !carriesBody(request)) return true;
3902
+ throw new common.HttpException({
3903
+ error: {
3904
+ code: AUTH_ERROR_CODES.VALIDATION,
3905
+ message: UNSUPPORTED_MEDIA_TYPE_MESSAGE,
3906
+ details: null
3907
+ }
3908
+ }, common.HttpStatus.UNSUPPORTED_MEDIA_TYPE);
3909
+ }
3910
+ };
3911
+ exports.RequestEncodingGuard = _ts_decorate10([
3912
+ common.Injectable(),
3913
+ _ts_metadata10("design:type", Function),
3914
+ _ts_metadata10("design:paramtypes", [
3915
+ typeof core.Reflector === "undefined" ? Object : core.Reflector
3916
+ ])
3917
+ ], exports.RequestEncodingGuard);
3918
+ function carriesBody(request) {
3919
+ const length = request.headers["content-length"];
3920
+ return request.headers["transfer-encoding"] !== void 0 || length !== void 0 && length !== "0";
3921
+ }
3922
+ __name(carriesBody, "carriesBody");
3923
+ function _ts_decorate11(decorators, target, key, desc) {
3924
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3925
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3926
+ r = Reflect.decorate(decorators, target, key, desc);
3927
+ } else {
3928
+ for (var i = decorators.length - 1; i >= 0; i--) {
3929
+ if (d = decorators[i]) {
3930
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3931
+ }
3932
+ }
3933
+ }
3934
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3935
+ }
3936
+ __name(_ts_decorate11, "_ts_decorate");
3937
+ function _ts_metadata11(metadataKey, metadataValue) {
3938
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3939
+ return Reflect.metadata(metadataKey, metadataValue);
3940
+ }
3941
+ }
3942
+ __name(_ts_metadata11, "_ts_metadata");
3859
3943
  function _ts_param6(paramIndex, decorator) {
3860
3944
  return function(target, key) {
3861
3945
  decorator(target, key, paramIndex);
@@ -3899,15 +3983,15 @@ exports.TrustedOriginGuard = class TrustedOriginGuard {
3899
3983
  return true;
3900
3984
  }
3901
3985
  };
3902
- exports.TrustedOriginGuard = _ts_decorate10([
3986
+ exports.TrustedOriginGuard = _ts_decorate11([
3903
3987
  common.Injectable(),
3904
3988
  _ts_param6(0, common.Inject(BYMAX_AUTH_OPTIONS)),
3905
- _ts_metadata10("design:type", Function),
3906
- _ts_metadata10("design:paramtypes", [
3989
+ _ts_metadata11("design:type", Function),
3990
+ _ts_metadata11("design:paramtypes", [
3907
3991
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3908
3992
  ])
3909
3993
  ], exports.TrustedOriginGuard);
3910
- function _ts_decorate11(decorators, target, key, desc) {
3994
+ function _ts_decorate12(decorators, target, key, desc) {
3911
3995
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3912
3996
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3913
3997
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3920,13 +4004,13 @@ function _ts_decorate11(decorators, target, key, desc) {
3920
4004
  }
3921
4005
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3922
4006
  }
3923
- __name(_ts_decorate11, "_ts_decorate");
3924
- function _ts_metadata11(metadataKey, metadataValue) {
4007
+ __name(_ts_decorate12, "_ts_decorate");
4008
+ function _ts_metadata12(metadataKey, metadataValue) {
3925
4009
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3926
4010
  return Reflect.metadata(metadataKey, metadataValue);
3927
4011
  }
3928
4012
  }
3929
- __name(_ts_metadata11, "_ts_metadata");
4013
+ __name(_ts_metadata12, "_ts_metadata");
3930
4014
  function _ts_param7(paramIndex, decorator) {
3931
4015
  return function(target, key) {
3932
4016
  decorator(target, key, paramIndex);
@@ -4073,15 +4157,15 @@ exports.AccountStatusService = class AccountStatusService {
4073
4157
  assertNotBlocked(admin.status, this.options.blockedStatuses);
4074
4158
  }
4075
4159
  };
4076
- exports.AccountStatusService = _ts_decorate11([
4160
+ exports.AccountStatusService = _ts_decorate12([
4077
4161
  common.Injectable(),
4078
4162
  _ts_param7(0, common.Inject(AuthRedisService)),
4079
4163
  _ts_param7(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
4080
4164
  _ts_param7(2, common.Inject(BYMAX_AUTH_OPTIONS)),
4081
4165
  _ts_param7(3, common.Optional()),
4082
4166
  _ts_param7(3, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
4083
- _ts_metadata11("design:type", Function),
4084
- _ts_metadata11("design:paramtypes", [
4167
+ _ts_metadata12("design:type", Function),
4168
+ _ts_metadata12("design:paramtypes", [
4085
4169
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
4086
4170
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
4087
4171
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -4090,7 +4174,7 @@ exports.AccountStatusService = _ts_decorate11([
4090
4174
  ], exports.AccountStatusService);
4091
4175
 
4092
4176
  // src/server/guards/user-status.guard.ts
4093
- function _ts_decorate12(decorators, target, key, desc) {
4177
+ function _ts_decorate13(decorators, target, key, desc) {
4094
4178
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4095
4179
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4096
4180
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4103,13 +4187,13 @@ function _ts_decorate12(decorators, target, key, desc) {
4103
4187
  }
4104
4188
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4105
4189
  }
4106
- __name(_ts_decorate12, "_ts_decorate");
4107
- function _ts_metadata12(metadataKey, metadataValue) {
4190
+ __name(_ts_decorate13, "_ts_decorate");
4191
+ function _ts_metadata13(metadataKey, metadataValue) {
4108
4192
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4109
4193
  return Reflect.metadata(metadataKey, metadataValue);
4110
4194
  }
4111
4195
  }
4112
- __name(_ts_metadata12, "_ts_metadata");
4196
+ __name(_ts_metadata13, "_ts_metadata");
4113
4197
  function _ts_param8(paramIndex, decorator) {
4114
4198
  return function(target, key) {
4115
4199
  decorator(target, key, paramIndex);
@@ -4144,15 +4228,15 @@ exports.UserStatusGuard = class UserStatusGuard {
4144
4228
  return true;
4145
4229
  }
4146
4230
  };
4147
- exports.UserStatusGuard = _ts_decorate12([
4231
+ exports.UserStatusGuard = _ts_decorate13([
4148
4232
  common.Injectable(),
4149
4233
  _ts_param8(0, common.Inject(exports.AccountStatusService)),
4150
- _ts_metadata12("design:type", Function),
4151
- _ts_metadata12("design:paramtypes", [
4234
+ _ts_metadata13("design:type", Function),
4235
+ _ts_metadata13("design:paramtypes", [
4152
4236
  typeof exports.AccountStatusService === "undefined" ? Object : exports.AccountStatusService
4153
4237
  ])
4154
4238
  ], exports.UserStatusGuard);
4155
- function _ts_decorate13(decorators, target, key, desc) {
4239
+ function _ts_decorate14(decorators, target, key, desc) {
4156
4240
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4157
4241
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4158
4242
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4165,7 +4249,7 @@ function _ts_decorate13(decorators, target, key, desc) {
4165
4249
  }
4166
4250
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4167
4251
  }
4168
- __name(_ts_decorate13, "_ts_decorate");
4252
+ __name(_ts_decorate14, "_ts_decorate");
4169
4253
  var NoStoreInterceptor = class {
4170
4254
  static {
4171
4255
  __name(this, "NoStoreInterceptor");
@@ -4180,7 +4264,7 @@ var NoStoreInterceptor = class {
4180
4264
  return next.handle();
4181
4265
  }
4182
4266
  };
4183
- NoStoreInterceptor = _ts_decorate13([
4267
+ NoStoreInterceptor = _ts_decorate14([
4184
4268
  common.Injectable()
4185
4269
  ], NoStoreInterceptor);
4186
4270
  function flattenValidationErrors(errors, parentPath = "") {
@@ -4220,7 +4304,7 @@ function createAuthValidationPipe(options = {}) {
4220
4304
  });
4221
4305
  }
4222
4306
  __name(createAuthValidationPipe, "createAuthValidationPipe");
4223
- function _ts_decorate14(decorators, target, key, desc) {
4307
+ function _ts_decorate15(decorators, target, key, desc) {
4224
4308
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4225
4309
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4226
4310
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4233,13 +4317,13 @@ function _ts_decorate14(decorators, target, key, desc) {
4233
4317
  }
4234
4318
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4235
4319
  }
4236
- __name(_ts_decorate14, "_ts_decorate");
4237
- function _ts_metadata13(metadataKey, metadataValue) {
4320
+ __name(_ts_decorate15, "_ts_decorate");
4321
+ function _ts_metadata14(metadataKey, metadataValue) {
4238
4322
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4239
4323
  return Reflect.metadata(metadataKey, metadataValue);
4240
4324
  }
4241
4325
  }
4242
- __name(_ts_metadata13, "_ts_metadata");
4326
+ __name(_ts_metadata14, "_ts_metadata");
4243
4327
  function _ts_param9(paramIndex, decorator) {
4244
4328
  return function(target, key) {
4245
4329
  decorator(target, key, paramIndex);
@@ -4335,17 +4419,17 @@ exports.BruteForceService = class _BruteForceService {
4335
4419
  }
4336
4420
  }
4337
4421
  };
4338
- exports.BruteForceService = _ts_decorate14([
4422
+ exports.BruteForceService = _ts_decorate15([
4339
4423
  common.Injectable(),
4340
4424
  _ts_param9(0, common.Inject(AuthRedisService)),
4341
4425
  _ts_param9(1, common.Inject(BYMAX_AUTH_OPTIONS)),
4342
- _ts_metadata13("design:type", Function),
4343
- _ts_metadata13("design:paramtypes", [
4426
+ _ts_metadata14("design:type", Function),
4427
+ _ts_metadata14("design:paramtypes", [
4344
4428
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
4345
4429
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
4346
4430
  ])
4347
4431
  ], exports.BruteForceService);
4348
- function _ts_decorate15(decorators, target, key, desc) {
4432
+ function _ts_decorate16(decorators, target, key, desc) {
4349
4433
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4350
4434
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4351
4435
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4358,13 +4442,13 @@ function _ts_decorate15(decorators, target, key, desc) {
4358
4442
  }
4359
4443
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4360
4444
  }
4361
- __name(_ts_decorate15, "_ts_decorate");
4362
- function _ts_metadata14(metadataKey, metadataValue) {
4445
+ __name(_ts_decorate16, "_ts_decorate");
4446
+ function _ts_metadata15(metadataKey, metadataValue) {
4363
4447
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4364
4448
  return Reflect.metadata(metadataKey, metadataValue);
4365
4449
  }
4366
4450
  }
4367
- __name(_ts_metadata14, "_ts_metadata");
4451
+ __name(_ts_metadata15, "_ts_metadata");
4368
4452
  function _ts_param10(paramIndex, decorator) {
4369
4453
  return function(target, key) {
4370
4454
  decorator(target, key, paramIndex);
@@ -4528,17 +4612,17 @@ exports.OtpService = class OtpService {
4528
4612
  await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
4529
4613
  }
4530
4614
  };
4531
- exports.OtpService = _ts_decorate15([
4615
+ exports.OtpService = _ts_decorate16([
4532
4616
  common.Injectable(),
4533
4617
  _ts_param10(0, common.Inject(AuthRedisService)),
4534
4618
  _ts_param10(1, common.Inject(BYMAX_AUTH_OPTIONS)),
4535
- _ts_metadata14("design:type", Function),
4536
- _ts_metadata14("design:paramtypes", [
4619
+ _ts_metadata15("design:type", Function),
4620
+ _ts_metadata15("design:paramtypes", [
4537
4621
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
4538
4622
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
4539
4623
  ])
4540
4624
  ], exports.OtpService);
4541
- function _ts_decorate16(decorators, target, key, desc) {
4625
+ function _ts_decorate17(decorators, target, key, desc) {
4542
4626
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4543
4627
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4544
4628
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4551,13 +4635,13 @@ function _ts_decorate16(decorators, target, key, desc) {
4551
4635
  }
4552
4636
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4553
4637
  }
4554
- __name(_ts_decorate16, "_ts_decorate");
4555
- function _ts_metadata15(metadataKey, metadataValue) {
4638
+ __name(_ts_decorate17, "_ts_decorate");
4639
+ function _ts_metadata16(metadataKey, metadataValue) {
4556
4640
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4557
4641
  return Reflect.metadata(metadataKey, metadataValue);
4558
4642
  }
4559
4643
  }
4560
- __name(_ts_metadata15, "_ts_metadata");
4644
+ __name(_ts_metadata16, "_ts_metadata");
4561
4645
  function _ts_param11(paramIndex, decorator) {
4562
4646
  return function(target, key) {
4563
4647
  decorator(target, key, paramIndex);
@@ -4852,12 +4936,12 @@ var PasswordService = class _PasswordService {
4852
4936
  return crypto.timingSafeEqual(candidate, DUMMY_EXPECTED);
4853
4937
  }
4854
4938
  };
4855
- PasswordService = _ts_decorate16([
4939
+ PasswordService = _ts_decorate17([
4856
4940
  common.Injectable(),
4857
4941
  _ts_param11(0, common.Inject(BYMAX_AUTH_OPTIONS)),
4858
4942
  _ts_param11(1, common.Inject(BYMAX_AUTH_BREACH_CHECKER)),
4859
- _ts_metadata15("design:type", Function),
4860
- _ts_metadata15("design:paramtypes", [
4943
+ _ts_metadata16("design:type", Function),
4944
+ _ts_metadata16("design:paramtypes", [
4861
4945
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
4862
4946
  typeof IPasswordBreachChecker === "undefined" ? Object : IPasswordBreachChecker
4863
4947
  ])
@@ -4890,7 +4974,7 @@ function settleAfter(first, followUps) {
4890
4974
  __name(settleAfter, "settleAfter");
4891
4975
 
4892
4976
  // src/server/services/session.service.ts
4893
- function _ts_decorate17(decorators, target, key, desc) {
4977
+ function _ts_decorate18(decorators, target, key, desc) {
4894
4978
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4895
4979
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4896
4980
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4903,13 +4987,13 @@ function _ts_decorate17(decorators, target, key, desc) {
4903
4987
  }
4904
4988
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4905
4989
  }
4906
- __name(_ts_decorate17, "_ts_decorate");
4907
- function _ts_metadata16(metadataKey, metadataValue) {
4990
+ __name(_ts_decorate18, "_ts_decorate");
4991
+ function _ts_metadata17(metadataKey, metadataValue) {
4908
4992
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4909
4993
  return Reflect.metadata(metadataKey, metadataValue);
4910
4994
  }
4911
4995
  }
4912
- __name(_ts_metadata16, "_ts_metadata");
4996
+ __name(_ts_metadata17, "_ts_metadata");
4913
4997
  function _ts_param12(paramIndex, decorator) {
4914
4998
  return function(target, key) {
4915
4999
  decorator(target, key, paramIndex);
@@ -5240,16 +5324,35 @@ exports.SessionService = class _SessionService {
5240
5324
  * Refuses a session hash that names no live session of this user.
5241
5325
  *
5242
5326
  * For an operation that keeps one session and ends the rest and so has to be told which one,
5243
- * checked before it changes anything. The membership test is the same one
5244
- * {@link revokeAllExceptCurrent} applies.
5327
+ * checked before it changes anything. The membership test is the one {@link resolveLiveSession}
5328
+ * applies, so a token that has just rotated is accepted here exactly as it is there.
5245
5329
  *
5246
5330
  * @param params - See {@link LiveSessionParams}.
5247
5331
  * @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is not a live session.
5248
5332
  */
5249
- async assertLiveSession({ userId, tenantId, sessionHash }) {
5333
+ async assertLiveSession(params) {
5334
+ await this.resolveLiveSession(params);
5335
+ }
5336
+ /**
5337
+ * Names the live session a presented refresh-token hash stands for.
5338
+ *
5339
+ * The hash itself when it is a live session. When it is a token that rotated away moments ago,
5340
+ * the session the rotation produced: the rotation grace pointer `rp:{hash}` names that successor,
5341
+ * and the presented token still identifies the same device. A request that carries a refresh
5342
+ * token can lose a race to a refresh of the same session, and an operation that must keep "the
5343
+ * caller's session" would otherwise refuse the caller for having been refreshed. The pointer is
5344
+ * read, never consumed, and the successor has to be live in the index too, so a pointer left
5345
+ * behind by a session that was since revoked names nothing.
5346
+ *
5347
+ * @param params - See {@link LiveSessionParams}.
5348
+ * @returns The hash of the live session to keep: `sessionHash`, or its live successor.
5349
+ * @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is neither a live session nor
5350
+ * the predecessor of one.
5351
+ */
5352
+ async resolveLiveSession({ userId, tenantId, sessionHash }) {
5250
5353
  this.assertTenant(tenantId);
5251
5354
  this.assertValidSessionHash(sessionHash, "sessionHash");
5252
- this.requireLiveMember(await this.redis.smembers(this.indexKey(userId, tenantId)), sessionHash);
5355
+ return this.resolveLiveMember(await this.redis.smembers(this.indexKey(userId, tenantId)), sessionHash);
5253
5356
  }
5254
5357
  /**
5255
5358
  * Revokes all sessions for a user except the caller's current session.
@@ -5286,11 +5389,11 @@ exports.SessionService = class _SessionService {
5286
5389
  this.assertTenant(tenantId);
5287
5390
  this.assertValidSessionHash(currentSessionHash, "currentSessionHash");
5288
5391
  const members = await this.redis.smembers(this.indexKey(userId, tenantId));
5289
- this.requireLiveMember(members, currentSessionHash);
5392
+ const keptHash = await this.resolveLiveMember(members, currentSessionHash);
5290
5393
  const rtMembers = members.filter((m) => m.startsWith("rt:"));
5291
5394
  for (const member of rtMembers) {
5292
5395
  const hash = member.slice(3);
5293
- if (timingSafeCompare(hash, currentSessionHash)) continue;
5396
+ if (timingSafeCompare(hash, keptHash)) continue;
5294
5397
  try {
5295
5398
  await this.revokeSession({
5296
5399
  userId,
@@ -5411,13 +5514,33 @@ exports.SessionService = class _SessionService {
5411
5514
  }
5412
5515
  }
5413
5516
  /**
5414
- * Throws unless `members` holds a live refresh session with this hash.
5517
+ * The hash of the live refresh session `sessionHash` stands for within `members`.
5415
5518
  *
5416
5519
  * @throws {@link AuthException} `SESSION_NOT_FOUND`.
5417
5520
  */
5418
- requireLiveMember(members, sessionHash) {
5419
- const live = members.some((member) => member.startsWith("rt:") && timingSafeCompare(member.slice(3), sessionHash));
5420
- if (!live) throw new AuthException(AUTH_ERROR_CODES.SESSION_NOT_FOUND);
5521
+ async resolveLiveMember(members, sessionHash) {
5522
+ if (this.isLiveMember(members, sessionHash)) return sessionHash;
5523
+ const successor = await this.graceSuccessor(sessionHash);
5524
+ if (successor !== void 0 && this.isLiveMember(members, successor)) return successor;
5525
+ throw new AuthException(AUTH_ERROR_CODES.SESSION_NOT_FOUND);
5526
+ }
5527
+ /** Whether `members` holds a live refresh session with this hash. */
5528
+ isLiveMember(members, sessionHash) {
5529
+ return members.some((member) => member.startsWith("rt:") && timingSafeCompare(member.slice(3), sessionHash));
5530
+ }
5531
+ /**
5532
+ * The successor hash a rotation grace pointer names, or `undefined` when there is none.
5533
+ *
5534
+ * The pointer's value is `{successorHash}:{record}`, split on the first colon exactly as the
5535
+ * rotation script writes it.
5536
+ */
5537
+ async graceSuccessor(sessionHash) {
5538
+ const pointer = await this.redis.get(`rp:${sessionHash}`);
5539
+ if (pointer === null) return void 0;
5540
+ const separator = pointer.indexOf(":");
5541
+ if (separator < 0) return void 0;
5542
+ const successor = pointer.slice(0, separator);
5543
+ return SESSION_HASH_RE.test(successor) ? successor : void 0;
5421
5544
  }
5422
5545
  /**
5423
5546
  * The Redis key of this user's session index.
@@ -5462,28 +5585,18 @@ exports.SessionService = class _SessionService {
5462
5585
  const rtMembers = members.filter((m) => m.startsWith("rt:"));
5463
5586
  const limit = await this.resolveSessionLimit(userId, tenantId);
5464
5587
  if (rtMembers.length <= limit) return;
5465
- const withTimestamps = await Promise.all(rtMembers.map(async (member) => {
5466
- const memberHash = member.slice(3);
5467
- let createdAt = 0;
5468
- try {
5469
- const raw = await this.redis.get(`sd:${memberHash}`);
5470
- if (raw !== null) {
5471
- const parsed = JSON.parse(raw);
5472
- if (
5473
- // Stryker disable next-line ConditionalExpression: defensive `parsed !== null` guard masked by the surrounding try/catch fallback, yielding the same result
5474
- parsed !== null && typeof parsed === "object" && "createdAt" in parsed && typeof parsed["createdAt"] === "number"
5475
- ) {
5476
- createdAt = parsed.createdAt;
5477
- }
5478
- }
5479
- } catch {
5480
- }
5481
- return {
5588
+ let withTimestamps;
5589
+ try {
5590
+ withTimestamps = await Promise.all(rtMembers.map(async (member) => ({
5482
5591
  member,
5483
- memberHash,
5484
- createdAt
5485
- };
5486
- }));
5592
+ // member is "rt:{hash}" — extract just the hash portion.
5593
+ memberHash: member.slice(3),
5594
+ createdAt: await this.readCreatedAt(member.slice(3))
5595
+ })));
5596
+ } catch (err) {
5597
+ this.logger.error(`enforceSessionLimit: eviction skipped for user ${logSafe(userId)}, a session record could not be read: ${describeChannelStatus(err)}`);
5598
+ return;
5599
+ }
5487
5600
  withTimestamps.sort((a, b) => a.createdAt - b.createdAt);
5488
5601
  const evictCount = rtMembers.length - limit;
5489
5602
  const toEvict = withTimestamps.filter((entry) => entry.memberHash !== newHash).slice(0, evictCount);
@@ -5512,6 +5625,29 @@ exports.SessionService = class _SessionService {
5512
5625
  }
5513
5626
  }
5514
5627
  /**
5628
+ * The creation time of a session, for ranking sessions by age.
5629
+ *
5630
+ * An absent record and one that is not a detail record both rank as `0`, the oldest: a state the
5631
+ * store reported, not a fault. A read the store fails propagates, because no age can be named.
5632
+ *
5633
+ * @param memberHash - SHA-256 hash of the session's refresh token.
5634
+ */
5635
+ async readCreatedAt(memberHash) {
5636
+ const raw = await this.redis.get(`sd:${memberHash}`);
5637
+ if (raw === null) return 0;
5638
+ try {
5639
+ const parsed = JSON.parse(raw);
5640
+ if (
5641
+ // Stryker disable next-line ConditionalExpression: defensive `parsed !== null` guard masked by the surrounding try/catch fallback, yielding the same result
5642
+ parsed !== null && typeof parsed === "object" && "createdAt" in parsed && typeof parsed["createdAt"] === "number"
5643
+ ) {
5644
+ return parsed.createdAt;
5645
+ }
5646
+ } catch {
5647
+ }
5648
+ return 0;
5649
+ }
5650
+ /**
5515
5651
  * Resolves the maximum number of concurrent sessions allowed for a user.
5516
5652
  *
5517
5653
  * When `options.sessions.maxSessionsResolver` is configured, it is called with
@@ -5554,15 +5690,15 @@ exports.SessionService = class _SessionService {
5554
5690
  }
5555
5691
  }
5556
5692
  };
5557
- exports.SessionService = _ts_decorate17([
5693
+ exports.SessionService = _ts_decorate18([
5558
5694
  common.Injectable(),
5559
5695
  _ts_param12(0, common.Inject(BYMAX_AUTH_OPTIONS)),
5560
5696
  _ts_param12(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
5561
5697
  _ts_param12(2, common.Inject(BYMAX_AUTH_HOOKS)),
5562
5698
  _ts_param12(2, common.Optional()),
5563
5699
  _ts_param12(3, common.Inject(AuthRedisService)),
5564
- _ts_metadata16("design:type", Function),
5565
- _ts_metadata16("design:paramtypes", [
5700
+ _ts_metadata17("design:type", Function),
5701
+ _ts_metadata17("design:paramtypes", [
5566
5702
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
5567
5703
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
5568
5704
  Object,
@@ -5585,7 +5721,7 @@ function ownerFragment(ownerId) {
5585
5721
  __name(ownerFragment, "ownerFragment");
5586
5722
 
5587
5723
  // src/server/services/token-manager.service.ts
5588
- function _ts_decorate18(decorators, target, key, desc) {
5724
+ function _ts_decorate19(decorators, target, key, desc) {
5589
5725
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5590
5726
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
5591
5727
  r = Reflect.decorate(decorators, target, key, desc);
@@ -5598,13 +5734,13 @@ function _ts_decorate18(decorators, target, key, desc) {
5598
5734
  }
5599
5735
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5600
5736
  }
5601
- __name(_ts_decorate18, "_ts_decorate");
5602
- function _ts_metadata17(metadataKey, metadataValue) {
5737
+ __name(_ts_decorate19, "_ts_decorate");
5738
+ function _ts_metadata18(metadataKey, metadataValue) {
5603
5739
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
5604
5740
  return Reflect.metadata(metadataKey, metadataValue);
5605
5741
  }
5606
5742
  }
5607
- __name(_ts_metadata17, "_ts_metadata");
5743
+ __name(_ts_metadata18, "_ts_metadata");
5608
5744
  function _ts_param13(paramIndex, decorator) {
5609
5745
  return function(target, key) {
5610
5746
  decorator(target, key, paramIndex);
@@ -6514,15 +6650,15 @@ var TokenManagerService = class _TokenManagerService {
6514
6650
  return await this.redis.del(`mfa:${sha256(jti)}`);
6515
6651
  }
6516
6652
  };
6517
- TokenManagerService = _ts_decorate18([
6653
+ TokenManagerService = _ts_decorate19([
6518
6654
  common.Injectable(),
6519
6655
  _ts_param13(0, common.Inject(jwt.JwtService)),
6520
6656
  _ts_param13(1, common.Inject(BYMAX_AUTH_OPTIONS)),
6521
6657
  _ts_param13(2, common.Inject(AuthRedisService)),
6522
6658
  _ts_param13(3, common.Inject(BYMAX_AUTH_HOOKS)),
6523
6659
  _ts_param13(3, common.Optional()),
6524
- _ts_metadata17("design:type", Function),
6525
- _ts_metadata17("design:paramtypes", [
6660
+ _ts_metadata18("design:type", Function),
6661
+ _ts_metadata18("design:paramtypes", [
6526
6662
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
6527
6663
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
6528
6664
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
@@ -6530,6 +6666,18 @@ TokenManagerService = _ts_decorate18([
6530
6666
  ])
6531
6667
  ], TokenManagerService);
6532
6668
 
6669
+ // src/server/constants/logout-pending.ts
6670
+ var LOGOUT_PENDING_MIN_TTL_SECONDS = 300;
6671
+ function logoutPendingKey(plane, sessionHash) {
6672
+ return `${plane === "dashboard" ? "lp" : "plp"}:${sessionHash}`;
6673
+ }
6674
+ __name(logoutPendingKey, "logoutPendingKey");
6675
+ function logoutPendingTtlSeconds(accessExpiresIn) {
6676
+ const lifetime = accessExpiresIn === void 0 ? void 0 : durationToSeconds(accessExpiresIn);
6677
+ return Math.max(LOGOUT_PENDING_MIN_TTL_SECONDS, Math.ceil(lifetime ?? 0));
6678
+ }
6679
+ __name(logoutPendingTtlSeconds, "logoutPendingTtlSeconds");
6680
+
6533
6681
  // src/server/utils/mask-email.ts
6534
6682
  function maskEmail(email) {
6535
6683
  const atIndex = email.indexOf("@");
@@ -6544,6 +6692,29 @@ function normalizeEmail(email) {
6544
6692
  }
6545
6693
  __name(normalizeEmail, "normalizeEmail");
6546
6694
 
6695
+ // src/server/utils/pending-logout.ts
6696
+ async function rememberPendingLogout(redis, key, owner, ttlSeconds, logger) {
6697
+ try {
6698
+ await redis.set(key, JSON.stringify({
6699
+ userId: owner.userId,
6700
+ tenantId: owner.tenantId
6701
+ }), ttlSeconds);
6702
+ } catch (err) {
6703
+ logger.warn(`logout: the owner could not be kept for a retry \u2014 ${describeChannelStatus(err)}`);
6704
+ }
6705
+ }
6706
+ __name(rememberPendingLogout, "rememberPendingLogout");
6707
+ async function settlePendingLogout(redis, key, fromSession, logger) {
6708
+ try {
6709
+ const removed = await redis.del(key);
6710
+ return fromSession || removed;
6711
+ } catch (err) {
6712
+ logger.warn(`logout: the retry marker could not be cleared \u2014 ${describeChannelStatus(err)}`);
6713
+ return fromSession;
6714
+ }
6715
+ }
6716
+ __name(settlePendingLogout, "settlePendingLogout");
6717
+
6547
6718
  // src/server/utils/resolve-tenant-id.ts
6548
6719
  async function resolveTenantId(dtoTenantId, req, resolver) {
6549
6720
  if (resolver) {
@@ -6590,7 +6761,7 @@ function tenantScoped(user, tenantId) {
6590
6761
  __name(tenantScoped, "tenantScoped");
6591
6762
 
6592
6763
  // src/server/services/auth.service.ts
6593
- function _ts_decorate19(decorators, target, key, desc) {
6764
+ function _ts_decorate20(decorators, target, key, desc) {
6594
6765
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6595
6766
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
6596
6767
  r = Reflect.decorate(decorators, target, key, desc);
@@ -6603,13 +6774,13 @@ function _ts_decorate19(decorators, target, key, desc) {
6603
6774
  }
6604
6775
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6605
6776
  }
6606
- __name(_ts_decorate19, "_ts_decorate");
6607
- function _ts_metadata18(metadataKey, metadataValue) {
6777
+ __name(_ts_decorate20, "_ts_decorate");
6778
+ function _ts_metadata19(metadataKey, metadataValue) {
6608
6779
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
6609
6780
  return Reflect.metadata(metadataKey, metadataValue);
6610
6781
  }
6611
6782
  }
6612
- __name(_ts_metadata18, "_ts_metadata");
6783
+ __name(_ts_metadata19, "_ts_metadata");
6613
6784
  function _ts_param14(paramIndex, decorator) {
6614
6785
  return function(target, key) {
6615
6786
  decorator(target, key, paramIndex);
@@ -6984,39 +7155,83 @@ exports.AuthService = class _AuthService {
6984
7155
  */
6985
7156
  async logout(accessToken, rawRefreshToken) {
6986
7157
  const sessionHash = sha256(rawRefreshToken);
6987
- const { userId, tenantId } = await this.redis.readSessionOwner(`rt:${sessionHash}`);
7158
+ const markerKey = logoutPendingKey("dashboard", sessionHash);
7159
+ const live = await this.redis.readSessionOwner(`rt:${sessionHash}`);
7160
+ const fromSession = live.userId !== "";
7161
+ const { userId, tenantId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
6988
7162
  this.logger.log(`logout: userId=${logSafe(userId || "(no live session)")}`);
6989
- let blacklist = [];
7163
+ const failures = await settleWrites([
7164
+ ...this.blacklistWrites(accessToken),
7165
+ () => this.redis.del(`rt:${sessionHash}`),
7166
+ () => this.redis.del(`rp:${sessionHash}`)
7167
+ ]);
7168
+ await this.revokeSessionMetadata(userId, tenantId, sessionHash);
7169
+ if (failures.length > 0 && fromSession) {
7170
+ await rememberPendingLogout(this.redis, markerKey, {
7171
+ userId,
7172
+ tenantId
7173
+ }, logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn), this.logger);
7174
+ }
7175
+ raiseFirst(failures);
7176
+ if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, this.logger)) {
7177
+ this.emitLogout(userId, tenantId);
7178
+ }
7179
+ return userId;
7180
+ }
7181
+ /**
7182
+ * The access-token blacklist write for a logout, or none when there is nothing to revoke.
7183
+ *
7184
+ * Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
7185
+ * forged one must not blacklist an id it does not own. Only the verification is tolerant.
7186
+ *
7187
+ * @param accessToken - Raw access token; absent, malformed or expired yields no write.
7188
+ * @returns The writes to hand to `settleWrites`.
7189
+ */
7190
+ blacklistWrites(accessToken) {
6990
7191
  try {
6991
7192
  const payload = this.tokenManager.verifyIgnoringExpiry(accessToken);
6992
7193
  const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
6993
7194
  if (remainingTtl > 0) {
6994
- blacklist = [
7195
+ return [
6995
7196
  () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
6996
7197
  ];
6997
7198
  }
6998
7199
  } catch {
6999
7200
  }
7000
- const failures = await settleWrites([
7001
- ...blacklist,
7002
- () => this.redis.del(`rt:${sessionHash}`),
7003
- () => this.redis.del(`rp:${sessionHash}`)
7004
- ]);
7005
- if (this.options.sessions.enabled && userId && tenantId !== void 0) {
7006
- await this.sessionService.revokeSession({
7007
- userId,
7008
- tenantId,
7009
- sessionHash
7010
- }).catch((err) => {
7011
- const errCode = err instanceof AuthException ? err.getResponse().error.code : void 0;
7012
- if (errCode !== AUTH_ERROR_CODES.SESSION_NOT_FOUND) {
7013
- this.logger.warn(`logout: session cleanup failed \u2014 ${describeChannelStatus(err)}`);
7014
- }
7015
- });
7016
- }
7017
- raiseFirst(failures);
7018
- this.emitLogout(userId, tenantId);
7019
- return userId;
7201
+ return [];
7202
+ }
7203
+ /**
7204
+ * Cleans up the session's metadata through `SessionService.revokeSession()`.
7205
+ *
7206
+ * It performs an atomic SISMEMBER ownership check before deleting `sd:{hash}` and SREMing from
7207
+ * `sess:{userId}`. The `rt:{hash}` DEL already ran — revokeSession's internal DEL is a no-op
7208
+ * (Redis DEL is idempotent when the key is absent). SESSION_NOT_FOUND means the session was
7209
+ * evicted, already revoked, or the refresh token does not belong to this user — in all cases
7210
+ * authentication is already invalidated.
7211
+ *
7212
+ * The tenant is REQUIRED to name the index, and it comes off the record rather than from the
7213
+ * caller. A record without one is a pre-upgrade write: the contract lists `tenantId` among the
7214
+ * refresh session's fields, so a live record always has it. Skipping the call is the honest end
7215
+ * for one that does not — `rt:{hash}` is already deleted, so the session is dead either way, and
7216
+ * guessing a tenant would name an index belonging to nobody while reading like a revocation that
7217
+ * happened.
7218
+ *
7219
+ * @param userId - The owner, empty when none is known.
7220
+ * @param tenantId - The owner's tenant, absent when the record carried none.
7221
+ * @param sessionHash - The SHA-256 of the raw refresh token.
7222
+ */
7223
+ async revokeSessionMetadata(userId, tenantId, sessionHash) {
7224
+ if (!this.options.sessions.enabled || !userId || tenantId === void 0) return;
7225
+ await this.sessionService.revokeSession({
7226
+ userId,
7227
+ tenantId,
7228
+ sessionHash
7229
+ }).catch((err) => {
7230
+ const errCode = err instanceof AuthException ? err.getResponse().error.code : void 0;
7231
+ if (errCode !== AUTH_ERROR_CODES.SESSION_NOT_FOUND) {
7232
+ this.logger.warn(`logout: session cleanup failed \u2014 ${describeChannelStatus(err)}`);
7233
+ }
7234
+ });
7020
7235
  }
7021
7236
  /**
7022
7237
  * Announces a completed logout, the only hook `AuthService.logout` emits.
@@ -7606,7 +7821,7 @@ exports.AuthService = class _AuthService {
7606
7821
  })();
7607
7822
  }
7608
7823
  };
7609
- exports.AuthService = _ts_decorate19([
7824
+ exports.AuthService = _ts_decorate20([
7610
7825
  common.Injectable(),
7611
7826
  _ts_param14(0, common.Inject(BYMAX_AUTH_OPTIONS)),
7612
7827
  _ts_param14(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -7621,8 +7836,8 @@ exports.AuthService = _ts_decorate19([
7621
7836
  _ts_param14(8, common.Inject(exports.OtpService)),
7622
7837
  _ts_param14(9, common.Inject(exports.SessionService)),
7623
7838
  _ts_param14(10, common.Inject(exports.AccountStatusService)),
7624
- _ts_metadata18("design:type", Function),
7625
- _ts_metadata18("design:paramtypes", [
7839
+ _ts_metadata19("design:type", Function),
7840
+ _ts_metadata19("design:paramtypes", [
7626
7841
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
7627
7842
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
7628
7843
  Object,
@@ -7646,7 +7861,7 @@ __name(toSafeUser2, "toSafeUser");
7646
7861
  var WS_TICKET_TTL_SECONDS = 30;
7647
7862
 
7648
7863
  // src/server/services/ws-ticket.service.ts
7649
- function _ts_decorate20(decorators, target, key, desc) {
7864
+ function _ts_decorate21(decorators, target, key, desc) {
7650
7865
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7651
7866
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
7652
7867
  r = Reflect.decorate(decorators, target, key, desc);
@@ -7659,13 +7874,13 @@ function _ts_decorate20(decorators, target, key, desc) {
7659
7874
  }
7660
7875
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7661
7876
  }
7662
- __name(_ts_decorate20, "_ts_decorate");
7663
- function _ts_metadata19(metadataKey, metadataValue) {
7877
+ __name(_ts_decorate21, "_ts_decorate");
7878
+ function _ts_metadata20(metadataKey, metadataValue) {
7664
7879
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
7665
7880
  return Reflect.metadata(metadataKey, metadataValue);
7666
7881
  }
7667
7882
  }
7668
- __name(_ts_metadata19, "_ts_metadata");
7883
+ __name(_ts_metadata20, "_ts_metadata");
7669
7884
  function _ts_param15(paramIndex, decorator) {
7670
7885
  return function(target, key) {
7671
7886
  decorator(target, key, paramIndex);
@@ -7805,14 +8020,14 @@ exports.WsTicketService = class _WsTicketService {
7805
8020
  return snapshot;
7806
8021
  }
7807
8022
  };
7808
- exports.WsTicketService = _ts_decorate20([
8023
+ exports.WsTicketService = _ts_decorate21([
7809
8024
  common.Injectable(),
7810
8025
  _ts_param15(0, common.Inject(AuthRedisService)),
7811
8026
  _ts_param15(1, common.Inject(BYMAX_AUTH_OPTIONS)),
7812
8027
  _ts_param15(2, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
7813
8028
  _ts_param15(3, common.Inject(exports.AuthRevocationService)),
7814
- _ts_metadata19("design:type", Function),
7815
- _ts_metadata19("design:paramtypes", [
8029
+ _ts_metadata20("design:type", Function),
8030
+ _ts_metadata20("design:paramtypes", [
7816
8031
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
7817
8032
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
7818
8033
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
@@ -7821,7 +8036,7 @@ exports.WsTicketService = _ts_decorate20([
7821
8036
  ], exports.WsTicketService);
7822
8037
 
7823
8038
  // src/server/controllers/auth.controller.ts
7824
- function _ts_decorate21(decorators, target, key, desc) {
8039
+ function _ts_decorate22(decorators, target, key, desc) {
7825
8040
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7826
8041
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
7827
8042
  r = Reflect.decorate(decorators, target, key, desc);
@@ -7834,13 +8049,13 @@ function _ts_decorate21(decorators, target, key, desc) {
7834
8049
  }
7835
8050
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7836
8051
  }
7837
- __name(_ts_decorate21, "_ts_decorate");
7838
- function _ts_metadata20(metadataKey, metadataValue) {
8052
+ __name(_ts_decorate22, "_ts_decorate");
8053
+ function _ts_metadata21(metadataKey, metadataValue) {
7839
8054
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
7840
8055
  return Reflect.metadata(metadataKey, metadataValue);
7841
8056
  }
7842
8057
  }
7843
- __name(_ts_metadata20, "_ts_metadata");
8058
+ __name(_ts_metadata21, "_ts_metadata");
7844
8059
  function _ts_param16(paramIndex, decorator) {
7845
8060
  return function(target, key) {
7846
8061
  decorator(target, key, paramIndex);
@@ -7999,7 +8214,7 @@ var AuthController = class {
7999
8214
  await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
8000
8215
  }
8001
8216
  };
8002
- _ts_decorate21([
8217
+ _ts_decorate22([
8003
8218
  Public(),
8004
8219
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.register),
8005
8220
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
@@ -8009,15 +8224,15 @@ _ts_decorate21([
8009
8224
  _ts_param16(2, common.Res({
8010
8225
  passthrough: true
8011
8226
  })),
8012
- _ts_metadata20("design:type", Function),
8013
- _ts_metadata20("design:paramtypes", [
8227
+ _ts_metadata21("design:type", Function),
8228
+ _ts_metadata21("design:paramtypes", [
8014
8229
  typeof RegisterDto === "undefined" ? Object : RegisterDto,
8015
8230
  typeof Request === "undefined" ? Object : Request,
8016
8231
  typeof Response === "undefined" ? Object : Response
8017
8232
  ]),
8018
- _ts_metadata20("design:returntype", Promise)
8233
+ _ts_metadata21("design:returntype", Promise)
8019
8234
  ], AuthController.prototype, "register", null);
8020
- _ts_decorate21([
8235
+ _ts_decorate22([
8021
8236
  Public(),
8022
8237
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.login),
8023
8238
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
@@ -8028,72 +8243,75 @@ _ts_decorate21([
8028
8243
  _ts_param16(2, common.Res({
8029
8244
  passthrough: true
8030
8245
  })),
8031
- _ts_metadata20("design:type", Function),
8032
- _ts_metadata20("design:paramtypes", [
8246
+ _ts_metadata21("design:type", Function),
8247
+ _ts_metadata21("design:paramtypes", [
8033
8248
  typeof LoginDto === "undefined" ? Object : LoginDto,
8034
8249
  typeof Request === "undefined" ? Object : Request,
8035
8250
  typeof Response === "undefined" ? Object : Response
8036
8251
  ]),
8037
- _ts_metadata20("design:returntype", Promise)
8252
+ _ts_metadata21("design:returntype", Promise)
8038
8253
  ], AuthController.prototype, "login", null);
8039
- _ts_decorate21([
8254
+ _ts_decorate22([
8040
8255
  Public(),
8041
8256
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
8042
8257
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
8043
8258
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8259
+ RequestEncoding("unchecked"),
8044
8260
  common.Post("logout"),
8045
8261
  _ts_param16(0, common.Req()),
8046
8262
  _ts_param16(1, common.Res({
8047
8263
  passthrough: true
8048
8264
  })),
8049
- _ts_metadata20("design:type", Function),
8050
- _ts_metadata20("design:paramtypes", [
8265
+ _ts_metadata21("design:type", Function),
8266
+ _ts_metadata21("design:paramtypes", [
8051
8267
  typeof Request === "undefined" ? Object : Request,
8052
8268
  typeof Response === "undefined" ? Object : Response
8053
8269
  ]),
8054
- _ts_metadata20("design:returntype", Promise)
8270
+ _ts_metadata21("design:returntype", Promise)
8055
8271
  ], AuthController.prototype, "logout", null);
8056
- _ts_decorate21([
8272
+ _ts_decorate22([
8057
8273
  Public(),
8058
8274
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
8059
8275
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
8060
8276
  common.HttpCode(common.HttpStatus.OK),
8277
+ RequestEncoding("unchecked"),
8061
8278
  common.Post("refresh"),
8062
8279
  _ts_param16(0, common.Req()),
8063
8280
  _ts_param16(1, common.Res({
8064
8281
  passthrough: true
8065
8282
  })),
8066
- _ts_metadata20("design:type", Function),
8067
- _ts_metadata20("design:paramtypes", [
8283
+ _ts_metadata21("design:type", Function),
8284
+ _ts_metadata21("design:paramtypes", [
8068
8285
  typeof Request === "undefined" ? Object : Request,
8069
8286
  typeof Response === "undefined" ? Object : Response
8070
8287
  ]),
8071
- _ts_metadata20("design:returntype", Promise)
8288
+ _ts_metadata21("design:returntype", Promise)
8072
8289
  ], AuthController.prototype, "refresh", null);
8073
- _ts_decorate21([
8290
+ _ts_decorate22([
8074
8291
  common.UseGuards(exports.JwtAuthGuard),
8075
8292
  common.Get("me"),
8076
8293
  _ts_param16(0, CurrentUser()),
8077
- _ts_metadata20("design:type", Function),
8078
- _ts_metadata20("design:paramtypes", [
8294
+ _ts_metadata21("design:type", Function),
8295
+ _ts_metadata21("design:paramtypes", [
8079
8296
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8080
8297
  ]),
8081
- _ts_metadata20("design:returntype", Promise)
8298
+ _ts_metadata21("design:returntype", Promise)
8082
8299
  ], AuthController.prototype, "me", null);
8083
- _ts_decorate21([
8300
+ _ts_decorate22([
8084
8301
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
8085
8302
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
8086
8303
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
8304
+ RequestEncoding("unchecked"),
8087
8305
  common.Post("ws-ticket"),
8088
8306
  common.HttpCode(common.HttpStatus.OK),
8089
8307
  _ts_param16(0, CurrentUser()),
8090
- _ts_metadata20("design:type", Function),
8091
- _ts_metadata20("design:paramtypes", [
8308
+ _ts_metadata21("design:type", Function),
8309
+ _ts_metadata21("design:paramtypes", [
8092
8310
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8093
8311
  ]),
8094
- _ts_metadata20("design:returntype", Promise)
8312
+ _ts_metadata21("design:returntype", Promise)
8095
8313
  ], AuthController.prototype, "wsTicket", null);
8096
- _ts_decorate21([
8314
+ _ts_decorate22([
8097
8315
  Public(),
8098
8316
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
8099
8317
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
@@ -8101,14 +8319,14 @@ _ts_decorate21([
8101
8319
  common.Post("verify-email"),
8102
8320
  _ts_param16(0, common.Body()),
8103
8321
  _ts_param16(1, common.Req()),
8104
- _ts_metadata20("design:type", Function),
8105
- _ts_metadata20("design:paramtypes", [
8322
+ _ts_metadata21("design:type", Function),
8323
+ _ts_metadata21("design:paramtypes", [
8106
8324
  typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
8107
8325
  typeof Request === "undefined" ? Object : Request
8108
8326
  ]),
8109
- _ts_metadata20("design:returntype", Promise)
8327
+ _ts_metadata21("design:returntype", Promise)
8110
8328
  ], AuthController.prototype, "verifyEmail", null);
8111
- _ts_decorate21([
8329
+ _ts_decorate22([
8112
8330
  Public(),
8113
8331
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
8114
8332
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
@@ -8116,29 +8334,29 @@ _ts_decorate21([
8116
8334
  common.Post("resend-verification"),
8117
8335
  _ts_param16(0, common.Body()),
8118
8336
  _ts_param16(1, common.Req()),
8119
- _ts_metadata20("design:type", Function),
8120
- _ts_metadata20("design:paramtypes", [
8337
+ _ts_metadata21("design:type", Function),
8338
+ _ts_metadata21("design:paramtypes", [
8121
8339
  typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
8122
8340
  typeof Request === "undefined" ? Object : Request
8123
8341
  ]),
8124
- _ts_metadata20("design:returntype", Promise)
8342
+ _ts_metadata21("design:returntype", Promise)
8125
8343
  ], AuthController.prototype, "resendVerification", null);
8126
- AuthController = _ts_decorate21([
8344
+ AuthController = _ts_decorate22([
8127
8345
  common.UseInterceptors(NoStoreInterceptor),
8128
8346
  common.Controller(),
8129
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8347
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8130
8348
  common.UsePipes(createAuthValidationPipe()),
8131
8349
  _ts_param16(0, common.Inject(exports.AuthService)),
8132
8350
  _ts_param16(1, common.Inject(exports.TokenDeliveryService)),
8133
8351
  _ts_param16(2, common.Inject(exports.WsTicketService)),
8134
- _ts_metadata20("design:type", Function),
8135
- _ts_metadata20("design:paramtypes", [
8352
+ _ts_metadata21("design:type", Function),
8353
+ _ts_metadata21("design:paramtypes", [
8136
8354
  typeof exports.AuthService === "undefined" ? Object : exports.AuthService,
8137
8355
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
8138
8356
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService
8139
8357
  ])
8140
8358
  ], AuthController);
8141
- function _ts_decorate22(decorators, target, key, desc) {
8359
+ function _ts_decorate23(decorators, target, key, desc) {
8142
8360
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8143
8361
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8144
8362
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8151,13 +8369,13 @@ function _ts_decorate22(decorators, target, key, desc) {
8151
8369
  }
8152
8370
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8153
8371
  }
8154
- __name(_ts_decorate22, "_ts_decorate");
8155
- function _ts_metadata21(metadataKey, metadataValue) {
8372
+ __name(_ts_decorate23, "_ts_decorate");
8373
+ function _ts_metadata22(metadataKey, metadataValue) {
8156
8374
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8157
8375
  return Reflect.metadata(metadataKey, metadataValue);
8158
8376
  }
8159
8377
  }
8160
- __name(_ts_metadata21, "_ts_metadata");
8378
+ __name(_ts_metadata22, "_ts_metadata");
8161
8379
  var ChangeEmailDto = class {
8162
8380
  static {
8163
8381
  __name(this, "ChangeEmailDto");
@@ -8177,20 +8395,20 @@ var ChangeEmailDto = class {
8177
8395
  */
8178
8396
  currentPassword;
8179
8397
  };
8180
- _ts_decorate22([
8398
+ _ts_decorate23([
8181
8399
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8182
8400
  classValidator.IsEmail(),
8183
8401
  classValidator.IsNotEmpty(),
8184
8402
  classValidator.MaxLength(255),
8185
- _ts_metadata21("design:type", String)
8403
+ _ts_metadata22("design:type", String)
8186
8404
  ], ChangeEmailDto.prototype, "newEmail", void 0);
8187
- _ts_decorate22([
8405
+ _ts_decorate23([
8188
8406
  classValidator.IsString(),
8189
8407
  classValidator.MinLength(1),
8190
8408
  classValidator.MaxLength(128),
8191
- _ts_metadata21("design:type", String)
8409
+ _ts_metadata22("design:type", String)
8192
8410
  ], ChangeEmailDto.prototype, "currentPassword", void 0);
8193
- function _ts_decorate23(decorators, target, key, desc) {
8411
+ function _ts_decorate24(decorators, target, key, desc) {
8194
8412
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8195
8413
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8196
8414
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8203,13 +8421,13 @@ function _ts_decorate23(decorators, target, key, desc) {
8203
8421
  }
8204
8422
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8205
8423
  }
8206
- __name(_ts_decorate23, "_ts_decorate");
8207
- function _ts_metadata22(metadataKey, metadataValue) {
8424
+ __name(_ts_decorate24, "_ts_decorate");
8425
+ function _ts_metadata23(metadataKey, metadataValue) {
8208
8426
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8209
8427
  return Reflect.metadata(metadataKey, metadataValue);
8210
8428
  }
8211
8429
  }
8212
- __name(_ts_metadata22, "_ts_metadata");
8430
+ __name(_ts_metadata23, "_ts_metadata");
8213
8431
  var ConfirmEmailChangeDto = class {
8214
8432
  static {
8215
8433
  __name(this, "ConfirmEmailChangeDto");
@@ -8222,13 +8440,13 @@ var ConfirmEmailChangeDto = class {
8222
8440
  */
8223
8441
  token;
8224
8442
  };
8225
- _ts_decorate23([
8443
+ _ts_decorate24([
8226
8444
  classValidator.IsString(),
8227
8445
  classValidator.IsNotEmpty(),
8228
8446
  classValidator.Length(64, 64),
8229
- _ts_metadata22("design:type", String)
8447
+ _ts_metadata23("design:type", String)
8230
8448
  ], ConfirmEmailChangeDto.prototype, "token", void 0);
8231
- function _ts_decorate24(decorators, target, key, desc) {
8449
+ function _ts_decorate25(decorators, target, key, desc) {
8232
8450
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8233
8451
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8234
8452
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8241,13 +8459,13 @@ function _ts_decorate24(decorators, target, key, desc) {
8241
8459
  }
8242
8460
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8243
8461
  }
8244
- __name(_ts_decorate24, "_ts_decorate");
8245
- function _ts_metadata23(metadataKey, metadataValue) {
8462
+ __name(_ts_decorate25, "_ts_decorate");
8463
+ function _ts_metadata24(metadataKey, metadataValue) {
8246
8464
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8247
8465
  return Reflect.metadata(metadataKey, metadataValue);
8248
8466
  }
8249
8467
  }
8250
- __name(_ts_metadata23, "_ts_metadata");
8468
+ __name(_ts_metadata24, "_ts_metadata");
8251
8469
  function _ts_param17(paramIndex, decorator) {
8252
8470
  return function(target, key) {
8253
8471
  decorator(target, key, paramIndex);
@@ -8485,7 +8703,7 @@ exports.EmailChangeService = class _EmailChangeService {
8485
8703
  }
8486
8704
  }
8487
8705
  };
8488
- exports.EmailChangeService = _ts_decorate24([
8706
+ exports.EmailChangeService = _ts_decorate25([
8489
8707
  common.Injectable(),
8490
8708
  _ts_param17(0, common.Inject(BYMAX_AUTH_OPTIONS)),
8491
8709
  _ts_param17(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -8493,8 +8711,8 @@ exports.EmailChangeService = _ts_decorate24([
8493
8711
  _ts_param17(3, common.Inject(PasswordService)),
8494
8712
  _ts_param17(4, common.Inject(AuthRedisService)),
8495
8713
  _ts_param17(5, common.Inject(exports.BruteForceService)),
8496
- _ts_metadata23("design:type", Function),
8497
- _ts_metadata23("design:paramtypes", [
8714
+ _ts_metadata24("design:type", Function),
8715
+ _ts_metadata24("design:paramtypes", [
8498
8716
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
8499
8717
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
8500
8718
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
@@ -8505,7 +8723,7 @@ exports.EmailChangeService = _ts_decorate24([
8505
8723
  ], exports.EmailChangeService);
8506
8724
 
8507
8725
  // src/server/controllers/email-change.controller.ts
8508
- function _ts_decorate25(decorators, target, key, desc) {
8726
+ function _ts_decorate26(decorators, target, key, desc) {
8509
8727
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8510
8728
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8511
8729
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8518,13 +8736,13 @@ function _ts_decorate25(decorators, target, key, desc) {
8518
8736
  }
8519
8737
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8520
8738
  }
8521
- __name(_ts_decorate25, "_ts_decorate");
8522
- function _ts_metadata24(metadataKey, metadataValue) {
8739
+ __name(_ts_decorate26, "_ts_decorate");
8740
+ function _ts_metadata25(metadataKey, metadataValue) {
8523
8741
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8524
8742
  return Reflect.metadata(metadataKey, metadataValue);
8525
8743
  }
8526
8744
  }
8527
- __name(_ts_metadata24, "_ts_metadata");
8745
+ __name(_ts_metadata25, "_ts_metadata");
8528
8746
  function _ts_param18(paramIndex, decorator) {
8529
8747
  return function(target, key) {
8530
8748
  decorator(target, key, paramIndex);
@@ -8577,7 +8795,7 @@ var EmailChangeController = class {
8577
8795
  await this.emailChangeService.confirmChange(dto);
8578
8796
  }
8579
8797
  };
8580
- _ts_decorate25([
8798
+ _ts_decorate26([
8581
8799
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
8582
8800
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
8583
8801
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
@@ -8585,38 +8803,38 @@ _ts_decorate25([
8585
8803
  common.Post("change"),
8586
8804
  _ts_param18(0, common.Body()),
8587
8805
  _ts_param18(1, CurrentUser()),
8588
- _ts_metadata24("design:type", Function),
8589
- _ts_metadata24("design:paramtypes", [
8806
+ _ts_metadata25("design:type", Function),
8807
+ _ts_metadata25("design:paramtypes", [
8590
8808
  typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
8591
8809
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8592
8810
  ]),
8593
- _ts_metadata24("design:returntype", Promise)
8811
+ _ts_metadata25("design:returntype", Promise)
8594
8812
  ], EmailChangeController.prototype, "requestChange", null);
8595
- _ts_decorate25([
8813
+ _ts_decorate26([
8596
8814
  Public(),
8597
8815
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
8598
8816
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
8599
8817
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8600
8818
  common.Post("change/confirm"),
8601
8819
  _ts_param18(0, common.Body()),
8602
- _ts_metadata24("design:type", Function),
8603
- _ts_metadata24("design:paramtypes", [
8820
+ _ts_metadata25("design:type", Function),
8821
+ _ts_metadata25("design:paramtypes", [
8604
8822
  typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
8605
8823
  ]),
8606
- _ts_metadata24("design:returntype", Promise)
8824
+ _ts_metadata25("design:returntype", Promise)
8607
8825
  ], EmailChangeController.prototype, "confirmChange", null);
8608
- EmailChangeController = _ts_decorate25([
8826
+ EmailChangeController = _ts_decorate26([
8609
8827
  common.UseInterceptors(NoStoreInterceptor),
8610
8828
  common.Controller("email"),
8611
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8829
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8612
8830
  common.UsePipes(createAuthValidationPipe()),
8613
8831
  _ts_param18(0, common.Inject(exports.EmailChangeService)),
8614
- _ts_metadata24("design:type", Function),
8615
- _ts_metadata24("design:paramtypes", [
8832
+ _ts_metadata25("design:type", Function),
8833
+ _ts_metadata25("design:paramtypes", [
8616
8834
  typeof exports.EmailChangeService === "undefined" ? Object : exports.EmailChangeService
8617
8835
  ])
8618
8836
  ], EmailChangeController);
8619
- function _ts_decorate26(decorators, target, key, desc) {
8837
+ function _ts_decorate27(decorators, target, key, desc) {
8620
8838
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8621
8839
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8622
8840
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8629,13 +8847,13 @@ function _ts_decorate26(decorators, target, key, desc) {
8629
8847
  }
8630
8848
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8631
8849
  }
8632
- __name(_ts_decorate26, "_ts_decorate");
8633
- function _ts_metadata25(metadataKey, metadataValue) {
8850
+ __name(_ts_decorate27, "_ts_decorate");
8851
+ function _ts_metadata26(metadataKey, metadataValue) {
8634
8852
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8635
8853
  return Reflect.metadata(metadataKey, metadataValue);
8636
8854
  }
8637
8855
  }
8638
- __name(_ts_metadata25, "_ts_metadata");
8856
+ __name(_ts_metadata26, "_ts_metadata");
8639
8857
  var AcceptInvitationDto = class {
8640
8858
  static {
8641
8859
  __name(this, "AcceptInvitationDto");
@@ -8674,24 +8892,24 @@ var AcceptInvitationDto = class {
8674
8892
  */
8675
8893
  password;
8676
8894
  };
8677
- _ts_decorate26([
8895
+ _ts_decorate27([
8678
8896
  classValidator.IsString(),
8679
8897
  classValidator.IsNotEmpty(),
8680
8898
  classValidator.Length(64, 64),
8681
- _ts_metadata25("design:type", String)
8899
+ _ts_metadata26("design:type", String)
8682
8900
  ], AcceptInvitationDto.prototype, "token", void 0);
8683
- _ts_decorate26([
8901
+ _ts_decorate27([
8684
8902
  classValidator.IsString(),
8685
8903
  classValidator.IsNotEmpty(),
8686
8904
  classValidator.Length(2, 100),
8687
- _ts_metadata25("design:type", String)
8905
+ _ts_metadata26("design:type", String)
8688
8906
  ], AcceptInvitationDto.prototype, "name", void 0);
8689
- _ts_decorate26([
8907
+ _ts_decorate27([
8690
8908
  classValidator.IsString(),
8691
8909
  classValidator.Length(8, 128),
8692
- _ts_metadata25("design:type", String)
8910
+ _ts_metadata26("design:type", String)
8693
8911
  ], AcceptInvitationDto.prototype, "password", void 0);
8694
- function _ts_decorate27(decorators, target, key, desc) {
8912
+ function _ts_decorate28(decorators, target, key, desc) {
8695
8913
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8696
8914
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8697
8915
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8704,13 +8922,13 @@ function _ts_decorate27(decorators, target, key, desc) {
8704
8922
  }
8705
8923
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8706
8924
  }
8707
- __name(_ts_decorate27, "_ts_decorate");
8708
- function _ts_metadata26(metadataKey, metadataValue) {
8925
+ __name(_ts_decorate28, "_ts_decorate");
8926
+ function _ts_metadata27(metadataKey, metadataValue) {
8709
8927
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8710
8928
  return Reflect.metadata(metadataKey, metadataValue);
8711
8929
  }
8712
8930
  }
8713
- __name(_ts_metadata26, "_ts_metadata");
8931
+ __name(_ts_metadata27, "_ts_metadata");
8714
8932
  var CreateInvitationDto = class {
8715
8933
  static {
8716
8934
  __name(this, "CreateInvitationDto");
@@ -8741,27 +8959,27 @@ var CreateInvitationDto = class {
8741
8959
  */
8742
8960
  tenantName;
8743
8961
  };
8744
- _ts_decorate27([
8962
+ _ts_decorate28([
8745
8963
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8746
8964
  classValidator.IsEmail(),
8747
8965
  classValidator.IsNotEmpty(),
8748
8966
  classValidator.MaxLength(255),
8749
- _ts_metadata26("design:type", String)
8967
+ _ts_metadata27("design:type", String)
8750
8968
  ], CreateInvitationDto.prototype, "email", void 0);
8751
- _ts_decorate27([
8969
+ _ts_decorate28([
8752
8970
  classValidator.IsString(),
8753
8971
  classValidator.IsNotEmpty(),
8754
8972
  classValidator.MaxLength(64),
8755
- _ts_metadata26("design:type", String)
8973
+ _ts_metadata27("design:type", String)
8756
8974
  ], CreateInvitationDto.prototype, "role", void 0);
8757
- _ts_decorate27([
8975
+ _ts_decorate28([
8758
8976
  classValidator.IsOptional(),
8759
8977
  classValidator.IsString(),
8760
8978
  classValidator.IsNotEmpty(),
8761
8979
  classValidator.MaxLength(128),
8762
- _ts_metadata26("design:type", String)
8980
+ _ts_metadata27("design:type", String)
8763
8981
  ], CreateInvitationDto.prototype, "tenantName", void 0);
8764
- function _ts_decorate28(decorators, target, key, desc) {
8982
+ function _ts_decorate29(decorators, target, key, desc) {
8765
8983
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8766
8984
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8767
8985
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8774,13 +8992,13 @@ function _ts_decorate28(decorators, target, key, desc) {
8774
8992
  }
8775
8993
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8776
8994
  }
8777
- __name(_ts_decorate28, "_ts_decorate");
8778
- function _ts_metadata27(metadataKey, metadataValue) {
8995
+ __name(_ts_decorate29, "_ts_decorate");
8996
+ function _ts_metadata28(metadataKey, metadataValue) {
8779
8997
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8780
8998
  return Reflect.metadata(metadataKey, metadataValue);
8781
8999
  }
8782
9000
  }
8783
- __name(_ts_metadata27, "_ts_metadata");
9001
+ __name(_ts_metadata28, "_ts_metadata");
8784
9002
  var RevokeInvitationDto = class {
8785
9003
  static {
8786
9004
  __name(this, "RevokeInvitationDto");
@@ -8792,14 +9010,14 @@ var RevokeInvitationDto = class {
8792
9010
  */
8793
9011
  email;
8794
9012
  };
8795
- _ts_decorate28([
9013
+ _ts_decorate29([
8796
9014
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8797
9015
  classValidator.IsEmail(),
8798
9016
  classValidator.IsNotEmpty(),
8799
9017
  classValidator.MaxLength(255),
8800
- _ts_metadata27("design:type", String)
9018
+ _ts_metadata28("design:type", String)
8801
9019
  ], RevokeInvitationDto.prototype, "email", void 0);
8802
- function _ts_decorate29(decorators, target, key, desc) {
9020
+ function _ts_decorate30(decorators, target, key, desc) {
8803
9021
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8804
9022
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8805
9023
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8812,13 +9030,13 @@ function _ts_decorate29(decorators, target, key, desc) {
8812
9030
  }
8813
9031
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8814
9032
  }
8815
- __name(_ts_decorate29, "_ts_decorate");
8816
- function _ts_metadata28(metadataKey, metadataValue) {
9033
+ __name(_ts_decorate30, "_ts_decorate");
9034
+ function _ts_metadata29(metadataKey, metadataValue) {
8817
9035
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8818
9036
  return Reflect.metadata(metadataKey, metadataValue);
8819
9037
  }
8820
9038
  }
8821
- __name(_ts_metadata28, "_ts_metadata");
9039
+ __name(_ts_metadata29, "_ts_metadata");
8822
9040
  function _ts_param19(paramIndex, decorator) {
8823
9041
  return function(target, key) {
8824
9042
  decorator(target, key, paramIndex);
@@ -9301,7 +9519,7 @@ exports.InvitationService = class _InvitationService {
9301
9519
  return result;
9302
9520
  }
9303
9521
  };
9304
- exports.InvitationService = _ts_decorate29([
9522
+ exports.InvitationService = _ts_decorate30([
9305
9523
  common.Injectable(),
9306
9524
  _ts_param19(0, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
9307
9525
  _ts_param19(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
@@ -9311,8 +9529,8 @@ exports.InvitationService = _ts_decorate29([
9311
9529
  _ts_param19(5, common.Inject(exports.SessionService)),
9312
9530
  _ts_param19(6, common.Inject(TokenManagerService)),
9313
9531
  _ts_param19(7, common.Inject(BYMAX_AUTH_OPTIONS)),
9314
- _ts_metadata28("design:type", Function),
9315
- _ts_metadata28("design:paramtypes", [
9532
+ _ts_metadata29("design:type", Function),
9533
+ _ts_metadata29("design:paramtypes", [
9316
9534
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
9317
9535
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
9318
9536
  typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
@@ -9325,7 +9543,7 @@ exports.InvitationService = _ts_decorate29([
9325
9543
  ], exports.InvitationService);
9326
9544
 
9327
9545
  // src/server/controllers/invitation.controller.ts
9328
- function _ts_decorate30(decorators, target, key, desc) {
9546
+ function _ts_decorate31(decorators, target, key, desc) {
9329
9547
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9330
9548
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9331
9549
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9338,13 +9556,13 @@ function _ts_decorate30(decorators, target, key, desc) {
9338
9556
  }
9339
9557
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9340
9558
  }
9341
- __name(_ts_decorate30, "_ts_decorate");
9342
- function _ts_metadata29(metadataKey, metadataValue) {
9559
+ __name(_ts_decorate31, "_ts_decorate");
9560
+ function _ts_metadata30(metadataKey, metadataValue) {
9343
9561
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9344
9562
  return Reflect.metadata(metadataKey, metadataValue);
9345
9563
  }
9346
9564
  }
9347
- __name(_ts_metadata29, "_ts_metadata");
9565
+ __name(_ts_metadata30, "_ts_metadata");
9348
9566
  function _ts_param20(paramIndex, decorator) {
9349
9567
  return function(target, key) {
9350
9568
  decorator(target, key, paramIndex);
@@ -9426,7 +9644,7 @@ var InvitationController = class {
9426
9644
  return this.tokenDelivery.deliverAuthResponse(res, result, req);
9427
9645
  }
9428
9646
  };
9429
- _ts_decorate30([
9647
+ _ts_decorate31([
9430
9648
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
9431
9649
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
9432
9650
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
@@ -9434,14 +9652,14 @@ _ts_decorate30([
9434
9652
  common.Post(),
9435
9653
  _ts_param20(0, common.Body()),
9436
9654
  _ts_param20(1, CurrentUser()),
9437
- _ts_metadata29("design:type", Function),
9438
- _ts_metadata29("design:paramtypes", [
9655
+ _ts_metadata30("design:type", Function),
9656
+ _ts_metadata30("design:paramtypes", [
9439
9657
  typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
9440
9658
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
9441
9659
  ]),
9442
- _ts_metadata29("design:returntype", Promise)
9660
+ _ts_metadata30("design:returntype", Promise)
9443
9661
  ], InvitationController.prototype, "invite", null);
9444
- _ts_decorate30([
9662
+ _ts_decorate31([
9445
9663
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
9446
9664
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
9447
9665
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
@@ -9449,14 +9667,14 @@ _ts_decorate30([
9449
9667
  common.Post("revoke"),
9450
9668
  _ts_param20(0, common.Body()),
9451
9669
  _ts_param20(1, CurrentUser()),
9452
- _ts_metadata29("design:type", Function),
9453
- _ts_metadata29("design:paramtypes", [
9670
+ _ts_metadata30("design:type", Function),
9671
+ _ts_metadata30("design:paramtypes", [
9454
9672
  typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
9455
9673
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
9456
9674
  ]),
9457
- _ts_metadata29("design:returntype", Promise)
9675
+ _ts_metadata30("design:returntype", Promise)
9458
9676
  ], InvitationController.prototype, "revoke", null);
9459
- _ts_decorate30([
9677
+ _ts_decorate31([
9460
9678
  Public(),
9461
9679
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
9462
9680
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
@@ -9467,23 +9685,23 @@ _ts_decorate30([
9467
9685
  _ts_param20(2, common.Res({
9468
9686
  passthrough: true
9469
9687
  })),
9470
- _ts_metadata29("design:type", Function),
9471
- _ts_metadata29("design:paramtypes", [
9688
+ _ts_metadata30("design:type", Function),
9689
+ _ts_metadata30("design:paramtypes", [
9472
9690
  typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
9473
9691
  typeof Request === "undefined" ? Object : Request,
9474
9692
  typeof Response === "undefined" ? Object : Response
9475
9693
  ]),
9476
- _ts_metadata29("design:returntype", Promise)
9694
+ _ts_metadata30("design:returntype", Promise)
9477
9695
  ], InvitationController.prototype, "accept", null);
9478
- InvitationController = _ts_decorate30([
9696
+ InvitationController = _ts_decorate31([
9479
9697
  common.UseInterceptors(NoStoreInterceptor),
9480
9698
  common.Controller("invitations"),
9481
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9699
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9482
9700
  common.UsePipes(createAuthValidationPipe()),
9483
9701
  _ts_param20(0, common.Inject(exports.InvitationService)),
9484
9702
  _ts_param20(1, common.Inject(exports.TokenDeliveryService)),
9485
- _ts_metadata29("design:type", Function),
9486
- _ts_metadata29("design:paramtypes", [
9703
+ _ts_metadata30("design:type", Function),
9704
+ _ts_metadata30("design:paramtypes", [
9487
9705
  typeof exports.InvitationService === "undefined" ? Object : exports.InvitationService,
9488
9706
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
9489
9707
  ])
@@ -9494,7 +9712,7 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
9494
9712
  var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
9495
9713
  var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
9496
9714
  var SkipMfa = /* @__PURE__ */ __name(() => common.SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
9497
- function _ts_decorate31(decorators, target, key, desc) {
9715
+ function _ts_decorate32(decorators, target, key, desc) {
9498
9716
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9499
9717
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9500
9718
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9507,13 +9725,13 @@ function _ts_decorate31(decorators, target, key, desc) {
9507
9725
  }
9508
9726
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9509
9727
  }
9510
- __name(_ts_decorate31, "_ts_decorate");
9511
- function _ts_metadata30(metadataKey, metadataValue) {
9728
+ __name(_ts_decorate32, "_ts_decorate");
9729
+ function _ts_metadata31(metadataKey, metadataValue) {
9512
9730
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9513
9731
  return Reflect.metadata(metadataKey, metadataValue);
9514
9732
  }
9515
9733
  }
9516
- __name(_ts_metadata30, "_ts_metadata");
9734
+ __name(_ts_metadata31, "_ts_metadata");
9517
9735
  var MfaChallengeDto = class {
9518
9736
  static {
9519
9737
  __name(this, "MfaChallengeDto");
@@ -9549,23 +9767,23 @@ var MfaChallengeDto = class {
9549
9767
  */
9550
9768
  code;
9551
9769
  };
9552
- _ts_decorate31([
9770
+ _ts_decorate32([
9553
9771
  classValidator.IsOptional(),
9554
9772
  classValidator.IsString(),
9555
9773
  classValidator.IsNotEmpty(),
9556
9774
  classValidator.MaxLength(512),
9557
- _ts_metadata30("design:type", String)
9775
+ _ts_metadata31("design:type", String)
9558
9776
  ], MfaChallengeDto.prototype, "mfaTempToken", void 0);
9559
- _ts_decorate31([
9777
+ _ts_decorate32([
9560
9778
  classValidator.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})$/, {
9561
9779
  message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
9562
9780
  }),
9563
9781
  classValidator.IsString(),
9564
9782
  classValidator.IsNotEmpty(),
9565
9783
  classValidator.MaxLength(29),
9566
- _ts_metadata30("design:type", String)
9784
+ _ts_metadata31("design:type", String)
9567
9785
  ], MfaChallengeDto.prototype, "code", void 0);
9568
- function _ts_decorate32(decorators, target, key, desc) {
9786
+ function _ts_decorate33(decorators, target, key, desc) {
9569
9787
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9570
9788
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9571
9789
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9578,13 +9796,13 @@ function _ts_decorate32(decorators, target, key, desc) {
9578
9796
  }
9579
9797
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9580
9798
  }
9581
- __name(_ts_decorate32, "_ts_decorate");
9582
- function _ts_metadata31(metadataKey, metadataValue) {
9799
+ __name(_ts_decorate33, "_ts_decorate");
9800
+ function _ts_metadata32(metadataKey, metadataValue) {
9583
9801
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9584
9802
  return Reflect.metadata(metadataKey, metadataValue);
9585
9803
  }
9586
9804
  }
9587
- __name(_ts_metadata31, "_ts_metadata");
9805
+ __name(_ts_metadata32, "_ts_metadata");
9588
9806
  var MfaDisableDto = class {
9589
9807
  static {
9590
9808
  __name(this, "MfaDisableDto");
@@ -9598,16 +9816,16 @@ var MfaDisableDto = class {
9598
9816
  */
9599
9817
  code;
9600
9818
  };
9601
- _ts_decorate32([
9819
+ _ts_decorate33([
9602
9820
  classValidator.MaxLength(6),
9603
9821
  classValidator.Matches(/^\d{6}$/, {
9604
9822
  message: "code must be exactly 6 digits"
9605
9823
  }),
9606
9824
  classValidator.IsString(),
9607
9825
  classValidator.IsNotEmpty(),
9608
- _ts_metadata31("design:type", String)
9826
+ _ts_metadata32("design:type", String)
9609
9827
  ], MfaDisableDto.prototype, "code", void 0);
9610
- function _ts_decorate33(decorators, target, key, desc) {
9828
+ function _ts_decorate34(decorators, target, key, desc) {
9611
9829
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9612
9830
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9613
9831
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9620,13 +9838,13 @@ function _ts_decorate33(decorators, target, key, desc) {
9620
9838
  }
9621
9839
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9622
9840
  }
9623
- __name(_ts_decorate33, "_ts_decorate");
9624
- function _ts_metadata32(metadataKey, metadataValue) {
9841
+ __name(_ts_decorate34, "_ts_decorate");
9842
+ function _ts_metadata33(metadataKey, metadataValue) {
9625
9843
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9626
9844
  return Reflect.metadata(metadataKey, metadataValue);
9627
9845
  }
9628
9846
  }
9629
- __name(_ts_metadata32, "_ts_metadata");
9847
+ __name(_ts_metadata33, "_ts_metadata");
9630
9848
  var MfaRegenerateRecoveryCodesDto = class {
9631
9849
  static {
9632
9850
  __name(this, "MfaRegenerateRecoveryCodesDto");
@@ -9640,16 +9858,16 @@ var MfaRegenerateRecoveryCodesDto = class {
9640
9858
  */
9641
9859
  code;
9642
9860
  };
9643
- _ts_decorate33([
9861
+ _ts_decorate34([
9644
9862
  classValidator.MaxLength(6),
9645
9863
  classValidator.Matches(/^\d{6}$/, {
9646
9864
  message: "code must be exactly 6 digits"
9647
9865
  }),
9648
9866
  classValidator.IsString(),
9649
9867
  classValidator.IsNotEmpty(),
9650
- _ts_metadata32("design:type", String)
9868
+ _ts_metadata33("design:type", String)
9651
9869
  ], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
9652
- function _ts_decorate34(decorators, target, key, desc) {
9870
+ function _ts_decorate35(decorators, target, key, desc) {
9653
9871
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9654
9872
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9655
9873
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9662,13 +9880,13 @@ function _ts_decorate34(decorators, target, key, desc) {
9662
9880
  }
9663
9881
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9664
9882
  }
9665
- __name(_ts_decorate34, "_ts_decorate");
9666
- function _ts_metadata33(metadataKey, metadataValue) {
9883
+ __name(_ts_decorate35, "_ts_decorate");
9884
+ function _ts_metadata34(metadataKey, metadataValue) {
9667
9885
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9668
9886
  return Reflect.metadata(metadataKey, metadataValue);
9669
9887
  }
9670
9888
  }
9671
- __name(_ts_metadata33, "_ts_metadata");
9889
+ __name(_ts_metadata34, "_ts_metadata");
9672
9890
  var MfaSetupDto = class {
9673
9891
  static {
9674
9892
  __name(this, "MfaSetupDto");
@@ -9692,14 +9910,14 @@ var MfaSetupDto = class {
9692
9910
  */
9693
9911
  password;
9694
9912
  };
9695
- _ts_decorate34([
9913
+ _ts_decorate35([
9696
9914
  classValidator.IsOptional(),
9697
9915
  classValidator.IsString(),
9698
9916
  classValidator.MinLength(1),
9699
9917
  classValidator.MaxLength(128),
9700
- _ts_metadata33("design:type", String)
9918
+ _ts_metadata34("design:type", String)
9701
9919
  ], MfaSetupDto.prototype, "password", void 0);
9702
- function _ts_decorate35(decorators, target, key, desc) {
9920
+ function _ts_decorate36(decorators, target, key, desc) {
9703
9921
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9704
9922
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9705
9923
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9712,13 +9930,13 @@ function _ts_decorate35(decorators, target, key, desc) {
9712
9930
  }
9713
9931
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9714
9932
  }
9715
- __name(_ts_decorate35, "_ts_decorate");
9716
- function _ts_metadata34(metadataKey, metadataValue) {
9933
+ __name(_ts_decorate36, "_ts_decorate");
9934
+ function _ts_metadata35(metadataKey, metadataValue) {
9717
9935
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9718
9936
  return Reflect.metadata(metadataKey, metadataValue);
9719
9937
  }
9720
9938
  }
9721
- __name(_ts_metadata34, "_ts_metadata");
9939
+ __name(_ts_metadata35, "_ts_metadata");
9722
9940
  var MfaVerifyDto = class {
9723
9941
  static {
9724
9942
  __name(this, "MfaVerifyDto");
@@ -9731,14 +9949,14 @@ var MfaVerifyDto = class {
9731
9949
  */
9732
9950
  code;
9733
9951
  };
9734
- _ts_decorate35([
9952
+ _ts_decorate36([
9735
9953
  classValidator.MaxLength(6),
9736
9954
  classValidator.Matches(/^\d{6}$/, {
9737
9955
  message: "code must be exactly 6 digits"
9738
9956
  }),
9739
9957
  classValidator.IsString(),
9740
9958
  classValidator.IsNotEmpty(),
9741
- _ts_metadata34("design:type", String)
9959
+ _ts_metadata35("design:type", String)
9742
9960
  ], MfaVerifyDto.prototype, "code", void 0);
9743
9961
  var IV_LENGTH = 12;
9744
9962
  var AUTH_TAG_BYTE_LENGTH = 16;
@@ -9802,7 +10020,7 @@ function runDetached(logger, run, failure) {
9802
10020
  __name(runDetached, "runDetached");
9803
10021
 
9804
10022
  // src/server/services/mfa.service.ts
9805
- function _ts_decorate36(decorators, target, key, desc) {
10023
+ function _ts_decorate37(decorators, target, key, desc) {
9806
10024
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9807
10025
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9808
10026
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9815,13 +10033,13 @@ function _ts_decorate36(decorators, target, key, desc) {
9815
10033
  }
9816
10034
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9817
10035
  }
9818
- __name(_ts_decorate36, "_ts_decorate");
9819
- function _ts_metadata35(metadataKey, metadataValue) {
10036
+ __name(_ts_decorate37, "_ts_decorate");
10037
+ function _ts_metadata36(metadataKey, metadataValue) {
9820
10038
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9821
10039
  return Reflect.metadata(metadataKey, metadataValue);
9822
10040
  }
9823
10041
  }
9824
- __name(_ts_metadata35, "_ts_metadata");
10042
+ __name(_ts_metadata36, "_ts_metadata");
9825
10043
  function _ts_param21(paramIndex, decorator) {
9826
10044
  return function(target, key) {
9827
10045
  decorator(target, key, paramIndex);
@@ -9903,29 +10121,28 @@ exports.MfaService = class _MfaService {
9903
10121
  * Detached from the challenge it follows: the user is already authenticated and the retired
9904
10122
  * key still opens the secret, so a failure here costs the migration and nothing else.
9905
10123
  *
10124
+ * The write replaces the whole MFA record, so it runs as a serialized transition and lands only
10125
+ * on a record that still holds this secret. One that no longer does was disabled or re-enrolled
10126
+ * since, and writing the re-encrypted old secret over it would restore a factor the user removed
10127
+ * and unspend the recovery codes they replaced. The comparison is on the decrypted secret, not
10128
+ * the ciphertext: a sibling challenge that only re-encrypted the same secret changes the
10129
+ * ciphertext and nothing else, and must not be mistaken for a re-enrolment.
10130
+ *
9906
10131
  * @param userId - The account whose stored secret is being re-encrypted.
9907
10132
  * @param context - Which identity plane the account belongs to.
9908
10133
  * @param secretBase32 - The decrypted secret.
9909
- * @param recoveryCodes - The stored recovery digests, written back unchanged.
9910
10134
  * @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
9911
10135
  */
9912
- async reencryptSecret(userId, context, secretBase32, recoveryCodes, tenantId) {
9913
- const update = {
9914
- mfaEnabled: true,
9915
- mfaSecret: this.encryptSecret(secretBase32),
9916
- mfaRecoveryCodes: recoveryCodes
9917
- };
10136
+ async reencryptSecret(userId, context, secretBase32, tenantId) {
9918
10137
  try {
9919
- if (context === "platform" && this.platformUserRepo) {
9920
- await this.platformUserRepo.updateMfa(userId, update);
9921
- } else {
9922
- this.assertDashboardTenant(tenantId);
9923
- await this.userRepo.updateMfa({
9924
- id: userId,
9925
- tenantId,
9926
- data: update
9927
- });
9928
- }
10138
+ await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10139
+ if (!current.mfaEnabled || !this.holdsSecret(current.mfaSecret, secretBase32)) return null;
10140
+ return {
10141
+ mfaEnabled: true,
10142
+ mfaSecret: this.encryptSecret(secretBase32),
10143
+ mfaRecoveryCodes: current.mfaRecoveryCodes ?? []
10144
+ };
10145
+ });
9929
10146
  } catch (err) {
9930
10147
  this.logger.error(`re-encryption under the current MFA key failed: ${describeChannelStatus(err)}`);
9931
10148
  }
@@ -10019,6 +10236,20 @@ exports.MfaService = class _MfaService {
10019
10236
  }
10020
10237
  }
10021
10238
  /**
10239
+ * Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
10240
+ *
10241
+ * Compares plaintext, so a record that was only re-encrypted still matches and one holding a
10242
+ * different secret does not. A ciphertext no key opens does not match either.
10243
+ */
10244
+ holdsSecret(stored, secretBase32) {
10245
+ if (!stored) return false;
10246
+ try {
10247
+ return timingSafeCompare(this.decryptWithRotation(stored).secret, secretBase32);
10248
+ } catch {
10249
+ return false;
10250
+ }
10251
+ }
10252
+ /**
10022
10253
  * Encrypts a TOTP secret for storage in the database using AES-256-GCM.
10023
10254
  */
10024
10255
  encryptSecret(secret) {
@@ -10469,6 +10700,7 @@ exports.MfaService = class _MfaService {
10469
10700
  [];
10470
10701
  await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10471
10702
  if (!current.mfaEnabled) return null;
10703
+ if (!this.holdsSecret(current.mfaSecret, secretBase32)) return null;
10472
10704
  const currentCodes = current.mfaRecoveryCodes ?? [];
10473
10705
  const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
10474
10706
  const liveIndex = currentCodes.indexOf(spentDigest);
@@ -10486,7 +10718,7 @@ exports.MfaService = class _MfaService {
10486
10718
  };
10487
10719
  });
10488
10720
  } else if (encryptedUnderRetiredKey) {
10489
- void this.reencryptSecret(userId, context, secretBase32, user.mfaRecoveryCodes ?? [], tenantId);
10721
+ void this.reencryptSecret(userId, context, secretBase32, tenantId);
10490
10722
  }
10491
10723
  this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
10492
10724
  if (context === "dashboard") {
@@ -11051,7 +11283,7 @@ exports.MfaService = class _MfaService {
11051
11283
  return admin;
11052
11284
  }
11053
11285
  };
11054
- exports.MfaService = _ts_decorate36([
11286
+ exports.MfaService = _ts_decorate37([
11055
11287
  common.Injectable(),
11056
11288
  _ts_param21(0, common.Inject(BYMAX_AUTH_OPTIONS)),
11057
11289
  _ts_param21(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -11064,8 +11296,8 @@ exports.MfaService = _ts_decorate36([
11064
11296
  _ts_param21(7, common.Inject(exports.SessionService)),
11065
11297
  _ts_param21(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
11066
11298
  _ts_param21(9, common.Inject(BYMAX_AUTH_HOOKS)),
11067
- _ts_metadata35("design:type", Function),
11068
- _ts_metadata35("design:paramtypes", [
11299
+ _ts_metadata36("design:type", Function),
11300
+ _ts_metadata36("design:paramtypes", [
11069
11301
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
11070
11302
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
11071
11303
  Object,
@@ -11080,7 +11312,7 @@ exports.MfaService = _ts_decorate36([
11080
11312
  ], exports.MfaService);
11081
11313
 
11082
11314
  // src/server/controllers/mfa.controller.ts
11083
- function _ts_decorate37(decorators, target, key, desc) {
11315
+ function _ts_decorate38(decorators, target, key, desc) {
11084
11316
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11085
11317
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11086
11318
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11093,13 +11325,13 @@ function _ts_decorate37(decorators, target, key, desc) {
11093
11325
  }
11094
11326
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11095
11327
  }
11096
- __name(_ts_decorate37, "_ts_decorate");
11097
- function _ts_metadata36(metadataKey, metadataValue) {
11328
+ __name(_ts_decorate38, "_ts_decorate");
11329
+ function _ts_metadata37(metadataKey, metadataValue) {
11098
11330
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11099
11331
  return Reflect.metadata(metadataKey, metadataValue);
11100
11332
  }
11101
11333
  }
11102
- __name(_ts_metadata36, "_ts_metadata");
11334
+ __name(_ts_metadata37, "_ts_metadata");
11103
11335
  function _ts_param22(paramIndex, decorator) {
11104
11336
  return function(target, key) {
11105
11337
  decorator(target, key, paramIndex);
@@ -11294,21 +11526,22 @@ var MfaController = class {
11294
11526
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
11295
11527
  }
11296
11528
  };
11297
- _ts_decorate37([
11529
+ _ts_decorate38([
11298
11530
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11299
11531
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
11300
11532
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
11533
+ RequestEncoding("when-body"),
11301
11534
  common.Post("setup"),
11302
11535
  _ts_param22(0, CurrentUser()),
11303
11536
  _ts_param22(1, common.Body()),
11304
- _ts_metadata36("design:type", Function),
11305
- _ts_metadata36("design:paramtypes", [
11537
+ _ts_metadata37("design:type", Function),
11538
+ _ts_metadata37("design:paramtypes", [
11306
11539
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11307
11540
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
11308
11541
  ]),
11309
- _ts_metadata36("design:returntype", Promise)
11542
+ _ts_metadata37("design:returntype", Promise)
11310
11543
  ], MfaController.prototype, "setup", null);
11311
- _ts_decorate37([
11544
+ _ts_decorate38([
11312
11545
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11313
11546
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11314
11547
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
@@ -11317,15 +11550,15 @@ _ts_decorate37([
11317
11550
  _ts_param22(0, CurrentUser()),
11318
11551
  _ts_param22(1, common.Body()),
11319
11552
  _ts_param22(2, common.Req()),
11320
- _ts_metadata36("design:type", Function),
11321
- _ts_metadata36("design:paramtypes", [
11553
+ _ts_metadata37("design:type", Function),
11554
+ _ts_metadata37("design:paramtypes", [
11322
11555
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11323
11556
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
11324
11557
  typeof Request === "undefined" ? Object : Request
11325
11558
  ]),
11326
- _ts_metadata36("design:returntype", Promise)
11559
+ _ts_metadata37("design:returntype", Promise)
11327
11560
  ], MfaController.prototype, "verifyEnable", null);
11328
- _ts_decorate37([
11561
+ _ts_decorate38([
11329
11562
  Public(),
11330
11563
  SkipMfa(),
11331
11564
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
@@ -11337,15 +11570,15 @@ _ts_decorate37([
11337
11570
  _ts_param22(2, common.Res({
11338
11571
  passthrough: true
11339
11572
  })),
11340
- _ts_metadata36("design:type", Function),
11341
- _ts_metadata36("design:paramtypes", [
11573
+ _ts_metadata37("design:type", Function),
11574
+ _ts_metadata37("design:paramtypes", [
11342
11575
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
11343
11576
  typeof Request === "undefined" ? Object : Request,
11344
11577
  typeof Response === "undefined" ? Object : Response
11345
11578
  ]),
11346
- _ts_metadata36("design:returntype", Promise)
11579
+ _ts_metadata37("design:returntype", Promise)
11347
11580
  ], MfaController.prototype, "challenge", null);
11348
- _ts_decorate37([
11581
+ _ts_decorate38([
11349
11582
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11350
11583
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11351
11584
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -11354,15 +11587,15 @@ _ts_decorate37([
11354
11587
  _ts_param22(0, CurrentUser()),
11355
11588
  _ts_param22(1, common.Body()),
11356
11589
  _ts_param22(2, common.Req()),
11357
- _ts_metadata36("design:type", Function),
11358
- _ts_metadata36("design:paramtypes", [
11590
+ _ts_metadata37("design:type", Function),
11591
+ _ts_metadata37("design:paramtypes", [
11359
11592
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11360
11593
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
11361
11594
  typeof Request === "undefined" ? Object : Request
11362
11595
  ]),
11363
- _ts_metadata36("design:returntype", Promise)
11596
+ _ts_metadata37("design:returntype", Promise)
11364
11597
  ], MfaController.prototype, "disable", null);
11365
- _ts_decorate37([
11598
+ _ts_decorate38([
11366
11599
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11367
11600
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11368
11601
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -11371,33 +11604,33 @@ _ts_decorate37([
11371
11604
  _ts_param22(0, CurrentUser()),
11372
11605
  _ts_param22(1, common.Body()),
11373
11606
  _ts_param22(2, common.Req()),
11374
- _ts_metadata36("design:type", Function),
11375
- _ts_metadata36("design:paramtypes", [
11607
+ _ts_metadata37("design:type", Function),
11608
+ _ts_metadata37("design:paramtypes", [
11376
11609
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11377
11610
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
11378
11611
  typeof Request === "undefined" ? Object : Request
11379
11612
  ]),
11380
- _ts_metadata36("design:returntype", Promise)
11613
+ _ts_metadata37("design:returntype", Promise)
11381
11614
  ], MfaController.prototype, "regenerateRecoveryCodes", null);
11382
- MfaController = _ts_decorate37([
11615
+ MfaController = _ts_decorate38([
11383
11616
  common.UseInterceptors(NoStoreInterceptor),
11384
11617
  common.Controller("mfa"),
11385
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11618
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11386
11619
  common.UsePipes(createAuthValidationPipe({
11387
11620
  forbidUnknownValues: true
11388
11621
  })),
11389
11622
  _ts_param22(0, common.Inject(exports.MfaService)),
11390
11623
  _ts_param22(1, common.Inject(exports.TokenDeliveryService)),
11391
11624
  _ts_param22(2, common.Inject(BYMAX_AUTH_OPTIONS)),
11392
- _ts_metadata36("design:type", Function),
11393
- _ts_metadata36("design:paramtypes", [
11625
+ _ts_metadata37("design:type", Function),
11626
+ _ts_metadata37("design:paramtypes", [
11394
11627
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
11395
11628
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
11396
11629
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11397
11630
  ])
11398
11631
  ], MfaController);
11399
11632
  var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
11400
- function _ts_decorate38(decorators, target, key, desc) {
11633
+ function _ts_decorate39(decorators, target, key, desc) {
11401
11634
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11402
11635
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11403
11636
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11410,13 +11643,13 @@ function _ts_decorate38(decorators, target, key, desc) {
11410
11643
  }
11411
11644
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11412
11645
  }
11413
- __name(_ts_decorate38, "_ts_decorate");
11414
- function _ts_metadata37(metadataKey, metadataValue) {
11646
+ __name(_ts_decorate39, "_ts_decorate");
11647
+ function _ts_metadata38(metadataKey, metadataValue) {
11415
11648
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11416
11649
  return Reflect.metadata(metadataKey, metadataValue);
11417
11650
  }
11418
11651
  }
11419
- __name(_ts_metadata37, "_ts_metadata");
11652
+ __name(_ts_metadata38, "_ts_metadata");
11420
11653
  var ChangePasswordDto = class {
11421
11654
  static {
11422
11655
  __name(this, "ChangePasswordDto");
@@ -11469,26 +11702,26 @@ var ChangePasswordDto = class {
11469
11702
  */
11470
11703
  refreshToken;
11471
11704
  };
11472
- _ts_decorate38([
11705
+ _ts_decorate39([
11473
11706
  classValidator.IsString(),
11474
11707
  classValidator.MinLength(1),
11475
11708
  classValidator.MaxLength(128),
11476
- _ts_metadata37("design:type", String)
11709
+ _ts_metadata38("design:type", String)
11477
11710
  ], ChangePasswordDto.prototype, "currentPassword", void 0);
11478
- _ts_decorate38([
11711
+ _ts_decorate39([
11479
11712
  classValidator.IsString(),
11480
11713
  classValidator.MinLength(8),
11481
11714
  classValidator.MaxLength(128),
11482
- _ts_metadata37("design:type", String)
11715
+ _ts_metadata38("design:type", String)
11483
11716
  ], ChangePasswordDto.prototype, "newPassword", void 0);
11484
- _ts_decorate38([
11717
+ _ts_decorate39([
11485
11718
  classValidator.IsOptional(),
11486
11719
  classValidator.IsString(),
11487
11720
  classValidator.IsNotEmpty(),
11488
11721
  classValidator.MaxLength(2048),
11489
- _ts_metadata37("design:type", String)
11722
+ _ts_metadata38("design:type", String)
11490
11723
  ], ChangePasswordDto.prototype, "refreshToken", void 0);
11491
- function _ts_decorate39(decorators, target, key, desc) {
11724
+ function _ts_decorate40(decorators, target, key, desc) {
11492
11725
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11493
11726
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11494
11727
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11501,13 +11734,13 @@ function _ts_decorate39(decorators, target, key, desc) {
11501
11734
  }
11502
11735
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11503
11736
  }
11504
- __name(_ts_decorate39, "_ts_decorate");
11505
- function _ts_metadata38(metadataKey, metadataValue) {
11737
+ __name(_ts_decorate40, "_ts_decorate");
11738
+ function _ts_metadata39(metadataKey, metadataValue) {
11506
11739
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11507
11740
  return Reflect.metadata(metadataKey, metadataValue);
11508
11741
  }
11509
11742
  }
11510
- __name(_ts_metadata38, "_ts_metadata");
11743
+ __name(_ts_metadata39, "_ts_metadata");
11511
11744
  var ForgotPasswordDto = class {
11512
11745
  static {
11513
11746
  __name(this, "ForgotPasswordDto");
@@ -11523,13 +11756,13 @@ var ForgotPasswordDto = class {
11523
11756
  */
11524
11757
  tenantId;
11525
11758
  };
11526
- _ts_decorate39([
11759
+ _ts_decorate40([
11527
11760
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11528
11761
  classValidator.IsEmail(),
11529
11762
  classValidator.MaxLength(255),
11530
- _ts_metadata38("design:type", String)
11763
+ _ts_metadata39("design:type", String)
11531
11764
  ], ForgotPasswordDto.prototype, "email", void 0);
11532
- _ts_decorate39([
11765
+ _ts_decorate40([
11533
11766
  classValidator.IsOptional(),
11534
11767
  classValidator.IsString(),
11535
11768
  classValidator.IsNotEmpty(),
@@ -11537,9 +11770,9 @@ _ts_decorate39([
11537
11770
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11538
11771
  message: "tenantId must not contain control characters"
11539
11772
  }),
11540
- _ts_metadata38("design:type", String)
11773
+ _ts_metadata39("design:type", String)
11541
11774
  ], ForgotPasswordDto.prototype, "tenantId", void 0);
11542
- function _ts_decorate40(decorators, target, key, desc) {
11775
+ function _ts_decorate41(decorators, target, key, desc) {
11543
11776
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11544
11777
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11545
11778
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11552,13 +11785,13 @@ function _ts_decorate40(decorators, target, key, desc) {
11552
11785
  }
11553
11786
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11554
11787
  }
11555
- __name(_ts_decorate40, "_ts_decorate");
11556
- function _ts_metadata39(metadataKey, metadataValue) {
11788
+ __name(_ts_decorate41, "_ts_decorate");
11789
+ function _ts_metadata40(metadataKey, metadataValue) {
11557
11790
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11558
11791
  return Reflect.metadata(metadataKey, metadataValue);
11559
11792
  }
11560
11793
  }
11561
- __name(_ts_metadata39, "_ts_metadata");
11794
+ __name(_ts_metadata40, "_ts_metadata");
11562
11795
  var ResendOtpDto = class {
11563
11796
  static {
11564
11797
  __name(this, "ResendOtpDto");
@@ -11573,13 +11806,13 @@ var ResendOtpDto = class {
11573
11806
  */
11574
11807
  tenantId;
11575
11808
  };
11576
- _ts_decorate40([
11809
+ _ts_decorate41([
11577
11810
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11578
11811
  classValidator.IsEmail(),
11579
11812
  classValidator.MaxLength(255),
11580
- _ts_metadata39("design:type", String)
11813
+ _ts_metadata40("design:type", String)
11581
11814
  ], ResendOtpDto.prototype, "email", void 0);
11582
- _ts_decorate40([
11815
+ _ts_decorate41([
11583
11816
  classValidator.IsOptional(),
11584
11817
  classValidator.IsString(),
11585
11818
  classValidator.IsNotEmpty(),
@@ -11587,9 +11820,9 @@ _ts_decorate40([
11587
11820
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11588
11821
  message: "tenantId must not contain control characters"
11589
11822
  }),
11590
- _ts_metadata39("design:type", String)
11823
+ _ts_metadata40("design:type", String)
11591
11824
  ], ResendOtpDto.prototype, "tenantId", void 0);
11592
- function _ts_decorate41(decorators, target, key, desc) {
11825
+ function _ts_decorate42(decorators, target, key, desc) {
11593
11826
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11594
11827
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11595
11828
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11602,13 +11835,13 @@ function _ts_decorate41(decorators, target, key, desc) {
11602
11835
  }
11603
11836
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11604
11837
  }
11605
- __name(_ts_decorate41, "_ts_decorate");
11606
- function _ts_metadata40(metadataKey, metadataValue) {
11838
+ __name(_ts_decorate42, "_ts_decorate");
11839
+ function _ts_metadata41(metadataKey, metadataValue) {
11607
11840
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11608
11841
  return Reflect.metadata(metadataKey, metadataValue);
11609
11842
  }
11610
11843
  }
11611
- __name(_ts_metadata40, "_ts_metadata");
11844
+ __name(_ts_metadata41, "_ts_metadata");
11612
11845
  var ResetPasswordDto = class {
11613
11846
  static {
11614
11847
  __name(this, "ResetPasswordDto");
@@ -11655,38 +11888,38 @@ var ResetPasswordDto = class {
11655
11888
  */
11656
11889
  tenantId;
11657
11890
  };
11658
- _ts_decorate41([
11891
+ _ts_decorate42([
11659
11892
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11660
11893
  classValidator.IsEmail(),
11661
11894
  classValidator.MaxLength(255),
11662
- _ts_metadata40("design:type", String)
11895
+ _ts_metadata41("design:type", String)
11663
11896
  ], ResetPasswordDto.prototype, "email", void 0);
11664
- _ts_decorate41([
11897
+ _ts_decorate42([
11665
11898
  classValidator.IsString(),
11666
11899
  classValidator.MinLength(8),
11667
11900
  classValidator.MaxLength(128),
11668
- _ts_metadata40("design:type", String)
11901
+ _ts_metadata41("design:type", String)
11669
11902
  ], ResetPasswordDto.prototype, "newPassword", void 0);
11670
- _ts_decorate41([
11903
+ _ts_decorate42([
11671
11904
  classValidator.IsOptional(),
11672
11905
  classValidator.IsString(),
11673
11906
  classValidator.IsNotEmpty(),
11674
11907
  classValidator.MaxLength(2048),
11675
- _ts_metadata40("design:type", String)
11908
+ _ts_metadata41("design:type", String)
11676
11909
  ], ResetPasswordDto.prototype, "token", void 0);
11677
- _ts_decorate41([
11910
+ _ts_decorate42([
11678
11911
  classValidator.IsOptional(),
11679
11912
  classValidator.IsString(),
11680
11913
  classValidator.Length(4, 8),
11681
- _ts_metadata40("design:type", String)
11914
+ _ts_metadata41("design:type", String)
11682
11915
  ], ResetPasswordDto.prototype, "otp", void 0);
11683
- _ts_decorate41([
11916
+ _ts_decorate42([
11684
11917
  classValidator.IsOptional(),
11685
11918
  classValidator.IsString(),
11686
11919
  classValidator.Length(64, 64),
11687
- _ts_metadata40("design:type", String)
11920
+ _ts_metadata41("design:type", String)
11688
11921
  ], ResetPasswordDto.prototype, "verifiedToken", void 0);
11689
- _ts_decorate41([
11922
+ _ts_decorate42([
11690
11923
  classValidator.IsOptional(),
11691
11924
  classValidator.IsString(),
11692
11925
  classValidator.IsNotEmpty(),
@@ -11694,9 +11927,9 @@ _ts_decorate41([
11694
11927
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11695
11928
  message: "tenantId must not contain control characters"
11696
11929
  }),
11697
- _ts_metadata40("design:type", String)
11930
+ _ts_metadata41("design:type", String)
11698
11931
  ], ResetPasswordDto.prototype, "tenantId", void 0);
11699
- function _ts_decorate42(decorators, target, key, desc) {
11932
+ function _ts_decorate43(decorators, target, key, desc) {
11700
11933
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11701
11934
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11702
11935
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11709,13 +11942,13 @@ function _ts_decorate42(decorators, target, key, desc) {
11709
11942
  }
11710
11943
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11711
11944
  }
11712
- __name(_ts_decorate42, "_ts_decorate");
11713
- function _ts_metadata41(metadataKey, metadataValue) {
11945
+ __name(_ts_decorate43, "_ts_decorate");
11946
+ function _ts_metadata42(metadataKey, metadataValue) {
11714
11947
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11715
11948
  return Reflect.metadata(metadataKey, metadataValue);
11716
11949
  }
11717
11950
  }
11718
- __name(_ts_metadata41, "_ts_metadata");
11951
+ __name(_ts_metadata42, "_ts_metadata");
11719
11952
  var VerifyOtpDto = class {
11720
11953
  static {
11721
11954
  __name(this, "VerifyOtpDto");
@@ -11737,18 +11970,18 @@ var VerifyOtpDto = class {
11737
11970
  */
11738
11971
  tenantId;
11739
11972
  };
11740
- _ts_decorate42([
11973
+ _ts_decorate43([
11741
11974
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11742
11975
  classValidator.IsEmail(),
11743
11976
  classValidator.MaxLength(255),
11744
- _ts_metadata41("design:type", String)
11977
+ _ts_metadata42("design:type", String)
11745
11978
  ], VerifyOtpDto.prototype, "email", void 0);
11746
- _ts_decorate42([
11979
+ _ts_decorate43([
11747
11980
  classValidator.IsString(),
11748
11981
  classValidator.Length(4, 8),
11749
- _ts_metadata41("design:type", String)
11982
+ _ts_metadata42("design:type", String)
11750
11983
  ], VerifyOtpDto.prototype, "otp", void 0);
11751
- _ts_decorate42([
11984
+ _ts_decorate43([
11752
11985
  classValidator.IsOptional(),
11753
11986
  classValidator.IsString(),
11754
11987
  classValidator.IsNotEmpty(),
@@ -11756,9 +11989,9 @@ _ts_decorate42([
11756
11989
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11757
11990
  message: "tenantId must not contain control characters"
11758
11991
  }),
11759
- _ts_metadata41("design:type", String)
11992
+ _ts_metadata42("design:type", String)
11760
11993
  ], VerifyOtpDto.prototype, "tenantId", void 0);
11761
- function _ts_decorate43(decorators, target, key, desc) {
11994
+ function _ts_decorate44(decorators, target, key, desc) {
11762
11995
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11763
11996
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11764
11997
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11771,13 +12004,13 @@ function _ts_decorate43(decorators, target, key, desc) {
11771
12004
  }
11772
12005
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11773
12006
  }
11774
- __name(_ts_decorate43, "_ts_decorate");
11775
- function _ts_metadata42(metadataKey, metadataValue) {
12007
+ __name(_ts_decorate44, "_ts_decorate");
12008
+ function _ts_metadata43(metadataKey, metadataValue) {
11776
12009
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11777
12010
  return Reflect.metadata(metadataKey, metadataValue);
11778
12011
  }
11779
12012
  }
11780
- __name(_ts_metadata42, "_ts_metadata");
12013
+ __name(_ts_metadata43, "_ts_metadata");
11781
12014
  function _ts_param23(paramIndex, decorator) {
11782
12015
  return function(target, key) {
11783
12016
  decorator(target, key, paramIndex);
@@ -12135,7 +12368,7 @@ exports.PasswordResetService = class _PasswordResetService {
12135
12368
  throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
12136
12369
  }
12137
12370
  await this.bruteForce.resetFailures(bfIdentifier);
12138
- await this.requireLiveCurrentSession(userId, user.tenantId, currentRefreshToken);
12371
+ const keptHash = await this.resolveCurrentSession(userId, user.tenantId, currentRefreshToken);
12139
12372
  await this.passwordService.assertAcceptable(dto.newPassword, "newPassword");
12140
12373
  const passwordHash = await this.passwordService.hash(dto.newPassword);
12141
12374
  await this.userRepo.updatePassword({
@@ -12143,36 +12376,40 @@ exports.PasswordResetService = class _PasswordResetService {
12143
12376
  tenantId,
12144
12377
  passwordHash
12145
12378
  });
12146
- await this.endOtherSessions(userId, user.tenantId, currentRefreshToken);
12379
+ await this.endOtherSessions(userId, user.tenantId, keptHash);
12147
12380
  await this.notifyPasswordChanged(user);
12148
12381
  }
12149
- /** Refuses a presented refresh token that names no live session of the account. */
12150
- async requireLiveCurrentSession(userId, tenantId, currentRefreshToken) {
12151
- if (currentRefreshToken === void 0 || currentRefreshToken.length === 0) return;
12152
- await this.sessionService.assertLiveSession({
12382
+ /**
12383
+ * The hash of the live session a presented refresh token stands for, or `undefined` when the
12384
+ * request carried none. Refuses a token that names no live session of the account; a token that
12385
+ * rotated away while the password was being verified stands for the session that replaced it.
12386
+ */
12387
+ async resolveCurrentSession(userId, tenantId, currentRefreshToken) {
12388
+ if (currentRefreshToken === void 0 || currentRefreshToken.length === 0) return void 0;
12389
+ return this.sessionService.resolveLiveSession({
12153
12390
  userId,
12154
12391
  tenantId,
12155
12392
  sessionHash: sha256(currentRefreshToken)
12156
12393
  });
12157
12394
  }
12158
12395
  /**
12159
- * Ends every session but the caller's, once the new password is already written.
12396
+ * Ends every session but the one to keep, once the new password is already written.
12160
12397
  *
12161
- * With no presented token there is no session to spare and every session ends. A token that was
12162
- * live when it was checked can rotate away while the new password is hashed, and then there is
12163
- * no current session left to keep either: every session ends, so the cleanup that makes the
12164
- * change safe is never aborted by the session it was told to spare. Any other failure of the
12165
- * sweep propagates.
12398
+ * With no session to keep every session ends. A kept session can rotate away while the new
12399
+ * password is hashed; the sweep follows it to its successor, and when it cannot be followed
12400
+ * there is no current session left to spare, so every session ends and the cleanup that makes
12401
+ * the change safe is never aborted by the session it was told to spare. Any other failure of
12402
+ * the sweep propagates.
12166
12403
  */
12167
- async endOtherSessions(userId, tenantId, currentRefreshToken) {
12168
- if (currentRefreshToken === void 0 || currentRefreshToken.length === 0) {
12404
+ async endOtherSessions(userId, tenantId, keptHash) {
12405
+ if (keptHash === void 0) {
12169
12406
  return this.endAllSessions(userId, tenantId);
12170
12407
  }
12171
12408
  try {
12172
12409
  await this.sessionService.revokeAllExceptCurrent({
12173
12410
  userId,
12174
12411
  tenantId,
12175
- currentSessionHash: sha256(currentRefreshToken)
12412
+ currentSessionHash: keptHash
12176
12413
  });
12177
12414
  } catch (err) {
12178
12415
  const body = err instanceof AuthException ? err.getResponse() : void 0;
@@ -12389,7 +12626,7 @@ exports.PasswordResetService = class _PasswordResetService {
12389
12626
  };
12390
12627
  }
12391
12628
  };
12392
- exports.PasswordResetService = _ts_decorate43([
12629
+ exports.PasswordResetService = _ts_decorate44([
12393
12630
  common.Injectable(),
12394
12631
  _ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12395
12632
  _ts_param23(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -12402,8 +12639,8 @@ exports.PasswordResetService = _ts_decorate43([
12402
12639
  _ts_param23(6, common.Inject(AuthRedisService)),
12403
12640
  _ts_param23(7, common.Inject(exports.SessionService)),
12404
12641
  _ts_param23(8, common.Inject(exports.BruteForceService)),
12405
- _ts_metadata42("design:type", Function),
12406
- _ts_metadata42("design:paramtypes", [
12642
+ _ts_metadata43("design:type", Function),
12643
+ _ts_metadata43("design:paramtypes", [
12407
12644
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
12408
12645
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
12409
12646
  Object,
@@ -12422,7 +12659,7 @@ function toSafeUser3(user) {
12422
12659
  __name(toSafeUser3, "toSafeUser");
12423
12660
 
12424
12661
  // src/server/controllers/password-reset.controller.ts
12425
- function _ts_decorate44(decorators, target, key, desc) {
12662
+ function _ts_decorate45(decorators, target, key, desc) {
12426
12663
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12427
12664
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12428
12665
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12435,13 +12672,13 @@ function _ts_decorate44(decorators, target, key, desc) {
12435
12672
  }
12436
12673
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12437
12674
  }
12438
- __name(_ts_decorate44, "_ts_decorate");
12439
- function _ts_metadata43(metadataKey, metadataValue) {
12675
+ __name(_ts_decorate45, "_ts_decorate");
12676
+ function _ts_metadata44(metadataKey, metadataValue) {
12440
12677
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12441
12678
  return Reflect.metadata(metadataKey, metadataValue);
12442
12679
  }
12443
12680
  }
12444
- __name(_ts_metadata43, "_ts_metadata");
12681
+ __name(_ts_metadata44, "_ts_metadata");
12445
12682
  function _ts_param24(paramIndex, decorator) {
12446
12683
  return function(target, key) {
12447
12684
  decorator(target, key, paramIndex);
@@ -12564,35 +12801,35 @@ var PasswordResetController = class {
12564
12801
  return {};
12565
12802
  }
12566
12803
  };
12567
- _ts_decorate44([
12804
+ _ts_decorate45([
12568
12805
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
12569
12806
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
12570
12807
  common.HttpCode(common.HttpStatus.OK),
12571
12808
  common.Post("forgot-password"),
12572
12809
  _ts_param24(0, common.Body()),
12573
12810
  _ts_param24(1, common.Req()),
12574
- _ts_metadata43("design:type", Function),
12575
- _ts_metadata43("design:paramtypes", [
12811
+ _ts_metadata44("design:type", Function),
12812
+ _ts_metadata44("design:paramtypes", [
12576
12813
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
12577
12814
  typeof Request === "undefined" ? Object : Request
12578
12815
  ]),
12579
- _ts_metadata43("design:returntype", Promise)
12816
+ _ts_metadata44("design:returntype", Promise)
12580
12817
  ], PasswordResetController.prototype, "forgotPassword", null);
12581
- _ts_decorate44([
12818
+ _ts_decorate45([
12582
12819
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
12583
12820
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
12584
12821
  common.HttpCode(common.HttpStatus.NO_CONTENT),
12585
12822
  common.Post("reset-password"),
12586
12823
  _ts_param24(0, common.Body()),
12587
12824
  _ts_param24(1, common.Req()),
12588
- _ts_metadata43("design:type", Function),
12589
- _ts_metadata43("design:paramtypes", [
12825
+ _ts_metadata44("design:type", Function),
12826
+ _ts_metadata44("design:paramtypes", [
12590
12827
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
12591
12828
  typeof Request === "undefined" ? Object : Request
12592
12829
  ]),
12593
- _ts_metadata43("design:returntype", Promise)
12830
+ _ts_metadata44("design:returntype", Promise)
12594
12831
  ], PasswordResetController.prototype, "resetPassword", null);
12595
- _ts_decorate44([
12832
+ _ts_decorate45([
12596
12833
  Authenticated(),
12597
12834
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
12598
12835
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
@@ -12602,57 +12839,57 @@ _ts_decorate44([
12602
12839
  _ts_param24(0, CurrentUser()),
12603
12840
  _ts_param24(1, common.Body()),
12604
12841
  _ts_param24(2, common.Req()),
12605
- _ts_metadata43("design:type", Function),
12606
- _ts_metadata43("design:paramtypes", [
12842
+ _ts_metadata44("design:type", Function),
12843
+ _ts_metadata44("design:paramtypes", [
12607
12844
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
12608
12845
  typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
12609
12846
  typeof Request === "undefined" ? Object : Request
12610
12847
  ]),
12611
- _ts_metadata43("design:returntype", Promise)
12848
+ _ts_metadata44("design:returntype", Promise)
12612
12849
  ], PasswordResetController.prototype, "changePassword", null);
12613
- _ts_decorate44([
12850
+ _ts_decorate45([
12614
12851
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
12615
12852
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
12616
12853
  common.HttpCode(common.HttpStatus.OK),
12617
12854
  common.Post("verify-otp"),
12618
12855
  _ts_param24(0, common.Body()),
12619
12856
  _ts_param24(1, common.Req()),
12620
- _ts_metadata43("design:type", Function),
12621
- _ts_metadata43("design:paramtypes", [
12857
+ _ts_metadata44("design:type", Function),
12858
+ _ts_metadata44("design:paramtypes", [
12622
12859
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
12623
12860
  typeof Request === "undefined" ? Object : Request
12624
12861
  ]),
12625
- _ts_metadata43("design:returntype", Promise)
12862
+ _ts_metadata44("design:returntype", Promise)
12626
12863
  ], PasswordResetController.prototype, "verifyOtp", null);
12627
- _ts_decorate44([
12864
+ _ts_decorate45([
12628
12865
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12629
12866
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12630
12867
  common.HttpCode(common.HttpStatus.OK),
12631
12868
  common.Post("resend-otp"),
12632
12869
  _ts_param24(0, common.Body()),
12633
12870
  _ts_param24(1, common.Req()),
12634
- _ts_metadata43("design:type", Function),
12635
- _ts_metadata43("design:paramtypes", [
12871
+ _ts_metadata44("design:type", Function),
12872
+ _ts_metadata44("design:paramtypes", [
12636
12873
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
12637
12874
  typeof Request === "undefined" ? Object : Request
12638
12875
  ]),
12639
- _ts_metadata43("design:returntype", Promise)
12876
+ _ts_metadata44("design:returntype", Promise)
12640
12877
  ], PasswordResetController.prototype, "resendOtp", null);
12641
- PasswordResetController = _ts_decorate44([
12878
+ PasswordResetController = _ts_decorate45([
12642
12879
  Public(),
12643
12880
  common.UseInterceptors(NoStoreInterceptor),
12644
12881
  common.Controller("password"),
12645
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12882
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12646
12883
  common.UsePipes(createAuthValidationPipe()),
12647
12884
  _ts_param24(0, common.Inject(exports.PasswordResetService)),
12648
12885
  _ts_param24(1, common.Inject(exports.TokenDeliveryService)),
12649
- _ts_metadata43("design:type", Function),
12650
- _ts_metadata43("design:paramtypes", [
12886
+ _ts_metadata44("design:type", Function),
12887
+ _ts_metadata44("design:paramtypes", [
12651
12888
  typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
12652
12889
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
12653
12890
  ])
12654
12891
  ], PasswordResetController);
12655
- function _ts_decorate45(decorators, target, key, desc) {
12892
+ function _ts_decorate46(decorators, target, key, desc) {
12656
12893
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12657
12894
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12658
12895
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12665,13 +12902,13 @@ function _ts_decorate45(decorators, target, key, desc) {
12665
12902
  }
12666
12903
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12667
12904
  }
12668
- __name(_ts_decorate45, "_ts_decorate");
12669
- function _ts_metadata44(metadataKey, metadataValue) {
12905
+ __name(_ts_decorate46, "_ts_decorate");
12906
+ function _ts_metadata45(metadataKey, metadataValue) {
12670
12907
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12671
12908
  return Reflect.metadata(metadataKey, metadataValue);
12672
12909
  }
12673
12910
  }
12674
- __name(_ts_metadata44, "_ts_metadata");
12911
+ __name(_ts_metadata45, "_ts_metadata");
12675
12912
  var PlatformLoginDto = class {
12676
12913
  static {
12677
12914
  __name(this, "PlatformLoginDto");
@@ -12699,14 +12936,14 @@ var PlatformLoginDto = class {
12699
12936
  */
12700
12937
  password;
12701
12938
  };
12702
- _ts_decorate45([
12939
+ _ts_decorate46([
12703
12940
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
12704
12941
  classValidator.IsEmail(),
12705
12942
  classValidator.IsNotEmpty(),
12706
12943
  classValidator.MaxLength(255),
12707
- _ts_metadata44("design:type", String)
12944
+ _ts_metadata45("design:type", String)
12708
12945
  ], PlatformLoginDto.prototype, "email", void 0);
12709
- _ts_decorate45([
12946
+ _ts_decorate46([
12710
12947
  classValidator.IsString(),
12711
12948
  classValidator.IsNotEmpty(),
12712
12949
  classValidator.Matches(/\S/, {
@@ -12714,9 +12951,9 @@ _ts_decorate45([
12714
12951
  }),
12715
12952
  classValidator.MinLength(1),
12716
12953
  classValidator.MaxLength(128),
12717
- _ts_metadata44("design:type", String)
12954
+ _ts_metadata45("design:type", String)
12718
12955
  ], PlatformLoginDto.prototype, "password", void 0);
12719
- function _ts_decorate46(decorators, target, key, desc) {
12956
+ function _ts_decorate47(decorators, target, key, desc) {
12720
12957
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12721
12958
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12722
12959
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12729,13 +12966,13 @@ function _ts_decorate46(decorators, target, key, desc) {
12729
12966
  }
12730
12967
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12731
12968
  }
12732
- __name(_ts_decorate46, "_ts_decorate");
12733
- function _ts_metadata45(metadataKey, metadataValue) {
12969
+ __name(_ts_decorate47, "_ts_decorate");
12970
+ function _ts_metadata46(metadataKey, metadataValue) {
12734
12971
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12735
12972
  return Reflect.metadata(metadataKey, metadataValue);
12736
12973
  }
12737
12974
  }
12738
- __name(_ts_metadata45, "_ts_metadata");
12975
+ __name(_ts_metadata46, "_ts_metadata");
12739
12976
  function _ts_param25(paramIndex, decorator) {
12740
12977
  return function(target, key) {
12741
12978
  decorator(target, key, paramIndex);
@@ -12787,15 +13024,15 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
12787
13024
  return true;
12788
13025
  }
12789
13026
  };
12790
- exports.JwtPlatformGuard = _ts_decorate46([
13027
+ exports.JwtPlatformGuard = _ts_decorate47([
12791
13028
  common.Injectable(),
12792
13029
  _ts_param25(0, common.Inject(jwt.JwtService)),
12793
13030
  _ts_param25(1, common.Inject(exports.TokenDeliveryService)),
12794
13031
  _ts_param25(2, common.Inject(exports.AuthRevocationService)),
12795
13032
  _ts_param25(3, common.Inject(core.Reflector)),
12796
13033
  _ts_param25(4, common.Inject(BYMAX_AUTH_OPTIONS)),
12797
- _ts_metadata45("design:type", Function),
12798
- _ts_metadata45("design:paramtypes", [
13034
+ _ts_metadata46("design:type", Function),
13035
+ _ts_metadata46("design:paramtypes", [
12799
13036
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
12800
13037
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
12801
13038
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -12803,7 +13040,7 @@ exports.JwtPlatformGuard = _ts_decorate46([
12803
13040
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
12804
13041
  ])
12805
13042
  ], exports.JwtPlatformGuard);
12806
- function _ts_decorate47(decorators, target, key, desc) {
13043
+ function _ts_decorate48(decorators, target, key, desc) {
12807
13044
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12808
13045
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12809
13046
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12816,13 +13053,13 @@ function _ts_decorate47(decorators, target, key, desc) {
12816
13053
  }
12817
13054
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12818
13055
  }
12819
- __name(_ts_decorate47, "_ts_decorate");
12820
- function _ts_metadata46(metadataKey, metadataValue) {
13056
+ __name(_ts_decorate48, "_ts_decorate");
13057
+ function _ts_metadata47(metadataKey, metadataValue) {
12821
13058
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12822
13059
  return Reflect.metadata(metadataKey, metadataValue);
12823
13060
  }
12824
13061
  }
12825
- __name(_ts_metadata46, "_ts_metadata");
13062
+ __name(_ts_metadata47, "_ts_metadata");
12826
13063
  function _ts_param26(paramIndex, decorator) {
12827
13064
  return function(target, key) {
12828
13065
  decorator(target, key, paramIndex);
@@ -12927,36 +13164,60 @@ exports.PlatformAuthService = class _PlatformAuthService {
12927
13164
  */
12928
13165
  async logout(accessToken, rawRefreshToken) {
12929
13166
  const tokenHash = sha256(rawRefreshToken);
12930
- const { userId } = await this.redis.readSessionOwner(`prt:${tokenHash}`);
13167
+ const markerKey = logoutPendingKey("platform", tokenHash);
13168
+ const live = await this.redis.readSessionOwner(`prt:${tokenHash}`);
13169
+ const fromSession = live.userId !== "";
13170
+ const { userId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
12931
13171
  this.logger.log(`logout: adminId=${logSafe(userId || "(no live session)")}`);
12932
- let blacklist = [];
12933
- try {
12934
- const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
12935
- const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
12936
- if (remainingTtl > 0) {
12937
- blacklist = [
12938
- () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
12939
- ];
12940
- }
12941
- } catch {
12942
- }
12943
13172
  const index = userId ? sessionIndexKey("platform", userId, this.options.hmacKey, void 0) : "";
12944
13173
  const prune = /* @__PURE__ */ __name((member) => index === "" ? [] : [
12945
13174
  () => this.redis.srem(index, member)
12946
13175
  ], "prune");
12947
13176
  const failures = await settleWrites([
12948
- ...blacklist,
13177
+ ...this.blacklistWrites(accessToken),
12949
13178
  settleAfter(() => this.redis.del("prt:" + tokenHash), [
12950
13179
  ...prune("prt:" + tokenHash),
12951
13180
  () => this.redis.del("psd:" + tokenHash)
12952
13181
  ]),
12953
13182
  settleAfter(() => this.redis.del("prp:" + tokenHash), prune("prp:" + tokenHash))
12954
13183
  ]);
13184
+ if (failures.length > 0 && fromSession) {
13185
+ await rememberPendingLogout(this.redis, markerKey, {
13186
+ userId,
13187
+ tenantId: void 0
13188
+ }, logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn), this.logger);
13189
+ }
12955
13190
  raiseFirst(failures);
12956
- this.emitPlatformLogout(userId);
13191
+ if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, this.logger)) {
13192
+ this.emitPlatformLogout(userId);
13193
+ }
12957
13194
  return userId;
12958
13195
  }
12959
13196
  /**
13197
+ * The access-token blacklist write for a platform logout, or none when there is nothing to
13198
+ * revoke.
13199
+ *
13200
+ * Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
13201
+ * forged one must not be able to blacklist an id it does not own. Only the verification is
13202
+ * tolerant: a token nobody can verify has nothing to blacklist, but a refused write is not.
13203
+ *
13204
+ * @param accessToken - Raw platform access token; absent, malformed or expired yields no write.
13205
+ * @returns The writes to hand to `settleWrites`.
13206
+ */
13207
+ blacklistWrites(accessToken) {
13208
+ try {
13209
+ const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
13210
+ const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
13211
+ if (remainingTtl > 0) {
13212
+ return [
13213
+ () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
13214
+ ];
13215
+ }
13216
+ } catch {
13217
+ }
13218
+ return [];
13219
+ }
13220
+ /**
12960
13221
  * Announces a completed platform logout, the only hook `PlatformAuthService` emits.
12961
13222
  *
12962
13223
  * Owns three concerns a reader of `logout` does not need: whether a hook is registered, the
@@ -13093,7 +13354,7 @@ exports.PlatformAuthService = class _PlatformAuthService {
13093
13354
  await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
13094
13355
  }
13095
13356
  };
13096
- exports.PlatformAuthService = _ts_decorate47([
13357
+ exports.PlatformAuthService = _ts_decorate48([
13097
13358
  common.Injectable(),
13098
13359
  _ts_param26(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
13099
13360
  _ts_param26(1, common.Inject(PasswordService)),
@@ -13103,8 +13364,8 @@ exports.PlatformAuthService = _ts_decorate47([
13103
13364
  _ts_param26(5, common.Inject(BYMAX_AUTH_OPTIONS)),
13104
13365
  _ts_param26(6, common.Inject(BYMAX_AUTH_HOOKS)),
13105
13366
  _ts_param26(6, common.Optional()),
13106
- _ts_metadata46("design:type", Function),
13107
- _ts_metadata46("design:paramtypes", [
13367
+ _ts_metadata47("design:type", Function),
13368
+ _ts_metadata47("design:paramtypes", [
13108
13369
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
13109
13370
  typeof PasswordService === "undefined" ? Object : PasswordService,
13110
13371
  typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
@@ -13116,7 +13377,7 @@ exports.PlatformAuthService = _ts_decorate47([
13116
13377
  ], exports.PlatformAuthService);
13117
13378
 
13118
13379
  // src/server/controllers/platform-auth.controller.ts
13119
- function _ts_decorate48(decorators, target, key, desc) {
13380
+ function _ts_decorate49(decorators, target, key, desc) {
13120
13381
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13121
13382
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13122
13383
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13129,13 +13390,13 @@ function _ts_decorate48(decorators, target, key, desc) {
13129
13390
  }
13130
13391
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13131
13392
  }
13132
- __name(_ts_decorate48, "_ts_decorate");
13133
- function _ts_metadata47(metadataKey, metadataValue) {
13393
+ __name(_ts_decorate49, "_ts_decorate");
13394
+ function _ts_metadata48(metadataKey, metadataValue) {
13134
13395
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13135
13396
  return Reflect.metadata(metadataKey, metadataValue);
13136
13397
  }
13137
13398
  }
13138
- __name(_ts_metadata47, "_ts_metadata");
13399
+ __name(_ts_metadata48, "_ts_metadata");
13139
13400
  function _ts_param27(paramIndex, decorator) {
13140
13401
  return function(target, key) {
13141
13402
  decorator(target, key, paramIndex);
@@ -13287,7 +13548,7 @@ var PlatformAuthController = class {
13287
13548
  await this.platformAuthService.revokeAllPlatformSessions(user.sub);
13288
13549
  }
13289
13550
  };
13290
- _ts_decorate48([
13551
+ _ts_decorate49([
13291
13552
  Public(),
13292
13553
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
13293
13554
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
@@ -13295,14 +13556,14 @@ _ts_decorate48([
13295
13556
  common.Post("login"),
13296
13557
  _ts_param27(0, common.Body()),
13297
13558
  _ts_param27(1, common.Req()),
13298
- _ts_metadata47("design:type", Function),
13299
- _ts_metadata47("design:paramtypes", [
13559
+ _ts_metadata48("design:type", Function),
13560
+ _ts_metadata48("design:paramtypes", [
13300
13561
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
13301
13562
  typeof Request === "undefined" ? Object : Request
13302
13563
  ]),
13303
- _ts_metadata47("design:returntype", Promise)
13564
+ _ts_metadata48("design:returntype", Promise)
13304
13565
  ], PlatformAuthController.prototype, "login", null);
13305
- _ts_decorate48([
13566
+ _ts_decorate49([
13306
13567
  Public(),
13307
13568
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
13308
13569
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
@@ -13310,78 +13571,80 @@ _ts_decorate48([
13310
13571
  common.Post("mfa/challenge"),
13311
13572
  _ts_param27(0, common.Body()),
13312
13573
  _ts_param27(1, common.Req()),
13313
- _ts_metadata47("design:type", Function),
13314
- _ts_metadata47("design:paramtypes", [
13574
+ _ts_metadata48("design:type", Function),
13575
+ _ts_metadata48("design:paramtypes", [
13315
13576
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
13316
13577
  typeof Request === "undefined" ? Object : Request
13317
13578
  ]),
13318
- _ts_metadata47("design:returntype", Promise)
13579
+ _ts_metadata48("design:returntype", Promise)
13319
13580
  ], PlatformAuthController.prototype, "mfaChallenge", null);
13320
- _ts_decorate48([
13581
+ _ts_decorate49([
13321
13582
  common.UseGuards(exports.JwtPlatformGuard),
13322
13583
  common.Get("me"),
13323
13584
  _ts_param27(0, CurrentUser()),
13324
- _ts_metadata47("design:type", Function),
13325
- _ts_metadata47("design:paramtypes", [
13585
+ _ts_metadata48("design:type", Function),
13586
+ _ts_metadata48("design:paramtypes", [
13326
13587
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13327
13588
  ]),
13328
- _ts_metadata47("design:returntype", Promise)
13589
+ _ts_metadata48("design:returntype", Promise)
13329
13590
  ], PlatformAuthController.prototype, "me", null);
13330
- _ts_decorate48([
13591
+ _ts_decorate49([
13331
13592
  Public(),
13332
13593
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
13333
13594
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
13334
13595
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13596
+ RequestEncoding("unchecked"),
13335
13597
  common.Post("logout"),
13336
13598
  _ts_param27(0, common.Req()),
13337
- _ts_metadata47("design:type", Function),
13338
- _ts_metadata47("design:paramtypes", [
13599
+ _ts_metadata48("design:type", Function),
13600
+ _ts_metadata48("design:paramtypes", [
13339
13601
  typeof Request === "undefined" ? Object : Request
13340
13602
  ]),
13341
- _ts_metadata47("design:returntype", Promise)
13603
+ _ts_metadata48("design:returntype", Promise)
13342
13604
  ], PlatformAuthController.prototype, "logout", null);
13343
- _ts_decorate48([
13605
+ _ts_decorate49([
13344
13606
  Public(),
13345
13607
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
13346
13608
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
13347
13609
  common.HttpCode(common.HttpStatus.OK),
13610
+ RequestEncoding("unchecked"),
13348
13611
  common.Post("refresh"),
13349
13612
  _ts_param27(0, common.Req()),
13350
- _ts_metadata47("design:type", Function),
13351
- _ts_metadata47("design:paramtypes", [
13613
+ _ts_metadata48("design:type", Function),
13614
+ _ts_metadata48("design:paramtypes", [
13352
13615
  typeof Request === "undefined" ? Object : Request
13353
13616
  ]),
13354
- _ts_metadata47("design:returntype", Promise)
13617
+ _ts_metadata48("design:returntype", Promise)
13355
13618
  ], PlatformAuthController.prototype, "refresh", null);
13356
- _ts_decorate48([
13619
+ _ts_decorate49([
13357
13620
  common.UseGuards(exports.JwtPlatformGuard),
13358
13621
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13359
13622
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13360
13623
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13361
13624
  common.Delete("sessions"),
13362
13625
  _ts_param27(0, CurrentUser()),
13363
- _ts_metadata47("design:type", Function),
13364
- _ts_metadata47("design:paramtypes", [
13626
+ _ts_metadata48("design:type", Function),
13627
+ _ts_metadata48("design:paramtypes", [
13365
13628
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13366
13629
  ]),
13367
- _ts_metadata47("design:returntype", Promise)
13630
+ _ts_metadata48("design:returntype", Promise)
13368
13631
  ], PlatformAuthController.prototype, "revokeSessions", null);
13369
- PlatformAuthController = _ts_decorate48([
13632
+ PlatformAuthController = _ts_decorate49([
13370
13633
  common.UseInterceptors(NoStoreInterceptor),
13371
13634
  common.Controller("platform"),
13372
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13635
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13373
13636
  common.UsePipes(createAuthValidationPipe()),
13374
13637
  _ts_param27(0, common.Inject(exports.PlatformAuthService)),
13375
13638
  _ts_param27(1, common.Inject(exports.MfaService)),
13376
13639
  _ts_param27(2, common.Inject(exports.TokenDeliveryService)),
13377
- _ts_metadata47("design:type", Function),
13378
- _ts_metadata47("design:paramtypes", [
13640
+ _ts_metadata48("design:type", Function),
13641
+ _ts_metadata48("design:paramtypes", [
13379
13642
  typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
13380
13643
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
13381
13644
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13382
13645
  ])
13383
13646
  ], PlatformAuthController);
13384
- function _ts_decorate49(decorators, target, key, desc) {
13647
+ function _ts_decorate50(decorators, target, key, desc) {
13385
13648
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13386
13649
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13387
13650
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13394,13 +13657,13 @@ function _ts_decorate49(decorators, target, key, desc) {
13394
13657
  }
13395
13658
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13396
13659
  }
13397
- __name(_ts_decorate49, "_ts_decorate");
13398
- function _ts_metadata48(metadataKey, metadataValue) {
13660
+ __name(_ts_decorate50, "_ts_decorate");
13661
+ function _ts_metadata49(metadataKey, metadataValue) {
13399
13662
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13400
13663
  return Reflect.metadata(metadataKey, metadataValue);
13401
13664
  }
13402
13665
  }
13403
- __name(_ts_metadata48, "_ts_metadata");
13666
+ __name(_ts_metadata49, "_ts_metadata");
13404
13667
  function _ts_param28(paramIndex, decorator) {
13405
13668
  return function(target, key) {
13406
13669
  decorator(target, key, paramIndex);
@@ -13485,21 +13748,22 @@ var PlatformMfaController = class {
13485
13748
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
13486
13749
  }
13487
13750
  };
13488
- _ts_decorate49([
13751
+ _ts_decorate50([
13489
13752
  common.UseGuards(exports.JwtPlatformGuard),
13490
13753
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
13491
13754
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
13755
+ RequestEncoding("when-body"),
13492
13756
  common.Post("setup"),
13493
13757
  _ts_param28(0, CurrentUser()),
13494
13758
  _ts_param28(1, common.Body()),
13495
- _ts_metadata48("design:type", Function),
13496
- _ts_metadata48("design:paramtypes", [
13759
+ _ts_metadata49("design:type", Function),
13760
+ _ts_metadata49("design:paramtypes", [
13497
13761
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13498
13762
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
13499
13763
  ]),
13500
- _ts_metadata48("design:returntype", Promise)
13764
+ _ts_metadata49("design:returntype", Promise)
13501
13765
  ], PlatformMfaController.prototype, "setup", null);
13502
- _ts_decorate49([
13766
+ _ts_decorate50([
13503
13767
  common.UseGuards(exports.JwtPlatformGuard),
13504
13768
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
13505
13769
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
@@ -13508,15 +13772,15 @@ _ts_decorate49([
13508
13772
  _ts_param28(0, CurrentUser()),
13509
13773
  _ts_param28(1, common.Body()),
13510
13774
  _ts_param28(2, common.Req()),
13511
- _ts_metadata48("design:type", Function),
13512
- _ts_metadata48("design:paramtypes", [
13775
+ _ts_metadata49("design:type", Function),
13776
+ _ts_metadata49("design:paramtypes", [
13513
13777
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13514
13778
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
13515
13779
  typeof Request === "undefined" ? Object : Request
13516
13780
  ]),
13517
- _ts_metadata48("design:returntype", Promise)
13781
+ _ts_metadata49("design:returntype", Promise)
13518
13782
  ], PlatformMfaController.prototype, "verifyEnable", null);
13519
- _ts_decorate49([
13783
+ _ts_decorate50([
13520
13784
  common.UseGuards(exports.JwtPlatformGuard),
13521
13785
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13522
13786
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -13525,15 +13789,15 @@ _ts_decorate49([
13525
13789
  _ts_param28(0, CurrentUser()),
13526
13790
  _ts_param28(1, common.Body()),
13527
13791
  _ts_param28(2, common.Req()),
13528
- _ts_metadata48("design:type", Function),
13529
- _ts_metadata48("design:paramtypes", [
13792
+ _ts_metadata49("design:type", Function),
13793
+ _ts_metadata49("design:paramtypes", [
13530
13794
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13531
13795
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
13532
13796
  typeof Request === "undefined" ? Object : Request
13533
13797
  ]),
13534
- _ts_metadata48("design:returntype", Promise)
13798
+ _ts_metadata49("design:returntype", Promise)
13535
13799
  ], PlatformMfaController.prototype, "disable", null);
13536
- _ts_decorate49([
13800
+ _ts_decorate50([
13537
13801
  common.UseGuards(exports.JwtPlatformGuard),
13538
13802
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13539
13803
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -13542,28 +13806,28 @@ _ts_decorate49([
13542
13806
  _ts_param28(0, CurrentUser()),
13543
13807
  _ts_param28(1, common.Body()),
13544
13808
  _ts_param28(2, common.Req()),
13545
- _ts_metadata48("design:type", Function),
13546
- _ts_metadata48("design:paramtypes", [
13809
+ _ts_metadata49("design:type", Function),
13810
+ _ts_metadata49("design:paramtypes", [
13547
13811
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13548
13812
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
13549
13813
  typeof Request === "undefined" ? Object : Request
13550
13814
  ]),
13551
- _ts_metadata48("design:returntype", Promise)
13815
+ _ts_metadata49("design:returntype", Promise)
13552
13816
  ], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
13553
- PlatformMfaController = _ts_decorate49([
13817
+ PlatformMfaController = _ts_decorate50([
13554
13818
  common.UseInterceptors(NoStoreInterceptor),
13555
13819
  common.Controller("platform/mfa"),
13556
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13820
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13557
13821
  common.UsePipes(createAuthValidationPipe({
13558
13822
  forbidUnknownValues: true
13559
13823
  })),
13560
13824
  _ts_param28(0, common.Inject(exports.MfaService)),
13561
- _ts_metadata48("design:type", Function),
13562
- _ts_metadata48("design:paramtypes", [
13825
+ _ts_metadata49("design:type", Function),
13826
+ _ts_metadata49("design:paramtypes", [
13563
13827
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService
13564
13828
  ])
13565
13829
  ], PlatformMfaController);
13566
- function _ts_decorate50(decorators, target, key, desc) {
13830
+ function _ts_decorate51(decorators, target, key, desc) {
13567
13831
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13568
13832
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13569
13833
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13576,13 +13840,13 @@ function _ts_decorate50(decorators, target, key, desc) {
13576
13840
  }
13577
13841
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13578
13842
  }
13579
- __name(_ts_decorate50, "_ts_decorate");
13580
- function _ts_metadata49(metadataKey, metadataValue) {
13843
+ __name(_ts_decorate51, "_ts_decorate");
13844
+ function _ts_metadata50(metadataKey, metadataValue) {
13581
13845
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13582
13846
  return Reflect.metadata(metadataKey, metadataValue);
13583
13847
  }
13584
13848
  }
13585
- __name(_ts_metadata49, "_ts_metadata");
13849
+ __name(_ts_metadata50, "_ts_metadata");
13586
13850
  function _ts_param29(paramIndex, decorator) {
13587
13851
  return function(target, key) {
13588
13852
  decorator(target, key, paramIndex);
@@ -13688,63 +13952,64 @@ var SessionController = class {
13688
13952
  });
13689
13953
  }
13690
13954
  };
13691
- _ts_decorate50([
13955
+ _ts_decorate51([
13692
13956
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
13693
13957
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
13694
13958
  common.Get(),
13695
13959
  _ts_param29(0, CurrentUser()),
13696
13960
  _ts_param29(1, common.Req()),
13697
- _ts_metadata49("design:type", Function),
13698
- _ts_metadata49("design:paramtypes", [
13961
+ _ts_metadata50("design:type", Function),
13962
+ _ts_metadata50("design:paramtypes", [
13699
13963
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13700
13964
  typeof Request === "undefined" ? Object : Request
13701
13965
  ]),
13702
- _ts_metadata49("design:returntype", Promise)
13966
+ _ts_metadata50("design:returntype", Promise)
13703
13967
  ], SessionController.prototype, "listSessions", null);
13704
- _ts_decorate50([
13968
+ _ts_decorate51([
13705
13969
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13706
13970
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13707
13971
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13972
+ RequestEncoding("unchecked"),
13708
13973
  common.Post("revoke-all"),
13709
13974
  _ts_param29(0, CurrentUser()),
13710
13975
  _ts_param29(1, common.Req()),
13711
- _ts_metadata49("design:type", Function),
13712
- _ts_metadata49("design:paramtypes", [
13976
+ _ts_metadata50("design:type", Function),
13977
+ _ts_metadata50("design:paramtypes", [
13713
13978
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13714
13979
  typeof Request === "undefined" ? Object : Request
13715
13980
  ]),
13716
- _ts_metadata49("design:returntype", Promise)
13981
+ _ts_metadata50("design:returntype", Promise)
13717
13982
  ], SessionController.prototype, "revokeAllSessions", null);
13718
- _ts_decorate50([
13983
+ _ts_decorate51([
13719
13984
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
13720
13985
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
13721
13986
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13722
13987
  common.Delete(":id"),
13723
13988
  _ts_param29(0, CurrentUser()),
13724
13989
  _ts_param29(1, common.Param("id")),
13725
- _ts_metadata49("design:type", Function),
13726
- _ts_metadata49("design:paramtypes", [
13990
+ _ts_metadata50("design:type", Function),
13991
+ _ts_metadata50("design:paramtypes", [
13727
13992
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13728
13993
  String
13729
13994
  ]),
13730
- _ts_metadata49("design:returntype", Promise)
13995
+ _ts_metadata50("design:returntype", Promise)
13731
13996
  ], SessionController.prototype, "revokeSession", null);
13732
- SessionController = _ts_decorate50([
13997
+ SessionController = _ts_decorate51([
13733
13998
  common.UseInterceptors(NoStoreInterceptor),
13734
13999
  common.Controller("sessions"),
13735
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
14000
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
13736
14001
  common.UsePipes(createAuthValidationPipe()),
13737
14002
  _ts_param29(0, common.Inject(exports.SessionService)),
13738
14003
  _ts_param29(1, common.Inject(exports.TokenDeliveryService)),
13739
- _ts_metadata49("design:type", Function),
13740
- _ts_metadata49("design:paramtypes", [
14004
+ _ts_metadata50("design:type", Function),
14005
+ _ts_metadata50("design:paramtypes", [
13741
14006
  typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
13742
14007
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13743
14008
  ])
13744
14009
  ], SessionController);
13745
14010
  var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
13746
14011
  var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => common.SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
13747
- function _ts_decorate51(decorators, target, key, desc) {
14012
+ function _ts_decorate52(decorators, target, key, desc) {
13748
14013
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13749
14014
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13750
14015
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13757,13 +14022,13 @@ function _ts_decorate51(decorators, target, key, desc) {
13757
14022
  }
13758
14023
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13759
14024
  }
13760
- __name(_ts_decorate51, "_ts_decorate");
13761
- function _ts_metadata50(metadataKey, metadataValue) {
14025
+ __name(_ts_decorate52, "_ts_decorate");
14026
+ function _ts_metadata51(metadataKey, metadataValue) {
13762
14027
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13763
14028
  return Reflect.metadata(metadataKey, metadataValue);
13764
14029
  }
13765
14030
  }
13766
- __name(_ts_metadata50, "_ts_metadata");
14031
+ __name(_ts_metadata51, "_ts_metadata");
13767
14032
  function _ts_param30(paramIndex, decorator) {
13768
14033
  return function(target, key) {
13769
14034
  decorator(target, key, paramIndex);
@@ -13830,12 +14095,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
13830
14095
  await this.flush();
13831
14096
  }
13832
14097
  };
13833
- ApiKeyLastUsedService = _ts_decorate51([
14098
+ ApiKeyLastUsedService = _ts_decorate52([
13834
14099
  common.Injectable(),
13835
14100
  _ts_param30(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
13836
14101
  _ts_param30(1, common.Inject(BYMAX_AUTH_OPTIONS)),
13837
- _ts_metadata50("design:type", Function),
13838
- _ts_metadata50("design:paramtypes", [
14102
+ _ts_metadata51("design:type", Function),
14103
+ _ts_metadata51("design:paramtypes", [
13839
14104
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
13840
14105
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
13841
14106
  ])
@@ -13884,7 +14149,7 @@ function digestsMatch(computed, stored) {
13884
14149
  __name(digestsMatch, "digestsMatch");
13885
14150
 
13886
14151
  // src/server/services/api-key-verifier.service.ts
13887
- function _ts_decorate52(decorators, target, key, desc) {
14152
+ function _ts_decorate53(decorators, target, key, desc) {
13888
14153
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13889
14154
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13890
14155
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13897,13 +14162,13 @@ function _ts_decorate52(decorators, target, key, desc) {
13897
14162
  }
13898
14163
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13899
14164
  }
13900
- __name(_ts_decorate52, "_ts_decorate");
13901
- function _ts_metadata51(metadataKey, metadataValue) {
14165
+ __name(_ts_decorate53, "_ts_decorate");
14166
+ function _ts_metadata52(metadataKey, metadataValue) {
13902
14167
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13903
14168
  return Reflect.metadata(metadataKey, metadataValue);
13904
14169
  }
13905
14170
  }
13906
- __name(_ts_metadata51, "_ts_metadata");
14171
+ __name(_ts_metadata52, "_ts_metadata");
13907
14172
  function _ts_param31(paramIndex, decorator) {
13908
14173
  return function(target, key) {
13909
14174
  decorator(target, key, paramIndex);
@@ -13969,14 +14234,14 @@ var ApiKeyVerifierService = class {
13969
14234
  return null;
13970
14235
  }
13971
14236
  };
13972
- ApiKeyVerifierService = _ts_decorate52([
14237
+ ApiKeyVerifierService = _ts_decorate53([
13973
14238
  common.Injectable(),
13974
14239
  _ts_param31(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
13975
14240
  _ts_param31(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
13976
14241
  _ts_param31(2, common.Inject(BYMAX_AUTH_OPTIONS)),
13977
14242
  _ts_param31(3, common.Inject(ApiKeyLastUsedService)),
13978
- _ts_metadata51("design:type", Function),
13979
- _ts_metadata51("design:paramtypes", [
14243
+ _ts_metadata52("design:type", Function),
14244
+ _ts_metadata52("design:paramtypes", [
13980
14245
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
13981
14246
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
13982
14247
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -13985,7 +14250,7 @@ ApiKeyVerifierService = _ts_decorate52([
13985
14250
  ], ApiKeyVerifierService);
13986
14251
 
13987
14252
  // src/server/guards/api-key.guard.ts
13988
- function _ts_decorate53(decorators, target, key, desc) {
14253
+ function _ts_decorate54(decorators, target, key, desc) {
13989
14254
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13990
14255
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13991
14256
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13998,13 +14263,13 @@ function _ts_decorate53(decorators, target, key, desc) {
13998
14263
  }
13999
14264
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14000
14265
  }
14001
- __name(_ts_decorate53, "_ts_decorate");
14002
- function _ts_metadata52(metadataKey, metadataValue) {
14266
+ __name(_ts_decorate54, "_ts_decorate");
14267
+ function _ts_metadata53(metadataKey, metadataValue) {
14003
14268
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14004
14269
  return Reflect.metadata(metadataKey, metadataValue);
14005
14270
  }
14006
14271
  }
14007
- __name(_ts_metadata52, "_ts_metadata");
14272
+ __name(_ts_metadata53, "_ts_metadata");
14008
14273
  function _ts_param32(paramIndex, decorator) {
14009
14274
  return function(target, key) {
14010
14275
  decorator(target, key, paramIndex);
@@ -14150,15 +14415,15 @@ exports.ApiKeyGuard = class _ApiKeyGuard {
14150
14415
  };
14151
14416
  }
14152
14417
  };
14153
- exports.ApiKeyGuard = _ts_decorate53([
14418
+ exports.ApiKeyGuard = _ts_decorate54([
14154
14419
  common.Injectable(),
14155
14420
  _ts_param32(0, common.Inject(core.Reflector)),
14156
14421
  _ts_param32(1, common.Inject(ApiKeyVerifierService)),
14157
14422
  _ts_param32(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14158
14423
  _ts_param32(3, common.Inject(BYMAX_AUTH_HOOKS)),
14159
14424
  _ts_param32(3, common.Optional()),
14160
- _ts_metadata52("design:type", Function),
14161
- _ts_metadata52("design:paramtypes", [
14425
+ _ts_metadata53("design:type", Function),
14426
+ _ts_metadata53("design:paramtypes", [
14162
14427
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14163
14428
  typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
14164
14429
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14170,7 +14435,7 @@ function routePattern(request) {
14170
14435
  return typeof path === "string" ? path : "";
14171
14436
  }
14172
14437
  __name(routePattern, "routePattern");
14173
- function _ts_decorate54(decorators, target, key, desc) {
14438
+ function _ts_decorate55(decorators, target, key, desc) {
14174
14439
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14175
14440
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14176
14441
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14183,13 +14448,13 @@ function _ts_decorate54(decorators, target, key, desc) {
14183
14448
  }
14184
14449
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14185
14450
  }
14186
- __name(_ts_decorate54, "_ts_decorate");
14187
- function _ts_metadata53(metadataKey, metadataValue) {
14451
+ __name(_ts_decorate55, "_ts_decorate");
14452
+ function _ts_metadata54(metadataKey, metadataValue) {
14188
14453
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14189
14454
  return Reflect.metadata(metadataKey, metadataValue);
14190
14455
  }
14191
14456
  }
14192
- __name(_ts_metadata53, "_ts_metadata");
14457
+ __name(_ts_metadata54, "_ts_metadata");
14193
14458
  function _ts_param33(paramIndex, decorator) {
14194
14459
  return function(target, key) {
14195
14460
  decorator(target, key, paramIndex);
@@ -14222,11 +14487,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
14222
14487
  return true;
14223
14488
  }
14224
14489
  };
14225
- exports.MfaRequiredGuard = _ts_decorate54([
14490
+ exports.MfaRequiredGuard = _ts_decorate55([
14226
14491
  common.Injectable(),
14227
14492
  _ts_param33(0, common.Inject(core.Reflector)),
14228
- _ts_metadata53("design:type", Function),
14229
- _ts_metadata53("design:paramtypes", [
14493
+ _ts_metadata54("design:type", Function),
14494
+ _ts_metadata54("design:paramtypes", [
14230
14495
  typeof core.Reflector === "undefined" ? Object : core.Reflector
14231
14496
  ])
14232
14497
  ], exports.MfaRequiredGuard);
@@ -14234,7 +14499,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
14234
14499
  var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
14235
14500
 
14236
14501
  // src/server/guards/platform-roles.guard.ts
14237
- function _ts_decorate55(decorators, target, key, desc) {
14502
+ function _ts_decorate56(decorators, target, key, desc) {
14238
14503
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14239
14504
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14240
14505
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14247,13 +14512,13 @@ function _ts_decorate55(decorators, target, key, desc) {
14247
14512
  }
14248
14513
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14249
14514
  }
14250
- __name(_ts_decorate55, "_ts_decorate");
14251
- function _ts_metadata54(metadataKey, metadataValue) {
14515
+ __name(_ts_decorate56, "_ts_decorate");
14516
+ function _ts_metadata55(metadataKey, metadataValue) {
14252
14517
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14253
14518
  return Reflect.metadata(metadataKey, metadataValue);
14254
14519
  }
14255
14520
  }
14256
- __name(_ts_metadata54, "_ts_metadata");
14521
+ __name(_ts_metadata55, "_ts_metadata");
14257
14522
  function _ts_param34(paramIndex, decorator) {
14258
14523
  return function(target, key) {
14259
14524
  decorator(target, key, paramIndex);
@@ -14293,12 +14558,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
14293
14558
  return true;
14294
14559
  }
14295
14560
  };
14296
- exports.PlatformRolesGuard = _ts_decorate55([
14561
+ exports.PlatformRolesGuard = _ts_decorate56([
14297
14562
  common.Injectable(),
14298
14563
  _ts_param34(0, common.Inject(core.Reflector)),
14299
14564
  _ts_param34(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14300
- _ts_metadata54("design:type", Function),
14301
- _ts_metadata54("design:paramtypes", [
14565
+ _ts_metadata55("design:type", Function),
14566
+ _ts_metadata55("design:paramtypes", [
14302
14567
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14303
14568
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14304
14569
  ])
@@ -14307,7 +14572,7 @@ var ROLES_KEY = "roles";
14307
14572
  var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
14308
14573
 
14309
14574
  // src/server/guards/roles.guard.ts
14310
- function _ts_decorate56(decorators, target, key, desc) {
14575
+ function _ts_decorate57(decorators, target, key, desc) {
14311
14576
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14312
14577
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14313
14578
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14320,13 +14585,13 @@ function _ts_decorate56(decorators, target, key, desc) {
14320
14585
  }
14321
14586
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14322
14587
  }
14323
- __name(_ts_decorate56, "_ts_decorate");
14324
- function _ts_metadata55(metadataKey, metadataValue) {
14588
+ __name(_ts_decorate57, "_ts_decorate");
14589
+ function _ts_metadata56(metadataKey, metadataValue) {
14325
14590
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14326
14591
  return Reflect.metadata(metadataKey, metadataValue);
14327
14592
  }
14328
14593
  }
14329
- __name(_ts_metadata55, "_ts_metadata");
14594
+ __name(_ts_metadata56, "_ts_metadata");
14330
14595
  function _ts_param35(paramIndex, decorator) {
14331
14596
  return function(target, key) {
14332
14597
  decorator(target, key, paramIndex);
@@ -14362,17 +14627,17 @@ exports.RolesGuard = class RolesGuard {
14362
14627
  return true;
14363
14628
  }
14364
14629
  };
14365
- exports.RolesGuard = _ts_decorate56([
14630
+ exports.RolesGuard = _ts_decorate57([
14366
14631
  common.Injectable(),
14367
14632
  _ts_param35(0, common.Inject(core.Reflector)),
14368
14633
  _ts_param35(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14369
- _ts_metadata55("design:type", Function),
14370
- _ts_metadata55("design:paramtypes", [
14634
+ _ts_metadata56("design:type", Function),
14635
+ _ts_metadata56("design:paramtypes", [
14371
14636
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14372
14637
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14373
14638
  ])
14374
14639
  ], exports.RolesGuard);
14375
- function _ts_decorate57(decorators, target, key, desc) {
14640
+ function _ts_decorate58(decorators, target, key, desc) {
14376
14641
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14377
14642
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14378
14643
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14385,7 +14650,7 @@ function _ts_decorate57(decorators, target, key, desc) {
14385
14650
  }
14386
14651
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14387
14652
  }
14388
- __name(_ts_decorate57, "_ts_decorate");
14653
+ __name(_ts_decorate58, "_ts_decorate");
14389
14654
  exports.NoOpAuthHooks = class NoOpAuthHooks {
14390
14655
  static {
14391
14656
  __name(this, "NoOpAuthHooks");
@@ -14434,7 +14699,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
14434
14699
  };
14435
14700
  }
14436
14701
  };
14437
- exports.NoOpAuthHooks = _ts_decorate57([
14702
+ exports.NoOpAuthHooks = _ts_decorate58([
14438
14703
  common.Injectable()
14439
14704
  ], exports.NoOpAuthHooks);
14440
14705
 
@@ -14447,7 +14712,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
14447
14712
  var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
14448
14713
 
14449
14714
  // src/server/oauth/oauth.service.ts
14450
- function _ts_decorate58(decorators, target, key, desc) {
14715
+ function _ts_decorate59(decorators, target, key, desc) {
14451
14716
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14452
14717
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14453
14718
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14460,13 +14725,13 @@ function _ts_decorate58(decorators, target, key, desc) {
14460
14725
  }
14461
14726
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14462
14727
  }
14463
- __name(_ts_decorate58, "_ts_decorate");
14464
- function _ts_metadata56(metadataKey, metadataValue) {
14728
+ __name(_ts_decorate59, "_ts_decorate");
14729
+ function _ts_metadata57(metadataKey, metadataValue) {
14465
14730
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14466
14731
  return Reflect.metadata(metadataKey, metadataValue);
14467
14732
  }
14468
14733
  }
14469
- __name(_ts_metadata56, "_ts_metadata");
14734
+ __name(_ts_metadata57, "_ts_metadata");
14470
14735
  function _ts_param36(paramIndex, decorator) {
14471
14736
  return function(target, key) {
14472
14737
  decorator(target, key, paramIndex);
@@ -14766,7 +15031,7 @@ exports.OAuthService = class _OAuthService {
14766
15031
  return plugin;
14767
15032
  }
14768
15033
  };
14769
- exports.OAuthService = _ts_decorate58([
15034
+ exports.OAuthService = _ts_decorate59([
14770
15035
  common.Injectable(),
14771
15036
  _ts_param36(0, common.Inject(OAUTH_PLUGINS)),
14772
15037
  _ts_param36(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -14776,8 +15041,8 @@ exports.OAuthService = _ts_decorate58([
14776
15041
  _ts_param36(4, common.Inject(TokenManagerService)),
14777
15042
  _ts_param36(5, common.Inject(exports.SessionService)),
14778
15043
  _ts_param36(6, common.Inject(BYMAX_AUTH_OPTIONS)),
14779
- _ts_metadata56("design:type", Function),
14780
- _ts_metadata56("design:paramtypes", [
15044
+ _ts_metadata57("design:type", Function),
15045
+ _ts_metadata57("design:paramtypes", [
14781
15046
  Array,
14782
15047
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
14783
15048
  Object,
@@ -14787,7 +15052,7 @@ exports.OAuthService = _ts_decorate58([
14787
15052
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14788
15053
  ])
14789
15054
  ], exports.OAuthService);
14790
- function _ts_decorate59(decorators, target, key, desc) {
15055
+ function _ts_decorate60(decorators, target, key, desc) {
14791
15056
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14792
15057
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14793
15058
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14800,13 +15065,13 @@ function _ts_decorate59(decorators, target, key, desc) {
14800
15065
  }
14801
15066
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14802
15067
  }
14803
- __name(_ts_decorate59, "_ts_decorate");
14804
- function _ts_metadata57(metadataKey, metadataValue) {
15068
+ __name(_ts_decorate60, "_ts_decorate");
15069
+ function _ts_metadata58(metadataKey, metadataValue) {
14805
15070
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14806
15071
  return Reflect.metadata(metadataKey, metadataValue);
14807
15072
  }
14808
15073
  }
14809
- __name(_ts_metadata57, "_ts_metadata");
15074
+ __name(_ts_metadata58, "_ts_metadata");
14810
15075
  var OAuthCallbackQueryDto = class {
14811
15076
  static {
14812
15077
  __name(this, "OAuthCallbackQueryDto");
@@ -14905,69 +15170,69 @@ var OAuthCallbackQueryDto = class {
14905
15170
  */
14906
15171
  hd;
14907
15172
  };
14908
- _ts_decorate59([
15173
+ _ts_decorate60([
14909
15174
  classValidator.ValidateIf((query) => query.error === void 0 || query.error === null),
14910
15175
  classValidator.IsOptional(),
14911
15176
  classValidator.IsString(),
14912
15177
  classValidator.IsNotEmpty(),
14913
15178
  classValidator.MaxLength(2048),
14914
- _ts_metadata57("design:type", String)
15179
+ _ts_metadata58("design:type", String)
14915
15180
  ], OAuthCallbackQueryDto.prototype, "code", void 0);
14916
- _ts_decorate59([
15181
+ _ts_decorate60([
14917
15182
  classValidator.IsOptional(),
14918
15183
  classValidator.IsString(),
14919
15184
  classValidator.MaxLength(128),
14920
- _ts_metadata57("design:type", String)
15185
+ _ts_metadata58("design:type", String)
14921
15186
  ], OAuthCallbackQueryDto.prototype, "error", void 0);
14922
- _ts_decorate59([
15187
+ _ts_decorate60([
14923
15188
  classValidator.IsOptional(),
14924
15189
  classValidator.IsString(),
14925
15190
  classValidator.MaxLength(512),
14926
- _ts_metadata57("design:type", String)
15191
+ _ts_metadata58("design:type", String)
14927
15192
  ], OAuthCallbackQueryDto.prototype, "error_description", void 0);
14928
- _ts_decorate59([
15193
+ _ts_decorate60([
14929
15194
  classValidator.IsOptional(),
14930
15195
  classValidator.IsString(),
14931
15196
  classValidator.MaxLength(512),
14932
- _ts_metadata57("design:type", String)
15197
+ _ts_metadata58("design:type", String)
14933
15198
  ], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
14934
- _ts_decorate59([
15199
+ _ts_decorate60([
14935
15200
  classValidator.IsString(),
14936
15201
  classValidator.IsNotEmpty(),
14937
15202
  classValidator.MaxLength(128),
14938
- _ts_metadata57("design:type", String)
15203
+ _ts_metadata58("design:type", String)
14939
15204
  ], OAuthCallbackQueryDto.prototype, "state", void 0);
14940
- _ts_decorate59([
15205
+ _ts_decorate60([
14941
15206
  classValidator.IsOptional(),
14942
15207
  classValidator.IsString(),
14943
15208
  classValidator.MaxLength(512),
14944
- _ts_metadata57("design:type", String)
15209
+ _ts_metadata58("design:type", String)
14945
15210
  ], OAuthCallbackQueryDto.prototype, "iss", void 0);
14946
- _ts_decorate59([
15211
+ _ts_decorate60([
14947
15212
  classValidator.IsOptional(),
14948
15213
  classValidator.IsString(),
14949
15214
  classValidator.MaxLength(2048),
14950
- _ts_metadata57("design:type", String)
15215
+ _ts_metadata58("design:type", String)
14951
15216
  ], OAuthCallbackQueryDto.prototype, "scope", void 0);
14952
- _ts_decorate59([
15217
+ _ts_decorate60([
14953
15218
  classValidator.IsOptional(),
14954
15219
  classValidator.IsString(),
14955
15220
  classValidator.MaxLength(16),
14956
- _ts_metadata57("design:type", String)
15221
+ _ts_metadata58("design:type", String)
14957
15222
  ], OAuthCallbackQueryDto.prototype, "authuser", void 0);
14958
- _ts_decorate59([
15223
+ _ts_decorate60([
14959
15224
  classValidator.IsOptional(),
14960
15225
  classValidator.IsString(),
14961
15226
  classValidator.MaxLength(64),
14962
- _ts_metadata57("design:type", String)
15227
+ _ts_metadata58("design:type", String)
14963
15228
  ], OAuthCallbackQueryDto.prototype, "prompt", void 0);
14964
- _ts_decorate59([
15229
+ _ts_decorate60([
14965
15230
  classValidator.IsOptional(),
14966
15231
  classValidator.IsString(),
14967
15232
  classValidator.MaxLength(253),
14968
- _ts_metadata57("design:type", String)
15233
+ _ts_metadata58("design:type", String)
14969
15234
  ], OAuthCallbackQueryDto.prototype, "hd", void 0);
14970
- function _ts_decorate60(decorators, target, key, desc) {
15235
+ function _ts_decorate61(decorators, target, key, desc) {
14971
15236
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14972
15237
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14973
15238
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14980,13 +15245,13 @@ function _ts_decorate60(decorators, target, key, desc) {
14980
15245
  }
14981
15246
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14982
15247
  }
14983
- __name(_ts_decorate60, "_ts_decorate");
14984
- function _ts_metadata58(metadataKey, metadataValue) {
15248
+ __name(_ts_decorate61, "_ts_decorate");
15249
+ function _ts_metadata59(metadataKey, metadataValue) {
14985
15250
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14986
15251
  return Reflect.metadata(metadataKey, metadataValue);
14987
15252
  }
14988
15253
  }
14989
- __name(_ts_metadata58, "_ts_metadata");
15254
+ __name(_ts_metadata59, "_ts_metadata");
14990
15255
  var OAuthInitiateQueryDto = class {
14991
15256
  static {
14992
15257
  __name(this, "OAuthInitiateQueryDto");
@@ -15003,7 +15268,7 @@ var OAuthInitiateQueryDto = class {
15003
15268
  */
15004
15269
  tenantId;
15005
15270
  };
15006
- _ts_decorate60([
15271
+ _ts_decorate61([
15007
15272
  classValidator.IsOptional(),
15008
15273
  classValidator.IsString(),
15009
15274
  classValidator.IsNotEmpty(),
@@ -15011,11 +15276,11 @@ _ts_decorate60([
15011
15276
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
15012
15277
  message: "tenantId must not contain control characters"
15013
15278
  }),
15014
- _ts_metadata58("design:type", String)
15279
+ _ts_metadata59("design:type", String)
15015
15280
  ], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
15016
15281
 
15017
15282
  // src/server/oauth/oauth.controller.ts
15018
- function _ts_decorate61(decorators, target, key, desc) {
15283
+ function _ts_decorate62(decorators, target, key, desc) {
15019
15284
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15020
15285
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15021
15286
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15028,13 +15293,13 @@ function _ts_decorate61(decorators, target, key, desc) {
15028
15293
  }
15029
15294
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15030
15295
  }
15031
- __name(_ts_decorate61, "_ts_decorate");
15032
- function _ts_metadata59(metadataKey, metadataValue) {
15296
+ __name(_ts_decorate62, "_ts_decorate");
15297
+ function _ts_metadata60(metadataKey, metadataValue) {
15033
15298
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15034
15299
  return Reflect.metadata(metadataKey, metadataValue);
15035
15300
  }
15036
15301
  }
15037
- __name(_ts_metadata59, "_ts_metadata");
15302
+ __name(_ts_metadata60, "_ts_metadata");
15038
15303
  function _ts_param37(paramIndex, decorator) {
15039
15304
  return function(target, key) {
15040
15305
  decorator(target, key, paramIndex);
@@ -15258,7 +15523,7 @@ var OAuthController = class _OAuthController {
15258
15523
  });
15259
15524
  }
15260
15525
  };
15261
- _ts_decorate61([
15526
+ _ts_decorate62([
15262
15527
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15263
15528
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15264
15529
  common.Get(":provider"),
@@ -15268,16 +15533,16 @@ _ts_decorate61([
15268
15533
  _ts_param37(3, common.Res({
15269
15534
  passthrough: true
15270
15535
  })),
15271
- _ts_metadata59("design:type", Function),
15272
- _ts_metadata59("design:paramtypes", [
15536
+ _ts_metadata60("design:type", Function),
15537
+ _ts_metadata60("design:paramtypes", [
15273
15538
  String,
15274
15539
  typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
15275
15540
  typeof Request === "undefined" ? Object : Request,
15276
15541
  typeof Response === "undefined" ? Object : Response
15277
15542
  ]),
15278
- _ts_metadata59("design:returntype", Promise)
15543
+ _ts_metadata60("design:returntype", Promise)
15279
15544
  ], OAuthController.prototype, "initiate", null);
15280
- _ts_decorate61([
15545
+ _ts_decorate62([
15281
15546
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
15282
15547
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
15283
15548
  common.HttpCode(common.HttpStatus.OK),
@@ -15288,29 +15553,29 @@ _ts_decorate61([
15288
15553
  _ts_param37(3, common.Res({
15289
15554
  passthrough: true
15290
15555
  })),
15291
- _ts_metadata59("design:type", Function),
15292
- _ts_metadata59("design:paramtypes", [
15556
+ _ts_metadata60("design:type", Function),
15557
+ _ts_metadata60("design:paramtypes", [
15293
15558
  String,
15294
15559
  typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
15295
15560
  typeof Request === "undefined" ? Object : Request,
15296
15561
  typeof Response === "undefined" ? Object : Response
15297
15562
  ]),
15298
- _ts_metadata59("design:returntype", Promise)
15563
+ _ts_metadata60("design:returntype", Promise)
15299
15564
  ], OAuthController.prototype, "callback", null);
15300
- OAuthController = _ts_decorate61([
15565
+ OAuthController = _ts_decorate62([
15301
15566
  Public(),
15302
15567
  SkipMfa(),
15303
15568
  common.UseInterceptors(NoStoreInterceptor),
15304
15569
  common.Controller("oauth"),
15305
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
15570
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
15306
15571
  common.UsePipes(createAuthValidationPipe({
15307
15572
  forbidUnknownValues: true
15308
15573
  })),
15309
15574
  _ts_param37(0, common.Inject(exports.OAuthService)),
15310
15575
  _ts_param37(1, common.Inject(exports.TokenDeliveryService)),
15311
15576
  _ts_param37(2, common.Inject(BYMAX_AUTH_OPTIONS)),
15312
- _ts_metadata59("design:type", Function),
15313
- _ts_metadata59("design:paramtypes", [
15577
+ _ts_metadata60("design:type", Function),
15578
+ _ts_metadata60("design:paramtypes", [
15314
15579
  typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
15315
15580
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
15316
15581
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -15449,7 +15714,7 @@ var GoogleOAuthPlugin = class {
15449
15714
  };
15450
15715
 
15451
15716
  // src/server/oauth/oauth.module.ts
15452
- function _ts_decorate62(decorators, target, key, desc) {
15717
+ function _ts_decorate63(decorators, target, key, desc) {
15453
15718
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15454
15719
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15455
15720
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15462,7 +15727,7 @@ function _ts_decorate62(decorators, target, key, desc) {
15462
15727
  }
15463
15728
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15464
15729
  }
15465
- __name(_ts_decorate62, "_ts_decorate");
15730
+ __name(_ts_decorate63, "_ts_decorate");
15466
15731
  function buildOAuthPlugins(options) {
15467
15732
  const plugins = [];
15468
15733
  if (options.oauth?.google) {
@@ -15532,7 +15797,7 @@ var OAuthModule = class _OAuthModule {
15532
15797
  };
15533
15798
  }
15534
15799
  };
15535
- OAuthModule = _ts_decorate62([
15800
+ OAuthModule = _ts_decorate63([
15536
15801
  common.Module({})
15537
15802
  ], OAuthModule);
15538
15803
 
@@ -16427,7 +16692,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
16427
16692
  __name(schemesFor, "schemesFor");
16428
16693
 
16429
16694
  // src/server/openapi/auth-openapi.contributor.ts
16430
- function _ts_decorate63(decorators, target, key, desc) {
16695
+ function _ts_decorate64(decorators, target, key, desc) {
16431
16696
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16432
16697
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16433
16698
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16440,13 +16705,13 @@ function _ts_decorate63(decorators, target, key, desc) {
16440
16705
  }
16441
16706
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16442
16707
  }
16443
- __name(_ts_decorate63, "_ts_decorate");
16444
- function _ts_metadata60(metadataKey, metadataValue) {
16708
+ __name(_ts_decorate64, "_ts_decorate");
16709
+ function _ts_metadata61(metadataKey, metadataValue) {
16445
16710
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16446
16711
  return Reflect.metadata(metadataKey, metadataValue);
16447
16712
  }
16448
16713
  }
16449
- __name(_ts_metadata60, "_ts_metadata");
16714
+ __name(_ts_metadata61, "_ts_metadata");
16450
16715
  function _ts_param38(paramIndex, decorator) {
16451
16716
  return function(target, key) {
16452
16717
  decorator(target, key, paramIndex);
@@ -16472,18 +16737,18 @@ var AuthOpenApiContributor = class {
16472
16737
  return buildAuthOpenApiFragment(this.options, this.registered);
16473
16738
  }
16474
16739
  };
16475
- AuthOpenApiContributor = _ts_decorate63([
16740
+ AuthOpenApiContributor = _ts_decorate64([
16476
16741
  common.Injectable(),
16477
16742
  common.SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
16478
16743
  _ts_param38(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16479
16744
  _ts_param38(1, common.Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
16480
- _ts_metadata60("design:type", Function),
16481
- _ts_metadata60("design:paramtypes", [
16745
+ _ts_metadata61("design:type", Function),
16746
+ _ts_metadata61("design:paramtypes", [
16482
16747
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
16483
16748
  typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
16484
16749
  ])
16485
16750
  ], AuthOpenApiContributor);
16486
- function _ts_decorate64(decorators, target, key, desc) {
16751
+ function _ts_decorate65(decorators, target, key, desc) {
16487
16752
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16488
16753
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16489
16754
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16496,13 +16761,13 @@ function _ts_decorate64(decorators, target, key, desc) {
16496
16761
  }
16497
16762
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16498
16763
  }
16499
- __name(_ts_decorate64, "_ts_decorate");
16500
- function _ts_metadata61(metadataKey, metadataValue) {
16764
+ __name(_ts_decorate65, "_ts_decorate");
16765
+ function _ts_metadata62(metadataKey, metadataValue) {
16501
16766
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16502
16767
  return Reflect.metadata(metadataKey, metadataValue);
16503
16768
  }
16504
16769
  }
16505
- __name(_ts_metadata61, "_ts_metadata");
16770
+ __name(_ts_metadata62, "_ts_metadata");
16506
16771
  function _ts_param39(paramIndex, decorator) {
16507
16772
  return function(target, key) {
16508
16773
  decorator(target, key, paramIndex);
@@ -16814,16 +17079,16 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
16814
17079
  return false;
16815
17080
  }
16816
17081
  };
16817
- exports.CommonPasswordChecker = _ts_decorate64([
17082
+ exports.CommonPasswordChecker = _ts_decorate65([
16818
17083
  common.Injectable(),
16819
17084
  _ts_param39(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16820
17085
  _ts_param39(0, common.Optional()),
16821
- _ts_metadata61("design:type", Function),
16822
- _ts_metadata61("design:paramtypes", [
17086
+ _ts_metadata62("design:type", Function),
17087
+ _ts_metadata62("design:paramtypes", [
16823
17088
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
16824
17089
  ])
16825
17090
  ], exports.CommonPasswordChecker);
16826
- function _ts_decorate65(decorators, target, key, desc) {
17091
+ function _ts_decorate66(decorators, target, key, desc) {
16827
17092
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16828
17093
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16829
17094
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16836,7 +17101,7 @@ function _ts_decorate65(decorators, target, key, desc) {
16836
17101
  }
16837
17102
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16838
17103
  }
16839
- __name(_ts_decorate65, "_ts_decorate");
17104
+ __name(_ts_decorate66, "_ts_decorate");
16840
17105
  exports.NoOpEmailProvider = class _NoOpEmailProvider {
16841
17106
  static {
16842
17107
  __name(this, "NoOpEmailProvider");
@@ -16871,7 +17136,7 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
16871
17136
  this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
16872
17137
  }
16873
17138
  };
16874
- exports.NoOpEmailProvider = _ts_decorate65([
17139
+ exports.NoOpEmailProvider = _ts_decorate66([
16875
17140
  common.Injectable()
16876
17141
  ], exports.NoOpEmailProvider);
16877
17142
 
@@ -16885,7 +17150,7 @@ var SystemApiKeyClock = class {
16885
17150
  return /* @__PURE__ */ new Date();
16886
17151
  }
16887
17152
  };
16888
- function _ts_decorate66(decorators, target, key, desc) {
17153
+ function _ts_decorate67(decorators, target, key, desc) {
16889
17154
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16890
17155
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16891
17156
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16898,13 +17163,13 @@ function _ts_decorate66(decorators, target, key, desc) {
16898
17163
  }
16899
17164
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16900
17165
  }
16901
- __name(_ts_decorate66, "_ts_decorate");
16902
- function _ts_metadata62(metadataKey, metadataValue) {
17166
+ __name(_ts_decorate67, "_ts_decorate");
17167
+ function _ts_metadata63(metadataKey, metadataValue) {
16903
17168
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16904
17169
  return Reflect.metadata(metadataKey, metadataValue);
16905
17170
  }
16906
17171
  }
16907
- __name(_ts_metadata62, "_ts_metadata");
17172
+ __name(_ts_metadata63, "_ts_metadata");
16908
17173
  function _ts_param40(paramIndex, decorator) {
16909
17174
  return function(target, key) {
16910
17175
  decorator(target, key, paramIndex);
@@ -16953,21 +17218,21 @@ var ApiKeyScopeAuditService = class {
16953
17218
  }
16954
17219
  }
16955
17220
  };
16956
- ApiKeyScopeAuditService = _ts_decorate66([
17221
+ ApiKeyScopeAuditService = _ts_decorate67([
16957
17222
  common.Injectable(),
16958
17223
  _ts_param40(0, common.Inject(core.DiscoveryService)),
16959
17224
  _ts_param40(1, common.Inject(core.MetadataScanner)),
16960
17225
  _ts_param40(2, common.Inject(core.Reflector)),
16961
17226
  _ts_param40(3, common.Inject(BYMAX_AUTH_OPTIONS)),
16962
- _ts_metadata62("design:type", Function),
16963
- _ts_metadata62("design:paramtypes", [
17227
+ _ts_metadata63("design:type", Function),
17228
+ _ts_metadata63("design:paramtypes", [
16964
17229
  typeof core.DiscoveryService === "undefined" ? Object : core.DiscoveryService,
16965
17230
  typeof core.MetadataScanner === "undefined" ? Object : core.MetadataScanner,
16966
17231
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
16967
17232
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
16968
17233
  ])
16969
17234
  ], ApiKeyScopeAuditService);
16970
- function _ts_decorate67(decorators, target, key, desc) {
17235
+ function _ts_decorate68(decorators, target, key, desc) {
16971
17236
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16972
17237
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16973
17238
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16980,13 +17245,13 @@ function _ts_decorate67(decorators, target, key, desc) {
16980
17245
  }
16981
17246
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16982
17247
  }
16983
- __name(_ts_decorate67, "_ts_decorate");
16984
- function _ts_metadata63(metadataKey, metadataValue) {
17248
+ __name(_ts_decorate68, "_ts_decorate");
17249
+ function _ts_metadata64(metadataKey, metadataValue) {
16985
17250
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16986
17251
  return Reflect.metadata(metadataKey, metadataValue);
16987
17252
  }
16988
17253
  }
16989
- __name(_ts_metadata63, "_ts_metadata");
17254
+ __name(_ts_metadata64, "_ts_metadata");
16990
17255
  function _ts_param41(paramIndex, decorator) {
16991
17256
  return function(target, key) {
16992
17257
  decorator(target, key, paramIndex);
@@ -17121,13 +17386,13 @@ exports.ApiKeyService = class ApiKeyService {
17121
17386
  return value;
17122
17387
  }
17123
17388
  };
17124
- exports.ApiKeyService = _ts_decorate67([
17389
+ exports.ApiKeyService = _ts_decorate68([
17125
17390
  common.Injectable(),
17126
17391
  _ts_param41(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
17127
17392
  _ts_param41(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
17128
17393
  _ts_param41(2, common.Inject(BYMAX_AUTH_OPTIONS)),
17129
- _ts_metadata63("design:type", Function),
17130
- _ts_metadata63("design:paramtypes", [
17394
+ _ts_metadata64("design:type", Function),
17395
+ _ts_metadata64("design:paramtypes", [
17131
17396
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
17132
17397
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
17133
17398
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -17209,7 +17474,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
17209
17474
  __name(assertTenantBinding, "assertTenantBinding");
17210
17475
 
17211
17476
  // src/server/services/auth-token-verifier.service.ts
17212
- function _ts_decorate68(decorators, target, key, desc) {
17477
+ function _ts_decorate69(decorators, target, key, desc) {
17213
17478
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17214
17479
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17215
17480
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17222,13 +17487,13 @@ function _ts_decorate68(decorators, target, key, desc) {
17222
17487
  }
17223
17488
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17224
17489
  }
17225
- __name(_ts_decorate68, "_ts_decorate");
17226
- function _ts_metadata64(metadataKey, metadataValue) {
17490
+ __name(_ts_decorate69, "_ts_decorate");
17491
+ function _ts_metadata65(metadataKey, metadataValue) {
17227
17492
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17228
17493
  return Reflect.metadata(metadataKey, metadataValue);
17229
17494
  }
17230
17495
  }
17231
- __name(_ts_metadata64, "_ts_metadata");
17496
+ __name(_ts_metadata65, "_ts_metadata");
17232
17497
  function _ts_param42(paramIndex, decorator) {
17233
17498
  return function(target, key) {
17234
17499
  decorator(target, key, paramIndex);
@@ -17418,14 +17683,14 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
17418
17683
  }
17419
17684
  }
17420
17685
  };
17421
- exports.AuthTokenVerifierService = _ts_decorate68([
17686
+ exports.AuthTokenVerifierService = _ts_decorate69([
17422
17687
  common.Injectable(),
17423
17688
  _ts_param42(0, common.Inject(jwt.JwtService)),
17424
17689
  _ts_param42(1, common.Inject(BYMAX_AUTH_OPTIONS)),
17425
17690
  _ts_param42(2, common.Inject(exports.AuthRevocationService)),
17426
17691
  _ts_param42(3, common.Inject(exports.AccountStatusService)),
17427
- _ts_metadata64("design:type", Function),
17428
- _ts_metadata64("design:paramtypes", [
17692
+ _ts_metadata65("design:type", Function),
17693
+ _ts_metadata65("design:paramtypes", [
17429
17694
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
17430
17695
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
17431
17696
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -17434,7 +17699,7 @@ exports.AuthTokenVerifierService = _ts_decorate68([
17434
17699
  ], exports.AuthTokenVerifierService);
17435
17700
 
17436
17701
  // src/server/bymax-auth.module.ts
17437
- function _ts_decorate69(decorators, target, key, desc) {
17702
+ function _ts_decorate70(decorators, target, key, desc) {
17438
17703
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17439
17704
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17440
17705
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17447,7 +17712,7 @@ function _ts_decorate69(decorators, target, key, desc) {
17447
17712
  }
17448
17713
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17449
17714
  }
17450
- __name(_ts_decorate69, "_ts_decorate");
17715
+ __name(_ts_decorate70, "_ts_decorate");
17451
17716
  function hasProviderToken(providers, token) {
17452
17717
  return providers.some((p) => {
17453
17718
  if (typeof p === "function") return false;
@@ -17707,6 +17972,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17707
17972
  exports.AuthService,
17708
17973
  // Guards — registered as providers so they can be applied via @UseGuards().
17709
17974
  exports.JwtAuthGuard,
17975
+ exports.RequestEncodingGuard,
17710
17976
  exports.TrustedOriginGuard,
17711
17977
  exports.AuthRateLimitGuard,
17712
17978
  // Response-header interceptor — every library controller applies it, so it must be
@@ -17739,6 +18005,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17739
18005
  exports.AuthService,
17740
18006
  // Export guards so host-app modules can apply them without reimporting.
17741
18007
  exports.JwtAuthGuard,
18008
+ exports.RequestEncodingGuard,
17742
18009
  exports.TrustedOriginGuard,
17743
18010
  exports.AuthRateLimitGuard,
17744
18011
  exports.RolesGuard,
@@ -17837,7 +18104,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17837
18104
  };
17838
18105
  }
17839
18106
  };
17840
- exports.BymaxAuthModule = _ts_decorate69([
18107
+ exports.BymaxAuthModule = _ts_decorate70([
17841
18108
  common.Module({})
17842
18109
  ], exports.BymaxAuthModule);
17843
18110
 
@@ -18165,7 +18432,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
18165
18432
  }
18166
18433
  }
18167
18434
  };
18168
- function _ts_decorate70(decorators, target, key, desc) {
18435
+ function _ts_decorate71(decorators, target, key, desc) {
18169
18436
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18170
18437
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18171
18438
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18178,13 +18445,13 @@ function _ts_decorate70(decorators, target, key, desc) {
18178
18445
  }
18179
18446
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18180
18447
  }
18181
- __name(_ts_decorate70, "_ts_decorate");
18182
- function _ts_metadata65(metadataKey, metadataValue) {
18448
+ __name(_ts_decorate71, "_ts_decorate");
18449
+ function _ts_metadata66(metadataKey, metadataValue) {
18183
18450
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18184
18451
  return Reflect.metadata(metadataKey, metadataValue);
18185
18452
  }
18186
18453
  }
18187
- __name(_ts_metadata65, "_ts_metadata");
18454
+ __name(_ts_metadata66, "_ts_metadata");
18188
18455
  var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
18189
18456
  var PREFIX_LENGTH = 5;
18190
18457
  var DEFAULT_TIMEOUT_MS = 1500;
@@ -18241,10 +18508,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
18241
18508
  }
18242
18509
  }
18243
18510
  };
18244
- exports.HibpBreachChecker = _ts_decorate70([
18511
+ exports.HibpBreachChecker = _ts_decorate71([
18245
18512
  common.Injectable(),
18246
- _ts_metadata65("design:type", Function),
18247
- _ts_metadata65("design:paramtypes", [
18513
+ _ts_metadata66("design:type", Function),
18514
+ _ts_metadata66("design:paramtypes", [
18248
18515
  Number
18249
18516
  ])
18250
18517
  ], exports.HibpBreachChecker);
@@ -18257,10 +18524,10 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
18257
18524
  return false;
18258
18525
  }
18259
18526
  };
18260
- exports.AllowAllBreachChecker = _ts_decorate70([
18527
+ exports.AllowAllBreachChecker = _ts_decorate71([
18261
18528
  common.Injectable()
18262
18529
  ], exports.AllowAllBreachChecker);
18263
- function _ts_decorate71(decorators, target, key, desc) {
18530
+ function _ts_decorate72(decorators, target, key, desc) {
18264
18531
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18265
18532
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18266
18533
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18273,7 +18540,7 @@ function _ts_decorate71(decorators, target, key, desc) {
18273
18540
  }
18274
18541
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18275
18542
  }
18276
- __name(_ts_decorate71, "_ts_decorate");
18543
+ __name(_ts_decorate72, "_ts_decorate");
18277
18544
  exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
18278
18545
  static {
18279
18546
  __name(this, "OptionalAuthGuard");
@@ -18288,10 +18555,10 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
18288
18555
  return super.canActivate(context);
18289
18556
  }
18290
18557
  };
18291
- exports.OptionalAuthGuard = _ts_decorate71([
18558
+ exports.OptionalAuthGuard = _ts_decorate72([
18292
18559
  common.Injectable()
18293
18560
  ], exports.OptionalAuthGuard);
18294
- function _ts_decorate72(decorators, target, key, desc) {
18561
+ function _ts_decorate73(decorators, target, key, desc) {
18295
18562
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18296
18563
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18297
18564
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18304,13 +18571,13 @@ function _ts_decorate72(decorators, target, key, desc) {
18304
18571
  }
18305
18572
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18306
18573
  }
18307
- __name(_ts_decorate72, "_ts_decorate");
18308
- function _ts_metadata66(metadataKey, metadataValue) {
18574
+ __name(_ts_decorate73, "_ts_decorate");
18575
+ function _ts_metadata67(metadataKey, metadataValue) {
18309
18576
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18310
18577
  return Reflect.metadata(metadataKey, metadataValue);
18311
18578
  }
18312
18579
  }
18313
- __name(_ts_metadata66, "_ts_metadata");
18580
+ __name(_ts_metadata67, "_ts_metadata");
18314
18581
  function _ts_param43(paramIndex, decorator) {
18315
18582
  return function(target, key) {
18316
18583
  decorator(target, key, paramIndex);
@@ -18346,11 +18613,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
18346
18613
  throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
18347
18614
  }
18348
18615
  };
18349
- exports.SelfOrAdminGuard = _ts_decorate72([
18616
+ exports.SelfOrAdminGuard = _ts_decorate73([
18350
18617
  common.Injectable(),
18351
18618
  _ts_param43(0, common.Inject(BYMAX_AUTH_OPTIONS)),
18352
- _ts_metadata66("design:type", Function),
18353
- _ts_metadata66("design:paramtypes", [
18619
+ _ts_metadata67("design:type", Function),
18620
+ _ts_metadata67("design:paramtypes", [
18354
18621
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
18355
18622
  ])
18356
18623
  ], exports.SelfOrAdminGuard);
@@ -18363,7 +18630,7 @@ function isHexLooking(value) {
18363
18630
  return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
18364
18631
  }
18365
18632
  __name(isHexLooking, "isHexLooking");
18366
- function _ts_decorate73(decorators, target, key, desc) {
18633
+ function _ts_decorate74(decorators, target, key, desc) {
18367
18634
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18368
18635
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18369
18636
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18376,13 +18643,13 @@ function _ts_decorate73(decorators, target, key, desc) {
18376
18643
  }
18377
18644
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18378
18645
  }
18379
- __name(_ts_decorate73, "_ts_decorate");
18380
- function _ts_metadata67(metadataKey, metadataValue) {
18646
+ __name(_ts_decorate74, "_ts_decorate");
18647
+ function _ts_metadata68(metadataKey, metadataValue) {
18381
18648
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18382
18649
  return Reflect.metadata(metadataKey, metadataValue);
18383
18650
  }
18384
18651
  }
18385
- __name(_ts_metadata67, "_ts_metadata");
18652
+ __name(_ts_metadata68, "_ts_metadata");
18386
18653
  function _ts_param44(paramIndex, decorator) {
18387
18654
  return function(target, key) {
18388
18655
  decorator(target, key, paramIndex);
@@ -18452,14 +18719,14 @@ exports.WsJwtGuard = class WsJwtGuard {
18452
18719
  return true;
18453
18720
  }
18454
18721
  };
18455
- exports.WsJwtGuard = _ts_decorate73([
18722
+ exports.WsJwtGuard = _ts_decorate74([
18456
18723
  common.Injectable(),
18457
18724
  _ts_param44(0, common.Inject(jwt.JwtService)),
18458
18725
  _ts_param44(1, common.Inject(exports.AuthRevocationService)),
18459
18726
  _ts_param44(2, common.Inject(exports.WsTicketService)),
18460
18727
  _ts_param44(3, common.Inject(BYMAX_AUTH_OPTIONS)),
18461
- _ts_metadata67("design:type", Function),
18462
- _ts_metadata67("design:paramtypes", [
18728
+ _ts_metadata68("design:type", Function),
18729
+ _ts_metadata68("design:paramtypes", [
18463
18730
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
18464
18731
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
18465
18732
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
@@ -18499,7 +18766,7 @@ function bindingInput(handshake) {
18499
18766
  };
18500
18767
  }
18501
18768
  __name(bindingInput, "bindingInput");
18502
- function _ts_decorate74(decorators, target, key, desc) {
18769
+ function _ts_decorate75(decorators, target, key, desc) {
18503
18770
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18504
18771
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18505
18772
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18512,13 +18779,48 @@ function _ts_decorate74(decorators, target, key, desc) {
18512
18779
  }
18513
18780
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18514
18781
  }
18515
- __name(_ts_decorate74, "_ts_decorate");
18782
+ __name(_ts_decorate75, "_ts_decorate");
18516
18783
  function isAuthEnvelope(body) {
18517
18784
  if (typeof body !== "object" || body === null) return false;
18518
18785
  const error = body.error;
18519
18786
  return typeof error === "object" && error !== null && "code" in error;
18520
18787
  }
18521
18788
  __name(isAuthEnvelope, "isAuthEnvelope");
18789
+ var BODY_PARSER_ERROR_TYPES = /* @__PURE__ */ new Set([
18790
+ "entity.parse.failed",
18791
+ "entity.too.large",
18792
+ "entity.verify.failed",
18793
+ "charset.unsupported",
18794
+ "encoding.unsupported",
18795
+ "request.aborted",
18796
+ "request.size.invalid",
18797
+ "querystring.parse.rangeError",
18798
+ "parameters.too.many"
18799
+ ]);
18800
+ var MALFORMED_REQUEST_MESSAGE = "Malformed request";
18801
+ function bodyParserStatus(exception) {
18802
+ if (typeof exception !== "object" || exception === null) return void 0;
18803
+ const { type, status } = exception;
18804
+ if (typeof type !== "string" || !BODY_PARSER_ERROR_TYPES.has(type)) return void 0;
18805
+ return typeof status === "number" && status >= 400 && status < 500 ? status : void 0;
18806
+ }
18807
+ __name(bodyParserStatus, "bodyParserStatus");
18808
+ function isUntypedParserRefusal(exception) {
18809
+ if (!(exception instanceof Error)) return false;
18810
+ const { status, statusCode, expose, type } = exception;
18811
+ return status === common.HttpStatus.BAD_REQUEST && statusCode === common.HttpStatus.BAD_REQUEST && expose === true && type === void 0;
18812
+ }
18813
+ __name(isUntypedParserRefusal, "isUntypedParserRefusal");
18814
+ function bodyParserMessage(status) {
18815
+ if (status === common.HttpStatus.PAYLOAD_TOO_LARGE) return "Request entity too large";
18816
+ if (status === common.HttpStatus.UNSUPPORTED_MEDIA_TYPE) return "Unsupported media type";
18817
+ return MALFORMED_REQUEST_MESSAGE;
18818
+ }
18819
+ __name(bodyParserMessage, "bodyParserMessage");
18820
+ function isPreRoutingBadRequest(exception, req) {
18821
+ return exception instanceof common.BadRequestException && req.route === void 0;
18822
+ }
18823
+ __name(isPreRoutingBadRequest, "isPreRoutingBadRequest");
18522
18824
  exports.AuthExceptionFilter = class _AuthExceptionFilter {
18523
18825
  static {
18524
18826
  __name(this, "AuthExceptionFilter");
@@ -18531,7 +18833,8 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18531
18833
  * @param host - The arguments host, used to reach the HTTP response.
18532
18834
  */
18533
18835
  catch(exception, host) {
18534
- const res = host.switchToHttp().getResponse();
18836
+ const http = host.switchToHttp();
18837
+ const res = http.getResponse();
18535
18838
  if (exception instanceof AuthException) {
18536
18839
  res.status(exception.getStatus()).json(exception.getResponse());
18537
18840
  return;
@@ -18542,6 +18845,16 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18542
18845
  res.status(exception.getStatus()).json(body);
18543
18846
  return;
18544
18847
  }
18848
+ if (isPreRoutingBadRequest(exception, http.getRequest())) {
18849
+ res.status(common.HttpStatus.BAD_REQUEST).json({
18850
+ error: {
18851
+ code: AUTH_ERROR_CODES.VALIDATION,
18852
+ message: MALFORMED_REQUEST_MESSAGE,
18853
+ details: null
18854
+ }
18855
+ });
18856
+ return;
18857
+ }
18545
18858
  const message = typeof body === "string" ? body : exception.message;
18546
18859
  res.status(exception.getStatus()).json({
18547
18860
  error: {
@@ -18552,6 +18865,27 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18552
18865
  });
18553
18866
  return;
18554
18867
  }
18868
+ const refusedStatus = bodyParserStatus(exception);
18869
+ if (refusedStatus !== void 0) {
18870
+ res.status(refusedStatus).json({
18871
+ error: {
18872
+ code: AUTH_ERROR_CODES.VALIDATION,
18873
+ message: bodyParserMessage(refusedStatus),
18874
+ details: null
18875
+ }
18876
+ });
18877
+ return;
18878
+ }
18879
+ if (isUntypedParserRefusal(exception) && http.getRequest().route === void 0) {
18880
+ res.status(common.HttpStatus.BAD_REQUEST).json({
18881
+ error: {
18882
+ code: AUTH_ERROR_CODES.VALIDATION,
18883
+ message: MALFORMED_REQUEST_MESSAGE,
18884
+ details: null
18885
+ }
18886
+ });
18887
+ return;
18888
+ }
18555
18889
  this.logger.error(`unhandled exception: ${describeChannelStatus(exception)}`);
18556
18890
  res.status(common.HttpStatus.INTERNAL_SERVER_ERROR).json({
18557
18891
  error: {
@@ -18564,10 +18898,10 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18564
18898
  });
18565
18899
  }
18566
18900
  };
18567
- exports.AuthExceptionFilter = _ts_decorate74([
18901
+ exports.AuthExceptionFilter = _ts_decorate75([
18568
18902
  common.Catch()
18569
18903
  ], exports.AuthExceptionFilter);
18570
- function _ts_decorate75(decorators, target, key, desc) {
18904
+ function _ts_decorate76(decorators, target, key, desc) {
18571
18905
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18572
18906
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18573
18907
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18580,7 +18914,7 @@ function _ts_decorate75(decorators, target, key, desc) {
18580
18914
  }
18581
18915
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18582
18916
  }
18583
- __name(_ts_decorate75, "_ts_decorate");
18917
+ __name(_ts_decorate76, "_ts_decorate");
18584
18918
  function isEmittingClient(client) {
18585
18919
  return typeof client?.emit === "function";
18586
18920
  }
@@ -18624,7 +18958,7 @@ exports.WsAuthExceptionFilter = class _WsAuthExceptionFilter {
18624
18958
  this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
18625
18959
  }
18626
18960
  };
18627
- exports.WsAuthExceptionFilter = _ts_decorate75([
18961
+ exports.WsAuthExceptionFilter = _ts_decorate76([
18628
18962
  common.Catch(AuthException)
18629
18963
  ], exports.WsAuthExceptionFilter);
18630
18964
  var ServiceKey = /* @__PURE__ */ __name((...scopes) => common.applyDecorators(common.SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), common.UseGuards(exports.ApiKeyGuard)), "ServiceKey");
@@ -18670,6 +19004,7 @@ exports.PlatformRoles = PlatformRoles;
18670
19004
  exports.Public = Public;
18671
19005
  exports.ROLES_KEY = ROLES_KEY;
18672
19006
  exports.RegisterDto = RegisterDto;
19007
+ exports.RequestEncoding = RequestEncoding;
18673
19008
  exports.ResendOtpDto = ResendOtpDto;
18674
19009
  exports.ResendVerificationDto = ResendVerificationDto;
18675
19010
  exports.ResetPasswordDto = ResetPasswordDto;