@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
@@ -35,6 +35,9 @@
35
35
  * });
36
36
  * ```
37
37
  */
38
+ import type { RetryTerminalClass } from '../local/store/reliability.js';
39
+ import type { RelayProtocolError } from './device-set-reconciliation.js';
40
+ export type { RetryTerminalClass };
38
41
  /**
39
42
  * Decrypted envelope passed to onMessageDecrypted hook
40
43
  *
@@ -72,6 +75,131 @@ export interface DeliveredEvent {
72
75
  /** The group ID, for a group message. */
73
76
  groupId?: string;
74
77
  }
78
+ /**
79
+ * The end of a retry request with no resend. The device that asked for the
80
+ * resend gets it for each class except `missing-prekey`. The device that
81
+ * sent the failed message gets `missing-prekey`, when it cannot start a new
82
+ * session with the requester. Each request ends once, and the hook runs once
83
+ * for it.
84
+ */
85
+ export interface RetryTerminalEvent {
86
+ /** Why the request ended. */
87
+ class: RetryTerminalClass;
88
+ /** The Relay message ID of the envelope that the requester failed to decrypt. */
89
+ failedEnvelopeId: string;
90
+ /**
91
+ * The session reset of the requester. Only an `expired-content` end of a
92
+ * client with a Relay has it.
93
+ */
94
+ recovery?: RetryTerminalRecoveryEvent;
95
+ }
96
+ /**
97
+ * The session reset of the requester after a retry request ends as
98
+ * `expired-content`.
99
+ *
100
+ * The requester archived its session with the device that sent the failed
101
+ * envelope, after each decrypt from that device in progress ended. The next
102
+ * message to or from the device starts a new session.
103
+ */
104
+ export interface RetryTerminalRecoveryEvent {
105
+ /** The user ID of the device whose session the requester archived. */
106
+ userId: string;
107
+ /** The device ID of the device whose session the requester archived. */
108
+ deviceId: number;
109
+ /**
110
+ * `applied`: the failed message is a group message, and the requester has
111
+ * a sender key for that group. The reset does not rotate the key. A key
112
+ * older than `maxSenderKeyAge` rotates at the next send, as at any send,
113
+ * and the new key goes to each member.
114
+ * `skipped`: a pairwise message, a group message whose group the receive
115
+ * did not resolve, or a group with no local sender key.
116
+ *
117
+ * With each outcome, the reset deletes the handoff rows of each device of
118
+ * that account in every group. The next send to each of those groups
119
+ * gives the current key to each of those devices.
120
+ */
121
+ senderKey: 'applied' | 'skipped';
122
+ /**
123
+ * `sent`: one null message went to the device and started the new session.
124
+ * `limited`: a null message went to the device in the last hour, so none
125
+ * was sent. `failed`: the send failed. With `limited` and `failed`, the
126
+ * next ordinary message starts the new session.
127
+ */
128
+ nullMessage: 'sent' | 'limited' | 'failed';
129
+ }
130
+ /**
131
+ * Why the client reports a delivery error for a failed envelope.
132
+ *
133
+ * - `content-hint`: the failed envelope has the `Default` content hint, or
134
+ * no hint, so the error comes at the first failure.
135
+ * - `deadline`: the failed envelope has the `Resendable` content hint, and
136
+ * its content did not come back within `RETRY_PLACEHOLDER_DEADLINE_MS`.
137
+ * - `rate-limit`: a rate limit refused the retry request of the envelope.
138
+ * - `request-ended`: the retry request ended with no resend, as
139
+ * `onRetryTerminal` reports.
140
+ */
141
+ export type DeliveryErrorCause = 'content-hint' | 'deadline' | 'rate-limit' | 'request-ended';
142
+ /** The recovery of one failed incoming envelope that had a delivery error. */
143
+ export interface DeliveryRecoveredEvent {
144
+ /** The Relay message ID of the envelope that the local device failed to decrypt. */
145
+ failedEnvelopeId: string;
146
+ /** The client message ID of the failed envelope, when its relay delivered one. */
147
+ clientMessageId?: string;
148
+ /** The user that sent the failed envelope. */
149
+ senderUserId: string;
150
+ /** The device that sent the failed envelope. */
151
+ senderDeviceId: number;
152
+ /** True when the failed envelope is a sender-key group message. */
153
+ groupMessage: boolean;
154
+ /**
155
+ * The group of a failed group message, in the form of
156
+ * `DecryptedEnvelope.conversationId`. A group envelope names no group, so
157
+ * the client knows it only when it holds the sender key that the message
158
+ * names. The error of a message that failed for a missing sender key has
159
+ * none. Its recovery has one when the decrypt that gave the content
160
+ * installed or used the sender key of the group. `processIncomingEnvelope`
161
+ * gives a resend's distribution to the caller and installs no key, so
162
+ * its recovery can have none.
163
+ */
164
+ groupId?: string;
165
+ /** The time of the first failure of the envelope, in epoch milliseconds. */
166
+ receivedAt: number;
167
+ }
168
+ /** The delivery error of one failed incoming envelope. */
169
+ export interface DeliveryErrorEvent extends DeliveryRecoveredEvent {
170
+ /** Why the client reports the error now. */
171
+ cause: DeliveryErrorCause;
172
+ }
173
+ /**
174
+ * Received content that waited on this device for 30 days. The client
175
+ * drops it after the hook.
176
+ */
177
+ export interface ReceiveExpiredEvent {
178
+ /** The receive record ID: the delivered fingerprint of the envelope. */
179
+ workId: string;
180
+ /** Why the content expired. */
181
+ reason: 'max-age';
182
+ /** When the device first admitted the content, in epoch milliseconds. */
183
+ receivedAt: number;
184
+ /**
185
+ * Where the content waited: `decrypted` for content that the client did
186
+ * not deliver yet, `awaiting-completion` for a helper receive that the
187
+ * application did not complete.
188
+ */
189
+ stage: 'decrypted' | 'awaiting-completion';
190
+ /** `relay` for a Relay message, `caller` for a helper receive. */
191
+ origin: 'relay' | 'caller';
192
+ /** The message ID. Absent for content stored before the receive queue. */
193
+ messageId?: string;
194
+ /** The sender. Absent for content stored before the receive queue. */
195
+ senderId?: string;
196
+ /** The sender device. Absent for content stored before the receive queue. */
197
+ senderDeviceId?: number;
198
+ /** The raw group of the content, when known. */
199
+ groupId?: string;
200
+ /** The failed envelope that the content resends, for a resend. */
201
+ failedEnvelopeId?: string;
202
+ }
75
203
  export interface DecryptedEnvelope {
76
204
  /** Unique message ID (from server or generated) */
77
205
  messageId: string;
@@ -85,11 +213,17 @@ export interface DecryptedEnvelope {
85
213
  conversationId: string;
86
214
  /** Decrypted plaintext content (typically JSON) */
87
215
  content: string;
88
- /** Message timestamp (from sender) */
216
+ /**
217
+ * The sender's timestamp from the content, which a receipt for the
218
+ * message names. Content with no timestamp gives `receivedAt`.
219
+ */
89
220
  timestamp: number;
90
221
  /** Relay server timestamp when available */
91
222
  serverTimestamp?: number;
92
- /** When the device received the message locally */
223
+ /**
224
+ * When the device first admitted the message locally, in epoch
225
+ * milliseconds. A retry and a restart give the same time.
226
+ */
93
227
  receivedAt: number;
94
228
  /** Whether this is a group message */
95
229
  isGroup: boolean;
@@ -144,7 +278,11 @@ export interface SignalProtocolClientHooks {
144
278
  * Runs after the client archives a session (moved to inactive list)
145
279
  *
146
280
  * Stale-device recovery archives the session so delayed messages can still
147
- * attempt decryption.
281
+ * attempt decryption. When the recovery refreshes the session of a receipt
282
+ * or a retry request, the new session archives the stale one in the same
283
+ * write, and the hook runs after that session start succeeds. A failure
284
+ * in the SESAME registration after that write keeps the new session and
285
+ * runs no hook.
148
286
  * Per SESAME §3.2: "previously active session is moved to the head of the inactive sessions list"
149
287
  *
150
288
  * @param sessionId - The identifier of the archived session
@@ -197,6 +335,15 @@ export interface SignalProtocolClientHooks {
197
335
  * The hook receives the full decrypted envelope with all metadata
198
336
  * needed to store the message in the encrypted content database.
199
337
  *
338
+ * Delivery is at least once. The client stores the content before it
339
+ * acknowledges the Relay message and runs the hook after that. A stop or
340
+ * a crash before the client records the delivery runs the hook again
341
+ * with the same `messageId`. Deduplicate on `messageId`.
342
+ *
343
+ * The hook must settle. The receive queue runs one hook call at a time,
344
+ * so a hook that never settles stops the queue and `processPendingReceives`
345
+ * until the process restarts.
346
+ *
200
347
  * @param envelope - The decrypted message envelope
201
348
  *
202
349
  * @example
@@ -282,11 +429,20 @@ export interface SignalProtocolClientHooks {
282
429
  * Runs when a recipient device gets one of this client's messages
283
430
  *
284
431
  * A message to one device goes from accepted (the send resolved) to
285
- * delivered. The hook runs once for each source that reports the delivery:
432
+ * delivered. The hook runs for each source that reports the delivery:
286
433
  * `'relay'` when the Relay hands the message to the device, and `'e2ee'`
287
434
  * when the device decrypts it and sends an encrypted delivery receipt. A
288
- * second report from the same source does not run the hook. A receipt that
289
- * arrives before the send resolves runs the hook after the send resolves.
435
+ * receipt that arrives before the send resolves runs the hook after the
436
+ * send resolves.
437
+ *
438
+ * The hook runs at least once for each source. The client marks a source
439
+ * announced only after the hook returns. An error from the hook fails the
440
+ * receipt, so the relay delivers it again. A hook that throws, a client
441
+ * stop during the hook, or a crash leaves the source unannounced, and the
442
+ * hook runs again for it with the next receipt for the message. A second
443
+ * report from the same source after the hook returned does not run the
444
+ * hook. Make the hook idempotent for one `clientMessageId`,
445
+ * `recipientDeviceId`, and `source`.
290
446
  *
291
447
  * @param event - The delivery and its sources so far
292
448
  *
@@ -301,6 +457,152 @@ export interface SignalProtocolClientHooks {
301
457
  * ```
