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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (583) hide show
  1. package/ADAPTERS.md +4 -4
  2. package/ARCHITECTURE.md +6 -8
  3. package/CHANGELOG.md +1315 -0
  4. package/README.md +1 -1
  5. package/SECURITY.md +2 -2
  6. package/TROUBLESHOOTING.md +1 -1
  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 +1168 -184
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/config.d.ts +40 -32
  14. package/dist/client/config.d.ts.map +1 -1
  15. package/dist/client/config.js +1 -1
  16. package/dist/client/config.js.map +1 -1
  17. package/dist/client/constants.d.ts +42 -8
  18. package/dist/client/constants.d.ts.map +1 -1
  19. package/dist/client/constants.js +48 -3
  20. package/dist/client/constants.js.map +1 -1
  21. package/dist/client/content-adapter.d.ts +80 -0
  22. package/dist/client/content-adapter.d.ts.map +1 -1
  23. package/dist/client/content-adapter.js +225 -12
  24. package/dist/client/content-adapter.js.map +1 -1
  25. package/dist/client/delivery-error.d.ts +150 -0
  26. package/dist/client/delivery-error.d.ts.map +1 -0
  27. package/dist/client/delivery-error.js +226 -0
  28. package/dist/client/delivery-error.js.map +1 -0
  29. package/dist/client/delivery-status.d.ts +32 -6
  30. package/dist/client/delivery-status.d.ts.map +1 -1
  31. package/dist/client/delivery-status.js +61 -13
  32. package/dist/client/delivery-status.js.map +1 -1
  33. package/dist/client/device-set-reconciliation.d.ts +196 -0
  34. package/dist/client/device-set-reconciliation.d.ts.map +1 -0
  35. package/dist/client/device-set-reconciliation.js +282 -0
  36. package/dist/client/device-set-reconciliation.js.map +1 -0
  37. package/dist/client/distribution-records.d.ts +29 -0
  38. package/dist/client/distribution-records.d.ts.map +1 -0
  39. package/dist/client/distribution-records.js +33 -0
  40. package/dist/client/distribution-records.js.map +1 -0
  41. package/dist/client/event-hooks.d.ts +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 +20 -19
  251. package/dist/internal/manager/manager.d.ts.map +1 -1
  252. package/dist/internal/manager/manager.js +56 -39
  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 +13 -11
  313. package/dist/internal/session/cipher.d.ts.map +1 -1
  314. package/dist/internal/session/cipher.js +40 -22
  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 +4 -12
  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/encryption.d.ts +8 -1
  416. package/dist/local/store/sqlite/encryption.d.ts.map +1 -1
  417. package/dist/local/store/sqlite/encryption.js +9 -0
  418. package/dist/local/store/sqlite/encryption.js.map +1 -1
  419. package/dist/local/store/sqlite/key-storage/index.d.ts +25 -4
  420. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
  421. package/dist/local/store/sqlite/key-storage/index.js +68 -7
  422. package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
  423. package/dist/local/store/sqlite/key-storage/message-records.d.ts +16 -4
  424. package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -1
  425. package/dist/local/store/sqlite/key-storage/message-records.js +49 -6
  426. package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -1
  427. package/dist/local/store/sqlite/key-storage/metadata.d.ts +8 -7
  428. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
  429. package/dist/local/store/sqlite/key-storage/metadata.js +17 -15
  430. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
  431. package/dist/local/store/sqlite/key-storage/receive-work.d.ts +27 -0
  432. package/dist/local/store/sqlite/key-storage/receive-work.d.ts.map +1 -0
  433. package/dist/local/store/sqlite/key-storage/receive-work.js +98 -0
  434. package/dist/local/store/sqlite/key-storage/receive-work.js.map +1 -0
  435. package/dist/local/store/sqlite/key-storage/send-log.d.ts +27 -0
  436. package/dist/local/store/sqlite/key-storage/send-log.d.ts.map +1 -0
  437. package/dist/local/store/sqlite/key-storage/send-log.js +178 -0
  438. package/dist/local/store/sqlite/key-storage/send-log.js.map +1 -0
  439. package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts +27 -0
  440. package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts.map +1 -0
  441. package/dist/local/store/sqlite/key-storage/sender-key-handoff.js +75 -0
  442. package/dist/local/store/sqlite/key-storage/sender-key-handoff.js.map +1 -0
  443. package/dist/local/store/sqlite/key-storage/session-trust.d.ts +2 -2
  444. package/dist/local/store/sqlite/key-storage/session-trust.js +5 -5
  445. package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -1
  446. package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
  447. package/dist/local/store/sqlite/migrations.js +101 -0
  448. package/dist/local/store/sqlite/migrations.js.map +1 -1
  449. package/dist/local/store/sqlite/models/index.d.ts +2 -1
  450. package/dist/local/store/sqlite/models/index.d.ts.map +1 -1
  451. package/dist/local/store/sqlite/models/index.js +5 -1
  452. package/dist/local/store/sqlite/models/index.js.map +1 -1
  453. package/dist/local/store/sqlite/models/message-record.d.ts +15 -0
  454. package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -1
  455. package/dist/local/store/sqlite/models/message-record.js +24 -0
  456. package/dist/local/store/sqlite/models/message-record.js.map +1 -1
  457. package/dist/local/store/sqlite/models/send-log.d.ts +51 -0
  458. package/dist/local/store/sqlite/models/send-log.d.ts.map +1 -0
  459. package/dist/local/store/sqlite/models/send-log.js +206 -0
  460. package/dist/local/store/sqlite/models/send-log.js.map +1 -0
  461. package/dist/local/store/sqlite/open-store.d.ts +9 -1
  462. package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
  463. package/dist/local/store/sqlite/open-store.js +20 -1
  464. package/dist/local/store/sqlite/open-store.js.map +1 -1
  465. package/dist/local/store/sqlite/schema.d.ts +34 -1
  466. package/dist/local/store/sqlite/schema.d.ts.map +1 -1
  467. package/dist/local/store/sqlite/schema.js +14 -0
  468. package/dist/local/store/sqlite/schema.js.map +1 -1
  469. package/dist/local/store/sqlite/store.d.ts +61 -11
  470. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  471. package/dist/local/store/sqlite/store.js +191 -27
  472. package/dist/local/store/sqlite/store.js.map +1 -1
  473. package/dist/local/store/web/adapter.d.ts +76 -8
  474. package/dist/local/store/web/adapter.d.ts.map +1 -1
  475. package/dist/local/store/web/adapter.js +579 -127
  476. package/dist/local/store/web/adapter.js.map +1 -1
  477. package/dist/local/store/web/receive-work.d.ts +57 -0
  478. package/dist/local/store/web/receive-work.d.ts.map +1 -0
  479. package/dist/local/store/web/receive-work.js +99 -0
  480. package/dist/local/store/web/receive-work.js.map +1 -0
  481. package/dist/local/store/web/send-log.d.ts +92 -0
  482. package/dist/local/store/web/send-log.d.ts.map +1 -0
  483. package/dist/local/store/web/send-log.js +267 -0
  484. package/dist/local/store/web/send-log.js.map +1 -0
  485. package/dist/local/store/web/sender-key-handoff.d.ts +81 -0
  486. package/dist/local/store/web/sender-key-handoff.d.ts.map +1 -0
  487. package/dist/local/store/web/sender-key-handoff.js +156 -0
  488. package/dist/local/store/web/sender-key-handoff.js.map +1 -0
  489. package/dist/local/store/web-sqlite/adapter.d.ts +2 -0
  490. package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
  491. package/dist/local/store/web-sqlite/adapter.js +12 -6
  492. package/dist/local/store/web-sqlite/adapter.js.map +1 -1
  493. package/dist/local/vault/custody.d.ts +8 -0
  494. package/dist/local/vault/custody.d.ts.map +1 -0
  495. package/dist/local/vault/custody.js +9 -0
  496. package/dist/local/vault/custody.js.map +1 -0
  497. package/dist/local/vault/electron-safe-storage.d.ts +3 -1
  498. package/dist/local/vault/electron-safe-storage.d.ts.map +1 -1
  499. package/dist/local/vault/electron-safe-storage.js +2 -0
  500. package/dist/local/vault/electron-safe-storage.js.map +1 -1
  501. package/dist/local/vault/expo-secure-store.d.ts +3 -1
  502. package/dist/local/vault/expo-secure-store.d.ts.map +1 -1
  503. package/dist/local/vault/expo-secure-store.js +2 -0
  504. package/dist/local/vault/expo-secure-store.js.map +1 -1
  505. package/dist/local/vault/indexed-db.d.ts +3 -1
  506. package/dist/local/vault/indexed-db.d.ts.map +1 -1
  507. package/dist/local/vault/indexed-db.js +2 -0
  508. package/dist/local/vault/indexed-db.js.map +1 -1
  509. package/dist/local/vault/react-native-keychain.d.ts +3 -1
  510. package/dist/local/vault/react-native-keychain.d.ts.map +1 -1
  511. package/dist/local/vault/react-native-keychain.js +2 -0
  512. package/dist/local/vault/react-native-keychain.js.map +1 -1
  513. package/dist/remote/relay/device-set.d.ts +94 -0
  514. package/dist/remote/relay/device-set.d.ts.map +1 -0
  515. package/dist/remote/relay/device-set.js +156 -0
  516. package/dist/remote/relay/device-set.js.map +1 -0
  517. package/dist/remote/relay/types.d.ts +92 -107
  518. package/dist/remote/relay/types.d.ts.map +1 -1
  519. package/dist/safety/core.d.ts +15 -6
  520. package/dist/safety/core.d.ts.map +1 -1
  521. package/dist/safety/core.js +41 -27
  522. package/dist/safety/core.js.map +1 -1
  523. package/dist/safety/index.d.ts +2 -1
  524. package/dist/safety/index.d.ts.map +1 -1
  525. package/dist/safety/index.js +12 -18
  526. package/dist/safety/index.js.map +1 -1
  527. package/dist/types/api.d.ts +707 -62
  528. package/dist/types/api.d.ts.map +1 -1
  529. package/dist/types/errors.d.ts +14 -33
  530. package/dist/types/errors.d.ts.map +1 -1
  531. package/dist/types/errors.js +14 -24
  532. package/dist/types/errors.js.map +1 -1
  533. package/dist/types/messages.d.ts +2 -2
  534. package/dist/types/messages.js +1 -1
  535. package/dist/types/protocol-config.d.ts +175 -42
  536. package/dist/types/protocol-config.d.ts.map +1 -1
  537. package/dist/types/protocol-config.js +19 -38
  538. package/dist/types/protocol-config.js.map +1 -1
  539. package/dist/types/protocol-constants.d.ts +6 -6
  540. package/dist/types/protocol-constants.js +6 -6
  541. package/dist/types/session.d.ts +7 -7
  542. package/dist/types/session.d.ts.map +1 -1
  543. package/dist/types/session.js +39 -21
  544. package/dist/types/session.js.map +1 -1
  545. package/dist/username/link.d.ts +2 -2
  546. package/dist/username/link.js +2 -2
  547. package/dist/utils/origin-lock.d.ts +45 -0
  548. package/dist/utils/origin-lock.d.ts.map +1 -0
  549. package/dist/utils/origin-lock.js +80 -0
  550. package/dist/utils/origin-lock.js.map +1 -0
  551. package/docs/ASSURANCE.md +6 -6
  552. package/docs/CLIENT_COMPOSITION.md +2 -2
  553. package/docs/DEVIATIONS.md +677 -182
  554. package/docs/E2EE.md +1 -1
  555. package/docs/ERROR_HANDLING.md +165 -2
  556. package/docs/GETTING_STARTED.md +7 -4
  557. package/docs/INTERFACES.md +1 -1
  558. package/docs/PACKAGE_SURFACE.md +6 -5
  559. package/docs/PROTOCOL_POLICY.md +102 -22
  560. package/docs/RECIPES.md +3 -15
  561. package/docs/SECURITY.md +90 -5
  562. package/keys/README.md +3 -3
  563. package/local/store/README.md +78 -14
  564. package/local/store/key-value/README.md +14 -3
  565. package/local/store/node/README.md +8 -3
  566. package/local/store/web/README.md +9 -0
  567. package/local/store/web-sqlite/README.md +14 -2
  568. package/local/vault/README.md +21 -0
  569. package/package.json +1 -6
  570. package/remote/README.md +0 -1
  571. package/remote/relay/README.md +2 -2
  572. package/dist/device/provisioning.d.ts +0 -242
  573. package/dist/device/provisioning.d.ts.map +0 -1
  574. package/dist/device/provisioning.js +0 -421
  575. package/dist/device/provisioning.js.map +0 -1
  576. package/dist/internal/protocol/x3dh/index.d.ts +0 -15
  577. package/dist/internal/protocol/x3dh/index.d.ts.map +0 -1
  578. package/dist/internal/protocol/x3dh/index.js +0 -13
  579. package/dist/internal/protocol/x3dh/index.js.map +0 -1
  580. package/dist/internal/protocol/x3dh/x3dh.d.ts +0 -131
  581. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +0 -1
  582. package/dist/internal/protocol/x3dh/x3dh.js +0 -261
  583. package/dist/internal/protocol/x3dh/x3dh.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ /**
2
+ * The receive record of a group: what a device must verify before it delivers
3
+ * the group's content.
4
+ *
5
+ * The record sits beside the master key and the cached state. Its required
6
+ * revision is the revision that local state must reach before the device
7
+ * delivers. Its fetch state bounds the server work that claims can cause.
8
+ */
9
+ export {};
10
+ /**
11
+ * How the device learned the group's master key.
12
+ *
13
+ * No SDK path writes `'provisioning'`.
14
+ */
15
+ export type GroupRecordSource = 'provisioning' | 'context' | 'sync' | 'local';
16
+ /** A verified answer from the group server that refuses this device. */
17
+ export type GroupFetchDenial = 'group-not-found' | 'access-revoked' | 'group-not-readable';
18
+ /** The fetch backoff and the last verified denial of one group. */
19
+ export interface GroupFetchState {
20
+ /**
21
+ * Consecutive fetches that reached no head, or that the server denied.
22
+ * Zero after a fetch reaches the server head.
23
+ */
24
+ attempts: number;
25
+ /** The end of the current backoff window, in epoch milliseconds. */
26
+ nextAttemptAt: number;
27
+ /** The server head that the last fetch reached. A failed fetch clears it. */
28
+ head?: number;
29
+ /** The claimed revisions already fetched in the current window. */
30
+ fetchedClaims?: number[];
31
+ /**
32
+ * The last verified denial, and the highest claim it answered: the claim
33
+ * of its fetch or the required revision then, whichever is higher.
34
+ */
35
+ denied?: {
36
+ atRevision: number;
37
+ reason: GroupFetchDenial;
38
+ };
39
+ }
40
+ /** The sender device whose group context created an unverified group. */
41
+ export interface GroupUnverifiedOrigin {
42
+ senderId: string;
43
+ senderDeviceId: number;
44
+ createdAt: number;
45
+ }
46
+ /** The receive record of one group. */
47
+ export interface GroupReceiveRecord {
48
+ /**
49
+ * The highest revision that an authenticated group context from any
50
+ * sender claimed since the last fetch that reached the server head. That
51
+ * fetch sets it to the head, so a claim above the head holds the group
52
+ * stale only until the fetch for it. Local state below it is stale.
53
+ */
54
+ requiredRevision: number;
55
+ source: GroupRecordSource;
56
+ init: GroupFetchState;
57
+ /** Set while a group that a sender's context created has never verified. */
58
+ unverified?: GroupUnverifiedOrigin;
59
+ }
60
+ /** The status that a receive record and the local state derive. */
61
+ export type GroupReceiveStatus = 'ready' | 'stale' | 'pending' | 'denied';
62
+ /** The minimum time between two fetches of one group. */
63
+ export declare const GROUP_FETCH_WINDOW_MS = 30000;
64
+ /** The maximum backoff after repeated fetch failures. */
65
+ export declare const GROUP_FETCH_MAX_BACKOFF_MS: number;
66
+ /** A receive record for a group with no claims and no fetch history. */
67
+ export declare function newGroupReceiveRecord(source: GroupRecordSource): GroupReceiveRecord;
68
+ /** A deep copy of a receive record, which holds only JSON values. */
69
+ export declare function cloneGroupReceiveRecord(record: GroupReceiveRecord): GroupReceiveRecord;
70
+ /**
71
+ * The derived status of a group.
72
+ *
73
+ * A denial holds only while no claim above the revision it answered exists.
74
+ */
75
+ export declare function groupReceiveStatus(record: GroupReceiveRecord | null, stateRevision: number | null): GroupReceiveStatus;
76
+ /** The backoff delay after `attempts` consecutive failures. */
77
+ export declare function groupFetchBackoffMs(attempts: number): number;
78
+ //# sourceMappingURL=receive-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receive-record.d.ts","sourceRoot":"","sources":["../../../internal/groups/receive-record.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC;AAEV;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9E,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,oBAAoB,CAAC;AAEzB,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,gBAAgB,CAAA;KAAE,CAAC;CAC3D;AAED,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED,mEAAmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1E,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAC5C,yDAAyD;AACzD,eAAO,MAAM,0BAA0B,QAAc,CAAC;AAEtD,wEAAwE;AACxE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,GACxB,kBAAkB,CAMpB;AAED,qEAAqE;AACrE,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,kBAAkB,GACzB,kBAAkB,CAEpB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,GAAG,IAAI,EACjC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,kBAAkB,CAMpB;AAED,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK5D"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The receive record of a group: what a device must verify before it delivers
3
+ * the group's content.
4
+ *
5
+ * The record sits beside the master key and the cached state. Its required
6
+ * revision is the revision that local state must reach before the device
7
+ * delivers. Its fetch state bounds the server work that claims can cause.
8
+ */
9
+ /** The minimum time between two fetches of one group. */
10
+ export const GROUP_FETCH_WINDOW_MS = 30_000;
11
+ /** The maximum backoff after repeated fetch failures. */
12
+ export const GROUP_FETCH_MAX_BACKOFF_MS = 60 * 60_000;
13
+ /** A receive record for a group with no claims and no fetch history. */
14
+ export function newGroupReceiveRecord(source) {
15
+ return {
16
+ requiredRevision: 0,
17
+ source,
18
+ init: { attempts: 0, nextAttemptAt: 0 },
19
+ };
20
+ }
21
+ /** A deep copy of a receive record, which holds only JSON values. */
22
+ export function cloneGroupReceiveRecord(record) {
23
+ return JSON.parse(JSON.stringify(record));
24
+ }
25
+ /**
26
+ * The derived status of a group.
27
+ *
28
+ * A denial holds only while no claim above the revision it answered exists.
29
+ */
30
+ export function groupReceiveStatus(record, stateRevision) {
31
+ const required = record?.requiredRevision ?? 0;
32
+ const denied = record?.init.denied;
33
+ if (denied && denied.atRevision >= required)
34
+ return 'denied';
35
+ if (stateRevision === null)
36
+ return 'pending';
37
+ return stateRevision >= required ? 'ready' : 'stale';
38
+ }
39
+ /** The backoff delay after `attempts` consecutive failures. */
40
+ export function groupFetchBackoffMs(attempts) {
41
+ return Math.min(GROUP_FETCH_WINDOW_MS * 2 ** Math.max(0, attempts), GROUP_FETCH_MAX_BACKOFF_MS);
42
+ }
43
+ //# sourceMappingURL=receive-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receive-record.js","sourceRoot":"","sources":["../../../internal/groups/receive-record.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8DH,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,yDAAyD;AACzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,MAAM,CAAC;AAEtD,wEAAwE;AACxE,MAAM,UAAU,qBAAqB,CACnC,MAAyB;IAEzB,OAAO;QACL,gBAAgB,EAAE,CAAC;QACnB,MAAM;QACN,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE;KACxC,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,uBAAuB,CACrC,MAA0B;IAE1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAuB,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAiC,EACjC,aAA4B;IAE5B,MAAM,QAAQ,GAAG,MAAM,EAAE,gBAAgB,IAAI,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IACnC,IAAI,MAAM,IAAI,MAAM,CAAC,UAAU,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC7D,IAAI,aAAa,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,aAAa,IAAI,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,OAAO,IAAI,CAAC,GAAG,CACb,qBAAqB,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAClD,0BAA0B,CAC3B,CAAC;AACJ,CAAC"}
@@ -3,18 +3,30 @@
3
3
  */
