@open-e2ee/signal-protocol-sdk 10.1.0 → 12.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 (595) hide show
  1. package/ADAPTERS.md +4 -4
  2. package/ARCHITECTURE.md +6 -8
  3. package/CHANGELOG.md +1413 -0
  4. package/README.md +1 -1
  5. package/SECURITY.md +2 -2
  6. package/TROUBLESHOOTING.md +1 -1
  7. package/client/README.md +84 -37
  8. package/device/README.md +39 -85
  9. package/dist/client/client.d.ts +342 -62
  10. package/dist/client/client.d.ts.map +1 -1
  11. package/dist/client/client.js +1195 -179
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/config.d.ts +40 -32
  14. package/dist/client/config.d.ts.map +1 -1
  15. package/dist/client/config.js +1 -1
  16. package/dist/client/config.js.map +1 -1
  17. package/dist/client/constants.d.ts +42 -8
  18. package/dist/client/constants.d.ts.map +1 -1
  19. package/dist/client/constants.js +48 -3
  20. package/dist/client/constants.js.map +1 -1
  21. package/dist/client/content-adapter.d.ts +80 -0
  22. package/dist/client/content-adapter.d.ts.map +1 -1
  23. package/dist/client/content-adapter.js +225 -12
  24. package/dist/client/content-adapter.js.map +1 -1
  25. package/dist/client/delivery-error.d.ts +150 -0
  26. package/dist/client/delivery-error.d.ts.map +1 -0
  27. package/dist/client/delivery-error.js +226 -0
  28. package/dist/client/delivery-error.js.map +1 -0
  29. package/dist/client/delivery-status.d.ts +32 -6
  30. package/dist/client/delivery-status.d.ts.map +1 -1
  31. package/dist/client/delivery-status.js +61 -13
  32. package/dist/client/delivery-status.js.map +1 -1
  33. package/dist/client/device-set-reconciliation.d.ts +196 -0
  34. package/dist/client/device-set-reconciliation.d.ts.map +1 -0
  35. package/dist/client/device-set-reconciliation.js +282 -0
  36. package/dist/client/device-set-reconciliation.js.map +1 -0
  37. package/dist/client/distribution-records.d.ts +29 -0
  38. package/dist/client/distribution-records.d.ts.map +1 -0
  39. package/dist/client/distribution-records.js +33 -0
  40. package/dist/client/distribution-records.js.map +1 -0
  41. package/dist/client/event-hooks.d.ts +308 -6
  42. package/dist/client/event-hooks.d.ts.map +1 -1
  43. package/dist/client/event-hooks.js +9 -0
  44. package/dist/client/event-hooks.js.map +1 -1
  45. package/dist/client/group-device-set.d.ts +47 -0
  46. package/dist/client/group-device-set.d.ts.map +1 -0
  47. package/dist/client/group-device-set.js +65 -0
  48. package/dist/client/group-device-set.js.map +1 -0
  49. package/dist/client/group-fetcher.d.ts +116 -0
  50. package/dist/client/group-fetcher.d.ts.map +1 -0
  51. package/dist/client/group-fetcher.js +598 -0
  52. package/dist/client/group-fetcher.js.map +1 -0
  53. package/dist/client/group-outbox.d.ts +172 -10
  54. package/dist/client/group-outbox.d.ts.map +1 -1
  55. package/dist/client/group-outbox.js +915 -74
  56. package/dist/client/group-outbox.js.map +1 -1
  57. package/dist/client/group-receive-authorization.d.ts +127 -4
  58. package/dist/client/group-receive-authorization.d.ts.map +1 -1
  59. package/dist/client/group-receive-authorization.js +270 -20
  60. package/dist/client/group-receive-authorization.js.map +1 -1
  61. package/dist/client/group-sealed-sender.d.ts +3 -0
  62. package/dist/client/group-sealed-sender.d.ts.map +1 -1
  63. package/dist/client/group-sealed-sender.js +1 -0
  64. package/dist/client/group-sealed-sender.js.map +1 -1
  65. package/dist/client/group-sender-key-operations.d.ts +14 -3
  66. package/dist/client/group-sender-key-operations.d.ts.map +1 -1
  67. package/dist/client/group-sender-key-operations.js +26 -5
  68. package/dist/client/group-sender-key-operations.js.map +1 -1
  69. package/dist/client/groups.d.ts +5 -5
  70. package/dist/client/groups.d.ts.map +1 -1
  71. package/dist/client/groups.js +5 -4
  72. package/dist/client/groups.js.map +1 -1
  73. package/dist/client/hosted-anonymous-delivery.d.ts +61 -9
  74. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  75. package/dist/client/hosted-anonymous-delivery.js +242 -48
  76. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  77. package/dist/client/hosted-assertion-id.d.ts +7 -0
  78. package/dist/client/hosted-assertion-id.d.ts.map +1 -0
  79. package/dist/client/hosted-assertion-id.js +51 -0
  80. package/dist/client/hosted-assertion-id.js.map +1 -0
  81. package/dist/client/hosted-device-standing.d.ts +52 -0
  82. package/dist/client/hosted-device-standing.d.ts.map +1 -0
  83. package/dist/client/hosted-device-standing.js +74 -0
  84. package/dist/client/hosted-device-standing.js.map +1 -0
  85. package/dist/client/hosted-mailbox-subscription.d.ts +48 -3
  86. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
  87. package/dist/client/hosted-mailbox-subscription.js +288 -74
  88. package/dist/client/hosted-mailbox-subscription.js.map +1 -1
  89. package/dist/client/hosted-push.d.ts +22 -4
  90. package/dist/client/hosted-push.d.ts.map +1 -1
  91. package/dist/client/hosted-push.js +75 -22
  92. package/dist/client/hosted-push.js.map +1 -1
  93. package/dist/client/hosted-transport.d.ts +22 -28
  94. package/dist/client/hosted-transport.d.ts.map +1 -1
  95. package/dist/client/hosted-transport.js +167 -69
  96. package/dist/client/hosted-transport.js.map +1 -1
  97. package/dist/client/hosted.d.ts +22 -5
  98. package/dist/client/hosted.d.ts.map +1 -1
  99. package/dist/client/hosted.js +122 -45
  100. package/dist/client/hosted.js.map +1 -1
  101. package/dist/client/index.d.ts +6 -4
  102. package/dist/client/index.d.ts.map +1 -1
  103. package/dist/client/index.js +3 -1
  104. package/dist/client/index.js.map +1 -1
  105. package/dist/client/messages.d.ts +25 -3
  106. package/dist/client/messages.d.ts.map +1 -1
  107. package/dist/client/messages.js +118 -17
  108. package/dist/client/messages.js.map +1 -1
  109. package/dist/client/one-time-prekey-refill.d.ts +7 -0
  110. package/dist/client/one-time-prekey-refill.d.ts.map +1 -1
  111. package/dist/client/one-time-prekey-refill.js +5 -1
  112. package/dist/client/one-time-prekey-refill.js.map +1 -1
  113. package/dist/client/receive-admission.d.ts +58 -0
  114. package/dist/client/receive-admission.d.ts.map +1 -0
  115. package/dist/client/receive-admission.js +78 -0
  116. package/dist/client/receive-admission.js.map +1 -0
  117. package/dist/client/receive-expiry.d.ts +31 -0
  118. package/dist/client/receive-expiry.d.ts.map +1 -0
  119. package/dist/client/receive-expiry.js +35 -0
  120. package/dist/client/receive-expiry.js.map +1 -0
  121. package/dist/client/receive-hook-bound.d.ts +50 -0
  122. package/dist/client/receive-hook-bound.d.ts.map +1 -0
  123. package/dist/client/receive-hook-bound.js +115 -0
  124. package/dist/client/receive-hook-bound.js.map +1 -0
  125. package/dist/client/receive-queue.d.ts +299 -0
  126. package/dist/client/receive-queue.d.ts.map +1 -0
  127. package/dist/client/receive-queue.js +1420 -0
  128. package/dist/client/receive-queue.js.map +1 -0
  129. package/dist/client/receive-work-seed.d.ts +54 -0
  130. package/dist/client/receive-work-seed.d.ts.map +1 -0
  131. package/dist/client/receive-work-seed.js +116 -0
  132. package/dist/client/receive-work-seed.js.map +1 -0
  133. package/dist/client/recovery-driver.d.ts +25 -0
  134. package/dist/client/recovery-driver.d.ts.map +1 -0
  135. package/dist/client/recovery-driver.js +121 -0
  136. package/dist/client/recovery-driver.js.map +1 -0
  137. package/dist/client/relay-acceptance.d.ts +30 -0
  138. package/dist/client/relay-acceptance.d.ts.map +1 -1
  139. package/dist/client/relay-acceptance.js +55 -0
  140. package/dist/client/relay-acceptance.js.map +1 -1
  141. package/dist/client/relay-device-refusal.d.ts +18 -0
  142. package/dist/client/relay-device-refusal.d.ts.map +1 -1
  143. package/dist/client/relay-device-refusal.js +31 -0
  144. package/dist/client/relay-device-refusal.js.map +1 -1
  145. package/dist/client/relay-sealed-route.d.ts +36 -0
  146. package/dist/client/relay-sealed-route.d.ts.map +1 -0
  147. package/dist/client/relay-sealed-route.js +45 -0
  148. package/dist/client/relay-sealed-route.js.map +1 -0
  149. package/dist/client/relay-subscription.d.ts +56 -13
  150. package/dist/client/relay-subscription.d.ts.map +1 -1
  151. package/dist/client/relay-subscription.js +220 -150
  152. package/dist/client/relay-subscription.js.map +1 -1
  153. package/dist/client/resendable-content.d.ts +98 -0
  154. package/dist/client/resendable-content.d.ts.map +1 -0
  155. package/dist/client/resendable-content.js +136 -0
  156. package/dist/client/resendable-content.js.map +1 -0
  157. package/dist/client/retry-family.d.ts +68 -19
  158. package/dist/client/retry-family.d.ts.map +1 -1
  159. package/dist/client/retry-family.js +59 -17
  160. package/dist/client/retry-family.js.map +1 -1
  161. package/dist/client/retry-request-envelope.d.ts +145 -18
  162. package/dist/client/retry-request-envelope.d.ts.map +1 -1
  163. package/dist/client/retry-request-envelope.js +301 -64
  164. package/dist/client/retry-request-envelope.js.map +1 -1
  165. package/dist/client/retry-request-lifecycle.d.ts +157 -0
  166. package/dist/client/retry-request-lifecycle.d.ts.map +1 -0
  167. package/dist/client/retry-request-lifecycle.js +437 -0
  168. package/dist/client/retry-request-lifecycle.js.map +1 -0
  169. package/dist/client/retry-terminal-recovery.d.ts +100 -0
  170. package/dist/client/retry-terminal-recovery.d.ts.map +1 -0
  171. package/dist/client/retry-terminal-recovery.js +164 -0
  172. package/dist/client/retry-terminal-recovery.js.map +1 -0
  173. package/dist/client/retry-utils.d.ts +27 -0
  174. package/dist/client/retry-utils.d.ts.map +1 -1
  175. package/dist/client/retry-utils.js +46 -0
  176. package/dist/client/retry-utils.js.map +1 -1
  177. package/dist/client/retry.d.ts +106 -18
  178. package/dist/client/retry.d.ts.map +1 -1
  179. package/dist/client/retry.js +687 -139
  180. package/dist/client/retry.js.map +1 -1
  181. package/dist/client/sealed-sender.d.ts +23 -6
  182. package/dist/client/sealed-sender.d.ts.map +1 -1
  183. package/dist/client/sealed-sender.js +30 -6
  184. package/dist/client/sealed-sender.js.map +1 -1
  185. package/dist/client/sessions.d.ts +2 -2
  186. package/dist/client/sessions.js +2 -2
  187. package/dist/client/signal-service-cipher.d.ts +726 -19
  188. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  189. package/dist/client/signal-service-cipher.js +2265 -343
  190. package/dist/client/signal-service-cipher.js.map +1 -1
  191. package/dist/client/state.d.ts +5 -0
  192. package/dist/client/state.d.ts.map +1 -1
  193. package/dist/client/state.js +11 -1
  194. package/dist/client/state.js.map +1 -1
  195. package/dist/client/storage-protection.d.ts +64 -0
  196. package/dist/client/storage-protection.d.ts.map +1 -0
  197. package/dist/client/storage-protection.js +150 -0
  198. package/dist/client/storage-protection.js.map +1 -0
  199. package/dist/client/types.d.ts +149 -15
  200. package/dist/client/types.d.ts.map +1 -1
  201. package/dist/client/types.js +1 -1
  202. package/dist/client/types.js.map +1 -1
  203. package/dist/device/constants.d.ts +0 -5
  204. package/dist/device/constants.d.ts.map +1 -1
  205. package/dist/device/constants.js +0 -5
  206. package/dist/device/constants.js.map +1 -1
  207. package/dist/device/expo/index.d.ts +4 -17
  208. package/dist/device/expo/index.d.ts.map +1 -1
  209. package/dist/device/expo/index.js +4 -23
  210. package/dist/device/expo/index.js.map +1 -1
  211. package/dist/device/index.d.ts +0 -2
  212. package/dist/device/index.d.ts.map +1 -1
  213. package/dist/device/index.js +0 -7
  214. package/dist/device/index.js.map +1 -1
  215. package/dist/device/lifecycle/manager.d.ts +5 -4
  216. package/dist/device/lifecycle/manager.d.ts.map +1 -1
  217. package/dist/device/lifecycle/manager.js +16 -16
  218. package/dist/device/lifecycle/manager.js.map +1 -1
  219. package/dist/device/lifecycle/types.d.ts +2 -2
  220. package/dist/device/lifecycle/types.d.ts.map +1 -1
  221. package/dist/device/react-native/index.d.ts +4 -15
  222. package/dist/device/react-native/index.d.ts.map +1 -1
  223. package/dist/device/react-native/index.js +4 -21
  224. package/dist/device/react-native/index.js.map +1 -1
  225. package/dist/device/types.d.ts +1 -1
  226. package/dist/groups/index.d.ts +1 -1
  227. package/dist/groups/index.d.ts.map +1 -1
  228. package/dist/index.d.ts +8 -6
  229. package/dist/index.d.ts.map +1 -1
  230. package/dist/index.js +2 -1
  231. package/dist/index.js.map +1 -1
  232. package/dist/internal/crypto/ec/x25519-validation.d.ts +0 -1
  233. package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -1
  234. package/dist/internal/crypto/ec/x25519-validation.js +0 -1
  235. package/dist/internal/crypto/ec/x25519-validation.js.map +1 -1
  236. package/dist/internal/crypto/validation.d.ts +2 -2
  237. package/dist/internal/groups/index.d.ts +1 -0
  238. package/dist/internal/groups/index.d.ts.map +1 -1
  239. package/dist/internal/groups/index.js +1 -0
  240. package/dist/internal/groups/index.js.map +1 -1
  241. package/dist/internal/groups/manager.d.ts +37 -16
  242. package/dist/internal/groups/manager.d.ts.map +1 -1
  243. package/dist/internal/groups/manager.js +46 -1
  244. package/dist/internal/groups/manager.js.map +1 -1
  245. package/dist/internal/groups/receive-record.d.ts +78 -0
  246. package/dist/internal/groups/receive-record.d.ts.map +1 -0
  247. package/dist/internal/groups/receive-record.js +43 -0
  248. package/dist/internal/groups/receive-record.js.map +1 -0
  249. package/dist/internal/groups/sdk-store.d.ts +27 -3
  250. package/dist/internal/groups/sdk-store.d.ts.map +1 -1
  251. package/dist/internal/groups/sdk-store.js +151 -19
  252. package/dist/internal/groups/sdk-store.js.map +1 -1
  253. package/dist/internal/groups/wire.d.ts +12 -1
  254. package/dist/internal/groups/wire.d.ts.map +1 -1
  255. package/dist/internal/groups/wire.js +36 -0
  256. package/dist/internal/groups/wire.js.map +1 -1
  257. package/dist/internal/manager/index.d.ts +1 -1
  258. package/dist/internal/manager/manager.d.ts +20 -19
  259. package/dist/internal/manager/manager.d.ts.map +1 -1
  260. package/dist/internal/manager/manager.js +56 -39
  261. package/dist/internal/manager/manager.js.map +1 -1
  262. package/dist/internal/protocol/double-ratchet/chains.d.ts +4 -18
  263. package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -1
  264. package/dist/internal/protocol/double-ratchet/chains.js +23 -74
  265. package/dist/internal/protocol/double-ratchet/chains.js.map +1 -1
  266. package/dist/internal/protocol/double-ratchet/index.d.ts +1 -1
  267. package/dist/internal/protocol/double-ratchet/index.d.ts.map +1 -1
  268. package/dist/internal/protocol/double-ratchet/index.js +1 -1
  269. package/dist/internal/protocol/double-ratchet/index.js.map +1 -1
  270. package/dist/internal/protocol/double-ratchet/ratchet.d.ts +5 -7
  271. package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
  272. package/dist/internal/protocol/double-ratchet/ratchet.js +4 -6
  273. package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
  274. package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -1
  275. package/dist/internal/protocol/pqxdh/pqxdh.js +2 -1
  276. package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -1
  277. package/dist/internal/protocol/sealed-sender/types.d.ts +6 -8
  278. package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
  279. package/dist/internal/protocol/sealed-sender/types.js +8 -9
  280. package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
  281. package/dist/internal/protocol/sender-keys/handoff-ledger.d.ts +110 -0
  282. package/dist/internal/protocol/sender-keys/handoff-ledger.d.ts.map +1 -0
  283. package/dist/internal/protocol/sender-keys/handoff-ledger.js +124 -0
  284. package/dist/internal/protocol/sender-keys/handoff-ledger.js.map +1 -0
  285. package/dist/internal/protocol/sender-keys/manager.d.ts +71 -62
  286. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  287. package/dist/internal/protocol/sender-keys/manager.js +228 -175
  288. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  289. package/dist/internal/protocol/spqr/index.d.ts +2 -2
  290. package/dist/internal/protocol/spqr/index.d.ts.map +1 -1
  291. package/dist/internal/protocol/spqr/index.js +2 -2
  292. package/dist/internal/protocol/spqr/index.js.map +1 -1
  293. package/dist/internal/protocol/spqr/serialize.d.ts +9 -1
  294. package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -1
  295. package/dist/internal/protocol/spqr/serialize.js +56 -16
  296. package/dist/internal/protocol/spqr/serialize.js.map +1 -1
  297. package/dist/internal/protocol/spqr/spqr.d.ts +1 -14
  298. package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
  299. package/dist/internal/protocol/spqr/spqr.js +54 -42
  300. package/dist/internal/protocol/spqr/spqr.js.map +1 -1
  301. package/dist/internal/protocol/spqr/validate.d.ts +26 -6
  302. package/dist/internal/protocol/spqr/validate.d.ts.map +1 -1
  303. package/dist/internal/protocol/spqr/validate.js +49 -21
  304. package/dist/internal/protocol/spqr/validate.js.map +1 -1
  305. package/dist/internal/sesame/index.d.ts +1 -1
  306. package/dist/internal/sesame/index.d.ts.map +1 -1
  307. package/dist/internal/sesame/index.js.map +1 -1
  308. package/dist/internal/sesame/manager.d.ts +66 -13
  309. package/dist/internal/sesame/manager.d.ts.map +1 -1
  310. package/dist/internal/sesame/manager.js +221 -87
  311. package/dist/internal/sesame/manager.js.map +1 -1
  312. package/dist/internal/sesame/types.d.ts +95 -17
  313. package/dist/internal/sesame/types.d.ts.map +1 -1
  314. package/dist/internal/sesame/types.js +17 -0
  315. package/dist/internal/sesame/types.js.map +1 -1
  316. package/dist/internal/session/builder.d.ts +5 -5
  317. package/dist/internal/session/builder.d.ts.map +1 -1
  318. package/dist/internal/session/builder.js +12 -17
  319. package/dist/internal/session/builder.js.map +1 -1
  320. package/dist/internal/session/cipher.d.ts +13 -11
  321. package/dist/internal/session/cipher.d.ts.map +1 -1
  322. package/dist/internal/session/cipher.js +40 -22
  323. package/dist/internal/session/cipher.js.map +1 -1
  324. package/dist/internal/session/factory.d.ts +5 -5
  325. package/dist/internal/session/factory.d.ts.map +1 -1
  326. package/dist/internal/session/factory.js +4 -4
  327. package/dist/internal/session/factory.js.map +1 -1
  328. package/dist/internal/session/handshake.d.ts +14 -16
  329. package/dist/internal/session/handshake.d.ts.map +1 -1
  330. package/dist/internal/session/handshake.js +18 -75
  331. package/dist/internal/session/handshake.js.map +1 -1
  332. package/dist/internal/session/index.d.ts +1 -1
  333. package/dist/internal/session/index.js +1 -1
  334. package/dist/internal/session/record-locks.d.ts +17 -6
  335. package/dist/internal/session/record-locks.d.ts.map +1 -1
  336. package/dist/internal/session/record-locks.js +43 -7
  337. package/dist/internal/session/record-locks.js.map +1 -1
  338. package/dist/internal/session/session-resolver.d.ts +1 -1
  339. package/dist/internal/session/session-resolver.js +1 -1
  340. package/dist/internal/session/state.d.ts +2 -2
  341. package/dist/internal/session/state.js +1 -1
  342. package/dist/internal/session/types.d.ts +4 -12
  343. package/dist/internal/session/types.d.ts.map +1 -1
  344. package/dist/internal/session/types.js +1 -1
  345. package/dist/keys/generation.d.ts +2 -2
  346. package/dist/keys/generation.js +2 -2
  347. package/dist/keys/types.d.ts +5 -5
  348. package/dist/keys/types.d.ts.map +1 -1
  349. package/dist/keys/types.js +1 -1
  350. package/dist/layers.d.ts +1 -1
  351. package/dist/layers.js +2 -2
  352. package/dist/layers.js.map +1 -1
  353. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  354. package/dist/local/store/expo/adapter.js +12 -8
  355. package/dist/local/store/expo/adapter.js.map +1 -1
  356. package/dist/local/store/key-value/adapter.d.ts +76 -10
  357. package/dist/local/store/key-value/adapter.d.ts.map +1 -1
  358. package/dist/local/store/key-value/adapter.js +367 -61
  359. package/dist/local/store/key-value/adapter.js.map +1 -1
  360. package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -1
  361. package/dist/local/store/key-value/backend-conformance.js +74 -0
  362. package/dist/local/store/key-value/backend-conformance.js.map +1 -1
  363. package/dist/local/store/key-value/batch.d.ts +2 -0
  364. package/dist/local/store/key-value/batch.d.ts.map +1 -1
  365. package/dist/local/store/key-value/batch.js +26 -0
  366. package/dist/local/store/key-value/batch.js.map +1 -1
  367. package/dist/local/store/key-value/receive-work.d.ts +55 -0
  368. package/dist/local/store/key-value/receive-work.d.ts.map +1 -0
  369. package/dist/local/store/key-value/receive-work.js +162 -0
  370. package/dist/local/store/key-value/receive-work.js.map +1 -0
  371. package/dist/local/store/key-value/send-log.d.ts +61 -0
  372. package/dist/local/store/key-value/send-log.d.ts.map +1 -0
  373. package/dist/local/store/key-value/send-log.js +430 -0
  374. package/dist/local/store/key-value/send-log.js.map +1 -0
  375. package/dist/local/store/key-value/sender-key-handoff.d.ts +68 -0
  376. package/dist/local/store/key-value/sender-key-handoff.d.ts.map +1 -0
  377. package/dist/local/store/key-value/sender-key-handoff.js +189 -0
  378. package/dist/local/store/key-value/sender-key-handoff.js.map +1 -0
  379. package/dist/local/store/key-value/storage.d.ts +15 -0
  380. package/dist/local/store/key-value/storage.d.ts.map +1 -1
  381. package/dist/local/store/keyed-index.d.ts +23 -0
  382. package/dist/local/store/keyed-index.d.ts.map +1 -0
  383. package/dist/local/store/keyed-index.js +41 -0
  384. package/dist/local/store/keyed-index.js.map +1 -0
  385. package/dist/local/store/memory/adapter.d.ts +44 -12
  386. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  387. package/dist/local/store/memory/adapter.js +197 -46
  388. package/dist/local/store/memory/adapter.js.map +1 -1
  389. package/dist/local/store/memory/send-log.d.ts +42 -0
  390. package/dist/local/store/memory/send-log.d.ts.map +1 -0
  391. package/dist/local/store/memory/send-log.js +190 -0
  392. package/dist/local/store/memory/send-log.js.map +1 -0
  393. package/dist/local/store/node/adapter.d.ts.map +1 -1
  394. package/dist/local/store/node/adapter.js +8 -6
  395. package/dist/local/store/node/adapter.js.map +1 -1
  396. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  397. package/dist/local/store/react-native/adapter.js +12 -8
  398. package/dist/local/store/react-native/adapter.js.map +1 -1
  399. package/dist/local/store/receive-work.d.ts +87 -0
  400. package/dist/local/store/receive-work.d.ts.map +1 -0
  401. package/dist/local/store/receive-work.js +204 -0
  402. package/dist/local/store/receive-work.js.map +1 -0
  403. package/dist/local/store/received-content.d.ts +3 -3
  404. package/dist/local/store/received-content.d.ts.map +1 -1
  405. package/dist/local/store/received-content.js +2 -11
  406. package/dist/local/store/received-content.js.map +1 -1
  407. package/dist/local/store/reliability.d.ts +411 -14
  408. package/dist/local/store/reliability.d.ts.map +1 -1
  409. package/dist/local/store/reliability.js +532 -58
  410. package/dist/local/store/reliability.js.map +1 -1
  411. package/dist/local/store/send-log-order.d.ts +15 -0
  412. package/dist/local/store/send-log-order.d.ts.map +1 -0
  413. package/dist/local/store/send-log-order.js +24 -0
  414. package/dist/local/store/send-log-order.js.map +1 -0
  415. package/dist/local/store/sender-key-handoff-index.d.ts +38 -0
  416. package/dist/local/store/sender-key-handoff-index.d.ts.map +1 -0
  417. package/dist/local/store/sender-key-handoff-index.js +101 -0
  418. package/dist/local/store/sender-key-handoff-index.js.map +1 -0
  419. package/dist/local/store/sender-key-handoff-table.d.ts +29 -0
  420. package/dist/local/store/sender-key-handoff-table.d.ts.map +1 -0
  421. package/dist/local/store/sender-key-handoff-table.js +97 -0
  422. package/dist/local/store/sender-key-handoff-table.js.map +1 -0
  423. package/dist/local/store/sqlite/encryption.d.ts +8 -1
  424. package/dist/local/store/sqlite/encryption.d.ts.map +1 -1
  425. package/dist/local/store/sqlite/encryption.js +9 -0
  426. package/dist/local/store/sqlite/encryption.js.map +1 -1
  427. package/dist/local/store/sqlite/key-storage/index.d.ts +25 -4
  428. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
  429. package/dist/local/store/sqlite/key-storage/index.js +68 -7
  430. package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
  431. package/dist/local/store/sqlite/key-storage/message-records.d.ts +16 -4
  432. package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -1
  433. package/dist/local/store/sqlite/key-storage/message-records.js +49 -6
  434. package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -1
  435. package/dist/local/store/sqlite/key-storage/metadata.d.ts +8 -7
  436. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
  437. package/dist/local/store/sqlite/key-storage/metadata.js +17 -15
  438. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
  439. package/dist/local/store/sqlite/key-storage/receive-work.d.ts +27 -0
  440. package/dist/local/store/sqlite/key-storage/receive-work.d.ts.map +1 -0
  441. package/dist/local/store/sqlite/key-storage/receive-work.js +98 -0
  442. package/dist/local/store/sqlite/key-storage/receive-work.js.map +1 -0
  443. package/dist/local/store/sqlite/key-storage/send-log.d.ts +27 -0
  444. package/dist/local/store/sqlite/key-storage/send-log.d.ts.map +1 -0
  445. package/dist/local/store/sqlite/key-storage/send-log.js +178 -0
  446. package/dist/local/store/sqlite/key-storage/send-log.js.map +1 -0
  447. package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts +27 -0
  448. package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts.map +1 -0
  449. package/dist/local/store/sqlite/key-storage/sender-key-handoff.js +75 -0
  450. package/dist/local/store/sqlite/key-storage/sender-key-handoff.js.map +1 -0
  451. package/dist/local/store/sqlite/key-storage/session-trust.d.ts +2 -2
  452. package/dist/local/store/sqlite/key-storage/session-trust.js +5 -5
  453. package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -1
  454. package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
  455. package/dist/local/store/sqlite/migrations.js +101 -0
  456. package/dist/local/store/sqlite/migrations.js.map +1 -1
  457. package/dist/local/store/sqlite/models/index.d.ts +2 -1
  458. package/dist/local/store/sqlite/models/index.d.ts.map +1 -1
  459. package/dist/local/store/sqlite/models/index.js +5 -1
  460. package/dist/local/store/sqlite/models/index.js.map +1 -1
  461. package/dist/local/store/sqlite/models/message-record.d.ts +15 -0
  462. package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -1
  463. package/dist/local/store/sqlite/models/message-record.js +24 -0
  464. package/dist/local/store/sqlite/models/message-record.js.map +1 -1
  465. package/dist/local/store/sqlite/models/send-log.d.ts +51 -0
  466. package/dist/local/store/sqlite/models/send-log.d.ts.map +1 -0
  467. package/dist/local/store/sqlite/models/send-log.js +206 -0
  468. package/dist/local/store/sqlite/models/send-log.js.map +1 -0
  469. package/dist/local/store/sqlite/open-store.d.ts +9 -1
  470. package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
  471. package/dist/local/store/sqlite/open-store.js +20 -1
  472. package/dist/local/store/sqlite/open-store.js.map +1 -1
  473. package/dist/local/store/sqlite/schema.d.ts +34 -1
  474. package/dist/local/store/sqlite/schema.d.ts.map +1 -1
  475. package/dist/local/store/sqlite/schema.js +14 -0
  476. package/dist/local/store/sqlite/schema.js.map +1 -1
  477. package/dist/local/store/sqlite/store.d.ts +61 -11
  478. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  479. package/dist/local/store/sqlite/store.js +191 -27
  480. package/dist/local/store/sqlite/store.js.map +1 -1
  481. package/dist/local/store/web/adapter.d.ts +76 -8
  482. package/dist/local/store/web/adapter.d.ts.map +1 -1
  483. package/dist/local/store/web/adapter.js +579 -127
  484. package/dist/local/store/web/adapter.js.map +1 -1
  485. package/dist/local/store/web/receive-work.d.ts +57 -0
  486. package/dist/local/store/web/receive-work.d.ts.map +1 -0
  487. package/dist/local/store/web/receive-work.js +99 -0
  488. package/dist/local/store/web/receive-work.js.map +1 -0
  489. package/dist/local/store/web/send-log.d.ts +92 -0
  490. package/dist/local/store/web/send-log.d.ts.map +1 -0
  491. package/dist/local/store/web/send-log.js +267 -0
  492. package/dist/local/store/web/send-log.js.map +1 -0
  493. package/dist/local/store/web/sender-key-handoff.d.ts +81 -0
  494. package/dist/local/store/web/sender-key-handoff.d.ts.map +1 -0
  495. package/dist/local/store/web/sender-key-handoff.js +156 -0
  496. package/dist/local/store/web/sender-key-handoff.js.map +1 -0
  497. package/dist/local/store/web-sqlite/adapter.d.ts +2 -0
  498. package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
  499. package/dist/local/store/web-sqlite/adapter.js +12 -6
  500. package/dist/local/store/web-sqlite/adapter.js.map +1 -1
  501. package/dist/local/vault/custody.d.ts +8 -0
  502. package/dist/local/vault/custody.d.ts.map +1 -0
  503. package/dist/local/vault/custody.js +9 -0
  504. package/dist/local/vault/custody.js.map +1 -0
  505. package/dist/local/vault/electron-safe-storage.d.ts +3 -1
  506. package/dist/local/vault/electron-safe-storage.d.ts.map +1 -1
  507. package/dist/local/vault/electron-safe-storage.js +2 -0
  508. package/dist/local/vault/electron-safe-storage.js.map +1 -1
  509. package/dist/local/vault/expo-secure-store.d.ts +3 -1
  510. package/dist/local/vault/expo-secure-store.d.ts.map +1 -1
  511. package/dist/local/vault/expo-secure-store.js +2 -0
  512. package/dist/local/vault/expo-secure-store.js.map +1 -1
  513. package/dist/local/vault/indexed-db.d.ts +3 -1
  514. package/dist/local/vault/indexed-db.d.ts.map +1 -1
  515. package/dist/local/vault/indexed-db.js +2 -0
  516. package/dist/local/vault/indexed-db.js.map +1 -1
  517. package/dist/local/vault/react-native-keychain.d.ts +3 -1
  518. package/dist/local/vault/react-native-keychain.d.ts.map +1 -1
  519. package/dist/local/vault/react-native-keychain.js +2 -0
  520. package/dist/local/vault/react-native-keychain.js.map +1 -1
  521. package/dist/remote/relay/device-set.d.ts +94 -0
  522. package/dist/remote/relay/device-set.d.ts.map +1 -0
  523. package/dist/remote/relay/device-set.js +156 -0
  524. package/dist/remote/relay/device-set.js.map +1 -0
  525. package/dist/remote/relay/types.d.ts +104 -110
  526. package/dist/remote/relay/types.d.ts.map +1 -1
  527. package/dist/safety/core.d.ts +15 -6
  528. package/dist/safety/core.d.ts.map +1 -1
  529. package/dist/safety/core.js +41 -27
  530. package/dist/safety/core.js.map +1 -1
  531. package/dist/safety/index.d.ts +2 -1
  532. package/dist/safety/index.d.ts.map +1 -1
  533. package/dist/safety/index.js +12 -18
  534. package/dist/safety/index.js.map +1 -1
  535. package/dist/types/api.d.ts +707 -62
  536. package/dist/types/api.d.ts.map +1 -1
  537. package/dist/types/errors.d.ts +14 -33
  538. package/dist/types/errors.d.ts.map +1 -1
  539. package/dist/types/errors.js +14 -24
  540. package/dist/types/errors.js.map +1 -1
  541. package/dist/types/messages.d.ts +2 -2
  542. package/dist/types/messages.js +1 -1
  543. package/dist/types/protocol-config.d.ts +175 -42
  544. package/dist/types/protocol-config.d.ts.map +1 -1
  545. package/dist/types/protocol-config.js +19 -38
  546. package/dist/types/protocol-config.js.map +1 -1
  547. package/dist/types/protocol-constants.d.ts +6 -6
  548. package/dist/types/protocol-constants.js +6 -6
  549. package/dist/types/session.d.ts +7 -7
  550. package/dist/types/session.d.ts.map +1 -1
  551. package/dist/types/session.js +39 -21
  552. package/dist/types/session.js.map +1 -1
  553. package/dist/username/link.d.ts +2 -2
  554. package/dist/username/link.js +2 -2
  555. package/dist/utils/origin-lock.d.ts +45 -0
  556. package/dist/utils/origin-lock.d.ts.map +1 -0
  557. package/dist/utils/origin-lock.js +80 -0
  558. package/dist/utils/origin-lock.js.map +1 -0
  559. package/dist/utils/retry.d.ts +2 -0
  560. package/dist/utils/retry.d.ts.map +1 -1
  561. package/dist/utils/retry.js +7 -0
  562. package/dist/utils/retry.js.map +1 -1
  563. package/docs/ASSURANCE.md +6 -6
  564. package/docs/CLIENT_COMPOSITION.md +2 -2
  565. package/docs/DEVIATIONS.md +677 -182
  566. package/docs/E2EE.md +1 -1
  567. package/docs/ERROR_HANDLING.md +235 -2
  568. package/docs/GETTING_STARTED.md +7 -4
  569. package/docs/INTERFACES.md +1 -1
  570. package/docs/PACKAGE_SURFACE.md +6 -5
  571. package/docs/PROTOCOL_POLICY.md +102 -22
  572. package/docs/RECIPES.md +3 -15
  573. package/docs/SECURITY.md +90 -5
  574. package/keys/README.md +3 -3
  575. package/local/store/README.md +78 -14
  576. package/local/store/key-value/README.md +14 -3
  577. package/local/store/node/README.md +8 -3
  578. package/local/store/web/README.md +9 -0
  579. package/local/store/web-sqlite/README.md +14 -2
  580. package/local/vault/README.md +21 -0
  581. package/package.json +1 -6
  582. package/remote/README.md +0 -1
  583. package/remote/relay/README.md +2 -2
  584. package/dist/device/provisioning.d.ts +0 -242
  585. package/dist/device/provisioning.d.ts.map +0 -1
  586. package/dist/device/provisioning.js +0 -421
  587. package/dist/device/provisioning.js.map +0 -1
  588. package/dist/internal/protocol/x3dh/index.d.ts +0 -15
  589. package/dist/internal/protocol/x3dh/index.d.ts.map +0 -1
  590. package/dist/internal/protocol/x3dh/index.js +0 -13
  591. package/dist/internal/protocol/x3dh/index.js.map +0 -1
  592. package/dist/internal/protocol/x3dh/x3dh.d.ts +0 -131
  593. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +0 -1
  594. package/dist/internal/protocol/x3dh/x3dh.js +0 -261
  595. package/dist/internal/protocol/x3dh/x3dh.js.map +0 -1