302
458
  */
303
459
  onDelivered?: (event: DeliveredEvent) => void | Promise<void>;
460
+ /**
461
+ * Runs when a retry request ends with no resend
462
+ *
463
+ * A failed decrypt asks the sender device for a resend. The request ends
464
+ * when the Relay gives a conclusive answer to its post, when it does not
465
+ * get its content before its deadline, 14 days after the first failure,
466
+ * when the resend of the fifth attempt also fails, when the sender used up
467
+ * its retry allowance, when the sender device has no prekey bundle of the
468
+ * requester, or when the sender device refuses group content to a
469
+ * requester that is not a current member of the group. The content of the
470
+ * failed envelope is then lost. The hook runs at least once for each
471
+ * request. The SDK marks the end emitted only after the hook returns. A
472
+ * hook that throws, a client stop during the hook, or a crash leaves the
473
+ * end not emitted, and the hook runs again at the next retry request pass,
474
+ * start, or redelivery. Make the hook idempotent for one
475
+ * `failedEnvelopeId`.
476
+ *
477
+ * Before the hook, an `expired-content` end resets the session with the
478
+ * device that sent the failed envelope, and `event.recovery` tells what
479
+ * the reset did. The other classes, and a post that fails and can be
480
+ * posted again, reset nothing. `onSessionArchived` runs for the archive.
481
+ *
482
+ * @param event - The class of the end, the failed envelope, and the reset
483
+ *
484
+ * @example
485
+ * ```typescript
486
+ * onRetryTerminal: async (event) => {
487
+ * await messageStore.markUndecryptable(event.failedEnvelopeId, event.class);
488
+ * }
489
+ * ```
490
+ */
491
+ onRetryTerminal?: (event: RetryTerminalEvent) => void | Promise<void>;
492
+ /**
493
+ * Runs when an incoming message failed to decrypt and its content did not
494
+ * come back
495
+ *
496
+ * A failed decrypt asks the sender device for a resend and acknowledges
497
+ * the failed envelope. The content hint of the envelope sets when the
498
+ * hook runs. With the `Default` hint, or no hint, it runs at the first
499
+ * failure. With the `Resendable` hint, it runs when the content did not
500
+ * come back within `RETRY_PLACEHOLDER_DEADLINE_MS`, one hour, of the
501
+ * first failure. With the `Implicit` hint, it never runs. A rate limit
502
+ * that refuses the retry request, and the end of the request, make it run
503
+ * at once. The client checks the time at each redelivery of the envelope
504
+ * and at each retry family write. With a relay, it also checks at
505
+ * create() and, while the client runs, at the time when the error is due.
506
+ *
507
+ * The hook runs at least once for each failed envelope, also across a
508
+ * restart. The client marks the error shown only after the hook returns.
509
+ * A hook that throws, a client stop during the hook, or a crash leaves the
510
+ * error not shown, and the hook runs again at the next retry request
511
+ * pass, start, or redelivery. The receive path does not acknowledge a
512
+ * failed envelope whose hook threw. Make the hook idempotent for one
513
+ * `failedEnvelopeId`. The error deletes nothing: the retry request
514
+ * continues, and when the content comes back, `onDeliveryRecovered` runs.
515
+ *
516
+ * @param event - The failed envelope, its sender and the cause
517
+ *
518
+ * @example
519
+ * ```typescript
520
+ * onDeliveryError: async (event) => {
521
+ * await messageStore.showUndelivered(event.failedEnvelopeId, event.senderUserId);
522
+ * }
523
+ * ```
524
+ */
525
+ onDeliveryError?: (event: DeliveryErrorEvent) => void | Promise<void>;
526
+ /**
527
+ * Runs when the content of a failed incoming message comes back after
528
+ * `onDeliveryError` ran for it
529
+ *
530
+ * The content comes back in a resend from the sender device, or in a
531
+ * redelivery of the failed envelope that now decrypts. The application
532
+ * gets the content as for any message, and then this hook runs. Its
533
+ * event carries the time of the first failure, so the application can put
534
+ * the message back in its first place.
535
+ *
536
+ * The hook runs at least once for each failed envelope, also across a
537
+ * restart. The client marks the recovery only after the hook returns. A
538
+ * hook that throws, a client stop during the hook, or a crash leaves the
539
+ * recovery not marked, and the hook runs again at the next retry request
540
+ * pass, start, or receive of an envelope of the same retry family. An
541
+ * error from the hook after the content does not fail that receive. Make
542
+ * the hook idempotent for one `failedEnvelopeId`.
543
+ *
544
+ * @param event - The failed envelope and its sender
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * onDeliveryRecovered: async (event) => {
549
+ * await messageStore.clearUndelivered(event.failedEnvelopeId);
550
+ * }
551
+ * ```
552
+ */
553
+ onDeliveryRecovered?: (event: DeliveryRecoveredEvent) => void | Promise<void>;
554
+ /**
555
+ * Runs when received content waited on this device for 30 days, before
556
+ * the client drops it.
557
+ *
558
+ * Content waits when its group state is not current, or when a helper
559
+ * receive is not completed. The hook runs at least once: a stop or a
560
+ * crash before the client records the expiry runs it again for the same
561
+ * `workId`. The client sends no delivery receipt and no retry request for
562
+ * expired content.
563
+ *
564
+ * @param event - The expired content, without its plaintext
565
+ *
566
+ * @example
567
+ * ```typescript
568
+ * onReceiveExpired: async (event) => {
569
+ * await messageStore.markLost(event.messageId ?? event.workId);
570
+ * }
571
+ * ```
572
+ */
573
+ onReceiveExpired?: (event: ReceiveExpiredEvent) => void | Promise<void>;
574
+ /**
575
+ * Runs once for a completed send whose Relay accepted a declared post
576
+ * without the `deviceSetChecked` mark. A declared post is a post to a
577
+ * recipient device or a sync copy to another device of the own account.
578
+ *
579
+ * The client declares the device set of each recipient account only to a
580
+ * Relay that compares device sets. Such a Relay marks each post that it
581
+ * compared. An accepted post without the mark is a Relay defect: the Relay
582
+ * did not check the declared devices. The send is delivered, so its result
583
+ * does not change and the client does not post it again. The error carries
584
+ * the code `DEVICE_SET_UNCHECKED`, the `clientMessageId` of the send, and
585
+ * the route of the post. The route is `identified-direct`,
586
+ * `anonymous-direct`, or `anonymous-group`. A sync copy is an
587
+ * `identified-direct` post. The client also logs one warning with the code
588
+ * and the route.
589
+ *
590
+ * The hook also runs once for a sync payload of a method such as
591
+ * `syncReadToLinkedDevices`. That error has no `clientMessageId`.
592
+ *
593
+ * The hook runs after the send completes. An error from the hook does not
594
+ * change the send result. The client logs the error.
595
+ *
596
+ * @param error - The protocol error of the send
597
+ *
598
+ * @example
599
+ * ```typescript
600
+ * onRelayProtocolError: (error) => {
601
+ * monitoring.report('relay-protocol', { code: error.code, route: error.route });
602
+ * }
603
+ * ```
604
+ */
605
+ onRelayProtocolError?: (error: RelayProtocolError) => void | Promise<void>;
304
606
  /**
305
607
  * Runs when the client receives a read receipt
306
608
  *
@@ -1 +1 @@
1
- {"version":3,"file":"event-hooks.d.ts","sourceRoot":"","sources":["../../client/event-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH;;;;;GAKG;AACH,OAAO,EAAE,CAAC;AAEV;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9C,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,EAAE,cAAc,CAAC;IACvB,mEAAmE;IACnE,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,+EAA+E;IAC/E,mBAAmB,EAAE,OAAO,CAAC;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SA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;;;OAkBG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzF;;;;;;;;;;;;;;;;;OAiBG;IACH,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3F;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,yBAAyB,CAAC,EAAE,CAC1B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,OAAO,SAAS,EAAE,YAAY,KACnC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC"}
@@ -35,6 +35,7 @@
35
35
  * });
36
36
  * ```
37
37
  */
