@open-e2ee/signal-protocol-sdk 7.2.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (688) hide show
  1. package/ADAPTERS.md +54 -7
  2. package/ARCHITECTURE.md +1 -0
  3. package/CHANGELOG.md +503 -0
  4. package/README.md +9 -5
  5. package/SECURITY.md +2 -2
  6. package/THIRD_PARTY_NOTICES.md +429 -0
  7. package/client/README.md +1 -2
  8. package/device/README.md +50 -19
  9. package/dist/client/client.d.ts +31 -5
  10. package/dist/client/client.d.ts.map +1 -1
  11. package/dist/client/client.js +149 -90
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/event-hooks.d.ts.map +1 -1
  14. package/dist/client/event-hooks.js +2 -0
  15. package/dist/client/event-hooks.js.map +1 -1
  16. package/dist/client/files.d.ts.map +1 -1
  17. package/dist/client/files.js +19 -2
  18. package/dist/client/files.js.map +1 -1
  19. package/dist/client/headless.d.ts +1 -1
  20. package/dist/client/headless.js +1 -1
  21. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  22. package/dist/client/hosted-anonymous-delivery.js +2 -1
  23. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  24. package/dist/client/hosted-connection.d.ts +1 -1
  25. package/dist/client/hosted-connection.d.ts.map +1 -1
  26. package/dist/client/hosted-connection.js +8 -12
  27. package/dist/client/hosted-connection.js.map +1 -1
  28. package/dist/client/hosted-group-authority.d.ts.map +1 -1
  29. package/dist/client/hosted-group-authority.js +2 -1
  30. package/dist/client/hosted-group-authority.js.map +1 -1
  31. package/dist/client/hosted-groups.d.ts.map +1 -1
  32. package/dist/client/hosted-groups.js +2 -1
  33. package/dist/client/hosted-groups.js.map +1 -1
  34. package/dist/client/hosted-push.d.ts.map +1 -1
  35. package/dist/client/hosted-push.js +2 -1
  36. package/dist/client/hosted-push.js.map +1 -1
  37. package/dist/client/hosted-transport.d.ts.map +1 -1
  38. package/dist/client/hosted-transport.js +10 -11
  39. package/dist/client/hosted-transport.js.map +1 -1
  40. package/dist/client/hosted-trust.d.ts +11 -11
  41. package/dist/client/hosted-trust.d.ts.map +1 -1
  42. package/dist/client/hosted-trust.js +12 -12
  43. package/dist/client/hosted-trust.js.map +1 -1
  44. package/dist/client/messages.d.ts.map +1 -1
  45. package/dist/client/messages.js +6 -1
  46. package/dist/client/messages.js.map +1 -1
  47. package/dist/client/multi-device.d.ts.map +1 -1
  48. package/dist/client/multi-device.js +2 -1
  49. package/dist/client/multi-device.js.map +1 -1
  50. package/dist/client/relay-work.d.ts +30 -0
  51. package/dist/client/relay-work.d.ts.map +1 -0
  52. package/dist/client/relay-work.js +189 -0
  53. package/dist/client/relay-work.js.map +1 -0
  54. package/dist/client/retry.d.ts.map +1 -1
  55. package/dist/client/retry.js +2 -0
  56. package/dist/client/retry.js.map +1 -1
  57. package/dist/client/sessions.d.ts.map +1 -1
  58. package/dist/client/sessions.js +3 -0
  59. package/dist/client/sessions.js.map +1 -1
  60. package/dist/client/signal-service-cipher.d.ts +19 -11
  61. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  62. package/dist/client/signal-service-cipher.js +48 -46
  63. package/dist/client/signal-service-cipher.js.map +1 -1
  64. package/dist/client/state.d.ts +8 -0
  65. package/dist/client/state.d.ts.map +1 -1
  66. package/dist/client/state.js +11 -0
  67. package/dist/client/state.js.map +1 -1
  68. package/dist/device/connection.d.ts +1 -1
  69. package/dist/device/connection.d.ts.map +1 -1
  70. package/dist/device/connection.js +4 -11
  71. package/dist/device/connection.js.map +1 -1
  72. package/dist/device/device-id.d.ts +10 -4
  73. package/dist/device/device-id.d.ts.map +1 -1
  74. package/dist/device/device-id.js +15 -9
  75. package/dist/device/device-id.js.map +1 -1
  76. package/dist/device/device-name-crypto.d.ts.map +1 -1
  77. package/dist/device/device-name-crypto.js +2 -2
  78. package/dist/device/device-name-crypto.js.map +1 -1
  79. package/dist/device/expo/index.d.ts +25 -8
  80. package/dist/device/expo/index.d.ts.map +1 -1
  81. package/dist/device/expo/index.js +58 -8
  82. package/dist/device/expo/index.js.map +1 -1
  83. package/dist/device/index.d.ts +2 -2
  84. package/dist/device/index.d.ts.map +1 -1
  85. package/dist/device/index.js +3 -2
  86. package/dist/device/index.js.map +1 -1
  87. package/dist/device/lifecycle/index.d.ts +4 -2
  88. package/dist/device/lifecycle/index.d.ts.map +1 -1
  89. package/dist/device/lifecycle/index.js.map +1 -1
  90. package/dist/device/lifecycle/manager.d.ts +12 -14
  91. package/dist/device/lifecycle/manager.d.ts.map +1 -1
  92. package/dist/device/lifecycle/manager.js +52 -97
  93. package/dist/device/lifecycle/manager.js.map +1 -1
  94. package/dist/device/lifecycle/types.d.ts +26 -16
  95. package/dist/device/lifecycle/types.d.ts.map +1 -1
  96. package/dist/device/lifecycle/utils.d.ts +8 -4
  97. package/dist/device/lifecycle/utils.d.ts.map +1 -1
  98. package/dist/device/lifecycle/utils.js +12 -16
  99. package/dist/device/lifecycle/utils.js.map +1 -1
  100. package/dist/device/provisioning.d.ts.map +1 -1
  101. package/dist/device/provisioning.js +6 -8
  102. package/dist/device/provisioning.js.map +1 -1
  103. package/dist/device/react-native/index.d.ts +40 -0
  104. package/dist/device/react-native/index.d.ts.map +1 -0
  105. package/dist/device/react-native/index.js +74 -0
  106. package/dist/device/react-native/index.js.map +1 -0
  107. package/dist/device/transfer.d.ts +15 -7
  108. package/dist/device/transfer.d.ts.map +1 -1
  109. package/dist/device/transfer.js +30 -22
  110. package/dist/device/transfer.js.map +1 -1
  111. package/dist/device/types.d.ts +15 -7
  112. package/dist/device/types.d.ts.map +1 -1
  113. package/dist/device/types.js.map +1 -1
  114. package/dist/device/vault-text.d.ts +13 -0
  115. package/dist/device/vault-text.d.ts.map +1 -0
  116. package/dist/device/vault-text.js +17 -0
  117. package/dist/device/vault-text.js.map +1 -0
  118. package/dist/index.d.ts +9 -5
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +9 -5
  121. package/dist/index.js.map +1 -1
  122. package/dist/internal/crypto/index.d.ts +3 -3
  123. package/dist/internal/crypto/index.d.ts.map +1 -1
  124. package/dist/internal/crypto/index.js +3 -3
  125. package/dist/internal/crypto/index.js.map +1 -1
  126. package/dist/internal/crypto/random-host.d.ts +1 -1
  127. package/dist/internal/crypto/random-host.d.ts.map +1 -1
  128. package/dist/internal/crypto/random-host.js +3 -2
  129. package/dist/internal/crypto/random-host.js.map +1 -1
  130. package/dist/internal/crypto/random-host.native.d.ts +6 -1
  131. package/dist/internal/crypto/random-host.native.d.ts.map +1 -1
  132. package/dist/internal/crypto/random-host.native.js +14 -10
  133. package/dist/internal/crypto/random-host.native.js.map +1 -1
  134. package/dist/internal/crypto/random-host.node.d.ts +1 -1
  135. package/dist/internal/crypto/random-host.node.d.ts.map +1 -1
  136. package/dist/internal/crypto/random-host.node.js +1 -1
  137. package/dist/internal/crypto/random-host.node.js.map +1 -1
  138. package/dist/internal/crypto/random.d.ts +12 -3
  139. package/dist/internal/crypto/random.d.ts.map +1 -1
  140. package/dist/internal/crypto/random.js +14 -3
  141. package/dist/internal/crypto/random.js.map +1 -1
  142. package/dist/internal/crypto/utils.d.ts.map +1 -1
  143. package/dist/internal/crypto/utils.js +10 -6
  144. package/dist/internal/crypto/utils.js.map +1 -1
  145. package/dist/internal/encoding/proto/primitives.d.ts +2 -0
  146. package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
  147. package/dist/internal/encoding/proto/primitives.js +2 -1
  148. package/dist/internal/encoding/proto/primitives.js.map +1 -1
  149. package/dist/internal/encoding/proto/signal-message.d.ts +1 -0
  150. package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
  151. package/dist/internal/encoding/proto/signal-message.js +2 -1
  152. package/dist/internal/encoding/proto/signal-message.js.map +1 -1
  153. package/dist/internal/groups/authority-certificate.d.ts.map +1 -1
  154. package/dist/internal/groups/authority-certificate.js +2 -1
  155. package/dist/internal/groups/authority-certificate.js.map +1 -1
  156. package/dist/internal/groups/encrypted-state.d.ts.map +1 -1
  157. package/dist/internal/groups/encrypted-state.js +9 -7
  158. package/dist/internal/groups/encrypted-state.js.map +1 -1
  159. package/dist/internal/groups/invite-link.d.ts.map +1 -1
  160. package/dist/internal/groups/invite-link.js +2 -1
  161. package/dist/internal/groups/invite-link.js.map +1 -1
  162. package/dist/internal/groups/manager.d.ts.map +1 -1
  163. package/dist/internal/groups/manager.js +5 -5
  164. package/dist/internal/groups/manager.js.map +1 -1
  165. package/dist/internal/groups/sdk-store.d.ts.map +1 -1
  166. package/dist/internal/groups/sdk-store.js +4 -3
  167. package/dist/internal/groups/sdk-store.js.map +1 -1
  168. package/dist/internal/groups/server-engine.d.ts +6 -1
  169. package/dist/internal/groups/server-engine.d.ts.map +1 -1
  170. package/dist/internal/groups/server-engine.js +11 -15
  171. package/dist/internal/groups/server-engine.js.map +1 -1
  172. package/dist/internal/groups/wire.d.ts.map +1 -1
  173. package/dist/internal/groups/wire.js +2 -1
  174. package/dist/internal/groups/wire.js.map +1 -1
  175. package/dist/internal/platform/blob.d.ts +10 -0
  176. package/dist/internal/platform/blob.d.ts.map +1 -0
  177. package/dist/internal/platform/blob.js +30 -0
  178. package/dist/internal/platform/blob.js.map +1 -0
  179. package/dist/internal/platform/env.d.ts +13 -0
  180. package/dist/internal/platform/env.d.ts.map +1 -0
  181. package/dist/internal/platform/env.js +17 -0
  182. package/dist/internal/platform/env.js.map +1 -0
  183. package/dist/internal/platform/index.d.ts +5 -0
  184. package/dist/internal/platform/index.d.ts.map +1 -0
  185. package/dist/internal/platform/index.js +5 -0
  186. package/dist/internal/platform/index.js.map +1 -0
  187. package/dist/internal/platform/url.d.ts +72 -0
  188. package/dist/internal/platform/url.d.ts.map +1 -0
  189. package/dist/internal/platform/url.js +275 -0
  190. package/dist/internal/platform/url.js.map +1 -0
  191. package/dist/internal/platform/utf8.d.ts +28 -0
  192. package/dist/internal/platform/utf8.d.ts.map +1 -0
  193. package/dist/internal/platform/utf8.js +167 -0
  194. package/dist/internal/platform/utf8.js.map +1 -0
  195. package/dist/internal/protocol/sealed-sender/delivery-token.d.ts +1 -1
  196. package/dist/internal/protocol/sealed-sender/delivery-token.d.ts.map +1 -1
  197. package/dist/internal/protocol/sealed-sender/delivery-token.js +5 -10
  198. package/dist/internal/protocol/sealed-sender/delivery-token.js.map +1 -1
  199. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  200. package/dist/internal/protocol/sealed-sender/proto/index.js +2 -4
  201. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  202. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  203. package/dist/internal/protocol/sender-keys/manager.js +4 -3
  204. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  205. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts +4 -4
  206. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts.map +1 -1
  207. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js +8 -10
  208. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js.map +1 -1
  209. package/dist/internal/protocol/username/hash.d.ts.map +1 -1
  210. package/dist/internal/protocol/username/hash.js +18 -3
  211. package/dist/internal/protocol/username/hash.js.map +1 -1
  212. package/dist/internal/protocol/username/link.d.ts.map +1 -1
  213. package/dist/internal/protocol/username/link.js +2 -1
  214. package/dist/internal/protocol/username/link.js.map +1 -1
  215. package/dist/internal/protocol/username/proof.d.ts.map +1 -1
  216. package/dist/internal/protocol/username/proof.js +2 -1
  217. package/dist/internal/protocol/username/proof.js.map +1 -1
  218. package/dist/internal/sesame/device-registry.d.ts +16 -3
  219. package/dist/internal/sesame/device-registry.d.ts.map +1 -1
  220. package/dist/internal/sesame/device-registry.js +10 -7
  221. package/dist/internal/sesame/device-registry.js.map +1 -1
  222. package/dist/internal/sesame/index.d.ts +1 -1
  223. package/dist/internal/sesame/index.d.ts.map +1 -1
  224. package/dist/internal/sesame/manager.d.ts.map +1 -1
  225. package/dist/internal/sesame/manager.js +3 -2
  226. package/dist/internal/sesame/manager.js.map +1 -1
  227. package/dist/internal/session/index.d.ts +1 -2
  228. package/dist/internal/session/index.d.ts.map +1 -1
  229. package/dist/internal/session/index.js +1 -1
  230. package/dist/internal/session/index.js.map +1 -1
  231. package/dist/internal/session/validation.d.ts +0 -80
  232. package/dist/internal/session/validation.d.ts.map +1 -1
  233. package/dist/internal/session/validation.js +0 -134
  234. package/dist/internal/session/validation.js.map +1 -1
  235. package/dist/local/store/device-record.d.ts +18 -0
  236. package/dist/local/store/device-record.d.ts.map +1 -0
  237. package/dist/local/store/device-record.js +34 -0
  238. package/dist/local/store/device-record.js.map +1 -0
  239. package/dist/local/store/expo/adapter.d.ts +59 -238
  240. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  241. package/dist/local/store/expo/adapter.js +83 -640
  242. package/dist/local/store/expo/adapter.js.map +1 -1
  243. package/dist/local/store/expo/driver.d.ts +16 -0
  244. package/dist/local/store/expo/driver.d.ts.map +1 -0
  245. package/dist/local/store/expo/driver.js +141 -0
  246. package/dist/local/store/expo/driver.js.map +1 -0
  247. package/dist/local/store/expo/index.d.ts +3 -12
  248. package/dist/local/store/expo/index.d.ts.map +1 -1
  249. package/dist/local/store/expo/index.js +1 -8
  250. package/dist/local/store/expo/index.js.map +1 -1
  251. package/dist/local/store/expo/maintenance.d.ts +3 -2
  252. package/dist/local/store/expo/maintenance.d.ts.map +1 -1
  253. package/dist/local/store/expo/maintenance.js +5 -34
  254. package/dist/local/store/expo/maintenance.js.map +1 -1
  255. package/dist/local/store/index.d.ts +10 -5
  256. package/dist/local/store/index.d.ts.map +1 -1
  257. package/dist/local/store/index.js +10 -5
  258. package/dist/local/store/index.js.map +1 -1
  259. package/dist/local/store/key-value/adapter.d.ts +326 -0
  260. package/dist/local/store/key-value/adapter.d.ts.map +1 -0
  261. package/dist/local/store/key-value/adapter.js +1472 -0
  262. package/dist/local/store/key-value/adapter.js.map +1 -0
  263. package/dist/local/store/{react-native → key-value}/backend-conformance.d.ts +6 -6
  264. package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -0
  265. package/dist/local/store/{react-native → key-value}/backend-conformance.js +3 -3
  266. package/dist/local/store/key-value/backend-conformance.js.map +1 -0
  267. package/dist/local/store/key-value/batch.d.ts +41 -0
  268. package/dist/local/store/key-value/batch.d.ts.map +1 -0
  269. package/dist/local/store/key-value/batch.js +77 -0
  270. package/dist/local/store/key-value/batch.js.map +1 -0
  271. package/dist/local/store/key-value/device-record.d.ts +23 -0
  272. package/dist/local/store/key-value/device-record.d.ts.map +1 -0
  273. package/dist/local/store/key-value/device-record.js +33 -0
  274. package/dist/local/store/key-value/device-record.js.map +1 -0
  275. package/dist/local/store/key-value/index.d.ts +24 -0
  276. package/dist/local/store/key-value/index.d.ts.map +1 -0
  277. package/dist/local/store/key-value/index.js +8 -0
  278. package/dist/local/store/key-value/index.js.map +1 -0
  279. package/dist/local/store/key-value/realm/index.d.ts +83 -0
  280. package/dist/local/store/key-value/realm/index.d.ts.map +1 -0
  281. package/dist/local/store/key-value/realm/index.js +102 -0
  282. package/dist/local/store/key-value/realm/index.js.map +1 -0
  283. package/dist/local/store/{react-native → key-value}/storage.d.ts +6 -6
  284. package/dist/local/store/key-value/storage.d.ts.map +1 -0
  285. package/dist/local/store/key-value/storage.js.map +1 -0
  286. package/dist/local/store/key-value/transactional-backend.d.ts +50 -0
  287. package/dist/local/store/key-value/transactional-backend.d.ts.map +1 -0
  288. package/dist/local/store/key-value/transactional-backend.js +90 -0
  289. package/dist/local/store/key-value/transactional-backend.js.map +1 -0
  290. package/dist/local/store/key-value/value-key.d.ts +34 -0
  291. package/dist/local/store/key-value/value-key.d.ts.map +1 -0
  292. package/dist/local/store/key-value/value-key.js +83 -0
  293. package/dist/local/store/key-value/value-key.js.map +1 -0
  294. package/dist/local/store/memory/adapter.d.ts +8 -0
  295. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  296. package/dist/local/store/memory/adapter.js +60 -75
  297. package/dist/local/store/memory/adapter.js.map +1 -1
  298. package/dist/local/store/node/adapter.d.ts +74 -130
  299. package/dist/local/store/node/adapter.d.ts.map +1 -1
  300. package/dist/local/store/node/adapter.js +83 -727
  301. package/dist/local/store/node/adapter.js.map +1 -1
  302. package/dist/local/store/node/index.d.ts +8 -6
  303. package/dist/local/store/node/index.d.ts.map +1 -1
  304. package/dist/local/store/node/index.js +3 -7
  305. package/dist/local/store/node/index.js.map +1 -1
  306. package/dist/local/store/node/maintenance.d.ts +5 -0
  307. package/dist/local/store/node/maintenance.d.ts.map +1 -0
  308. package/dist/local/store/node/maintenance.js +7 -0
  309. package/dist/local/store/node/maintenance.js.map +1 -0
  310. package/dist/local/store/node/owner-lock.d.ts +26 -0
  311. package/dist/local/store/node/owner-lock.d.ts.map +1 -0
  312. package/dist/local/store/node/owner-lock.js +88 -0
  313. package/dist/local/store/node/owner-lock.js.map +1 -0
  314. package/dist/local/store/react-native/adapter.d.ts +63 -274
  315. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  316. package/dist/local/store/react-native/adapter.js +80 -1406
  317. package/dist/local/store/react-native/adapter.js.map +1 -1
  318. package/dist/local/store/react-native/index.d.ts +7 -19
  319. package/dist/local/store/react-native/index.d.ts.map +1 -1
  320. package/dist/local/store/react-native/index.js +2 -7
  321. package/dist/local/store/react-native/index.js.map +1 -1
  322. package/dist/local/store/react-native/maintenance.d.ts +5 -0
  323. package/dist/local/store/react-native/maintenance.d.ts.map +1 -0
  324. package/dist/local/store/react-native/maintenance.js +7 -0
  325. package/dist/local/store/react-native/maintenance.js.map +1 -0
  326. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.d.ts +38 -0
  327. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.d.ts.map +1 -0
  328. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.js +196 -0
  329. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.js.map +1 -0
  330. package/dist/local/store/sqlite/database.d.ts +20 -0
  331. package/dist/local/store/sqlite/database.d.ts.map +1 -0
  332. package/dist/local/store/sqlite/database.js +41 -0
  333. package/dist/local/store/sqlite/database.js.map +1 -0
  334. package/dist/local/store/sqlite/driver.d.ts +138 -0
  335. package/dist/local/store/sqlite/driver.d.ts.map +1 -0
  336. package/dist/local/store/sqlite/driver.js +10 -0
  337. package/dist/local/store/sqlite/driver.js.map +1 -0
  338. package/dist/local/store/sqlite/encryption.d.ts +61 -0
  339. package/dist/local/store/sqlite/encryption.d.ts.map +1 -0
  340. package/dist/local/store/sqlite/encryption.js +98 -0
  341. package/dist/local/store/sqlite/encryption.js.map +1 -0
  342. package/dist/local/store/sqlite/errors.d.ts +70 -0
  343. package/dist/local/store/sqlite/errors.d.ts.map +1 -0
  344. package/dist/local/store/sqlite/errors.js +101 -0
  345. package/dist/local/store/sqlite/errors.js.map +1 -0
  346. package/dist/local/store/sqlite/executor.d.ts +22 -0
  347. package/dist/local/store/sqlite/executor.d.ts.map +1 -0
  348. package/dist/local/store/sqlite/executor.js +129 -0
  349. package/dist/local/store/sqlite/executor.js.map +1 -0
  350. package/dist/local/store/sqlite/index.d.ts +20 -0
  351. package/dist/local/store/sqlite/index.d.ts.map +1 -0
  352. package/dist/local/store/sqlite/index.js +18 -0
  353. package/dist/local/store/sqlite/index.js.map +1 -0
  354. package/dist/local/store/sqlite/key-storage/account.d.ts +45 -0
  355. package/dist/local/store/sqlite/key-storage/account.d.ts.map +1 -0
  356. package/dist/local/store/sqlite/key-storage/account.js +125 -0
  357. package/dist/local/store/sqlite/key-storage/account.js.map +1 -0
  358. package/dist/local/store/sqlite/key-storage/contact-identities.d.ts +19 -0
  359. package/dist/local/store/sqlite/key-storage/contact-identities.d.ts.map +1 -0
  360. package/dist/local/store/sqlite/key-storage/contact-identities.js +85 -0
  361. package/dist/local/store/sqlite/key-storage/contact-identities.js.map +1 -0
  362. package/dist/local/store/sqlite/key-storage/context.d.ts +19 -0
  363. package/dist/local/store/sqlite/key-storage/context.d.ts.map +1 -0
  364. package/dist/local/store/sqlite/key-storage/context.js +18 -0
  365. package/dist/local/store/sqlite/key-storage/context.js.map +1 -0
  366. package/dist/local/store/sqlite/key-storage/identity-keys.d.ts +18 -0
  367. package/dist/local/store/sqlite/key-storage/identity-keys.d.ts.map +1 -0
  368. package/dist/local/store/sqlite/key-storage/identity-keys.js +88 -0
  369. package/dist/local/store/sqlite/key-storage/identity-keys.js.map +1 -0
  370. package/dist/local/store/sqlite/key-storage/index.d.ts +108 -0
  371. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -0
  372. package/dist/local/store/sqlite/key-storage/index.js +241 -0
  373. package/dist/local/store/sqlite/key-storage/index.js.map +1 -0
  374. package/dist/local/store/sqlite/key-storage/message-records.d.ts +41 -0
  375. package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -0
  376. package/dist/local/store/sqlite/key-storage/message-records.js +133 -0
  377. package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -0
  378. package/dist/local/store/sqlite/key-storage/metadata.d.ts +16 -0
  379. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -0
  380. package/dist/local/store/sqlite/key-storage/metadata.js +53 -0
  381. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -0
  382. package/dist/local/store/sqlite/key-storage/one-time-prekeys.d.ts +36 -0
  383. package/dist/local/store/sqlite/key-storage/one-time-prekeys.d.ts.map +1 -0
  384. package/dist/local/store/sqlite/key-storage/one-time-prekeys.js +129 -0
  385. package/dist/local/store/sqlite/key-storage/one-time-prekeys.js.map +1 -0
  386. package/dist/local/store/sqlite/key-storage/session-trust.d.ts +10 -0
  387. package/dist/local/store/sqlite/key-storage/session-trust.d.ts.map +1 -0
  388. package/dist/local/store/sqlite/key-storage/session-trust.js +88 -0
  389. package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -0
  390. package/dist/local/store/sqlite/key-storage/sessions.d.ts +50 -0
  391. package/dist/local/store/sqlite/key-storage/sessions.d.ts.map +1 -0
  392. package/dist/local/store/sqlite/key-storage/sessions.js +209 -0
  393. package/dist/local/store/sqlite/key-storage/sessions.js.map +1 -0
  394. package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts +69 -0
  395. package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts.map +1 -0
  396. package/dist/local/store/sqlite/key-storage/signed-prekeys.js +219 -0
  397. package/dist/local/store/sqlite/key-storage/signed-prekeys.js.map +1 -0
  398. package/dist/local/store/sqlite/maintenance.d.ts +7 -0
  399. package/dist/local/store/sqlite/maintenance.d.ts.map +1 -0
  400. package/dist/local/store/sqlite/maintenance.js +32 -0
  401. package/dist/local/store/sqlite/maintenance.js.map +1 -0
  402. package/dist/local/store/sqlite/migrations.d.ts +31 -0
  403. package/dist/local/store/sqlite/migrations.d.ts.map +1 -0
  404. package/dist/local/store/sqlite/migrations.js +232 -0
  405. package/dist/local/store/sqlite/migrations.js.map +1 -0
  406. package/dist/local/store/{expo → sqlite}/models/ec-one-time-prekey.d.ts +17 -22
  407. package/dist/local/store/sqlite/models/ec-one-time-prekey.d.ts.map +1 -0
  408. package/dist/local/store/{expo → sqlite}/models/ec-one-time-prekey.js +61 -99
  409. package/dist/local/store/sqlite/models/ec-one-time-prekey.js.map +1 -0
  410. package/dist/local/store/{expo → sqlite}/models/ec-signed-prekey.d.ts +22 -25
  411. package/dist/local/store/sqlite/models/ec-signed-prekey.d.ts.map +1 -0
  412. package/dist/local/store/{expo → sqlite}/models/ec-signed-prekey.js +82 -128
  413. package/dist/local/store/sqlite/models/ec-signed-prekey.js.map +1 -0
  414. package/dist/local/store/sqlite/models/identity-key-id.d.ts.map +1 -0
  415. package/dist/local/store/sqlite/models/identity-key-id.js.map +1 -0
  416. package/dist/local/store/{expo → sqlite}/models/index.d.ts +5 -5
  417. package/dist/local/store/sqlite/models/index.d.ts.map +1 -0
  418. package/dist/local/store/{expo → sqlite}/models/index.js +12 -5
  419. package/dist/local/store/sqlite/models/index.js.map +1 -0
  420. package/dist/local/store/{expo → sqlite}/models/kyber-one-time-prekey.d.ts +17 -20
  421. package/dist/local/store/sqlite/models/kyber-one-time-prekey.d.ts.map +1 -0
  422. package/dist/local/store/{expo → sqlite}/models/kyber-one-time-prekey.js +65 -105
  423. package/dist/local/store/sqlite/models/kyber-one-time-prekey.js.map +1 -0
  424. package/dist/local/store/{expo → sqlite}/models/kyber-prekey-used.d.ts +3 -3
  425. package/dist/local/store/sqlite/models/kyber-prekey-used.d.ts.map +1 -0
  426. package/dist/local/store/{expo → sqlite}/models/kyber-prekey-used.js +13 -25
  427. package/dist/local/store/sqlite/models/kyber-prekey-used.js.map +1 -0
  428. package/dist/local/store/{expo → sqlite}/models/kyber-prekey.d.ts +16 -19
  429. package/dist/local/store/sqlite/models/kyber-prekey.d.ts.map +1 -0
  430. package/dist/local/store/{expo → sqlite}/models/kyber-prekey.js +67 -111
  431. package/dist/local/store/sqlite/models/kyber-prekey.js.map +1 -0
  432. package/dist/local/store/sqlite/models/local-identity.d.ts +51 -0
  433. package/dist/local/store/sqlite/models/local-identity.d.ts.map +1 -0
  434. package/dist/local/store/sqlite/models/local-identity.js +150 -0
  435. package/dist/local/store/sqlite/models/local-identity.js.map +1 -0
  436. package/dist/local/store/{expo → sqlite}/models/message-record.d.ts +15 -44
  437. package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -0
  438. package/dist/local/store/{expo → sqlite}/models/message-record.js +43 -109
  439. package/dist/local/store/sqlite/models/message-record.js.map +1 -0
  440. package/dist/local/store/sqlite/models/recipient-identity.d.ts +21 -0
  441. package/dist/local/store/sqlite/models/recipient-identity.d.ts.map +1 -0
  442. package/dist/local/store/sqlite/models/recipient-identity.js +59 -0
  443. package/dist/local/store/sqlite/models/recipient-identity.js.map +1 -0
  444. package/dist/local/store/sqlite/models/replaced-prekeys.d.ts +23 -0
  445. package/dist/local/store/sqlite/models/replaced-prekeys.d.ts.map +1 -0
  446. package/dist/local/store/sqlite/models/replaced-prekeys.js +42 -0
  447. package/dist/local/store/sqlite/models/replaced-prekeys.js.map +1 -0
  448. package/dist/local/store/{expo → sqlite}/models/sender-key.d.ts +22 -23
  449. package/dist/local/store/sqlite/models/sender-key.d.ts.map +1 -0
  450. package/dist/local/store/{expo → sqlite}/models/sender-key.js +66 -94
  451. package/dist/local/store/sqlite/models/sender-key.js.map +1 -0
  452. package/dist/local/store/sqlite/models/sesame-user-record.d.ts +32 -0
  453. package/dist/local/store/sqlite/models/sesame-user-record.d.ts.map +1 -0
  454. package/dist/local/store/sqlite/models/sesame-user-record.js +78 -0
  455. package/dist/local/store/sqlite/models/sesame-user-record.js.map +1 -0
  456. package/dist/local/store/{expo → sqlite}/models/session.d.ts +24 -20
  457. package/dist/local/store/sqlite/models/session.d.ts.map +1 -0
  458. package/dist/local/store/{expo → sqlite}/models/session.js +54 -72
  459. package/dist/local/store/sqlite/models/session.js.map +1 -0
  460. package/dist/local/store/sqlite/models/skipped-sender-key.d.ts +24 -0
  461. package/dist/local/store/sqlite/models/skipped-sender-key.d.ts.map +1 -0
  462. package/dist/local/store/sqlite/models/skipped-sender-key.js +62 -0
  463. package/dist/local/store/sqlite/models/skipped-sender-key.js.map +1 -0
  464. package/dist/local/store/sqlite/op-sqlite-driver.d.ts +14 -0
  465. package/dist/local/store/sqlite/op-sqlite-driver.d.ts.map +1 -0
  466. package/dist/local/store/sqlite/op-sqlite-driver.js +180 -0
  467. package/dist/local/store/sqlite/op-sqlite-driver.js.map +1 -0
  468. package/dist/local/store/sqlite/open-store.d.ts +83 -0
  469. package/dist/local/store/sqlite/open-store.d.ts.map +1 -0
  470. package/dist/local/store/sqlite/open-store.js +177 -0
  471. package/dist/local/store/sqlite/open-store.js.map +1 -0
  472. package/dist/local/store/sqlite/schema.d.ts +102 -0
  473. package/dist/local/store/sqlite/schema.d.ts.map +1 -0
  474. package/dist/local/store/sqlite/schema.js +61 -0
  475. package/dist/local/store/sqlite/schema.js.map +1 -0
  476. package/dist/local/store/sqlite/store.d.ts +199 -0
  477. package/dist/local/store/sqlite/store.d.ts.map +1 -0
  478. package/dist/local/store/sqlite/store.js +494 -0
  479. package/dist/local/store/sqlite/store.js.map +1 -0
  480. package/dist/local/store/sqlite/web/driver.d.ts +50 -0
  481. package/dist/local/store/sqlite/web/driver.d.ts.map +1 -0
  482. package/dist/local/store/sqlite/web/driver.js +169 -0
  483. package/dist/local/store/sqlite/web/driver.js.map +1 -0
  484. package/dist/local/store/sqlite/web/protocol.d.ts +80 -0
  485. package/dist/local/store/sqlite/web/protocol.d.ts.map +1 -0
  486. package/dist/local/store/sqlite/web/protocol.js +13 -0
  487. package/dist/local/store/sqlite/web/protocol.js.map +1 -0
  488. package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.mjs +14526 -0
  489. package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.wasm +0 -0
  490. package/dist/local/store/sqlite/web/worker.d.ts +36 -0
  491. package/dist/local/store/sqlite/web/worker.d.ts.map +1 -0
  492. package/dist/local/store/sqlite/web/worker.js +616 -0
  493. package/dist/local/store/sqlite/web/worker.js.map +1 -0
  494. package/dist/local/store/web/adapter.d.ts +5 -14
  495. package/dist/local/store/web/adapter.d.ts.map +1 -1
  496. package/dist/local/store/web/adapter.js +119 -106
  497. package/dist/local/store/web/adapter.js.map +1 -1
  498. package/dist/local/store/web/device-record.d.ts +23 -0
  499. package/dist/local/store/web/device-record.d.ts.map +1 -0
  500. package/dist/local/store/web/device-record.js +31 -0
  501. package/dist/local/store/web/device-record.js.map +1 -0
  502. package/dist/local/store/web-sqlite/adapter.d.ts +98 -0
  503. package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -0
  504. package/dist/local/store/web-sqlite/adapter.js +151 -0
  505. package/dist/local/store/web-sqlite/adapter.js.map +1 -0
  506. package/dist/local/store/web-sqlite/index.d.ts +14 -0
  507. package/dist/local/store/web-sqlite/index.d.ts.map +1 -0
  508. package/dist/local/store/web-sqlite/index.js +3 -0
  509. package/dist/local/store/web-sqlite/index.js.map +1 -0
  510. package/dist/local/store/web-sqlite/maintenance.d.ts +5 -0
  511. package/dist/local/store/web-sqlite/maintenance.d.ts.map +1 -0
  512. package/dist/local/store/web-sqlite/maintenance.js +7 -0
  513. package/dist/local/store/web-sqlite/maintenance.js.map +1 -0
  514. package/dist/local/store/web-sqlite/store-locks.d.ts +33 -0
  515. package/dist/local/store/web-sqlite/store-locks.d.ts.map +1 -0
  516. package/dist/local/store/web-sqlite/store-locks.js +60 -0
  517. package/dist/local/store/web-sqlite/store-locks.js.map +1 -0
  518. package/dist/local/vault/electron-safe-storage.d.ts +45 -0
  519. package/dist/local/vault/electron-safe-storage.d.ts.map +1 -0
  520. package/dist/local/vault/electron-safe-storage.js +212 -0
  521. package/dist/local/vault/electron-safe-storage.js.map +1 -0
  522. package/dist/local/vault/index.d.ts +4 -2
  523. package/dist/local/vault/index.d.ts.map +1 -1
  524. package/dist/local/vault/indexed-db.d.ts +37 -0
  525. package/dist/local/vault/indexed-db.d.ts.map +1 -0
  526. package/dist/local/vault/indexed-db.js +102 -0
  527. package/dist/local/vault/indexed-db.js.map +1 -0
  528. package/dist/local/vault/react-native-keychain.d.ts +12 -0
  529. package/dist/local/vault/react-native-keychain.d.ts.map +1 -0
  530. package/dist/local/vault/react-native-keychain.js +71 -0
  531. package/dist/local/vault/react-native-keychain.js.map +1 -0
  532. package/dist/local/vault/require.d.ts +10 -0
  533. package/dist/local/vault/require.d.ts.map +1 -0
  534. package/dist/local/vault/require.js +16 -0
  535. package/dist/local/vault/require.js.map +1 -0
  536. package/dist/logger.d.ts.map +1 -1
  537. package/dist/logger.js +2 -1
  538. package/dist/logger.js.map +1 -1
  539. package/dist/media/index.d.ts.map +1 -1
  540. package/dist/media/index.js +2 -1
  541. package/dist/media/index.js.map +1 -1
  542. package/dist/profile/contact-state.d.ts.map +1 -1
  543. package/dist/profile/contact-state.js +2 -4
  544. package/dist/profile/contact-state.js.map +1 -1
  545. package/dist/profile/index.d.ts +0 -1
  546. package/dist/profile/index.d.ts.map +1 -1
  547. package/dist/profile/index.js +0 -2
  548. package/dist/profile/index.js.map +1 -1
  549. package/dist/profile/profile-key.d.ts +16 -11
  550. package/dist/profile/profile-key.d.ts.map +1 -1
  551. package/dist/profile/profile-key.js +29 -29
  552. package/dist/profile/profile-key.js.map +1 -1
  553. package/dist/profile/update-service.d.ts +6 -0
  554. package/dist/profile/update-service.d.ts.map +1 -1
  555. package/dist/profile/update-service.js +3 -1
  556. package/dist/profile/update-service.js.map +1 -1
  557. package/dist/remote/object-store/validation.d.ts.map +1 -1
  558. package/dist/remote/object-store/validation.js +2 -1
  559. package/dist/remote/object-store/validation.js.map +1 -1
  560. package/dist/remote/relay/memory/adapter.d.ts +2 -3
  561. package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
  562. package/dist/remote/relay/memory/adapter.js +22 -30
  563. package/dist/remote/relay/memory/adapter.js.map +1 -1
  564. package/dist/remote/relay/memory/failures.d.ts.map +1 -1
  565. package/dist/remote/relay/memory/failures.js +2 -1
  566. package/dist/remote/relay/memory/failures.js.map +1 -1
  567. package/dist/remote/relay/memory/group-server.d.ts +5 -1
  568. package/dist/remote/relay/memory/group-server.d.ts.map +1 -1
  569. package/dist/remote/relay/memory/group-server.js +11 -1
  570. package/dist/remote/relay/memory/group-server.js.map +1 -1
  571. package/dist/safety/url.d.ts.map +1 -1
  572. package/dist/safety/url.js +21 -26
  573. package/dist/safety/url.js.map +1 -1
  574. package/dist/types/api.d.ts +15 -2
  575. package/dist/types/api.d.ts.map +1 -1
  576. package/dist/types/errors.d.ts +97 -1
  577. package/dist/types/errors.d.ts.map +1 -1
  578. package/dist/types/errors.js +105 -1
  579. package/dist/types/errors.js.map +1 -1
  580. package/dist/types/session.d.ts.map +1 -1
  581. package/dist/types/session.js +2 -1
  582. package/dist/types/session.js.map +1 -1
  583. package/dist/utils/retry.d.ts +2 -0
  584. package/dist/utils/retry.d.ts.map +1 -1
  585. package/dist/utils/retry.js +4 -2
  586. package/dist/utils/retry.js.map +1 -1
  587. package/docs/ASSURANCE.md +80 -8
  588. package/docs/CLIENT_COMPOSITION.md +1 -2
  589. package/docs/DEVIATIONS.md +1 -1
  590. package/docs/ERROR_HANDLING.md +6 -0
  591. package/docs/GETTING_STARTED.md +1 -2
  592. package/docs/PACKAGE_SURFACE.md +29 -11
  593. package/docs/RECIPES.md +1 -2
  594. package/examples/browser/index.html +1 -1
  595. package/local/store/README.md +117 -37
  596. package/local/store/expo/README.md +67 -47
  597. package/local/store/key-value/README.md +278 -0
  598. package/local/store/node/README.md +206 -46
  599. package/local/store/react-native/README.md +120 -61
  600. package/local/store/web/README.md +9 -0
  601. package/local/store/web-sqlite/README.md +202 -0
  602. package/local/vault/README.md +115 -2
  603. package/package.json +42 -23
  604. package/profile/README.md +9 -11
  605. package/remote/README.md +1 -2
  606. package/dist/local/store/expo/database-key.d.ts +0 -142
  607. package/dist/local/store/expo/database-key.d.ts.map +0 -1
  608. package/dist/local/store/expo/database-key.js +0 -312
  609. package/dist/local/store/expo/database-key.js.map +0 -1
  610. package/dist/local/store/expo/db.d.ts +0 -95
  611. package/dist/local/store/expo/db.d.ts.map +0 -1
  612. package/dist/local/store/expo/db.js +0 -147
  613. package/dist/local/store/expo/db.js.map +0 -1
  614. package/dist/local/store/expo/key-storage.d.ts +0 -429
  615. package/dist/local/store/expo/key-storage.d.ts.map +0 -1
  616. package/dist/local/store/expo/key-storage.js +0 -1361
  617. package/dist/local/store/expo/key-storage.js.map +0 -1
  618. package/dist/local/store/expo/models/ec-one-time-prekey.d.ts.map +0 -1
  619. package/dist/local/store/expo/models/ec-one-time-prekey.js.map +0 -1
  620. package/dist/local/store/expo/models/ec-signed-prekey.d.ts.map +0 -1
  621. package/dist/local/store/expo/models/ec-signed-prekey.js.map +0 -1
  622. package/dist/local/store/expo/models/identity-key-id.d.ts.map +0 -1
  623. package/dist/local/store/expo/models/identity-key-id.js.map +0 -1
  624. package/dist/local/store/expo/models/index.d.ts.map +0 -1
  625. package/dist/local/store/expo/models/index.js.map +0 -1
  626. package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts.map +0 -1
  627. package/dist/local/store/expo/models/kyber-one-time-prekey.js.map +0 -1
  628. package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +0 -1
  629. package/dist/local/store/expo/models/kyber-prekey-used.js.map +0 -1
  630. package/dist/local/store/expo/models/kyber-prekey.d.ts.map +0 -1
  631. package/dist/local/store/expo/models/kyber-prekey.js.map +0 -1
  632. package/dist/local/store/expo/models/local-identity.d.ts +0 -52
  633. package/dist/local/store/expo/models/local-identity.d.ts.map +0 -1
  634. package/dist/local/store/expo/models/local-identity.js +0 -166
  635. package/dist/local/store/expo/models/local-identity.js.map +0 -1
  636. package/dist/local/store/expo/models/message-record.d.ts.map +0 -1
  637. package/dist/local/store/expo/models/message-record.js.map +0 -1
  638. package/dist/local/store/expo/models/recipient-identity.d.ts +0 -21
  639. package/dist/local/store/expo/models/recipient-identity.d.ts.map +0 -1
  640. package/dist/local/store/expo/models/recipient-identity.js +0 -66
  641. package/dist/local/store/expo/models/recipient-identity.js.map +0 -1
  642. package/dist/local/store/expo/models/replaced-prekey-utils.d.ts +0 -33
  643. package/dist/local/store/expo/models/replaced-prekey-utils.d.ts.map +0 -1
  644. package/dist/local/store/expo/models/replaced-prekey-utils.js +0 -54
  645. package/dist/local/store/expo/models/replaced-prekey-utils.js.map +0 -1
  646. package/dist/local/store/expo/models/sender-key.d.ts.map +0 -1
  647. package/dist/local/store/expo/models/sender-key.js.map +0 -1
  648. package/dist/local/store/expo/models/session.d.ts.map +0 -1
  649. package/dist/local/store/expo/models/session.js.map +0 -1
  650. package/dist/local/store/expo/schema.d.ts +0 -1917
  651. package/dist/local/store/expo/schema.d.ts.map +0 -1
  652. package/dist/local/store/expo/schema.js +0 -197
  653. package/dist/local/store/expo/schema.js.map +0 -1
  654. package/dist/local/store/node/database-encryption.d.ts +0 -109
  655. package/dist/local/store/node/database-encryption.d.ts.map +0 -1
  656. package/dist/local/store/node/database-encryption.js +0 -202
  657. package/dist/local/store/node/database-encryption.js.map +0 -1
  658. package/dist/local/store/node/database-file-commit.d.ts +0 -8
  659. package/dist/local/store/node/database-file-commit.d.ts.map +0 -1
  660. package/dist/local/store/node/database-file-commit.js +0 -62
  661. package/dist/local/store/node/database-file-commit.js.map +0 -1
  662. package/dist/local/store/node/database-key.d.ts +0 -129
  663. package/dist/local/store/node/database-key.d.ts.map +0 -1
  664. package/dist/local/store/node/database-key.js +0 -293
  665. package/dist/local/store/node/database-key.js.map +0 -1
  666. package/dist/local/store/node/database-lock.d.ts +0 -8
  667. package/dist/local/store/node/database-lock.d.ts.map +0 -1
  668. package/dist/local/store/node/database-lock.js +0 -44
  669. package/dist/local/store/node/database-lock.js.map +0 -1
  670. package/dist/local/store/node/database.d.ts +0 -226
  671. package/dist/local/store/node/database.d.ts.map +0 -1
  672. package/dist/local/store/node/database.js +0 -813
  673. package/dist/local/store/node/database.js.map +0 -1
  674. package/dist/local/store/react-native/backend-conformance.d.ts.map +0 -1
  675. package/dist/local/store/react-native/backend-conformance.js.map +0 -1
  676. package/dist/local/store/react-native/reference-backend.d.ts +0 -43
  677. package/dist/local/store/react-native/reference-backend.d.ts.map +0 -1
  678. package/dist/local/store/react-native/reference-backend.js +0 -178
  679. package/dist/local/store/react-native/reference-backend.js.map +0 -1
  680. package/dist/local/store/react-native/storage.d.ts.map +0 -1
  681. package/dist/local/store/react-native/storage.js.map +0 -1
  682. package/dist/profile/storage.d.ts +0 -61
  683. package/dist/profile/storage.d.ts.map +0 -1
  684. package/dist/profile/storage.js +0 -145
  685. package/dist/profile/storage.js.map +0 -1
  686. /package/dist/local/store/{react-native → key-value}/storage.js +0 -0
  687. /package/dist/local/store/{expo → sqlite}/models/identity-key-id.d.ts +0 -0
  688. /package/dist/local/store/{expo → sqlite}/models/identity-key-id.js +0 -0
