matrix-js-sdk 42.0.0 → 42.1.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 (226) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/@types/PushRules.d.ts.map +1 -1
  3. package/lib/@types/PushRules.js +0 -5
  4. package/lib/@types/PushRules.js.map +1 -1
  5. package/lib/@types/auth.d.ts.map +1 -1
  6. package/lib/@types/auth.js +0 -5
  7. package/lib/@types/auth.js.map +1 -1
  8. package/lib/@types/crypto.d.ts.map +1 -1
  9. package/lib/@types/crypto.js.map +1 -1
  10. package/lib/@types/event.d.ts +3 -1
  11. package/lib/@types/event.d.ts.map +1 -1
  12. package/lib/@types/event.js +1 -0
  13. package/lib/@types/event.js.map +1 -1
  14. package/lib/@types/extensible_events.js.map +1 -1
  15. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
  16. package/lib/@types/media.js.map +1 -1
  17. package/lib/@types/partials.d.ts.map +1 -1
  18. package/lib/@types/partials.js.map +1 -1
  19. package/lib/@types/requests.d.ts.map +1 -1
  20. package/lib/@types/requests.js +0 -5
  21. package/lib/@types/requests.js.map +1 -1
  22. package/lib/@types/search.d.ts.map +1 -1
  23. package/lib/@types/search.js +0 -3
  24. package/lib/@types/search.js.map +1 -1
  25. package/lib/@types/spaces.d.ts.map +1 -1
  26. package/lib/@types/spaces.js.map +1 -1
  27. package/lib/@types/synapse.d.ts.map +1 -1
  28. package/lib/@types/synapse.js.map +1 -1
  29. package/lib/@types/threepids.js.map +1 -1
  30. package/lib/ToDeviceMessageQueue.d.ts.map +1 -1
  31. package/lib/ToDeviceMessageQueue.js +0 -2
  32. package/lib/ToDeviceMessageQueue.js.map +1 -1
  33. package/lib/browser-index.d.ts.map +1 -1
  34. package/lib/browser-index.js +3 -1
  35. package/lib/browser-index.js.map +1 -1
  36. package/lib/client.d.ts +5 -8
  37. package/lib/client.d.ts.map +1 -1
  38. package/lib/client.js +5 -46
  39. package/lib/client.js.map +1 -1
  40. package/lib/common-crypto/key-passphrase.d.ts.map +1 -1
  41. package/lib/common-crypto/key-passphrase.js +0 -3
  42. package/lib/common-crypto/key-passphrase.js.map +1 -1
  43. package/lib/crypto/store/base.d.ts.map +1 -1
  44. package/lib/crypto/store/base.js +0 -9
  45. package/lib/crypto/store/base.js.map +1 -1
  46. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  47. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -1
  48. package/lib/crypto/store/localStorage-crypto-store.js +0 -2
  49. package/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  50. package/lib/crypto-api/keybackup.d.ts +13 -6
  51. package/lib/crypto-api/keybackup.d.ts.map +1 -1
  52. package/lib/crypto-api/keybackup.js.map +1 -1
  53. package/lib/embedded.d.ts.map +1 -1
  54. package/lib/embedded.js +0 -5
  55. package/lib/embedded.js.map +1 -1
  56. package/lib/feature.d.ts.map +1 -1
  57. package/lib/feature.js +0 -3
  58. package/lib/feature.js.map +1 -1
  59. package/lib/filter-component.d.ts.map +1 -1
  60. package/lib/filter-component.js +2 -5
  61. package/lib/filter-component.js.map +1 -1
  62. package/lib/filter.d.ts.map +1 -1
  63. package/lib/filter.js +0 -4
  64. package/lib/filter.js.map +1 -1
  65. package/lib/http-api/interface.d.ts.map +1 -1
  66. package/lib/http-api/interface.js.map +1 -1
  67. package/lib/http-api/refresh.d.ts.map +1 -1
  68. package/lib/http-api/refresh.js +0 -3
  69. package/lib/http-api/refresh.js.map +1 -1
  70. package/lib/interactive-auth.d.ts.map +1 -1
  71. package/lib/interactive-auth.js +5 -6
  72. package/lib/interactive-auth.js.map +1 -1
  73. package/lib/logger.d.ts.map +1 -1
  74. package/lib/logger.js +0 -2
  75. package/lib/logger.js.map +1 -1
  76. package/lib/matrixrtc/CallMembership.d.ts +3 -3
  77. package/lib/matrixrtc/CallMembership.js +5 -5
  78. package/lib/matrixrtc/CallMembership.js.map +1 -1
  79. package/lib/matrixrtc/MatrixRTCSession.d.ts +18 -1
  80. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
  81. package/lib/matrixrtc/MatrixRTCSession.js +56 -4
  82. package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  83. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +14 -1
  84. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -1
  85. package/lib/matrixrtc/MatrixRTCSessionManager.js +20 -1
  86. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
  87. package/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
  88. package/lib/matrixrtc/MembershipManager.js +9 -6
  89. package/lib/matrixrtc/MembershipManager.js.map +1 -1
  90. package/lib/matrixrtc/index.d.ts +1 -1
  91. package/lib/matrixrtc/index.d.ts.map +1 -1
  92. package/lib/matrixrtc/index.js +1 -1
  93. package/lib/matrixrtc/index.js.map +1 -1
  94. package/lib/matrixrtc/membershipData/rtc.d.ts +6 -3
  95. package/lib/matrixrtc/membershipData/rtc.d.ts.map +1 -1
  96. package/lib/matrixrtc/membershipData/rtc.js +7 -4
  97. package/lib/matrixrtc/membershipData/rtc.js.map +1 -1
  98. package/lib/matrixrtc/types.d.ts +19 -6
  99. package/lib/matrixrtc/types.d.ts.map +1 -1
  100. package/lib/matrixrtc/types.js +11 -1
  101. package/lib/matrixrtc/types.js.map +1 -1
  102. package/lib/models/event.d.ts.map +1 -1
  103. package/lib/models/event.js +0 -6
  104. package/lib/models/event.js.map +1 -1
  105. package/lib/models/room-state.d.ts.map +1 -1
  106. package/lib/models/room-state.js.map +1 -1
  107. package/lib/models/room.d.ts.map +1 -1
  108. package/lib/models/room.js +6 -6
  109. package/lib/models/room.js.map +1 -1
  110. package/lib/models/thread.d.ts +2 -2
  111. package/lib/models/thread.d.ts.map +1 -1
  112. package/lib/models/thread.js.map +1 -1
  113. package/lib/realtime-callbacks.js +0 -1
  114. package/lib/realtime-callbacks.js.map +1 -1
  115. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -1
  116. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -1
  117. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
  118. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -1
  119. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -2
  120. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
  121. package/lib/rust-crypto/backup.d.ts +21 -1
  122. package/lib/rust-crypto/backup.d.ts.map +1 -1
  123. package/lib/rust-crypto/backup.js +62 -21
  124. package/lib/rust-crypto/backup.js.map +1 -1
  125. package/lib/rust-crypto/device-converter.d.ts.map +1 -1
  126. package/lib/rust-crypto/device-converter.js +1 -0
  127. package/lib/rust-crypto/device-converter.js.map +1 -1
  128. package/lib/rust-crypto/index.d.ts +7 -0
  129. package/lib/rust-crypto/index.d.ts.map +1 -1
  130. package/lib/rust-crypto/index.js +3 -3
  131. package/lib/rust-crypto/index.js.map +1 -1
  132. package/lib/rust-crypto/libolm_migration.d.ts.map +1 -1
  133. package/lib/rust-crypto/libolm_migration.js +0 -2
  134. package/lib/rust-crypto/libolm_migration.js.map +1 -1
  135. package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  136. package/lib/rust-crypto/rust-crypto.js +0 -3
  137. package/lib/rust-crypto/rust-crypto.js.map +1 -1
  138. package/lib/scheduler.d.ts.map +1 -1
  139. package/lib/scheduler.js +0 -3
  140. package/lib/scheduler.js.map +1 -1
  141. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  142. package/lib/sliding-sync-sdk.js +6 -0
  143. package/lib/sliding-sync-sdk.js.map +1 -1
  144. package/lib/sliding-sync.d.ts.map +1 -1
  145. package/lib/sliding-sync.js +3 -0
  146. package/lib/sliding-sync.js.map +1 -1
  147. package/lib/store/indexeddb.d.ts.map +1 -1
  148. package/lib/store/indexeddb.js +0 -2
  149. package/lib/store/indexeddb.js.map +1 -1
  150. package/lib/store/memory.d.ts.map +1 -1
  151. package/lib/store/memory.js +7 -9
  152. package/lib/store/memory.js.map +1 -1
  153. package/lib/sync-accumulator.d.ts.map +1 -1
  154. package/lib/sync-accumulator.js +1 -5
  155. package/lib/sync-accumulator.js.map +1 -1
  156. package/lib/sync.d.ts.map +1 -1
  157. package/lib/sync.js +1 -1
  158. package/lib/sync.js.map +1 -1
  159. package/lib/timeline-window.d.ts.map +1 -1
  160. package/lib/timeline-window.js +0 -1
  161. package/lib/timeline-window.js.map +1 -1
  162. package/lib/utils/internal/deriveKeys.d.ts.map +1 -1
  163. package/lib/utils/internal/deriveKeys.js +0 -1
  164. package/lib/utils/internal/deriveKeys.js.map +1 -1
  165. package/lib/webrtc/callEventTypes.d.ts.map +1 -1
  166. package/lib/webrtc/callEventTypes.js +0 -5
  167. package/lib/webrtc/callEventTypes.js.map +1 -1
  168. package/package.json +5 -5
  169. package/src/@types/PushRules.ts +0 -5
  170. package/src/@types/auth.ts +0 -6
  171. package/src/@types/crypto.ts +2 -6
  172. package/src/@types/event.ts +3 -0
  173. package/src/@types/extensible_events.ts +4 -4
  174. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -1
  175. package/src/@types/media.ts +1 -1
  176. package/src/@types/partials.ts +0 -2
  177. package/src/@types/requests.ts +0 -5
  178. package/src/@types/search.ts +0 -2
  179. package/src/@types/spaces.ts +0 -2
  180. package/src/@types/synapse.ts +0 -2
  181. package/src/@types/threepids.ts +2 -2
  182. package/src/ToDeviceMessageQueue.ts +0 -2
  183. package/src/browser-index.ts +3 -3
  184. package/src/client.ts +18 -61
  185. package/src/common-crypto/key-passphrase.ts +0 -1
  186. package/src/crypto/store/base.ts +1 -8
  187. package/src/crypto/store/indexeddb-crypto-store-backend.ts +1 -1
  188. package/src/crypto/store/localStorage-crypto-store.ts +0 -1
  189. package/src/crypto-api/keybackup.ts +14 -7
  190. package/src/embedded.ts +0 -5
  191. package/src/feature.ts +0 -3
  192. package/src/filter-component.ts +1 -2
  193. package/src/filter.ts +0 -3
  194. package/src/http-api/interface.ts +0 -1
  195. package/src/http-api/refresh.ts +0 -1
  196. package/src/interactive-auth.ts +4 -4
  197. package/src/logger.ts +0 -2
  198. package/src/matrixrtc/CallMembership.ts +5 -5
  199. package/src/matrixrtc/MatrixRTCSession.ts +70 -3
  200. package/src/matrixrtc/MatrixRTCSessionManager.ts +21 -2
  201. package/src/matrixrtc/MembershipManager.ts +8 -5
  202. package/src/matrixrtc/index.ts +1 -1
  203. package/src/matrixrtc/membershipData/rtc.ts +18 -7
  204. package/src/matrixrtc/types.ts +24 -7
  205. package/src/models/event.ts +0 -3
  206. package/src/models/room-state.ts +0 -3
  207. package/src/models/room.ts +6 -6
  208. package/src/models/thread.ts +2 -2
  209. package/src/realtime-callbacks.ts +0 -1
  210. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -1
  211. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -1
  212. package/src/rust-crypto/backup.ts +66 -28
  213. package/src/rust-crypto/device-converter.ts +1 -0
  214. package/src/rust-crypto/index.ts +11 -0
  215. package/src/rust-crypto/libolm_migration.ts +0 -2
  216. package/src/rust-crypto/rust-crypto.ts +0 -3
  217. package/src/scheduler.ts +0 -3
  218. package/src/sliding-sync-sdk.ts +3 -0
  219. package/src/sliding-sync.ts +2 -0
  220. package/src/store/indexeddb.ts +0 -2
  221. package/src/store/memory.ts +7 -9
  222. package/src/sync-accumulator.ts +1 -3
  223. package/src/sync.ts +1 -3
  224. package/src/timeline-window.ts +0 -1
  225. package/src/utils/internal/deriveKeys.ts +0 -1
  226. package/src/webrtc/callEventTypes.ts +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"key-passphrase.d.ts","sourceRoot":"","sources":["../../src/common-crypto/key-passphrase.ts"],"names":[],"mappings":"AAmBA,UAAU,SAAS;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW5F"}
1
+ {"version":3,"file":"key-passphrase.d.ts","sourceRoot":"","sources":["../../src/common-crypto/key-passphrase.ts"],"names":[],"mappings":"AAkBA,UAAU,SAAS;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAW5F"}
@@ -15,9 +15,6 @@
15
15
  */
16
16
 
17
17
  import { deriveRecoveryKeyFromPassphrase } from "../crypto-api/index.js";