38
+ import { ReceiveHookTimeout } from './receive-hook-bound.js';
38
39
  import { rethrowRelayWorkStopped } from './relay-work.js';
39
40
  const HOOK_NAMES = {
40
41
  onSessionEstablished: true,
@@ -47,6 +48,11 @@ const HOOK_NAMES = {
47
48
  onEncryptionError: true,
48
49
  onKeysCleanedUp: true,
49
50
  onDelivered: true,
51
+ onRetryTerminal: true,
52
+ onDeliveryError: true,
53
+ onDeliveryRecovered: true,
54
+ onReceiveExpired: true,
55
+ onRelayProtocolError: true,
50
56
  onReadReceiptReceived: true,
51
57
  onViewedReceiptReceived: true,
52
58
  onTypingIndicatorReceived: true,
@@ -80,6 +86,9 @@ export async function callHook(hooks, hookName, ...args) {
80
86
  }
81
87
  catch (error) {
82
88
  rethrowRelayWorkStopped(error);
89
+ // The receive hook bound logged its timeout.
90
+ if (error instanceof ReceiveHookTimeout)
91
+ return;
83
92
  // Log hook error but do not let it break core functionality
84
93
  console.error(`Hook ${hookName} failed:`, error);
85
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"event-hooks.js","sourceRoot":"","sources":["../../client/event-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAmWvD,MAAM,UAAU,GAAG;IACjB,oBAAoB,EAAE,IAAI;IAC1B,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,IAAI;IACjB,qBAAqB,EAAE,IAAI;IAC3B,uBAAuB,EAAE,IAAI;IAC7B,yBAAyB,EAAE,IAAI;CACU,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAA4C,EAC5C,QAAW,EACX,GAAG,IAA2D;IAE9D,IAAI,CAAC,KAAK,IAAI,CAAC,KAA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H,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The listed device set of one send. A replay reads the device lists of the
3
+ * members and of the sender's own account again, and this module finds how
4
+ * the read changes the stored set: the stored targets that the read no longer
5
+ * lists, and the listed devices that the send does not reach yet. It does not
6
+ * post or encrypt.
7
+ */
8
+ import type { OutgoingGroupDevice, StoredGroupSharedMessage, StoredOutgoingDeviceMessage, StoredOutgoingMessageIntent } from '../local/store/reliability.js';
9
+ import type { GroupMemberDevice } from '../remote/relay/types.js';
10
+ /** The change that a new read of the member device lists makes to a stored group send. */
11
+ export interface ListedGroupDeviceChange {
12
+ /**
13
+ * The devices of other members that a stored pre-message or device message
14
+ * targets, and that the read no longer lists.
15
+ */
16
+ unlisted: OutgoingGroupDevice[];
17
+ /** The listed devices of other members that no stored device message targets. */
18
+ added: GroupMemberDevice[];
19
+ }
20
+ /** The change that a new read of the sender's own device list makes to the sync copies of a send. */
21
+ export interface ListedOwnDeviceChange {
22
+ /** The own devices that a stored sync copy targets, and that the read no longer lists. */
23
+ unlisted: number[];
24
+ /** The listed own devices that no stored sync copy targets, in list order. */
25
+ added: number[];
26
+ }
27
+ /** One key for each device of an account. */
28
+ export declare function groupDeviceKey({ userId, deviceId }: OutgoingGroupDevice): string;
29
+ /**
30
+ * The change that `listed` makes to the stored targets of `intent`. `listed`
31
+ * holds the complete device list of each member of the send. The devices of
32
+ * the sender's own account are not member targets.
33
+ */
34
+ export declare function listedGroupDeviceChange(intent: StoredOutgoingMessageIntent, listed: readonly GroupMemberDevice[], senderUserId: string): ListedGroupDeviceChange;
35
+ /**
36
+ * The change that `listedDeviceIds` makes to the stored sync copies of a
37
+ * send. `listedDeviceIds` holds the sender's own listed devices other than
38
+ * the sending device.
39
+ */
40
+ export declare function listedOwnDeviceChange(syncMessages: readonly StoredOutgoingDeviceMessage[], listedDeviceIds: readonly number[]): ListedOwnDeviceChange;
41
+ /**
42
+ * The devices that a stored shared body names, as keys, each with the
43
+ * registration that the body names for it. The body names the devices of
44
+ * each account in the order of `recipientUserIds`.
45
+ */
46
+ export declare function sharedBodyDevices(shared: StoredGroupSharedMessage): Map<string, number>;
47
+ //# sourceMappingURL=group-device-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-device-set.d.ts","sourceRoot":"","sources":["../../client/group-device-set.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,0FAA0F;AAC1F,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,iFAAiF;IACjF,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,qGAAqG;AACrG,MAAM,WAAW,qBAAqB;IACpC,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,6CAA6C;AAC7C,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,GAAG,MAAM,CAEhF;AAOD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,2BAA2B,EACnC,MAAM,EAAE,SAAS,iBAAiB,EAAE,EACpC,YAAY,EAAE,MAAM,GACnB,uBAAuB,CAezB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,SAAS,2BAA2B,EAAE,EACpD,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,qBAAqB,CAOvB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,wBAAwB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAYvF"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The listed device set of one send. A replay reads the device lists of the
3
+ * members and of the sender's own account again, and this module finds how
4
+ * the read changes the stored set: the stored targets that the read no longer
5
+ * lists, and the listed devices that the send does not reach yet. It does not
6
+ * post or encrypt.
7
+ */
8
+ import { base64ToBytes } from '../internal/crypto/index.js';
9
+ import { deserializeSentMessage } from '../internal/protocol/sealed-sender/multi-recipient-message.js';
10
+ import { asBase64 } from '../types/utils.js';
11
+ /** One key for each device of an account. */
12
+ export function groupDeviceKey({ userId, deviceId }) {
13
+ return `${userId}\u0000${String(deviceId)}`;
14
+ }
15
+ /** The key of the device that a stored message targets. */
16
+ function targetKey(message) {
17
+ return groupDeviceKey({ userId: message.recipientUserId, deviceId: message.recipientDeviceId });
18
+ }
19
+ /**
20
+ * The change that `listed` makes to the stored targets of `intent`. `listed`
21
+ * holds the complete device list of each member of the send. The devices of
22
+ * the sender's own account are not member targets.
23
+ */
24
+ export function listedGroupDeviceChange(intent, listed, senderUserId) {
25
+ const others = listed.filter((member) => member.userId !== senderUserId);
26
+ const listedKeys = new Set(others.map(groupDeviceKey));
27
+ const unlisted = new Map();
28
+ for (const message of [...(intent.preMessages ?? []), ...intent.deviceMessages]) {
29
+ const key = targetKey(message);
30
+ if (!listedKeys.has(key)) {
31
+ unlisted.set(key, { userId: message.recipientUserId, deviceId: message.recipientDeviceId });
32
+ }
33
+ }
34
+ const targeted = new Set(intent.deviceMessages.map(targetKey));
35
+ return {
36
+ unlisted: [...unlisted.values()],
37
+ added: others.filter((member) => !targeted.has(groupDeviceKey(member))),
38
+ };
39
+ }
40
+ /**
41
+ * The change that `listedDeviceIds` makes to the stored sync copies of a
42
+ * send. `listedDeviceIds` holds the sender's own listed devices other than
43
+ * the sending device.
44
+ */
45
+ export function listedOwnDeviceChange(syncMessages, listedDeviceIds) {
46
+ const listed = new Set(listedDeviceIds);
47
+ const stored = new Set(syncMessages.map((message) => message.recipientDeviceId));
48
+ return {
49
+ unlisted: [...stored].filter((deviceId) => !listed.has(deviceId)),
50
+ added: [...listed].filter((deviceId) => !stored.has(deviceId)),
51
+ };
52
+ }
53
+ /**
54
+ * The devices that a stored shared body names, as keys, each with the
55
+ * registration that the body names for it. The body names the devices of
56
+ * each account in the order of `recipientUserIds`.
57
+ */
58
+ export function sharedBodyDevices(shared) {
59
+ const { recipients } = deserializeSentMessage(base64ToBytes(asBase64(shared.sentMessageBase64)));
60
+ return new Map(recipients.flatMap(({ devices }, index) => devices.map(({ deviceId, registrationId }) => [
61
+ groupDeviceKey({ userId: shared.recipientUserIds[index], deviceId }),
62
+ registrationId,
63
+ ])));
64
+ }
65
+ //# sourceMappingURL=group-device-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-device-set.js","sourceRoot":"","sources":["../../client/group-device-set.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAC;AAQpG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAqB1C,6CAA6C;AAC7C,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAuB;IACtE,OAAO,GAAG,MAAM,SAAS,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC9C,CAAC;AAED,2DAA2D;AAC3D,SAAS,SAAS,CAAC,OAAoC;IACrD,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAClG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAmC,EACnC,MAAoC,EACpC,YAAoB;IAEpB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,YAAY,CAAC,CAAC;IACzE,MAAM,UAAU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