@textrp/briij-js-sdk 41.0.0 → 42.0.0

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 (375) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/LICENSE +177 -177
  3. package/README.md +47 -46
  4. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +1 -1
  5. package/lib/@types/IIdentityServerProvider.js.map +1 -1
  6. package/lib/@types/PushRules.js +14 -14
  7. package/lib/@types/PushRules.js.map +1 -1
  8. package/lib/@types/another-json.d.js.map +1 -1
  9. package/lib/@types/auth.d.ts +19 -1
  10. package/lib/@types/auth.d.ts.map +1 -1
  11. package/lib/@types/auth.js +55 -54
  12. package/lib/@types/auth.js.map +1 -1
  13. package/lib/@types/beacon.js +100 -100
  14. package/lib/@types/beacon.js.map +1 -1
  15. package/lib/@types/common.js.map +1 -1
  16. package/lib/@types/crypto.js.map +1 -1
  17. package/lib/@types/event.d.ts +27 -0
  18. package/lib/@types/event.d.ts.map +1 -1
  19. package/lib/@types/event.js +105 -102
  20. package/lib/@types/event.js.map +1 -1
  21. package/lib/@types/events.js.map +1 -1
  22. package/lib/@types/extensible_events.js +53 -53
  23. package/lib/@types/extensible_events.js.map +1 -1
  24. package/lib/@types/local_notifications.js.map +1 -1
  25. package/lib/@types/location.js +41 -41
  26. package/lib/@types/location.js.map +1 -1
  27. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
  28. package/lib/@types/media.js.map +1 -1
  29. package/lib/@types/membership.js +39 -39
  30. package/lib/@types/membership.js.map +1 -1
  31. package/lib/@types/partials.js +25 -25
  32. package/lib/@types/partials.js.map +1 -1
  33. package/lib/@types/polls.js +46 -46
  34. package/lib/@types/polls.js.map +1 -1
  35. package/lib/@types/read_receipts.js +14 -14
  36. package/lib/@types/read_receipts.js.map +1 -1
  37. package/lib/@types/registration.js.map +1 -1
  38. package/lib/@types/search.js +14 -14
  39. package/lib/@types/search.js.map +1 -1
  40. package/lib/@types/signed.js.map +1 -1
  41. package/lib/@types/spaces.js.map +1 -1
  42. package/lib/@types/state_events.js.map +1 -1
  43. package/lib/@types/synapse.js.map +1 -1
  44. package/lib/@types/sync.js +18 -18
  45. package/lib/@types/sync.js.map +1 -1
  46. package/lib/@types/threepids.js +14 -14
  47. package/lib/@types/threepids.js.map +1 -1
  48. package/lib/@types/topic.js +47 -47
  49. package/lib/@types/topic.js.map +1 -1
  50. package/lib/@types/uia.js.map +1 -1
  51. package/lib/NamespacedValue.js +20 -20
  52. package/lib/NamespacedValue.js.map +1 -1
  53. package/lib/ReEmitter.js +16 -16
  54. package/lib/ReEmitter.js.map +1 -1
  55. package/lib/base64.js +32 -32
  56. package/lib/base64.js.map +1 -1
  57. package/lib/briij.d.ts +3 -0
  58. package/lib/briij.d.ts.map +1 -1
  59. package/lib/briij.js +3 -0
  60. package/lib/briij.js.map +1 -1
  61. package/lib/client.d.ts +18 -1
  62. package/lib/client.d.ts.map +1 -1
  63. package/lib/client.js +166 -103
  64. package/lib/client.js.map +1 -1
  65. package/lib/common-crypto/key-passphrase.js +19 -19
  66. package/lib/common-crypto/key-passphrase.js.map +1 -1
  67. package/lib/content-helpers.js +57 -57
  68. package/lib/content-helpers.js.map +1 -1
  69. package/lib/content-repo.js +36 -36
  70. package/lib/content-repo.js.map +1 -1
  71. package/lib/crypto/store/base.js +69 -69
  72. package/lib/crypto/store/base.js.map +1 -1
  73. package/lib/crypto/store/indexeddb-crypto-store-backend.js +58 -58
  74. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  75. package/lib/crypto/store/indexeddb-crypto-store.js +193 -193
  76. package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  77. package/lib/crypto/store/localStorage-crypto-store.js +72 -72
  78. package/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  79. package/lib/crypto/store/memory-crypto-store.js +74 -74
  80. package/lib/crypto/store/memory-crypto-store.js.map +1 -1
  81. package/lib/crypto-api/CryptoEventHandlerMap.js.map +1 -1
  82. package/lib/crypto-api/key-passphrase.js +22 -22
  83. package/lib/crypto-api/key-passphrase.js.map +1 -1
  84. package/lib/crypto-api/keybackup.js.map +1 -1
  85. package/lib/crypto-api/recovery-key.js +20 -20
  86. package/lib/crypto-api/recovery-key.js.map +1 -1
  87. package/lib/digest.js +21 -21
  88. package/lib/digest.js.map +1 -1
  89. package/lib/extensible_events_v1/ExtensibleEvent.js +39 -39
  90. package/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
  91. package/lib/extensible_events_v1/InvalidEventError.js +16 -16
  92. package/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
  93. package/lib/extensible_events_v1/MessageEvent.js +39 -39
  94. package/lib/extensible_events_v1/MessageEvent.js.map +1 -1
  95. package/lib/extensible_events_v1/PollEndEvent.js +29 -29
  96. package/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
  97. package/lib/extensible_events_v1/PollResponseEvent.js +39 -39
  98. package/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
  99. package/lib/extensible_events_v1/PollStartEvent.js +52 -52
  100. package/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
  101. package/lib/extensible_events_v1/utilities.js +22 -22
  102. package/lib/extensible_events_v1/utilities.js.map +1 -1
  103. package/lib/feature.js +16 -16
  104. package/lib/feature.js.map +1 -1
  105. package/lib/http-api/method.js +14 -14
  106. package/lib/http-api/method.js.map +1 -1
  107. package/lib/http-api/prefix.js +26 -26
  108. package/lib/http-api/prefix.js.map +1 -1
  109. package/lib/indexeddb-helpers.js +21 -21
  110. package/lib/indexeddb-helpers.js.map +1 -1
  111. package/lib/indexeddb-worker.js +18 -18
  112. package/lib/indexeddb-worker.js.map +1 -1
  113. package/lib/matrixrtc/IKeyTransport.js +17 -17
  114. package/lib/matrixrtc/IKeyTransport.js.map +1 -1
  115. package/lib/matrixrtc/IMembershipManager.js +27 -27
  116. package/lib/matrixrtc/IMembershipManager.js.map +1 -1
  117. package/lib/matrixrtc/LivekitTransport.js +19 -19
  118. package/lib/matrixrtc/LivekitTransport.js.map +1 -1
  119. package/lib/matrixrtc/index.js +14 -14
  120. package/lib/matrixrtc/index.js.map +1 -1
  121. package/lib/matrixrtc/utils.js +27 -27
  122. package/lib/matrixrtc/utils.js.map +1 -1
  123. package/lib/models/ToDeviceMessage.js.map +1 -1
  124. package/lib/models/device.js +24 -24
  125. package/lib/models/device.js.map +1 -1
  126. package/lib/models/event-status.js +17 -17
  127. package/lib/models/event-status.js.map +1 -1
  128. package/lib/models/invites-ignorer-types.js +25 -25
  129. package/lib/models/invites-ignorer-types.js.map +1 -1
  130. package/lib/models/profile-keys.js +26 -26
  131. package/lib/models/profile-keys.js.map +1 -1
  132. package/lib/models/room-summary.js +26 -26
  133. package/lib/models/room-summary.js.map +1 -1
  134. package/lib/models/search-result.js +22 -22
  135. package/lib/models/search-result.js.map +1 -1
  136. package/lib/models/typed-event-emitter.js +122 -122
  137. package/lib/models/typed-event-emitter.js.map +1 -1
  138. package/lib/oidc/authorize.js +76 -76
  139. package/lib/oidc/authorize.js.map +1 -1
  140. package/lib/oidc/error.js +17 -17
  141. package/lib/oidc/error.js.map +1 -1
  142. package/lib/oidc/index.js +17 -17
  143. package/lib/oidc/index.js.map +1 -1
  144. package/lib/oidc/register.js +41 -41
  145. package/lib/oidc/register.js.map +1 -1
  146. package/lib/oidc/tokenRefresher.js +51 -51
  147. package/lib/oidc/tokenRefresher.js.map +1 -1
  148. package/lib/oidc/validate.js +59 -59
  149. package/lib/oidc/validate.js.map +1 -1
  150. package/lib/randomstring.js +35 -35
  151. package/lib/randomstring.js.map +1 -1
  152. package/lib/realtime-callbacks.js +39 -39
  153. package/lib/realtime-callbacks.js.map +1 -1
  154. package/lib/receipt-accumulator.js +44 -44
  155. package/lib/receipt-accumulator.js.map +1 -1
  156. package/lib/rendezvous/RendezvousChannel.js.map +1 -1
  157. package/lib/rendezvous/RendezvousCode.js.map +1 -1
  158. package/lib/rendezvous/RendezvousError.js +14 -14
  159. package/lib/rendezvous/RendezvousError.js.map +1 -1
  160. package/lib/rendezvous/RendezvousFailureReason.js +14 -14
  161. package/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
  162. package/lib/rendezvous/RendezvousIntent.js +14 -14
  163. package/lib/rendezvous/RendezvousIntent.js.map +1 -1
  164. package/lib/rendezvous/RendezvousTransport.js.map +1 -1
  165. package/lib/rendezvous/channels/MSC4108SecureChannel.js +63 -63
  166. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
  167. package/lib/rendezvous/channels/index.js +14 -14
  168. package/lib/rendezvous/channels/index.js.map +1 -1
  169. package/lib/rendezvous/index.js +14 -14
  170. package/lib/rendezvous/index.js.map +1 -1
  171. package/lib/rendezvous/transports/index.js +14 -14
  172. package/lib/rendezvous/transports/index.js.map +1 -1
  173. package/lib/rust-crypto/CrossSigningIdentity.js +29 -29
  174. package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
  175. package/lib/rust-crypto/OutgoingRequestsManager.js +37 -37
  176. package/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
  177. package/lib/rust-crypto/device-converter.js +30 -30
  178. package/lib/rust-crypto/device-converter.js.map +1 -1
  179. package/lib/rust-crypto/secret-storage.js +30 -30
  180. package/lib/rust-crypto/secret-storage.js.map +1 -1
  181. package/lib/service-types.js +14 -14
  182. package/lib/service-types.js.map +1 -1
  183. package/lib/store/local-storage-events-emitter.js +21 -21
  184. package/lib/store/local-storage-events-emitter.js.map +1 -1
  185. package/lib/sync-accumulator.js +50 -50
  186. package/lib/sync-accumulator.js.map +1 -1
  187. package/lib/thread-utils.js +20 -20
  188. package/lib/thread-utils.js.map +1 -1
  189. package/lib/types.js +34 -34
  190. package/lib/types.js.map +1 -1
  191. package/lib/utils/decryptAESSecretStorageItem.js +22 -22
  192. package/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
  193. package/lib/utils/encryptAESSecretStorageItem.js +26 -26
  194. package/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
  195. package/lib/utils/internal/deriveKeys.js +21 -21
  196. package/lib/utils/internal/deriveKeys.js.map +1 -1
  197. package/lib/utils/roomVersion.js +26 -26
  198. package/lib/utils/roomVersion.js.map +1 -1
  199. package/lib/version-support.js +26 -26
  200. package/lib/version-support.js.map +1 -1
  201. package/lib/webrtc/audioContext.js +24 -24
  202. package/lib/webrtc/audioContext.js.map +1 -1
  203. package/lib/webrtc/callEventTypes.js.map +1 -1
  204. package/lib/webrtc/stats/callFeedStatsReporter.js +14 -14
  205. package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
  206. package/lib/webrtc/stats/callStatsReportGatherer.js +14 -14
  207. package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  208. package/lib/webrtc/stats/callStatsReportSummary.js.map +1 -1
  209. package/lib/webrtc/stats/connectionStats.js +14 -14
  210. package/lib/webrtc/stats/connectionStats.js.map +1 -1
  211. package/lib/webrtc/stats/connectionStatsBuilder.js +14 -14
  212. package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
  213. package/lib/webrtc/stats/connectionStatsReportBuilder.js +14 -14
  214. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
  215. package/lib/webrtc/stats/groupCallStats.js +14 -14
  216. package/lib/webrtc/stats/groupCallStats.js.map +1 -1
  217. package/lib/webrtc/stats/media/mediaSsrcHandler.js +14 -14
  218. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
  219. package/lib/webrtc/stats/media/mediaTrackHandler.js +14 -14
  220. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
  221. package/lib/webrtc/stats/media/mediaTrackStats.js +27 -27
  222. package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
  223. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +20 -20
  224. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
  225. package/lib/webrtc/stats/statsReport.js +14 -14
  226. package/lib/webrtc/stats/statsReport.js.map +1 -1
  227. package/lib/webrtc/stats/statsReportEmitter.js +14 -14
  228. package/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
  229. package/lib/webrtc/stats/trackStatsBuilder.js +4 -4
  230. package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
  231. package/lib/webrtc/stats/transportStats.js.map +1 -1
  232. package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  233. package/lib/webrtc/stats/valueFormatter.js +11 -11
  234. package/lib/webrtc/stats/valueFormatter.js.map +1 -1
  235. package/lib/xrpl/identity.d.ts +28 -0
  236. package/lib/xrpl/identity.d.ts.map +1 -0
  237. package/lib/xrpl/identity.js +213 -0
  238. package/lib/xrpl/identity.js.map +1 -0
  239. package/lib/xrpl/trust.d.ts +8 -0
  240. package/lib/xrpl/trust.d.ts.map +1 -0
  241. package/lib/xrpl/trust.js +61 -0
  242. package/lib/xrpl/trust.js.map +1 -0
  243. package/lib/xrpl/verification.d.ts +26 -0
  244. package/lib/xrpl/verification.d.ts.map +1 -0
  245. package/lib/xrpl/verification.js +295 -0
  246. package/lib/xrpl/verification.js.map +1 -0
  247. package/package.json +128 -129
  248. package/src/@types/AESEncryptedSecretStoragePayload.ts +29 -29
  249. package/src/@types/IIdentityServerProvider.ts +24 -24
  250. package/src/@types/PushRules.ts +208 -208
  251. package/src/@types/another-json.d.ts +19 -19
  252. package/src/@types/auth.ts +280 -258
  253. package/src/@types/beacon.ts +140 -140
  254. package/src/@types/common.ts +24 -24
  255. package/src/@types/crypto.ts +71 -71
  256. package/src/@types/event.ts +476 -449
  257. package/src/@types/events.ts +119 -119
  258. package/src/@types/extensible_events.ts +147 -147
  259. package/src/@types/local_notifications.ts +19 -19
  260. package/src/@types/location.ts +92 -92
  261. package/src/@types/matrix-sdk-crypto-wasm.d.ts +39 -39
  262. package/src/@types/media.ts +245 -245
  263. package/src/@types/membership.ts +57 -57
  264. package/src/@types/partials.ts +103 -103
  265. package/src/@types/polls.ts +120 -120
  266. package/src/@types/read_receipts.ts +61 -61
  267. package/src/@types/registration.ts +102 -102
  268. package/src/@types/search.ts +119 -119
  269. package/src/@types/signed.ts +25 -25
  270. package/src/@types/spaces.ts +37 -37
  271. package/src/@types/state_events.ts +153 -153
  272. package/src/@types/synapse.ts +40 -40
  273. package/src/@types/sync.ts +27 -27
  274. package/src/@types/threepids.ts +29 -29
  275. package/src/@types/topic.ts +69 -69
  276. package/src/@types/uia.ts +24 -24
  277. package/src/NamespacedValue.ts +121 -121
  278. package/src/ReEmitter.ts +93 -93
  279. package/src/base64.ts +86 -86
  280. package/src/briij.ts +3 -0
  281. package/src/client.ts +90 -10
  282. package/src/common-crypto/README.md +4 -4
  283. package/src/common-crypto/key-passphrase.ts +43 -43
  284. package/src/content-helpers.ts +298 -298
  285. package/src/content-repo.ts +122 -122
  286. package/src/crypto/store/base.ts +388 -388
  287. package/src/crypto/store/indexeddb-crypto-store-backend.ts +655 -655
  288. package/src/crypto/store/indexeddb-crypto-store.ts +555 -555
  289. package/src/crypto/store/localStorage-crypto-store.ts +409 -409
  290. package/src/crypto/store/memory-crypto-store.ts +326 -326
  291. package/src/crypto-api/CryptoEventHandlerMap.ts +42 -42
  292. package/src/crypto-api/key-passphrase.ts +58 -58
  293. package/src/crypto-api/keybackup.ts +114 -114
  294. package/src/crypto-api/recovery-key.ts +69 -69
  295. package/src/digest.ts +34 -34
  296. package/src/extensible_events_v1/ExtensibleEvent.ts +58 -58
  297. package/src/extensible_events_v1/InvalidEventError.ts +24 -24
  298. package/src/extensible_events_v1/MessageEvent.ts +143 -143
  299. package/src/extensible_events_v1/PollEndEvent.ts +97 -97
  300. package/src/extensible_events_v1/PollResponseEvent.ts +148 -148
  301. package/src/extensible_events_v1/PollStartEvent.ts +207 -207
  302. package/src/extensible_events_v1/utilities.ts +35 -35
  303. package/src/feature.ts +88 -88
  304. package/src/http-api/method.ts +25 -25
  305. package/src/http-api/prefix.ts +48 -48
  306. package/src/indexeddb-helpers.ts +50 -50
  307. package/src/indexeddb-worker.ts +24 -24
  308. package/src/matrixrtc/IKeyTransport.ts +63 -63
  309. package/src/matrixrtc/IMembershipManager.ts +120 -120
  310. package/src/matrixrtc/LivekitTransport.ts +46 -46
  311. package/src/matrixrtc/index.ts +24 -24
  312. package/src/matrixrtc/utils.ts +71 -71
  313. package/src/models/ToDeviceMessage.ts +38 -38
  314. package/src/models/device.ts +85 -85
  315. package/src/models/event-status.ts +39 -39
  316. package/src/models/invites-ignorer-types.ts +58 -58
  317. package/src/models/profile-keys.ts +33 -33
  318. package/src/models/room-summary.ts +78 -78
  319. package/src/models/search-result.ts +57 -57
  320. package/src/models/typed-event-emitter.ts +246 -246
  321. package/src/oidc/authorize.ts +279 -279
  322. package/src/oidc/error.ts +33 -33
  323. package/src/oidc/index.ts +33 -33
  324. package/src/oidc/register.ts +163 -163
  325. package/src/oidc/tokenRefresher.ts +184 -184
  326. package/src/oidc/validate.ts +265 -265
  327. package/src/randomstring.ts +103 -103
  328. package/src/realtime-callbacks.ts +191 -191
  329. package/src/receipt-accumulator.ts +189 -189
  330. package/src/rendezvous/RendezvousChannel.ts +48 -48
  331. package/src/rendezvous/RendezvousCode.ts +25 -25
  332. package/src/rendezvous/RendezvousError.ts +26 -26
  333. package/src/rendezvous/RendezvousFailureReason.ts +49 -49
  334. package/src/rendezvous/RendezvousIntent.ts +20 -20
  335. package/src/rendezvous/RendezvousTransport.ts +58 -58
  336. package/src/rendezvous/channels/MSC4108SecureChannel.ts +270 -270
  337. package/src/rendezvous/channels/index.ts +17 -17
  338. package/src/rendezvous/index.ts +25 -25
  339. package/src/rendezvous/transports/index.ts +17 -17
  340. package/src/rust-crypto/CrossSigningIdentity.ts +195 -195
  341. package/src/rust-crypto/OutgoingRequestsManager.ts +170 -170
  342. package/src/rust-crypto/device-converter.ts +128 -128
  343. package/src/rust-crypto/secret-storage.ts +60 -60
  344. package/src/service-types.ts +20 -20
  345. package/src/store/local-storage-events-emitter.ts +46 -46
  346. package/src/sync-accumulator.ts +779 -779
  347. package/src/thread-utils.ts +31 -31
  348. package/src/types.ts +59 -59
  349. package/src/utils/decryptAESSecretStorageItem.ts +54 -54
  350. package/src/utils/encryptAESSecretStorageItem.ts +73 -73
  351. package/src/utils/internal/deriveKeys.ts +63 -63
  352. package/src/utils/roomVersion.ts +35 -35
  353. package/src/version-support.ts +50 -50
  354. package/src/webrtc/audioContext.ts +44 -44
  355. package/src/webrtc/callEventTypes.ts +101 -101
  356. package/src/webrtc/stats/callFeedStatsReporter.ts +91 -91
  357. package/src/webrtc/stats/callStatsReportGatherer.ts +219 -219
  358. package/src/webrtc/stats/callStatsReportSummary.ts +30 -30
  359. package/src/webrtc/stats/connectionStats.ts +47 -47
  360. package/src/webrtc/stats/connectionStatsBuilder.ts +28 -28
  361. package/src/webrtc/stats/connectionStatsReportBuilder.ts +140 -140
  362. package/src/webrtc/stats/groupCallStats.ts +93 -93
  363. package/src/webrtc/stats/media/mediaSsrcHandler.ts +57 -57
  364. package/src/webrtc/stats/media/mediaTrackHandler.ts +70 -70
  365. package/src/webrtc/stats/media/mediaTrackStats.ts +176 -176
  366. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +90 -90
  367. package/src/webrtc/stats/statsReport.ts +133 -133
  368. package/src/webrtc/stats/statsReportEmitter.ts +49 -49
  369. package/src/webrtc/stats/trackStatsBuilder.ts +207 -207
  370. package/src/webrtc/stats/transportStats.ts +26 -26
  371. package/src/webrtc/stats/transportStatsBuilder.ts +48 -48
  372. package/src/webrtc/stats/valueFormatter.ts +27 -27
  373. package/src/xrpl/identity.ts +245 -0
  374. package/src/xrpl/trust.ts +64 -0
  375. package/src/xrpl/verification.ts +284 -0