@@ -187,17 +187,29 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
187
187
  */
188
188
  private get retryDedupState();
189
189
  /**
190
- * Get retry callbacks for retry operations
190
+ * Get retry callbacks for retry operations. Session changes and resends use
191
+ * the given context, so their hooks run through its relay work. A resend
192
+ * waits for the recipient's lock only until stop() stops the work.
191
193
  */
192
- private get retryCallbacks();
194
+ private retryCallbacks;
193
195
  /**
194
196
  * Get relay subscription state (passed to relay-subscription module)
195
197
  */
196
198
  private get relaySubscriptionState();
197
199
  /**
198
- * Get relay subscription callbacks (delegate back to DefaultSignalProtocolClient methods)
200
+ * Get relay subscription callbacks (delegate back to DefaultSignalProtocolClient methods).
201
+ * Receipts and typing indicators use the given context, so their hooks run
202
+ * through its relay work. Each receipt send is relay work of its own.
199
203
  */
200
- private get relaySubscriptionCallbacks();
204
+ private relaySubscriptionCallbacks;
205
+ /** Client context whose hooks call the app through the given relay work. */
206
+ private relayWorkContext;
207
+ /**
208
+ * Session callbacks of a send. Their session hooks run through the given
209
+ * context, so a send in relay work calls the app through that work. There
210
+ * are none without a relay.
211
+ */
212
+ private sendSessionCallbacks;
201
213
  /**
202
214
  * Get relay subscription config
203
215
  */
