@open-e2ee/signal-protocol-sdk 3.0.0 → 5.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 (341) hide show
  1. package/ADAPTERS.md +4 -4
  2. package/CHANGELOG.md +90 -0
  3. package/README.md +2 -2
  4. package/SECURITY.md +2 -2
  5. package/TROUBLESHOOTING.md +4 -4
  6. package/client/README.md +5 -5
  7. package/dist/blocking/manager.d.ts +2 -2
  8. package/dist/blocking/manager.d.ts.map +1 -1
  9. package/dist/blocking/manager.js.map +1 -1
  10. package/dist/client/client.d.ts +40 -51
  11. package/dist/client/client.d.ts.map +1 -1
  12. package/dist/client/client.js +51 -64
  13. package/dist/client/client.js.map +1 -1
  14. package/dist/client/compose.d.ts +7 -7
  15. package/dist/client/compose.d.ts.map +1 -1
  16. package/dist/client/compose.js +2 -2
  17. package/dist/client/compose.js.map +1 -1
  18. package/dist/client/config.d.ts +35 -35
  19. package/dist/client/config.d.ts.map +1 -1
  20. package/dist/client/dual-store.d.ts +5 -5
  21. package/dist/client/dual-store.d.ts.map +1 -1
  22. package/dist/client/dual-store.js.map +1 -1
  23. package/dist/client/endorsement-manager.d.ts +2 -2
  24. package/dist/client/endorsement-manager.d.ts.map +1 -1
  25. package/dist/client/endorsement-manager.js.map +1 -1
  26. package/dist/client/files.d.ts +1 -1
  27. package/dist/client/files.js +1 -1
  28. package/dist/client/group-outbox.d.ts +4 -4
  29. package/dist/client/group-outbox.d.ts.map +1 -1
  30. package/dist/client/group-sealed-sender.d.ts +2 -2
  31. package/dist/client/group-sealed-sender.d.ts.map +1 -1
  32. package/dist/client/groups.d.ts +1 -1
  33. package/dist/client/groups.js +1 -1
  34. package/dist/client/headless.d.ts +17 -28
  35. package/dist/client/headless.d.ts.map +1 -1
  36. package/dist/client/headless.js +25 -70
  37. package/dist/client/headless.js.map +1 -1
  38. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  39. package/dist/client/hosted-anonymous-delivery.js +15 -2
  40. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  41. package/dist/client/hosted-groups.d.ts +2 -2
  42. package/dist/client/hosted-groups.d.ts.map +1 -1
  43. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
  44. package/dist/client/hosted-mailbox-subscription.js +32 -0
  45. package/dist/client/hosted-mailbox-subscription.js.map +1 -1
  46. package/dist/client/hosted-push.d.ts +2 -2
  47. package/dist/client/hosted-push.d.ts.map +1 -1
  48. package/dist/client/hosted-transport.d.ts +21 -14
  49. package/dist/client/hosted-transport.d.ts.map +1 -1
  50. package/dist/client/hosted-transport.js +81 -60
  51. package/dist/client/hosted-transport.js.map +1 -1
  52. package/dist/client/hosted.d.ts +8 -8
  53. package/dist/client/hosted.d.ts.map +1 -1
  54. package/dist/client/hosted.js +2 -2
  55. package/dist/client/hosted.js.map +1 -1
  56. package/dist/client/index.d.ts +2 -2
  57. package/dist/client/index.d.ts.map +1 -1
  58. package/dist/client/index.js +1 -1
  59. package/dist/client/index.js.map +1 -1
  60. package/dist/client/key-rotation-core.d.ts +49 -72
  61. package/dist/client/key-rotation-core.d.ts.map +1 -1
  62. package/dist/client/key-rotation-core.js +162 -257
  63. package/dist/client/key-rotation-core.js.map +1 -1
  64. package/dist/client/key-rotation.d.ts +15 -30
  65. package/dist/client/key-rotation.d.ts.map +1 -1
  66. package/dist/client/key-rotation.js +38 -62
  67. package/dist/client/key-rotation.js.map +1 -1
  68. package/dist/client/media-queue-persistence.d.ts +2 -2
  69. package/dist/client/media-queue-persistence.d.ts.map +1 -1
  70. package/dist/client/media-queue-persistence.js.map +1 -1
  71. package/dist/client/media.js.map +1 -1
  72. package/dist/client/messages.d.ts +1 -1
  73. package/dist/client/messages.js +1 -1
  74. package/dist/client/multi-device.d.ts +1 -1
  75. package/dist/client/multi-device.js +1 -1
  76. package/dist/client/one-time-prekey-refill.d.ts +52 -0
  77. package/dist/client/one-time-prekey-refill.d.ts.map +1 -0
  78. package/dist/client/one-time-prekey-refill.js +79 -0
  79. package/dist/client/one-time-prekey-refill.js.map +1 -0
  80. package/dist/client/prekeys.d.ts +1 -1
  81. package/dist/client/prekeys.d.ts.map +1 -1
  82. package/dist/client/prekeys.js +39 -74
  83. package/dist/client/prekeys.js.map +1 -1
  84. package/dist/client/relay-subscription.d.ts +1 -1
  85. package/dist/client/relay-subscription.js +1 -1
  86. package/dist/client/retry.d.ts +3 -3
  87. package/dist/client/retry.d.ts.map +1 -1
  88. package/dist/client/retry.js +1 -1
  89. package/dist/client/retry.js.map +1 -1
  90. package/dist/client/sealed-sender.d.ts +5 -5
  91. package/dist/client/sealed-sender.d.ts.map +1 -1
  92. package/dist/client/sealed-sender.js.map +1 -1
  93. package/dist/client/sessions.d.ts +3 -3
  94. package/dist/client/sessions.d.ts.map +1 -1
  95. package/dist/client/sessions.js +1 -1
  96. package/dist/client/sessions.js.map +1 -1
  97. package/dist/client/signal-service-cipher.d.ts +6 -6
  98. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  99. package/dist/client/signal-service-cipher.js +2 -2
  100. package/dist/client/signal-service-cipher.js.map +1 -1
  101. package/dist/client/state.d.ts +1 -1
  102. package/dist/client/state.js +1 -1
  103. package/dist/client/types.d.ts +11 -11
  104. package/dist/client/types.d.ts.map +1 -1
  105. package/dist/client/types.js +1 -1
  106. package/dist/device/connection.d.ts.map +1 -1
  107. package/dist/device/connection.js.map +1 -1
  108. package/dist/device/device-id.d.ts +2 -2
  109. package/dist/device/device-id.d.ts.map +1 -1
  110. package/dist/device/device-id.js.map +1 -1
  111. package/dist/device/index.d.ts +1 -1
  112. package/dist/device/index.d.ts.map +1 -1
  113. package/dist/device/lifecycle/index.d.ts +1 -1
  114. package/dist/device/lifecycle/index.d.ts.map +1 -1
  115. package/dist/device/lifecycle/manager.d.ts.map +1 -1
  116. package/dist/device/lifecycle/manager.js +0 -3
  117. package/dist/device/lifecycle/manager.js.map +1 -1
  118. package/dist/device/lifecycle/types.d.ts +9 -17
  119. package/dist/device/lifecycle/types.d.ts.map +1 -1
  120. package/dist/device/lifecycle/utils.d.ts +2 -4
  121. package/dist/device/lifecycle/utils.d.ts.map +1 -1
  122. package/dist/device/lifecycle/utils.js +2 -4
  123. package/dist/device/lifecycle/utils.js.map +1 -1
  124. package/dist/device/provisioning.d.ts +12 -12
  125. package/dist/device/provisioning.d.ts.map +1 -1
  126. package/dist/device/provisioning.js.map +1 -1
  127. package/dist/device/transfer.d.ts +13 -13
  128. package/dist/device/transfer.d.ts.map +1 -1
  129. package/dist/device/transfer.js.map +1 -1
  130. package/dist/device/types.d.ts +2 -2
  131. package/dist/device/types.d.ts.map +1 -1
  132. package/dist/groups/index.d.ts +1 -1
  133. package/dist/groups/index.d.ts.map +1 -1
  134. package/dist/groups/server.d.ts +1 -1
  135. package/dist/groups/server.d.ts.map +1 -1
  136. package/dist/hooks/index.d.ts +1 -2
  137. package/dist/hooks/index.d.ts.map +1 -1
  138. package/dist/hooks/index.js +0 -1
  139. package/dist/hooks/index.js.map +1 -1
  140. package/dist/hooks/use-group-membership.d.ts +2 -2
  141. package/dist/hooks/use-group-membership.d.ts.map +1 -1
  142. package/dist/hooks/use-group-membership.js.map +1 -1
  143. package/dist/hooks/use-key-rotation.d.ts +3 -6
  144. package/dist/hooks/use-key-rotation.d.ts.map +1 -1
  145. package/dist/hooks/use-key-rotation.js +8 -5
  146. package/dist/hooks/use-key-rotation.js.map +1 -1
  147. package/dist/hooks/use-session-health.d.ts +2 -2
  148. package/dist/hooks/use-session-health.d.ts.map +1 -1
  149. package/dist/hooks/use-single-flight.d.ts +4 -4
  150. package/dist/hooks/use-single-flight.js +4 -4
  151. package/dist/index.d.ts +12 -12
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +3 -3
  154. package/dist/index.js.map +1 -1
  155. package/dist/internal/crypto/ec/x25519-validation.d.ts +4 -4
  156. package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -1
  157. package/dist/internal/crypto/ec/x25519-validation.js.map +1 -1
  158. package/dist/internal/groups/index.d.ts +1 -1
  159. package/dist/internal/groups/index.d.ts.map +1 -1
  160. package/dist/internal/groups/manager.d.ts +4 -4
  161. package/dist/internal/groups/manager.d.ts.map +1 -1
  162. package/dist/internal/groups/manager.js.map +1 -1
  163. package/dist/internal/groups/sdk-store.d.ts +4 -4
  164. package/dist/internal/groups/sdk-store.d.ts.map +1 -1
  165. package/dist/internal/groups/sdk-store.js.map +1 -1
  166. package/dist/internal/groups/server-engine.d.ts +2 -2
  167. package/dist/internal/groups/server-engine.d.ts.map +1 -1
  168. package/dist/internal/manager/index.d.ts +2 -2
  169. package/dist/internal/manager/index.d.ts.map +1 -1
  170. package/dist/internal/manager/index.js +1 -1
  171. package/dist/internal/manager/index.js.map +1 -1
  172. package/dist/internal/manager/manager.d.ts +22 -22
  173. package/dist/internal/manager/manager.d.ts.map +1 -1
  174. package/dist/internal/manager/manager.js +18 -18
  175. package/dist/internal/manager/manager.js.map +1 -1
  176. package/dist/internal/protocol/double-ratchet/chains.d.ts +9 -9
  177. package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -1
  178. package/dist/internal/protocol/double-ratchet/chains.js.map +1 -1
  179. package/dist/internal/protocol/double-ratchet/ratchet.d.ts +2 -2
  180. package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
  181. package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
  182. package/dist/internal/protocol/pqxdh/pqxdh.d.ts +3 -3
  183. package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -1
  184. package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -1
  185. package/dist/internal/protocol/sender-keys/manager.d.ts +3 -3
  186. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  187. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  188. package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.d.ts +3 -3
  189. package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.d.ts.map +1 -1
  190. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts +3 -3
  191. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts.map +1 -1
  192. package/dist/internal/protocol/spqr/ml-kem-braid/index.d.ts +2 -2
  193. package/dist/internal/protocol/spqr/ml-kem-braid/index.d.ts.map +1 -1
  194. package/dist/internal/protocol/spqr/ml-kem-braid/index.js +1 -1
  195. package/dist/internal/protocol/spqr/ml-kem-braid/index.js.map +1 -1
  196. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts +3 -3
  197. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts.map +1 -1
  198. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +2 -2
  199. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -1
  200. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +3 -3
  201. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -1
  202. package/dist/internal/protocol/spqr/spqr.d.ts +5 -5
  203. package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
  204. package/dist/internal/protocol/spqr/spqr.js.map +1 -1
  205. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +4 -4
  206. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +1 -1
  207. package/dist/internal/protocol/triple-ratchet/ratchet.js.map +1 -1
  208. package/dist/internal/protocol/x3dh/x3dh.d.ts +3 -3
  209. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -1
  210. package/dist/internal/protocol/x3dh/x3dh.js.map +1 -1
  211. package/dist/internal/sesame/device-registry.d.ts +16 -16
  212. package/dist/internal/sesame/device-registry.d.ts.map +1 -1
  213. package/dist/internal/sesame/device-registry.js +6 -6
  214. package/dist/internal/sesame/device-registry.js.map +1 -1
  215. package/dist/internal/sesame/index.d.ts +4 -4
  216. package/dist/internal/sesame/index.d.ts.map +1 -1
  217. package/dist/internal/sesame/index.js +2 -2
  218. package/dist/internal/sesame/index.js.map +1 -1
  219. package/dist/internal/sesame/manager.d.ts +8 -8
  220. package/dist/internal/sesame/manager.d.ts.map +1 -1
  221. package/dist/internal/sesame/manager.js +7 -7
  222. package/dist/internal/sesame/manager.js.map +1 -1
  223. package/dist/internal/sesame/types.d.ts +4 -4
  224. package/dist/internal/sesame/types.d.ts.map +1 -1
  225. package/dist/internal/session/cipher.d.ts +3 -3
  226. package/dist/internal/session/cipher.d.ts.map +1 -1
  227. package/dist/internal/session/cipher.js.map +1 -1
  228. package/dist/internal/session/decryption.js.map +1 -1
  229. package/dist/internal/session/factory.d.ts +3 -3
  230. package/dist/internal/session/factory.d.ts.map +1 -1
  231. package/dist/internal/session/factory.js.map +1 -1
  232. package/dist/internal/session/handshake.d.ts +2 -2
  233. package/dist/internal/session/handshake.d.ts.map +1 -1
  234. package/dist/internal/session/handshake.js.map +1 -1
  235. package/dist/internal/session/ratchet.d.ts +4 -4
  236. package/dist/internal/session/ratchet.d.ts.map +1 -1
  237. package/dist/internal/session/ratchet.js.map +1 -1
  238. package/dist/internal/session/types.d.ts +5 -5
  239. package/dist/internal/session/types.d.ts.map +1 -1
  240. package/dist/internal/session/validation.d.ts +3 -3
  241. package/dist/internal/session/validation.d.ts.map +1 -1
  242. package/dist/internal/session/validation.js.map +1 -1
  243. package/dist/layers.d.ts +3 -3
  244. package/dist/layers.d.ts.map +1 -1
  245. package/dist/layers.js +11 -11
  246. package/dist/layers.js.map +1 -1
  247. package/dist/local/store/expo/adapter.d.ts +8 -8
  248. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  249. package/dist/local/store/expo/adapter.js +1 -1
  250. package/dist/local/store/expo/adapter.js.map +1 -1
  251. package/dist/local/store/expo/database-key.d.ts +5 -5
  252. package/dist/local/store/expo/database-key.d.ts.map +1 -1
  253. package/dist/local/store/expo/database-key.js.map +1 -1
  254. package/dist/local/store/expo/index.d.ts +3 -3
  255. package/dist/local/store/expo/index.d.ts.map +1 -1
  256. package/dist/local/store/expo/key-storage.d.ts +4 -4
  257. package/dist/local/store/expo/key-storage.d.ts.map +1 -1
  258. package/dist/local/store/expo/key-storage.js.map +1 -1
  259. package/dist/local/store/expo/models/ec-one-time-prekey.d.ts.map +1 -1
  260. package/dist/local/store/expo/models/ec-one-time-prekey.js +4 -6
  261. package/dist/local/store/expo/models/ec-one-time-prekey.js.map +1 -1
  262. package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts.map +1 -1
  263. package/dist/local/store/expo/models/kyber-one-time-prekey.js +4 -8
  264. package/dist/local/store/expo/models/kyber-one-time-prekey.js.map +1 -1
  265. package/dist/local/store/index.d.ts +3 -3
  266. package/dist/local/store/index.d.ts.map +1 -1
  267. package/dist/local/store/index.js +1 -1
  268. package/dist/local/store/memory/adapter.d.ts +3 -3
  269. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  270. package/dist/local/store/memory/adapter.js +1 -1
  271. package/dist/local/store/node/adapter.d.ts +2 -2
  272. package/dist/local/store/node/adapter.d.ts.map +1 -1
  273. package/dist/local/store/node/database.d.ts +2 -2
  274. package/dist/local/store/node/database.d.ts.map +1 -1
  275. package/dist/local/store/node/database.js.map +1 -1
  276. package/dist/local/store/react-native/adapter.d.ts +2 -2
  277. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  278. package/dist/local/store/received-content.d.ts +2 -2
  279. package/dist/local/store/received-content.d.ts.map +1 -1
  280. package/dist/local/store/received-content.js.map +1 -1
  281. package/dist/local/store/reliability.d.ts +2 -2
  282. package/dist/local/store/reliability.d.ts.map +1 -1
  283. package/dist/local/store/web/adapter.d.ts +3 -3
  284. package/dist/local/store/web/adapter.d.ts.map +1 -1
  285. package/dist/local/store/web/adapter.js +1 -1
  286. package/dist/local/vault/expo-secure-store.d.ts +2 -2
  287. package/dist/local/vault/expo-secure-store.d.ts.map +1 -1
  288. package/dist/local/vault/index.d.ts +1 -1
  289. package/dist/local/vault/index.d.ts.map +1 -1
  290. package/dist/logger.d.ts +4 -4
  291. package/dist/logger.d.ts.map +1 -1
  292. package/dist/logger.js.map +1 -1
  293. package/dist/profile/contact-state.d.ts +2 -2
  294. package/dist/profile/contact-state.d.ts.map +1 -1
  295. package/dist/profile/contact-state.js.map +1 -1
  296. package/dist/profile/profile-key.d.ts +2 -2
  297. package/dist/profile/profile-key.d.ts.map +1 -1
  298. package/dist/profile/profile-key.js.map +1 -1
  299. package/dist/profile/update-service.d.ts +2 -2
  300. package/dist/profile/update-service.d.ts.map +1 -1
  301. package/dist/profile/update-service.js.map +1 -1
  302. package/dist/remote/relay/index.d.ts +4 -4
  303. package/dist/remote/relay/index.d.ts.map +1 -1
  304. package/dist/remote/relay/index.js +3 -3
  305. package/dist/remote/relay/memory/adapter.d.ts +5 -17
  306. package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
  307. package/dist/remote/relay/memory/adapter.js +9 -62
  308. package/dist/remote/relay/memory/adapter.js.map +1 -1
  309. package/dist/remote/relay/types.d.ts +29 -73
  310. package/dist/remote/relay/types.d.ts.map +1 -1
  311. package/dist/remote/relay/types.js +1 -1
  312. package/dist/safety/index.d.ts +2 -2
  313. package/dist/safety/index.js +2 -2
  314. package/dist/types/api.d.ts +48 -36
  315. package/dist/types/api.d.ts.map +1 -1
  316. package/dist/types/index.js +1 -1
  317. package/dist/types/index.js.map +1 -1
  318. package/docs/ASSURANCE.md +5 -5
  319. package/docs/CLIENT_COMPOSITION.md +4 -4
  320. package/docs/ERROR_HANDLING.md +4 -4
  321. package/docs/INTERFACES.md +15 -15
  322. package/docs/PACKAGE_SURFACE.md +5 -6
  323. package/examples/browser/index.html +1 -1
  324. package/groups/README.md +4 -4
  325. package/hooks/README.md +4 -14
  326. package/local/store/README.md +6 -6
  327. package/local/store/expo/README.md +1 -1
  328. package/local/store/memory/README.md +1 -1
  329. package/local/store/node/README.md +2 -2
  330. package/local/store/react-native/README.md +1 -1
  331. package/local/store/web/README.md +1 -1
  332. package/local/vault/README.md +1 -1
  333. package/package.json +1 -5
  334. package/remote/README.md +8 -8
  335. package/remote/relay/README.md +2 -2
  336. package/remote/relay/memory/README.md +1 -1
  337. package/types/README.md +2 -2
  338. package/dist/hooks/use-connection-presence.d.ts +0 -66
  339. package/dist/hooks/use-connection-presence.d.ts.map +0 -1
  340. package/dist/hooks/use-connection-presence.js +0 -298
  341. package/dist/hooks/use-connection-presence.js.map +0 -1
