@unwanted/matrix-sdk-mini 34.12.0-1 → 34.12.0-3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (636) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/event.d.ts +0 -19
  3. package/lib/@types/event.d.ts.map +1 -1
  4. package/lib/@types/event.js.map +1 -1
  5. package/lib/@types/global.d.js +0 -2
  6. package/lib/@types/global.d.js.map +1 -1
  7. package/lib/browser-index.d.ts.map +1 -1
  8. package/lib/browser-index.js +0 -11
  9. package/lib/browser-index.js.map +1 -1
  10. package/lib/client.d.ts +2 -1224
  11. package/lib/client.d.ts.map +1 -1
  12. package/lib/client.js +345 -2826
  13. package/lib/client.js.map +1 -1
  14. package/lib/embedded.d.ts +0 -22
  15. package/lib/embedded.d.ts.map +1 -1
  16. package/lib/embedded.js +24 -167
  17. package/lib/embedded.js.map +1 -1
  18. package/lib/event-mapper.d.ts.map +1 -1
  19. package/lib/event-mapper.js +0 -4
  20. package/lib/event-mapper.js.map +1 -1
  21. package/lib/matrix.d.ts +0 -25
  22. package/lib/matrix.d.ts.map +1 -1
  23. package/lib/matrix.js +1 -30
  24. package/lib/matrix.js.map +1 -1
  25. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  26. package/lib/models/MSC3089Branch.js +0 -3
  27. package/lib/models/MSC3089Branch.js.map +1 -1
  28. package/lib/models/event.d.ts +0 -94
  29. package/lib/models/event.d.ts.map +1 -1
  30. package/lib/models/event.js +0 -274
  31. package/lib/models/event.js.map +1 -1
  32. package/lib/models/poll.d.ts.map +1 -1
  33. package/lib/models/poll.js +1 -5
  34. package/lib/models/poll.js.map +1 -1
  35. package/lib/models/relations-container.d.ts.map +1 -1
  36. package/lib/models/relations-container.js +1 -7
  37. package/lib/models/relations-container.js.map +1 -1
  38. package/lib/models/relations.d.ts +0 -1
  39. package/lib/models/relations.d.ts.map +1 -1
  40. package/lib/models/relations.js +0 -8
  41. package/lib/models/relations.js.map +1 -1
  42. package/lib/models/room-state.d.ts.map +1 -1
  43. package/lib/models/room-state.js +10 -26
  44. package/lib/models/room-state.js.map +1 -1
  45. package/lib/models/room.d.ts +0 -18
  46. package/lib/models/room.d.ts.map +1 -1
  47. package/lib/models/room.js +94 -148
  48. package/lib/models/room.js.map +1 -1
  49. package/lib/models/thread.d.ts.map +1 -1
  50. package/lib/models/thread.js +0 -1
  51. package/lib/models/thread.js.map +1 -1
  52. package/lib/sliding-sync-sdk.d.ts +2 -3
  53. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  54. package/lib/sliding-sync-sdk.js +41 -90
  55. package/lib/sliding-sync-sdk.js.map +1 -1
  56. package/lib/sync.d.ts +0 -12
  57. package/lib/sync.d.ts.map +1 -1
  58. package/lib/sync.js +1 -73
  59. package/lib/sync.js.map +1 -1
  60. package/lib/testing.d.ts +0 -48
  61. package/lib/testing.d.ts.map +1 -1
  62. package/lib/testing.js +0 -105
  63. package/lib/testing.js.map +1 -1
  64. package/package.json +1 -3
  65. package/src/@types/event.ts +2 -36
  66. package/src/@types/global.d.ts +0 -3
  67. package/src/browser-index.ts +0 -11
  68. package/src/client.ts +52 -2876
  69. package/src/embedded.ts +3 -132
  70. package/src/event-mapper.ts +0 -4
  71. package/src/matrix.ts +0 -41
  72. package/src/models/MSC3089Branch.ts +0 -3
  73. package/src/models/event.ts +0 -289
  74. package/src/models/poll.ts +0 -6
  75. package/src/models/relations-container.ts +1 -8
  76. package/src/models/relations.ts +0 -8
  77. package/src/models/room-state.ts +2 -8
  78. package/src/models/room.ts +0 -62
  79. package/src/models/thread.ts +0 -1
  80. package/src/sliding-sync-sdk.ts +2 -72
  81. package/src/sync.ts +1 -98
  82. package/src/testing.ts +0 -108
  83. package/lib/@types/crypto.d.ts +0 -47
  84. package/lib/@types/crypto.d.ts.map +0 -1
  85. package/lib/@types/crypto.js +0 -1
  86. package/lib/@types/crypto.js.map +0 -1
  87. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  88. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  89. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  90. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  91. package/lib/common-crypto/CryptoBackend.js +0 -73
  92. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  93. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  94. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  95. package/lib/common-crypto/key-passphrase.js +0 -33
  96. package/lib/common-crypto/key-passphrase.js.map +0 -1
  97. package/lib/crypto/CrossSigning.d.ts +0 -184
  98. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  99. package/lib/crypto/CrossSigning.js +0 -718
  100. package/lib/crypto/CrossSigning.js.map +0 -1
  101. package/lib/crypto/DeviceList.d.ts +0 -216
  102. package/lib/crypto/DeviceList.d.ts.map +0 -1
  103. package/lib/crypto/DeviceList.js +0 -892
  104. package/lib/crypto/DeviceList.js.map +0 -1
  105. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  106. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  107. package/lib/crypto/EncryptionSetup.js +0 -356
  108. package/lib/crypto/EncryptionSetup.js.map +0 -1
  109. package/lib/crypto/OlmDevice.d.ts +0 -457
  110. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  111. package/lib/crypto/OlmDevice.js +0 -1241
  112. package/lib/crypto/OlmDevice.js.map +0 -1
  113. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  114. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  115. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  116. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  117. package/lib/crypto/RoomList.d.ts +0 -26
  118. package/lib/crypto/RoomList.d.ts.map +0 -1
  119. package/lib/crypto/RoomList.js +0 -71
  120. package/lib/crypto/RoomList.js.map +0 -1
  121. package/lib/crypto/SecretSharing.d.ts +0 -24
  122. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  123. package/lib/crypto/SecretSharing.js +0 -194
  124. package/lib/crypto/SecretSharing.js.map +0 -1
  125. package/lib/crypto/SecretStorage.d.ts +0 -55
  126. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  127. package/lib/crypto/SecretStorage.js +0 -118
  128. package/lib/crypto/SecretStorage.js.map +0 -1
  129. package/lib/crypto/aes.d.ts +0 -6
  130. package/lib/crypto/aes.d.ts.map +0 -1
  131. package/lib/crypto/aes.js +0 -24
  132. package/lib/crypto/aes.js.map +0 -1
  133. package/lib/crypto/algorithms/base.d.ts +0 -156
  134. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  135. package/lib/crypto/algorithms/base.js +0 -187
  136. package/lib/crypto/algorithms/base.js.map +0 -1
  137. package/lib/crypto/algorithms/index.d.ts +0 -4
  138. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  139. package/lib/crypto/algorithms/index.js +0 -20
  140. package/lib/crypto/algorithms/index.js.map +0 -1
  141. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  142. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  143. package/lib/crypto/algorithms/megolm.js +0 -1822
  144. package/lib/crypto/algorithms/megolm.js.map +0 -1
  145. package/lib/crypto/algorithms/olm.d.ts +0 -5
  146. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  147. package/lib/crypto/algorithms/olm.js +0 -299
  148. package/lib/crypto/algorithms/olm.js.map +0 -1
  149. package/lib/crypto/api.d.ts +0 -32
  150. package/lib/crypto/api.d.ts.map +0 -1
  151. package/lib/crypto/api.js +0 -22
  152. package/lib/crypto/api.js.map +0 -1
  153. package/lib/crypto/backup.d.ts +0 -227
  154. package/lib/crypto/backup.d.ts.map +0 -1
  155. package/lib/crypto/backup.js +0 -824
  156. package/lib/crypto/backup.js.map +0 -1
  157. package/lib/crypto/crypto.d.ts +0 -3
  158. package/lib/crypto/crypto.d.ts.map +0 -1
  159. package/lib/crypto/crypto.js +0 -19
  160. package/lib/crypto/crypto.js.map +0 -1
  161. package/lib/crypto/dehydration.d.ts +0 -34
  162. package/lib/crypto/dehydration.d.ts.map +0 -1
  163. package/lib/crypto/dehydration.js +0 -252
  164. package/lib/crypto/dehydration.js.map +0 -1
  165. package/lib/crypto/device-converter.d.ts +0 -9
  166. package/lib/crypto/device-converter.d.ts.map +0 -1
  167. package/lib/crypto/device-converter.js +0 -42
  168. package/lib/crypto/device-converter.js.map +0 -1
  169. package/lib/crypto/deviceinfo.d.ts +0 -99
  170. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  171. package/lib/crypto/deviceinfo.js +0 -148
  172. package/lib/crypto/deviceinfo.js.map +0 -1
  173. package/lib/crypto/index.d.ts +0 -1209
  174. package/lib/crypto/index.d.ts.map +0 -1
  175. package/lib/crypto/index.js +0 -4097
  176. package/lib/crypto/index.js.map +0 -1
  177. package/lib/crypto/key_passphrase.d.ts +0 -14
  178. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  179. package/lib/crypto/key_passphrase.js +0 -44
  180. package/lib/crypto/key_passphrase.js.map +0 -1
  181. package/lib/crypto/keybackup.d.ts +0 -18
  182. package/lib/crypto/keybackup.d.ts.map +0 -1
  183. package/lib/crypto/keybackup.js +0 -1
  184. package/lib/crypto/keybackup.js.map +0 -1
  185. package/lib/crypto/olmlib.d.ts +0 -129
  186. package/lib/crypto/olmlib.d.ts.map +0 -1
  187. package/lib/crypto/olmlib.js +0 -492
  188. package/lib/crypto/olmlib.js.map +0 -1
  189. package/lib/crypto/recoverykey.d.ts +0 -2
  190. package/lib/crypto/recoverykey.d.ts.map +0 -1
  191. package/lib/crypto/recoverykey.js +0 -19
  192. package/lib/crypto/recoverykey.js.map +0 -1
  193. package/lib/crypto/store/base.d.ts +0 -252
  194. package/lib/crypto/store/base.d.ts.map +0 -1
  195. package/lib/crypto/store/base.js +0 -64
  196. package/lib/crypto/store/base.js.map +0 -1
  197. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  198. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  199. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  200. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  201. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  202. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  203. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  204. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  205. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  206. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  207. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  208. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  209. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  210. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  211. package/lib/crypto/store/memory-crypto-store.js +0 -622
  212. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  213. package/lib/crypto/verification/Base.d.ts +0 -105
  214. package/lib/crypto/verification/Base.d.ts.map +0 -1
  215. package/lib/crypto/verification/Base.js +0 -372
  216. package/lib/crypto/verification/Base.js.map +0 -1
  217. package/lib/crypto/verification/Error.d.ts +0 -35
  218. package/lib/crypto/verification/Error.d.ts.map +0 -1
  219. package/lib/crypto/verification/Error.js +0 -86
  220. package/lib/crypto/verification/Error.js.map +0 -1
  221. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  222. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  223. package/lib/crypto/verification/IllegalMethod.js +0 -43
  224. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  225. package/lib/crypto/verification/QRCode.d.ts +0 -51
  226. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  227. package/lib/crypto/verification/QRCode.js +0 -277
  228. package/lib/crypto/verification/QRCode.js.map +0 -1
  229. package/lib/crypto/verification/SAS.d.ts +0 -27
  230. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  231. package/lib/crypto/verification/SAS.js +0 -485
  232. package/lib/crypto/verification/SAS.js.map +0 -1
  233. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  234. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  235. package/lib/crypto/verification/SASDecimal.js +0 -34
  236. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  237. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  238. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  239. package/lib/crypto/verification/request/Channel.js +0 -1
  240. package/lib/crypto/verification/request/Channel.js.map +0 -1
  241. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  242. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  243. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  244. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  245. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  246. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  247. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  248. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  249. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  250. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  251. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  252. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  253. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  254. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  255. package/lib/crypto-api/CryptoEvent.js +0 -33
  256. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  257. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  258. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  259. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  260. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  261. package/lib/crypto-api/index.d.ts +0 -978
  262. package/lib/crypto-api/index.d.ts.map +0 -1
  263. package/lib/crypto-api/index.js +0 -304
  264. package/lib/crypto-api/index.js.map +0 -1
  265. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  266. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  267. package/lib/crypto-api/key-passphrase.js +0 -51
  268. package/lib/crypto-api/key-passphrase.js.map +0 -1
  269. package/lib/crypto-api/keybackup.d.ts +0 -88
  270. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  271. package/lib/crypto-api/keybackup.js +0 -1
  272. package/lib/crypto-api/keybackup.js.map +0 -1
  273. package/lib/crypto-api/recovery-key.d.ts +0 -11
  274. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  275. package/lib/crypto-api/recovery-key.js +0 -65
  276. package/lib/crypto-api/recovery-key.js.map +0 -1
  277. package/lib/crypto-api/verification.d.ts +0 -344
  278. package/lib/crypto-api/verification.d.ts.map +0 -1
  279. package/lib/crypto-api/verification.js +0 -91
  280. package/lib/crypto-api/verification.js.map +0 -1
  281. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  282. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  283. package/lib/matrixrtc/CallMembership.js +0 -197
  284. package/lib/matrixrtc/CallMembership.js.map +0 -1
  285. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  286. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  287. package/lib/matrixrtc/LivekitFocus.js +0 -20
  288. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  289. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  290. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  291. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  292. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  293. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  294. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  295. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  296. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  297. package/lib/matrixrtc/focus.d.ts +0 -10
  298. package/lib/matrixrtc/focus.d.ts.map +0 -1
  299. package/lib/matrixrtc/focus.js +0 -1
  300. package/lib/matrixrtc/focus.js.map +0 -1
  301. package/lib/matrixrtc/index.d.ts +0 -7
  302. package/lib/matrixrtc/index.d.ts.map +0 -1
  303. package/lib/matrixrtc/index.js +0 -21
  304. package/lib/matrixrtc/index.js.map +0 -1
  305. package/lib/matrixrtc/types.d.ts +0 -19
  306. package/lib/matrixrtc/types.d.ts.map +0 -1
  307. package/lib/matrixrtc/types.js +0 -1
  308. package/lib/matrixrtc/types.js.map +0 -1
  309. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  310. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  311. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  312. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  313. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  314. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  315. package/lib/rendezvous/RendezvousChannel.js +0 -1
  316. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  317. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  318. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  319. package/lib/rendezvous/RendezvousCode.js +0 -1
  320. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  321. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  322. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  323. package/lib/rendezvous/RendezvousError.js +0 -23
  324. package/lib/rendezvous/RendezvousError.js.map +0 -1
  325. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  326. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  327. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  328. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  329. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  330. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  331. package/lib/rendezvous/RendezvousIntent.js +0 -22
  332. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  333. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  334. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  335. package/lib/rendezvous/RendezvousTransport.js +0 -1
  336. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  337. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  338. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  339. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  340. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  341. package/lib/rendezvous/channels/index.d.ts +0 -2
  342. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  343. package/lib/rendezvous/channels/index.js +0 -18
  344. package/lib/rendezvous/channels/index.js.map +0 -1
  345. package/lib/rendezvous/index.d.ts +0 -10
  346. package/lib/rendezvous/index.d.ts.map +0 -1
  347. package/lib/rendezvous/index.js +0 -23
  348. package/lib/rendezvous/index.js.map +0 -1
  349. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  350. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  351. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  352. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  353. package/lib/rendezvous/transports/index.d.ts +0 -2
  354. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  355. package/lib/rendezvous/transports/index.js +0 -18
  356. package/lib/rendezvous/transports/index.js.map +0 -1
  357. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  358. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  359. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  360. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  361. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  362. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  363. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  364. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  365. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  366. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  367. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  368. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  369. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  370. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  371. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  372. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  373. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  374. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  375. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  376. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  377. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  378. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  379. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  380. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  381. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  382. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  383. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  384. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  385. package/lib/rust-crypto/backup.d.ts +0 -254
  386. package/lib/rust-crypto/backup.d.ts.map +0 -1
  387. package/lib/rust-crypto/backup.js +0 -837
  388. package/lib/rust-crypto/backup.js.map +0 -1
  389. package/lib/rust-crypto/constants.d.ts +0 -3
  390. package/lib/rust-crypto/constants.d.ts.map +0 -1
  391. package/lib/rust-crypto/constants.js +0 -19
  392. package/lib/rust-crypto/constants.js.map +0 -1
  393. package/lib/rust-crypto/device-converter.d.ts +0 -28
  394. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  395. package/lib/rust-crypto/device-converter.js +0 -123
  396. package/lib/rust-crypto/device-converter.js.map +0 -1
  397. package/lib/rust-crypto/index.d.ts +0 -61
  398. package/lib/rust-crypto/index.d.ts.map +0 -1
  399. package/lib/rust-crypto/index.js +0 -152
  400. package/lib/rust-crypto/index.js.map +0 -1
  401. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  402. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  403. package/lib/rust-crypto/libolm_migration.js +0 -459
  404. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  405. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  406. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  407. package/lib/rust-crypto/rust-crypto.js +0 -2016
  408. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  409. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  410. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  411. package/lib/rust-crypto/secret-storage.js +0 -63
  412. package/lib/rust-crypto/secret-storage.js.map +0 -1
  413. package/lib/rust-crypto/verification.d.ts +0 -319
  414. package/lib/rust-crypto/verification.d.ts.map +0 -1
  415. package/lib/rust-crypto/verification.js +0 -816
  416. package/lib/rust-crypto/verification.js.map +0 -1
  417. package/lib/secret-storage.d.ts +0 -370
  418. package/lib/secret-storage.d.ts.map +0 -1
  419. package/lib/secret-storage.js +0 -466
  420. package/lib/secret-storage.js.map +0 -1
  421. package/lib/webrtc/audioContext.d.ts +0 -15
  422. package/lib/webrtc/audioContext.d.ts.map +0 -1
  423. package/lib/webrtc/audioContext.js +0 -46
  424. package/lib/webrtc/audioContext.js.map +0 -1
  425. package/lib/webrtc/call.d.ts +0 -560
  426. package/lib/webrtc/call.d.ts.map +0 -1
  427. package/lib/webrtc/call.js +0 -2541
  428. package/lib/webrtc/call.js.map +0 -1
  429. package/lib/webrtc/callEventHandler.d.ts +0 -37
  430. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  431. package/lib/webrtc/callEventHandler.js +0 -344
  432. package/lib/webrtc/callEventHandler.js.map +0 -1
  433. package/lib/webrtc/callEventTypes.d.ts +0 -73
  434. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  435. package/lib/webrtc/callEventTypes.js +0 -13
  436. package/lib/webrtc/callEventTypes.js.map +0 -1
  437. package/lib/webrtc/callFeed.d.ts +0 -128
  438. package/lib/webrtc/callFeed.d.ts.map +0 -1
  439. package/lib/webrtc/callFeed.js +0 -289
  440. package/lib/webrtc/callFeed.js.map +0 -1
  441. package/lib/webrtc/groupCall.d.ts +0 -323
  442. package/lib/webrtc/groupCall.d.ts.map +0 -1
  443. package/lib/webrtc/groupCall.js +0 -1337
  444. package/lib/webrtc/groupCall.js.map +0 -1
  445. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  446. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  447. package/lib/webrtc/groupCallEventHandler.js +0 -178
  448. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  449. package/lib/webrtc/mediaHandler.d.ts +0 -89
  450. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  451. package/lib/webrtc/mediaHandler.js +0 -437
  452. package/lib/webrtc/mediaHandler.js.map +0 -1
  453. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  454. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  455. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  456. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  457. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  458. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  459. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  460. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  461. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  462. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  463. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  464. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  465. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  466. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  467. package/lib/webrtc/stats/connectionStats.js +0 -26
  468. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  469. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  470. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  471. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  472. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  473. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  474. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  475. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  476. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  477. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  478. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  479. package/lib/webrtc/stats/groupCallStats.js +0 -78
  480. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  481. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  482. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  483. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  484. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  485. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  486. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  487. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  488. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  489. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  490. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  491. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  492. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  493. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  494. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  495. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  496. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  497. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  498. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  499. package/lib/webrtc/stats/statsReport.js +0 -32
  500. package/lib/webrtc/stats/statsReport.js.map +0 -1
  501. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  502. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  503. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  504. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  505. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  506. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  507. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  508. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  509. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  510. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  511. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  512. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  513. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  514. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  515. package/lib/webrtc/stats/transportStats.js +0 -1
  516. package/lib/webrtc/stats/transportStats.js.map +0 -1
  517. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  518. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  519. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  520. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  521. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  522. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  523. package/lib/webrtc/stats/valueFormatter.js +0 -25
  524. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  525. package/src/@types/crypto.ts +0 -73
  526. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  527. package/src/common-crypto/CryptoBackend.ts +0 -302
  528. package/src/common-crypto/README.md +0 -4
  529. package/src/common-crypto/key-passphrase.ts +0 -43
  530. package/src/crypto/CrossSigning.ts +0 -773
  531. package/src/crypto/DeviceList.ts +0 -989
  532. package/src/crypto/EncryptionSetup.ts +0 -351
  533. package/src/crypto/OlmDevice.ts +0 -1500
  534. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  535. package/src/crypto/RoomList.ts +0 -70
  536. package/src/crypto/SecretSharing.ts +0 -240
  537. package/src/crypto/SecretStorage.ts +0 -136
  538. package/src/crypto/aes.ts +0 -23
  539. package/src/crypto/algorithms/base.ts +0 -236
  540. package/src/crypto/algorithms/index.ts +0 -20
  541. package/src/crypto/algorithms/megolm.ts +0 -2216
  542. package/src/crypto/algorithms/olm.ts +0 -381
  543. package/src/crypto/api.ts +0 -70
  544. package/src/crypto/backup.ts +0 -922
  545. package/src/crypto/crypto.ts +0 -18
  546. package/src/crypto/dehydration.ts +0 -272
  547. package/src/crypto/device-converter.ts +0 -45
  548. package/src/crypto/deviceinfo.ts +0 -158
  549. package/src/crypto/index.ts +0 -4414
  550. package/src/crypto/key_passphrase.ts +0 -42
  551. package/src/crypto/keybackup.ts +0 -47
  552. package/src/crypto/olmlib.ts +0 -539
  553. package/src/crypto/recoverykey.ts +0 -18
  554. package/src/crypto/store/base.ts +0 -348
  555. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  556. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  557. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  558. package/src/crypto/store/memory-crypto-store.ts +0 -680
  559. package/src/crypto/verification/Base.ts +0 -409
  560. package/src/crypto/verification/Error.ts +0 -76
  561. package/src/crypto/verification/IllegalMethod.ts +0 -50
  562. package/src/crypto/verification/QRCode.ts +0 -310
  563. package/src/crypto/verification/SAS.ts +0 -494
  564. package/src/crypto/verification/SASDecimal.ts +0 -37
  565. package/src/crypto/verification/request/Channel.ts +0 -34
  566. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  567. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  568. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  569. package/src/crypto-api/CryptoEvent.ts +0 -93
  570. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  571. package/src/crypto-api/index.ts +0 -1175
  572. package/src/crypto-api/key-passphrase.ts +0 -58
  573. package/src/crypto-api/keybackup.ts +0 -115
  574. package/src/crypto-api/recovery-key.ts +0 -69
  575. package/src/crypto-api/verification.ts +0 -408
  576. package/src/matrixrtc/CallMembership.ts +0 -247
  577. package/src/matrixrtc/LivekitFocus.ts +0 -39
  578. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  579. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  580. package/src/matrixrtc/focus.ts +0 -25
  581. package/src/matrixrtc/index.ts +0 -22
  582. package/src/matrixrtc/types.ts +0 -36
  583. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  584. package/src/rendezvous/RendezvousChannel.ts +0 -48
  585. package/src/rendezvous/RendezvousCode.ts +0 -25
  586. package/src/rendezvous/RendezvousError.ts +0 -26
  587. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  588. package/src/rendezvous/RendezvousIntent.ts +0 -20
  589. package/src/rendezvous/RendezvousTransport.ts +0 -58
  590. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  591. package/src/rendezvous/channels/index.ts +0 -17
  592. package/src/rendezvous/index.ts +0 -25
  593. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  594. package/src/rendezvous/transports/index.ts +0 -17
  595. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  596. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  597. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  598. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  599. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  600. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  601. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  602. package/src/rust-crypto/backup.ts +0 -881
  603. package/src/rust-crypto/constants.ts +0 -18
  604. package/src/rust-crypto/device-converter.ts +0 -128
  605. package/src/rust-crypto/index.ts +0 -237
  606. package/src/rust-crypto/libolm_migration.ts +0 -530
  607. package/src/rust-crypto/rust-crypto.ts +0 -2205
  608. package/src/rust-crypto/secret-storage.ts +0 -60
  609. package/src/rust-crypto/verification.ts +0 -830
  610. package/src/secret-storage.ts +0 -693
  611. package/src/webrtc/audioContext.ts +0 -44
  612. package/src/webrtc/call.ts +0 -3074
  613. package/src/webrtc/callEventHandler.ts +0 -425
  614. package/src/webrtc/callEventTypes.ts +0 -93
  615. package/src/webrtc/callFeed.ts +0 -364
  616. package/src/webrtc/groupCall.ts +0 -1735
  617. package/src/webrtc/groupCallEventHandler.ts +0 -234
  618. package/src/webrtc/mediaHandler.ts +0 -484
  619. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  620. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  621. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  622. package/src/webrtc/stats/connectionStats.ts +0 -47
  623. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  624. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  625. package/src/webrtc/stats/groupCallStats.ts +0 -93
  626. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  627. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  628. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  629. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  630. package/src/webrtc/stats/statsReport.ts +0 -133
  631. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  632. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  633. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  634. package/src/webrtc/stats/transportStats.ts +0 -26
  635. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  636. package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1,466 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- /*
3
- Copyright 2021-2023 The Matrix.org Foundation C.I.C.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- /**
19
- * Implementation of server-side secret storage
20
- *
21
- * @see https://spec.matrix.org/v1.6/client-server-api/#storage
22
- */
23
-
24
- import { ClientEvent } from "./client.js";
25
- import { randomString } from "./randomstring.js";
26
- import { logger } from "./logger.js";
27
- import encryptAESSecretStorageItem from "./utils/encryptAESSecretStorageItem.js";
28
- import decryptAESSecretStorageItem from "./utils/decryptAESSecretStorageItem.js";
29
- export var SECRET_STORAGE_ALGORITHM_V1_AES = "m.secret_storage.v1.aes-hmac-sha2";
30
-
31
- /**
32
- * Common base interface for Secret Storage Keys.
33
- *
34
- * The common properties for all encryption keys used in server-side secret storage.
35
- *
36
- * @see https://spec.matrix.org/v1.6/client-server-api/#key-storage
37
- */
38
-
39
- /**
40
- * Properties for a SSSS key using the `m.secret_storage.v1.aes-hmac-sha2` algorithm.
41
- *
42
- * Corresponds to `AesHmacSha2KeyDescription` in the specification.
43
- *
44
- * @see https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2
45
- */
46
-
47
- /**
48
- * Union type for secret storage keys.
49
- *
50
- * For now, this is only {@link SecretStorageKeyDescriptionAesV1}, but other interfaces may be added in future.
51
- */
52
-
53
- /**
54
- * Information on how to generate the key from a passphrase.
55
- *
56
- * @see https://spec.matrix.org/v1.6/client-server-api/#deriving-keys-from-passphrases
57
- */
58
-
59
- /**
60
- * Options for {@link ServerSideSecretStorageImpl#addKey}.
61
- */
62
-
63
- /**
64
- * Return type for {@link ServerSideSecretStorageImpl#getKey}.
65
- */
66
-
67
- /**
68
- * Return type for {@link ServerSideSecretStorageImpl#addKey}.
69
- */
70
-
71
- /** Interface for managing account data on the server.
72
- *
73
- * A subset of {@link MatrixClient}.
74
- */
75
-
76
- /**
77
- * Application callbacks for use with {@link SecretStorage.ServerSideSecretStorageImpl}
78
- */
79
-
80
- /**
81
- * Interface provided by SecretStorage implementations
82
- *
83
- * Normally this will just be an {@link ServerSideSecretStorageImpl}, but for backwards
84
- * compatibility some methods allow other implementations.
85
- */
86
-
87
- /**
88
- * Implementation of Server-side secret storage.
89
- *
90
- * Secret *sharing* is *not* implemented here: this class is strictly about the storage component of
91
- * SSSS.
92
- *
93
- * @see https://spec.matrix.org/v1.6/client-server-api/#storage
94
- */
95
- export class ServerSideSecretStorageImpl {
96
- /**
97
- * Construct a new `SecretStorage`.
98
- *
99
- * Normally, it is unnecessary to call this directly, since MatrixClient automatically constructs one.
100
- * However, it may be useful to construct a new `SecretStorage`, if custom `callbacks` are required, for example.
101
- *
102
- * @param accountDataAdapter - interface for fetching and setting account data on the server. Normally an instance
103
- * of {@link MatrixClient}.
104
- * @param callbacks - application level callbacks for retrieving secret keys
105
- */
106
- constructor(accountDataAdapter, callbacks) {
107
- this.accountDataAdapter = accountDataAdapter;
108
- this.callbacks = callbacks;
109
- }
110
-
111
- /**
112
- * Get the current default key ID for encrypting secrets.
113
- *
114
- * @returns The default key ID or null if no default key ID is set
115
- */
116
- getDefaultKeyId() {
117
- var _this = this;
118
- return _asyncToGenerator(function* () {
119
- var defaultKey = yield _this.accountDataAdapter.getAccountDataFromServer("m.secret_storage.default_key");
120
- if (!defaultKey) return null;
121
- return defaultKey.key;
122
- })();
123
- }
124
-
125
- /**
126
- * Set the default key ID for encrypting secrets.
127
- *
128
- * @param keyId - The new default key ID
129
- */
130
- setDefaultKeyId(keyId) {
131
- return new Promise((resolve, reject) => {
132
- var listener = ev => {
133
- if (ev.getType() === "m.secret_storage.default_key" && ev.getContent().key === keyId) {
134
- this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);
135
- resolve();
136
- }
137
- };
138
- this.accountDataAdapter.on(ClientEvent.AccountData, listener);
139
- this.accountDataAdapter.setAccountData("m.secret_storage.default_key", {
140
- key: keyId
141
- }).catch(e => {
142
- this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);
143
- reject(e);
144
- });
145
- });
146
- }
147
-
148
- /**
149
- * Add a key for encrypting secrets.
150
- *
151
- * @param algorithm - the algorithm used by the key.
152
- * @param opts - the options for the algorithm. The properties used
153
- * depend on the algorithm given.
154
- * @param keyId - the ID of the key. If not given, a random
155
- * ID will be generated.
156
- *
157
- * @returns An object with:
158
- * keyId: the ID of the key
159
- * keyInfo: details about the key (iv, mac, passphrase)
160
- */
161
- addKey(algorithm, opts, keyId) {
162
- var _this2 = this;
163
- return _asyncToGenerator(function* () {
164
- if (algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {
165
- throw new Error("Unknown key algorithm ".concat(algorithm));
166
- }
167
- var keyInfo = {
168
- algorithm
169
- };
170
- if (opts.name) {
171
- keyInfo.name = opts.name;
172
- }
173
- if (opts.passphrase) {
174
- keyInfo.passphrase = opts.passphrase;
175
- }
176
- var {
177
- iv,
178
- mac
179
- } = yield calculateKeyCheck(opts.key);
180
- keyInfo.iv = iv;
181
- keyInfo.mac = mac;
182
-
183
- // Create a unique key id. XXX: this is racey.
184
- if (!keyId) {
185
- do {
186
- keyId = randomString(32);
187
- } while (yield _this2.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key.".concat(keyId)));
188
- }
189
- yield _this2.accountDataAdapter.setAccountData("m.secret_storage.key.".concat(keyId), keyInfo);
190
- return {
191
- keyId,
192
- keyInfo
193
- };
194
- })();
195
- }
196
-
197
- /**
198
- * Get the key information for a given ID.
199
- *
200
- * @param keyId - The ID of the key to check
201
- * for. Defaults to the default key ID if not provided.
202
- * @returns If the key was found, the return value is an array of
203
- * the form [keyId, keyInfo]. Otherwise, null is returned.
204
- * XXX: why is this an array when addKey returns an object?
205
- */
206
- getKey(keyId) {
207
- var _this3 = this;
208
- return _asyncToGenerator(function* () {
209
- if (!keyId) {
210
- keyId = yield _this3.getDefaultKeyId();
211
- }
212
- if (!keyId) {
213
- return null;
214
- }
215
- var keyInfo = yield _this3.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + keyId);
216
- return keyInfo ? [keyId, keyInfo] : null;
217
- })();
218
- }
219
-
220
- /**
221
- * Check whether we have a key with a given ID.
222
- *
223
- * @param keyId - The ID of the key to check
224
- * for. Defaults to the default key ID if not provided.
225
- * @returns Whether we have the key.
226
- */
227
- hasKey(keyId) {
228
- var _this4 = this;
229
- return _asyncToGenerator(function* () {
230
- var key = yield _this4.getKey(keyId);
231
- return Boolean(key);
232
- })();
233
- }
234
-
235
- /**
236
- * Check whether a key matches what we expect based on the key info
237
- *
238
- * @param key - the key to check
239
- * @param info - the key info
240
- *
241
- * @returns whether or not the key matches
242
- */
243
- checkKey(key, info) {
244
- return _asyncToGenerator(function* () {
245
- if (info.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
246
- if (info.mac) {
247
- var {
248
- mac
249
- } = yield calculateKeyCheck(key, info.iv);
250
- return trimTrailingEquals(info.mac) === trimTrailingEquals(mac);
251
- } else {
252
- // if we have no information, we have to assume the key is right
253
- return true;
254
- }
255
- } else {
256
- throw new Error("Unknown algorithm");
257
- }
258
- })();
259
- }
260
-
261
- /**
262
- * Store an encrypted secret on the server.
263
- *
264
- * Details of the encryption keys to be used must previously have been stored in account data
265
- * (for example, via {@link ServerSideSecretStorageImpl#addKey}. {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage
266
- * key to decrypt the secret.
267
- *
268
- * @param name - The name of the secret - i.e., the "event type" to be stored in the account data
269
- * @param secret - The secret contents.
270
- * @param keys - The IDs of the keys to use to encrypt the secret, or null/undefined to use the default key.
271
- */
272
- store(name, secret, keys) {
273
- var _this5 = this;
274
- return _asyncToGenerator(function* () {
275
- var encrypted = {};
276
- if (!keys) {
277
- var defaultKeyId = yield _this5.getDefaultKeyId();
278
- if (!defaultKeyId) {
279
- throw new Error("No keys specified and no default key present");
280
- }
281
- keys = [defaultKeyId];
282
- }
283
- if (keys.length === 0) {
284
- throw new Error("Zero keys given to encrypt with!");
285
- }
286
- for (var _keyId of keys) {
287
- // get key information from key storage
288
- var _keyInfo = yield _this5.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + _keyId);
289
- if (!_keyInfo) {
290
- throw new Error("Unknown key: " + _keyId);
291
- }
292
-
293
- // encrypt secret, based on the algorithm
294
- if (_keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
295
- var _keys = {
296
- [_keyId]: _keyInfo
297
- };
298
- var [, encryption] = yield _this5.getSecretStorageKey(_keys, name);
299
- encrypted[_keyId] = yield encryption.encrypt(secret);
300
- } else {
301
- logger.warn("unknown algorithm for secret storage key " + _keyId + ": " + _keyInfo.algorithm);
302
- // do nothing if we don't understand the encryption algorithm
303
- }
304
- }
305
-
306
- // save encrypted secret
307
- yield _this5.accountDataAdapter.setAccountData(name, {
308
- encrypted
309
- });
310
- })();
311
- }
312
-
313
- /**
314
- * Get a secret from storage, and decrypt it.
315
- *
316
- * {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage
317
- * key to decrypt the secret.
318
- *
319
- * @param name - the name of the secret - i.e., the "event type" stored in the account data
320
- *
321
- * @returns the decrypted contents of the secret, or "undefined" if `name` is not found in
322
- * the user's account data.
323
- */
324
- get(name) {
325
- var _this6 = this;
326
- return _asyncToGenerator(function* () {
327
- var secretInfo = yield _this6.accountDataAdapter.getAccountDataFromServer(name);
328
- if (!secretInfo) {
329
- return;
330
- }
331
- if (!secretInfo.encrypted) {
332
- throw new Error("Content is not encrypted!");
333
- }
334
-
335
- // get possible keys to decrypt
336
- var keys = {};
337
- for (var _keyId2 of Object.keys(secretInfo.encrypted)) {
338
- // get key information from key storage
339
- var _keyInfo2 = yield _this6.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + _keyId2);
340
- var _encInfo = secretInfo.encrypted[_keyId2];
341
- // only use keys we understand the encryption algorithm of
342
- if ((_keyInfo2 === null || _keyInfo2 === void 0 ? void 0 : _keyInfo2.algorithm) === SECRET_STORAGE_ALGORITHM_V1_AES) {
343
- if (_encInfo.iv && _encInfo.ciphertext && _encInfo.mac) {
344
- keys[_keyId2] = _keyInfo2;
345
- }
346
- }
347
- }
348
- if (Object.keys(keys).length === 0) {
349
- throw new Error("Could not decrypt ".concat(name, " because none of ") + "the keys it is encrypted with are for a supported algorithm");
350
- }
351
-
352
- // fetch private key from app
353
- var [keyId, decryption] = yield _this6.getSecretStorageKey(keys, name);
354
- var encInfo = secretInfo.encrypted[keyId];
355
- return decryption.decrypt(encInfo);
356
- })();
357
- }
358
-
359
- /**
360
- * Check if a secret is stored on the server.
361
- *
362
- * @param name - the name of the secret
363
- *
364
- * @returns map of key name to key info the secret is encrypted
365
- * with, or null if it is not present or not encrypted with a trusted
366
- * key
367
- */
368
- isStored(name) {
369
- var _this7 = this;
370
- return _asyncToGenerator(function* () {
371
- // check if secret exists
372
- var secretInfo = yield _this7.accountDataAdapter.getAccountDataFromServer(name);
373
- if (!(secretInfo !== null && secretInfo !== void 0 && secretInfo.encrypted)) return null;
374
- var ret = {};
375
-
376
- // filter secret encryption keys with supported algorithm
377
- for (var _keyId3 of Object.keys(secretInfo.encrypted)) {
378
- // get key information from key storage
379
- var _keyInfo3 = yield _this7.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + _keyId3);
380
- if (!_keyInfo3) continue;
381
- var encInfo = secretInfo.encrypted[_keyId3];
382
-
383
- // only use keys we understand the encryption algorithm of
384
- if (_keyInfo3.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
385
- if (encInfo.iv && encInfo.ciphertext && encInfo.mac) {
386
- ret[_keyId3] = _keyInfo3;
387
- }
388
- }
389
- }
390
- return Object.keys(ret).length ? ret : null;
391
- })();
392
- }
393
- getSecretStorageKey(keys, name) {
394
- var _this8 = this;
395
- return _asyncToGenerator(function* () {
396
- if (!_this8.callbacks.getSecretStorageKey) {
397
- throw new Error("No getSecretStorageKey callback supplied");
398
- }
399
- var returned = yield _this8.callbacks.getSecretStorageKey({
400
- keys
401
- }, name);
402
- if (!returned) {
403
- throw new Error("getSecretStorageKey callback returned falsey");
404
- }
405
- if (returned.length < 2) {
406
- throw new Error("getSecretStorageKey callback returned invalid data");
407
- }
408
- var [keyId, privateKey] = returned;
409
- if (!keys[keyId]) {
410
- throw new Error("App returned unknown key from getSecretStorageKey!");
411
- }
412
- if (keys[keyId].algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
413
- var decryption = {
414
- encrypt: function encrypt(secret) {
415
- return encryptAESSecretStorageItem(secret, privateKey, name);
416
- },
417
- decrypt: function decrypt(encInfo) {
418
- return decryptAESSecretStorageItem(encInfo, privateKey, name);
419
- }
420
- };
421
- return [keyId, decryption];
422
- } else {
423
- throw new Error("Unknown key type: " + keys[keyId].algorithm);
424
- }
425
- })();
426
- }
427
- }
428
-
429
- /** trim trailing instances of '=' from a string
430
- *
431
- * @internal
432
- *
433
- * @param input - input string
434
- */
435
- export function trimTrailingEquals(input) {
436
- // according to Sonar and CodeQL, a regex such as /=+$/ is superlinear.
437
- // Not sure I believe it, but it's easy enough to work around.
438
-
439
- // find the number of characters before the trailing =
440
- var i = input.length;
441
- while (i >= 1 && input.charCodeAt(i - 1) == 0x3d) i--;
442
-
443
- // trim to the calculated length
444
- if (i < input.length) {
445
- return input.substring(0, i);
446
- } else {
447
- return input;
448
- }
449
- }
450
-
451
- // string of zeroes, for calculating the key check
452
- var ZERO_STR = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
453
-
454
- /**
455
- * Calculate the MAC for checking the key.
456
- * See https://spec.matrix.org/v1.11/client-server-api/#msecret_storagev1aes-hmac-sha2, steps 3 and 4.
457
- *
458
- * @param key - the key to use
459
- * @param iv - The initialization vector as a base64-encoded string.
460
- * If omitted, a random initialization vector will be created.
461
- * @returns An object that contains, `mac` and `iv` properties.
462
- */
463
- export function calculateKeyCheck(key, iv) {
464
- return encryptAESSecretStorageItem(ZERO_STR, key, "", iv);
465
- }
466
- //# sourceMappingURL=secret-storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"secret-storage.js","names":["ClientEvent","randomString","logger","encryptAESSecretStorageItem","decryptAESSecretStorageItem","SECRET_STORAGE_ALGORITHM_V1_AES","ServerSideSecretStorageImpl","constructor","accountDataAdapter","callbacks","getDefaultKeyId","_this","_asyncToGenerator","defaultKey","getAccountDataFromServer","key","setDefaultKeyId","keyId","Promise","resolve","reject","listener","ev","getType","getContent","removeListener","AccountData","on","setAccountData","catch","e","addKey","algorithm","opts","_this2","Error","concat","keyInfo","name","passphrase","iv","mac","calculateKeyCheck","getKey","_this3","hasKey","_this4","Boolean","checkKey","info","trimTrailingEquals","store","secret","keys","_this5","encrypted","defaultKeyId","length","encryption","getSecretStorageKey","encrypt","warn","get","_this6","secretInfo","Object","encInfo","ciphertext","decryption","decrypt","isStored","_this7","ret","_this8","returned","privateKey","input","i","charCodeAt","substring","ZERO_STR"],"sources":["../src/secret-storage.ts"],"sourcesContent":["/*\nCopyright 2021-2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Implementation of server-side secret storage\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#storage\n */\n\nimport { TypedEventEmitter } from \"./models/typed-event-emitter.ts\";\nimport { ClientEvent, ClientEventHandlerMap } from \"./client.ts\";\nimport { MatrixEvent } from \"./models/event.ts\";\nimport { randomString } from \"./randomstring.ts\";\nimport { logger } from \"./logger.ts\";\nimport encryptAESSecretStorageItem from \"./utils/encryptAESSecretStorageItem.ts\";\nimport decryptAESSecretStorageItem from \"./utils/decryptAESSecretStorageItem.ts\";\nimport { AESEncryptedSecretStoragePayload } from \"./@types/AESEncryptedSecretStoragePayload.ts\";\n\nexport const SECRET_STORAGE_ALGORITHM_V1_AES = \"m.secret_storage.v1.aes-hmac-sha2\";\n\n/**\n * Common base interface for Secret Storage Keys.\n *\n * The common properties for all encryption keys used in server-side secret storage.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#key-storage\n */\nexport interface SecretStorageKeyDescriptionCommon {\n /** A human-readable name for this key. */\n // XXX: according to the spec, this is optional\n name: string;\n\n /** The encryption algorithm used with this key. */\n algorithm: string;\n\n /** Information for deriving this key from a passphrase. */\n // XXX: according to the spec, this is optional\n passphrase: PassphraseInfo;\n}\n\n/**\n * Properties for a SSSS key using the `m.secret_storage.v1.aes-hmac-sha2` algorithm.\n *\n * Corresponds to `AesHmacSha2KeyDescription` in the specification.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2\n */\nexport interface SecretStorageKeyDescriptionAesV1 extends SecretStorageKeyDescriptionCommon {\n // XXX: strictly speaking, we should be able to enforce the algorithm here. But\n // this interface ends up being incorrectly used where other algorithms are in use (notably\n // in device-dehydration support), and unpicking that is too much like hard work\n // at the moment.\n // algorithm: \"m.secret_storage.v1.aes-hmac-sha2\";\n\n /** The 16-byte AES initialization vector, encoded as base64. */\n iv: string;\n\n /** The MAC of the result of encrypting 32 bytes of 0, encoded as base64. */\n mac: string;\n}\n\n/**\n * Union type for secret storage keys.\n *\n * For now, this is only {@link SecretStorageKeyDescriptionAesV1}, but other interfaces may be added in future.\n */\nexport type SecretStorageKeyDescription = SecretStorageKeyDescriptionAesV1;\n\n/**\n * Information on how to generate the key from a passphrase.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#deriving-keys-from-passphrases\n */\nexport interface PassphraseInfo {\n /** The algorithm to be used to derive the key. */\n algorithm: \"m.pbkdf2\";\n\n /** The number of PBKDF2 iterations to use. */\n iterations: number;\n\n /** The salt to be used for PBKDF2. */\n salt: string;\n\n /** The number of bits to generate. Defaults to 256. */\n bits?: number;\n}\n\n/**\n * Options for {@link ServerSideSecretStorageImpl#addKey}.\n */\nexport interface AddSecretStorageKeyOpts {\n /** Information for deriving the key from a passphrase if any. */\n passphrase?: PassphraseInfo;\n /** Optional name of the key. */\n name?: string;\n /** The private key. Will be used to generate the key check values in the key info; it will not be stored on the server */\n key: Uint8Array;\n}\n\n/**\n * Return type for {@link ServerSideSecretStorageImpl#getKey}.\n */\nexport type SecretStorageKeyTuple = [keyId: string, keyInfo: SecretStorageKeyDescription];\n\n/**\n * Return type for {@link ServerSideSecretStorageImpl#addKey}.\n */\nexport type SecretStorageKeyObject = {\n /** The ID of the key */\n keyId: string;\n /** details about the key */\n keyInfo: SecretStorageKeyDescription;\n};\n\n/** Interface for managing account data on the server.\n *\n * A subset of {@link MatrixClient}.\n */\nexport interface AccountDataClient extends TypedEventEmitter<ClientEvent.AccountData, ClientEventHandlerMap> {\n /**\n * Get account data event of given type for the current user. This variant\n * gets account data directly from the homeserver if the local store is not\n * ready, which can be useful very early in startup before the initial sync.\n *\n * @param eventType - The type of account data\n * @returns The contents of the given account data event, or `null` if the event is not found\n */\n getAccountDataFromServer: <T extends Record<string, any>>(eventType: string) => Promise<T | null>;\n\n /**\n * Set account data event for the current user, with retries\n *\n * @param eventType - The type of account data\n * @param content - the content object to be set\n * @returns an empty object\n */\n setAccountData: (eventType: string, content: any) => Promise<{}>;\n}\n\n/**\n * Application callbacks for use with {@link SecretStorage.ServerSideSecretStorageImpl}\n */\nexport interface SecretStorageCallbacks {\n /**\n * Called to retrieve a secret storage encryption key\n *\n * Before a secret can be stored in server-side storage, it must be encrypted with one or more\n * keys. Similarly, after it has been retrieved from storage, it must be decrypted with one of\n * the keys it was encrypted with. These encryption keys are known as \"secret storage keys\".\n *\n * Descriptions of the secret storage keys are also stored in server-side storage, per the\n * [matrix specification](https://spec.matrix.org/v1.6/client-server-api/#key-storage), so\n * before a key can be used in this way, it must have been stored on the server. This is\n * done via {@link ServerSideSecretStorage#addKey}.\n *\n * Obviously the keys themselves are not stored server-side, so the js-sdk calls this callback\n * in order to retrieve a secret storage key from the application.\n *\n * @param keys - An options object, containing only the property `keys`.\n *\n * @param name - the name of the *secret* (NB: not the encryption key) being stored or retrieved.\n * This is the \"event type\" stored in account data.\n *\n * @returns a pair [`keyId`, `privateKey`], where `keyId` is one of the keys from the `keys` parameter,\n * and `privateKey` is the raw private encryption key, as appropriate for the encryption algorithm.\n * (For `m.secret_storage.v1.aes-hmac-sha2`, it is the input to an HKDF as defined in the\n * [specification](https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2).)\n *\n * Alternatively, if none of the keys are known, may return `null` — in which case the original\n * storage/retrieval operation will fail with an exception.\n */\n getSecretStorageKey?: (\n keys: {\n /**\n * details of the secret storage keys required: a map from the key ID\n * (excluding the `m.secret_storage.key.` prefix) to details of the key.\n *\n * When storing a secret, `keys` will contain exactly one entry; this method will be called\n * once for each secret storage key to be used for encryption.\n *\n * For secret retrieval, `keys` may contain several entries, and the application can return\n * any one of the requested keys.\n */\n keys: Record<string, SecretStorageKeyDescription>;\n },\n name: string,\n ) => Promise<[string, Uint8Array] | null>;\n}\n\ninterface SecretInfo {\n encrypted: {\n [keyId: string]: AESEncryptedSecretStoragePayload;\n };\n}\n\ninterface Decryptors {\n encrypt: (plaintext: string) => Promise<AESEncryptedSecretStoragePayload>;\n decrypt: (ciphertext: AESEncryptedSecretStoragePayload) => Promise<string>;\n}\n\n/**\n * Interface provided by SecretStorage implementations\n *\n * Normally this will just be an {@link ServerSideSecretStorageImpl}, but for backwards\n * compatibility some methods allow other implementations.\n */\nexport interface ServerSideSecretStorage {\n /**\n * Add a key for encrypting secrets.\n *\n * @param algorithm - the algorithm used by the key.\n * @param opts - the options for the algorithm. The properties used\n * depend on the algorithm given.\n * @param keyId - the ID of the key. If not given, a random\n * ID will be generated.\n *\n * @returns details about the key.\n */\n addKey(algorithm: string, opts: AddSecretStorageKeyOpts, keyId?: string): Promise<SecretStorageKeyObject>;\n\n /**\n * Get the key information for a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns If the key was found, the return value is an array of\n * the form [keyId, keyInfo]. Otherwise, null is returned.\n * XXX: why is this an array when addKey returns an object?\n */\n getKey(keyId?: string | null): Promise<SecretStorageKeyTuple | null>;\n\n /**\n * Check whether we have a key with a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns Whether we have the key.\n */\n hasKey(keyId?: string): Promise<boolean>;\n\n /**\n * Check whether a key matches what we expect based on the key info\n *\n * @param key - the key to check\n * @param info - the key info\n *\n * @returns whether or not the key matches\n */\n checkKey(key: Uint8Array, info: SecretStorageKeyDescriptionAesV1): Promise<boolean>;\n\n /**\n * Store an encrypted secret on the server.\n *\n * Details of the encryption keys to be used must previously have been stored in account data\n * (for example, via {@link ServerSideSecretStorage#addKey}.\n *\n * @param name - The name of the secret - i.e., the \"event type\" to be stored in the account data\n * @param secret - The secret contents.\n * @param keys - The IDs of the keys to use to encrypt the secret, or null/undefined to use the default key\n * (will throw if no default key is set).\n */\n store(name: string, secret: string, keys?: string[] | null): Promise<void>;\n\n /**\n * Get a secret from storage, and decrypt it.\n *\n * @param name - the name of the secret - i.e., the \"event type\" stored in the account data\n *\n * @returns the decrypted contents of the secret, or \"undefined\" if `name` is not found in\n * the user's account data.\n */\n get(name: string): Promise<string | undefined>;\n\n /**\n * Check if a secret is stored on the server.\n *\n * @param name - the name of the secret\n *\n * @returns map of key name to key info the secret is encrypted\n * with, or null if it is not present or not encrypted with a trusted\n * key\n */\n isStored(name: string): Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null>;\n\n /**\n * Get the current default key ID for encrypting secrets.\n *\n * @returns The default key ID or null if no default key ID is set\n */\n getDefaultKeyId(): Promise<string | null>;\n\n /**\n * Set the default key ID for encrypting secrets.\n *\n * @param keyId - The new default key ID\n */\n setDefaultKeyId(keyId: string): Promise<void>;\n}\n\n/**\n * Implementation of Server-side secret storage.\n *\n * Secret *sharing* is *not* implemented here: this class is strictly about the storage component of\n * SSSS.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#storage\n */\nexport class ServerSideSecretStorageImpl implements ServerSideSecretStorage {\n /**\n * Construct a new `SecretStorage`.\n *\n * Normally, it is unnecessary to call this directly, since MatrixClient automatically constructs one.\n * However, it may be useful to construct a new `SecretStorage`, if custom `callbacks` are required, for example.\n *\n * @param accountDataAdapter - interface for fetching and setting account data on the server. Normally an instance\n * of {@link MatrixClient}.\n * @param callbacks - application level callbacks for retrieving secret keys\n */\n public constructor(\n private readonly accountDataAdapter: AccountDataClient,\n private readonly callbacks: SecretStorageCallbacks,\n ) {}\n\n /**\n * Get the current default key ID for encrypting secrets.\n *\n * @returns The default key ID or null if no default key ID is set\n */\n public async getDefaultKeyId(): Promise<string | null> {\n const defaultKey = await this.accountDataAdapter.getAccountDataFromServer<{ key: string }>(\n \"m.secret_storage.default_key\",\n );\n if (!defaultKey) return null;\n return defaultKey.key;\n }\n\n /**\n * Set the default key ID for encrypting secrets.\n *\n * @param keyId - The new default key ID\n */\n public setDefaultKeyId(keyId: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const listener = (ev: MatrixEvent): void => {\n if (ev.getType() === \"m.secret_storage.default_key\" && ev.getContent().key === keyId) {\n this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);\n resolve();\n }\n };\n this.accountDataAdapter.on(ClientEvent.AccountData, listener);\n\n this.accountDataAdapter.setAccountData(\"m.secret_storage.default_key\", { key: keyId }).catch((e) => {\n this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);\n reject(e);\n });\n });\n }\n\n /**\n * Add a key for encrypting secrets.\n *\n * @param algorithm - the algorithm used by the key.\n * @param opts - the options for the algorithm. The properties used\n * depend on the algorithm given.\n * @param keyId - the ID of the key. If not given, a random\n * ID will be generated.\n *\n * @returns An object with:\n * keyId: the ID of the key\n * keyInfo: details about the key (iv, mac, passphrase)\n */\n public async addKey(\n algorithm: string,\n opts: AddSecretStorageKeyOpts,\n keyId?: string,\n ): Promise<SecretStorageKeyObject> {\n if (algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {\n throw new Error(`Unknown key algorithm ${algorithm}`);\n }\n\n const keyInfo = { algorithm } as SecretStorageKeyDescriptionAesV1;\n\n if (opts.name) {\n keyInfo.name = opts.name;\n }\n\n if (opts.passphrase) {\n keyInfo.passphrase = opts.passphrase;\n }\n\n const { iv, mac } = await calculateKeyCheck(opts.key);\n keyInfo.iv = iv;\n keyInfo.mac = mac;\n\n // Create a unique key id. XXX: this is racey.\n if (!keyId) {\n do {\n keyId = randomString(32);\n } while (\n await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescription>(\n `m.secret_storage.key.${keyId}`,\n )\n );\n }\n\n await this.accountDataAdapter.setAccountData(`m.secret_storage.key.${keyId}`, keyInfo);\n\n return {\n keyId,\n keyInfo,\n };\n }\n\n /**\n * Get the key information for a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns If the key was found, the return value is an array of\n * the form [keyId, keyInfo]. Otherwise, null is returned.\n * XXX: why is this an array when addKey returns an object?\n */\n public async getKey(keyId?: string | null): Promise<SecretStorageKeyTuple | null> {\n if (!keyId) {\n keyId = await this.getDefaultKeyId();\n }\n if (!keyId) {\n return null;\n }\n\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n return keyInfo ? [keyId, keyInfo] : null;\n }\n\n /**\n * Check whether we have a key with a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns Whether we have the key.\n */\n public async hasKey(keyId?: string): Promise<boolean> {\n const key = await this.getKey(keyId);\n return Boolean(key);\n }\n\n /**\n * Check whether a key matches what we expect based on the key info\n *\n * @param key - the key to check\n * @param info - the key info\n *\n * @returns whether or not the key matches\n */\n public async checkKey(key: Uint8Array, info: SecretStorageKeyDescriptionAesV1): Promise<boolean> {\n if (info.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n if (info.mac) {\n const { mac } = await calculateKeyCheck(key, info.iv);\n return trimTrailingEquals(info.mac) === trimTrailingEquals(mac);\n } else {\n // if we have no information, we have to assume the key is right\n return true;\n }\n } else {\n throw new Error(\"Unknown algorithm\");\n }\n }\n\n /**\n * Store an encrypted secret on the server.\n *\n * Details of the encryption keys to be used must previously have been stored in account data\n * (for example, via {@link ServerSideSecretStorageImpl#addKey}. {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage\n * key to decrypt the secret.\n *\n * @param name - The name of the secret - i.e., the \"event type\" to be stored in the account data\n * @param secret - The secret contents.\n * @param keys - The IDs of the keys to use to encrypt the secret, or null/undefined to use the default key.\n */\n public async store(name: string, secret: string, keys?: string[] | null): Promise<void> {\n const encrypted: Record<string, AESEncryptedSecretStoragePayload> = {};\n\n if (!keys) {\n const defaultKeyId = await this.getDefaultKeyId();\n if (!defaultKeyId) {\n throw new Error(\"No keys specified and no default key present\");\n }\n keys = [defaultKeyId];\n }\n\n if (keys.length === 0) {\n throw new Error(\"Zero keys given to encrypt with!\");\n }\n\n for (const keyId of keys) {\n // get key information from key storage\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n if (!keyInfo) {\n throw new Error(\"Unknown key: \" + keyId);\n }\n\n // encrypt secret, based on the algorithm\n if (keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n const keys = { [keyId]: keyInfo };\n const [, encryption] = await this.getSecretStorageKey(keys, name);\n encrypted[keyId] = await encryption.encrypt(secret);\n } else {\n logger.warn(\"unknown algorithm for secret storage key \" + keyId + \": \" + keyInfo.algorithm);\n // do nothing if we don't understand the encryption algorithm\n }\n }\n\n // save encrypted secret\n await this.accountDataAdapter.setAccountData(name, { encrypted });\n }\n\n /**\n * Get a secret from storage, and decrypt it.\n *\n * {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage\n * key to decrypt the secret.\n *\n * @param name - the name of the secret - i.e., the \"event type\" stored in the account data\n *\n * @returns the decrypted contents of the secret, or \"undefined\" if `name` is not found in\n * the user's account data.\n */\n public async get(name: string): Promise<string | undefined> {\n const secretInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretInfo>(name);\n if (!secretInfo) {\n return;\n }\n if (!secretInfo.encrypted) {\n throw new Error(\"Content is not encrypted!\");\n }\n\n // get possible keys to decrypt\n const keys: Record<string, SecretStorageKeyDescriptionAesV1> = {};\n for (const keyId of Object.keys(secretInfo.encrypted)) {\n // get key information from key storage\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n const encInfo = secretInfo.encrypted[keyId];\n // only use keys we understand the encryption algorithm of\n if (keyInfo?.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n if (encInfo.iv && encInfo.ciphertext && encInfo.mac) {\n keys[keyId] = keyInfo;\n }\n }\n }\n\n if (Object.keys(keys).length === 0) {\n throw new Error(\n `Could not decrypt ${name} because none of ` +\n `the keys it is encrypted with are for a supported algorithm`,\n );\n }\n\n // fetch private key from app\n const [keyId, decryption] = await this.getSecretStorageKey(keys, name);\n const encInfo = secretInfo.encrypted[keyId];\n\n return decryption.decrypt(encInfo);\n }\n\n /**\n * Check if a secret is stored on the server.\n *\n * @param name - the name of the secret\n *\n * @returns map of key name to key info the secret is encrypted\n * with, or null if it is not present or not encrypted with a trusted\n * key\n */\n public async isStored(name: string): Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null> {\n // check if secret exists\n const secretInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretInfo>(name);\n if (!secretInfo?.encrypted) return null;\n\n const ret: Record<string, SecretStorageKeyDescriptionAesV1> = {};\n\n // filter secret encryption keys with supported algorithm\n for (const keyId of Object.keys(secretInfo.encrypted)) {\n // get key information from key storage\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n if (!keyInfo) continue;\n const encInfo = secretInfo.encrypted[keyId];\n\n // only use keys we understand the encryption algorithm of\n if (keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n if (encInfo.iv && encInfo.ciphertext && encInfo.mac) {\n ret[keyId] = keyInfo;\n }\n }\n }\n return Object.keys(ret).length ? ret : null;\n }\n\n private async getSecretStorageKey(\n keys: Record<string, SecretStorageKeyDescriptionAesV1>,\n name: string,\n ): Promise<[string, Decryptors]> {\n if (!this.callbacks.getSecretStorageKey) {\n throw new Error(\"No getSecretStorageKey callback supplied\");\n }\n\n const returned = await this.callbacks.getSecretStorageKey({ keys }, name);\n\n if (!returned) {\n throw new Error(\"getSecretStorageKey callback returned falsey\");\n }\n if (returned.length < 2) {\n throw new Error(\"getSecretStorageKey callback returned invalid data\");\n }\n\n const [keyId, privateKey] = returned;\n if (!keys[keyId]) {\n throw new Error(\"App returned unknown key from getSecretStorageKey!\");\n }\n\n if (keys[keyId].algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n const decryption = {\n encrypt: function (secret: string): Promise<AESEncryptedSecretStoragePayload> {\n return encryptAESSecretStorageItem(secret, privateKey, name);\n },\n decrypt: function (encInfo: AESEncryptedSecretStoragePayload): Promise<string> {\n return decryptAESSecretStorageItem(encInfo, privateKey, name);\n },\n };\n return [keyId, decryption];\n } else {\n throw new Error(\"Unknown key type: \" + keys[keyId].algorithm);\n }\n }\n}\n\n/** trim trailing instances of '=' from a string\n *\n * @internal\n *\n * @param input - input string\n */\nexport function trimTrailingEquals(input: string): string {\n // according to Sonar and CodeQL, a regex such as /=+$/ is superlinear.\n // Not sure I believe it, but it's easy enough to work around.\n\n // find the number of characters before the trailing =\n let i = input.length;\n while (i >= 1 && input.charCodeAt(i - 1) == 0x3d) i--;\n\n // trim to the calculated length\n if (i < input.length) {\n return input.substring(0, i);\n } else {\n return input;\n }\n}\n\n// string of zeroes, for calculating the key check\nconst ZERO_STR = \"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Calculate the MAC for checking the key.\n * See https://spec.matrix.org/v1.11/client-server-api/#msecret_storagev1aes-hmac-sha2, steps 3 and 4.\n *\n * @param key - the key to use\n * @param iv - The initialization vector as a base64-encoded string.\n * If omitted, a random initialization vector will be created.\n * @returns An object that contains, `mac` and `iv` properties.\n */\nexport function calculateKeyCheck(key: Uint8Array, iv?: string): Promise<AESEncryptedSecretStoragePayload> {\n return encryptAESSecretStorageItem(ZERO_STR, key, \"\", iv);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAGA,SAASA,WAAW,QAA+B,aAAa;AAEhE,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,2BAA2B,MAAM,wCAAwC;AAChF,OAAOC,2BAA2B,MAAM,wCAAwC;AAGhF,OAAO,IAAMC,+BAA+B,GAAG,mCAAmC;;AAElF;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;;AAUA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAsBA;AACA;AACA;;AA2DA;AACA;AACA;AACA;AACA;AACA;;AA8FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,CAAoC;EACxE;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACWC,WAAWA,CACGC,kBAAqC,EACrCC,SAAiC,EACpD;IAAA,KAFmBD,kBAAqC,GAArCA,kBAAqC;IAAA,KACrCC,SAAiC,GAAjCA,SAAiC;EACnD;;EAEH;AACJ;AACA;AACA;AACA;EACiBC,eAAeA,CAAA,EAA2B;IAAA,IAAAC,KAAA;IAAA,OAAAC,iBAAA;MACnD,IAAMC,UAAU,SAASF,KAAI,CAACH,kBAAkB,CAACM,wBAAwB,CACrE,8BACJ,CAAC;MACD,IAAI,CAACD,UAAU,EAAE,OAAO,IAAI;MAC5B,OAAOA,UAAU,CAACE,GAAG;IAAC;EAC1B;;EAEA;AACJ;AACA;AACA;AACA;EACWC,eAAeA,CAACC,KAAa,EAAiB;IACjD,OAA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2B,CAACiD,MAAM,EAAEuB,UAAU,EAAErC,IAAI,CAAC;UAChE,CAAC;UACD+B,OAAO,EAAE,SAATA,OAAOA,CAAYH,OAAyC,EAAmB;YAC3E,OAAO9D,2BAA2B,CAAC8D,OAAO,EAAES,UAAU,EAAErC,IAAI,CAAC;UACjE;QACJ,CAAC;QACD,OAAO,CAACrB,KAAK,EAAEmD,UAAU,CAAC;MAC9B,CAAC,MAAM;QACH,MAAM,IAAIjC,KAAK,CAAC,oBAAoB,GAAGkB,IAAI,CAACpC,KAAK,CAAC,CAACe,SAAS,CAAC;MACjE;IAAC;EACL;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASkB,kBAAkBA,CAAC0B,KAAa,EAAU;EACtD;EACA;;EAEA;EACA,IAAIC,CAAC,GAAGD,KAAK,CAACnB,MAAM;EACpB,OAAOoB,CAAC,IAAI,CAAC,IAAID,KAAK,CAACE,UAAU,CAACD,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAAEA,CAAC,EAAE;;EAErD;EACA,IAAIA,CAAC,GAAGD,KAAK,CAACnB,MAAM,EAAE;IAClB,OAAOmB,KAAK,CAACG,SAAS,CAAC,CAAC,EAAEF,CAAC,CAAC;EAChC,CAAC,MAAM;IACH,OAAOD,KAAK;EAChB;AACJ;;AAEA;AACA,IAAMI,QAAQ,GAAG,kEAAkE;;AAEnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAStC,iBAAiBA,CAAC3B,GAAe,EAAEyB,EAAW,EAA6C;EACvG,OAAOrC,2BAA2B,CAAC6E,QAAQ,EAAEjE,GAAG,EAAE,EAAE,EAAEyB,EAAE,CAAC;AAC7D","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- /**
2
- * Acquires a reference to the shared AudioContext.
3
- * It's highly recommended to reuse this AudioContext rather than creating your
4
- * own, because multiple AudioContexts can be problematic in some browsers.
5
- * Make sure to call releaseContext when you're done using it.
6
- * @returns The shared AudioContext
7
- */
8
- export declare const acquireContext: () => AudioContext;
9
- /**
10
- * Signals that one of the references to the shared AudioContext has been
11
- * released, allowing the context and associated hardware resources to be
12
- * cleaned up if nothing else is using it.
13
- */
14
- export declare const releaseContext: () => void;
15
- //# sourceMappingURL=audioContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioContext.d.ts","sourceRoot":"","sources":["../../src/webrtc/audioContext.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,QAAO,YAIjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,IAMjC,CAAC"}
@@ -1,46 +0,0 @@
1
- /*
2
- Copyright 2022 The Matrix.org Foundation C.I.C.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- var audioContext = null;
18
- var refCount = 0;
19
-
20
- /**
21
- * Acquires a reference to the shared AudioContext.
22
- * It's highly recommended to reuse this AudioContext rather than creating your
23
- * own, because multiple AudioContexts can be problematic in some browsers.
24
- * Make sure to call releaseContext when you're done using it.
25
- * @returns The shared AudioContext
26
- */
27
- export var acquireContext = () => {
28
- if (audioContext === null) audioContext = new AudioContext();
29
- refCount++;
30
- return audioContext;
31
- };
32
-
33
- /**
34
- * Signals that one of the references to the shared AudioContext has been
35
- * released, allowing the context and associated hardware resources to be
36
- * cleaned up if nothing else is using it.
37
- */
38
- export var releaseContext = () => {
39
- refCount--;
40
- if (refCount === 0) {
41
- var _audioContext;
42
- (_audioContext = audioContext) === null || _audioContext === void 0 || _audioContext.close();
43
- audioContext = null;
44
- }
45
- };
46
- //# sourceMappingURL=audioContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioContext.js","names":["audioContext","refCount","acquireContext","AudioContext","releaseContext","_audioContext","close"],"sources":["../../src/webrtc/audioContext.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nlet audioContext: AudioContext | null = null;\nlet refCount = 0;\n\n/**\n * Acquires a reference to the shared AudioContext.\n * It's highly recommended to reuse this AudioContext rather than creating your\n * own, because multiple AudioContexts can be problematic in some browsers.\n * Make sure to call releaseContext when you're done using it.\n * @returns The shared AudioContext\n */\nexport const acquireContext = (): AudioContext => {\n if (audioContext === null) audioContext = new AudioContext();\n refCount++;\n return audioContext;\n};\n\n/**\n * Signals that one of the references to the shared AudioContext has been\n * released, allowing the context and associated hardware resources to be\n * cleaned up if nothing else is using it.\n */\nexport const releaseContext = (): void => {\n refCount--;\n if (refCount === 0) {\n audioContext?.close();\n audioContext = null;\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,YAAiC,GAAG,IAAI;AAC5C,IAAIC,QAAQ,GAAG,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,cAAc,GAAGA,CAAA,KAAoB;EAC9C,IAAIF,YAAY,KAAK,IAAI,EAAEA,YAAY,GAAG,IAAIG,YAAY,CAAC,CAAC;EAC5DF,QAAQ,EAAE;EACV,OAAOD,YAAY;AACvB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMI,cAAc,GAAGA,CAAA,KAAY;EACtCH,QAAQ,EAAE;EACV,IAAIA,QAAQ,KAAK,CAAC,EAAE;IAAA,IAAAI,aAAA;IAChB,CAAAA,aAAA,GAAAL,YAAY,cAAAK,aAAA,eAAZA,aAAA,CAAcC,KAAK,CAAC,CAAC;IACrBN,YAAY,GAAG,IAAI;EACvB;AACJ,CAAC","ignoreList":[]}