@@ -603,6 +615,11 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
603
615
  * ```
604
616
  */
605
617
  send(recipientId: string, content: DataMessageInput | string | Uint8Array, options?: SendOptions): Promise<SendResult>;
618
+ /**
619
+ * Send with the given session callbacks, or with the client's own if none.
620
+ * The stop signal of relay work ends a wait for the recipient's lock.
621
+ */
622
+ private sendWithSessions;
606
623
  uploadAttachment(data: Uint8Array, options: SendOptions & {
607
624
  mimeType: string;
608
625
  }): Promise<import('./types.js').PreparedAttachmentUpload>;
@@ -728,6 +745,8 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
728
745
  * This prevents infinite retry loops where each retry creates a new session
729
746
  * with different header keys.
730
747
  *
748
+ * The request runs as relay work, so its hooks run through that work.
749
+ *
731
750
  * @param retryRequest - The retry request from the recipient
732
751
  */
733
752
  private handleRetryRequestAndResend;
@@ -742,6 +761,7 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
742
761
  *
743
762
  * @param recipientUserId - The sender's user ID (we are receipting TO them)
744
763
  * @param timestamps - Array of message timestamps that have been delivered
764
+ * @param ctx - Client context, whose hooks run through the relay work of the send
745
765
  *
746
766
  */
747
767
  private sendDeliveryReceipt;
@@ -846,7 +866,13 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
846
866
  * Stop the Signal Protocol client and clean up resources
847
867
  *
848
868
  * Call this when the user logs out or the app shuts down.
849
- * Unsubscribes from relay server and cleans up any pending operations.
869
+ * Unsubscribes from relay server, waits for the SDK work of the
870
+ * deliveries, retry requests, and receipt sends in progress, and cleans up
871
+ * any pending operations.
872
+ *
873
+ * It does not wait for app hooks, so a hook can await stop(). When a hook
874
+ * returns after stop(), the SDK drops the work after the hook and writes
875
+ * nothing more. The relay delivers the envelope again after the next start.
850
876
  *
851
877
  * @example
852
878
  * ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../client/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAIH,OAAO,KAAK,EAGV,oBAAoB,EACpB,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EAIrB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAChC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAiB,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAA+B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL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CAC1B,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;OAEG;IACG,wBAAwB,CAC5B,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpF;IAED;;OAEG;IACG,sBAAsB,CAC1B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,UAAU,EACnB,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,CAAA;KAAE,CAAC,CAEtE;IAMD;;OAEG;IACH,OAAO,CAAC,cAAc;CAQvB"}
@@ -43,6 +43,7 @@
43
43
  * });
44
44
  * ```
