@textrp/briij-js-sdk 41.0.1 → 43.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 (380) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/LICENSE +177 -177
  3. package/README.md +85 -3
  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 +72 -1
  10. package/lib/@types/auth.d.ts.map +1 -1
  11. package/lib/@types/auth.js +57 -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 +59 -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 +4 -0
  58. package/lib/briij.d.ts.map +1 -1
  59. package/lib/briij.js +4 -0
  60. package/lib/briij.js.map +1 -1
  61. package/lib/client.d.ts +48 -1
  62. package/lib/client.d.ts.map +1 -1
  63. package/lib/client.js +262 -108
  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/wallet-recovery.d.ts +24 -0
  202. package/lib/wallet-recovery.d.ts.map +1 -0
  203. package/lib/wallet-recovery.js +232 -0
  204. package/lib/wallet-recovery.js.map +1 -0
  205. package/lib/webrtc/audioContext.js +24 -24
  206. package/lib/webrtc/audioContext.js.map +1 -1
  207. package/lib/webrtc/callEventTypes.js.map +1 -1
  208. package/lib/webrtc/stats/callFeedStatsReporter.js +14 -14
  209. package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
  210. package/lib/webrtc/stats/callStatsReportGatherer.js +14 -14
  211. package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  212. package/lib/webrtc/stats/callStatsReportSummary.js.map +1 -1
  213. package/lib/webrtc/stats/connectionStats.js +14 -14
  214. package/lib/webrtc/stats/connectionStats.js.map +1 -1
  215. package/lib/webrtc/stats/connectionStatsBuilder.js +14 -14
  216. package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
  217. package/lib/webrtc/stats/connectionStatsReportBuilder.js +14 -14
  218. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
  219. package/lib/webrtc/stats/groupCallStats.js +14 -14
  220. package/lib/webrtc/stats/groupCallStats.js.map +1 -1
  221. package/lib/webrtc/stats/media/mediaSsrcHandler.js +14 -14
  222. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
  223. package/lib/webrtc/stats/media/mediaTrackHandler.js +14 -14
  224. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
  225. package/lib/webrtc/stats/media/mediaTrackStats.js +27 -27
  226. package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
  227. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +20 -20
  228. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
  229. package/lib/webrtc/stats/statsReport.js +14 -14
  230. package/lib/webrtc/stats/statsReport.js.map +1 -1
  231. package/lib/webrtc/stats/statsReportEmitter.js +14 -14
  232. package/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
  233. package/lib/webrtc/stats/trackStatsBuilder.js +4 -4
  234. package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
  235. package/lib/webrtc/stats/transportStats.js.map +1 -1
  236. package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  237. package/lib/webrtc/stats/valueFormatter.js +11 -11
  238. package/lib/webrtc/stats/valueFormatter.js.map +1 -1
  239. package/lib/xrpl/identity.d.ts +28 -0
  240. package/lib/xrpl/identity.d.ts.map +1 -0
  241. package/lib/xrpl/identity.js +213 -0
  242. package/lib/xrpl/identity.js.map +1 -0
  243. package/lib/xrpl/trust.d.ts +8 -0
  244. package/lib/xrpl/trust.d.ts.map +1 -0
  245. package/lib/xrpl/trust.js +61 -0
  246. package/lib/xrpl/trust.js.map +1 -0
  247. package/lib/xrpl/verification.d.ts +26 -0
  248. package/lib/xrpl/verification.d.ts.map +1 -0
  249. package/lib/xrpl/verification.js +295 -0
  250. package/lib/xrpl/verification.js.map +1 -0
  251. package/package.json +130 -129
  252. package/src/@types/AESEncryptedSecretStoragePayload.ts +29 -29
  253. package/src/@types/IIdentityServerProvider.ts +24 -24
  254. package/src/@types/PushRules.ts +208 -208
  255. package/src/@types/another-json.d.ts +19 -19
  256. package/src/@types/auth.ts +340 -258
  257. package/src/@types/beacon.ts +140 -140
  258. package/src/@types/common.ts +24 -24
  259. package/src/@types/crypto.ts +71 -71
  260. package/src/@types/event.ts +508 -449
  261. package/src/@types/events.ts +119 -119
  262. package/src/@types/extensible_events.ts +147 -147
  263. package/src/@types/local_notifications.ts +19 -19
  264. package/src/@types/location.ts +92 -92
  265. package/src/@types/matrix-sdk-crypto-wasm.d.ts +39 -39
  266. package/src/@types/media.ts +245 -245
  267. package/src/@types/membership.ts +57 -57
  268. package/src/@types/partials.ts +103 -103
  269. package/src/@types/polls.ts +120 -120
  270. package/src/@types/read_receipts.ts +61 -61
  271. package/src/@types/registration.ts +102 -102
  272. package/src/@types/search.ts +119 -119
  273. package/src/@types/signed.ts +25 -25
  274. package/src/@types/spaces.ts +37 -37
  275. package/src/@types/state_events.ts +153 -153
  276. package/src/@types/synapse.ts +40 -40
  277. package/src/@types/sync.ts +27 -27
  278. package/src/@types/threepids.ts +29 -29
  279. package/src/@types/topic.ts +69 -69
  280. package/src/@types/uia.ts +24 -24
  281. package/src/NamespacedValue.ts +121 -121
  282. package/src/ReEmitter.ts +93 -93
  283. package/src/base64.ts +86 -86
  284. package/src/briij.ts +4 -0
  285. package/src/client.ts +183 -10
  286. package/src/common-crypto/README.md +4 -4
  287. package/src/common-crypto/key-passphrase.ts +43 -43
  288. package/src/content-helpers.ts +298 -298
  289. package/src/content-repo.ts +122 -122
  290. package/src/crypto/store/base.ts +388 -388
  291. package/src/crypto/store/indexeddb-crypto-store-backend.ts +655 -655
  292. package/src/crypto/store/indexeddb-crypto-store.ts +555 -555
  293. package/src/crypto/store/localStorage-crypto-store.ts +409 -409
  294. package/src/crypto/store/memory-crypto-store.ts +326 -326
  295. package/src/crypto-api/CryptoEventHandlerMap.ts +42 -42
  296. package/src/crypto-api/key-passphrase.ts +58 -58
  297. package/src/crypto-api/keybackup.ts +114 -114
  298. package/src/crypto-api/recovery-key.ts +69 -69
  299. package/src/digest.ts +34 -34
  300. package/src/extensible_events_v1/ExtensibleEvent.ts +58 -58
  301. package/src/extensible_events_v1/InvalidEventError.ts +24 -24
  302. package/src/extensible_events_v1/MessageEvent.ts +143 -143
  303. package/src/extensible_events_v1/PollEndEvent.ts +97 -97
  304. package/src/extensible_events_v1/PollResponseEvent.ts +148 -148
  305. package/src/extensible_events_v1/PollStartEvent.ts +207 -207
  306. package/src/extensible_events_v1/utilities.ts +35 -35
  307. package/src/feature.ts +88 -88
  308. package/src/http-api/method.ts +25 -25
  309. package/src/http-api/prefix.ts +48 -48
  310. package/src/indexeddb-helpers.ts +50 -50
  311. package/src/indexeddb-worker.ts +24 -24
  312. package/src/matrixrtc/IKeyTransport.ts +63 -63
  313. package/src/matrixrtc/IMembershipManager.ts +120 -120
  314. package/src/matrixrtc/LivekitTransport.ts +46 -46
  315. package/src/matrixrtc/index.ts +24 -24
  316. package/src/matrixrtc/utils.ts +71 -71
  317. package/src/models/ToDeviceMessage.ts +38 -38
  318. package/src/models/device.ts +85 -85
  319. package/src/models/event-status.ts +39 -39
  320. package/src/models/invites-ignorer-types.ts +58 -58
  321. package/src/models/profile-keys.ts +33 -33
  322. package/src/models/room-summary.ts +78 -78
  323. package/src/models/search-result.ts +57 -57
  324. package/src/models/typed-event-emitter.ts +246 -246
  325. package/src/oidc/authorize.ts +279 -279
  326. package/src/oidc/error.ts +33 -33
  327. package/src/oidc/index.ts +33 -33
  328. package/src/oidc/register.ts +163 -163
  329. package/src/oidc/tokenRefresher.ts +184 -184
  330. package/src/oidc/validate.ts +265 -265
  331. package/src/randomstring.ts +103 -103
  332. package/src/realtime-callbacks.ts +191 -191
  333. package/src/receipt-accumulator.ts +189 -189
  334. package/src/rendezvous/RendezvousChannel.ts +48 -48
  335. package/src/rendezvous/RendezvousCode.ts +25 -25
  336. package/src/rendezvous/RendezvousError.ts +26 -26
  337. package/src/rendezvous/RendezvousFailureReason.ts +49 -49
  338. package/src/rendezvous/RendezvousIntent.ts +20 -20
  339. package/src/rendezvous/RendezvousTransport.ts +58 -58
  340. package/src/rendezvous/channels/MSC4108SecureChannel.ts +270 -270
  341. package/src/rendezvous/channels/index.ts +17 -17
  342. package/src/rendezvous/index.ts +25 -25
  343. package/src/rendezvous/transports/index.ts +17 -17
  344. package/src/rust-crypto/CrossSigningIdentity.ts +195 -195
  345. package/src/rust-crypto/OutgoingRequestsManager.ts +170 -170
  346. package/src/rust-crypto/device-converter.ts +128 -128
  347. package/src/rust-crypto/secret-storage.ts +60 -60
  348. package/src/service-types.ts +20 -20
  349. package/src/store/local-storage-events-emitter.ts +46 -46
  350. package/src/sync-accumulator.ts +779 -779
  351. package/src/thread-utils.ts +31 -31
  352. package/src/types.ts +59 -59
  353. package/src/utils/decryptAESSecretStorageItem.ts +54 -54
  354. package/src/utils/encryptAESSecretStorageItem.ts +73 -73
  355. package/src/utils/internal/deriveKeys.ts +63 -63
  356. package/src/utils/roomVersion.ts +35 -35
  357. package/src/version-support.ts +50 -50
  358. package/src/wallet-recovery.ts +252 -0
  359. package/src/webrtc/audioContext.ts +44 -44
  360. package/src/webrtc/callEventTypes.ts +101 -101
  361. package/src/webrtc/stats/callFeedStatsReporter.ts +91 -91
  362. package/src/webrtc/stats/callStatsReportGatherer.ts +219 -219
  363. package/src/webrtc/stats/callStatsReportSummary.ts +30 -30
  364. package/src/webrtc/stats/connectionStats.ts +47 -47
  365. package/src/webrtc/stats/connectionStatsBuilder.ts +28 -28
  366. package/src/webrtc/stats/connectionStatsReportBuilder.ts +140 -140
  367. package/src/webrtc/stats/groupCallStats.ts +93 -93
  368. package/src/webrtc/stats/media/mediaSsrcHandler.ts +57 -57
  369. package/src/webrtc/stats/media/mediaTrackHandler.ts +70 -70
  370. package/src/webrtc/stats/media/mediaTrackStats.ts +176 -176
  371. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +90 -90
  372. package/src/webrtc/stats/statsReport.ts +133 -133
  373. package/src/webrtc/stats/statsReportEmitter.ts +49 -49
  374. package/src/webrtc/stats/trackStatsBuilder.ts +207 -207
  375. package/src/webrtc/stats/transportStats.ts +26 -26
  376. package/src/webrtc/stats/transportStatsBuilder.ts +48 -48
  377. package/src/webrtc/stats/valueFormatter.ts +27 -27
  378. package/src/xrpl/identity.ts +245 -0
  379. package/src/xrpl/trust.ts +64 -0
  380. 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 { WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE, WALLET_IDENTITY_ACCOUNT_DATA_TYPE, 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,121 @@ export class BriijClient extends TypedEventEmitter {
5256
5295
  });
