@open-e2ee/signal-protocol-sdk 14.0.0 → 14.2.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 (406) hide show
  1. package/ADAPTERS.md +5 -5
  2. package/ARCHITECTURE.md +1 -1
  3. package/CHANGELOG.md +461 -0
  4. package/README.md +21 -15
  5. package/SECURITY.md +2 -2
  6. package/TROUBLESHOOTING.md +1 -1
  7. package/client/README.md +35 -22
  8. package/device/README.md +5 -5
  9. package/dist/client/client.d.ts +44 -34
  10. package/dist/client/client.d.ts.map +1 -1
  11. package/dist/client/client.js +221 -146
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/compose.d.ts +7 -5
  14. package/dist/client/compose.d.ts.map +1 -1
  15. package/dist/client/compose.js +7 -2
  16. package/dist/client/compose.js.map +1 -1
  17. package/dist/client/config.d.ts +23 -14
  18. package/dist/client/config.d.ts.map +1 -1
  19. package/dist/client/config.js.map +1 -1
  20. package/dist/client/content-adapter.d.ts +9 -0
  21. package/dist/client/content-adapter.d.ts.map +1 -1
  22. package/dist/client/content-adapter.js +6 -0
  23. package/dist/client/content-adapter.js.map +1 -1
  24. package/dist/client/delivery-status.d.ts +2 -2
  25. package/dist/client/delivery-status.d.ts.map +1 -1
  26. package/dist/client/delivery-status.js +10 -4
  27. package/dist/client/delivery-status.js.map +1 -1
  28. package/dist/client/device-set-reconciliation.d.ts +24 -16
  29. package/dist/client/device-set-reconciliation.d.ts.map +1 -1
  30. package/dist/client/device-set-reconciliation.js +17 -14
  31. package/dist/client/device-set-reconciliation.js.map +1 -1
  32. package/dist/client/event-hooks.d.ts +22 -7
  33. package/dist/client/event-hooks.d.ts.map +1 -1
  34. package/dist/client/event-hooks.js +35 -5
  35. package/dist/client/event-hooks.js.map +1 -1
  36. package/dist/client/group-device-set.d.ts +1 -1
  37. package/dist/client/group-device-set.d.ts.map +1 -1
  38. package/dist/client/group-key-sync.js +1 -1
  39. package/dist/client/group-key-sync.js.map +1 -1
  40. package/dist/client/group-outbox.d.ts +7 -7
  41. package/dist/client/group-outbox.d.ts.map +1 -1
  42. package/dist/client/group-outbox.js +24 -24
  43. package/dist/client/group-outbox.js.map +1 -1
  44. package/dist/client/group-sealed-sender.d.ts +1 -1
  45. package/dist/client/group-sealed-sender.d.ts.map +1 -1
  46. package/dist/client/group-sender-key-operations.js +1 -1
  47. package/dist/client/group-sender-key-operations.js.map +1 -1
  48. package/dist/client/headless.d.ts +6 -6
  49. package/dist/client/headless.d.ts.map +1 -1
  50. package/dist/client/headless.js +7 -7
  51. package/dist/client/headless.js.map +1 -1
  52. package/dist/client/hosted-anonymous-delivery.d.ts +18 -6
  53. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  54. package/dist/client/hosted-anonymous-delivery.js +63 -20
  55. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  56. package/dist/client/hosted-assertion-id.d.ts +1 -1
  57. package/dist/client/hosted-assertion-id.d.ts.map +1 -1
  58. package/dist/client/hosted-assertion-id.js +1 -1
  59. package/dist/client/hosted-assertion-id.js.map +1 -1
  60. package/dist/client/hosted-connection.d.ts +5 -5
  61. package/dist/client/hosted-connection.d.ts.map +1 -1
  62. package/dist/client/hosted-connection.js +32 -32
  63. package/dist/client/hosted-connection.js.map +1 -1
  64. package/dist/client/hosted-device-link-transport.d.ts +2 -2
  65. package/dist/client/hosted-device-link-transport.d.ts.map +1 -1
  66. package/dist/client/hosted-device-link-transport.js +1 -1
  67. package/dist/client/hosted-device-link-transport.js.map +1 -1
  68. package/dist/client/hosted-device-link.d.ts +5 -1
  69. package/dist/client/hosted-device-link.d.ts.map +1 -1
  70. package/dist/client/hosted-device-link.js +7 -4
  71. package/dist/client/hosted-device-link.js.map +1 -1
  72. package/dist/client/hosted-device-standing.d.ts +13 -5
  73. package/dist/client/hosted-device-standing.d.ts.map +1 -1
  74. package/dist/client/hosted-device-standing.js +11 -6
  75. package/dist/client/hosted-device-standing.js.map +1 -1
  76. package/dist/client/hosted-group-authority.d.ts +2 -2
  77. package/dist/client/hosted-group-authority.d.ts.map +1 -1
  78. package/dist/client/hosted-group-authority.js +8 -8
  79. package/dist/client/hosted-group-authority.js.map +1 -1
  80. package/dist/client/hosted-groups.d.ts +4 -4
  81. package/dist/client/hosted-groups.d.ts.map +1 -1
  82. package/dist/client/hosted-groups.js +8 -8
  83. package/dist/client/hosted-groups.js.map +1 -1
  84. package/dist/client/hosted-http-error.d.ts +8 -4
  85. package/dist/client/hosted-http-error.d.ts.map +1 -1
  86. package/dist/client/hosted-http-error.js +7 -4
  87. package/dist/client/hosted-http-error.js.map +1 -1
  88. package/dist/client/hosted-mailbox-subscription.d.ts +16 -15
  89. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
  90. package/dist/client/hosted-mailbox-subscription.js +21 -25
  91. package/dist/client/hosted-mailbox-subscription.js.map +1 -1
  92. package/dist/client/hosted-prekey-publication.d.ts +9 -9
  93. package/dist/client/hosted-prekey-publication.d.ts.map +1 -1
  94. package/dist/client/hosted-prekey-publication.js.map +1 -1
  95. package/dist/client/hosted-presence-frames.d.ts +62 -38
  96. package/dist/client/hosted-presence-frames.d.ts.map +1 -1
  97. package/dist/client/hosted-presence-frames.js +4 -2
  98. package/dist/client/hosted-presence-frames.js.map +1 -1
  99. package/dist/client/hosted-presence.d.ts +22 -14
  100. package/dist/client/hosted-presence.d.ts.map +1 -1
  101. package/dist/client/hosted-presence.js +26 -17
  102. package/dist/client/hosted-presence.js.map +1 -1
  103. package/dist/client/hosted-profile-keys.d.ts +3 -1
  104. package/dist/client/hosted-profile-keys.d.ts.map +1 -1
  105. package/dist/client/hosted-profile-keys.js +19 -15
  106. package/dist/client/hosted-profile-keys.js.map +1 -1
  107. package/dist/client/hosted-push.d.ts +38 -16
  108. package/dist/client/hosted-push.d.ts.map +1 -1
  109. package/dist/client/hosted-push.js +11 -5
  110. package/dist/client/hosted-push.js.map +1 -1
  111. package/dist/client/hosted-resume-error.d.ts +21 -9
  112. package/dist/client/hosted-resume-error.d.ts.map +1 -1
  113. package/dist/client/hosted-resume-error.js +4 -1
  114. package/dist/client/hosted-resume-error.js.map +1 -1
  115. package/dist/client/hosted-resume.d.ts +3 -3
  116. package/dist/client/hosted-resume.d.ts.map +1 -1
  117. package/dist/client/hosted-resume.js +12 -12
  118. package/dist/client/hosted-resume.js.map +1 -1
  119. package/dist/client/hosted-sandbox-identity.d.ts +82 -5
  120. package/dist/client/hosted-sandbox-identity.d.ts.map +1 -1
  121. package/dist/client/hosted-sandbox-identity.js +160 -50
  122. package/dist/client/hosted-sandbox-identity.js.map +1 -1
  123. package/dist/client/hosted-store-records.d.ts +46 -0
  124. package/dist/client/hosted-store-records.d.ts.map +1 -0
  125. package/dist/client/hosted-store-records.js +32 -0
  126. package/dist/client/hosted-store-records.js.map +1 -0
  127. package/dist/client/hosted-transport.d.ts +53 -33
  128. package/dist/client/hosted-transport.d.ts.map +1 -1
  129. package/dist/client/hosted-transport.js +225 -138
  130. package/dist/client/hosted-transport.js.map +1 -1
  131. package/dist/client/hosted-trust.d.ts +1 -1
  132. package/dist/client/hosted-trust.d.ts.map +1 -1
  133. package/dist/client/hosted-trust.js +1 -1
  134. package/dist/client/hosted-trust.js.map +1 -1
  135. package/dist/client/hosted.d.ts +144 -75
  136. package/dist/client/hosted.d.ts.map +1 -1
  137. package/dist/client/hosted.js +106 -61
  138. package/dist/client/hosted.js.map +1 -1
  139. package/dist/client/index.d.ts +4 -4
  140. package/dist/client/index.d.ts.map +1 -1
  141. package/dist/client/index.js +4 -4
  142. package/dist/client/index.js.map +1 -1
  143. package/dist/client/key-rotation-core.d.ts +4 -4
  144. package/dist/client/key-rotation-core.d.ts.map +1 -1
  145. package/dist/client/key-rotation-core.js +8 -8
  146. package/dist/client/key-rotation-core.js.map +1 -1
  147. package/dist/client/key-rotation.js +2 -2
  148. package/dist/client/key-rotation.js.map +1 -1
  149. package/dist/client/messages.d.ts +3 -3
  150. package/dist/client/messages.d.ts.map +1 -1
  151. package/dist/client/messages.js +18 -18
  152. package/dist/client/messages.js.map +1 -1
  153. package/dist/client/one-time-prekey-refill.d.ts +1 -1
  154. package/dist/client/one-time-prekey-refill.d.ts.map +1 -1
  155. package/dist/client/prekeys.js +17 -17
  156. package/dist/client/prekeys.js.map +1 -1
  157. package/dist/client/receive-queue.d.ts +4 -4
  158. package/dist/client/receive-queue.d.ts.map +1 -1
  159. package/dist/client/receive-queue.js +29 -29
  160. package/dist/client/receive-queue.js.map +1 -1
  161. package/dist/client/receive-work-seed.d.ts +6 -2
  162. package/dist/client/receive-work-seed.d.ts.map +1 -1
  163. package/dist/client/receive-work-seed.js.map +1 -1
  164. package/dist/client/recovery-driver.js +7 -7
  165. package/dist/client/recovery-driver.js.map +1 -1
  166. package/dist/client/retry-request-envelope.d.ts +3 -3
  167. package/dist/client/retry-request-envelope.d.ts.map +1 -1
  168. package/dist/client/retry-request-envelope.js +10 -10
  169. package/dist/client/retry-request-envelope.js.map +1 -1
  170. package/dist/client/retry-request-lifecycle.d.ts +1 -1
  171. package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
  172. package/dist/client/retry-request-lifecycle.js +8 -8
  173. package/dist/client/retry-request-lifecycle.js.map +1 -1
  174. package/dist/client/retry-terminal-recovery.js +2 -2
  175. package/dist/client/retry-terminal-recovery.js.map +1 -1
  176. package/dist/client/retry.js +13 -13
  177. package/dist/client/retry.js.map +1 -1
  178. package/dist/client/sealed-sender.d.ts +13 -4
  179. package/dist/client/sealed-sender.d.ts.map +1 -1
  180. package/dist/client/sealed-sender.js +27 -15
  181. package/dist/client/sealed-sender.js.map +1 -1
  182. package/dist/client/send-deadline.d.ts +8 -7
  183. package/dist/client/send-deadline.d.ts.map +1 -1
  184. package/dist/client/send-deadline.js +41 -23
  185. package/dist/client/send-deadline.js.map +1 -1
  186. package/dist/client/send-intent-driver.js +9 -9
  187. package/dist/client/send-intent-driver.js.map +1 -1
  188. package/dist/client/sessions.js +11 -11
  189. package/dist/client/sessions.js.map +1 -1
  190. package/dist/client/{relay-acceptance.d.ts → signal-relay-acceptance.d.ts} +9 -9
  191. package/dist/client/signal-relay-acceptance.d.ts.map +1 -0
  192. package/dist/client/{relay-acceptance.js → signal-relay-acceptance.js} +7 -7
  193. package/dist/client/signal-relay-acceptance.js.map +1 -0
  194. package/dist/client/{relay-device-refusal.d.ts → signal-relay-device-refusal.d.ts} +7 -7
  195. package/dist/client/signal-relay-device-refusal.d.ts.map +1 -0
  196. package/dist/client/{relay-device-refusal.js → signal-relay-device-refusal.js} +9 -9
  197. package/dist/client/signal-relay-device-refusal.js.map +1 -0
  198. package/dist/client/{relay-lifecycle.d.ts → signal-relay-lifecycle.d.ts} +21 -11
  199. package/dist/client/signal-relay-lifecycle.d.ts.map +1 -0
  200. package/dist/client/{relay-lifecycle.js → signal-relay-lifecycle.js} +19 -9
  201. package/dist/client/signal-relay-lifecycle.js.map +1 -0
  202. package/dist/client/signal-relay-period-close.d.ts +35 -0
  203. package/dist/client/signal-relay-period-close.d.ts.map +1 -0
  204. package/dist/client/signal-relay-period-close.js +63 -0
  205. package/dist/client/signal-relay-period-close.js.map +1 -0
  206. package/dist/client/{relay-protocol.d.ts → signal-relay-protocol.d.ts} +12 -8
  207. package/dist/client/signal-relay-protocol.d.ts.map +1 -0
  208. package/dist/client/{relay-protocol.js → signal-relay-protocol.js} +13 -10
  209. package/dist/client/signal-relay-protocol.js.map +1 -0
  210. package/dist/client/{relay-receipt-intake.d.ts → signal-relay-receipt-intake.d.ts} +12 -12
  211. package/dist/client/signal-relay-receipt-intake.d.ts.map +1 -0
  212. package/dist/client/{relay-receipt-intake.js → signal-relay-receipt-intake.js} +9 -9
  213. package/dist/client/signal-relay-receipt-intake.js.map +1 -0
  214. package/dist/client/{relay-receipt-join.d.ts → signal-relay-receipt-join.d.ts} +8 -8
  215. package/dist/client/signal-relay-receipt-join.d.ts.map +1 -0
  216. package/dist/client/{relay-receipt-join.js → signal-relay-receipt-join.js} +11 -11
  217. package/dist/client/signal-relay-receipt-join.js.map +1 -0
  218. package/dist/client/{relay-request-deadline.d.ts → signal-relay-request-deadline.d.ts} +3 -3
  219. package/dist/client/signal-relay-request-deadline.d.ts.map +1 -0
  220. package/dist/client/{relay-request-deadline.js → signal-relay-request-deadline.js} +4 -4
  221. package/dist/client/signal-relay-request-deadline.js.map +1 -0
  222. package/dist/client/{relay-sealed-route.d.ts → signal-relay-sealed-route.d.ts} +1 -1
  223. package/dist/client/signal-relay-sealed-route.d.ts.map +1 -0
  224. package/dist/client/{relay-sealed-route.js → signal-relay-sealed-route.js} +1 -1
  225. package/dist/client/signal-relay-sealed-route.js.map +1 -0
  226. package/dist/client/{relay-subscription.d.ts → signal-relay-subscription.d.ts} +12 -12
  227. package/dist/client/signal-relay-subscription.d.ts.map +1 -0
  228. package/dist/client/{relay-subscription.js → signal-relay-subscription.js} +23 -23
  229. package/dist/client/signal-relay-subscription.js.map +1 -0
  230. package/dist/client/{relay-work.d.ts → signal-relay-work.d.ts} +7 -7
  231. package/dist/client/signal-relay-work.d.ts.map +1 -0
  232. package/dist/client/{relay-work.js → signal-relay-work.js} +13 -13
  233. package/dist/client/signal-relay-work.js.map +1 -0
  234. package/dist/client/signal-service-cipher.d.ts +11 -9
  235. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  236. package/dist/client/signal-service-cipher.js +103 -98
  237. package/dist/client/signal-service-cipher.js.map +1 -1
  238. package/dist/client/state.d.ts +4 -4
  239. package/dist/client/state.d.ts.map +1 -1
  240. package/dist/client/state.js +3 -3
  241. package/dist/client/state.js.map +1 -1
  242. package/dist/client/types.d.ts +13 -4
  243. package/dist/client/types.d.ts.map +1 -1
  244. package/dist/client/types.js.map +1 -1
  245. package/dist/device/connection.d.ts +10 -4
  246. package/dist/device/connection.d.ts.map +1 -1
  247. package/dist/device/connection.js +8 -3
  248. package/dist/device/connection.js.map +1 -1
  249. package/dist/device/index.d.ts +2 -2
  250. package/dist/device/index.d.ts.map +1 -1
  251. package/dist/device/index.js +1 -1
  252. package/dist/device/index.js.map +1 -1
  253. package/dist/device/types.d.ts +3 -1
  254. package/dist/device/types.d.ts.map +1 -1
  255. package/dist/hooks/index.d.ts +2 -2
  256. package/dist/hooks/index.d.ts.map +1 -1
  257. package/dist/hooks/index.js +2 -2
  258. package/dist/hooks/index.js.map +1 -1
  259. package/dist/hooks/use-signal-relay-connection-state.d.ts +40 -0
  260. package/dist/hooks/use-signal-relay-connection-state.d.ts.map +1 -0
  261. package/dist/hooks/use-signal-relay-connection-state.js +45 -0
  262. package/dist/hooks/use-signal-relay-connection-state.js.map +1 -0
  263. package/dist/hooks/use-signal-relay-lifecycle.d.ts +43 -0
  264. package/dist/hooks/use-signal-relay-lifecycle.d.ts.map +1 -0
  265. package/dist/hooks/use-signal-relay-lifecycle.js +38 -0
  266. package/dist/hooks/use-signal-relay-lifecycle.js.map +1 -0
  267. package/dist/index.d.ts +18 -12
  268. package/dist/index.d.ts.map +1 -1
  269. package/dist/index.js +5 -5
  270. package/dist/index.js.map +1 -1
  271. package/dist/internal/groups/authority-certificate.d.ts +7 -1
  272. package/dist/internal/groups/authority-certificate.d.ts.map +1 -1
  273. package/dist/internal/groups/authority-certificate.js +29 -6
  274. package/dist/internal/groups/authority-certificate.js.map +1 -1
  275. package/dist/internal/protocol/sealed-sender/certificate.js +2 -2
  276. package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
  277. package/dist/internal/protocol/sealed-sender/proto/index.d.ts +1 -1
  278. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  279. package/dist/internal/protocol/sealed-sender/proto/index.js +5 -5
  280. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  281. package/dist/internal/sesame/device-registry.d.ts +13 -13
  282. package/dist/internal/sesame/device-registry.d.ts.map +1 -1
  283. package/dist/internal/sesame/device-registry.js +20 -20
  284. package/dist/internal/sesame/device-registry.js.map +1 -1
  285. package/dist/local/store/receive-work.d.ts +29 -0
  286. package/dist/local/store/receive-work.d.ts.map +1 -1
  287. package/dist/local/store/receive-work.js +58 -1
  288. package/dist/local/store/receive-work.js.map +1 -1
  289. package/dist/local/store/received-content.d.ts +1 -1
  290. package/dist/local/store/received-content.d.ts.map +1 -1
  291. package/dist/local/store/reliability.d.ts +11 -3
  292. package/dist/local/store/reliability.d.ts.map +1 -1
  293. package/dist/local/store/reliability.js +4 -0
  294. package/dist/local/store/reliability.js.map +1 -1
  295. package/dist/local/store/sqlite/key-storage/index.d.ts +3 -9
  296. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
  297. package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
  298. package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts +1 -7
  299. package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts.map +1 -1
  300. package/dist/local/store/sqlite/key-storage/signed-prekeys.js.map +1 -1
  301. package/dist/local/store/sqlite/models/kyber-prekey.d.ts +4 -9
  302. package/dist/local/store/sqlite/models/kyber-prekey.d.ts.map +1 -1
  303. package/dist/local/store/sqlite/models/kyber-prekey.js +4 -1
  304. package/dist/local/store/sqlite/models/kyber-prekey.js.map +1 -1
  305. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  306. package/dist/local/store/sqlite/store.js +1 -2
  307. package/dist/local/store/sqlite/store.js.map +1 -1
  308. package/dist/remote/signal-relay/connection-state.d.ts +16 -0
  309. package/dist/remote/signal-relay/connection-state.d.ts.map +1 -0
  310. package/dist/remote/{relay → signal-relay}/connection-state.js +1 -1
  311. package/dist/remote/signal-relay/connection-state.js.map +1 -0
  312. package/dist/remote/{relay → signal-relay}/device-set.d.ts +3 -3
  313. package/dist/remote/signal-relay/device-set.d.ts.map +1 -0
  314. package/dist/remote/{relay → signal-relay}/device-set.js +7 -7
  315. package/dist/remote/signal-relay/device-set.js.map +1 -0
  316. package/dist/remote/{relay → signal-relay}/index.d.ts +3 -3
  317. package/dist/remote/signal-relay/index.d.ts.map +1 -0
  318. package/dist/remote/{relay → signal-relay}/index.js +2 -2
  319. package/dist/remote/signal-relay/index.js.map +1 -0
  320. package/dist/remote/{relay → signal-relay}/request-admission.d.ts +7 -5
  321. package/dist/remote/signal-relay/request-admission.d.ts.map +1 -0
  322. package/dist/remote/{relay → signal-relay}/request-admission.js +7 -6
  323. package/dist/remote/signal-relay/request-admission.js.map +1 -0
  324. package/dist/remote/{relay → signal-relay}/types.d.ts +30 -12
  325. package/dist/remote/signal-relay/types.d.ts.map +1 -0
  326. package/dist/remote/{relay → signal-relay}/types.js +1 -1
  327. package/dist/remote/signal-relay/types.js.map +1 -0
  328. package/dist/safety/core.d.ts +1 -1
  329. package/dist/safety/core.js +1 -1
  330. package/dist/types/api.d.ts +43 -20
  331. package/dist/types/api.d.ts.map +1 -1
  332. package/dist/types/errors.d.ts +55 -7
  333. package/dist/types/errors.d.ts.map +1 -1
  334. package/dist/types/errors.js +61 -8
  335. package/dist/types/errors.js.map +1 -1
  336. package/dist/types/renamed-member.d.ts +41 -0
  337. package/dist/types/renamed-member.d.ts.map +1 -0
  338. package/dist/types/renamed-member.js +73 -0
  339. package/dist/types/renamed-member.js.map +1 -0
  340. package/dist/utils/bounded-fan-out.d.ts +2 -2
  341. package/dist/utils/bounded-fan-out.d.ts.map +1 -1
  342. package/dist/utils/bounded-fan-out.js +2 -2
  343. package/dist/utils/bounded-fan-out.js.map +1 -1
  344. package/dist/utils/retry.d.ts +3 -3
  345. package/dist/utils/retry.d.ts.map +1 -1
  346. package/dist/utils/retry.js +4 -3
  347. package/dist/utils/retry.js.map +1 -1
  348. package/docs/ASSURANCE.md +8 -8
  349. package/docs/CLIENT_COMPOSITION.md +11 -7
  350. package/docs/DEVIATIONS.md +58 -8
  351. package/docs/ERROR_HANDLING.md +24 -24
  352. package/docs/GETTING_STARTED.md +25 -16
  353. package/docs/INTERFACES.md +5 -5
  354. package/docs/PACKAGE_SURFACE.md +14 -4
  355. package/docs/PROTOCOL_POLICY.md +4 -4
  356. package/docs/RECIPES.md +274 -15
  357. package/hooks/README.md +11 -11
  358. package/local/store/expo/README.md +1 -1
  359. package/local/store/key-value/README.md +2 -2
  360. package/local/store/node/README.md +1 -1
  361. package/local/store/react-native/README.md +1 -1
  362. package/local/store/web/README.md +1 -1
  363. package/local/store/web-sqlite/README.md +2 -2
  364. package/package.json +22 -7
  365. package/remote/README.md +4 -4
  366. package/remote/object-store/convex-r2/README.md +1 -1
  367. package/remote/{relay → signal-relay}/README.md +16 -6
  368. package/dist/client/relay-acceptance.d.ts.map +0 -1
  369. package/dist/client/relay-acceptance.js.map +0 -1
  370. package/dist/client/relay-device-refusal.d.ts.map +0 -1
  371. package/dist/client/relay-device-refusal.js.map +0 -1
  372. package/dist/client/relay-lifecycle.d.ts.map +0 -1
  373. package/dist/client/relay-lifecycle.js.map +0 -1
  374. package/dist/client/relay-protocol.d.ts.map +0 -1
  375. package/dist/client/relay-protocol.js.map +0 -1
  376. package/dist/client/relay-receipt-intake.d.ts.map +0 -1
  377. package/dist/client/relay-receipt-intake.js.map +0 -1
  378. package/dist/client/relay-receipt-join.d.ts.map +0 -1
  379. package/dist/client/relay-receipt-join.js.map +0 -1
  380. package/dist/client/relay-request-deadline.d.ts.map +0 -1
  381. package/dist/client/relay-request-deadline.js.map +0 -1
  382. package/dist/client/relay-sealed-route.d.ts.map +0 -1
  383. package/dist/client/relay-sealed-route.js.map +0 -1
  384. package/dist/client/relay-subscription.d.ts.map +0 -1
  385. package/dist/client/relay-subscription.js.map +0 -1
  386. package/dist/client/relay-work.d.ts.map +0 -1
  387. package/dist/client/relay-work.js.map +0 -1
  388. package/dist/hooks/use-relay-connection-state.d.ts +0 -32
  389. package/dist/hooks/use-relay-connection-state.d.ts.map +0 -1
  390. package/dist/hooks/use-relay-connection-state.js +0 -31
  391. package/dist/hooks/use-relay-connection-state.js.map +0 -1
  392. package/dist/hooks/use-relay-lifecycle.d.ts +0 -36
  393. package/dist/hooks/use-relay-lifecycle.d.ts.map +0 -1
  394. package/dist/hooks/use-relay-lifecycle.js +0 -35
  395. package/dist/hooks/use-relay-lifecycle.js.map +0 -1
  396. package/dist/remote/relay/connection-state.d.ts +0 -16
  397. package/dist/remote/relay/connection-state.d.ts.map +0 -1
  398. package/dist/remote/relay/connection-state.js.map +0 -1
  399. package/dist/remote/relay/device-set.d.ts.map +0 -1
  400. package/dist/remote/relay/device-set.js.map +0 -1
  401. package/dist/remote/relay/index.d.ts.map +0 -1
  402. package/dist/remote/relay/index.js.map +0 -1
  403. package/dist/remote/relay/request-admission.d.ts.map +0 -1
  404. package/dist/remote/relay/request-admission.js.map +0 -1
  405. package/dist/remote/relay/types.d.ts.map +0 -1
  406. package/dist/remote/relay/types.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { relayAnswerVersion } from './relay-protocol.js';