18
-
19
- /* eslint-disable camelcase */
20
-
21
18
  /**
22
19
  * Derive a backup key from a passphrase using the salt and iterations from the auth data.
23
20
  * @param authData - The auth data containing the salt and iterations
@@ -1 +1 @@
1
- {"version":3,"file":"key-passphrase.js","names":[],"sources":["../../src/common-crypto/key-passphrase.ts"],"sourcesContent":["/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { deriveRecoveryKeyFromPassphrase } from \"../crypto-api/index.ts\";\n\n/* eslint-disable camelcase */\ninterface IAuthData {\n private_key_salt?: string;\n private_key_iterations?: number;\n private_key_bits?: number;\n}\n\n/**\n * Derive a backup key from a passphrase using the salt and iterations from the auth data.\n * @param authData - The auth data containing the salt and iterations\n * @param passphrase - The passphrase to derive the key from\n * @deprecated Deriving a backup key from a passphrase is not part of the matrix spec. Instead, a random key is generated and stored/shared via 4S.\n */\nexport function keyFromAuthData(authData: IAuthData, passphrase: string): Promise<Uint8Array> {\n if (!authData.private_key_salt || !authData.private_key_iterations) {\n throw new Error(\"Salt and/or iterations not found: \" + \"this backup cannot be restored with a passphrase\");\n }\n\n return deriveRecoveryKeyFromPassphrase(\n passphrase,\n authData.private_key_salt,\n authData.private_key_iterations,\n authData.private_key_bits,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,+BAA+B,QAAQ,wBAAwB;;AAExE;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,eAAe,CAAC,QAAmB,EAAE,UAAkB,EAAuB;EAC1F,IAAI,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE;IAChE,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,kDAAkD,CAAC;EAC9G;EAEA,OAAO,+BAA+B,CAClC,UAAU,EACV,QAAQ,CAAC,gBAAgB,EACzB,QAAQ,CAAC,sBAAsB,EAC/B,QAAQ,CAAC,gBACb,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"key-passphrase.js","names":[],"sources":["../../src/common-crypto/key-passphrase.ts"],"sourcesContent":["/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { deriveRecoveryKeyFromPassphrase } from \"../crypto-api/index.ts\";\n\ninterface IAuthData {\n private_key_salt?: string;\n private_key_iterations?: number;\n private_key_bits?: number;\n}\n\n/**\n * Derive a backup key from a passphrase using the salt and iterations from the auth data.\n * @param authData - The auth data containing the salt and iterations\n * @param passphrase - The passphrase to derive the key from\n * @deprecated Deriving a backup key from a passphrase is not part of the matrix spec. Instead, a random key is generated and stored/shared via 4S.\n */\nexport function keyFromAuthData(authData: IAuthData, passphrase: string): Promise<Uint8Array> {\n if (!authData.private_key_salt || !authData.private_key_iterations) {\n throw new Error(\"Salt and/or iterations not found: \" + \"this backup cannot be restored with a passphrase\");\n }\n\n return deriveRecoveryKeyFromPassphrase(\n passphrase,\n authData.private_key_salt,\n authData.private_key_iterations,\n authData.private_key_bits,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,+BAA+B,QAAQ,wBAAwB;AAQxE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,eAAe,CAAC,QAAmB,EAAE,UAAkB,EAAuB;EAC1F,IAAI,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE;IAChE,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,kDAAkD,CAAC;EAC9G;EAEA,OAAO,+BAA+B,CAClC,UAAU,EACV,QAAQ,CAAC,gBAAgB,EACzB,QAAQ,CAAC,sBAAsB,EAC/B,QAAQ,CAAC,gBACb,CAAC;AACL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/crypto/store/base.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,KAA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,oBAAY,mBAAmB;IAC3B,2BAA2B;IAC3B,MAAM,IAAA;IACN,mCAAmC;IACnC,IAAI,IAAA;IACJ,gDAAgD;IAChD,mBAAmB,IAAA;IACnB;;;OAGG;IACH,gCAAgC,IAAA;CACnC;AAED,UAAU,QAAQ;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,QAAQ;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,OAAO;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,+CAA+C;AAC/C,oBAAY,kBAAkB;IAC1B,OAAO,KAAK;IACZ,UAAU,IAAI;IACd,QAAQ,IAAI;CACf"}
@@ -68,11 +68,6 @@ export let MigrationState = /*#__PURE__*/function (MigrationState) {
68
68
  * {@link CryptoStore#getEndToEndInboundGroupSessionsBatch}.
69
69
  */
70
70
  export const SESSION_BATCH_SIZE = 50;
71
-
72
- /* eslint-disable camelcase */
73
-
74
- /* eslint-enable camelcase */
75
-
76
71
  export let TrackingStatus = /*#__PURE__*/function (TrackingStatus) {
77
72
  TrackingStatus[TrackingStatus["NotTracked"] = 0] = "NotTracked";
78
73
  TrackingStatus[TrackingStatus["PendingDownload"] = 1] = "PendingDownload";
@@ -125,16 +120,12 @@ export let RoomKeyRequestState = /*#__PURE__*/function (RoomKeyRequestState) {
125
120
  return RoomKeyRequestState;
126
121
  }({});
127
122
 
128
- /* eslint-disable camelcase */
129
-
130
123
  /**
131
124
  * The parameters of a room key request. The details of the request may
132
125
  * vary with the crypto algorithm, but the management and storage layers for
133
126
  * outgoing requests expect it to have 'room_id' and 'session_id' properties.
134
127
  */
135
128
 
136
- /* eslint-enable camelcase */
137
-
138
129
  /** State of the verification of the device. */
139
130
  export let DeviceVerification = /*#__PURE__*/function (DeviceVerification) {
140
131
  DeviceVerification[DeviceVerification["Blocked"] = -1] = "Blocked";
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","names":[],"sources":["../../../src/crypto/store/base.ts"],"sourcesContent":["/*\nCopyright 2021 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\nimport { type Logger } from \"../../logger.ts\";\nimport { type CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\nimport { type AESEncryptedSecretStoragePayload } from \"../../@types/AESEncryptedSecretStoragePayload.ts\";\nimport { type ISignatures } from \"../../@types/signed.ts\";\n\n/**\n * Internal module. Definitions for storage for the crypto module\n */\n\nexport interface SecretStorePrivateKeys {\n \"m.megolm_backup.v1\": AESEncryptedSecretStoragePayload;\n}\n\n/**\n * Abstraction of things that can store data required for end-to-end encryption\n */\nexport interface CryptoStore {\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Unlike the rest of the methods in this interface, can be called before {@link CryptoStore#startup}.\n *\n * @internal\n */\n containsData(): Promise<boolean>;\n\n /**\n * Initialise this crypto store.\n *\n * Typically, this involves provisioning storage, and migrating any existing data to the current version of the\n * storage schema where appropriate.\n *\n * Must be called before any of the rest of the methods in this interface.\n */\n startup(): Promise<CryptoStore>;\n\n deleteAllData(): Promise<void>;\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n getMigrationState(): Promise<MigrationState>;\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n setMigrationState(migrationState: MigrationState): Promise<void>;\n\n // Olm Account\n getAccount(txn: unknown, func: (accountPickle: string | null) => void): void;\n storeAccount(txn: unknown, accountPickle: string): void;\n getCrossSigningKeys(txn: unknown, func: (keys: Record<string, CrossSigningKeyInfo> | null) => void): void;\n getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void;\n storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void;\n\n // Olm Sessions\n countEndToEndSessions(txn: unknown, func: (count: number) => void): void;\n getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo | null) => void,\n ): void;\n getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void;\n\n storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void;\n\n /**\n * Get a batch of end-to-end sessions from the database.\n *\n * @returns A batch of Olm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndSessionsBatch(): Promise<ISessionInfo[] | null>;\n\n /**\n * Delete a batch of end-to-end sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions: { deviceKey?: string; sessionId?: string }[]): Promise<void>;\n\n // Inbound Group Sessions\n getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void;\n storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void;\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions(): Promise<number>;\n\n /**\n * Get a batch of Megolm sessions from the database.\n *\n * @returns A batch of Megolm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch(): Promise<SessionExtended[] | null>;\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions: { senderKey: string; sessionId: string }[]): Promise<void>;\n\n // Device Data\n getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void;\n markSessionsNeedingBackup(sessions: ISession[], txn?: unknown): Promise<void>;\n\n // Session key backups\n doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn: unknown) => T, log?: Logger): Promise<T>;\n}\n\nexport type Mode = \"readonly\" | \"readwrite\";\n\n/** Data on a Megolm session */\nexport interface ISession {\n senderKey: string;\n sessionId: string;\n sessionData?: InboundGroupSessionData;\n}\n\n/** Extended data on a Megolm session */\nexport interface SessionExtended extends ISession {\n needsBackup: boolean;\n}\n\n/** Data on an Olm session */\nexport interface ISessionInfo {\n deviceKey?: string;\n sessionId?: string;\n session?: string;\n lastReceivedMessageTs?: number;\n}\n\nexport interface IDeviceData {\n devices: {\n [userId: string]: {\n [deviceId: string]: IDevice;\n };\n };\n trackingStatus: {\n [userId: string]: TrackingStatus;\n };\n crossSigningInfo?: Record<string, ICrossSigningInfo>;\n syncToken?: string;\n}\n\nexport interface IWithheld {\n // eslint-disable-next-line camelcase\n room_id: string;\n code: string;\n reason: string;\n}\n\n/**\n * Represents an outgoing room key request\n */\nexport interface OutgoingRoomKeyRequest {\n /**\n * Unique id for this request. Used for both an id within the request for later pairing with a cancellation,\n * and for the transaction id when sending the to_device messages to our local server.\n */\n requestId: string;\n requestTxnId?: string;\n /**\n * Transaction id for the cancellation, if any\n */\n cancellationTxnId?: string;\n /**\n * List of recipients for the request\n */\n recipients: IRoomKeyRequestRecipient[];\n /**\n * Parameters for the request\n */\n requestBody: IRoomKeyRequestBody;\n /**\n * current state of this request\n */\n state: RoomKeyRequestState;\n}\n\n/**\n * Keys for the `account` object store to store the migration state.\n * Values are defined in `MigrationState`.\n * @internal\n */\nexport const ACCOUNT_OBJECT_KEY_MIGRATION_STATE = \"migrationState\";\n\n/**\n * A record of which steps have been completed in the libolm to Rust Crypto migration.\n *\n * Used by {@link CryptoStore#getMigrationState} and {@link CryptoStore#setMigrationState}.\n *\n * @internal\n */\nexport enum MigrationState {\n /** No migration steps have yet been completed. */\n NOT_STARTED,\n\n /** We have migrated the account data, cross-signing keys, etc. */\n INITIAL_DATA_MIGRATED,\n\n /** INITIAL_DATA_MIGRATED, and in addition, we have migrated all the Olm sessions. */\n OLM_SESSIONS_MIGRATED,\n\n /** OLM_SESSIONS_MIGRATED, and in addition, we have migrated all the Megolm sessions. */\n MEGOLM_SESSIONS_MIGRATED,\n\n /** MEGOLM_SESSIONS_MIGRATED, and in addition, we have migrated all the room settings. */\n ROOM_SETTINGS_MIGRATED,\n\n /** ROOM_SETTINGS_MIGRATED, and in addition, we have done the first own keys query in order to\n * load the public part of the keys that have been migrated */\n INITIAL_OWN_KEY_QUERY_DONE,\n}\n\n/**\n * The size of batches to be returned by {@link CryptoStore#getEndToEndSessionsBatch} and\n * {@link CryptoStore#getEndToEndInboundGroupSessionsBatch}.\n */\nexport const SESSION_BATCH_SIZE = 50;\n\nexport interface InboundGroupSessionData {\n room_id: string; // eslint-disable-line camelcase\n /** pickled Olm.InboundGroupSession */\n session: string;\n keysClaimed?: Record<string, string>;\n /** Devices involved in forwarding this session to us (normally empty). */\n forwardingCurve25519KeyChain: string[];\n /** whether this session is untrusted. */\n untrusted?: boolean;\n /** whether this session exists during the room being set to shared history. */\n sharedHistory?: boolean;\n}\n\nexport interface ICrossSigningInfo {\n keys: Record<string, CrossSigningKeyInfo>;\n firstUse: boolean;\n crossSigningVerifiedBefore: boolean;\n}\n\n/* eslint-disable camelcase */\nexport interface IRoomEncryption {\n algorithm: string;\n rotation_period_ms?: number;\n rotation_period_msgs?: number;\n}\n/* eslint-enable camelcase */\n\nexport enum TrackingStatus {\n NotTracked,\n PendingDownload,\n DownloadInProgress,\n UpToDate,\n}\n\n/**\n * possible states for a room key request\n *\n * The state machine looks like:\n * ```\n *\n * | (cancellation sent)\n * | .-------------------------------------------------.\n * | | |\n * V V (cancellation requested) |\n * UNSENT -----------------------------+ |\n * | | |\n * | | |\n * | (send successful) | CANCELLATION_PENDING_AND_WILL_RESEND\n * V | Λ\n * SENT | |\n * |-------------------------------- | --------------'\n * | | (cancellation requested with intent\n * | | to resend the original request)\n * | |\n * | (cancellation requested) |\n * V |\n * CANCELLATION_PENDING |\n * | |\n * | (cancellation sent) |\n * V |\n * (deleted) <---------------------------+\n * ```\n */\nexport enum RoomKeyRequestState {\n /** request not yet sent */\n Unsent,\n /** request sent, awaiting reply */\n Sent,\n /** reply received, cancellation not yet sent */\n CancellationPending,\n /**\n * Cancellation not yet sent and will transition to UNSENT instead of\n * being deleted once the cancellation has been sent.\n */\n CancellationPendingAndWillResend,\n}\n\n/* eslint-disable camelcase */\ninterface IRoomKey {\n room_id: string;\n algorithm: string;\n}\n\n/**\n * The parameters of a room key request. The details of the request may\n * vary with the crypto algorithm, but the management and storage layers for\n * outgoing requests expect it to have 'room_id' and 'session_id' properties.\n */\nexport interface IRoomKeyRequestBody extends IRoomKey {\n session_id: string;\n sender_key: string;\n}\n\n/* eslint-enable camelcase */\n\nexport interface IRoomKeyRequestRecipient {\n userId: string;\n deviceId: string;\n}\n\ninterface IDevice {\n keys: Record<string, string>;\n algorithms: string[];\n verified: DeviceVerification;\n known: boolean;\n unsigned?: Record<string, any>;\n signatures?: ISignatures;\n}\n\n/** State of the verification of the device. */\nexport enum DeviceVerification {\n Blocked = -1,\n Unverified = 0,\n Verified = 1,\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AAMA;AACA;AACA;;AAqIA;;AAOA;;AAKA;;AA4BA;AACA;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,kCAAkC,GAAG,gBAAgB;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAY,cAAc,0BAAd,cAAc;EACtB;EADQ,cAAc,CAAd,cAAc;EAItB;EAJQ,cAAc,CAAd,cAAc;EAOtB;EAPQ,cAAc,CAAd,cAAc;EAUtB;EAVQ,cAAc,CAAd,cAAc;EAatB;EAbQ,cAAc,CAAd,cAAc;EAgBtB;AACJ;EAjBY,cAAc,CAAd,cAAc;EAAA,OAAd,cAAc;AAAA;;AAqB1B;AACA;AACA;AACA;AACA,OAAO,MAAM,kBAAkB,GAAG,EAAE;;AAqBpC;;AAMA;;AAEA,WAAY,cAAc,0BAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAA,OAAd,cAAc;AAAA;;AAO1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAY,mBAAmB,0BAAnB,mBAAmB;EAC3B;EADQ,mBAAmB,CAAnB,mBAAmB;EAG3B;EAHQ,mBAAmB,CAAnB,mBAAmB;EAK3B;EALQ,mBAAmB,CAAnB,mBAAmB;EAO3B;AACJ;AACA;AACA;EAVY,mBAAmB,CAAnB,mBAAmB;EAAA,OAAnB,mBAAmB;AAAA;;AAc/B;;AAMA;AACA;AACA;AACA;AACA;;AAMA;;AAgBA;AACA,WAAY,kBAAkB,0BAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAA,OAAlB,kBAAkB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"base.js","names":[],"sources":["../../../src/crypto/store/base.ts"],"sourcesContent":["/*\nCopyright 2021 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\nimport { type Logger } from \"../../logger.ts\";\nimport { type CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\nimport { type AESEncryptedSecretStoragePayload } from \"../../@types/AESEncryptedSecretStoragePayload.ts\";\nimport { type ISignatures } from \"../../@types/signed.ts\";\n\n/**\n * Internal module. Definitions for storage for the crypto module\n */\n\nexport interface SecretStorePrivateKeys {\n \"m.megolm_backup.v1\": AESEncryptedSecretStoragePayload;\n}\n\n/**\n * Abstraction of things that can store data required for end-to-end encryption\n */\nexport interface CryptoStore {\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Unlike the rest of the methods in this interface, can be called before {@link CryptoStore#startup}.\n *\n * @internal\n */\n containsData(): Promise<boolean>;\n\n /**\n * Initialise this crypto store.\n *\n * Typically, this involves provisioning storage, and migrating any existing data to the current version of the\n * storage schema where appropriate.\n *\n * Must be called before any of the rest of the methods in this interface.\n */\n startup(): Promise<CryptoStore>;\n\n deleteAllData(): Promise<void>;\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n getMigrationState(): Promise<MigrationState>;\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n setMigrationState(migrationState: MigrationState): Promise<void>;\n\n // Olm Account\n getAccount(txn: unknown, func: (accountPickle: string | null) => void): void;\n storeAccount(txn: unknown, accountPickle: string): void;\n getCrossSigningKeys(txn: unknown, func: (keys: Record<string, CrossSigningKeyInfo> | null) => void): void;\n getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void;\n storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void;\n\n // Olm Sessions\n countEndToEndSessions(txn: unknown, func: (count: number) => void): void;\n getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo | null) => void,\n ): void;\n getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void;\n\n storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void;\n\n /**\n * Get a batch of end-to-end sessions from the database.\n *\n * @returns A batch of Olm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndSessionsBatch(): Promise<ISessionInfo[] | null>;\n\n /**\n * Delete a batch of end-to-end sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions: { deviceKey?: string; sessionId?: string }[]): Promise<void>;\n\n // Inbound Group Sessions\n getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void;\n storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void;\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions(): Promise<number>;\n\n /**\n * Get a batch of Megolm sessions from the database.\n *\n * @returns A batch of Megolm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch(): Promise<SessionExtended[] | null>;\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions: { senderKey: string; sessionId: string }[]): Promise<void>;\n\n // Device Data\n getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void;\n markSessionsNeedingBackup(sessions: ISession[], txn?: unknown): Promise<void>;\n\n // Session key backups\n doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn: unknown) => T, log?: Logger): Promise<T>;\n}\n\nexport type Mode = \"readonly\" | \"readwrite\";\n\n/** Data on a Megolm session */\nexport interface ISession {\n senderKey: string;\n sessionId: string;\n sessionData?: InboundGroupSessionData;\n}\n\n/** Extended data on a Megolm session */\nexport interface SessionExtended extends ISession {\n needsBackup: boolean;\n}\n\n/** Data on an Olm session */\nexport interface ISessionInfo {\n deviceKey?: string;\n sessionId?: string;\n session?: string;\n lastReceivedMessageTs?: number;\n}\n\nexport interface IDeviceData {\n devices: {\n [userId: string]: {\n [deviceId: string]: IDevice;\n };\n };\n trackingStatus: {\n [userId: string]: TrackingStatus;\n };\n crossSigningInfo?: Record<string, ICrossSigningInfo>;\n syncToken?: string;\n}\n\nexport interface IWithheld {\n room_id: string;\n code: string;\n reason: string;\n}\n\n/**\n * Represents an outgoing room key request\n */\nexport interface OutgoingRoomKeyRequest {\n /**\n * Unique id for this request. Used for both an id within the request for later pairing with a cancellation,\n * and for the transaction id when sending the to_device messages to our local server.\n */\n requestId: string;\n requestTxnId?: string;\n /**\n * Transaction id for the cancellation, if any\n */\n cancellationTxnId?: string;\n /**\n * List of recipients for the request\n */\n recipients: IRoomKeyRequestRecipient[];\n /**\n * Parameters for the request\n */\n requestBody: IRoomKeyRequestBody;\n /**\n * current state of this request\n */\n state: RoomKeyRequestState;\n}\n\n/**\n * Keys for the `account` object store to store the migration state.\n * Values are defined in `MigrationState`.\n * @internal\n */\nexport const ACCOUNT_OBJECT_KEY_MIGRATION_STATE = \"migrationState\";\n\n/**\n * A record of which steps have been completed in the libolm to Rust Crypto migration.\n *\n * Used by {@link CryptoStore#getMigrationState} and {@link CryptoStore#setMigrationState}.\n *\n * @internal\n */\nexport enum MigrationState {\n /** No migration steps have yet been completed. */\n NOT_STARTED,\n\n /** We have migrated the account data, cross-signing keys, etc. */\n INITIAL_DATA_MIGRATED,\n\n /** INITIAL_DATA_MIGRATED, and in addition, we have migrated all the Olm sessions. */\n OLM_SESSIONS_MIGRATED,\n\n /** OLM_SESSIONS_MIGRATED, and in addition, we have migrated all the Megolm sessions. */\n MEGOLM_SESSIONS_MIGRATED,\n\n /** MEGOLM_SESSIONS_MIGRATED, and in addition, we have migrated all the room settings. */\n ROOM_SETTINGS_MIGRATED,\n\n /** ROOM_SETTINGS_MIGRATED, and in addition, we have done the first own keys query in order to\n * load the public part of the keys that have been migrated */\n INITIAL_OWN_KEY_QUERY_DONE,\n}\n\n/**\n * The size of batches to be returned by {@link CryptoStore#getEndToEndSessionsBatch} and\n * {@link CryptoStore#getEndToEndInboundGroupSessionsBatch}.\n */\nexport const SESSION_BATCH_SIZE = 50;\n\nexport interface InboundGroupSessionData {\n room_id: string;\n /** pickled Olm.InboundGroupSession */\n session: string;\n keysClaimed?: Record<string, string>;\n /** Devices involved in forwarding this session to us (normally empty). */\n forwardingCurve25519KeyChain: string[];\n /** whether this session is untrusted. */\n untrusted?: boolean;\n /** whether this session exists during the room being set to shared history. */\n sharedHistory?: boolean;\n}\n\nexport interface ICrossSigningInfo {\n keys: Record<string, CrossSigningKeyInfo>;\n firstUse: boolean;\n crossSigningVerifiedBefore: boolean;\n}\n\nexport interface IRoomEncryption {\n algorithm: string;\n rotation_period_ms?: number;\n rotation_period_msgs?: number;\n}\nexport enum TrackingStatus {\n NotTracked,\n PendingDownload,\n DownloadInProgress,\n UpToDate,\n}\n\n/**\n * possible states for a room key request\n *\n * The state machine looks like:\n * ```\n *\n * | (cancellation sent)\n * | .-------------------------------------------------.\n * | | |\n * V V (cancellation requested) |\n * UNSENT -----------------------------+ |\n * | | |\n * | | |\n * | (send successful) | CANCELLATION_PENDING_AND_WILL_RESEND\n * V | Λ\n * SENT | |\n * |-------------------------------- | --------------'\n * | | (cancellation requested with intent\n * | | to resend the original request)\n * | |\n * | (cancellation requested) |\n * V |\n * CANCELLATION_PENDING |\n * | |\n * | (cancellation sent) |\n * V |\n * (deleted) <---------------------------+\n * ```\n */\nexport enum RoomKeyRequestState {\n /** request not yet sent */\n Unsent,\n /** request sent, awaiting reply */\n Sent,\n /** reply received, cancellation not yet sent */\n CancellationPending,\n /**\n * Cancellation not yet sent and will transition to UNSENT instead of\n * being deleted once the cancellation has been sent.\n */\n CancellationPendingAndWillResend,\n}\n\ninterface IRoomKey {\n room_id: string;\n algorithm: string;\n}\n\n/**\n * The parameters of a room key request. The details of the request may\n * vary with the crypto algorithm, but the management and storage layers for\n * outgoing requests expect it to have 'room_id' and 'session_id' properties.\n */\nexport interface IRoomKeyRequestBody extends IRoomKey {\n session_id: string;\n sender_key: string;\n}\n\nexport interface IRoomKeyRequestRecipient {\n userId: string;\n deviceId: string;\n}\n\ninterface IDevice {\n keys: Record<string, string>;\n algorithms: string[];\n verified: DeviceVerification;\n known: boolean;\n unsigned?: Record<string, any>;\n signatures?: ISignatures;\n}\n\n/** State of the verification of the device. */\nexport enum DeviceVerification {\n Blocked = -1,\n Unverified = 0,\n Verified = 1,\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AAMA;AACA;AACA;;AAqIA;;AAOA;;AAKA;;AA2BA;AACA;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,kCAAkC,GAAG,gBAAgB;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAY,cAAc,0BAAd,cAAc;EACtB;EADQ,cAAc,CAAd,cAAc;EAItB;EAJQ,cAAc,CAAd,cAAc;EAOtB;EAPQ,cAAc,CAAd,cAAc;EAUtB;EAVQ,cAAc,CAAd,cAAc;EAatB;EAbQ,cAAc,CAAd,cAAc;EAgBtB;AACJ;EAjBY,cAAc,CAAd,cAAc;EAAA,OAAd,cAAc;AAAA;;AAqB1B;AACA;AACA;AACA;AACA,OAAO,MAAM,kBAAkB,GAAG,EAAE;AA0BpC,WAAY,cAAc,0BAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAd,cAAc,CAAd,cAAc;EAAA,OAAd,cAAc;AAAA;;AAO1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAY,mBAAmB,0BAAnB,mBAAmB;EAC3B;EADQ,mBAAmB,CAAnB,mBAAmB;EAG3B;EAHQ,mBAAmB,CAAnB,mBAAmB;EAK3B;EALQ,mBAAmB,CAAnB,mBAAmB;EAO3B;AACJ;AACA;AACA;EAVY,mBAAmB,CAAnB,mBAAmB;EAAA,OAAnB,mBAAmB;AAAA;;AAmB/B;AACA;AACA;AACA;AACA;;AAoBA;AACA,WAAY,kBAAkB,0BAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAlB,kBAAkB,CAAlB,kBAAkB;EAAA,OAAlB,kBAAkB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"indexeddb-crypto-store-backend.js","names":[],"sources":["../../../src/crypto/store/indexeddb-crypto-store-backend.ts"],"sourcesContent":["/*\nCopyright 2017 - 2021 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\nimport { type Logger, logger } from \"../../logger.ts\";\nimport {\n type CryptoStore,\n type IDeviceData,\n type ISession,\n type SessionExtended,\n type ISessionInfo,\n type IWithheld,\n MigrationState,\n type Mode,\n type SecretStorePrivateKeys,\n SESSION_BATCH_SIZE,\n ACCOUNT_OBJECT_KEY_MIGRATION_STATE,\n type InboundGroupSessionData,\n type IRoomEncryption,\n} from \"./base.ts\";\nimport { IndexedDBCryptoStore } from \"./indexeddb-crypto-store.ts\";\nimport { type CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\n\nconst PROFILE_TRANSACTIONS = false;\n\n/**\n * Implementation of a CryptoStore which is backed by an existing\n * IndexedDB connection. Generally you want IndexedDBCryptoStore\n * which connects to the database and defers to one of these.\n *\n * @internal\n */\nexport class Backend implements CryptoStore {\n private nextTxnId = 0;\n\n /**\n */\n public constructor(private db: IDBDatabase) {\n // make sure we close the db on `onversionchange` - otherwise\n // attempts to delete the database will block (and subsequent\n // attempts to re-create it will also block).\n db.onversionchange = (): void => {\n logger.log(`versionchange for indexeddb ${this.db.name}: closing`);\n db.close();\n };\n }\n\n public async containsData(): Promise<boolean> {\n throw Error(\"Not implemented for Backend\");\n }\n\n public async startup(): Promise<CryptoStore> {\n // No work to do, as the startup is done by the caller (e.g IndexedDBCryptoStore)\n // by passing us a ready IDBDatabase instance\n return this;\n }\n\n public async deleteAllData(): Promise<void> {\n throw Error(\"This is not implemented, call IDBFactory::deleteDatabase(dbName) instead.\");\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n */\n public async getMigrationState(): Promise<MigrationState> {\n let migrationState = MigrationState.NOT_STARTED;\n await this.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n const getReq = objectStore.get(ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n getReq.onsuccess = (): void => {\n migrationState = getReq.result ?? MigrationState.NOT_STARTED;\n };\n });\n return migrationState;\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n */\n public async setMigrationState(migrationState: MigrationState): Promise<void> {\n await this.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n objectStore.put(migrationState, ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n });\n }\n\n // Olm Account\n\n public getAccount(txn: IDBTransaction, func: (accountPickle: string | null) => void): void {\n const objectStore = txn.objectStore(\"account\");\n const getReq = objectStore.get(\"-\");\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeAccount(txn: IDBTransaction, accountPickle: string): void {\n const objectStore = txn.objectStore(\"account\");\n objectStore.put(accountPickle, \"-\");\n }\n\n public getCrossSigningKeys(\n txn: IDBTransaction,\n func: (keys: Record<string, CrossSigningKeyInfo> | null) => void,\n ): void {\n const objectStore = txn.objectStore(\"account\");\n const getReq = objectStore.get(\"crossSigningKeys\");\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: IDBTransaction,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void {\n const objectStore = txn.objectStore(\"account\");\n const getReq = objectStore.get(`ssss_cache:${type}`);\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: IDBTransaction,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void {\n const objectStore = txn.objectStore(\"account\");\n objectStore.put(key, `ssss_cache:${type}`);\n }\n\n // Olm Sessions\n\n public countEndToEndSessions(txn: IDBTransaction, func: (count: number) => void): void {\n const objectStore = txn.objectStore(\"sessions\");\n const countReq = objectStore.count();\n countReq.onsuccess = function (): void {\n try {\n func(countReq.result);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public getEndToEndSessions(\n deviceKey: string,\n txn: IDBTransaction,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void {\n const objectStore = txn.objectStore(\"sessions\");\n const idx = objectStore.index(\"deviceKey\");\n const getReq = idx.openCursor(deviceKey);\n const results: Parameters<Parameters<Backend[\"getEndToEndSessions\"]>[2]>[0] = {};\n getReq.onsuccess = function (): void {\n const cursor = getReq.result;\n if (cursor) {\n results[cursor.value.sessionId] = {\n session: cursor.value.session,\n lastReceivedMessageTs: cursor.value.lastReceivedMessageTs,\n };\n cursor.continue();\n } else {\n try {\n func(results);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n }\n };\n }\n\n public getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: IDBTransaction,\n func: (session: ISessionInfo | null) => void,\n ): void {\n const objectStore = txn.objectStore(\"sessions\");\n const getReq = objectStore.get([deviceKey, sessionId]);\n getReq.onsuccess = function (): void {\n try {\n if (getReq.result) {\n func({\n session: getReq.result.session,\n lastReceivedMessageTs: getReq.result.lastReceivedMessageTs,\n });\n } else {\n func(null);\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeEndToEndSession(\n deviceKey: string,\n sessionId: string,\n sessionInfo: ISessionInfo,\n txn: IDBTransaction,\n ): void {\n const objectStore = txn.objectStore(\"sessions\");\n objectStore.put({\n deviceKey,\n sessionId,\n session: sessionInfo.session,\n lastReceivedMessageTs: sessionInfo.lastReceivedMessageTs,\n });\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n */\n public async getEndToEndSessionsBatch(): Promise<null | ISessionInfo[]> {\n const result: ISessionInfo[] = [];\n await this.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_SESSIONS], (txn) => {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_SESSIONS);\n const getReq = objectStore.openCursor();\n getReq.onsuccess = function (): void {\n try {\n const cursor = getReq.result;\n if (cursor) {\n result.push(cursor.value);\n if (result.length < SESSION_BATCH_SIZE) {\n cursor.continue();\n }\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n });\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n return result;\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndSessionsBatch(sessions: { deviceKey: string; sessionId: string }[]): Promise<void> {\n await this.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_SESSIONS], async (txn) => {\n try {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_SESSIONS);\n for (const { deviceKey, sessionId } of sessions) {\n const req = objectStore.delete([deviceKey, sessionId]);\n await new Promise((resolve) => {\n req.onsuccess = resolve;\n });\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n });\n }\n\n // Inbound group sessions\n\n public getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: IDBTransaction,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void {\n let session: InboundGroupSessionData | null | boolean = false;\n let withheld: IWithheld | null | boolean = false;\n const objectStore = txn.objectStore(\"inbound_group_sessions\");\n const getReq = objectStore.get([senderCurve25519Key, sessionId]);\n getReq.onsuccess = function (): void {\n try {\n if (getReq.result) {\n session = getReq.result.session;\n } else {\n session = null;\n }\n if (withheld !== false) {\n func(session as InboundGroupSessionData, withheld as IWithheld);\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n\n const withheldObjectStore = txn.objectStore(\"inbound_group_sessions_withheld\");\n const withheldGetReq = withheldObjectStore.get([senderCurve25519Key, sessionId]);\n withheldGetReq.onsuccess = function (): void {\n try {\n if (withheldGetReq.result) {\n withheld = withheldGetReq.result.session;\n } else {\n withheld = null;\n }\n if (session !== false) {\n func(session as InboundGroupSessionData, withheld as IWithheld);\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: IDBTransaction,\n ): void {\n const objectStore = txn.objectStore(\"inbound_group_sessions\");\n objectStore.put({\n senderCurve25519Key,\n sessionId,\n session: sessionData,\n });\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n public async countEndToEndInboundGroupSessions(): Promise<number> {\n let result = 0;\n await this.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], (txn) => {\n const sessionStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n const countReq = sessionStore.count();\n countReq.onsuccess = (): void => {\n result = countReq.result;\n };\n });\n return result;\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n */\n public async getEndToEndInboundGroupSessionsBatch(): Promise<null | SessionExtended[]> {\n const result: SessionExtended[] = [];\n await this.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS, IndexedDBCryptoStore.STORE_BACKUP],\n (txn) => {\n const sessionStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n const backupStore = txn.objectStore(IndexedDBCryptoStore.STORE_BACKUP);\n\n const getReq = sessionStore.openCursor();\n getReq.onsuccess = function (): void {\n try {\n const cursor = getReq.result;\n if (cursor) {\n const backupGetReq = backupStore.get(cursor.key);\n backupGetReq.onsuccess = (): void => {\n result.push({\n senderKey: cursor.value.senderCurve25519Key,\n sessionId: cursor.value.sessionId,\n sessionData: cursor.value.session,\n needsBackup: backupGetReq.result !== undefined,\n });\n if (result.length < SESSION_BATCH_SIZE) {\n cursor.continue();\n }\n };\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n },\n );\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n return result;\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndInboundGroupSessionsBatch(\n sessions: { senderKey: string; sessionId: string }[],\n ): Promise<void> {\n await this.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], async (txn) => {\n try {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n for (const { senderKey, sessionId } of sessions) {\n const req = objectStore.delete([senderKey, sessionId]);\n await new Promise((resolve) => {\n req.onsuccess = resolve;\n });\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n });\n }\n\n public getEndToEndDeviceData(txn: IDBTransaction, func: (deviceData: IDeviceData | null) => void): void {\n const objectStore = txn.objectStore(\"device_data\");\n const getReq = objectStore.get(\"-\");\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public getEndToEndRooms(txn: IDBTransaction, func: (rooms: Record<string, IRoomEncryption>) => void): void {\n const rooms: Parameters<Parameters<Backend[\"getEndToEndRooms\"]>[1]>[0] = {};\n const objectStore = txn.objectStore(\"rooms\");\n const getReq = objectStore.openCursor();\n getReq.onsuccess = function (): void {\n const cursor = getReq.result;\n if (cursor) {\n rooms[cursor.key as string] = cursor.value;\n cursor.continue();\n } else {\n try {\n func(rooms);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n }\n };\n }\n\n public async markSessionsNeedingBackup(sessions: ISession[], txn?: IDBTransaction): Promise<void> {\n if (!txn) {\n txn = this.db.transaction(\"sessions_needing_backup\", \"readwrite\");\n }\n const objectStore = txn.objectStore(\"sessions_needing_backup\");\n await Promise.all(\n sessions.map((session) => {\n return new Promise((resolve, reject) => {\n const req = objectStore.put({\n senderCurve25519Key: session.senderKey,\n sessionId: session.sessionId,\n });\n req.onsuccess = resolve;\n req.onerror = reject;\n });\n }),\n );\n }\n\n public doTxn<T>(\n mode: Mode,\n stores: string | string[],\n func: (txn: IDBTransaction) => T,\n log: Logger = logger,\n ): Promise<T> {\n let startTime: number;\n let description: string;\n if (PROFILE_TRANSACTIONS) {\n const txnId = this.nextTxnId++;\n startTime = Date.now();\n description = `${mode} crypto store transaction ${txnId} in ${stores}`;\n log.debug(`Starting ${description}`);\n }\n const txn = this.db.transaction(stores, mode);\n const promise = promiseifyTxn(txn);\n const result = func(txn);\n if (PROFILE_TRANSACTIONS) {\n promise.then(\n () => {\n const elapsedTime = Date.now() - startTime;\n log.debug(`Finished ${description}, took ${elapsedTime} ms`);\n },\n () => {\n const elapsedTime = Date.now() - startTime;\n log.error(`Failed ${description}, took ${elapsedTime} ms`);\n },\n );\n }\n return promise.then(() => {\n return result;\n });\n }\n}\n\ntype DbMigration = (db: IDBDatabase) => void;\nconst DB_MIGRATIONS: DbMigration[] = [\n (db): void => {\n createDatabase(db);\n },\n (db): void => {\n db.createObjectStore(\"account\");\n },\n (db): void => {\n const sessionsStore = db.createObjectStore(\"sessions\", {\n keyPath: [\"deviceKey\", \"sessionId\"],\n });\n sessionsStore.createIndex(\"deviceKey\", \"deviceKey\");\n },\n (db): void => {\n db.createObjectStore(\"inbound_group_sessions\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"device_data\");\n },\n (db): void => {\n db.createObjectStore(\"rooms\");\n },\n (db): void => {\n db.createObjectStore(\"sessions_needing_backup\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"inbound_group_sessions_withheld\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"],\n });\n },\n (db): void => {\n const problemsStore = db.createObjectStore(\"session_problems\", {\n keyPath: [\"deviceKey\", \"time\"],\n });\n problemsStore.createIndex(\"deviceKey\", \"deviceKey\");\n\n db.createObjectStore(\"notified_error_devices\", {\n keyPath: [\"userId\", \"deviceId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"shared_history_inbound_group_sessions\", {\n keyPath: [\"roomId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"parked_shared_history\", {\n keyPath: [\"roomId\"],\n });\n },\n // Expand as needed.\n];\nexport const VERSION = DB_MIGRATIONS.length;\n\nexport function upgradeDatabase(db: IDBDatabase, oldVersion: number): void {\n logger.log(`Upgrading IndexedDBCryptoStore from version ${oldVersion}` + ` to ${VERSION}`);\n DB_MIGRATIONS.forEach((migration, index) => {\n if (oldVersion <= index) migration(db);\n });\n}\n\nfunction createDatabase(db: IDBDatabase): void {\n const outgoingRoomKeyRequestsStore = db.createObjectStore(\"outgoingRoomKeyRequests\", { keyPath: \"requestId\" });\n\n // we assume that the RoomKeyRequestBody will have room_id and session_id\n // properties, to make the index efficient.\n outgoingRoomKeyRequestsStore.createIndex(\"session\", [\"requestBody.room_id\", \"requestBody.session_id\"]);\n\n outgoingRoomKeyRequestsStore.createIndex(\"state\", \"state\");\n}\n\ninterface IWrappedIDBTransaction extends IDBTransaction {\n _mx_abortexception: Error; // eslint-disable-line camelcase\n}\n\n/*\n * Aborts a transaction with a given exception\n * The transaction promise will be rejected with this exception.\n */\nfunction abortWithException(txn: IDBTransaction, e: Error): void {\n // We cheekily stick our exception onto the transaction object here\n // We could alternatively make the thing we pass back to the app\n // an object containing the transaction and exception.\n (txn as IWrappedIDBTransaction)._mx_abortexception = e;\n try {\n txn.abort();\n } catch {\n // sometimes we won't be able to abort the transaction\n // (ie. if it's aborted or completed)\n }\n}\n\nfunction promiseifyTxn<T>(txn: IDBTransaction): Promise<T | null> {\n return new Promise((resolve, reject) => {\n txn.oncomplete = (): void => {\n if ((txn as IWrappedIDBTransaction)._mx_abortexception !== undefined) {\n reject((txn as IWrappedIDBTransaction)._mx_abortexception);\n }\n resolve(null);\n };\n txn.onerror = (event): void => {\n if ((txn as IWrappedIDBTransaction)._mx_abortexception !== undefined) {\n reject((txn as IWrappedIDBTransaction)._mx_abortexception);\n } else {\n logger.log(\"Error performing indexeddb txn\", event);\n reject(txn.error);\n }\n };\n txn.onabort = (event): void => {\n if ((txn as IWrappedIDBTransaction)._mx_abortexception !== undefined) {\n reject((txn as IWrappedIDBTransaction)._mx_abortexception);\n } else {\n logger.log(\"Error performing indexeddb txn\", event);\n reject(txn.error);\n }\n };\n });\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAsB,MAAM,QAAQ,iBAAiB;AACrD,SAOI,cAAc,EAGd,kBAAkB,EAClB,kCAAkC,QAG/B,WAAW;AAClB,SAAS,oBAAoB,QAAQ,6BAA6B;AAGlE,MAAM,oBAAoB,GAAG,KAAK;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,OAAO,CAAwB;EAGxC;AACJ;EACW,WAAW,CAAS,EAAe,EAAE;IAAA,mCAJxB,CAAC;IAAA,KAIM,EAAe,GAAf,EAAe;IACtC;IACA;IACA;IACA,EAAE,CAAC,eAAe,GAAG,MAAY;MAC7B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KAAK;IACpC,GAAG,CAAC,UAAU,GAAG,MAAY;MACzB,IAAK,GAAG,CAA4B,kBAAkB,KAAK,SAAS,EAAE;QAClE,MAAM,CAAE,GAAG,CAA4B,kBAAkB,CAAC;MAC9D;MACA,OAAO,CAAC,IAAI,CAAC;IACjB,CAAC;IACD,GAAG,CAAC,OAAO,GAAI,KAAK,IAAW;MAC3B,IAAK,GAAG,CAA4B,kBAAkB,KAAK,SAAS,EAAE;QAClE,MAAM,CAAE,GAAG,CAA4B,kBAAkB,CAAC;MAC9D,CAAC,MAAM;QACH,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC;QACnD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;MACrB;IACJ,CAAC;IACD,GAAG,CAAC,OAAO,GAAI,KAAK,IAAW;MAC3B,IAAK,GAAG,CAA4B,kBAAkB,KAAK,SAAS,EAAE;QAClE,MAAM,CAAE,GAAG,CAA4B,kBAAkB,CAAC;MAC9D,CAAC,MAAM;QACH,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC;QACnD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;MACrB;IACJ,CAAC;EACL,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"indexeddb-crypto-store-backend.js","names":[],"sources":["../../../src/crypto/store/indexeddb-crypto-store-backend.ts"],"sourcesContent":["/*\nCopyright 2017 - 2021 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\nimport { type Logger, logger } from \"../../logger.ts\";\nimport {\n type CryptoStore,\n type IDeviceData,\n type ISession,\n type SessionExtended,\n type ISessionInfo,\n type IWithheld,\n MigrationState,\n type Mode,\n type SecretStorePrivateKeys,\n SESSION_BATCH_SIZE,\n ACCOUNT_OBJECT_KEY_MIGRATION_STATE,\n type InboundGroupSessionData,\n type IRoomEncryption,\n} from \"./base.ts\";\nimport { IndexedDBCryptoStore } from \"./indexeddb-crypto-store.ts\";\nimport { type CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\n\nconst PROFILE_TRANSACTIONS = false;\n\n/**\n * Implementation of a CryptoStore which is backed by an existing\n * IndexedDB connection. Generally you want IndexedDBCryptoStore\n * which connects to the database and defers to one of these.\n *\n * @internal\n */\nexport class Backend implements CryptoStore {\n private nextTxnId = 0;\n\n /**\n */\n public constructor(private db: IDBDatabase) {\n // make sure we close the db on `onversionchange` - otherwise\n // attempts to delete the database will block (and subsequent\n // attempts to re-create it will also block).\n db.onversionchange = (): void => {\n logger.log(`versionchange for indexeddb ${this.db.name}: closing`);\n db.close();\n };\n }\n\n public async containsData(): Promise<boolean> {\n throw Error(\"Not implemented for Backend\");\n }\n\n public async startup(): Promise<CryptoStore> {\n // No work to do, as the startup is done by the caller (e.g IndexedDBCryptoStore)\n // by passing us a ready IDBDatabase instance\n return this;\n }\n\n public async deleteAllData(): Promise<void> {\n throw Error(\"This is not implemented, call IDBFactory::deleteDatabase(dbName) instead.\");\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n */\n public async getMigrationState(): Promise<MigrationState> {\n let migrationState = MigrationState.NOT_STARTED;\n await this.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n const getReq = objectStore.get(ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n getReq.onsuccess = (): void => {\n migrationState = getReq.result ?? MigrationState.NOT_STARTED;\n };\n });\n return migrationState;\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n */\n public async setMigrationState(migrationState: MigrationState): Promise<void> {\n await this.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n objectStore.put(migrationState, ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n });\n }\n\n // Olm Account\n\n public getAccount(txn: IDBTransaction, func: (accountPickle: string | null) => void): void {\n const objectStore = txn.objectStore(\"account\");\n const getReq = objectStore.get(\"-\");\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeAccount(txn: IDBTransaction, accountPickle: string): void {\n const objectStore = txn.objectStore(\"account\");\n objectStore.put(accountPickle, \"-\");\n }\n\n public getCrossSigningKeys(\n txn: IDBTransaction,\n func: (keys: Record<string, CrossSigningKeyInfo> | null) => void,\n ): void {\n const objectStore = txn.objectStore(\"account\");\n const getReq = objectStore.get(\"crossSigningKeys\");\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: IDBTransaction,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void {\n const objectStore = txn.objectStore(\"account\");\n const getReq = objectStore.get(`ssss_cache:${type}`);\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: IDBTransaction,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void {\n const objectStore = txn.objectStore(\"account\");\n objectStore.put(key, `ssss_cache:${type}`);\n }\n\n // Olm Sessions\n\n public countEndToEndSessions(txn: IDBTransaction, func: (count: number) => void): void {\n const objectStore = txn.objectStore(\"sessions\");\n const countReq = objectStore.count();\n countReq.onsuccess = function (): void {\n try {\n func(countReq.result);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public getEndToEndSessions(\n deviceKey: string,\n txn: IDBTransaction,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void {\n const objectStore = txn.objectStore(\"sessions\");\n const idx = objectStore.index(\"deviceKey\");\n const getReq = idx.openCursor(deviceKey);\n const results: Parameters<Parameters<Backend[\"getEndToEndSessions\"]>[2]>[0] = {};\n getReq.onsuccess = function (): void {\n const cursor = getReq.result;\n if (cursor) {\n results[cursor.value.sessionId] = {\n session: cursor.value.session,\n lastReceivedMessageTs: cursor.value.lastReceivedMessageTs,\n };\n cursor.continue();\n } else {\n try {\n func(results);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n }\n };\n }\n\n public getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: IDBTransaction,\n func: (session: ISessionInfo | null) => void,\n ): void {\n const objectStore = txn.objectStore(\"sessions\");\n const getReq = objectStore.get([deviceKey, sessionId]);\n getReq.onsuccess = function (): void {\n try {\n if (getReq.result) {\n func({\n session: getReq.result.session,\n lastReceivedMessageTs: getReq.result.lastReceivedMessageTs,\n });\n } else {\n func(null);\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeEndToEndSession(\n deviceKey: string,\n sessionId: string,\n sessionInfo: ISessionInfo,\n txn: IDBTransaction,\n ): void {\n const objectStore = txn.objectStore(\"sessions\");\n objectStore.put({\n deviceKey,\n sessionId,\n session: sessionInfo.session,\n lastReceivedMessageTs: sessionInfo.lastReceivedMessageTs,\n });\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n */\n public async getEndToEndSessionsBatch(): Promise<null | ISessionInfo[]> {\n const result: ISessionInfo[] = [];\n await this.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_SESSIONS], (txn) => {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_SESSIONS);\n const getReq = objectStore.openCursor();\n getReq.onsuccess = function (): void {\n try {\n const cursor = getReq.result;\n if (cursor) {\n result.push(cursor.value);\n if (result.length < SESSION_BATCH_SIZE) {\n cursor.continue();\n }\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n });\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n return result;\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndSessionsBatch(sessions: { deviceKey: string; sessionId: string }[]): Promise<void> {\n await this.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_SESSIONS], async (txn) => {\n try {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_SESSIONS);\n for (const { deviceKey, sessionId } of sessions) {\n const req = objectStore.delete([deviceKey, sessionId]);\n await new Promise((resolve) => {\n req.onsuccess = resolve;\n });\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n });\n }\n\n // Inbound group sessions\n\n public getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: IDBTransaction,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void {\n let session: InboundGroupSessionData | null | boolean = false;\n let withheld: IWithheld | null | boolean = false;\n const objectStore = txn.objectStore(\"inbound_group_sessions\");\n const getReq = objectStore.get([senderCurve25519Key, sessionId]);\n getReq.onsuccess = function (): void {\n try {\n if (getReq.result) {\n session = getReq.result.session;\n } else {\n session = null;\n }\n if (withheld !== false) {\n func(session as InboundGroupSessionData, withheld as IWithheld);\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n\n const withheldObjectStore = txn.objectStore(\"inbound_group_sessions_withheld\");\n const withheldGetReq = withheldObjectStore.get([senderCurve25519Key, sessionId]);\n withheldGetReq.onsuccess = function (): void {\n try {\n if (withheldGetReq.result) {\n withheld = withheldGetReq.result.session;\n } else {\n withheld = null;\n }\n if (session !== false) {\n func(session as InboundGroupSessionData, withheld as IWithheld);\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: IDBTransaction,\n ): void {\n const objectStore = txn.objectStore(\"inbound_group_sessions\");\n objectStore.put({\n senderCurve25519Key,\n sessionId,\n session: sessionData,\n });\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n public async countEndToEndInboundGroupSessions(): Promise<number> {\n let result = 0;\n await this.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], (txn) => {\n const sessionStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n const countReq = sessionStore.count();\n countReq.onsuccess = (): void => {\n result = countReq.result;\n };\n });\n return result;\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n */\n public async getEndToEndInboundGroupSessionsBatch(): Promise<null | SessionExtended[]> {\n const result: SessionExtended[] = [];\n await this.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS, IndexedDBCryptoStore.STORE_BACKUP],\n (txn) => {\n const sessionStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n const backupStore = txn.objectStore(IndexedDBCryptoStore.STORE_BACKUP);\n\n const getReq = sessionStore.openCursor();\n getReq.onsuccess = function (): void {\n try {\n const cursor = getReq.result;\n if (cursor) {\n const backupGetReq = backupStore.get(cursor.key);\n backupGetReq.onsuccess = (): void => {\n result.push({\n senderKey: cursor.value.senderCurve25519Key,\n sessionId: cursor.value.sessionId,\n sessionData: cursor.value.session,\n needsBackup: backupGetReq.result !== undefined,\n });\n if (result.length < SESSION_BATCH_SIZE) {\n cursor.continue();\n }\n };\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n },\n );\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n return result;\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndInboundGroupSessionsBatch(\n sessions: { senderKey: string; sessionId: string }[],\n ): Promise<void> {\n await this.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], async (txn) => {\n try {\n const objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n for (const { senderKey, sessionId } of sessions) {\n const req = objectStore.delete([senderKey, sessionId]);\n await new Promise((resolve) => {\n req.onsuccess = resolve;\n });\n }\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n });\n }\n\n public getEndToEndDeviceData(txn: IDBTransaction, func: (deviceData: IDeviceData | null) => void): void {\n const objectStore = txn.objectStore(\"device_data\");\n const getReq = objectStore.get(\"-\");\n getReq.onsuccess = function (): void {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n };\n }\n\n public getEndToEndRooms(txn: IDBTransaction, func: (rooms: Record<string, IRoomEncryption>) => void): void {\n const rooms: Parameters<Parameters<Backend[\"getEndToEndRooms\"]>[1]>[0] = {};\n const objectStore = txn.objectStore(\"rooms\");\n const getReq = objectStore.openCursor();\n getReq.onsuccess = function (): void {\n const cursor = getReq.result;\n if (cursor) {\n rooms[cursor.key as string] = cursor.value;\n cursor.continue();\n } else {\n try {\n func(rooms);\n } catch (e) {\n abortWithException(txn, <Error>e);\n }\n }\n };\n }\n\n public async markSessionsNeedingBackup(sessions: ISession[], txn?: IDBTransaction): Promise<void> {\n if (!txn) {\n txn = this.db.transaction(\"sessions_needing_backup\", \"readwrite\");\n }\n const objectStore = txn.objectStore(\"sessions_needing_backup\");\n await Promise.all(\n sessions.map((session) => {\n return new Promise((resolve, reject) => {\n const req = objectStore.put({\n senderCurve25519Key: session.senderKey,\n sessionId: session.sessionId,\n });\n req.onsuccess = resolve;\n req.onerror = reject;\n });\n }),\n );\n }\n\n public doTxn<T>(\n mode: Mode,\n stores: string | string[],\n func: (txn: IDBTransaction) => T,\n log: Logger = logger,\n ): Promise<T> {\n let startTime: number;\n let description: string;\n if (PROFILE_TRANSACTIONS) {\n const txnId = this.nextTxnId++;\n startTime = Date.now();\n description = `${mode} crypto store transaction ${txnId} in ${stores}`;\n log.debug(`Starting ${description}`);\n }\n const txn = this.db.transaction(stores, mode);\n const promise = promiseifyTxn(txn);\n const result = func(txn);\n if (PROFILE_TRANSACTIONS) {\n promise.then(\n () => {\n const elapsedTime = Date.now() - startTime;\n log.debug(`Finished ${description}, took ${elapsedTime} ms`);\n },\n () => {\n const elapsedTime = Date.now() - startTime;\n log.error(`Failed ${description}, took ${elapsedTime} ms`);\n },\n );\n }\n return promise.then(() => {\n return result;\n });\n }\n}\n\ntype DbMigration = (db: IDBDatabase) => void;\nconst DB_MIGRATIONS: DbMigration[] = [\n (db): void => {\n createDatabase(db);\n },\n (db): void => {\n db.createObjectStore(\"account\");\n },\n (db): void => {\n const sessionsStore = db.createObjectStore(\"sessions\", {\n keyPath: [\"deviceKey\", \"sessionId\"],\n });\n sessionsStore.createIndex(\"deviceKey\", \"deviceKey\");\n },\n (db): void => {\n db.createObjectStore(\"inbound_group_sessions\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"device_data\");\n },\n (db): void => {\n db.createObjectStore(\"rooms\");\n },\n (db): void => {\n db.createObjectStore(\"sessions_needing_backup\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"inbound_group_sessions_withheld\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"],\n });\n },\n (db): void => {\n const problemsStore = db.createObjectStore(\"session_problems\", {\n keyPath: [\"deviceKey\", \"time\"],\n });\n problemsStore.createIndex(\"deviceKey\", \"deviceKey\");\n\n db.createObjectStore(\"notified_error_devices\", {\n keyPath: [\"userId\", \"deviceId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"shared_history_inbound_group_sessions\", {\n keyPath: [\"roomId\"],\n });\n },\n (db): void => {\n db.createObjectStore(\"parked_shared_history\", {\n keyPath: [\"roomId\"],\n });\n },\n // Expand as needed.\n];\nexport const VERSION = DB_MIGRATIONS.length;\n\nexport function upgradeDatabase(db: IDBDatabase, oldVersion: number): void {\n logger.log(`Upgrading IndexedDBCryptoStore from version ${oldVersion}` + ` to ${VERSION}`);\n DB_MIGRATIONS.forEach((migration, index) => {\n if (oldVersion <= index) migration(db);\n });\n}\n\nfunction createDatabase(db: IDBDatabase): void {\n const outgoingRoomKeyRequestsStore = db.createObjectStore(\"outgoingRoomKeyRequests\", { keyPath: \"requestId\" });\n\n // we assume that the RoomKeyRequestBody will have room_id and session_id\n // properties, to make the index efficient.\n outgoingRoomKeyRequestsStore.createIndex(\"session\", [\"requestBody.room_id\", \"requestBody.session_id\"]);\n\n outgoingRoomKeyRequestsStore.createIndex(\"state\", \"state\");\n}\n\ninterface IWrappedIDBTransaction extends IDBTransaction {\n _mx_abortexception: Error;\n}\n\n/*\n * Aborts a transaction with a given exception\n * The transaction promise will be rejected with this exception.\n */\nfunction abortWithException(txn: IDBTransaction, e: Error): void {\n // We cheekily stick our exception onto the transaction object here\n // We could alternatively make the thing we pass back to the app\n // an object containing the transaction and exception.\n (txn as IWrappedIDBTransaction)._mx_abortexception = e;\n try {\n txn.abort();\n } catch {\n // sometimes we won't be able to abort the transaction\n // (ie. if it's aborted or completed)\n }\n}\n\nfunction promiseifyTxn<T>(txn: IDBTransaction): Promise<T | null> {\n return new Promise((resolve, reject) => {\n txn.oncomplete = (): void => {\n if ((txn as IWrappedIDBTransaction)._mx_abortexception !== undefined) {\n reject((txn as IWrappedIDBTransaction)._mx_abortexception);\n }\n resolve(null);\n };\n txn.onerror = (event): void => {\n if ((txn as IWrappedIDBTransaction)._mx_abortexception !== undefined) {\n reject((txn as IWrappedIDBTransaction)._mx_abortexception);\n } else {\n logger.log(\"Error performing indexeddb txn\", event);\n reject(txn.error);\n }\n };\n txn.onabort = (event): void => {\n if ((txn as IWrappedIDBTransaction)._mx_abortexception !== undefined) {\n reject((txn as IWrappedIDBTransaction)._mx_abortexception);\n } else {\n logger.log(\"Error performing indexeddb txn\", event);\n reject(txn.error);\n }\n };\n });\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAsB,MAAM,QAAQ,iBAAiB;AACrD,SAOI,cAAc,EAGd,kBAAkB,EAClB,kCAAkC,QAG/B,WAAW;AAClB,SAAS,oBAAoB,QAAQ,6BAA6B;AAGlE,MAAM,oBAAoB,GAAG,KAAK;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,OAAO,CAAwB;EAGxC;AACJ;EACW,WAAW,CAAS,EAAe,EAAE;IAAA,mCAJxB,CAAC;IAAA,KAIM,EAAe,GAAf,EAAe;IACtC;IACA;IACA;IACA,EAAE,CAAC,eAAe,GAAG,MAAY;MAC7B,MAAM,CAAC,GAAG,CAAC,+BAA+B,IAAI,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC;MAClE,EAAE,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;EACL;EAEA,MAAa,YAAY,GAAqB;IAC1C,MAAM,KAAK,CAAC,6BAA6B,CAAC;EAC9C;EAEA,MAAa,OAAO,GAAyB;IACzC;IACA;IACA,OAAO,IAAI;EACf;EAEA,MAAa,aAAa,GAAkB;IACxC,MAAM,KAAK,CAAC,2EAA2E,CAAC;EAC5F;;EAEA;AACJ;AACA;AACA;AACA;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,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC;QACnD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;MACrB;IACJ,CAAC;IACD,GAAG,CAAC,OAAO,GAAI,KAAK,IAAW;MAC3B,IAAK,GAAG,CAA4B,kBAAkB,KAAK,SAAS,EAAE;QAClE,MAAM,CAAE,GAAG,CAA4B,kBAAkB,CAAC;MAC9D,CAAC,MAAM;QACH,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC;QACnD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;MACrB;IACJ,CAAC;EACL,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"localStorage-crypto-store.d.ts","sourceRoot":"","sources":["../../../src/crypto/store/localStorage-crypto-store.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,cAAc,EACd,KAAK,IAAI,EACT,KAAK,sBAAsB,EAE3B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAmCrE,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,WAAW;IAW9D,OAAO,CAAC,QAAQ,CAAC,KAAK;IAVzC,OAAc,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ5C;IAED,YAAoC,KAAK,EAAE,OAAO,EAEjD;IAED;;;;;;OAMG;IACU,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAE5C;IAED;;;;;;OAMG;IACU,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAExD;IAED;;;;;;OAMG;IACU,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG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,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE3F;CACJ"}
@@ -106,8 +106,6 @@ export class LocalStorageCryptoStore extends MemoryCryptoStore {
106
106
  }
107
107
  func(count);
108
108
  }
109
-
110
- // eslint-disable-next-line @typescript-eslint/naming-convention
111
109
  _getEndToEndSessions(deviceKey) {
112
110
  const sessions = getJsonItem(this.store, keyEndToEndSessions(deviceKey));
113
111
  const fixedSessions = {};
@@ -1 +1 @@
1
- {"version":3,"file":"localStorage-crypto-store.js","names":[],"sources":["../../../src/crypto/store/localStorage-crypto-store.ts"],"sourcesContent":["/*\nCopyright 2017 - 2021 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\nimport { logger } from \"../../logger.ts\";\nimport { MemoryCryptoStore } from \"./memory-crypto-store.ts\";\nimport {\n type CryptoStore,\n type ISession,\n type SessionExtended,\n type ISessionInfo,\n type IWithheld,\n MigrationState,\n type Mode,\n type SecretStorePrivateKeys,\n SESSION_BATCH_SIZE,\n type InboundGroupSessionData,\n type IRoomEncryption,\n} from \"./base.ts\";\nimport { type CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\n\n/**\n * Internal module. Partial localStorage backed storage for e2e.\n * This is not a full crypto store, just the in-memory store with\n * some things backed by localStorage. It exists because indexedDB\n * is broken in Firefox private mode or set to, \"will not remember\n * history\".\n */\n\nconst E2E_PREFIX = \"crypto.\";\nconst KEY_END_TO_END_MIGRATION_STATE = E2E_PREFIX + \"migration\";\nconst KEY_END_TO_END_ACCOUNT = E2E_PREFIX + \"account\";\nconst KEY_CROSS_SIGNING_KEYS = E2E_PREFIX + \"cross_signing_keys\";\nconst KEY_INBOUND_SESSION_PREFIX = E2E_PREFIX + \"inboundgroupsessions/\";\nconst KEY_INBOUND_SESSION_WITHHELD_PREFIX = E2E_PREFIX + \"inboundgroupsessions.withheld/\";\nconst KEY_ROOMS_PREFIX = E2E_PREFIX + \"rooms/\";\nconst KEY_SESSIONS_NEEDING_BACKUP = E2E_PREFIX + \"sessionsneedingbackup\";\n\nfunction keyEndToEndSessions(deviceKey: string): string {\n return E2E_PREFIX + \"sessions/\" + deviceKey;\n}\n\nfunction keyEndToEndInboundGroupSession(senderKey: string, sessionId: string): string {\n return KEY_INBOUND_SESSION_PREFIX + senderKey + \"/\" + sessionId;\n}\n\nfunction keyEndToEndInboundGroupSessionWithheld(senderKey: string, sessionId: string): string {\n return KEY_INBOUND_SESSION_WITHHELD_PREFIX + senderKey + \"/\" + sessionId;\n}\n\nfunction keyEndToEndRoomsPrefix(roomId: string): string {\n return KEY_ROOMS_PREFIX + roomId;\n}\n\nexport class LocalStorageCryptoStore extends MemoryCryptoStore implements CryptoStore {\n public static exists(store: Storage): boolean {\n const length = store.length;\n for (let i = 0; i < length; i++) {\n if (store.key(i)?.startsWith(E2E_PREFIX)) {\n return true;\n }\n }\n return false;\n }\n\n public constructor(private readonly store: Storage) {\n super();\n }\n\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Implementation of {@link CryptoStore.containsData}.\n *\n * @internal\n */\n public async containsData(): Promise<boolean> {\n return LocalStorageCryptoStore.exists(this.store);\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n *\n * @internal\n */\n public async getMigrationState(): Promise<MigrationState> {\n return getJsonItem(this.store, KEY_END_TO_END_MIGRATION_STATE) ?? MigrationState.NOT_STARTED;\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n *\n * @internal\n */\n public async setMigrationState(migrationState: MigrationState): Promise<void> {\n setJsonItem(this.store, KEY_END_TO_END_MIGRATION_STATE, migrationState);\n }\n\n // Olm Sessions\n\n public countEndToEndSessions(txn: unknown, func: (count: number) => void): void {\n let count = 0;\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(keyEndToEndSessions(\"\"))) {\n const sessions = getJsonItem(this.store, key);\n count += Object.keys(sessions ?? {}).length;\n }\n }\n func(count);\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private _getEndToEndSessions(deviceKey: string): Record<string, ISessionInfo> {\n const sessions = getJsonItem(this.store, keyEndToEndSessions(deviceKey));\n const fixedSessions: Record<string, ISessionInfo> = {};\n\n // fix up any old sessions to be objects rather than just the base64 pickle\n for (const [sid, val] of Object.entries(sessions || {})) {\n if (typeof val === \"string\") {\n fixedSessions[sid] = {\n session: val,\n };\n } else {\n fixedSessions[sid] = val;\n }\n }\n\n return fixedSessions;\n }\n\n public getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo) => void,\n ): void {\n const sessions = this._getEndToEndSessions(deviceKey);\n func(sessions[sessionId] ?? {});\n }\n\n public getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void {\n func(this._getEndToEndSessions(deviceKey) ?? {});\n }\n\n public storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void {\n const sessions = this._getEndToEndSessions(deviceKey) || {};\n sessions[sessionId] = sessionInfo;\n setJsonItem(this.store, keyEndToEndSessions(deviceKey), sessions);\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async getEndToEndSessionsBatch(): Promise<null | ISessionInfo[]> {\n const result: ISessionInfo[] = [];\n for (let i = 0; i < this.store.length; ++i) {\n if (this.store.key(i)?.startsWith(keyEndToEndSessions(\"\"))) {\n const deviceKey = this.store.key(i)!.split(\"/\")[1];\n for (const session of Object.values(this._getEndToEndSessions(deviceKey))) {\n result.push(session);\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n }\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndSessionsBatch(sessions: { deviceKey: string; sessionId: string }[]): Promise<void> {\n for (const { deviceKey, sessionId } of sessions) {\n const deviceSessions = this._getEndToEndSessions(deviceKey) || {};\n delete deviceSessions[sessionId];\n if (Object.keys(deviceSessions).length === 0) {\n // No more sessions for this device.\n this.store.removeItem(keyEndToEndSessions(deviceKey));\n } else {\n setJsonItem(this.store, keyEndToEndSessions(deviceKey), deviceSessions);\n }\n }\n }\n\n // Inbound Group Sessions\n\n public getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void {\n func(\n getJsonItem(this.store, keyEndToEndInboundGroupSession(senderCurve25519Key, sessionId)),\n getJsonItem(this.store, keyEndToEndInboundGroupSessionWithheld(senderCurve25519Key, sessionId)),\n );\n }\n\n public storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void {\n setJsonItem(this.store, keyEndToEndInboundGroupSession(senderCurve25519Key, sessionId), sessionData);\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n public async countEndToEndInboundGroupSessions(): Promise<number> {\n let count = 0;\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(KEY_INBOUND_SESSION_PREFIX)) {\n count += 1;\n }\n }\n return count;\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async getEndToEndInboundGroupSessionsBatch(): Promise<SessionExtended[] | null> {\n const sessionsNeedingBackup = getJsonItem<string[]>(this.store, KEY_SESSIONS_NEEDING_BACKUP) || {};\n const result: SessionExtended[] = [];\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(KEY_INBOUND_SESSION_PREFIX)) {\n const key2 = key.slice(KEY_INBOUND_SESSION_PREFIX.length);\n\n // we can't use split, as the components we are trying to split out\n // might themselves contain '/' characters. We rely on the\n // senderKey being a (32-byte) curve25519 key, base64-encoded\n // (hence 43 characters long).\n\n result.push({\n senderKey: key2.slice(0, 43),\n sessionId: key2.slice(44),\n sessionData: getJsonItem(this.store, key)!,\n needsBackup: key2 in sessionsNeedingBackup,\n });\n\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndInboundGroupSessionsBatch(\n sessions: { senderKey: string; sessionId: string }[],\n ): Promise<void> {\n for (const { senderKey, sessionId } of sessions) {\n const k = keyEndToEndInboundGroupSession(senderKey, sessionId);\n this.store.removeItem(k);\n }\n }\n\n public getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void {\n const result: Record<string, IRoomEncryption> = {};\n const prefix = keyEndToEndRoomsPrefix(\"\");\n\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(prefix)) {\n const roomId = key.slice(prefix.length);\n result[roomId] = getJsonItem(this.store, key)!;\n }\n }\n func(result);\n }\n\n public markSessionsNeedingBackup(sessions: ISession[]): Promise<void> {\n const sessionsNeedingBackup =\n getJsonItem<{\n [senderKeySessionId: string]: boolean;\n }>(this.store, KEY_SESSIONS_NEEDING_BACKUP) || {};\n for (const session of sessions) {\n sessionsNeedingBackup[session.senderKey + \"/\" + session.sessionId] = true;\n }\n setJsonItem(this.store, KEY_SESSIONS_NEEDING_BACKUP, sessionsNeedingBackup);\n return Promise.resolve();\n }\n\n /**\n * Delete all data from this store.\n *\n * @returns Promise which resolves when the store has been cleared.\n */\n public deleteAllData(): Promise<void> {\n this.store.removeItem(KEY_END_TO_END_ACCOUNT);\n return Promise.resolve();\n }\n\n // Olm account\n\n public getAccount(txn: unknown, func: (accountPickle: string | null) => void): void {\n const accountPickle = getJsonItem<string>(this.store, KEY_END_TO_END_ACCOUNT);\n func(accountPickle);\n }\n\n public storeAccount(txn: unknown, accountPickle: string): void {\n setJsonItem(this.store, KEY_END_TO_END_ACCOUNT, accountPickle);\n }\n\n public getCrossSigningKeys(txn: unknown, func: (keys: Record<string, CrossSigningKeyInfo> | null) => void): void {\n const keys = getJsonItem<Record<string, CrossSigningKeyInfo>>(this.store, KEY_CROSS_SIGNING_KEYS);\n func(keys);\n }\n\n public getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void {\n const key = getJsonItem<SecretStorePrivateKeys[K]>(this.store, E2E_PREFIX + `ssss_cache.${type}`);\n func(key);\n }\n\n public storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void {\n setJsonItem(this.store, E2E_PREFIX + `ssss_cache.${type}`, key);\n }\n\n public doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn: unknown) => T): Promise<T> {\n return Promise.resolve(func(null));\n }\n}\n\nfunction getJsonItem<T>(store: Storage, key: string): T | null {\n try {\n // if the key is absent, store.getItem() returns null, and\n // JSON.parse(null) === null, so this returns null.\n return JSON.parse(store.getItem(key)!);\n } catch (e) {\n logger.log(\"Error: Failed to get key %s: %s\", key, (<Error>e).message);\n logger.log((<Error>e).stack);\n }\n return null;\n}\n\nfunction setJsonItem<T>(store: Storage, key: string, val: T): void {\n store.setItem(key, JSON.stringify(val));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,MAAM,QAAQ,iBAAiB;AACxC,SAAS,iBAAiB,QAAQ,0BAA0B;AAC5D,SAMI,cAAc,EAGd,kBAAkB,QAGf,WAAW;AAGlB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAM,UAAU,GAAG,SAAS;AAC5B,MAAM,8BAA8B,GAAG,UAAU,GAAG,WAAW;AAC/D,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS;AACrD,MAAM,sBAAsB,GAAG,UAAU,GAAG,oBAAoB;AAChE,MAAM,0BAA0B,GAAG,UAAU,GAAG,uBAAuB;AACvE,MAAM,mCAAmC,GAAG,UAAU,GAAG,gCAAgC;AACzF,MAAM,gBAAgB,GAAG,UAAU,GAAG,QAAQ;AAC9C,MAAM,2BAA2B,GAAG,UAAU,GAAG,uBAAuB;AAExE,SAAS,mBAAmB,CAAC,SAAiB,EAAU;EACpD,OAAO,UAAU,GAAG,WAAW,GAAG,SAAS;AAC/C;AAEA,SAAS,8BAA8B,CAAC,SAAiB,EAAE,SAAiB,EAAU;EAClF,OAAO,0BAA0B,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS;AACnE;AAEA,SAAS,sCAAsC,CAAC,SAAiB,EAAE,SAAiB,EAAU;EAC1F,OAAO,mCAAmC,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS;AAC5E;AAEA,SAAS,sB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,CAAC;AAC3C","ignoreList":[]}
1
+ {"version":3,"file":"localStorage-crypto-store.js","names":[],"sources":["../../../src/crypto/store/localStorage-crypto-store.ts"],"sourcesContent":["/*\nCopyright 2017 - 2021 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\nimport { logger } from \"../../logger.ts\";\nimport { MemoryCryptoStore } from \"./memory-crypto-store.ts\";\nimport {\n type CryptoStore,\n type ISession,\n type SessionExtended,\n type ISessionInfo,\n type IWithheld,\n MigrationState,\n type Mode,\n type SecretStorePrivateKeys,\n SESSION_BATCH_SIZE,\n type InboundGroupSessionData,\n type IRoomEncryption,\n} from \"./base.ts\";\nimport { type CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\n\n/**\n * Internal module. Partial localStorage backed storage for e2e.\n * This is not a full crypto store, just the in-memory store with\n * some things backed by localStorage. It exists because indexedDB\n * is broken in Firefox private mode or set to, \"will not remember\n * history\".\n */\n\nconst E2E_PREFIX = \"crypto.\";\nconst KEY_END_TO_END_MIGRATION_STATE = E2E_PREFIX + \"migration\";\nconst KEY_END_TO_END_ACCOUNT = E2E_PREFIX + \"account\";\nconst KEY_CROSS_SIGNING_KEYS = E2E_PREFIX + \"cross_signing_keys\";\nconst KEY_INBOUND_SESSION_PREFIX = E2E_PREFIX + \"inboundgroupsessions/\";\nconst KEY_INBOUND_SESSION_WITHHELD_PREFIX = E2E_PREFIX + \"inboundgroupsessions.withheld/\";\nconst KEY_ROOMS_PREFIX = E2E_PREFIX + \"rooms/\";\nconst KEY_SESSIONS_NEEDING_BACKUP = E2E_PREFIX + \"sessionsneedingbackup\";\n\nfunction keyEndToEndSessions(deviceKey: string): string {\n return E2E_PREFIX + \"sessions/\" + deviceKey;\n}\n\nfunction keyEndToEndInboundGroupSession(senderKey: string, sessionId: string): string {\n return KEY_INBOUND_SESSION_PREFIX + senderKey + \"/\" + sessionId;\n}\n\nfunction keyEndToEndInboundGroupSessionWithheld(senderKey: string, sessionId: string): string {\n return KEY_INBOUND_SESSION_WITHHELD_PREFIX + senderKey + \"/\" + sessionId;\n}\n\nfunction keyEndToEndRoomsPrefix(roomId: string): string {\n return KEY_ROOMS_PREFIX + roomId;\n}\n\nexport class LocalStorageCryptoStore extends MemoryCryptoStore implements CryptoStore {\n public static exists(store: Storage): boolean {\n const length = store.length;\n for (let i = 0; i < length; i++) {\n if (store.key(i)?.startsWith(E2E_PREFIX)) {\n return true;\n }\n }\n return false;\n }\n\n public constructor(private readonly store: Storage) {\n super();\n }\n\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Implementation of {@link CryptoStore.containsData}.\n *\n * @internal\n */\n public async containsData(): Promise<boolean> {\n return LocalStorageCryptoStore.exists(this.store);\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n *\n * @internal\n */\n public async getMigrationState(): Promise<MigrationState> {\n return getJsonItem(this.store, KEY_END_TO_END_MIGRATION_STATE) ?? MigrationState.NOT_STARTED;\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n *\n * @internal\n */\n public async setMigrationState(migrationState: MigrationState): Promise<void> {\n setJsonItem(this.store, KEY_END_TO_END_MIGRATION_STATE, migrationState);\n }\n\n // Olm Sessions\n\n public countEndToEndSessions(txn: unknown, func: (count: number) => void): void {\n let count = 0;\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(keyEndToEndSessions(\"\"))) {\n const sessions = getJsonItem(this.store, key);\n count += Object.keys(sessions ?? {}).length;\n }\n }\n func(count);\n }\n\n private _getEndToEndSessions(deviceKey: string): Record<string, ISessionInfo> {\n const sessions = getJsonItem(this.store, keyEndToEndSessions(deviceKey));\n const fixedSessions: Record<string, ISessionInfo> = {};\n\n // fix up any old sessions to be objects rather than just the base64 pickle\n for (const [sid, val] of Object.entries(sessions || {})) {\n if (typeof val === \"string\") {\n fixedSessions[sid] = {\n session: val,\n };\n } else {\n fixedSessions[sid] = val;\n }\n }\n\n return fixedSessions;\n }\n\n public getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo) => void,\n ): void {\n const sessions = this._getEndToEndSessions(deviceKey);\n func(sessions[sessionId] ?? {});\n }\n\n public getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void {\n func(this._getEndToEndSessions(deviceKey) ?? {});\n }\n\n public storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void {\n const sessions = this._getEndToEndSessions(deviceKey) || {};\n sessions[sessionId] = sessionInfo;\n setJsonItem(this.store, keyEndToEndSessions(deviceKey), sessions);\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async getEndToEndSessionsBatch(): Promise<null | ISessionInfo[]> {\n const result: ISessionInfo[] = [];\n for (let i = 0; i < this.store.length; ++i) {\n if (this.store.key(i)?.startsWith(keyEndToEndSessions(\"\"))) {\n const deviceKey = this.store.key(i)!.split(\"/\")[1];\n for (const session of Object.values(this._getEndToEndSessions(deviceKey))) {\n result.push(session);\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n }\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndSessionsBatch(sessions: { deviceKey: string; sessionId: string }[]): Promise<void> {\n for (const { deviceKey, sessionId } of sessions) {\n const deviceSessions = this._getEndToEndSessions(deviceKey) || {};\n delete deviceSessions[sessionId];\n if (Object.keys(deviceSessions).length === 0) {\n // No more sessions for this device.\n this.store.removeItem(keyEndToEndSessions(deviceKey));\n } else {\n setJsonItem(this.store, keyEndToEndSessions(deviceKey), deviceSessions);\n }\n }\n }\n\n // Inbound Group Sessions\n\n public getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void {\n func(\n getJsonItem(this.store, keyEndToEndInboundGroupSession(senderCurve25519Key, sessionId)),\n getJsonItem(this.store, keyEndToEndInboundGroupSessionWithheld(senderCurve25519Key, sessionId)),\n );\n }\n\n public storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void {\n setJsonItem(this.store, keyEndToEndInboundGroupSession(senderCurve25519Key, sessionId), sessionData);\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n public async countEndToEndInboundGroupSessions(): Promise<number> {\n let count = 0;\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(KEY_INBOUND_SESSION_PREFIX)) {\n count += 1;\n }\n }\n return count;\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async getEndToEndInboundGroupSessionsBatch(): Promise<SessionExtended[] | null> {\n const sessionsNeedingBackup = getJsonItem<string[]>(this.store, KEY_SESSIONS_NEEDING_BACKUP) || {};\n const result: SessionExtended[] = [];\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(KEY_INBOUND_SESSION_PREFIX)) {\n const key2 = key.slice(KEY_INBOUND_SESSION_PREFIX.length);\n\n // we can't use split, as the components we are trying to split out\n // might themselves contain '/' characters. We rely on the\n // senderKey being a (32-byte) curve25519 key, base64-encoded\n // (hence 43 characters long).\n\n result.push({\n senderKey: key2.slice(0, 43),\n sessionId: key2.slice(44),\n sessionData: getJsonItem(this.store, key)!,\n needsBackup: key2 in sessionsNeedingBackup,\n });\n\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndInboundGroupSessionsBatch(\n sessions: { senderKey: string; sessionId: string }[],\n ): Promise<void> {\n for (const { senderKey, sessionId } of sessions) {\n const k = keyEndToEndInboundGroupSession(senderKey, sessionId);\n this.store.removeItem(k);\n }\n }\n\n public getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void {\n const result: Record<string, IRoomEncryption> = {};\n const prefix = keyEndToEndRoomsPrefix(\"\");\n\n for (let i = 0; i < this.store.length; ++i) {\n const key = this.store.key(i);\n if (key?.startsWith(prefix)) {\n const roomId = key.slice(prefix.length);\n result[roomId] = getJsonItem(this.store, key)!;\n }\n }\n func(result);\n }\n\n public markSessionsNeedingBackup(sessions: ISession[]): Promise<void> {\n const sessionsNeedingBackup =\n getJsonItem<{\n [senderKeySessionId: string]: boolean;\n }>(this.store, KEY_SESSIONS_NEEDING_BACKUP) || {};\n for (const session of sessions) {\n sessionsNeedingBackup[session.senderKey + \"/\" + session.sessionId] = true;\n }\n setJsonItem(this.store, KEY_SESSIONS_NEEDING_BACKUP, sessionsNeedingBackup);\n return Promise.resolve();\n }\n\n /**\n * Delete all data from this store.\n *\n * @returns Promise which resolves when the store has been cleared.\n */\n public deleteAllData(): Promise<void> {\n this.store.removeItem(KEY_END_TO_END_ACCOUNT);\n return Promise.resolve();\n }\n\n // Olm account\n\n public getAccount(txn: unknown, func: (accountPickle: string | null) => void): void {\n const accountPickle = getJsonItem<string>(this.store, KEY_END_TO_END_ACCOUNT);\n func(accountPickle);\n }\n\n public storeAccount(txn: unknown, accountPickle: string): void {\n setJsonItem(this.store, KEY_END_TO_END_ACCOUNT, accountPickle);\n }\n\n public getCrossSigningKeys(txn: unknown, func: (keys: Record<string, CrossSigningKeyInfo> | null) => void): void {\n const keys = getJsonItem<Record<string, CrossSigningKeyInfo>>(this.store, KEY_CROSS_SIGNING_KEYS);\n func(keys);\n }\n\n public getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void {\n const key = getJsonItem<SecretStorePrivateKeys[K]>(this.store, E2E_PREFIX + `ssss_cache.${type}`);\n func(key);\n }\n\n public storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void {\n setJsonItem(this.store, E2E_PREFIX + `ssss_cache.${type}`, key);\n }\n\n public doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn: unknown) => T): Promise<T> {\n return Promise.resolve(func(null));\n }\n}\n\nfunction getJsonItem<T>(store: Storage, key: string): T | null {\n try {\n // if the key is absent, store.getItem() returns null, and\n // JSON.parse(null) === null, so this returns null.\n return JSON.parse(store.getItem(key)!);\n } catch (e) {\n logger.log(\"Error: Failed to get key %s: %s\", key, (<Error>e).message);\n logger.log((<Error>e).stack);\n }\n return null;\n}\n\nfunction setJsonItem<T>(store: Storage, key: string, val: T): void {\n store.setItem(key, JSON.stringify(val));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AAK,EAAE,UAAU,GAAG,cAAc,IAAI,EAAE,CAAC;IACjG,IAAI,CAAC,GAAG,CAAC;EACb;EAEO,0BAA0B,CAC7B,GAAY,EACZ,IAAO,EACP,GAA8B,EAC1B;IACJ,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,IAAI,EAAE,EAAE,GAAG,CAAC;EACnE;EAEO,KAAK,CAAI,IAAU,EAAE,MAAwB,EAAE,IAAyB,EAAc;IACzF,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACtC;AACJ;AAEA,SAAS,WAAW,CAAI,KAAc,EAAE,GAAW,EAAY;EAC3D,IAAI;IACA;IACA;IACA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAE,CAAC;EAC1C,CAAC,CAAC,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,GAAG,CAAC,iCAAiC,EAAE,GAAG,EAAU,CAAC,CAAE,OAAO,CAAC;IACtE,MAAM,CAAC,GAAG,CAAS,CAAC,CAAE,KAAK,CAAC;EAChC;EACA,OAAO,IAAI;AACf;AAEA,SAAS,WAAW,CAAI,KAAc,EAAE,GAAW,EAAE,GAAM,EAAQ;EAC/D,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC3C","ignoreList":[]}
@@ -14,16 +14,23 @@ export interface Aes256AuthData {
14
14
  private_key_iterations?: number;
15
15
  }
16
16
  /**
17
- * Information about a server-side key backup.
17
+ * Information about a new server-side key backup.
18
18
  *
19
- * Returned by [`GET /_matrix/client/v3/room_keys/version`](https://spec.matrix.org/v1.7/client-server-api/#get_matrixclientv3room_keysversion).
19
+ * The type of the request body for [`POST /_matrix/client/v3/room_keys/version`](https://spec.matrix.org/v1.19/client-server-api/#post_matrixclientv3room_keysversion).
20
20
  */
21
- export interface KeyBackupInfo {
21
+ export interface NewKeyBackupInfo {
22
22
  algorithm: string;
23
23
  auth_data: ISigned & (Curve25519AuthData | Aes256AuthData);
24
- count?: number;
25
- etag?: string;
26
- version?: string;
24
+ }
25
+ /**
26
+ * Information about an existing server-side key backup.
27
+ *
28
+ * Returned by [`GET /_matrix/client/v3/room_keys/version`](https://spec.matrix.org/v1.7/client-server-api/#get_matrixclientv3room_keysversion).
29
+ */
30
+ export interface KeyBackupInfo extends NewKeyBackupInfo {
31
+ count: number;
32
+ etag: string;
33
+ version: string;
27
34
  }
28
35
  /**
29
36
  * Information on whether a given server-side backup is trusted.
@@ -1 +1 @@
1
- {"version":3,"file":"keybackup.d.ts","sourceRoot":"","sources":["../../src/crypto-api/keybackup.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,GAAG,CAAC,kBAAkB,GAAG,cAAc,CAAC,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG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AAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACpE;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"keybackup.js","names":[],"sources":["../../src/crypto-api/keybackup.ts"],"sourcesContent":["/*\nCopyright 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\nimport { type ISigned } from \"../@types/signed.ts\";\nimport { type AESEncryptedSecretStoragePayload } from \"../@types/AESEncryptedSecretStoragePayload.ts\";\nimport { type ImportRoomKeyProgressData } from \"./index.ts\";\n\nexport interface Curve25519AuthData {\n public_key: string;\n private_key_salt?: string;\n private_key_iterations?: number;\n private_key_bits?: number;\n}\n\nexport interface Aes256AuthData {\n iv: string;\n mac: string;\n private_key_salt?: string;\n private_key_iterations?: number;\n}\n\n/**\n * Information about a server-side key backup.\n *\n * Returned by [`GET /_matrix/client/v3/room_keys/version`](https://spec.matrix.org/v1.7/client-server-api/#get_matrixclientv3room_keysversion).\n */\nexport interface KeyBackupInfo {\n algorithm: string;\n auth_data: ISigned & (Curve25519AuthData | Aes256AuthData);\n count?: number;\n etag?: string;\n version?: string; // number contained within\n}\n\n/**\n * Information on whether a given server-side backup is trusted.\n */\nexport interface BackupTrustInfo {\n /**\n * Is this backup trusted?\n *\n * True if, and only if, there is a valid signature on the backup from a trusted device.\n */\n readonly trusted: boolean;\n\n /**\n * True if this backup matches the stored decryption key.\n */\n readonly matchesDecryptionKey: boolean;\n}\n\n/**\n * The result of {@link CryptoApi.checkKeyBackupAndEnable}.\n */\nexport interface KeyBackupCheck {\n backupInfo: KeyBackupInfo;\n trustInfo: BackupTrustInfo;\n}\n\nexport interface Curve25519SessionData {\n ciphertext: string;\n ephemeral: string;\n mac: string;\n}\n\n/* eslint-disable camelcase */\nexport interface KeyBackupSession<T = Curve25519SessionData | AESEncryptedSecretStoragePayload> {\n first_message_index: number;\n forwarded_count: number;\n is_verified: boolean;\n session_data: T;\n}\n\nexport interface KeyBackupRoomSessions {\n [sessionId: string]: KeyBackupSession;\n}\n\n/**\n * Extra parameters for {@link CryptoApi.restoreKeyBackup} and {@link CryptoApi.restoreKeyBackupWithPassphrase}.\n */\nexport interface KeyBackupRestoreOpts {\n /**\n * A callback which, if defined, will be called periodically to report ongoing progress of the backup restore process.\n * @param progress\n */\n progressCallback?: (progress: ImportRoomKeyProgressData) => void;\n}\n\n/**\n * The result of {@link CryptoApi.restoreKeyBackup}.\n */\nexport interface KeyBackupRestoreResult {\n /**\n * The total number of keys that were found in the backup.\n */\n total: number;\n /**\n * The number of keys that were imported.\n */\n imported: number;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"keybackup.js","names":[],"sources":["../../src/crypto-api/keybackup.ts"],"sourcesContent":["/*\nCopyright 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\nimport { type ISigned } from \"../@types/signed.ts\";\nimport { type AESEncryptedSecretStoragePayload } from \"../@types/AESEncryptedSecretStoragePayload.ts\";\nimport { type ImportRoomKeyProgressData } from \"./index.ts\";\n\nexport interface Curve25519AuthData {\n public_key: string;\n private_key_salt?: string;\n private_key_iterations?: number;\n private_key_bits?: number;\n}\n\nexport interface Aes256AuthData {\n iv: string;\n mac: string;\n private_key_salt?: string;\n private_key_iterations?: number;\n}\n\n/**\n * Information about a new server-side key backup.\n *\n * The type of the request body for [`POST /_matrix/client/v3/room_keys/version`](https://spec.matrix.org/v1.19/client-server-api/#post_matrixclientv3room_keysversion).\n */\nexport interface NewKeyBackupInfo {\n algorithm: string;\n auth_data: ISigned & (Curve25519AuthData | Aes256AuthData);\n}\n\n/**\n * Information about an existing server-side key backup.\n *\n * Returned by [`GET /_matrix/client/v3/room_keys/version`](https://spec.matrix.org/v1.7/client-server-api/#get_matrixclientv3room_keysversion).\n */\nexport interface KeyBackupInfo extends NewKeyBackupInfo {\n count: number;\n etag: string;\n version: string; // number contained within\n}\n\n/**\n * Information on whether a given server-side backup is trusted.\n */\nexport interface BackupTrustInfo {\n /**\n * Is this backup trusted?\n *\n * True if, and only if, there is a valid signature on the backup from a trusted device.\n */\n readonly trusted: boolean;\n\n /**\n * True if this backup matches the stored decryption key.\n */\n readonly matchesDecryptionKey: boolean;\n}\n\n/**\n * The result of {@link CryptoApi.checkKeyBackupAndEnable}.\n */\nexport interface KeyBackupCheck {\n backupInfo: KeyBackupInfo;\n trustInfo: BackupTrustInfo;\n}\n\nexport interface Curve25519SessionData {\n ciphertext: string;\n ephemeral: string;\n mac: string;\n}\n\nexport interface KeyBackupSession<T = Curve25519SessionData | AESEncryptedSecretStoragePayload> {\n first_message_index: number;\n forwarded_count: number;\n is_verified: boolean;\n session_data: T;\n}\n\nexport interface KeyBackupRoomSessions {\n [sessionId: string]: KeyBackupSession;\n}\n\n/**\n * Extra parameters for {@link CryptoApi.restoreKeyBackup} and {@link CryptoApi.restoreKeyBackupWithPassphrase}.\n */\nexport interface KeyBackupRestoreOpts {\n /**\n * A callback which, if defined, will be called periodically to report ongoing progress of the backup restore process.\n * @param progress\n */\n progressCallback?: (progress: ImportRoomKeyProgressData) => void;\n}\n\n/**\n * The result of {@link CryptoApi.restoreKeyBackup}.\n */\nexport interface KeyBackupRestoreResult {\n /**\n * The total number of keys that were found in the backup.\n */\n total: number;\n /**\n * The number of keys that were imported.\n */\n imported: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../src/embedded.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,SAAS,EAejB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAA2C,MAAM,mBAAmB,CAAC;AACzF,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,wBAAwB,EAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EACH,YAAY,EAEZ,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAW,SAAS,EAAE,MAAM,WAAW,CAAC;AAI/C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAkB,KAAK,SAAS,EAAwB,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,KAAK,WAAW,EAA4D,MAAM,aAAa,CAAC;AAEzG,UAAU,kBAAkB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;OAEG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