45
45
  */
46
+ import { utf8Decode } from '../internal/platform/index.js';
46
47
  import AsyncLock from 'async-lock';
47
48
  import { DefaultSignalProtocolManager } from '../internal/manager/index.js';
48
49
  import { DefaultSesameManager } from '../internal/sesame/index.js';
@@ -57,7 +58,7 @@ import { createDefaultSignalProtocolContentAdapter, } from './content-adapter.js
57
58
  // Note: group utilities (isGroupId, extractGroupId, createGroupId) are used by SignalProtocolServiceCipher
58
59
  import { isGroupId } from '../internal/groups/index.js';
59
60
  import { profileKeyExchange } from './profile-key-exchange.js';
60
- import { SignalProtocolServiceCipher, sortEnvelopesForDecryption } from './signal-service-cipher.js';
61
+ import { SignalProtocolServiceCipher, sortEnvelopesForDecryption, } from './signal-service-cipher.js';
61
62
  import { establishMultiDeviceSessions } from '../internal/sesame/device-registry.js';
62
63
  import { isRetryableDecryptionError } from './retry-utils.js';
63
64
  import { MESSAGE_RECORD_TTL_MS } from './constants.js';
@@ -71,6 +72,7 @@ import * as PreKeyOps from './prekeys.js';
71
72
  import * as RetryOps from './retry.js';
