@bymax-one/nest-auth 1.4.17 → 1.4.19

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",
@@ -1265,6 +1269,8 @@ var CurrentUser = common.createParamDecorator((property, ctx) => {
1265
1269
  });
1266
1270
  var IS_PUBLIC_KEY = /* @__PURE__ */ Symbol("bymax:isPublic");
1267
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");
1268
1274
 
1269
1275
  // src/server/dto/no-control-characters.ts
1270
1276
  var NO_CONTROL_CHARACTERS = /^[^\u0000-\u001F\u007F-\u009F]+$/;
@@ -3862,6 +3868,78 @@ function _ts_metadata10(metadataKey, metadataValue) {
3862
3868
  }
3863
3869
  }
3864
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");
3865
3943
  function _ts_param6(paramIndex, decorator) {
3866
3944
  return function(target, key) {
3867
3945
  decorator(target, key, paramIndex);
@@ -3905,15 +3983,15 @@ exports.TrustedOriginGuard = class TrustedOriginGuard {
3905
3983
  return true;
3906
3984
  }
3907
3985
  };
3908
- exports.TrustedOriginGuard = _ts_decorate10([
3986
+ exports.TrustedOriginGuard = _ts_decorate11([
3909
3987
  common.Injectable(),
3910
3988
  _ts_param6(0, common.Inject(BYMAX_AUTH_OPTIONS)),
3911
- _ts_metadata10("design:type", Function),
3912
- _ts_metadata10("design:paramtypes", [
3989
+ _ts_metadata11("design:type", Function),
3990
+ _ts_metadata11("design:paramtypes", [
3913
3991
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
3914
3992
  ])
3915
3993
  ], exports.TrustedOriginGuard);
3916
- function _ts_decorate11(decorators, target, key, desc) {
3994
+ function _ts_decorate12(decorators, target, key, desc) {
3917
3995
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3918
3996
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3919
3997
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3926,13 +4004,13 @@ function _ts_decorate11(decorators, target, key, desc) {
3926
4004
  }
3927
4005
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3928
4006
  }
3929
- __name(_ts_decorate11, "_ts_decorate");
3930
- function _ts_metadata11(metadataKey, metadataValue) {
4007
+ __name(_ts_decorate12, "_ts_decorate");
4008
+ function _ts_metadata12(metadataKey, metadataValue) {
3931
4009
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3932
4010
  return Reflect.metadata(metadataKey, metadataValue);
3933
4011
  }
3934
4012
  }
3935
- __name(_ts_metadata11, "_ts_metadata");
4013
+ __name(_ts_metadata12, "_ts_metadata");
3936
4014
  function _ts_param7(paramIndex, decorator) {
3937
4015
  return function(target, key) {
3938
4016
  decorator(target, key, paramIndex);
@@ -4079,15 +4157,15 @@ exports.AccountStatusService = class AccountStatusService {
4079
4157
  assertNotBlocked(admin.status, this.options.blockedStatuses);
4080
4158
  }
4081
4159
  };
4082
- exports.AccountStatusService = _ts_decorate11([
4160
+ exports.AccountStatusService = _ts_decorate12([
4083
4161
  common.Injectable(),
4084
4162
  _ts_param7(0, common.Inject(AuthRedisService)),
4085
4163
  _ts_param7(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
4086
4164
  _ts_param7(2, common.Inject(BYMAX_AUTH_OPTIONS)),
4087
4165
  _ts_param7(3, common.Optional()),
4088
4166
  _ts_param7(3, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
4089
- _ts_metadata11("design:type", Function),
4090
- _ts_metadata11("design:paramtypes", [
4167
+ _ts_metadata12("design:type", Function),
4168
+ _ts_metadata12("design:paramtypes", [
4091
4169
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
4092
4170
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
4093
4171
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -4096,7 +4174,7 @@ exports.AccountStatusService = _ts_decorate11([
4096
4174
  ], exports.AccountStatusService);
4097
4175
 
4098
4176
  // src/server/guards/user-status.guard.ts
4099
- function _ts_decorate12(decorators, target, key, desc) {
4177
+ function _ts_decorate13(decorators, target, key, desc) {
4100
4178
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4101
4179
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4102
4180
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4109,13 +4187,13 @@ function _ts_decorate12(decorators, target, key, desc) {
4109
4187
  }
4110
4188
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4111
4189
  }
4112
- __name(_ts_decorate12, "_ts_decorate");
4113
- function _ts_metadata12(metadataKey, metadataValue) {
4190
+ __name(_ts_decorate13, "_ts_decorate");
4191
+ function _ts_metadata13(metadataKey, metadataValue) {
4114
4192
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4115
4193
  return Reflect.metadata(metadataKey, metadataValue);
4116
4194
  }
4117
4195
  }
4118
- __name(_ts_metadata12, "_ts_metadata");
4196
+ __name(_ts_metadata13, "_ts_metadata");
4119
4197
  function _ts_param8(paramIndex, decorator) {
4120
4198
  return function(target, key) {
4121
4199
  decorator(target, key, paramIndex);
@@ -4150,15 +4228,15 @@ exports.UserStatusGuard = class UserStatusGuard {
4150
4228
  return true;
4151
4229
  }
4152
4230
  };
4153
- exports.UserStatusGuard = _ts_decorate12([
4231
+ exports.UserStatusGuard = _ts_decorate13([
4154
4232
  common.Injectable(),
4155
4233
  _ts_param8(0, common.Inject(exports.AccountStatusService)),
4156
- _ts_metadata12("design:type", Function),
4157
- _ts_metadata12("design:paramtypes", [
4234
+ _ts_metadata13("design:type", Function),
4235
+ _ts_metadata13("design:paramtypes", [
4158
4236
  typeof exports.AccountStatusService === "undefined" ? Object : exports.AccountStatusService
4159
4237
  ])
4160
4238
  ], exports.UserStatusGuard);
4161
- function _ts_decorate13(decorators, target, key, desc) {
4239
+ function _ts_decorate14(decorators, target, key, desc) {
4162
4240
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4163
4241
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4164
4242
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4171,7 +4249,7 @@ function _ts_decorate13(decorators, target, key, desc) {
4171
4249
  }
4172
4250
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4173
4251
  }
4174
- __name(_ts_decorate13, "_ts_decorate");
4252
+ __name(_ts_decorate14, "_ts_decorate");
4175
4253
  var NoStoreInterceptor = class {
4176
4254
  static {
4177
4255
  __name(this, "NoStoreInterceptor");
@@ -4186,7 +4264,7 @@ var NoStoreInterceptor = class {
4186
4264
  return next.handle();
4187
4265
  }
4188
4266
  };
4189
- NoStoreInterceptor = _ts_decorate13([
4267
+ NoStoreInterceptor = _ts_decorate14([
4190
4268
  common.Injectable()
4191
4269
  ], NoStoreInterceptor);
4192
4270
  function flattenValidationErrors(errors, parentPath = "") {
@@ -4226,7 +4304,7 @@ function createAuthValidationPipe(options = {}) {
4226
4304
  });
4227
4305
  }
4228
4306
  __name(createAuthValidationPipe, "createAuthValidationPipe");
4229
- function _ts_decorate14(decorators, target, key, desc) {
4307
+ function _ts_decorate15(decorators, target, key, desc) {
4230
4308
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4231
4309
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4232
4310
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4239,13 +4317,13 @@ function _ts_decorate14(decorators, target, key, desc) {
4239
4317
  }
4240
4318
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4241
4319
  }
4242
- __name(_ts_decorate14, "_ts_decorate");
4243
- function _ts_metadata13(metadataKey, metadataValue) {
4320
+ __name(_ts_decorate15, "_ts_decorate");
4321
+ function _ts_metadata14(metadataKey, metadataValue) {
4244
4322
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4245
4323
  return Reflect.metadata(metadataKey, metadataValue);
4246
4324
  }
4247
4325
  }
4248
- __name(_ts_metadata13, "_ts_metadata");
4326
+ __name(_ts_metadata14, "_ts_metadata");
4249
4327
  function _ts_param9(paramIndex, decorator) {
4250
4328
  return function(target, key) {
4251
4329
  decorator(target, key, paramIndex);
@@ -4341,17 +4419,17 @@ exports.BruteForceService = class _BruteForceService {
4341
4419
  }
4342
4420
  }
4343
4421
  };
4344
- exports.BruteForceService = _ts_decorate14([
4422
+ exports.BruteForceService = _ts_decorate15([
4345
4423
  common.Injectable(),
4346
4424
  _ts_param9(0, common.Inject(AuthRedisService)),
4347
4425
  _ts_param9(1, common.Inject(BYMAX_AUTH_OPTIONS)),
4348
- _ts_metadata13("design:type", Function),
4349
- _ts_metadata13("design:paramtypes", [
4426
+ _ts_metadata14("design:type", Function),
4427
+ _ts_metadata14("design:paramtypes", [
4350
4428
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
4351
4429
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
4352
4430
  ])
4353
4431
  ], exports.BruteForceService);
4354
- function _ts_decorate15(decorators, target, key, desc) {
4432
+ function _ts_decorate16(decorators, target, key, desc) {
4355
4433
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4356
4434
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4357
4435
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4364,13 +4442,13 @@ function _ts_decorate15(decorators, target, key, desc) {
4364
4442
  }
4365
4443
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4366
4444
  }
4367
- __name(_ts_decorate15, "_ts_decorate");
4368
- function _ts_metadata14(metadataKey, metadataValue) {
4445
+ __name(_ts_decorate16, "_ts_decorate");
4446
+ function _ts_metadata15(metadataKey, metadataValue) {
4369
4447
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4370
4448
  return Reflect.metadata(metadataKey, metadataValue);
4371
4449
  }
4372
4450
  }
4373
- __name(_ts_metadata14, "_ts_metadata");
4451
+ __name(_ts_metadata15, "_ts_metadata");
4374
4452
  function _ts_param10(paramIndex, decorator) {
4375
4453
  return function(target, key) {
4376
4454
  decorator(target, key, paramIndex);
@@ -4534,17 +4612,17 @@ exports.OtpService = class OtpService {
4534
4612
  await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
4535
4613
  }
4536
4614
  };
4537
- exports.OtpService = _ts_decorate15([
4615
+ exports.OtpService = _ts_decorate16([
4538
4616
  common.Injectable(),
4539
4617
  _ts_param10(0, common.Inject(AuthRedisService)),
4540
4618
  _ts_param10(1, common.Inject(BYMAX_AUTH_OPTIONS)),
4541
- _ts_metadata14("design:type", Function),
4542
- _ts_metadata14("design:paramtypes", [
4619
+ _ts_metadata15("design:type", Function),
4620
+ _ts_metadata15("design:paramtypes", [
4543
4621
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
4544
4622
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
4545
4623
  ])
4546
4624
  ], exports.OtpService);
4547
- function _ts_decorate16(decorators, target, key, desc) {
4625
+ function _ts_decorate17(decorators, target, key, desc) {
4548
4626
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4549
4627
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4550
4628
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4557,13 +4635,13 @@ function _ts_decorate16(decorators, target, key, desc) {
4557
4635
  }
4558
4636
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4559
4637
  }
4560
- __name(_ts_decorate16, "_ts_decorate");
4561
- function _ts_metadata15(metadataKey, metadataValue) {
4638
+ __name(_ts_decorate17, "_ts_decorate");
4639
+ function _ts_metadata16(metadataKey, metadataValue) {
4562
4640
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4563
4641
  return Reflect.metadata(metadataKey, metadataValue);
4564
4642
  }
4565
4643
  }
4566
- __name(_ts_metadata15, "_ts_metadata");
4644
+ __name(_ts_metadata16, "_ts_metadata");
4567
4645
  function _ts_param11(paramIndex, decorator) {
4568
4646
  return function(target, key) {
4569
4647
  decorator(target, key, paramIndex);
@@ -4858,12 +4936,12 @@ var PasswordService = class _PasswordService {
4858
4936
  return crypto.timingSafeEqual(candidate, DUMMY_EXPECTED);
4859
4937
  }
4860
4938
  };
4861
- PasswordService = _ts_decorate16([
4939
+ PasswordService = _ts_decorate17([
4862
4940
  common.Injectable(),
4863
4941
  _ts_param11(0, common.Inject(BYMAX_AUTH_OPTIONS)),
4864
4942
  _ts_param11(1, common.Inject(BYMAX_AUTH_BREACH_CHECKER)),
4865
- _ts_metadata15("design:type", Function),
4866
- _ts_metadata15("design:paramtypes", [
4943
+ _ts_metadata16("design:type", Function),
4944
+ _ts_metadata16("design:paramtypes", [
4867
4945
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
4868
4946
  typeof IPasswordBreachChecker === "undefined" ? Object : IPasswordBreachChecker
4869
4947
  ])
@@ -4896,7 +4974,7 @@ function settleAfter(first, followUps) {
4896
4974
  __name(settleAfter, "settleAfter");
4897
4975
 
4898
4976
  // src/server/services/session.service.ts
4899
- function _ts_decorate17(decorators, target, key, desc) {
4977
+ function _ts_decorate18(decorators, target, key, desc) {
4900
4978
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4901
4979
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
4902
4980
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4909,13 +4987,13 @@ function _ts_decorate17(decorators, target, key, desc) {
4909
4987
  }
4910
4988
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4911
4989
  }
4912
- __name(_ts_decorate17, "_ts_decorate");
4913
- function _ts_metadata16(metadataKey, metadataValue) {
4990
+ __name(_ts_decorate18, "_ts_decorate");
4991
+ function _ts_metadata17(metadataKey, metadataValue) {
4914
4992
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
4915
4993
  return Reflect.metadata(metadataKey, metadataValue);
4916
4994
  }
4917
4995
  }
4918
- __name(_ts_metadata16, "_ts_metadata");
4996
+ __name(_ts_metadata17, "_ts_metadata");
4919
4997
  function _ts_param12(paramIndex, decorator) {
4920
4998
  return function(target, key) {
4921
4999
  decorator(target, key, paramIndex);
@@ -5612,15 +5690,15 @@ exports.SessionService = class _SessionService {
5612
5690
  }
5613
5691
  }
5614
5692
  };
5615
- exports.SessionService = _ts_decorate17([
5693
+ exports.SessionService = _ts_decorate18([
5616
5694
  common.Injectable(),
5617
5695
  _ts_param12(0, common.Inject(BYMAX_AUTH_OPTIONS)),
5618
5696
  _ts_param12(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
5619
5697
  _ts_param12(2, common.Inject(BYMAX_AUTH_HOOKS)),
5620
5698
  _ts_param12(2, common.Optional()),
5621
5699
  _ts_param12(3, common.Inject(AuthRedisService)),
5622
- _ts_metadata16("design:type", Function),
5623
- _ts_metadata16("design:paramtypes", [
5700
+ _ts_metadata17("design:type", Function),
5701
+ _ts_metadata17("design:paramtypes", [
5624
5702
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
5625
5703
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
5626
5704
  Object,
@@ -5643,7 +5721,7 @@ function ownerFragment(ownerId) {
5643
5721
  __name(ownerFragment, "ownerFragment");
5644
5722
 
5645
5723
  // src/server/services/token-manager.service.ts
5646
- function _ts_decorate18(decorators, target, key, desc) {
5724
+ function _ts_decorate19(decorators, target, key, desc) {
5647
5725
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5648
5726
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
5649
5727
  r = Reflect.decorate(decorators, target, key, desc);
@@ -5656,13 +5734,13 @@ function _ts_decorate18(decorators, target, key, desc) {
5656
5734
  }
5657
5735
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5658
5736
  }
5659
- __name(_ts_decorate18, "_ts_decorate");
5660
- function _ts_metadata17(metadataKey, metadataValue) {
5737
+ __name(_ts_decorate19, "_ts_decorate");
5738
+ function _ts_metadata18(metadataKey, metadataValue) {
5661
5739
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
5662
5740
  return Reflect.metadata(metadataKey, metadataValue);
5663
5741
  }
5664
5742
  }
5665
- __name(_ts_metadata17, "_ts_metadata");
5743
+ __name(_ts_metadata18, "_ts_metadata");
5666
5744
  function _ts_param13(paramIndex, decorator) {
5667
5745
  return function(target, key) {
5668
5746
  decorator(target, key, paramIndex);
@@ -6572,15 +6650,15 @@ var TokenManagerService = class _TokenManagerService {
6572
6650
  return await this.redis.del(`mfa:${sha256(jti)}`);
6573
6651
  }
6574
6652
  };
6575
- TokenManagerService = _ts_decorate18([
6653
+ TokenManagerService = _ts_decorate19([
6576
6654
  common.Injectable(),
6577
6655
  _ts_param13(0, common.Inject(jwt.JwtService)),
6578
6656
  _ts_param13(1, common.Inject(BYMAX_AUTH_OPTIONS)),
6579
6657
  _ts_param13(2, common.Inject(AuthRedisService)),
6580
6658
  _ts_param13(3, common.Inject(BYMAX_AUTH_HOOKS)),
6581
6659
  _ts_param13(3, common.Optional()),
6582
- _ts_metadata17("design:type", Function),
6583
- _ts_metadata17("design:paramtypes", [
6660
+ _ts_metadata18("design:type", Function),
6661
+ _ts_metadata18("design:paramtypes", [
6584
6662
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
6585
6663
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
6586
6664
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
@@ -6588,6 +6666,18 @@ TokenManagerService = _ts_decorate18([
6588
6666
  ])
6589
6667
  ], TokenManagerService);
6590
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
+
6591
6681
  // src/server/utils/mask-email.ts
6592
6682
  function maskEmail(email) {
6593
6683
  const atIndex = email.indexOf("@");
@@ -6602,6 +6692,39 @@ function normalizeEmail(email) {
6602
6692
  }
6603
6693
  __name(normalizeEmail, "normalizeEmail");
6604
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, owner, ttlSeconds, 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
+ if (!fromSession) throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
6714
+ return confirmNoStaleMarker(redis, key, owner, ttlSeconds, logger);
6715
+ }
6716
+ }
6717
+ __name(settlePendingLogout, "settlePendingLogout");
6718
+ async function confirmNoStaleMarker(redis, key, owner, ttlSeconds, logger) {
6719
+ try {
6720
+ if (await redis.get(key) === null) return true;
6721
+ } catch {
6722
+ await rememberPendingLogout(redis, key, owner, ttlSeconds, logger);
6723
+ }
6724
+ throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
6725
+ }
6726
+ __name(confirmNoStaleMarker, "confirmNoStaleMarker");
6727
+
6605
6728
  // src/server/utils/resolve-tenant-id.ts
6606
6729
  async function resolveTenantId(dtoTenantId, req, resolver) {
6607
6730
  if (resolver) {
@@ -6648,7 +6771,7 @@ function tenantScoped(user, tenantId) {
6648
6771
  __name(tenantScoped, "tenantScoped");
6649
6772
 
6650
6773
  // src/server/services/auth.service.ts
6651
- function _ts_decorate19(decorators, target, key, desc) {
6774
+ function _ts_decorate20(decorators, target, key, desc) {
6652
6775
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6653
6776
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
6654
6777
  r = Reflect.decorate(decorators, target, key, desc);
@@ -6661,13 +6784,13 @@ function _ts_decorate19(decorators, target, key, desc) {
6661
6784
  }
6662
6785
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6663
6786
  }
6664
- __name(_ts_decorate19, "_ts_decorate");
6665
- function _ts_metadata18(metadataKey, metadataValue) {
6787
+ __name(_ts_decorate20, "_ts_decorate");
6788
+ function _ts_metadata19(metadataKey, metadataValue) {
6666
6789
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
6667
6790
  return Reflect.metadata(metadataKey, metadataValue);
6668
6791
  }
6669
6792
  }
6670
- __name(_ts_metadata18, "_ts_metadata");
6793
+ __name(_ts_metadata19, "_ts_metadata");
6671
6794
  function _ts_param14(paramIndex, decorator) {
6672
6795
  return function(target, key) {
6673
6796
  decorator(target, key, paramIndex);
@@ -7042,39 +7165,87 @@ exports.AuthService = class _AuthService {
7042
7165
  */
7043
7166
  async logout(accessToken, rawRefreshToken) {
7044
7167
  const sessionHash = sha256(rawRefreshToken);
7045
- const { userId, tenantId } = await this.redis.readSessionOwner(`rt:${sessionHash}`);
7168
+ const markerKey = logoutPendingKey("dashboard", sessionHash);
7169
+ const live = await this.redis.readSessionOwner(`rt:${sessionHash}`);
7170
+ const fromSession = live.userId !== "";
7171
+ const { userId, tenantId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
7046
7172
  this.logger.log(`logout: userId=${logSafe(userId || "(no live session)")}`);
7047
- let blacklist = [];
7173
+ const failures = await settleWrites([
7174
+ ...this.blacklistWrites(accessToken),
7175
+ () => this.redis.del(`rt:${sessionHash}`),
7176
+ () => this.redis.del(`rp:${sessionHash}`)
7177
+ ]);
7178
+ await this.revokeSessionMetadata(userId, tenantId, sessionHash);
7179
+ const markerTtl = logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn);
7180
+ if (failures.length > 0 && fromSession) {
7181
+ await rememberPendingLogout(this.redis, markerKey, {
7182
+ userId,
7183
+ tenantId
7184
+ }, markerTtl, this.logger);
7185
+ }
7186
+ raiseFirst(failures);
7187
+ if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, {
7188
+ userId,
7189
+ tenantId
7190
+ }, markerTtl, this.logger)) {
7191
+ this.emitLogout(userId, tenantId);
7192
+ }
7193
+ return userId;
7194
+ }
7195
+ /**
7196
+ * The access-token blacklist write for a logout, or none when there is nothing to revoke.
7197
+ *
7198
+ * Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
7199
+ * forged one must not blacklist an id it does not own. Only the verification is tolerant.
7200
+ *
7201
+ * @param accessToken - Raw access token; absent, malformed or expired yields no write.
7202
+ * @returns The writes to hand to `settleWrites`.
7203
+ */
7204
+ blacklistWrites(accessToken) {
7048
7205
  try {
7049
7206
  const payload = this.tokenManager.verifyIgnoringExpiry(accessToken);
7050
7207
  const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
7051
7208
  if (remainingTtl > 0) {
7052
- blacklist = [
7209
+ return [
7053
7210
  () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
7054
7211
  ];
7055
7212
  }
7056
7213
  } catch {
7057
7214
  }
7058
- const failures = await settleWrites([
7059
- ...blacklist,
7060
- () => this.redis.del(`rt:${sessionHash}`),
7061
- () => this.redis.del(`rp:${sessionHash}`)
7062
- ]);
7063
- if (this.options.sessions.enabled && userId && tenantId !== void 0) {
7064
- await this.sessionService.revokeSession({
7065
- userId,
7066
- tenantId,
7067
- sessionHash
7068
- }).catch((err) => {
7069
- const errCode = err instanceof AuthException ? err.getResponse().error.code : void 0;
7070
- if (errCode !== AUTH_ERROR_CODES.SESSION_NOT_FOUND) {
7071
- this.logger.warn(`logout: session cleanup failed \u2014 ${describeChannelStatus(err)}`);
7072
- }
7073
- });
7074
- }
7075
- raiseFirst(failures);
7076
- this.emitLogout(userId, tenantId);
7077
- return userId;
7215
+ return [];
7216
+ }
7217
+ /**
7218
+ * Cleans up the session's metadata through `SessionService.revokeSession()`.
7219
+ *
7220
+ * It performs an atomic SISMEMBER ownership check before deleting `sd:{hash}` and SREMing from
7221
+ * `sess:{userId}`. The `rt:{hash}` DEL already ran — revokeSession's internal DEL is a no-op
7222
+ * (Redis DEL is idempotent when the key is absent). SESSION_NOT_FOUND means the session was
7223
+ * evicted, already revoked, or the refresh token does not belong to this user — in all cases
7224
+ * authentication is already invalidated.
7225
+ *
7226
+ * The tenant is REQUIRED to name the index, and it comes off the record rather than from the
7227
+ * caller. A record without one is a pre-upgrade write: the contract lists `tenantId` among the
7228
+ * refresh session's fields, so a live record always has it. Skipping the call is the honest end
7229
+ * for one that does not — `rt:{hash}` is already deleted, so the session is dead either way, and
7230
+ * guessing a tenant would name an index belonging to nobody while reading like a revocation that
7231
+ * happened.
7232
+ *
7233
+ * @param userId - The owner, empty when none is known.
7234
+ * @param tenantId - The owner's tenant, absent when the record carried none.
7235
+ * @param sessionHash - The SHA-256 of the raw refresh token.
7236
+ */
7237
+ async revokeSessionMetadata(userId, tenantId, sessionHash) {
7238
+ if (!this.options.sessions.enabled || !userId || tenantId === void 0) return;
7239
+ await this.sessionService.revokeSession({
7240
+ userId,
7241
+ tenantId,
7242
+ sessionHash
7243
+ }).catch((err) => {
7244
+ const errCode = err instanceof AuthException ? err.getResponse().error.code : void 0;
7245
+ if (errCode !== AUTH_ERROR_CODES.SESSION_NOT_FOUND) {
7246
+ this.logger.warn(`logout: session cleanup failed \u2014 ${describeChannelStatus(err)}`);
7247
+ }
7248
+ });
7078
7249
  }
7079
7250
  /**
7080
7251
  * Announces a completed logout, the only hook `AuthService.logout` emits.
@@ -7664,7 +7835,7 @@ exports.AuthService = class _AuthService {
7664
7835
  })();
7665
7836
  }
7666
7837
  };
7667
- exports.AuthService = _ts_decorate19([
7838
+ exports.AuthService = _ts_decorate20([
7668
7839
  common.Injectable(),
7669
7840
  _ts_param14(0, common.Inject(BYMAX_AUTH_OPTIONS)),
7670
7841
  _ts_param14(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -7679,8 +7850,8 @@ exports.AuthService = _ts_decorate19([
7679
7850
  _ts_param14(8, common.Inject(exports.OtpService)),
7680
7851
  _ts_param14(9, common.Inject(exports.SessionService)),
7681
7852
  _ts_param14(10, common.Inject(exports.AccountStatusService)),
7682
- _ts_metadata18("design:type", Function),
7683
- _ts_metadata18("design:paramtypes", [
7853
+ _ts_metadata19("design:type", Function),
7854
+ _ts_metadata19("design:paramtypes", [
7684
7855
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
7685
7856
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
7686
7857
  Object,
@@ -7704,7 +7875,7 @@ __name(toSafeUser2, "toSafeUser");
7704
7875
  var WS_TICKET_TTL_SECONDS = 30;
7705
7876
 
7706
7877
  // src/server/services/ws-ticket.service.ts
7707
- function _ts_decorate20(decorators, target, key, desc) {
7878
+ function _ts_decorate21(decorators, target, key, desc) {
7708
7879
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7709
7880
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
7710
7881
  r = Reflect.decorate(decorators, target, key, desc);
@@ -7717,13 +7888,13 @@ function _ts_decorate20(decorators, target, key, desc) {
7717
7888
  }
7718
7889
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7719
7890
  }
7720
- __name(_ts_decorate20, "_ts_decorate");
7721
- function _ts_metadata19(metadataKey, metadataValue) {
7891
+ __name(_ts_decorate21, "_ts_decorate");
7892
+ function _ts_metadata20(metadataKey, metadataValue) {
7722
7893
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
7723
7894
  return Reflect.metadata(metadataKey, metadataValue);
7724
7895
  }
7725
7896
  }
7726
- __name(_ts_metadata19, "_ts_metadata");
7897
+ __name(_ts_metadata20, "_ts_metadata");
7727
7898
  function _ts_param15(paramIndex, decorator) {
7728
7899
  return function(target, key) {
7729
7900
  decorator(target, key, paramIndex);
@@ -7863,14 +8034,14 @@ exports.WsTicketService = class _WsTicketService {
7863
8034
  return snapshot;
7864
8035
  }
7865
8036
  };
7866
- exports.WsTicketService = _ts_decorate20([
8037
+ exports.WsTicketService = _ts_decorate21([
7867
8038
  common.Injectable(),
7868
8039
  _ts_param15(0, common.Inject(AuthRedisService)),
7869
8040
  _ts_param15(1, common.Inject(BYMAX_AUTH_OPTIONS)),
7870
8041
  _ts_param15(2, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
7871
8042
  _ts_param15(3, common.Inject(exports.AuthRevocationService)),
7872
- _ts_metadata19("design:type", Function),
7873
- _ts_metadata19("design:paramtypes", [
8043
+ _ts_metadata20("design:type", Function),
8044
+ _ts_metadata20("design:paramtypes", [
7874
8045
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
7875
8046
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
7876
8047
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
@@ -7879,7 +8050,7 @@ exports.WsTicketService = _ts_decorate20([
7879
8050
  ], exports.WsTicketService);
7880
8051
 
7881
8052
  // src/server/controllers/auth.controller.ts
7882
- function _ts_decorate21(decorators, target, key, desc) {
8053
+ function _ts_decorate22(decorators, target, key, desc) {
7883
8054
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7884
8055
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
7885
8056
  r = Reflect.decorate(decorators, target, key, desc);
@@ -7892,13 +8063,13 @@ function _ts_decorate21(decorators, target, key, desc) {
7892
8063
  }
7893
8064
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7894
8065
  }
7895
- __name(_ts_decorate21, "_ts_decorate");
7896
- function _ts_metadata20(metadataKey, metadataValue) {
8066
+ __name(_ts_decorate22, "_ts_decorate");
8067
+ function _ts_metadata21(metadataKey, metadataValue) {
7897
8068
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
7898
8069
  return Reflect.metadata(metadataKey, metadataValue);
7899
8070
  }
7900
8071
  }
7901
- __name(_ts_metadata20, "_ts_metadata");
8072
+ __name(_ts_metadata21, "_ts_metadata");
7902
8073
  function _ts_param16(paramIndex, decorator) {
7903
8074
  return function(target, key) {
7904
8075
  decorator(target, key, paramIndex);
@@ -8057,7 +8228,7 @@ var AuthController = class {
8057
8228
  await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
8058
8229
  }
8059
8230
  };
8060
- _ts_decorate21([
8231
+ _ts_decorate22([
8061
8232
  Public(),
8062
8233
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.register),
8063
8234
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
@@ -8067,15 +8238,15 @@ _ts_decorate21([
8067
8238
  _ts_param16(2, common.Res({
8068
8239
  passthrough: true
8069
8240
  })),
8070
- _ts_metadata20("design:type", Function),
8071
- _ts_metadata20("design:paramtypes", [
8241
+ _ts_metadata21("design:type", Function),
8242
+ _ts_metadata21("design:paramtypes", [
8072
8243
  typeof RegisterDto === "undefined" ? Object : RegisterDto,
8073
8244
  typeof Request === "undefined" ? Object : Request,
8074
8245
  typeof Response === "undefined" ? Object : Response
8075
8246
  ]),
8076
- _ts_metadata20("design:returntype", Promise)
8247
+ _ts_metadata21("design:returntype", Promise)
8077
8248
  ], AuthController.prototype, "register", null);
8078
- _ts_decorate21([
8249
+ _ts_decorate22([
8079
8250
  Public(),
8080
8251
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.login),
8081
8252
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
@@ -8086,72 +8257,75 @@ _ts_decorate21([
8086
8257
  _ts_param16(2, common.Res({
8087
8258
  passthrough: true
8088
8259
  })),
8089
- _ts_metadata20("design:type", Function),
8090
- _ts_metadata20("design:paramtypes", [
8260
+ _ts_metadata21("design:type", Function),
8261
+ _ts_metadata21("design:paramtypes", [
8091
8262
  typeof LoginDto === "undefined" ? Object : LoginDto,
8092
8263
  typeof Request === "undefined" ? Object : Request,
8093
8264
  typeof Response === "undefined" ? Object : Response
8094
8265
  ]),
8095
- _ts_metadata20("design:returntype", Promise)
8266
+ _ts_metadata21("design:returntype", Promise)
8096
8267
  ], AuthController.prototype, "login", null);
8097
- _ts_decorate21([
8268
+ _ts_decorate22([
8098
8269
  Public(),
8099
8270
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
8100
8271
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
8101
8272
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8273
+ RequestEncoding("unchecked"),
8102
8274
  common.Post("logout"),
8103
8275
  _ts_param16(0, common.Req()),
8104
8276
  _ts_param16(1, common.Res({
8105
8277
  passthrough: true
8106
8278
  })),
8107
- _ts_metadata20("design:type", Function),
8108
- _ts_metadata20("design:paramtypes", [
8279
+ _ts_metadata21("design:type", Function),
8280
+ _ts_metadata21("design:paramtypes", [
8109
8281
  typeof Request === "undefined" ? Object : Request,
8110
8282
  typeof Response === "undefined" ? Object : Response
8111
8283
  ]),
8112
- _ts_metadata20("design:returntype", Promise)
8284
+ _ts_metadata21("design:returntype", Promise)
8113
8285
  ], AuthController.prototype, "logout", null);
8114
- _ts_decorate21([
8286
+ _ts_decorate22([
8115
8287
  Public(),
8116
8288
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
8117
8289
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
8118
8290
  common.HttpCode(common.HttpStatus.OK),
8291
+ RequestEncoding("unchecked"),
8119
8292
  common.Post("refresh"),
8120
8293
  _ts_param16(0, common.Req()),
8121
8294
  _ts_param16(1, common.Res({
8122
8295
  passthrough: true
8123
8296
  })),
8124
- _ts_metadata20("design:type", Function),
8125
- _ts_metadata20("design:paramtypes", [
8297
+ _ts_metadata21("design:type", Function),
8298
+ _ts_metadata21("design:paramtypes", [
8126
8299
  typeof Request === "undefined" ? Object : Request,
8127
8300
  typeof Response === "undefined" ? Object : Response
8128
8301
  ]),
8129
- _ts_metadata20("design:returntype", Promise)
8302
+ _ts_metadata21("design:returntype", Promise)
8130
8303
  ], AuthController.prototype, "refresh", null);
8131
- _ts_decorate21([
8304
+ _ts_decorate22([
8132
8305
  common.UseGuards(exports.JwtAuthGuard),
8133
8306
  common.Get("me"),
8134
8307
  _ts_param16(0, CurrentUser()),
8135
- _ts_metadata20("design:type", Function),
8136
- _ts_metadata20("design:paramtypes", [
8308
+ _ts_metadata21("design:type", Function),
8309
+ _ts_metadata21("design:paramtypes", [
8137
8310
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8138
8311
  ]),
8139
- _ts_metadata20("design:returntype", Promise)
8312
+ _ts_metadata21("design:returntype", Promise)
8140
8313
  ], AuthController.prototype, "me", null);
8141
- _ts_decorate21([
8314
+ _ts_decorate22([
8142
8315
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
8143
8316
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
8144
8317
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
8318
+ RequestEncoding("unchecked"),
8145
8319
  common.Post("ws-ticket"),
8146
8320
  common.HttpCode(common.HttpStatus.OK),
8147
8321
  _ts_param16(0, CurrentUser()),
8148
- _ts_metadata20("design:type", Function),
8149
- _ts_metadata20("design:paramtypes", [
8322
+ _ts_metadata21("design:type", Function),
8323
+ _ts_metadata21("design:paramtypes", [
8150
8324
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8151
8325
  ]),
8152
- _ts_metadata20("design:returntype", Promise)
8326
+ _ts_metadata21("design:returntype", Promise)
8153
8327
  ], AuthController.prototype, "wsTicket", null);
8154
- _ts_decorate21([
8328
+ _ts_decorate22([
8155
8329
  Public(),
8156
8330
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
8157
8331
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
@@ -8159,14 +8333,14 @@ _ts_decorate21([
8159
8333
  common.Post("verify-email"),
8160
8334
  _ts_param16(0, common.Body()),
8161
8335
  _ts_param16(1, common.Req()),
8162
- _ts_metadata20("design:type", Function),
8163
- _ts_metadata20("design:paramtypes", [
8336
+ _ts_metadata21("design:type", Function),
8337
+ _ts_metadata21("design:paramtypes", [
8164
8338
  typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
8165
8339
  typeof Request === "undefined" ? Object : Request
8166
8340
  ]),
8167
- _ts_metadata20("design:returntype", Promise)
8341
+ _ts_metadata21("design:returntype", Promise)
8168
8342
  ], AuthController.prototype, "verifyEmail", null);
8169
- _ts_decorate21([
8343
+ _ts_decorate22([
8170
8344
  Public(),
8171
8345
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
8172
8346
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
@@ -8174,29 +8348,29 @@ _ts_decorate21([
8174
8348
  common.Post("resend-verification"),
8175
8349
  _ts_param16(0, common.Body()),
8176
8350
  _ts_param16(1, common.Req()),
8177
- _ts_metadata20("design:type", Function),
8178
- _ts_metadata20("design:paramtypes", [
8351
+ _ts_metadata21("design:type", Function),
8352
+ _ts_metadata21("design:paramtypes", [
8179
8353
  typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
8180
8354
  typeof Request === "undefined" ? Object : Request
8181
8355
  ]),
8182
- _ts_metadata20("design:returntype", Promise)
8356
+ _ts_metadata21("design:returntype", Promise)
8183
8357
  ], AuthController.prototype, "resendVerification", null);
8184
- AuthController = _ts_decorate21([
8358
+ AuthController = _ts_decorate22([
8185
8359
  common.UseInterceptors(NoStoreInterceptor),
8186
8360
  common.Controller(),
8187
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8361
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8188
8362
  common.UsePipes(createAuthValidationPipe()),
8189
8363
  _ts_param16(0, common.Inject(exports.AuthService)),
8190
8364
  _ts_param16(1, common.Inject(exports.TokenDeliveryService)),
8191
8365
  _ts_param16(2, common.Inject(exports.WsTicketService)),
8192
- _ts_metadata20("design:type", Function),
8193
- _ts_metadata20("design:paramtypes", [
8366
+ _ts_metadata21("design:type", Function),
8367
+ _ts_metadata21("design:paramtypes", [
8194
8368
  typeof exports.AuthService === "undefined" ? Object : exports.AuthService,
8195
8369
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
8196
8370
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService
8197
8371
  ])
8198
8372
  ], AuthController);
8199
- function _ts_decorate22(decorators, target, key, desc) {
8373
+ function _ts_decorate23(decorators, target, key, desc) {
8200
8374
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8201
8375
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8202
8376
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8209,13 +8383,13 @@ function _ts_decorate22(decorators, target, key, desc) {
8209
8383
  }
8210
8384
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8211
8385
  }
8212
- __name(_ts_decorate22, "_ts_decorate");
8213
- function _ts_metadata21(metadataKey, metadataValue) {
8386
+ __name(_ts_decorate23, "_ts_decorate");
8387
+ function _ts_metadata22(metadataKey, metadataValue) {
8214
8388
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8215
8389
  return Reflect.metadata(metadataKey, metadataValue);
8216
8390
  }
8217
8391
  }
8218
- __name(_ts_metadata21, "_ts_metadata");
8392
+ __name(_ts_metadata22, "_ts_metadata");
8219
8393
  var ChangeEmailDto = class {
8220
8394
  static {
8221
8395
  __name(this, "ChangeEmailDto");
@@ -8235,20 +8409,20 @@ var ChangeEmailDto = class {
8235
8409
  */
8236
8410
  currentPassword;
8237
8411
  };
8238
- _ts_decorate22([
8412
+ _ts_decorate23([
8239
8413
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8240
8414
  classValidator.IsEmail(),
8241
8415
  classValidator.IsNotEmpty(),
8242
8416
  classValidator.MaxLength(255),
8243
- _ts_metadata21("design:type", String)
8417
+ _ts_metadata22("design:type", String)
8244
8418
  ], ChangeEmailDto.prototype, "newEmail", void 0);
8245
- _ts_decorate22([
8419
+ _ts_decorate23([
8246
8420
  classValidator.IsString(),
8247
8421
  classValidator.MinLength(1),
8248
8422
  classValidator.MaxLength(128),
8249
- _ts_metadata21("design:type", String)
8423
+ _ts_metadata22("design:type", String)
8250
8424
  ], ChangeEmailDto.prototype, "currentPassword", void 0);
8251
- function _ts_decorate23(decorators, target, key, desc) {
8425
+ function _ts_decorate24(decorators, target, key, desc) {
8252
8426
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8253
8427
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8254
8428
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8261,13 +8435,13 @@ function _ts_decorate23(decorators, target, key, desc) {
8261
8435
  }
8262
8436
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8263
8437
  }
8264
- __name(_ts_decorate23, "_ts_decorate");
8265
- function _ts_metadata22(metadataKey, metadataValue) {
8438
+ __name(_ts_decorate24, "_ts_decorate");
8439
+ function _ts_metadata23(metadataKey, metadataValue) {
8266
8440
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8267
8441
  return Reflect.metadata(metadataKey, metadataValue);
8268
8442
  }
8269
8443
  }
8270
- __name(_ts_metadata22, "_ts_metadata");
8444
+ __name(_ts_metadata23, "_ts_metadata");
8271
8445
  var ConfirmEmailChangeDto = class {
8272
8446
  static {
8273
8447
  __name(this, "ConfirmEmailChangeDto");
@@ -8280,13 +8454,13 @@ var ConfirmEmailChangeDto = class {
8280
8454
  */
8281
8455
  token;
8282
8456
  };
8283
- _ts_decorate23([
8457
+ _ts_decorate24([
8284
8458
  classValidator.IsString(),
8285
8459
  classValidator.IsNotEmpty(),
8286
8460
  classValidator.Length(64, 64),
8287
- _ts_metadata22("design:type", String)
8461
+ _ts_metadata23("design:type", String)
8288
8462
  ], ConfirmEmailChangeDto.prototype, "token", void 0);
8289
- function _ts_decorate24(decorators, target, key, desc) {
8463
+ function _ts_decorate25(decorators, target, key, desc) {
8290
8464
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8291
8465
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8292
8466
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8299,13 +8473,13 @@ function _ts_decorate24(decorators, target, key, desc) {
8299
8473
  }
8300
8474
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8301
8475
  }
8302
- __name(_ts_decorate24, "_ts_decorate");
8303
- function _ts_metadata23(metadataKey, metadataValue) {
8476
+ __name(_ts_decorate25, "_ts_decorate");
8477
+ function _ts_metadata24(metadataKey, metadataValue) {
8304
8478
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8305
8479
  return Reflect.metadata(metadataKey, metadataValue);
8306
8480
  }
8307
8481
  }
8308
- __name(_ts_metadata23, "_ts_metadata");
8482
+ __name(_ts_metadata24, "_ts_metadata");
8309
8483
  function _ts_param17(paramIndex, decorator) {
8310
8484
  return function(target, key) {
8311
8485
  decorator(target, key, paramIndex);
@@ -8543,7 +8717,7 @@ exports.EmailChangeService = class _EmailChangeService {
8543
8717
  }
8544
8718
  }
8545
8719
  };
8546
- exports.EmailChangeService = _ts_decorate24([
8720
+ exports.EmailChangeService = _ts_decorate25([
8547
8721
  common.Injectable(),
8548
8722
  _ts_param17(0, common.Inject(BYMAX_AUTH_OPTIONS)),
8549
8723
  _ts_param17(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -8551,8 +8725,8 @@ exports.EmailChangeService = _ts_decorate24([
8551
8725
  _ts_param17(3, common.Inject(PasswordService)),
8552
8726
  _ts_param17(4, common.Inject(AuthRedisService)),
8553
8727
  _ts_param17(5, common.Inject(exports.BruteForceService)),
8554
- _ts_metadata23("design:type", Function),
8555
- _ts_metadata23("design:paramtypes", [
8728
+ _ts_metadata24("design:type", Function),
8729
+ _ts_metadata24("design:paramtypes", [
8556
8730
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
8557
8731
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
8558
8732
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
@@ -8563,7 +8737,7 @@ exports.EmailChangeService = _ts_decorate24([
8563
8737
  ], exports.EmailChangeService);
8564
8738
 
8565
8739
  // src/server/controllers/email-change.controller.ts
8566
- function _ts_decorate25(decorators, target, key, desc) {
8740
+ function _ts_decorate26(decorators, target, key, desc) {
8567
8741
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8568
8742
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8569
8743
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8576,13 +8750,13 @@ function _ts_decorate25(decorators, target, key, desc) {
8576
8750
  }
8577
8751
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8578
8752
  }
8579
- __name(_ts_decorate25, "_ts_decorate");
8580
- function _ts_metadata24(metadataKey, metadataValue) {
8753
+ __name(_ts_decorate26, "_ts_decorate");
8754
+ function _ts_metadata25(metadataKey, metadataValue) {
8581
8755
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8582
8756
  return Reflect.metadata(metadataKey, metadataValue);
8583
8757
  }
8584
8758
  }
8585
- __name(_ts_metadata24, "_ts_metadata");
8759
+ __name(_ts_metadata25, "_ts_metadata");
8586
8760
  function _ts_param18(paramIndex, decorator) {
8587
8761
  return function(target, key) {
8588
8762
  decorator(target, key, paramIndex);
@@ -8635,7 +8809,7 @@ var EmailChangeController = class {
8635
8809
  await this.emailChangeService.confirmChange(dto);
8636
8810
  }
8637
8811
  };
8638
- _ts_decorate25([
8812
+ _ts_decorate26([
8639
8813
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
8640
8814
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
8641
8815
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
@@ -8643,38 +8817,38 @@ _ts_decorate25([
8643
8817
  common.Post("change"),
8644
8818
  _ts_param18(0, common.Body()),
8645
8819
  _ts_param18(1, CurrentUser()),
8646
- _ts_metadata24("design:type", Function),
8647
- _ts_metadata24("design:paramtypes", [
8820
+ _ts_metadata25("design:type", Function),
8821
+ _ts_metadata25("design:paramtypes", [
8648
8822
  typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
8649
8823
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8650
8824
  ]),
8651
- _ts_metadata24("design:returntype", Promise)
8825
+ _ts_metadata25("design:returntype", Promise)
8652
8826
  ], EmailChangeController.prototype, "requestChange", null);
8653
- _ts_decorate25([
8827
+ _ts_decorate26([
8654
8828
  Public(),
8655
8829
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
8656
8830
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
8657
8831
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8658
8832
  common.Post("change/confirm"),
8659
8833
  _ts_param18(0, common.Body()),
8660
- _ts_metadata24("design:type", Function),
8661
- _ts_metadata24("design:paramtypes", [
8834
+ _ts_metadata25("design:type", Function),
8835
+ _ts_metadata25("design:paramtypes", [
8662
8836
  typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
8663
8837
  ]),
8664
- _ts_metadata24("design:returntype", Promise)
8838
+ _ts_metadata25("design:returntype", Promise)
8665
8839
  ], EmailChangeController.prototype, "confirmChange", null);
8666
- EmailChangeController = _ts_decorate25([
8840
+ EmailChangeController = _ts_decorate26([
8667
8841
  common.UseInterceptors(NoStoreInterceptor),
8668
8842
  common.Controller("email"),
8669
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8843
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8670
8844
  common.UsePipes(createAuthValidationPipe()),
8671
8845
  _ts_param18(0, common.Inject(exports.EmailChangeService)),
8672
- _ts_metadata24("design:type", Function),
8673
- _ts_metadata24("design:paramtypes", [
8846
+ _ts_metadata25("design:type", Function),
8847
+ _ts_metadata25("design:paramtypes", [
8674
8848
  typeof exports.EmailChangeService === "undefined" ? Object : exports.EmailChangeService
8675
8849
  ])
8676
8850
  ], EmailChangeController);
8677
- function _ts_decorate26(decorators, target, key, desc) {
8851
+ function _ts_decorate27(decorators, target, key, desc) {
8678
8852
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8679
8853
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8680
8854
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8687,13 +8861,13 @@ function _ts_decorate26(decorators, target, key, desc) {
8687
8861
  }
8688
8862
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8689
8863
  }
8690
- __name(_ts_decorate26, "_ts_decorate");
8691
- function _ts_metadata25(metadataKey, metadataValue) {
8864
+ __name(_ts_decorate27, "_ts_decorate");
8865
+ function _ts_metadata26(metadataKey, metadataValue) {
8692
8866
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8693
8867
  return Reflect.metadata(metadataKey, metadataValue);
8694
8868
  }
8695
8869
  }
8696
- __name(_ts_metadata25, "_ts_metadata");
8870
+ __name(_ts_metadata26, "_ts_metadata");
8697
8871
  var AcceptInvitationDto = class {
8698
8872
  static {
8699
8873
  __name(this, "AcceptInvitationDto");
@@ -8732,24 +8906,24 @@ var AcceptInvitationDto = class {
8732
8906
  */
8733
8907
  password;
8734
8908
  };
8735
- _ts_decorate26([
8909
+ _ts_decorate27([
8736
8910
  classValidator.IsString(),
8737
8911
  classValidator.IsNotEmpty(),
8738
8912
  classValidator.Length(64, 64),
8739
- _ts_metadata25("design:type", String)
8913
+ _ts_metadata26("design:type", String)
8740
8914
  ], AcceptInvitationDto.prototype, "token", void 0);
8741
- _ts_decorate26([
8915
+ _ts_decorate27([
8742
8916
  classValidator.IsString(),
8743
8917
  classValidator.IsNotEmpty(),
8744
8918
  classValidator.Length(2, 100),
8745
- _ts_metadata25("design:type", String)
8919
+ _ts_metadata26("design:type", String)
8746
8920
  ], AcceptInvitationDto.prototype, "name", void 0);
8747
- _ts_decorate26([
8921
+ _ts_decorate27([
8748
8922
  classValidator.IsString(),
8749
8923
  classValidator.Length(8, 128),
8750
- _ts_metadata25("design:type", String)
8924
+ _ts_metadata26("design:type", String)
8751
8925
  ], AcceptInvitationDto.prototype, "password", void 0);
8752
- function _ts_decorate27(decorators, target, key, desc) {
8926
+ function _ts_decorate28(decorators, target, key, desc) {
8753
8927
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8754
8928
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8755
8929
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8762,13 +8936,13 @@ function _ts_decorate27(decorators, target, key, desc) {
8762
8936
  }
8763
8937
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8764
8938
  }
8765
- __name(_ts_decorate27, "_ts_decorate");
8766
- function _ts_metadata26(metadataKey, metadataValue) {
8939
+ __name(_ts_decorate28, "_ts_decorate");
8940
+ function _ts_metadata27(metadataKey, metadataValue) {
8767
8941
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8768
8942
  return Reflect.metadata(metadataKey, metadataValue);
8769
8943
  }
8770
8944
  }
8771
- __name(_ts_metadata26, "_ts_metadata");
8945
+ __name(_ts_metadata27, "_ts_metadata");
8772
8946
  var CreateInvitationDto = class {
8773
8947
  static {
8774
8948
  __name(this, "CreateInvitationDto");
@@ -8799,27 +8973,27 @@ var CreateInvitationDto = class {
8799
8973
  */
8800
8974
  tenantName;
8801
8975
  };
8802
- _ts_decorate27([
8976
+ _ts_decorate28([
8803
8977
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8804
8978
  classValidator.IsEmail(),
8805
8979
  classValidator.IsNotEmpty(),
8806
8980
  classValidator.MaxLength(255),
8807
- _ts_metadata26("design:type", String)
8981
+ _ts_metadata27("design:type", String)
8808
8982
  ], CreateInvitationDto.prototype, "email", void 0);
8809
- _ts_decorate27([
8983
+ _ts_decorate28([
8810
8984
  classValidator.IsString(),
8811
8985
  classValidator.IsNotEmpty(),
8812
8986
  classValidator.MaxLength(64),
8813
- _ts_metadata26("design:type", String)
8987
+ _ts_metadata27("design:type", String)
8814
8988
  ], CreateInvitationDto.prototype, "role", void 0);
8815
- _ts_decorate27([
8989
+ _ts_decorate28([
8816
8990
  classValidator.IsOptional(),
8817
8991
  classValidator.IsString(),
8818
8992
  classValidator.IsNotEmpty(),
8819
8993
  classValidator.MaxLength(128),
8820
- _ts_metadata26("design:type", String)
8994
+ _ts_metadata27("design:type", String)
8821
8995
  ], CreateInvitationDto.prototype, "tenantName", void 0);
8822
- function _ts_decorate28(decorators, target, key, desc) {
8996
+ function _ts_decorate29(decorators, target, key, desc) {
8823
8997
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8824
8998
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8825
8999
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8832,13 +9006,13 @@ function _ts_decorate28(decorators, target, key, desc) {
8832
9006
  }
8833
9007
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8834
9008
  }
8835
- __name(_ts_decorate28, "_ts_decorate");
8836
- function _ts_metadata27(metadataKey, metadataValue) {
9009
+ __name(_ts_decorate29, "_ts_decorate");
9010
+ function _ts_metadata28(metadataKey, metadataValue) {
8837
9011
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8838
9012
  return Reflect.metadata(metadataKey, metadataValue);
8839
9013
  }
8840
9014
  }
8841
- __name(_ts_metadata27, "_ts_metadata");
9015
+ __name(_ts_metadata28, "_ts_metadata");
8842
9016
  var RevokeInvitationDto = class {
8843
9017
  static {
8844
9018
  __name(this, "RevokeInvitationDto");
@@ -8850,14 +9024,14 @@ var RevokeInvitationDto = class {
8850
9024
  */
8851
9025
  email;
8852
9026
  };
8853
- _ts_decorate28([
9027
+ _ts_decorate29([
8854
9028
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8855
9029
  classValidator.IsEmail(),
8856
9030
  classValidator.IsNotEmpty(),
8857
9031
  classValidator.MaxLength(255),
8858
- _ts_metadata27("design:type", String)
9032
+ _ts_metadata28("design:type", String)
8859
9033
  ], RevokeInvitationDto.prototype, "email", void 0);
8860
- function _ts_decorate29(decorators, target, key, desc) {
9034
+ function _ts_decorate30(decorators, target, key, desc) {
8861
9035
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8862
9036
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8863
9037
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8870,13 +9044,13 @@ function _ts_decorate29(decorators, target, key, desc) {
8870
9044
  }
8871
9045
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8872
9046
  }
8873
- __name(_ts_decorate29, "_ts_decorate");
8874
- function _ts_metadata28(metadataKey, metadataValue) {
9047
+ __name(_ts_decorate30, "_ts_decorate");
9048
+ function _ts_metadata29(metadataKey, metadataValue) {
8875
9049
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8876
9050
  return Reflect.metadata(metadataKey, metadataValue);
8877
9051
  }
8878
9052
  }
8879
- __name(_ts_metadata28, "_ts_metadata");
9053
+ __name(_ts_metadata29, "_ts_metadata");
8880
9054
  function _ts_param19(paramIndex, decorator) {
8881
9055
  return function(target, key) {
8882
9056
  decorator(target, key, paramIndex);
@@ -9359,7 +9533,7 @@ exports.InvitationService = class _InvitationService {
9359
9533
  return result;
9360
9534
  }
9361
9535
  };
9362
- exports.InvitationService = _ts_decorate29([
9536
+ exports.InvitationService = _ts_decorate30([
9363
9537
  common.Injectable(),
9364
9538
  _ts_param19(0, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
9365
9539
  _ts_param19(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
@@ -9369,8 +9543,8 @@ exports.InvitationService = _ts_decorate29([
9369
9543
  _ts_param19(5, common.Inject(exports.SessionService)),
9370
9544
  _ts_param19(6, common.Inject(TokenManagerService)),
9371
9545
  _ts_param19(7, common.Inject(BYMAX_AUTH_OPTIONS)),
9372
- _ts_metadata28("design:type", Function),
9373
- _ts_metadata28("design:paramtypes", [
9546
+ _ts_metadata29("design:type", Function),
9547
+ _ts_metadata29("design:paramtypes", [
9374
9548
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
9375
9549
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
9376
9550
  typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
@@ -9383,7 +9557,7 @@ exports.InvitationService = _ts_decorate29([
9383
9557
  ], exports.InvitationService);
9384
9558
 
9385
9559
  // src/server/controllers/invitation.controller.ts
9386
- function _ts_decorate30(decorators, target, key, desc) {
9560
+ function _ts_decorate31(decorators, target, key, desc) {
9387
9561
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9388
9562
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9389
9563
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9396,13 +9570,13 @@ function _ts_decorate30(decorators, target, key, desc) {
9396
9570
  }
9397
9571
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9398
9572
  }
9399
- __name(_ts_decorate30, "_ts_decorate");
9400
- function _ts_metadata29(metadataKey, metadataValue) {
9573
+ __name(_ts_decorate31, "_ts_decorate");
9574
+ function _ts_metadata30(metadataKey, metadataValue) {
9401
9575
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9402
9576
  return Reflect.metadata(metadataKey, metadataValue);
9403
9577
  }
9404
9578
  }
9405
- __name(_ts_metadata29, "_ts_metadata");
9579
+ __name(_ts_metadata30, "_ts_metadata");
9406
9580
  function _ts_param20(paramIndex, decorator) {
9407
9581
  return function(target, key) {
9408
9582
  decorator(target, key, paramIndex);
@@ -9484,7 +9658,7 @@ var InvitationController = class {
9484
9658
  return this.tokenDelivery.deliverAuthResponse(res, result, req);
9485
9659
  }
9486
9660
  };
9487
- _ts_decorate30([
9661
+ _ts_decorate31([
9488
9662
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
9489
9663
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
9490
9664
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
@@ -9492,14 +9666,14 @@ _ts_decorate30([
9492
9666
  common.Post(),
9493
9667
  _ts_param20(0, common.Body()),
9494
9668
  _ts_param20(1, CurrentUser()),
9495
- _ts_metadata29("design:type", Function),
9496
- _ts_metadata29("design:paramtypes", [
9669
+ _ts_metadata30("design:type", Function),
9670
+ _ts_metadata30("design:paramtypes", [
9497
9671
  typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
9498
9672
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
9499
9673
  ]),
9500
- _ts_metadata29("design:returntype", Promise)
9674
+ _ts_metadata30("design:returntype", Promise)
9501
9675
  ], InvitationController.prototype, "invite", null);
9502
- _ts_decorate30([
9676
+ _ts_decorate31([
9503
9677
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
9504
9678
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
9505
9679
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
@@ -9507,14 +9681,14 @@ _ts_decorate30([
9507
9681
  common.Post("revoke"),
9508
9682
  _ts_param20(0, common.Body()),
9509
9683
  _ts_param20(1, CurrentUser()),
9510
- _ts_metadata29("design:type", Function),
9511
- _ts_metadata29("design:paramtypes", [
9684
+ _ts_metadata30("design:type", Function),
9685
+ _ts_metadata30("design:paramtypes", [
9512
9686
  typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
9513
9687
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
9514
9688
  ]),
9515
- _ts_metadata29("design:returntype", Promise)
9689
+ _ts_metadata30("design:returntype", Promise)
9516
9690
  ], InvitationController.prototype, "revoke", null);
9517
- _ts_decorate30([
9691
+ _ts_decorate31([
9518
9692
  Public(),
9519
9693
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
9520
9694
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
@@ -9525,23 +9699,23 @@ _ts_decorate30([
9525
9699
  _ts_param20(2, common.Res({
9526
9700
  passthrough: true
9527
9701
  })),
9528
- _ts_metadata29("design:type", Function),
9529
- _ts_metadata29("design:paramtypes", [
9702
+ _ts_metadata30("design:type", Function),
9703
+ _ts_metadata30("design:paramtypes", [
9530
9704
  typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
9531
9705
  typeof Request === "undefined" ? Object : Request,
9532
9706
  typeof Response === "undefined" ? Object : Response
9533
9707
  ]),
9534
- _ts_metadata29("design:returntype", Promise)
9708
+ _ts_metadata30("design:returntype", Promise)
9535
9709
  ], InvitationController.prototype, "accept", null);
9536
- InvitationController = _ts_decorate30([
9710
+ InvitationController = _ts_decorate31([
9537
9711
  common.UseInterceptors(NoStoreInterceptor),
9538
9712
  common.Controller("invitations"),
9539
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9713
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9540
9714
  common.UsePipes(createAuthValidationPipe()),
9541
9715
  _ts_param20(0, common.Inject(exports.InvitationService)),
9542
9716
  _ts_param20(1, common.Inject(exports.TokenDeliveryService)),
9543
- _ts_metadata29("design:type", Function),
9544
- _ts_metadata29("design:paramtypes", [
9717
+ _ts_metadata30("design:type", Function),
9718
+ _ts_metadata30("design:paramtypes", [
9545
9719
  typeof exports.InvitationService === "undefined" ? Object : exports.InvitationService,
9546
9720
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
9547
9721
  ])
@@ -9552,7 +9726,7 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
9552
9726
  var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
9553
9727
  var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
9554
9728
  var SkipMfa = /* @__PURE__ */ __name(() => common.SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
9555
- function _ts_decorate31(decorators, target, key, desc) {
9729
+ function _ts_decorate32(decorators, target, key, desc) {
9556
9730
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9557
9731
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9558
9732
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9565,13 +9739,13 @@ function _ts_decorate31(decorators, target, key, desc) {
9565
9739
  }
9566
9740
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9567
9741
  }
9568
- __name(_ts_decorate31, "_ts_decorate");
9569
- function _ts_metadata30(metadataKey, metadataValue) {
9742
+ __name(_ts_decorate32, "_ts_decorate");
9743
+ function _ts_metadata31(metadataKey, metadataValue) {
9570
9744
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9571
9745
  return Reflect.metadata(metadataKey, metadataValue);
9572
9746
  }
9573
9747
  }
9574
- __name(_ts_metadata30, "_ts_metadata");
9748
+ __name(_ts_metadata31, "_ts_metadata");
9575
9749
  var MfaChallengeDto = class {
9576
9750
  static {
9577
9751
  __name(this, "MfaChallengeDto");
@@ -9607,23 +9781,23 @@ var MfaChallengeDto = class {
9607
9781
  */
9608
9782
  code;
9609
9783
  };
9610
- _ts_decorate31([
9784
+ _ts_decorate32([
9611
9785
  classValidator.IsOptional(),
9612
9786
  classValidator.IsString(),
9613
9787
  classValidator.IsNotEmpty(),
9614
9788
  classValidator.MaxLength(512),
9615
- _ts_metadata30("design:type", String)
9789
+ _ts_metadata31("design:type", String)
9616
9790
  ], MfaChallengeDto.prototype, "mfaTempToken", void 0);
9617
- _ts_decorate31([
9791
+ _ts_decorate32([
9618
9792
  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})$/, {
9619
9793
  message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
9620
9794
  }),
9621
9795
  classValidator.IsString(),
9622
9796
  classValidator.IsNotEmpty(),
9623
9797
  classValidator.MaxLength(29),
9624
- _ts_metadata30("design:type", String)
9798
+ _ts_metadata31("design:type", String)
9625
9799
  ], MfaChallengeDto.prototype, "code", void 0);
9626
- function _ts_decorate32(decorators, target, key, desc) {
9800
+ function _ts_decorate33(decorators, target, key, desc) {
9627
9801
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9628
9802
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9629
9803
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9636,13 +9810,13 @@ function _ts_decorate32(decorators, target, key, desc) {
9636
9810
  }
9637
9811
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9638
9812
  }
9639
- __name(_ts_decorate32, "_ts_decorate");
9640
- function _ts_metadata31(metadataKey, metadataValue) {
9813
+ __name(_ts_decorate33, "_ts_decorate");
9814
+ function _ts_metadata32(metadataKey, metadataValue) {
9641
9815
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9642
9816
  return Reflect.metadata(metadataKey, metadataValue);
9643
9817
  }
9644
9818
  }
9645
- __name(_ts_metadata31, "_ts_metadata");
9819
+ __name(_ts_metadata32, "_ts_metadata");
9646
9820
  var MfaDisableDto = class {
9647
9821
  static {
9648
9822
  __name(this, "MfaDisableDto");
@@ -9656,16 +9830,16 @@ var MfaDisableDto = class {
9656
9830
  */
9657
9831
  code;
9658
9832
  };
9659
- _ts_decorate32([
9833
+ _ts_decorate33([
9660
9834
  classValidator.MaxLength(6),
9661
9835
  classValidator.Matches(/^\d{6}$/, {
9662
9836
  message: "code must be exactly 6 digits"
9663
9837
  }),
9664
9838
  classValidator.IsString(),
9665
9839
  classValidator.IsNotEmpty(),
9666
- _ts_metadata31("design:type", String)
9840
+ _ts_metadata32("design:type", String)
9667
9841
  ], MfaDisableDto.prototype, "code", void 0);
9668
- function _ts_decorate33(decorators, target, key, desc) {
9842
+ function _ts_decorate34(decorators, target, key, desc) {
9669
9843
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9670
9844
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9671
9845
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9678,13 +9852,13 @@ function _ts_decorate33(decorators, target, key, desc) {
9678
9852
  }
9679
9853
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9680
9854
  }
9681
- __name(_ts_decorate33, "_ts_decorate");
9682
- function _ts_metadata32(metadataKey, metadataValue) {
9855
+ __name(_ts_decorate34, "_ts_decorate");
9856
+ function _ts_metadata33(metadataKey, metadataValue) {
9683
9857
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9684
9858
  return Reflect.metadata(metadataKey, metadataValue);
9685
9859
  }
9686
9860
  }
9687
- __name(_ts_metadata32, "_ts_metadata");
9861
+ __name(_ts_metadata33, "_ts_metadata");
9688
9862
  var MfaRegenerateRecoveryCodesDto = class {
9689
9863
  static {
9690
9864
  __name(this, "MfaRegenerateRecoveryCodesDto");
@@ -9698,16 +9872,16 @@ var MfaRegenerateRecoveryCodesDto = class {
9698
9872
  */
9699
9873
  code;
9700
9874
  };
9701
- _ts_decorate33([
9875
+ _ts_decorate34([
9702
9876
  classValidator.MaxLength(6),
9703
9877
  classValidator.Matches(/^\d{6}$/, {
9704
9878
  message: "code must be exactly 6 digits"
9705
9879
  }),
9706
9880
  classValidator.IsString(),
9707
9881
  classValidator.IsNotEmpty(),
9708
- _ts_metadata32("design:type", String)
9882
+ _ts_metadata33("design:type", String)
9709
9883
  ], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
9710
- function _ts_decorate34(decorators, target, key, desc) {
9884
+ function _ts_decorate35(decorators, target, key, desc) {
9711
9885
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9712
9886
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9713
9887
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9720,13 +9894,13 @@ function _ts_decorate34(decorators, target, key, desc) {
9720
9894
  }
9721
9895
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9722
9896
  }
9723
- __name(_ts_decorate34, "_ts_decorate");
9724
- function _ts_metadata33(metadataKey, metadataValue) {
9897
+ __name(_ts_decorate35, "_ts_decorate");
9898
+ function _ts_metadata34(metadataKey, metadataValue) {
9725
9899
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9726
9900
  return Reflect.metadata(metadataKey, metadataValue);
9727
9901
  }
9728
9902
  }
9729
- __name(_ts_metadata33, "_ts_metadata");
9903
+ __name(_ts_metadata34, "_ts_metadata");
9730
9904
  var MfaSetupDto = class {
9731
9905
  static {
9732
9906
  __name(this, "MfaSetupDto");
@@ -9750,14 +9924,14 @@ var MfaSetupDto = class {
9750
9924
  */
9751
9925
  password;
9752
9926
  };
9753
- _ts_decorate34([
9927
+ _ts_decorate35([
9754
9928
  classValidator.IsOptional(),
9755
9929
  classValidator.IsString(),
9756
9930
  classValidator.MinLength(1),
9757
9931
  classValidator.MaxLength(128),
9758
- _ts_metadata33("design:type", String)
9932
+ _ts_metadata34("design:type", String)
9759
9933
  ], MfaSetupDto.prototype, "password", void 0);
9760
- function _ts_decorate35(decorators, target, key, desc) {
9934
+ function _ts_decorate36(decorators, target, key, desc) {
9761
9935
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9762
9936
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9763
9937
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9770,13 +9944,13 @@ function _ts_decorate35(decorators, target, key, desc) {
9770
9944
  }
9771
9945
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9772
9946
  }
9773
- __name(_ts_decorate35, "_ts_decorate");
9774
- function _ts_metadata34(metadataKey, metadataValue) {
9947
+ __name(_ts_decorate36, "_ts_decorate");
9948
+ function _ts_metadata35(metadataKey, metadataValue) {
9775
9949
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9776
9950
  return Reflect.metadata(metadataKey, metadataValue);
9777
9951
  }
9778
9952
  }
9779
- __name(_ts_metadata34, "_ts_metadata");
9953
+ __name(_ts_metadata35, "_ts_metadata");
9780
9954
  var MfaVerifyDto = class {
9781
9955
  static {
9782
9956
  __name(this, "MfaVerifyDto");
@@ -9789,14 +9963,14 @@ var MfaVerifyDto = class {
9789
9963
  */
9790
9964
  code;
9791
9965
  };
9792
- _ts_decorate35([
9966
+ _ts_decorate36([
9793
9967
  classValidator.MaxLength(6),
9794
9968
  classValidator.Matches(/^\d{6}$/, {
9795
9969
  message: "code must be exactly 6 digits"
9796
9970
  }),
9797
9971
  classValidator.IsString(),
9798
9972
  classValidator.IsNotEmpty(),
9799
- _ts_metadata34("design:type", String)
9973
+ _ts_metadata35("design:type", String)
9800
9974
  ], MfaVerifyDto.prototype, "code", void 0);
9801
9975
  var IV_LENGTH = 12;
9802
9976
  var AUTH_TAG_BYTE_LENGTH = 16;
@@ -9860,7 +10034,7 @@ function runDetached(logger, run, failure) {
9860
10034
  __name(runDetached, "runDetached");
9861
10035
 
9862
10036
  // src/server/services/mfa.service.ts
9863
- function _ts_decorate36(decorators, target, key, desc) {
10037
+ function _ts_decorate37(decorators, target, key, desc) {
9864
10038
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9865
10039
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9866
10040
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9873,13 +10047,13 @@ function _ts_decorate36(decorators, target, key, desc) {
9873
10047
  }
9874
10048
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9875
10049
  }
9876
- __name(_ts_decorate36, "_ts_decorate");
9877
- function _ts_metadata35(metadataKey, metadataValue) {
10050
+ __name(_ts_decorate37, "_ts_decorate");
10051
+ function _ts_metadata36(metadataKey, metadataValue) {
9878
10052
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9879
10053
  return Reflect.metadata(metadataKey, metadataValue);
9880
10054
  }
9881
10055
  }
9882
- __name(_ts_metadata35, "_ts_metadata");
10056
+ __name(_ts_metadata36, "_ts_metadata");
9883
10057
  function _ts_param21(paramIndex, decorator) {
9884
10058
  return function(target, key) {
9885
10059
  decorator(target, key, paramIndex);
@@ -9961,29 +10135,28 @@ exports.MfaService = class _MfaService {
9961
10135
  * Detached from the challenge it follows: the user is already authenticated and the retired
9962
10136
  * key still opens the secret, so a failure here costs the migration and nothing else.
9963
10137
  *
10138
+ * The write replaces the whole MFA record, so it runs as a serialized transition and lands only
10139
+ * on a record that still holds this secret. One that no longer does was disabled or re-enrolled
10140
+ * since, and writing the re-encrypted old secret over it would restore a factor the user removed
10141
+ * and unspend the recovery codes they replaced. The comparison is on the decrypted secret, not
10142
+ * the ciphertext: a sibling challenge that only re-encrypted the same secret changes the
10143
+ * ciphertext and nothing else, and must not be mistaken for a re-enrolment.
10144
+ *
9964
10145
  * @param userId - The account whose stored secret is being re-encrypted.
9965
10146
  * @param context - Which identity plane the account belongs to.
9966
10147
  * @param secretBase32 - The decrypted secret.
9967
- * @param recoveryCodes - The stored recovery digests, written back unchanged.
9968
10148
  * @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
9969
10149
  */
9970
- async reencryptSecret(userId, context, secretBase32, recoveryCodes, tenantId) {
9971
- const update = {
9972
- mfaEnabled: true,
9973
- mfaSecret: this.encryptSecret(secretBase32),
9974
- mfaRecoveryCodes: recoveryCodes
9975
- };
10150
+ async reencryptSecret(userId, context, secretBase32, tenantId) {
9976
10151
  try {
9977
- if (context === "platform" && this.platformUserRepo) {
9978
- await this.platformUserRepo.updateMfa(userId, update);
9979
- } else {
9980
- this.assertDashboardTenant(tenantId);
9981
- await this.userRepo.updateMfa({
9982
- id: userId,
9983
- tenantId,
9984
- data: update
9985
- });
9986
- }
10152
+ await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10153
+ if (!current.mfaEnabled || !this.holdsSecret(current.mfaSecret, secretBase32)) return null;
10154
+ return {
10155
+ mfaEnabled: true,
10156
+ mfaSecret: this.encryptSecret(secretBase32),
10157
+ mfaRecoveryCodes: current.mfaRecoveryCodes ?? []
10158
+ };
10159
+ });
9987
10160
  } catch (err) {
9988
10161
  this.logger.error(`re-encryption under the current MFA key failed: ${describeChannelStatus(err)}`);
9989
10162
  }
@@ -10077,6 +10250,20 @@ exports.MfaService = class _MfaService {
10077
10250
  }
10078
10251
  }
10079
10252
  /**
10253
+ * Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
10254
+ *
10255
+ * Compares plaintext, so a record that was only re-encrypted still matches and one holding a
10256
+ * different secret does not. A ciphertext no key opens does not match either.
10257
+ */
10258
+ holdsSecret(stored, secretBase32) {
10259
+ if (!stored) return false;
10260
+ try {
10261
+ return timingSafeCompare(this.decryptWithRotation(stored).secret, secretBase32);
10262
+ } catch {
10263
+ return false;
10264
+ }
10265
+ }
10266
+ /**
10080
10267
  * Encrypts a TOTP secret for storage in the database using AES-256-GCM.
10081
10268
  */
10082
10269
  encryptSecret(secret) {
@@ -10527,6 +10714,7 @@ exports.MfaService = class _MfaService {
10527
10714
  [];
10528
10715
  await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10529
10716
  if (!current.mfaEnabled) return null;
10717
+ if (!this.holdsSecret(current.mfaSecret, secretBase32)) return null;
10530
10718
  const currentCodes = current.mfaRecoveryCodes ?? [];
10531
10719
  const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
10532
10720
  const liveIndex = currentCodes.indexOf(spentDigest);
@@ -10544,7 +10732,7 @@ exports.MfaService = class _MfaService {
10544
10732
  };
10545
10733
  });
10546
10734
  } else if (encryptedUnderRetiredKey) {
10547
- void this.reencryptSecret(userId, context, secretBase32, user.mfaRecoveryCodes ?? [], tenantId);
10735
+ void this.reencryptSecret(userId, context, secretBase32, tenantId);
10548
10736
  }
10549
10737
  this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
10550
10738
  if (context === "dashboard") {
@@ -11109,7 +11297,7 @@ exports.MfaService = class _MfaService {
11109
11297
  return admin;
11110
11298
  }
11111
11299
  };
11112
- exports.MfaService = _ts_decorate36([
11300
+ exports.MfaService = _ts_decorate37([
11113
11301
  common.Injectable(),
11114
11302
  _ts_param21(0, common.Inject(BYMAX_AUTH_OPTIONS)),
11115
11303
  _ts_param21(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -11122,8 +11310,8 @@ exports.MfaService = _ts_decorate36([
11122
11310
  _ts_param21(7, common.Inject(exports.SessionService)),
11123
11311
  _ts_param21(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
11124
11312
  _ts_param21(9, common.Inject(BYMAX_AUTH_HOOKS)),
11125
- _ts_metadata35("design:type", Function),
11126
- _ts_metadata35("design:paramtypes", [
11313
+ _ts_metadata36("design:type", Function),
11314
+ _ts_metadata36("design:paramtypes", [
11127
11315
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
11128
11316
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
11129
11317
  Object,
@@ -11138,7 +11326,7 @@ exports.MfaService = _ts_decorate36([
11138
11326
  ], exports.MfaService);
11139
11327
 
11140
11328
  // src/server/controllers/mfa.controller.ts
11141
- function _ts_decorate37(decorators, target, key, desc) {
11329
+ function _ts_decorate38(decorators, target, key, desc) {
11142
11330
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11143
11331
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11144
11332
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11151,13 +11339,13 @@ function _ts_decorate37(decorators, target, key, desc) {
11151
11339
  }
11152
11340
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11153
11341
  }
11154
- __name(_ts_decorate37, "_ts_decorate");
11155
- function _ts_metadata36(metadataKey, metadataValue) {
11342
+ __name(_ts_decorate38, "_ts_decorate");
11343
+ function _ts_metadata37(metadataKey, metadataValue) {
11156
11344
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11157
11345
  return Reflect.metadata(metadataKey, metadataValue);
11158
11346
  }
11159
11347
  }
11160
- __name(_ts_metadata36, "_ts_metadata");
11348
+ __name(_ts_metadata37, "_ts_metadata");
11161
11349
  function _ts_param22(paramIndex, decorator) {
11162
11350
  return function(target, key) {
11163
11351
  decorator(target, key, paramIndex);
@@ -11352,21 +11540,22 @@ var MfaController = class {
11352
11540
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
11353
11541
  }
11354
11542
  };
11355
- _ts_decorate37([
11543
+ _ts_decorate38([
11356
11544
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11357
11545
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
11358
11546
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
11547
+ RequestEncoding("when-body"),
11359
11548
  common.Post("setup"),
11360
11549
  _ts_param22(0, CurrentUser()),
11361
11550
  _ts_param22(1, common.Body()),
11362
- _ts_metadata36("design:type", Function),
11363
- _ts_metadata36("design:paramtypes", [
11551
+ _ts_metadata37("design:type", Function),
11552
+ _ts_metadata37("design:paramtypes", [
11364
11553
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11365
11554
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
11366
11555
  ]),
11367
- _ts_metadata36("design:returntype", Promise)
11556
+ _ts_metadata37("design:returntype", Promise)
11368
11557
  ], MfaController.prototype, "setup", null);
11369
- _ts_decorate37([
11558
+ _ts_decorate38([
11370
11559
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11371
11560
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11372
11561
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
@@ -11375,15 +11564,15 @@ _ts_decorate37([
11375
11564
  _ts_param22(0, CurrentUser()),
11376
11565
  _ts_param22(1, common.Body()),
11377
11566
  _ts_param22(2, common.Req()),
11378
- _ts_metadata36("design:type", Function),
11379
- _ts_metadata36("design:paramtypes", [
11567
+ _ts_metadata37("design:type", Function),
11568
+ _ts_metadata37("design:paramtypes", [
11380
11569
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11381
11570
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
11382
11571
  typeof Request === "undefined" ? Object : Request
11383
11572
  ]),
11384
- _ts_metadata36("design:returntype", Promise)
11573
+ _ts_metadata37("design:returntype", Promise)
11385
11574
  ], MfaController.prototype, "verifyEnable", null);
11386
- _ts_decorate37([
11575
+ _ts_decorate38([
11387
11576
  Public(),
11388
11577
  SkipMfa(),
11389
11578
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
@@ -11395,15 +11584,15 @@ _ts_decorate37([
11395
11584
  _ts_param22(2, common.Res({
11396
11585
  passthrough: true
11397
11586
  })),
11398
- _ts_metadata36("design:type", Function),
11399
- _ts_metadata36("design:paramtypes", [
11587
+ _ts_metadata37("design:type", Function),
11588
+ _ts_metadata37("design:paramtypes", [
11400
11589
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
11401
11590
  typeof Request === "undefined" ? Object : Request,
11402
11591
  typeof Response === "undefined" ? Object : Response
11403
11592
  ]),
11404
- _ts_metadata36("design:returntype", Promise)
11593
+ _ts_metadata37("design:returntype", Promise)
11405
11594
  ], MfaController.prototype, "challenge", null);
11406
- _ts_decorate37([
11595
+ _ts_decorate38([
11407
11596
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11408
11597
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11409
11598
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -11412,15 +11601,15 @@ _ts_decorate37([
11412
11601
  _ts_param22(0, CurrentUser()),
11413
11602
  _ts_param22(1, common.Body()),
11414
11603
  _ts_param22(2, common.Req()),
11415
- _ts_metadata36("design:type", Function),
11416
- _ts_metadata36("design:paramtypes", [
11604
+ _ts_metadata37("design:type", Function),
11605
+ _ts_metadata37("design:paramtypes", [
11417
11606
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11418
11607
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
11419
11608
  typeof Request === "undefined" ? Object : Request
11420
11609
  ]),
11421
- _ts_metadata36("design:returntype", Promise)
11610
+ _ts_metadata37("design:returntype", Promise)
11422
11611
  ], MfaController.prototype, "disable", null);
11423
- _ts_decorate37([
11612
+ _ts_decorate38([
11424
11613
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11425
11614
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11426
11615
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -11429,33 +11618,33 @@ _ts_decorate37([
11429
11618
  _ts_param22(0, CurrentUser()),
11430
11619
  _ts_param22(1, common.Body()),
11431
11620
  _ts_param22(2, common.Req()),
11432
- _ts_metadata36("design:type", Function),
11433
- _ts_metadata36("design:paramtypes", [
11621
+ _ts_metadata37("design:type", Function),
11622
+ _ts_metadata37("design:paramtypes", [
11434
11623
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11435
11624
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
11436
11625
  typeof Request === "undefined" ? Object : Request
11437
11626
  ]),
11438
- _ts_metadata36("design:returntype", Promise)
11627
+ _ts_metadata37("design:returntype", Promise)
11439
11628
  ], MfaController.prototype, "regenerateRecoveryCodes", null);
11440
- MfaController = _ts_decorate37([
11629
+ MfaController = _ts_decorate38([
11441
11630
  common.UseInterceptors(NoStoreInterceptor),
11442
11631
  common.Controller("mfa"),
11443
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11632
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11444
11633
  common.UsePipes(createAuthValidationPipe({
11445
11634
  forbidUnknownValues: true
11446
11635
  })),
11447
11636
  _ts_param22(0, common.Inject(exports.MfaService)),
11448
11637
  _ts_param22(1, common.Inject(exports.TokenDeliveryService)),
11449
11638
  _ts_param22(2, common.Inject(BYMAX_AUTH_OPTIONS)),
11450
- _ts_metadata36("design:type", Function),
11451
- _ts_metadata36("design:paramtypes", [
11639
+ _ts_metadata37("design:type", Function),
11640
+ _ts_metadata37("design:paramtypes", [
11452
11641
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
11453
11642
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
11454
11643
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11455
11644
  ])
11456
11645
  ], MfaController);
11457
11646
  var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
11458
- function _ts_decorate38(decorators, target, key, desc) {
11647
+ function _ts_decorate39(decorators, target, key, desc) {
11459
11648
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11460
11649
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11461
11650
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11468,13 +11657,13 @@ function _ts_decorate38(decorators, target, key, desc) {
11468
11657
  }
11469
11658
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11470
11659
  }
11471
- __name(_ts_decorate38, "_ts_decorate");
11472
- function _ts_metadata37(metadataKey, metadataValue) {
11660
+ __name(_ts_decorate39, "_ts_decorate");
11661
+ function _ts_metadata38(metadataKey, metadataValue) {
11473
11662
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11474
11663
  return Reflect.metadata(metadataKey, metadataValue);
11475
11664
  }
11476
11665
  }
11477
- __name(_ts_metadata37, "_ts_metadata");
11666
+ __name(_ts_metadata38, "_ts_metadata");
11478
11667
  var ChangePasswordDto = class {
11479
11668
  static {
11480
11669
  __name(this, "ChangePasswordDto");
@@ -11527,26 +11716,26 @@ var ChangePasswordDto = class {
11527
11716
  */
11528
11717
  refreshToken;
11529
11718
  };
11530
- _ts_decorate38([
11719
+ _ts_decorate39([
11531
11720
  classValidator.IsString(),
11532
11721
  classValidator.MinLength(1),
11533
11722
  classValidator.MaxLength(128),
11534
- _ts_metadata37("design:type", String)
11723
+ _ts_metadata38("design:type", String)
11535
11724
  ], ChangePasswordDto.prototype, "currentPassword", void 0);
11536
- _ts_decorate38([
11725
+ _ts_decorate39([
11537
11726
  classValidator.IsString(),
11538
11727
  classValidator.MinLength(8),
11539
11728
  classValidator.MaxLength(128),
11540
- _ts_metadata37("design:type", String)
11729
+ _ts_metadata38("design:type", String)
11541
11730
  ], ChangePasswordDto.prototype, "newPassword", void 0);
11542
- _ts_decorate38([
11731
+ _ts_decorate39([
11543
11732
  classValidator.IsOptional(),
11544
11733
  classValidator.IsString(),
11545
11734
  classValidator.IsNotEmpty(),
11546
11735
  classValidator.MaxLength(2048),
11547
- _ts_metadata37("design:type", String)
11736
+ _ts_metadata38("design:type", String)
11548
11737
  ], ChangePasswordDto.prototype, "refreshToken", void 0);
11549
- function _ts_decorate39(decorators, target, key, desc) {
11738
+ function _ts_decorate40(decorators, target, key, desc) {
11550
11739
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11551
11740
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11552
11741
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11559,13 +11748,13 @@ function _ts_decorate39(decorators, target, key, desc) {
11559
11748
  }
11560
11749
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11561
11750
  }
11562
- __name(_ts_decorate39, "_ts_decorate");
11563
- function _ts_metadata38(metadataKey, metadataValue) {
11751
+ __name(_ts_decorate40, "_ts_decorate");
11752
+ function _ts_metadata39(metadataKey, metadataValue) {
11564
11753
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11565
11754
  return Reflect.metadata(metadataKey, metadataValue);
11566
11755
  }
11567
11756
  }
11568
- __name(_ts_metadata38, "_ts_metadata");
11757
+ __name(_ts_metadata39, "_ts_metadata");
11569
11758
  var ForgotPasswordDto = class {
11570
11759
  static {
11571
11760
  __name(this, "ForgotPasswordDto");
@@ -11581,13 +11770,13 @@ var ForgotPasswordDto = class {
11581
11770
  */
11582
11771
  tenantId;
11583
11772
  };
11584
- _ts_decorate39([
11773
+ _ts_decorate40([
11585
11774
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11586
11775
  classValidator.IsEmail(),
11587
11776
  classValidator.MaxLength(255),
11588
- _ts_metadata38("design:type", String)
11777
+ _ts_metadata39("design:type", String)
11589
11778
  ], ForgotPasswordDto.prototype, "email", void 0);
11590
- _ts_decorate39([
11779
+ _ts_decorate40([
11591
11780
  classValidator.IsOptional(),
11592
11781
  classValidator.IsString(),
11593
11782
  classValidator.IsNotEmpty(),
@@ -11595,9 +11784,9 @@ _ts_decorate39([
11595
11784
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11596
11785
  message: "tenantId must not contain control characters"
11597
11786
  }),
11598
- _ts_metadata38("design:type", String)
11787
+ _ts_metadata39("design:type", String)
11599
11788
  ], ForgotPasswordDto.prototype, "tenantId", void 0);
11600
- function _ts_decorate40(decorators, target, key, desc) {
11789
+ function _ts_decorate41(decorators, target, key, desc) {
11601
11790
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11602
11791
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11603
11792
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11610,13 +11799,13 @@ function _ts_decorate40(decorators, target, key, desc) {
11610
11799
  }
11611
11800
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11612
11801
  }
11613
- __name(_ts_decorate40, "_ts_decorate");
11614
- function _ts_metadata39(metadataKey, metadataValue) {
11802
+ __name(_ts_decorate41, "_ts_decorate");
11803
+ function _ts_metadata40(metadataKey, metadataValue) {
11615
11804
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11616
11805
  return Reflect.metadata(metadataKey, metadataValue);
11617
11806
  }
11618
11807
  }
11619
- __name(_ts_metadata39, "_ts_metadata");
11808
+ __name(_ts_metadata40, "_ts_metadata");
11620
11809
  var ResendOtpDto = class {
11621
11810
  static {
11622
11811
  __name(this, "ResendOtpDto");
@@ -11631,13 +11820,13 @@ var ResendOtpDto = class {
11631
11820
  */
11632
11821
  tenantId;
11633
11822
  };
11634
- _ts_decorate40([
11823
+ _ts_decorate41([
11635
11824
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11636
11825
  classValidator.IsEmail(),
11637
11826
  classValidator.MaxLength(255),
11638
- _ts_metadata39("design:type", String)
11827
+ _ts_metadata40("design:type", String)
11639
11828
  ], ResendOtpDto.prototype, "email", void 0);
11640
- _ts_decorate40([
11829
+ _ts_decorate41([
11641
11830
  classValidator.IsOptional(),
11642
11831
  classValidator.IsString(),
11643
11832
  classValidator.IsNotEmpty(),
@@ -11645,9 +11834,9 @@ _ts_decorate40([
11645
11834
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11646
11835
  message: "tenantId must not contain control characters"
11647
11836
  }),
11648
- _ts_metadata39("design:type", String)
11837
+ _ts_metadata40("design:type", String)
11649
11838
  ], ResendOtpDto.prototype, "tenantId", void 0);
11650
- function _ts_decorate41(decorators, target, key, desc) {
11839
+ function _ts_decorate42(decorators, target, key, desc) {
11651
11840
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11652
11841
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11653
11842
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11660,13 +11849,13 @@ function _ts_decorate41(decorators, target, key, desc) {
11660
11849
  }
11661
11850
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11662
11851
  }
11663
- __name(_ts_decorate41, "_ts_decorate");
11664
- function _ts_metadata40(metadataKey, metadataValue) {
11852
+ __name(_ts_decorate42, "_ts_decorate");
11853
+ function _ts_metadata41(metadataKey, metadataValue) {
11665
11854
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11666
11855
  return Reflect.metadata(metadataKey, metadataValue);
11667
11856
  }
11668
11857
  }
11669
- __name(_ts_metadata40, "_ts_metadata");
11858
+ __name(_ts_metadata41, "_ts_metadata");
11670
11859
  var ResetPasswordDto = class {
11671
11860
  static {
11672
11861
  __name(this, "ResetPasswordDto");
@@ -11713,38 +11902,38 @@ var ResetPasswordDto = class {
11713
11902
  */
11714
11903
  tenantId;
11715
11904
  };
11716
- _ts_decorate41([
11905
+ _ts_decorate42([
11717
11906
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11718
11907
  classValidator.IsEmail(),
11719
11908
  classValidator.MaxLength(255),
11720
- _ts_metadata40("design:type", String)
11909
+ _ts_metadata41("design:type", String)
11721
11910
  ], ResetPasswordDto.prototype, "email", void 0);
11722
- _ts_decorate41([
11911
+ _ts_decorate42([
11723
11912
  classValidator.IsString(),
11724
11913
  classValidator.MinLength(8),
11725
11914
  classValidator.MaxLength(128),
11726
- _ts_metadata40("design:type", String)
11915
+ _ts_metadata41("design:type", String)
11727
11916
  ], ResetPasswordDto.prototype, "newPassword", void 0);
11728
- _ts_decorate41([
11917
+ _ts_decorate42([
11729
11918
  classValidator.IsOptional(),
11730
11919
  classValidator.IsString(),
11731
11920
  classValidator.IsNotEmpty(),
11732
11921
  classValidator.MaxLength(2048),
11733
- _ts_metadata40("design:type", String)
11922
+ _ts_metadata41("design:type", String)
11734
11923
  ], ResetPasswordDto.prototype, "token", void 0);
11735
- _ts_decorate41([
11924
+ _ts_decorate42([
11736
11925
  classValidator.IsOptional(),
11737
11926
  classValidator.IsString(),
11738
11927
  classValidator.Length(4, 8),
11739
- _ts_metadata40("design:type", String)
11928
+ _ts_metadata41("design:type", String)
11740
11929
  ], ResetPasswordDto.prototype, "otp", void 0);
11741
- _ts_decorate41([
11930
+ _ts_decorate42([
11742
11931
  classValidator.IsOptional(),
11743
11932
  classValidator.IsString(),
11744
11933
  classValidator.Length(64, 64),
11745
- _ts_metadata40("design:type", String)
11934
+ _ts_metadata41("design:type", String)
11746
11935
  ], ResetPasswordDto.prototype, "verifiedToken", void 0);
11747
- _ts_decorate41([
11936
+ _ts_decorate42([
11748
11937
  classValidator.IsOptional(),
11749
11938
  classValidator.IsString(),
11750
11939
  classValidator.IsNotEmpty(),
@@ -11752,9 +11941,9 @@ _ts_decorate41([
11752
11941
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11753
11942
  message: "tenantId must not contain control characters"
11754
11943
  }),
11755
- _ts_metadata40("design:type", String)
11944
+ _ts_metadata41("design:type", String)
11756
11945
  ], ResetPasswordDto.prototype, "tenantId", void 0);
11757
- function _ts_decorate42(decorators, target, key, desc) {
11946
+ function _ts_decorate43(decorators, target, key, desc) {
11758
11947
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11759
11948
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11760
11949
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11767,13 +11956,13 @@ function _ts_decorate42(decorators, target, key, desc) {
11767
11956
  }
11768
11957
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11769
11958
  }
11770
- __name(_ts_decorate42, "_ts_decorate");
11771
- function _ts_metadata41(metadataKey, metadataValue) {
11959
+ __name(_ts_decorate43, "_ts_decorate");
11960
+ function _ts_metadata42(metadataKey, metadataValue) {
11772
11961
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11773
11962
  return Reflect.metadata(metadataKey, metadataValue);
11774
11963
  }
11775
11964
  }
11776
- __name(_ts_metadata41, "_ts_metadata");
11965
+ __name(_ts_metadata42, "_ts_metadata");
11777
11966
  var VerifyOtpDto = class {
11778
11967
  static {
11779
11968
  __name(this, "VerifyOtpDto");
@@ -11795,18 +11984,18 @@ var VerifyOtpDto = class {
11795
11984
  */
11796
11985
  tenantId;
11797
11986
  };
11798
- _ts_decorate42([
11987
+ _ts_decorate43([
11799
11988
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11800
11989
  classValidator.IsEmail(),
11801
11990
  classValidator.MaxLength(255),
11802
- _ts_metadata41("design:type", String)
11991
+ _ts_metadata42("design:type", String)
11803
11992
  ], VerifyOtpDto.prototype, "email", void 0);
11804
- _ts_decorate42([
11993
+ _ts_decorate43([
11805
11994
  classValidator.IsString(),
11806
11995
  classValidator.Length(4, 8),
11807
- _ts_metadata41("design:type", String)
11996
+ _ts_metadata42("design:type", String)
11808
11997
  ], VerifyOtpDto.prototype, "otp", void 0);
11809
- _ts_decorate42([
11998
+ _ts_decorate43([
11810
11999
  classValidator.IsOptional(),
11811
12000
  classValidator.IsString(),
11812
12001
  classValidator.IsNotEmpty(),
@@ -11814,9 +12003,54 @@ _ts_decorate42([
11814
12003
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11815
12004
  message: "tenantId must not contain control characters"
11816
12005
  }),
11817
- _ts_metadata41("design:type", String)
12006
+ _ts_metadata42("design:type", String)
11818
12007
  ], VerifyOtpDto.prototype, "tenantId", void 0);
11819
- function _ts_decorate43(decorators, target, key, desc) {
12008
+
12009
+ // src/server/utils/answer-reset-request.ts
12010
+ async function answerResetRequest(deps, request) {
12011
+ const { redis, logger } = deps;
12012
+ const { label, cooldownKey, start } = request;
12013
+ const holdFloor = /* @__PURE__ */ __name(() => sleep(Math.max(0, request.floorMs - (Date.now() - start))), "holdFloor");
12014
+ const releaseCooldown = /* @__PURE__ */ __name(async () => {
12015
+ try {
12016
+ await redis.del(cooldownKey);
12017
+ } catch (err) {
12018
+ logger.error(`${label}: cooldown release failed: ${describeChannelStatus(err)}`);
12019
+ }
12020
+ }, "releaseCooldown");
12021
+ let claimed;
12022
+ try {
12023
+ claimed = await redis.setnx(cooldownKey, request.cooldownSeconds);
12024
+ } catch (err) {
12025
+ logger.error(`${label}: cooldown store failed: ${describeChannelStatus(err)}`);
12026
+ await holdFloor();
12027
+ throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
12028
+ }
12029
+ if (!claimed) {
12030
+ await holdFloor();
12031
+ return;
12032
+ }
12033
+ let account;
12034
+ try {
12035
+ account = await request.findAccount();
12036
+ } catch (err) {
12037
+ logger.error(`${label}: account lookup failed: ${describeChannelStatus(err)}`);
12038
+ await releaseCooldown();
12039
+ await holdFloor();
12040
+ throw new AuthException(AUTH_ERROR_CODES.INTERNAL);
12041
+ }
12042
+ try {
12043
+ if (account && !request.isBlocked(account.status)) await request.issue(account.id);
12044
+ } catch (err) {
12045
+ logger.error(`${label}: unexpected error: ${describeChannelStatus(err)}`);
12046
+ await releaseCooldown();
12047
+ }
12048
+ await holdFloor();
12049
+ }
12050
+ __name(answerResetRequest, "answerResetRequest");
12051
+
12052
+ // src/server/services/password-reset.service.ts
12053
+ function _ts_decorate44(decorators, target, key, desc) {
11820
12054
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11821
12055
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11822
12056
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11829,13 +12063,13 @@ function _ts_decorate43(decorators, target, key, desc) {
11829
12063
  }
11830
12064
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11831
12065
  }
11832
- __name(_ts_decorate43, "_ts_decorate");
11833
- function _ts_metadata42(metadataKey, metadataValue) {
12066
+ __name(_ts_decorate44, "_ts_decorate");
12067
+ function _ts_metadata43(metadataKey, metadataValue) {
11834
12068
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11835
12069
  return Reflect.metadata(metadataKey, metadataValue);
11836
12070
  }
11837
12071
  }
11838
- __name(_ts_metadata42, "_ts_metadata");
12072
+ __name(_ts_metadata43, "_ts_metadata");
11839
12073
  function _ts_param23(paramIndex, decorator) {
11840
12074
  return function(target, key) {
11841
12075
  decorator(target, key, paramIndex);
@@ -11881,12 +12115,14 @@ exports.PasswordResetService = class _PasswordResetService {
11881
12115
  * inactive, or suspended), issues a reset token or OTP (depending on
11882
12116
  * `options.passwordReset.method`) and sends it via the email provider.
11883
12117
  *
11884
- * **Always returns without throwing**, even when:
12118
+ * **Resolves the same way** whether or not the account exists:
11885
12119
  * - The email does not exist in the tenant.
11886
12120
  * - The account is blocked.
11887
- * - The email provider fails.
12121
+ * - Issuing or storing the code, or the email provider, fails for an account that exists.
11888
12122
  *
11889
- * This anti-enumeration design ensures the response cannot be used to probe
12123
+ * A failure that is the same for every address, the resend-cooldown store or the account
12124
+ * lookup, throws `INTERNAL` (500) after the floor, and the cooldown this call took is
12125
+ * released. This anti-enumeration design ensures the response cannot be used to probe
11890
12126
  * whether an email address is registered.
11891
12127
  *
11892
12128
  * Timing normalization: the method always takes at least {@link ANTI_ENUM_MIN_MS}
@@ -11902,30 +12138,8 @@ exports.PasswordResetService = class _PasswordResetService {
11902
12138
  email: normalizeEmail(dto.email)
11903
12139
  };
11904
12140
  const start = Date.now();
11905
- const cooldownKey = `resend:${PASSWORD_RESET_PURPOSE}:${this.otpIdentifier(tenantId, dto.email)}`;
11906
- const wasSet = await this.redis.setnx(cooldownKey, RESEND_COOLDOWN_SECONDS);
11907
- if (!wasSet) {
11908
- await sleep(Math.max(0, ANTI_ENUM_MIN_MS2 - (Date.now() - start)));
11909
- return;
11910
- }
11911
- try {
11912
- const user = tenantScoped(await this.userRepo.findByEmail({
11913
- email: dto.email,
11914
- tenantId
11915
- }), tenantId);
11916
- if (user && !this.isBlocked(user.status)) {
11917
- const { method } = this.options.passwordReset;
11918
- if (method === "otp") {
11919
- await this.sendOtp(dto.email, tenantId, user.id);
11920
- } else {
11921
- await this.sendToken(dto.email, tenantId, user.id);
11922
- }
11923
- }
11924
- } catch (err) {
11925
- this.logger.error(`initiateReset: unexpected error: ${describeChannelStatus(err)}`);
11926
- } finally {
11927
- await sleep(Math.max(0, ANTI_ENUM_MIN_MS2 - (Date.now() - start)));
11928
- }
12141
+ const { method } = this.options.passwordReset;
12142
+ await this.answerResetRequest("initiateReset", dto.email, tenantId, start, (userId) => method === "otp" ? this.sendOtp(dto.email, tenantId, userId) : this.sendToken(dto.email, tenantId, userId));
11929
12143
  }
11930
12144
  /**
11931
12145
  * Resets the user's password using a verified proof (token, OTP, or verifiedToken).
@@ -12031,8 +12245,9 @@ exports.PasswordResetService = class _PasswordResetService {
12031
12245
  * Requests a new password-reset OTP for the given email address.
12032
12246
  *
12033
12247
  * Subject to an atomic 60-second cooldown enforced via a Redis NX key to
12034
- * prevent OTP flooding. Always returns success regardless of whether the
12035
- * user exists — anti-enumeration principle.
12248
+ * prevent OTP flooding. Resolves the same way whether or not the user exists —
12249
+ * anti-enumeration principle; a failure of the cooldown store or the account lookup
12250
+ * throws `INTERNAL` (500) after the floor and releases the cooldown.
12036
12251
  *
12037
12252
  * Timing normalization: always takes at least {@link ANTI_ENUM_MIN_MS} ms.
12038
12253
  *
@@ -12046,26 +12261,29 @@ exports.PasswordResetService = class _PasswordResetService {
12046
12261
  email: normalizeEmail(dto.email)
12047
12262
  };
12048
12263
  const start = Date.now();
12049
- const identifier = this.otpIdentifier(tenantId, dto.email);
12050
- const cooldownKey = `resend:${PASSWORD_RESET_PURPOSE}:${identifier}`;
12051
- const wasSet = await this.redis.setnx(cooldownKey, RESEND_COOLDOWN_SECONDS);
12052
- if (!wasSet) {
12053
- await sleep(Math.max(0, ANTI_ENUM_MIN_MS2 - (Date.now() - start)));
12054
- return;
12055
- }
12056
- try {
12057
- const user = tenantScoped(await this.userRepo.findByEmail({
12058
- email: dto.email,
12264
+ await this.answerResetRequest("resendOtp", dto.email, tenantId, start, (userId) => this.sendOtp(dto.email, tenantId, userId));
12265
+ }
12266
+ // ---------------------------------------------------------------------------
12267
+ // Private helpers — reset requests
12268
+ // ---------------------------------------------------------------------------
12269
+ /** Runs one `forgot-password` or `resend-otp` request through the shared failure rule. */
12270
+ answerResetRequest(label, email, tenantId, start, issue) {
12271
+ return answerResetRequest({
12272
+ redis: this.redis,
12273
+ logger: this.logger
12274
+ }, {
12275
+ label,
12276
+ cooldownKey: `resend:${PASSWORD_RESET_PURPOSE}:${this.otpIdentifier(tenantId, email)}`,
12277
+ cooldownSeconds: RESEND_COOLDOWN_SECONDS,
12278
+ floorMs: ANTI_ENUM_MIN_MS2,
12279
+ start,
12280
+ findAccount: /* @__PURE__ */ __name(async () => tenantScoped(await this.userRepo.findByEmail({
12281
+ email,
12059
12282
  tenantId
12060
- }), tenantId);
12061
- if (user && !this.isBlocked(user.status)) {
12062
- await this.sendOtp(dto.email, tenantId, user.id);
12063
- }
12064
- } catch (err) {
12065
- this.logger.error(`resendOtp: unexpected error: ${describeChannelStatus(err)}`);
12066
- } finally {
12067
- await sleep(Math.max(0, ANTI_ENUM_MIN_MS2 - (Date.now() - start)));
12068
- }
12283
+ }), tenantId), "findAccount"),
12284
+ isBlocked: /* @__PURE__ */ __name((status) => this.isBlocked(status), "isBlocked"),
12285
+ issue
12286
+ });
12069
12287
  }
12070
12288
  // ---------------------------------------------------------------------------
12071
12289
  // Private helpers — reset paths
@@ -12451,7 +12669,7 @@ exports.PasswordResetService = class _PasswordResetService {
12451
12669
  };
12452
12670
  }
12453
12671
  };
12454
- exports.PasswordResetService = _ts_decorate43([
12672
+ exports.PasswordResetService = _ts_decorate44([
12455
12673
  common.Injectable(),
12456
12674
  _ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12457
12675
  _ts_param23(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -12464,8 +12682,8 @@ exports.PasswordResetService = _ts_decorate43([
12464
12682
  _ts_param23(6, common.Inject(AuthRedisService)),
12465
12683
  _ts_param23(7, common.Inject(exports.SessionService)),
12466
12684
  _ts_param23(8, common.Inject(exports.BruteForceService)),
12467
- _ts_metadata42("design:type", Function),
12468
- _ts_metadata42("design:paramtypes", [
12685
+ _ts_metadata43("design:type", Function),
12686
+ _ts_metadata43("design:paramtypes", [
12469
12687
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
12470
12688
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
12471
12689
  Object,
@@ -12484,7 +12702,7 @@ function toSafeUser3(user) {
12484
12702
  __name(toSafeUser3, "toSafeUser");
12485
12703
 
12486
12704
  // src/server/controllers/password-reset.controller.ts
12487
- function _ts_decorate44(decorators, target, key, desc) {
12705
+ function _ts_decorate45(decorators, target, key, desc) {
12488
12706
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12489
12707
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12490
12708
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12497,13 +12715,13 @@ function _ts_decorate44(decorators, target, key, desc) {
12497
12715
  }
12498
12716
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12499
12717
  }
12500
- __name(_ts_decorate44, "_ts_decorate");
12501
- function _ts_metadata43(metadataKey, metadataValue) {
12718
+ __name(_ts_decorate45, "_ts_decorate");
12719
+ function _ts_metadata44(metadataKey, metadataValue) {
12502
12720
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12503
12721
  return Reflect.metadata(metadataKey, metadataValue);
12504
12722
  }
12505
12723
  }
12506
- __name(_ts_metadata43, "_ts_metadata");
12724
+ __name(_ts_metadata44, "_ts_metadata");
12507
12725
  function _ts_param24(paramIndex, decorator) {
12508
12726
  return function(target, key) {
12509
12727
  decorator(target, key, paramIndex);
@@ -12527,8 +12745,9 @@ var PasswordResetController = class {
12527
12745
  * Initiates a password reset for the given email address.
12528
12746
  *
12529
12747
  * Sends a reset token or OTP to the user's email if the account exists and
12530
- * is eligible. Always returns `200 OK` with an empty JSON object regardless of outcome
12531
- * (anti-enumeration; the body is pinned by the wire contract).
12748
+ * is eligible. Answers `200 OK` with an empty JSON object whether or not the account exists
12749
+ * (anti-enumeration; the body is pinned by the wire contract). Only a failure that is the same
12750
+ * for every address, the cooldown store or the account lookup, answers `500` `auth.internal`.
12532
12751
  *
12533
12752
  * @param dto - Validated DTO with `email` and `tenantId`.
12534
12753
  * @returns An empty object.
@@ -12615,8 +12834,9 @@ var PasswordResetController = class {
12615
12834
  * Re-sends the password-reset OTP for the given email address.
12616
12835
  *
12617
12836
  * Subject to a 60-second atomic cooldown per `(tenantId, email)` pair.
12618
- * Always returns `200 OK` with an empty JSON object regardless of outcome (anti-enumeration;
12619
- * the body is pinned by the wire contract).
12837
+ * Answers `200 OK` with an empty JSON object whether or not the account exists
12838
+ * (anti-enumeration; the body is pinned by the wire contract). Only a failure that is the same
12839
+ * for every address, the cooldown store or the account lookup, answers `500` `auth.internal`.
12620
12840
  *
12621
12841
  * @param dto - Validated DTO with `email` and `tenantId`.
12622
12842
  * @returns An empty object.
@@ -12626,35 +12846,35 @@ var PasswordResetController = class {
12626
12846
  return {};
12627
12847
  }
12628
12848
  };
12629
- _ts_decorate44([
12849
+ _ts_decorate45([
12630
12850
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
12631
12851
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
12632
12852
  common.HttpCode(common.HttpStatus.OK),
12633
12853
  common.Post("forgot-password"),
12634
12854
  _ts_param24(0, common.Body()),
12635
12855
  _ts_param24(1, common.Req()),
12636
- _ts_metadata43("design:type", Function),
12637
- _ts_metadata43("design:paramtypes", [
12856
+ _ts_metadata44("design:type", Function),
12857
+ _ts_metadata44("design:paramtypes", [
12638
12858
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
12639
12859
  typeof Request === "undefined" ? Object : Request
12640
12860
  ]),
12641
- _ts_metadata43("design:returntype", Promise)
12861
+ _ts_metadata44("design:returntype", Promise)
12642
12862
  ], PasswordResetController.prototype, "forgotPassword", null);
12643
- _ts_decorate44([
12863
+ _ts_decorate45([
12644
12864
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
12645
12865
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
12646
12866
  common.HttpCode(common.HttpStatus.NO_CONTENT),
12647
12867
  common.Post("reset-password"),
12648
12868
  _ts_param24(0, common.Body()),
12649
12869
  _ts_param24(1, common.Req()),
12650
- _ts_metadata43("design:type", Function),
12651
- _ts_metadata43("design:paramtypes", [
12870
+ _ts_metadata44("design:type", Function),
12871
+ _ts_metadata44("design:paramtypes", [
12652
12872
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
12653
12873
  typeof Request === "undefined" ? Object : Request
12654
12874
  ]),
12655
- _ts_metadata43("design:returntype", Promise)
12875
+ _ts_metadata44("design:returntype", Promise)
12656
12876
  ], PasswordResetController.prototype, "resetPassword", null);
12657
- _ts_decorate44([
12877
+ _ts_decorate45([
12658
12878
  Authenticated(),
12659
12879
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
12660
12880
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
@@ -12664,57 +12884,57 @@ _ts_decorate44([
12664
12884
  _ts_param24(0, CurrentUser()),
12665
12885
  _ts_param24(1, common.Body()),
12666
12886
  _ts_param24(2, common.Req()),
12667
- _ts_metadata43("design:type", Function),
12668
- _ts_metadata43("design:paramtypes", [
12887
+ _ts_metadata44("design:type", Function),
12888
+ _ts_metadata44("design:paramtypes", [
12669
12889
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
12670
12890
  typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
12671
12891
  typeof Request === "undefined" ? Object : Request
12672
12892
  ]),
12673
- _ts_metadata43("design:returntype", Promise)
12893
+ _ts_metadata44("design:returntype", Promise)
12674
12894
  ], PasswordResetController.prototype, "changePassword", null);
12675
- _ts_decorate44([
12895
+ _ts_decorate45([
12676
12896
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
12677
12897
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
12678
12898
  common.HttpCode(common.HttpStatus.OK),
12679
12899
  common.Post("verify-otp"),
12680
12900
  _ts_param24(0, common.Body()),
12681
12901
  _ts_param24(1, common.Req()),
12682
- _ts_metadata43("design:type", Function),
12683
- _ts_metadata43("design:paramtypes", [
12902
+ _ts_metadata44("design:type", Function),
12903
+ _ts_metadata44("design:paramtypes", [
12684
12904
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
12685
12905
  typeof Request === "undefined" ? Object : Request
12686
12906
  ]),
12687
- _ts_metadata43("design:returntype", Promise)
12907
+ _ts_metadata44("design:returntype", Promise)
12688
12908
  ], PasswordResetController.prototype, "verifyOtp", null);
12689
- _ts_decorate44([
12909
+ _ts_decorate45([
12690
12910
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12691
12911
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12692
12912
  common.HttpCode(common.HttpStatus.OK),
12693
12913
  common.Post("resend-otp"),
12694
12914
  _ts_param24(0, common.Body()),
12695
12915
  _ts_param24(1, common.Req()),
12696
- _ts_metadata43("design:type", Function),
12697
- _ts_metadata43("design:paramtypes", [
12916
+ _ts_metadata44("design:type", Function),
12917
+ _ts_metadata44("design:paramtypes", [
12698
12918
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
12699
12919
  typeof Request === "undefined" ? Object : Request
12700
12920
  ]),
12701
- _ts_metadata43("design:returntype", Promise)
12921
+ _ts_metadata44("design:returntype", Promise)
12702
12922
  ], PasswordResetController.prototype, "resendOtp", null);
12703
- PasswordResetController = _ts_decorate44([
12923
+ PasswordResetController = _ts_decorate45([
12704
12924
  Public(),
12705
12925
  common.UseInterceptors(NoStoreInterceptor),
12706
12926
  common.Controller("password"),
12707
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12927
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12708
12928
  common.UsePipes(createAuthValidationPipe()),
12709
12929
  _ts_param24(0, common.Inject(exports.PasswordResetService)),
12710
12930
  _ts_param24(1, common.Inject(exports.TokenDeliveryService)),
12711
- _ts_metadata43("design:type", Function),
12712
- _ts_metadata43("design:paramtypes", [
12931
+ _ts_metadata44("design:type", Function),
12932
+ _ts_metadata44("design:paramtypes", [
12713
12933
  typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
12714
12934
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
12715
12935
  ])
12716
12936
  ], PasswordResetController);
12717
- function _ts_decorate45(decorators, target, key, desc) {
12937
+ function _ts_decorate46(decorators, target, key, desc) {
12718
12938
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12719
12939
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12720
12940
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12727,13 +12947,13 @@ function _ts_decorate45(decorators, target, key, desc) {
12727
12947
  }
12728
12948
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12729
12949
  }
12730
- __name(_ts_decorate45, "_ts_decorate");
12731
- function _ts_metadata44(metadataKey, metadataValue) {
12950
+ __name(_ts_decorate46, "_ts_decorate");
12951
+ function _ts_metadata45(metadataKey, metadataValue) {
12732
12952
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12733
12953
  return Reflect.metadata(metadataKey, metadataValue);
12734
12954
  }
12735
12955
  }
12736
- __name(_ts_metadata44, "_ts_metadata");
12956
+ __name(_ts_metadata45, "_ts_metadata");
12737
12957
  var PlatformLoginDto = class {
12738
12958
  static {
12739
12959
  __name(this, "PlatformLoginDto");
@@ -12761,14 +12981,14 @@ var PlatformLoginDto = class {
12761
12981
  */
12762
12982
  password;
12763
12983
  };
12764
- _ts_decorate45([
12984
+ _ts_decorate46([
12765
12985
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
12766
12986
  classValidator.IsEmail(),
12767
12987
  classValidator.IsNotEmpty(),
12768
12988
  classValidator.MaxLength(255),
12769
- _ts_metadata44("design:type", String)
12989
+ _ts_metadata45("design:type", String)
12770
12990
  ], PlatformLoginDto.prototype, "email", void 0);
12771
- _ts_decorate45([
12991
+ _ts_decorate46([
12772
12992
  classValidator.IsString(),
12773
12993
  classValidator.IsNotEmpty(),
12774
12994
  classValidator.Matches(/\S/, {
@@ -12776,9 +12996,9 @@ _ts_decorate45([
12776
12996
  }),
12777
12997
  classValidator.MinLength(1),
12778
12998
  classValidator.MaxLength(128),
12779
- _ts_metadata44("design:type", String)
12999
+ _ts_metadata45("design:type", String)
12780
13000
  ], PlatformLoginDto.prototype, "password", void 0);
12781
- function _ts_decorate46(decorators, target, key, desc) {
13001
+ function _ts_decorate47(decorators, target, key, desc) {
12782
13002
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12783
13003
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12784
13004
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12791,13 +13011,13 @@ function _ts_decorate46(decorators, target, key, desc) {
12791
13011
  }
12792
13012
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12793
13013
  }
12794
- __name(_ts_decorate46, "_ts_decorate");
12795
- function _ts_metadata45(metadataKey, metadataValue) {
13014
+ __name(_ts_decorate47, "_ts_decorate");
13015
+ function _ts_metadata46(metadataKey, metadataValue) {
12796
13016
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12797
13017
  return Reflect.metadata(metadataKey, metadataValue);
12798
13018
  }
12799
13019
  }
12800
- __name(_ts_metadata45, "_ts_metadata");
13020
+ __name(_ts_metadata46, "_ts_metadata");
12801
13021
  function _ts_param25(paramIndex, decorator) {
12802
13022
  return function(target, key) {
12803
13023
  decorator(target, key, paramIndex);
@@ -12849,15 +13069,15 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
12849
13069
  return true;
12850
13070
  }
12851
13071
  };
12852
- exports.JwtPlatformGuard = _ts_decorate46([
13072
+ exports.JwtPlatformGuard = _ts_decorate47([
12853
13073
  common.Injectable(),
12854
13074
  _ts_param25(0, common.Inject(jwt.JwtService)),
12855
13075
  _ts_param25(1, common.Inject(exports.TokenDeliveryService)),
12856
13076
  _ts_param25(2, common.Inject(exports.AuthRevocationService)),
12857
13077
  _ts_param25(3, common.Inject(core.Reflector)),
12858
13078
  _ts_param25(4, common.Inject(BYMAX_AUTH_OPTIONS)),
12859
- _ts_metadata45("design:type", Function),
12860
- _ts_metadata45("design:paramtypes", [
13079
+ _ts_metadata46("design:type", Function),
13080
+ _ts_metadata46("design:paramtypes", [
12861
13081
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
12862
13082
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
12863
13083
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -12865,7 +13085,7 @@ exports.JwtPlatformGuard = _ts_decorate46([
12865
13085
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
12866
13086
  ])
12867
13087
  ], exports.JwtPlatformGuard);
12868
- function _ts_decorate47(decorators, target, key, desc) {
13088
+ function _ts_decorate48(decorators, target, key, desc) {
12869
13089
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12870
13090
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12871
13091
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12878,13 +13098,13 @@ function _ts_decorate47(decorators, target, key, desc) {
12878
13098
  }
12879
13099
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12880
13100
  }
12881
- __name(_ts_decorate47, "_ts_decorate");
12882
- function _ts_metadata46(metadataKey, metadataValue) {
13101
+ __name(_ts_decorate48, "_ts_decorate");
13102
+ function _ts_metadata47(metadataKey, metadataValue) {
12883
13103
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12884
13104
  return Reflect.metadata(metadataKey, metadataValue);
12885
13105
  }
12886
13106
  }
12887
- __name(_ts_metadata46, "_ts_metadata");
13107
+ __name(_ts_metadata47, "_ts_metadata");
12888
13108
  function _ts_param26(paramIndex, decorator) {
12889
13109
  return function(target, key) {
12890
13110
  decorator(target, key, paramIndex);
@@ -12989,36 +13209,64 @@ exports.PlatformAuthService = class _PlatformAuthService {
12989
13209
  */
12990
13210
  async logout(accessToken, rawRefreshToken) {
12991
13211
  const tokenHash = sha256(rawRefreshToken);
12992
- const { userId } = await this.redis.readSessionOwner(`prt:${tokenHash}`);
13212
+ const markerKey = logoutPendingKey("platform", tokenHash);
13213
+ const live = await this.redis.readSessionOwner(`prt:${tokenHash}`);
13214
+ const fromSession = live.userId !== "";
13215
+ const { userId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
12993
13216
  this.logger.log(`logout: adminId=${logSafe(userId || "(no live session)")}`);
12994
- let blacklist = [];
12995
- try {
12996
- const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
12997
- const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
12998
- if (remainingTtl > 0) {
12999
- blacklist = [
13000
- () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
13001
- ];
13002
- }
13003
- } catch {
13004
- }
13005
13217
  const index = userId ? sessionIndexKey("platform", userId, this.options.hmacKey, void 0) : "";
13006
13218
  const prune = /* @__PURE__ */ __name((member) => index === "" ? [] : [
13007
13219
  () => this.redis.srem(index, member)
13008
13220
  ], "prune");
13009
13221
  const failures = await settleWrites([
13010
- ...blacklist,
13222
+ ...this.blacklistWrites(accessToken),
13011
13223
  settleAfter(() => this.redis.del("prt:" + tokenHash), [
13012
13224
  ...prune("prt:" + tokenHash),
13013
13225
  () => this.redis.del("psd:" + tokenHash)
13014
13226
  ]),
13015
13227
  settleAfter(() => this.redis.del("prp:" + tokenHash), prune("prp:" + tokenHash))
13016
13228
  ]);
13229
+ const markerTtl = logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn);
13230
+ if (failures.length > 0 && fromSession) {
13231
+ await rememberPendingLogout(this.redis, markerKey, {
13232
+ userId,
13233
+ tenantId: void 0
13234
+ }, markerTtl, this.logger);
13235
+ }
13017
13236
  raiseFirst(failures);
13018
- this.emitPlatformLogout(userId);
13237
+ if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, {
13238
+ userId,
13239
+ tenantId: void 0
13240
+ }, markerTtl, this.logger)) {
13241
+ this.emitPlatformLogout(userId);
13242
+ }
13019
13243
  return userId;
13020
13244
  }
13021
13245
  /**
13246
+ * The access-token blacklist write for a platform logout, or none when there is nothing to
13247
+ * revoke.
13248
+ *
13249
+ * Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
13250
+ * forged one must not be able to blacklist an id it does not own. Only the verification is
13251
+ * tolerant: a token nobody can verify has nothing to blacklist, but a refused write is not.
13252
+ *
13253
+ * @param accessToken - Raw platform access token; absent, malformed or expired yields no write.
13254
+ * @returns The writes to hand to `settleWrites`.
13255
+ */
13256
+ blacklistWrites(accessToken) {
13257
+ try {
13258
+ const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
13259
+ const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
13260
+ if (remainingTtl > 0) {
13261
+ return [
13262
+ () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
13263
+ ];
13264
+ }
13265
+ } catch {
13266
+ }
13267
+ return [];
13268
+ }
13269
+ /**
13022
13270
  * Announces a completed platform logout, the only hook `PlatformAuthService` emits.
13023
13271
  *
13024
13272
  * Owns three concerns a reader of `logout` does not need: whether a hook is registered, the
@@ -13155,7 +13403,7 @@ exports.PlatformAuthService = class _PlatformAuthService {
13155
13403
  await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
13156
13404
  }
13157
13405
  };
13158
- exports.PlatformAuthService = _ts_decorate47([
13406
+ exports.PlatformAuthService = _ts_decorate48([
13159
13407
  common.Injectable(),
13160
13408
  _ts_param26(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
13161
13409
  _ts_param26(1, common.Inject(PasswordService)),
@@ -13165,8 +13413,8 @@ exports.PlatformAuthService = _ts_decorate47([
13165
13413
  _ts_param26(5, common.Inject(BYMAX_AUTH_OPTIONS)),
13166
13414
  _ts_param26(6, common.Inject(BYMAX_AUTH_HOOKS)),
13167
13415
  _ts_param26(6, common.Optional()),
13168
- _ts_metadata46("design:type", Function),
13169
- _ts_metadata46("design:paramtypes", [
13416
+ _ts_metadata47("design:type", Function),
13417
+ _ts_metadata47("design:paramtypes", [
13170
13418
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
13171
13419
  typeof PasswordService === "undefined" ? Object : PasswordService,
13172
13420
  typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
@@ -13178,7 +13426,7 @@ exports.PlatformAuthService = _ts_decorate47([
13178
13426
  ], exports.PlatformAuthService);
13179
13427
 
13180
13428
  // src/server/controllers/platform-auth.controller.ts
13181
- function _ts_decorate48(decorators, target, key, desc) {
13429
+ function _ts_decorate49(decorators, target, key, desc) {
13182
13430
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13183
13431
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13184
13432
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13191,13 +13439,13 @@ function _ts_decorate48(decorators, target, key, desc) {
13191
13439
  }
13192
13440
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13193
13441
  }
13194
- __name(_ts_decorate48, "_ts_decorate");
13195
- function _ts_metadata47(metadataKey, metadataValue) {
13442
+ __name(_ts_decorate49, "_ts_decorate");
13443
+ function _ts_metadata48(metadataKey, metadataValue) {
13196
13444
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13197
13445
  return Reflect.metadata(metadataKey, metadataValue);
13198
13446
  }
13199
13447
  }
13200
- __name(_ts_metadata47, "_ts_metadata");
13448
+ __name(_ts_metadata48, "_ts_metadata");
13201
13449
  function _ts_param27(paramIndex, decorator) {
13202
13450
  return function(target, key) {
13203
13451
  decorator(target, key, paramIndex);
@@ -13349,7 +13597,7 @@ var PlatformAuthController = class {
13349
13597
  await this.platformAuthService.revokeAllPlatformSessions(user.sub);
13350
13598
  }
13351
13599
  };
13352
- _ts_decorate48([
13600
+ _ts_decorate49([
13353
13601
  Public(),
13354
13602
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
13355
13603
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
@@ -13357,14 +13605,14 @@ _ts_decorate48([
13357
13605
  common.Post("login"),
13358
13606
  _ts_param27(0, common.Body()),
13359
13607
  _ts_param27(1, common.Req()),
13360
- _ts_metadata47("design:type", Function),
13361
- _ts_metadata47("design:paramtypes", [
13608
+ _ts_metadata48("design:type", Function),
13609
+ _ts_metadata48("design:paramtypes", [
13362
13610
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
13363
13611
  typeof Request === "undefined" ? Object : Request
13364
13612
  ]),
13365
- _ts_metadata47("design:returntype", Promise)
13613
+ _ts_metadata48("design:returntype", Promise)
13366
13614
  ], PlatformAuthController.prototype, "login", null);
13367
- _ts_decorate48([
13615
+ _ts_decorate49([
13368
13616
  Public(),
13369
13617
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
13370
13618
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
@@ -13372,78 +13620,80 @@ _ts_decorate48([
13372
13620
  common.Post("mfa/challenge"),
13373
13621
  _ts_param27(0, common.Body()),
13374
13622
  _ts_param27(1, common.Req()),
13375
- _ts_metadata47("design:type", Function),
13376
- _ts_metadata47("design:paramtypes", [
13623
+ _ts_metadata48("design:type", Function),
13624
+ _ts_metadata48("design:paramtypes", [
13377
13625
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
13378
13626
  typeof Request === "undefined" ? Object : Request
13379
13627
  ]),
13380
- _ts_metadata47("design:returntype", Promise)
13628
+ _ts_metadata48("design:returntype", Promise)
13381
13629
  ], PlatformAuthController.prototype, "mfaChallenge", null);
13382
- _ts_decorate48([
13630
+ _ts_decorate49([
13383
13631
  common.UseGuards(exports.JwtPlatformGuard),
13384
13632
  common.Get("me"),
13385
13633
  _ts_param27(0, CurrentUser()),
13386
- _ts_metadata47("design:type", Function),
13387
- _ts_metadata47("design:paramtypes", [
13634
+ _ts_metadata48("design:type", Function),
13635
+ _ts_metadata48("design:paramtypes", [
13388
13636
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13389
13637
  ]),
13390
- _ts_metadata47("design:returntype", Promise)
13638
+ _ts_metadata48("design:returntype", Promise)
13391
13639
  ], PlatformAuthController.prototype, "me", null);
13392
- _ts_decorate48([
13640
+ _ts_decorate49([
13393
13641
  Public(),
13394
13642
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
13395
13643
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
13396
13644
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13645
+ RequestEncoding("unchecked"),
13397
13646
  common.Post("logout"),
13398
13647
  _ts_param27(0, common.Req()),
13399
- _ts_metadata47("design:type", Function),
13400
- _ts_metadata47("design:paramtypes", [
13648
+ _ts_metadata48("design:type", Function),
13649
+ _ts_metadata48("design:paramtypes", [
13401
13650
  typeof Request === "undefined" ? Object : Request
13402
13651
  ]),
13403
- _ts_metadata47("design:returntype", Promise)
13652
+ _ts_metadata48("design:returntype", Promise)
13404
13653
  ], PlatformAuthController.prototype, "logout", null);
13405
- _ts_decorate48([
13654
+ _ts_decorate49([
13406
13655
  Public(),
13407
13656
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
13408
13657
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
13409
13658
  common.HttpCode(common.HttpStatus.OK),
13659
+ RequestEncoding("unchecked"),
13410
13660
  common.Post("refresh"),
13411
13661
  _ts_param27(0, common.Req()),
13412
- _ts_metadata47("design:type", Function),
13413
- _ts_metadata47("design:paramtypes", [
13662
+ _ts_metadata48("design:type", Function),
13663
+ _ts_metadata48("design:paramtypes", [
13414
13664
  typeof Request === "undefined" ? Object : Request
13415
13665
  ]),
13416
- _ts_metadata47("design:returntype", Promise)
13666
+ _ts_metadata48("design:returntype", Promise)
13417
13667
  ], PlatformAuthController.prototype, "refresh", null);
13418
- _ts_decorate48([
13668
+ _ts_decorate49([
13419
13669
  common.UseGuards(exports.JwtPlatformGuard),
13420
13670
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13421
13671
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13422
13672
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13423
13673
  common.Delete("sessions"),
13424
13674
  _ts_param27(0, CurrentUser()),
13425
- _ts_metadata47("design:type", Function),
13426
- _ts_metadata47("design:paramtypes", [
13675
+ _ts_metadata48("design:type", Function),
13676
+ _ts_metadata48("design:paramtypes", [
13427
13677
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13428
13678
  ]),
13429
- _ts_metadata47("design:returntype", Promise)
13679
+ _ts_metadata48("design:returntype", Promise)
13430
13680
  ], PlatformAuthController.prototype, "revokeSessions", null);
13431
- PlatformAuthController = _ts_decorate48([
13681
+ PlatformAuthController = _ts_decorate49([
13432
13682
  common.UseInterceptors(NoStoreInterceptor),
13433
13683
  common.Controller("platform"),
13434
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13684
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13435
13685
  common.UsePipes(createAuthValidationPipe()),
13436
13686
  _ts_param27(0, common.Inject(exports.PlatformAuthService)),
13437
13687
  _ts_param27(1, common.Inject(exports.MfaService)),
13438
13688
  _ts_param27(2, common.Inject(exports.TokenDeliveryService)),
13439
- _ts_metadata47("design:type", Function),
13440
- _ts_metadata47("design:paramtypes", [
13689
+ _ts_metadata48("design:type", Function),
13690
+ _ts_metadata48("design:paramtypes", [
13441
13691
  typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
13442
13692
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
13443
13693
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13444
13694
  ])
13445
13695
  ], PlatformAuthController);
13446
- function _ts_decorate49(decorators, target, key, desc) {
13696
+ function _ts_decorate50(decorators, target, key, desc) {
13447
13697
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13448
13698
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13449
13699
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13456,13 +13706,13 @@ function _ts_decorate49(decorators, target, key, desc) {
13456
13706
  }
13457
13707
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13458
13708
  }
13459
- __name(_ts_decorate49, "_ts_decorate");
13460
- function _ts_metadata48(metadataKey, metadataValue) {
13709
+ __name(_ts_decorate50, "_ts_decorate");
13710
+ function _ts_metadata49(metadataKey, metadataValue) {
13461
13711
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13462
13712
  return Reflect.metadata(metadataKey, metadataValue);
13463
13713
  }
13464
13714
  }
13465
- __name(_ts_metadata48, "_ts_metadata");
13715
+ __name(_ts_metadata49, "_ts_metadata");
13466
13716
  function _ts_param28(paramIndex, decorator) {
13467
13717
  return function(target, key) {
13468
13718
  decorator(target, key, paramIndex);
@@ -13547,21 +13797,22 @@ var PlatformMfaController = class {
13547
13797
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
13548
13798
  }
13549
13799
  };
13550
- _ts_decorate49([
13800
+ _ts_decorate50([
13551
13801
  common.UseGuards(exports.JwtPlatformGuard),
13552
13802
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
13553
13803
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
13804
+ RequestEncoding("when-body"),
13554
13805
  common.Post("setup"),
13555
13806
  _ts_param28(0, CurrentUser()),
13556
13807
  _ts_param28(1, common.Body()),
13557
- _ts_metadata48("design:type", Function),
13558
- _ts_metadata48("design:paramtypes", [
13808
+ _ts_metadata49("design:type", Function),
13809
+ _ts_metadata49("design:paramtypes", [
13559
13810
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13560
13811
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
13561
13812
  ]),
13562
- _ts_metadata48("design:returntype", Promise)
13813
+ _ts_metadata49("design:returntype", Promise)
13563
13814
  ], PlatformMfaController.prototype, "setup", null);
13564
- _ts_decorate49([
13815
+ _ts_decorate50([
13565
13816
  common.UseGuards(exports.JwtPlatformGuard),
13566
13817
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
13567
13818
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
@@ -13570,15 +13821,15 @@ _ts_decorate49([
13570
13821
  _ts_param28(0, CurrentUser()),
13571
13822
  _ts_param28(1, common.Body()),
13572
13823
  _ts_param28(2, common.Req()),
13573
- _ts_metadata48("design:type", Function),
13574
- _ts_metadata48("design:paramtypes", [
13824
+ _ts_metadata49("design:type", Function),
13825
+ _ts_metadata49("design:paramtypes", [
13575
13826
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13576
13827
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
13577
13828
  typeof Request === "undefined" ? Object : Request
13578
13829
  ]),
13579
- _ts_metadata48("design:returntype", Promise)
13830
+ _ts_metadata49("design:returntype", Promise)
13580
13831
  ], PlatformMfaController.prototype, "verifyEnable", null);
13581
- _ts_decorate49([
13832
+ _ts_decorate50([
13582
13833
  common.UseGuards(exports.JwtPlatformGuard),
13583
13834
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13584
13835
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -13587,15 +13838,15 @@ _ts_decorate49([
13587
13838
  _ts_param28(0, CurrentUser()),
13588
13839
  _ts_param28(1, common.Body()),
13589
13840
  _ts_param28(2, common.Req()),
13590
- _ts_metadata48("design:type", Function),
13591
- _ts_metadata48("design:paramtypes", [
13841
+ _ts_metadata49("design:type", Function),
13842
+ _ts_metadata49("design:paramtypes", [
13592
13843
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13593
13844
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
13594
13845
  typeof Request === "undefined" ? Object : Request
13595
13846
  ]),
13596
- _ts_metadata48("design:returntype", Promise)
13847
+ _ts_metadata49("design:returntype", Promise)
13597
13848
  ], PlatformMfaController.prototype, "disable", null);
13598
- _ts_decorate49([
13849
+ _ts_decorate50([
13599
13850
  common.UseGuards(exports.JwtPlatformGuard),
13600
13851
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13601
13852
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -13604,28 +13855,28 @@ _ts_decorate49([
13604
13855
  _ts_param28(0, CurrentUser()),
13605
13856
  _ts_param28(1, common.Body()),
13606
13857
  _ts_param28(2, common.Req()),
13607
- _ts_metadata48("design:type", Function),
13608
- _ts_metadata48("design:paramtypes", [
13858
+ _ts_metadata49("design:type", Function),
13859
+ _ts_metadata49("design:paramtypes", [
13609
13860
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13610
13861
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
13611
13862
  typeof Request === "undefined" ? Object : Request
13612
13863
  ]),
13613
- _ts_metadata48("design:returntype", Promise)
13864
+ _ts_metadata49("design:returntype", Promise)
13614
13865
  ], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
13615
- PlatformMfaController = _ts_decorate49([
13866
+ PlatformMfaController = _ts_decorate50([
13616
13867
  common.UseInterceptors(NoStoreInterceptor),
13617
13868
  common.Controller("platform/mfa"),
13618
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13869
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13619
13870
  common.UsePipes(createAuthValidationPipe({
13620
13871
  forbidUnknownValues: true
13621
13872
  })),
13622
13873
  _ts_param28(0, common.Inject(exports.MfaService)),
13623
- _ts_metadata48("design:type", Function),
13624
- _ts_metadata48("design:paramtypes", [
13874
+ _ts_metadata49("design:type", Function),
13875
+ _ts_metadata49("design:paramtypes", [
13625
13876
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService
13626
13877
  ])
13627
13878
  ], PlatformMfaController);
13628
- function _ts_decorate50(decorators, target, key, desc) {
13879
+ function _ts_decorate51(decorators, target, key, desc) {
13629
13880
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13630
13881
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13631
13882
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13638,13 +13889,13 @@ function _ts_decorate50(decorators, target, key, desc) {
13638
13889
  }
13639
13890
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13640
13891
  }
13641
- __name(_ts_decorate50, "_ts_decorate");
13642
- function _ts_metadata49(metadataKey, metadataValue) {
13892
+ __name(_ts_decorate51, "_ts_decorate");
13893
+ function _ts_metadata50(metadataKey, metadataValue) {
13643
13894
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13644
13895
  return Reflect.metadata(metadataKey, metadataValue);
13645
13896
  }
13646
13897
  }
13647
- __name(_ts_metadata49, "_ts_metadata");
13898
+ __name(_ts_metadata50, "_ts_metadata");
13648
13899
  function _ts_param29(paramIndex, decorator) {
13649
13900
  return function(target, key) {
13650
13901
  decorator(target, key, paramIndex);
@@ -13750,63 +14001,64 @@ var SessionController = class {
13750
14001
  });
13751
14002
  }
13752
14003
  };
13753
- _ts_decorate50([
14004
+ _ts_decorate51([
13754
14005
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
13755
14006
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
13756
14007
  common.Get(),
13757
14008
  _ts_param29(0, CurrentUser()),
13758
14009
  _ts_param29(1, common.Req()),
13759
- _ts_metadata49("design:type", Function),
13760
- _ts_metadata49("design:paramtypes", [
14010
+ _ts_metadata50("design:type", Function),
14011
+ _ts_metadata50("design:paramtypes", [
13761
14012
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13762
14013
  typeof Request === "undefined" ? Object : Request
13763
14014
  ]),
13764
- _ts_metadata49("design:returntype", Promise)
14015
+ _ts_metadata50("design:returntype", Promise)
13765
14016
  ], SessionController.prototype, "listSessions", null);
13766
- _ts_decorate50([
14017
+ _ts_decorate51([
13767
14018
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13768
14019
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13769
14020
  common.HttpCode(common.HttpStatus.NO_CONTENT),
14021
+ RequestEncoding("unchecked"),
13770
14022
  common.Post("revoke-all"),
13771
14023
  _ts_param29(0, CurrentUser()),
13772
14024
  _ts_param29(1, common.Req()),
13773
- _ts_metadata49("design:type", Function),
13774
- _ts_metadata49("design:paramtypes", [
14025
+ _ts_metadata50("design:type", Function),
14026
+ _ts_metadata50("design:paramtypes", [
13775
14027
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13776
14028
  typeof Request === "undefined" ? Object : Request
13777
14029
  ]),
13778
- _ts_metadata49("design:returntype", Promise)
14030
+ _ts_metadata50("design:returntype", Promise)
13779
14031
  ], SessionController.prototype, "revokeAllSessions", null);
13780
- _ts_decorate50([
14032
+ _ts_decorate51([
13781
14033
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
13782
14034
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
13783
14035
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13784
14036
  common.Delete(":id"),
13785
14037
  _ts_param29(0, CurrentUser()),
13786
14038
  _ts_param29(1, common.Param("id")),
13787
- _ts_metadata49("design:type", Function),
13788
- _ts_metadata49("design:paramtypes", [
14039
+ _ts_metadata50("design:type", Function),
14040
+ _ts_metadata50("design:paramtypes", [
13789
14041
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13790
14042
  String
13791
14043
  ]),
13792
- _ts_metadata49("design:returntype", Promise)
14044
+ _ts_metadata50("design:returntype", Promise)
13793
14045
  ], SessionController.prototype, "revokeSession", null);
13794
- SessionController = _ts_decorate50([
14046
+ SessionController = _ts_decorate51([
13795
14047
  common.UseInterceptors(NoStoreInterceptor),
13796
14048
  common.Controller("sessions"),
13797
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
14049
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
13798
14050
  common.UsePipes(createAuthValidationPipe()),
13799
14051
  _ts_param29(0, common.Inject(exports.SessionService)),
13800
14052
  _ts_param29(1, common.Inject(exports.TokenDeliveryService)),
13801
- _ts_metadata49("design:type", Function),
13802
- _ts_metadata49("design:paramtypes", [
14053
+ _ts_metadata50("design:type", Function),
14054
+ _ts_metadata50("design:paramtypes", [
13803
14055
  typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
13804
14056
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13805
14057
  ])
13806
14058
  ], SessionController);
13807
14059
  var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
13808
14060
  var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => common.SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
13809
- function _ts_decorate51(decorators, target, key, desc) {
14061
+ function _ts_decorate52(decorators, target, key, desc) {
13810
14062
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13811
14063
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13812
14064
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13819,13 +14071,13 @@ function _ts_decorate51(decorators, target, key, desc) {
13819
14071
  }
13820
14072
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13821
14073
  }
13822
- __name(_ts_decorate51, "_ts_decorate");
13823
- function _ts_metadata50(metadataKey, metadataValue) {
14074
+ __name(_ts_decorate52, "_ts_decorate");
14075
+ function _ts_metadata51(metadataKey, metadataValue) {
13824
14076
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13825
14077
  return Reflect.metadata(metadataKey, metadataValue);
13826
14078
  }
13827
14079
  }
13828
- __name(_ts_metadata50, "_ts_metadata");
14080
+ __name(_ts_metadata51, "_ts_metadata");
13829
14081
  function _ts_param30(paramIndex, decorator) {
13830
14082
  return function(target, key) {
13831
14083
  decorator(target, key, paramIndex);
@@ -13892,12 +14144,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
13892
14144
  await this.flush();
13893
14145
  }
13894
14146
  };
13895
- ApiKeyLastUsedService = _ts_decorate51([
14147
+ ApiKeyLastUsedService = _ts_decorate52([
13896
14148
  common.Injectable(),
13897
14149
  _ts_param30(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
13898
14150
  _ts_param30(1, common.Inject(BYMAX_AUTH_OPTIONS)),
13899
- _ts_metadata50("design:type", Function),
13900
- _ts_metadata50("design:paramtypes", [
14151
+ _ts_metadata51("design:type", Function),
14152
+ _ts_metadata51("design:paramtypes", [
13901
14153
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
13902
14154
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
13903
14155
  ])
@@ -13946,7 +14198,7 @@ function digestsMatch(computed, stored) {
13946
14198
  __name(digestsMatch, "digestsMatch");
13947
14199
 
13948
14200
  // src/server/services/api-key-verifier.service.ts
13949
- function _ts_decorate52(decorators, target, key, desc) {
14201
+ function _ts_decorate53(decorators, target, key, desc) {
13950
14202
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13951
14203
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13952
14204
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13959,13 +14211,13 @@ function _ts_decorate52(decorators, target, key, desc) {
13959
14211
  }
13960
14212
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13961
14213
  }
13962
- __name(_ts_decorate52, "_ts_decorate");
13963
- function _ts_metadata51(metadataKey, metadataValue) {
14214
+ __name(_ts_decorate53, "_ts_decorate");
14215
+ function _ts_metadata52(metadataKey, metadataValue) {
13964
14216
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13965
14217
  return Reflect.metadata(metadataKey, metadataValue);
13966
14218
  }
13967
14219
  }
13968
- __name(_ts_metadata51, "_ts_metadata");
14220
+ __name(_ts_metadata52, "_ts_metadata");
13969
14221
  function _ts_param31(paramIndex, decorator) {
13970
14222
  return function(target, key) {
13971
14223
  decorator(target, key, paramIndex);
@@ -14031,14 +14283,14 @@ var ApiKeyVerifierService = class {
14031
14283
  return null;
14032
14284
  }
14033
14285
  };
14034
- ApiKeyVerifierService = _ts_decorate52([
14286
+ ApiKeyVerifierService = _ts_decorate53([
14035
14287
  common.Injectable(),
14036
14288
  _ts_param31(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
14037
14289
  _ts_param31(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
14038
14290
  _ts_param31(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14039
14291
  _ts_param31(3, common.Inject(ApiKeyLastUsedService)),
14040
- _ts_metadata51("design:type", Function),
14041
- _ts_metadata51("design:paramtypes", [
14292
+ _ts_metadata52("design:type", Function),
14293
+ _ts_metadata52("design:paramtypes", [
14042
14294
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
14043
14295
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
14044
14296
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14047,7 +14299,7 @@ ApiKeyVerifierService = _ts_decorate52([
14047
14299
  ], ApiKeyVerifierService);
14048
14300
 
14049
14301
  // src/server/guards/api-key.guard.ts
14050
- function _ts_decorate53(decorators, target, key, desc) {
14302
+ function _ts_decorate54(decorators, target, key, desc) {
14051
14303
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14052
14304
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14053
14305
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14060,13 +14312,13 @@ function _ts_decorate53(decorators, target, key, desc) {
14060
14312
  }
14061
14313
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14062
14314
  }
14063
- __name(_ts_decorate53, "_ts_decorate");
14064
- function _ts_metadata52(metadataKey, metadataValue) {
14315
+ __name(_ts_decorate54, "_ts_decorate");
14316
+ function _ts_metadata53(metadataKey, metadataValue) {
14065
14317
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14066
14318
  return Reflect.metadata(metadataKey, metadataValue);
14067
14319
  }
14068
14320
  }
14069
- __name(_ts_metadata52, "_ts_metadata");
14321
+ __name(_ts_metadata53, "_ts_metadata");
14070
14322
  function _ts_param32(paramIndex, decorator) {
14071
14323
  return function(target, key) {
14072
14324
  decorator(target, key, paramIndex);
@@ -14212,15 +14464,15 @@ exports.ApiKeyGuard = class _ApiKeyGuard {
14212
14464
  };
14213
14465
  }
14214
14466
  };
14215
- exports.ApiKeyGuard = _ts_decorate53([
14467
+ exports.ApiKeyGuard = _ts_decorate54([
14216
14468
  common.Injectable(),
14217
14469
  _ts_param32(0, common.Inject(core.Reflector)),
14218
14470
  _ts_param32(1, common.Inject(ApiKeyVerifierService)),
14219
14471
  _ts_param32(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14220
14472
  _ts_param32(3, common.Inject(BYMAX_AUTH_HOOKS)),
14221
14473
  _ts_param32(3, common.Optional()),
14222
- _ts_metadata52("design:type", Function),
14223
- _ts_metadata52("design:paramtypes", [
14474
+ _ts_metadata53("design:type", Function),
14475
+ _ts_metadata53("design:paramtypes", [
14224
14476
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14225
14477
  typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
14226
14478
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14232,7 +14484,7 @@ function routePattern(request) {
14232
14484
  return typeof path === "string" ? path : "";
14233
14485
  }
14234
14486
  __name(routePattern, "routePattern");
14235
- function _ts_decorate54(decorators, target, key, desc) {
14487
+ function _ts_decorate55(decorators, target, key, desc) {
14236
14488
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14237
14489
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14238
14490
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14245,13 +14497,13 @@ function _ts_decorate54(decorators, target, key, desc) {
14245
14497
  }
14246
14498
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14247
14499
  }
14248
- __name(_ts_decorate54, "_ts_decorate");
14249
- function _ts_metadata53(metadataKey, metadataValue) {
14500
+ __name(_ts_decorate55, "_ts_decorate");
14501
+ function _ts_metadata54(metadataKey, metadataValue) {
14250
14502
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14251
14503
  return Reflect.metadata(metadataKey, metadataValue);
14252
14504
  }
14253
14505
  }
14254
- __name(_ts_metadata53, "_ts_metadata");
14506
+ __name(_ts_metadata54, "_ts_metadata");
14255
14507
  function _ts_param33(paramIndex, decorator) {
14256
14508
  return function(target, key) {
14257
14509
  decorator(target, key, paramIndex);
@@ -14284,11 +14536,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
14284
14536
  return true;
14285
14537
  }
14286
14538
  };
14287
- exports.MfaRequiredGuard = _ts_decorate54([
14539
+ exports.MfaRequiredGuard = _ts_decorate55([
14288
14540
  common.Injectable(),
14289
14541
  _ts_param33(0, common.Inject(core.Reflector)),
14290
- _ts_metadata53("design:type", Function),
14291
- _ts_metadata53("design:paramtypes", [
14542
+ _ts_metadata54("design:type", Function),
14543
+ _ts_metadata54("design:paramtypes", [
14292
14544
  typeof core.Reflector === "undefined" ? Object : core.Reflector
14293
14545
  ])
14294
14546
  ], exports.MfaRequiredGuard);
@@ -14296,7 +14548,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
14296
14548
  var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
14297
14549
 
14298
14550
  // src/server/guards/platform-roles.guard.ts
14299
- function _ts_decorate55(decorators, target, key, desc) {
14551
+ function _ts_decorate56(decorators, target, key, desc) {
14300
14552
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14301
14553
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14302
14554
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14309,13 +14561,13 @@ function _ts_decorate55(decorators, target, key, desc) {
14309
14561
  }
14310
14562
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14311
14563
  }
14312
- __name(_ts_decorate55, "_ts_decorate");
14313
- function _ts_metadata54(metadataKey, metadataValue) {
14564
+ __name(_ts_decorate56, "_ts_decorate");
14565
+ function _ts_metadata55(metadataKey, metadataValue) {
14314
14566
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14315
14567
  return Reflect.metadata(metadataKey, metadataValue);
14316
14568
  }
14317
14569
  }
14318
- __name(_ts_metadata54, "_ts_metadata");
14570
+ __name(_ts_metadata55, "_ts_metadata");
14319
14571
  function _ts_param34(paramIndex, decorator) {
14320
14572
  return function(target, key) {
14321
14573
  decorator(target, key, paramIndex);
@@ -14355,12 +14607,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
14355
14607
  return true;
14356
14608
  }
14357
14609
  };
14358
- exports.PlatformRolesGuard = _ts_decorate55([
14610
+ exports.PlatformRolesGuard = _ts_decorate56([
14359
14611
  common.Injectable(),
14360
14612
  _ts_param34(0, common.Inject(core.Reflector)),
14361
14613
  _ts_param34(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14362
- _ts_metadata54("design:type", Function),
14363
- _ts_metadata54("design:paramtypes", [
14614
+ _ts_metadata55("design:type", Function),
14615
+ _ts_metadata55("design:paramtypes", [
14364
14616
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14365
14617
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14366
14618
  ])
@@ -14369,7 +14621,7 @@ var ROLES_KEY = "roles";
14369
14621
  var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
14370
14622
 
14371
14623
  // src/server/guards/roles.guard.ts
14372
- function _ts_decorate56(decorators, target, key, desc) {
14624
+ function _ts_decorate57(decorators, target, key, desc) {
14373
14625
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14374
14626
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14375
14627
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14382,13 +14634,13 @@ function _ts_decorate56(decorators, target, key, desc) {
14382
14634
  }
14383
14635
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14384
14636
  }
14385
- __name(_ts_decorate56, "_ts_decorate");
14386
- function _ts_metadata55(metadataKey, metadataValue) {
14637
+ __name(_ts_decorate57, "_ts_decorate");
14638
+ function _ts_metadata56(metadataKey, metadataValue) {
14387
14639
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14388
14640
  return Reflect.metadata(metadataKey, metadataValue);
14389
14641
  }
14390
14642
  }
14391
- __name(_ts_metadata55, "_ts_metadata");
14643
+ __name(_ts_metadata56, "_ts_metadata");
14392
14644
  function _ts_param35(paramIndex, decorator) {
14393
14645
  return function(target, key) {
14394
14646
  decorator(target, key, paramIndex);
@@ -14424,17 +14676,17 @@ exports.RolesGuard = class RolesGuard {
14424
14676
  return true;
14425
14677
  }
14426
14678
  };
14427
- exports.RolesGuard = _ts_decorate56([
14679
+ exports.RolesGuard = _ts_decorate57([
14428
14680
  common.Injectable(),
14429
14681
  _ts_param35(0, common.Inject(core.Reflector)),
14430
14682
  _ts_param35(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14431
- _ts_metadata55("design:type", Function),
14432
- _ts_metadata55("design:paramtypes", [
14683
+ _ts_metadata56("design:type", Function),
14684
+ _ts_metadata56("design:paramtypes", [
14433
14685
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14434
14686
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14435
14687
  ])
14436
14688
  ], exports.RolesGuard);
14437
- function _ts_decorate57(decorators, target, key, desc) {
14689
+ function _ts_decorate58(decorators, target, key, desc) {
14438
14690
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14439
14691
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14440
14692
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14447,7 +14699,7 @@ function _ts_decorate57(decorators, target, key, desc) {
14447
14699
  }
14448
14700
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14449
14701
  }
14450
- __name(_ts_decorate57, "_ts_decorate");
14702
+ __name(_ts_decorate58, "_ts_decorate");
14451
14703
  exports.NoOpAuthHooks = class NoOpAuthHooks {
14452
14704
  static {
14453
14705
  __name(this, "NoOpAuthHooks");
@@ -14496,7 +14748,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
14496
14748
  };
14497
14749
  }
14498
14750
  };
14499
- exports.NoOpAuthHooks = _ts_decorate57([
14751
+ exports.NoOpAuthHooks = _ts_decorate58([
14500
14752
  common.Injectable()
14501
14753
  ], exports.NoOpAuthHooks);
14502
14754
 
@@ -14509,7 +14761,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
14509
14761
  var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
14510
14762
 
14511
14763
  // src/server/oauth/oauth.service.ts
14512
- function _ts_decorate58(decorators, target, key, desc) {
14764
+ function _ts_decorate59(decorators, target, key, desc) {
14513
14765
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14514
14766
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14515
14767
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14522,13 +14774,13 @@ function _ts_decorate58(decorators, target, key, desc) {
14522
14774
  }
14523
14775
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14524
14776
  }
14525
- __name(_ts_decorate58, "_ts_decorate");
14526
- function _ts_metadata56(metadataKey, metadataValue) {
14777
+ __name(_ts_decorate59, "_ts_decorate");
14778
+ function _ts_metadata57(metadataKey, metadataValue) {
14527
14779
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14528
14780
  return Reflect.metadata(metadataKey, metadataValue);
14529
14781
  }
14530
14782
  }
14531
- __name(_ts_metadata56, "_ts_metadata");
14783
+ __name(_ts_metadata57, "_ts_metadata");
14532
14784
  function _ts_param36(paramIndex, decorator) {
14533
14785
  return function(target, key) {
14534
14786
  decorator(target, key, paramIndex);
@@ -14828,7 +15080,7 @@ exports.OAuthService = class _OAuthService {
14828
15080
  return plugin;
14829
15081
  }
14830
15082
  };
14831
- exports.OAuthService = _ts_decorate58([
15083
+ exports.OAuthService = _ts_decorate59([
14832
15084
  common.Injectable(),
14833
15085
  _ts_param36(0, common.Inject(OAUTH_PLUGINS)),
14834
15086
  _ts_param36(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -14838,8 +15090,8 @@ exports.OAuthService = _ts_decorate58([
14838
15090
  _ts_param36(4, common.Inject(TokenManagerService)),
14839
15091
  _ts_param36(5, common.Inject(exports.SessionService)),
14840
15092
  _ts_param36(6, common.Inject(BYMAX_AUTH_OPTIONS)),
14841
- _ts_metadata56("design:type", Function),
14842
- _ts_metadata56("design:paramtypes", [
15093
+ _ts_metadata57("design:type", Function),
15094
+ _ts_metadata57("design:paramtypes", [
14843
15095
  Array,
14844
15096
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
14845
15097
  Object,
@@ -14849,7 +15101,7 @@ exports.OAuthService = _ts_decorate58([
14849
15101
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14850
15102
  ])
14851
15103
  ], exports.OAuthService);
14852
- function _ts_decorate59(decorators, target, key, desc) {
15104
+ function _ts_decorate60(decorators, target, key, desc) {
14853
15105
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14854
15106
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14855
15107
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14862,13 +15114,13 @@ function _ts_decorate59(decorators, target, key, desc) {
14862
15114
  }
14863
15115
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14864
15116
  }
14865
- __name(_ts_decorate59, "_ts_decorate");
14866
- function _ts_metadata57(metadataKey, metadataValue) {
15117
+ __name(_ts_decorate60, "_ts_decorate");
15118
+ function _ts_metadata58(metadataKey, metadataValue) {
14867
15119
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14868
15120
  return Reflect.metadata(metadataKey, metadataValue);
14869
15121
  }
14870
15122
  }
14871
- __name(_ts_metadata57, "_ts_metadata");
15123
+ __name(_ts_metadata58, "_ts_metadata");
14872
15124
  var OAuthCallbackQueryDto = class {
14873
15125
  static {
14874
15126
  __name(this, "OAuthCallbackQueryDto");
@@ -14967,69 +15219,69 @@ var OAuthCallbackQueryDto = class {
14967
15219
  */
14968
15220
  hd;
14969
15221
  };
14970
- _ts_decorate59([
15222
+ _ts_decorate60([
14971
15223
  classValidator.ValidateIf((query) => query.error === void 0 || query.error === null),
14972
15224
  classValidator.IsOptional(),
14973
15225
  classValidator.IsString(),
14974
15226
  classValidator.IsNotEmpty(),
14975
15227
  classValidator.MaxLength(2048),
14976
- _ts_metadata57("design:type", String)
15228
+ _ts_metadata58("design:type", String)
14977
15229
  ], OAuthCallbackQueryDto.prototype, "code", void 0);
14978
- _ts_decorate59([
15230
+ _ts_decorate60([
14979
15231
  classValidator.IsOptional(),
14980
15232
  classValidator.IsString(),
14981
15233
  classValidator.MaxLength(128),
14982
- _ts_metadata57("design:type", String)
15234
+ _ts_metadata58("design:type", String)
14983
15235
  ], OAuthCallbackQueryDto.prototype, "error", void 0);
14984
- _ts_decorate59([
15236
+ _ts_decorate60([
14985
15237
  classValidator.IsOptional(),
14986
15238
  classValidator.IsString(),
14987
15239
  classValidator.MaxLength(512),
14988
- _ts_metadata57("design:type", String)
15240
+ _ts_metadata58("design:type", String)
14989
15241
  ], OAuthCallbackQueryDto.prototype, "error_description", void 0);
14990
- _ts_decorate59([
15242
+ _ts_decorate60([
14991
15243
  classValidator.IsOptional(),
14992
15244
  classValidator.IsString(),
14993
15245
  classValidator.MaxLength(512),
14994
- _ts_metadata57("design:type", String)
15246
+ _ts_metadata58("design:type", String)
14995
15247
  ], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
14996
- _ts_decorate59([
15248
+ _ts_decorate60([
14997
15249
  classValidator.IsString(),
14998
15250
  classValidator.IsNotEmpty(),
14999
15251
  classValidator.MaxLength(128),
15000
- _ts_metadata57("design:type", String)
15252
+ _ts_metadata58("design:type", String)
15001
15253
  ], OAuthCallbackQueryDto.prototype, "state", void 0);
15002
- _ts_decorate59([
15254
+ _ts_decorate60([
15003
15255
  classValidator.IsOptional(),
15004
15256
  classValidator.IsString(),
15005
15257
  classValidator.MaxLength(512),
15006
- _ts_metadata57("design:type", String)
15258
+ _ts_metadata58("design:type", String)
15007
15259
  ], OAuthCallbackQueryDto.prototype, "iss", void 0);
15008
- _ts_decorate59([
15260
+ _ts_decorate60([
15009
15261
  classValidator.IsOptional(),
15010
15262
  classValidator.IsString(),
15011
15263
  classValidator.MaxLength(2048),
15012
- _ts_metadata57("design:type", String)
15264
+ _ts_metadata58("design:type", String)
15013
15265
  ], OAuthCallbackQueryDto.prototype, "scope", void 0);
15014
- _ts_decorate59([
15266
+ _ts_decorate60([
15015
15267
  classValidator.IsOptional(),
15016
15268
  classValidator.IsString(),
15017
15269
  classValidator.MaxLength(16),
15018
- _ts_metadata57("design:type", String)
15270
+ _ts_metadata58("design:type", String)
15019
15271
  ], OAuthCallbackQueryDto.prototype, "authuser", void 0);
15020
- _ts_decorate59([
15272
+ _ts_decorate60([
15021
15273
  classValidator.IsOptional(),
15022
15274
  classValidator.IsString(),
15023
15275
  classValidator.MaxLength(64),
15024
- _ts_metadata57("design:type", String)
15276
+ _ts_metadata58("design:type", String)
15025
15277
  ], OAuthCallbackQueryDto.prototype, "prompt", void 0);
15026
- _ts_decorate59([
15278
+ _ts_decorate60([
15027
15279
  classValidator.IsOptional(),
15028
15280
  classValidator.IsString(),
15029
15281
  classValidator.MaxLength(253),
15030
- _ts_metadata57("design:type", String)
15282
+ _ts_metadata58("design:type", String)
15031
15283
  ], OAuthCallbackQueryDto.prototype, "hd", void 0);
15032
- function _ts_decorate60(decorators, target, key, desc) {
15284
+ function _ts_decorate61(decorators, target, key, desc) {
15033
15285
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15034
15286
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15035
15287
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15042,13 +15294,13 @@ function _ts_decorate60(decorators, target, key, desc) {
15042
15294
  }
15043
15295
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15044
15296
  }
15045
- __name(_ts_decorate60, "_ts_decorate");
15046
- function _ts_metadata58(metadataKey, metadataValue) {
15297
+ __name(_ts_decorate61, "_ts_decorate");
15298
+ function _ts_metadata59(metadataKey, metadataValue) {
15047
15299
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15048
15300
  return Reflect.metadata(metadataKey, metadataValue);
15049
15301
  }
15050
15302
  }
15051
- __name(_ts_metadata58, "_ts_metadata");
15303
+ __name(_ts_metadata59, "_ts_metadata");
15052
15304
  var OAuthInitiateQueryDto = class {
15053
15305
  static {
15054
15306
  __name(this, "OAuthInitiateQueryDto");
@@ -15065,7 +15317,7 @@ var OAuthInitiateQueryDto = class {
15065
15317
  */
15066
15318
  tenantId;
15067
15319
  };
15068
- _ts_decorate60([
15320
+ _ts_decorate61([
15069
15321
  classValidator.IsOptional(),
15070
15322
  classValidator.IsString(),
15071
15323
  classValidator.IsNotEmpty(),
@@ -15073,11 +15325,11 @@ _ts_decorate60([
15073
15325
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
15074
15326
  message: "tenantId must not contain control characters"
15075
15327
  }),
15076
- _ts_metadata58("design:type", String)
15328
+ _ts_metadata59("design:type", String)
15077
15329
  ], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
15078
15330
 
15079
15331
  // src/server/oauth/oauth.controller.ts
15080
- function _ts_decorate61(decorators, target, key, desc) {
15332
+ function _ts_decorate62(decorators, target, key, desc) {
15081
15333
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15082
15334
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15083
15335
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15090,13 +15342,13 @@ function _ts_decorate61(decorators, target, key, desc) {
15090
15342
  }
15091
15343
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15092
15344
  }
15093
- __name(_ts_decorate61, "_ts_decorate");
15094
- function _ts_metadata59(metadataKey, metadataValue) {
15345
+ __name(_ts_decorate62, "_ts_decorate");
15346
+ function _ts_metadata60(metadataKey, metadataValue) {
15095
15347
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15096
15348
  return Reflect.metadata(metadataKey, metadataValue);
15097
15349
  }
15098
15350
  }
15099
- __name(_ts_metadata59, "_ts_metadata");
15351
+ __name(_ts_metadata60, "_ts_metadata");
15100
15352
  function _ts_param37(paramIndex, decorator) {
15101
15353
  return function(target, key) {
15102
15354
  decorator(target, key, paramIndex);
@@ -15320,7 +15572,7 @@ var OAuthController = class _OAuthController {
15320
15572
  });
15321
15573
  }
15322
15574
  };
15323
- _ts_decorate61([
15575
+ _ts_decorate62([
15324
15576
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15325
15577
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15326
15578
  common.Get(":provider"),
@@ -15330,16 +15582,16 @@ _ts_decorate61([
15330
15582
  _ts_param37(3, common.Res({
15331
15583
  passthrough: true
15332
15584
  })),
15333
- _ts_metadata59("design:type", Function),
15334
- _ts_metadata59("design:paramtypes", [
15585
+ _ts_metadata60("design:type", Function),
15586
+ _ts_metadata60("design:paramtypes", [
15335
15587
  String,
15336
15588
  typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
15337
15589
  typeof Request === "undefined" ? Object : Request,
15338
15590
  typeof Response === "undefined" ? Object : Response
15339
15591
  ]),
15340
- _ts_metadata59("design:returntype", Promise)
15592
+ _ts_metadata60("design:returntype", Promise)
15341
15593
  ], OAuthController.prototype, "initiate", null);
15342
- _ts_decorate61([
15594
+ _ts_decorate62([
15343
15595
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
15344
15596
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
15345
15597
  common.HttpCode(common.HttpStatus.OK),
@@ -15350,29 +15602,29 @@ _ts_decorate61([
15350
15602
  _ts_param37(3, common.Res({
15351
15603
  passthrough: true
15352
15604
  })),
15353
- _ts_metadata59("design:type", Function),
15354
- _ts_metadata59("design:paramtypes", [
15605
+ _ts_metadata60("design:type", Function),
15606
+ _ts_metadata60("design:paramtypes", [
15355
15607
  String,
15356
15608
  typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
15357
15609
  typeof Request === "undefined" ? Object : Request,
15358
15610
  typeof Response === "undefined" ? Object : Response
15359
15611
  ]),
15360
- _ts_metadata59("design:returntype", Promise)
15612
+ _ts_metadata60("design:returntype", Promise)
15361
15613
  ], OAuthController.prototype, "callback", null);
15362
- OAuthController = _ts_decorate61([
15614
+ OAuthController = _ts_decorate62([
15363
15615
  Public(),
15364
15616
  SkipMfa(),
15365
15617
  common.UseInterceptors(NoStoreInterceptor),
15366
15618
  common.Controller("oauth"),
15367
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
15619
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
15368
15620
  common.UsePipes(createAuthValidationPipe({
15369
15621
  forbidUnknownValues: true
15370
15622
  })),
15371
15623
  _ts_param37(0, common.Inject(exports.OAuthService)),
15372
15624
  _ts_param37(1, common.Inject(exports.TokenDeliveryService)),
15373
15625
  _ts_param37(2, common.Inject(BYMAX_AUTH_OPTIONS)),
15374
- _ts_metadata59("design:type", Function),
15375
- _ts_metadata59("design:paramtypes", [
15626
+ _ts_metadata60("design:type", Function),
15627
+ _ts_metadata60("design:paramtypes", [
15376
15628
  typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
15377
15629
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
15378
15630
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -15511,7 +15763,7 @@ var GoogleOAuthPlugin = class {
15511
15763
  };
15512
15764
 
15513
15765
  // src/server/oauth/oauth.module.ts
15514
- function _ts_decorate62(decorators, target, key, desc) {
15766
+ function _ts_decorate63(decorators, target, key, desc) {
15515
15767
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15516
15768
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15517
15769
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15524,7 +15776,7 @@ function _ts_decorate62(decorators, target, key, desc) {
15524
15776
  }
15525
15777
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15526
15778
  }
15527
- __name(_ts_decorate62, "_ts_decorate");
15779
+ __name(_ts_decorate63, "_ts_decorate");
15528
15780
  function buildOAuthPlugins(options) {
15529
15781
  const plugins = [];
15530
15782
  if (options.oauth?.google) {
@@ -15594,7 +15846,7 @@ var OAuthModule = class _OAuthModule {
15594
15846
  };
15595
15847
  }
15596
15848
  };
15597
- OAuthModule = _ts_decorate62([
15849
+ OAuthModule = _ts_decorate63([
15598
15850
  common.Module({})
15599
15851
  ], OAuthModule);
15600
15852
 
@@ -16489,7 +16741,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
16489
16741
  __name(schemesFor, "schemesFor");
16490
16742
 
16491
16743
  // src/server/openapi/auth-openapi.contributor.ts
16492
- function _ts_decorate63(decorators, target, key, desc) {
16744
+ function _ts_decorate64(decorators, target, key, desc) {
16493
16745
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16494
16746
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16495
16747
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16502,13 +16754,13 @@ function _ts_decorate63(decorators, target, key, desc) {
16502
16754
  }
16503
16755
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16504
16756
  }
16505
- __name(_ts_decorate63, "_ts_decorate");
16506
- function _ts_metadata60(metadataKey, metadataValue) {
16757
+ __name(_ts_decorate64, "_ts_decorate");
16758
+ function _ts_metadata61(metadataKey, metadataValue) {
16507
16759
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16508
16760
  return Reflect.metadata(metadataKey, metadataValue);
16509
16761
  }
16510
16762
  }
16511
- __name(_ts_metadata60, "_ts_metadata");
16763
+ __name(_ts_metadata61, "_ts_metadata");
16512
16764
  function _ts_param38(paramIndex, decorator) {
16513
16765
  return function(target, key) {
16514
16766
  decorator(target, key, paramIndex);
@@ -16534,18 +16786,18 @@ var AuthOpenApiContributor = class {
16534
16786
  return buildAuthOpenApiFragment(this.options, this.registered);
16535
16787
  }
16536
16788
  };
16537
- AuthOpenApiContributor = _ts_decorate63([
16789
+ AuthOpenApiContributor = _ts_decorate64([
16538
16790
  common.Injectable(),
16539
16791
  common.SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
16540
16792
  _ts_param38(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16541
16793
  _ts_param38(1, common.Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
16542
- _ts_metadata60("design:type", Function),
16543
- _ts_metadata60("design:paramtypes", [
16794
+ _ts_metadata61("design:type", Function),
16795
+ _ts_metadata61("design:paramtypes", [
16544
16796
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
16545
16797
  typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
16546
16798
  ])
16547
16799
  ], AuthOpenApiContributor);
16548
- function _ts_decorate64(decorators, target, key, desc) {
16800
+ function _ts_decorate65(decorators, target, key, desc) {
16549
16801
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16550
16802
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16551
16803
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16558,13 +16810,13 @@ function _ts_decorate64(decorators, target, key, desc) {
16558
16810
  }
16559
16811
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16560
16812
  }
16561
- __name(_ts_decorate64, "_ts_decorate");
16562
- function _ts_metadata61(metadataKey, metadataValue) {
16813
+ __name(_ts_decorate65, "_ts_decorate");
16814
+ function _ts_metadata62(metadataKey, metadataValue) {
16563
16815
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16564
16816
  return Reflect.metadata(metadataKey, metadataValue);
16565
16817
  }
16566
16818
  }
16567
- __name(_ts_metadata61, "_ts_metadata");
16819
+ __name(_ts_metadata62, "_ts_metadata");
16568
16820
  function _ts_param39(paramIndex, decorator) {
16569
16821
  return function(target, key) {
16570
16822
  decorator(target, key, paramIndex);
@@ -16876,16 +17128,16 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
16876
17128
  return false;
16877
17129
  }
16878
17130
  };
16879
- exports.CommonPasswordChecker = _ts_decorate64([
17131
+ exports.CommonPasswordChecker = _ts_decorate65([
16880
17132
  common.Injectable(),
16881
17133
  _ts_param39(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16882
17134
  _ts_param39(0, common.Optional()),
16883
- _ts_metadata61("design:type", Function),
16884
- _ts_metadata61("design:paramtypes", [
17135
+ _ts_metadata62("design:type", Function),
17136
+ _ts_metadata62("design:paramtypes", [
16885
17137
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
16886
17138
  ])
16887
17139
  ], exports.CommonPasswordChecker);
16888
- function _ts_decorate65(decorators, target, key, desc) {
17140
+ function _ts_decorate66(decorators, target, key, desc) {
16889
17141
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16890
17142
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16891
17143
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16898,7 +17150,7 @@ function _ts_decorate65(decorators, target, key, desc) {
16898
17150
  }
16899
17151
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16900
17152
  }
16901
- __name(_ts_decorate65, "_ts_decorate");
17153
+ __name(_ts_decorate66, "_ts_decorate");
16902
17154
  exports.NoOpEmailProvider = class _NoOpEmailProvider {
16903
17155
  static {
16904
17156
  __name(this, "NoOpEmailProvider");
@@ -16933,7 +17185,7 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
16933
17185
  this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
16934
17186
  }
16935
17187
  };
16936
- exports.NoOpEmailProvider = _ts_decorate65([
17188
+ exports.NoOpEmailProvider = _ts_decorate66([
16937
17189
  common.Injectable()
16938
17190
  ], exports.NoOpEmailProvider);
16939
17191
 
@@ -16947,7 +17199,7 @@ var SystemApiKeyClock = class {
16947
17199
  return /* @__PURE__ */ new Date();
16948
17200
  }
16949
17201
  };
16950
- function _ts_decorate66(decorators, target, key, desc) {
17202
+ function _ts_decorate67(decorators, target, key, desc) {
16951
17203
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16952
17204
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16953
17205
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16960,13 +17212,13 @@ function _ts_decorate66(decorators, target, key, desc) {
16960
17212
  }
16961
17213
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16962
17214
  }
16963
- __name(_ts_decorate66, "_ts_decorate");
16964
- function _ts_metadata62(metadataKey, metadataValue) {
17215
+ __name(_ts_decorate67, "_ts_decorate");
17216
+ function _ts_metadata63(metadataKey, metadataValue) {
16965
17217
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16966
17218
  return Reflect.metadata(metadataKey, metadataValue);
16967
17219
  }
16968
17220
  }
16969
- __name(_ts_metadata62, "_ts_metadata");
17221
+ __name(_ts_metadata63, "_ts_metadata");
16970
17222
  function _ts_param40(paramIndex, decorator) {
16971
17223
  return function(target, key) {
16972
17224
  decorator(target, key, paramIndex);
@@ -17015,21 +17267,21 @@ var ApiKeyScopeAuditService = class {
17015
17267
  }
17016
17268
  }
17017
17269
  };
17018
- ApiKeyScopeAuditService = _ts_decorate66([
17270
+ ApiKeyScopeAuditService = _ts_decorate67([
17019
17271
  common.Injectable(),
17020
17272
  _ts_param40(0, common.Inject(core.DiscoveryService)),
17021
17273
  _ts_param40(1, common.Inject(core.MetadataScanner)),
17022
17274
  _ts_param40(2, common.Inject(core.Reflector)),
17023
17275
  _ts_param40(3, common.Inject(BYMAX_AUTH_OPTIONS)),
17024
- _ts_metadata62("design:type", Function),
17025
- _ts_metadata62("design:paramtypes", [
17276
+ _ts_metadata63("design:type", Function),
17277
+ _ts_metadata63("design:paramtypes", [
17026
17278
  typeof core.DiscoveryService === "undefined" ? Object : core.DiscoveryService,
17027
17279
  typeof core.MetadataScanner === "undefined" ? Object : core.MetadataScanner,
17028
17280
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
17029
17281
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
17030
17282
  ])
17031
17283
  ], ApiKeyScopeAuditService);
17032
- function _ts_decorate67(decorators, target, key, desc) {
17284
+ function _ts_decorate68(decorators, target, key, desc) {
17033
17285
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17034
17286
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17035
17287
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17042,13 +17294,13 @@ function _ts_decorate67(decorators, target, key, desc) {
17042
17294
  }
17043
17295
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17044
17296
  }
17045
- __name(_ts_decorate67, "_ts_decorate");
17046
- function _ts_metadata63(metadataKey, metadataValue) {
17297
+ __name(_ts_decorate68, "_ts_decorate");
17298
+ function _ts_metadata64(metadataKey, metadataValue) {
17047
17299
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17048
17300
  return Reflect.metadata(metadataKey, metadataValue);
17049
17301
  }
17050
17302
  }
17051
- __name(_ts_metadata63, "_ts_metadata");
17303
+ __name(_ts_metadata64, "_ts_metadata");
17052
17304
  function _ts_param41(paramIndex, decorator) {
17053
17305
  return function(target, key) {
17054
17306
  decorator(target, key, paramIndex);
@@ -17183,13 +17435,13 @@ exports.ApiKeyService = class ApiKeyService {
17183
17435
  return value;
17184
17436
  }
17185
17437
  };
17186
- exports.ApiKeyService = _ts_decorate67([
17438
+ exports.ApiKeyService = _ts_decorate68([
17187
17439
  common.Injectable(),
17188
17440
  _ts_param41(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
17189
17441
  _ts_param41(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
17190
17442
  _ts_param41(2, common.Inject(BYMAX_AUTH_OPTIONS)),
17191
- _ts_metadata63("design:type", Function),
17192
- _ts_metadata63("design:paramtypes", [
17443
+ _ts_metadata64("design:type", Function),
17444
+ _ts_metadata64("design:paramtypes", [
17193
17445
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
17194
17446
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
17195
17447
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -17271,7 +17523,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
17271
17523
  __name(assertTenantBinding, "assertTenantBinding");
17272
17524
 
17273
17525
  // src/server/services/auth-token-verifier.service.ts
17274
- function _ts_decorate68(decorators, target, key, desc) {
17526
+ function _ts_decorate69(decorators, target, key, desc) {
17275
17527
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17276
17528
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17277
17529
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17284,13 +17536,13 @@ function _ts_decorate68(decorators, target, key, desc) {
17284
17536
  }
17285
17537
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17286
17538
  }
17287
- __name(_ts_decorate68, "_ts_decorate");
17288
- function _ts_metadata64(metadataKey, metadataValue) {
17539
+ __name(_ts_decorate69, "_ts_decorate");
17540
+ function _ts_metadata65(metadataKey, metadataValue) {
17289
17541
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17290
17542
  return Reflect.metadata(metadataKey, metadataValue);
17291
17543
  }
17292
17544
  }
17293
- __name(_ts_metadata64, "_ts_metadata");
17545
+ __name(_ts_metadata65, "_ts_metadata");
17294
17546
  function _ts_param42(paramIndex, decorator) {
17295
17547
  return function(target, key) {
17296
17548
  decorator(target, key, paramIndex);
@@ -17480,14 +17732,14 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
17480
17732
  }
17481
17733
  }
17482
17734
  };
17483
- exports.AuthTokenVerifierService = _ts_decorate68([
17735
+ exports.AuthTokenVerifierService = _ts_decorate69([
17484
17736
  common.Injectable(),
17485
17737
  _ts_param42(0, common.Inject(jwt.JwtService)),
17486
17738
  _ts_param42(1, common.Inject(BYMAX_AUTH_OPTIONS)),
17487
17739
  _ts_param42(2, common.Inject(exports.AuthRevocationService)),
17488
17740
  _ts_param42(3, common.Inject(exports.AccountStatusService)),
17489
- _ts_metadata64("design:type", Function),
17490
- _ts_metadata64("design:paramtypes", [
17741
+ _ts_metadata65("design:type", Function),
17742
+ _ts_metadata65("design:paramtypes", [
17491
17743
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
17492
17744
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
17493
17745
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -17496,7 +17748,7 @@ exports.AuthTokenVerifierService = _ts_decorate68([
17496
17748
  ], exports.AuthTokenVerifierService);
17497
17749
 
17498
17750
  // src/server/bymax-auth.module.ts
17499
- function _ts_decorate69(decorators, target, key, desc) {
17751
+ function _ts_decorate70(decorators, target, key, desc) {
17500
17752
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17501
17753
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17502
17754
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17509,7 +17761,7 @@ function _ts_decorate69(decorators, target, key, desc) {
17509
17761
  }
17510
17762
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17511
17763
  }
17512
- __name(_ts_decorate69, "_ts_decorate");
17764
+ __name(_ts_decorate70, "_ts_decorate");
17513
17765
  function hasProviderToken(providers, token) {
17514
17766
  return providers.some((p) => {
17515
17767
  if (typeof p === "function") return false;
@@ -17769,6 +18021,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17769
18021
  exports.AuthService,
17770
18022
  // Guards — registered as providers so they can be applied via @UseGuards().
17771
18023
  exports.JwtAuthGuard,
18024
+ exports.RequestEncodingGuard,
17772
18025
  exports.TrustedOriginGuard,
17773
18026
  exports.AuthRateLimitGuard,
17774
18027
  // Response-header interceptor — every library controller applies it, so it must be
@@ -17801,6 +18054,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17801
18054
  exports.AuthService,
17802
18055
  // Export guards so host-app modules can apply them without reimporting.
17803
18056
  exports.JwtAuthGuard,
18057
+ exports.RequestEncodingGuard,
17804
18058
  exports.TrustedOriginGuard,
17805
18059
  exports.AuthRateLimitGuard,
17806
18060
  exports.RolesGuard,
@@ -17899,7 +18153,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17899
18153
  };
17900
18154
  }
17901
18155
  };
17902
- exports.BymaxAuthModule = _ts_decorate69([
18156
+ exports.BymaxAuthModule = _ts_decorate70([
17903
18157
  common.Module({})
17904
18158
  ], exports.BymaxAuthModule);
17905
18159
 
@@ -18227,7 +18481,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
18227
18481
  }
18228
18482
  }
18229
18483
  };
18230
- function _ts_decorate70(decorators, target, key, desc) {
18484
+ function _ts_decorate71(decorators, target, key, desc) {
18231
18485
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18232
18486
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18233
18487
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18240,13 +18494,13 @@ function _ts_decorate70(decorators, target, key, desc) {
18240
18494
  }
18241
18495
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18242
18496
  }
18243
- __name(_ts_decorate70, "_ts_decorate");
18244
- function _ts_metadata65(metadataKey, metadataValue) {
18497
+ __name(_ts_decorate71, "_ts_decorate");
18498
+ function _ts_metadata66(metadataKey, metadataValue) {
18245
18499
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18246
18500
  return Reflect.metadata(metadataKey, metadataValue);
18247
18501
  }
18248
18502
  }
18249
- __name(_ts_metadata65, "_ts_metadata");
18503
+ __name(_ts_metadata66, "_ts_metadata");
18250
18504
  var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
18251
18505
  var PREFIX_LENGTH = 5;
18252
18506
  var DEFAULT_TIMEOUT_MS = 1500;
@@ -18303,10 +18557,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
18303
18557
  }
18304
18558
  }
18305
18559
  };
18306
- exports.HibpBreachChecker = _ts_decorate70([
18560
+ exports.HibpBreachChecker = _ts_decorate71([
18307
18561
  common.Injectable(),
18308
- _ts_metadata65("design:type", Function),
18309
- _ts_metadata65("design:paramtypes", [
18562
+ _ts_metadata66("design:type", Function),
18563
+ _ts_metadata66("design:paramtypes", [
18310
18564
  Number
18311
18565
  ])
18312
18566
  ], exports.HibpBreachChecker);
@@ -18319,10 +18573,10 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
18319
18573
  return false;
18320
18574
  }
18321
18575
  };
18322
- exports.AllowAllBreachChecker = _ts_decorate70([
18576
+ exports.AllowAllBreachChecker = _ts_decorate71([
18323
18577
  common.Injectable()
18324
18578
  ], exports.AllowAllBreachChecker);
18325
- function _ts_decorate71(decorators, target, key, desc) {
18579
+ function _ts_decorate72(decorators, target, key, desc) {
18326
18580
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18327
18581
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18328
18582
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18335,7 +18589,7 @@ function _ts_decorate71(decorators, target, key, desc) {
18335
18589
  }
18336
18590
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18337
18591
  }
18338
- __name(_ts_decorate71, "_ts_decorate");
18592
+ __name(_ts_decorate72, "_ts_decorate");
18339
18593
  exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
18340
18594
  static {
18341
18595
  __name(this, "OptionalAuthGuard");
@@ -18350,10 +18604,10 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
18350
18604
  return super.canActivate(context);
18351
18605
  }
18352
18606
  };
18353
- exports.OptionalAuthGuard = _ts_decorate71([
18607
+ exports.OptionalAuthGuard = _ts_decorate72([
18354
18608
  common.Injectable()
18355
18609
  ], exports.OptionalAuthGuard);
18356
- function _ts_decorate72(decorators, target, key, desc) {
18610
+ function _ts_decorate73(decorators, target, key, desc) {
18357
18611
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18358
18612
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18359
18613
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18366,13 +18620,13 @@ function _ts_decorate72(decorators, target, key, desc) {
18366
18620
  }
18367
18621
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18368
18622
  }
18369
- __name(_ts_decorate72, "_ts_decorate");
18370
- function _ts_metadata66(metadataKey, metadataValue) {
18623
+ __name(_ts_decorate73, "_ts_decorate");
18624
+ function _ts_metadata67(metadataKey, metadataValue) {
18371
18625
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18372
18626
  return Reflect.metadata(metadataKey, metadataValue);
18373
18627
  }
18374
18628
  }
18375
- __name(_ts_metadata66, "_ts_metadata");
18629
+ __name(_ts_metadata67, "_ts_metadata");
18376
18630
  function _ts_param43(paramIndex, decorator) {
18377
18631
  return function(target, key) {
18378
18632
  decorator(target, key, paramIndex);
@@ -18408,11 +18662,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
18408
18662
  throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
18409
18663
  }
18410
18664
  };
18411
- exports.SelfOrAdminGuard = _ts_decorate72([
18665
+ exports.SelfOrAdminGuard = _ts_decorate73([
18412
18666
  common.Injectable(),
18413
18667
  _ts_param43(0, common.Inject(BYMAX_AUTH_OPTIONS)),
18414
- _ts_metadata66("design:type", Function),
18415
- _ts_metadata66("design:paramtypes", [
18668
+ _ts_metadata67("design:type", Function),
18669
+ _ts_metadata67("design:paramtypes", [
18416
18670
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
18417
18671
  ])
18418
18672
  ], exports.SelfOrAdminGuard);
@@ -18425,7 +18679,7 @@ function isHexLooking(value) {
18425
18679
  return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
18426
18680
  }
18427
18681
  __name(isHexLooking, "isHexLooking");
18428
- function _ts_decorate73(decorators, target, key, desc) {
18682
+ function _ts_decorate74(decorators, target, key, desc) {
18429
18683
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18430
18684
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18431
18685
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18438,13 +18692,13 @@ function _ts_decorate73(decorators, target, key, desc) {
18438
18692
  }
18439
18693
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18440
18694
  }
18441
- __name(_ts_decorate73, "_ts_decorate");
18442
- function _ts_metadata67(metadataKey, metadataValue) {
18695
+ __name(_ts_decorate74, "_ts_decorate");
18696
+ function _ts_metadata68(metadataKey, metadataValue) {
18443
18697
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18444
18698
  return Reflect.metadata(metadataKey, metadataValue);
18445
18699
  }
18446
18700
  }
18447
- __name(_ts_metadata67, "_ts_metadata");
18701
+ __name(_ts_metadata68, "_ts_metadata");
18448
18702
  function _ts_param44(paramIndex, decorator) {
18449
18703
  return function(target, key) {
18450
18704
  decorator(target, key, paramIndex);
@@ -18514,14 +18768,14 @@ exports.WsJwtGuard = class WsJwtGuard {
18514
18768
  return true;
18515
18769
  }
18516
18770
  };
18517
- exports.WsJwtGuard = _ts_decorate73([
18771
+ exports.WsJwtGuard = _ts_decorate74([
18518
18772
  common.Injectable(),
18519
18773
  _ts_param44(0, common.Inject(jwt.JwtService)),
18520
18774
  _ts_param44(1, common.Inject(exports.AuthRevocationService)),
18521
18775
  _ts_param44(2, common.Inject(exports.WsTicketService)),
18522
18776
  _ts_param44(3, common.Inject(BYMAX_AUTH_OPTIONS)),
18523
- _ts_metadata67("design:type", Function),
18524
- _ts_metadata67("design:paramtypes", [
18777
+ _ts_metadata68("design:type", Function),
18778
+ _ts_metadata68("design:paramtypes", [
18525
18779
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
18526
18780
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
18527
18781
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
@@ -18561,7 +18815,7 @@ function bindingInput(handshake) {
18561
18815
  };
18562
18816
  }
18563
18817
  __name(bindingInput, "bindingInput");
18564
- function _ts_decorate74(decorators, target, key, desc) {
18818
+ function _ts_decorate75(decorators, target, key, desc) {
18565
18819
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18566
18820
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18567
18821
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18574,7 +18828,7 @@ function _ts_decorate74(decorators, target, key, desc) {
18574
18828
  }
18575
18829
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18576
18830
  }
18577
- __name(_ts_decorate74, "_ts_decorate");
18831
+ __name(_ts_decorate75, "_ts_decorate");
18578
18832
  function isAuthEnvelope(body) {
18579
18833
  if (typeof body !== "object" || body === null) return false;
18580
18834
  const error = body.error;
@@ -18600,6 +18854,12 @@ function bodyParserStatus(exception) {
18600
18854
  return typeof status === "number" && status >= 400 && status < 500 ? status : void 0;
18601
18855
  }
18602
18856
  __name(bodyParserStatus, "bodyParserStatus");
18857
+ function isUntypedParserRefusal(exception) {
18858
+ if (!(exception instanceof Error)) return false;
18859
+ const { status, statusCode, expose, type } = exception;
18860
+ return status === common.HttpStatus.BAD_REQUEST && statusCode === common.HttpStatus.BAD_REQUEST && expose === true && type === void 0;
18861
+ }
18862
+ __name(isUntypedParserRefusal, "isUntypedParserRefusal");
18603
18863
  function bodyParserMessage(status) {
18604
18864
  if (status === common.HttpStatus.PAYLOAD_TOO_LARGE) return "Request entity too large";
18605
18865
  if (status === common.HttpStatus.UNSUPPORTED_MEDIA_TYPE) return "Unsupported media type";
@@ -18665,6 +18925,16 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18665
18925
  });
18666
18926
  return;
18667
18927
  }
18928
+ if (isUntypedParserRefusal(exception) && http.getRequest().route === void 0) {
18929
+ res.status(common.HttpStatus.BAD_REQUEST).json({
18930
+ error: {
18931
+ code: AUTH_ERROR_CODES.VALIDATION,
18932
+ message: MALFORMED_REQUEST_MESSAGE,
18933
+ details: null
18934
+ }
18935
+ });
18936
+ return;
18937
+ }
18668
18938
  this.logger.error(`unhandled exception: ${describeChannelStatus(exception)}`);
18669
18939
  res.status(common.HttpStatus.INTERNAL_SERVER_ERROR).json({
18670
18940
  error: {
@@ -18677,10 +18947,10 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18677
18947
  });
18678
18948
  }
18679
18949
  };
18680
- exports.AuthExceptionFilter = _ts_decorate74([
18950
+ exports.AuthExceptionFilter = _ts_decorate75([
18681
18951
  common.Catch()
18682
18952
  ], exports.AuthExceptionFilter);
18683
- function _ts_decorate75(decorators, target, key, desc) {
18953
+ function _ts_decorate76(decorators, target, key, desc) {
18684
18954
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18685
18955
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18686
18956
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18693,7 +18963,7 @@ function _ts_decorate75(decorators, target, key, desc) {
18693
18963
  }
18694
18964
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18695
18965
  }
18696
- __name(_ts_decorate75, "_ts_decorate");
18966
+ __name(_ts_decorate76, "_ts_decorate");
18697
18967
  function isEmittingClient(client) {
18698
18968
  return typeof client?.emit === "function";
18699
18969
  }
@@ -18737,7 +19007,7 @@ exports.WsAuthExceptionFilter = class _WsAuthExceptionFilter {
18737
19007
  this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
18738
19008
  }
18739
19009
  };
18740
- exports.WsAuthExceptionFilter = _ts_decorate75([
19010
+ exports.WsAuthExceptionFilter = _ts_decorate76([
18741
19011
  common.Catch(AuthException)
18742
19012
  ], exports.WsAuthExceptionFilter);
18743
19013
  var ServiceKey = /* @__PURE__ */ __name((...scopes) => common.applyDecorators(common.SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), common.UseGuards(exports.ApiKeyGuard)), "ServiceKey");
@@ -18783,6 +19053,7 @@ exports.PlatformRoles = PlatformRoles;
18783
19053
  exports.Public = Public;
18784
19054
  exports.ROLES_KEY = ROLES_KEY;
18785
19055
  exports.RegisterDto = RegisterDto;
19056
+ exports.RequestEncoding = RequestEncoding;
18786
19057
  exports.ResendOtpDto = ResendOtpDto;
18787
19058
  exports.ResendVerificationDto = ResendVerificationDto;
18788
19059
  exports.ResetPasswordDto = ResetPasswordDto;