1
+ import { signalRelayAnswerVersion } from './signal-relay-protocol.js';
2
2
  /**
3
3
  * The acceptance of a whole send from the acceptance of each of its posts.
4
4
  *
@@ -8,7 +8,7 @@ import { relayAnswerVersion } from './relay-protocol.js';
8
8
  * The device-set marks are not part of the aggregate. The device-set
9
9
  * reconciliation reads them from each post.
10
10
  */
11
- export function aggregateRelayAcceptance(posts) {
11
+ export function aggregateSignalProtocolRelayAcceptance(posts) {
12
12
  if (posts.length === 0)
13
13
  return {};
14
14
  const duplicates = posts.map((post) => post.duplicate);
@@ -52,13 +52,13 @@ export function sendResultAcceptance(acceptances) {
52
52
  * the error as the answer to a request of protocol version 2 or later. An
53
53
  * unmarked error and a version 1 answer carry it as an unknown code.
54
54
  */
55
- export function relayOperationRefusal(error) {
55
+ export function signalRelayOperationRefusal(error) {
56
56
  if (error === null || typeof error !== 'object')
57
57
  return undefined;
58
58
  const { code } = error;
59
59
  if (code === 'OPERATION_EXPIRED' || code === 'RETRY_CONFLICT')
60
60
  return code;
61
- if (code === 'DELIVERY_ALREADY_ACCEPTED' && (relayAnswerVersion(error) ?? 1) >= 2) {
61
+ if (code === 'DELIVERY_ALREADY_ACCEPTED' && (signalRelayAnswerVersion(error) ?? 1) >= 2) {
62
62
  return code;
63
63
  }
64
64
  return undefined;
@@ -68,8 +68,8 @@ export function relayOperationRefusal(error) {
68
68
  * message ID of the post: RETRY_CONFLICT, or DELIVERY_ALREADY_ACCEPTED under
69
69
  * protocol version 2. A post reads both answers in the same way.
70
70
  */
71
- export function relayHoldsMessageId(error) {
72
- const refusal = relayOperationRefusal(error);
71
+ export function signalRelayHoldsMessageId(error) {
72
+ const refusal = signalRelayOperationRefusal(error);
73
73
  return refusal === 'RETRY_CONFLICT' || refusal === 'DELIVERY_ALREADY_ACCEPTED';
74
74
  }
75
75
  /**
@@ -127,4 +127,4 @@ export function classifyRetryRequestPostFailure(error) {
127
127
  return { terminal: 'revoked-authority' };
128
128
  return { retry: 'transport-outage' };
129
129
  }
130
- //# sourceMappingURL=relay-acceptance.js.map
130
+ //# sourceMappingURL=signal-relay-acceptance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-acceptance.js","sourceRoot":"","sources":["../../client/signal-relay-acceptance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAgBnE;;;;;;;;GAQG;AACH,MAAM,UAAU,sCAAsC,CACpD,KAAoF;IAEpF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO;QACL,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI;YAC9D,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC;SACrC,CAAC;QACF,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC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,CAAC;IACpC,CAAC;IACD,IAAI,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAC3C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC1D,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IACpD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAC/E,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;AACvC,CAAC"}
@@ -15,20 +15,20 @@
15
15
  * @internal
16
16
  */
17
17
  /** The device that a relay refused, and why. */
18
- export interface RelayDeviceRefusal {
18
+ export interface SignalProtocolRelayDeviceRefusal {
19
19
  /** NOT_FOUND: the device's mailbox is gone. STALE_DEVICE: its registration changed. */
20
- readonly code: RelayDeviceRefusalCode;
20
+ readonly code: SignalProtocolRelayDeviceRefusalCode;
21
21
  readonly userId: string;
22
22
  readonly deviceId: number;
23
23
  }
24
24
  /** Declare that this relay refuses every post to a removed device's mailbox. */
25
- export declare function declareRefusesRemovedDevices(relay: object): void;
25
+ export declare function declareRefusesRemovedDevices(signalProtocolRelay: object): void;
26
26
  /** True only for the relay object that declared itself. A wrapper is not declared. */
27
- export declare function refusesRemovedDevices(relay: object): boolean;
27
+ export declare function refusesRemovedDevices(signalProtocolRelay: object): boolean;
28
28
  /** Mark an error as the relay's refusal of one device. Returns the same error. */
29
- export declare function markRelayDeviceRefusal<T extends Error>(error: T, refusal: RelayDeviceRefusal): T;
29
+ export declare function markSignalProtocolRelayDeviceRefusal<T extends Error>(error: T, refusal: SignalProtocolRelayDeviceRefusal): T;
30
30
  /** The refusal that a relay marked on this error, if any. */
31
- export declare function relayDeviceRefusal(error: unknown): RelayDeviceRefusal | undefined;
31
+ export declare function signalRelayDeviceRefusal(error: unknown): SignalProtocolRelayDeviceRefusal | undefined;
32
32
  /**
33
33
  * True when the relay refused one direct post because the registration of
34
34
  * its device changed: a marked `STALE_DEVICE` refusal, or a relay error whose
@@ -47,4 +47,4 @@ export declare class StaleSessionRefreshError extends Error {
47
47
  readonly name = "StaleSessionRefreshError";
48
48
  constructor(userId: string, deviceId: number, cause: unknown);
49
49
  }
50
- //# sourceMappingURL=relay-device-refusal.d.ts.map
50
+ //# sourceMappingURL=signal-relay-device-refusal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-device-refusal.d.ts","sourceRoot":"","sources":["../../client/signal-relay-device-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,gDAAgD;AAChD,MAAM,WAAW,gCAAgC;IAC/C,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,oCAAoC,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAKD,gFAAgF;AAChF,wBAAgB,4BAA4B,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAE9E;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,kFAAkF;AAClF,wBAAgB,oCAAoC,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,gCAAgC,GAAG,CAAC,CAG5H;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gCAAgC,GAAG,SAAS,CAErG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS5D;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAI/C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAJ3B,SAAkB,IAAI,8BAA8B;IAEpD,YACW,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EACzB,KAAK,EAAE,OAAO,EAGf;CACF"}
@@ -14,23 +14,23 @@
14
14
  *
15
15
  * @internal
16
16
  */
17
- const refusingRelays = new WeakSet();
17
+ const refusingSignalProtocolRelays = new WeakSet();
18
18
  const refusals = new WeakMap();
19
19
  /** Declare that this relay refuses every post to a removed device's mailbox. */
20
- export function declareRefusesRemovedDevices(relay) {
21
- refusingRelays.add(relay);
20
+ export function declareRefusesRemovedDevices(signalProtocolRelay) {
21
+ refusingSignalProtocolRelays.add(signalProtocolRelay);
22
22
  }
23
23
  /** True only for the relay object that declared itself. A wrapper is not declared. */
24
- export function refusesRemovedDevices(relay) {
25
- return refusingRelays.has(relay);
24
+ export function refusesRemovedDevices(signalProtocolRelay) {
25
+ return refusingSignalProtocolRelays.has(signalProtocolRelay);
26
26
  }
27
27
  /** Mark an error as the relay's refusal of one device. Returns the same error. */
28
- export function markRelayDeviceRefusal(error, refusal) {
28
+ export function markSignalProtocolRelayDeviceRefusal(error, refusal) {
29
29
  refusals.set(error, { ...refusal });
30
30
  return error;
31
31
  }
32
32
  /** The refusal that a relay marked on this error, if any. */
33
- export function relayDeviceRefusal(error) {
33
+ export function signalRelayDeviceRefusal(error) {
34
34
  return error !== null && typeof error === 'object' ? refusals.get(error) : undefined;
35
35
  }
36
36
  /**
@@ -39,7 +39,7 @@ export function relayDeviceRefusal(error) {
39
39
  * data names `STALE_DEVICE`.
40
40
  */
41
41
  export function isStaleDeviceRefusal(error) {
42
- if (relayDeviceRefusal(error)?.code === 'STALE_DEVICE')
42
+ if (signalRelayDeviceRefusal(error)?.code === 'STALE_DEVICE')
43
43
  return true;
44
44
  if (error === null || typeof error !== 'object' || !('data' in error))
45
45
  return false;
@@ -64,4 +64,4 @@ export class StaleSessionRefreshError extends Error {
64
64
  this.deviceId = deviceId;
65
65
  }
66
66
  }
67
- //# sourceMappingURL=relay-device-refusal.js.map
67
+ //# sourceMappingURL=signal-relay-device-refusal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-device-refusal.js","sourceRoot":"","sources":["../../client/signal-relay-device-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,MAAM,4BAA4B,GAAG,IAAI,OAAO,EAAU,CAAC;AAC3D,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA4C,CAAC;AAEzE,gFAAgF;AAChF,MAAM,UAAU,4BAA4B,CAAC,mBAA2B;IACtE,4BAA4B,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACxD,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,qBAAqB,CAAC,mBAA2B;IAC/D,OAAO,4BAA4B,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAC/D,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,oCAAoC,CAAkB,KAAQ,EAAE,OAAyC;IACvH,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,IAAI,wBAAwB,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,cAAc;QAAE,OAAO,IAAI,CAAC;IAC1E,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpF,MAAM,EAAE,IAAI,EAAE,GAAG,KAA0B,CAAC;IAC5C,OAAO,CACL,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACvB,IAA2B,CAAC,IAAI,KAAK,cAAc,CACrD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAItC,MAAM;IACN,QAAQ;IAJD,IAAI,GAAG,0BAA0B,CAAC;IAEpD,YACW,MAAc,EACd,QAAgB,EACzB,KAAc;QAEd,KAAK,CAAC,iCAAiC,QAAQ,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;sBAJ5D,MAAM;wBACN,QAAQ;IAInB,CAAC;CACF"}
@@ -1,12 +1,12 @@
1
- import type { Unsubscribe } from '../remote/relay/types.js';
1
+ import type { Unsubscribe } from '../remote/signal-relay/types.js';
2
2
  import type { SignalProtocolClient } from '../types/api.js';
3
3
  /**
4
- * The part of an app state source that `bindRelayLifecycle` reads.
4
+ * The part of an app state source that `bindSignalProtocolRelayLifecycle` reads.
5
5
  *
6
6
  * React Native's `AppState` satisfies it. The client entry does not import
7
7
  * react-native, so any source with this shape can drive the binding.
8
8
  */
9
- export interface RelayLifecycleAppState {
9
+ export interface SignalProtocolRelayLifecycleAppState {
10
10
  /**
11
11
  * The state at bind time, for example `active` or `background`. React
12
12
  * Native reports `null` when its native AppState module is not available.
@@ -18,8 +18,8 @@ export interface RelayLifecycleAppState {
18
18
  remove(): void;
19
19
  } | (() => void);
20
20
  }
21
- /** Options for `bindRelayLifecycle`. */
22
- export interface RelayLifecycleOptions {
21
+ /** Options for `bindSignalProtocolRelayLifecycle`. */
22
+ export interface SignalProtocolRelayLifecycleOptions {
23
23
  /**
24
24
  * Keep the relay socket open in the background, for example while an Android
25
25
  * foreground service runs. The binding then does nothing. Default: `false`.
@@ -30,9 +30,9 @@ export interface RelayLifecycleOptions {
30
30
  * Stops the relay subscription when the app goes to the background and starts
31
31
  * it again when the app becomes active.
32
32
  *
33
- * - `background` calls `stopRelaySubscription()`, which closes the socket with
33
+ * - `background` calls `stopSignalProtocolRelaySubscription()`, which closes the socket with
34
34
  * code 1000. The Relay records a client close.
35
- * - `active` calls `startRelaySubscription()`, but only after a stop that this
35
+ * - `active` calls `startSignalProtocolRelaySubscription()`, but only after a stop that this
36
36
  * binding made. The Relay replays retained messages over the new socket.
37
37
  * - `inactive` and other states change nothing. There is no grace delay.
38
38
  * - A subscription that is `stopped` stays stopped, so an app stop is kept.
@@ -41,6 +41,10 @@ export interface RelayLifecycleOptions {
41
41
  * Call the returned function before `stop()` on the client. It removes the
42
42
  * listener and does not start or stop the subscription.
43
43
  *
44
+ * An object that has only the deprecated member names, such as
45
+ * `stopRelaySubscription()`, also drives the binding. The binding reads each
46
+ * new name first.
47
+ *
44
48
  * @param signal - The Signal Protocol client
45
49
  * @param appState - React Native's `AppState`, or an object of the same shape
46
50
  * @param options - Binding options
@@ -49,13 +53,19 @@ export interface RelayLifecycleOptions {
49
53
  * @example
50
54
  * ```typescript
51
55
  * import { AppState } from 'react-native';
52
- * import { bindRelayLifecycle } from '@open-e2ee/signal-protocol-sdk/client';
56
+ * import { bindSignalProtocolRelayLifecycle } from '@open-e2ee/signal-protocol-sdk/client';
53
57
  *
54
- * const unbind = bindRelayLifecycle(signal, AppState);
58
+ * const unbind = bindSignalProtocolRelayLifecycle(signal, AppState);
55
59
  * // At sign-out:
56
60
  * unbind();
57
61
  * await signal.stop();
58
62
  * ```
59
63
  */
60
- export declare function bindRelayLifecycle(signal: Pick<SignalProtocolClient, 'relayConnectionState' | 'startRelaySubscription' | 'stopRelaySubscription'>, appState: RelayLifecycleAppState, { keepOpenInBackground }?: RelayLifecycleOptions): Unsubscribe;
61
- //# sourceMappingURL=relay-lifecycle.d.ts.map
64
+ export declare function bindSignalProtocolRelayLifecycle(signal: Pick<SignalProtocolClient, 'signalProtocolRelayConnectionState' | 'startSignalProtocolRelaySubscription' | 'stopSignalProtocolRelaySubscription'> | Pick<SignalProtocolClient, 'relayConnectionState' | 'startRelaySubscription' | 'stopRelaySubscription'>, appState: SignalProtocolRelayLifecycleAppState, { keepOpenInBackground }?: SignalProtocolRelayLifecycleOptions): Unsubscribe;
65
+ /** @deprecated Use `bindSignalProtocolRelayLifecycle`. SDK 15.0.0 removes this name. */
66
+ export declare const bindRelayLifecycle: typeof bindSignalProtocolRelayLifecycle;
67
+ /** @deprecated Use `SignalProtocolRelayLifecycleAppState`. SDK 15.0.0 removes this name. */
68
+ export type RelayLifecycleAppState = SignalProtocolRelayLifecycleAppState;
69
+ /** @deprecated Use `SignalProtocolRelayLifecycleOptions`. SDK 15.0.0 removes this name. */
70
+ export type RelayLifecycleOptions = SignalProtocolRelayLifecycleOptions;
71
+ //# sourceMappingURL=signal-relay-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-lifecycle.d.ts","sourceRoot":"","sources":["../../client/signal-relay-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,uFAAuF;IACvF,gBAAgB,CACd,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAChC;QAAE,MAAM,IAAI,IAAI,CAAA;KAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;CACtC;AAED,sDAAsD;AACtD,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EACF,IAAI,CACF,oBAAoB,EAClB,oCAAoC,GACpC,sCAAsC,GACtC,qCAAqC,CACxC,GACD,IAAI,CACF,oBAAoB,EACpB,sBAAsB,GAAG,wBAAwB,GAAG,uBAAuB,CAC5E,EACL,QAAQ,EAAE,oCAAoC,EAC9C,EAAE,oBAA4B,EAAE,GAAE,mCAAwC,GACzE,WAAW,CA8Cb;AAGD,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,yCAAmC,CAAC;AACnE,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,oCAAoC,CAAC;AAC1E,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG,mCAAmC,CAAC"}
@@ -1,10 +1,11 @@
1
+ import { readRenamedImplementation } from '../types/renamed-member.js';
1
2
  /**
2
3
  * Stops the relay subscription when the app goes to the background and starts
3
4
  * it again when the app becomes active.
4
5
  *
5
- * - `background` calls `stopRelaySubscription()`, which closes the socket with
6
+ * - `background` calls `stopSignalProtocolRelaySubscription()`, which closes the socket with
6
7
  * code 1000. The Relay records a client close.
7
- * - `active` calls `startRelaySubscription()`, but only after a stop that this
8
+ * - `active` calls `startSignalProtocolRelaySubscription()`, but only after a stop that this
8
9
  * binding made. The Relay replays retained messages over the new socket.
9
10
  * - `inactive` and other states change nothing. There is no grace delay.
10
11
  * - A subscription that is `stopped` stays stopped, so an app stop is kept.
@@ -13,6 +14,10 @@
13
14
  * Call the returned function before `stop()` on the client. It removes the
14
15
  * listener and does not start or stop the subscription.
15
16
  *
17
+ * An object that has only the deprecated member names, such as
18
+ * `stopRelaySubscription()`, also drives the binding. The binding reads each
19
+ * new name first.
20
+ *
16
21
  * @param signal - The Signal Protocol client
17
22
  * @param appState - React Native's `AppState`, or an object of the same shape
18
23
  * @param options - Binding options
@@ -21,28 +26,30 @@
21
26
  * @example
22
27
  * ```typescript
23
28
  * import { AppState } from 'react-native';
24
- * import { bindRelayLifecycle } from '@open-e2ee/signal-protocol-sdk/client';
29
+ * import { bindSignalProtocolRelayLifecycle } from '@open-e2ee/signal-protocol-sdk/client';
25
30
  *
26
- * const unbind = bindRelayLifecycle(signal, AppState);
31
+ * const unbind = bindSignalProtocolRelayLifecycle(signal, AppState);
27
32
  * // At sign-out:
28
33
  * unbind();
29
34
  * await signal.stop();
30
35
  * ```
31
36
  */
32
- export function bindRelayLifecycle(signal, appState, { keepOpenInBackground = false } = {}) {
37
+ export function bindSignalProtocolRelayLifecycle(signal, appState, { keepOpenInBackground = false } = {}) {
33
38
  if (keepOpenInBackground)
34
39
  return () => undefined;
40
+ const client = signal;
35
41
  let stoppedByBinding = false;
36
42
  const apply = (state) => {
37
43
  if (state === 'background') {
38
- if (stoppedByBinding || signal.relayConnectionState.state === 'stopped')
44
+ const connectionState = readRenamedImplementation(client, 'signalProtocolRelayConnectionState', 'relayConnectionState');
45
+ if (stoppedByBinding || connectionState?.state === 'stopped')
39
46
  return;
40
47
  stoppedByBinding = true;
41
- signal.stopRelaySubscription();
48
+ readRenamedImplementation(client, 'stopSignalProtocolRelaySubscription', 'stopRelaySubscription')?.();
42
49
  }
43
50
  else if (state === 'active' && stoppedByBinding) {
44
51
  stoppedByBinding = false;
45
- signal.startRelaySubscription();
52
+ readRenamedImplementation(client, 'startSignalProtocolRelaySubscription', 'startRelaySubscription')?.();
46
53
  }
47
54
  };
48
55
  const subscription = appState.addEventListener('change', apply);
@@ -58,4 +65,7 @@ export function bindRelayLifecycle(signal, appState, { keepOpenInBackground = fa
58
65
  subscription.remove();
59
66
  };
60
67
  }
61
- //# sourceMappingURL=relay-lifecycle.js.map
68
+ // Names before the Signal Protocol Relay rename. SDK 15.0.0 removes them.
69
+ /** @deprecated Use `bindSignalProtocolRelayLifecycle`. SDK 15.0.0 removes this name. */
70
+ export const bindRelayLifecycle = bindSignalProtocolRelayLifecycle;
71
+ //# sourceMappingURL=signal-relay-lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-lifecycle.js","sourceRoot":"","sources":["../../client/signal-relay-lifecycle.ts"],"names":[],"mappings":"AAEA,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YAAY,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,wFAAwF;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAG,gCAAgC,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Relay period close: the Relay's PERIOD_CLOSED refusal of one delivery post,
3
+ * and the one repeat of the same request that follows it.
4
+ *
5
+ * The Relay refuses a new admission with PERIOD_CLOSED when its admission
6
+ * period ended before the admission. The refusal comes after the duplicate
7
+ * check and before the Relay stores anything, and the Relay reads the period
8
+ * again for each request. So the refusal proves that the Relay did not
9
+ * accept the post, and one repeat of the same request can be admitted in the
10
+ * next period. The repeat keeps the message ID, the operation epoch, and the
11
+ * bytes of the post. A second PERIOD_CLOSED reaches the caller, and the send
12
+ * keeps the device pending.
13
+ *
14
+ * The sealed route gives each code outside its safe codes as DELIVERY_FAILED,
15
+ * so its carrier marks a PERIOD_CLOSED error here.
16
+ *
17
+ * No package entry exports this module. The mark is internal to the SDK.
18
+ *
19
+ * @internal
20
+ */
21
+ /** Mark an error as the Relay's PERIOD_CLOSED refusal. Returns the same error. */
22
+ export declare function markPeriodClosed<T>(error: T): T;
23
+ /** True when the Relay refused the post with PERIOD_CLOSED. */
24
+ export declare function isPeriodClosed(error: unknown): boolean;
25
+ /**
26
+ * Make the repeat rule of one post. Each call of the returned function runs
27
+ * `post`. After a PERIOD_CLOSED answer, it awaits `beforeRepeat` and runs the
28
+ * same post one more time. The rule repeats once for the whole post, also
29
+ * when the post makes more requests for other reasons, so a second
30
+ * PERIOD_CLOSED reaches the caller. Each other answer reaches the caller.
31
+ * When `beforeRepeat` rejects, no repeat starts and the PERIOD_CLOSED error
32
+ * is thrown.
33
+ */
34
+ export declare function onePeriodClosedRetry(): <T>(post: () => Promise<T>, beforeRepeat?: () => Promise<void>) => Promise<T>;
35
+ //# sourceMappingURL=signal-relay-period-close.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-period-close.d.ts","sourceRoot":"","sources":["../../client/signal-relay-period-close.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAG/C;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,CAAC,EACxC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAC/B,OAAO,CAAC,CAAC,CAAC,CAgBd"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Relay period close: the Relay's PERIOD_CLOSED refusal of one delivery post,
3
+ * and the one repeat of the same request that follows it.
4
+ *
5
+ * The Relay refuses a new admission with PERIOD_CLOSED when its admission
6
+ * period ended before the admission. The refusal comes after the duplicate
7
+ * check and before the Relay stores anything, and the Relay reads the period
8
+ * again for each request. So the refusal proves that the Relay did not
9
+ * accept the post, and one repeat of the same request can be admitted in the
10
+ * next period. The repeat keeps the message ID, the operation epoch, and the
11
+ * bytes of the post. A second PERIOD_CLOSED reaches the caller, and the send
12
+ * keeps the device pending.
13
+ *
14
+ * The sealed route gives each code outside its safe codes as DELIVERY_FAILED,
15
+ * so its carrier marks a PERIOD_CLOSED error here.
16
+ *
17
+ * No package entry exports this module. The mark is internal to the SDK.
18
+ *
19
+ * @internal
20
+ */
21
+ const periodClosed = new WeakSet();
22
+ /** Mark an error as the Relay's PERIOD_CLOSED refusal. Returns the same error. */
23
+ export function markPeriodClosed(error) {
24
+ if (error !== null && typeof error === 'object')
25
+ periodClosed.add(error);
26
+ return error;
27
+ }
28
+ /** True when the Relay refused the post with PERIOD_CLOSED. */
29
+ export function isPeriodClosed(error) {
30
+ if (error === null || typeof error !== 'object')
31
+ return false;
32
+ return periodClosed.has(error) || error.code === 'PERIOD_CLOSED';
33
+ }
34
+ /**
35
+ * Make the repeat rule of one post. Each call of the returned function runs
36
+ * `post`. After a PERIOD_CLOSED answer, it awaits `beforeRepeat` and runs the
37
+ * same post one more time. The rule repeats once for the whole post, also
38
+ * when the post makes more requests for other reasons, so a second
39
+ * PERIOD_CLOSED reaches the caller. Each other answer reaches the caller.
40
+ * When `beforeRepeat` rejects, no repeat starts and the PERIOD_CLOSED error
41
+ * is thrown.
42
+ */
43
+ export function onePeriodClosedRetry() {
44
+ let spent = false;
45
+ return async (post, beforeRepeat) => {
46
+ try {
47
+ return await post();
48
+ }
49
+ catch (error) {
50
+ if (spent || !isPeriodClosed(error))
51
+ throw error;
52
+ spent = true;
53
+ try {
54
+ await beforeRepeat?.();
55
+ }
56
+ catch {
57
+ throw error;
58
+ }
59
+ return post();
60
+ }
61
+ };
62
+ }
63
+ //# sourceMappingURL=signal-relay-period-close.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-period-close.js","sourceRoot":"","sources":["../../client/signal-relay-period-close.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU,CAAC;AAE3C,kFAAkF;AAClF,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAK,KAA4B,CAAC,IAAI,KAAK,eAAe,CAAC;AAC3F,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB;IAIlC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;QAClC,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YACjD,KAAK,GAAG,IAAI,CAAC;YACb,IAAI,CAAC;gBACH,MAAM,YAAY,EAAE,EAAE,CAAC;YACzB,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -25,18 +25,18 @@ export declare const RELAY_AUTH_PROTOCOL_PREFIX = "open-e2ee-relay.auth.";
25
25
  /** The HTTP header that carries the protocol version. */
26
26
  export declare const RELAY_PROTOCOL_HEADER = "x-open-e2ee-relay-protocol";
27
27
  /** The subprotocol token of a protocol version, for example `open-e2ee-relay.v1`. */
28
- export declare function relayProtocolToken(version: number): string;
28
+ export declare function signalRelayProtocolToken(version: number): string;
29
29
  /** The headers that put a protocol version on an HTTP request. */
30
- export declare function relayProtocolHeadersFor(version: number): Record<string, string>;
30
+ export declare function signalRelayProtocolHeadersFor(version: number): Record<string, string>;
31
31
  /** The headers that put this SDK's default protocol version on an HTTP request. */
32
- export declare function relayProtocolHeaders(): Record<string, string>;
32
+ export declare function signalRelayProtocolHeaders(): Record<string, string>;
33
33
  /**
34
34
  * The Relay no longer serves the protocol version of this SDK. The same
35
35
  * request fails again until the application ships a newer SDK, so the SDK
36
36
  * does not retry it. The mailbox subscription stops with the reason
37
37
  * `upgrade-required` for the same refusal on its socket.
38
38
  */
39
- export declare class HostedRelayUpgradeRequiredError extends Error {
39
+ export declare class HostedSignalProtocolRelayUpgradeRequiredError extends Error {
40
40
  readonly code = "UPGRADE_REQUIRED";
41
41
  /** The HTTP status of the refusal, 426 from a current Relay. */
42
42
  readonly status: number;
@@ -50,7 +50,7 @@ export declare class HostedRelayUpgradeRequiredError extends Error {
50
50
  constructor(status: number, version?: number);
51
51
  }
52
52
  /**
53
- * Throws `HostedRelayUpgradeRequiredError` when a Relay error body has the
53
+ * Throws `HostedSignalProtocolRelayUpgradeRequiredError` when a Relay error body has the
54
54
  * code `UPGRADE_REQUIRED`, at any error status. The body code is the
55
55
  * contract, not the status. The error names `version`, the protocol version
56
56
  * that the request sent.
@@ -61,11 +61,15 @@ export declare function throwIfUpgradeRequired(status: number, body: unknown, ve
61
61
  * `version`. The meaning of some codes depends on that version. Returns
62
62
  * the same error.
63
63
  */
64
- export declare function markRelayAnswerVersion<T extends object>(error: T, version: number): T;
64
+ export declare function markSignalProtocolRelayAnswerVersion<T extends object>(error: T, version: number): T;
65
65
  /**
66
66
  * The protocol version of the request that a Relay error answers, or
67
67
  * undefined when no hosted carrier marked the error. A custom relay marks
68
68
  * no error.
69
69
  */
70
- export declare function relayAnswerVersion(error: unknown): number | undefined;
71
- //# sourceMappingURL=relay-protocol.d.ts.map
70
+ export declare function signalRelayAnswerVersion(error: unknown): number | undefined;
71
+ /** @deprecated Use `HostedSignalProtocolRelayUpgradeRequiredError`. SDK 15.0.0 removes this name. */
72
+ export declare const HostedRelayUpgradeRequiredError: typeof HostedSignalProtocolRelayUpgradeRequiredError;
73
+ /** @deprecated Use `HostedSignalProtocolRelayUpgradeRequiredError`. SDK 15.0.0 removes this name. */
74
+ export type HostedRelayUpgradeRequiredError = HostedSignalProtocolRelayUpgradeRequiredError;
75
+ //# sourceMappingURL=signal-relay-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-protocol.d.ts","sourceRoot":"","sources":["../../client/signal-relay-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH,eAA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ries the protocol version. */
30
30
  export const RELAY_PROTOCOL_HEADER = "x-open-e2ee-relay-protocol";
31
31
  /** The subprotocol token of a protocol version, for example `open-e2ee-relay.v1`. */
32
- export function relayProtocolToken(version) {
32
+ export function signalRelayProtocolToken(version) {
33
33
  return `${RELAY_PROTOCOL_TOKEN_PREFIX}${version}`;
34
34
  }
35
35
  /** The headers that put a protocol version on an HTTP request. */
36
- export function relayProtocolHeadersFor(version) {
36
+ export function signalRelayProtocolHeadersFor(version) {
37
37
  return { [RELAY_PROTOCOL_HEADER]: String(version) };
38
38
  }
39
39
  /** The headers that put this SDK's default protocol version on an HTTP request. */
40
- export function relayProtocolHeaders() {
41
- return relayProtocolHeadersFor(RELAY_PROTOCOL_VERSION);
40
+ export function signalRelayProtocolHeaders() {
41
+ return signalRelayProtocolHeadersFor(RELAY_PROTOCOL_VERSION);
42
42
  }
43
43
  /**
44
44
  * The Relay no longer serves the protocol version of this SDK. The same
@@ -46,7 +46,7 @@ export function relayProtocolHeaders() {
46
46
  * does not retry it. The mailbox subscription stops with the reason
47
47
  * `upgrade-required` for the same refusal on its socket.
48
48
  */
49
- export class HostedRelayUpgradeRequiredError extends Error {
49
+ export class HostedSignalProtocolRelayUpgradeRequiredError extends Error {
50
50
  code = "UPGRADE_REQUIRED";
51
51
  /** The HTTP status of the refusal, 426 from a current Relay. */
52
52
  status;
@@ -64,7 +64,7 @@ export class HostedRelayUpgradeRequiredError extends Error {
64
64
  }
65
65
  }
66
66
  /**
67
- * Throws `HostedRelayUpgradeRequiredError` when a Relay error body has the
67
+ * Throws `HostedSignalProtocolRelayUpgradeRequiredError` when a Relay error body has the
68
68
  * code `UPGRADE_REQUIRED`, at any error status. The body code is the
69
69
  * contract, not the status. The error names `version`, the protocol version
70
70
  * that the request sent.
@@ -77,7 +77,7 @@ export function throwIfUpgradeRequired(status, body, version) {
77
77
  body.error !== null &&
78
78
  "code" in body.error &&
79
79
  body.error.code === "UPGRADE_REQUIRED")
80
- throw new HostedRelayUpgradeRequiredError(status, version);
80
+ throw new HostedSignalProtocolRelayUpgradeRequiredError(status, version);
81
81
  }
82
82
  /** The protocol version of the request that each Relay error answers. */
83
83
  const answerVersions = new WeakMap();
@@ -86,7 +86,7 @@ const answerVersions = new WeakMap();
86
86
  * `version`. The meaning of some codes depends on that version. Returns
87
87
  * the same error.
88
88
  */
89
- export function markRelayAnswerVersion(error, version) {
89
+ export function markSignalProtocolRelayAnswerVersion(error, version) {
90
90
  answerVersions.set(error, version);
91
91
  return error;
92
92
  }
@@ -95,9 +95,12 @@ export function markRelayAnswerVersion(error, version) {
95
95
  * undefined when no hosted carrier marked the error. A custom relay marks
96
96
  * no error.
97
97
  */
98
- export function relayAnswerVersion(error) {
98
+ export function signalRelayAnswerVersion(error) {
99
99
  return error !== null && typeof error === "object"
100
100
  ? answerVersions.get(error)
101
101
  : undefined;
102
102
  }
103
- //# sourceMappingURL=relay-protocol.js.map
103
+ // Names before the Signal Protocol Relay rename. SDK 15.0.0 removes them.
104
+ /** @deprecated Use `HostedSignalProtocolRelayUpgradeRequiredError`. SDK 15.0.0 removes this name. */
105
+ export const HostedRelayUpgradeRequiredError = HostedSignalProtocolRelayUpgradeRequiredError;
106
+ //# sourceMappingURL=signal-relay-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-relay-protocol.js","sourceRoot":"","sources":["../../client/signal-relay-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,sFAAsF;AACtF,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,6EAA6E;AAC7E,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAExD,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAElE,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAElE,qFAAqF;AACrF,M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mB,KAAQ,EAAE,OAAe;IAC9F,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAChD,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,0EAA0E;AAC1E,qGAAqG;AACrG,MAAM,CAAC,MAAM,+BAA+B,GAAG,6CAA6C,CAAC"}
@@ -18,7 +18,7 @@
18
18
  * @internal
19
19
  */
20
20
  /** One Relay delivery receipt, as the Relay sends it to the sender. */
21
- export interface RelayDeliveryReceipt {
21
+ export interface SignalProtocolRelayDeliveryReceipt {
22
22
  /** The stable identity of the receipt. A replay carries the same value. */
23
23
  readonly receiptId: string;
24
24
  /** The recipient device that acknowledged the messages. */
@@ -36,35 +36,35 @@ export interface RelayDeliveryReceipt {
36
36
  * order. A listener that throws fails the hand-off, so the receipt is not
37
37
  * acknowledged and the Relay replays it.
38
38
  */
39
- export type RelayDeliveryReceiptListener = (receipt: RelayDeliveryReceipt) => void | Promise<void>;
39
+ export type SignalProtocolRelayDeliveryReceiptListener = (receipt: SignalProtocolRelayDeliveryReceipt) => void | Promise<void>;
40
40
  /** The intake that a client binds to. */
41
- export interface RelayReceiptIntake {
42
- subscribe(listener: RelayDeliveryReceiptListener): Unsubscribe;
41
+ export interface SignalProtocolRelayReceiptIntake {
42
+ subscribe(listener: SignalProtocolRelayDeliveryReceiptListener): Unsubscribe;
43
43
  }
44
44
  /** A `delivery-receipt` frame holds no more receipts than this. */
45
45
  export declare const MAXIMUM_RECEIPTS_PER_FRAME = 32;
46
46
  /** Decodes one receipt of a `delivery-receipt` frame or a pull page. Throws when it is invalid. */
47
- export declare function decodeRelayDeliveryReceipt(value: unknown): RelayDeliveryReceipt;
47
+ export declare function decodeSignalProtocolRelayDeliveryReceipt(value: unknown): SignalProtocolRelayDeliveryReceipt;
48
48
  /** Decodes the receipt list of a frame or a pull page. Throws when any receipt is invalid. */
49
- export declare function decodeRelayDeliveryReceipts(value: unknown, maximum?: number): readonly RelayDeliveryReceipt[];
49
+ export declare function decodeSignalProtocolRelayDeliveryReceipts(value: unknown, maximum?: number): readonly SignalProtocolRelayDeliveryReceipt[];
50
50
  /**
51
51
  * The receipt inbox of one relay. It hands each receipt off to the bound
52
52
  * listeners once, by `receiptId`.
53
53
  */
54
- export declare class RelayReceiptInbox implements RelayReceiptIntake {
54
+ export declare class SignalProtocolRelayReceiptInbox implements SignalProtocolRelayReceiptIntake {
55
55
  private readonly listeners;
56
56
  private readonly handedOff;
57
- subscribe(listener: RelayDeliveryReceiptListener): Unsubscribe;
57
+ subscribe(listener: SignalProtocolRelayDeliveryReceiptListener): Unsubscribe;
58
58
  /**
59
59
  * Hands one receipt off to each listener in order, unless an earlier
60
60
  * hand-off of its `receiptId` completed. Resolves when the receipt may be
61
61
  * acknowledged. Rejects when a listener throws; the next replay then hands
62
62
  * the receipt off again.
63
63
  */
64
- handOff(receipt: RelayDeliveryReceipt): Promise<void>;
64
+ handOff(receipt: SignalProtocolRelayDeliveryReceipt): Promise<void>;
65
65
  }
66
66
  /** Declare the receipt intake of this relay. */
67
- export declare function declareRelayReceiptIntake(relay: object, intake: RelayReceiptIntake): void;
67
+ export declare function declareSignalProtocolRelayReceiptIntake(signalRelay: object, intake: SignalProtocolRelayReceiptIntake): void;
68
68
  /** The receipt intake that this relay object declared. A wrapper declares none. */
69
- export declare function relayReceiptIntakeOf(relay: object): RelayReceiptIntake | undefined;
70
- //# sourceMappingURL=relay-receipt-intake.d.ts.map
69
+ export declare function signalRelayReceiptIntakeOf(signalRelay: object): SignalProtocolRelayReceiptIntake | undefined;
70
+ //# sourceMappingURL=signal-relay-receipt-intake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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