@@ -95,14 +95,14 @@ app code does not have to compose queue callbacks for ordinary sends. See
95
95
 
96
96
  ## Direct Client Creation
97
97
 
98
- `SignalProtocolClient.create()` remains the low-level primitive. It uses the same
98
+ `DefaultSignalProtocolClient.create()` remains the low-level primitive. It uses the same
99
99
  developer-facing protocol config:
100
100
 
101
101
  <!-- doc-snippet:skip requires-external-context -->
102
102
  ```ts
103
- import { SignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
103
+ import { DefaultSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
104
104
 
105
- const signal = await SignalProtocolClient.create(userId, {
105
+ const signal = await DefaultSignalProtocolClient.create(userId, {
106
106
  // Low-level creation uses the same storage/relay/protocol concepts.
107
107
  storage,
108
108
  relay,
@@ -116,7 +116,7 @@ const signal = await SignalProtocolClient.create(userId, {
116
116
  - Keep account/device identity in `identity`.
117
117
  - Keep product security policy in `protocol`.
118
118
  - Keep app logging, hooks, sealed sender, groups, and sender-key options at the
119
- top level so they match `SignalProtocolClient.create()`.
119
+ top level so they match `DefaultSignalProtocolClient.create()`.
120
120
  - Use `protocol.postQuantum: 'compatible'` only when the product explicitly
121
121
  supports peers with no post-quantum material.
122
122
  - Use `protocol.braid: 'disabled'` only when a product-reviewed constraint
@@ -213,10 +213,10 @@ import { withRetry } from '@open-e2ee/signal-protocol-sdk/utils/retry';
213
213
 
214
214
  await withRetry(
215
215
  async () => {
216
- await signal.rotateEcSignedPreKey();
216
+ await signal.rotatePreKeys();
217
217
  },
218
218
  {
219
- operationName: 'rotateEcSignedPreKey',
219
+ operationName: 'rotatePreKeys',
220
220
  maxRetries: 2,
221
221
  baseDelay: 2000,
222
222
  maxDelay: 30000,
@@ -281,9 +281,9 @@ The library includes structured logging for errors:
281
281
 
282
282
  <!-- doc-snippet:skip requires-platform-adapters -->
283
283
  ```typescript
