@open-e2ee/signal-protocol-sdk 11.0.0 → 12.0.1

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 (590) hide show
  1. package/ADAPTERS.md +4 -4
  2. package/ARCHITECTURE.md +6 -8
  3. package/CHANGELOG.md +1348 -0
  4. package/README.md +1 -1
  5. package/SECURITY.md +2 -2
  6. package/TROUBLESHOOTING.md +8 -8
  7. package/client/README.md +70 -37
  8. package/device/README.md +39 -85
  9. package/dist/client/client.d.ts +334 -63
  10. package/dist/client/client.d.ts.map +1 -1
  11. package/dist/client/client.js +1175 -186
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/config.d.ts +57 -42
  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 +280 -14
  42. package/dist/client/event-hooks.d.ts.map +1 -1
  43. package/dist/client/event-hooks.js +8 -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-mailbox-subscription.d.ts +34 -2
  82. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
  83. package/dist/client/hosted-mailbox-subscription.js +87 -17
  84. package/dist/client/hosted-mailbox-subscription.js.map +1 -1
  85. package/dist/client/hosted-push.d.ts +22 -4
  86. package/dist/client/hosted-push.d.ts.map +1 -1
  87. package/dist/client/hosted-push.js +75 -22
  88. package/dist/client/hosted-push.js.map +1 -1
  89. package/dist/client/hosted-transport.d.ts +22 -28
  90. package/dist/client/hosted-transport.d.ts.map +1 -1
  91. package/dist/client/hosted-transport.js +115 -55
  92. package/dist/client/hosted-transport.js.map +1 -1
  93. package/dist/client/hosted.d.ts +10 -4
  94. package/dist/client/hosted.d.ts.map +1 -1
  95. package/dist/client/hosted.js +10 -4
  96. package/dist/client/hosted.js.map +1 -1
  97. package/dist/client/index.d.ts +5 -3
  98. package/dist/client/index.d.ts.map +1 -1
  99. package/dist/client/index.js +2 -0
  100. package/dist/client/index.js.map +1 -1
  101. package/dist/client/messages.d.ts +25 -3
  102. package/dist/client/messages.d.ts.map +1 -1
  103. package/dist/client/messages.js +111 -20
  104. package/dist/client/messages.js.map +1 -1
  105. package/dist/client/receive-admission.d.ts +58 -0
  106. package/dist/client/receive-admission.d.ts.map +1 -0
  107. package/dist/client/receive-admission.js +78 -0
  108. package/dist/client/receive-admission.js.map +1 -0
  109. package/dist/client/receive-expiry.d.ts +31 -0
  110. package/dist/client/receive-expiry.d.ts.map +1 -0
  111. package/dist/client/receive-expiry.js +35 -0
  112. package/dist/client/receive-expiry.js.map +1 -0
  113. package/dist/client/receive-hook-bound.d.ts +50 -0
  114. package/dist/client/receive-hook-bound.d.ts.map +1 -0
  115. package/dist/client/receive-hook-bound.js +115 -0
  116. package/dist/client/receive-hook-bound.js.map +1 -0
  117. package/dist/client/receive-queue.d.ts +299 -0
  118. package/dist/client/receive-queue.d.ts.map +1 -0
  119. package/dist/client/receive-queue.js +1420 -0
  120. package/dist/client/receive-queue.js.map +1 -0
  121. package/dist/client/receive-work-seed.d.ts +54 -0
  122. package/dist/client/receive-work-seed.d.ts.map +1 -0
  123. package/dist/client/receive-work-seed.js +116 -0
  124. package/dist/client/receive-work-seed.js.map +1 -0
  125. package/dist/client/recovery-driver.d.ts +25 -0
  126. package/dist/client/recovery-driver.d.ts.map +1 -0
  127. package/dist/client/recovery-driver.js +121 -0
  128. package/dist/client/recovery-driver.js.map +1 -0
  129. package/dist/client/relay-acceptance.d.ts +20 -7
  130. package/dist/client/relay-acceptance.d.ts.map +1 -1
  131. package/dist/client/relay-acceptance.js +30 -12
  132. package/dist/client/relay-acceptance.js.map +1 -1
  133. package/dist/client/relay-device-refusal.d.ts +18 -0
  134. package/dist/client/relay-device-refusal.d.ts.map +1 -1
  135. package/dist/client/relay-device-refusal.js +31 -0
  136. package/dist/client/relay-device-refusal.js.map +1 -1
  137. package/dist/client/relay-sealed-route.d.ts +36 -0
  138. package/dist/client/relay-sealed-route.d.ts.map +1 -0
  139. package/dist/client/relay-sealed-route.js +45 -0
  140. package/dist/client/relay-sealed-route.js.map +1 -0
  141. package/dist/client/relay-subscription.d.ts +56 -13
  142. package/dist/client/relay-subscription.d.ts.map +1 -1
  143. package/dist/client/relay-subscription.js +193 -123
  144. package/dist/client/relay-subscription.js.map +1 -1
  145. package/dist/client/resendable-content.d.ts +98 -0
  146. package/dist/client/resendable-content.d.ts.map +1 -0
  147. package/dist/client/resendable-content.js +136 -0
  148. package/dist/client/resendable-content.js.map +1 -0
  149. package/dist/client/retry-family.d.ts +57 -10
  150. package/dist/client/retry-family.d.ts.map +1 -1
  151. package/dist/client/retry-family.js +54 -12
  152. package/dist/client/retry-family.js.map +1 -1
  153. package/dist/client/retry-request-envelope.d.ts +107 -8
  154. package/dist/client/retry-request-envelope.d.ts.map +1 -1
  155. package/dist/client/retry-request-envelope.js +172 -23
  156. package/dist/client/retry-request-envelope.js.map +1 -1
  157. package/dist/client/retry-request-lifecycle.d.ts +70 -14
  158. package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
  159. package/dist/client/retry-request-lifecycle.js +162 -32
  160. package/dist/client/retry-request-lifecycle.js.map +1 -1
  161. package/dist/client/retry-terminal-recovery.d.ts +100 -0
  162. package/dist/client/retry-terminal-recovery.d.ts.map +1 -0
  163. package/dist/client/retry-terminal-recovery.js +164 -0
  164. package/dist/client/retry-terminal-recovery.js.map +1 -0
  165. package/dist/client/retry-utils.d.ts +27 -0
  166. package/dist/client/retry-utils.d.ts.map +1 -1
  167. package/dist/client/retry-utils.js +46 -0
  168. package/dist/client/retry-utils.js.map +1 -1
  169. package/dist/client/retry.d.ts +100 -12
  170. package/dist/client/retry.d.ts.map +1 -1
  171. package/dist/client/retry.js +619 -116
  172. package/dist/client/retry.js.map +1 -1
  173. package/dist/client/sealed-sender.d.ts +23 -6
  174. package/dist/client/sealed-sender.d.ts.map +1 -1
  175. package/dist/client/sealed-sender.js +30 -6
  176. package/dist/client/sealed-sender.js.map +1 -1
  177. package/dist/client/sessions.d.ts +2 -2
  178. package/dist/client/sessions.js +2 -2
  179. package/dist/client/signal-service-cipher.d.ts +726 -19
  180. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  181. package/dist/client/signal-service-cipher.js +2260 -342
  182. package/dist/client/signal-service-cipher.js.map +1 -1
  183. package/dist/client/state.d.ts +5 -0
  184. package/dist/client/state.d.ts.map +1 -1
  185. package/dist/client/state.js +11 -1
  186. package/dist/client/state.js.map +1 -1
  187. package/dist/client/storage-protection.d.ts +64 -0
  188. package/dist/client/storage-protection.d.ts.map +1 -0
  189. package/dist/client/storage-protection.js +150 -0
  190. package/dist/client/storage-protection.js.map +1 -0
  191. package/dist/client/types.d.ts +149 -15
  192. package/dist/client/types.d.ts.map +1 -1
  193. package/dist/client/types.js +1 -1
  194. package/dist/client/types.js.map +1 -1
  195. package/dist/device/constants.d.ts +0 -5
  196. package/dist/device/constants.d.ts.map +1 -1
  197. package/dist/device/constants.js +0 -5
  198. package/dist/device/constants.js.map +1 -1
  199. package/dist/device/expo/index.d.ts +4 -17
  200. package/dist/device/expo/index.d.ts.map +1 -1
  201. package/dist/device/expo/index.js +4 -23
  202. package/dist/device/expo/index.js.map +1 -1
  203. package/dist/device/index.d.ts +0 -2
  204. package/dist/device/index.d.ts.map +1 -1
  205. package/dist/device/index.js +0 -7
  206. package/dist/device/index.js.map +1 -1
  207. package/dist/device/lifecycle/manager.d.ts +5 -4
  208. package/dist/device/lifecycle/manager.d.ts.map +1 -1
  209. package/dist/device/lifecycle/manager.js +16 -16
  210. package/dist/device/lifecycle/manager.js.map +1 -1
  211. package/dist/device/lifecycle/types.d.ts +2 -2
  212. package/dist/device/lifecycle/types.d.ts.map +1 -1
  213. package/dist/device/react-native/index.d.ts +4 -15
  214. package/dist/device/react-native/index.d.ts.map +1 -1
  215. package/dist/device/react-native/index.js +4 -21
  216. package/dist/device/react-native/index.js.map +1 -1
  217. package/dist/device/types.d.ts +1 -1
  218. package/dist/groups/index.d.ts +1 -1
  219. package/dist/groups/index.d.ts.map +1 -1
  220. package/dist/index.d.ts +8 -6
  221. package/dist/index.d.ts.map +1 -1
  222. package/dist/index.js +2 -1
  223. package/dist/index.js.map +1 -1
  224. package/dist/internal/crypto/ec/x25519-validation.d.ts +0 -1
  225. package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -1
  226. package/dist/internal/crypto/ec/x25519-validation.js +0 -1
  227. package/dist/internal/crypto/ec/x25519-validation.js.map +1 -1
  228. package/dist/internal/crypto/validation.d.ts +2 -2
  229. package/dist/internal/groups/index.d.ts +1 -0
  230. package/dist/internal/groups/index.d.ts.map +1 -1
  231. package/dist/internal/groups/index.js +1 -0
  232. package/dist/internal/groups/index.js.map +1 -1
  233. package/dist/internal/groups/manager.d.ts +37 -16
  234. package/dist/internal/groups/manager.d.ts.map +1 -1
  235. package/dist/internal/groups/manager.js +46 -1
  236. package/dist/internal/groups/manager.js.map +1 -1
  237. package/dist/internal/groups/receive-record.d.ts +78 -0
  238. package/dist/internal/groups/receive-record.d.ts.map +1 -0
  239. package/dist/internal/groups/receive-record.js +43 -0
  240. package/dist/internal/groups/receive-record.js.map +1 -0
  241. package/dist/internal/groups/sdk-store.d.ts +27 -3
  242. package/dist/internal/groups/sdk-store.d.ts.map +1 -1
  243. package/dist/internal/groups/sdk-store.js +151 -19
  244. package/dist/internal/groups/sdk-store.js.map +1 -1
  245. package/dist/internal/groups/wire.d.ts +12 -1
  246. package/dist/internal/groups/wire.d.ts.map +1 -1
  247. package/dist/internal/groups/wire.js +36 -0
  248. package/dist/internal/groups/wire.js.map +1 -1
  249. package/dist/internal/manager/index.d.ts +1 -1
  250. package/dist/internal/manager/manager.d.ts +26 -20
  251. package/dist/internal/manager/manager.d.ts.map +1 -1
  252. package/dist/internal/manager/manager.js +64 -41
  253. package/dist/internal/manager/manager.js.map +1 -1
  254. package/dist/internal/protocol/double-ratchet/chains.d.ts +4 -18
  255. package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -1
  256. package/dist/internal/protocol/double-ratchet/chains.js +23 -74
  257. package/dist/internal/protocol/double-ratchet/chains.js.map +1 -1
  258. package/dist/internal/protocol/double-ratchet/index.d.ts +1 -1
  259. package/dist/internal/protocol/double-ratchet/index.d.ts.map +1 -1
  260. package/dist/internal/protocol/double-ratchet/index.js +1 -1
  261. package/dist/internal/protocol/double-ratchet/index.js.map +1 -1
  262. package/dist/internal/protocol/double-ratchet/ratchet.d.ts +5 -7
  263. package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
  264. package/dist/internal/protocol/double-ratchet/ratchet.js +4 -6
  265. package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
  266. package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -1
  267. package/dist/internal/protocol/pqxdh/pqxdh.js +2 -1
  268. package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -1
  269. package/dist/internal/protocol/sealed-sender/types.d.ts +6 -8
  270. package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
  271. package/dist/internal/protocol/sealed-sender/types.js +8 -9
  272. package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
  273. package/dist/internal/protocol/sender-keys/handoff-ledger.d.ts +110 -0
  274. package/dist/internal/protocol/sender-keys/handoff-ledger.d.ts.map +1 -0
  275. package/dist/internal/protocol/sender-keys/handoff-ledger.js +124 -0
  276. package/dist/internal/protocol/sender-keys/handoff-ledger.js.map +1 -0
  277. package/dist/internal/protocol/sender-keys/manager.d.ts +71 -62
  278. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  279. package/dist/internal/protocol/sender-keys/manager.js +228 -175
  280. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  281. package/dist/internal/protocol/spqr/index.d.ts +2 -2
  282. package/dist/internal/protocol/spqr/index.d.ts.map +1 -1
  283. package/dist/internal/protocol/spqr/index.js +2 -2
  284. package/dist/internal/protocol/spqr/index.js.map +1 -1
  285. package/dist/internal/protocol/spqr/serialize.d.ts +9 -1
  286. package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -1
  287. package/dist/internal/protocol/spqr/serialize.js +56 -16
  288. package/dist/internal/protocol/spqr/serialize.js.map +1 -1
  289. package/dist/internal/protocol/spqr/spqr.d.ts +1 -14
  290. package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
  291. package/dist/internal/protocol/spqr/spqr.js +54 -42
  292. package/dist/internal/protocol/spqr/spqr.js.map +1 -1
  293. package/dist/internal/protocol/spqr/validate.d.ts +26 -6
  294. package/dist/internal/protocol/spqr/validate.d.ts.map +1 -1
  295. package/dist/internal/protocol/spqr/validate.js +49 -21
  296. package/dist/internal/protocol/spqr/validate.js.map +1 -1
  297. package/dist/internal/sesame/index.d.ts +1 -1
  298. package/dist/internal/sesame/index.d.ts.map +1 -1
  299. package/dist/internal/sesame/index.js.map +1 -1
  300. package/dist/internal/sesame/manager.d.ts +66 -13
  301. package/dist/internal/sesame/manager.d.ts.map +1 -1
  302. package/dist/internal/sesame/manager.js +221 -87
  303. package/dist/internal/sesame/manager.js.map +1 -1
  304. package/dist/internal/sesame/types.d.ts +95 -17
  305. package/dist/internal/sesame/types.d.ts.map +1 -1
  306. package/dist/internal/sesame/types.js +17 -0
  307. package/dist/internal/sesame/types.js.map +1 -1
  308. package/dist/internal/session/builder.d.ts +5 -5
  309. package/dist/internal/session/builder.d.ts.map +1 -1
  310. package/dist/internal/session/builder.js +12 -17
  311. package/dist/internal/session/builder.js.map +1 -1
  312. package/dist/internal/session/cipher.d.ts +15 -13
  313. package/dist/internal/session/cipher.d.ts.map +1 -1
  314. package/dist/internal/session/cipher.js +41 -23
  315. package/dist/internal/session/cipher.js.map +1 -1
  316. package/dist/internal/session/factory.d.ts +5 -5
  317. package/dist/internal/session/factory.d.ts.map +1 -1
  318. package/dist/internal/session/factory.js +4 -4
  319. package/dist/internal/session/factory.js.map +1 -1
  320. package/dist/internal/session/handshake.d.ts +14 -16
  321. package/dist/internal/session/handshake.d.ts.map +1 -1
  322. package/dist/internal/session/handshake.js +18 -75
  323. package/dist/internal/session/handshake.js.map +1 -1
  324. package/dist/internal/session/index.d.ts +1 -1
  325. package/dist/internal/session/index.js +1 -1
  326. package/dist/internal/session/record-locks.d.ts +17 -6
  327. package/dist/internal/session/record-locks.d.ts.map +1 -1
  328. package/dist/internal/session/record-locks.js +43 -7
  329. package/dist/internal/session/record-locks.js.map +1 -1
  330. package/dist/internal/session/session-resolver.d.ts +1 -1
  331. package/dist/internal/session/session-resolver.js +1 -1
  332. package/dist/internal/session/state.d.ts +2 -2
  333. package/dist/internal/session/state.js +1 -1
  334. package/dist/internal/session/types.d.ts +5 -13
  335. package/dist/internal/session/types.d.ts.map +1 -1
  336. package/dist/internal/session/types.js +1 -1
  337. package/dist/keys/generation.d.ts +2 -2
  338. package/dist/keys/generation.js +2 -2
  339. package/dist/keys/types.d.ts +5 -5
  340. package/dist/keys/types.d.ts.map +1 -1
  341. package/dist/keys/types.js +1 -1
  342. package/dist/layers.d.ts +1 -1
  343. package/dist/layers.js +2 -2
  344. package/dist/layers.js.map +1 -1
  345. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  346. package/dist/local/store/expo/adapter.js +12 -8
  347. package/dist/local/store/expo/adapter.js.map +1 -1
  348. package/dist/local/store/key-value/adapter.d.ts +76 -10
  349. package/dist/local/store/key-value/adapter.d.ts.map +1 -1
  350. package/dist/local/store/key-value/adapter.js +367 -61
  351. package/dist/local/store/key-value/adapter.js.map +1 -1
  352. package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -1
  353. package/dist/local/store/key-value/backend-conformance.js +74 -0
  354. package/dist/local/store/key-value/backend-conformance.js.map +1 -1
  355. package/dist/local/store/key-value/batch.d.ts +2 -0
  356. package/dist/local/store/key-value/batch.d.ts.map +1 -1
  357. package/dist/local/store/key-value/batch.js +26 -0
  358. package/dist/local/store/key-value/batch.js.map +1 -1
  359. package/dist/local/store/key-value/receive-work.d.ts +55 -0
  360. package/dist/local/store/key-value/receive-work.d.ts.map +1 -0
  361. package/dist/local/store/key-value/receive-work.js +162 -0
  362. package/dist/local/store/key-value/receive-work.js.map +1 -0
  363. package/dist/local/store/key-value/send-log.d.ts +61 -0
  364. package/dist/local/store/key-value/send-log.d.ts.map +1 -0
  365. package/dist/local/store/key-value/send-log.js +430 -0
  366. package/dist/local/store/key-value/send-log.js.map +1 -0
  367. package/dist/local/store/key-value/sender-key-handoff.d.ts +68 -0
  368. package/dist/local/store/key-value/sender-key-handoff.d.ts.map +1 -0
  369. package/dist/local/store/key-value/sender-key-handoff.js +189 -0
  370. package/dist/local/store/key-value/sender-key-handoff.js.map +1 -0
  371. package/dist/local/store/key-value/storage.d.ts +15 -0
  372. package/dist/local/store/key-value/storage.d.ts.map +1 -1
  373. package/dist/local/store/keyed-index.d.ts +23 -0
  374. package/dist/local/store/keyed-index.d.ts.map +1 -0
  375. package/dist/local/store/keyed-index.js +41 -0
  376. package/dist/local/store/keyed-index.js.map +1 -0
  377. package/dist/local/store/memory/adapter.d.ts +44 -12
  378. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  379. package/dist/local/store/memory/adapter.js +197 -46
  380. package/dist/local/store/memory/adapter.js.map +1 -1
  381. package/dist/local/store/memory/send-log.d.ts +42 -0
  382. package/dist/local/store/memory/send-log.d.ts.map +1 -0
  383. package/dist/local/store/memory/send-log.js +190 -0
  384. package/dist/local/store/memory/send-log.js.map +1 -0
  385. package/dist/local/store/node/adapter.d.ts.map +1 -1
  386. package/dist/local/store/node/adapter.js +8 -6
  387. package/dist/local/store/node/adapter.js.map +1 -1
  388. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  389. package/dist/local/store/react-native/adapter.js +12 -8
  390. package/dist/local/store/react-native/adapter.js.map +1 -1
  391. package/dist/local/store/receive-work.d.ts +87 -0
  392. package/dist/local/store/receive-work.d.ts.map +1 -0
  393. package/dist/local/store/receive-work.js +204 -0
  394. package/dist/local/store/receive-work.js.map +1 -0
  395. package/dist/local/store/received-content.d.ts +3 -3
  396. package/dist/local/store/received-content.d.ts.map +1 -1
  397. package/dist/local/store/received-content.js +2 -11
  398. package/dist/local/store/received-content.js.map +1 -1
  399. package/dist/local/store/reliability.d.ts +317 -18
  400. package/dist/local/store/reliability.d.ts.map +1 -1
  401. package/dist/local/store/reliability.js +371 -46
  402. package/dist/local/store/reliability.js.map +1 -1
  403. package/dist/local/store/send-log-order.d.ts +15 -0
  404. package/dist/local/store/send-log-order.d.ts.map +1 -0
  405. package/dist/local/store/send-log-order.js +24 -0
  406. package/dist/local/store/send-log-order.js.map +1 -0
  407. package/dist/local/store/sender-key-handoff-index.d.ts +38 -0
  408. package/dist/local/store/sender-key-handoff-index.d.ts.map +1 -0
  409. package/dist/local/store/sender-key-handoff-index.js +101 -0
  410. package/dist/local/store/sender-key-handoff-index.js.map +1 -0
  411. package/dist/local/store/sender-key-handoff-table.d.ts +29 -0
  412. package/dist/local/store/sender-key-handoff-table.d.ts.map +1 -0
  413. package/dist/local/store/sender-key-handoff-table.js +97 -0
  414. package/dist/local/store/sender-key-handoff-table.js.map +1 -0
  415. package/dist/local/store/sqlite/driver.d.ts +9 -0
  416. package/dist/local/store/sqlite/driver.d.ts.map +1 -1
  417. package/dist/local/store/sqlite/encryption.d.ts +8 -1
  418. package/dist/local/store/sqlite/encryption.d.ts.map +1 -1
  419. package/dist/local/store/sqlite/encryption.js +9 -0
  420. package/dist/local/store/sqlite/encryption.js.map +1 -1
  421. package/dist/local/store/sqlite/key-storage/index.d.ts +25 -4
  422. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
  423. package/dist/local/store/sqlite/key-storage/index.js +68 -7
  424. package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
  425. package/dist/local/store/sqlite/key-storage/message-records.d.ts +16 -4
  426. package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -1
  427. package/dist/local/store/sqlite/key-storage/message-records.js +49 -6
  428. package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -1
  429. package/dist/local/store/sqlite/key-storage/metadata.d.ts +8 -7
  430. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
  431. package/dist/local/store/sqlite/key-storage/metadata.js +17 -15
  432. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
  433. package/dist/local/store/sqlite/key-storage/receive-work.d.ts +27 -0
  434. package/dist/local/store/sqlite/key-storage/receive-work.d.ts.map +1 -0
  435. package/dist/local/store/sqlite/key-storage/receive-work.js +98 -0
  436. package/dist/local/store/sqlite/key-storage/receive-work.js.map +1 -0
  437. package/dist/local/store/sqlite/key-storage/send-log.d.ts +27 -0
  438. package/dist/local/store/sqlite/key-storage/send-log.d.ts.map +1 -0
  439. package/dist/local/store/sqlite/key-storage/send-log.js +178 -0
  440. package/dist/local/store/sqlite/key-storage/send-log.js.map +1 -0
  441. package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts +27 -0
  442. package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts.map +1 -0
  443. package/dist/local/store/sqlite/key-storage/sender-key-handoff.js +75 -0
  444. package/dist/local/store/sqlite/key-storage/sender-key-handoff.js.map +1 -0
  445. package/dist/local/store/sqlite/key-storage/session-trust.d.ts +2 -2
  446. package/dist/local/store/sqlite/key-storage/session-trust.js +5 -5
  447. package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -1
  448. package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
  449. package/dist/local/store/sqlite/migrations.js +101 -0
  450. package/dist/local/store/sqlite/migrations.js.map +1 -1
  451. package/dist/local/store/sqlite/models/index.d.ts +2 -1
  452. package/dist/local/store/sqlite/models/index.d.ts.map +1 -1
  453. package/dist/local/store/sqlite/models/index.js +5 -1
  454. package/dist/local/store/sqlite/models/index.js.map +1 -1
  455. package/dist/local/store/sqlite/models/message-record.d.ts +15 -0
  456. package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -1
  457. package/dist/local/store/sqlite/models/message-record.js +24 -0
  458. package/dist/local/store/sqlite/models/message-record.js.map +1 -1
  459. package/dist/local/store/sqlite/models/send-log.d.ts +51 -0
  460. package/dist/local/store/sqlite/models/send-log.d.ts.map +1 -0
  461. package/dist/local/store/sqlite/models/send-log.js +206 -0
  462. package/dist/local/store/sqlite/models/send-log.js.map +1 -0
  463. package/dist/local/store/sqlite/open-store.d.ts +9 -1
  464. package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
  465. package/dist/local/store/sqlite/open-store.js +20 -1
  466. package/dist/local/store/sqlite/open-store.js.map +1 -1
  467. package/dist/local/store/sqlite/schema.d.ts +34 -1
  468. package/dist/local/store/sqlite/schema.d.ts.map +1 -1
  469. package/dist/local/store/sqlite/schema.js +14 -0
  470. package/dist/local/store/sqlite/schema.js.map +1 -1
  471. package/dist/local/store/sqlite/store.d.ts +61 -11
  472. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  473. package/dist/local/store/sqlite/store.js +191 -27
  474. package/dist/local/store/sqlite/store.js.map +1 -1
  475. package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.mjs +2 -1
  476. package/dist/local/store/sqlite/web/worker.d.ts +8 -0
  477. package/dist/local/store/sqlite/web/worker.d.ts.map +1 -1
  478. package/dist/local/store/sqlite/web/worker.js +64 -2
  479. package/dist/local/store/sqlite/web/worker.js.map +1 -1
  480. package/dist/local/store/web/adapter.d.ts +76 -8
  481. package/dist/local/store/web/adapter.d.ts.map +1 -1
  482. package/dist/local/store/web/adapter.js +579 -127
  483. package/dist/local/store/web/adapter.js.map +1 -1
  484. package/dist/local/store/web/receive-work.d.ts +57 -0
  485. package/dist/local/store/web/receive-work.d.ts.map +1 -0
  486. package/dist/local/store/web/receive-work.js +99 -0
  487. package/dist/local/store/web/receive-work.js.map +1 -0
  488. package/dist/local/store/web/send-log.d.ts +92 -0
  489. package/dist/local/store/web/send-log.d.ts.map +1 -0
  490. package/dist/local/store/web/send-log.js +267 -0
  491. package/dist/local/store/web/send-log.js.map +1 -0
  492. package/dist/local/store/web/sender-key-handoff.d.ts +81 -0
  493. package/dist/local/store/web/sender-key-handoff.d.ts.map +1 -0
  494. package/dist/local/store/web/sender-key-handoff.js +156 -0
  495. package/dist/local/store/web/sender-key-handoff.js.map +1 -0
  496. package/dist/local/store/web-sqlite/adapter.d.ts +2 -0
  497. package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
  498. package/dist/local/store/web-sqlite/adapter.js +12 -6
  499. package/dist/local/store/web-sqlite/adapter.js.map +1 -1
  500. package/dist/local/vault/custody.d.ts +8 -0
  501. package/dist/local/vault/custody.d.ts.map +1 -0
  502. package/dist/local/vault/custody.js +9 -0
  503. package/dist/local/vault/custody.js.map +1 -0
  504. package/dist/local/vault/electron-safe-storage.d.ts +3 -1
  505. package/dist/local/vault/electron-safe-storage.d.ts.map +1 -1
  506. package/dist/local/vault/electron-safe-storage.js +2 -0
  507. package/dist/local/vault/electron-safe-storage.js.map +1 -1
  508. package/dist/local/vault/expo-secure-store.d.ts +3 -1
  509. package/dist/local/vault/expo-secure-store.d.ts.map +1 -1
  510. package/dist/local/vault/expo-secure-store.js +2 -0
  511. package/dist/local/vault/expo-secure-store.js.map +1 -1
  512. package/dist/local/vault/indexed-db.d.ts +3 -1
  513. package/dist/local/vault/indexed-db.d.ts.map +1 -1
  514. package/dist/local/vault/indexed-db.js +2 -0
  515. package/dist/local/vault/indexed-db.js.map +1 -1
  516. package/dist/local/vault/react-native-keychain.d.ts +3 -1
  517. package/dist/local/vault/react-native-keychain.d.ts.map +1 -1
  518. package/dist/local/vault/react-native-keychain.js +2 -0
  519. package/dist/local/vault/react-native-keychain.js.map +1 -1
  520. package/dist/remote/relay/device-set.d.ts +94 -0
  521. package/dist/remote/relay/device-set.d.ts.map +1 -0
  522. package/dist/remote/relay/device-set.js +156 -0
  523. package/dist/remote/relay/device-set.js.map +1 -0
  524. package/dist/remote/relay/types.d.ts +92 -107
  525. package/dist/remote/relay/types.d.ts.map +1 -1
  526. package/dist/safety/core.d.ts +15 -6
  527. package/dist/safety/core.d.ts.map +1 -1
  528. package/dist/safety/core.js +41 -27
  529. package/dist/safety/core.js.map +1 -1
  530. package/dist/safety/index.d.ts +2 -1
  531. package/dist/safety/index.d.ts.map +1 -1
  532. package/dist/safety/index.js +12 -18
  533. package/dist/safety/index.js.map +1 -1
  534. package/dist/types/api.d.ts +707 -62
  535. package/dist/types/api.d.ts.map +1 -1
  536. package/dist/types/errors.d.ts +14 -33
  537. package/dist/types/errors.d.ts.map +1 -1
  538. package/dist/types/errors.js +14 -24
  539. package/dist/types/errors.js.map +1 -1
  540. package/dist/types/messages.d.ts +2 -2
  541. package/dist/types/messages.js +1 -1
  542. package/dist/types/protocol-config.d.ts +175 -42
  543. package/dist/types/protocol-config.d.ts.map +1 -1
  544. package/dist/types/protocol-config.js +19 -38
  545. package/dist/types/protocol-config.js.map +1 -1
  546. package/dist/types/protocol-constants.d.ts +6 -6
  547. package/dist/types/protocol-constants.js +6 -6
  548. package/dist/types/session.d.ts +7 -7
  549. package/dist/types/session.d.ts.map +1 -1
  550. package/dist/types/session.js +39 -21
  551. package/dist/types/session.js.map +1 -1
  552. package/dist/username/link.d.ts +2 -2
  553. package/dist/username/link.js +2 -2
  554. package/dist/utils/origin-lock.d.ts +45 -0
  555. package/dist/utils/origin-lock.d.ts.map +1 -0
  556. package/dist/utils/origin-lock.js +80 -0
  557. package/dist/utils/origin-lock.js.map +1 -0
  558. package/docs/ASSURANCE.md +6 -6
  559. package/docs/CLIENT_COMPOSITION.md +2 -2
  560. package/docs/DEVIATIONS.md +677 -182
  561. package/docs/E2EE.md +1 -1
  562. package/docs/ERROR_HANDLING.md +165 -2
  563. package/docs/GETTING_STARTED.md +7 -4
  564. package/docs/INTERFACES.md +1 -1
  565. package/docs/PACKAGE_SURFACE.md +6 -5
  566. package/docs/PROTOCOL_POLICY.md +102 -22
  567. package/docs/RECIPES.md +3 -15
  568. package/docs/SECURITY.md +90 -5
  569. package/keys/README.md +3 -3
  570. package/local/store/README.md +78 -14
  571. package/local/store/key-value/README.md +14 -3
  572. package/local/store/node/README.md +8 -3
  573. package/local/store/web/README.md +9 -0
  574. package/local/store/web-sqlite/README.md +14 -2
  575. package/local/vault/README.md +21 -0
  576. package/package.json +1 -6
  577. package/remote/README.md +0 -1
  578. package/remote/relay/README.md +2 -2
  579. package/dist/device/provisioning.d.ts +0 -242
  580. package/dist/device/provisioning.d.ts.map +0 -1
  581. package/dist/device/provisioning.js +0 -421
  582. package/dist/device/provisioning.js.map +0 -1
  583. package/dist/internal/protocol/x3dh/index.d.ts +0 -15
  584. package/dist/internal/protocol/x3dh/index.d.ts.map +0 -1
  585. package/dist/internal/protocol/x3dh/index.js +0 -13
  586. package/dist/internal/protocol/x3dh/index.js.map +0 -1
  587. package/dist/internal/protocol/x3dh/x3dh.d.ts +0 -131
  588. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +0 -1
  589. package/dist/internal/protocol/x3dh/x3dh.js +0 -261
  590. package/dist/internal/protocol/x3dh/x3dh.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,1353 @@