4
4
  import type { SignalProtocolLocalStore } from '../../types/api.js';
5
5
  import type { GroupStateStore } from './manager.js';
6
+ import { type GroupReceiveRecord } from './receive-record.js';
6
7
  import type { DecryptedGroup } from './types.js';
7
8
  export {};
8
9
  /**
9
10
  * Adapts the SDK local store to the group manager's focused storage contract.
10
11
  *
11
- * One versioned metadata record owns the master key, cached state, and sender
12
- * key rotation barrier for a group. State-and-barrier writes therefore cross
13
- * the local-store boundary atomically.
12
+ * One versioned metadata record owns the master key, cached state, sender key
13
+ * rotation barrier, and receive record of a group. State-and-barrier writes
14
+ * therefore cross the local-store boundary atomically. An index lists the
15
+ * groups that have a v2 record.
16
+ *
17
+ * A v1 record migrates forward when the group is first read or written. The
18
+ * migration indexes the group, writes the v2 record, and then deletes the v1
19
+ * record. Each step is idempotent, so a crash at any step reruns safely. A v1
20
+ * group that is never read again stays unlisted, which is correct for a group
21
+ * whose state the device already holds.
14
22
  */
15
23
  export declare class SignalProtocolGroupStateStore implements GroupStateStore {
16
24
  private readonly storage;
17
25
  private readonly lock;
26
+ /** Groups whose v1 record this process has confirmed deleted. */
27
+ private readonly migrated;
28
+ /** Groups that this process has confirmed in the index. */
29
+ private readonly indexed;
18
30
  constructor(storage: SignalProtocolLocalStore);
19
31
  storeMasterKey(groupId: string, masterKey: Uint8Array): Promise<void>;
20
32
  getMasterKey(groupId: string): Promise<Uint8Array | null>;
@@ -25,8 +37,20 @@ export declare class SignalProtocolGroupStateStore implements GroupStateStore {
25
37
  getSenderKeyRotationBarrier(groupId: string): Promise<number | null>;
26
38
  clearSenderKeyRotationBarrier(groupId: string, expectedRevision: number): Promise<void>;
27
39
  deleteGroupState(groupId: string): Promise<void>;
40
+ getGroupReceiveRecord(groupId: string): Promise<GroupReceiveRecord | null>;
41
+ updateGroupReceiveRecord(groupId: string, apply: (current: GroupReceiveRecord | null) => GroupReceiveRecord | null): Promise<GroupReceiveRecord | null>;
42
+ listGroupReceiveRecords(): Promise<string[]>;
28
43
  private key;
44
+ private v1Key;
29
45
  private read;
46
+ /** Read the v2 record, and migrate a v1 record first. Runs under the group lock. */
47
+ private load;
30
48
  private update;
49
+ /** Index the group, then write its record. */
50
+ private write;
51
+ /** Delete both record versions, then drop the group from the index. */
52
+ private remove;
53
+ private addToIndex;
54
+ private changeIndex;
31
55
  }
32
56
  //# sourceMappingURL=sdk-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-store.d.ts","sourceRoot":"","sources":["../../../internal/groups/sdk-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,CAAC;AA6CV;;;;;;GAMG;AACH,qBAAa,6BAA8B,YAAW,eAAe;IAGvD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO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AGpC;IAEK,wBAAwB,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,KAAK,kBAAkB,GAAG,IAAI,GACvE,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAuBpC;IAEK,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAEjD;IAED,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,KAAK;YAIC,IAAI;IAIlB,oFAAoF;YACtE,IAAI;YAqBJ,MAAM;IAcpB,8CAA8C;YAChC,KAAK;IAQnB,uEAAuE;YACzD,MAAM;YASN,UAAU;YAQV,WAAW;CAmB1B"}
@@ -5,8 +5,11 @@ import AsyncLock from 'async-lock';
5
5
  import { base64ToBytes, bytesToBase64 } from '../../encoding/base64.js';
6
6
  import { asBase64 } from '../../types/utils.js';
7
7
  import { cloneProtocolState } from '../crypto/utils.js';
8
- const RECORD_VERSION = 1;
9
- const RECORD_PREFIX = 'open-e2ee:group-state:v1:';
8
+ import { cloneGroupReceiveRecord, newGroupReceiveRecord, } from './receive-record.js';
9
+ const RECORD_VERSION = 2;
10
+ const RECORD_PREFIX = 'open-e2ee:group-state:v2:';
11
+ const V1_RECORD_PREFIX = 'open-e2ee:group-state:v1:';
12
+ const INDEX_KEY = 'open-e2ee:group-state:v2-index';
10
13
  const BYTES_TAG = '__openE2eeGroupBytes';
11
14
  function encodeRecord(record) {
12
15
  return JSON.stringify(record, (_key, value) => {
@@ -16,8 +19,8 @@ function encodeRecord(record) {
16
19
  return value;
17
20
  });
18
21
  }
19
- function decodeRecord(encoded) {
20
- const decoded = JSON.parse(encoded, (_key, value) => {
22
+ function decodeBytes(encoded) {
23
+ return JSON.parse(encoded, (_key, value) => {
21
24
  if (typeof value === 'object' &&
22
25
  value !== null &&
23
26
  Object.keys(value).length === 1 &&
@@ -26,87 +29,216 @@ function decodeRecord(encoded) {
26
29
  }
27
30
  return value;
28
31
  });
29
- if (decoded.version !== RECORD_VERSION) {
32
+ }
33
+ function decodeRecord(encoded, version) {
34
+ const decoded = decodeBytes(encoded);
35
+ if (decoded.version !== version) {
30
36
  throw new Error(`Unsupported SDK group-state record version ${String(decoded.version)}`);
31
37
  }
32
38
  return decoded;
33
39
  }
40
+ /**
41
+ * The v2 form of a v1 record. A v1 group has no claims and no fetch history,
42
+ * so it starts at required revision 0 as a locally known group.
43
+ */
44
+ function migrateV1Record(record) {
45
+ const { version: _version, ...fields } = record;
46
+ return {
47
+ ...fields,
48
+ ...newGroupReceiveRecord('local'),
49
+ version: RECORD_VERSION,
50
+ };
51
+ }
52
+ function receivePart(record) {
53
+ const { version: _version, masterKey: _masterKey, state: _state, senderKeyRotationBarrier: _barrier, ...receive } = record;
54
+ return cloneGroupReceiveRecord(receive);
55
+ }
56
+ function parseIndex(encoded) {
57
+ if (encoded === null)
58
+ return [];
59
+ const parsed = JSON.parse(encoded);
60
+ if (!Array.isArray(parsed) || !parsed.every((id) => typeof id === 'string')) {
61
+ throw new Error('The SDK group-state index is malformed');
62
+ }
63
+ return parsed;
64
+ }
34
65
  /**
35
66
  * Adapts the SDK local store to the group manager's focused storage contract.
36
67
  *
37
- * One versioned metadata record owns the master key, cached state, and sender
38
- * key rotation barrier for a group. State-and-barrier writes therefore cross
39
- * the local-store boundary atomically.
68
+ * One versioned metadata record owns the master key, cached state, sender key
69
+ * rotation barrier, and receive record of a group. State-and-barrier writes
70
+ * therefore cross the local-store boundary atomically. An index lists the
71
+ * groups that have a v2 record.
72
+ *
73
+ * A v1 record migrates forward when the group is first read or written. The
74
+ * migration indexes the group, writes the v2 record, and then deletes the v1
75
+ * record. Each step is idempotent, so a crash at any step reruns safely. A v1
76
+ * group that is never read again stays unlisted, which is correct for a group
77
+ * whose state the device already holds.
40
78
  */
41
79
  export class SignalProtocolGroupStateStore {
42
80
  storage;
43
81
  lock = new AsyncLock();
82
+ /** Groups whose v1 record this process has confirmed deleted. */
83
+ migrated = new Set();
84
+ /** Groups that this process has confirmed in the index. */
85
+ indexed = new Set();
44
86
  constructor(storage) {
45
87
  this.storage = storage;
46
88
  }
47
89
  async storeMasterKey(groupId, masterKey) {
48
90
  await this.update(groupId, (record) => {
49
91
  record.masterKey = new Uint8Array(masterKey);
92
+ return record;
50
93
  });
51
94
  }
52
95
  async getMasterKey(groupId) {
53
96
  const record = await this.read(groupId);
54
- return record.masterKey
55
- ? new Uint8Array(record.masterKey)
56
- : null;
97
+ return record?.masterKey ? new Uint8Array(record.masterKey) : null;
57
98
  }
58
99
  async deleteMasterKey(groupId) {
59
100
  await this.update(groupId, (record) => {
60
101
  delete record.masterKey;
102
+ return record;
61
103
  });
62
104
  }
63
105
  async storeGroupState(groupId, state) {
64
106
  await this.update(groupId, (record) => {
65
107
  record.state = cloneProtocolState(state);
108
+ delete record.unverified;
109
+ return record;
66
110
  });
67
111
  }
68
112
  async storeGroupStateWithSenderKeyRotationBarrier(groupId, state) {
69
113
  await this.update(groupId, (record) => {
70
114
  record.state = cloneProtocolState(state);
71
115
  record.senderKeyRotationBarrier = state.revision;
116
+ delete record.unverified;
117
+ return record;
72
118
  });
73
119
  }
74
120
  async getGroupState(groupId) {
75
121
  const record = await this.read(groupId);
76
- return record.state ? cloneProtocolState(record.state) : null;
122
+ return record?.state ? cloneProtocolState(record.state) : null;
77
123
  }
78
124
  async getSenderKeyRotationBarrier(groupId) {
79
125
  const record = await this.read(groupId);
80
- return record.senderKeyRotationBarrier ?? null;
126
+ return record?.senderKeyRotationBarrier ?? null;
81
127
  }
82
128
  async clearSenderKeyRotationBarrier(groupId, expectedRevision) {
83
129
  await this.update(groupId, (record) => {
84
130
  if (record.senderKeyRotationBarrier === expectedRevision) {
85
131
  delete record.senderKeyRotationBarrier;
86
132
  }
133
+ return record;
87
134
  });
88
135
  }
89
136
  async deleteGroupState(groupId) {
90
137
  await this.update(groupId, (record) => {
91
138
  delete record.state;
92
139
  delete record.senderKeyRotationBarrier;
140
+ return record;
93
141
  });
94
142
  }
143
+ async getGroupReceiveRecord(groupId) {
144
+ const record = await this.read(groupId);
145
+ return record ? receivePart(record) : null;
146
+ }
147
+ async updateGroupReceiveRecord(groupId, apply) {
148
+ let written = null;
149
+ await this.lock.acquire(groupId, async () => {
150
+ const current = await this.load(groupId);
151
+ const next = apply(current ? receivePart(current) : null);
152
+ if (next === null) {
153
+ if (current)
154
+ await this.remove(groupId);
155
+ return;
156
+ }
157
+ const receive = cloneGroupReceiveRecord(next);
158
+ const record = {
159
+ ...(current?.masterKey ? { masterKey: current.masterKey } : {}),
160
+ ...(current?.state ? { state: current.state } : {}),
161
+ ...(current?.senderKeyRotationBarrier !== undefined
162
+ ? { senderKeyRotationBarrier: current.senderKeyRotationBarrier }
163
+ : {}),
164
+ ...receive,
165
+ version: RECORD_VERSION,
166
+ };
167
+ await this.write(groupId, record);
168
+ written = receivePart(record);
169
+ });
170
+ return written;
171
+ }
172
+ async listGroupReceiveRecords() {
173
+ return parseIndex(await this.storage.getMetadata(INDEX_KEY));
174
+ }
95
175
  key(groupId) {
96
176
  return `${RECORD_PREFIX}${groupId}`;
97
177
  }
178
+ v1Key(groupId) {
179
+ return `${V1_RECORD_PREFIX}${groupId}`;
180
+ }
98
181
  async read(groupId) {
182
+ return this.lock.acquire(groupId, () => this.load(groupId));
183
+ }
184
+ /** Read the v2 record, and migrate a v1 record first. Runs under the group lock. */
185
+ async load(groupId) {
99
186
  const encoded = await this.storage.getMetadata(this.key(groupId));
100
- return encoded === null
101
- ? { version: RECORD_VERSION }
102
- : decodeRecord(encoded);
187
+ if (encoded !== null) {
188
+ if (!this.migrated.has(groupId)) {
189
+ // A crash after the v2 write left the v1 record. Finish the migration.
190
+ await this.storage.deleteMetadata(this.v1Key(groupId));
191
+ this.migrated.add(groupId);
192
+ }
193
+ return decodeRecord(encoded, RECORD_VERSION);
194
+ }
195
+ const legacy = await this.storage.getMetadata(this.v1Key(groupId));
196
+ if (legacy === null)
197
+ return null;
198
+ const migrated = migrateV1Record(decodeRecord(legacy, 1));
199
+ await this.write(groupId, migrated);
200
+ await this.storage.deleteMetadata(this.v1Key(groupId));
201
+ this.migrated.add(groupId);
202
+ return migrated;
103
203
  }
104
204
  async update(groupId, apply) {
105
205
  await this.lock.acquire(groupId, async () => {
106
- const record = await this.read(groupId);
107
- apply(record);
108
- await this.storage.setMetadata(this.key(groupId), encodeRecord(record));
206
+ const record = (await this.load(groupId)) ?? {
207
+ ...newGroupReceiveRecord('local'),
208
+ version: RECORD_VERSION,
209
+ };
210
+ await this.write(groupId, apply(record));
109
211
  });
110
212
  }
213
+ /** Index the group, then write its record. */
214
+ async write(groupId, record) {
215
+ await this.addToIndex(groupId);
216
+ await this.storage.setMetadata(this.key(groupId), encodeRecord(record));
217
+ }
218
+ /** Delete both record versions, then drop the group from the index. */
219
+ async remove(groupId) {
220
+ await this.storage.deleteMetadata(this.v1Key(groupId));
221
+ await this.storage.deleteMetadata(this.key(groupId));
222
+ await this.changeIndex((ids) => ids.includes(groupId) ? ids.filter((id) => id !== groupId) : ids);
223
+ this.indexed.delete(groupId);
224
+ }
225
+ async addToIndex(groupId) {
226
+ if (this.indexed.has(groupId))
227
+ return;
228
+ await this.changeIndex((ids) => ids.includes(groupId) ? ids : [...ids, groupId]);
229
+ this.indexed.add(groupId);
230
+ }
231
+ async changeIndex(change) {
232
+ for (;;) {
233
+ const encoded = await this.storage.getMetadata(INDEX_KEY);
234
+ const ids = parseIndex(encoded);
235
+ const next = change(ids);
236
+ if (next === ids)
237
+ return;
238
+ if (await this.storage.compareAndSetMetadata(INDEX_KEY, encoded, JSON.stringify(next))) {
239
+ return;
240
+ }
241
+ }
242
+ }
111
243
  }
112
244
  //# sourceMappingURL=sdk-store.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-store.js","sourceRoot":"","sources":["../../../internal/groups/sdk-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uB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,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,CAAC,CAChD,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEO,KAAK,CAAC,WAAW,CACvB,MAAmC;QAEnC,SAAS,CAAC;YACR,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAC1D,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;YAChC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,IAAI,KAAK,GAAG;gBAAE,OAAO;YACzB,IACE,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CACtC,SAAS,EACT,OAAO,EACP,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CACrB,EACD,CAAC;gBACD,OAAO;YACT,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module groups/wire
9
9
  */
10
- import { type EncryptedGroup, type EncryptedGroupCreationSubmission, type EncryptedGroupChange, type EncryptedGroupJoinInfo } from './types.js';
10
+ import { type EncryptedGroup, type EncryptedGroupCreationSubmission, type EncryptedGroupChange, type EncryptedGroupJoinInfo, type SerializedGroupChange } from './types.js';
11
11
  export declare function serializeGroupWire(value: unknown): Uint8Array;
12
12
  export declare function deserializeGroupWire<T>(bytes: Uint8Array): T;
13
13
  export declare function serializeEncryptedGroup(group: EncryptedGroup): Uint8Array;
@@ -32,6 +32,17 @@ export declare function serializeGroupBaseline(groupId: Uint8Array, version: num
32
32
  export declare function serializeGroupChangeCommitment(changeEpoch: number, actions: Uint8Array): Uint8Array;
33
33
  export declare function serializeEncryptedGroupChange(change: EncryptedGroupChange): Uint8Array;
34
34
  export declare function deserializeEncryptedGroupChange(bytes: Uint8Array): EncryptedGroupChange;
35
+ /**
36
+ * Serialize a signed group change as a message carries it in its group
37
+ * context, as Signal's `GroupContextV2.groupChange`.
38
+ */
39
+ export declare function serializeSignedGroupChange(change: SerializedGroupChange): Uint8Array;
40
+ /**
41
+ * Read the signed group change that a message carries. It throws when the
42
+ * bytes are not exactly the form that `serializeSignedGroupChange` writes.
43
+ * The caller still verifies the signature and the change.
44
+ */
45
+ export declare function deserializeSignedGroupChange(bytes: Uint8Array): SerializedGroupChange;
35
46
  /** Compute Revision 19's authoritative compatibility epoch from populated actions. */
36
47
  export declare function requiredGroupChangeEpoch(change: EncryptedGroupChange): number;
37
48
  /** Count populated actions, including every element of repeated action fields. */
@@ -1 +1 @@
1
- {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../internal/groups/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gCAAgC,EACrC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC5B,MAAM,SAAS,CAAC;AAsFjB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAK7D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,CAa5D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,UAAU,CAEzE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAE3E;AAED,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,gCAAgC,GACtC,UAAU,CAEZ;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,cAAc,GACpB,gCAAgC,CAoBlC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,MAAM,EACf,mBAAmB,EAAE,UAAU,GAC9B,UAAU,CASZ;AAED,6DAA6D;AAC7D,wBAAgB,8BAA8B,CA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A4BlE;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,wBAAwB,GAC7B,IAAI,CA8EN;AAuED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,wBAAwB,GAC7B,IAAI,CA2ON;AAiPD,yEAAyE;AACzE,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAEzE;AAED,wEAAwE;AACxE,wBAAgB,+CAA+C,CAC7D,KAAK,EAAE,gCAAgC,GACtC,IAAI,CAEN;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,UAAU,GAAG,sBAAsB,CAE3F"}
@@ -163,6 +163,42 @@ export function serializeEncryptedGroupChange(change) {
163
163
  export function deserializeEncryptedGroupChange(bytes) {
164
164
  return deserializeGroupWire(bytes);
165
165
  }
166
+ /**
167
+ * Serialize a signed group change as a message carries it in its group
168
+ * context, as Signal's `GroupContextV2.groupChange`.
169
+ */
170
+ export function serializeSignedGroupChange(change) {
171
+ return serializeGroupWire({
172
+ actions: change.actions,
173
+ serverSignature: change.serverSignature,
174
+ changeEpoch: change.changeEpoch,
175
+ });
176
+ }
177
+ /**
178
+ * Read the signed group change that a message carries. It throws when the
179
+ * bytes are not exactly the form that `serializeSignedGroupChange` writes.
180
+ * The caller still verifies the signature and the change.
181
+ */
182
+ export function deserializeSignedGroupChange(bytes) {
183
+ const value = deserializeGroupWire(bytes);
184
+ if (!value ||
185
+ typeof value !== 'object' ||
186
+ Array.isArray(value) ||
187
+ Object.keys(value).sort().join(',') !== 'actions,changeEpoch,serverSignature' ||
188
+ !(value.actions instanceof Uint8Array) ||
189
+ !(value.serverSignature instanceof Uint8Array) ||
190
+ typeof value.changeEpoch !== 'number' ||
191
+ !Number.isInteger(value.changeEpoch) ||
192
+ value.changeEpoch < 0 ||
193
+ value.changeEpoch > 0xffffffff) {
194
+ throw new Error('INVALID_CHANGE: A carried group change is malformed');
195
+ }
196
+ return {
197
+ actions: value.actions,
198
+ serverSignature: value.serverSignature,
199
+ changeEpoch: value.changeEpoch,
200
+ };
201
+ }
166
202
  /** Compute Revision 19's authoritative compatibility epoch from populated actions. */
167
203
  export function requiredGroupChangeEpoch(change) {
168
204
  let required = 0;