72
73
  import * as RelaySubscriptionOps from './relay-subscription.js';
73
74
  import { SignalProtocolClientState, SIGNAL_PROTOCOL_CLIENT_CONSTANTS } from './state.js';
75
+ import { rethrowRelayWorkStopped } from './relay-work.js';
74
76
  import { deleteMediaAttachment, resolveMediaAttachment, } from '../media/index.js';
75
77
  import { StorageBackedSignalProtocolClientMedia } from './media.js';
76
78
  // Group state (Signal Private Group System)
@@ -314,60 +316,11 @@ export class DefaultSignalProtocolClient {
314
316
  if (this.groupManager) {
315
317
  this.cipher.setGroupSendBarrierChecker((groupId) => this.groupManager.assertGroupSendAllowed(groupId));
316
318
  }
317
- // Set up auto-session establishment callback
319
+ // Set up auto-session establishment and stale-session refresh.
318
320
  // This enables lazy session creation when sending to users without established sessions
319
- if (this.relay) {
320
- this.cipher.setSessionEstablisher(async (recipientUserId) => {
321
- return establishMultiDeviceSessions(this, this.relay, recipientUserId);
322
- });
323
- // Set up stale session refresh callback
324
- // Stale-device recovery archives the old session, fetches a fresh bundle,
325
- // and establishes a replacement.
326
- // Per SESAME §3.2: session is archived (not deleted) to handle delayed messages
327
- this.cipher.setStaleSessionRefresher(async (recipientUserId, recipientDeviceId) => {
328
- try {
329
- const address = ProtocolAddress.create(recipientUserId, recipientDeviceId);
330
- // 1. Archive the stale session (preserves for delayed message decryption)
331
- await this.archiveSession(address);
332
- this.logger.debug('Archived stale session for refresh', {
333
- category: 'E2EE',
334
- data: { recipientUserId, recipientDeviceId },
335
- });
336
- // 2. Fetch fresh prekey bundle
337
- const freshBundle = await this.relay.fetchPreKeyBundle(recipientUserId, recipientDeviceId);
338
- if (!freshBundle) {
339
- this.logger.warn('No prekey bundle available for stale session refresh', {
340
- category: 'E2EE',
341
- data: { recipientUserId, recipientDeviceId },
342
- });
343
- return false;
344
- }
345
- // 3. Establish new session with fresh keys
346
- await this.establishSession(address, freshBundle);
347
- this.logger.info('Refreshed stale session with fresh bundle', {
348
- category: 'E2EE',
349
- data: {
350
- recipientUserId,
351
- recipientDeviceId,
352
- newSignedPreKeyId: freshBundle.ecSignedPreKey.keyId,
353
- newRegistrationId: freshBundle.registrationId,
354
- },
355
- });
356
- return true;
357
- }
358
- catch (error) {
359
- this.logger.error('Failed to refresh stale session', {
360
- category: 'E2EE',
361
- data: {
362
- recipientUserId,
363
- recipientDeviceId,
364
- error: error.message,
365
- },
366
- });
367
- return false;
368
- }
369
- });
370
- }
321
+ const sessions = this.sendSessionCallbacks(() => this.ctx);
322
+ if (sessions)
323
+ this.cipher.setSessionCallbacks(sessions);
371
324
  if (config?.sealedSender) {
372
325
  this.cipher.setSealedSenderDeliveryMode(config.sealedSender.deliveryMode ?? 'preferred');
373
326
  if (config.sealedSender.onIdentifiedFallback) {
@@ -619,13 +572,16 @@ export class DefaultSignalProtocolClient {
619
572
  return this.state.getRetryDedupState();
620
573
  }
621
574
  /**
622
- * Get retry callbacks for retry operations
575
+ * Get retry callbacks for retry operations. Session changes and resends use
576
+ * the given context, so their hooks run through its relay work. A resend
577
+ * waits for the recipient's lock only until stop() stops the work.
623
578
  */
624
- get retryCallbacks() {
579
+ retryCallbacks(work, ctx) {
580
+ const sessions = this.sendSessionCallbacks(() => ctx);
625
581
  return {
626
- archiveSession: (address) => this.archiveSession(address),
627
- establishSession: (address, bundle) => this.establishSession(address, bundle),
628
- send: (recipientId, content, options) => this.send(recipientId, content, options),
582
+ archiveSession: (address) => SessionOps.archiveSession(ctx, address),
583
+ establishSession: (address, bundle) => SessionOps.establishSession(ctx, this.sesameManager, address, bundle),
584
+ send: (recipientId, content, options) => this.sendWithSessions(recipientId, content, options, sessions, work.stopSignal),
629
585
  forcePreKeyRotation: () => this.regeneratePreKeysWithFreshIds(),
630
586
  };
631
587
  }
@@ -636,14 +592,84 @@ export class DefaultSignalProtocolClient {
636
592
  return this.state.getRelaySubscriptionState();
637
593
  }
638
594
  /**
639
- * Get relay subscription callbacks (delegate back to DefaultSignalProtocolClient methods)
595
+ * Get relay subscription callbacks (delegate back to DefaultSignalProtocolClient methods).
596
+ * Receipts and typing indicators use the given context, so their hooks run
597
+ * through its relay work. Each receipt send is relay work of its own.
640
598
  */
641
- get relaySubscriptionCallbacks() {
599
+ relaySubscriptionCallbacks(ctx) {
642
600
  return {
643
601
  forcePreKeyRotation: () => this.regeneratePreKeysWithFreshIds(),
644
- handleDeliveryReceipt: (envelope, receipt) => this.handleDeliveryReceipt(envelope, receipt),
645
- handleTypingIndicator: (envelope, typing) => this.handleTypingIndicator(envelope, typing),
646
- sendDeliveryReceipt: (userId, timestamps) => this.sendDeliveryReceipt(userId, timestamps),
602
+ handleDeliveryReceipt: (envelope, receipt) => this.handleDeliveryReceipt(envelope, receipt, ctx),
603
+ handleTypingIndicator: (envelope, typing) => this.handleTypingIndicator(envelope, typing, ctx),
604
+ sendDeliveryReceipt: (userId, timestamps) => this.state.relayWork.run((work) => this.sendDeliveryReceipt(userId, timestamps, this.relayWorkContext(work))),
605
+ };
606
+ }
607
+ /** Client context whose hooks call the app through the given relay work. */
608
+ relayWorkContext(work) {
609
+ return { ...this.ctx, hooks: work.wrapHooks(this.hooks) };
610
+ }
611
+ /**
612
+ * Session callbacks of a send. Their session hooks run through the given
613
+ * context, so a send in relay work calls the app through that work. There
614
+ * are none without a relay.
615
+ */
616
+ sendSessionCallbacks(context) {
617
+ const relay = this.relay;
618
+ if (!relay)
619
+ return undefined;
620
+ const establishSession = (address, bundle) => SessionOps.establishSession(context(), this.sesameManager, address, bundle);
621
+ return {
622
+ establishSessions: (recipientUserId) => establishMultiDeviceSessions(this, relay, recipientUserId, {
623
+ establishSession,
624
+ rethrowFatal: rethrowRelayWorkStopped,
625
+ }),
626
+ // Stale-device recovery archives the old session, fetches a fresh bundle,
627
+ // and establishes a replacement.
628
+ // Per SESAME §3.2: session is archived (not deleted) to handle delayed messages
629
+ refreshStaleSession: async (recipientUserId, recipientDeviceId) => {
630
+ try {
631
+ const address = ProtocolAddress.create(recipientUserId, recipientDeviceId);
632
+ // 1. Archive the stale session (preserves for delayed message decryption)
633
+ await SessionOps.archiveSession(context(), address);
634
+ this.logger.debug('Archived stale session for refresh', {
635
+ category: 'E2EE',
636
+ data: { recipientUserId, recipientDeviceId },
637
+ });
638
+ // 2. Fetch fresh prekey bundle
639
+ const freshBundle = await relay.fetchPreKeyBundle(recipientUserId, recipientDeviceId);
640
+ if (!freshBundle) {
641
+ this.logger.warn('No prekey bundle available for stale session refresh', {
642
+ category: 'E2EE',
643
+ data: { recipientUserId, recipientDeviceId },
644
+ });
645
+ return false;
646
+ }
647
+ // 3. Establish new session with fresh keys
648
+ await establishSession(address, freshBundle);
649
+ this.logger.info('Refreshed stale session with fresh bundle', {
650
+ category: 'E2EE',
651
+ data: {
652
+ recipientUserId,
653
+ recipientDeviceId,
654
+ newSignedPreKeyId: freshBundle.ecSignedPreKey.keyId,
655
+ newRegistrationId: freshBundle.registrationId,
656
+ },
657
+ });
658
+ return true;
659
+ }
660
+ catch (error) {
661
+ rethrowRelayWorkStopped(error);
662
+ this.logger.error('Failed to refresh stale session', {
663
+ category: 'E2EE',
664
+ data: {
665
+ recipientUserId,
666
+ recipientDeviceId,
667
+ error: error.message,
668
+ },
669
+ });
670
+ return false;
671
+ }
672
+ },
647
673
  };
648
674
  }
649
675
  /**
@@ -723,6 +749,7 @@ export class DefaultSignalProtocolClient {
723
749
  if (!config?.storage) {
724
750
  throw new Error('DefaultSignalProtocolClient.create() requires storage. ' +
725
751
  'Expo: import { expoStore } from "@open-e2ee/signal-protocol-sdk/local/store/expo"; ' +
752
+ 'React Native: import { reactNativeStore } from "@open-e2ee/signal-protocol-sdk/local/store/react-native"; ' +
726
753
  'Web: import { indexedDbStore } from "@open-e2ee/signal-protocol-sdk/local/store/web"; ' +
727
754
  'Node: import { nodeStore } from "@open-e2ee/signal-protocol-sdk/local/store/node";');
728
755
  }
@@ -1172,7 +1199,7 @@ export class DefaultSignalProtocolClient {
1172
1199
  // Decode ciphertext: base64 → UTF-8 bytes → JSON string
1173
1200
  // Relay stores as base64(UTF-8(JSON)), we need to reverse both encodings
1174
1201
  const ciphertextBytes = base64ToBytes(envelope.ciphertext);
1175
- const ciphertext = new TextDecoder().decode(ciphertextBytes);
1202
+ const ciphertext = utf8Decode(ciphertextBytes);
1176
1203
  // Decrypt message using Double Ratchet
1177
1204
  const plaintext = await this.decryptMessage(senderAddress, ciphertext);
1178
1205
  return plaintext;
@@ -1252,7 +1279,7 @@ export class DefaultSignalProtocolClient {
1252
1279
  targetDeviceId: this.deviceId,
1253
1280
  deliveryClass: 'user-visible',
1254
1281
  messageType: (envelope.messageType ?? 'ciphertext'),
1255
- }, this.relaySubscriptionState, this.relaySubscriptionCallbacks, { ...this.relaySubscriptionConfig, acknowledgeFailures: false });
1282
+ }, this.relaySubscriptionState, this.relaySubscriptionCallbacks(context), { ...this.relaySubscriptionConfig, acknowledgeFailures: false });
1256
1283
  (processed ? processedMessageIds : failedMessageIds).push(envelope.id);
1257
1284
  }
1258
1285
  catch {
@@ -1367,6 +1394,13 @@ export class DefaultSignalProtocolClient {
1367
1394
  * ```
1368
1395
  */
1369
1396
  async send(recipientId, content, options) {
1397
+ return this.sendWithSessions(recipientId, content, options, undefined, undefined);
1398
+ }
1399
+ /**
1400
+ * Send with the given session callbacks, or with the client's own if none.
1401
+ * The stop signal of relay work ends a wait for the recipient's lock.
1402
+ */
1403
+ async sendWithSessions(recipientId, content, options, sessions, stopSignal) {
1370
1404
  // Normalize all inputs to Uint8Array before calling cipher.encrypt()
1371
1405
  let plaintextBytes;
1372
1406
  let clientTimestamp;
@@ -1392,7 +1426,7 @@ export class DefaultSignalProtocolClient {
1392
1426
  const result = await this.cipher.encrypt(recipientId, plaintextBytes, {
1393
1427
  ...options,
1394
1428
  ...(clientTimestamp !== undefined && { timestamp: clientTimestamp }),
1395
- });
1429
+ }, sessions, stopSignal);
1396
1430
  if (profileKey)
1397
1431
  await profileKeys?.delivered(recipientId, profileKey);
1398
1432
  return clientTimestamp !== undefined ? { ...result, clientTimestamp } : result;
@@ -1572,13 +1606,19 @@ export class DefaultSignalProtocolClient {
1572
1606
  category: 'E2EE',
1573
1607
  data: { userId: this.userId, deviceId: this.deviceId },
1574
1608
  });
1575
- // Create extended context with cipher for relay subscription operations
1576
- const relayCtx = {
1577
- ...this.ctx,
1578
- cipher: this.cipher,
1579
- };
1580
- this.relayUnsubscribe = this.relay.subscribe(this.userId, this.deviceId, async (envelope) => {
1581
- await RelaySubscriptionOps.handleRelayMessage(relayCtx, envelope, this.relaySubscriptionState, this.relaySubscriptionCallbacks, this.relaySubscriptionConfig);
1609
+ this.relayUnsubscribe = this.relay.subscribe(this.userId, this.deviceId, (envelope) => {
1610
+ this.state.relayWork
1611
+ .run((work) => {
1612
+ const ctx = this.relayWorkContext(work);
1613
+ return RelaySubscriptionOps.handleRelayMessage({ ...ctx, cipher: this.cipher }, envelope, this.relaySubscriptionState, this.relaySubscriptionCallbacks(ctx), this.relaySubscriptionConfig);
1614
+ })
1615
+ .catch((error) => {
1616
+ // The relay does not wait for the handler. It delivers the envelope again.
1617
+ this.logger.error('Failed to handle relay envelope', {
1618
+ category: 'E2EE',
1619
+ data: { envelopeId: envelope.id, error: error.message },
1620
+ });
1621
+ });
1582
1622
  }, {
1583
1623
  // Batching callbacks for notification coalescing
1584
1624
  onBatchStart: () => this.contentAdapter.setRelayBatching(true),
@@ -1601,7 +1641,9 @@ export class DefaultSignalProtocolClient {
1601
1641
  const { receiptAccumulator } = this.relaySubscriptionState;
1602
1642
  for (const [userId, timestamps] of receiptAccumulator.pending) {
1603
1643
  if (timestamps.length > 0) {
1604
- this.sendDeliveryReceipt(userId, timestamps).catch((_error) => {
1644
+ this.state.relayWork
1645
+ .run((work) => this.sendDeliveryReceipt(userId, timestamps, this.relayWorkContext(work)))
1646
+ .catch((_error) => {
1605
1647
  this.logger.warn('Failed to send delivery receipt', {
1606
1648
  category: 'E2EE',
1607
1649
  data: { userId },
@@ -1666,10 +1708,15 @@ export class DefaultSignalProtocolClient {
1666
1708
  * This prevents infinite retry loops where each retry creates a new session
1667
1709
  * with different header keys.
1668
1710
  *
1711
+ * The request runs as relay work, so its hooks run through that work.
1712
+ *
1669
1713
  * @param retryRequest - The retry request from the recipient
1670
1714
  */
1671
- async handleRetryRequestAndResend(retryRequest) {
1672
- return RetryOps.handleRetryRequestAndResend(this.ctx, retryRequest, this.retryDedupState, this.retryCallbacks, this.retryConfig);
1715
+ handleRetryRequestAndResend(retryRequest) {
1716
+ return this.state.relayWork.run((work) => {
1717
+ const ctx = this.relayWorkContext(work);
1718
+ return RetryOps.handleRetryRequestAndResend(ctx, retryRequest, this.retryDedupState, this.retryCallbacks(work, ctx), this.retryConfig);
1719
+ });
1673
1720
  }
1674
1721
  /**
1675
1722
  * Send delivery receipt to original sender (all devices)
@@ -1682,10 +1729,11 @@ export class DefaultSignalProtocolClient {
1682
1729
  *
1683
1730
  * @param recipientUserId - The sender's user ID (we are receipting TO them)
1684
1731
  * @param timestamps - Array of message timestamps that have been delivered
1732
+ * @param ctx - Client context, whose hooks run through the relay work of the send
1685
1733
  *
1686
1734
  */
1687
- async sendDeliveryReceipt(recipientUserId, timestamps) {
1688
- return this.sendReceipt(recipientUserId, timestamps, ReceiptType.DELIVERY);
1735
+ async sendDeliveryReceipt(recipientUserId, timestamps, ctx = this.ctx) {
1736
+ return this.sendReceipt(recipientUserId, timestamps, ReceiptType.DELIVERY, ctx);
1689
1737
  }
1690
1738
  /**
1691
1739
  * Send read receipt to original message sender (all devices)
@@ -1813,30 +1861,36 @@ export class DefaultSignalProtocolClient {
1813
1861
  *
1814
1862
  * Delegates to MessageOps.sendReceipt for implementation.
1815
1863
  */
1816
- async sendReceipt(recipientUserId, timestamps, type) {
1817
- return MessageOps.sendReceipt(this.ctx, recipientUserId, timestamps, type);
1864
+ async sendReceipt(recipientUserId, timestamps, type, ctx = this.ctx) {
1865
+ return MessageOps.sendReceipt(ctx, recipientUserId, timestamps, type);
1818
1866
  }
1819
1867
  /**
1820
1868
  * Handle incoming delivery/read receipt and clean up MessageRecords
1821
1869
  *
1822
1870
  * Delegates to MessageOps.handleDeliveryReceipt for implementation.
1823
1871
  */
1824
- async handleDeliveryReceipt(envelope, receipt) {
1825
- return MessageOps.handleDeliveryReceipt(this.ctx, envelope, receipt);
1872
+ async handleDeliveryReceipt(envelope, receipt, ctx = this.ctx) {
1873
+ return MessageOps.handleDeliveryReceipt(ctx, envelope, receipt);
1826
1874
  }
1827
1875
  /**
1828
1876
  * Handle incoming typing indicator
1829
1877
  *
1830
1878
  * Delegates to MessageOps.handleTypingIndicator for implementation.
1831
1879
  */
1832
- async handleTypingIndicator(envelope, typing) {
1833
- return MessageOps.handleTypingIndicator(this.ctx, envelope, typing);
1880
+ async handleTypingIndicator(envelope, typing, ctx = this.ctx) {
1881
+ return MessageOps.handleTypingIndicator(ctx, envelope, typing);
1834
1882
  }
1835
1883
  /**
1836
1884
  * Stop the Signal Protocol client and clean up resources
1837
1885
  *
1838
1886
  * Call this when the user logs out or the app shuts down.
1839
- * Unsubscribes from relay server and cleans up any pending operations.
1887
+ * Unsubscribes from relay server, waits for the SDK work of the
1888
+ * deliveries, retry requests, and receipt sends in progress, and cleans up
1889
+ * any pending operations.
1890
+ *
1891
+ * It does not wait for app hooks, so a hook can await stop(). When a hook
1892
+ * returns after stop(), the SDK drops the work after the hook and writes
1893
+ * nothing more. The relay delivers the envelope again after the next start.
1840
1894
  *
1841
1895
  * @example
1842
1896
  * ```typescript
@@ -1859,7 +1913,14 @@ export class DefaultSignalProtocolClient {
1859
1913
  category: 'E2EE',
1860
1914
  });
1861
1915
  }
1862
- // 3. Cleanup expired Sesame sessions
1916
+ // 3. Stop the relay work in progress and wait for its SDK work. Work
1917
+ // that waits in an app hook is not awaited. It writes nothing after
1918
+ // the hook, and the relay delivers it again after the next start
1919
+ await this.state.relayWork.settle();
1920
+ // 4. Clear internal tracking state via state manager. This cancels the
1921
+ // receipt timers, so no receipt starts after the wait
1922
+ this.state.clearForStop();
1923
+ // 5. Cleanup expired Sesame sessions
1863
1924
  try {
1864
1925
  await this.sesameManager.cleanupExpiredSessions();
1865
1926
  }
@@ -1869,7 +1930,7 @@ export class DefaultSignalProtocolClient {
1869
1930
  data: { error: error.message },
1870
1931
  });
1871
1932
  }
1872
- // 4. Cleanup expired message records (SESAME spec §6.2)
1933
+ // 6. Cleanup expired message records (SESAME spec §6.2)
1873
1934
  try {
1874
1935
  const deleted = await this._storage.deleteExpiredMessageRecords(MESSAGE_RECORD_TTL_MS);
1875
1936
  if (deleted > 0) {
@@ -1886,8 +1947,6 @@ export class DefaultSignalProtocolClient {
1886
1947
  data: { error: error.message },
1887
1948
  });
1888
1949
  }
1889
- // 5. Clear internal tracking state via state manager
1890
- this.state.clearForStop();
1891
1950
  this.logger.debug('DefaultSignalProtocolClient stopped', {
1892
1951
  category: 'E2EE',
1893
1952
  data: { userId: this.userId, deviceId: this.deviceId },