package/lib/client.js CHANGED
@@ -57,6 +57,7 @@ import { SearchOrderBy } from "./@types/search.js";
57
57
  import { PushRuleActionName, PushRuleKind } from "./@types/PushRules.js";
58
58
  import { GroupCall } from "./webrtc/groupCall.js";
59
59
  import { MediaHandler } from "./webrtc/mediaHandler.js";
60
+ import { XRPL_WALLET_LOGIN_TYPE } from "./@types/auth.js";
60
61
  import { TypedEventEmitter } from "./models/typed-event-emitter.js";
61
62
  import { MAIN_ROOM_TIMELINE, ReceiptType } from "./@types/read_receipts.js";
62
63
  import { SlidingSyncSdk } from "./sliding-sync-sdk.js";
@@ -75,6 +76,9 @@ import { KnownMembership } from "./@types/membership.js";
75
76
  import { ServerCapabilities } from "./serverCapabilities.js";
76
77
  import { sha256 } from "./digest.js";
77
78
  import { discoverAndValidateOIDCIssuerWellKnown, validateAuthMetadataAndKeys } from "./oidc/index.js";
79
+ import { configureXrplIdentityMinting, mintSoulboundIdentityNFT } from "./xrpl/identity.js";
80
+ import { XRPL_VERIFIED_EVENT, XRPL_VERIFY_ACCEPT_EVENT, XRPL_VERIFY_REQUEST_EVENT } from "./xrpl/verification.js";
81
+ import { configureXrplTrust } from "./xrpl/trust.js";
78
82
  import { UnsupportedDelayedEventsEndpointError, UnsupportedStickyEventsEndpointError } from "./errors.js";