@@ -0,0 +1,196 @@
1
+ import { type DeviceSetRefusal } from '../remote/relay/device-set.js';
2
+ import { type RelayPostAcceptance } from './relay-acceptance.js';
3
+ /**
4
+ * The device-set reconciliation of a declared send.
5
+ *
6
+ * A send that declares its device sets posts every device of one phase in a
7
+ * pass. When the Relay refuses the declaration of a post, the send repairs
8
+ * every device that the refusals of the pass name, adds one to the restart
9
+ * count of the phase in the same write, and posts the phase again. A device
10
+ * that the Relay accepted in an earlier pass gets its stored bytes again,
11
+ * and the Relay answers with the stored receipt. The recipient phase and the
12
+ * sync phase each have at most 10 restarts, so at most 11 posts.
13
+ */
14
+ /** The most restarts of one phase of a declared send. */
15
+ export declare const DEVICE_SET_RESTARTS_MAXIMUM = 10;
16
+ /**
17
+ * The wait before the next pass after a repair that found no prekey bundle
18
+ * for a listed device: 250 ms, then 500 ms, then 1 s for each later pass.
19
+ */
20
+ export declare function deviceSetBundleRetryDelay(consecutiveMisses: number): number;
21
+ /** A phase of a declared send. The recipient phase runs first. */
22
+ export type DeviceSetPhase = 'recipient' | 'sync';
23
+ /** One device of a declared send: an account and one of its devices. */
24
+ export interface DeviceSetDevice {
25
+ readonly userId: string;
26
+ readonly deviceId: number;
27
+ }
28
+ /** The devices of one account that the last refusal of a phase named. */
29
+ export interface DeviceSetRefusalAccount {
30
+ readonly userId: string;
31
+ readonly missingDeviceIds: readonly number[];
32
+ readonly extraDeviceIds: readonly number[];
33
+ readonly staleDeviceIds: readonly number[];
34
+ }
35
+ /**
36
+ * The last refusal of a phase. `DEVICE_SET_MISMATCH` and `STALE_DEVICE` are
37
+ * the Relay's answers. `BUNDLE_NOT_FOUND` is a listed device that had no
38
+ * prekey bundle when the send repaired it.
39
+ */
40
+ export interface DeviceSetLastRefusal {
41
+ readonly code: 'DEVICE_SET_MISMATCH' | 'STALE_DEVICE' | 'BUNDLE_NOT_FOUND';
42
+ readonly accounts: readonly DeviceSetRefusalAccount[];
43
+ }
44
+ /**
45
+ * Why a phase of a declared send ended without the acceptance of every
46
+ * device. `exhausted`: the Relay refused the declaration after the 10th
47
+ * restart. `expired`: the Relay refused a restart post with
48
+ * `OPERATION_EXPIRED`, because the operation epoch of the send is outside
49
+ * its admission window.
50
+ */
51
+ export type DeviceSetUnresolvedReason = 'exhausted' | 'expired';
52
+ /** The terminal record of a phase that ended without reconciliation. */
53
+ export interface DeviceSetUnresolved {
54
+ readonly phase: DeviceSetPhase;
55
+ readonly reason: DeviceSetUnresolvedReason;
56
+ readonly restarts: number;
57
+ /** Absent when the phase resumed from a stored count and ended before a refusal. */
58
+ readonly lastRefusal?: DeviceSetLastRefusal;
59
+ }
60
+ /**
61
+ * A declared send that ended without the acceptance of every device. The
62
+ * devices in `acceptedDevices` stay accepted. The outbox keeps the send as
63
+ * terminal, and the SDK does not post it again. A call of `send()` with the
64
+ * same `clientMessageId` starts a new run at 0 restarts.
65
+ *
66
+ * `isOutgoingMessageError` is true for this error.
67
+ */
68
+ export declare class DeviceSetReconciliationError extends Error {
69
+ readonly name = "DeviceSetReconciliationError";
70
+ readonly reason: DeviceSetUnresolvedReason;
71
+ readonly phase: DeviceSetPhase;
72
+ readonly restarts: number;
73
+ readonly lastRefusal: DeviceSetLastRefusal | undefined;
74
+ readonly acceptedDevices: readonly DeviceSetDevice[];
75
+ readonly unresolvedDevices: readonly DeviceSetDevice[];
76
+ readonly clientMessageId: string;
77
+ constructor(unresolved: DeviceSetUnresolved, devices: {
78
+ readonly acceptedDevices: readonly DeviceSetDevice[];
79
+ readonly unresolvedDevices: readonly DeviceSetDevice[];
80
+ }, clientMessageId: string);
81
+ }
82
+ /**
83
+ * The route of a send whose Relay did not mark a declared post as compared.
84
+ * `identified-direct`: an identified post to one device. `anonymous-direct`:
85
+ * a sealed post to one device. `anonymous-group`: the shared sealed post of a
86
+ * group send.
87
+ */
88
+ export type RelayProtocolRoute = 'identified-direct' | 'anonymous-direct' | 'anonymous-group';
89
+ /** The code of a Relay answer that does not follow the device-set contract. */
90
+ export type RelayProtocolErrorCode = 'DEVICE_SET_UNCHECKED';
91
+ /**
92
+ * A Relay accepted a declared post without the `deviceSetChecked` mark. The
93
+ * send is delivered and its result does not change, because a second post
94
+ * could deliver the message twice. The client reports the error once for the
95
+ * send through `onRelayProtocolError`. A sync payload of a method such as
96
+ * `syncReadToLinkedDevices` has no send ID, so its error has no
97
+ * `clientMessageId`.
98
+ */
99
+ export declare class RelayProtocolError extends Error {
100
+ readonly code: RelayProtocolErrorCode;
101
+ readonly clientMessageId: string | undefined;
102
+ readonly route: RelayProtocolRoute;
103
+ readonly name = "RelayProtocolError";
104
+ constructor(code: RelayProtocolErrorCode, clientMessageId: string | undefined, route: RelayProtocolRoute);
105
+ }
106
+ /** Mark a send result with the protocol error of its send. */
107
+ export declare function markRelayProtocolError<T extends object>(result: T, error: RelayProtocolError): T;
108
+ /** The protocol error that a send result is marked with, if any. */
109
+ export declare function relayProtocolErrorOf(result: unknown): RelayProtocolError | undefined;
110
+ /** The receipt of one accepted declared post and the route of the post. */
111
+ export type DeclaredPostReceipt = readonly [RelayPostAcceptance, RelayProtocolRoute];
112
+ /** The end of the declared sync phase of a send. */
113
+ export interface DeclaredSyncOutcome {
114
+ /** True when every sync post was accepted. */
115
+ readonly synced: boolean;
116
+ /** The receipt of each accepted sync post of every pass. */
117
+ readonly accepted: readonly RelayPostAcceptance[];
118
+ }
119
+ /** The receipts of accepted sync posts. A sync copy is an identified post to an own device. */
120
+ export declare function syncPostReceipts(accepted: readonly RelayPostAcceptance[]): DeclaredPostReceipt[];
121
+ /**
122
+ * The protocol error of the first receipt that has no `deviceSetChecked`
123
+ * mark, or undefined when the Relay marked each receipt.
124
+ */
125
+ export declare function uncheckedDeclaredPost(receipts: readonly DeclaredPostReceipt[], clientMessageId: string | undefined): RelayProtocolError | undefined;
126
+ /** The repairs of one account that the refusals of a pass name. */
127
+ export interface DeviceSetAccountRepair {
128
+ readonly userId: string;
129
+ readonly missingDeviceIds: readonly number[];
130
+ readonly extraDeviceIds: readonly number[];
131
+ readonly staleDeviceIds: readonly number[];
132
+ }
133
+ /**
134
+ * Merge the refusals of one pass by account. The posts of one account in a
135
+ * pass share one declaration, so no device is both missing and extra. A
136
+ * device that is extra is not also repaired as stale.
137
+ */
138
+ export declare function mergeDeviceSetRefusals(refusals: readonly DeviceSetRefusal[]): DeviceSetAccountRepair[];
139
+ /** The answer to one device post of a pass. */
140
+ export interface DeviceSetPost<T> {
141
+ readonly device: DeviceSetDevice;
142
+ readonly outcome: {
143
+ readonly ok: true;
144
+ readonly value: T;
145
+ } | {
146
+ readonly ok: false;
147
+ readonly error: unknown;
148
+ };
149
+ }
150
+ /** What a repair of one pass did. */
151
+ export interface DeviceSetRepairOutcome {
152
+ /** The listed devices that had no prekey bundle. The next pass waits first. */
153
+ readonly bundleMissing: readonly DeviceSetDevice[];
154
+ }
155
+ /** One phase of a declared send, as the reconciliation runs it. */
156
+ export interface DeviceSetPhaseRun<T> {
157
+ readonly phase: DeviceSetPhase;
158
+ readonly clientMessageId: string;
159
+ /** The restart count that the outbox holds for the phase. */
160
+ readonly restarts: number;
161
+ /** Post every device of the phase once with its declaration. */
162
+ pass(): Promise<readonly DeviceSetPost<T>[]>;
163
+ /**
164
+ * Repair the devices that the refusals name, and commit the repair with
165
+ * the new restart count in one write.
166
+ */
167
+ repair(repairs: readonly DeviceSetAccountRepair[], restarts: number): Promise<DeviceSetRepairOutcome>;
168
+ /** Record the terminal state of the phase. */
169
+ unresolve(unresolved: DeviceSetUnresolved): Promise<void>;
170
+ /** Wait before the next pass. Rejects when the send stops. */
171
+ wait(milliseconds: number): Promise<void>;
172
+ /** Log a failure of a pass that does not decide the phase. */
173
+ logFailure?(device: DeviceSetDevice, error: unknown): void;
174
+ }
175
+ /**
176
+ * Run one phase of a declared send until every device post is accepted.
177
+ *
178
+ * After a pass, the first rule that applies decides:
179
+ * 1. A stopped send throws `RelayWorkStopped`.
180
+ * 2. A restart post that the Relay refused with `OPERATION_EXPIRED` ends the
181
+ * phase with `expired`. The restart count does not change.
182
+ * 3. A device-set refusal repairs every device that the refusals of the pass
183
+ * name, and starts the phase again. After the 10th restart it ends the
184
+ * phase with `exhausted`.
185
+ * 4. Any other failure throws the failure of the first failed device.
186
+ *
187
+ * @returns The answers of the last pass, all accepted
188
+ * @throws {DeviceSetReconciliationError} when the phase ends unresolved
189
+ */
190
+ export declare function runDeviceSetPhase<T>(run: DeviceSetPhaseRun<T>): Promise<readonly DeviceSetPost<T>[]>;
191
+ /**
192
+ * Wait for a time, or reject with `RelayWorkStopped` when the stop signal
193
+ * aborts first.
194
+ */
195
+ export declare function waitUnlessStopped(milliseconds: number, stopSignal?: AbortSignal): Promise<void>;
196
+ //# sourceMappingURL=device-set-reconciliation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-set-reconciliation.d.ts","sourceRoot":"","sources":["../../client/device-set-reconciliation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGrF;;;;;;;;;;GAUG;AAEH,yDAAyD;AACzD,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;AAElD,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,yEA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AAC,CAAC,EAAE,CAAC,CAAC;IAC7C;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACtG,8CAA8C;IAC9C,SAAS,CAAC,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,8DAA8D;IAC9D,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,8DAA8D;IAC9D,UAAU,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5D;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAgGtC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAa/F"}
@@ -0,0 +1,282 @@
1
+ import { deviceSetRefusal, } from '../remote/relay/device-set.js';
2
+ import { relayOperationRefusal } from './relay-acceptance.js';
3
+ import { RelayWorkStopped } from './relay-work.js';
4
+ /**
5
+ * The device-set reconciliation of a declared send.
6
+ *
7
+ * A send that declares its device sets posts every device of one phase in a
8
+ * pass. When the Relay refuses the declaration of a post, the send repairs
9
+ * every device that the refusals of the pass name, adds one to the restart
10
+ * count of the phase in the same write, and posts the phase again. A device
11
+ * that the Relay accepted in an earlier pass gets its stored bytes again,
12
+ * and the Relay answers with the stored receipt. The recipient phase and the
13
+ * sync phase each have at most 10 restarts, so at most 11 posts.
14
+ */
15
+ /** The most restarts of one phase of a declared send. */
16
+ export const DEVICE_SET_RESTARTS_MAXIMUM = 10;
17
+ /**
18
+ * The wait before the next pass after a repair that found no prekey bundle
19
+ * for a listed device: 250 ms, then 500 ms, then 1 s for each later pass.
20
+ */
21
+ export function deviceSetBundleRetryDelay(consecutiveMisses) {
22
+ if (consecutiveMisses <= 1)
23
+ return 250;
24
+ if (consecutiveMisses === 2)
25
+ return 500;
26
+ return 1000;
27
+ }
28
+ /**
29
+ * A declared send that ended without the acceptance of every device. The
30
+ * devices in `acceptedDevices` stay accepted. The outbox keeps the send as
31
+ * terminal, and the SDK does not post it again. A call of `send()` with the
32
+ * same `clientMessageId` starts a new run at 0 restarts.
33
+ *
34
+ * `isOutgoingMessageError` is true for this error.
35
+ */
36
+ export class DeviceSetReconciliationError extends Error {
37
+ name = 'DeviceSetReconciliationError';
38
+ reason;
39
+ phase;
40
+ restarts;
41
+ lastRefusal;
42
+ acceptedDevices;
43
+ unresolvedDevices;
44
+ clientMessageId;
45
+ constructor(unresolved, devices, clientMessageId) {
46
+ super(unresolved.reason === 'exhausted'
47
+ ? `The Relay refused the device sets of the ${unresolved.phase} phase after ${String(unresolved.restarts)} restarts`
48
+ : `The Relay refused a restart of the ${unresolved.phase} phase because the operation expired`);
49
+ this.reason = unresolved.reason;
50
+ this.phase = unresolved.phase;
51
+ this.restarts = unresolved.restarts;
52
+ this.lastRefusal = unresolved.lastRefusal;
53
+ this.acceptedDevices = devices.acceptedDevices;
54
+ this.unresolvedDevices = devices.unresolvedDevices;
55
+ this.clientMessageId = clientMessageId;
56
+ }
57
+ }
58
+ /**
59
+ * A Relay accepted a declared post without the `deviceSetChecked` mark. The
60
+ * send is delivered and its result does not change, because a second post
61
+ * could deliver the message twice. The client reports the error once for the
62
+ * send through `onRelayProtocolError`. A sync payload of a method such as
63
+ * `syncReadToLinkedDevices` has no send ID, so its error has no
64
+ * `clientMessageId`.
65
+ */
66
+ export class RelayProtocolError extends Error {
67
+ code;
68
+ clientMessageId;
69
+ route;
70
+ name = 'RelayProtocolError';
71
+ constructor(code, clientMessageId, route) {
72
+ super('The Relay accepted a declared post without comparing its device set');
73
+ this.code = code;
74
+ this.clientMessageId = clientMessageId;
75
+ this.route = route;
76
+ }
77
+ }
78
+ const relayProtocolErrors = new WeakMap();
79
+ /** Mark a send result with the protocol error of its send. */
80
+ export function markRelayProtocolError(result, error) {
81
+ if (!relayProtocolErrors.has(result))
82
+ relayProtocolErrors.set(result, error);
83
+ return result;
84
+ }
85
+ /** The protocol error that a send result is marked with, if any. */
86
+ export function relayProtocolErrorOf(result) {
87
+ return result !== null && typeof result === 'object'
88
+ ? relayProtocolErrors.get(result)
89
+ : undefined;
90
+ }
91
+ /** The receipts of accepted sync posts. A sync copy is an identified post to an own device. */
92
+ export function syncPostReceipts(accepted) {
93
+ return accepted.map((acceptance) => [acceptance, 'identified-direct']);
94
+ }
95
+ /**
96
+ * The protocol error of the first receipt that has no `deviceSetChecked`
97
+ * mark, or undefined when the Relay marked each receipt.
98
+ */
99
+ export function uncheckedDeclaredPost(receipts, clientMessageId) {
100
+ const unchecked = receipts.find(([acceptance]) => acceptance.deviceSetChecked !== true);
101
+ return unchecked
102
+ ? new RelayProtocolError('DEVICE_SET_UNCHECKED', clientMessageId, unchecked[1])
103
+ : undefined;
104
+ }
105
+ /**
106
+ * Merge the refusals of one pass by account. The posts of one account in a
107
+ * pass share one declaration, so no device is both missing and extra. A
108
+ * device that is extra is not also repaired as stale.
109
+ */
110
+ export function mergeDeviceSetRefusals(refusals) {
111
+ const accounts = new Map();
112
+ const account = (userId) => {
113
+ let entry = accounts.get(userId);
114
+ if (!entry) {
115
+ entry = { missing: new Set(), extra: new Set(), stale: new Set() };
116
+ accounts.set(userId, entry);
117
+ }
118
+ return entry;
119
+ };
120
+ for (const refusal of refusals) {
121
+ for (const refused of refusal.accounts) {
122
+ const entry = account(refused.userId);
123
+ if ('staleDeviceIds' in refused) {
124
+ for (const deviceId of refused.staleDeviceIds)
125
+ entry.stale.add(deviceId);
126
+ }
127
+ else {
128
+ for (const deviceId of refused.missingDeviceIds)
129
+ entry.missing.add(deviceId);
130
+ for (const deviceId of refused.extraDeviceIds)
131
+ entry.extra.add(deviceId);
132
+ }
133
+ }
134
+ }
135
+ const sorted = (devices) => [...devices].sort((a, b) => a - b);
136
+ return [...accounts].map(([userId, entry]) => {
137
+ for (const deviceId of entry.extra)
138
+ entry.missing.delete(deviceId);
139
+ for (const deviceId of entry.extra)
140
+ entry.stale.delete(deviceId);
141
+ return {
142
+ userId,
143
+ missingDeviceIds: sorted(entry.missing),
144
+ extraDeviceIds: sorted(entry.extra),
145
+ staleDeviceIds: sorted(entry.stale),
146
+ };
147
+ });
148
+ }
149
+ function lastRefusalOf(refusals, repairs) {
150
+ return {
151
+ code: refusals.some((refusal) => refusal.kind === 'mismatch')
152
+ ? 'DEVICE_SET_MISMATCH'
153
+ : 'STALE_DEVICE',
154
+ accounts: repairs.map((repair) => ({
155
+ userId: repair.userId,
156
+ missingDeviceIds: [...repair.missingDeviceIds],
157
+ extraDeviceIds: [...repair.extraDeviceIds],
158
+ staleDeviceIds: [...repair.staleDeviceIds],
159
+ })),
160
+ };
161
+ }
162
+ function deviceKey(device) {
163
+ return `${device.userId}\u0000${String(device.deviceId)}`;
164
+ }
165
+ /**
166
+ * Run one phase of a declared send until every device post is accepted.
167
+ *
168
+ * After a pass, the first rule that applies decides:
169
+ * 1. A stopped send throws `RelayWorkStopped`.
170
+ * 2. A restart post that the Relay refused with `OPERATION_EXPIRED` ends the
171
+ * phase with `expired`. The restart count does not change.
172
+ * 3. A device-set refusal repairs every device that the refusals of the pass
173
+ * name, and starts the phase again. After the 10th restart it ends the
174
+ * phase with `exhausted`.
175
+ * 4. Any other failure throws the failure of the first failed device.
176
+ *
177
+ * @returns The answers of the last pass, all accepted
178
+ * @throws {DeviceSetReconciliationError} when the phase ends unresolved
179
+ */
180
+ export async function runDeviceSetPhase(run) {
181
+ let restarts = run.restarts;
182
+ let lastRefusal;
183
+ let bundleMisses = 0;
184
+ const accepted = new Map();
185
+ const unresolve = async (reason, posts, named) => {
186
+ const unresolved = {
187
+ phase: run.phase,
188
+ reason,
189
+ restarts,
190
+ ...(lastRefusal && { lastRefusal }),
191
+ };
192
+ await run.unresolve(unresolved);
193
+ const unresolvedDevices = new Map();
194
+ for (const post of posts) {
195
+ if (!post.outcome.ok && !accepted.has(deviceKey(post.device))) {
196
+ unresolvedDevices.set(deviceKey(post.device), post.device);
197
+ }
198
+ }
199
+ for (const device of named) {
200
+ if (!accepted.has(deviceKey(device)))
201
+ unresolvedDevices.set(deviceKey(device), device);
202
+ }
203
+ throw new DeviceSetReconciliationError(unresolved, {
204
+ acceptedDevices: [...accepted.values()],
205
+ unresolvedDevices: [...unresolvedDevices.values()],
206
+ }, run.clientMessageId);
207
+ };
208
+ for (;;) {
209
+ const posts = await run.pass();
210
+ for (const post of posts) {
211
+ if (post.outcome.ok)
212
+ accepted.set(deviceKey(post.device), post.device);
213
+ }
214
+ const failures = posts.flatMap((post) => post.outcome.ok ? [] : [{ device: post.device, error: post.outcome.error }]);
215
+ if (failures.length === 0)
216
+ return posts;
217
+ const stopped = failures.find((failure) => failure.error instanceof RelayWorkStopped);
218
+ if (stopped)
219
+ throw stopped.error;
220
+ if (restarts > 0 &&
221
+ failures.some((failure) => relayOperationRefusal(failure.error) === 'OPERATION_EXPIRED')) {
222
+ return unresolve('expired', posts, []);
223
+ }
224
+ const refusals = failures.flatMap((failure) => {
225
+ const refusal = deviceSetRefusal(failure.error);
226
+ return refusal ? [refusal] : [];
227
+ });
228
+ if (refusals.length === 0) {
229
+ for (const failure of failures.slice(1))
230
+ run.logFailure?.(failure.device, failure.error);
231
+ throw failures[0].error;
232
+ }
233
+ const repairs = mergeDeviceSetRefusals(refusals);
234
+ lastRefusal = lastRefusalOf(refusals, repairs);
235
+ if (restarts >= DEVICE_SET_RESTARTS_MAXIMUM) {
236
+ const named = repairs.flatMap((repair) => [...repair.missingDeviceIds, ...repair.staleDeviceIds].map((deviceId) => ({
237
+ userId: repair.userId,
238
+ deviceId,
239
+ })));
240
+ return unresolve('exhausted', posts, named);
241
+ }
242
+ restarts += 1;
243
+ const { bundleMissing } = await run.repair(repairs, restarts);
244
+ if (bundleMissing.length === 0) {
245
+ bundleMisses = 0;
246
+ continue;
247
+ }
248
+ bundleMisses += 1;
249
+ lastRefusal = {
250
+ code: 'BUNDLE_NOT_FOUND',
251
+ accounts: [...new Set(bundleMissing.map((device) => device.userId))].map((userId) => ({
252
+ userId,
253
+ missingDeviceIds: bundleMissing
254
+ .filter((device) => device.userId === userId)
255
+ .map((device) => device.deviceId),
256
+ extraDeviceIds: [],
257
+ staleDeviceIds: [],
258
+ })),
259
+ };
260
+ await run.wait(deviceSetBundleRetryDelay(bundleMisses));
261
+ }
262
+ }
263
+ /**
264
+ * Wait for a time, or reject with `RelayWorkStopped` when the stop signal
265
+ * aborts first.
266
+ */
267
+ export function waitUnlessStopped(milliseconds, stopSignal) {
268
+ if (stopSignal?.aborted)
269
+ return Promise.reject(new RelayWorkStopped());
270
+ return new Promise((resolve, reject) => {
271
+ const onAbort = () => {
272
+ clearTimeout(timer);
273
+ reject(new RelayWorkStopped());
274
+ };
275
+ const timer = setTimeout(() => {
276
+ stopSignal?.removeEventListener('abort', onAbort);
277
+ resolve();
278
+ }, milliseconds);
279
+ stopSignal?.addEventListener('abort', onAbort, { once: true });
280
+ });
281
+ }
282
+ //# sourceMappingURL=device-set-reconciliation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-set-reconciliation.js","sourceRoot":"","sources":["../../client/device-set-reconciliation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAEjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAA4B,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;GAUG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAE9C;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAA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,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Sender key distributions and pairwise message records.
3
+ *
4
+ * A distribution carries the chain key of the sender's group chain. The
5
+ * chain key rests only in the sender key store. A MessageRecord keeps the
6
+ * plaintext of a pairwise send so the sender can answer a retry request, so
7
+ * the record of a send keeps the plaintext without its distribution (see
8
+ * `SignalProtocolContentAdapter.withoutSenderKeyDistribution`). A send that
9
+ * carries only a distribution keeps no record.
10
+ *
11
+ * An earlier version kept the whole plaintext. A one-time sweep at client
12
+ * start removes the distribution from each stored record, and the retry
13
+ * handler removes one that it finds at lookup.
14
+ */
15
+ import type { Logger } from '../logger.js';
16
+ import type { SignalProtocolLocalStore } from '../types/api.js';
17
+ import type { SignalProtocolContentAdapter } from './content-adapter.js';
18
+ /** The metadata key that records a completed sweep. */
19
+ export declare const DISTRIBUTION_RECORDS_SWEPT_MARKER = "migration:skdm-records-removed";
20
+ type DistributionRecordStore = Pick<SignalProtocolLocalStore, 'getMetadata' | 'setMetadata' | 'rewriteMessageRecords'>;
21
+ /**
22
+ * Remove the sender key distribution from every stored message record, once
23
+ * per store. A record that holds only a distribution is deleted, and the
24
+ * other content of a record is kept. The marker is written only after the
25
+ * sweep succeeds, so a failed sweep runs again at the next start.
26
+ */
27
+ export declare function removeDistributionsFromMessageRecords(storage: DistributionRecordStore, adapter: SignalProtocolContentAdapter, logger: Required<Logger>): Promise<void>;
28
+ export {};
29
+ //# sourceMappingURL=distribution-records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribution-records.d.ts","sourceRoot":"","sources":["../../client/distribution-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEtE,uDAAuD;AACvD,eAAO,MAAM,iCAAiC,mCAAmC,CAAC;AAElF,KAAK,uBAAuB,GAAG,IAAI,CACjC,wBAAwB,EACxB,aAAa,GAAG,aAAa,GAAG,uBAAuB,CACxD,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,qCAAqC,CACzD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,4BAA4B,EACrC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GACvB,OAAO,CAAC,IAAI,CAAC,CAUf"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Sender key distributions and pairwise message records.
3
+ *
4
+ * A distribution carries the chain key of the sender's group chain. The
5
+ * chain key rests only in the sender key store. A MessageRecord keeps the
6
+ * plaintext of a pairwise send so the sender can answer a retry request, so
7
+ * the record of a send keeps the plaintext without its distribution (see
8
+ * `SignalProtocolContentAdapter.withoutSenderKeyDistribution`). A send that
9
+ * carries only a distribution keeps no record.
10
+ *
11
+ * An earlier version kept the whole plaintext. A one-time sweep at client
12
+ * start removes the distribution from each stored record, and the retry
13
+ * handler removes one that it finds at lookup.
14
+ */
15
+ /** The metadata key that records a completed sweep. */
16
+ export const DISTRIBUTION_RECORDS_SWEPT_MARKER = 'migration:skdm-records-removed';
17
+ /**
18
+ * Remove the sender key distribution from every stored message record, once
19
+ * per store. A record that holds only a distribution is deleted, and the
20
+ * other content of a record is kept. The marker is written only after the
21
+ * sweep succeeds, so a failed sweep runs again at the next start.
22
+ */
23
+ export async function removeDistributionsFromMessageRecords(storage, adapter, logger) {
24
+ if ((await storage.getMetadata(DISTRIBUTION_RECORDS_SWEPT_MARKER)) !== null)
25
+ return;
26
+ const changed = await storage.rewriteMessageRecords((record) => adapter.withoutSenderKeyDistribution(record.plaintext));
27
+ await storage.setMetadata(DISTRIBUTION_RECORDS_SWEPT_MARKER, String(Date.now()));
28
+ logger.info('Removed sender key distributions from message records', {
29
+ category: 'E2EE',
30
+ data: { changed },
31
+ });
32
+ }
33
+ //# sourceMappingURL=distribution-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribution-records.js","sourceRoot":"","sources":["../../client/distribution-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,uDAAuD;AACvD,MAAM,CAAC,MAAM,iCAAiC,GAAG,gCAAgC,CAAC;AAOlF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,OAAgC,EAChC,OAAqC,EACrC,MAAwB;IAExB,IAAI,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO;IACpF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAC,MAAM,EAAE,EAAE,CAC7D,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAAC,SAAS,CAAC,CACvD,CAAC;IACF,MAAM,OAAO,CAAC,WAAW,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,CAAC,IAAI,CAAC,uDAAuD,EAAE;QACnE,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,EAAE,OAAO,EAAE;KAClB,CAAC,CAAC;AACL,CAAC"}