@textrp/briij-js-sdk 43.0.0 → 43.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +7 -4
  2. package/lib/@types/auth.d.ts +7 -5
  3. package/lib/@types/auth.d.ts.map +1 -1
  4. package/lib/@types/auth.js.map +1 -1
  5. package/lib/@types/event.d.ts +3 -32
  6. package/lib/@types/event.d.ts.map +1 -1
  7. package/lib/@types/event.js.map +1 -1
  8. package/lib/@types/synapse.d.ts +64 -0
  9. package/lib/@types/synapse.d.ts.map +1 -1
  10. package/lib/@types/synapse.js.map +1 -1
  11. package/lib/briij.d.ts +1 -0
  12. package/lib/briij.d.ts.map +1 -1
  13. package/lib/briij.js +1 -0
  14. package/lib/briij.js.map +1 -1
  15. package/lib/client.d.ts +72 -1
  16. package/lib/client.d.ts.map +1 -1
  17. package/lib/client.js +369 -196
  18. package/lib/client.js.map +1 -1
  19. package/lib/wallet-recovery.d.ts +1 -1
  20. package/lib/wallet-recovery.d.ts.map +1 -1
  21. package/lib/wallet-recovery.js +32 -8
  22. package/lib/wallet-recovery.js.map +1 -1
  23. package/lib/xrpl/identity.d.ts +2 -1
  24. package/lib/xrpl/identity.d.ts.map +1 -1
  25. package/lib/xrpl/identity.js +70 -47
  26. package/lib/xrpl/identity.js.map +1 -1
  27. package/lib/xrpl/trust.d.ts +4 -2
  28. package/lib/xrpl/trust.d.ts.map +1 -1
  29. package/lib/xrpl/trust.js +31 -19
  30. package/lib/xrpl/trust.js.map +1 -1
  31. package/lib/xrpl/verification.js +17 -6
  32. package/lib/xrpl/verification.js.map +1 -1
  33. package/package.json +127 -129
  34. package/src/@types/auth.ts +6 -7
  35. package/src/@types/event.ts +3 -32
  36. package/src/@types/synapse.ts +77 -0
  37. package/src/briij.ts +1 -0
  38. package/src/client.ts +261 -36
  39. package/src/wallet-recovery.ts +101 -26
  40. package/src/xrpl/identity.ts +66 -39
  41. package/src/xrpl/trust.ts +35 -18
  42. package/src/xrpl/verification.ts +19 -6
package/lib/client.js CHANGED
@@ -76,9 +76,8 @@ import { KnownMembership } from "./@types/membership.js";
76
76
  import { ServerCapabilities } from "./serverCapabilities.js";
77
77
  import { sha256 } from "./digest.js";
78
78
  import { discoverAndValidateOIDCIssuerWellKnown, validateAuthMetadataAndKeys } from "./oidc/index.js";
79
- import { configureXrplIdentityMinting, mintSoulboundIdentityNFT } from "./xrpl/identity.js";
79
+ import { getConfiguredXrplIdentityMintingConfig, mintSoulboundIdentityNFT } from "./xrpl/identity.js";
80
80
  import { XRPL_VERIFIED_EVENT, XRPL_VERIFY_ACCEPT_EVENT, XRPL_VERIFY_REQUEST_EVENT } from "./xrpl/verification.js";
81
- import { configureXrplTrust } from "./xrpl/trust.js";
82
81
  import { UnsupportedDelayedEventsEndpointError, UnsupportedStickyEventsEndpointError } from "./errors.js";
83
82
  var SCROLLBACK_DELAY_MS = 3000;
84
83
  var TURN_CHECK_INTERVAL = 10 * 60 * 1000; // poll for turn credentials every 10 minutes
@@ -327,7 +326,7 @@ var SSO_ACTION_PARAM = new UnstableValue("action", "org.matrix.msc3824.action");
327
326
  */