5257
5296
  }
5258
5297
 
5298
+ /**
5299
+ * Request an XRPL login challenge from the homeserver.
5300
+ *
5301
+ * The briij homeserver responds with HTTP 401 as the successful challenge
5302
+ * response, so this helper normalizes that into a resolved promise.
5303
+ */
5304
+ getXrplAuthChallenge(request) {
5305
+ var _this56 = this;
5306
+ return _asyncToGenerator(function* () {
5307
+ try {
5308
+ var response = yield _this56.loginRequest(_objectSpread(_objectSpread({}, request), {}, {
5309
+ type: XRPL_WALLET_LOGIN_TYPE
5310
+ }));
5311
+ if (typeof response.session === "string" && typeof response.challenge === "string") {
5312
+ return response;
5313
+ }
5314
+ } catch (error) {
5315
+ if (error instanceof BriijError && error.httpStatus === 401) {
5316
+ var _error$data, _error$data2;
5317
+ var session = (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.session;
5318
+ var challenge = (_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.challenge;
5319
+ if (typeof session === "string" && typeof challenge === "string") {
5320
+ return {
5321
+ session,
5322
+ challenge
5323
+ };
5324
+ }
5325
+ }
5326
+ throw error;
5327
+ }
5328
+ throw new Error("XRPL challenge response was not returned by homeserver");
5329
+ })();
5330
+ }
5331
+
5332
+ /**
5333
+ * Complete XRPL login using the previously issued challenge session.
5334
+ *
5335
+ * @returns Promise which resolves to a LoginResponse object.
5336
+ * @returns Rejects: with an error response.
5337
+ */
5338
+ completeXrplAuth(request) {
5339
+ return this.loginRequest(_objectSpread(_objectSpread({}, request), {}, {
5340
+ type: XRPL_WALLET_LOGIN_TYPE
5341
+ }));
5342
+ }
5343
+
5344
+ /**
5345
+ * Store a chain-agnostic wallet recovery envelope in account data.
5346
+ *
5347
+ * This uses a stable account-data type and does not affect core E2EE state.
5348
+ *
5349
+ * @param envelope - Wallet recovery envelope payload.
5350
+ */
5351
+ setWalletRecoveryEnvelope(envelope) {
5352
+ return this.setAccountDataRaw(WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE, envelope);
5353
+ }
5354
+
5355
+ /**
5356
+ * Fetch wallet recovery envelope directly from the homeserver.
5357
+ *
5358
+ * @returns The stored envelope, or null if not found.
5359
+ */
5360
+ getWalletRecoveryEnvelopeFromServer() {
5361
+ return this.getAccountDataFromServer(WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE);
5362
+ }
5363
+
5364
+ /**
5365
+ * Fetch canonical wallet identity metadata from the homeserver.
5366
+ *
5367
+ * @returns Wallet identity metadata, or null if not found.
5368
+ */
5369
+ getWalletIdentityFromServer() {
5370
+ return this.getAccountDataFromServer(WALLET_IDENTITY_ACCOUNT_DATA_TYPE);
5371
+ }
5372
+
5373
+ /**
5374
+ * @deprecated Use `getXrplAuthChallenge` + `completeXrplAuth` for explicit
5375
+ * two-step XRPL login flow. This wrapper now expects `challenge` to include
5376
+ * the `session` and optional `public_key`.
5377
+ */
5378
+ loginWithXrplWallet(user, walletAddress, signature, challenge) {
5379
+ var _arguments13 = arguments,
5380
+ _this57 = this;
5381
+ return _asyncToGenerator(function* () {
5382
+ var _parsedChallenge, _parsedChallenge2;
5383
+ var network = _arguments13.length > 4 && _arguments13[4] !== undefined ? _arguments13[4] : "xrpl";
5384
+ var parsedChallenge = null;
5385
+ if (typeof challenge === "string") {
5386
+ try {
5387
+ parsedChallenge = JSON.parse(challenge);
5388
+ } catch (_unused3) {
5389
+ throw new Error("XRPL challenge must be JSON with a session field");
5390
+ }
5391
+ } else {
5392
+ parsedChallenge = challenge;
5393
+ }
5394
+ var session = (_parsedChallenge = parsedChallenge) === null || _parsedChallenge === void 0 ? void 0 : _parsedChallenge.session;
5395
+ if (!session) {
5396
+ throw new Error("XRPL challenge payload is missing session; call getXrplAuthChallenge first");
5397
+ }
5398
+ return _this57.completeXrplAuth({
5399
+ user,
5400
+ identifier: {
5401
+ type: "m.id.user",
5402
+ user
5403
+ },
5404
+ session,
5405
+ address: walletAddress,
5406
+ signature,
5407
+ public_key: (_parsedChallenge2 = parsedChallenge) === null || _parsedChallenge2 === void 0 ? void 0 : _parsedChallenge2.public_key,
5408
+ network
5409
+ });
5410
+ })();
5411
+ }
5412
+
5259
5413
  /**
5260
5414
  * @param redirectUrl - The URL to redirect to after the HS
5261
5415
  * authenticates with CAS.
@@ -5316,9 +5470,9 @@ export class BriijClient extends TypedEventEmitter {
5316
5470
  * @param data - Credentials and other details for the login request.
5317
5471
  */
5318
5472
  loginRequest(data) {
5319
- var _this55 = this;
5473
+ var _this58 = this;
5320
5474
  return _asyncToGenerator(function* () {
5321
- return yield _this55.http.authedRequest(Method.Post, "/login", undefined, data);
5475
+ return yield _this58.http.authedRequest(Method.Post, "/login", undefined, data);
5322
5476
  })();
5323
5477
  }
5324
5478
 
@@ -5332,15 +5486,15 @@ export class BriijClient extends TypedEventEmitter {
5332
5486
  * @returns Promise which resolves: On success, the empty object `{}`
5333
5487
  */
5334
5488
  logout() {
5335
- var _arguments13 = arguments,
5336
- _this56 = this;
5489
+ var _arguments14 = arguments,
5490
+ _this59 = this;
5337
5491
  return _asyncToGenerator(function* () {
5338
- var stopClient = _arguments13.length > 0 && _arguments13[0] !== undefined ? _arguments13[0] : false;
5492
+ var stopClient = _arguments14.length > 0 && _arguments14[0] !== undefined ? _arguments14[0] : false;
5339
5493
  if (stopClient) {
5340
- _this56.stopClient();
5341
- _this56.http.abort();
5494
+ _this59.stopClient();
5495
+ _this59.http.abort();
5342
5496
  }
5343
- return _this56.http.authedRequest(Method.Post, "/logout");
5497
+ return _this59.http.authedRequest(Method.Post, "/logout");
5344
5498
  })();
5345
5499
  }
5346
5500
 
@@ -5378,12 +5532,12 @@ export class BriijClient extends TypedEventEmitter {
5378
5532
  * or UIA auth data.
5379
5533
  */
5380
5534
  requestLoginToken(auth) {
5381
- var _this57 = this;
5535
+ var _this60 = this;
5382
5536
  return _asyncToGenerator(function* () {
5383
5537
  var body = {
5384
5538
  auth
5385
5539
  };
5386
- return _this57.http.authedRequest(Method.Post, "/login/get_token", undefined,
5540
+ return _this60.http.authedRequest(Method.Post, "/login/get_token", undefined,
5387
5541
  // no query params
5388
5542
  body, {
5389
5543
  prefix: ClientPrefix.V1
@@ -5415,23 +5569,23 @@ export class BriijClient extends TypedEventEmitter {
5415
5569
  * @returns Rejects: with an error response.
5416
5570
  */
5417
5571
  createRoom(options) {
5418
- var _this58 = this;
5572
+ var _this61 = this;
5419
5573
  return _asyncToGenerator(function* () {
5420
- var _this58$identityServe;
5574
+ var _this61$identityServe;
5421
5575
  // eslint-disable-line camelcase
5422
5576
  // some valid options include: room_alias_name, visibility, invite
5423
5577
 
5424
5578
  // inject the id_access_token if inviting 3rd party addresses
5425
5579
  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();
5580
+ if (invitesNeedingToken.length > 0 && (_this61$identityServe = _this61.identityServer) !== null && _this61$identityServe !== void 0 && _this61$identityServe.getAccessToken) {
5581
+ var identityAccessToken = yield _this61.identityServer.getAccessToken();
5428
5582
  if (identityAccessToken) {
5429
5583
  for (var invite of invitesNeedingToken) {
5430
5584
  invite.id_access_token = identityAccessToken;
5431
5585
  }
5432
5586
  }
5433
5587
  }
5434
- return _this58.http.authedRequest(Method.Post, "/createRoom", undefined, options);
5588
+ return _this61.http.authedRequest(Method.Post, "/createRoom", undefined, options);
5435
5589
  })();
5436
5590
  }
5437
5591
 
@@ -5576,12 +5730,12 @@ export class BriijClient extends TypedEventEmitter {
5576
5730
  * @returns Rejects: with an error response.
5577
5731
  */
5578
5732
  sendStateEvent(roomId, eventType, content) {
5579
- var _arguments14 = arguments,
5580
- _this59 = this;
5733
+ var _arguments15 = arguments,
5734
+ _this62 = this;
5581
5735
  return _asyncToGenerator(function* () {
5582
- var stateKey = _arguments14.length > 3 && _arguments14[3] !== undefined ? _arguments14[3] : "";
5583
- var opts = _arguments14.length > 4 && _arguments14[4] !== undefined ? _arguments14[4] : {};
5584
- var room = _this59.getRoom(roomId);
5736
+ var stateKey = _arguments15.length > 3 && _arguments15[3] !== undefined ? _arguments15[3] : "";
5737
+ var opts = _arguments15.length > 4 && _arguments15[4] !== undefined ? _arguments15[4] : {};
5738
+ var room = _this62.getRoom(roomId);
5585
5739
  var event = new BriijEvent({
5586
5740
  room_id: roomId,
5587
5741
  type: eventType,
@@ -5589,7 +5743,7 @@ export class BriijClient extends TypedEventEmitter {
5589
5743
  // Cast safety: StateEvents[K] is a stronger bound than IContent, which has [key: string]: any
5590
5744
  content: content
5591
5745
  });
5592
- yield _this59.encryptStateEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
5746
+ yield _this62.encryptStateEventIfNeeded(event, room !== null && room !== void 0 ? room : undefined);
5593
5747
  var pathParams = {
5594
5748
  $roomId: roomId,
5595
5749
  $eventType: event.getWireType(),
@@ -5599,36 +5753,36 @@ export class BriijClient extends TypedEventEmitter {
5599
5753
  if (stateKey !== undefined) {
5600
5754
  path = utils.encodeUri(path + "/$stateKey", pathParams);
5601
5755
  }
5602
- return _this59.http.authedRequest(Method.Put, path, undefined, event.getWireContent(), opts);
5756
+ return _this62.http.authedRequest(Method.Put, path, undefined, event.getWireContent(), opts);
5603
5757
  })();
5604
5758
  }
5605
5759
  encryptStateEventIfNeeded(event, room) {
5606
- var _this60 = this;
5760
+ var _this63 = this;
5607
5761
  return _asyncToGenerator(function* () {
5608
- if (!_this60.enableEncryptedStateEvents) {
5762
+ if (!_this63.enableEncryptedStateEvents) {
5609
5763
  return;
5610
5764
  }
5611
5765
 
5612
5766
  // If the room is unknown, we cannot encrypt for it
5613
5767
  if (!room) return;
5614
- if (!_this60.cryptoBackend && _this60.usingExternalCrypto) {
5768
+ if (!_this63.cryptoBackend && _this63.usingExternalCrypto) {
5615
5769
  // The client has opted to allow sending messages to encrypted
5616
5770
  // rooms even if the room is encrypted, and we haven't set up
5617
5771
  // crypto. This is useful for users of matrix-org/pantalaimon
5618
5772
  return;
5619
5773
  }
5620
- if (!_this60.cryptoBackend) {
5774
+ if (!_this63.cryptoBackend) {
5621
5775
  throw new Error("This room is configured to use encryption, but your client does not support encryption.");
5622
5776
  }
5623
5777
 
5624
5778
  // Check regular encryption conditions.
5625
- if (!(yield _this60.shouldEncryptEventForRoom(event, room))) {
5779
+ if (!(yield _this63.shouldEncryptEventForRoom(event, room))) {
5626
5780
  return;
5627
5781
  }
5628
5782
 
5629
5783
  // If the crypto impl thinks we shouldn't encrypt, then we shouldn't.
5630
5784
  // Safety: we checked the crypto impl exists above.
5631
- if (!(yield _this60.cryptoBackend.isStateEncryptionEnabledInRoom(room.roomId))) {
5785
+ if (!(yield _this63.cryptoBackend.isStateEncryptionEnabledInRoom(room.roomId))) {
5632
5786
  return;
5633
5787
  }
5634
5788
 
@@ -5636,7 +5790,7 @@ export class BriijClient extends TypedEventEmitter {
5636
5790
  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
5791
  return;
5638
5792
  }
5639
- yield _this60.cryptoBackend.encryptEvent(event, room);
5793
+ yield _this63.cryptoBackend.encryptEvent(event, room);
5640
5794
  })();
5641
5795
  }
5642
5796
 
@@ -5669,7 +5823,7 @@ export class BriijClient extends TypedEventEmitter {
5669
5823
  * @returns Promise which resolves: the empty object, `{}`.
5670
5824
  */
5671
5825
  setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId) {
5672
- var _this61 = this;
5826
+ var _this64 = this;
5673
5827
  return _asyncToGenerator(function* () {
5674
5828
  var path = utils.encodeUri("/rooms/$roomId/read_markers", {
5675
5829
  $roomId: roomId
@@ -5678,10 +5832,10 @@ export class BriijClient extends TypedEventEmitter {
5678
5832
  [ReceiptType.FullyRead]: rmEventId,
5679
5833
  [ReceiptType.Read]: rrEventId
5680
5834
  };
5681
- if ((yield _this61.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this61.isVersionSupported("v1.4"))) {
5835
+ if ((yield _this64.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")) || (yield _this64.isVersionSupported("v1.4"))) {
5682
5836
  content[ReceiptType.ReadPrivate] = rpEventId;
5683
5837
  }
5684
- return _this61.http.authedRequest(Method.Post, path, undefined, content);
5838
+ return _this64.http.authedRequest(Method.Post, path, undefined, content);
5685
5839
  })();
5686
5840
  }
5687
5841
 
@@ -5915,9 +6069,9 @@ export class BriijClient extends TypedEventEmitter {
5915
6069
  * @returns `true` if supported, otherwise `false`
5916
6070
  */
5917
6071
  doesServerSupportExtendedProfiles() {
5918
- var _this62 = this;
6072
+ var _this65 = this;
5919
6073
  return _asyncToGenerator(function* () {
5920
- return (yield _this62.isVersionSupported("v1.16")) || (yield _this62.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) || (yield _this62.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES));
6074
+ return (yield _this65.isVersionSupported("v1.16")) || (yield _this65.doesServerSupportUnstableFeature(UNSTABLE_MSC4133_EXTENDED_PROFILES)) || (yield _this65.doesServerSupportUnstableFeature(STABLE_MSC4133_EXTENDED_PROFILES));
5921
6075
  })();
5922
6076
  }
5923
6077
 
@@ -5927,9 +6081,9 @@ export class BriijClient extends TypedEventEmitter {
5927
6081
  * @returns The prefix for use with `authedRequest`
5928
6082
  */
5929
6083
  getExtendedProfileRequestPrefix() {
5930
- var _this63 = this;
6084
+ var _this66 = this;
5931
6085
  return _asyncToGenerator(function* () {
5932
- if ((yield _this63.isVersionSupported("v1.16")) || (yield _this63.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))) {
6086
+ if ((yield _this66.isVersionSupported("v1.16")) || (yield _this66.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable"))) {
5933
6087
  return ClientPrefix.V3;
5934
6088
  }
5935
6089
  return "/_matrix/client/unstable/uk.tcpip.msc4133";
@@ -5947,15 +6101,15 @@ export class BriijClient extends TypedEventEmitter {
5947
6101
  * @throws A M_NOT_FOUND error if the profile could not be found.
5948
6102
  */
5949
6103
  getExtendedProfile(userId) {
5950
- var _this64 = this;
6104
+ var _this67 = this;
5951
6105
  return _asyncToGenerator(function* () {
5952
- if (!(yield _this64.doesServerSupportExtendedProfiles())) {
6106
+ if (!(yield _this67.doesServerSupportExtendedProfiles())) {
5953
6107
  throw new Error("Server does not support extended profiles");
5954
6108
  }
5955
- return _this64.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
6109
+ return _this67.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId", {
5956
6110
  $userId: userId
5957
6111
  }), undefined, undefined, {
5958
- prefix: yield _this64.getExtendedProfileRequestPrefix()
6112
+ prefix: yield _this67.getExtendedProfileRequestPrefix()
5959
6113
  });
5960
6114
  })();
5961
6115
  }
@@ -5972,16 +6126,16 @@ export class BriijClient extends TypedEventEmitter {
5972
6126
  * @throws A M_NOT_FOUND error if the key was not set OR the profile could not be found.
5973
6127
  */
5974
6128
  getExtendedProfileProperty(userId, key) {
5975
- var _this65 = this;
6129
+ var _this68 = this;
5976
6130
  return _asyncToGenerator(function* () {
5977
- if (!(yield _this65.doesServerSupportExtendedProfiles())) {
6131
+ if (!(yield _this68.doesServerSupportExtendedProfiles())) {
5978
6132
  throw new Error("Server does not support extended profiles");
5979
6133
  }
5980
- var profile = yield _this65.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
6134
+ var profile = yield _this68.http.authedRequest(Method.Get, utils.encodeUri("/profile/$userId/$key", {
5981
6135
  $userId: userId,
5982
6136
  $key: key
5983
6137
  }), undefined, undefined, {
5984
- prefix: yield _this65.getExtendedProfileRequestPrefix()
6138
+ prefix: yield _this68.getExtendedProfileRequestPrefix()
5985
6139
  });
5986
6140
  return profile[key];
5987
6141
  })();
@@ -5997,19 +6151,19 @@ export class BriijClient extends TypedEventEmitter {
5997
6151
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
5998
6152
  */
5999
6153
  setExtendedProfileProperty(key, value) {
6000
- var _this66 = this;
6154
+ var _this69 = this;
6001
6155
  return _asyncToGenerator(function* () {
6002
- if (!(yield _this66.doesServerSupportExtendedProfiles())) {
6156
+ if (!(yield _this69.doesServerSupportExtendedProfiles())) {
6003
6157
  throw new Error("Server does not support extended profiles");
6004
6158
  }
6005
- var userId = _this66.getUserId();
6006
- yield _this66.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
6159
+ var userId = _this69.getUserId();
6160
+ yield _this69.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId/$key", {
6007
6161
  $userId: userId,
6008
6162
  $key: key
6009
6163
  }), undefined, {
6010
6164
  [key]: value
6011
6165
  }, {
6012
- prefix: yield _this66.getExtendedProfileRequestPrefix()
6166
+ prefix: yield _this69.getExtendedProfileRequestPrefix()
6013
6167
  });
6014
6168
  })();
6015
6169
  }
@@ -6023,17 +6177,17 @@ export class BriijClient extends TypedEventEmitter {
6023
6177
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6024
6178
  */
6025
6179
  deleteExtendedProfileProperty(key) {
6026
- var _this67 = this;
6180
+ var _this70 = this;
6027
6181
  return _asyncToGenerator(function* () {
6028
- if (!(yield _this67.doesServerSupportExtendedProfiles())) {
6182
+ if (!(yield _this70.doesServerSupportExtendedProfiles())) {
6029
6183
  throw new Error("Server does not support extended profiles");
6030
6184
  }
6031
- var userId = _this67.getUserId();
6032
- yield _this67.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
6185
+ var userId = _this70.getUserId();
6186
+ yield _this70.http.authedRequest(Method.Delete, utils.encodeUri("/profile/$userId/$key", {
6033
6187
  $userId: userId,
6034
6188
  $key: key
6035
6189
  }), undefined, undefined, {
6036
- prefix: yield _this67.getExtendedProfileRequestPrefix()
6190
+ prefix: yield _this70.getExtendedProfileRequestPrefix()
6037
6191
  });
6038
6192
  })();
6039
6193
  }
@@ -6049,16 +6203,16 @@ export class BriijClient extends TypedEventEmitter {
6049
6203
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6050
6204
  */
6051
6205
  patchExtendedProfile(profile) {
6052
- var _this68 = this;
6206
+ var _this71 = this;
6053
6207
  return _asyncToGenerator(function* () {
6054
- if (!(yield _this68.doesServerSupportExtendedProfiles())) {
6208
+ if (!(yield _this71.doesServerSupportExtendedProfiles())) {
6055
6209
  throw new Error("Server does not support extended profiles");
6056
6210
  }
6057
- var userId = _this68.getUserId();
6058
- return _this68.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
6211
+ var userId = _this71.getUserId();
6212
+ return _this71.http.authedRequest(Method.Patch, utils.encodeUri("/profile/$userId", {
6059
6213
  $userId: userId
6060
6214
  }), {}, profile, {
6061
- prefix: yield _this68.getExtendedProfileRequestPrefix()
6215
+ prefix: yield _this71.getExtendedProfileRequestPrefix()
6062
6216
  });
6063
6217
  })();
6064
6218
  }
@@ -6073,16 +6227,16 @@ export class BriijClient extends TypedEventEmitter {
6073
6227
  * @throws An error if the server does not support MSC4133 OR the server disallows editing the user profile.
6074
6228
  */
6075
6229
  setExtendedProfile(profile) {
6076
- var _this69 = this;
6230
+ var _this72 = this;
6077
6231
  return _asyncToGenerator(function* () {
6078
- if (!(yield _this69.doesServerSupportExtendedProfiles())) {
6232
+ if (!(yield _this72.doesServerSupportExtendedProfiles())) {
6079
6233
  throw new Error("Server does not support extended profiles");
6080
6234
  }
6081
- var userId = _this69.getUserId();
6082
- yield _this69.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
6235
+ var userId = _this72.getUserId();
6236
+ yield _this72.http.authedRequest(Method.Put, utils.encodeUri("/profile/$userId", {
6083
6237
  $userId: userId
6084
6238
  }), {}, profile, {
6085
- prefix: yield _this69.getExtendedProfileRequestPrefix()
6239
+ prefix: yield _this72.getExtendedProfileRequestPrefix()
6086
6240
  });
6087
6241
  })();
6088
6242
  }
@@ -6105,10 +6259,10 @@ export class BriijClient extends TypedEventEmitter {
6105
6259
  * @returns Rejects: with an error response.
6106
6260
  */
6107
6261
  addThreePidOnly(data) {
6108
- var _this70 = this;
6262
+ var _this73 = this;
6109
6263
  return _asyncToGenerator(function* () {
6110
6264
  var path = "/account/3pid/add";
6111
- return _this70.http.authedRequest(Method.Post, path, undefined, data);
6265
+ return _this73.http.authedRequest(Method.Post, path, undefined, data);
6112
6266
  })();
6113
6267
  }
6114
6268
 
@@ -6124,10 +6278,10 @@ export class BriijClient extends TypedEventEmitter {
6124
6278
  * @returns Rejects: with an error response.
6125
6279
  */
6126
6280
  bindThreePid(data) {
6127
- var _this71 = this;
6281
+ var _this74 = this;
6128
6282
  return _asyncToGenerator(function* () {
6129
6283
  var path = "/account/3pid/bind";
6130
- return _this71.http.authedRequest(Method.Post, path, undefined, data);
6284
+ return _this74.http.authedRequest(Method.Post, path, undefined, data);
6131
6285
  })();
6132
6286
  }
6133
6287
 
@@ -6145,15 +6299,15 @@ export class BriijClient extends TypedEventEmitter {
6145
6299
  unbindThreePid(medium, address
6146
6300
  // eslint-disable-next-line camelcase
6147
6301
  ) {
6148
- var _this72 = this;
6302
+ var _this75 = this;
6149
6303
  return _asyncToGenerator(function* () {
6150
6304
  var path = "/account/3pid/unbind";
6151
6305
  var data = {
6152
6306
  medium,
6153
6307
  address,
6154
- id_server: _this72.getIdentityServerUrl(true)
6308
+ id_server: _this75.getIdentityServerUrl(true)
6155
6309
  };
6156
- return _this72.http.authedRequest(Method.Post, path, undefined, data);
6310
+ return _this75.http.authedRequest(Method.Post, path, undefined, data);
6157
6311
  })();
6158
6312
  }
6159
6313
 
@@ -6275,13 +6429,13 @@ export class BriijClient extends TypedEventEmitter {
6275
6429
  * @returns Rejects: with an error response.
6276
6430
  */
6277
6431
  getPushers() {
6278
- var _this73 = this;
6432
+ var _this76 = this;
6279
6433
  return _asyncToGenerator(function* () {
6280
- var response = yield _this73.http.authedRequest(Method.Get, "/pushers");
6434
+ var response = yield _this76.http.authedRequest(Method.Get, "/pushers");
6281
6435
 
6282
6436
  // Migration path for clients that connect to a homeserver that does not support
6283
6437
  // 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"))) {
6438
+ if (!(yield _this76.doesServerSupportUnstableFeature("org.matrix.msc3881"))) {
6285
6439
  response.pushers = response.pushers.map(pusher => {
6286
6440
  if (!pusher.hasOwnProperty(PUSHER_ENABLED.name)) {
6287
6441
  pusher[PUSHER_ENABLED.name] = true;
@@ -6711,7 +6865,7 @@ export class BriijClient extends TypedEventEmitter {
6711
6865
  * found MXIDs. Results where no user could be found will not be listed.
6712
6866
  */
6713
6867
  identityHashedLookup(addressPairs, identityAccessToken) {
6714
- var _this74 = this;
6868
+ var _this77 = this;
6715
6869
  return _asyncToGenerator(function* () {
6716
6870
  var params = {
6717
6871
  // addresses: ["email@example.org", "10005550000"],
@@ -6720,7 +6874,7 @@ export class BriijClient extends TypedEventEmitter {
6720
6874
  };
6721
6875
 
6722
6876
  // Get hash information first before trying to do a lookup
6723
- var hashes = yield _this74.getIdentityHashDetails(identityAccessToken);
6877
+ var hashes = yield _this77.getIdentityHashDetails(identityAccessToken);
6724
6878
  if (!hashes || !hashes["lookup_pepper"] || !hashes["algorithms"]) {
6725
6879
  throw new Error("Unsupported identity server: bad response");
6726
6880
  }
@@ -6763,7 +6917,7 @@ export class BriijClient extends TypedEventEmitter {
6763
6917
  } else {
6764
6918
  throw new Error("Unsupported identity server: unknown hash algorithm");
6765
6919
  }
6766
- var response = yield _this74.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
6920
+ var response = yield _this77.http.idServerRequest(Method.Post, "/lookup", params, IdentityPrefix.V2, identityAccessToken);
6767
6921
  if (!(response !== null && response !== void 0 && response["mappings"])) return []; // no results
6768
6922
 
6769
6923
  var foundAddresses = [];
@@ -6797,12 +6951,12 @@ export class BriijClient extends TypedEventEmitter {
6797
6951
  * @returns Rejects: with an error response.
6798
6952
  */
6799
6953
  lookupThreePid(medium, address, identityAccessToken) {
6800
- var _this75 = this;
6954
+ var _this78 = this;
6801
6955
  return _asyncToGenerator(function* () {
6802
6956
  // Note: we're using the V2 API by calling this function, but our
6803
6957
  // function contract requires a V1 response. We therefore have to
6804
6958
  // convert it manually.
6805
- var response = yield _this75.identityHashedLookup([[address, medium]], identityAccessToken);
6959
+ var response = yield _this78.identityHashedLookup([[address, medium]], identityAccessToken);
6806
6960
  var result = response.find(p => p.address === address);
6807
6961
  if (!result) {
6808
6962
  return {};
@@ -6834,12 +6988,12 @@ export class BriijClient extends TypedEventEmitter {
6834
6988
  * @returns Rejects: with an error response.
6835
6989
  */
6836
6990
  bulkLookupThreePids(query, identityAccessToken) {
6837
- var _this76 = this;
6991
+ var _this79 = this;
6838
6992
  return _asyncToGenerator(function* () {
6839
6993
  // Note: we're using the V2 API by calling this function, but our
6840
6994
  // function contract requires a V1 response. We therefore have to
6841
6995
  // convert it manually.
6842
- var response = yield _this76.identityHashedLookup(
6996
+ var response = yield _this79.identityHashedLookup(
6843
6997
  // We have to reverse the query order to get [address, medium] pairs
6844
6998
  query.map(p => [p[1], p[0]]), identityAccessToken);
6845
6999
  var v1results = [];
@@ -6913,16 +7067,16 @@ export class BriijClient extends TypedEventEmitter {
6913
7067
  * @returns Promise which resolves once queued there is no error feedback when sending fails.
6914
7068
  */
6915
7069
  encryptAndSendToDevice(eventType, devices, payload) {
6916
- var _this77 = this;
7070
+ var _this80 = this;
6917
7071
  return _asyncToGenerator(function* () {
6918
- if (!_this77.cryptoBackend) {
7072
+ if (!_this80.cryptoBackend) {
6919
7073
  throw new Error("Cannot encrypt to device event, your client does not support encryption.");
6920
7074
  }
6921
- var batch = yield _this77.cryptoBackend.encryptToDeviceMessages(eventType, devices, payload);
7075
+ var batch = yield _this80.cryptoBackend.encryptToDeviceMessages(eventType, devices, payload);
6922
7076
 
6923
7077
  // TODO The batch mechanism removes all possibility to get error feedbacks..
6924
7078
  // We might want instead to do the API call directly and pass the errors back.
6925
- yield _this77.queueToDevice(batch);
7079
+ yield _this80.queueToDevice(batch);
6926
7080
  })();
6927
7081
  }
6928
7082
 
@@ -7079,16 +7233,16 @@ export class BriijClient extends TypedEventEmitter {
7079
7233
  * @returns Promise which resolves to the created space.
7080
7234
  */
7081
7235
  unstableCreateFileTree(name) {
7082
- var _this78 = this;
7236
+ var _this81 = this;
7083
7237
  return _asyncToGenerator(function* () {
7084
7238
  var {
7085
7239
  room_id: roomId
7086
- } = yield _this78.createRoom({
7240
+ } = yield _this81.createRoom({
7087
7241
  name: name,
7088
7242
  preset: Preset.PrivateChat,
7089
7243
  power_level_content_override: _objectSpread(_objectSpread({}, DEFAULT_TREE_POWER_LEVELS_TEMPLATE), {}, {
7090
7244
  users: {
7091
- [_this78.getUserId()]: 100
7245
+ [_this81.getUserId()]: 100
7092
7246
  }
7093
7247
  }),
7094
7248
  creation_content: {
@@ -7108,7 +7262,7 @@ export class BriijClient extends TypedEventEmitter {
7108
7262
  }
7109
7263
  }]
7110
7264
  });
7111
- return new MSC3089TreeSpace(_this78, roomId);
7265
+ return new MSC3089TreeSpace(_this81, roomId);
7112
7266
  })();
7113
7267
  }
7114
7268
 
@@ -7185,7 +7339,7 @@ export class BriijClient extends TypedEventEmitter {
7185
7339
  * @param via - The list of servers which know about the room if only an ID was provided.
7186
7340
  */
7187
7341
  getRoomSummary(roomIdOrAlias, via) {
7188
- var _this79 = this;
7342
+ var _this82 = this;
7189
7343
  return _asyncToGenerator(function* () {
7190
7344
  var paramOpts = {
7191
7345
  prefix: "/_matrix/client/unstable/im.nheko.summary"
@@ -7194,7 +7348,7 @@ export class BriijClient extends TypedEventEmitter {
7194
7348
  var path = utils.encodeUri("/summary/$roomid", {
7195
7349
  $roomid: roomIdOrAlias
7196
7350
  });
7197
- return yield _this79.http.authedRequest(Method.Get, path, {
7351
+ return yield _this82.http.authedRequest(Method.Get, path, {
7198
7352
  via
7199
7353
  }, undefined, paramOpts);
7200
7354
  } catch (e) {
@@ -7202,7 +7356,7 @@ export class BriijClient extends TypedEventEmitter {
7202
7356
  var _path = utils.encodeUri("/rooms/$roomid/summary", {
7203
7357
  $roomid: roomIdOrAlias
7204
7358
  });
7205
- return yield _this79.http.authedRequest(Method.Get, _path, {
7359
+ return yield _this82.http.authedRequest(Method.Get, _path, {
7206
7360
  via
7207
7361
  }, undefined, paramOpts);
7208
7362
  } else {
@@ -7254,9 +7408,9 @@ export class BriijClient extends TypedEventEmitter {
7254
7408
  * Fetches information about the user for the configured access token.
7255
7409
  */
7256
7410
  whoami() {
7257
- var _this80 = this;
7411
+ var _this83 = this;
7258
7412
  return _asyncToGenerator(function* () {
7259
- return _this80.http.authedRequest(Method.Get, "/account/whoami");
7413
+ return _this83.http.authedRequest(Method.Get, "/account/whoami");
7260
7414
  })();
7261
7415
  }
7262
7416
 
@@ -7267,7 +7421,7 @@ export class BriijClient extends TypedEventEmitter {
7267
7421
  * @returns Rejects: when the request fails (module:http-api.BriijError)
7268
7422
  */
7269
7423
  timestampToEvent(roomId, timestamp, dir) {
7270
- var _this81 = this;
7424
+ var _this84 = this;
7271
7425
  return _asyncToGenerator(function* () {
7272
7426
  var path = utils.encodeUri("/rooms/$roomId/timestamp_to_event", {
7273
7427
  $roomId: roomId
@@ -7277,7 +7431,7 @@ export class BriijClient extends TypedEventEmitter {
7277
7431
  dir: dir
7278
7432
  };
7279
7433
  try {
7280
- return yield _this81.http.authedRequest(Method.Get, path, queryParams, undefined, {
7434
+ return yield _this84.http.authedRequest(Method.Get, path, queryParams, undefined, {
7281
7435
  prefix: ClientPrefix.V1
7282
7436
  });
7283
7437
  } catch (err) {
@@ -7293,7 +7447,7 @@ export class BriijClient extends TypedEventEmitter {
7293
7447
  // both indicate that this endpoint+verb combination is
7294
7448
  // not supported.
7295
7449
  err.httpStatus === 404 || err.httpStatus === 405)) {
7296
- return yield _this81.http.authedRequest(Method.Get, path, queryParams, undefined, {
7450
+ return yield _this84.http.authedRequest(Method.Get, path, queryParams, undefined, {
7297
7451
  prefix: "/_matrix/client/unstable/org.matrix.msc3030"
7298
7452
  });
7299
7453
  }
@@ -7313,12 +7467,12 @@ export class BriijClient extends TypedEventEmitter {
7313
7467
  * @throws when delegated auth config is invalid or unreachable
7314
7468
  */
7315
7469
  getAuthMetadata() {
7316
- var _this82 = this;
7470
+ var _this85 = this;
7317
7471
  return _asyncToGenerator(function* () {
7318
7472
  var authMetadata;
7319
7473
  try {
7320
- var useStable = yield _this82.isVersionSupported("v1.15");
7321
- authMetadata = yield _this82.http.request(Method.Get, "/auth_metadata", undefined, undefined, {
7474
+ var useStable = yield _this85.isVersionSupported("v1.15");
7475
+ authMetadata = yield _this85.http.request(Method.Get, "/auth_metadata", undefined, undefined, {
7322
7476
  prefix: useStable ? ClientPrefix.V1 : ClientPrefix.Unstable + "/org.matrix.msc2965"
7323
7477
  });
7324
7478
  } catch (e) {
@@ -7326,7 +7480,7 @@ export class BriijClient extends TypedEventEmitter {
7326
7480
  // Fall back to older variant of MSC2965
7327
7481
  var {
7328
7482
  issuer
7329
- } = yield _this82.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
7483
+ } = yield _this85.http.request(Method.Get, "/auth_issuer", undefined, undefined, {
7330
7484
  prefix: ClientPrefix.Unstable + "/org.matrix.msc2965"
7331
7485
  });
7332
7486
  return discoverAndValidateOIDCIssuerWellKnown(issuer);