284
- import { SignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';
284
+ import { DefaultSignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';
285
285
 
286
- const signal = await SignalProtocolClient.create(userId, {
286
+ const signal = await DefaultSignalProtocolClient.create(userId, {
287
287
  storage,
288
288
  relay,
289
289
  logger: {
@@ -12,31 +12,31 @@ policy.
12
12
 
13
13
  ```text
14
14
  SignalProtocolClient
15
- ├── ISignalProtocolLocalStore device-local protocol state
16
- ├── ISignalProtocolRelayServer authenticated device, prekey, and envelope service
15
+ ├── SignalProtocolLocalStore device-local protocol state
16
+ ├── SignalProtocolRelayServer authenticated device, prekey, and envelope service
17
17
  ├── SignalProtocolRemoteObjectStore brokered encrypted-object operations (optional)
18
18
  ├── media callbacks application-owned attachment bytes and caches
19
19
  └── lifecycle hooks application reactions and observability
20
20
 
21
21
  Local-store bootstrap
22
- └── ISignalProtocolLocalSecretVault small platform-managed bootstrap secrets
22
+ └── SignalProtocolLocalSecretVault small platform-managed bootstrap secrets
23
23
  ```
24
24
 
25
25
  The interfaces are public contracts, but they do not make an implementation
26
26
  secure by themselves. Each adapter must preserve the ownership and atomicity
27
27
  requirements described below.
28
28
 
29
- ## `ISignalProtocolLocalStore`
29
+ ## `SignalProtocolLocalStore`
30
30
 
31
- `ISignalProtocolLocalStore` persists the current device's identities, prekeys, sessions,
31
+ `SignalProtocolLocalStore` persists the current device's identities, prekeys, sessions,
32
32
  sender keys, contact trust, retry records, and operational metadata.
33
33
 
34
34
  <!-- doc-snippet:skip requires-external-context -->
35
35
  ```ts
36
- import type { ISignalProtocolLocalStore } from "@open-e2ee/signal-protocol-sdk/local/store";
36
+ import type { SignalProtocolLocalStore } from "@open-e2ee/signal-protocol-sdk/local/store";
37
37
  import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
38
38
 
39
- const storage: ISignalProtocolLocalStore = appProtocolStore;
39
+ const storage: SignalProtocolLocalStore = appProtocolStore;
40
40
 
41
41
  const client = await createSignalProtocolClient({
42
42
  identity: { userId },
@@ -57,17 +57,17 @@ A production implementation must:
57
57
  The [local-store guide](../local/store/README.md) lists the available adapters
58
58
  and their status.
59
59
 
60
- ## `ISignalProtocolLocalSecretVault`
60
+ ## `SignalProtocolLocalSecretVault`
61
61
 
62
- `ISignalProtocolLocalSecretVault` is a deliberately small interface for bootstrap
62
+ `SignalProtocolLocalSecretVault` is a deliberately small interface for bootstrap
63
63
  secrets that must live outside the main local store, such as a database
64
64
  encryption key.
65
65
 
66
66
  <!-- doc-snippet:skip requires-external-context -->
67
67
  ```ts
68
- import type { ISignalProtocolLocalSecretVault } from "@open-e2ee/signal-protocol-sdk";
68
+ import type { SignalProtocolLocalSecretVault } from "@open-e2ee/signal-protocol-sdk";
69
69
 
70
- const vault: ISignalProtocolLocalSecretVault = {
70
+ const vault: SignalProtocolLocalSecretVault = {
71
71
  getSecret: (name) => platformSecrets.getBytes(name),
72
72
  setSecret: (name, value) => platformSecrets.setBytes(name, value),
73
73
  deleteSecret: (name) => platformSecrets.delete(name),
@@ -79,21 +79,21 @@ device migration, uninstall persistence, and deletion behavior depend on the
79
79
  selected platform service and host configuration. See the
80
80
  [secret-vault guide](../local/vault/README.md).
81
81
 
82
- ## `ISignalProtocolRelayServer`
82
+ ## `SignalProtocolRelayServer`
83
83
 
84
- `ISignalProtocolRelayServer` represents the authenticated application backend used for
84
+ `SignalProtocolRelayServer` represents the authenticated application backend used for
85
85
  device registration, account identity state, public prekeys, encrypted-envelope
86
86
  delivery, provisioning, key rotation, and encrypted group coordination.
87
87
 
88
88
  <!-- doc-snippet:skip requires-external-context -->
89
89
  ```ts
90
- import type { ISignalProtocolRelayServer } from "@open-e2ee/signal-protocol-sdk/remote/relay";
90
+ import type { SignalProtocolRelayServer } from "@open-e2ee/signal-protocol-sdk/remote/relay";
91
91
  import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
92
92
 
93
93
  // Development uses the in-memory relay. Production connects to the OpenE2EE
94
94
  // Signal Protocol Relay through `createHostedSignalProtocolClient()`, or to an
95
95
  // application backend that implements this interface.
96
- const relay: ISignalProtocolRelayServer = inMemoryRelay();
96
+ const relay: SignalProtocolRelayServer = inMemoryRelay();
97
97
  ```
98
98
 
99
99
  The application backend must:
@@ -12,7 +12,7 @@ It also defines the vocabulary the rest of the documentation assumes.
12
12
  ## Core model
13
13
 
14
14
  - `createSignalProtocolClient()` is the recommended app-facing entry point.
15
- - `SignalProtocolClient` is the primary class returned by the factory.
15
+ - `DefaultSignalProtocolClient` is the class the factory returns. `SignalProtocolClient` is its interface.
16
16
  - Every client requires `storage`, which owns local encryption state for one
17
17
  user/device.
18
18
  - `relay` is optional for local development. Real messaging apps use it for
@@ -89,7 +89,6 @@ Expo storage or the Convex R2 object store.
89
89
  - `@open-e2ee/signal-protocol-sdk/groups`
90
90
  - `@open-e2ee/signal-protocol-sdk/groups/server`
91
91
  - `@open-e2ee/signal-protocol-sdk/hooks`
92
- - `@open-e2ee/signal-protocol-sdk/hooks/use-connection-presence`
93
92
  - `@open-e2ee/signal-protocol-sdk/keys`
94
93
  - `@open-e2ee/signal-protocol-sdk/keys/generation`
95
94
  - `@open-e2ee/signal-protocol-sdk/keys/types`
@@ -147,7 +146,7 @@ Expo storage or the Convex R2 object store.
147
146
  - `createHostedSignalProtocolClient()` from the package root for the OpenE2EE
148
147
  Signal Protocol Relay
149
148
  - `InMemorySignalProtocolRelayServer` / `inMemoryRelay()` for local development
150
- - custom implementations via `ISignalProtocolRelayServer`
149
+ - custom implementations via `SignalProtocolRelayServer`
151
150
 
152
151
  ### Storage implementations
153
152
 
@@ -162,7 +161,7 @@ Expo storage or the Convex R2 object store.
162
161
  backend-conformance kit)
163
162
  - `NodeSignalProtocolStore` / `nodeStore()` for Node environments
164
163
  - `InMemorySignalProtocolStore` / `inMemoryStore()` for local development
165
- - custom implementations via `ISignalProtocolLocalStore`
164
+ - custom implementations via `SignalProtocolLocalStore`
166
165
 
167
166
  ### Remote object store
168
167
 
@@ -203,12 +202,12 @@ implement the same `MediaAttachmentTransfer` seam.
203
202
 
204
203
  ## Design notes
205
204
 
206
- - `SignalProtocolClient.create()` requires `storage`. There are no hidden
205
+ - `DefaultSignalProtocolClient.create()` requires `storage`. There are no hidden
207
206
  default adapters.
208
207
  - `createSignalProtocolClient()` is the preferred composition helper when app
209
208
  code owns multiple adapters.
210
209
  - Linked devices must already contain provisioned identity material before
211
- `SignalProtocolClient.create(..., { deviceId: 2 })`.
210
+ `DefaultSignalProtocolClient.create(..., { deviceId: 2 })`.
212
211
  - Username-only apps typically run ACI-only. Phone-capable apps can enable both
213
212
  ACI and PNI with `enablePniKeys: true`.
214
213
  - `protocol.postQuantum` and `protocol.braid` are product-facing policy.
@@ -19,7 +19,7 @@
19
19
  <p id="status" role="status">Ready</p>
20
20
  <pre id="output" aria-label="Execution output" tabindex="0"></pre>
21
21
  <p>The browser console shows the same results. Ciphertext changes on each run.</p>
22
- <p><a href="https://github.com/open-e2ee/signal-protocol-js/tree/v3.0.0/examples/browser/src/exchange.ts">Read the exchange code</a> · <a href="https://stackblitz.com/fork/github/open-e2ee/signal-protocol-js/tree/v3.0.0/examples/browser">Edit on StackBlitz</a></p>
22
+ <p><a href="https://github.com/open-e2ee/signal-protocol-js/tree/v5.0.0/examples/browser/src/exchange.ts">Read the exchange code</a> · <a href="https://stackblitz.com/fork/github/open-e2ee/signal-protocol-js/tree/v5.0.0/examples/browser">Edit on StackBlitz</a></p>
23
23
  <p>Continue with <a href="https://docs.open-e2ee.dev/start/browser">browser storage</a>, <a href="https://docs.open-e2ee.dev/start/expo">Expo / Hermes setup</a>, or <a href="https://open-e2ee.dev/relay">the OpenE2EE Signal Protocol Relay for separate devices</a>.</p>
24
24
  </main>
25
25
  <script type="module" src="/src/main.ts"></script>
package/groups/README.md CHANGED
@@ -18,13 +18,13 @@ and sender-key rotation.
18
18
  import {
19
19
  GroupManager,
20
20
  createGroupId,
21
- type IGroupServer,
22
- type IGroupStateStore,
21
+ type GroupServer,
22
+ type GroupStateStore,
23
23
  } from "@open-e2ee/signal-protocol-sdk/groups";
24
24
 
25
25
  const groups = new GroupManager({
26
- store: appGroupStore as IGroupStateStore,
27
- server: appGroupServer as IGroupServer,
26
+ store: appGroupStore as GroupStateStore,
27
+ server: appGroupServer as GroupServer,
28
28
  issueCredential: () => appGroupCredentials.issue(),
29
29
  credentialPublicKey,
30
30
  serverSigningPublicKey,
package/hooks/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # React Hooks
2
2
 
3
3
  The hooks module adapts client lifecycle operations to React components. It
4
- includes connection presence, key rotation, group membership, session health,
5
- and single-flight helpers.
4
+ includes key rotation, group membership, session health, and single-flight
5
+ helpers.
6
6
 
7
7
  ## Why it exists
8
8
 
@@ -13,22 +13,12 @@ subscribe to SDK state without duplicating effect cleanup.
13
13
  ## Usage
14
14
 
15
15
  ```tsx
16
- import {
17
- useConnectionPresence,
18
- useSessionHealth,
19
- } from "@open-e2ee/signal-protocol-sdk/hooks";
16
+ import { useSessionHealth } from "@open-e2ee/signal-protocol-sdk/hooks";
20
17
 
21
18
  function ConversationStatus({ client, address }) {
22
- const connection = useConnectionPresence({ client });
23
19
  const session = useSessionHealth({ client, address });
24
20
 
25
- return (
26
- <p>
27
- {connection.isConnected && session.isHealthy
28
- ? "Ready"
29
- : "Reconnecting…"}
30
- </p>
31
- );
21
+ return <p>{session.isHealthy ? "Ready" : "Reconnecting…"}</p>;
32
22
  }
33
23
  ```
34
24
 
@@ -1,6 +1,6 @@
1
1
  # Storage Guide
2
2
 
3
- > Infrastructure | Implements `ISignalProtocolLocalStore` | [Architecture](../../ARCHITECTURE.md)
3
+ > Infrastructure | Implements `SignalProtocolLocalStore` | [Architecture](../../ARCHITECTURE.md)
4
4
 
5
5
  The storage layer owns device-local Signal Protocol state: identity keys,
6
6
  contact trust, prekeys, sessions, and retry/message-record metadata.
@@ -8,7 +8,7 @@ contact trust, prekeys, sessions, and retry/message-record metadata.
8
8
  ## Why it exists
9
9
 
10
10
  Protocol state must survive restarts and several security transitions must
11
- commit atomically. `ISignalProtocolLocalStore` makes those requirements explicit
11
+ commit atomically. `SignalProtocolLocalStore` makes those requirements explicit
12
12
  without coupling the client to a database or platform.
13
13
 
14
14
  ## Current Support
@@ -50,7 +50,7 @@ exported backend-conformance kit described in the
50
50
 
51
51
  The experimental label comes off an adapter when every item below is a named,
52
52
  continuously running CI gate. Each gate tests the adapter's own contract,
53
- which is the set of promises `ISignalProtocolLocalStore` makes. No gate tests
53
+ which is the set of promises `SignalProtocolLocalStore` makes. No gate tests
54
54
  the platform under it. Browsers, IndexedDB, and React Native are the
55
55
  environment an adapter must honor its promises in, not the subject of a test.
56
56
 
@@ -144,11 +144,11 @@ state, retry message records, and recovery helpers.
144
144
 
145
145
  <!-- doc-snippet:skip requires-external-context -->
146
146
  ```ts
147
- import { SignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';
147
+ import { DefaultSignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';
148
148
  import { ExpoSignalProtocolStore } from '@open-e2ee/signal-protocol-sdk/local/store/expo';
149
149
 
150
150
  // Configure the application-owned Expo/SQLCipher database bindings first.
151
- const signal = await SignalProtocolClient.create(userId, {
151
+ const signal = await DefaultSignalProtocolClient.create(userId, {
152
152
  storage: new ExpoSignalProtocolStore(),
153
153
  });
154
154
  ```
@@ -157,7 +157,7 @@ The [Expo guide](./expo/README.md) shows the required database bootstrap.
157
157
 
158
158
  ## Storage Responsibilities
159
159
 
160
- An `ISignalProtocolLocalStore` implementation must preserve:
160
+ An `SignalProtocolLocalStore` implementation must preserve:
161
161
 
162
162
  - account identity key storage
163
163
  - contact identity trust / TOFU decisions
@@ -1,6 +1,6 @@
1
1
  # Expo Store
2
2
 
3
- `ExpoSignalProtocolStore` implements `ISignalProtocolLocalStore` for Expo and React Native with
3
+ `ExpoSignalProtocolStore` implements `SignalProtocolLocalStore` for Expo and React Native with
4
4
  an application-owned SQLite/Drizzle database and a database key held through
5
5
  the local secret-vault boundary.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # In-Memory Store
2
2
 
3
- `InMemorySignalProtocolStore` implements `ISignalProtocolLocalStore` in memory for examples, local
3
+ `InMemorySignalProtocolStore` implements `SignalProtocolLocalStore` in memory for examples, local
4
4
  development, and deterministic application prototypes.
5
5
 
6
6
  The protocol and cryptography are real. The adapter simulates the
@@ -3,12 +3,12 @@
3
3
  `NodeSignalProtocolStore` provides Node.js protocol storage using encrypted,
4
4
  crash-durable filesystem state.
5
5
 
6
- It implements all of `ISignalProtocolLocalStore`. That covers identity,
6
+ It implements all of `SignalProtocolLocalStore`. That covers identity,
7
7
  prekeys, sessions, Kyber prekeys, Sesame device records, sender keys, and
8
8
  message records. Multi-device and group flows therefore work in Node without a
9
9
  custom adapter.
10
10
 
11
- The class declares `implements ISignalProtocolLocalStore`, so the compiler
11
+ The class declares `implements SignalProtocolLocalStore`, so the compiler
12
12
  rejects any build that omits a member or changes its signature. That check is
13
13
  the guarantee behind this paragraph, not a manual audit.
14
14
 
@@ -1,6 +1,6 @@
1
1
  # Bare React Native Store
2
2
 
3
- `ReactNativeSignalProtocolStore` implements `ISignalProtocolLocalStore` for bare React Native
3
+ `ReactNativeSignalProtocolStore` implements `SignalProtocolLocalStore` for bare React Native
4
4
  through an application-provided persistent key-value backend.
5
5
 
6
6
  ## Why it exists
@@ -1,6 +1,6 @@
1
1
  # IndexedDB Store
2
2
 
3
- `IndexedDbSignalProtocolStore` implements the full `ISignalProtocolLocalStore` contract for web
3
+ `IndexedDbSignalProtocolStore` implements the full `SignalProtocolLocalStore` contract for web
4
4
  browsers using IndexedDB and Web Crypto.
5
5
 
6
6
  ## Why it exists
@@ -7,7 +7,7 @@ The local secret vault stores small bootstrap secrets through a minimal
7
7
 
8
8
  Platform secret managers are appropriate for tiny keys and bootstrap values,
9
9
  but not full session databases. A vault separate from
10
- `ISignalProtocolLocalStore` keeps platform limits explicit. A local store can
10
+ `SignalProtocolLocalStore` keeps platform limits explicit. A local store can
11
11
  then use a vault-held wrapping key without placing every protocol record in the
12
12
  platform keychain.
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-e2ee/signal-protocol-sdk",
3
- "version": "3.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Pure TypeScript Signal Protocol SDK for encrypted chat in Expo, React Native, browsers, and Node. Post-quantum by default.",
5
5
  "keywords": [
6
6
  "open-e2ee",
@@ -147,10 +147,6 @@
147
147
  "types": "./dist/hooks/index.d.ts",
148
148
  "default": "./dist/hooks/index.js"
149
149
  },
150
- "./hooks/use-connection-presence": {
151
- "types": "./dist/hooks/use-connection-presence.d.ts",
152
- "default": "./dist/hooks/use-connection-presence.js"
153
- },
154
150
  "./keys": {
155
151
  "types": "./dist/keys/index.d.ts",
156
152
  "default": "./dist/keys/index.js"
package/remote/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Remote Guide
2
2
 
3
- > Infrastructure | Implements `ISignalProtocolRelayServer` and `SignalProtocolRemoteObjectStore` | [Architecture](../ARCHITECTURE.md)
3
+ > Infrastructure | Implements `SignalProtocolRelayServer` and `SignalProtocolRemoteObjectStore` | [Architecture](../ARCHITECTURE.md)
4
4
 
5
5
  The backend layer is responsible for server-owned protocol state: public
6
6
  prekeys, device registration, encrypted-envelope delivery, and provisioning
@@ -19,7 +19,7 @@ replaceable and prevent them from owning private keys or plaintext.
19
19
 
20
20
  - the OpenE2EE Signal Protocol Relay through `createHostedSignalProtocolClient()` from the package root
21
21
  - `InMemorySignalProtocolRelayServer` from `@open-e2ee/signal-protocol-sdk/remote/relay/memory`
22
- - custom implementations via `ISignalProtocolRelayServer`
22
+ - custom implementations via `SignalProtocolRelayServer`
23
23
 
24
24
  ### Remote object store
25
25
 
@@ -51,7 +51,7 @@ const signal = await createHostedSignalProtocolClient({
51
51
 
52
52
  ## Relay Responsibilities
53
53
 
54
- An `ISignalProtocolRelayServer` implementation must preserve the package’s protocol semantics for:
54
+ An `SignalProtocolRelayServer` implementation must preserve the package’s protocol semantics for:
55
55
 
56
56
  - identity and prekey upload
57
57
  - prekey bundle fetch
@@ -98,11 +98,11 @@ create, download, completion, and deletion.
98
98
 
99
99
  <!-- doc-snippet:skip requires-external-context -->
100
100
  ```ts
101
- import { SignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
101
+ import { DefaultSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
102
102
  import { convexR2ObjectStore } from "@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2";
103
103
  import { api } from "../convex/_generated/api";
104
104
 
105
- const signal = await SignalProtocolClient.create(userId, {
105
+ const signal = await DefaultSignalProtocolClient.create(userId, {
106
106
  storage,
107
107
  relay,
108
108
  remoteObjectStore: convexR2ObjectStore({
@@ -201,18 +201,18 @@ Use `InMemorySignalProtocolRelayServer` when multiple clients need a shared in-m
201
201
  <!-- doc-snippet:run remote-shared-memory-relay expect="" -->
202
202
  ```ts
203
203
  // Real protocol and cryptography; simulated in-memory infrastructure.
204
- import { SignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
204
+ import { DefaultSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
205
205
  import { InMemorySignalProtocolRelayServer } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
206
206
  import { InMemorySignalProtocolStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
207
207
 
208
208
  const relay = new InMemorySignalProtocolRelayServer();
209
209
 
210
- const alice = await SignalProtocolClient.create("alice", {
210
+ const alice = await DefaultSignalProtocolClient.create("alice", {
211
211
  storage: new InMemorySignalProtocolStore(),
212
212
  relay,
213
213
  });
214
214
 
215
- const bob = await SignalProtocolClient.create("bob", {
215
+ const bob = await DefaultSignalProtocolClient.create("bob", {
216
216
  storage: new InMemorySignalProtocolStore(),
217
217
  relay,
218
218
  });
@@ -1,6 +1,6 @@
1
1
  # Relay
2
2
 
3
- The relay module defines `ISignalProtocolRelayServer`, the application-backend contract
3
+ The relay module defines `SignalProtocolRelayServer`, the application-backend contract
4
4
  for device discovery, public prekeys, encrypted envelopes, key rotation,
5
5
  provisioning, and related synchronization.
6
6
 
@@ -32,7 +32,7 @@ await client.syncToServer();
32
32
 
33
33
  For production, connect to the OpenE2EE Signal Protocol Relay through
34
34
  `createHostedSignalProtocolClient()` from the package root, or implement
35
- `ISignalProtocolRelayServer` against your own backend. That backend must authenticate
35
+ `SignalProtocolRelayServer` against your own backend. That backend must authenticate
36
36
  mutations, allocate linked-device IDs, consume one-time prekeys atomically,
37
37
  enforce access policy, and store only encrypted envelopes plus required routing
38
38
  metadata.
@@ -1,6 +1,6 @@
1
1
  # In-Memory Relay
2
2
 
3
- `InMemorySignalProtocolRelayServer` implements `ISignalProtocolRelayServer` in memory for examples
3
+ `InMemorySignalProtocolRelayServer` implements `SignalProtocolRelayServer` in memory for examples
4
4
  and local application development.
5
5
 
6
6
  The protocol and cryptography are real. The adapter simulates the
package/types/README.md CHANGED
@@ -15,8 +15,8 @@ contracts they validate.
15
15
  <!-- doc-snippet:skip requires-external-context -->
16
16
  ```ts
17
17
  import type {
18
- ISignalProtocolLocalStore,
19
- ISignalProtocolClient,
18
+ SignalProtocolLocalStore,
19
+ SignalProtocolClient,
20
20
  SignalProtocolConfig,
21
21
  } from "@open-e2ee/signal-protocol-sdk/types";
22
22
  import { ProtocolAddress } from "@open-e2ee/signal-protocol-sdk/types/address";
@@ -1,66 +0,0 @@
1
- /**
2
- * Unified Presence Tracking Hook
3
- *
4
- * Handles both WebSocket connection state and app lifecycle state
5
- * to provide accurate, immediate presence updates with no duplicate calls.
6
- *
7
- * Routes presence operations through the Signal Protocol relay for architectural
8
- * consistency with other device operations.
9
- *
10
- * Behavior:
11
- * - WebSocket connects (app active) → mark online + start heartbeat
12
- * - WebSocket disconnects → mark offline + stop heartbeat
13
- * - App backgrounds → immediately mark offline + stop heartbeat
14
- * - App foregrounds → wait for WebSocket reconnect (which marks online)
15
- * - Heartbeat every 10 seconds keeps device "alive" on server
16
- *
17
- * Server-side:
18
- * - Server schedules 30-second timeout on state transitions (offline → online)
19
- * - Heartbeat writes to heartbeats table (triggers 0 query reruns)
20
- * - If client crashes (no graceful disconnect), 30s timeout marks offline
21
- *
22
- * Benefits:
23
- * - Immediate offline on app background
24
- * - 30-second server timeout catches crashes
25
- * - Periodic heartbeat keeps presence accurate
26
- * - Single hook, no duplicate calls
27
- *
28
- * @example
29
- * ```typescript
30
- * // Any ISignalProtocolRelayServer that reports presence.
31
- * const relay = createAuthenticatedRelay({ userId, getAuthToken });
32
- * useConnectionPresence({
33
- * relay,
34
- * deviceId,
35
- * enabled: isSignedIn && !!deviceId,
36
- * });
37
- * ```
38
- */
39
- import type { ISignalProtocolRelayServer } from '../remote/relay/types.js';
40
- import { type ILogger } from '../logger.js';
41
- /**
42
- * Heartbeat interval for presence keep-alive.
43
- * Server has 30-second timeout, so we send heartbeat every 10 seconds
44
- * so we refresh `lastSeen` before the timeout fires.
45
- */
46
- export {};
47
- export interface UseConnectionPresenceOptions {
48
- /** Signal Protocol relay server instance */
49
- relay: ISignalProtocolRelayServer;
50
- /** Current device ID (1-5) */
51
- deviceId: number | null;
52
- /** Enable/disable presence tracking (default: true) */
53
- enabled?: boolean;
54
- /** Optional logger for presence operations */
55
- logger?: ILogger;
56
- }
57
- /**
58
- * Hook that manages device presence via connection state and app lifecycle events.
59
- *
60
- * Combines WebSocket state tracking with AppState tracking for immediate,
61
- * accurate presence updates without duplicate server calls.
62
- *
63
- * Uses single-flighting to prevent request spam during rapid state changes.
64
- */
65
- export declare function useConnectionPresence({ relay, deviceId, enabled, logger: providedLogger, }: UseConnectionPresenceOptions): void;
66
- //# sourceMappingURL=use-connection-presence.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-connection-presence.d.ts","sourceRoot":"","sources":["../../hooks/use-connection-presence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAKH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAA+B,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtE;;;;GAIG;AACH,OAAO,EAAE,CAAC;AAGV,MAAM,WAAW,4BAA4B;IAC3C,4CAA4C;IAC5C,KAAK,EAAE,0BAA0B,CAAC;IAClC,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,OAAc,EACd,MAAM,EAAE,cAAc,GACvB,EAAE,4BAA4B,GAAG,IAAI,CAqSrC"}