328
327
  export class BriijClient extends TypedEventEmitter {
329
328
  constructor(opts) {
330
- var _opts$logger, _opts$usingExternalCr, _this, _opts$disableVoip, _opts$enableEncrypted, _opts$cryptoCallbacks;
329
+ var _opts$logger, _opts$usingExternalCr, _opts$xrplIdentityMin, _this, _opts$disableVoip, _opts$enableEncrypted, _opts$cryptoCallbacks;
331
330
  // If a custom logger is provided, use it. Otherwise, default to the global
332
331
  // one in logger.ts.
333
332
  super();
@@ -387,6 +386,7 @@ export class BriijClient extends TypedEventEmitter {
387
386
  // XXX: Intended private, used in code.
388
387
  _defineProperty(this, "idBaseUrl", void 0);
389
388
  _defineProperty(this, "baseUrl", void 0);
389
+ _defineProperty(this, "legacyApiBaseUrl", void 0);
390
390
  _defineProperty(this, "isVoipWithNoMediaAllowed", void 0);
391
391
  _defineProperty(this, "disableVoip", void 0);
392
392
  _defineProperty(this, "useLivekitForGroupCalls", void 0);
@@ -412,6 +412,8 @@ export class BriijClient extends TypedEventEmitter {
412
412
  _defineProperty(this, "clientOpts", void 0);
413
413
  _defineProperty(this, "clientWellKnownIntervalID", void 0);
414
414
  _defineProperty(this, "canResetTimelineCallback", void 0);
415
+ _defineProperty(this, "xrplTrustConfig", void 0);
416
+ _defineProperty(this, "xrplIdentityMintingConfig", {});
415
417
  _defineProperty(this, "canSupport", new Map());
416
418
  // The pushprocessor caches useful things, so keep one and re-use it
417
419
  _defineProperty(this, "pushProcessor", new PushProcessor(this));
@@ -495,6 +497,7 @@ export class BriijClient extends TypedEventEmitter {
495
497
  opts.baseUrl = utils.ensureNoTrailingSlash(opts.baseUrl);
496
498
  opts.idBaseUrl = utils.ensureNoTrailingSlash(opts.idBaseUrl);
497
499
  this.baseUrl = opts.baseUrl;
500
+ this.legacyApiBaseUrl = utils.ensureNoTrailingSlash(opts.legacyApiBaseUrl);
498
501
  this.idBaseUrl = opts.idBaseUrl;
499
502
  this.identityServer = opts.identityServer;
500
503
  this.usingExternalCrypto = (_opts$usingExternalCr = opts.usingExternalCrypto) !== null && _opts$usingExternalCr !== void 0 ? _opts$usingExternalCr : false;
@@ -505,6 +508,17 @@ export class BriijClient extends TypedEventEmitter {
505
508
  this.credentials = {
506
509
  userId
507
510
  };
511
+ if (opts.xrplTrust) {
512
+ var _opts$xrplTrust$homes, _ref, _opts$xrplTrust$acces;
513
+ this.xrplTrustConfig = {
514
+ homeserverBaseUrl: (_opts$xrplTrust$homes = opts.xrplTrust.homeserverBaseUrl) !== null && _opts$xrplTrust$homes !== void 0 ? _opts$xrplTrust$homes : this.baseUrl,
515
+ accessToken: (_ref = (_opts$xrplTrust$acces = opts.xrplTrust.accessToken) !== null && _opts$xrplTrust$acces !== void 0 ? _opts$xrplTrust$acces : opts.accessToken) !== null && _ref !== void 0 ? _ref : "",
516
+ trustPath: opts.xrplTrust.trustPath
517
+ };
518
+ }
519
+ this.xrplIdentityMintingConfig = _objectSpread(_objectSpread({}, (_opts$xrplIdentityMin = opts.xrplIdentityMinting) !== null && _opts$xrplIdentityMin !== void 0 ? _opts$xrplIdentityMin : {}), opts.xamanWallet ? {
520
+ xamanWallet: opts.xamanWallet
521
+ } : {});
508
522
  this.http = new BriijHttpApi(this, {
509
523
  fetchFn: opts.fetchFn,
510
524
  baseUrl: opts.baseUrl,
@@ -526,7 +540,7 @@ export class BriijClient extends TypedEventEmitter {
526
540
  this.scheduler = opts.scheduler;
527
541
  if (this.scheduler) {
528
542
  this.scheduler.setProcessFunction(/*#__PURE__*/function () {
529
- var _ref = _asyncToGenerator(function* (eventToSend) {
543
+ var _ref2 = _asyncToGenerator(function* (eventToSend) {
530
544
  var room = _this.getRoom(eventToSend.getRoomId());
531
545
  if (eventToSend.status !== EventStatus.SENDING) {
532
546
  _this.updatePendingEventStatus(room, eventToSend, EventStatus.SENDING);
@@ -540,7 +554,7 @@ export class BriijClient extends TypedEventEmitter {
540
554
  return res;
541
555
  });
542
556
  return function (_x) {
543
- return _ref.apply(this, arguments);
557
+ return _ref2.apply(this, arguments);
544
558
  };
545
559
  }());
546
560
  }
@@ -733,7 +747,7 @@ export class BriijClient extends TypedEventEmitter {
733
747
 
734
748
  // delete the stores used by the rust matrix-sdk-crypto, in case they were used
735
749
  var deleteRustSdkStore = /*#__PURE__*/function () {
736
- var _ref2 = _asyncToGenerator(function* () {
750
+ var _ref3 = _asyncToGenerator(function* () {
737
751
  var indexedDB;
738
752
  try {
739
753
  indexedDB = globalThis.indexedDB;
@@ -771,7 +785,7 @@ export class BriijClient extends TypedEventEmitter {
771
785
  }
772
786
  });
773
787
  return function deleteRustSdkStore() {
774
- return _ref2.apply(this, arguments);
788
+ return _ref3.apply(this, arguments);
775
789
  };
776
790
  }();
777
791
  promises.push(deleteRustSdkStore());
@@ -1866,7 +1880,7 @@ export class BriijClient extends TypedEventEmitter {
1866
1880
  * @returns Rejects: with an error response.
1867
1881
  */
1868
1882
 
1869
- sendCompleteEvent(_ref3) {
1883
+ sendCompleteEvent(_ref4) {
1870
1884
  var {
1871
1885
  roomId,
1872
1886
  threadId,
@@ -1874,7 +1888,7 @@ export class BriijClient extends TypedEventEmitter {
1874
1888
  delayOpts,
1875
1889
  queryDict,
1876
1890
  txnId
1877
- } = _ref3;
1891
+ } = _ref4;
1878
1892
  if (!txnId) {
1879
1893
  txnId = this.makeTxnId();
1880
1894
  }
@@ -3440,7 +3454,7 @@ export class BriijClient extends TypedEventEmitter {
3440
3454
  getEventTimeline(timelineSet, eventId) {
3441
3455
  var _this39 = this;
3442
3456
  return _asyncToGenerator(function* () {
3443
- var _ref4, _timelineSet$getTimel, _timelineSet$room$fin;
3457
+ var _ref5, _timelineSet$getTimel, _timelineSet$room$fin;
3444
3458
  // don't allow any timeline support unless it's been enabled.
3445
3459
  if (!_this39.timelineSupport) {
3446
3460
  throw new Error("timeline support is disabled. Set the 'timelineSupport'" + " parameter to true when creating BriijClient to enable it.");
@@ -3493,7 +3507,7 @@ export class BriijClient extends TypedEventEmitter {
3493
3507
  // There is no guarantee that the event ended up in "timeline" (we might have switched to a neighbouring
3494
3508
  // timeline) - so check the room's index again. On the other hand, there's no guarantee the event ended up
3495
3509
  // anywhere, if it was later redacted, so we just return the timeline we first thought of.
3496
- return (_ref4 = (_timelineSet$getTimel = timelineSet.getTimelineForEvent(eventId)) !== null && _timelineSet$getTimel !== void 0 ? _timelineSet$getTimel : (_timelineSet$room$fin = timelineSet.room.findThreadForEvent(event)) === null || _timelineSet$room$fin === void 0 ? void 0 : _timelineSet$room$fin.liveTimeline) !== null && _ref4 !== void 0 ? _ref4 :
3510
+ return (_ref5 = (_timelineSet$getTimel = timelineSet.getTimelineForEvent(eventId)) !== null && _timelineSet$getTimel !== void 0 ? _timelineSet$getTimel : (_timelineSet$room$fin = timelineSet.room.findThreadForEvent(event)) === null || _timelineSet$room$fin === void 0 ? void 0 : _timelineSet$room$fin.liveTimeline) !== null && _ref5 !== void 0 ? _ref5 :
3497
3511
  // for Threads degraded support
3498
3512
  timeline;
3499
3513
  })();
@@ -3815,7 +3829,7 @@ export class BriijClient extends TypedEventEmitter {
3815
3829
  params.from = token;
3816
3830
  }
3817
3831
  promise = this.http.authedRequest(Method.Get, path, params).then(/*#__PURE__*/function () {
3818
- var _ref5 = _asyncToGenerator(function* (res) {
3832
+ var _ref6 = _asyncToGenerator(function* (res) {
3819
3833
  var token = res.next_token;
3820
3834
  var matrixEvents = [];
3821
3835
  res.notifications = res.notifications.filter(noUnsafeEventProps);
@@ -3845,7 +3859,7 @@ export class BriijClient extends TypedEventEmitter {
3845
3859
  return Boolean(res.next_token);
3846
3860
  });
3847
3861
  return function (_x2) {
3848
- return _ref5.apply(this, arguments);
3862
+ return _ref6.apply(this, arguments);
3849
3863
  };
3850
3864
  }()).finally(() => {
3851
3865
  eventTimeline.paginationRequests[dir] = null;
@@ -3895,7 +3909,7 @@ export class BriijClient extends TypedEventEmitter {
3895
3909
  from: token !== null && token !== void 0 ? token : undefined,
3896
3910
  recurse: recurse || undefined
3897
3911
  }).then(/*#__PURE__*/function () {
3898
- var _ref6 = _asyncToGenerator(function* (res) {
3912
+ var _ref7 = _asyncToGenerator(function* (res) {
3899
3913
  var mapper = _this42.getEventMapper();
3900
3914
  var matrixEvents = res.chunk.filter(noUnsafeEventProps).filter(getRelationsThreadFilter(thread.id)).map(mapper);
3901
3915
 
@@ -3926,7 +3940,7 @@ export class BriijClient extends TypedEventEmitter {
3926
3940
  return Boolean(newToken);
3927
3941
  });
3928
3942
  return function (_x3) {
3929
- return _ref6.apply(this, arguments);
3943
+ return _ref7.apply(this, arguments);
3930
3944
  };
3931
3945
  }()).finally(() => {
3932
3946
  eventTimeline.paginationRequests[dir] = null;
@@ -4654,6 +4668,33 @@ export class BriijClient extends TypedEventEmitter {
4654
4668
  return this.fallbackICEServerAllowed;
4655
4669
  }
4656
4670
 
4671
+ /**
4672
+ * Some briij deployments mount admin resources under `/_briij/admin` while
4673
+ * Synapse defaults to `/_synapse/admin`. Try both prefixes to stay compatible.
4674
+ */
4675
+ authedRequestWithAdminPrefixes(method, adminSubPath, queryParams, body) {
4676
+ var _this46 = this;
4677
+ return _asyncToGenerator(function* () {
4678
+ var normalizedSubPath = adminSubPath.replace(/^\/+/, "");
4679
+ var adminPrefixes = ["/_synapse/admin", "/_briij/admin"];
4680
+ var lastError;
4681
+ for (var adminPrefix of adminPrefixes) {
4682
+ try {
4683
+ return yield _this46.http.authedRequest(method, "".concat(adminPrefix, "/").concat(normalizedSubPath), queryParams, body, {
4684
+ prefix: ""
4685
+ });
4686
+ } catch (error) {
4687
+ if (error instanceof BriijError && error.httpStatus === 404) {
4688
+ lastError = error;
4689
+ continue;
4690
+ }
4691
+ throw error;
4692
+ }
4693
+ }
4694
+ throw lastError !== null && lastError !== void 0 ? lastError : new Error("Admin API endpoint not found");
4695
+ })();
4696
+ }
4697
+
4657
4698
  /**
4658
4699
  * Determines if the current user is an administrator of the Synapse homeserver.
4659
4700
  * Returns false if untrue or the homeserver does not appear to be a Synapse
@@ -4662,12 +4703,24 @@ export class BriijClient extends TypedEventEmitter {
4662
4703
  * @returns true if the user appears to be a Synapse administrator.
4663
4704
  */
4664
4705
  isSynapseAdministrator() {
4665
- var path = utils.encodeUri("/_synapse/admin/v1/users/$userId/admin", {
4666
- $userId: this.getUserId()
4667
- });
4668
- return this.http.authedRequest(Method.Get, path, undefined, undefined, {
4669
- prefix: ""
4670
- }).then(r => r.admin); // pull out the specific boolean we want
4706
+ var _this47 = this;
4707
+ return _asyncToGenerator(function* () {
4708
+ var adminSubPath = utils.encodeUri("v1/users/$userId/admin", {
4709
+ $userId: _this47.getUserId()
4710
+ });
4711
+ try {
4712
+ var response = yield _this47.authedRequestWithAdminPrefixes(Method.Get, adminSubPath);
4713
+ return response.admin;
4714
+ } catch (error) {
4715
+ if (error instanceof BriijError && error.httpStatus === 404) {
4716
+ return false;
4717
+ }
4718
+ if (error instanceof Error && /Admin API endpoint not found/i.test(error.message)) {
4719
+ return false;
4720
+ }
4721
+ throw error;
4722
+ }
4723
+ })();
4671
4724
  }
4672
4725
 
4673
4726
  /**
@@ -4678,12 +4731,10 @@ export class BriijClient extends TypedEventEmitter {
4678
4731
  * @returns the whois response - see Synapse docs for information.
4679
4732
  */
4680
4733
  whoisSynapseUser(userId) {
4681
- var path = utils.encodeUri("/_synapse/admin/v1/whois/$userId", {
4734
+ var adminSubPath = utils.encodeUri("v1/whois/$userId", {
4682
4735
  $userId: userId
4683
4736
  });
4684
- return this.http.authedRequest(Method.Get, path, undefined, undefined, {
4685
- prefix: ""
4686
- });
4737
+ return this.authedRequestWithAdminPrefixes(Method.Get, adminSubPath);
4687
4738
  }
4688
4739
 
4689
4740
  /**
@@ -4693,22 +4744,126 @@ export class BriijClient extends TypedEventEmitter {
4693
4744
  * @returns the deactivate response - see Synapse docs for information.
4694
4745
  */
4695
4746
  deactivateSynapseUser(userId) {
4696
- var path = utils.encodeUri("/_synapse/admin/v1/deactivate/$userId", {
4747
+ var adminSubPath = utils.encodeUri("v1/deactivate/$userId", {
4697
4748
  $userId: userId
4698
4749
  });
4699
- return this.http.authedRequest(Method.Post, path, undefined, undefined, {
4700
- prefix: ""
4750
+ return this.authedRequestWithAdminPrefixes(Method.Post, adminSubPath);
4751
+ }
4752
+
4753
+ /**
4754
+ * Lists active mCredits features for the authenticated user.
4755
+ */
4756
+ getBriijMcreditsFeatures() {
4757
+ return this.http.authedRequest(Method.Get, "/mcredits/features", undefined, undefined, {
4758
+ prefix: ClientPrefix.V3
4701
4759
  });
4702
4760
  }
4761
+
4762
+ /**
4763
+ * Retrieves the authenticated user's mCredits balance.
4764
+ */
4765
+ getBriijMcreditsBalance() {
4766
+ return this.http.authedRequest(Method.Get, "/mcredits/balance", undefined, undefined, {
4767
+ prefix: ClientPrefix.V3
4768
+ });
4769
+ }
4770
+
4771
+ /**
4772
+ * Spends mCredits for a premium feature.
4773
+ * @param featureKey - The premium feature identifier to spend against.
4774
+ */
4775
+ spendBriijMcredits(featureKey) {
4776
+ return this.http.authedRequest(Method.Post, "/mcredits/spend", undefined, {
4777
+ feature_key: featureKey
4778
+ }, {
4779
+ prefix: ClientPrefix.V3
4780
+ });
4781
+ }
4782
+
4783
+ /**
4784
+ * Calls Briij's legacy-compatible endpoint to resolve a Matrix user to wallet/mcredit payload.
4785
+ * @param matrixUserId - Matrix user ID used by legacy clients.
4786
+ */
4787
+ getBriijLegacyMyAddress(matrixUserId) {
4788
+ return this.http.authedRequest(Method.Post, "/my-address", undefined, {
4789
+ address: matrixUserId
4790
+ }, {
4791
+ prefix: "",
4792
+ baseUrl: this.getLegacyApiBaseUrl()
4793
+ });
4794
+ }
4795
+
4796
+ /**
4797
+ * Calls Briij's legacy-compatible enabled-features endpoint.
4798
+ * @param walletAddress - XRPL wallet address.
4799
+ * @param network - Legacy network segment; defaults to `main`.
4800
+ */
4801
+ getBriijLegacyEnabledFeatures(walletAddress) {
4802
+ var network = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "main";
4803
+ var path = utils.encodeUri("/my-features/$walletAddress/$network/enabled", {
4804
+ $walletAddress: walletAddress,
4805
+ $network: network
4806
+ });
4807
+ return this.http.authedRequest(Method.Get, path, undefined, undefined, {
4808
+ prefix: "",
4809
+ baseUrl: this.getLegacyApiBaseUrl()
4810
+ });
4811
+ }
4812
+ getLegacyApiBaseUrl() {
4813
+ var _ref8, _this$legacyApiBaseUr, _this$xrplTrustConfig;
4814
+ return (_ref8 = (_this$legacyApiBaseUr = this.legacyApiBaseUrl) !== null && _this$legacyApiBaseUr !== void 0 ? _this$legacyApiBaseUr : utils.ensureNoTrailingSlash((_this$xrplTrustConfig = this.xrplTrustConfig) === null || _this$xrplTrustConfig === void 0 ? void 0 : _this$xrplTrustConfig.homeserverBaseUrl)) !== null && _ref8 !== void 0 ? _ref8 : this.baseUrl;
4815
+ }
4816
+
4817
+ /**
4818
+ * Lists mCredits premium features from Synapse admin APIs.
4819
+ */
4820
+ getBriijAdminPremiumFeatures() {
4821
+ var _this48 = this;
4822
+ return _asyncToGenerator(function* () {
4823
+ var response = yield _this48.authedRequestWithAdminPrefixes(Method.Get, "v2/briij/premium_features");
4824
+ return response.premium_features;
4825
+ })();
4826
+ }
4827
+
4828
+ /**
4829
+ * Creates an mCredits premium feature via Synapse admin APIs.
4830
+ * @param body - Feature fields to create.
4831
+ */
4832
+ createBriijAdminPremiumFeature(body) {
4833
+ return this.authedRequestWithAdminPrefixes(Method.Post, "v2/briij/premium_features", undefined, body);
4834
+ }
4835
+
4836
+ /**
4837
+ * Updates an mCredits premium feature via Synapse admin APIs.
4838
+ * @param featureKey - The premium feature key to update.
4839
+ * @param body - Updatable feature fields.
4840
+ */
4841
+ updateBriijAdminPremiumFeature(featureKey, body) {
4842
+ var adminSubPath = utils.encodeUri("v2/briij/premium_features/$featureKey", {
4843
+ $featureKey: featureKey
4844
+ });
4845
+ return this.authedRequestWithAdminPrefixes(Method.Put, adminSubPath, undefined, body);
4846
+ }
4847
+
4848
+ /**
4849
+ * Soft-deactivates an mCredits premium feature via Synapse admin APIs.
4850
+ * @param featureKey - The premium feature key to deactivate.
4851
+ */
4852
+ deactivateBriijAdminPremiumFeature(featureKey) {
4853
+ var adminSubPath = utils.encodeUri("v2/briij/premium_features/$featureKey", {
4854
+ $featureKey: featureKey
4855
+ });
4856
+ return this.authedRequestWithAdminPrefixes(Method.Delete, adminSubPath);
4857
+ }
4703
4858
  fetchClientWellKnown() {
4704
- var _this46 = this;
4859
+ var _this49 = this;
4705
4860
  return _asyncToGenerator(function* () {
4706
- var _this46$getDomain;
4861
+ var _this49$getDomain;
4707
4862
  // `getRawClientConfig` does not throw or reject on network errors, instead
4708
4863
  // it absorbs errors and returns `{}`.
4709
- _this46.clientWellKnownPromise = AutoDiscovery.getRawClientConfig((_this46$getDomain = _this46.getDomain()) !== null && _this46$getDomain !== void 0 ? _this46$getDomain : undefined);
4710
- _this46.clientWellKnown = yield _this46.clientWellKnownPromise;
4711
- _this46.emit(ClientEvent.ClientWellKnown, _this46.clientWellKnown);
4864
+ _this49.clientWellKnownPromise = AutoDiscovery.getRawClientConfig((_this49$getDomain = _this49.getDomain()) !== null && _this49$getDomain !== void 0 ? _this49$getDomain : undefined);
4865
+ _this49.clientWellKnown = yield _this49.clientWellKnownPromise;
4866
+ _this49.emit(ClientEvent.ClientWellKnown, _this49.clientWellKnown);
4712
4867
  })();
4713
4868
  }
4714
4869
  getClientWellKnown() {
@@ -4730,11 +4885,11 @@ export class BriijClient extends TypedEventEmitter {
4730
4885
  storeClientOptions() {
4731
4886
  // XXX: Intended private, used in code
4732
4887
  var primTypes = ["boolean", "string", "number"];
4733
- var serializableOpts = Object.entries(this.clientOpts).filter(_ref7 => {
4734
- var [key, value] = _ref7;
4888
+ var serializableOpts = Object.entries(this.clientOpts).filter(_ref9 => {
4889
+ var [key, value] = _ref9;
4735
4890
  return primTypes.includes(typeof value);
4736
- }).reduce((obj, _ref8) => {
4737
- var [key, value] = _ref8;
4891
+ }).reduce((obj, _ref0) => {
4892
+ var [key, value] = _ref0;
4738
4893
  obj[key] = value;
4739
4894
  return obj;
4740
4895
  }, {});
@@ -4754,16 +4909,16 @@ export class BriijClient extends TypedEventEmitter {
4754
4909
  // TODO: on spec release, rename this to getMutualRooms
4755
4910
  // eslint-disable-next-line
4756
4911
  _unstable_getSharedRooms(userId) {
4757
- var _this47 = this;
4912
+ var _this50 = this;
4758
4913
  return _asyncToGenerator(function* () {
4759
4914
  // Initial variant of the MSC
4760
- var sharedRoomsSupport = yield _this47.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_SHARED_ROOMS);
4915
+ var sharedRoomsSupport = yield _this50.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_SHARED_ROOMS);
4761
4916
 
4762
4917
  // Newer variant that renamed shared rooms to mutual rooms
4763
- var mutualRoomsSupport = yield _this47.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_MUTUAL_ROOMS);
4918
+ var mutualRoomsSupport = yield _this50.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_MUTUAL_ROOMS);
4764
4919
 
4765
4920
  // Latest variant that changed from path elements to query elements
4766
- var queryMutualRoomsSupport = yield _this47.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS);
4921
+ var queryMutualRoomsSupport = yield _this50.doesServerSupportUnstableFeature(UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS);
4767
4922
  if (!sharedRoomsSupport && !mutualRoomsSupport && !queryMutualRoomsSupport) {
4768
4923
  throw Error("Server does not support the Mutual Rooms API");
4769
4924
  }
@@ -4791,7 +4946,7 @@ export class BriijClient extends TypedEventEmitter {
4791
4946
  if (token != null && queryMutualRoomsSupport) {
4792
4947
  tokenQuery["batch_token"] = token;
4793
4948
  }
4794
- var res = yield _this47.http.authedRequest(Method.Get, path, _objectSpread(_objectSpread({}, query), tokenQuery), undefined, {
4949
+ var res = yield _this50.http.authedRequest(Method.Get, path, _objectSpread(_objectSpread({}, query), tokenQuery), undefined, {
4795
4950
  prefix: ClientPrefix.Unstable
4796
4951
  });
4797
4952
  rooms.push(...res.joined);
@@ -4812,10 +4967,10 @@ export class BriijClient extends TypedEventEmitter {
4812
4967
  */
4813
4968
  // eslint-disable-next-line @typescript-eslint/naming-convention
4814
4969
  _unstable_getRTCTransports() {
4815
- var _this48 = this;
4970
+ var _this51 = this;
4816
4971
  return _asyncToGenerator(function* () {
4817
4972
  // There is no /versions endpoint to check for support, so we just have to attempt a request.
4818
- return (yield _this48.http.authedRequest(Method.Get, "/rtc/transports", undefined, undefined, {
4973
+ return (yield _this51.http.authedRequest(Method.Get, "/rtc/transports", undefined, undefined, {
4819
4974
  prefix: "".concat(ClientPrefix.Unstable, "/org.matrix.msc4143")
4820
4975
  })).rtc_transports;
4821
4976
  })();
@@ -4827,24 +4982,24 @@ export class BriijClient extends TypedEventEmitter {
4827
4982
  * @returns The server /versions response
4828
4983
  */
4829
4984
  getVersions() {
4830
- var _this49 = this;
4985
+ var _this52 = this;
4831
4986
  return _asyncToGenerator(function* () {
4832
- if (_this49.serverVersionsPromise) {
4833
- return _this49.serverVersionsPromise;
4987
+ if (_this52.serverVersionsPromise) {
4988
+ return _this52.serverVersionsPromise;
4834
4989
  }
4835
4990
 
4836
4991
  // We send an authenticated request as of MSC4026
4837
- _this49.serverVersionsPromise = _this49.http.authedRequest(Method.Get, "/_matrix/client/versions", undefined, undefined, {
4992
+ _this52.serverVersionsPromise = _this52.http.authedRequest(Method.Get, "/_matrix/client/versions", undefined, undefined, {
4838
4993
  prefix: ""
4839
4994
  }).catch(e => {
4840
4995
  // Need to unset this if it fails, otherwise we'll never retry
4841
- _this49.serverVersionsPromise = undefined;
4996
+ _this52.serverVersionsPromise = undefined;
4842
4997
  // but rethrow the exception to anything that was waiting
4843
4998
  throw e;
4844
4999
  });
4845
- var serverVersions = yield _this49.serverVersionsPromise;
4846
- _this49.canSupport = yield buildFeatureSupportMap(serverVersions);
4847
- return _this49.serverVersionsPromise;
5000
+ var serverVersions = yield _this52.serverVersionsPromise;
5001
+ _this52.canSupport = yield buildFeatureSupportMap(serverVersions);
5002
+ return _this52.serverVersionsPromise;
4848
5003
  })();
4849
5004
  }
4850
5005
 
@@ -4854,11 +5009,11 @@ export class BriijClient extends TypedEventEmitter {
4854
5009
  * @returns Whether it is supported
4855
5010
  */
4856
5011
  isVersionSupported(version) {
4857
- var _this50 = this;
5012
+ var _this53 = this;
4858
5013
  return _asyncToGenerator(function* () {
4859
5014
  var {
4860
5015
  versions
4861
- } = yield _this50.getVersions();
5016
+ } = yield _this53.getVersions();
4862
5017
  return versions && versions.includes(version);
4863
5018
  })();
4864
5019
  }
@@ -4870,9 +5025,9 @@ export class BriijClient extends TypedEventEmitter {
4870
5025
  * @returns true if the feature is supported
4871
5026
  */
4872
5027
  doesServerSupportUnstableFeature(feature) {
4873
- var _this51 = this;
5028
+ var _this54 = this;
4874
5029
  return _asyncToGenerator(function* () {
4875
- var response = yield _this51.getVersions();
5030
+ var response = yield _this54.getVersions();
4876
5031
  if (!response) return false;
4877
5032
  var unstableFeatures = response["unstable_features"];
4878
5033
  return unstableFeatures && !!unstableFeatures[feature];
@@ -4887,9 +5042,9 @@ export class BriijClient extends TypedEventEmitter {
4887
5042
  * for the preset.
4888
5043
  */
4889
5044
  doesServerForceEncryptionForPreset(presetName) {
4890
- var _this52 = this;
5045
+ var _this55 = this;
4891
5046
  return _asyncToGenerator(function* () {
4892
- var response = yield _this52.getVersions();
5047
+ var response = yield _this55.getVersions();
4893
5048
  if (!response) return false;
4894
5049
  var unstableFeatures = response["unstable_features"];
4895
5050
 
@@ -4899,9 +5054,9 @@ export class BriijClient extends TypedEventEmitter {
4899
5054
  })();
4900
5055
  }
4901
5056
  doesServerSupportThread() {
4902
- var _this53 = this;
5057
+ var _this56 = this;
4903
5058
  return _asyncToGenerator(function* () {
4904
- if (yield _this53.isVersionSupported("v1.4")) {
5059
+ if (yield _this56.isVersionSupported("v1.4")) {
4905
5060
  return {
4906
5061
  threads: FeatureSupport.Stable,
4907
5062
  list: FeatureSupport.Stable,
@@ -4909,7 +5064,7 @@ export class BriijClient extends TypedEventEmitter {
4909
5064
  };
4910
5065
  }
4911
5066
  try {
4912
- var [threadUnstable, threadStable, listUnstable, listStable, fwdPaginationUnstable, fwdPaginationStable] = yield Promise.all([_this53.doesServerSupportUnstableFeature("org.matrix.msc3440"), _this53.doesServerSupportUnstableFeature("org.matrix.msc3440.stable"), _this53.doesServerSupportUnstableFeature("org.matrix.msc3856"), _this53.doesServerSupportUnstableFeature("org.matrix.msc3856.stable"), _this53.doesServerSupportUnstableFeature("org.matrix.msc3715"), _this53.doesServerSupportUnstableFeature("org.matrix.msc3715.stable")]);
5067
+ var [threadUnstable, threadStable, listUnstable, listStable, fwdPaginationUnstable, fwdPaginationStable] = yield Promise.all([_this56.doesServerSupportUnstableFeature("org.matrix.msc3440"), _this56.doesServerSupportUnstableFeature("org.matrix.msc3440.stable"), _this56.doesServerSupportUnstableFeature("org.matrix.msc3856"), _this56.doesServerSupportUnstableFeature("org.matrix.msc3856.stable"), _this56.doesServerSupportUnstableFeature("org.matrix.msc3715"), _this56.doesServerSupportUnstableFeature("org.matrix.msc3715.stable")]);
4913
5068
  return {
4914
5069
  threads: determineFeatureSupport(threadStable, threadUnstable),
4915
5070
  list: determineFeatureSupport(listStable, listUnstable),
@@ -4968,20 +5123,20 @@ export class BriijClient extends TypedEventEmitter {
4968
5123
  */
4969
5124
  relations(roomId, eventId, relationType, eventType) {
4970
5125
  var _arguments12 = arguments,
4971
- _this54 = this;
5126
+ _this57 = this;
4972
5127
  return _asyncToGenerator(function* () {
4973
5128
  var _result$next_batch, _result$prev_batch;
4974
5129
  var opts = _arguments12.length > 4 && _arguments12[4] !== undefined ? _arguments12[4] : {
4975
5130
  dir: Direction.Backward
4976
5131
  };
4977
- var fetchedEventType = eventType ? _this54.getEncryptedIfNeededEventType(roomId, eventType) : null;
4978
- var [eventResult, result] = yield Promise.all([_this54.fetchRoomEvent(roomId, eventId), _this54.fetchRelations(roomId, eventId, relationType, fetchedEventType, opts)]);
4979
- var mapper = _this54.getEventMapper();
5132
+ var fetchedEventType = eventType ? _this57.getEncryptedIfNeededEventType(roomId, eventType) : null;
5133
+ var [eventResult, result] = yield Promise.all([_this57.fetchRoomEvent(roomId, eventId), _this57.fetchRelations(roomId, eventId, relationType, fetchedEventType, opts)]);
5134
+ var mapper = _this57.getEventMapper();
4980
5135
  var originalEvent = eventResult ? mapper(eventResult) : undefined;
4981
5136
  var events = result.chunk.map(mapper);
4982
5137
  if (fetchedEventType === EventType.RoomMessageEncrypted) {
4983
5138
  var allEvents = originalEvent ? events.concat(originalEvent) : events;
4984
- yield Promise.all(allEvents.map(e => _this54.decryptEventIfNeeded(e)));
5139
+ yield Promise.all(allEvents.map(e => _this57.decryptEventIfNeeded(e)));
4985
5140
  if (eventType !== null) {
4986
5141
  events = events.filter(e => e.getType() === eventType);
4987
5142
  }
@@ -5248,35 +5403,48 @@ export class BriijClient extends TypedEventEmitter {
5248
5403
  * results. See https://github.com/matrix-org/briij-js-sdk/issues/4502.
5249
5404
  */
5250
5405
  login(loginType, data) {
5251
- var _this55 = this;
5406
+ var _this58 = this;
5252
5407
  return _asyncToGenerator(function* () {
5253
- var response = yield _this55.loginRequest(_objectSpread(_objectSpread({}, data), {}, {
5408
+ var response = yield _this58.loginRequest(_objectSpread(_objectSpread({}, data), {}, {
5254
5409
  type: loginType
5255
5410
  }));
5256
- if (response.access_token && response.user_id) {
5257
- _this55.http.opts.accessToken = response.access_token;
5258
- _this55.credentials = {
5259
- userId: response.user_id
5260
- };
5261
- configureXrplTrust({
5262
- homeserverBaseUrl: _this55.baseUrl,
5263
- accessToken: response.access_token
5264
- });
5411
+ yield _this58.applyLoginResponse(response, loginType);
5412
+ return response;
5413
+ })();
5414
+ }
5415
+ applyLoginResponse(response, loginType) {
5416
+ var _this59 = this;
5417
+ return _asyncToGenerator(function* () {
5418
+ var _response$device_id, _this59$xrplTrustConf;
5419
+ if (!response.access_token || !response.user_id) {
5420
+ return;
5265
5421
  }
5422
+ _this59.http.opts.accessToken = response.access_token;
5423
+ _this59.credentials = {
5424
+ userId: response.user_id
5425
+ };
5426
+ _this59.deviceId = (_response$device_id = response.device_id) !== null && _response$device_id !== void 0 ? _response$device_id : _this59.deviceId;
5427
+ _this59.xrplTrustConfig = {
5428
+ homeserverBaseUrl: _this59.baseUrl,
5429
+ accessToken: response.access_token,
5430
+ trustPath: (_this59$xrplTrustConf = _this59.xrplTrustConfig) === null || _this59$xrplTrustConf === void 0 ? void 0 : _this59$xrplTrustConf.trustPath
5431
+ };
5266
5432
 
5267
5433
  // After Xaman-backed SSO login, mint once and persist identity metadata in account_data.
5268
- if (loginType === "m.login.token" && response.access_token && response.user_id) {
5269
- configureXrplIdentityMinting({
5270
- homeserverBaseUrl: _this55.baseUrl,
5271
- accessToken: response.access_token
5272
- });
5434
+ if (loginType === "m.login.token") {
5435
+ var _this59$xrplIdentityM;
5436
+ var fallbackMintingConfig = getConfiguredXrplIdentityMintingConfig();
5437
+ var xamanWallet = (_this59$xrplIdentityM = _this59.xrplIdentityMintingConfig.xamanWallet) !== null && _this59$xrplIdentityM !== void 0 ? _this59$xrplIdentityM : fallbackMintingConfig.xamanWallet;
5273
5438
  try {
5274
- yield mintSoulboundIdentityNFT(response.user_id);
5439
+ yield mintSoulboundIdentityNFT(response.user_id, _objectSpread(_objectSpread(_objectSpread({}, fallbackMintingConfig), _this59.xrplIdentityMintingConfig), {}, {
5440
+ homeserverBaseUrl: _this59.baseUrl,
5441
+ accessToken: response.access_token,
5442
+ xamanWallet
5443
+ }));
5275
5444
  } catch (error) {
5276
5445
  logger.warn("XRPL identity NFT minting skipped/failed", error);
5277
5446
  }
5278
5447
  }
5279
- return response;
5280
5448
  })();
5281
5449
  }
5282
5450
 
@@ -5302,10 +5470,10 @@ export class BriijClient extends TypedEventEmitter {
5302
5470
  * response, so this helper normalizes that into a resolved promise.
5303
5471
  */
5304
5472
  getXrplAuthChallenge(request) {
5305
- var _this56 = this;
5473
+ var _this60 = this;
5306
5474
  return _asyncToGenerator(function* () {
5307
5475
  try {
5308
- var response = yield _this56.loginRequest(_objectSpread(_objectSpread({}, request), {}, {
5476
+ var response = yield _this60.loginRequest(_objectSpread(_objectSpread({}, request), {}, {
5309
5477
  type: XRPL_WALLET_LOGIN_TYPE
5310
5478
  }));
5311
5479
  if (typeof response.session === "string" && typeof response.challenge === "string") {
@@ -5349,7 +5517,10 @@ export class BriijClient extends TypedEventEmitter {
5349
5517
  * @param envelope - Wallet recovery envelope payload.
5350
5518
  */
5351
5519
  setWalletRecoveryEnvelope(envelope) {
5352
- return this.setAccountDataRaw(WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE, envelope);
5520
+ var _this61 = this;
5521
+ return _asyncToGenerator(function* () {
5522
+ return yield _this61.setAccountData(WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE, envelope);
5523
+ })();
5353
5524
  }
5354
5525
 
5355
5526
  /**
@@ -5377,7 +5548,7 @@ export class BriijClient extends TypedEventEmitter {
5377
5548
  */
5378
5549
  loginWithXrplWallet(user, walletAddress, signature, challenge) {
5379
5550
  var _arguments13 = arguments,
5380
- _this57 = this;
5551
+ _this62 = this;
5381
5552
  return _asyncToGenerator(function* () {
5382
5553
  var _parsedChallenge, _parsedChallenge2;
5383
5554
  var network = _arguments13.length > 4 && _arguments13[4] !== undefined ? _arguments13[4] : "xrpl";
@@ -5395,7 +5566,7 @@ export class BriijClient extends TypedEventEmitter {
5395
5566
  if (!session) {
5396
5567
  throw new Error("XRPL challenge payload is missing session; call getXrplAuthChallenge first");
5397
5568
  }
5398
- return _this57.completeXrplAuth({
5569
+ var response = yield _this62.completeXrplAuth({
5399
5570
  user,
5400
5571
  identifier: {
5401
5572
  type: "m.id.user",
@@ -5407,6 +5578,8 @@ export class BriijClient extends TypedEventEmitter {
5407
5578
  public_key: (_parsedChallenge2 = parsedChallenge) === null || _parsedChallenge2 === void 0 ? void 0 : _parsedChallenge2.public_key,
5408
5579
  network
5409
5580
  });
5581
+ yield _this62.applyLoginResponse(response, XRPL_WALLET_LOGIN_TYPE);
5582
+ return response;
5410
5583
  })();
5411
5584
  }
5412
5585
 
@@ -5470,9 +5643,9 @@ export class BriijClient extends TypedEventEmitter {
5470
5643
  * @param data - Credentials and other details for the login request.
5471
5644
  */
5472
5645
  loginRequest(data) {
5473
- var _this58 = this;
5646
+ var _this63 = this;
5474
5647
  return _asyncToGenerator(function* () {
5475
- return yield _this58.http.authedRequest(Method.Post, "/login", undefined, data);
5648
+ return yield _this63.http.authedRequest(Method.Post, "/login", undefined, data);
5476
5649
  })();
5477
5650
  }
5478
5651
 
@@ -5487,14 +5660,14 @@ export class BriijClient extends TypedEventEmitter {
5487
5660
  */
5488
5661
  logout() {
5489
5662
  var _arguments14 = arguments,
5490
- _this59 = this;
5663
+ _this64 = this;
5491
5664
  return _asyncToGenerator(function* () {
5492
5665
  var stopClient = _arguments14.length > 0 && _arguments14[0] !== undefined ? _arguments14[0] : false;
5493
5666
  if (stopClient) {
5494
- _this59.stopClient();
5495
- _this59.http.abort();
5667
+ _this64.stopClient();
5668
+ _this64.http.abort();
5496
5669
  }
5497
- return _this59.http.authedRequest(Method.Post, "/logout");
5670
+ return _this64.http.authedRequest(Method.Post, "/logout");
5498
5671
  })();
5499
5672
  }
5500
5673
 
@@ -5532,12 +5705,12 @@ export class BriijClient extends TypedEventEmitter {
5532
5705
  * or UIA auth data.
5533
5706
  */
5534
5707
  requestLoginToken(auth) {
5535
- var _this60 = this;
5708
+ var _this65 = this;
5536
5709
  return _asyncToGenerator(function* () {
5537
5710
  var body = {
5538
5711
  auth
5539
5712
  };
5540
- return _this60.http.authedRequest(Method.Post, "/login/get_token", undefined,
5713
+ return _this65.http.authedRequest(Method.Post, "/login/get_token", undefined,
5541
5714
  // no query params
5542
5715
  body, {
5543
5716
  prefix: ClientPrefix.V1
@@ -5569,23 +5742,23 @@ export class BriijClient extends TypedEventEmitter {
5569
5742
  * @returns Rejects: with an error response.
5570
5743
  */
5571
5744
  createRoom(options) {
5572
- var _this61 = this;
5745
+ var _this66 = this;
5573
5746
  return _asyncToGenerator(function* () {
5574
- var _this61$identityServe;
5747
+ var _this66$identityServe;
5575
5748
  // eslint-disable-line camelcase
5576
5749
  // some valid options include: room_alias_name, visibility, invite
5577
5750
 
5578
5751
  // inject the id_access_token if inviting 3rd party addresses
5579
5752
  var invitesNeedingToken = (options.invite_3pid || []).filter(i => !i.id_access_token);
5580
- if (invitesNeedingToken.length > 0 && (_this61$identityServe = _this61.identityServer) !== null && _this61$identityServe !== void 0 && _this61$identityServe.getAccessToken) {
5581
- var identityAccessToken = yield _this61.identityServer.getAccessToken();
5753
+ if (invitesNeedingToken.length > 0 && (_this66$identityServe = _this66.identityServer) !== null && _this66$identityServe !== void 0 && _this66$identityServe.getAccessToken) {
5754
+ var identityAccessToken = yield _this66.identityServer.getAccessToken();
5582
5755
  if (identityAccessToken) {
5583
5756
  for (var invite of invitesNeedingToken) {
5584
5757
  invite.id_access_token = identityAccessToken;
5585
5758
  }
5586
5759
  }
5587
5760
  }
5588
- return _this61.http.authedRequest(Method.Post, "/createRoom", undefined, options);
5761
+ return _this66.http.authedRequest(Method.Post, "/createRoom", undefined, options);
5589
5762
  })();
5590
5763
  }
5591
5764
 
@@ -5731,11 +5904,11 @@ export class BriijClient extends TypedEventEmitter {
5731
5904
  */
5732
5905
  sendStateEvent(roomId, eventType, content) {
5733
5906
  var _arguments15 = arguments,
5734
- _this62 = this;
5907
+ _this67 = this;
5735
5908
  return _asyncToGenerator(function* () {
5736
5909
  var stateKey = _arguments15.length > 3 && _arguments15[3] !== undefined ? _arguments15[3] : "";
5737
5910
  var opts = _arguments15.length > 4 && _arguments15[4] !== undefined ? _arguments15[4] : {};
5738
- var room = _this62.getRoom(roomId);
5911
+ var room = _this67.getRoom(roomId);
5739
5912
  var event = new BriijEvent({
5740
5913
  room_id: roomId,
5741
5914
  type: eventType,
@@ -5743,7 +5916,7 @@ export class BriijClient extends TypedEventEmitter {
5743
5916
  // Cast safety: StateEvents[K] is a stronger bound than IContent, which has [key: string]: any
5744
5917
  content: content
5745
5918
  });
5746
- yield _this62.encryptStateEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
5919
+ yield _this67.encryptStateEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
5747
5920
  var pathParams = {
5748
5921
  $roomId: roomId,
5749
5922
  $eventType: event.getWireType(),
@@ -5753,36 +5926,36 @@ export class BriijClient extends TypedEventEmitter {
5753
5926
  if (stateKey !== undefined) {
5754
5927
  path = utils.encodeUri(path + "/$stateKey", pathParams);
5755
5928
  }
5756
- return _this62.http.authedRequest(Method.Put, path, undefined, event.getWireContent(), opts);
5929
+ return _this67.http.authedRequest(Method.Put, path, undefined, event.getWireContent(), opts);
5757
5930
  })();
5758
5931
  }
5759
5932
  encryptStateEventIfNeeded(event, room) {
5760
- var _this63 = this;
5933
+ var _this68 = this;
5761
5934
  return _asyncToGenerator(function* () {
5762
- if (!_this63.enableEncryptedStateEvents) {
5935
+ if (!_this68.enableEncryptedStateEvents) {
5763
5936
  return;
5764
5937
  }
5765
5938
 
5766
5939
  // If the room is unknown, we cannot encrypt for it
5767
5940
  if (!room) return;
5768
- if (!_this63.cryptoBackend && _this63.usingExternalCrypto) {
5941
+ if (!_this68.cryptoBackend && _this68.usingExternalCrypto) {
5769
5942
  // The client has opted to allow sending messages to encrypted
5770
5943
  // rooms even if the room is encrypted, and we haven't set up
5771
5944
  // crypto. This is useful for users of matrix-org/pantalaimon
5772
5945
  return;
5773
5946
  }
5774
- if (!_this63.cryptoBackend) {
5947
+ if (!_this68.cryptoBackend) {
5775
5948
  throw new Error("This room is configured to use encryption, but your client does not support encryption.");
5776
5949
  }
5777
5950
 
5778
5951
  // Check regular encryption conditions.
5779
- if (!(yield _this63.shouldEncryptEventForRoom(event, room))) {
5952
+ if (!(yield _this68.shouldEncryptEventForRoom(event, room))) {
5780
5953
  return;
5781
5954
  }
5782
5955
 
5783
5956
  // If the crypto impl thinks we shouldn't encrypt, then we shouldn't.
5784
5957
  // Safety: we checked the crypto impl exists above.
5785
- if (!(yield _this63.cryptoBackend.isStateEncryptionEnabledInRoom(room.roomId))) {
5958
+ if (!(yield _this68.cryptoBackend.isStateEncryptionEnabledInRoom(room.roomId))) {
5786
5959
  return;
5787
5960
  }
5788
5961
 
@@ -5790,7 +5963,7 @@ export class BriijClient extends TypedEventEmitter {
5790
5963
  if (["m.room.create", "m.room.member", "m.room.join_rules", "m.room.power_levels", "m.room.third_party_invite", "m.room.history_visibility", "m.room.guest_access", "m.room.encryption"].includes(event.getType())) {
5791
5964
  return;
5792
5965
  }
5793
- yield _this63.cryptoBackend.encryptEvent(event, room);
5966
+ yield _this68.cryptoBackend.encryptEvent(event, room);
5794
5967
  })();
5795
5968
  }
5796
5969
 
@@ -5823,7 +5996,7 @@ export class BriijClient extends TypedEventEmitter {
5823
5996
  * @returns Promise which resolves: the empty object, `{}`.
5824
5997
  */
5825
5998
  setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId) {
5826
- var _this64 = this;
5999
+ var _this69 = this;
5827
6000
  return _asyncToGenerator(function* () {
5828
6001
  var path = utils.encodeUri("/rooms/$roomId/read_markers", {
5829
6002
  $roomId: roomId
@@ -5832,10 +6005,10 @@ export class BriijClient extends TypedEventEmitter {
5832
6005
  [ReceiptType.FullyRead]: rmEventId,
5833
6006
  [ReceiptType.Read]: rrEventId
5834
6007
  };
5835
- if ((yield _this64.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this64.isVersionSupported("v1.4"))) {
6008
+ if ((yield _this69.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this69.isVersionSupported("v1.4"))) {
5836
6009
  content[ReceiptType.ReadPrivate] = rpEventId;
5837
6010
  }
5838
- return _this64.http.authedRequest(Method.Post, path, undefined, content);
6011
+ return _this69.http.authedRequest(Method.Post, path, undefined, content);
5839
6012
  })();
5840
6013
  }
5841
6014
 
@@ -5871,13 +6044,13 @@ export class BriijClient extends TypedEventEmitter {
5871
6044
  * @see BriijSafetyError
5872
6045
  */
5873
6046
  publicRooms() {
5874
- var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6047
+ var _ref1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5875
6048
  var {
5876
6049
  server,
5877
6050
  limit,
5878
6051
  since
5879
- } = _ref9,
5880
- options = _objectWithoutProperties(_ref9, _excluded);
6052
+ } = _ref1,
6053
+ options = _objectWithoutProperties(_ref1, _excluded);
5881
6054
  if (Object.keys(options).length === 0) {
5882
6055
  var queryParams = {
5883
6056
  server,
@@ -5995,11 +6168,11 @@ export class BriijClient extends TypedEventEmitter {
5995
6168
  * @param options.limit - the maximum number of results to return. The server will apply a limit if unspecified.
5996
6169
  * @returns Promise which resolves: an array of results.
5997
6170
  */
5998
- searchUserDirectory(_ref0) {
6171
+ searchUserDirectory(_ref10) {
5999
6172
  var {
6000
6173
  term,
6001
6174
  limit
6002
- } = _ref0;
6175
+ } = _ref10;
6003
6176
  var body = {
6004
6177
  search_term: term
6005
6178
  };
@@ -6069,9 +6242,9 @@ export class BriijClient extends TypedEventEmitter {
6069
6242
  * @returns `true` if supported, otherwise `false`
6070
6243
  */
6071
6244
  doesServerSupportExtendedProfiles() {
6072
- var _this65 = this;
6245
+ var _this70 = this;
6073
6246
  return _asyncToGenerator(function* () {
6074
- return (yield _this65.isVersionSupported("v1.16")) || (yield _this65.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) || (yield _this65.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES));
6247
+ return (yield _this70.isVersionSupported("v1.16")) || (yield _this70.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) || (yield _this70.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES));
6075
6248
  })();
6076
6249
  }
6077
6250
 
@@ -6081,9 +6254,9 @@ export class BriijClient extends TypedEventEmitter {
6081
6254
  * @returns The prefix for use with `authedRequest`
6082
6255
  */
6083
6256
  getExtendedProfileRequestPrefix() {
6084
- var _this66 = this;
6257
+ var _this71 = this;
6085
6258
  return _asyncToGenerator(function* () {
6086
- if ((yield _this66.isVersionSupported("v1.16")) || (yield _this66.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))) {
6259
+ if ((yield _this71.isVersionSupported("v1.16")) || (yield _this71.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))) {
6087
6260
  return ClientPrefix.V3;
6088
6261
  }
6089
6262
  return "/_matrix/client/unstable/uk.tcpip.msc4133";
@@ -6101,15 +6274,15 @@ export class BriijClient extends TypedEventEmitter {
6101
6274
  * @throws A M_NOT_FOUND error if the profile could not be found.
6102
6275
  */
6103
6276
  getExtendedProfile(userId) {
6104
- var _this67 = this;
6277
+ var _this72 = this;
6105
6278
  return _asyncToGenerator(function* () {
6106
- if (!(yield _this67.doesServerSupportExtendedProfiles())) {
6279
+ if (!(yield _this72.doesServerSupportExtendedProfiles())) {
6107
6280
  throw new Error("Server does not support extended profiles");
6108
6281
  }
6109
- return _this67.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
6282
+ return _this72.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
6110
6283
  $userId: userId
6111
6284
  }), undefined, undefined, {
6112
- prefix: yield _this67.getExtendedProfileRequestPrefix()
6285
+ prefix: yield _this72.getExtendedProfileRequestPrefix()
6113
6286
  });
6114
6287
  })();
6115
6288
  }
@@ -6126,16 +6299,16 @@ export class BriijClient extends TypedEventEmitter {
6126
6299
  * @throws A M_NOT_FOUND error if the key was not set OR the profile could not be found.
6127
6300
  */
6128
6301
  getExtendedProfileProperty(userId, key) {
6129
- var _this68 = this;
6302
+ var _this73 = this;
6130
6303
  return _asyncToGenerator(function* () {
6131
- if (!(yield _this68.doesServerSupportExtendedProfiles())) {
6304
+ if (!(yield _this73.doesServerSupportExtendedProfiles())) {
6132
6305
  throw new Error("Server does not support extended profiles");
6133
6306
  }
6134
- var profile = yield _this68.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
6307
+ var profile = yield _this73.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
6135
6308
  $userId: userId,
6136
6309
  $key: key
6137
6310
  }), undefined, undefined, {
6138
- prefix: yield _this68.getExtendedProfileRequestPrefix()
6311
+ prefix: yield _this73.getExtendedProfileRequestPrefix()
6139
6312
  });
6140
6313
  return profile[key];
6141
6314
  })();
@@ -6151,19 +6324,19 @@ export class BriijClient extends TypedEventEmitter {
6151
6324
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6152
6325
  */
6153
6326
  setExtendedProfileProperty(key, value) {
6154
- var _this69 = this;
6327
+ var _this74 = this;
6155
6328
  return _asyncToGenerator(function* () {
6156
- if (!(yield _this69.doesServerSupportExtendedProfiles())) {
6329
+ if (!(yield _this74.doesServerSupportExtendedProfiles())) {
6157
6330
  throw new Error("Server does not support extended profiles");
6158
6331
  }
6159
- var userId = _this69.getUserId();
6160
- yield _this69.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
6332
+ var userId = _this74.getUserId();
6333
+ yield _this74.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
6161
6334
  $userId: userId,
6162
6335
  $key: key
6163
6336
  }), undefined, {
6164
6337
  [key]: value
6165
6338
  }, {
6166
- prefix: yield _this69.getExtendedProfileRequestPrefix()
6339
+ prefix: yield _this74.getExtendedProfileRequestPrefix()
6167
6340
  });
6168
6341
  })();
6169
6342
  }
@@ -6177,17 +6350,17 @@ export class BriijClient extends TypedEventEmitter {
6177
6350
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6178
6351
  */
6179
6352
  deleteExtendedProfileProperty(key) {
6180
- var _this70 = this;
6353
+ var _this75 = this;
6181
6354
  return _asyncToGenerator(function* () {
6182
- if (!(yield _this70.doesServerSupportExtendedProfiles())) {
6355
+ if (!(yield _this75.doesServerSupportExtendedProfiles())) {
6183
6356
  throw new Error("Server does not support extended profiles");
6184
6357
  }
6185
- var userId = _this70.getUserId();
6186
- yield _this70.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
6358
+ var userId = _this75.getUserId();
6359
+ yield _this75.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
6187
6360
  $userId: userId,
6188
6361
  $key: key
6189
6362
  }), undefined, undefined, {
6190
- prefix: yield _this70.getExtendedProfileRequestPrefix()
6363
+ prefix: yield _this75.getExtendedProfileRequestPrefix()
6191
6364
  });
6192
6365
  })();
6193
6366
  }
@@ -6203,16 +6376,16 @@ export class BriijClient extends TypedEventEmitter {
6203
6376
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6204
6377
  */
6205
6378
  patchExtendedProfile(profile) {
6206
- var _this71 = this;
6379
+ var _this76 = this;
6207
6380
  return _asyncToGenerator(function* () {
6208
- if (!(yield _this71.doesServerSupportExtendedProfiles())) {
6381
+ if (!(yield _this76.doesServerSupportExtendedProfiles())) {
6209
6382
  throw new Error("Server does not support extended profiles");
6210
6383
  }
6211
- var userId = _this71.getUserId();
6212
- return _this71.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
6384
+ var userId = _this76.getUserId();
6385
+ return _this76.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
6213
6386
  $userId: userId
6214
6387
  }), {}, profile, {
6215
- prefix: yield _this71.getExtendedProfileRequestPrefix()
6388
+ prefix: yield _this76.getExtendedProfileRequestPrefix()
6216
6389
  });
6217
6390
  })();
6218
6391
  }
@@ -6227,16 +6400,16 @@ export class BriijClient extends TypedEventEmitter {
6227
6400
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6228
6401
  */
6229
6402
  setExtendedProfile(profile) {
6230
- var _this72 = this;
6403
+ var _this77 = this;
6231
6404
  return _asyncToGenerator(function* () {
6232
- if (!(yield _this72.doesServerSupportExtendedProfiles())) {
6405
+ if (!(yield _this77.doesServerSupportExtendedProfiles())) {
6233
6406
  throw new Error("Server does not support extended profiles");
6234
6407
  }
6235
- var userId = _this72.getUserId();
6236
- yield _this72.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
6408
+ var userId = _this77.getUserId();
6409
+ yield _this77.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
6237
6410
  $userId: userId
6238
6411
  }), {}, profile, {
6239
- prefix: yield _this72.getExtendedProfileRequestPrefix()
6412
+ prefix: yield _this77.getExtendedProfileRequestPrefix()
6240
6413
  });
6241
6414
  })();
6242
6415
  }
@@ -6259,10 +6432,10 @@ export class BriijClient extends TypedEventEmitter {
6259
6432
  * @returns Rejects: with an error response.
6260
6433
  */
6261
6434
  addThreePidOnly(data) {
6262
- var _this73 = this;
6435
+ var _this78 = this;
6263
6436
  return _asyncToGenerator(function* () {
6264
6437
  var path = "/account/3pid/add";
6265
- return _this73.http.authedRequest(Method.Post, path, undefined, data);
6438
+ return _this78.http.authedRequest(Method.Post, path, undefined, data);
6266
6439
  })();
6267
6440
  }
6268
6441
 
@@ -6278,10 +6451,10 @@ export class BriijClient extends TypedEventEmitter {
6278
6451
  * @returns Rejects: with an error response.
6279
6452
  */
6280
6453
  bindThreePid(data) {
6281
- var _this74 = this;
6454
+ var _this79 = this;
6282
6455
  return _asyncToGenerator(function* () {
6283
6456
  var path = "/account/3pid/bind";
6284
- return _this74.http.authedRequest(Method.Post, path, undefined, data);
6457
+ return _this79.http.authedRequest(Method.Post, path, undefined, data);
6285
6458
  })();
6286
6459
  }
6287
6460
 
@@ -6299,15 +6472,15 @@ export class BriijClient extends TypedEventEmitter {
6299
6472
  unbindThreePid(medium, address
6300
6473
  // eslint-disable-next-line camelcase
6301
6474
  ) {
6302
- var _this75 = this;
6475
+ var _this80 = this;
6303
6476
  return _asyncToGenerator(function* () {
6304
6477
  var path = "/account/3pid/unbind";
6305
6478
  var data = {
6306
6479
  medium,
6307
6480
  address,
6308
- id_server: _this75.getIdentityServerUrl(true)
6481
+ id_server: _this80.getIdentityServerUrl(true)
6309
6482
  };
6310
- return _this75.http.authedRequest(Method.Post, path, undefined, data);
6483
+ return _this80.http.authedRequest(Method.Post, path, undefined, data);
6311
6484
  })();
6312
6485
  }
6313
6486
 
@@ -6429,13 +6602,13 @@ export class BriijClient extends TypedEventEmitter {
6429
6602
  * @returns Rejects: with an error response.
6430
6603
  */
6431
6604
  getPushers() {
6432
- var _this76 = this;
6605
+ var _this81 = this;
6433
6606
  return _asyncToGenerator(function* () {
6434
- var response = yield _this76.http.authedRequest(Method.Get, "/pushers");
6607
+ var response = yield _this81.http.authedRequest(Method.Get, "/pushers");
6435
6608
 
6436
6609
  // Migration path for clients that connect to a homeserver that does not support
6437
6610
  // MSC3881 yet, see https://github.com/matrix-org/matrix-spec-proposals/blob/kerry/remote-push-toggle/proposals/3881-remote-push-notification-toggling.md#migration
6438
- if (!(yield _this76.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
6611
+ if (!(yield _this81.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
6439
6612
  response.pushers = response.pushers.map(pusher => {
6440
6613
  if (!pusher.hasOwnProperty(PUSHER_ENABLED.name)) {
6441
6614
  pusher[PUSHER_ENABLED.name] = true;
@@ -6574,11 +6747,11 @@ export class BriijClient extends TypedEventEmitter {
6574
6747
  * @returns Promise which resolves to the search response object.
6575
6748
  * @returns Rejects: with an error response.
6576
6749
  */
6577
- search(_ref1, abortSignal) {
6750
+ search(_ref11, abortSignal) {
6578
6751
  var {
6579
6752
  body,
6580
6753
  next_batch: nextBatch
6581
- } = _ref1;
6754
+ } = _ref11;
6582
6755
  var queryParams = {};
6583
6756
  if (nextBatch) {
6584
6757
  queryParams.next_batch = nextBatch;
@@ -6865,7 +7038,7 @@ export class BriijClient extends TypedEventEmitter {
6865
7038
  * found MXIDs. Results where no user could be found will not be listed.
6866
7039
  */
6867
7040
  identityHashedLookup(addressPairs, identityAccessToken) {
6868
- var _this77 = this;
7041
+ var _this82 = this;
6869
7042
  return _asyncToGenerator(function* () {
6870
7043
  var params = {
6871
7044
  // addresses: ["email@example.org", "10005550000"],
@@ -6874,7 +7047,7 @@ export class BriijClient extends TypedEventEmitter {
6874
7047
  };
6875
7048
 
6876
7049
  // Get hash information first before trying to do a lookup
6877
- var hashes = yield _this77.getIdentityHashDetails(identityAccessToken);
7050
+ var hashes = yield _this82.getIdentityHashDetails(identityAccessToken);
6878
7051
  if (!hashes || !hashes["lookup_pepper"] || !hashes["algorithms"]) {
6879
7052
  throw new Error("Unsupported identity server: bad response");
6880
7053
  }
@@ -6887,7 +7060,7 @@ export class BriijClient extends TypedEventEmitter {
6887
7060
  // When picking an algorithm, we pick the hashed over no hashes
6888
7061
  if (hashes["algorithms"].includes("sha256")) {
6889
7062
  params["addresses"] = yield Promise.all(addressPairs.map(/*#__PURE__*/function () {
6890
- var _ref10 = _asyncToGenerator(function* (p) {
7063
+ var _ref12 = _asyncToGenerator(function* (p) {
6891
7064
  var addr = p[0].toLowerCase(); // lowercase to get consistent hashes
6892
7065
  var med = p[1].toLowerCase();
6893
7066
  var hashBuffer = yield sha256("".concat(addr, " ").concat(med, " ").concat(params["pepper"]));
@@ -6899,7 +7072,7 @@ export class BriijClient extends TypedEventEmitter {
6899
7072
  return hashed;
6900
7073
  });
6901
7074
  return function (_x4) {
6902
- return _ref10.apply(this, arguments);
7075
+ return _ref12.apply(this, arguments);
6903
7076
  };
6904
7077
  }()));
6905
7078
  params["algorithm"] = "sha256";
@@ -6917,7 +7090,7 @@ export class BriijClient extends TypedEventEmitter {
6917
7090
  } else {
6918
7091
  throw new Error("Unsupported identity server: unknown hash algorithm");
6919
7092
  }
6920
- var response = yield _this77.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
7093
+ var response = yield _this82.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
6921
7094
  if (!(response !== null && response !== void 0 && response["mappings"])) return []; // no results
6922
7095
 
6923
7096
  var foundAddresses = [];
@@ -6951,12 +7124,12 @@ export class BriijClient extends TypedEventEmitter {
6951
7124
  * @returns Rejects: with an error response.
6952
7125
  */
6953
7126
  lookupThreePid(medium, address, identityAccessToken) {
6954
- var _this78 = this;
7127
+ var _this83 = this;
6955
7128
  return _asyncToGenerator(function* () {
6956
7129
  // Note: we're using the V2 API by calling this function, but our
6957
7130
  // function contract requires a V1 response. We therefore have to
6958
7131
  // convert it manually.
6959
- var response = yield _this78.identityHashedLookup([[address, medium]], identityAccessToken);
7132
+ var response = yield _this83.identityHashedLookup([[address, medium]], identityAccessToken);
6960
7133
  var result = response.find(p => p.address === address);
6961
7134
  if (!result) {
6962
7135
  return {};
@@ -6988,12 +7161,12 @@ export class BriijClient extends TypedEventEmitter {
6988
7161
  * @returns Rejects: with an error response.
6989
7162
  */
6990
7163
  bulkLookupThreePids(query, identityAccessToken) {
6991
- var _this79 = this;
7164
+ var _this84 = this;
6992
7165
  return _asyncToGenerator(function* () {
6993
7166
  // Note: we're using the V2 API by calling this function, but our
6994
7167
  // function contract requires a V1 response. We therefore have to
6995
7168
  // convert it manually.
6996
- var response = yield _this79.identityHashedLookup(
7169
+ var response = yield _this84.identityHashedLookup(
6997
7170
  // We have to reverse the query order to get [address, medium] pairs
6998
7171
  query.map(p => [p[1], p[0]]), identityAccessToken);
6999
7172
  var v1results = [];
@@ -7067,16 +7240,16 @@ export class BriijClient extends TypedEventEmitter {
7067
7240
  * @returns Promise which resolves once queued there is no error feedback when sending fails.
7068
7241
  */
7069
7242
  encryptAndSendToDevice(eventType, devices, payload) {
7070
- var _this80 = this;
7243
+ var _this85 = this;
7071
7244
  return _asyncToGenerator(function* () {
7072
- if (!_this80.cryptoBackend) {
7245
+ if (!_this85.cryptoBackend) {
7073
7246
  throw new Error("Cannot encrypt to device event, your client does not support encryption.");
7074
7247
  }
7075
- var batch = yield _this80.cryptoBackend.encryptToDeviceMessages(eventType, devices, payload);
7248
+ var batch = yield _this85.cryptoBackend.encryptToDeviceMessages(eventType, devices, payload);
7076
7249
 
7077
7250
  // TODO The batch mechanism removes all possibility to get error feedbacks..
7078
7251
  // We might want instead to do the API call directly and pass the errors back.
7079
- yield _this80.queueToDevice(batch);
7252
+ yield _this85.queueToDevice(batch);
7080
7253
  })();
7081
7254
  }
7082
7255
 
@@ -7233,16 +7406,16 @@ export class BriijClient extends TypedEventEmitter {
7233
7406
  * @returns Promise which resolves to the created space.
7234
7407
  */
7235
7408
  unstableCreateFileTree(name) {
7236
- var _this81 = this;
7409
+ var _this86 = this;
7237
7410
  return _asyncToGenerator(function* () {
7238
7411
  var {
7239
7412
  room_id: roomId
7240
- } = yield _this81.createRoom({
7413
+ } = yield _this86.createRoom({
7241
7414
  name: name,
7242
7415
  preset: Preset.PrivateChat,
7243
7416
  power_level_content_override: _objectSpread(_objectSpread({}, DEFAULT_TREE_POWER_LEVELS_TEMPLATE), {}, {
7244
7417
  users: {
7245
- [_this81.getUserId()]: 100
7418
+ [_this86.getUserId()]: 100
7246
7419
  }
7247
7420
  }),
7248
7421
  creation_content: {
@@ -7262,7 +7435,7 @@ export class BriijClient extends TypedEventEmitter {
7262
7435
  }
7263
7436
  }]
7264
7437
  });
7265
- return new MSC3089TreeSpace(_this81, roomId);
7438
+ return new MSC3089TreeSpace(_this86, roomId);
7266
7439
  })();
7267
7440
  }
7268
7441
 
@@ -7339,7 +7512,7 @@ export class BriijClient extends TypedEventEmitter {
7339
7512
  * @param via - The list of servers which know about the room if only an ID was provided.
7340
7513
  */
7341
7514
  getRoomSummary(roomIdOrAlias, via) {
7342
- var _this82 = this;
7515
+ var _this87 = this;
7343
7516
  return _asyncToGenerator(function* () {
7344
7517
  var paramOpts = {
7345
7518
  prefix: "/_matrix/client/unstable/im.nheko.summary"
@@ -7348,7 +7521,7 @@ export class BriijClient extends TypedEventEmitter {
7348
7521
  var path = utils.encodeUri("/summary/$roomid", {
7349
7522
  $roomid: roomIdOrAlias
7350
7523
  });
7351
- return yield _this82.http.authedRequest(Method.Get, path, {
7524
+ return yield _this87.http.authedRequest(Method.Get, path, {
7352
7525
  via
7353
7526
  }, undefined, paramOpts);
7354
7527
  } catch (e) {
@@ -7356,7 +7529,7 @@ export class BriijClient extends TypedEventEmitter {
7356
7529
  var _path = utils.encodeUri("/rooms/$roomid/summary", {
7357
7530
  $roomid: roomIdOrAlias
7358
7531
  });
7359
- return yield _this82.http.authedRequest(Method.Get, _path, {
7532
+ return yield _this87.http.authedRequest(Method.Get, _path, {
7360
7533
  via
7361
7534
  }, undefined, paramOpts);
7362
7535
  } else {
@@ -7408,9 +7581,9 @@ export class BriijClient extends TypedEventEmitter {
7408
7581
  * Fetches information about the user for the configured access token.
7409
7582
  */
7410
7583
  whoami() {
7411
- var _this83 = this;
7584
+ var _this88 = this;
7412
7585
  return _asyncToGenerator(function* () {
7413
- return _this83.http.authedRequest(Method.Get, "/account/whoami");
7586
+ return _this88.http.authedRequest(Method.Get, "/account/whoami");
7414
7587
  })();
7415
7588
  }
7416
7589
 
@@ -7421,7 +7594,7 @@ export class BriijClient extends TypedEventEmitter {
7421
7594
  * @returns Rejects: when the request fails (module:http-api.BriijError)
7422
7595
  */
7423
7596
  timestampToEvent(roomId, timestamp, dir) {
7424
- var _this84 = this;
7597
+ var _this89 = this;
7425
7598
  return _asyncToGenerator(function* () {
7426
7599
  var path = utils.encodeUri("/rooms/$roomId/timestamp_to_event", {
7427
7600
  $roomId: roomId
@@ -7431,7 +7604,7 @@ export class BriijClient extends TypedEventEmitter {
7431
7604
  dir: dir
7432
7605
  };
7433
7606
  try {
7434
- return yield _this84.http.authedRequest(Method.Get, path, queryParams, undefined, {
7607
+ return yield _this89.http.authedRequest(Method.Get, path, queryParams, undefined, {
7435
7608
  prefix: ClientPrefix.V1
7436
7609
  });
7437
7610
  } catch (err) {
@@ -7447,7 +7620,7 @@ export class BriijClient extends TypedEventEmitter {
7447
7620
  // both indicate that this endpoint+verb combination is
7448
7621
  // not supported.
7449
7622
  err.httpStatus === 404 || err.httpStatus === 405)) {
7450
- return yield _this84.http.authedRequest(Method.Get, path, queryParams, undefined, {
7623
+ return yield _this89.http.authedRequest(Method.Get, path, queryParams, undefined, {
7451
7624
  prefix: "/_matrix/client/unstable/org.matrix.msc3030"
7452
7625
  });
7453
7626
  }
@@ -7467,12 +7640,12 @@ export class BriijClient extends TypedEventEmitter {
7467
7640
  * @throws when delegated auth config is invalid or unreachable
7468
7641
  */
7469
7642
  getAuthMetadata() {
7470
- var _this85 = this;
7643
+ var _this90 = this;
7471
7644
  return _asyncToGenerator(function* () {
7472
7645
  var authMetadata;
7473
7646
  try {
7474
- var useStable = yield _this85.isVersionSupported("v1.15");
7475
- authMetadata = yield _this85.http.request(Method.Get, "/auth_metadata", undefined, undefined, {
7647
+ var useStable = yield _this90.isVersionSupported("v1.15");
7648
+ authMetadata = yield _this90.http.request(Method.Get, "/auth_metadata", undefined, undefined, {
7476
7649
  prefix: useStable ? ClientPrefix.V1 : ClientPrefix.Unstable + "/org.matrix.msc2965"
7477
7650
  });
7478
7651
  } catch (e) {
@@ -7480,7 +7653,7 @@ export class BriijClient extends TypedEventEmitter {
7480
7653
  // Fall back to older variant of MSC2965
7481
7654
  var {
7482
7655
  issuer
7483
- } = yield _this85.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
7656
+ } = yield _this90.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
7484
7657
  prefix: ClientPrefix.Unstable + "/org.matrix.msc2965"
7485
7658
  });
7486
7659
  return discoverAndValidateOIDCIssuerWellKnown(issuer);
@@ -7493,8 +7666,8 @@ export class BriijClient extends TypedEventEmitter {
7493
7666
  }
7494
7667
  _defineProperty(BriijClient, "RESTORE_BACKUP_ERROR_BAD_KEY", "RESTORE_BACKUP_ERROR_BAD_KEY");
7495
7668
  function getUnstableDelayQueryOpts(delayOpts) {
7496
- return Object.fromEntries(Object.entries(delayOpts).map(_ref11 => {
7497
- var [k, v] = _ref11;
7669
+ return Object.fromEntries(Object.entries(delayOpts).map(_ref13 => {
7670
+ var [k, v] = _ref13;
7498
7671
  return ["".concat(UNSTABLE_MSC4140_DELAYED_EVENTS, ".").concat(k), v];
7499
7672
  }));
7500
7673
  }