@bymax-one/nest-auth 1.4.17 → 1.4.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -189,6 +189,10 @@ var LIBRARY_READ_HEADERS = [
189
189
  // The cross-site request checks of `TrustedOriginGuard`.
190
190
  "origin",
191
191
  "sec-fetch-site",
192
+ // The compressed-body refusal of `RequestEncodingGuard`, and the check of whether a body is present.
193
+ "content-encoding",
194
+ "content-length",
195
+ "transfer-encoding",
192
196
  // What the client address (`request.ip`) is derived from behind a trusted proxy.
193
197
  "x-forwarded-for",
194
198
  "x-forwarded-host",
@@ -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,29 @@ 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, logger) {
6708
+ try {
6709
+ const removed = await redis.del(key);
6710
+ return fromSession || removed;
6711
+ } catch (err) {
6712
+ logger.warn(`logout: the retry marker could not be cleared \u2014 ${describeChannelStatus(err)}`);
6713
+ return fromSession;
6714
+ }
6715
+ }
6716
+ __name(settlePendingLogout, "settlePendingLogout");
6717
+
6605
6718
  // src/server/utils/resolve-tenant-id.ts
6606
6719
  async function resolveTenantId(dtoTenantId, req, resolver) {
6607
6720
  if (resolver) {
@@ -6648,7 +6761,7 @@ function tenantScoped(user, tenantId) {
6648
6761
  __name(tenantScoped, "tenantScoped");
6649
6762
 
6650
6763
  // src/server/services/auth.service.ts
6651
- function _ts_decorate19(decorators, target, key, desc) {
6764
+ function _ts_decorate20(decorators, target, key, desc) {
6652
6765
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6653
6766
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
6654
6767
  r = Reflect.decorate(decorators, target, key, desc);
@@ -6661,13 +6774,13 @@ function _ts_decorate19(decorators, target, key, desc) {
6661
6774
  }
6662
6775
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6663
6776
  }
6664
- __name(_ts_decorate19, "_ts_decorate");
6665
- function _ts_metadata18(metadataKey, metadataValue) {
6777
+ __name(_ts_decorate20, "_ts_decorate");
6778
+ function _ts_metadata19(metadataKey, metadataValue) {
6666
6779
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
6667
6780
  return Reflect.metadata(metadataKey, metadataValue);
6668
6781
  }
6669
6782
  }
6670
- __name(_ts_metadata18, "_ts_metadata");
6783
+ __name(_ts_metadata19, "_ts_metadata");
6671
6784
  function _ts_param14(paramIndex, decorator) {
6672
6785
  return function(target, key) {
6673
6786
  decorator(target, key, paramIndex);
@@ -7042,39 +7155,83 @@ exports.AuthService = class _AuthService {
7042
7155
  */
7043
7156
  async logout(accessToken, rawRefreshToken) {
7044
7157
  const sessionHash = sha256(rawRefreshToken);
7045
- const { userId, tenantId } = await this.redis.readSessionOwner(`rt:${sessionHash}`);
7158
+ const markerKey = logoutPendingKey("dashboard", sessionHash);
7159
+ const live = await this.redis.readSessionOwner(`rt:${sessionHash}`);
7160
+ const fromSession = live.userId !== "";
7161
+ const { userId, tenantId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
7046
7162
  this.logger.log(`logout: userId=${logSafe(userId || "(no live session)")}`);
7047
- let blacklist = [];
7163
+ const failures = await settleWrites([
7164
+ ...this.blacklistWrites(accessToken),
7165
+ () => this.redis.del(`rt:${sessionHash}`),
7166
+ () => this.redis.del(`rp:${sessionHash}`)
7167
+ ]);
7168
+ await this.revokeSessionMetadata(userId, tenantId, sessionHash);
7169
+ if (failures.length > 0 && fromSession) {
7170
+ await rememberPendingLogout(this.redis, markerKey, {
7171
+ userId,
7172
+ tenantId
7173
+ }, logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn), this.logger);
7174
+ }
7175
+ raiseFirst(failures);
7176
+ if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, this.logger)) {
7177
+ this.emitLogout(userId, tenantId);
7178
+ }
7179
+ return userId;
7180
+ }
7181
+ /**
7182
+ * The access-token blacklist write for a logout, or none when there is nothing to revoke.
7183
+ *
7184
+ * Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
7185
+ * forged one must not blacklist an id it does not own. Only the verification is tolerant.
7186
+ *
7187
+ * @param accessToken - Raw access token; absent, malformed or expired yields no write.
7188
+ * @returns The writes to hand to `settleWrites`.
7189
+ */
7190
+ blacklistWrites(accessToken) {
7048
7191
  try {
7049
7192
  const payload = this.tokenManager.verifyIgnoringExpiry(accessToken);
7050
7193
  const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
7051
7194
  if (remainingTtl > 0) {
7052
- blacklist = [
7195
+ return [
7053
7196
  () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
7054
7197
  ];
7055
7198
  }
7056
7199
  } catch {
7057
7200
  }
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;
7201
+ return [];
7202
+ }
7203
+ /**
7204
+ * Cleans up the session's metadata through `SessionService.revokeSession()`.
7205
+ *
7206
+ * It performs an atomic SISMEMBER ownership check before deleting `sd:{hash}` and SREMing from
7207
+ * `sess:{userId}`. The `rt:{hash}` DEL already ran — revokeSession's internal DEL is a no-op
7208
+ * (Redis DEL is idempotent when the key is absent). SESSION_NOT_FOUND means the session was
7209
+ * evicted, already revoked, or the refresh token does not belong to this user — in all cases
7210
+ * authentication is already invalidated.
7211
+ *
7212
+ * The tenant is REQUIRED to name the index, and it comes off the record rather than from the
7213
+ * caller. A record without one is a pre-upgrade write: the contract lists `tenantId` among the
7214
+ * refresh session's fields, so a live record always has it. Skipping the call is the honest end
7215
+ * for one that does not — `rt:{hash}` is already deleted, so the session is dead either way, and
7216
+ * guessing a tenant would name an index belonging to nobody while reading like a revocation that
7217
+ * happened.
7218
+ *
7219
+ * @param userId - The owner, empty when none is known.
7220
+ * @param tenantId - The owner's tenant, absent when the record carried none.
7221
+ * @param sessionHash - The SHA-256 of the raw refresh token.
7222
+ */
7223
+ async revokeSessionMetadata(userId, tenantId, sessionHash) {
7224
+ if (!this.options.sessions.enabled || !userId || tenantId === void 0) return;
7225
+ await this.sessionService.revokeSession({
7226
+ userId,
7227
+ tenantId,
7228
+ sessionHash
7229
+ }).catch((err) => {
7230
+ const errCode = err instanceof AuthException ? err.getResponse().error.code : void 0;
7231
+ if (errCode !== AUTH_ERROR_CODES.SESSION_NOT_FOUND) {
7232
+ this.logger.warn(`logout: session cleanup failed \u2014 ${describeChannelStatus(err)}`);
7233
+ }
7234
+ });
7078
7235
  }
7079
7236
  /**
7080
7237
  * Announces a completed logout, the only hook `AuthService.logout` emits.
@@ -7664,7 +7821,7 @@ exports.AuthService = class _AuthService {
7664
7821
  })();
7665
7822
  }
7666
7823
  };
7667
- exports.AuthService = _ts_decorate19([
7824
+ exports.AuthService = _ts_decorate20([
7668
7825
  common.Injectable(),
7669
7826
  _ts_param14(0, common.Inject(BYMAX_AUTH_OPTIONS)),
7670
7827
  _ts_param14(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -7679,8 +7836,8 @@ exports.AuthService = _ts_decorate19([
7679
7836
  _ts_param14(8, common.Inject(exports.OtpService)),
7680
7837
  _ts_param14(9, common.Inject(exports.SessionService)),
7681
7838
  _ts_param14(10, common.Inject(exports.AccountStatusService)),
7682
- _ts_metadata18("design:type", Function),
7683
- _ts_metadata18("design:paramtypes", [
7839
+ _ts_metadata19("design:type", Function),
7840
+ _ts_metadata19("design:paramtypes", [
7684
7841
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
7685
7842
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
7686
7843
  Object,
@@ -7704,7 +7861,7 @@ __name(toSafeUser2, "toSafeUser");
7704
7861
  var WS_TICKET_TTL_SECONDS = 30;
7705
7862
 
7706
7863
  // src/server/services/ws-ticket.service.ts
7707
- function _ts_decorate20(decorators, target, key, desc) {
7864
+ function _ts_decorate21(decorators, target, key, desc) {
7708
7865
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7709
7866
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
7710
7867
  r = Reflect.decorate(decorators, target, key, desc);
@@ -7717,13 +7874,13 @@ function _ts_decorate20(decorators, target, key, desc) {
7717
7874
  }
7718
7875
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7719
7876
  }
7720
- __name(_ts_decorate20, "_ts_decorate");
7721
- function _ts_metadata19(metadataKey, metadataValue) {
7877
+ __name(_ts_decorate21, "_ts_decorate");
7878
+ function _ts_metadata20(metadataKey, metadataValue) {
7722
7879
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
7723
7880
  return Reflect.metadata(metadataKey, metadataValue);
7724
7881
  }
7725
7882
  }
7726
- __name(_ts_metadata19, "_ts_metadata");
7883
+ __name(_ts_metadata20, "_ts_metadata");
7727
7884
  function _ts_param15(paramIndex, decorator) {
7728
7885
  return function(target, key) {
7729
7886
  decorator(target, key, paramIndex);
@@ -7863,14 +8020,14 @@ exports.WsTicketService = class _WsTicketService {
7863
8020
  return snapshot;
7864
8021
  }
7865
8022
  };
7866
- exports.WsTicketService = _ts_decorate20([
8023
+ exports.WsTicketService = _ts_decorate21([
7867
8024
  common.Injectable(),
7868
8025
  _ts_param15(0, common.Inject(AuthRedisService)),
7869
8026
  _ts_param15(1, common.Inject(BYMAX_AUTH_OPTIONS)),
7870
8027
  _ts_param15(2, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
7871
8028
  _ts_param15(3, common.Inject(exports.AuthRevocationService)),
7872
- _ts_metadata19("design:type", Function),
7873
- _ts_metadata19("design:paramtypes", [
8029
+ _ts_metadata20("design:type", Function),
8030
+ _ts_metadata20("design:paramtypes", [
7874
8031
  typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
7875
8032
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
7876
8033
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
@@ -7879,7 +8036,7 @@ exports.WsTicketService = _ts_decorate20([
7879
8036
  ], exports.WsTicketService);
7880
8037
 
7881
8038
  // src/server/controllers/auth.controller.ts
7882
- function _ts_decorate21(decorators, target, key, desc) {
8039
+ function _ts_decorate22(decorators, target, key, desc) {
7883
8040
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7884
8041
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
7885
8042
  r = Reflect.decorate(decorators, target, key, desc);
@@ -7892,13 +8049,13 @@ function _ts_decorate21(decorators, target, key, desc) {
7892
8049
  }
7893
8050
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7894
8051
  }
7895
- __name(_ts_decorate21, "_ts_decorate");
7896
- function _ts_metadata20(metadataKey, metadataValue) {
8052
+ __name(_ts_decorate22, "_ts_decorate");
8053
+ function _ts_metadata21(metadataKey, metadataValue) {
7897
8054
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
7898
8055
  return Reflect.metadata(metadataKey, metadataValue);
7899
8056
  }
7900
8057
  }
7901
- __name(_ts_metadata20, "_ts_metadata");
8058
+ __name(_ts_metadata21, "_ts_metadata");
7902
8059
  function _ts_param16(paramIndex, decorator) {
7903
8060
  return function(target, key) {
7904
8061
  decorator(target, key, paramIndex);
@@ -8057,7 +8214,7 @@ var AuthController = class {
8057
8214
  await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
8058
8215
  }
8059
8216
  };
8060
- _ts_decorate21([
8217
+ _ts_decorate22([
8061
8218
  Public(),
8062
8219
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.register),
8063
8220
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
@@ -8067,15 +8224,15 @@ _ts_decorate21([
8067
8224
  _ts_param16(2, common.Res({
8068
8225
  passthrough: true
8069
8226
  })),
8070
- _ts_metadata20("design:type", Function),
8071
- _ts_metadata20("design:paramtypes", [
8227
+ _ts_metadata21("design:type", Function),
8228
+ _ts_metadata21("design:paramtypes", [
8072
8229
  typeof RegisterDto === "undefined" ? Object : RegisterDto,
8073
8230
  typeof Request === "undefined" ? Object : Request,
8074
8231
  typeof Response === "undefined" ? Object : Response
8075
8232
  ]),
8076
- _ts_metadata20("design:returntype", Promise)
8233
+ _ts_metadata21("design:returntype", Promise)
8077
8234
  ], AuthController.prototype, "register", null);
8078
- _ts_decorate21([
8235
+ _ts_decorate22([
8079
8236
  Public(),
8080
8237
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.login),
8081
8238
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
@@ -8086,72 +8243,75 @@ _ts_decorate21([
8086
8243
  _ts_param16(2, common.Res({
8087
8244
  passthrough: true
8088
8245
  })),
8089
- _ts_metadata20("design:type", Function),
8090
- _ts_metadata20("design:paramtypes", [
8246
+ _ts_metadata21("design:type", Function),
8247
+ _ts_metadata21("design:paramtypes", [
8091
8248
  typeof LoginDto === "undefined" ? Object : LoginDto,
8092
8249
  typeof Request === "undefined" ? Object : Request,
8093
8250
  typeof Response === "undefined" ? Object : Response
8094
8251
  ]),
8095
- _ts_metadata20("design:returntype", Promise)
8252
+ _ts_metadata21("design:returntype", Promise)
8096
8253
  ], AuthController.prototype, "login", null);
8097
- _ts_decorate21([
8254
+ _ts_decorate22([
8098
8255
  Public(),
8099
8256
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
8100
8257
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
8101
8258
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8259
+ RequestEncoding("unchecked"),
8102
8260
  common.Post("logout"),
8103
8261
  _ts_param16(0, common.Req()),
8104
8262
  _ts_param16(1, common.Res({
8105
8263
  passthrough: true
8106
8264
  })),
8107
- _ts_metadata20("design:type", Function),
8108
- _ts_metadata20("design:paramtypes", [
8265
+ _ts_metadata21("design:type", Function),
8266
+ _ts_metadata21("design:paramtypes", [
8109
8267
  typeof Request === "undefined" ? Object : Request,
8110
8268
  typeof Response === "undefined" ? Object : Response
8111
8269
  ]),
8112
- _ts_metadata20("design:returntype", Promise)
8270
+ _ts_metadata21("design:returntype", Promise)
8113
8271
  ], AuthController.prototype, "logout", null);
8114
- _ts_decorate21([
8272
+ _ts_decorate22([
8115
8273
  Public(),
8116
8274
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
8117
8275
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
8118
8276
  common.HttpCode(common.HttpStatus.OK),
8277
+ RequestEncoding("unchecked"),
8119
8278
  common.Post("refresh"),
8120
8279
  _ts_param16(0, common.Req()),
8121
8280
  _ts_param16(1, common.Res({
8122
8281
  passthrough: true
8123
8282
  })),
8124
- _ts_metadata20("design:type", Function),
8125
- _ts_metadata20("design:paramtypes", [
8283
+ _ts_metadata21("design:type", Function),
8284
+ _ts_metadata21("design:paramtypes", [
8126
8285
  typeof Request === "undefined" ? Object : Request,
8127
8286
  typeof Response === "undefined" ? Object : Response
8128
8287
  ]),
8129
- _ts_metadata20("design:returntype", Promise)
8288
+ _ts_metadata21("design:returntype", Promise)
8130
8289
  ], AuthController.prototype, "refresh", null);
8131
- _ts_decorate21([
8290
+ _ts_decorate22([
8132
8291
  common.UseGuards(exports.JwtAuthGuard),
8133
8292
  common.Get("me"),
8134
8293
  _ts_param16(0, CurrentUser()),
8135
- _ts_metadata20("design:type", Function),
8136
- _ts_metadata20("design:paramtypes", [
8294
+ _ts_metadata21("design:type", Function),
8295
+ _ts_metadata21("design:paramtypes", [
8137
8296
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8138
8297
  ]),
8139
- _ts_metadata20("design:returntype", Promise)
8298
+ _ts_metadata21("design:returntype", Promise)
8140
8299
  ], AuthController.prototype, "me", null);
8141
- _ts_decorate21([
8300
+ _ts_decorate22([
8142
8301
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
8143
8302
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
8144
8303
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
8304
+ RequestEncoding("unchecked"),
8145
8305
  common.Post("ws-ticket"),
8146
8306
  common.HttpCode(common.HttpStatus.OK),
8147
8307
  _ts_param16(0, CurrentUser()),
8148
- _ts_metadata20("design:type", Function),
8149
- _ts_metadata20("design:paramtypes", [
8308
+ _ts_metadata21("design:type", Function),
8309
+ _ts_metadata21("design:paramtypes", [
8150
8310
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8151
8311
  ]),
8152
- _ts_metadata20("design:returntype", Promise)
8312
+ _ts_metadata21("design:returntype", Promise)
8153
8313
  ], AuthController.prototype, "wsTicket", null);
8154
- _ts_decorate21([
8314
+ _ts_decorate22([
8155
8315
  Public(),
8156
8316
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
8157
8317
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
@@ -8159,14 +8319,14 @@ _ts_decorate21([
8159
8319
  common.Post("verify-email"),
8160
8320
  _ts_param16(0, common.Body()),
8161
8321
  _ts_param16(1, common.Req()),
8162
- _ts_metadata20("design:type", Function),
8163
- _ts_metadata20("design:paramtypes", [
8322
+ _ts_metadata21("design:type", Function),
8323
+ _ts_metadata21("design:paramtypes", [
8164
8324
  typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
8165
8325
  typeof Request === "undefined" ? Object : Request
8166
8326
  ]),
8167
- _ts_metadata20("design:returntype", Promise)
8327
+ _ts_metadata21("design:returntype", Promise)
8168
8328
  ], AuthController.prototype, "verifyEmail", null);
8169
- _ts_decorate21([
8329
+ _ts_decorate22([
8170
8330
  Public(),
8171
8331
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
8172
8332
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
@@ -8174,29 +8334,29 @@ _ts_decorate21([
8174
8334
  common.Post("resend-verification"),
8175
8335
  _ts_param16(0, common.Body()),
8176
8336
  _ts_param16(1, common.Req()),
8177
- _ts_metadata20("design:type", Function),
8178
- _ts_metadata20("design:paramtypes", [
8337
+ _ts_metadata21("design:type", Function),
8338
+ _ts_metadata21("design:paramtypes", [
8179
8339
  typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
8180
8340
  typeof Request === "undefined" ? Object : Request
8181
8341
  ]),
8182
- _ts_metadata20("design:returntype", Promise)
8342
+ _ts_metadata21("design:returntype", Promise)
8183
8343
  ], AuthController.prototype, "resendVerification", null);
8184
- AuthController = _ts_decorate21([
8344
+ AuthController = _ts_decorate22([
8185
8345
  common.UseInterceptors(NoStoreInterceptor),
8186
8346
  common.Controller(),
8187
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8347
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8188
8348
  common.UsePipes(createAuthValidationPipe()),
8189
8349
  _ts_param16(0, common.Inject(exports.AuthService)),
8190
8350
  _ts_param16(1, common.Inject(exports.TokenDeliveryService)),
8191
8351
  _ts_param16(2, common.Inject(exports.WsTicketService)),
8192
- _ts_metadata20("design:type", Function),
8193
- _ts_metadata20("design:paramtypes", [
8352
+ _ts_metadata21("design:type", Function),
8353
+ _ts_metadata21("design:paramtypes", [
8194
8354
  typeof exports.AuthService === "undefined" ? Object : exports.AuthService,
8195
8355
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
8196
8356
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService
8197
8357
  ])
8198
8358
  ], AuthController);
8199
- function _ts_decorate22(decorators, target, key, desc) {
8359
+ function _ts_decorate23(decorators, target, key, desc) {
8200
8360
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8201
8361
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8202
8362
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8209,13 +8369,13 @@ function _ts_decorate22(decorators, target, key, desc) {
8209
8369
  }
8210
8370
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8211
8371
  }
8212
- __name(_ts_decorate22, "_ts_decorate");
8213
- function _ts_metadata21(metadataKey, metadataValue) {
8372
+ __name(_ts_decorate23, "_ts_decorate");
8373
+ function _ts_metadata22(metadataKey, metadataValue) {
8214
8374
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8215
8375
  return Reflect.metadata(metadataKey, metadataValue);
8216
8376
  }
8217
8377
  }
8218
- __name(_ts_metadata21, "_ts_metadata");
8378
+ __name(_ts_metadata22, "_ts_metadata");
8219
8379
  var ChangeEmailDto = class {
8220
8380
  static {
8221
8381
  __name(this, "ChangeEmailDto");
@@ -8235,20 +8395,20 @@ var ChangeEmailDto = class {
8235
8395
  */
8236
8396
  currentPassword;
8237
8397
  };
8238
- _ts_decorate22([
8398
+ _ts_decorate23([
8239
8399
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8240
8400
  classValidator.IsEmail(),
8241
8401
  classValidator.IsNotEmpty(),
8242
8402
  classValidator.MaxLength(255),
8243
- _ts_metadata21("design:type", String)
8403
+ _ts_metadata22("design:type", String)
8244
8404
  ], ChangeEmailDto.prototype, "newEmail", void 0);
8245
- _ts_decorate22([
8405
+ _ts_decorate23([
8246
8406
  classValidator.IsString(),
8247
8407
  classValidator.MinLength(1),
8248
8408
  classValidator.MaxLength(128),
8249
- _ts_metadata21("design:type", String)
8409
+ _ts_metadata22("design:type", String)
8250
8410
  ], ChangeEmailDto.prototype, "currentPassword", void 0);
8251
- function _ts_decorate23(decorators, target, key, desc) {
8411
+ function _ts_decorate24(decorators, target, key, desc) {
8252
8412
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8253
8413
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8254
8414
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8261,13 +8421,13 @@ function _ts_decorate23(decorators, target, key, desc) {
8261
8421
  }
8262
8422
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8263
8423
  }
8264
- __name(_ts_decorate23, "_ts_decorate");
8265
- function _ts_metadata22(metadataKey, metadataValue) {
8424
+ __name(_ts_decorate24, "_ts_decorate");
8425
+ function _ts_metadata23(metadataKey, metadataValue) {
8266
8426
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8267
8427
  return Reflect.metadata(metadataKey, metadataValue);
8268
8428
  }
8269
8429
  }
8270
- __name(_ts_metadata22, "_ts_metadata");
8430
+ __name(_ts_metadata23, "_ts_metadata");
8271
8431
  var ConfirmEmailChangeDto = class {
8272
8432
  static {
8273
8433
  __name(this, "ConfirmEmailChangeDto");
@@ -8280,13 +8440,13 @@ var ConfirmEmailChangeDto = class {
8280
8440
  */
8281
8441
  token;
8282
8442
  };
8283
- _ts_decorate23([
8443
+ _ts_decorate24([
8284
8444
  classValidator.IsString(),
8285
8445
  classValidator.IsNotEmpty(),
8286
8446
  classValidator.Length(64, 64),
8287
- _ts_metadata22("design:type", String)
8447
+ _ts_metadata23("design:type", String)
8288
8448
  ], ConfirmEmailChangeDto.prototype, "token", void 0);
8289
- function _ts_decorate24(decorators, target, key, desc) {
8449
+ function _ts_decorate25(decorators, target, key, desc) {
8290
8450
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8291
8451
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8292
8452
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8299,13 +8459,13 @@ function _ts_decorate24(decorators, target, key, desc) {
8299
8459
  }
8300
8460
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8301
8461
  }
8302
- __name(_ts_decorate24, "_ts_decorate");
8303
- function _ts_metadata23(metadataKey, metadataValue) {
8462
+ __name(_ts_decorate25, "_ts_decorate");
8463
+ function _ts_metadata24(metadataKey, metadataValue) {
8304
8464
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8305
8465
  return Reflect.metadata(metadataKey, metadataValue);
8306
8466
  }
8307
8467
  }
8308
- __name(_ts_metadata23, "_ts_metadata");
8468
+ __name(_ts_metadata24, "_ts_metadata");
8309
8469
  function _ts_param17(paramIndex, decorator) {
8310
8470
  return function(target, key) {
8311
8471
  decorator(target, key, paramIndex);
@@ -8543,7 +8703,7 @@ exports.EmailChangeService = class _EmailChangeService {
8543
8703
  }
8544
8704
  }
8545
8705
  };
8546
- exports.EmailChangeService = _ts_decorate24([
8706
+ exports.EmailChangeService = _ts_decorate25([
8547
8707
  common.Injectable(),
8548
8708
  _ts_param17(0, common.Inject(BYMAX_AUTH_OPTIONS)),
8549
8709
  _ts_param17(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -8551,8 +8711,8 @@ exports.EmailChangeService = _ts_decorate24([
8551
8711
  _ts_param17(3, common.Inject(PasswordService)),
8552
8712
  _ts_param17(4, common.Inject(AuthRedisService)),
8553
8713
  _ts_param17(5, common.Inject(exports.BruteForceService)),
8554
- _ts_metadata23("design:type", Function),
8555
- _ts_metadata23("design:paramtypes", [
8714
+ _ts_metadata24("design:type", Function),
8715
+ _ts_metadata24("design:paramtypes", [
8556
8716
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
8557
8717
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
8558
8718
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
@@ -8563,7 +8723,7 @@ exports.EmailChangeService = _ts_decorate24([
8563
8723
  ], exports.EmailChangeService);
8564
8724
 
8565
8725
  // src/server/controllers/email-change.controller.ts
8566
- function _ts_decorate25(decorators, target, key, desc) {
8726
+ function _ts_decorate26(decorators, target, key, desc) {
8567
8727
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8568
8728
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8569
8729
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8576,13 +8736,13 @@ function _ts_decorate25(decorators, target, key, desc) {
8576
8736
  }
8577
8737
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8578
8738
  }
8579
- __name(_ts_decorate25, "_ts_decorate");
8580
- function _ts_metadata24(metadataKey, metadataValue) {
8739
+ __name(_ts_decorate26, "_ts_decorate");
8740
+ function _ts_metadata25(metadataKey, metadataValue) {
8581
8741
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8582
8742
  return Reflect.metadata(metadataKey, metadataValue);
8583
8743
  }
8584
8744
  }
8585
- __name(_ts_metadata24, "_ts_metadata");
8745
+ __name(_ts_metadata25, "_ts_metadata");
8586
8746
  function _ts_param18(paramIndex, decorator) {
8587
8747
  return function(target, key) {
8588
8748
  decorator(target, key, paramIndex);
@@ -8635,7 +8795,7 @@ var EmailChangeController = class {
8635
8795
  await this.emailChangeService.confirmChange(dto);
8636
8796
  }
8637
8797
  };
8638
- _ts_decorate25([
8798
+ _ts_decorate26([
8639
8799
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
8640
8800
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
8641
8801
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
@@ -8643,38 +8803,38 @@ _ts_decorate25([
8643
8803
  common.Post("change"),
8644
8804
  _ts_param18(0, common.Body()),
8645
8805
  _ts_param18(1, CurrentUser()),
8646
- _ts_metadata24("design:type", Function),
8647
- _ts_metadata24("design:paramtypes", [
8806
+ _ts_metadata25("design:type", Function),
8807
+ _ts_metadata25("design:paramtypes", [
8648
8808
  typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
8649
8809
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
8650
8810
  ]),
8651
- _ts_metadata24("design:returntype", Promise)
8811
+ _ts_metadata25("design:returntype", Promise)
8652
8812
  ], EmailChangeController.prototype, "requestChange", null);
8653
- _ts_decorate25([
8813
+ _ts_decorate26([
8654
8814
  Public(),
8655
8815
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
8656
8816
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
8657
8817
  common.HttpCode(common.HttpStatus.NO_CONTENT),
8658
8818
  common.Post("change/confirm"),
8659
8819
  _ts_param18(0, common.Body()),
8660
- _ts_metadata24("design:type", Function),
8661
- _ts_metadata24("design:paramtypes", [
8820
+ _ts_metadata25("design:type", Function),
8821
+ _ts_metadata25("design:paramtypes", [
8662
8822
  typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
8663
8823
  ]),
8664
- _ts_metadata24("design:returntype", Promise)
8824
+ _ts_metadata25("design:returntype", Promise)
8665
8825
  ], EmailChangeController.prototype, "confirmChange", null);
8666
- EmailChangeController = _ts_decorate25([
8826
+ EmailChangeController = _ts_decorate26([
8667
8827
  common.UseInterceptors(NoStoreInterceptor),
8668
8828
  common.Controller("email"),
8669
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8829
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
8670
8830
  common.UsePipes(createAuthValidationPipe()),
8671
8831
  _ts_param18(0, common.Inject(exports.EmailChangeService)),
8672
- _ts_metadata24("design:type", Function),
8673
- _ts_metadata24("design:paramtypes", [
8832
+ _ts_metadata25("design:type", Function),
8833
+ _ts_metadata25("design:paramtypes", [
8674
8834
  typeof exports.EmailChangeService === "undefined" ? Object : exports.EmailChangeService
8675
8835
  ])
8676
8836
  ], EmailChangeController);
8677
- function _ts_decorate26(decorators, target, key, desc) {
8837
+ function _ts_decorate27(decorators, target, key, desc) {
8678
8838
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8679
8839
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8680
8840
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8687,13 +8847,13 @@ function _ts_decorate26(decorators, target, key, desc) {
8687
8847
  }
8688
8848
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8689
8849
  }
8690
- __name(_ts_decorate26, "_ts_decorate");
8691
- function _ts_metadata25(metadataKey, metadataValue) {
8850
+ __name(_ts_decorate27, "_ts_decorate");
8851
+ function _ts_metadata26(metadataKey, metadataValue) {
8692
8852
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8693
8853
  return Reflect.metadata(metadataKey, metadataValue);
8694
8854
  }
8695
8855
  }
8696
- __name(_ts_metadata25, "_ts_metadata");
8856
+ __name(_ts_metadata26, "_ts_metadata");
8697
8857
  var AcceptInvitationDto = class {
8698
8858
  static {
8699
8859
  __name(this, "AcceptInvitationDto");
@@ -8732,24 +8892,24 @@ var AcceptInvitationDto = class {
8732
8892
  */
8733
8893
  password;
8734
8894
  };
8735
- _ts_decorate26([
8895
+ _ts_decorate27([
8736
8896
  classValidator.IsString(),
8737
8897
  classValidator.IsNotEmpty(),
8738
8898
  classValidator.Length(64, 64),
8739
- _ts_metadata25("design:type", String)
8899
+ _ts_metadata26("design:type", String)
8740
8900
  ], AcceptInvitationDto.prototype, "token", void 0);
8741
- _ts_decorate26([
8901
+ _ts_decorate27([
8742
8902
  classValidator.IsString(),
8743
8903
  classValidator.IsNotEmpty(),
8744
8904
  classValidator.Length(2, 100),
8745
- _ts_metadata25("design:type", String)
8905
+ _ts_metadata26("design:type", String)
8746
8906
  ], AcceptInvitationDto.prototype, "name", void 0);
8747
- _ts_decorate26([
8907
+ _ts_decorate27([
8748
8908
  classValidator.IsString(),
8749
8909
  classValidator.Length(8, 128),
8750
- _ts_metadata25("design:type", String)
8910
+ _ts_metadata26("design:type", String)
8751
8911
  ], AcceptInvitationDto.prototype, "password", void 0);
8752
- function _ts_decorate27(decorators, target, key, desc) {
8912
+ function _ts_decorate28(decorators, target, key, desc) {
8753
8913
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8754
8914
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8755
8915
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8762,13 +8922,13 @@ function _ts_decorate27(decorators, target, key, desc) {
8762
8922
  }
8763
8923
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8764
8924
  }
8765
- __name(_ts_decorate27, "_ts_decorate");
8766
- function _ts_metadata26(metadataKey, metadataValue) {
8925
+ __name(_ts_decorate28, "_ts_decorate");
8926
+ function _ts_metadata27(metadataKey, metadataValue) {
8767
8927
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8768
8928
  return Reflect.metadata(metadataKey, metadataValue);
8769
8929
  }
8770
8930
  }
8771
- __name(_ts_metadata26, "_ts_metadata");
8931
+ __name(_ts_metadata27, "_ts_metadata");
8772
8932
  var CreateInvitationDto = class {
8773
8933
  static {
8774
8934
  __name(this, "CreateInvitationDto");
@@ -8799,27 +8959,27 @@ var CreateInvitationDto = class {
8799
8959
  */
8800
8960
  tenantName;
8801
8961
  };
8802
- _ts_decorate27([
8962
+ _ts_decorate28([
8803
8963
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8804
8964
  classValidator.IsEmail(),
8805
8965
  classValidator.IsNotEmpty(),
8806
8966
  classValidator.MaxLength(255),
8807
- _ts_metadata26("design:type", String)
8967
+ _ts_metadata27("design:type", String)
8808
8968
  ], CreateInvitationDto.prototype, "email", void 0);
8809
- _ts_decorate27([
8969
+ _ts_decorate28([
8810
8970
  classValidator.IsString(),
8811
8971
  classValidator.IsNotEmpty(),
8812
8972
  classValidator.MaxLength(64),
8813
- _ts_metadata26("design:type", String)
8973
+ _ts_metadata27("design:type", String)
8814
8974
  ], CreateInvitationDto.prototype, "role", void 0);
8815
- _ts_decorate27([
8975
+ _ts_decorate28([
8816
8976
  classValidator.IsOptional(),
8817
8977
  classValidator.IsString(),
8818
8978
  classValidator.IsNotEmpty(),
8819
8979
  classValidator.MaxLength(128),
8820
- _ts_metadata26("design:type", String)
8980
+ _ts_metadata27("design:type", String)
8821
8981
  ], CreateInvitationDto.prototype, "tenantName", void 0);
8822
- function _ts_decorate28(decorators, target, key, desc) {
8982
+ function _ts_decorate29(decorators, target, key, desc) {
8823
8983
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8824
8984
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8825
8985
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8832,13 +8992,13 @@ function _ts_decorate28(decorators, target, key, desc) {
8832
8992
  }
8833
8993
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8834
8994
  }
8835
- __name(_ts_decorate28, "_ts_decorate");
8836
- function _ts_metadata27(metadataKey, metadataValue) {
8995
+ __name(_ts_decorate29, "_ts_decorate");
8996
+ function _ts_metadata28(metadataKey, metadataValue) {
8837
8997
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8838
8998
  return Reflect.metadata(metadataKey, metadataValue);
8839
8999
  }
8840
9000
  }
8841
- __name(_ts_metadata27, "_ts_metadata");
9001
+ __name(_ts_metadata28, "_ts_metadata");
8842
9002
  var RevokeInvitationDto = class {
8843
9003
  static {
8844
9004
  __name(this, "RevokeInvitationDto");
@@ -8850,14 +9010,14 @@ var RevokeInvitationDto = class {
8850
9010
  */
8851
9011
  email;
8852
9012
  };
8853
- _ts_decorate28([
9013
+ _ts_decorate29([
8854
9014
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
8855
9015
  classValidator.IsEmail(),
8856
9016
  classValidator.IsNotEmpty(),
8857
9017
  classValidator.MaxLength(255),
8858
- _ts_metadata27("design:type", String)
9018
+ _ts_metadata28("design:type", String)
8859
9019
  ], RevokeInvitationDto.prototype, "email", void 0);
8860
- function _ts_decorate29(decorators, target, key, desc) {
9020
+ function _ts_decorate30(decorators, target, key, desc) {
8861
9021
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8862
9022
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
8863
9023
  r = Reflect.decorate(decorators, target, key, desc);
@@ -8870,13 +9030,13 @@ function _ts_decorate29(decorators, target, key, desc) {
8870
9030
  }
8871
9031
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8872
9032
  }
8873
- __name(_ts_decorate29, "_ts_decorate");
8874
- function _ts_metadata28(metadataKey, metadataValue) {
9033
+ __name(_ts_decorate30, "_ts_decorate");
9034
+ function _ts_metadata29(metadataKey, metadataValue) {
8875
9035
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
8876
9036
  return Reflect.metadata(metadataKey, metadataValue);
8877
9037
  }
8878
9038
  }
8879
- __name(_ts_metadata28, "_ts_metadata");
9039
+ __name(_ts_metadata29, "_ts_metadata");
8880
9040
  function _ts_param19(paramIndex, decorator) {
8881
9041
  return function(target, key) {
8882
9042
  decorator(target, key, paramIndex);
@@ -9359,7 +9519,7 @@ exports.InvitationService = class _InvitationService {
9359
9519
  return result;
9360
9520
  }
9361
9521
  };
9362
- exports.InvitationService = _ts_decorate29([
9522
+ exports.InvitationService = _ts_decorate30([
9363
9523
  common.Injectable(),
9364
9524
  _ts_param19(0, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
9365
9525
  _ts_param19(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
@@ -9369,8 +9529,8 @@ exports.InvitationService = _ts_decorate29([
9369
9529
  _ts_param19(5, common.Inject(exports.SessionService)),
9370
9530
  _ts_param19(6, common.Inject(TokenManagerService)),
9371
9531
  _ts_param19(7, common.Inject(BYMAX_AUTH_OPTIONS)),
9372
- _ts_metadata28("design:type", Function),
9373
- _ts_metadata28("design:paramtypes", [
9532
+ _ts_metadata29("design:type", Function),
9533
+ _ts_metadata29("design:paramtypes", [
9374
9534
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
9375
9535
  typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
9376
9536
  typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
@@ -9383,7 +9543,7 @@ exports.InvitationService = _ts_decorate29([
9383
9543
  ], exports.InvitationService);
9384
9544
 
9385
9545
  // src/server/controllers/invitation.controller.ts
9386
- function _ts_decorate30(decorators, target, key, desc) {
9546
+ function _ts_decorate31(decorators, target, key, desc) {
9387
9547
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9388
9548
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9389
9549
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9396,13 +9556,13 @@ function _ts_decorate30(decorators, target, key, desc) {
9396
9556
  }
9397
9557
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9398
9558
  }
9399
- __name(_ts_decorate30, "_ts_decorate");
9400
- function _ts_metadata29(metadataKey, metadataValue) {
9559
+ __name(_ts_decorate31, "_ts_decorate");
9560
+ function _ts_metadata30(metadataKey, metadataValue) {
9401
9561
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9402
9562
  return Reflect.metadata(metadataKey, metadataValue);
9403
9563
  }
9404
9564
  }
9405
- __name(_ts_metadata29, "_ts_metadata");
9565
+ __name(_ts_metadata30, "_ts_metadata");
9406
9566
  function _ts_param20(paramIndex, decorator) {
9407
9567
  return function(target, key) {
9408
9568
  decorator(target, key, paramIndex);
@@ -9484,7 +9644,7 @@ var InvitationController = class {
9484
9644
  return this.tokenDelivery.deliverAuthResponse(res, result, req);
9485
9645
  }
9486
9646
  };
9487
- _ts_decorate30([
9647
+ _ts_decorate31([
9488
9648
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
9489
9649
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
9490
9650
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
@@ -9492,14 +9652,14 @@ _ts_decorate30([
9492
9652
  common.Post(),
9493
9653
  _ts_param20(0, common.Body()),
9494
9654
  _ts_param20(1, CurrentUser()),
9495
- _ts_metadata29("design:type", Function),
9496
- _ts_metadata29("design:paramtypes", [
9655
+ _ts_metadata30("design:type", Function),
9656
+ _ts_metadata30("design:paramtypes", [
9497
9657
  typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
9498
9658
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
9499
9659
  ]),
9500
- _ts_metadata29("design:returntype", Promise)
9660
+ _ts_metadata30("design:returntype", Promise)
9501
9661
  ], InvitationController.prototype, "invite", null);
9502
- _ts_decorate30([
9662
+ _ts_decorate31([
9503
9663
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
9504
9664
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
9505
9665
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
@@ -9507,14 +9667,14 @@ _ts_decorate30([
9507
9667
  common.Post("revoke"),
9508
9668
  _ts_param20(0, common.Body()),
9509
9669
  _ts_param20(1, CurrentUser()),
9510
- _ts_metadata29("design:type", Function),
9511
- _ts_metadata29("design:paramtypes", [
9670
+ _ts_metadata30("design:type", Function),
9671
+ _ts_metadata30("design:paramtypes", [
9512
9672
  typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
9513
9673
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
9514
9674
  ]),
9515
- _ts_metadata29("design:returntype", Promise)
9675
+ _ts_metadata30("design:returntype", Promise)
9516
9676
  ], InvitationController.prototype, "revoke", null);
9517
- _ts_decorate30([
9677
+ _ts_decorate31([
9518
9678
  Public(),
9519
9679
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
9520
9680
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
@@ -9525,23 +9685,23 @@ _ts_decorate30([
9525
9685
  _ts_param20(2, common.Res({
9526
9686
  passthrough: true
9527
9687
  })),
9528
- _ts_metadata29("design:type", Function),
9529
- _ts_metadata29("design:paramtypes", [
9688
+ _ts_metadata30("design:type", Function),
9689
+ _ts_metadata30("design:paramtypes", [
9530
9690
  typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
9531
9691
  typeof Request === "undefined" ? Object : Request,
9532
9692
  typeof Response === "undefined" ? Object : Response
9533
9693
  ]),
9534
- _ts_metadata29("design:returntype", Promise)
9694
+ _ts_metadata30("design:returntype", Promise)
9535
9695
  ], InvitationController.prototype, "accept", null);
9536
- InvitationController = _ts_decorate30([
9696
+ InvitationController = _ts_decorate31([
9537
9697
  common.UseInterceptors(NoStoreInterceptor),
9538
9698
  common.Controller("invitations"),
9539
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9699
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
9540
9700
  common.UsePipes(createAuthValidationPipe()),
9541
9701
  _ts_param20(0, common.Inject(exports.InvitationService)),
9542
9702
  _ts_param20(1, common.Inject(exports.TokenDeliveryService)),
9543
- _ts_metadata29("design:type", Function),
9544
- _ts_metadata29("design:paramtypes", [
9703
+ _ts_metadata30("design:type", Function),
9704
+ _ts_metadata30("design:paramtypes", [
9545
9705
  typeof exports.InvitationService === "undefined" ? Object : exports.InvitationService,
9546
9706
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
9547
9707
  ])
@@ -9552,7 +9712,7 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
9552
9712
  var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
9553
9713
  var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
9554
9714
  var SkipMfa = /* @__PURE__ */ __name(() => common.SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
9555
- function _ts_decorate31(decorators, target, key, desc) {
9715
+ function _ts_decorate32(decorators, target, key, desc) {
9556
9716
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9557
9717
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9558
9718
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9565,13 +9725,13 @@ function _ts_decorate31(decorators, target, key, desc) {
9565
9725
  }
9566
9726
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9567
9727
  }
9568
- __name(_ts_decorate31, "_ts_decorate");
9569
- function _ts_metadata30(metadataKey, metadataValue) {
9728
+ __name(_ts_decorate32, "_ts_decorate");
9729
+ function _ts_metadata31(metadataKey, metadataValue) {
9570
9730
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9571
9731
  return Reflect.metadata(metadataKey, metadataValue);
9572
9732
  }
9573
9733
  }
9574
- __name(_ts_metadata30, "_ts_metadata");
9734
+ __name(_ts_metadata31, "_ts_metadata");
9575
9735
  var MfaChallengeDto = class {
9576
9736
  static {
9577
9737
  __name(this, "MfaChallengeDto");
@@ -9607,23 +9767,23 @@ var MfaChallengeDto = class {
9607
9767
  */
9608
9768
  code;
9609
9769
  };
9610
- _ts_decorate31([
9770
+ _ts_decorate32([
9611
9771
  classValidator.IsOptional(),
9612
9772
  classValidator.IsString(),
9613
9773
  classValidator.IsNotEmpty(),
9614
9774
  classValidator.MaxLength(512),
9615
- _ts_metadata30("design:type", String)
9775
+ _ts_metadata31("design:type", String)
9616
9776
  ], MfaChallengeDto.prototype, "mfaTempToken", void 0);
9617
- _ts_decorate31([
9777
+ _ts_decorate32([
9618
9778
  classValidator.Matches(/^(\d{6}|[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4})$/, {
9619
9779
  message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
9620
9780
  }),
9621
9781
  classValidator.IsString(),
9622
9782
  classValidator.IsNotEmpty(),
9623
9783
  classValidator.MaxLength(29),
9624
- _ts_metadata30("design:type", String)
9784
+ _ts_metadata31("design:type", String)
9625
9785
  ], MfaChallengeDto.prototype, "code", void 0);
9626
- function _ts_decorate32(decorators, target, key, desc) {
9786
+ function _ts_decorate33(decorators, target, key, desc) {
9627
9787
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9628
9788
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9629
9789
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9636,13 +9796,13 @@ function _ts_decorate32(decorators, target, key, desc) {
9636
9796
  }
9637
9797
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9638
9798
  }
9639
- __name(_ts_decorate32, "_ts_decorate");
9640
- function _ts_metadata31(metadataKey, metadataValue) {
9799
+ __name(_ts_decorate33, "_ts_decorate");
9800
+ function _ts_metadata32(metadataKey, metadataValue) {
9641
9801
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9642
9802
  return Reflect.metadata(metadataKey, metadataValue);
9643
9803
  }
9644
9804
  }
9645
- __name(_ts_metadata31, "_ts_metadata");
9805
+ __name(_ts_metadata32, "_ts_metadata");
9646
9806
  var MfaDisableDto = class {
9647
9807
  static {
9648
9808
  __name(this, "MfaDisableDto");
@@ -9656,16 +9816,16 @@ var MfaDisableDto = class {
9656
9816
  */
9657
9817
  code;
9658
9818
  };
9659
- _ts_decorate32([
9819
+ _ts_decorate33([
9660
9820
  classValidator.MaxLength(6),
9661
9821
  classValidator.Matches(/^\d{6}$/, {
9662
9822
  message: "code must be exactly 6 digits"
9663
9823
  }),
9664
9824
  classValidator.IsString(),
9665
9825
  classValidator.IsNotEmpty(),
9666
- _ts_metadata31("design:type", String)
9826
+ _ts_metadata32("design:type", String)
9667
9827
  ], MfaDisableDto.prototype, "code", void 0);
9668
- function _ts_decorate33(decorators, target, key, desc) {
9828
+ function _ts_decorate34(decorators, target, key, desc) {
9669
9829
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9670
9830
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9671
9831
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9678,13 +9838,13 @@ function _ts_decorate33(decorators, target, key, desc) {
9678
9838
  }
9679
9839
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9680
9840
  }
9681
- __name(_ts_decorate33, "_ts_decorate");
9682
- function _ts_metadata32(metadataKey, metadataValue) {
9841
+ __name(_ts_decorate34, "_ts_decorate");
9842
+ function _ts_metadata33(metadataKey, metadataValue) {
9683
9843
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9684
9844
  return Reflect.metadata(metadataKey, metadataValue);
9685
9845
  }
9686
9846
  }
9687
- __name(_ts_metadata32, "_ts_metadata");
9847
+ __name(_ts_metadata33, "_ts_metadata");
9688
9848
  var MfaRegenerateRecoveryCodesDto = class {
9689
9849
  static {
9690
9850
  __name(this, "MfaRegenerateRecoveryCodesDto");
@@ -9698,16 +9858,16 @@ var MfaRegenerateRecoveryCodesDto = class {
9698
9858
  */
9699
9859
  code;
9700
9860
  };
9701
- _ts_decorate33([
9861
+ _ts_decorate34([
9702
9862
  classValidator.MaxLength(6),
9703
9863
  classValidator.Matches(/^\d{6}$/, {
9704
9864
  message: "code must be exactly 6 digits"
9705
9865
  }),
9706
9866
  classValidator.IsString(),
9707
9867
  classValidator.IsNotEmpty(),
9708
- _ts_metadata32("design:type", String)
9868
+ _ts_metadata33("design:type", String)
9709
9869
  ], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
9710
- function _ts_decorate34(decorators, target, key, desc) {
9870
+ function _ts_decorate35(decorators, target, key, desc) {
9711
9871
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9712
9872
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9713
9873
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9720,13 +9880,13 @@ function _ts_decorate34(decorators, target, key, desc) {
9720
9880
  }
9721
9881
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9722
9882
  }
9723
- __name(_ts_decorate34, "_ts_decorate");
9724
- function _ts_metadata33(metadataKey, metadataValue) {
9883
+ __name(_ts_decorate35, "_ts_decorate");
9884
+ function _ts_metadata34(metadataKey, metadataValue) {
9725
9885
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9726
9886
  return Reflect.metadata(metadataKey, metadataValue);
9727
9887
  }
9728
9888
  }
9729
- __name(_ts_metadata33, "_ts_metadata");
9889
+ __name(_ts_metadata34, "_ts_metadata");
9730
9890
  var MfaSetupDto = class {
9731
9891
  static {
9732
9892
  __name(this, "MfaSetupDto");
@@ -9750,14 +9910,14 @@ var MfaSetupDto = class {
9750
9910
  */
9751
9911
  password;
9752
9912
  };
9753
- _ts_decorate34([
9913
+ _ts_decorate35([
9754
9914
  classValidator.IsOptional(),
9755
9915
  classValidator.IsString(),
9756
9916
  classValidator.MinLength(1),
9757
9917
  classValidator.MaxLength(128),
9758
- _ts_metadata33("design:type", String)
9918
+ _ts_metadata34("design:type", String)
9759
9919
  ], MfaSetupDto.prototype, "password", void 0);
9760
- function _ts_decorate35(decorators, target, key, desc) {
9920
+ function _ts_decorate36(decorators, target, key, desc) {
9761
9921
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9762
9922
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9763
9923
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9770,13 +9930,13 @@ function _ts_decorate35(decorators, target, key, desc) {
9770
9930
  }
9771
9931
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9772
9932
  }
9773
- __name(_ts_decorate35, "_ts_decorate");
9774
- function _ts_metadata34(metadataKey, metadataValue) {
9933
+ __name(_ts_decorate36, "_ts_decorate");
9934
+ function _ts_metadata35(metadataKey, metadataValue) {
9775
9935
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9776
9936
  return Reflect.metadata(metadataKey, metadataValue);
9777
9937
  }
9778
9938
  }
9779
- __name(_ts_metadata34, "_ts_metadata");
9939
+ __name(_ts_metadata35, "_ts_metadata");
9780
9940
  var MfaVerifyDto = class {
9781
9941
  static {
9782
9942
  __name(this, "MfaVerifyDto");
@@ -9789,14 +9949,14 @@ var MfaVerifyDto = class {
9789
9949
  */
9790
9950
  code;
9791
9951
  };
9792
- _ts_decorate35([
9952
+ _ts_decorate36([
9793
9953
  classValidator.MaxLength(6),
9794
9954
  classValidator.Matches(/^\d{6}$/, {
9795
9955
  message: "code must be exactly 6 digits"
9796
9956
  }),
9797
9957
  classValidator.IsString(),
9798
9958
  classValidator.IsNotEmpty(),
9799
- _ts_metadata34("design:type", String)
9959
+ _ts_metadata35("design:type", String)
9800
9960
  ], MfaVerifyDto.prototype, "code", void 0);
9801
9961
  var IV_LENGTH = 12;
9802
9962
  var AUTH_TAG_BYTE_LENGTH = 16;
@@ -9860,7 +10020,7 @@ function runDetached(logger, run, failure) {
9860
10020
  __name(runDetached, "runDetached");
9861
10021
 
9862
10022
  // src/server/services/mfa.service.ts
9863
- function _ts_decorate36(decorators, target, key, desc) {
10023
+ function _ts_decorate37(decorators, target, key, desc) {
9864
10024
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9865
10025
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
9866
10026
  r = Reflect.decorate(decorators, target, key, desc);
@@ -9873,13 +10033,13 @@ function _ts_decorate36(decorators, target, key, desc) {
9873
10033
  }
9874
10034
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9875
10035
  }
9876
- __name(_ts_decorate36, "_ts_decorate");
9877
- function _ts_metadata35(metadataKey, metadataValue) {
10036
+ __name(_ts_decorate37, "_ts_decorate");
10037
+ function _ts_metadata36(metadataKey, metadataValue) {
9878
10038
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
9879
10039
  return Reflect.metadata(metadataKey, metadataValue);
9880
10040
  }
9881
10041
  }
9882
- __name(_ts_metadata35, "_ts_metadata");
10042
+ __name(_ts_metadata36, "_ts_metadata");
9883
10043
  function _ts_param21(paramIndex, decorator) {
9884
10044
  return function(target, key) {
9885
10045
  decorator(target, key, paramIndex);
@@ -9961,29 +10121,28 @@ exports.MfaService = class _MfaService {
9961
10121
  * Detached from the challenge it follows: the user is already authenticated and the retired
9962
10122
  * key still opens the secret, so a failure here costs the migration and nothing else.
9963
10123
  *
10124
+ * The write replaces the whole MFA record, so it runs as a serialized transition and lands only
10125
+ * on a record that still holds this secret. One that no longer does was disabled or re-enrolled
10126
+ * since, and writing the re-encrypted old secret over it would restore a factor the user removed
10127
+ * and unspend the recovery codes they replaced. The comparison is on the decrypted secret, not
10128
+ * the ciphertext: a sibling challenge that only re-encrypted the same secret changes the
10129
+ * ciphertext and nothing else, and must not be mistaken for a re-enrolment.
10130
+ *
9964
10131
  * @param userId - The account whose stored secret is being re-encrypted.
9965
10132
  * @param context - Which identity plane the account belongs to.
9966
10133
  * @param secretBase32 - The decrypted secret.
9967
- * @param recoveryCodes - The stored recovery digests, written back unchanged.
9968
10134
  * @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
9969
10135
  */
9970
- async reencryptSecret(userId, context, secretBase32, recoveryCodes, tenantId) {
9971
- const update = {
9972
- mfaEnabled: true,
9973
- mfaSecret: this.encryptSecret(secretBase32),
9974
- mfaRecoveryCodes: recoveryCodes
9975
- };
10136
+ async reencryptSecret(userId, context, secretBase32, tenantId) {
9976
10137
  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
- }
10138
+ await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10139
+ if (!current.mfaEnabled || !this.holdsSecret(current.mfaSecret, secretBase32)) return null;
10140
+ return {
10141
+ mfaEnabled: true,
10142
+ mfaSecret: this.encryptSecret(secretBase32),
10143
+ mfaRecoveryCodes: current.mfaRecoveryCodes ?? []
10144
+ };
10145
+ });
9987
10146
  } catch (err) {
9988
10147
  this.logger.error(`re-encryption under the current MFA key failed: ${describeChannelStatus(err)}`);
9989
10148
  }
@@ -10077,6 +10236,20 @@ exports.MfaService = class _MfaService {
10077
10236
  }
10078
10237
  }
10079
10238
  /**
10239
+ * Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
10240
+ *
10241
+ * Compares plaintext, so a record that was only re-encrypted still matches and one holding a
10242
+ * different secret does not. A ciphertext no key opens does not match either.
10243
+ */
10244
+ holdsSecret(stored, secretBase32) {
10245
+ if (!stored) return false;
10246
+ try {
10247
+ return timingSafeCompare(this.decryptWithRotation(stored).secret, secretBase32);
10248
+ } catch {
10249
+ return false;
10250
+ }
10251
+ }
10252
+ /**
10080
10253
  * Encrypts a TOTP secret for storage in the database using AES-256-GCM.
10081
10254
  */
10082
10255
  encryptSecret(secret) {
@@ -10527,6 +10700,7 @@ exports.MfaService = class _MfaService {
10527
10700
  [];
10528
10701
  await this.transitionMfaRecord(context, userId, tenantId, (current) => {
10529
10702
  if (!current.mfaEnabled) return null;
10703
+ if (!this.holdsSecret(current.mfaSecret, secretBase32)) return null;
10530
10704
  const currentCodes = current.mfaRecoveryCodes ?? [];
10531
10705
  const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
10532
10706
  const liveIndex = currentCodes.indexOf(spentDigest);
@@ -10544,7 +10718,7 @@ exports.MfaService = class _MfaService {
10544
10718
  };
10545
10719
  });
10546
10720
  } else if (encryptedUnderRetiredKey) {
10547
- void this.reencryptSecret(userId, context, secretBase32, user.mfaRecoveryCodes ?? [], tenantId);
10721
+ void this.reencryptSecret(userId, context, secretBase32, tenantId);
10548
10722
  }
10549
10723
  this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
10550
10724
  if (context === "dashboard") {
@@ -11109,7 +11283,7 @@ exports.MfaService = class _MfaService {
11109
11283
  return admin;
11110
11284
  }
11111
11285
  };
11112
- exports.MfaService = _ts_decorate36([
11286
+ exports.MfaService = _ts_decorate37([
11113
11287
  common.Injectable(),
11114
11288
  _ts_param21(0, common.Inject(BYMAX_AUTH_OPTIONS)),
11115
11289
  _ts_param21(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -11122,8 +11296,8 @@ exports.MfaService = _ts_decorate36([
11122
11296
  _ts_param21(7, common.Inject(exports.SessionService)),
11123
11297
  _ts_param21(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
11124
11298
  _ts_param21(9, common.Inject(BYMAX_AUTH_HOOKS)),
11125
- _ts_metadata35("design:type", Function),
11126
- _ts_metadata35("design:paramtypes", [
11299
+ _ts_metadata36("design:type", Function),
11300
+ _ts_metadata36("design:paramtypes", [
11127
11301
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
11128
11302
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
11129
11303
  Object,
@@ -11138,7 +11312,7 @@ exports.MfaService = _ts_decorate36([
11138
11312
  ], exports.MfaService);
11139
11313
 
11140
11314
  // src/server/controllers/mfa.controller.ts
11141
- function _ts_decorate37(decorators, target, key, desc) {
11315
+ function _ts_decorate38(decorators, target, key, desc) {
11142
11316
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11143
11317
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11144
11318
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11151,13 +11325,13 @@ function _ts_decorate37(decorators, target, key, desc) {
11151
11325
  }
11152
11326
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11153
11327
  }
11154
- __name(_ts_decorate37, "_ts_decorate");
11155
- function _ts_metadata36(metadataKey, metadataValue) {
11328
+ __name(_ts_decorate38, "_ts_decorate");
11329
+ function _ts_metadata37(metadataKey, metadataValue) {
11156
11330
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11157
11331
  return Reflect.metadata(metadataKey, metadataValue);
11158
11332
  }
11159
11333
  }
11160
- __name(_ts_metadata36, "_ts_metadata");
11334
+ __name(_ts_metadata37, "_ts_metadata");
11161
11335
  function _ts_param22(paramIndex, decorator) {
11162
11336
  return function(target, key) {
11163
11337
  decorator(target, key, paramIndex);
@@ -11352,21 +11526,22 @@ var MfaController = class {
11352
11526
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
11353
11527
  }
11354
11528
  };
11355
- _ts_decorate37([
11529
+ _ts_decorate38([
11356
11530
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11357
11531
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
11358
11532
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
11533
+ RequestEncoding("when-body"),
11359
11534
  common.Post("setup"),
11360
11535
  _ts_param22(0, CurrentUser()),
11361
11536
  _ts_param22(1, common.Body()),
11362
- _ts_metadata36("design:type", Function),
11363
- _ts_metadata36("design:paramtypes", [
11537
+ _ts_metadata37("design:type", Function),
11538
+ _ts_metadata37("design:paramtypes", [
11364
11539
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11365
11540
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
11366
11541
  ]),
11367
- _ts_metadata36("design:returntype", Promise)
11542
+ _ts_metadata37("design:returntype", Promise)
11368
11543
  ], MfaController.prototype, "setup", null);
11369
- _ts_decorate37([
11544
+ _ts_decorate38([
11370
11545
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11371
11546
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
11372
11547
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
@@ -11375,15 +11550,15 @@ _ts_decorate37([
11375
11550
  _ts_param22(0, CurrentUser()),
11376
11551
  _ts_param22(1, common.Body()),
11377
11552
  _ts_param22(2, common.Req()),
11378
- _ts_metadata36("design:type", Function),
11379
- _ts_metadata36("design:paramtypes", [
11553
+ _ts_metadata37("design:type", Function),
11554
+ _ts_metadata37("design:paramtypes", [
11380
11555
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11381
11556
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
11382
11557
  typeof Request === "undefined" ? Object : Request
11383
11558
  ]),
11384
- _ts_metadata36("design:returntype", Promise)
11559
+ _ts_metadata37("design:returntype", Promise)
11385
11560
  ], MfaController.prototype, "verifyEnable", null);
11386
- _ts_decorate37([
11561
+ _ts_decorate38([
11387
11562
  Public(),
11388
11563
  SkipMfa(),
11389
11564
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
@@ -11395,15 +11570,15 @@ _ts_decorate37([
11395
11570
  _ts_param22(2, common.Res({
11396
11571
  passthrough: true
11397
11572
  })),
11398
- _ts_metadata36("design:type", Function),
11399
- _ts_metadata36("design:paramtypes", [
11573
+ _ts_metadata37("design:type", Function),
11574
+ _ts_metadata37("design:paramtypes", [
11400
11575
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
11401
11576
  typeof Request === "undefined" ? Object : Request,
11402
11577
  typeof Response === "undefined" ? Object : Response
11403
11578
  ]),
11404
- _ts_metadata36("design:returntype", Promise)
11579
+ _ts_metadata37("design:returntype", Promise)
11405
11580
  ], MfaController.prototype, "challenge", null);
11406
- _ts_decorate37([
11581
+ _ts_decorate38([
11407
11582
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11408
11583
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11409
11584
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -11412,15 +11587,15 @@ _ts_decorate37([
11412
11587
  _ts_param22(0, CurrentUser()),
11413
11588
  _ts_param22(1, common.Body()),
11414
11589
  _ts_param22(2, common.Req()),
11415
- _ts_metadata36("design:type", Function),
11416
- _ts_metadata36("design:paramtypes", [
11590
+ _ts_metadata37("design:type", Function),
11591
+ _ts_metadata37("design:paramtypes", [
11417
11592
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11418
11593
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
11419
11594
  typeof Request === "undefined" ? Object : Request
11420
11595
  ]),
11421
- _ts_metadata36("design:returntype", Promise)
11596
+ _ts_metadata37("design:returntype", Promise)
11422
11597
  ], MfaController.prototype, "disable", null);
11423
- _ts_decorate37([
11598
+ _ts_decorate38([
11424
11599
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
11425
11600
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
11426
11601
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -11429,33 +11604,33 @@ _ts_decorate37([
11429
11604
  _ts_param22(0, CurrentUser()),
11430
11605
  _ts_param22(1, common.Body()),
11431
11606
  _ts_param22(2, common.Req()),
11432
- _ts_metadata36("design:type", Function),
11433
- _ts_metadata36("design:paramtypes", [
11607
+ _ts_metadata37("design:type", Function),
11608
+ _ts_metadata37("design:paramtypes", [
11434
11609
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
11435
11610
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
11436
11611
  typeof Request === "undefined" ? Object : Request
11437
11612
  ]),
11438
- _ts_metadata36("design:returntype", Promise)
11613
+ _ts_metadata37("design:returntype", Promise)
11439
11614
  ], MfaController.prototype, "regenerateRecoveryCodes", null);
11440
- MfaController = _ts_decorate37([
11615
+ MfaController = _ts_decorate38([
11441
11616
  common.UseInterceptors(NoStoreInterceptor),
11442
11617
  common.Controller("mfa"),
11443
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11618
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
11444
11619
  common.UsePipes(createAuthValidationPipe({
11445
11620
  forbidUnknownValues: true
11446
11621
  })),
11447
11622
  _ts_param22(0, common.Inject(exports.MfaService)),
11448
11623
  _ts_param22(1, common.Inject(exports.TokenDeliveryService)),
11449
11624
  _ts_param22(2, common.Inject(BYMAX_AUTH_OPTIONS)),
11450
- _ts_metadata36("design:type", Function),
11451
- _ts_metadata36("design:paramtypes", [
11625
+ _ts_metadata37("design:type", Function),
11626
+ _ts_metadata37("design:paramtypes", [
11452
11627
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
11453
11628
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
11454
11629
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
11455
11630
  ])
11456
11631
  ], MfaController);
11457
11632
  var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
11458
- function _ts_decorate38(decorators, target, key, desc) {
11633
+ function _ts_decorate39(decorators, target, key, desc) {
11459
11634
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11460
11635
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11461
11636
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11468,13 +11643,13 @@ function _ts_decorate38(decorators, target, key, desc) {
11468
11643
  }
11469
11644
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11470
11645
  }
11471
- __name(_ts_decorate38, "_ts_decorate");
11472
- function _ts_metadata37(metadataKey, metadataValue) {
11646
+ __name(_ts_decorate39, "_ts_decorate");
11647
+ function _ts_metadata38(metadataKey, metadataValue) {
11473
11648
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11474
11649
  return Reflect.metadata(metadataKey, metadataValue);
11475
11650
  }
11476
11651
  }
11477
- __name(_ts_metadata37, "_ts_metadata");
11652
+ __name(_ts_metadata38, "_ts_metadata");
11478
11653
  var ChangePasswordDto = class {
11479
11654
  static {
11480
11655
  __name(this, "ChangePasswordDto");
@@ -11527,26 +11702,26 @@ var ChangePasswordDto = class {
11527
11702
  */
11528
11703
  refreshToken;
11529
11704
  };
11530
- _ts_decorate38([
11705
+ _ts_decorate39([
11531
11706
  classValidator.IsString(),
11532
11707
  classValidator.MinLength(1),
11533
11708
  classValidator.MaxLength(128),
11534
- _ts_metadata37("design:type", String)
11709
+ _ts_metadata38("design:type", String)
11535
11710
  ], ChangePasswordDto.prototype, "currentPassword", void 0);
11536
- _ts_decorate38([
11711
+ _ts_decorate39([
11537
11712
  classValidator.IsString(),
11538
11713
  classValidator.MinLength(8),
11539
11714
  classValidator.MaxLength(128),
11540
- _ts_metadata37("design:type", String)
11715
+ _ts_metadata38("design:type", String)
11541
11716
  ], ChangePasswordDto.prototype, "newPassword", void 0);
11542
- _ts_decorate38([
11717
+ _ts_decorate39([
11543
11718
  classValidator.IsOptional(),
11544
11719
  classValidator.IsString(),
11545
11720
  classValidator.IsNotEmpty(),
11546
11721
  classValidator.MaxLength(2048),
11547
- _ts_metadata37("design:type", String)
11722
+ _ts_metadata38("design:type", String)
11548
11723
  ], ChangePasswordDto.prototype, "refreshToken", void 0);
11549
- function _ts_decorate39(decorators, target, key, desc) {
11724
+ function _ts_decorate40(decorators, target, key, desc) {
11550
11725
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11551
11726
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11552
11727
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11559,13 +11734,13 @@ function _ts_decorate39(decorators, target, key, desc) {
11559
11734
  }
11560
11735
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11561
11736
  }
11562
- __name(_ts_decorate39, "_ts_decorate");
11563
- function _ts_metadata38(metadataKey, metadataValue) {
11737
+ __name(_ts_decorate40, "_ts_decorate");
11738
+ function _ts_metadata39(metadataKey, metadataValue) {
11564
11739
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11565
11740
  return Reflect.metadata(metadataKey, metadataValue);
11566
11741
  }
11567
11742
  }
11568
- __name(_ts_metadata38, "_ts_metadata");
11743
+ __name(_ts_metadata39, "_ts_metadata");
11569
11744
  var ForgotPasswordDto = class {
11570
11745
  static {
11571
11746
  __name(this, "ForgotPasswordDto");
@@ -11581,13 +11756,13 @@ var ForgotPasswordDto = class {
11581
11756
  */
11582
11757
  tenantId;
11583
11758
  };
11584
- _ts_decorate39([
11759
+ _ts_decorate40([
11585
11760
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11586
11761
  classValidator.IsEmail(),
11587
11762
  classValidator.MaxLength(255),
11588
- _ts_metadata38("design:type", String)
11763
+ _ts_metadata39("design:type", String)
11589
11764
  ], ForgotPasswordDto.prototype, "email", void 0);
11590
- _ts_decorate39([
11765
+ _ts_decorate40([
11591
11766
  classValidator.IsOptional(),
11592
11767
  classValidator.IsString(),
11593
11768
  classValidator.IsNotEmpty(),
@@ -11595,9 +11770,9 @@ _ts_decorate39([
11595
11770
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11596
11771
  message: "tenantId must not contain control characters"
11597
11772
  }),
11598
- _ts_metadata38("design:type", String)
11773
+ _ts_metadata39("design:type", String)
11599
11774
  ], ForgotPasswordDto.prototype, "tenantId", void 0);
11600
- function _ts_decorate40(decorators, target, key, desc) {
11775
+ function _ts_decorate41(decorators, target, key, desc) {
11601
11776
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11602
11777
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11603
11778
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11610,13 +11785,13 @@ function _ts_decorate40(decorators, target, key, desc) {
11610
11785
  }
11611
11786
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11612
11787
  }
11613
- __name(_ts_decorate40, "_ts_decorate");
11614
- function _ts_metadata39(metadataKey, metadataValue) {
11788
+ __name(_ts_decorate41, "_ts_decorate");
11789
+ function _ts_metadata40(metadataKey, metadataValue) {
11615
11790
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11616
11791
  return Reflect.metadata(metadataKey, metadataValue);
11617
11792
  }
11618
11793
  }
11619
- __name(_ts_metadata39, "_ts_metadata");
11794
+ __name(_ts_metadata40, "_ts_metadata");
11620
11795
  var ResendOtpDto = class {
11621
11796
  static {
11622
11797
  __name(this, "ResendOtpDto");
@@ -11631,13 +11806,13 @@ var ResendOtpDto = class {
11631
11806
  */
11632
11807
  tenantId;
11633
11808
  };
11634
- _ts_decorate40([
11809
+ _ts_decorate41([
11635
11810
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11636
11811
  classValidator.IsEmail(),
11637
11812
  classValidator.MaxLength(255),
11638
- _ts_metadata39("design:type", String)
11813
+ _ts_metadata40("design:type", String)
11639
11814
  ], ResendOtpDto.prototype, "email", void 0);
11640
- _ts_decorate40([
11815
+ _ts_decorate41([
11641
11816
  classValidator.IsOptional(),
11642
11817
  classValidator.IsString(),
11643
11818
  classValidator.IsNotEmpty(),
@@ -11645,9 +11820,9 @@ _ts_decorate40([
11645
11820
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11646
11821
  message: "tenantId must not contain control characters"
11647
11822
  }),
11648
- _ts_metadata39("design:type", String)
11823
+ _ts_metadata40("design:type", String)
11649
11824
  ], ResendOtpDto.prototype, "tenantId", void 0);
11650
- function _ts_decorate41(decorators, target, key, desc) {
11825
+ function _ts_decorate42(decorators, target, key, desc) {
11651
11826
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11652
11827
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11653
11828
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11660,13 +11835,13 @@ function _ts_decorate41(decorators, target, key, desc) {
11660
11835
  }
11661
11836
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11662
11837
  }
11663
- __name(_ts_decorate41, "_ts_decorate");
11664
- function _ts_metadata40(metadataKey, metadataValue) {
11838
+ __name(_ts_decorate42, "_ts_decorate");
11839
+ function _ts_metadata41(metadataKey, metadataValue) {
11665
11840
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11666
11841
  return Reflect.metadata(metadataKey, metadataValue);
11667
11842
  }
11668
11843
  }
11669
- __name(_ts_metadata40, "_ts_metadata");
11844
+ __name(_ts_metadata41, "_ts_metadata");
11670
11845
  var ResetPasswordDto = class {
11671
11846
  static {
11672
11847
  __name(this, "ResetPasswordDto");
@@ -11713,38 +11888,38 @@ var ResetPasswordDto = class {
11713
11888
  */
11714
11889
  tenantId;
11715
11890
  };
11716
- _ts_decorate41([
11891
+ _ts_decorate42([
11717
11892
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11718
11893
  classValidator.IsEmail(),
11719
11894
  classValidator.MaxLength(255),
11720
- _ts_metadata40("design:type", String)
11895
+ _ts_metadata41("design:type", String)
11721
11896
  ], ResetPasswordDto.prototype, "email", void 0);
11722
- _ts_decorate41([
11897
+ _ts_decorate42([
11723
11898
  classValidator.IsString(),
11724
11899
  classValidator.MinLength(8),
11725
11900
  classValidator.MaxLength(128),
11726
- _ts_metadata40("design:type", String)
11901
+ _ts_metadata41("design:type", String)
11727
11902
  ], ResetPasswordDto.prototype, "newPassword", void 0);
11728
- _ts_decorate41([
11903
+ _ts_decorate42([
11729
11904
  classValidator.IsOptional(),
11730
11905
  classValidator.IsString(),
11731
11906
  classValidator.IsNotEmpty(),
11732
11907
  classValidator.MaxLength(2048),
11733
- _ts_metadata40("design:type", String)
11908
+ _ts_metadata41("design:type", String)
11734
11909
  ], ResetPasswordDto.prototype, "token", void 0);
11735
- _ts_decorate41([
11910
+ _ts_decorate42([
11736
11911
  classValidator.IsOptional(),
11737
11912
  classValidator.IsString(),
11738
11913
  classValidator.Length(4, 8),
11739
- _ts_metadata40("design:type", String)
11914
+ _ts_metadata41("design:type", String)
11740
11915
  ], ResetPasswordDto.prototype, "otp", void 0);
11741
- _ts_decorate41([
11916
+ _ts_decorate42([
11742
11917
  classValidator.IsOptional(),
11743
11918
  classValidator.IsString(),
11744
11919
  classValidator.Length(64, 64),
11745
- _ts_metadata40("design:type", String)
11920
+ _ts_metadata41("design:type", String)
11746
11921
  ], ResetPasswordDto.prototype, "verifiedToken", void 0);
11747
- _ts_decorate41([
11922
+ _ts_decorate42([
11748
11923
  classValidator.IsOptional(),
11749
11924
  classValidator.IsString(),
11750
11925
  classValidator.IsNotEmpty(),
@@ -11752,9 +11927,9 @@ _ts_decorate41([
11752
11927
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11753
11928
  message: "tenantId must not contain control characters"
11754
11929
  }),
11755
- _ts_metadata40("design:type", String)
11930
+ _ts_metadata41("design:type", String)
11756
11931
  ], ResetPasswordDto.prototype, "tenantId", void 0);
11757
- function _ts_decorate42(decorators, target, key, desc) {
11932
+ function _ts_decorate43(decorators, target, key, desc) {
11758
11933
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11759
11934
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11760
11935
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11767,13 +11942,13 @@ function _ts_decorate42(decorators, target, key, desc) {
11767
11942
  }
11768
11943
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11769
11944
  }
11770
- __name(_ts_decorate42, "_ts_decorate");
11771
- function _ts_metadata41(metadataKey, metadataValue) {
11945
+ __name(_ts_decorate43, "_ts_decorate");
11946
+ function _ts_metadata42(metadataKey, metadataValue) {
11772
11947
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11773
11948
  return Reflect.metadata(metadataKey, metadataValue);
11774
11949
  }
11775
11950
  }
11776
- __name(_ts_metadata41, "_ts_metadata");
11951
+ __name(_ts_metadata42, "_ts_metadata");
11777
11952
  var VerifyOtpDto = class {
11778
11953
  static {
11779
11954
  __name(this, "VerifyOtpDto");
@@ -11795,18 +11970,18 @@ var VerifyOtpDto = class {
11795
11970
  */
11796
11971
  tenantId;
11797
11972
  };
11798
- _ts_decorate42([
11973
+ _ts_decorate43([
11799
11974
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
11800
11975
  classValidator.IsEmail(),
11801
11976
  classValidator.MaxLength(255),
11802
- _ts_metadata41("design:type", String)
11977
+ _ts_metadata42("design:type", String)
11803
11978
  ], VerifyOtpDto.prototype, "email", void 0);
11804
- _ts_decorate42([
11979
+ _ts_decorate43([
11805
11980
  classValidator.IsString(),
11806
11981
  classValidator.Length(4, 8),
11807
- _ts_metadata41("design:type", String)
11982
+ _ts_metadata42("design:type", String)
11808
11983
  ], VerifyOtpDto.prototype, "otp", void 0);
11809
- _ts_decorate42([
11984
+ _ts_decorate43([
11810
11985
  classValidator.IsOptional(),
11811
11986
  classValidator.IsString(),
11812
11987
  classValidator.IsNotEmpty(),
@@ -11814,9 +11989,9 @@ _ts_decorate42([
11814
11989
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
11815
11990
  message: "tenantId must not contain control characters"
11816
11991
  }),
11817
- _ts_metadata41("design:type", String)
11992
+ _ts_metadata42("design:type", String)
11818
11993
  ], VerifyOtpDto.prototype, "tenantId", void 0);
11819
- function _ts_decorate43(decorators, target, key, desc) {
11994
+ function _ts_decorate44(decorators, target, key, desc) {
11820
11995
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11821
11996
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
11822
11997
  r = Reflect.decorate(decorators, target, key, desc);
@@ -11829,13 +12004,13 @@ function _ts_decorate43(decorators, target, key, desc) {
11829
12004
  }
11830
12005
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11831
12006
  }
11832
- __name(_ts_decorate43, "_ts_decorate");
11833
- function _ts_metadata42(metadataKey, metadataValue) {
12007
+ __name(_ts_decorate44, "_ts_decorate");
12008
+ function _ts_metadata43(metadataKey, metadataValue) {
11834
12009
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
11835
12010
  return Reflect.metadata(metadataKey, metadataValue);
11836
12011
  }
11837
12012
  }
11838
- __name(_ts_metadata42, "_ts_metadata");
12013
+ __name(_ts_metadata43, "_ts_metadata");
11839
12014
  function _ts_param23(paramIndex, decorator) {
11840
12015
  return function(target, key) {
11841
12016
  decorator(target, key, paramIndex);
@@ -12451,7 +12626,7 @@ exports.PasswordResetService = class _PasswordResetService {
12451
12626
  };
12452
12627
  }
12453
12628
  };
12454
- exports.PasswordResetService = _ts_decorate43([
12629
+ exports.PasswordResetService = _ts_decorate44([
12455
12630
  common.Injectable(),
12456
12631
  _ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
12457
12632
  _ts_param23(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -12464,8 +12639,8 @@ exports.PasswordResetService = _ts_decorate43([
12464
12639
  _ts_param23(6, common.Inject(AuthRedisService)),
12465
12640
  _ts_param23(7, common.Inject(exports.SessionService)),
12466
12641
  _ts_param23(8, common.Inject(exports.BruteForceService)),
12467
- _ts_metadata42("design:type", Function),
12468
- _ts_metadata42("design:paramtypes", [
12642
+ _ts_metadata43("design:type", Function),
12643
+ _ts_metadata43("design:paramtypes", [
12469
12644
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
12470
12645
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
12471
12646
  Object,
@@ -12484,7 +12659,7 @@ function toSafeUser3(user) {
12484
12659
  __name(toSafeUser3, "toSafeUser");
12485
12660
 
12486
12661
  // src/server/controllers/password-reset.controller.ts
12487
- function _ts_decorate44(decorators, target, key, desc) {
12662
+ function _ts_decorate45(decorators, target, key, desc) {
12488
12663
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12489
12664
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12490
12665
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12497,13 +12672,13 @@ function _ts_decorate44(decorators, target, key, desc) {
12497
12672
  }
12498
12673
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12499
12674
  }
12500
- __name(_ts_decorate44, "_ts_decorate");
12501
- function _ts_metadata43(metadataKey, metadataValue) {
12675
+ __name(_ts_decorate45, "_ts_decorate");
12676
+ function _ts_metadata44(metadataKey, metadataValue) {
12502
12677
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12503
12678
  return Reflect.metadata(metadataKey, metadataValue);
12504
12679
  }
12505
12680
  }
12506
- __name(_ts_metadata43, "_ts_metadata");
12681
+ __name(_ts_metadata44, "_ts_metadata");
12507
12682
  function _ts_param24(paramIndex, decorator) {
12508
12683
  return function(target, key) {
12509
12684
  decorator(target, key, paramIndex);
@@ -12626,35 +12801,35 @@ var PasswordResetController = class {
12626
12801
  return {};
12627
12802
  }
12628
12803
  };
12629
- _ts_decorate44([
12804
+ _ts_decorate45([
12630
12805
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
12631
12806
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
12632
12807
  common.HttpCode(common.HttpStatus.OK),
12633
12808
  common.Post("forgot-password"),
12634
12809
  _ts_param24(0, common.Body()),
12635
12810
  _ts_param24(1, common.Req()),
12636
- _ts_metadata43("design:type", Function),
12637
- _ts_metadata43("design:paramtypes", [
12811
+ _ts_metadata44("design:type", Function),
12812
+ _ts_metadata44("design:paramtypes", [
12638
12813
  typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
12639
12814
  typeof Request === "undefined" ? Object : Request
12640
12815
  ]),
12641
- _ts_metadata43("design:returntype", Promise)
12816
+ _ts_metadata44("design:returntype", Promise)
12642
12817
  ], PasswordResetController.prototype, "forgotPassword", null);
12643
- _ts_decorate44([
12818
+ _ts_decorate45([
12644
12819
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
12645
12820
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
12646
12821
  common.HttpCode(common.HttpStatus.NO_CONTENT),
12647
12822
  common.Post("reset-password"),
12648
12823
  _ts_param24(0, common.Body()),
12649
12824
  _ts_param24(1, common.Req()),
12650
- _ts_metadata43("design:type", Function),
12651
- _ts_metadata43("design:paramtypes", [
12825
+ _ts_metadata44("design:type", Function),
12826
+ _ts_metadata44("design:paramtypes", [
12652
12827
  typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
12653
12828
  typeof Request === "undefined" ? Object : Request
12654
12829
  ]),
12655
- _ts_metadata43("design:returntype", Promise)
12830
+ _ts_metadata44("design:returntype", Promise)
12656
12831
  ], PasswordResetController.prototype, "resetPassword", null);
12657
- _ts_decorate44([
12832
+ _ts_decorate45([
12658
12833
  Authenticated(),
12659
12834
  common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
12660
12835
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
@@ -12664,57 +12839,57 @@ _ts_decorate44([
12664
12839
  _ts_param24(0, CurrentUser()),
12665
12840
  _ts_param24(1, common.Body()),
12666
12841
  _ts_param24(2, common.Req()),
12667
- _ts_metadata43("design:type", Function),
12668
- _ts_metadata43("design:paramtypes", [
12842
+ _ts_metadata44("design:type", Function),
12843
+ _ts_metadata44("design:paramtypes", [
12669
12844
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
12670
12845
  typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
12671
12846
  typeof Request === "undefined" ? Object : Request
12672
12847
  ]),
12673
- _ts_metadata43("design:returntype", Promise)
12848
+ _ts_metadata44("design:returntype", Promise)
12674
12849
  ], PasswordResetController.prototype, "changePassword", null);
12675
- _ts_decorate44([
12850
+ _ts_decorate45([
12676
12851
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
12677
12852
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
12678
12853
  common.HttpCode(common.HttpStatus.OK),
12679
12854
  common.Post("verify-otp"),
12680
12855
  _ts_param24(0, common.Body()),
12681
12856
  _ts_param24(1, common.Req()),
12682
- _ts_metadata43("design:type", Function),
12683
- _ts_metadata43("design:paramtypes", [
12857
+ _ts_metadata44("design:type", Function),
12858
+ _ts_metadata44("design:paramtypes", [
12684
12859
  typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
12685
12860
  typeof Request === "undefined" ? Object : Request
12686
12861
  ]),
12687
- _ts_metadata43("design:returntype", Promise)
12862
+ _ts_metadata44("design:returntype", Promise)
12688
12863
  ], PasswordResetController.prototype, "verifyOtp", null);
12689
- _ts_decorate44([
12864
+ _ts_decorate45([
12690
12865
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12691
12866
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
12692
12867
  common.HttpCode(common.HttpStatus.OK),
12693
12868
  common.Post("resend-otp"),
12694
12869
  _ts_param24(0, common.Body()),
12695
12870
  _ts_param24(1, common.Req()),
12696
- _ts_metadata43("design:type", Function),
12697
- _ts_metadata43("design:paramtypes", [
12871
+ _ts_metadata44("design:type", Function),
12872
+ _ts_metadata44("design:paramtypes", [
12698
12873
  typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
12699
12874
  typeof Request === "undefined" ? Object : Request
12700
12875
  ]),
12701
- _ts_metadata43("design:returntype", Promise)
12876
+ _ts_metadata44("design:returntype", Promise)
12702
12877
  ], PasswordResetController.prototype, "resendOtp", null);
12703
- PasswordResetController = _ts_decorate44([
12878
+ PasswordResetController = _ts_decorate45([
12704
12879
  Public(),
12705
12880
  common.UseInterceptors(NoStoreInterceptor),
12706
12881
  common.Controller("password"),
12707
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12882
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
12708
12883
  common.UsePipes(createAuthValidationPipe()),
12709
12884
  _ts_param24(0, common.Inject(exports.PasswordResetService)),
12710
12885
  _ts_param24(1, common.Inject(exports.TokenDeliveryService)),
12711
- _ts_metadata43("design:type", Function),
12712
- _ts_metadata43("design:paramtypes", [
12886
+ _ts_metadata44("design:type", Function),
12887
+ _ts_metadata44("design:paramtypes", [
12713
12888
  typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
12714
12889
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
12715
12890
  ])
12716
12891
  ], PasswordResetController);
12717
- function _ts_decorate45(decorators, target, key, desc) {
12892
+ function _ts_decorate46(decorators, target, key, desc) {
12718
12893
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12719
12894
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12720
12895
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12727,13 +12902,13 @@ function _ts_decorate45(decorators, target, key, desc) {
12727
12902
  }
12728
12903
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12729
12904
  }
12730
- __name(_ts_decorate45, "_ts_decorate");
12731
- function _ts_metadata44(metadataKey, metadataValue) {
12905
+ __name(_ts_decorate46, "_ts_decorate");
12906
+ function _ts_metadata45(metadataKey, metadataValue) {
12732
12907
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12733
12908
  return Reflect.metadata(metadataKey, metadataValue);
12734
12909
  }
12735
12910
  }
12736
- __name(_ts_metadata44, "_ts_metadata");
12911
+ __name(_ts_metadata45, "_ts_metadata");
12737
12912
  var PlatformLoginDto = class {
12738
12913
  static {
12739
12914
  __name(this, "PlatformLoginDto");
@@ -12761,14 +12936,14 @@ var PlatformLoginDto = class {
12761
12936
  */
12762
12937
  password;
12763
12938
  };
12764
- _ts_decorate45([
12939
+ _ts_decorate46([
12765
12940
  classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
12766
12941
  classValidator.IsEmail(),
12767
12942
  classValidator.IsNotEmpty(),
12768
12943
  classValidator.MaxLength(255),
12769
- _ts_metadata44("design:type", String)
12944
+ _ts_metadata45("design:type", String)
12770
12945
  ], PlatformLoginDto.prototype, "email", void 0);
12771
- _ts_decorate45([
12946
+ _ts_decorate46([
12772
12947
  classValidator.IsString(),
12773
12948
  classValidator.IsNotEmpty(),
12774
12949
  classValidator.Matches(/\S/, {
@@ -12776,9 +12951,9 @@ _ts_decorate45([
12776
12951
  }),
12777
12952
  classValidator.MinLength(1),
12778
12953
  classValidator.MaxLength(128),
12779
- _ts_metadata44("design:type", String)
12954
+ _ts_metadata45("design:type", String)
12780
12955
  ], PlatformLoginDto.prototype, "password", void 0);
12781
- function _ts_decorate46(decorators, target, key, desc) {
12956
+ function _ts_decorate47(decorators, target, key, desc) {
12782
12957
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12783
12958
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12784
12959
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12791,13 +12966,13 @@ function _ts_decorate46(decorators, target, key, desc) {
12791
12966
  }
12792
12967
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12793
12968
  }
12794
- __name(_ts_decorate46, "_ts_decorate");
12795
- function _ts_metadata45(metadataKey, metadataValue) {
12969
+ __name(_ts_decorate47, "_ts_decorate");
12970
+ function _ts_metadata46(metadataKey, metadataValue) {
12796
12971
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12797
12972
  return Reflect.metadata(metadataKey, metadataValue);
12798
12973
  }
12799
12974
  }
12800
- __name(_ts_metadata45, "_ts_metadata");
12975
+ __name(_ts_metadata46, "_ts_metadata");
12801
12976
  function _ts_param25(paramIndex, decorator) {
12802
12977
  return function(target, key) {
12803
12978
  decorator(target, key, paramIndex);
@@ -12849,15 +13024,15 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
12849
13024
  return true;
12850
13025
  }
12851
13026
  };
12852
- exports.JwtPlatformGuard = _ts_decorate46([
13027
+ exports.JwtPlatformGuard = _ts_decorate47([
12853
13028
  common.Injectable(),
12854
13029
  _ts_param25(0, common.Inject(jwt.JwtService)),
12855
13030
  _ts_param25(1, common.Inject(exports.TokenDeliveryService)),
12856
13031
  _ts_param25(2, common.Inject(exports.AuthRevocationService)),
12857
13032
  _ts_param25(3, common.Inject(core.Reflector)),
12858
13033
  _ts_param25(4, common.Inject(BYMAX_AUTH_OPTIONS)),
12859
- _ts_metadata45("design:type", Function),
12860
- _ts_metadata45("design:paramtypes", [
13034
+ _ts_metadata46("design:type", Function),
13035
+ _ts_metadata46("design:paramtypes", [
12861
13036
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
12862
13037
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
12863
13038
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -12865,7 +13040,7 @@ exports.JwtPlatformGuard = _ts_decorate46([
12865
13040
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
12866
13041
  ])
12867
13042
  ], exports.JwtPlatformGuard);
12868
- function _ts_decorate47(decorators, target, key, desc) {
13043
+ function _ts_decorate48(decorators, target, key, desc) {
12869
13044
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12870
13045
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
12871
13046
  r = Reflect.decorate(decorators, target, key, desc);
@@ -12878,13 +13053,13 @@ function _ts_decorate47(decorators, target, key, desc) {
12878
13053
  }
12879
13054
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12880
13055
  }
12881
- __name(_ts_decorate47, "_ts_decorate");
12882
- function _ts_metadata46(metadataKey, metadataValue) {
13056
+ __name(_ts_decorate48, "_ts_decorate");
13057
+ function _ts_metadata47(metadataKey, metadataValue) {
12883
13058
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
12884
13059
  return Reflect.metadata(metadataKey, metadataValue);
12885
13060
  }
12886
13061
  }
12887
- __name(_ts_metadata46, "_ts_metadata");
13062
+ __name(_ts_metadata47, "_ts_metadata");
12888
13063
  function _ts_param26(paramIndex, decorator) {
12889
13064
  return function(target, key) {
12890
13065
  decorator(target, key, paramIndex);
@@ -12989,36 +13164,60 @@ exports.PlatformAuthService = class _PlatformAuthService {
12989
13164
  */
12990
13165
  async logout(accessToken, rawRefreshToken) {
12991
13166
  const tokenHash = sha256(rawRefreshToken);
12992
- const { userId } = await this.redis.readSessionOwner(`prt:${tokenHash}`);
13167
+ const markerKey = logoutPendingKey("platform", tokenHash);
13168
+ const live = await this.redis.readSessionOwner(`prt:${tokenHash}`);
13169
+ const fromSession = live.userId !== "";
13170
+ const { userId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
12993
13171
  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
13172
  const index = userId ? sessionIndexKey("platform", userId, this.options.hmacKey, void 0) : "";
13006
13173
  const prune = /* @__PURE__ */ __name((member) => index === "" ? [] : [
13007
13174
  () => this.redis.srem(index, member)
13008
13175
  ], "prune");
13009
13176
  const failures = await settleWrites([
13010
- ...blacklist,
13177
+ ...this.blacklistWrites(accessToken),
13011
13178
  settleAfter(() => this.redis.del("prt:" + tokenHash), [
13012
13179
  ...prune("prt:" + tokenHash),
13013
13180
  () => this.redis.del("psd:" + tokenHash)
13014
13181
  ]),
13015
13182
  settleAfter(() => this.redis.del("prp:" + tokenHash), prune("prp:" + tokenHash))
13016
13183
  ]);
13184
+ if (failures.length > 0 && fromSession) {
13185
+ await rememberPendingLogout(this.redis, markerKey, {
13186
+ userId,
13187
+ tenantId: void 0
13188
+ }, logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn), this.logger);
13189
+ }
13017
13190
  raiseFirst(failures);
13018
- this.emitPlatformLogout(userId);
13191
+ if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, this.logger)) {
13192
+ this.emitPlatformLogout(userId);
13193
+ }
13019
13194
  return userId;
13020
13195
  }
13021
13196
  /**
13197
+ * The access-token blacklist write for a platform logout, or none when there is nothing to
13198
+ * revoke.
13199
+ *
13200
+ * Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
13201
+ * forged one must not be able to blacklist an id it does not own. Only the verification is
13202
+ * tolerant: a token nobody can verify has nothing to blacklist, but a refused write is not.
13203
+ *
13204
+ * @param accessToken - Raw platform access token; absent, malformed or expired yields no write.
13205
+ * @returns The writes to hand to `settleWrites`.
13206
+ */
13207
+ blacklistWrites(accessToken) {
13208
+ try {
13209
+ const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
13210
+ const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
13211
+ if (remainingTtl > 0) {
13212
+ return [
13213
+ () => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
13214
+ ];
13215
+ }
13216
+ } catch {
13217
+ }
13218
+ return [];
13219
+ }
13220
+ /**
13022
13221
  * Announces a completed platform logout, the only hook `PlatformAuthService` emits.
13023
13222
  *
13024
13223
  * Owns three concerns a reader of `logout` does not need: whether a hook is registered, the
@@ -13155,7 +13354,7 @@ exports.PlatformAuthService = class _PlatformAuthService {
13155
13354
  await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
13156
13355
  }
13157
13356
  };
13158
- exports.PlatformAuthService = _ts_decorate47([
13357
+ exports.PlatformAuthService = _ts_decorate48([
13159
13358
  common.Injectable(),
13160
13359
  _ts_param26(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
13161
13360
  _ts_param26(1, common.Inject(PasswordService)),
@@ -13165,8 +13364,8 @@ exports.PlatformAuthService = _ts_decorate47([
13165
13364
  _ts_param26(5, common.Inject(BYMAX_AUTH_OPTIONS)),
13166
13365
  _ts_param26(6, common.Inject(BYMAX_AUTH_HOOKS)),
13167
13366
  _ts_param26(6, common.Optional()),
13168
- _ts_metadata46("design:type", Function),
13169
- _ts_metadata46("design:paramtypes", [
13367
+ _ts_metadata47("design:type", Function),
13368
+ _ts_metadata47("design:paramtypes", [
13170
13369
  typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
13171
13370
  typeof PasswordService === "undefined" ? Object : PasswordService,
13172
13371
  typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
@@ -13178,7 +13377,7 @@ exports.PlatformAuthService = _ts_decorate47([
13178
13377
  ], exports.PlatformAuthService);
13179
13378
 
13180
13379
  // src/server/controllers/platform-auth.controller.ts
13181
- function _ts_decorate48(decorators, target, key, desc) {
13380
+ function _ts_decorate49(decorators, target, key, desc) {
13182
13381
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13183
13382
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13184
13383
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13191,13 +13390,13 @@ function _ts_decorate48(decorators, target, key, desc) {
13191
13390
  }
13192
13391
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13193
13392
  }
13194
- __name(_ts_decorate48, "_ts_decorate");
13195
- function _ts_metadata47(metadataKey, metadataValue) {
13393
+ __name(_ts_decorate49, "_ts_decorate");
13394
+ function _ts_metadata48(metadataKey, metadataValue) {
13196
13395
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13197
13396
  return Reflect.metadata(metadataKey, metadataValue);
13198
13397
  }
13199
13398
  }
13200
- __name(_ts_metadata47, "_ts_metadata");
13399
+ __name(_ts_metadata48, "_ts_metadata");
13201
13400
  function _ts_param27(paramIndex, decorator) {
13202
13401
  return function(target, key) {
13203
13402
  decorator(target, key, paramIndex);
@@ -13349,7 +13548,7 @@ var PlatformAuthController = class {
13349
13548
  await this.platformAuthService.revokeAllPlatformSessions(user.sub);
13350
13549
  }
13351
13550
  };
13352
- _ts_decorate48([
13551
+ _ts_decorate49([
13353
13552
  Public(),
13354
13553
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
13355
13554
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
@@ -13357,14 +13556,14 @@ _ts_decorate48([
13357
13556
  common.Post("login"),
13358
13557
  _ts_param27(0, common.Body()),
13359
13558
  _ts_param27(1, common.Req()),
13360
- _ts_metadata47("design:type", Function),
13361
- _ts_metadata47("design:paramtypes", [
13559
+ _ts_metadata48("design:type", Function),
13560
+ _ts_metadata48("design:paramtypes", [
13362
13561
  typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
13363
13562
  typeof Request === "undefined" ? Object : Request
13364
13563
  ]),
13365
- _ts_metadata47("design:returntype", Promise)
13564
+ _ts_metadata48("design:returntype", Promise)
13366
13565
  ], PlatformAuthController.prototype, "login", null);
13367
- _ts_decorate48([
13566
+ _ts_decorate49([
13368
13567
  Public(),
13369
13568
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
13370
13569
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
@@ -13372,78 +13571,80 @@ _ts_decorate48([
13372
13571
  common.Post("mfa/challenge"),
13373
13572
  _ts_param27(0, common.Body()),
13374
13573
  _ts_param27(1, common.Req()),
13375
- _ts_metadata47("design:type", Function),
13376
- _ts_metadata47("design:paramtypes", [
13574
+ _ts_metadata48("design:type", Function),
13575
+ _ts_metadata48("design:paramtypes", [
13377
13576
  typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
13378
13577
  typeof Request === "undefined" ? Object : Request
13379
13578
  ]),
13380
- _ts_metadata47("design:returntype", Promise)
13579
+ _ts_metadata48("design:returntype", Promise)
13381
13580
  ], PlatformAuthController.prototype, "mfaChallenge", null);
13382
- _ts_decorate48([
13581
+ _ts_decorate49([
13383
13582
  common.UseGuards(exports.JwtPlatformGuard),
13384
13583
  common.Get("me"),
13385
13584
  _ts_param27(0, CurrentUser()),
13386
- _ts_metadata47("design:type", Function),
13387
- _ts_metadata47("design:paramtypes", [
13585
+ _ts_metadata48("design:type", Function),
13586
+ _ts_metadata48("design:paramtypes", [
13388
13587
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13389
13588
  ]),
13390
- _ts_metadata47("design:returntype", Promise)
13589
+ _ts_metadata48("design:returntype", Promise)
13391
13590
  ], PlatformAuthController.prototype, "me", null);
13392
- _ts_decorate48([
13591
+ _ts_decorate49([
13393
13592
  Public(),
13394
13593
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
13395
13594
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
13396
13595
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13596
+ RequestEncoding("unchecked"),
13397
13597
  common.Post("logout"),
13398
13598
  _ts_param27(0, common.Req()),
13399
- _ts_metadata47("design:type", Function),
13400
- _ts_metadata47("design:paramtypes", [
13599
+ _ts_metadata48("design:type", Function),
13600
+ _ts_metadata48("design:paramtypes", [
13401
13601
  typeof Request === "undefined" ? Object : Request
13402
13602
  ]),
13403
- _ts_metadata47("design:returntype", Promise)
13603
+ _ts_metadata48("design:returntype", Promise)
13404
13604
  ], PlatformAuthController.prototype, "logout", null);
13405
- _ts_decorate48([
13605
+ _ts_decorate49([
13406
13606
  Public(),
13407
13607
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
13408
13608
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
13409
13609
  common.HttpCode(common.HttpStatus.OK),
13610
+ RequestEncoding("unchecked"),
13410
13611
  common.Post("refresh"),
13411
13612
  _ts_param27(0, common.Req()),
13412
- _ts_metadata47("design:type", Function),
13413
- _ts_metadata47("design:paramtypes", [
13613
+ _ts_metadata48("design:type", Function),
13614
+ _ts_metadata48("design:paramtypes", [
13414
13615
  typeof Request === "undefined" ? Object : Request
13415
13616
  ]),
13416
- _ts_metadata47("design:returntype", Promise)
13617
+ _ts_metadata48("design:returntype", Promise)
13417
13618
  ], PlatformAuthController.prototype, "refresh", null);
13418
- _ts_decorate48([
13619
+ _ts_decorate49([
13419
13620
  common.UseGuards(exports.JwtPlatformGuard),
13420
13621
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13421
13622
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13422
13623
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13423
13624
  common.Delete("sessions"),
13424
13625
  _ts_param27(0, CurrentUser()),
13425
- _ts_metadata47("design:type", Function),
13426
- _ts_metadata47("design:paramtypes", [
13626
+ _ts_metadata48("design:type", Function),
13627
+ _ts_metadata48("design:paramtypes", [
13427
13628
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
13428
13629
  ]),
13429
- _ts_metadata47("design:returntype", Promise)
13630
+ _ts_metadata48("design:returntype", Promise)
13430
13631
  ], PlatformAuthController.prototype, "revokeSessions", null);
13431
- PlatformAuthController = _ts_decorate48([
13632
+ PlatformAuthController = _ts_decorate49([
13432
13633
  common.UseInterceptors(NoStoreInterceptor),
13433
13634
  common.Controller("platform"),
13434
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13635
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13435
13636
  common.UsePipes(createAuthValidationPipe()),
13436
13637
  _ts_param27(0, common.Inject(exports.PlatformAuthService)),
13437
13638
  _ts_param27(1, common.Inject(exports.MfaService)),
13438
13639
  _ts_param27(2, common.Inject(exports.TokenDeliveryService)),
13439
- _ts_metadata47("design:type", Function),
13440
- _ts_metadata47("design:paramtypes", [
13640
+ _ts_metadata48("design:type", Function),
13641
+ _ts_metadata48("design:paramtypes", [
13441
13642
  typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
13442
13643
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
13443
13644
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13444
13645
  ])
13445
13646
  ], PlatformAuthController);
13446
- function _ts_decorate49(decorators, target, key, desc) {
13647
+ function _ts_decorate50(decorators, target, key, desc) {
13447
13648
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13448
13649
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13449
13650
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13456,13 +13657,13 @@ function _ts_decorate49(decorators, target, key, desc) {
13456
13657
  }
13457
13658
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13458
13659
  }
13459
- __name(_ts_decorate49, "_ts_decorate");
13460
- function _ts_metadata48(metadataKey, metadataValue) {
13660
+ __name(_ts_decorate50, "_ts_decorate");
13661
+ function _ts_metadata49(metadataKey, metadataValue) {
13461
13662
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13462
13663
  return Reflect.metadata(metadataKey, metadataValue);
13463
13664
  }
13464
13665
  }
13465
- __name(_ts_metadata48, "_ts_metadata");
13666
+ __name(_ts_metadata49, "_ts_metadata");
13466
13667
  function _ts_param28(paramIndex, decorator) {
13467
13668
  return function(target, key) {
13468
13669
  decorator(target, key, paramIndex);
@@ -13547,21 +13748,22 @@ var PlatformMfaController = class {
13547
13748
  return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
13548
13749
  }
13549
13750
  };
13550
- _ts_decorate49([
13751
+ _ts_decorate50([
13551
13752
  common.UseGuards(exports.JwtPlatformGuard),
13552
13753
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
13553
13754
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
13755
+ RequestEncoding("when-body"),
13554
13756
  common.Post("setup"),
13555
13757
  _ts_param28(0, CurrentUser()),
13556
13758
  _ts_param28(1, common.Body()),
13557
- _ts_metadata48("design:type", Function),
13558
- _ts_metadata48("design:paramtypes", [
13759
+ _ts_metadata49("design:type", Function),
13760
+ _ts_metadata49("design:paramtypes", [
13559
13761
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13560
13762
  typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
13561
13763
  ]),
13562
- _ts_metadata48("design:returntype", Promise)
13764
+ _ts_metadata49("design:returntype", Promise)
13563
13765
  ], PlatformMfaController.prototype, "setup", null);
13564
- _ts_decorate49([
13766
+ _ts_decorate50([
13565
13767
  common.UseGuards(exports.JwtPlatformGuard),
13566
13768
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
13567
13769
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
@@ -13570,15 +13772,15 @@ _ts_decorate49([
13570
13772
  _ts_param28(0, CurrentUser()),
13571
13773
  _ts_param28(1, common.Body()),
13572
13774
  _ts_param28(2, common.Req()),
13573
- _ts_metadata48("design:type", Function),
13574
- _ts_metadata48("design:paramtypes", [
13775
+ _ts_metadata49("design:type", Function),
13776
+ _ts_metadata49("design:paramtypes", [
13575
13777
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13576
13778
  typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
13577
13779
  typeof Request === "undefined" ? Object : Request
13578
13780
  ]),
13579
- _ts_metadata48("design:returntype", Promise)
13781
+ _ts_metadata49("design:returntype", Promise)
13580
13782
  ], PlatformMfaController.prototype, "verifyEnable", null);
13581
- _ts_decorate49([
13783
+ _ts_decorate50([
13582
13784
  common.UseGuards(exports.JwtPlatformGuard),
13583
13785
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13584
13786
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -13587,15 +13789,15 @@ _ts_decorate49([
13587
13789
  _ts_param28(0, CurrentUser()),
13588
13790
  _ts_param28(1, common.Body()),
13589
13791
  _ts_param28(2, common.Req()),
13590
- _ts_metadata48("design:type", Function),
13591
- _ts_metadata48("design:paramtypes", [
13792
+ _ts_metadata49("design:type", Function),
13793
+ _ts_metadata49("design:paramtypes", [
13592
13794
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13593
13795
  typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
13594
13796
  typeof Request === "undefined" ? Object : Request
13595
13797
  ]),
13596
- _ts_metadata48("design:returntype", Promise)
13798
+ _ts_metadata49("design:returntype", Promise)
13597
13799
  ], PlatformMfaController.prototype, "disable", null);
13598
- _ts_decorate49([
13800
+ _ts_decorate50([
13599
13801
  common.UseGuards(exports.JwtPlatformGuard),
13600
13802
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
13601
13803
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
@@ -13604,28 +13806,28 @@ _ts_decorate49([
13604
13806
  _ts_param28(0, CurrentUser()),
13605
13807
  _ts_param28(1, common.Body()),
13606
13808
  _ts_param28(2, common.Req()),
13607
- _ts_metadata48("design:type", Function),
13608
- _ts_metadata48("design:paramtypes", [
13809
+ _ts_metadata49("design:type", Function),
13810
+ _ts_metadata49("design:paramtypes", [
13609
13811
  typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
13610
13812
  typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
13611
13813
  typeof Request === "undefined" ? Object : Request
13612
13814
  ]),
13613
- _ts_metadata48("design:returntype", Promise)
13815
+ _ts_metadata49("design:returntype", Promise)
13614
13816
  ], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
13615
- PlatformMfaController = _ts_decorate49([
13817
+ PlatformMfaController = _ts_decorate50([
13616
13818
  common.UseInterceptors(NoStoreInterceptor),
13617
13819
  common.Controller("platform/mfa"),
13618
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13820
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
13619
13821
  common.UsePipes(createAuthValidationPipe({
13620
13822
  forbidUnknownValues: true
13621
13823
  })),
13622
13824
  _ts_param28(0, common.Inject(exports.MfaService)),
13623
- _ts_metadata48("design:type", Function),
13624
- _ts_metadata48("design:paramtypes", [
13825
+ _ts_metadata49("design:type", Function),
13826
+ _ts_metadata49("design:paramtypes", [
13625
13827
  typeof exports.MfaService === "undefined" ? Object : exports.MfaService
13626
13828
  ])
13627
13829
  ], PlatformMfaController);
13628
- function _ts_decorate50(decorators, target, key, desc) {
13830
+ function _ts_decorate51(decorators, target, key, desc) {
13629
13831
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13630
13832
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13631
13833
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13638,13 +13840,13 @@ function _ts_decorate50(decorators, target, key, desc) {
13638
13840
  }
13639
13841
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13640
13842
  }
13641
- __name(_ts_decorate50, "_ts_decorate");
13642
- function _ts_metadata49(metadataKey, metadataValue) {
13843
+ __name(_ts_decorate51, "_ts_decorate");
13844
+ function _ts_metadata50(metadataKey, metadataValue) {
13643
13845
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13644
13846
  return Reflect.metadata(metadataKey, metadataValue);
13645
13847
  }
13646
13848
  }
13647
- __name(_ts_metadata49, "_ts_metadata");
13849
+ __name(_ts_metadata50, "_ts_metadata");
13648
13850
  function _ts_param29(paramIndex, decorator) {
13649
13851
  return function(target, key) {
13650
13852
  decorator(target, key, paramIndex);
@@ -13750,63 +13952,64 @@ var SessionController = class {
13750
13952
  });
13751
13953
  }
13752
13954
  };
13753
- _ts_decorate50([
13955
+ _ts_decorate51([
13754
13956
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
13755
13957
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
13756
13958
  common.Get(),
13757
13959
  _ts_param29(0, CurrentUser()),
13758
13960
  _ts_param29(1, common.Req()),
13759
- _ts_metadata49("design:type", Function),
13760
- _ts_metadata49("design:paramtypes", [
13961
+ _ts_metadata50("design:type", Function),
13962
+ _ts_metadata50("design:paramtypes", [
13761
13963
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13762
13964
  typeof Request === "undefined" ? Object : Request
13763
13965
  ]),
13764
- _ts_metadata49("design:returntype", Promise)
13966
+ _ts_metadata50("design:returntype", Promise)
13765
13967
  ], SessionController.prototype, "listSessions", null);
13766
- _ts_decorate50([
13968
+ _ts_decorate51([
13767
13969
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13768
13970
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
13769
13971
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13972
+ RequestEncoding("unchecked"),
13770
13973
  common.Post("revoke-all"),
13771
13974
  _ts_param29(0, CurrentUser()),
13772
13975
  _ts_param29(1, common.Req()),
13773
- _ts_metadata49("design:type", Function),
13774
- _ts_metadata49("design:paramtypes", [
13976
+ _ts_metadata50("design:type", Function),
13977
+ _ts_metadata50("design:paramtypes", [
13775
13978
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13776
13979
  typeof Request === "undefined" ? Object : Request
13777
13980
  ]),
13778
- _ts_metadata49("design:returntype", Promise)
13981
+ _ts_metadata50("design:returntype", Promise)
13779
13982
  ], SessionController.prototype, "revokeAllSessions", null);
13780
- _ts_decorate50([
13983
+ _ts_decorate51([
13781
13984
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
13782
13985
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
13783
13986
  common.HttpCode(common.HttpStatus.NO_CONTENT),
13784
13987
  common.Delete(":id"),
13785
13988
  _ts_param29(0, CurrentUser()),
13786
13989
  _ts_param29(1, common.Param("id")),
13787
- _ts_metadata49("design:type", Function),
13788
- _ts_metadata49("design:paramtypes", [
13990
+ _ts_metadata50("design:type", Function),
13991
+ _ts_metadata50("design:paramtypes", [
13789
13992
  typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
13790
13993
  String
13791
13994
  ]),
13792
- _ts_metadata49("design:returntype", Promise)
13995
+ _ts_metadata50("design:returntype", Promise)
13793
13996
  ], SessionController.prototype, "revokeSession", null);
13794
- SessionController = _ts_decorate50([
13997
+ SessionController = _ts_decorate51([
13795
13998
  common.UseInterceptors(NoStoreInterceptor),
13796
13999
  common.Controller("sessions"),
13797
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
14000
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
13798
14001
  common.UsePipes(createAuthValidationPipe()),
13799
14002
  _ts_param29(0, common.Inject(exports.SessionService)),
13800
14003
  _ts_param29(1, common.Inject(exports.TokenDeliveryService)),
13801
- _ts_metadata49("design:type", Function),
13802
- _ts_metadata49("design:paramtypes", [
14004
+ _ts_metadata50("design:type", Function),
14005
+ _ts_metadata50("design:paramtypes", [
13803
14006
  typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
13804
14007
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
13805
14008
  ])
13806
14009
  ], SessionController);
13807
14010
  var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
13808
14011
  var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => common.SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
13809
- function _ts_decorate51(decorators, target, key, desc) {
14012
+ function _ts_decorate52(decorators, target, key, desc) {
13810
14013
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13811
14014
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13812
14015
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13819,13 +14022,13 @@ function _ts_decorate51(decorators, target, key, desc) {
13819
14022
  }
13820
14023
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13821
14024
  }
13822
- __name(_ts_decorate51, "_ts_decorate");
13823
- function _ts_metadata50(metadataKey, metadataValue) {
14025
+ __name(_ts_decorate52, "_ts_decorate");
14026
+ function _ts_metadata51(metadataKey, metadataValue) {
13824
14027
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13825
14028
  return Reflect.metadata(metadataKey, metadataValue);
13826
14029
  }
13827
14030
  }
13828
- __name(_ts_metadata50, "_ts_metadata");
14031
+ __name(_ts_metadata51, "_ts_metadata");
13829
14032
  function _ts_param30(paramIndex, decorator) {
13830
14033
  return function(target, key) {
13831
14034
  decorator(target, key, paramIndex);
@@ -13892,12 +14095,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
13892
14095
  await this.flush();
13893
14096
  }
13894
14097
  };
13895
- ApiKeyLastUsedService = _ts_decorate51([
14098
+ ApiKeyLastUsedService = _ts_decorate52([
13896
14099
  common.Injectable(),
13897
14100
  _ts_param30(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
13898
14101
  _ts_param30(1, common.Inject(BYMAX_AUTH_OPTIONS)),
13899
- _ts_metadata50("design:type", Function),
13900
- _ts_metadata50("design:paramtypes", [
14102
+ _ts_metadata51("design:type", Function),
14103
+ _ts_metadata51("design:paramtypes", [
13901
14104
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
13902
14105
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
13903
14106
  ])
@@ -13946,7 +14149,7 @@ function digestsMatch(computed, stored) {
13946
14149
  __name(digestsMatch, "digestsMatch");
13947
14150
 
13948
14151
  // src/server/services/api-key-verifier.service.ts
13949
- function _ts_decorate52(decorators, target, key, desc) {
14152
+ function _ts_decorate53(decorators, target, key, desc) {
13950
14153
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13951
14154
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
13952
14155
  r = Reflect.decorate(decorators, target, key, desc);
@@ -13959,13 +14162,13 @@ function _ts_decorate52(decorators, target, key, desc) {
13959
14162
  }
13960
14163
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13961
14164
  }
13962
- __name(_ts_decorate52, "_ts_decorate");
13963
- function _ts_metadata51(metadataKey, metadataValue) {
14165
+ __name(_ts_decorate53, "_ts_decorate");
14166
+ function _ts_metadata52(metadataKey, metadataValue) {
13964
14167
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
13965
14168
  return Reflect.metadata(metadataKey, metadataValue);
13966
14169
  }
13967
14170
  }
13968
- __name(_ts_metadata51, "_ts_metadata");
14171
+ __name(_ts_metadata52, "_ts_metadata");
13969
14172
  function _ts_param31(paramIndex, decorator) {
13970
14173
  return function(target, key) {
13971
14174
  decorator(target, key, paramIndex);
@@ -14031,14 +14234,14 @@ var ApiKeyVerifierService = class {
14031
14234
  return null;
14032
14235
  }
14033
14236
  };
14034
- ApiKeyVerifierService = _ts_decorate52([
14237
+ ApiKeyVerifierService = _ts_decorate53([
14035
14238
  common.Injectable(),
14036
14239
  _ts_param31(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
14037
14240
  _ts_param31(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
14038
14241
  _ts_param31(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14039
14242
  _ts_param31(3, common.Inject(ApiKeyLastUsedService)),
14040
- _ts_metadata51("design:type", Function),
14041
- _ts_metadata51("design:paramtypes", [
14243
+ _ts_metadata52("design:type", Function),
14244
+ _ts_metadata52("design:paramtypes", [
14042
14245
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
14043
14246
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
14044
14247
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14047,7 +14250,7 @@ ApiKeyVerifierService = _ts_decorate52([
14047
14250
  ], ApiKeyVerifierService);
14048
14251
 
14049
14252
  // src/server/guards/api-key.guard.ts
14050
- function _ts_decorate53(decorators, target, key, desc) {
14253
+ function _ts_decorate54(decorators, target, key, desc) {
14051
14254
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14052
14255
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14053
14256
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14060,13 +14263,13 @@ function _ts_decorate53(decorators, target, key, desc) {
14060
14263
  }
14061
14264
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14062
14265
  }
14063
- __name(_ts_decorate53, "_ts_decorate");
14064
- function _ts_metadata52(metadataKey, metadataValue) {
14266
+ __name(_ts_decorate54, "_ts_decorate");
14267
+ function _ts_metadata53(metadataKey, metadataValue) {
14065
14268
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14066
14269
  return Reflect.metadata(metadataKey, metadataValue);
14067
14270
  }
14068
14271
  }
14069
- __name(_ts_metadata52, "_ts_metadata");
14272
+ __name(_ts_metadata53, "_ts_metadata");
14070
14273
  function _ts_param32(paramIndex, decorator) {
14071
14274
  return function(target, key) {
14072
14275
  decorator(target, key, paramIndex);
@@ -14212,15 +14415,15 @@ exports.ApiKeyGuard = class _ApiKeyGuard {
14212
14415
  };
14213
14416
  }
14214
14417
  };
14215
- exports.ApiKeyGuard = _ts_decorate53([
14418
+ exports.ApiKeyGuard = _ts_decorate54([
14216
14419
  common.Injectable(),
14217
14420
  _ts_param32(0, common.Inject(core.Reflector)),
14218
14421
  _ts_param32(1, common.Inject(ApiKeyVerifierService)),
14219
14422
  _ts_param32(2, common.Inject(BYMAX_AUTH_OPTIONS)),
14220
14423
  _ts_param32(3, common.Inject(BYMAX_AUTH_HOOKS)),
14221
14424
  _ts_param32(3, common.Optional()),
14222
- _ts_metadata52("design:type", Function),
14223
- _ts_metadata52("design:paramtypes", [
14425
+ _ts_metadata53("design:type", Function),
14426
+ _ts_metadata53("design:paramtypes", [
14224
14427
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14225
14428
  typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
14226
14429
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
@@ -14232,7 +14435,7 @@ function routePattern(request) {
14232
14435
  return typeof path === "string" ? path : "";
14233
14436
  }
14234
14437
  __name(routePattern, "routePattern");
14235
- function _ts_decorate54(decorators, target, key, desc) {
14438
+ function _ts_decorate55(decorators, target, key, desc) {
14236
14439
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14237
14440
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14238
14441
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14245,13 +14448,13 @@ function _ts_decorate54(decorators, target, key, desc) {
14245
14448
  }
14246
14449
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14247
14450
  }
14248
- __name(_ts_decorate54, "_ts_decorate");
14249
- function _ts_metadata53(metadataKey, metadataValue) {
14451
+ __name(_ts_decorate55, "_ts_decorate");
14452
+ function _ts_metadata54(metadataKey, metadataValue) {
14250
14453
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14251
14454
  return Reflect.metadata(metadataKey, metadataValue);
14252
14455
  }
14253
14456
  }
14254
- __name(_ts_metadata53, "_ts_metadata");
14457
+ __name(_ts_metadata54, "_ts_metadata");
14255
14458
  function _ts_param33(paramIndex, decorator) {
14256
14459
  return function(target, key) {
14257
14460
  decorator(target, key, paramIndex);
@@ -14284,11 +14487,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
14284
14487
  return true;
14285
14488
  }
14286
14489
  };
14287
- exports.MfaRequiredGuard = _ts_decorate54([
14490
+ exports.MfaRequiredGuard = _ts_decorate55([
14288
14491
  common.Injectable(),
14289
14492
  _ts_param33(0, common.Inject(core.Reflector)),
14290
- _ts_metadata53("design:type", Function),
14291
- _ts_metadata53("design:paramtypes", [
14493
+ _ts_metadata54("design:type", Function),
14494
+ _ts_metadata54("design:paramtypes", [
14292
14495
  typeof core.Reflector === "undefined" ? Object : core.Reflector
14293
14496
  ])
14294
14497
  ], exports.MfaRequiredGuard);
@@ -14296,7 +14499,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
14296
14499
  var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
14297
14500
 
14298
14501
  // src/server/guards/platform-roles.guard.ts
14299
- function _ts_decorate55(decorators, target, key, desc) {
14502
+ function _ts_decorate56(decorators, target, key, desc) {
14300
14503
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14301
14504
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14302
14505
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14309,13 +14512,13 @@ function _ts_decorate55(decorators, target, key, desc) {
14309
14512
  }
14310
14513
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14311
14514
  }
14312
- __name(_ts_decorate55, "_ts_decorate");
14313
- function _ts_metadata54(metadataKey, metadataValue) {
14515
+ __name(_ts_decorate56, "_ts_decorate");
14516
+ function _ts_metadata55(metadataKey, metadataValue) {
14314
14517
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14315
14518
  return Reflect.metadata(metadataKey, metadataValue);
14316
14519
  }
14317
14520
  }
14318
- __name(_ts_metadata54, "_ts_metadata");
14521
+ __name(_ts_metadata55, "_ts_metadata");
14319
14522
  function _ts_param34(paramIndex, decorator) {
14320
14523
  return function(target, key) {
14321
14524
  decorator(target, key, paramIndex);
@@ -14355,12 +14558,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
14355
14558
  return true;
14356
14559
  }
14357
14560
  };
14358
- exports.PlatformRolesGuard = _ts_decorate55([
14561
+ exports.PlatformRolesGuard = _ts_decorate56([
14359
14562
  common.Injectable(),
14360
14563
  _ts_param34(0, common.Inject(core.Reflector)),
14361
14564
  _ts_param34(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14362
- _ts_metadata54("design:type", Function),
14363
- _ts_metadata54("design:paramtypes", [
14565
+ _ts_metadata55("design:type", Function),
14566
+ _ts_metadata55("design:paramtypes", [
14364
14567
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14365
14568
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14366
14569
  ])
@@ -14369,7 +14572,7 @@ var ROLES_KEY = "roles";
14369
14572
  var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
14370
14573
 
14371
14574
  // src/server/guards/roles.guard.ts
14372
- function _ts_decorate56(decorators, target, key, desc) {
14575
+ function _ts_decorate57(decorators, target, key, desc) {
14373
14576
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14374
14577
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14375
14578
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14382,13 +14585,13 @@ function _ts_decorate56(decorators, target, key, desc) {
14382
14585
  }
14383
14586
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14384
14587
  }
14385
- __name(_ts_decorate56, "_ts_decorate");
14386
- function _ts_metadata55(metadataKey, metadataValue) {
14588
+ __name(_ts_decorate57, "_ts_decorate");
14589
+ function _ts_metadata56(metadataKey, metadataValue) {
14387
14590
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14388
14591
  return Reflect.metadata(metadataKey, metadataValue);
14389
14592
  }
14390
14593
  }
14391
- __name(_ts_metadata55, "_ts_metadata");
14594
+ __name(_ts_metadata56, "_ts_metadata");
14392
14595
  function _ts_param35(paramIndex, decorator) {
14393
14596
  return function(target, key) {
14394
14597
  decorator(target, key, paramIndex);
@@ -14424,17 +14627,17 @@ exports.RolesGuard = class RolesGuard {
14424
14627
  return true;
14425
14628
  }
14426
14629
  };
14427
- exports.RolesGuard = _ts_decorate56([
14630
+ exports.RolesGuard = _ts_decorate57([
14428
14631
  common.Injectable(),
14429
14632
  _ts_param35(0, common.Inject(core.Reflector)),
14430
14633
  _ts_param35(1, common.Inject(BYMAX_AUTH_OPTIONS)),
14431
- _ts_metadata55("design:type", Function),
14432
- _ts_metadata55("design:paramtypes", [
14634
+ _ts_metadata56("design:type", Function),
14635
+ _ts_metadata56("design:paramtypes", [
14433
14636
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
14434
14637
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14435
14638
  ])
14436
14639
  ], exports.RolesGuard);
14437
- function _ts_decorate57(decorators, target, key, desc) {
14640
+ function _ts_decorate58(decorators, target, key, desc) {
14438
14641
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14439
14642
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14440
14643
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14447,7 +14650,7 @@ function _ts_decorate57(decorators, target, key, desc) {
14447
14650
  }
14448
14651
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14449
14652
  }
14450
- __name(_ts_decorate57, "_ts_decorate");
14653
+ __name(_ts_decorate58, "_ts_decorate");
14451
14654
  exports.NoOpAuthHooks = class NoOpAuthHooks {
14452
14655
  static {
14453
14656
  __name(this, "NoOpAuthHooks");
@@ -14496,7 +14699,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
14496
14699
  };
14497
14700
  }
14498
14701
  };
14499
- exports.NoOpAuthHooks = _ts_decorate57([
14702
+ exports.NoOpAuthHooks = _ts_decorate58([
14500
14703
  common.Injectable()
14501
14704
  ], exports.NoOpAuthHooks);
14502
14705
 
@@ -14509,7 +14712,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
14509
14712
  var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
14510
14713
 
14511
14714
  // src/server/oauth/oauth.service.ts
14512
- function _ts_decorate58(decorators, target, key, desc) {
14715
+ function _ts_decorate59(decorators, target, key, desc) {
14513
14716
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14514
14717
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14515
14718
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14522,13 +14725,13 @@ function _ts_decorate58(decorators, target, key, desc) {
14522
14725
  }
14523
14726
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14524
14727
  }
14525
- __name(_ts_decorate58, "_ts_decorate");
14526
- function _ts_metadata56(metadataKey, metadataValue) {
14728
+ __name(_ts_decorate59, "_ts_decorate");
14729
+ function _ts_metadata57(metadataKey, metadataValue) {
14527
14730
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14528
14731
  return Reflect.metadata(metadataKey, metadataValue);
14529
14732
  }
14530
14733
  }
14531
- __name(_ts_metadata56, "_ts_metadata");
14734
+ __name(_ts_metadata57, "_ts_metadata");
14532
14735
  function _ts_param36(paramIndex, decorator) {
14533
14736
  return function(target, key) {
14534
14737
  decorator(target, key, paramIndex);
@@ -14828,7 +15031,7 @@ exports.OAuthService = class _OAuthService {
14828
15031
  return plugin;
14829
15032
  }
14830
15033
  };
14831
- exports.OAuthService = _ts_decorate58([
15034
+ exports.OAuthService = _ts_decorate59([
14832
15035
  common.Injectable(),
14833
15036
  _ts_param36(0, common.Inject(OAUTH_PLUGINS)),
14834
15037
  _ts_param36(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
@@ -14838,8 +15041,8 @@ exports.OAuthService = _ts_decorate58([
14838
15041
  _ts_param36(4, common.Inject(TokenManagerService)),
14839
15042
  _ts_param36(5, common.Inject(exports.SessionService)),
14840
15043
  _ts_param36(6, common.Inject(BYMAX_AUTH_OPTIONS)),
14841
- _ts_metadata56("design:type", Function),
14842
- _ts_metadata56("design:paramtypes", [
15044
+ _ts_metadata57("design:type", Function),
15045
+ _ts_metadata57("design:paramtypes", [
14843
15046
  Array,
14844
15047
  typeof IUserRepository === "undefined" ? Object : IUserRepository,
14845
15048
  Object,
@@ -14849,7 +15052,7 @@ exports.OAuthService = _ts_decorate58([
14849
15052
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
14850
15053
  ])
14851
15054
  ], exports.OAuthService);
14852
- function _ts_decorate59(decorators, target, key, desc) {
15055
+ function _ts_decorate60(decorators, target, key, desc) {
14853
15056
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14854
15057
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
14855
15058
  r = Reflect.decorate(decorators, target, key, desc);
@@ -14862,13 +15065,13 @@ function _ts_decorate59(decorators, target, key, desc) {
14862
15065
  }
14863
15066
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14864
15067
  }
14865
- __name(_ts_decorate59, "_ts_decorate");
14866
- function _ts_metadata57(metadataKey, metadataValue) {
15068
+ __name(_ts_decorate60, "_ts_decorate");
15069
+ function _ts_metadata58(metadataKey, metadataValue) {
14867
15070
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
14868
15071
  return Reflect.metadata(metadataKey, metadataValue);
14869
15072
  }
14870
15073
  }
14871
- __name(_ts_metadata57, "_ts_metadata");
15074
+ __name(_ts_metadata58, "_ts_metadata");
14872
15075
  var OAuthCallbackQueryDto = class {
14873
15076
  static {
14874
15077
  __name(this, "OAuthCallbackQueryDto");
@@ -14967,69 +15170,69 @@ var OAuthCallbackQueryDto = class {
14967
15170
  */
14968
15171
  hd;
14969
15172
  };
14970
- _ts_decorate59([
15173
+ _ts_decorate60([
14971
15174
  classValidator.ValidateIf((query) => query.error === void 0 || query.error === null),
14972
15175
  classValidator.IsOptional(),
14973
15176
  classValidator.IsString(),
14974
15177
  classValidator.IsNotEmpty(),
14975
15178
  classValidator.MaxLength(2048),
14976
- _ts_metadata57("design:type", String)
15179
+ _ts_metadata58("design:type", String)
14977
15180
  ], OAuthCallbackQueryDto.prototype, "code", void 0);
14978
- _ts_decorate59([
15181
+ _ts_decorate60([
14979
15182
  classValidator.IsOptional(),
14980
15183
  classValidator.IsString(),
14981
15184
  classValidator.MaxLength(128),
14982
- _ts_metadata57("design:type", String)
15185
+ _ts_metadata58("design:type", String)
14983
15186
  ], OAuthCallbackQueryDto.prototype, "error", void 0);
14984
- _ts_decorate59([
15187
+ _ts_decorate60([
14985
15188
  classValidator.IsOptional(),
14986
15189
  classValidator.IsString(),
14987
15190
  classValidator.MaxLength(512),
14988
- _ts_metadata57("design:type", String)
15191
+ _ts_metadata58("design:type", String)
14989
15192
  ], OAuthCallbackQueryDto.prototype, "error_description", void 0);
14990
- _ts_decorate59([
15193
+ _ts_decorate60([
14991
15194
  classValidator.IsOptional(),
14992
15195
  classValidator.IsString(),
14993
15196
  classValidator.MaxLength(512),
14994
- _ts_metadata57("design:type", String)
15197
+ _ts_metadata58("design:type", String)
14995
15198
  ], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
14996
- _ts_decorate59([
15199
+ _ts_decorate60([
14997
15200
  classValidator.IsString(),
14998
15201
  classValidator.IsNotEmpty(),
14999
15202
  classValidator.MaxLength(128),
15000
- _ts_metadata57("design:type", String)
15203
+ _ts_metadata58("design:type", String)
15001
15204
  ], OAuthCallbackQueryDto.prototype, "state", void 0);
15002
- _ts_decorate59([
15205
+ _ts_decorate60([
15003
15206
  classValidator.IsOptional(),
15004
15207
  classValidator.IsString(),
15005
15208
  classValidator.MaxLength(512),
15006
- _ts_metadata57("design:type", String)
15209
+ _ts_metadata58("design:type", String)
15007
15210
  ], OAuthCallbackQueryDto.prototype, "iss", void 0);
15008
- _ts_decorate59([
15211
+ _ts_decorate60([
15009
15212
  classValidator.IsOptional(),
15010
15213
  classValidator.IsString(),
15011
15214
  classValidator.MaxLength(2048),
15012
- _ts_metadata57("design:type", String)
15215
+ _ts_metadata58("design:type", String)
15013
15216
  ], OAuthCallbackQueryDto.prototype, "scope", void 0);
15014
- _ts_decorate59([
15217
+ _ts_decorate60([
15015
15218
  classValidator.IsOptional(),
15016
15219
  classValidator.IsString(),
15017
15220
  classValidator.MaxLength(16),
15018
- _ts_metadata57("design:type", String)
15221
+ _ts_metadata58("design:type", String)
15019
15222
  ], OAuthCallbackQueryDto.prototype, "authuser", void 0);
15020
- _ts_decorate59([
15223
+ _ts_decorate60([
15021
15224
  classValidator.IsOptional(),
15022
15225
  classValidator.IsString(),
15023
15226
  classValidator.MaxLength(64),
15024
- _ts_metadata57("design:type", String)
15227
+ _ts_metadata58("design:type", String)
15025
15228
  ], OAuthCallbackQueryDto.prototype, "prompt", void 0);
15026
- _ts_decorate59([
15229
+ _ts_decorate60([
15027
15230
  classValidator.IsOptional(),
15028
15231
  classValidator.IsString(),
15029
15232
  classValidator.MaxLength(253),
15030
- _ts_metadata57("design:type", String)
15233
+ _ts_metadata58("design:type", String)
15031
15234
  ], OAuthCallbackQueryDto.prototype, "hd", void 0);
15032
- function _ts_decorate60(decorators, target, key, desc) {
15235
+ function _ts_decorate61(decorators, target, key, desc) {
15033
15236
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15034
15237
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15035
15238
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15042,13 +15245,13 @@ function _ts_decorate60(decorators, target, key, desc) {
15042
15245
  }
15043
15246
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15044
15247
  }
15045
- __name(_ts_decorate60, "_ts_decorate");
15046
- function _ts_metadata58(metadataKey, metadataValue) {
15248
+ __name(_ts_decorate61, "_ts_decorate");
15249
+ function _ts_metadata59(metadataKey, metadataValue) {
15047
15250
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15048
15251
  return Reflect.metadata(metadataKey, metadataValue);
15049
15252
  }
15050
15253
  }
15051
- __name(_ts_metadata58, "_ts_metadata");
15254
+ __name(_ts_metadata59, "_ts_metadata");
15052
15255
  var OAuthInitiateQueryDto = class {
15053
15256
  static {
15054
15257
  __name(this, "OAuthInitiateQueryDto");
@@ -15065,7 +15268,7 @@ var OAuthInitiateQueryDto = class {
15065
15268
  */
15066
15269
  tenantId;
15067
15270
  };
15068
- _ts_decorate60([
15271
+ _ts_decorate61([
15069
15272
  classValidator.IsOptional(),
15070
15273
  classValidator.IsString(),
15071
15274
  classValidator.IsNotEmpty(),
@@ -15073,11 +15276,11 @@ _ts_decorate60([
15073
15276
  classValidator.Matches(NO_CONTROL_CHARACTERS, {
15074
15277
  message: "tenantId must not contain control characters"
15075
15278
  }),
15076
- _ts_metadata58("design:type", String)
15279
+ _ts_metadata59("design:type", String)
15077
15280
  ], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
15078
15281
 
15079
15282
  // src/server/oauth/oauth.controller.ts
15080
- function _ts_decorate61(decorators, target, key, desc) {
15283
+ function _ts_decorate62(decorators, target, key, desc) {
15081
15284
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15082
15285
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15083
15286
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15090,13 +15293,13 @@ function _ts_decorate61(decorators, target, key, desc) {
15090
15293
  }
15091
15294
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15092
15295
  }
15093
- __name(_ts_decorate61, "_ts_decorate");
15094
- function _ts_metadata59(metadataKey, metadataValue) {
15296
+ __name(_ts_decorate62, "_ts_decorate");
15297
+ function _ts_metadata60(metadataKey, metadataValue) {
15095
15298
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
15096
15299
  return Reflect.metadata(metadataKey, metadataValue);
15097
15300
  }
15098
15301
  }
15099
- __name(_ts_metadata59, "_ts_metadata");
15302
+ __name(_ts_metadata60, "_ts_metadata");
15100
15303
  function _ts_param37(paramIndex, decorator) {
15101
15304
  return function(target, key) {
15102
15305
  decorator(target, key, paramIndex);
@@ -15320,7 +15523,7 @@ var OAuthController = class _OAuthController {
15320
15523
  });
15321
15524
  }
15322
15525
  };
15323
- _ts_decorate61([
15526
+ _ts_decorate62([
15324
15527
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15325
15528
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
15326
15529
  common.Get(":provider"),
@@ -15330,16 +15533,16 @@ _ts_decorate61([
15330
15533
  _ts_param37(3, common.Res({
15331
15534
  passthrough: true
15332
15535
  })),
15333
- _ts_metadata59("design:type", Function),
15334
- _ts_metadata59("design:paramtypes", [
15536
+ _ts_metadata60("design:type", Function),
15537
+ _ts_metadata60("design:paramtypes", [
15335
15538
  String,
15336
15539
  typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
15337
15540
  typeof Request === "undefined" ? Object : Request,
15338
15541
  typeof Response === "undefined" ? Object : Response
15339
15542
  ]),
15340
- _ts_metadata59("design:returntype", Promise)
15543
+ _ts_metadata60("design:returntype", Promise)
15341
15544
  ], OAuthController.prototype, "initiate", null);
15342
- _ts_decorate61([
15545
+ _ts_decorate62([
15343
15546
  throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
15344
15547
  AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
15345
15548
  common.HttpCode(common.HttpStatus.OK),
@@ -15350,29 +15553,29 @@ _ts_decorate61([
15350
15553
  _ts_param37(3, common.Res({
15351
15554
  passthrough: true
15352
15555
  })),
15353
- _ts_metadata59("design:type", Function),
15354
- _ts_metadata59("design:paramtypes", [
15556
+ _ts_metadata60("design:type", Function),
15557
+ _ts_metadata60("design:paramtypes", [
15355
15558
  String,
15356
15559
  typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
15357
15560
  typeof Request === "undefined" ? Object : Request,
15358
15561
  typeof Response === "undefined" ? Object : Response
15359
15562
  ]),
15360
- _ts_metadata59("design:returntype", Promise)
15563
+ _ts_metadata60("design:returntype", Promise)
15361
15564
  ], OAuthController.prototype, "callback", null);
15362
- OAuthController = _ts_decorate61([
15565
+ OAuthController = _ts_decorate62([
15363
15566
  Public(),
15364
15567
  SkipMfa(),
15365
15568
  common.UseInterceptors(NoStoreInterceptor),
15366
15569
  common.Controller("oauth"),
15367
- common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
15570
+ common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
15368
15571
  common.UsePipes(createAuthValidationPipe({
15369
15572
  forbidUnknownValues: true
15370
15573
  })),
15371
15574
  _ts_param37(0, common.Inject(exports.OAuthService)),
15372
15575
  _ts_param37(1, common.Inject(exports.TokenDeliveryService)),
15373
15576
  _ts_param37(2, common.Inject(BYMAX_AUTH_OPTIONS)),
15374
- _ts_metadata59("design:type", Function),
15375
- _ts_metadata59("design:paramtypes", [
15577
+ _ts_metadata60("design:type", Function),
15578
+ _ts_metadata60("design:paramtypes", [
15376
15579
  typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
15377
15580
  typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
15378
15581
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -15511,7 +15714,7 @@ var GoogleOAuthPlugin = class {
15511
15714
  };
15512
15715
 
15513
15716
  // src/server/oauth/oauth.module.ts
15514
- function _ts_decorate62(decorators, target, key, desc) {
15717
+ function _ts_decorate63(decorators, target, key, desc) {
15515
15718
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15516
15719
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
15517
15720
  r = Reflect.decorate(decorators, target, key, desc);
@@ -15524,7 +15727,7 @@ function _ts_decorate62(decorators, target, key, desc) {
15524
15727
  }
15525
15728
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15526
15729
  }
15527
- __name(_ts_decorate62, "_ts_decorate");
15730
+ __name(_ts_decorate63, "_ts_decorate");
15528
15731
  function buildOAuthPlugins(options) {
15529
15732
  const plugins = [];
15530
15733
  if (options.oauth?.google) {
@@ -15594,7 +15797,7 @@ var OAuthModule = class _OAuthModule {
15594
15797
  };
15595
15798
  }
15596
15799
  };
15597
- OAuthModule = _ts_decorate62([
15800
+ OAuthModule = _ts_decorate63([
15598
15801
  common.Module({})
15599
15802
  ], OAuthModule);
15600
15803
 
@@ -16489,7 +16692,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
16489
16692
  __name(schemesFor, "schemesFor");
16490
16693
 
16491
16694
  // src/server/openapi/auth-openapi.contributor.ts
16492
- function _ts_decorate63(decorators, target, key, desc) {
16695
+ function _ts_decorate64(decorators, target, key, desc) {
16493
16696
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16494
16697
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16495
16698
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16502,13 +16705,13 @@ function _ts_decorate63(decorators, target, key, desc) {
16502
16705
  }
16503
16706
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16504
16707
  }
16505
- __name(_ts_decorate63, "_ts_decorate");
16506
- function _ts_metadata60(metadataKey, metadataValue) {
16708
+ __name(_ts_decorate64, "_ts_decorate");
16709
+ function _ts_metadata61(metadataKey, metadataValue) {
16507
16710
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16508
16711
  return Reflect.metadata(metadataKey, metadataValue);
16509
16712
  }
16510
16713
  }
16511
- __name(_ts_metadata60, "_ts_metadata");
16714
+ __name(_ts_metadata61, "_ts_metadata");
16512
16715
  function _ts_param38(paramIndex, decorator) {
16513
16716
  return function(target, key) {
16514
16717
  decorator(target, key, paramIndex);
@@ -16534,18 +16737,18 @@ var AuthOpenApiContributor = class {
16534
16737
  return buildAuthOpenApiFragment(this.options, this.registered);
16535
16738
  }
16536
16739
  };
16537
- AuthOpenApiContributor = _ts_decorate63([
16740
+ AuthOpenApiContributor = _ts_decorate64([
16538
16741
  common.Injectable(),
16539
16742
  common.SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
16540
16743
  _ts_param38(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16541
16744
  _ts_param38(1, common.Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
16542
- _ts_metadata60("design:type", Function),
16543
- _ts_metadata60("design:paramtypes", [
16745
+ _ts_metadata61("design:type", Function),
16746
+ _ts_metadata61("design:paramtypes", [
16544
16747
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
16545
16748
  typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
16546
16749
  ])
16547
16750
  ], AuthOpenApiContributor);
16548
- function _ts_decorate64(decorators, target, key, desc) {
16751
+ function _ts_decorate65(decorators, target, key, desc) {
16549
16752
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16550
16753
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16551
16754
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16558,13 +16761,13 @@ function _ts_decorate64(decorators, target, key, desc) {
16558
16761
  }
16559
16762
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16560
16763
  }
16561
- __name(_ts_decorate64, "_ts_decorate");
16562
- function _ts_metadata61(metadataKey, metadataValue) {
16764
+ __name(_ts_decorate65, "_ts_decorate");
16765
+ function _ts_metadata62(metadataKey, metadataValue) {
16563
16766
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16564
16767
  return Reflect.metadata(metadataKey, metadataValue);
16565
16768
  }
16566
16769
  }
16567
- __name(_ts_metadata61, "_ts_metadata");
16770
+ __name(_ts_metadata62, "_ts_metadata");
16568
16771
  function _ts_param39(paramIndex, decorator) {
16569
16772
  return function(target, key) {
16570
16773
  decorator(target, key, paramIndex);
@@ -16876,16 +17079,16 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
16876
17079
  return false;
16877
17080
  }
16878
17081
  };
16879
- exports.CommonPasswordChecker = _ts_decorate64([
17082
+ exports.CommonPasswordChecker = _ts_decorate65([
16880
17083
  common.Injectable(),
16881
17084
  _ts_param39(0, common.Inject(BYMAX_AUTH_OPTIONS)),
16882
17085
  _ts_param39(0, common.Optional()),
16883
- _ts_metadata61("design:type", Function),
16884
- _ts_metadata61("design:paramtypes", [
17086
+ _ts_metadata62("design:type", Function),
17087
+ _ts_metadata62("design:paramtypes", [
16885
17088
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
16886
17089
  ])
16887
17090
  ], exports.CommonPasswordChecker);
16888
- function _ts_decorate65(decorators, target, key, desc) {
17091
+ function _ts_decorate66(decorators, target, key, desc) {
16889
17092
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16890
17093
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16891
17094
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16898,7 +17101,7 @@ function _ts_decorate65(decorators, target, key, desc) {
16898
17101
  }
16899
17102
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16900
17103
  }
16901
- __name(_ts_decorate65, "_ts_decorate");
17104
+ __name(_ts_decorate66, "_ts_decorate");
16902
17105
  exports.NoOpEmailProvider = class _NoOpEmailProvider {
16903
17106
  static {
16904
17107
  __name(this, "NoOpEmailProvider");
@@ -16933,7 +17136,7 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
16933
17136
  this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
16934
17137
  }
16935
17138
  };
16936
- exports.NoOpEmailProvider = _ts_decorate65([
17139
+ exports.NoOpEmailProvider = _ts_decorate66([
16937
17140
  common.Injectable()
16938
17141
  ], exports.NoOpEmailProvider);
16939
17142
 
@@ -16947,7 +17150,7 @@ var SystemApiKeyClock = class {
16947
17150
  return /* @__PURE__ */ new Date();
16948
17151
  }
16949
17152
  };
16950
- function _ts_decorate66(decorators, target, key, desc) {
17153
+ function _ts_decorate67(decorators, target, key, desc) {
16951
17154
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16952
17155
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
16953
17156
  r = Reflect.decorate(decorators, target, key, desc);
@@ -16960,13 +17163,13 @@ function _ts_decorate66(decorators, target, key, desc) {
16960
17163
  }
16961
17164
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16962
17165
  }
16963
- __name(_ts_decorate66, "_ts_decorate");
16964
- function _ts_metadata62(metadataKey, metadataValue) {
17166
+ __name(_ts_decorate67, "_ts_decorate");
17167
+ function _ts_metadata63(metadataKey, metadataValue) {
16965
17168
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
16966
17169
  return Reflect.metadata(metadataKey, metadataValue);
16967
17170
  }
16968
17171
  }
16969
- __name(_ts_metadata62, "_ts_metadata");
17172
+ __name(_ts_metadata63, "_ts_metadata");
16970
17173
  function _ts_param40(paramIndex, decorator) {
16971
17174
  return function(target, key) {
16972
17175
  decorator(target, key, paramIndex);
@@ -17015,21 +17218,21 @@ var ApiKeyScopeAuditService = class {
17015
17218
  }
17016
17219
  }
17017
17220
  };
17018
- ApiKeyScopeAuditService = _ts_decorate66([
17221
+ ApiKeyScopeAuditService = _ts_decorate67([
17019
17222
  common.Injectable(),
17020
17223
  _ts_param40(0, common.Inject(core.DiscoveryService)),
17021
17224
  _ts_param40(1, common.Inject(core.MetadataScanner)),
17022
17225
  _ts_param40(2, common.Inject(core.Reflector)),
17023
17226
  _ts_param40(3, common.Inject(BYMAX_AUTH_OPTIONS)),
17024
- _ts_metadata62("design:type", Function),
17025
- _ts_metadata62("design:paramtypes", [
17227
+ _ts_metadata63("design:type", Function),
17228
+ _ts_metadata63("design:paramtypes", [
17026
17229
  typeof core.DiscoveryService === "undefined" ? Object : core.DiscoveryService,
17027
17230
  typeof core.MetadataScanner === "undefined" ? Object : core.MetadataScanner,
17028
17231
  typeof core.Reflector === "undefined" ? Object : core.Reflector,
17029
17232
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
17030
17233
  ])
17031
17234
  ], ApiKeyScopeAuditService);
17032
- function _ts_decorate67(decorators, target, key, desc) {
17235
+ function _ts_decorate68(decorators, target, key, desc) {
17033
17236
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17034
17237
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17035
17238
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17042,13 +17245,13 @@ function _ts_decorate67(decorators, target, key, desc) {
17042
17245
  }
17043
17246
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17044
17247
  }
17045
- __name(_ts_decorate67, "_ts_decorate");
17046
- function _ts_metadata63(metadataKey, metadataValue) {
17248
+ __name(_ts_decorate68, "_ts_decorate");
17249
+ function _ts_metadata64(metadataKey, metadataValue) {
17047
17250
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17048
17251
  return Reflect.metadata(metadataKey, metadataValue);
17049
17252
  }
17050
17253
  }
17051
- __name(_ts_metadata63, "_ts_metadata");
17254
+ __name(_ts_metadata64, "_ts_metadata");
17052
17255
  function _ts_param41(paramIndex, decorator) {
17053
17256
  return function(target, key) {
17054
17257
  decorator(target, key, paramIndex);
@@ -17183,13 +17386,13 @@ exports.ApiKeyService = class ApiKeyService {
17183
17386
  return value;
17184
17387
  }
17185
17388
  };
17186
- exports.ApiKeyService = _ts_decorate67([
17389
+ exports.ApiKeyService = _ts_decorate68([
17187
17390
  common.Injectable(),
17188
17391
  _ts_param41(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
17189
17392
  _ts_param41(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
17190
17393
  _ts_param41(2, common.Inject(BYMAX_AUTH_OPTIONS)),
17191
- _ts_metadata63("design:type", Function),
17192
- _ts_metadata63("design:paramtypes", [
17394
+ _ts_metadata64("design:type", Function),
17395
+ _ts_metadata64("design:paramtypes", [
17193
17396
  typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
17194
17397
  typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
17195
17398
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
@@ -17271,7 +17474,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
17271
17474
  __name(assertTenantBinding, "assertTenantBinding");
17272
17475
 
17273
17476
  // src/server/services/auth-token-verifier.service.ts
17274
- function _ts_decorate68(decorators, target, key, desc) {
17477
+ function _ts_decorate69(decorators, target, key, desc) {
17275
17478
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17276
17479
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17277
17480
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17284,13 +17487,13 @@ function _ts_decorate68(decorators, target, key, desc) {
17284
17487
  }
17285
17488
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17286
17489
  }
17287
- __name(_ts_decorate68, "_ts_decorate");
17288
- function _ts_metadata64(metadataKey, metadataValue) {
17490
+ __name(_ts_decorate69, "_ts_decorate");
17491
+ function _ts_metadata65(metadataKey, metadataValue) {
17289
17492
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
17290
17493
  return Reflect.metadata(metadataKey, metadataValue);
17291
17494
  }
17292
17495
  }
17293
- __name(_ts_metadata64, "_ts_metadata");
17496
+ __name(_ts_metadata65, "_ts_metadata");
17294
17497
  function _ts_param42(paramIndex, decorator) {
17295
17498
  return function(target, key) {
17296
17499
  decorator(target, key, paramIndex);
@@ -17480,14 +17683,14 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
17480
17683
  }
17481
17684
  }
17482
17685
  };
17483
- exports.AuthTokenVerifierService = _ts_decorate68([
17686
+ exports.AuthTokenVerifierService = _ts_decorate69([
17484
17687
  common.Injectable(),
17485
17688
  _ts_param42(0, common.Inject(jwt.JwtService)),
17486
17689
  _ts_param42(1, common.Inject(BYMAX_AUTH_OPTIONS)),
17487
17690
  _ts_param42(2, common.Inject(exports.AuthRevocationService)),
17488
17691
  _ts_param42(3, common.Inject(exports.AccountStatusService)),
17489
- _ts_metadata64("design:type", Function),
17490
- _ts_metadata64("design:paramtypes", [
17692
+ _ts_metadata65("design:type", Function),
17693
+ _ts_metadata65("design:paramtypes", [
17491
17694
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
17492
17695
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
17493
17696
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
@@ -17496,7 +17699,7 @@ exports.AuthTokenVerifierService = _ts_decorate68([
17496
17699
  ], exports.AuthTokenVerifierService);
17497
17700
 
17498
17701
  // src/server/bymax-auth.module.ts
17499
- function _ts_decorate69(decorators, target, key, desc) {
17702
+ function _ts_decorate70(decorators, target, key, desc) {
17500
17703
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17501
17704
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
17502
17705
  r = Reflect.decorate(decorators, target, key, desc);
@@ -17509,7 +17712,7 @@ function _ts_decorate69(decorators, target, key, desc) {
17509
17712
  }
17510
17713
  return c > 3 && r && Object.defineProperty(target, key, r), r;
17511
17714
  }
17512
- __name(_ts_decorate69, "_ts_decorate");
17715
+ __name(_ts_decorate70, "_ts_decorate");
17513
17716
  function hasProviderToken(providers, token) {
17514
17717
  return providers.some((p) => {
17515
17718
  if (typeof p === "function") return false;
@@ -17769,6 +17972,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17769
17972
  exports.AuthService,
17770
17973
  // Guards — registered as providers so they can be applied via @UseGuards().
17771
17974
  exports.JwtAuthGuard,
17975
+ exports.RequestEncodingGuard,
17772
17976
  exports.TrustedOriginGuard,
17773
17977
  exports.AuthRateLimitGuard,
17774
17978
  // Response-header interceptor — every library controller applies it, so it must be
@@ -17801,6 +18005,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17801
18005
  exports.AuthService,
17802
18006
  // Export guards so host-app modules can apply them without reimporting.
17803
18007
  exports.JwtAuthGuard,
18008
+ exports.RequestEncodingGuard,
17804
18009
  exports.TrustedOriginGuard,
17805
18010
  exports.AuthRateLimitGuard,
17806
18011
  exports.RolesGuard,
@@ -17899,7 +18104,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
17899
18104
  };
17900
18105
  }
17901
18106
  };
17902
- exports.BymaxAuthModule = _ts_decorate69([
18107
+ exports.BymaxAuthModule = _ts_decorate70([
17903
18108
  common.Module({})
17904
18109
  ], exports.BymaxAuthModule);
17905
18110
 
@@ -18227,7 +18432,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
18227
18432
  }
18228
18433
  }
18229
18434
  };
18230
- function _ts_decorate70(decorators, target, key, desc) {
18435
+ function _ts_decorate71(decorators, target, key, desc) {
18231
18436
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18232
18437
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18233
18438
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18240,13 +18445,13 @@ function _ts_decorate70(decorators, target, key, desc) {
18240
18445
  }
18241
18446
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18242
18447
  }
18243
- __name(_ts_decorate70, "_ts_decorate");
18244
- function _ts_metadata65(metadataKey, metadataValue) {
18448
+ __name(_ts_decorate71, "_ts_decorate");
18449
+ function _ts_metadata66(metadataKey, metadataValue) {
18245
18450
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18246
18451
  return Reflect.metadata(metadataKey, metadataValue);
18247
18452
  }
18248
18453
  }
18249
- __name(_ts_metadata65, "_ts_metadata");
18454
+ __name(_ts_metadata66, "_ts_metadata");
18250
18455
  var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
18251
18456
  var PREFIX_LENGTH = 5;
18252
18457
  var DEFAULT_TIMEOUT_MS = 1500;
@@ -18303,10 +18508,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
18303
18508
  }
18304
18509
  }
18305
18510
  };
18306
- exports.HibpBreachChecker = _ts_decorate70([
18511
+ exports.HibpBreachChecker = _ts_decorate71([
18307
18512
  common.Injectable(),
18308
- _ts_metadata65("design:type", Function),
18309
- _ts_metadata65("design:paramtypes", [
18513
+ _ts_metadata66("design:type", Function),
18514
+ _ts_metadata66("design:paramtypes", [
18310
18515
  Number
18311
18516
  ])
18312
18517
  ], exports.HibpBreachChecker);
@@ -18319,10 +18524,10 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
18319
18524
  return false;
18320
18525
  }
18321
18526
  };
18322
- exports.AllowAllBreachChecker = _ts_decorate70([
18527
+ exports.AllowAllBreachChecker = _ts_decorate71([
18323
18528
  common.Injectable()
18324
18529
  ], exports.AllowAllBreachChecker);
18325
- function _ts_decorate71(decorators, target, key, desc) {
18530
+ function _ts_decorate72(decorators, target, key, desc) {
18326
18531
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18327
18532
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18328
18533
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18335,7 +18540,7 @@ function _ts_decorate71(decorators, target, key, desc) {
18335
18540
  }
18336
18541
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18337
18542
  }
18338
- __name(_ts_decorate71, "_ts_decorate");
18543
+ __name(_ts_decorate72, "_ts_decorate");
18339
18544
  exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
18340
18545
  static {
18341
18546
  __name(this, "OptionalAuthGuard");
@@ -18350,10 +18555,10 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
18350
18555
  return super.canActivate(context);
18351
18556
  }
18352
18557
  };
18353
- exports.OptionalAuthGuard = _ts_decorate71([
18558
+ exports.OptionalAuthGuard = _ts_decorate72([
18354
18559
  common.Injectable()
18355
18560
  ], exports.OptionalAuthGuard);
18356
- function _ts_decorate72(decorators, target, key, desc) {
18561
+ function _ts_decorate73(decorators, target, key, desc) {
18357
18562
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18358
18563
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18359
18564
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18366,13 +18571,13 @@ function _ts_decorate72(decorators, target, key, desc) {
18366
18571
  }
18367
18572
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18368
18573
  }
18369
- __name(_ts_decorate72, "_ts_decorate");
18370
- function _ts_metadata66(metadataKey, metadataValue) {
18574
+ __name(_ts_decorate73, "_ts_decorate");
18575
+ function _ts_metadata67(metadataKey, metadataValue) {
18371
18576
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18372
18577
  return Reflect.metadata(metadataKey, metadataValue);
18373
18578
  }
18374
18579
  }
18375
- __name(_ts_metadata66, "_ts_metadata");
18580
+ __name(_ts_metadata67, "_ts_metadata");
18376
18581
  function _ts_param43(paramIndex, decorator) {
18377
18582
  return function(target, key) {
18378
18583
  decorator(target, key, paramIndex);
@@ -18408,11 +18613,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
18408
18613
  throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
18409
18614
  }
18410
18615
  };
18411
- exports.SelfOrAdminGuard = _ts_decorate72([
18616
+ exports.SelfOrAdminGuard = _ts_decorate73([
18412
18617
  common.Injectable(),
18413
18618
  _ts_param43(0, common.Inject(BYMAX_AUTH_OPTIONS)),
18414
- _ts_metadata66("design:type", Function),
18415
- _ts_metadata66("design:paramtypes", [
18619
+ _ts_metadata67("design:type", Function),
18620
+ _ts_metadata67("design:paramtypes", [
18416
18621
  typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
18417
18622
  ])
18418
18623
  ], exports.SelfOrAdminGuard);
@@ -18425,7 +18630,7 @@ function isHexLooking(value) {
18425
18630
  return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
18426
18631
  }
18427
18632
  __name(isHexLooking, "isHexLooking");
18428
- function _ts_decorate73(decorators, target, key, desc) {
18633
+ function _ts_decorate74(decorators, target, key, desc) {
18429
18634
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18430
18635
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18431
18636
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18438,13 +18643,13 @@ function _ts_decorate73(decorators, target, key, desc) {
18438
18643
  }
18439
18644
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18440
18645
  }
18441
- __name(_ts_decorate73, "_ts_decorate");
18442
- function _ts_metadata67(metadataKey, metadataValue) {
18646
+ __name(_ts_decorate74, "_ts_decorate");
18647
+ function _ts_metadata68(metadataKey, metadataValue) {
18443
18648
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
18444
18649
  return Reflect.metadata(metadataKey, metadataValue);
18445
18650
  }
18446
18651
  }
18447
- __name(_ts_metadata67, "_ts_metadata");
18652
+ __name(_ts_metadata68, "_ts_metadata");
18448
18653
  function _ts_param44(paramIndex, decorator) {
18449
18654
  return function(target, key) {
18450
18655
  decorator(target, key, paramIndex);
@@ -18514,14 +18719,14 @@ exports.WsJwtGuard = class WsJwtGuard {
18514
18719
  return true;
18515
18720
  }
18516
18721
  };
18517
- exports.WsJwtGuard = _ts_decorate73([
18722
+ exports.WsJwtGuard = _ts_decorate74([
18518
18723
  common.Injectable(),
18519
18724
  _ts_param44(0, common.Inject(jwt.JwtService)),
18520
18725
  _ts_param44(1, common.Inject(exports.AuthRevocationService)),
18521
18726
  _ts_param44(2, common.Inject(exports.WsTicketService)),
18522
18727
  _ts_param44(3, common.Inject(BYMAX_AUTH_OPTIONS)),
18523
- _ts_metadata67("design:type", Function),
18524
- _ts_metadata67("design:paramtypes", [
18728
+ _ts_metadata68("design:type", Function),
18729
+ _ts_metadata68("design:paramtypes", [
18525
18730
  typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
18526
18731
  typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
18527
18732
  typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
@@ -18561,7 +18766,7 @@ function bindingInput(handshake) {
18561
18766
  };
18562
18767
  }
18563
18768
  __name(bindingInput, "bindingInput");
18564
- function _ts_decorate74(decorators, target, key, desc) {
18769
+ function _ts_decorate75(decorators, target, key, desc) {
18565
18770
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18566
18771
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18567
18772
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18574,7 +18779,7 @@ function _ts_decorate74(decorators, target, key, desc) {
18574
18779
  }
18575
18780
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18576
18781
  }
18577
- __name(_ts_decorate74, "_ts_decorate");
18782
+ __name(_ts_decorate75, "_ts_decorate");
18578
18783
  function isAuthEnvelope(body) {
18579
18784
  if (typeof body !== "object" || body === null) return false;
18580
18785
  const error = body.error;
@@ -18600,6 +18805,12 @@ function bodyParserStatus(exception) {
18600
18805
  return typeof status === "number" && status >= 400 && status < 500 ? status : void 0;
18601
18806
  }
18602
18807
  __name(bodyParserStatus, "bodyParserStatus");
18808
+ function isUntypedParserRefusal(exception) {
18809
+ if (!(exception instanceof Error)) return false;
18810
+ const { status, statusCode, expose, type } = exception;
18811
+ return status === common.HttpStatus.BAD_REQUEST && statusCode === common.HttpStatus.BAD_REQUEST && expose === true && type === void 0;
18812
+ }
18813
+ __name(isUntypedParserRefusal, "isUntypedParserRefusal");
18603
18814
  function bodyParserMessage(status) {
18604
18815
  if (status === common.HttpStatus.PAYLOAD_TOO_LARGE) return "Request entity too large";
18605
18816
  if (status === common.HttpStatus.UNSUPPORTED_MEDIA_TYPE) return "Unsupported media type";
@@ -18665,6 +18876,16 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18665
18876
  });
18666
18877
  return;
18667
18878
  }
18879
+ if (isUntypedParserRefusal(exception) && http.getRequest().route === void 0) {
18880
+ res.status(common.HttpStatus.BAD_REQUEST).json({
18881
+ error: {
18882
+ code: AUTH_ERROR_CODES.VALIDATION,
18883
+ message: MALFORMED_REQUEST_MESSAGE,
18884
+ details: null
18885
+ }
18886
+ });
18887
+ return;
18888
+ }
18668
18889
  this.logger.error(`unhandled exception: ${describeChannelStatus(exception)}`);
18669
18890
  res.status(common.HttpStatus.INTERNAL_SERVER_ERROR).json({
18670
18891
  error: {
@@ -18677,10 +18898,10 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
18677
18898
  });
18678
18899
  }
18679
18900
  };
18680
- exports.AuthExceptionFilter = _ts_decorate74([
18901
+ exports.AuthExceptionFilter = _ts_decorate75([
18681
18902
  common.Catch()
18682
18903
  ], exports.AuthExceptionFilter);
18683
- function _ts_decorate75(decorators, target, key, desc) {
18904
+ function _ts_decorate76(decorators, target, key, desc) {
18684
18905
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18685
18906
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
18686
18907
  r = Reflect.decorate(decorators, target, key, desc);
@@ -18693,7 +18914,7 @@ function _ts_decorate75(decorators, target, key, desc) {
18693
18914
  }
18694
18915
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18695
18916
  }
18696
- __name(_ts_decorate75, "_ts_decorate");
18917
+ __name(_ts_decorate76, "_ts_decorate");
18697
18918
  function isEmittingClient(client) {
18698
18919
  return typeof client?.emit === "function";
18699
18920
  }
@@ -18737,7 +18958,7 @@ exports.WsAuthExceptionFilter = class _WsAuthExceptionFilter {
18737
18958
  this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
18738
18959
  }
18739
18960
  };
18740
- exports.WsAuthExceptionFilter = _ts_decorate75([
18961
+ exports.WsAuthExceptionFilter = _ts_decorate76([
18741
18962
  common.Catch(AuthException)
18742
18963
  ], exports.WsAuthExceptionFilter);
18743
18964
  var ServiceKey = /* @__PURE__ */ __name((...scopes) => common.applyDecorators(common.SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), common.UseGuards(exports.ApiKeyGuard)), "ServiceKey");
@@ -18783,6 +19004,7 @@ exports.PlatformRoles = PlatformRoles;
18783
19004
  exports.Public = Public;
18784
19005
  exports.ROLES_KEY = ROLES_KEY;
18785
19006
  exports.RegisterDto = RegisterDto;
19007
+ exports.RequestEncoding = RequestEncoding;
18786
19008
  exports.ResendOtpDto = ResendOtpDto;
18787
19009
  exports.ResendVerificationDto = ResendVerificationDto;
18788
19010
  exports.ResetPasswordDto = ResetPasswordDto;