79
83
  var SCROLLBACK_DELAY_MS = 3000;
80
84
  var TURN_CHECK_INTERVAL = 10 * 60 * 1000; // poll for turn credentials every 10 minutes
@@ -307,6 +311,9 @@ export var ClientEvent = /*#__PURE__*/function (ClientEvent) {
307
311
  */
308
312
  ClientEvent["ClientWellKnown"] = "WellKnown.client";
309
313
  ClientEvent["ReceivedVoipEvent"] = "received_voip_event";
314
+ ClientEvent["XrplVerificationRequest"] = "xrpl.verification.request";
315
+ ClientEvent["XrplVerificationAccept"] = "xrpl.verification.accept";
316
+ ClientEvent["XrplVerified"] = "xrpl.verification.verified";
310
317
  ClientEvent["TurnServers"] = "turnServers";
311
318
  ClientEvent["TurnServersError"] = "turnServers.error";
312
319
  return ClientEvent;
@@ -433,6 +440,19 @@ export class BriijClient extends TypedEventEmitter {
433
440
  _defineProperty(this, "ignoredInvites", void 0);
434
441
  _defineProperty(this, "matrixRTC", void 0);
435
442
  _defineProperty(this, "serverCapabilitiesService", void 0);
443
+ _defineProperty(this, "dispatchXrplVerificationEvents", event => {
444
+ if (event.getType() === XRPL_VERIFY_REQUEST_EVENT) {
445
+ this.emit(ClientEvent.XrplVerificationRequest, event);
446
+ return;
447
+ }
448
+ if (event.getType() === XRPL_VERIFY_ACCEPT_EVENT) {
449
+ this.emit(ClientEvent.XrplVerificationAccept, event);
450
+ return;
451
+ }
452
+ if (event.getType() === XRPL_VERIFIED_EVENT) {
453
+ this.emit(ClientEvent.XrplVerified, event);
454
+ }
455
+ });
436
456
  _defineProperty(this, "startCallEventHandler", () => {
437
457
  if (this.isInitialSyncComplete()) {
438
458
  if (supportsBriijCall()) {
@@ -540,6 +560,7 @@ export class BriijClient extends TypedEventEmitter {
540
560
  this.matrixRTC = new BriijRTCSessionManager(this.logger, this);
541
561
  this.serverCapabilitiesService = new ServerCapabilities(this.logger, this.http);
542
562
  this.on(ClientEvent.Sync, this.fixupRoomNotifications);
563
+ this.on(ClientEvent.Event, this.dispatchXrplVerificationEvents);
543
564
  this.timelineSupport = Boolean(opts.timelineSupport);
544
565
  this.legacyCryptoStore = opts.cryptoStore;
545
566
  this.verificationMethods = opts.verificationMethods;
@@ -575,7 +596,6 @@ export class BriijClient extends TypedEventEmitter {
575
596
  get store() {
576
597
  return this._store;
577
598
  }
578
-
579
599
  /**
580
600
  * High level helper method to begin syncing and poll for new events. To listen for these
581
601
  * events, add a listener for {@link ClientEvent.Event}
@@ -5228,17 +5248,36 @@ export class BriijClient extends TypedEventEmitter {
5228
5248
  * results. See https://github.com/matrix-org/briij-js-sdk/issues/4502.
5229
5249
  */
5230
5250
  login(loginType, data) {
5231
- return this.loginRequest(_objectSpread(_objectSpread({}, data), {}, {
5232
- type: loginType
5233
- })).then(response => {
5251
+ var _this55 = this;
5252
+ return _asyncToGenerator(function* () {
5253
+ var response = yield _this55.loginRequest(_objectSpread(_objectSpread({}, data), {}, {
5254
+ type: loginType
5255
+ }));
5234
5256
  if (response.access_token && response.user_id) {
5235
- this.http.opts.accessToken = response.access_token;
5236
- this.credentials = {
5257
+ _this55.http.opts.accessToken = response.access_token;
5258
+ _this55.credentials = {
5237
5259
  userId: response.user_id
5238
5260
  };
5261
+ configureXrplTrust({
5262
+ homeserverBaseUrl: _this55.baseUrl,
5263
+ accessToken: response.access_token
5264
+ });
5265
+ }
5266
+
5267
+ // 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
+ });
5273
+ try {
5274
+ yield mintSoulboundIdentityNFT(response.user_id);
5275
+ } catch (error) {
5276
+ logger.warn("XRPL identity NFT minting skipped/failed", error);
5277
+ }
5239
5278
  }
5240
5279
  return response;
5241
- });
5280
+ })();
5242
5281
  }
5243
5282
 
5244
5283
  /**
@@ -5256,6 +5295,30 @@ export class BriijClient extends TypedEventEmitter {
5256
5295
  });
5257
5296
  }
5258
5297
 
5298
+ /**
5299
+ * @param user - Matrix user ID localpart or fully qualified MXID.
5300
+ * @param walletAddress - XRPL/Xahau classic wallet address.
5301
+ * @param signature - Hex signature for the challenge message.
5302
+ * @param challenge - Signed challenge payload.
5303
+ * @param network - Ledger network identifier. Defaults to `xrpl`.
5304
+ * @returns Promise which resolves to a LoginResponse object.
5305
+ * @returns Rejects: with an error response.
5306
+ */
5307
+ loginWithXrplWallet(user, walletAddress, signature, challenge) {
5308
+ var network = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "xrpl";
5309
+ return this.login(XRPL_WALLET_LOGIN_TYPE, {
5310
+ user: user,
5311
+ identifier: {
5312
+ type: "m.id.user",
5313
+ user: user
5314
+ },
5315
+ wallet_address: walletAddress,
5316
+ signature: signature,
5317
+ challenge: typeof challenge === "string" ? challenge : JSON.stringify(challenge),
5318
+ network: network
5319
+ });
5320
+ }
5321
+
5259
5322
  /**
5260
5323
  * @param redirectUrl - The URL to redirect to after the HS
5261
5324
  * authenticates with CAS.
@@ -5316,9 +5379,9 @@ export class BriijClient extends TypedEventEmitter {
5316
5379
  * @param data - Credentials and other details for the login request.
5317
5380
  */
5318
5381
  loginRequest(data) {
5319
- var _this55 = this;
5382
+ var _this56 = this;
5320
5383
  return _asyncToGenerator(function* () {
5321
- return yield _this55.http.authedRequest(Method.Post, "/login", undefined, data);
5384
+ return yield _this56.http.authedRequest(Method.Post, "/login", undefined, data);
5322
5385
  })();
5323
5386
  }
5324
5387
 
@@ -5333,14 +5396,14 @@ export class BriijClient extends TypedEventEmitter {
5333
5396
  */
5334
5397
  logout() {
5335
5398
  var _arguments13 = arguments,
5336
- _this56 = this;
5399
+ _this57 = this;
5337
5400
  return _asyncToGenerator(function* () {
5338
5401
  var stopClient = _arguments13.length > 0 && _arguments13[0] !== undefined ? _arguments13[0] : false;
5339
5402
  if (stopClient) {
5340
- _this56.stopClient();
5341
- _this56.http.abort();
5403
+ _this57.stopClient();
5404
+ _this57.http.abort();
5342
5405
  }
5343
- return _this56.http.authedRequest(Method.Post, "/logout");
5406
+ return _this57.http.authedRequest(Method.Post, "/logout");
5344
5407
  })();
5345
5408
  }
5346
5409
 
@@ -5378,12 +5441,12 @@ export class BriijClient extends TypedEventEmitter {
5378
5441
  * or UIA auth data.
5379
5442
  */
5380
5443
  requestLoginToken(auth) {
5381
- var _this57 = this;
5444
+ var _this58 = this;
5382
5445
  return _asyncToGenerator(function* () {
5383
5446
  var body = {
5384
5447
  auth
5385
5448
  };
5386
- return _this57.http.authedRequest(Method.Post, "/login/get_token", undefined,
5449
+ return _this58.http.authedRequest(Method.Post, "/login/get_token", undefined,
5387
5450
  // no query params
5388
5451
  body, {
5389
5452
  prefix: ClientPrefix.V1
@@ -5415,23 +5478,23 @@ export class BriijClient extends TypedEventEmitter {
5415
5478
  * @returns Rejects: with an error response.
5416
5479
  */
5417
5480
  createRoom(options) {
5418
- var _this58 = this;
5481
+ var _this59 = this;
5419
5482
  return _asyncToGenerator(function* () {
5420
- var _this58$identityServe;
5483
+ var _this59$identityServe;
5421
5484
  // eslint-disable-line camelcase
5422
5485
  // some valid options include: room_alias_name, visibility, invite
5423
5486
 
5424
5487
  // inject the id_access_token if inviting 3rd party addresses
5425
5488
  var invitesNeedingToken = (options.invite_3pid || []).filter(i => !i.id_access_token);
5426
- if (invitesNeedingToken.length > 0 && (_this58$identityServe = _this58.identityServer) !== null && _this58$identityServe !== void 0 && _this58$identityServe.getAccessToken) {
5427
- var identityAccessToken = yield _this58.identityServer.getAccessToken();
5489
+ if (invitesNeedingToken.length > 0 && (_this59$identityServe = _this59.identityServer) !== null && _this59$identityServe !== void 0 && _this59$identityServe.getAccessToken) {
5490
+ var identityAccessToken = yield _this59.identityServer.getAccessToken();
5428
5491
  if (identityAccessToken) {
5429
5492
  for (var invite of invitesNeedingToken) {
5430
5493
  invite.id_access_token = identityAccessToken;
5431
5494
  }
5432
5495
  }
5433
5496
  }
5434
- return _this58.http.authedRequest(Method.Post, "/createRoom", undefined, options);
5497
+ return _this59.http.authedRequest(Method.Post, "/createRoom", undefined, options);
5435
5498
  })();
5436
5499
  }
5437
5500
 
@@ -5577,11 +5640,11 @@ export class BriijClient extends TypedEventEmitter {
5577
5640
  */
5578
5641
  sendStateEvent(roomId, eventType, content) {
5579
5642
  var _arguments14 = arguments,
5580
- _this59 = this;
5643
+ _this60 = this;
5581
5644
  return _asyncToGenerator(function* () {
5582
5645
  var stateKey = _arguments14.length > 3 && _arguments14[3] !== undefined ? _arguments14[3] : "";
5583
5646
  var opts = _arguments14.length > 4 && _arguments14[4] !== undefined ? _arguments14[4] : {};
5584
- var room = _this59.getRoom(roomId);
5647
+ var room = _this60.getRoom(roomId);
5585
5648
  var event = new BriijEvent({
5586
5649
  room_id: roomId,
5587
5650
  type: eventType,
@@ -5589,7 +5652,7 @@ export class BriijClient extends TypedEventEmitter {
5589
5652
  // Cast safety: StateEvents[K] is a stronger bound than IContent, which has [key: string]: any
5590
5653
  content: content
5591
5654
  });
5592
- yield _this59.encryptStateEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
5655
+ yield _this60.encryptStateEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
5593
5656
  var pathParams = {
5594
5657
  $roomId: roomId,
5595
5658
  $eventType: event.getWireType(),
@@ -5599,36 +5662,36 @@ export class BriijClient extends TypedEventEmitter {
5599
5662
  if (stateKey !== undefined) {
5600
5663
  path = utils.encodeUri(path + "/$stateKey", pathParams);
5601
5664
  }
5602
- return _this59.http.authedRequest(Method.Put, path, undefined, event.getWireContent(), opts);
5665
+ return _this60.http.authedRequest(Method.Put, path, undefined, event.getWireContent(), opts);
5603
5666
  })();
5604
5667
  }
5605
5668
  encryptStateEventIfNeeded(event, room) {
5606
- var _this60 = this;
5669
+ var _this61 = this;
5607
5670
  return _asyncToGenerator(function* () {
5608
- if (!_this60.enableEncryptedStateEvents) {
5671
+ if (!_this61.enableEncryptedStateEvents) {
5609
5672
  return;
5610
5673
  }
5611
5674
 
5612
5675
  // If the room is unknown, we cannot encrypt for it
5613
5676
  if (!room) return;
5614
- if (!_this60.cryptoBackend && _this60.usingExternalCrypto) {
5677
+ if (!_this61.cryptoBackend && _this61.usingExternalCrypto) {
5615
5678
  // The client has opted to allow sending messages to encrypted
5616
5679
  // rooms even if the room is encrypted, and we haven't set up
5617
5680
  // crypto. This is useful for users of matrix-org/pantalaimon
5618
5681
  return;
5619
5682
  }
5620
- if (!_this60.cryptoBackend) {
5683
+ if (!_this61.cryptoBackend) {
5621
5684
  throw new Error("This room is configured to use encryption, but your client does not support encryption.");
5622
5685
  }
5623
5686
 
5624
5687
  // Check regular encryption conditions.
5625
- if (!(yield _this60.shouldEncryptEventForRoom(event, room))) {
5688
+ if (!(yield _this61.shouldEncryptEventForRoom(event, room))) {
5626
5689
  return;
5627
5690
  }
5628
5691
 
5629
5692
  // If the crypto impl thinks we shouldn't encrypt, then we shouldn't.
5630
5693
  // Safety: we checked the crypto impl exists above.
5631
- if (!(yield _this60.cryptoBackend.isStateEncryptionEnabledInRoom(room.roomId))) {
5694
+ if (!(yield _this61.cryptoBackend.isStateEncryptionEnabledInRoom(room.roomId))) {
5632
5695
  return;
5633
5696
  }
5634
5697
 
@@ -5636,7 +5699,7 @@ export class BriijClient extends TypedEventEmitter {
5636
5699
  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())) {
5637
5700
  return;
5638
5701
  }
5639
- yield _this60.cryptoBackend.encryptEvent(event, room);
5702
+ yield _this61.cryptoBackend.encryptEvent(event, room);
5640
5703
  })();
5641
5704
  }
5642
5705
 
@@ -5669,7 +5732,7 @@ export class BriijClient extends TypedEventEmitter {
5669
5732
  * @returns Promise which resolves: the empty object, `{}`.
5670
5733
  */
5671
5734
  setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId) {
5672
- var _this61 = this;
5735
+ var _this62 = this;
5673
5736
  return _asyncToGenerator(function* () {
5674
5737
  var path = utils.encodeUri("/rooms/$roomId/read_markers", {
5675
5738
  $roomId: roomId
@@ -5678,10 +5741,10 @@ export class BriijClient extends TypedEventEmitter {
5678
5741
  [ReceiptType.FullyRead]: rmEventId,
5679
5742
  [ReceiptType.Read]: rrEventId
5680
5743
  };
5681
- if ((yield _this61.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this61.isVersionSupported("v1.4"))) {
5744
+ if ((yield _this62.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this62.isVersionSupported("v1.4"))) {
5682
5745
  content[ReceiptType.ReadPrivate] = rpEventId;
5683
5746
  }
5684
- return _this61.http.authedRequest(Method.Post, path, undefined, content);
5747
+ return _this62.http.authedRequest(Method.Post, path, undefined, content);
5685
5748
  })();
5686
5749
  }
5687
5750
 
@@ -5915,9 +5978,9 @@ export class BriijClient extends TypedEventEmitter {
5915
5978
  * @returns `true` if supported, otherwise `false`
5916
5979
  */
5917
5980
  doesServerSupportExtendedProfiles() {
5918
- var _this62 = this;
5981
+ var _this63 = this;
5919
5982
  return _asyncToGenerator(function* () {
5920
- return (yield _this62.isVersionSupported("v1.16")) || (yield _this62.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) || (yield _this62.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES));
5983
+ return (yield _this63.isVersionSupported("v1.16")) || (yield _this63.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) || (yield _this63.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES));
5921
5984
  })();
5922
5985
  }
5923
5986
 
@@ -5927,9 +5990,9 @@ export class BriijClient extends TypedEventEmitter {
5927
5990
  * @returns The prefix for use with `authedRequest`
5928
5991
  */
5929
5992
  getExtendedProfileRequestPrefix() {
5930
- var _this63 = this;
5993
+ var _this64 = this;
5931
5994
  return _asyncToGenerator(function* () {
5932
- if ((yield _this63.isVersionSupported("v1.16")) || (yield _this63.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))) {
5995
+ if ((yield _this64.isVersionSupported("v1.16")) || (yield _this64.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))) {
5933
5996
  return ClientPrefix.V3;
5934
5997
  }
5935
5998
  return "/_matrix/client/unstable/uk.tcpip.msc4133";
@@ -5947,15 +6010,15 @@ export class BriijClient extends TypedEventEmitter {
5947
6010
  * @throws A M_NOT_FOUND error if the profile could not be found.
5948
6011
  */
5949
6012
  getExtendedProfile(userId) {
5950
- var _this64 = this;
6013
+ var _this65 = this;
5951
6014
  return _asyncToGenerator(function* () {
5952
- if (!(yield _this64.doesServerSupportExtendedProfiles())) {
6015
+ if (!(yield _this65.doesServerSupportExtendedProfiles())) {
5953
6016
  throw new Error("Server does not support extended profiles");
5954
6017
  }
5955
- return _this64.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
6018
+ return _this65.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
5956
6019
  $userId: userId
5957
6020
  }), undefined, undefined, {
5958
- prefix: yield _this64.getExtendedProfileRequestPrefix()
6021
+ prefix: yield _this65.getExtendedProfileRequestPrefix()
5959
6022
  });
5960
6023
  })();
5961
6024
  }
@@ -5972,16 +6035,16 @@ export class BriijClient extends TypedEventEmitter {
5972
6035
  * @throws A M_NOT_FOUND error if the key was not set OR the profile could not be found.
5973
6036
  */
5974
6037
  getExtendedProfileProperty(userId, key) {
5975
- var _this65 = this;
6038
+ var _this66 = this;
5976
6039
  return _asyncToGenerator(function* () {
5977
- if (!(yield _this65.doesServerSupportExtendedProfiles())) {
6040
+ if (!(yield _this66.doesServerSupportExtendedProfiles())) {
5978
6041
  throw new Error("Server does not support extended profiles");
5979
6042
  }
5980
- var profile = yield _this65.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
6043
+ var profile = yield _this66.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
5981
6044
  $userId: userId,
5982
6045
  $key: key
5983
6046
  }), undefined, undefined, {
5984
- prefix: yield _this65.getExtendedProfileRequestPrefix()
6047
+ prefix: yield _this66.getExtendedProfileRequestPrefix()
5985
6048
  });
5986
6049
  return profile[key];
5987
6050
  })();
@@ -5997,19 +6060,19 @@ export class BriijClient extends TypedEventEmitter {
5997
6060
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
5998
6061
  */
5999
6062
  setExtendedProfileProperty(key, value) {
6000
- var _this66 = this;
6063
+ var _this67 = this;
6001
6064
  return _asyncToGenerator(function* () {
6002
- if (!(yield _this66.doesServerSupportExtendedProfiles())) {
6065
+ if (!(yield _this67.doesServerSupportExtendedProfiles())) {
6003
6066
  throw new Error("Server does not support extended profiles");
6004
6067
  }
6005
- var userId = _this66.getUserId();
6006
- yield _this66.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
6068
+ var userId = _this67.getUserId();
6069
+ yield _this67.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
6007
6070
  $userId: userId,
6008
6071
  $key: key
6009
6072
  }), undefined, {
6010
6073
  [key]: value
6011
6074
  }, {
6012
- prefix: yield _this66.getExtendedProfileRequestPrefix()
6075
+ prefix: yield _this67.getExtendedProfileRequestPrefix()
6013
6076
  });
6014
6077
  })();
6015
6078
  }
@@ -6023,17 +6086,17 @@ export class BriijClient extends TypedEventEmitter {
6023
6086
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6024
6087
  */
6025
6088
  deleteExtendedProfileProperty(key) {
6026
- var _this67 = this;
6089
+ var _this68 = this;
6027
6090
  return _asyncToGenerator(function* () {
6028
- if (!(yield _this67.doesServerSupportExtendedProfiles())) {
6091
+ if (!(yield _this68.doesServerSupportExtendedProfiles())) {
6029
6092
  throw new Error("Server does not support extended profiles");
6030
6093
  }
6031
- var userId = _this67.getUserId();
6032
- yield _this67.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
6094
+ var userId = _this68.getUserId();
6095
+ yield _this68.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
6033
6096
  $userId: userId,
6034
6097
  $key: key
6035
6098
  }), undefined, undefined, {
6036
- prefix: yield _this67.getExtendedProfileRequestPrefix()
6099
+ prefix: yield _this68.getExtendedProfileRequestPrefix()
6037
6100
  });
6038
6101
  })();
6039
6102
  }
@@ -6049,16 +6112,16 @@ export class BriijClient extends TypedEventEmitter {
6049
6112
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6050
6113
  */
6051
6114
  patchExtendedProfile(profile) {
6052
- var _this68 = this;
6115
+ var _this69 = this;
6053
6116
  return _asyncToGenerator(function* () {
6054
- if (!(yield _this68.doesServerSupportExtendedProfiles())) {
6117
+ if (!(yield _this69.doesServerSupportExtendedProfiles())) {
6055
6118
  throw new Error("Server does not support extended profiles");
6056
6119
  }
6057
- var userId = _this68.getUserId();
6058
- return _this68.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
6120
+ var userId = _this69.getUserId();
6121
+ return _this69.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
6059
6122
  $userId: userId
6060
6123
  }), {}, profile, {
6061
- prefix: yield _this68.getExtendedProfileRequestPrefix()
6124
+ prefix: yield _this69.getExtendedProfileRequestPrefix()
6062
6125
  });
6063
6126
  })();
6064
6127
  }
@@ -6073,16 +6136,16 @@ export class BriijClient extends TypedEventEmitter {
6073
6136
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6074
6137
  */
6075
6138
  setExtendedProfile(profile) {
6076
- var _this69 = this;
6139
+ var _this70 = this;
6077
6140
  return _asyncToGenerator(function* () {
6078
- if (!(yield _this69.doesServerSupportExtendedProfiles())) {
6141
+ if (!(yield _this70.doesServerSupportExtendedProfiles())) {
6079
6142
  throw new Error("Server does not support extended profiles");
6080
6143
  }
6081
- var userId = _this69.getUserId();
6082
- yield _this69.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
6144
+ var userId = _this70.getUserId();
6145
+ yield _this70.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
6083
6146
  $userId: userId
6084
6147
  }), {}, profile, {
6085
- prefix: yield _this69.getExtendedProfileRequestPrefix()
6148
+ prefix: yield _this70.getExtendedProfileRequestPrefix()
6086
6149
  });
6087
6150
  })();
6088
6151
  }
@@ -6105,10 +6168,10 @@ export class BriijClient extends TypedEventEmitter {
6105
6168
  * @returns Rejects: with an error response.
6106
6169
  */
6107
6170
  addThreePidOnly(data) {
6108
- var _this70 = this;
6171
+ var _this71 = this;
6109
6172
  return _asyncToGenerator(function* () {
6110
6173
  var path = "/account/3pid/add";
6111
- return _this70.http.authedRequest(Method.Post, path, undefined, data);
6174
+ return _this71.http.authedRequest(Method.Post, path, undefined, data);
6112
6175
  })();
6113
6176
  }
6114
6177
 
@@ -6124,10 +6187,10 @@ export class BriijClient extends TypedEventEmitter {
6124
6187
  * @returns Rejects: with an error response.
6125
6188
  */
6126
6189
  bindThreePid(data) {
6127
- var _this71 = this;
6190
+ var _this72 = this;
6128
6191
  return _asyncToGenerator(function* () {
6129
6192
  var path = "/account/3pid/bind";
6130
- return _this71.http.authedRequest(Method.Post, path, undefined, data);
6193
+ return _this72.http.authedRequest(Method.Post, path, undefined, data);
6131
6194
  })();
6132
6195
  }
6133
6196
 
@@ -6145,15 +6208,15 @@ export class BriijClient extends TypedEventEmitter {
6145
6208
  unbindThreePid(medium, address
6146
6209
  // eslint-disable-next-line camelcase
6147
6210
  ) {
6148
- var _this72 = this;
6211
+ var _this73 = this;
6149
6212
  return _asyncToGenerator(function* () {
6150
6213
  var path = "/account/3pid/unbind";
6151
6214
  var data = {
6152
6215
  medium,
6153
6216
  address,
6154
- id_server: _this72.getIdentityServerUrl(true)
6217
+ id_server: _this73.getIdentityServerUrl(true)
6155
6218
  };
6156
- return _this72.http.authedRequest(Method.Post, path, undefined, data);
6219
+ return _this73.http.authedRequest(Method.Post, path, undefined, data);
6157
6220
  })();
6158
6221
  }
6159
6222
 
@@ -6275,13 +6338,13 @@ export class BriijClient extends TypedEventEmitter {
6275
6338
  * @returns Rejects: with an error response.
6276
6339
  */
6277
6340
  getPushers() {
6278
- var _this73 = this;
6341
+ var _this74 = this;
6279
6342
  return _asyncToGenerator(function* () {
6280
- var response = yield _this73.http.authedRequest(Method.Get, "/pushers");
6343
+ var response = yield _this74.http.authedRequest(Method.Get, "/pushers");
6281
6344
 
6282
6345
  // Migration path for clients that connect to a homeserver that does not support
6283
6346
  // MSC3881 yet, see https://github.com/matrix-org/matrix-spec-proposals/blob/kerry/remote-push-toggle/proposals/3881-remote-push-notification-toggling.md#migration
6284
- if (!(yield _this73.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
6347
+ if (!(yield _this74.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
6285
6348
  response.pushers = response.pushers.map(pusher => {
6286
6349
  if (!pusher.hasOwnProperty(PUSHER_ENABLED.name)) {
6287
6350
  pusher[PUSHER_ENABLED.name] = true;
@@ -6711,7 +6774,7 @@ export class BriijClient extends TypedEventEmitter {
6711
6774
  * found MXIDs. Results where no user could be found will not be listed.
6712
6775
  */
6713
6776
  identityHashedLookup(addressPairs, identityAccessToken) {
6714
- var _this74 = this;
6777
+ var _this75 = this;
6715
6778
  return _asyncToGenerator(function* () {
6716
6779
  var params = {
6717
6780
  // addresses: ["email@example.org", "10005550000"],
@@ -6720,7 +6783,7 @@ export class BriijClient extends TypedEventEmitter {
6720
6783
  };
6721
6784
 
6722
6785
  // Get hash information first before trying to do a lookup
6723
- var hashes = yield _this74.getIdentityHashDetails(identityAccessToken);
6786
+ var hashes = yield _this75.getIdentityHashDetails(identityAccessToken);
6724
6787
  if (!hashes || !hashes["lookup_pepper"] || !hashes["algorithms"]) {
6725
6788
  throw new Error("Unsupported identity server: bad response");
6726
6789
  }
@@ -6763,7 +6826,7 @@ export class BriijClient extends TypedEventEmitter {
6763
6826
  } else {
6764
6827
  throw new Error("Unsupported identity server: unknown hash algorithm");
6765
6828
  }
6766
- var response = yield _this74.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
6829
+ var response = yield _this75.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
6767
6830
  if (!(response !== null && response !== void 0 && response["mappings"])) return []; // no results
6768
6831
 
6769
6832
  var foundAddresses = [];
@@ -6797,12 +6860,12 @@ export class BriijClient extends TypedEventEmitter {
6797
6860
  * @returns Rejects: with an error response.
6798
6861
  */
6799
6862
  lookupThreePid(medium, address, identityAccessToken) {
6800
- var _this75 = this;
6863
+ var _this76 = this;
6801
6864
  return _asyncToGenerator(function* () {
6802
6865
  // Note: we're using the V2 API by calling this function, but our
6803
6866
  // function contract requires a V1 response. We therefore have to
6804
6867
  // convert it manually.
6805
- var response = yield _this75.identityHashedLookup([[address, medium]], identityAccessToken);
6868
+ var response = yield _this76.identityHashedLookup([[address, medium]], identityAccessToken);
6806
6869
  var result = response.find(p => p.address === address);
6807
6870
  if (!result) {
6808
6871
  return {};
@@ -6834,12 +6897,12 @@ export class BriijClient extends TypedEventEmitter {
6834
6897
  * @returns Rejects: with an error response.
6835
6898
  */
6836
6899
  bulkLookupThreePids(query, identityAccessToken) {
6837
- var _this76 = this;
6900
+ var _this77 = this;
6838
6901
  return _asyncToGenerator(function* () {
6839
6902
  // Note: we're using the V2 API by calling this function, but our
6840
6903
  // function contract requires a V1 response. We therefore have to
6841
6904
  // convert it manually.
6842
- var response = yield _this76.identityHashedLookup(
6905
+ var response = yield _this77.identityHashedLookup(
6843
6906
  // We have to reverse the query order to get [address, medium] pairs
6844
6907
  query.map(p => [p[1], p[0]]), identityAccessToken);
6845
6908
  var v1results = [];
@@ -6913,16 +6976,16 @@ export class BriijClient extends TypedEventEmitter {
6913
6976
  * @returns Promise which resolves once queued there is no error feedback when sending fails.
6914
6977
  */
6915
6978
  encryptAndSendToDevice(eventType, devices, payload) {
6916
- var _this77 = this;
6979
+ var _this78 = this;
6917
6980
  return _asyncToGenerator(function* () {
6918
- if (!_this77.cryptoBackend) {
6981
+ if (!_this78.cryptoBackend) {
6919
6982
  throw new Error("Cannot encrypt to device event, your client does not support encryption.");
6920
6983
  }
6921
- var batch = yield _this77.cryptoBackend.encryptToDeviceMessages(eventType, devices, payload);
6984
+ var batch = yield _this78.cryptoBackend.encryptToDeviceMessages(eventType, devices, payload);
6922
6985
 
6923
6986
  // TODO The batch mechanism removes all possibility to get error feedbacks..
6924
6987
  // We might want instead to do the API call directly and pass the errors back.
6925
- yield _this77.queueToDevice(batch);
6988
+ yield _this78.queueToDevice(batch);
6926
6989
  })();
6927
6990
  }
6928
6991
 
@@ -7079,16 +7142,16 @@ export class BriijClient extends TypedEventEmitter {
7079
7142
  * @returns Promise which resolves to the created space.
7080
7143
  */
7081
7144
  unstableCreateFileTree(name) {
7082
- var _this78 = this;
7145
+ var _this79 = this;
7083
7146
  return _asyncToGenerator(function* () {
7084
7147
  var {
7085
7148
  room_id: roomId
7086
- } = yield _this78.createRoom({
7149
+ } = yield _this79.createRoom({
7087
7150
  name: name,
7088
7151
  preset: Preset.PrivateChat,
7089
7152
  power_level_content_override: _objectSpread(_objectSpread({}, DEFAULT_TREE_POWER_LEVELS_TEMPLATE), {}, {
7090
7153
  users: {
7091
- [_this78.getUserId()]: 100
7154
+ [_this79.getUserId()]: 100
7092
7155
  }
7093
7156
  }),
7094
7157
  creation_content: {
@@ -7108,7 +7171,7 @@ export class BriijClient extends TypedEventEmitter {
7108
7171
  }
7109
7172
  }]
7110
7173
  });
7111
- return new MSC3089TreeSpace(_this78, roomId);
7174
+ return new MSC3089TreeSpace(_this79, roomId);
7112
7175
  })();
7113
7176
  }
7114
7177
 
@@ -7185,7 +7248,7 @@ export class BriijClient extends TypedEventEmitter {
7185
7248
  * @param via - The list of servers which know about the room if only an ID was provided.
7186
7249
  */
7187
7250
  getRoomSummary(roomIdOrAlias, via) {
7188
- var _this79 = this;
7251
+ var _this80 = this;
7189
7252
  return _asyncToGenerator(function* () {
7190
7253
  var paramOpts = {
7191
7254
  prefix: "/_matrix/client/unstable/im.nheko.summary"
@@ -7194,7 +7257,7 @@ export class BriijClient extends TypedEventEmitter {
7194
7257
  var path = utils.encodeUri("/summary/$roomid", {
7195
7258
  $roomid: roomIdOrAlias
7196
7259
  });
7197
- return yield _this79.http.authedRequest(Method.Get, path, {
7260
+ return yield _this80.http.authedRequest(Method.Get, path, {
7198
7261
  via
7199
7262
  }, undefined, paramOpts);
7200
7263
  } catch (e) {
@@ -7202,7 +7265,7 @@ export class BriijClient extends TypedEventEmitter {
7202
7265
  var _path = utils.encodeUri("/rooms/$roomid/summary", {
7203
7266
  $roomid: roomIdOrAlias
7204
7267
  });
7205
- return yield _this79.http.authedRequest(Method.Get, _path, {
7268
+ return yield _this80.http.authedRequest(Method.Get, _path, {
7206
7269
  via
7207
7270
  }, undefined, paramOpts);
7208
7271
  } else {
@@ -7254,9 +7317,9 @@ export class BriijClient extends TypedEventEmitter {
7254
7317
  * Fetches information about the user for the configured access token.
7255
7318
  */
7256
7319
  whoami() {
7257
- var _this80 = this;
7320
+ var _this81 = this;
7258
7321
  return _asyncToGenerator(function* () {
7259
- return _this80.http.authedRequest(Method.Get, "/account/whoami");
7322
+ return _this81.http.authedRequest(Method.Get, "/account/whoami");
7260
7323
  })();
7261
7324
  }
7262
7325
 
@@ -7267,7 +7330,7 @@ export class BriijClient extends TypedEventEmitter {
7267
7330
  * @returns Rejects: when the request fails (module:http-api.BriijError)
7268
7331
  */
7269
7332
  timestampToEvent(roomId, timestamp, dir) {
7270
- var _this81 = this;
7333
+ var _this82 = this;
7271
7334
  return _asyncToGenerator(function* () {
7272
7335
  var path = utils.encodeUri("/rooms/$roomId/timestamp_to_event", {
7273
7336
  $roomId: roomId
@@ -7277,7 +7340,7 @@ export class BriijClient extends TypedEventEmitter {
7277
7340
  dir: dir
7278
7341
  };
7279
7342
  try {
7280
- return yield _this81.http.authedRequest(Method.Get, path, queryParams, undefined, {
7343
+ return yield _this82.http.authedRequest(Method.Get, path, queryParams, undefined, {
7281
7344
  prefix: ClientPrefix.V1
7282
7345
  });
7283
7346
  } catch (err) {
@@ -7293,7 +7356,7 @@ export class BriijClient extends TypedEventEmitter {
7293
7356
  // both indicate that this endpoint+verb combination is
7294
7357
  // not supported.
7295
7358
  err.httpStatus === 404 || err.httpStatus === 405)) {
7296
- return yield _this81.http.authedRequest(Method.Get, path, queryParams, undefined, {
7359
+ return yield _this82.http.authedRequest(Method.Get, path, queryParams, undefined, {
7297
7360
  prefix: "/_matrix/client/unstable/org.matrix.msc3030"
7298
7361
  });
7299
7362
  }
@@ -7313,12 +7376,12 @@ export class BriijClient extends TypedEventEmitter {
7313
7376
  * @throws when delegated auth config is invalid or unreachable
7314
7377
  */
7315
7378
  getAuthMetadata() {
7316
- var _this82 = this;
7379
+ var _this83 = this;
7317
7380
  return _asyncToGenerator(function* () {
7318
7381
  var authMetadata;
7319
7382
  try {
7320
- var useStable = yield _this82.isVersionSupported("v1.15");
7321
- authMetadata = yield _this82.http.request(Method.Get, "/auth_metadata", undefined, undefined, {
7383
+ var useStable = yield _this83.isVersionSupported("v1.15");
7384
+ authMetadata = yield _this83.http.request(Method.Get, "/auth_metadata", undefined, undefined, {
7322
7385
  prefix: useStable ? ClientPrefix.V1 : ClientPrefix.Unstable + "/org.matrix.msc2965"
7323
7386
  });
7324
7387
  } catch (e) {
@@ -7326,7 +7389,7 @@ export class BriijClient extends TypedEventEmitter {
7326
7389
  // Fall back to older variant of MSC2965
7327
7390
  var {
7328
7391
  issuer
7329
- } = yield _this82.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
7392
+ } = yield _this83.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
7330
7393
  prefix: ClientPrefix.Unstable + "/org.matrix.msc2965"
7331
7394
  });
7332
7395
  return discoverAndValidateOIDCIssuerWellKnown(issuer);