1
1
  # Changelog
2
2
 
3
+ ## 12.0.1
4
+
5
+ - **Fixed: a web SQLite store restores the last commit after a tab died inside a
6
+ commit.** The `opfs-sahpool` VFS of the vendored engine reported a reserved
7
+ lock on every check. SQLite then took the hot journal that a tab killed
8
+ inside a commit left for the journal of a live transaction and never played
9
+ it back, so the next open read the half-written commit. In 12.0.0 and
10
+ earlier, such a store could report `database disk image is malformed`. The
11
+ patched engine reports no reserved lock, and the next open of such a store
12
+ plays the journal back.
13
+
14
+ - **Fixed: a web SQLite open with the wrong key state leaves the file as it was.**
15
+ The open reads the first page of the file through an immutable read-only
16
+ connection with no key before it opens the file. An open with no key of an
17
+ encrypted file, or an open with a key of a plaintext file, rejects with
18
+ `file is not a database` and plays no hot journal back. In 12.0.0 and
19
+ earlier, such an open of a file with a hot journal played the journal back
20
+ through the wrong key state and left the file corrupt.
21
+
22
+ - **Fixed: `ratchetConfig.maxSkip` sets the skip limit.** The client passes
23
+ `SignalProtocolClientConfig.ratchetConfig.maxSkip` to the session cipher of
24
+ the protocol manager that it creates. In 12.0.0 and earlier, the client did
25
+ not read the option. A gap above the limit fails with
26
+ `TOO_MANY_SKIPPED_MESSAGES`. The default is 25000, which is the value that
27
+ the cipher used before. The API reference said 1000 and now says 25000. A
28
+ value that is not a positive integer fails at client creation with
29
+ `ratchetConfig.maxSkip must be a positive integer.` A `protocolManager` that
30
+ the caller supplies keeps its own limit. The client does not read
31
+ `maxMessageKeysStored` or `keyExpirationMs`. Their reference now states the
32
+ fixed values: 2000 skipped message keys per receiver chain, deleted after 7
33
+ days.
34
+
35
+
36
+ ## 12.0.0
37
+
38
+ - **Breaking: every new session uses PQXDH, and the SDK has no classical key
39
+ agreement.** A peer bundle without an ML-KEM prekey fails with
40
+ `PQXDH_REQUIRED`, and no setting allows a classical X3DH session.
41
+ `'required'` is the only `postQuantum` value. `PostQuantumPolicy.Compatible`
42
+ and the `'compatible'` value are removed, and `postQuantum: 'compatible'`
43
+ throws `Unsupported postQuantum policy` at client creation.
44
+ `ProtocolStrategyConfig.allowClassicalFallback` is removed, and the SDK
45
+ ignores the key from an untyped caller. `ClassicalFallbackReason` is removed
46
+ from `./client/config` and `./types`. `ProtocolSelectionEvent` no longer
47
+ carries `usedClassicalFallback` or `classicalFallbackReason`.
48
+ `X3DH_INFO_DEFAULT` is removed from `./client/config` and `./types`, and
49
+ `ResolvedKeyExchangeInfoStrings` carries only `pqxdh`. `PQXDHFallbackType`,
50
+ `PQXDHRequiredErrorOptions.fallbackType`, and `PQXDHRequiredError.fallbackType`
51
+ are removed; read `PQXDHRequiredError.reason` (`no_kyber_prekey` or
52
+ `pqxdh_failed`) instead. The X3DH module and its `performX3DH`,
53
+ `performX3DHResponder`, `calculateX3DHSharedSecret`, `EphemeralKeyPair`,
54
+ `X3DHResult`, `X3DHResponderInput`, and `X3DHResponderResult` exports are
55
+ removed. `validateProtocolStrategy` no
56
+ longer warns about a classical fallback. A stored 11.x classical session
57
+ continues as a Double Ratchet session.
58
+ - **Breaking: the managed device link is the one link path.** The SDK no
59
+ longer ships the device provisioning protocol. `linkHostedRelayDevice()` is
60
+ the one way to link a device. A linked device gets the account identity by
61
+ device transfer or by an application-owned channel. The managed device link
62
+ runs in one process that holds the active device's store and the new
63
+ device's store. It sends no private key to the Relay. These public names
64
+ are removed: the `./device/provisioning` subpath and its exports
65
+ `DEFAULT_PROVISIONING_LINK_PREFIX`, `LocalDeviceMetadata`,
66
+ `ProvisioningGroupStateStore`, `ProvisioningIdentityStore`,
67
+ `ProvisioningKeyPair`, `ProvisioningLocalStateStore`, `ProvisioningMessage`,
68
+ `ProvisioningQRData`, `ProvisioningReceiveOptions`, `ProvisioningSendOptions`,
69
+ `ProvisioningUsernameStateStore`, `UserProfile`, `cancelProvisioning`,
70
+ `connectToProvisioningSession`, `generateProvisioningQR`,
71
+ `parseProvisioningQR`, `provisionDevice` and `receiveProvisioningMessage`,
72
+ with their `./device` re-exports; `PROVISIONING_SESSION_TTL_MS` from
73
+ `./device/constants`; `getDeviceMetadata` from `./device/expo` and
74
+ `./device/react-native`; `ProvisioningService` from `./remote/relay/types`;
75
+ the `SignalProtocolRelayServer` methods `createProvisioningSession`,
76
+ `connectNewDevice`, `sendProvisioningMessage`, `getProvisioningMessage`,
77
+ `completeProvisioning`, `acknowledgeProvisioning`, `rollbackProvisioning` and
78
+ `deleteProvisioningSession`, with their `HostedRelayHttpTransport` members;
79
+ and `DeviceChoice.requiresQR`. A relay adapter drops these methods.
80
+ - **Fixed: a blocked head of the mailbox no longer stalls the HTTP pull.**
81
+ A mailbox pull, and so `pullHostedRelayAfterWake`, now sends the Relay
82
+ cursor of the page before it, so the pull moves past a full page of
83
+ unacknowledged envelopes and gives the messages and Relay receipts behind
84
+ it. Three kinds of envelope stay unacknowledged: an envelope that the
85
+ receive bounds refuse, a decrypt failure that no retry request owns, and
86
+ a retry request that waits for the next group fetch. The cursor lives in
87
+ memory only. An empty page, a page without a Relay cursor, a failed pull,
88
+ and a restart clear it, so the next pull starts at the head and offers
89
+ those envelopes again. The recovery pull after failed work also starts at
90
+ the head. Advancing
91
+ the cursor acknowledges nothing, so the Relay keeps each envelope. Before,
92
+ a full page of such envelopes came back on each pull, and the messages
93
+ behind it waited.
94
+ - **Changed: hosted registration and recovery accept a native assertion with
95
+ no `jti`.** The transport binds the challenge to the exact assertion,
96
+ purpose, and operation ID. The Relay verifies the configured provider and
97
+ rejects an invalid token. An assertion with a valid `jti` keeps that
98
+ identifier.
99
+ - **Breaking: a send declares its device sets, and the Relay compares
100
+ them.** Each post to an account declares the device IDs that the sender
101
+ holds records for. `Envelope.declaredDeviceIds` carries the declaration of
102
+ a direct post, and the hosted transport sends it as `deviceSets`.
103
+ `SignalProtocolRelayServer.sendMultiRecipientUnidentified` takes a 9th
104
+ argument, `deviceSets`, for a sealed post. The relay `send()` returns the
105
+ optional `deviceSetChecked` and `needsSync`.
106
+ `sendMultiRecipientUnidentified` returns the optional `deviceSetChecked`
107
+ and `refusals`. The Relay refuses a declaration that does not match with
108
+ 409 `DEVICE_SET_MISMATCH`, which names the missing and the extra devices,
109
+ or with 410 `STALE_DEVICE`, which names the devices whose registration
110
+ changed. The SDK then removes each extra device record, starts a new
111
+ session with each missing or stale device, encrypts the message again only
112
+ for those devices, and posts again. The hosted transport finds each device
113
+ in the device directory before it posts, on the identified and on the
114
+ sealed route. A declared post to a device that the directory does not list
115
+ fails before the post with the 409 `DEVICE_SET_MISMATCH` refusal of the
116
+ Relay, which names the device as extra, so the SDK removes the device
117
+ record and posts again. A device that the Relay accepted keeps
118
+ its stored post. A send has a recipient phase and then a sync phase, and
119
+ each phase can restart 10 times. When the recipient phase does not match
120
+ after the 10th restart, or the Relay refuses a restart post with
121
+ `OPERATION_EXPIRED`, the send throws the new
122
+ `DeviceSetReconciliationError`. The outbox keeps the send as terminal, and
123
+ a call of `send()` with the same `clientMessageId` starts a new run at 0
124
+ restarts. A group restart keeps the group ciphertext, seals the shared body
125
+ again, and replaces it in one write. A device-specific resend, a receipt,
126
+ and a retry request declare nothing. A custom relay and a wrapper of a
127
+ relay do not compare, get no declaration, and keep the device list reads. `docs/DEVIATIONS.md` sections 5.5 and 5.6 compare this
128
+ loop with Signal's.
129
+ - **Breaking: a send to a recipient with a session reads no device list on a
130
+ comparing relay.** The Relay refuses a declared post that misses a device
131
+ or names a removed one, so the 60 s freshness window applies only to a
132
+ relay that does not compare. A recipient with no session gets one list
133
+ read to start the sessions. A group send declares the devices of its
134
+ records, and reads the list of a member only when it holds no record for
135
+ that member. A replay reads no device list. One exception holds in a live
136
+ send and in a replay. A repair that leaves an account with no device
137
+ record reads the list of that account once.
138
+ - **Breaking: the own device list is read only on `needsSync`.** On a
139
+ comparing relay, the recipient phase posts first. Its receipt sets
140
+ `needsSync` when the sender account has other devices. The sync phase then
141
+ declares the own devices that the sender holds records for. When the
142
+ sender holds no record of another own device, the send reads the own list
143
+ once. A failed read no longer fails the send. The recipient result is
144
+ stored first, and the result carries `syncPending: true` when the sync
145
+ phase does not complete or the own list cannot be read. Call `send()`
146
+ again with the same `clientMessageId` to post the pending copies. A replay
147
+ reads the own list again when the send could not read it. The SDK makes no
148
+ sync post without a destination.
149
+ - **Breaking: a custom store keeps the device-set fields of an outgoing
150
+ intent.** An outgoing intent adds `deviceSetRestarts`,
151
+ `deviceSetUnresolved`, `deviceSetBundleMissing`, and `syncPending`. A
152
+ custom metadata store must keep each field of the stored intent value,
153
+ also a field that it does not know.
154
+ The fields need no schema step, because they live in the existing JSON
155
+ value of the intent.
156
+ - **Breaking: a refused group-token destination is no longer inferred as
157
+ stale.** The group-token receipt names each refused destination with its
158
+ code in `refusals`. A `STALE_DEVICE` destination leaves the shared group
159
+ message and gets the device repair once. A `NOT_FOUND` destination of a
160
+ declared post settles a removed account: the SDK adds nothing for it, and
161
+ `uuids404` names the account only when the receipt is not a duplicate.
162
+ `SendResult.refusedDestinationCount` stays a count, and the SDK infers no
163
+ code from it.
164
+ - **Breaking: a repair fails the send on a session error other than a
165
+ missing bundle.** When the start of a new session for a refused device
166
+ fails for another reason, such as an untrusted identity, the send fails
167
+ with that error. A listed device with no prekey bundle makes the send wait
168
+ and restart, and counts each restart. The repair write stores each such
169
+ device in the outbox. A replay after a process restart, a stop, or a
170
+ terminal end starts a session with each stored device before its first
171
+ post, so the device gets the message when it has a bundle again. When the
172
+ send holds no message for an account, a bundle fetch that the Relay
173
+ answers with `NOT_FOUND` removes the record of the device. The Relay gives
174
+ that answer for an unregistered device, and for a registered device with
175
+ no uploaded prekeys. Each other device that the account record holds gets
176
+ the message in the same repair when it has a session or a bundle. An
177
+ account left with no device record gets one list read, and a listed device
178
+ with no bundle waits again within the restart bound. Thus a replay reaches a device that the account linked
179
+ after an unlink. Before, a replay of a send whose recipient had no other
180
+ device failed with `SESSION_NOT_FOUND`, and a group replay completed
181
+ without the member.
182
+ - **Added: `SendResult.syncPending`.** It is true when the Relay accepted
183
+ the send for every recipient device and the copies for the other devices
184
+ of the own account are not posted yet.
185
+ - **Added: the `onRelayProtocolError` hook and `RelayProtocolError`.** The
186
+ Relay marks each accepted declared post with `deviceSetChecked`. When an
187
+ accepted declared post has no mark, the send is delivered and its result
188
+ does not change. The client reports a `RelayProtocolError` with the code
189
+ `DEVICE_SET_UNCHECKED` and the route of the post once for the send through
190
+ `onRelayProtocolError`. A sync copy to another own device is a declared
191
+ post too, on the `identified-direct` route. A sync payload of a method such
192
+ as `syncReadToLinkedDevices` reports its error once with no
193
+ `clientMessageId`. The new exported types are
194
+ `DeviceSetReconciliationError`, `RelayProtocolError`, `DeviceSetDevice`,
195
+ `DeviceSetLastRefusal`, `DeviceSetPhase`, `DeviceSetRefusalAccount`,
196
+ `DeviceSetUnresolved`, `DeviceSetUnresolvedReason`,
197
+ `RelayProtocolErrorCode`, and `RelayProtocolRoute`.
198
+ - **Added: `HostedAnonymousDeliveryError.data`.** The error keeps the
199
+ `details` object of the Relay answer. For a refused declared post, it
200
+ names the missing, the extra, or the stale devices.
201
+ - **Breaking: the skipped-key cap applies to each receiver chain.** A
202
+ receiver chain keeps at most `maxMessageKeysStored` skipped message keys,
203
+ 2000 by default, as libsignal keeps `MAX_MESSAGE_KEYS` for each chain. When
204
+ a chain is at the cap, its key with the lowest index leaves. A store to one
205
+ chain never evicts a key of another chain. Before this change, the cap
206
+ applied to all five chains together, and the oldest key of any chain left.
207
+ A session now keeps up to 2000 keys in each of its five chains. The 7-day
208
+ `maxMessageKeyAge` limit does not change. `countTotalMessageKeys` and
209
+ `evictOldestMessageKey` are removed from the double-ratchet exports.
210
+ - **Breaking: a receive pass waits for each hook for at most 2 minutes.**
211
+ The new `protocol.receiveQueue.receiveHookTimeoutMs` option sets the
212
+ bound. The default is 120000 ms. The value must be a positive integer of
213
+ at most 2147483647 ms, so `create()` refuses zero, a negative value, a
214
+ fraction, and `Infinity`. The bound applies to each hook that a receive
215
+ pass awaits. At the bound, the SDK logs a warning with the
216
+ `RECEIVE_HOOK_TIMEOUT` behavior and no longer waits for the hook. A
217
+ timeout of `onMessageDecrypted` or `onDelivered` counts as one failed hook
218
+ attempt, with the normal backoff and attempt cap, and it logs no
219
+ `RECEIVE_HOOK_FAILED` warning. A timeout of another hook ends that call,
220
+ and the pass continues. A hook that settles after its bound writes
221
+ nothing. An application whose hook can run longer than 2 minutes sets a
222
+ larger bound.
223
+ - **Breaking: a delivery receipt stops its retries 1 day after it becomes
224
+ due.** One Signal client gives its delivery receipt job the same 1-day
225
+ lifespan.
226
+ When a receive record waits for its delivery receipt for 1 day,
227
+ the SDK completes the record. It sends no receipt, it does not call
228
+ `onMessageDecrypted` again, and it gives no `onReceiveExpired` report,
229
+ because the application already has the content. A resend record still
230
+ reports `onDeliveryRecovered`. The 30-day receive age still applies, so a
231
+ record whose age ends first completes at its age. Before this change, a
232
+ receipt retried until the receive age of 30 days.
233
+ - **Breaking: SPQR skipped keys leave by index distance in each epoch, not
234
+ by age.** The SPQR receive path now keeps held skipped keys as the
235
+ SparsePostQuantumRatchet chain keeps its key history. Each epoch keeps at
236
+ most `maxOutOfOrderKeys` keys after a trim, 2000 by default. A key whose
237
+ index plus `maxOutOfOrderKeys` is below the receive counter of its epoch
238
+ is refused with `DECRYPTION_FAILED` and the reason `key-trimmed`. A
239
+ receive holds only the skipped keys at or above its own horizon. A jump
240
+ above `maxOutOfOrderKeys` clears the held keys of that epoch. When an epoch
241
+ holds 2201 keys, the keys behind the horizon leave. No eviction reads the
242
+ clock, and the `timestamp` field stays in the persisted shape. When the
243
+ send epoch prunes an old epoch, the held keys of that epoch leave with its
244
+ chains, so a key of a pruned epoch no longer decrypts. Before this change,
245
+ the trim ran only when all epochs together held 2000 keys, and one receive
246
+ then added every key of its gap, up to 24999 keys. The internal
247
+ `deserializeSPQRState` loader refused a state above 2000 keys. It now
248
+ keeps the highest 2200 indexes of each epoch, drops the keys of an epoch
249
+ with no chain, and logs one warning with the dropped count. The
250
+ `cleanupSPQRState` export and `SPQR_CONFIG.MAX_SKIPPED_KEY_AGE` are
251
+ removed from the SPQR module for the 12.0.0 cut, because no receive path
252
+ called them. `trimSkippedKeys` is replaced by
253
+ `trimEpochSkippedKeys(state, epoch)`.
254
+ - **Breaking: safety numbers order the two parties as libsignal does.**
255
+ Each party gets its own 30-digit display string. The string that is lower
256
+ by byte comparison comes first, in the 60 digits, the emoji, and the hex.
257
+ The SDK no longer compares the two user identifiers, so no locale and no
258
+ identifier character can change the order. For some identifier pairs, the
259
+ displayed safety number of 12.0.0 differs from the one of 11.x. The 30
260
+ digits of each party do not change, and only their order changes. This
261
+ applies to `client.verify()` and `generateCompositeSafetyNumber`, and also
262
+ to `generateSingleKeyReferenceSafetyNumber`, `Fingerprint`, and
263
+ `createFingerprintData`. The composite QR profile version steps from 3 to
264
+ 4 for the 12.0.0 cut. A QR code from an 11.x client then reports
265
+ `version_mismatch`, not `no_match`. The single-key QR profile stays at
266
+ version 2, because the new order makes its output equal to libsignal
267
+ version 2.
268
+ - **Breaking: a safety-number confirmation from an earlier version is
269
+ refused.** `SafetyNumberConfirmation.version` steps from 1 to 2 with the
270
+ composite QR profile step. `confirmSafetyNumber` refuses a version 1
271
+ confirmation with the unsupported-version error, not with
272
+ `IDENTITY_MISMATCH`. The app calls `verify()` again and shows the new safety
273
+ number.
274
+ - **Fixed: a cached safety number keeps the QR orientation of its caller.**
275
+ Before, the cache gave the swapped call for the other party the same cached
276
+ result. Its QR code then carried the first caller's orientation, so a scan
277
+ against the other party's QR code reported `no_match`. The cache now keeps
278
+ one entry for each orientation.
279
+ - **Fixed: an archived session no longer sends a PreKeyMessage.** When a
280
+ session moves to the archive, the SDK now clears its unacknowledged prekey
281
+ state: the pending flag, the prekey IDs, and the Kyber and KEM one-time
282
+ ciphertexts, as libsignal does. Before, a session that was archived before
283
+ the peer replied kept that state, and a later promotion made its next send
284
+ a PreKeyMessage for prekeys that the peer could already have deleted. The
285
+ in-memory store archive now follows the same record rule, so it also keeps
286
+ at most 40 archived sessions.
287
+ - **Changed: archived sessions are evicted by insertion order, not by last
288
+ use.** Over 40 archived sessions, the session that went into the archive
289
+ first leaves, as libsignal does. Before, the session with the oldest
290
+ `lastUsedAt` left. A session archived again under the same base key moves
291
+ to the newest end.
292
+ - **Breaking: a removed device keeps its record and its archived sessions.**
293
+ `SesameManager.removeDevice` now archives the current session of the
294
+ device, keeps the record, and marks it removed with the new
295
+ `DeviceRecord.removedAt` field. Before, the removal deleted the record and
296
+ its sessions, so a message that the device sent before its removal did not
297
+ decrypt. Now that message decrypts on the archived session. A removed
298
+ device gets no fan-out: a send, a sync copy, a receipt, and a sender-key
299
+ distribution skip it. A send to a user whose devices are all removed fails
300
+ with `NO_DEVICES`. A second removal of the same device writes nothing and
301
+ emits no second `onDeviceRemoved` event.
302
+ - **Changed: a device list that names a removed device again relists it.**
303
+ The removed marker clears, and the device returns to fan-out with no
304
+ current session. The archived sessions stay. The relist emits
305
+ `onDeviceAdded` once. A group send to a removed member device reads its
306
+ device list again before it gives the sender key. A device that is still
307
+ removed after that read gets no key. The new
308
+ `SesameManager.relistDevice` call relists one device.
309
+ - **Changed: a declared send counts a removed device record as absent.**
310
+ On a comparing relay, a send declares only the devices whose records are
311
+ not marked removed. A repair that removes an extra device, or a device
312
+ whose bundle fetch the Relay answers with `NOT_FOUND`, marks its record.
313
+ A member or an own account whose every record is marked removed gets the
314
+ list read of an account with no record. A repair that starts a session
315
+ with a missing device relists its record, so the next post declares it.
316
+ - **Changed: an identity change keeps the archived sessions.** When a device
317
+ list gives a new identity key for a device, the SDK archives the current
318
+ session, takes the new key, and marks the device pending verification.
319
+ Before, it deleted the record and its sessions and added the device again,
320
+ with an `onDeviceRemoved` and an `onDeviceAdded` event. Now a message under
321
+ the old session still decrypts, and the change emits no device event. A
322
+ removed device whose identity changes is relisted, with one
323
+ `onDeviceAdded` event.
324
+ - **Changed: the client deletes stale device records at each start.** The
325
+ receive queue runs `cleanupStaleRecords` once in each run, after its
326
+ resume. A removed record goes when its removal is older than `maxLatency`,
327
+ 30 days by default. The cleanup also deletes a record that has no session
328
+ and is older than `maxLatency`. Before, no SDK path ran the cleanup.
329
+ - **Breaking: a custom store keeps and deletes removed device records.** A
330
+ `SesameStore` must keep the `removedAt` field of a device record.
331
+ `deleteStaleRecords` must also delete a record for which
332
+ `isExpiredRemovedDevice` is true. `getSesameDeviceIds` still returns the
333
+ removed devices, and a caller that sends to the devices skips them with
334
+ `isRemovedDevice`.
335
+ - **Breaking: the SQLite schema moves to version 6 and the IndexedDB database
336
+ to version 11.** Neither step changes a table or an object store. The steps
337
+ keep an earlier SDK, which sends to a removed device, from opening the
338
+ store. An earlier SDK refuses the SQLite file with
339
+ `SqliteSchemaTooNewError`, and the browser refuses the IndexedDB open with
340
+ a `VersionError`. A downgrade is not supported.
341
+ - **Added: `isRemovedDevice` and `isExpiredRemovedDevice`.** The two
342
+ predicates are exported from the `types` entry point. `isRemovedDevice`
343
+ tells whether a device record is marked removed. `isExpiredRemovedDevice`
344
+ tells whether the stale-record cleanup deletes a removed record.
345
+ - **Changed: a waiting receive record holds back only its conversation.** A
346
+ record that waits for its group state, or for a hook retry below the
347
+ attempt cap, holds back the later records of its conversation, as one
348
+ Signal client queues its message jobs. Group content keys by its group,
349
+ a sent transcript of this account keys by its destination, and other
350
+ content keys by its sender account. Before this change, a waiting record
351
+ held back every later record of its sender device, in every group and in
352
+ direct chats. Now direct chats and other groups make progress, and a
353
+ blocked group holds back its later content from every sender. A record
354
+ that waits behind an earlier record of its group counts toward the share
355
+ of that group in the receive queue, so a stalled group reaches its share
356
+ sooner, and its new sender-key messages wait at the Relay. The order in
357
+ which the device commits its records stays per sender device.
358
+ - **Added: `discardPendingReceive` removes a receive that the application
359
+ cannot process.** The call takes the `messageId` that
360
+ `listPendingReceives` gives. It removes a receive that has not reached its
361
+ delivery receipt, and returns the removed receive, or `null` when no
362
+ listed receive matches. It sends no receipt, it does not call
363
+ `onMessageDecrypted`, and it gives no `onReceiveExpired` report. A
364
+ redelivery of the envelope then gives `duplicate` and decrypts nothing.
365
+ A hook call that already started still runs. Each
366
+ `PendingReceive` now gives `hookAttempts`, the count of failed
367
+ `onMessageDecrypted` attempts. Its `messageId` is now always set: a
368
+ receive stored before the client kept message IDs gives its record ID, as
369
+ the `processed` outcome does.
370
+ - **Changed: group sends and session locks order the tabs of one origin.**
371
+ When `navigator.locks.request` exists and the store has a
372
+ `storeIdentity`, a group Sender Key operation runs under the Web Lock
373
+ `open-e2ee:group-send:<store identity>:<lock key>`. The session lock, the
374
+ user lock, and the device-list sync lock run under
375
+ `open-e2ee:session:<store identity>:<lock key>`. Two tabs or workers of
376
+ one origin on one store then encrypt in turn, so two group messages never
377
+ carry one iteration and two direct messages never carry one counter.
378
+ Before this change, each tab had only its own in-process lock. A page or
379
+ engine with no Web Locks, and a store with no identity, keeps the
380
+ in-process locks. Two tabs on one store are then not ordered, and the
381
+ application must give one tab exclusive access to the store. The session
382
+ lock and the device-list sync lock still end a wait after 5 seconds. On
383
+ the Web Lock path the wait rejects with `ORIGIN_LOCK_TIMEOUT_MESSAGE`, and
384
+ on the in-process path with the message of the in-process lock. A stop of
385
+ the relay work still ends the wait of a group operation. A Web Lock has no limit on its waiting requests. The
386
+ in-process session lock still refuses a request when 1,000 requests wait.
387
+ - **Added: `storeIdentity` on the local store contract.** The optional
388
+ member names the data of a store, so that each tab and worker of an
389
+ origin gives the same name for the same data. The IndexedDB store and the
390
+ web SQLite store give their database names. A
391
+ custom web store that shares its data across tabs sets it, so that its
392
+ sends take the Web Locks.
393
+ - **Fixed: a sender-key rotation keeps the states that another client
394
+ wrote.** Each `SenderKeyManager` kept its own copy of the previous
395
+ states, and a rotation or a new distribution built the archive from that
396
+ copy. When two clients on one store rotated in turn, for example in two
397
+ tabs, the archive lost the states that the other client wrote, so the
398
+ earlier messages of those states no longer decrypted. The manager now
399
+ reads the archive from the stored record each time, and the record keeps
400
+ at most 5 states.
401
+ - **Breaking: a group send gives its sender key to each device that has no
402
+ handoff row.** The SDK keeps a sender-key handoff row for each device of
403
+ another member when the Relay accepts a distribution of the own sender key
404
+ for that device. The row names the group, the sender key ID, the
405
+ generation, the recipient device, and the registration ID of the session.
406
+ A group send reads the device list of each member. It gives the current key
407
+ to each listed device that has no row for the current sender key ID,
408
+ generation, and registration. A row records a handoff. It is not proof
409
+ that the device installed the key. The SDK writes the row after the Relay
410
+ accepts the distribution and before the send marks the distribution sent.
411
+ A dropped distribution writes no row. A new own key, a rotation, and a
412
+ delete of the own key delete the rows of the group. A PreKey session from
413
+ the device, a bundle session that replaces a current session, a session
414
+ archive, a session delete, and a device-record delete delete the rows of
415
+ the device in every group. An identity rotation of a contact deletes the
416
+ rows of each device of that account. A retry request deletes the rows of
417
+ the requester in the group of the failed message only. A session reset
418
+ after an expired retry request deletes the rows of each device of the
419
+ sender account in every group. Client start
420
+ deletes each row that no current own key covers. `docs/DEVIATIONS.md`
421
+ section 7.5 compares this record with the record of the Signal apps and
422
+ gives the reason for each difference.
423
+ `SenderKeyState.distributionPending`,
424
+ `SenderKeyManager.getPendingSenderKeyDistribution`, and
425
+ `SenderKeyManager.confirmSenderKeyDistributionSent` are removed.
426
+ `SenderKeyManager.rotateSenderKey` and `rotateGroupSenderKey` do not take
427
+ `options.distributionPending`. The manager ignores a `distributionPending`
428
+ field in a stored state, and the next write of the state omits it.
429
+ - **Breaking: a custom store keeps the sender-key handoff rows.**
430
+ `SignalProtocolLocalStore` extends the new `SenderKeyHandoffStore`. A
431
+ custom store must implement its six methods: `recordSenderKeyHandoff`,
432
+ `listSenderKeyHandoffs`, `invalidateSenderKeyHandoff`,
433
+ `invalidateAccountSenderKeyHandoffs`, `listSenderKeyHandoffGroupIds`, and
434
+ `retainSenderKeyHandoffs`. Each row delete must be in the same write as
435
+ the change that causes it.
436
+ `storeSenderKeyRecord` and `deleteSenderKey` take the new
437
+ `SenderKeyRecordWriteOptions`. With `deleteSenderKeyHandoffs`, the write
438
+ deletes the rows of the group. `setDeviceRecord` takes the new
439
+ `SetDeviceRecordOptions`, and `SessionTrustCommit` has the field
440
+ `senderKeyHandoffInvalidation`. With the device, the write deletes the
441
+ rows of that device in every group. `archiveCurrentSession`,
442
+ `deleteSessionRecord`, `deleteDeviceRecord`,
443
+ `deleteAllSenderKeysForGroup`, and
444
+ `acceptContactIdentityRotationAndDeleteSessions` always delete the rows
445
+ of their device, group, or account. The memory store keeps the rows in its
446
+ state. The IndexedDB, key-value, and SQLite stores keep the rows durably,
447
+ so a restart does not give the key to a listed device again. The SQLite
448
+ stores add the `sender_key_handoff` table in schema version 5, and the
449
+ IndexedDB store adds the `senderKeyHandoff` object store in database
450
+ version 10. The IndexedDB and key-value stores encrypt each row and find it
451
+ by keyed hashes, so they hold no group ID, account ID, or device in the
452
+ clear.
453
+ - **Breaking: a custom key-value backend must apply
454
+ `removeSenderKeyHandoffs` inside `atomicWrite`.** `KeyValueOperation` has
455
+ the new variant. The part of a key after `keyPrefix` has five
456
+ colon-separated segments: the group hash, the generation, the account
457
+ hash, the recipient hash, and the entry hash. The backend removes each key
458
+ whose group, account, and recipient segments equal every given hash, and
459
+ keeps a key of another shape. It applies the operation in the same
460
+ transaction as the other operations of the batch, and the operation
461
+ observes the earlier writes of the batch. A backend built with
462
+ `createTransactionalKeyValueBackend` applies it already.
463
+ `assertBackendConformance` checks it.
464
+ - **Breaking: the group outbox context and the sync send change.**
465
+ `GroupOutboxContext` does not have `confirmSenderKeyDistributionSent`.
466
+ It has the required members `recordSenderKeyHandoff`,
467
+ `prepareSenderKeyHandoffs`, `resolveOwnDevices`,
468
+ `isConclusiveDeviceRejection`, `repairStaleDevice`, and
469
+ `postSyncMessage`. `postSyncMessage` takes, as its third argument, a
470
+ function that encrypts the transcript again for one own device.
471
+ `prepareSyncMessages` takes the own devices of the send as its fifth
472
+ argument. `postPreMessage` resolves to the new
473
+ `PreMessagePostResult`. `appendOutgoingGroupDeviceMessages` is removed.
474
+ `reconcileOutgoingGroupDeviceSet` removes the messages of devices from an
475
+ intent and adds new messages in one write.
476
+ `DefaultSesameManager.sendToLocalOtherDevices` requires
477
+ `listedDeviceIds`, and it sends only to those own devices.
478
+ - **Changed: each send gives a sync copy to exactly the listed own
479
+ devices.** On a relay that does not compare device sets, each direct or
480
+ group send, and each replay, reads the device list of the own account,
481
+ with no freshness window. A failed
482
+ read stops the recipient post and fails the send, also for an account
483
+ with no linked device, and the outbox retries a stored send. The first
484
+ attempt of a send that fails on this read throws before the SDK stores
485
+ it. The error carries the `clientMessageId`, but the outbox holds no
486
+ transmission for it. The application calls `send()` again, and the SDK
487
+ encrypts the content again. The send gives
488
+ a sync copy to each listed own device other than the sending device. Each
489
+ sync copy is keyed by its device. An own device gets the transcript and
490
+ never a sender-key handoff row. When the Relay refuses an own device as
491
+ stale, the SDK refreshes the session of that device once and encrypts the
492
+ copy again for it. For the transcript of a stored send, the SDK replaces
493
+ the copy in the intent and posts the new copy under a repair ID. The
494
+ device then gets the transcript of that send. When the Relay refuses the
495
+ new copy too, the SDK archives the session, removes the copy from the
496
+ intent, and completes the send. When the refresh fails, or the encryption
497
+ for the new session gives no copy, the send fails. The copy and the new
498
+ session stay, and the outbox retries the stored send. A sync copy of
499
+ account state, such as a read sync, gets the same refresh. The SDK posts
500
+ the new copy again with no operation ID and changes no intent.
501
+ - **Changed: a group replay reads the device lists again.** On a relay that
502
+ does not compare device sets, before the replay of a stored group send, the
503
+ SDK reads the device lists of the members and of the own account. One intent write removes each message of
504
+ a device that the lists do not show. A listed device that the stored send
505
+ does not reach gets the current key of the send and the stored group
506
+ ciphertext. When the sender rotated the key after the send, the added
507
+ device gets only the stored group ciphertext, and the replay completes.
508
+ The device recovers the content through its retry request, and the next
509
+ send gives it the current key. The stored ciphertext does not change, because the Relay
510
+ refuses another operation under the same message ID. Thus a device that
511
+ the replay adds gets the content only through its retry request and the
512
+ resend of a `Resendable` send.
513
+
514
+ - **Breaking: a group state store keeps a receive record for each group.**
515
+ `GroupStateStore` adds `getGroupReceiveRecord`,
516
+ `updateGroupReceiveRecord`, and `listGroupReceiveRecords`. A receive
517
+ record holds the group's required revision, which is the highest revision
518
+ that an authenticated group context has claimed, and the fetch backoff and
519
+ the last verified denial. A custom store must implement the three methods.
520
+ An update that returns null deletes the group's whole record. The SDK
521
+ store writes version 2 group records with an index. It migrates a version
522
+ 1 record forward when it first reads or writes that group, and a crash at
523
+ any migration step reruns safely. A migrated group starts at required
524
+ revision 0 as a locally known group. A record that a context created
525
+ before the group's state was verified also names the sender device that
526
+ claimed it. `storeGroupState` and
527
+ `storeGroupStateWithSenderKeyRotationBarrier` must remove that origin in
528
+ the same write that stores the state. A custom store must do the same.
529
+ - **Breaking: managed group content carries its group context.** Each
530
+ send to a managed group, its sync transcript, and its send log entry now
531
+ carry the group's master key and the revision of the sender's verified
532
+ state inside the encrypted content, as Signal's `GroupContextV2` does. A
533
+ resend therefore carries the context of the original send. The receiving
534
+ client removes the context before it gives the content to the
535
+ application, so the application gets the bytes that the sender sent. An
536
+ ad hoc group send carries no context. `SignalProtocolContentAdapter` adds
537
+ two required methods, `serializeContentWithGroupContext` and
538
+ `withoutGroupContext`, and `inspectContent` reports `groupContext`, or
539
+ `'malformed'` for a context that does not decode. A custom adapter must
540
+ implement both methods and report the context. The default adapter puts
541
+ the context in a `groupContext` member of a JSON object and wraps any
542
+ other content in a `groupContent` member.
543
+ - **Breaking: a managed group receive follows Signal's order.** The
544
+ client decrypts, runs the replay check, and then installs a sender key
545
+ distribution with no group decision, as Signal does. Membership,
546
+ permission, and blocking no longer stop the install. After the install,
547
+ the client derives the group ID from the context's master key and
548
+ compares it with the group of the envelope and of the distribution. A
549
+ context that does not decode is refused as `malformed-context`, and a
550
+ context of another group as `context-mismatch`. Content that a sender
551
+ key decrypts, or that comes beside a distribution, is content of that
552
+ group in every shape. Sync content is content of this account. On the
553
+ Relay subscription, in `receiveIncomingEnvelopes`, and in
554
+ `processIncomingEnvelope` and `decryptGroupMessage`, content from
555
+ another account that carries a sync message is refused as
556
+ `sync-from-other-account` before the distribution install and before
557
+ any group decision, and the application gets no content. The raw
558
+ decrypt methods `receive`, `decryptMessage`, and `decryptMessages`
559
+ return the plaintext with no group classification and do not refuse
560
+ it. Sender-key content from another account is delivered under its
561
+ group, never under a conversation that its content names. When the
562
+ local state is
563
+ below the revision that the context claims, one fetcher brings the group
564
+ up to date before the client decides. The client decides each message
565
+ at the revision that its own context claims, so a false claim uses up
566
+ only its own fetch. The fetcher runs at most one fetch for each claimed
567
+ revision and at most 16 claims in a backoff window. A fetch that ends
568
+ below the claim is complete: the client decides that message at the
569
+ fetched state, the group's required revision becomes the server head,
570
+ or a higher claim that came while the fetch ran, and the backoff does
571
+ not grow. Only a fetch that fails or that the
572
+ server refuses backs off. A claim above the fetched state that the
573
+ window cannot fetch waits for the next window, so false claims hold an
574
+ honest claim for 30 s at most. When the trust
575
+ root has a server signing key, a context that carries the signed change
576
+ to the claimed revision applies that change with no fetch, also when
577
+ the window has fetched its 16 claims. Under
578
+ `allowUnauthenticatedGroupHistory`, the client never applies a carried
579
+ change. Content with no context is decided at the local state, and is
580
+ refused as `legacy-no-context` when the client has no state. While the
581
+ group cannot update, the content waits on the device in the receive
582
+ record that the decrypt committed with the ratchet state, and the receive
583
+ queue decides it when a fetch of its group completes. The client sends
584
+ no retry request and does not call `onDecryptionError`. The fetcher
585
+ tries again in the background and at start. `decryptGroupMessage` throws
586
+ `GroupReceiveUnavailableError` for such content, and the error carries
587
+ the `messageId` of the record. A second call with the same message
588
+ decides the stored content with no second decrypt, also after a restart.
589
+ Two concurrent calls with the same message give the content once. A sender
590
+ device can make at most 100 groups wait for verification. Past the cap,
591
+ a context for a new group is refused as `unverified-cap`. The new
592
+ `groups.isGroupBlocked` config drops the content of a blocked group with
593
+ no report and no fetch. The background fetcher also skips a blocked
594
+ group, at start and on its timer. A block hook that throws any value
595
+ skips only its own group. `decryptGroupMessage` now decrypts before it
596
+ decides, so a refused message uses its message key. `syncGroup` now runs
597
+ through the fetcher, so it joins a fetch in flight and records its
598
+ result. It returns that result only when the fetch called the group
599
+ server. After a fetch that only tried a carried change, it waits for the
600
+ next fetch, its own when no other caller starts one first. An ad hoc
601
+ distribution installs with no `groups` config. The
602
+ package root and the `client` entry export `GroupReceiveUnavailableError`,
603
+ `GroupReceiveRefusedError`, and `GroupResendDeferredError`.
604
+ `processIncomingEnvelope` returns `pending` for content that waits for
605
+ its group and `denied` for refused content, and the caller acknowledges
606
+ the envelope in both cases. A deferred resend leaves the retry request
607
+ with the Relay. See `docs/ERROR_HANDLING.md`.
608
+ - **Breaking: `processIncomingEnvelope` returns a receive outcome.** The
609
+ method now returns a `ReceiveOutcome` in place of the plaintext. Its
610
+ `kind` is `processed`, `pending`, `duplicate`, `null-message`, `denied`,
611
+ or `refused`. Acknowledge the envelope for each kind except `refused`,
612
+ which means that the receive queue has no room: nothing is decrypted or
613
+ stored, so give the envelope again later. A `processed` receive keeps
614
+ its content on the device until the application calls the new
615
+ `completeReceive` with its `messageId`, or until the new `onPersist`
616
+ option resolves. A redelivery before then returns the same outcome with
617
+ no second decrypt. A Relay delivery of an envelope that
618
+ `processIncomingEnvelope` committed reuses that record and installs no
619
+ sender key distribution from it. The new `listPendingReceives` lists the stored
620
+ receives one page at a time, and `{ ready: true }` lists only the
621
+ receives that wait for `completeReceive`. The new
622
+ `processPendingReceives` runs one pass of the receive queue now, and its
623
+ `deadlineMs` option bounds the pass. `processIncomingEnvelopes` returns
624
+ `{ envelope, outcome }` or `{ envelope, error }` for each envelope.
625
+ Before, the method returned the plaintext and deleted the stored content
626
+ before the application saved it, so a crash between the two lost the
627
+ message.
628
+ - **Breaking: a custom store commits a receive record with the ratchet
629
+ state.** `SessionTrustCommit.receiveWork` and
630
+ `SenderKeyReceiveCommit.work` replace `receivedContent` and `content`.
631
+ The store must write the `ReceiveWorkRecord` in the same transaction as
632
+ the session or sender key state, so the ratchet step and the record roll
633
+ back together. The store adds `getReceiveWork`,
634
+ `putReceiveWork`, `listReceiveWork`, `receiveWorkUsage`, and
635
+ `completeReceiveWork`, and removes `getReceivedContent`,
636
+ `deleteReceivedContent`, and `deleteExpiredReceivedContent`.
637
+ `listReceiveWork` returns records in arrival order, by `arrivalSeq` and
638
+ then `workId`, and its `after` query takes the last record of the page
639
+ before, so records with an equal `arrivalSeq` are never skipped.
640
+ `putReceiveWork` and `completeReceiveWork` compare the record revision
641
+ and write nothing on a mismatch. `completeReceiveWork` deletes the record
642
+ and writes its metadata in one transaction.
643
+ `SignalProtocolManager.decrypt` takes a `receiveWork` seed in place of
644
+ `receiveId`. The SQLite schema version 4 and the IndexedDB schema version
645
+ 9 add only the `receive_work` table and object store. After the first
646
+ open, an SDK earlier than 12 cannot open the store. There is no
647
+ downgrade path. At open, each SDK
648
+ store converts the received content rows of SDK 11 to receive records
649
+ that wait for the redelivery of their envelope, and writes its completion
650
+ marker last, so a stop during the conversion is safe. A row that does not
651
+ parse stays in place, and the store reports it with no content: the
652
+ SQLite store through its logger, the other stores through
653
+ `console.error`. When the Relay subscription, `receiveIncomingEnvelopes`,
654
+ or `pullHostedRelayAfterWake` gets the redelivered envelope of a converted
655
+ record, and the client already processed that envelope, the client
656
+ completes the record with no hook call.
657
+ - **Fixed: a receiver installs a sender key that the sender creates again.**
658
+ `processSenderKeyDistribution` matches a key by its sender key ID, as
659
+ Signal's published implementation matches a state by its chain ID and
660
+ signing key. The generation rules apply only to a distribution of the
661
+ current key, and a later generation of that key replaces it in place. A
662
+ distribution of a kept previous key changes nothing. A distribution of
663
+ another key becomes the current state, and the earlier current state
664
+ becomes a previous state, so a message in flight under it still decrypts.
665
+ Before, a receiver dropped each distribution whose generation was not
666
+ above the generation of its current state. `createGroupSenderKey` over an
667
+ existing key, and a delete followed by a create, start again at
668
+ generation 1, so each receiver that held the earlier key failed every
669
+ later group message of that sender device with `SENDER_KEY_MISMATCH`,
670
+ until a rotation took the sender's generation above the one the receiver
671
+ held.
672
+ - **Fixed: every send error carries the logical-send identifier.**
673
+ `send()` chooses the `clientMessageId` before any other step, so
674
+ `isOutgoingMessageError` is true also for an error before the encryption,
675
+ such as a failed content serialization or a failed read of the own device
676
+ list. The application calls `send()` again with the same
677
+ `clientMessageId`. Before, only an error of the encryption carried the
678
+ identifier.
679
+ - **Fixed: a group resend checks membership at the required revision.**
680
+ Before a sender gives group content again, it brings a managed group
681
+ up to the highest revision that an authenticated context claimed. The
682
+ check uses the same receive record, fetch window, and backoff as a
683
+ receive. A requester who is not a member at that revision gets no
684
+ content, and the answer ends as `membership-refused`. When the update
685
+ is fresh, the sender answers from the local state, also when a false
686
+ claim keeps the required revision above the server head, so a removed
687
+ member who claims a false revision is refused and not deferred. When
688
+ the update fails or waits for its backoff, the sender defers the resend
689
+ and does not refuse it. The resend job stays pending for the resend job
690
+ driver, and the retry request envelope stays unacknowledged for the next
691
+ Relay delivery. Before, the sender checked a stale local state, so it could
692
+ resend to a removed member or refuse an added member.
693
+ - **Fixed: unacknowledged messages no longer stall the socket backlog.**
694
+ The mailbox socket now ends each page of durable frames with one
695
+ `acknowledge` frame, with no ID when the page acknowledged nothing. The
696
+ Relay sends the next page of a backlog only on that frame. Before, a page
697
+ of messages that all stayed unacknowledged stalled every page behind it
698
+ until the socket reconnected.
699
+ - **Fixed: received content keeps the time of its first admission.**
700
+ `DecryptedEnvelope.receivedAt` is the time the device first committed
701
+ the content. A first pass, a retry, and a delivery after a restart give
702
+ the same value. Content with no timestamp of its own gives this time as
703
+ its `timestamp` for receipt matching, so each delivery gives the same
704
+ timestamp. The 30-day receive age of stored content
705
+ also counts from this time, through a retry, a redelivery, and a
706
+ restart. Before, the first pass read the clock again after it stored
707
+ the content.
708
+ - **Changed: the client acknowledges a Relay message after its commit.**
709
+ On the Relay subscription and in `pullHostedRelayAfterWake`, the client
710
+ decrypts each envelope and commits its content as a receive record in
711
+ the same transaction as the ratchet step. It acknowledges the envelope
712
+ only after that commit, and sends no acknowledgment when the commit
713
+ fails, as Signal does. The receive queue then decides the group, gives
714
+ the content to `onMessageDecrypted`, and sends the E2EE delivery
715
+ receipt. That receipt is the only proof that the application processed
716
+ the content. A Relay delivery receipt marks only the handoff of the
717
+ content to the device. Content that waits for its group state stays on
718
+ the device, not at the Relay. A hook that throws is tried again after a
719
+ backoff. The device stores the count of each attempt before it calls the
720
+ hook, so a hook call that ends the process also counts as an attempt.
721
+ After 10 attempts, the content no longer holds back the
722
+ later content of its conversation. Each start then offers it to the hook
723
+ once: in the start pass, or at the registration of `onMessageDecrypted`
724
+ when the start pass had no hook. After that offer, only
725
+ `processPendingReceives` tries it again before the next start, until it
726
+ expires or the application discards it. A pass of those that ends before
727
+ the retry, at a deadline or at a failed page read, leaves the retry to
728
+ the next pass. That retry runs after the other content
729
+ of the device, so a hook call that ends the process on it does not stop
730
+ the later content of its conversation. `pullHostedRelayAfterWake` commits, acknowledges, then
731
+ runs `processPendingReceives`, and its new `deadlineMs` option bounds
732
+ that pass. It gives no content to the application before the
733
+ acknowledgment settles. `HostedRelayWakeClient` adds
734
+ `processPendingReceives`. `receiveIncomingEnvelopes` commits each
735
+ envelope and sends no acknowledgment. The content reaches
736
+ `onMessageDecrypted` in a later pass of the receive queue, after the
737
+ call returns. After `stop()`, the content waits for the next start of the
738
+ queue from `startRelaySubscription`, or for `processPendingReceives`. At
739
+ start, the client admits a new envelope only after its first read of the
740
+ stored content ends, so new content of a sender device comes after its stored
741
+ content, also when the clock stepped back across the restart. This order
742
+ holds only when that first read completes. It does not hold after a first
743
+ read that failed, after a `stop()` during the first read, or for an
744
+ envelope received before the first start. Two processes that share one
745
+ store, such as two browser tabs, each keep their own arrival order, so
746
+ content of one process can come before content that the other process
747
+ received earlier. Before, the client acknowledged only after the
748
+ application had the content, so group content that waited for its group
749
+ stayed at the Relay and came back on each delivery.
750
+ - **Added: a bounded receive queue with an expiry hook.** The new
751
+ `protocol.receiveQueue` config sets how much the device holds. Stored
752
+ content may wait 30 days, counted from its first commit on this
753
+ device. The age is fixed. `protocol.receiveQueue` has no age field, and
754
+ a client created with `protocol.receiveQueue.maxAgeMs` is refused with
755
+ an error that names 12.0.0 and the fixed 30 days. Content expires when
756
+ its age is equal to or more than
757
+ 30 days. The earlier prune deleted content only at an age of more
758
+ than 30 days, so the expiry now comes 1 ms sooner. `maxItems` is 3000 and `maxBytes` is 750 MiB by default. They are
759
+ provisional until a measurement sets them. `blockedGroupShare`, 0.25 by
760
+ default, is the part of each bound that the waiting records of one group
761
+ can fill. At a bound the client decrypts nothing more and does not
762
+ acknowledge the envelope, so the Relay keeps it. A refused envelope
763
+ expires at the Relay at the TTL of the Relay project, and no local hook
764
+ reports that expiry. While the mailbox of the device is full, the Relay
765
+ refuses a new message to it with `MAILBOX_FULL` to its sender. The new
766
+ `onReceiveExpired` hook gets a `ReceiveExpiredEvent` for content that
767
+ waited 30 days, before the client drops it. Before the hook, the
768
+ client reads the record again, so content that the client completed
769
+ before that read, such as at the redelivery of its envelope, gets no
770
+ report. Before, the client deleted stored content after 30 days with no
771
+ report.
772
+ - **Added: `decryptEnvelope` decrypts one envelope with no receive
773
+ record.** It installs a sender key distribution that the content
774
+ carries and checks the group context against the transport. It stores
775
+ no content, decides no group state, and sends no receipt. The decrypt
776
+ spends the ratchet step, so a plaintext that the application loses is
777
+ gone. Use `processIncomingEnvelope` to keep the content until the
778
+ application completes the receive.
779
+ - **Changed: `decryptGroupMessage` is deprecated.** Use
780
+ `processIncomingEnvelope`, which returns a receive outcome and keeps the
781
+ content until the application completes the receive.
782
+ `decryptGroupMessage` completes the receive before it returns, so a
783
+ plaintext that the application loses is gone. It throws
784
+ `EncryptionError` with `STORAGE_QUOTA_EXCEEDED` when the receive queue
785
+ has no room, and with `MESSAGE_DUPLICATE` for a message that this client
786
+ processed or that gives no content.
787
+ - **Fixed: a retry deadline no longer resets a session whose resend
788
+ arrived.** The commit of a resend now records its failed envelope as
789
+ fulfilled before the client acknowledges the resend. At start, the
790
+ client records it again for each stored resend before the retry request
791
+ lifecycle starts. Before, a resend that waited for its group could reach
792
+ the retry deadline, and the deadline reset the session.
793
+ - **Changed: metadata values rest encrypted on the IndexedDB and key-value
794
+ stores.** Each value that `setMetadata` and `compareAndSetMetadata` write
795
+ now goes through the store's record cipher, AES-256-GCM. These values
796
+ include group master keys, the hosted device authentication key, and
797
+ outbox intents. The first open after the upgrade encrypts each clear value
798
+ that the store holds. A stop during that step is safe, and the next open
799
+ continues it. A store that is full keeps its clear values and still opens.
800
+ Metadata key names stay in clear, and some of them hold identifiers. The
801
+ SQLite stores need no change, because the file cipher covers them. An
802
+ earlier SDK version cannot read the encrypted values, so do not open the
803
+ store with one after the upgrade.
804
+ - **Fixed: a membership change no longer makes the next distribution
805
+ identified.** A member removal clears the group's endorsements. Before,
806
+ the next send resolved the sealed sender of each distribution pre-message
807
+ from the cache with no refresh. A pre-message to a member with no access
808
+ key then went identified in `preferred` mode, or failed the send in
809
+ `required` mode. A group send now refreshes the endorsements for all
810
+ recipients before it seals the pre-messages, at preparation and again at
811
+ dispatch. A pre-message goes identified only to a member that the refresh
812
+ does not endorse.
813
+ - **Fixed: an expired sender key no longer blocks group sends.** When the
814
+ own sender key of a group is older than `maxSenderKeyAge`, a group send
815
+ rotates the key before it prepares the distribution pre-messages. The
816
+ rotation deletes the handoff rows of the group. The send then gives the
817
+ new key to each device that needs it, and encrypts with the new key. A
818
+ distribution that fails, for example after a Relay refusal or an offline
819
+ send, does not make a later send to the group fail with
820
+ `SENDER_KEY_EXPIRED`.
821
+ - **Fixed: a retryable Relay refusal no longer ends a retry request.**
822
+ The retry request scheduler now reads the Relay's `retryable` flag before
823
+ the code and the HTTP status. A refusal with `retryable` true, for example
824
+ `AUTHORITY_DENIED` with HTTP 401 while a Relay binding is missing, is a
825
+ transport outage, or a rate refusal for `QUOTA_EXCEEDED`, `MAILBOX_FULL`,
826
+ and HTTP 429. The request waits and is posted again with the same bytes
827
+ and ID. Before, the request ended with `revoked-authority`. A refusal with
828
+ `retryable` false keeps its terminal class. A `TOKEN_INVALID` after the
829
+ one token refresh is `revoked-authority`.
830
+ - **Fixed: a failed `onDelivered` hook no longer loses the delivery.** The
831
+ client now marks a delivery source announced only after the hook returns.
832
+ Before, the client stored the mark first, so a hook that threw, a
833
+ `stop()` during the hook, or a crash lost the event. The hook now runs at
834
+ least once for each source. An error from the hook fails the Relay
835
+ receipt or the encrypted delivery receipt, so the relay delivers it again
836
+ and the hook runs again. Make the hook idempotent for one
837
+ `clientMessageId`, `recipientDeviceId`, and `source`.
838
+ - **Fixed: a failed `onRetryTerminal` hook no longer marks the end
839
+ emitted.** The SDK marks a retry end emitted only after the hook returns.
840
+ A hook that throws keeps the scheduler running. The next scheduler pass,
841
+ the next start, or the redelivery of the request runs the hook again.
842
+ The hook now runs at least once for each request.
843
+ - **Added: a session reset when a retry request ends as
844
+ `expired-content`.** Before the SDK calls `onRetryTerminal`, the
845
+ requester waits for each decrypt from the device that sent the failed
846
+ envelope that is in progress. It then archives its session with that
847
+ device, and its next send to the user reads the device list again. The
848
+ archive deletes the sender-key handoff rows of that device in every group.
849
+ The requester then deletes the rows of each device of that account in
850
+ every group, for a group message and for a pairwise message, as one
851
+ Signal client does at an automatic session reset. The reset does not
852
+ rotate a sender key. The next send to each group gives the current key to
853
+ each device of the account. The requester then sends one
854
+ null message to the device, at most one in an hour for each device. The
855
+ next ordinary message starts the new session when no null message goes.
856
+ The retry request record stores each step, so a replay after a restart
857
+ or a stop does not archive a newer session. The other terminal classes,
858
+ and a post that fails and is posted again, reset nothing.
859
+ `onSessionArchived` runs for the archive. The event gets the optional
860
+ field `recovery` of the new type `RetryTerminalRecoveryEvent`, which is
861
+ exported from the main entry and from `/client`. It has the device, the
862
+ sender key outcome, and the null message outcome `sent`, `limited`, or
863
+ `failed`. The sender key outcome is `applied` when the failed envelope is
864
+ a group message and the requester has a sender key for that group.
865
+ Otherwise it is `skipped`. The rows of the account are deleted with each
866
+ outcome.
867
+ - **Changed: a retry request is sealed when the client can seal it.** The
868
+ client seals a retry request when it holds the access key of the target,
869
+ and the Relay does not see the requester. The seal holds the payload of
870
+ the identified request as `PLAINTEXT_CONTENT` (8), and the sealed post
871
+ keeps the retry ID, the client message ID and the timestamp, so the Relay
872
+ deduplicates it as before. A group send endorsement never seals a retry
873
+ request. A retry request follows the `deliveryMode` of `sealedSender`, as
874
+ a delivery receipt does. In `'preferred'` mode the request goes identified
875
+ when the client has no access key or the Relay refuses it. In
876
+ `'required'` mode the request never goes identified: it stays pending, and
877
+ the scheduler posts it again until its deadline. In `'disabled'` mode it
878
+ is always identified. Before, each retry request was identified in every
879
+ mode, and an identified retry request does not have the privacy of a
880
+ sealed one. The `sendRetryRequest` callback of `processIncomingEnvelope`
881
+ gets an identified request, so `'required'` mode never calls it.
882
+ - **Changed: the client accepts a sealed retry request.** A sealed envelope
883
+ with the content type `PLAINTEXT_CONTENT` goes to the retry request
884
+ handler, never to a ratchet decrypt. `processIncomingEnvelope` rejects a
885
+ sealed retry request with `INVALID_CIPHERTEXT`, as it rejects an
886
+ identified one. A `11.0.x` client rejects this content type, so it drops
887
+ a sealed retry request from a newer client, and that request ends as
888
+ `expired-content` for the requester. A sealed retry request gets a
889
+ resend only from a sender device that runs this release or a later one.
890
+ - **Changed: the `deliveryMode` documentation names what each mode
891
+ covers.** The mode covers each message, resend, delivery receipt and
892
+ retry request to a device of another account. A typing indicator, and a
893
+ sync message to another device of the same account, are always
894
+ identified. `onIdentifiedFallback` reports only a message or a resend.
895
+ - **Changed: a group send seals its sender-key distributions.** In
896
+ `required` and `preferred` sealed-sender mode, each distribution
897
+ pre-message goes through the sealed route to its one recipient. The
898
+ recipient's access key comes first, and the group endorsement serves a
899
+ member without one. When the relay rejects the access key, the SDK
900
+ restricts the cached access mode of the recipient and posts the
901
+ distribution again with the group endorsement. A `required` send checks
902
+ this authorization before it encrypts a distribution and before any
903
+ post. When it cannot seal a distribution, it throws
904
+ `SEALED_SENDER_REQUIRED` and posts nothing. A `preferred` send posts a
905
+ distribution identified only after the relay rejects each sealed
906
+ authorization, and then calls `onIdentifiedFallback`.
907
+ A saved send whose distributions have no sealed transport seals them
908
+ from the stored ciphertext at replay, with no new ratchet effect.
909
+ - **Fixed: a refused distribution is repaired once.** When a device refuses
910
+ a distribution conclusively, for example after a reinstall with the same
911
+ device ID, the SDK refreshes the session of that device once and encrypts
912
+ the distribution again. It replaces the stored pre-message before the
913
+ post, so a replay never posts the refused ciphertext again. The repair
914
+ post has a new transport ID, `<id>:repair:<n>`. A replay after a restart
915
+ rebuilds a refused distribution from the current sender key with the same
916
+ `senderKeyId`. The repaired device then decrypts the later group messages
917
+ of the sender, but not the message of that send. When the sender key of
918
+ the send is no longer current, the replay refreshes the session, drops
919
+ the distribution, and continues. The next send gives the device the
920
+ current key.
921
+ - **Fixed: a group send drops the distribution of a removed device.** When
922
+ the relay refuses a distribution with `NOT_FOUND`, the SDK reads the
923
+ recipient's device list. If the list no longer shows the device, the
924
+ send drops that distribution and continues, as a direct send drops a
925
+ removed device. The send then makes no device post to that device. This
926
+ applies to the repair of a refused device message and to a device that the
927
+ re-read of a skipped account adds. A refused device that the list still
928
+ shows fails the send.
929
+ - **Fixed: all six post kinds name the registration of their device.** A
930
+ direct message, a sync copy, a sender-key distribution, a group device
931
+ message, a receipt, and a retry request send the registration ID of the
932
+ recipient session. This applies on the identified route, on the
933
+ access-key route, and on the group-token route. A post to a device with
934
+ no session names none. A sealed post names the registration of each device in its body,
935
+ and each hosted destination names the registration that the body gives
936
+ its device. A device with registration 0 names none. The Relay refuses a
937
+ device that was reinstalled with the same device ID. The refused post
938
+ then gets the one session repair, and the reinstalled device decrypts
939
+ the later messages. A group device post that the Relay refuses as a stale
940
+ device gets the same repair. The send gives the device the key of the
941
+ send and posts the device message again with the new registration. When
942
+ the repair of a refused distribution refreshes the session of a device,
943
+ that device leaves the shared group message of the send. The send posts
944
+ the device message to it on its own with the new registration, so the
945
+ device decrypts the message of that send. A device whose session changed
946
+ for another reason, such as a receipt that refreshed it, also leaves the
947
+ shared group message. When that device has no handoff row, it gets the key
948
+ of the send before its device post. On the attempt that prepared the send,
949
+ the device decrypts the message. On a replay, it gets the current key. It
950
+ recovers the message through its retry request only when the send was
951
+ Resendable and the send log kept it. For another send, the retry request
952
+ gets the current distribution alone, and the device does not get that
953
+ message. The group-token receipt names
954
+ each refused destination with its code. A destination that the Relay
955
+ refused as `STALE_DEVICE` leaves the shared group message. The send
956
+ repairs that device and posts the device message to it on its own. When the Relay refuses a receipt or a retry
957
+ request as a stale device, the SDK fetches a fresh bundle, starts a new
958
+ session once, and posts the receipt or the request again under the new
959
+ session. The session start archives the stale session in the same record
960
+ write, and the `onSessionArchived` hook runs after the start succeeds.
961
+ So a reinstalled device gets the retry request and resends the message.
962
+ A retry request ends with the terminal class `missing-sender` only when
963
+ the Relay has no bundle of the device or refuses the request again. When
964
+ the refresh fails for another reason, the receipt or the request is
965
+ posted again later. A failure before the session record write, such as a
966
+ failed bundle fetch, keeps the stale session, and the next stale refusal
967
+ refreshes again. A failure after that write, such as a failed SESAME
968
+ registration, leaves the new session, and the next post uses it. The sealed post sends
969
+ no sender identity. `sendMultiRecipientUnidentified` takes nine arguments.
970
+ - **Changed: a one-device sealed post can use the group endorsement on the
971
+ direct route.** A sender-key distribution, a resend, or a group message
972
+ to one device whose only sealed authorization is the group endorsement
973
+ now posts to `/anonymous/delivery/send`. The Relay accepts the
974
+ endorsement there only when it is for the destination account alone.
975
+ The shared group message stays on `/anonymous/groups/send`, also for one
976
+ device. When the direct route answers the endorsement with 401
977
+ `ANONYMOUS_AUTH_REJECTED`, the SDK posts the same message once on the
978
+ group route for that device and writes one `info` log line with the
979
+ behavior `GROUP_ROUTE_FALLBACK`. A 401 `GROUP_CREDENTIAL_REJECTED` gets no
980
+ route fallback. A `required` send never falls back to identified
981
+ delivery.
982
+ - **Fixed: a resend of a group send is sealed with the group endorsement.**
983
+ A resend to a member with no access key could not be sealed, because the
984
+ resend did not look up the group of the original send. It now uses the
985
+ group endorsement of that group for the one device. A `required`
986
+ resend with no sealed authorization fails with `SEALED_SENDER_REQUIRED`
987
+ and makes no identified post.
988
+ - **Fixed: a resend with only the sender key keeps the failed group message
989
+ open.** When the sender logged no content for the device, it answers a
990
+ group retry request with the current sender-key distribution alone. That
991
+ resend gives the key but no content, so it no longer marks the failed
992
+ group message processed. A redelivery of that message now decrypts with
993
+ the key and gives its text. This applies, for example, when
994
+ `receiveIncomingEnvelopes` reports the message in `failedMessageIds` and
995
+ the application does not acknowledge it. A resend that carries content
996
+ still marks the failed envelope processed. The client writes a `debug`
997
+ log line with the behavior `RETRY_SENDER_KEY_RESEND`.
998
+ - **Added: `SendResult.refusedDestinationCount`.** A group send through
999
+ the hosted group-token route reports the number of destinations that the
1000
+ Relay refused when it accepted the shared post. A later fan-out refusal
1001
+ is not counted. Other sends do not set the field.
1002
+ - **Added: send log and storage protection types.** `SendLogStore`
1003
+ describes the storage of resendable group content: a payload for each
1004
+ group send and a row for each recipient device, kept until that device
1005
+ confirms the message or the entry expires. `LocalStoreProtection` names
1006
+ how a local store encrypts its data and where its key is kept. A
1007
+ `SignalProtocolLocalSecretVault` can declare `custody`. A vault that does
1008
+ not declare it counts as `same-origin`.
1009
+ - **Added: recovery constants.** `RESENDABLE_CONTENT_RETENTION_MS` is 14
1010
+ days, `RETRY_PLACEHOLDER_DEADLINE_MS` is one hour, and
1011
+ `SEND_LOG_RESEND_JOB_TTL_MS` is one day. `MESSAGE_RECORD_TTL_MS` is now
1012
+ deprecated. It keeps the same 14-day value as
1013
+ `RESENDABLE_CONTENT_RETENTION_MS`.
1014
+ - **Breaking: every local store must declare its protection.**
1015
+ `SignalProtocolLocalStore` now requires a `protection` member, so a store
1016
+ that the application writes must add it. The SQLite stores report
1017
+ `file-cipher` with the custody of their vault. They read the cipher from
1018
+ the setting that the database records, so a store with
1019
+ `encryptionAtRest: false` reports `none` and no key.
1020
+ `KeyValueSignalProtocolStore` reports `record-cipher` with the custody of
1021
+ its vault. `IndexedDbSignalProtocolStore` reports `record-cipher` with
1022
+ `same-origin` custody. `InMemorySignalProtocolStore` reports `none`. The
1023
+ Expo SecureStore, react-native-keychain, and Electron safeStorage vaults
1024
+ declare `os-keychain` custody, and the IndexedDB vault declares
1025
+ `same-origin`.
1026
+ - **Added: the SQLite stores keep a send log.** The Node, Expo, React
1027
+ Native, and web SQLite stores implement `SendLogStore`. Schema version 3
1028
+ adds three tables for the payloads, the recipient rows, and the resend
1029
+ jobs. The store opens a version 2 file and adds the tables with no change
1030
+ to the existing data. The store clock sets `createdAt`, so retention does
1031
+ not read the client timestamp. `clearAllKeys` also clears the send log.
1032
+ - **Breaking: every local store keeps a send log.**
1033
+ `SignalProtocolLocalStore` now extends `SendLogStore`, so a store that
1034
+ the application writes must add the send log methods.
1035
+ `KeyValueSignalProtocolStore`, `IndexedDbSignalProtocolStore`, and
1036
+ `InMemorySignalProtocolStore` now implement them with the same behavior
1037
+ as the SQLite stores. The key-value and IndexedDB stores encrypt the
1038
+ group, the content hint, and the content of each payload. The recipient
1039
+ rows and the resend jobs hold no content and stay in the clear. The
1040
+ IndexedDB schema version 8 adds three object stores and keeps the data of
1041
+ a version 7 database. `clearAllKeys` and the key-value reset
1042
+ also clear the send log.
1043
+ - **Breaking: resendable content needs a protected store.** A sender
1044
+ keeps the plaintext of a resendable message to answer a retry request.
1045
+ `protocol.contentRecovery` now decides whether the local store may hold
1046
+ it. The default mode, `require-protected`, keeps it only when the store
1047
+ is encrypted and its key is in an operating system keychain or a
1048
+ declared application vault. The mode `allow-co-located-key` also keeps
1049
+ it when the key shares the storage of the data, as with
1050
+ `IndexedDbSignalProtocolStore` and the IndexedDB vault. Those stores
1051
+ encrypt each record, but a reader of the origin storage can also read
1052
+ the key. The mode `off` keeps no content. A store with no encryption
1053
+ never keeps it. When the policy refuses the store, the client keeps no
1054
+ pairwise message record, and a retry request for a direct message resets
1055
+ the session with no content. The client also deletes the message records
1056
+ and the send log entries that the store already holds.
1057
+ `contentRecoveryStatus` shows the decision and its reason, and the client
1058
+ logs it once at creation. To keep content recovery on a web store, use a
1059
+ keychain or application vault, or set `allow-co-located-key` after a
1060
+ product review. `retentionMs` sets the retention, at most 30 days.
1061
+ - **Breaking: the client validates the store protection.** Creation fails
1062
+ when the local store declares no `protection`, an unknown value, or a
1063
+ cipher without a key. A declaration adds no encryption. It must state
1064
+ what the store does.
1065
+ - **Corrected: storage protection and content hint documentation.** The
1066
+ security model lists the protection that each built-in store declares,
1067
+ and says that a deletion does not erase content. Received content is
1068
+ outside `protocol.contentRecovery`: every store keeps it until the
1069
+ application handles the envelope, and a later Relay receive deletes what
1070
+ is older than 30 days. `MessageRecord` holds no retry count. The `contentHint` docs give the retry request and
1071
+ `onDeliveryError` behavior of each hint.
1072
+ - **Added: `contentRecoveryStatus.groupMembershipSource`.** The sender
1073
+ asks a group membership source before it gives group content to a device
1074
+ again. A managed group is checked against its verified group state, from
1075
+ `groups` with `resolveAciBytesByUserIds`. The hook
1076
+ `protocol.contentRecovery.isCurrentMember` answers for an ad hoc group
1077
+ and gets the prefixed group ID. The status field is `managed`, `hook`, or
1078
+ `none`, with the type `GroupMembershipSource`. A client with no source
1079
+ is still created and keeps content. It logs one warning at creation, a
1080
+ direct message resend works, and the client refuses each group resend.
1081
+ - **Changed: a group message is resendable by default.** When
1082
+ `protocol.contentRecovery` keeps content, a group send of a `DataMessage`
1083
+ has the content hint `Resendable` unless the application sets another
1084
+ hint. The client writes the content and the recipient devices to the
1085
+ send log before it stores the outgoing intent, so a failed write stops
1086
+ the send before any post. The client writes the entry once. A replay of
1087
+ an unfinished send writes no row again, so a row that an E2EE delivery
1088
+ receipt deleted stays deleted. Each recipient gets the hint in the identified
1089
+ envelope, the sealed message for one device, and the shared sealed
1090
+ message for the group. When the policy keeps no content, or the send is
1091
+ a string or bytes with a `Resendable` hint, the send goes out as
1092
+ `Default` and the client logs this once.
1093
+ - **Changed: an E2EE delivery receipt ends the content of its device.**
1094
+ When a device confirms a message with an E2EE delivery receipt, the
1095
+ client deletes the send log row of that device. The last row takes the
1096
+ content with it. A Relay delivery receipt, a read receipt, and a viewed
1097
+ receipt delete no row, because a device also acknowledges a copy that it
1098
+ could not decrypt.
1099
+ - **Added: `forgetSentContent` and `getPendingRecipients`.**
1100
+ `client.getPendingRecipients(clientMessageId)` lists the devices that
1101
+ have not confirmed a group send with an E2EE delivery receipt.
1102
+ `client.forgetSentContent(clientMessageId)` deletes the logged content of
1103
+ one group send at once. It does not delete the pairwise message records.
1104
+ - **Changed: content retention follows `retentionMs`.** The client deletes
1105
+ send log entries and pairwise message records past
1106
+ `protocol.contentRecovery.retentionMs` at creation, at `stop()`, and
1107
+ before the first resendable group send of each day. It also deletes
1108
+ expired send log entries before each lookup. A retry request for a
1109
+ pairwise message older than the retention gets no content. Before, the
1110
+ client used the fixed 14-day value for the message records.
1111
+ - **Changed: the store clock sets the age of a pairwise message record.**
1112
+ Each local store sets `createdAt` of a `MessageRecord` from its clock at
1113
+ the first write, and keeps that value when a resend replaces the record.
1114
+ It does not store the `createdAt` that the caller gives. Retention, the
1115
+ sweep, and the sender refusal of an old retry request measure from this
1116
+ value, so the message timestamp does not change retention. A retry
1117
+ request for a message with no stored content takes its age from the
1118
+ failed timestamp. Records written before this change keep their stored
1119
+ `createdAt`. A custom `MessageRecordStore` must set `createdAt` the same
1120
+ way.
1121
+ - **Breaking: `KeyStorageOps` needs `clearSendLog`.** A device lifecycle
1122
+ reset now clears the send log with the other local crypto state. A
1123
+ custom `KeyStorageOps` must add `clearSendLog(): Promise<number>`. The
1124
+ built-in stores already implement it.
1125
+ - **Added: a retry request names the failed client message ID.**
1126
+ `RetryRequest` has an optional `failedClientMessageId`. When the relay of
1127
+ the requester delivers the client message ID of the failed envelope, the
1128
+ retry request carries it, so a sender can find the message when the
1129
+ relay assigns its own envelope ID. The payload stays at version 1, and a
1130
+ decoder that does not know the key ignores it. Each later attempt of the
1131
+ request carries the ID of the failed envelope, not the ID of a failed
1132
+ resend.
1133
+ - **Changed: a retry request for a sender-key message has no ratchet key.**
1134
+ The SDK no longer reads a ratchet key from the ciphertext of a failed
1135
+ sender-key message. A retry request without `ratchetKey` names a
1136
+ sender-key failure.
1137
+ - **Fixed: a pairwise retry request carries the ratchet key of the
1138
+ sender.** The SDK reads the ratchet key from the stored wire form of the
1139
+ failed message. A stale-session request now resets the session, and a
1140
+ request for a current session resends only. Before, the SDK read the
1141
+ wire form as a framed message, so no request carried a key. A sealed or
1142
+ malformed message still gives no key.
1143
+ - **Fixed: a session reset for a retry request sends its null message.**
1144
+ When the content of a failed pairwise message is gone, and the request
1145
+ names the ratchet key of the current session, the sender archives that
1146
+ session. The sender then starts a new session from a fresh prekey bundle
1147
+ of the requesting device and sends the null message on it. Before, the
1148
+ null message found no session, so the sender did not acknowledge the
1149
+ request. A request with another ratchet key, for another device, or from
1150
+ another sender does not change the session.
1151
+ - **Fixed: a new session from a prekey bundle keeps the earlier sessions.**
1152
+ A session that the client starts from a prekey bundle archives the
1153
+ current session and keeps the archived sessions. Before, it replaced the
1154
+ session record, so a message that the peer encrypted on an earlier
1155
+ session did not decrypt. After a session reset for a retry request, a
1156
+ message that the requester sent on the archived session now decrypts.
1157
+ - **Changed: a sender answers a group retry request from the send log.**
1158
+ The sender looks up the send log rows of the device that asked: by the
1159
+ failed client message ID, then by the failed envelope ID, then by the
1160
+ failed timestamp. Each logged entry that it finds goes again to that
1161
+ device only, with its timestamp and content hint, and only when the
1162
+ current membership source admits the requester to the group of the
1163
+ entry. A row counts its resends, and the count survives a restart. A row
1164
+ with 5 resends gets no more. A requester that is not a current member,
1165
+ and a group with no membership source, get no content and no
1166
+ distribution. The answer to the failed envelope then ends with the new
1167
+ `RetryTerminalClass` value `membership-refused`. The sender stores the
1168
+ end, calls `onRetryTerminal` once, and answers no later request for that
1169
+ envelope from that device. The refusal is not a delivery error, and the
1170
+ sender acknowledges the request envelope. A group with no membership
1171
+ source also writes one `warn` log line for the group with the behavior
1172
+ `RETRY_GROUP_RESEND_REFUSED`. This deviates from the recovery design,
1173
+ which logged the refusal only. When no row names the
1174
+ message, a sender-key failure gets the current sender-key distribution
1175
+ of the group alone, so the device decrypts the later group messages of
1176
+ the sender. A retry request without a ratchet key never resets the
1177
+ pairwise session. A retry request that names another device of the
1178
+ sender gets no answer, and the client writes a `warn` log line with the
1179
+ behavior `RETRY_REQUEST_OTHER_DEVICE`.
1180
+ - **Changed: a resend of logged group content carries the current sender
1181
+ key.** Each logged entry goes again with the current sender-key
1182
+ distribution of its group beside the content, in one pairwise envelope.
1183
+ The sender reads the distribution when it makes the resend, so the
1184
+ device also decrypts the later group messages of the sender. With no
1185
+ sender key for the group, the content goes alone. The `info` log line of
1186
+ the resend says whether it carried a distribution.
1187
+ - **Breaking: a content adapter must put content beside a distribution.**
1188
+ `SignalProtocolContentAdapter.serializeContentBesideSenderKeyDistribution(content, groupId, distribution)`
1189
+ is a new required method. It returns one content with the logged content
1190
+ and the distribution. The default adapter adds the distribution to the
1191
+ JSON object of the content, in the form of
1192
+ `serializeSenderKeyDistributionText`. It throws when the content is not
1193
+ a JSON object.
1194
+ - **Added: a resend of logged content survives a restart.** Before the
1195
+ membership check, the sender writes a pending resend job for each logged
1196
+ entry that a retry request attempt names. The job of the entry that
1197
+ answers the attempt names the failed envelope in the new field
1198
+ `SendLogResendJob.failedEnvelopeId`. The SQLite send log keeps it in the
1199
+ new column `failed_envelope_id` of `send_log_resend_job`. A job counts
1200
+ each post attempt before the post and ends as `posted` after it. The job
1201
+ of an entry that the membership or the resend limit refuses ends as
1202
+ `abandoned`. The client runs the pending jobs at `create()`, at each
1203
+ relay transition to connected, and after a failed job. The wait after a
1204
+ failure is a full-jitter wait from 1 s that doubles up to 30 s, and a
1205
+ failed job writes a `warn` log line with the behavior
1206
+ `RESEND_JOB_RETRY`. A job checks the membership again when it runs, and
1207
+ never resets a session: it makes one only when there is none. A job
1208
+ ends as `abandoned`, with one `info` log line, when it is older than
1209
+ `SEND_LOG_RESEND_JOB_TTL_MS`, when its logged entry is gone, when the
1210
+ answer to its failed envelope ended, when the membership refuses the
1211
+ requester, at the resend limit, or when no session can be made. A
1212
+ request without a request attempt writes no job. This deviates from the
1213
+ recovery design, which named a `send-log:resend-job` reliability record.
1214
+ The job lives in the send log store, with its entry.
1215
+ - **Changed: a message record keeps no sender-key distribution.** The
1216
+ message records of the pairwise sends keep no chain key. A send of a
1217
+ distribution alone keeps no record. A record of a distribution beside
1218
+ other content keeps only that content, so it stays resendable. A
1219
+ sent-sync transcript to an own device follows the same rule. At
1220
+ `create()`, the client removes each distribution from the records that
1221
+ an earlier version wrote, once, and then writes the marker
1222
+ `migration:skdm-records-removed`. It keeps the content and the
1223
+ `createdAt` of a mixed record and deletes a record of a distribution
1224
+ alone. When this sweep fails, `create()` fails, and the next start
1225
+ sweeps again. The retry handler applies the same rule to each record
1226
+ that it reads. A group timestamp whose record it deletes gets the
1227
+ current sender-key distribution of the group, as a missing record does.
1228
+ - **Changed: a start with content recovery off clears content once.** When
1229
+ content recovery is off, `create()` clears the message records and the
1230
+ send log once, and then writes the marker `resendable-content:cleared`.
1231
+ A later start with content recovery off clears nothing, until a start
1232
+ with content recovery on keeps content again. The clear deletes no
1233
+ sender-key state, so the next group send needs no new distribution.
1234
+ When the clear fails, `create()` fails, and the next start clears again.
1235
+ - **Breaking: a content adapter must remove a distribution from a
1236
+ record.** `SignalProtocolContentAdapter.withoutSenderKeyDistribution(plaintext)`
1237
+ is a new required method. It returns the plaintext unchanged when it
1238
+ carries no distribution, the other content when a distribution travels
1239
+ beside it, and `null` for a distribution alone. It applies the same
1240
+ rule to the content inside a sent-sync transcript of the adapter's
1241
+ format. The default adapter implements it.
1242
+ - **Breaking: a custom message record store must rewrite its records.**
1243
+ `MessageRecordStore.rewriteMessageRecords(rewrite)` is a new required
1244
+ method. It calls `rewrite` for each record, replaces the plaintext of a
1245
+ record when the result differs and keeps its `createdAt`, deletes the
1246
+ record when the result is `null`, and returns the number of changed
1247
+ records. The memory, key-value, web, and SQLite stores implement it.
1248
+ - **Fixed: content beside a sender-key distribution reaches the
1249
+ application.** Before, the client installed a distribution and then
1250
+ dropped the rest of its content. A data message in the same envelope
1251
+ never reached `onMessageDecrypted`, and no delivery receipt went out for
1252
+ it. Now the client installs the distribution, then routes the other
1253
+ content as a receipt, a typing indicator, or a data message. This
1254
+ applies on the relay subscription and on `receiveIncomingEnvelopes()`.
1255
+ A distribution that comes alone still gives nothing to the application.
1256
+ - **Breaking: a content adapter must decide a distribution-only content.**
1257
+ `InspectedSignalProtocolContent.senderKeyDistributionOnly` is a new
1258
+ required `boolean`. A custom content adapter must set it on every
1259
+ inspect result. It is `true` when the content carries a sender-key
1260
+ distribution and nothing else. The default adapter sets it.
1261
+ - **Changed: content beside a sender-key distribution is group content.**
1262
+ Before the client installs such a distribution, it checks that the
1263
+ sender may send messages to the group of the distribution. When the
1264
+ group refuses the sender, the client installs no key and gives no
1265
+ content. `onMessageDecrypted` gets the content with `isGroup` set to
1266
+ `true` and the group ID as `conversationId`. A retry resend can carry
1267
+ the content of a failed group message beside the current sender key.
1268
+ The application then gets that content under the `messageId` of the
1269
+ failed message, on the relay subscription and on
1270
+ `receiveIncomingEnvelopes()`. The resend marks the failed message
1271
+ processed, so a later redelivery of that message is dropped. When the
1272
+ failed message decrypts first, the later resend is dropped.
1273
+ - **Fixed: `processIncomingEnvelope()` asks for a failed group message
1274
+ again.** A group message that fails with a retryable error, for example
1275
+ after a lost sender-key distribution, now gets a retry request to its
1276
+ sender, and the client acknowledges it, as on the relay subscription.
1277
+ Before, the method threw with no request, so the message was lost. A
1278
+ group message with the Implicit content hint gets no request and is
1279
+ acknowledged. On every receive path, the stored request names the
1280
+ message as a group message, so a resend that brings only the sender key
1281
+ does not mark the message processed.
1282
+ - **Added: the `onDeliveryError` and `onDeliveryRecovered` hooks.** When a
1283
+ received message fails to decrypt and the client asks the sender for it
1284
+ again, `onDeliveryError` tells the application that the content did not
1285
+ come. The content hint of the message sets the time. A message with the
1286
+ Default hint, or with no hint, gets the error at once. A Resendable
1287
+ message gets it one hour after the first failure,
1288
+ `RETRY_PLACEHOLDER_DEADLINE_MS`, when its content has not come. An
1289
+ Implicit message never gets it. A request that a rate limit refuses, or
1290
+ a request that ends, gets the error at once. It deletes nothing, and the
1291
+ retry request continues after it. When the content comes after the
1292
+ error, `onDeliveryRecovered` runs with the receive time of the first
1293
+ failure. Each hook runs at least once for each failed message, also
1294
+ across a restart. The client marks the error shown, or the recovery,
1295
+ only after the hook returns. A hook that throws, a client stop, or a
1296
+ crash before that mark runs the hook again at the next retry request
1297
+ pass, start, or redelivery. A hook that throws in a retry request pass
1298
+ does not delay the next attempt or the end of the request. A receive
1299
+ does not acknowledge a failed message whose error or recovery hook threw
1300
+ before the content, but an error from the recovery hook after the
1301
+ content does not fail the receive that gave it. Make each hook
1302
+ idempotent for one `failedEnvelopeId`. The events are
1303
+ `DeliveryErrorEvent` and `DeliveryRecoveredEvent`, with the cause type
1304
+ `DeliveryErrorCause`. They are exported from the main entry and from
1305
+ `/client`. For a failed group message, both events carry `groupId`, in
1306
+ the form of `DecryptedEnvelope.conversationId`, when the client holds
1307
+ the sender key that the message names. The error of a message with a
1308
+ missing sender key has no `groupId`. Its recovery has one when the
1309
+ decrypt that gave
1310
+ the content installed or used the sender key of the group. The client checks the time at each redelivery of the failed message and at each retry
1311
+ request write. With a relay, it also checks at `create()` and, while the
1312
+ client runs, at the time when the error is due. A pairwise message has
1313
+ no content hint by default, so its error comes at once.
1314
+ - **Changed: a receive failure that no resend can repair asks for
1315
+ nothing.** Three failures are in this class: the group state refuses the
1316
+ sender, the identity of the sender is not trusted (`UNTRUSTED_IDENTITY`),
1317
+ and the envelope is malformed (`INVALID_CIPHERTEXT`). On the relay
1318
+ subscription, on `receiveIncomingEnvelopes()`, and on
1319
+ `processIncomingEnvelope()`, the client posts no retry request, stores
1320
+ no request record, and acknowledges the envelope. `onDecryptionError`
1321
+ runs once for the envelope, and a redelivery of it is dropped. The relay
1322
+ subscription writes an `error` log line that names the refusal. A
1323
+ ciphertext that does not decode or parse now fails with
1324
+ `INVALID_CIPHERTEXT`. Before, it got a retry request. Before, the relay subscription also asked again for a
1325
+ refused or untrusted envelope, and `processIncomingEnvelope()` did not
1326
+ acknowledge it.
1327
+ - **Changed: a retry request ends 14 days after the first failure.** The
1328
+ deadline of a request is the time of attempt 1 plus 14 days, the default
1329
+ retention of resendable content, `RESENDABLE_CONTENT_RETENTION_MS`.
1330
+ Each later attempt keeps it, and the timestamp of the
1331
+ failed message does not change it. Before, the deadline was 24 hours
1332
+ after attempt 1 and no later than 30 days after the failed message. A
1333
+ request that a rate limit refuses waits for the end of the rate window
1334
+ and keeps its deadline, also across a restart. At the deadline the
1335
+ request ends as `expired-content`, also when its stored attempt is
1336
+ answered. A request whose content came does not end. A stored request
1337
+ keeps its stored deadline. At the deadline, a sender key that has not
1338
+ rotated since the failure is older than the default `maxSenderKeyAge` of
1339
+ 14 days. After an `expired-content` end of a group message, the next
1340
+ group send then rotates that key, as any send does, and distributes the
1341
+ new key to each member.
1342
+ - **Added: the `attempts-exhausted` retry terminal class.** When the
1343
+ resend that answers the fifth attempt of a request,
1344
+ `MAX_RETRY_RESPONSES_PER_MESSAGE`, also fails, the request ends as
1345
+ `attempts-exhausted` and posts no sixth attempt. `onRetryTerminal` runs
1346
+ with the class, and `onDeliveryError` runs with the cause
1347
+ `request-ended`. Only an `expired-content` end resets the session, so
1348
+ this end resets nothing. A switch over `RetryTerminalClass` must handle
1349
+ the new value.
1350
+
3
1351
  ## 11.0.0
4
1352
 
5
1353
  - **Added: the connection reason `authority-refused`.** The mailbox