@open-e2ee/signal-protocol-sdk 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (1095) hide show
  1. package/ADAPTERS.md +24 -24
  2. package/ARCHITECTURE.md +4 -4
  3. package/CHANGELOG.md +1370 -0
  4. package/COMMERCIAL.md +56 -0
  5. package/NOTICE +3 -1
  6. package/README.md +40 -35
  7. package/SECURITY.md +15 -1
  8. package/blocking/README.md +5 -5
  9. package/client/README.md +5 -5
  10. package/device/README.md +3 -1
  11. package/dist/blocking/index.d.ts +2 -2
  12. package/dist/blocking/index.d.ts.map +1 -1
  13. package/dist/blocking/index.js +1 -1
  14. package/dist/blocking/index.js.map +1 -1
  15. package/dist/blocking/manager.d.ts +7 -7
  16. package/dist/blocking/manager.d.ts.map +1 -1
  17. package/dist/blocking/manager.js +3 -3
  18. package/dist/blocking/manager.js.map +1 -1
  19. package/dist/blocking/types.d.ts +4 -4
  20. package/dist/blocking/types.d.ts.map +1 -1
  21. package/dist/blocking/types.js +1 -1
  22. package/dist/client/client.d.ts +48 -41
  23. package/dist/client/client.d.ts.map +1 -1
  24. package/dist/client/client.js +160 -101
  25. package/dist/client/client.js.map +1 -1
  26. package/dist/client/compose.d.ts +15 -10
  27. package/dist/client/compose.d.ts.map +1 -1
  28. package/dist/client/compose.js +2 -0
  29. package/dist/client/compose.js.map +1 -1
  30. package/dist/client/config.d.ts +68 -34
  31. package/dist/client/config.d.ts.map +1 -1
  32. package/dist/client/config.js.map +1 -1
  33. package/dist/client/content-adapter.d.ts +4 -4
  34. package/dist/client/content-adapter.d.ts.map +1 -1
  35. package/dist/client/content-adapter.js +1 -1
  36. package/dist/client/content-adapter.js.map +1 -1
  37. package/dist/client/dual-store.d.ts +5 -5
  38. package/dist/client/dual-store.d.ts.map +1 -1
  39. package/dist/client/dual-store.js.map +1 -1
  40. package/dist/client/endorsement-manager.d.ts +23 -2
  41. package/dist/client/endorsement-manager.d.ts.map +1 -1
  42. package/dist/client/endorsement-manager.js +37 -12
  43. package/dist/client/endorsement-manager.js.map +1 -1
  44. package/dist/client/event-hooks.d.ts +1 -1
  45. package/dist/client/groups.d.ts +29 -29
  46. package/dist/client/groups.d.ts.map +1 -1
  47. package/dist/client/groups.js +54 -37
  48. package/dist/client/groups.js.map +1 -1
  49. package/dist/client/headless.d.ts +12 -12
  50. package/dist/client/headless.d.ts.map +1 -1
  51. package/dist/client/headless.js +9 -9
  52. package/dist/client/headless.js.map +1 -1
  53. package/dist/client/index.d.ts +4 -4
  54. package/dist/client/index.d.ts.map +1 -1
  55. package/dist/client/index.js +1 -1
  56. package/dist/client/index.js.map +1 -1
  57. package/dist/client/key-rotation-core.d.ts +11 -11
  58. package/dist/client/key-rotation-core.d.ts.map +1 -1
  59. package/dist/client/key-rotation-core.js +22 -22
  60. package/dist/client/key-rotation-core.js.map +1 -1
  61. package/dist/client/media.d.ts +2 -2
  62. package/dist/client/media.js +5 -5
  63. package/dist/client/media.js.map +1 -1
  64. package/dist/client/messages.js +2 -2
  65. package/dist/client/messages.js.map +1 -1
  66. package/dist/client/prekeys.js +1 -1
  67. package/dist/client/prekeys.js.map +1 -1
  68. package/dist/client/relay-subscription.d.ts +2 -2
  69. package/dist/client/relay-subscription.d.ts.map +1 -1
  70. package/dist/client/relay-subscription.js +18 -1
  71. package/dist/client/relay-subscription.js.map +1 -1
  72. package/dist/client/retry.js +1 -1
  73. package/dist/client/retry.js.map +1 -1
  74. package/dist/client/sealed-sender-ops.d.ts +28 -2
  75. package/dist/client/sealed-sender-ops.d.ts.map +1 -1
  76. package/dist/client/sealed-sender-ops.js +40 -10
  77. package/dist/client/sealed-sender-ops.js.map +1 -1
  78. package/dist/client/sessions.d.ts.map +1 -1
  79. package/dist/client/sessions.js +3 -0
  80. package/dist/client/sessions.js.map +1 -1
  81. package/dist/client/signal-service-cipher.d.ts +34 -11
  82. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  83. package/dist/client/signal-service-cipher.js +149 -75
  84. package/dist/client/signal-service-cipher.js.map +1 -1
  85. package/dist/client/types.d.ts +28 -15
  86. package/dist/client/types.d.ts.map +1 -1
  87. package/dist/client/types.js.map +1 -1
  88. package/dist/device/connection.js +2 -2
  89. package/dist/device/connection.js.map +1 -1
  90. package/dist/device/device-id.d.ts.map +1 -1
  91. package/dist/device/device-id.js +4 -4
  92. package/dist/device/device-id.js.map +1 -1
  93. package/dist/device/expo-metadata.d.ts +26 -0
  94. package/dist/device/expo-metadata.d.ts.map +1 -0
  95. package/dist/device/expo-metadata.js +33 -0
  96. package/dist/device/expo-metadata.js.map +1 -0
  97. package/dist/device/index.d.ts +1 -1
  98. package/dist/device/index.d.ts.map +1 -1
  99. package/dist/device/index.js +5 -1
  100. package/dist/device/index.js.map +1 -1
  101. package/dist/device/provisioning.d.ts +9 -17
  102. package/dist/device/provisioning.d.ts.map +1 -1
  103. package/dist/device/provisioning.js +13 -30
  104. package/dist/device/provisioning.js.map +1 -1
  105. package/dist/device/transfer.d.ts.map +1 -1
  106. package/dist/device/transfer.js +14 -14
  107. package/dist/device/transfer.js.map +1 -1
  108. package/dist/files/index.d.ts +1 -1
  109. package/dist/files/index.js +1 -1
  110. package/dist/groups/index.d.ts +4 -4
  111. package/dist/groups/index.d.ts.map +1 -1
  112. package/dist/groups/index.js +3 -3
  113. package/dist/groups/index.js.map +1 -1
  114. package/dist/hooks/use-connection-presence.d.ts +5 -5
  115. package/dist/hooks/use-connection-presence.d.ts.map +1 -1
  116. package/dist/hooks/use-connection-presence.js +5 -5
  117. package/dist/hooks/use-connection-presence.js.map +1 -1
  118. package/dist/hooks/use-group-membership.d.ts +2 -2
  119. package/dist/hooks/use-key-rotation.js +2 -2
  120. package/dist/hooks/use-key-rotation.js.map +1 -1
  121. package/dist/index.d.ts +29 -22
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +20 -13
  124. package/dist/index.js.map +1 -1
  125. package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -1
  126. package/dist/internal/crypto/ec/x25519-validation.js +4 -4
  127. package/dist/internal/crypto/ec/x25519-validation.js.map +1 -1
  128. package/dist/internal/crypto/index.d.ts +1 -1
  129. package/dist/internal/crypto/index.d.ts.map +1 -1
  130. package/dist/internal/crypto/index.js +2 -2
  131. package/dist/internal/crypto/index.js.map +1 -1
  132. package/dist/internal/crypto/kdf/hkdf.d.ts +1 -1
  133. package/dist/internal/crypto/kdf/hkdf.d.ts.map +1 -1
  134. package/dist/internal/crypto/kdf/hkdf.js +2 -2
  135. package/dist/internal/crypto/kdf/hkdf.js.map +1 -1
  136. package/dist/internal/crypto/key-prefix.d.ts +1 -1
  137. package/dist/internal/crypto/key-prefix.js +1 -1
  138. package/dist/internal/crypto/pq/kyber.d.ts +1 -1
  139. package/dist/internal/crypto/pq/kyber.js +1 -1
  140. package/dist/internal/crypto/random.d.ts +9 -0
  141. package/dist/internal/crypto/random.d.ts.map +1 -1
  142. package/dist/internal/crypto/random.js +16 -0
  143. package/dist/internal/crypto/random.js.map +1 -1
  144. package/dist/internal/crypto/symmetric/aes-gcm-siv.d.ts +1 -1
  145. package/dist/internal/crypto/symmetric/aes-gcm-siv.js +1 -1
  146. package/dist/internal/crypto/symmetric/mac.d.ts +3 -3
  147. package/dist/internal/crypto/symmetric/mac.js +3 -3
  148. package/dist/internal/crypto/utils.d.ts +2 -2
  149. package/dist/internal/crypto/utils.js +2 -2
  150. package/dist/internal/encoding/proto/envelope.d.ts +21 -21
  151. package/dist/internal/encoding/proto/envelope.d.ts.map +1 -1
  152. package/dist/internal/encoding/proto/envelope.js +25 -25
  153. package/dist/internal/encoding/proto/envelope.js.map +1 -1
  154. package/dist/internal/encoding/proto/index.d.ts +2 -2
  155. package/dist/internal/encoding/proto/index.d.ts.map +1 -1
  156. package/dist/internal/encoding/proto/index.js +3 -3
  157. package/dist/internal/encoding/proto/index.js.map +1 -1
  158. package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts +5 -5
  159. package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts.map +1 -1
  160. package/dist/internal/encoding/proto/pq-ratchet-serialize.js +4 -4
  161. package/dist/internal/encoding/proto/pq-ratchet-serialize.js.map +1 -1
  162. package/dist/internal/encoding/proto/primitives.d.ts +261 -6
  163. package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
  164. package/dist/internal/encoding/proto/primitives.js +468 -6
  165. package/dist/internal/encoding/proto/primitives.js.map +1 -1
  166. package/dist/internal/encoding/proto/sender-key-message.d.ts +4 -3
  167. package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -1
  168. package/dist/internal/encoding/proto/sender-key-message.js +97 -76
  169. package/dist/internal/encoding/proto/sender-key-message.js.map +1 -1
  170. package/dist/internal/encoding/proto/signal-message.d.ts +39 -34
  171. package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
  172. package/dist/internal/encoding/proto/signal-message.js +236 -152
  173. package/dist/internal/encoding/proto/signal-message.js.map +1 -1
  174. package/dist/internal/groups/access-control.d.ts +170 -0
  175. package/dist/internal/groups/access-control.d.ts.map +1 -0
  176. package/dist/internal/groups/access-control.js +284 -0
  177. package/dist/internal/groups/access-control.js.map +1 -0
  178. package/dist/internal/groups/change-actions.d.ts +57 -0
  179. package/dist/internal/groups/change-actions.d.ts.map +1 -0
  180. package/dist/internal/groups/change-actions.js +827 -0
  181. package/dist/internal/groups/change-actions.js.map +1 -0
  182. package/dist/internal/groups/change-authorization.d.ts +16 -0
  183. package/dist/internal/groups/change-authorization.d.ts.map +1 -0
  184. package/dist/internal/groups/change-authorization.js +120 -0
  185. package/dist/internal/groups/change-authorization.js.map +1 -0
  186. package/dist/internal/{groups-v2 → groups}/encrypted-state.d.ts +12 -2
  187. package/dist/internal/groups/encrypted-state.d.ts.map +1 -0
  188. package/dist/internal/{groups-v2 → groups}/encrypted-state.js +122 -22
  189. package/dist/internal/groups/encrypted-state.js.map +1 -0
  190. package/dist/internal/groups/group-id.d.ts +9 -9
  191. package/dist/internal/groups/group-id.d.ts.map +1 -1
  192. package/dist/internal/groups/group-id.js +11 -12
  193. package/dist/internal/groups/group-id.js.map +1 -1
  194. package/dist/internal/groups/index.d.ts +16 -6
  195. package/dist/internal/groups/index.d.ts.map +1 -1
  196. package/dist/internal/groups/index.js +9 -1
  197. package/dist/internal/groups/index.js.map +1 -1
  198. package/dist/internal/groups/invite-link.d.ts.map +1 -0
  199. package/dist/internal/groups/invite-link.js.map +1 -0
  200. package/dist/internal/{groups-v2 → groups}/manager.d.ts +212 -43
  201. package/dist/internal/groups/manager.d.ts.map +1 -0
  202. package/dist/internal/groups/manager.js +1945 -0
  203. package/dist/internal/groups/manager.js.map +1 -0
  204. package/dist/internal/groups/sdk-store.d.ts +32 -0
  205. package/dist/internal/groups/sdk-store.d.ts.map +1 -0
  206. package/dist/internal/groups/sdk-store.js +111 -0
  207. package/dist/internal/groups/sdk-store.js.map +1 -0
  208. package/dist/internal/groups/server-engine.d.ts +98 -0
  209. package/dist/internal/groups/server-engine.d.ts.map +1 -0
  210. package/dist/internal/groups/server-engine.js +1235 -0
  211. package/dist/internal/groups/server-engine.js.map +1 -0
  212. package/dist/internal/groups/trust-root.d.ts +32 -0
  213. package/dist/internal/groups/trust-root.d.ts.map +1 -0
  214. package/dist/internal/groups/trust-root.js +91 -0
  215. package/dist/internal/groups/trust-root.js.map +1 -0
  216. package/dist/internal/{groups-v2 → groups}/types.d.ts +190 -41
  217. package/dist/internal/groups/types.d.ts.map +1 -0
  218. package/dist/internal/{groups-v2 → groups}/types.js +3 -2
  219. package/dist/internal/groups/types.js.map +1 -0
  220. package/dist/internal/groups/wire.d.ts +68 -0
  221. package/dist/internal/groups/wire.d.ts.map +1 -0
  222. package/dist/internal/groups/wire.js +708 -0
  223. package/dist/internal/groups/wire.js.map +1 -0
  224. package/dist/internal/manager/manager.d.ts +4 -4
  225. package/dist/internal/manager/manager.d.ts.map +1 -1
  226. package/dist/internal/manager/manager.js +28 -17
  227. package/dist/internal/manager/manager.js.map +1 -1
  228. package/dist/internal/protocol/double-ratchet/chains.d.ts +1 -1
  229. package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -1
  230. package/dist/internal/protocol/double-ratchet/chains.js +10 -10
  231. package/dist/internal/protocol/double-ratchet/chains.js.map +1 -1
  232. package/dist/internal/protocol/double-ratchet/ratchet.d.ts +3 -3
  233. package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
  234. package/dist/internal/protocol/double-ratchet/ratchet.js +3 -3
  235. package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
  236. package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -1
  237. package/dist/internal/protocol/pqxdh/pqxdh.js +3 -3
  238. package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -1
  239. package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts.map +1 -1
  240. package/dist/internal/protocol/sealed-sender/decryption-v2.js +32 -18
  241. package/dist/internal/protocol/sealed-sender/decryption-v2.js.map +1 -1
  242. package/dist/internal/protocol/sealed-sender/decryption.d.ts.map +1 -1
  243. package/dist/internal/protocol/sealed-sender/decryption.js +35 -21
  244. package/dist/internal/protocol/sealed-sender/decryption.js.map +1 -1
  245. package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts.map +1 -1
  246. package/dist/internal/protocol/sealed-sender/encryption-v2.js +8 -14
  247. package/dist/internal/protocol/sealed-sender/encryption-v2.js.map +1 -1
  248. package/dist/internal/protocol/sealed-sender/encryption.d.ts +9 -4
  249. package/dist/internal/protocol/sealed-sender/encryption.d.ts.map +1 -1
  250. package/dist/internal/protocol/sealed-sender/encryption.js +7 -15
  251. package/dist/internal/protocol/sealed-sender/encryption.js.map +1 -1
  252. package/dist/internal/protocol/sealed-sender/proto/index.d.ts +56 -11
  253. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  254. package/dist/internal/protocol/sealed-sender/proto/index.js +278 -158
  255. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  256. package/dist/internal/protocol/sealed-sender/trust-root.d.ts +45 -0
  257. package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +1 -0
  258. package/dist/internal/protocol/sealed-sender/trust-root.js +77 -0
  259. package/dist/internal/protocol/sealed-sender/trust-root.js.map +1 -0
  260. package/dist/internal/protocol/sealed-sender/types.d.ts +65 -10
  261. package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
  262. package/dist/internal/protocol/sealed-sender/types.js +44 -1
  263. package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
  264. package/dist/internal/protocol/sender-keys/index.d.ts +1 -1
  265. package/dist/internal/protocol/sender-keys/manager.d.ts +41 -4
  266. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  267. package/dist/internal/protocol/sender-keys/manager.js +113 -12
  268. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  269. package/dist/internal/protocol/spqr/index.d.ts +1 -1
  270. package/dist/internal/protocol/spqr/index.js +1 -1
  271. package/dist/internal/protocol/spqr/message.d.ts +1 -1
  272. package/dist/internal/protocol/spqr/message.js +1 -1
  273. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts +3 -3
  274. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts.map +1 -1
  275. package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.js +2 -2
  276. package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.js.map +1 -1
  277. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.d.ts +1 -1
  278. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.js +1 -1
  279. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.js.map +1 -1
  280. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts +8 -2
  281. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts.map +1 -1
  282. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js +335 -152
  283. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js.map +1 -1
  284. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +5 -5
  285. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -1
  286. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +1 -1
  287. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -1
  288. package/dist/internal/protocol/spqr/spqr.d.ts +10 -10
  289. package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
  290. package/dist/internal/protocol/spqr/spqr.js +14 -14
  291. package/dist/internal/protocol/spqr/spqr.js.map +1 -1
  292. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +3 -3
  293. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +1 -1
  294. package/dist/internal/protocol/triple-ratchet/ratchet.js +5 -5
  295. package/dist/internal/protocol/triple-ratchet/ratchet.js.map +1 -1
  296. package/dist/internal/protocol/username/generate.d.ts +1 -1
  297. package/dist/internal/protocol/username/generate.js +1 -1
  298. package/dist/internal/protocol/username/hash.d.ts +1 -1
  299. package/dist/internal/protocol/username/hash.js +1 -1
  300. package/dist/internal/protocol/username/link.d.ts +1 -1
  301. package/dist/internal/protocol/username/link.js +1 -1
  302. package/dist/internal/protocol/username/proof.d.ts +1 -1
  303. package/dist/internal/protocol/username/proof.js +1 -1
  304. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -1
  305. package/dist/internal/protocol/x3dh/x3dh.js +6 -6
  306. package/dist/internal/protocol/x3dh/x3dh.js.map +1 -1
  307. package/dist/internal/protocol/zk/groups/auth-credential.d.ts +14 -11
  308. package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -1
  309. package/dist/internal/protocol/zk/groups/auth-credential.js +68 -29
  310. package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -1
  311. package/dist/internal/protocol/zk/groups/client-zk-group-cipher.d.ts +2 -2
  312. package/dist/internal/protocol/zk/groups/client-zk-group-cipher.js +2 -2
  313. package/dist/internal/protocol/zk/groups/server-params.d.ts +1 -1
  314. package/dist/internal/protocol/zk/groups/server-params.d.ts.map +1 -1
  315. package/dist/internal/protocol/zk/groups/server-params.js.map +1 -1
  316. package/dist/internal/protocol/zk/groups/uid-struct.d.ts +2 -0
  317. package/dist/internal/protocol/zk/groups/uid-struct.d.ts.map +1 -1
  318. package/dist/internal/protocol/zk/groups/uid-struct.js +4 -0
  319. package/dist/internal/protocol/zk/groups/uid-struct.js.map +1 -1
  320. package/dist/internal/sesame/device-registry.d.ts +18 -13
  321. package/dist/internal/sesame/device-registry.d.ts.map +1 -1
  322. package/dist/internal/sesame/device-registry.js +13 -9
  323. package/dist/internal/sesame/device-registry.js.map +1 -1
  324. package/dist/internal/sesame/manager.d.ts +1 -1
  325. package/dist/internal/sesame/manager.d.ts.map +1 -1
  326. package/dist/internal/sesame/manager.js +66 -34
  327. package/dist/internal/sesame/manager.js.map +1 -1
  328. package/dist/internal/sesame/types.d.ts.map +1 -1
  329. package/dist/internal/sesame/types.js +7 -2
  330. package/dist/internal/sesame/types.js.map +1 -1
  331. package/dist/internal/session/builder.js +3 -3
  332. package/dist/internal/session/builder.js.map +1 -1
  333. package/dist/internal/session/cipher.d.ts +2 -2
  334. package/dist/internal/session/cipher.d.ts.map +1 -1
  335. package/dist/internal/session/cipher.js +38 -30
  336. package/dist/internal/session/cipher.js.map +1 -1
  337. package/dist/internal/session/decryption.d.ts +1 -1
  338. package/dist/internal/session/decryption.js +10 -10
  339. package/dist/internal/session/decryption.js.map +1 -1
  340. package/dist/internal/session/factory.d.ts.map +1 -1
  341. package/dist/internal/session/factory.js +3 -3
  342. package/dist/internal/session/factory.js.map +1 -1
  343. package/dist/internal/session/handshake.d.ts.map +1 -1
  344. package/dist/internal/session/handshake.js +3 -3
  345. package/dist/internal/session/handshake.js.map +1 -1
  346. package/dist/internal/session/keys.d.ts +1 -1
  347. package/dist/internal/session/ratchet.d.ts.map +1 -1
  348. package/dist/internal/session/ratchet.js +4 -4
  349. package/dist/internal/session/ratchet.js.map +1 -1
  350. package/dist/internal/session/types.d.ts +2 -2
  351. package/dist/internal/session/types.d.ts.map +1 -1
  352. package/dist/internal/session/validation.d.ts.map +1 -1
  353. package/dist/internal/session/validation.js +3 -3
  354. package/dist/internal/session/validation.js.map +1 -1
  355. package/dist/keys/generation.d.ts +4 -3
  356. package/dist/keys/generation.d.ts.map +1 -1
  357. package/dist/keys/generation.js +2 -2
  358. package/dist/keys/generation.js.map +1 -1
  359. package/dist/keys/identity.d.ts +32 -0
  360. package/dist/keys/identity.d.ts.map +1 -1
  361. package/dist/keys/identity.js +55 -0
  362. package/dist/keys/identity.js.map +1 -1
  363. package/dist/keys/index.d.ts +1 -1
  364. package/dist/keys/index.d.ts.map +1 -1
  365. package/dist/keys/index.js +1 -1
  366. package/dist/keys/index.js.map +1 -1
  367. package/dist/keys/types.d.ts +1 -1
  368. package/dist/keys/types.d.ts.map +1 -1
  369. package/dist/layers.d.ts +5 -5
  370. package/dist/layers.d.ts.map +1 -1
  371. package/dist/layers.js +9 -9
  372. package/dist/layers.js.map +1 -1
  373. package/dist/local/store/expo/adapter.d.ts +28 -25
  374. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  375. package/dist/local/store/expo/adapter.js +125 -113
  376. package/dist/local/store/expo/adapter.js.map +1 -1
  377. package/dist/local/store/expo/database-key.d.ts +2 -2
  378. package/dist/local/store/expo/database-key.d.ts.map +1 -1
  379. package/dist/local/store/expo/database-key.js +5 -5
  380. package/dist/local/store/expo/database-key.js.map +1 -1
  381. package/dist/local/store/expo/db.d.ts +13 -10
  382. package/dist/local/store/expo/db.d.ts.map +1 -1
  383. package/dist/local/store/expo/db.js +8 -3
  384. package/dist/local/store/expo/db.js.map +1 -1
  385. package/dist/local/store/expo/index.d.ts +5 -7
  386. package/dist/local/store/expo/index.d.ts.map +1 -1
  387. package/dist/local/store/expo/index.js +3 -3
  388. package/dist/local/store/expo/index.js.map +1 -1
  389. package/dist/local/store/expo/key-storage.d.ts +1 -1
  390. package/dist/local/store/expo/key-storage.d.ts.map +1 -1
  391. package/dist/local/store/expo/key-storage.js +4 -4
  392. package/dist/local/store/expo/key-storage.js.map +1 -1
  393. package/dist/local/store/expo/models/index.d.ts +1 -1
  394. package/dist/local/store/expo/models/index.d.ts.map +1 -1
  395. package/dist/local/store/expo/models/index.js +2 -2
  396. package/dist/local/store/expo/models/index.js.map +1 -1
  397. package/dist/local/store/expo/models/local-identity.d.ts +1 -1
  398. package/dist/local/store/expo/models/local-identity.js +1 -1
  399. package/dist/local/store/expo/models/sender-key.d.ts +101 -77
  400. package/dist/local/store/expo/models/sender-key.d.ts.map +1 -1
  401. package/dist/local/store/expo/models/sender-key.js +154 -124
  402. package/dist/local/store/expo/models/sender-key.js.map +1 -1
  403. package/dist/local/store/expo/schema.d.ts +135 -33
  404. package/dist/local/store/expo/schema.d.ts.map +1 -1
  405. package/dist/local/store/expo/schema.js +37 -8
  406. package/dist/local/store/expo/schema.js.map +1 -1
  407. package/dist/local/store/expo/secure-store-options.d.ts +2 -2
  408. package/dist/local/store/expo/secure-store-options.d.ts.map +1 -1
  409. package/dist/local/store/expo/secure-store-options.js +1 -1
  410. package/dist/local/store/expo/secure-store-options.js.map +1 -1
  411. package/dist/local/store/index.d.ts +9 -9
  412. package/dist/local/store/index.d.ts.map +1 -1
  413. package/dist/local/store/index.js +9 -9
  414. package/dist/local/store/index.js.map +1 -1
  415. package/dist/local/store/{mock → memory}/adapter.d.ts +14 -7
  416. package/dist/local/store/memory/adapter.d.ts.map +1 -0
  417. package/dist/local/store/{mock → memory}/adapter.js +156 -58
  418. package/dist/local/store/memory/adapter.js.map +1 -0
  419. package/dist/local/store/memory/failures.d.ts +34 -0
  420. package/dist/local/store/memory/failures.d.ts.map +1 -0
  421. package/dist/local/store/memory/failures.js +75 -0
  422. package/dist/local/store/memory/failures.js.map +1 -0
  423. package/dist/local/store/memory/index.d.ts +11 -0
  424. package/dist/local/store/memory/index.d.ts.map +1 -0
  425. package/dist/local/store/memory/index.js +7 -0
  426. package/dist/local/store/memory/index.js.map +1 -0
  427. package/dist/local/store/node/adapter.d.ts +56 -7
  428. package/dist/local/store/node/adapter.d.ts.map +1 -1
  429. package/dist/local/store/node/adapter.js +458 -11
  430. package/dist/local/store/node/adapter.js.map +1 -1
  431. package/dist/local/store/node/database-key.js +1 -1
  432. package/dist/local/store/node/database.d.ts +68 -0
  433. package/dist/local/store/node/database.d.ts.map +1 -1
  434. package/dist/local/store/node/database.js +203 -20
  435. package/dist/local/store/node/database.js.map +1 -1
  436. package/dist/local/store/node/index.d.ts +4 -4
  437. package/dist/local/store/node/index.d.ts.map +1 -1
  438. package/dist/local/store/node/index.js +3 -3
  439. package/dist/local/store/node/index.js.map +1 -1
  440. package/dist/local/store/react-native/adapter.d.ts +44 -5
  441. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  442. package/dist/local/store/react-native/adapter.js +177 -22
  443. package/dist/local/store/react-native/adapter.js.map +1 -1
  444. package/dist/local/store/react-native/index.d.ts +4 -4
  445. package/dist/local/store/react-native/index.d.ts.map +1 -1
  446. package/dist/local/store/react-native/index.js +3 -3
  447. package/dist/local/store/react-native/index.js.map +1 -1
  448. package/dist/local/store/react-native/storage.d.ts +2 -2
  449. package/dist/local/store/web/adapter.d.ts +5 -4
  450. package/dist/local/store/web/adapter.d.ts.map +1 -1
  451. package/dist/local/store/web/adapter.js +54 -10
  452. package/dist/local/store/web/adapter.js.map +1 -1
  453. package/dist/local/store/web/index.d.ts +4 -4
  454. package/dist/local/store/web/index.d.ts.map +1 -1
  455. package/dist/local/store/web/index.js +3 -3
  456. package/dist/local/store/web/index.js.map +1 -1
  457. package/dist/local/vault/expo-secure-store.d.ts +2 -2
  458. package/dist/local/vault/expo-secure-store.d.ts.map +1 -1
  459. package/dist/local/vault/expo-secure-store.js +5 -5
  460. package/dist/local/vault/expo-secure-store.js.map +1 -1
  461. package/dist/local/vault/index.d.ts +7 -3
  462. package/dist/local/vault/index.d.ts.map +1 -1
  463. package/dist/local/vault/index.js +1 -1
  464. package/dist/local/vault/index.js.map +1 -1
  465. package/dist/logger.d.ts +4 -4
  466. package/dist/logger.d.ts.map +1 -1
  467. package/dist/logger.js +5 -5
  468. package/dist/logger.js.map +1 -1
  469. package/dist/media/index.d.ts +7 -7
  470. package/dist/media/index.d.ts.map +1 -1
  471. package/dist/media/index.js +2 -2
  472. package/dist/profile/cipher.d.ts +1 -1
  473. package/dist/profile/cipher.js +1 -1
  474. package/dist/profile/contact-state.d.ts +1 -1
  475. package/dist/profile/contact-state.d.ts.map +1 -1
  476. package/dist/profile/contact-state.js +3 -3
  477. package/dist/profile/contact-state.js.map +1 -1
  478. package/dist/profile/crypto.d.ts +1 -1
  479. package/dist/profile/crypto.js +1 -1
  480. package/dist/profile/profile-key.d.ts.map +1 -1
  481. package/dist/profile/profile-key.js +3 -3
  482. package/dist/profile/profile-key.js.map +1 -1
  483. package/dist/profile/update-service.d.ts +2 -2
  484. package/dist/profile/update-service.d.ts.map +1 -1
  485. package/dist/profile/update-service.js +2 -2
  486. package/dist/profile/update-service.js.map +1 -1
  487. package/dist/remote/object-store/convex-r2/server.d.ts +1 -1
  488. package/dist/remote/object-store/convex-r2/storage.d.ts +2 -2
  489. package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -1
  490. package/dist/remote/object-store/index.d.ts +1 -1
  491. package/dist/remote/object-store/index.d.ts.map +1 -1
  492. package/dist/remote/object-store/s3/storage.d.ts +3 -3
  493. package/dist/remote/object-store/s3/storage.d.ts.map +1 -1
  494. package/dist/remote/object-store/s3/storage.js +1 -1
  495. package/dist/remote/object-store/types.d.ts +1 -1
  496. package/dist/remote/object-store/types.d.ts.map +1 -1
  497. package/dist/remote/relay/convex/backend.d.ts +405 -0
  498. package/dist/remote/relay/convex/backend.d.ts.map +1 -0
  499. package/dist/remote/relay/convex/backend.js +687 -0
  500. package/dist/remote/relay/convex/backend.js.map +1 -0
  501. package/dist/remote/relay/convex/component/_generated/api.d.ts +58 -0
  502. package/dist/remote/relay/convex/component/_generated/api.d.ts.map +1 -0
  503. package/dist/remote/relay/convex/component/_generated/api.js +31 -0
  504. package/dist/remote/relay/convex/component/_generated/api.js.map +1 -0
  505. package/dist/remote/relay/convex/component/_generated/component.d.ts +483 -0
  506. package/dist/remote/relay/convex/component/_generated/component.d.ts.map +1 -0
  507. package/dist/remote/relay/convex/component/_generated/component.js +11 -0
  508. package/dist/remote/relay/convex/component/_generated/component.js.map +1 -0
  509. package/dist/remote/relay/convex/component/_generated/dataModel.d.ts +46 -0
  510. package/dist/remote/relay/convex/component/_generated/dataModel.d.ts.map +1 -0
  511. package/dist/remote/relay/convex/component/_generated/dataModel.js +11 -0
  512. package/dist/remote/relay/convex/component/_generated/dataModel.js.map +1 -0
  513. package/dist/remote/relay/convex/component/_generated/server.d.ts +129 -0
  514. package/dist/remote/relay/convex/component/_generated/server.d.ts.map +1 -0
  515. package/dist/remote/relay/convex/component/_generated/server.js +79 -0
  516. package/dist/remote/relay/convex/component/_generated/server.js.map +1 -0
  517. package/dist/remote/relay/convex/component/accounts.d.ts +43 -0
  518. package/dist/remote/relay/convex/component/accounts.d.ts.map +1 -0
  519. package/dist/remote/relay/convex/component/accounts.js +181 -0
  520. package/dist/remote/relay/convex/component/accounts.js.map +1 -0
  521. package/dist/remote/relay/convex/component/certificates.d.ts +10 -0
  522. package/dist/remote/relay/convex/component/certificates.d.ts.map +1 -0
  523. package/dist/remote/relay/convex/component/certificates.js +117 -0
  524. package/dist/remote/relay/convex/component/certificates.js.map +1 -0
  525. package/dist/remote/relay/convex/component/cleanup.d.ts +32 -0
  526. package/dist/remote/relay/convex/component/cleanup.d.ts.map +1 -0
  527. package/dist/remote/relay/convex/component/cleanup.js +146 -0
  528. package/dist/remote/relay/convex/component/cleanup.js.map +1 -0
  529. package/dist/remote/relay/convex/component/convex.config.d.ts +5 -0
  530. package/dist/remote/relay/convex/component/convex.config.d.ts.map +1 -0
  531. package/dist/remote/relay/convex/component/convex.config.js +33 -0
  532. package/dist/remote/relay/convex/component/convex.config.js.map +1 -0
  533. package/dist/remote/relay/convex/component/crons.d.ts +3 -0
  534. package/dist/remote/relay/convex/component/crons.d.ts.map +1 -0
  535. package/dist/remote/relay/convex/component/crons.js +10 -0
  536. package/dist/remote/relay/convex/component/crons.js.map +1 -0
  537. package/dist/remote/relay/convex/component/devices.d.ts +101 -0
  538. package/dist/remote/relay/convex/component/devices.d.ts.map +1 -0
  539. package/dist/remote/relay/convex/component/devices.js +299 -0
  540. package/dist/remote/relay/convex/component/devices.js.map +1 -0
  541. package/dist/remote/relay/convex/component/errors.d.ts +22 -0
  542. package/dist/remote/relay/convex/component/errors.d.ts.map +1 -0
  543. package/dist/remote/relay/convex/component/errors.js +17 -0
  544. package/dist/remote/relay/convex/component/errors.js.map +1 -0
  545. package/dist/remote/relay/convex/component/groups.d.ts +63 -0
  546. package/dist/remote/relay/convex/component/groups.d.ts.map +1 -0
  547. package/dist/remote/relay/convex/component/groups.js +341 -0
  548. package/dist/remote/relay/convex/component/groups.js.map +1 -0
  549. package/dist/remote/relay/convex/component/keys.d.ts +130 -0
  550. package/dist/remote/relay/convex/component/keys.d.ts.map +1 -0
  551. package/dist/remote/relay/convex/component/keys.js +578 -0
  552. package/dist/remote/relay/convex/component/keys.js.map +1 -0
  553. package/dist/remote/relay/convex/component/messages.d.ts +119 -0
  554. package/dist/remote/relay/convex/component/messages.d.ts.map +1 -0
  555. package/dist/remote/relay/convex/component/messages.js +723 -0
  556. package/dist/remote/relay/convex/component/messages.js.map +1 -0
  557. package/dist/remote/relay/convex/component/provisioning.d.ts +92 -0
  558. package/dist/remote/relay/convex/component/provisioning.d.ts.map +1 -0
  559. package/dist/remote/relay/convex/component/provisioning.js +359 -0
  560. package/dist/remote/relay/convex/component/provisioning.js.map +1 -0
  561. package/dist/remote/relay/convex/component/runtime.d.ts +18 -0
  562. package/dist/remote/relay/convex/component/runtime.d.ts.map +1 -0
  563. package/dist/remote/relay/convex/component/runtime.js +142 -0
  564. package/dist/remote/relay/convex/component/runtime.js.map +1 -0
  565. package/dist/remote/relay/convex/component/schema.d.ts +358 -0
  566. package/dist/remote/relay/convex/component/schema.d.ts.map +1 -0
  567. package/dist/remote/relay/convex/component/schema.js +287 -0
  568. package/dist/remote/relay/convex/component/schema.js.map +1 -0
  569. package/dist/remote/relay/convex/component/zkAuth.d.ts +12 -0
  570. package/dist/remote/relay/convex/component/zkAuth.d.ts.map +1 -0
  571. package/dist/remote/relay/convex/component/zkAuth.js +71 -0
  572. package/dist/remote/relay/convex/component/zkAuth.js.map +1 -0
  573. package/dist/remote/relay/convex/constants.d.ts +3 -0
  574. package/dist/remote/relay/convex/constants.d.ts.map +1 -0
  575. package/dist/remote/relay/convex/constants.js +3 -0
  576. package/dist/remote/relay/convex/constants.js.map +1 -0
  577. package/dist/remote/relay/convex/group-server.d.ts +29 -24
  578. package/dist/remote/relay/convex/group-server.d.ts.map +1 -1
  579. package/dist/remote/relay/convex/group-server.js +62 -28
  580. package/dist/remote/relay/convex/group-server.js.map +1 -1
  581. package/dist/remote/relay/convex/index.d.ts +14 -11
  582. package/dist/remote/relay/convex/index.d.ts.map +1 -1
  583. package/dist/remote/relay/convex/index.js +9 -7
  584. package/dist/remote/relay/convex/index.js.map +1 -1
  585. package/dist/remote/relay/convex/relay.d.ts +67 -80
  586. package/dist/remote/relay/convex/relay.d.ts.map +1 -1
  587. package/dist/remote/relay/convex/relay.js +143 -59
  588. package/dist/remote/relay/convex/relay.js.map +1 -1
  589. package/dist/remote/relay/convex/types.d.ts +16 -103
  590. package/dist/remote/relay/convex/types.d.ts.map +1 -1
  591. package/dist/remote/relay/convex/types.js +8 -13
  592. package/dist/remote/relay/convex/types.js.map +1 -1
  593. package/dist/remote/relay/index.d.ts +7 -7
  594. package/dist/remote/relay/index.d.ts.map +1 -1
  595. package/dist/remote/relay/index.js +7 -7
  596. package/dist/remote/relay/index.js.map +1 -1
  597. package/dist/remote/relay/{mock → memory}/adapter.d.ts +55 -31
  598. package/dist/remote/relay/memory/adapter.d.ts.map +1 -0
  599. package/dist/remote/relay/{mock → memory}/adapter.js +276 -135
  600. package/dist/remote/relay/memory/adapter.js.map +1 -0
  601. package/dist/remote/relay/memory/failures.d.ts +58 -0
  602. package/dist/remote/relay/memory/failures.d.ts.map +1 -0
  603. package/dist/remote/relay/memory/failures.js +123 -0
  604. package/dist/remote/relay/memory/failures.js.map +1 -0
  605. package/dist/remote/relay/memory/group-server.d.ts +9 -0
  606. package/dist/remote/relay/memory/group-server.d.ts.map +1 -0
  607. package/dist/remote/relay/memory/group-server.js +9 -0
  608. package/dist/remote/relay/memory/group-server.js.map +1 -0
  609. package/dist/remote/relay/memory/index.d.ts +11 -0
  610. package/dist/remote/relay/memory/index.d.ts.map +1 -0
  611. package/dist/remote/relay/memory/index.js +7 -0
  612. package/dist/remote/relay/memory/index.js.map +1 -0
  613. package/dist/remote/relay/types.d.ts +99 -86
  614. package/dist/remote/relay/types.d.ts.map +1 -1
  615. package/dist/remote/relay/types.js +2 -3
  616. package/dist/remote/relay/types.js.map +1 -1
  617. package/dist/safety/protobuf.d.ts +1 -1
  618. package/dist/safety/protobuf.d.ts.map +1 -1
  619. package/dist/types/api.d.ts +42 -17
  620. package/dist/types/api.d.ts.map +1 -1
  621. package/dist/types/errors.d.ts +2 -2
  622. package/dist/types/errors.d.ts.map +1 -1
  623. package/dist/types/errors.js +2 -2
  624. package/dist/types/errors.js.map +1 -1
  625. package/dist/types/messages.d.ts +1 -1
  626. package/dist/types/protocol-config.d.ts +71 -4
  627. package/dist/types/protocol-config.d.ts.map +1 -1
  628. package/dist/types/protocol-config.js +63 -2
  629. package/dist/types/protocol-config.js.map +1 -1
  630. package/dist/types/protocol-constants.d.ts +1 -1
  631. package/dist/types/protocol-constants.js +1 -1
  632. package/dist/utils/binary-transfer.d.ts +1 -1
  633. package/dist/utils/errors.d.ts +2 -2
  634. package/dist/utils/errors.js +2 -2
  635. package/dist/utils/retry.d.ts +4 -3
  636. package/dist/utils/retry.d.ts.map +1 -1
  637. package/dist/utils/retry.js +20 -1
  638. package/dist/utils/retry.js.map +1 -1
  639. package/dist/zk/groups.d.ts +1 -1
  640. package/dist/zk/groups.js +1 -1
  641. package/docs/ASSURANCE.md +28 -11
  642. package/docs/CLIENT_COMPOSITION.md +32 -76
  643. package/docs/DEVIATIONS.md +944 -0
  644. package/docs/E2EE.md +71 -6
  645. package/docs/ERROR_HANDLING.md +8 -1
  646. package/docs/GETTING_STARTED.md +22 -18
  647. package/docs/INTERFACES.md +22 -22
  648. package/docs/PACKAGE_SURFACE.md +23 -16
  649. package/docs/PROTOCOL_POLICY.md +11 -2
  650. package/docs/RECIPES.md +17 -13
  651. package/docs/SECURITY.md +8 -0
  652. package/files/README.md +1 -1
  653. package/groups/README.md +16 -5
  654. package/local/store/README.md +14 -12
  655. package/local/store/expo/README.md +15 -6
  656. package/local/store/memory/README.md +58 -0
  657. package/local/store/node/README.md +8 -1
  658. package/local/store/react-native/README.md +1 -1
  659. package/local/store/web/README.md +1 -1
  660. package/local/vault/README.md +3 -3
  661. package/package.json +33 -13
  662. package/remote/README.md +19 -19
  663. package/remote/object-store/README.md +3 -3
  664. package/remote/object-store/convex-r2/README.md +1 -1
  665. package/remote/object-store/s3/README.md +1 -1
  666. package/remote/relay/README.md +7 -7
  667. package/remote/relay/convex/README.md +10 -4
  668. package/remote/relay/convex/component/README.md +428 -0
  669. package/remote/relay/memory/README.md +69 -0
  670. package/scripts/oe-groups.mjs +162 -0
  671. package/types/README.md +1 -1
  672. package/dist/internal/groups-v2/access-control.d.ts +0 -101
  673. package/dist/internal/groups-v2/access-control.d.ts.map +0 -1
  674. package/dist/internal/groups-v2/access-control.js +0 -184
  675. package/dist/internal/groups-v2/access-control.js.map +0 -1
  676. package/dist/internal/groups-v2/change-actions.d.ts +0 -35
  677. package/dist/internal/groups-v2/change-actions.d.ts.map +0 -1
  678. package/dist/internal/groups-v2/change-actions.js +0 -358
  679. package/dist/internal/groups-v2/change-actions.js.map +0 -1
  680. package/dist/internal/groups-v2/encrypted-state.d.ts.map +0 -1
  681. package/dist/internal/groups-v2/encrypted-state.js.map +0 -1
  682. package/dist/internal/groups-v2/index.d.ts +0 -14
  683. package/dist/internal/groups-v2/index.d.ts.map +0 -1
  684. package/dist/internal/groups-v2/index.js +0 -11
  685. package/dist/internal/groups-v2/index.js.map +0 -1
  686. package/dist/internal/groups-v2/invite-link.d.ts.map +0 -1
  687. package/dist/internal/groups-v2/invite-link.js.map +0 -1
  688. package/dist/internal/groups-v2/manager.d.ts.map +0 -1
  689. package/dist/internal/groups-v2/manager.js +0 -1093
  690. package/dist/internal/groups-v2/manager.js.map +0 -1
  691. package/dist/internal/groups-v2/types.d.ts.map +0 -1
  692. package/dist/internal/groups-v2/types.js.map +0 -1
  693. package/dist/local/store/mock/adapter.d.ts.map +0 -1
  694. package/dist/local/store/mock/adapter.js.map +0 -1
  695. package/dist/local/store/mock/index.d.ts +0 -10
  696. package/dist/local/store/mock/index.d.ts.map +0 -1
  697. package/dist/local/store/mock/index.js +0 -6
  698. package/dist/local/store/mock/index.js.map +0 -1
  699. package/dist/remote/relay/mock/adapter.d.ts.map +0 -1
  700. package/dist/remote/relay/mock/adapter.js.map +0 -1
  701. package/dist/remote/relay/mock/index.d.ts +0 -10
  702. package/dist/remote/relay/mock/index.d.ts.map +0 -1
  703. package/dist/remote/relay/mock/index.js +0 -6
  704. package/dist/remote/relay/mock/index.js.map +0 -1
  705. package/docs/api/README.md +0 -471
  706. package/docs/api/classes/EncryptionError.md +0 -112
  707. package/docs/api/classes/EndorsementManager.md +0 -307
  708. package/docs/api/classes/SealedSenderAuthError.md +0 -127
  709. package/docs/api/classes/ServerDerivedKeyPair.md +0 -68
  710. package/docs/api/classes/ServerDerivedPublicKey.md +0 -33
  711. package/docs/api/classes/ServerRootKeyPair.md +0 -94
  712. package/docs/api/classes/ServerRootPublicKey.md +0 -72
  713. package/docs/api/classes/SignalBlockingManager.md +0 -106
  714. package/docs/api/classes/SignalProtocolClient.md +0 -2651
  715. package/docs/api/classes/VerificationFailure.md +0 -25
  716. package/docs/api/enumerations/ContentHint.md +0 -63
  717. package/docs/api/enumerations/EncryptionErrorCode.md +0 -488
  718. package/docs/api/enumerations/IdentityKeyChange.md +0 -65
  719. package/docs/api/enumerations/MessageType.md +0 -29
  720. package/docs/api/enumerations/TrustDirection.md +0 -33
  721. package/docs/api/enumerations/TypingAction.md +0 -31
  722. package/docs/api/functions/createDefaultSignalContentAdapter.md +0 -13
  723. package/docs/api/functions/createDefaultSignalLogger.md +0 -36
  724. package/docs/api/functions/createGroupId.md +0 -32
  725. package/docs/api/functions/createSignalProtocolClient.md +0 -36
  726. package/docs/api/functions/createSignalProtocolClientConfig.md +0 -24
  727. package/docs/api/functions/extractGroupId.md +0 -32
  728. package/docs/api/functions/formatVersion.md +0 -25
  729. package/docs/api/functions/isCompatible.md +0 -31
  730. package/docs/api/functions/isGroupId.md +0 -37
  731. package/docs/api/functions/isSealedSenderAuthError.md +0 -25
  732. package/docs/api/functions/parseVersion.md +0 -29
  733. package/docs/api/functions/resolveSPQRLimits.md +0 -21
  734. package/docs/api/functions/resolveSignalLogger.md +0 -42
  735. package/docs/api/interfaces/AccountIdentityProvisioning.md +0 -43
  736. package/docs/api/interfaces/AccountIdentityRotation.md +0 -69
  737. package/docs/api/interfaces/AttachmentTransferOptions.md +0 -49
  738. package/docs/api/interfaces/BlockedRecipientEntry.md +0 -25
  739. package/docs/api/interfaces/BlockedRecipientsSyncInput.md +0 -27
  740. package/docs/api/interfaces/ConfigurationSyncInput.md +0 -19
  741. package/docs/api/interfaces/CredentialPublicKey.md +0 -25
  742. package/docs/api/interfaces/DataMessageInput.md +0 -21
  743. package/docs/api/interfaces/DecryptedEnvelope.md +0 -95
  744. package/docs/api/interfaces/DecryptedGroup.md +0 -86
  745. package/docs/api/interfaces/DeviceInfo.md +0 -79
  746. package/docs/api/interfaces/DeviceRecord.md +0 -87
  747. package/docs/api/interfaces/DeviceRegistration.md +0 -27
  748. package/docs/api/interfaces/DoubleRatchetConfig.md +0 -36
  749. package/docs/api/interfaces/EcOneTimePreKey.md +0 -27
  750. package/docs/api/interfaces/EcSignedPreKey.md +0 -39
  751. package/docs/api/interfaces/EcSignedPreKeyUpload.md +0 -50
  752. package/docs/api/interfaces/EncryptionErrorContext.md +0 -51
  753. package/docs/api/interfaces/Envelope.md +0 -154
  754. package/docs/api/interfaces/ForceKeyResetResult.md +0 -37
  755. package/docs/api/interfaces/GroupAuthorization.md +0 -23
  756. package/docs/api/interfaces/GroupChangeEntry.md +0 -42
  757. package/docs/api/interfaces/GroupMemberDevice.md +0 -26
  758. package/docs/api/interfaces/IEcOneTimePreKeyStore.md +0 -86
  759. package/docs/api/interfaces/IEcSignedPreKeyStore.md +0 -132
  760. package/docs/api/interfaces/IGroupServer.md +0 -120
  761. package/docs/api/interfaces/IGroupStateStore.md +0 -128
  762. package/docs/api/interfaces/IIdentityKeyStore.md +0 -312
  763. package/docs/api/interfaces/IKemPreKeyStore.md +0 -144
  764. package/docs/api/interfaces/IKyberLastResortPreKeyStore.md +0 -111
  765. package/docs/api/interfaces/ILogger.md +0 -117
  766. package/docs/api/interfaces/IProtocolStore.md +0 -1033
  767. package/docs/api/interfaces/ISenderKeyStore.md +0 -417
  768. package/docs/api/interfaces/ISesameStore.md +0 -249
  769. package/docs/api/interfaces/ISessionStore.md +0 -178
  770. package/docs/api/interfaces/ISignalLocalSecretVault.md +0 -71
  771. package/docs/api/interfaces/ISignalLocalStore.md +0 -2053
  772. package/docs/api/interfaces/ISignalProtocolClient.md +0 -1183
  773. package/docs/api/interfaces/ISignalProtocolManager.md +0 -272
  774. package/docs/api/interfaces/ISignalRelayServer.md +0 -1329
  775. package/docs/api/interfaces/IdentityKeyPair.md +0 -49
  776. package/docs/api/interfaces/IncomingEnvelope.md +0 -91
  777. package/docs/api/interfaces/InspectedSignalContent.md +0 -43
  778. package/docs/api/interfaces/KDFChain.md +0 -31
  779. package/docs/api/interfaces/KemLastResortPreKeyUpload.md +0 -50
  780. package/docs/api/interfaces/KeyPair.md +0 -23
  781. package/docs/api/interfaces/KyberPreKey.md +0 -42
  782. package/docs/api/interfaces/MLKEMBraidAgentState.md +0 -191
  783. package/docs/api/interfaces/MLKEMBraidMessage.md +0 -49
  784. package/docs/api/interfaces/MediaAttachmentDeleteSyncInput.md +0 -31
  785. package/docs/api/interfaces/MessageHeader.md +0 -49
  786. package/docs/api/interfaces/MessageRecord.md +0 -86
  787. package/docs/api/interfaces/ParsedReceiptContent.md +0 -19
  788. package/docs/api/interfaces/ParsedTypingContent.md +0 -19
  789. package/docs/api/interfaces/PreKeyMaintenanceStore.md +0 -87
  790. package/docs/api/interfaces/PreKeyMessage.md +0 -159
  791. package/docs/api/interfaces/PreKeyStatusResult.md +0 -21
  792. package/docs/api/interfaces/PreKeyUpload.md +0 -42
  793. package/docs/api/interfaces/ProcessEnvelopeOptions.md +0 -72
  794. package/docs/api/interfaces/ProtocolAddress.md +0 -38
  795. package/docs/api/interfaces/ProtocolStrategyConfig.md +0 -91
  796. package/docs/api/interfaces/RatchetMessage.md +0 -96
  797. package/docs/api/interfaces/ReadSyncEntryInput.md +0 -19
  798. package/docs/api/interfaces/ReceiverChain.md +0 -43
  799. package/docs/api/interfaces/RecipientUsernameSyncInput.md +0 -31
  800. package/docs/api/interfaces/RelayPreKeyBundle.md +0 -254
  801. package/docs/api/interfaces/RemoteObjectDownload.md +0 -33
  802. package/docs/api/interfaces/RemoteObjectUpload.md +0 -49
  803. package/docs/api/interfaces/ResolvedSPQRInfoStrings.md +0 -27
  804. package/docs/api/interfaces/ResolvedSPQRLimits.md +0 -37
  805. package/docs/api/interfaces/RetryRequest.md +0 -80
  806. package/docs/api/interfaces/SCKAState.md +0 -65
  807. package/docs/api/interfaces/SPQRLimits.md +0 -40
  808. package/docs/api/interfaces/SPQRState.md +0 -191
  809. package/docs/api/interfaces/SafetyNumber.md +0 -60
  810. package/docs/api/interfaces/SafetyNumberConfirmation.md +0 -46
  811. package/docs/api/interfaces/SealedSenderConfig.md +0 -70
  812. package/docs/api/interfaces/SendOptions.md +0 -191
  813. package/docs/api/interfaces/SendResult.md +0 -93
  814. package/docs/api/interfaces/SenderKeyDistributionMessage.md +0 -43
  815. package/docs/api/interfaces/SenderKeyState.md +0 -76
  816. package/docs/api/interfaces/SenderKeysConfig.md +0 -65
  817. package/docs/api/interfaces/SentSyncTranscriptInput.md +0 -31
  818. package/docs/api/interfaces/ServiceId.md +0 -19
  819. package/docs/api/interfaces/SesameMessage.md +0 -84
  820. package/docs/api/interfaces/SesameStats.md +0 -57
  821. package/docs/api/interfaces/SessionHealthResult.md +0 -120
  822. package/docs/api/interfaces/SessionRecord.md +0 -80
  823. package/docs/api/interfaces/SessionRecordMetadata.md +0 -109
  824. package/docs/api/interfaces/SessionState.md +0 -368
  825. package/docs/api/interfaces/SessionTrustCommit.md +0 -58
  826. package/docs/api/interfaces/SignalBlockingHooks.md +0 -44
  827. package/docs/api/interfaces/SignalBlockingManagerOptions.md +0 -31
  828. package/docs/api/interfaces/SignalBlockingMirror.md +0 -30
  829. package/docs/api/interfaces/SignalBlockingStore.md +0 -83
  830. package/docs/api/interfaces/SignalContentAdapter.md +0 -325
  831. package/docs/api/interfaces/SignalProtocolClientAdapterConfig.md +0 -44
  832. package/docs/api/interfaces/SignalProtocolClientCompositionOptions.md +0 -693
  833. package/docs/api/interfaces/SignalProtocolClientConfig.md +0 -839
  834. package/docs/api/interfaces/SignalProtocolClientDeleteLocalAttachmentInput.md +0 -25
  835. package/docs/api/interfaces/SignalProtocolClientHooks.md +0 -506
  836. package/docs/api/interfaces/SignalProtocolClientIdentityConfig.md +0 -35
  837. package/docs/api/interfaces/SignalProtocolClientLoadLocalAttachmentInput.md +0 -187
  838. package/docs/api/interfaces/SignalProtocolClientLoadedLocalAttachment.md +0 -19
  839. package/docs/api/interfaces/SignalProtocolClientMedia.md +0 -83
  840. package/docs/api/interfaces/SignalProtocolClientMediaCompletedResult.md +0 -25
  841. package/docs/api/interfaces/SignalProtocolClientMediaConfig.md +0 -157
  842. package/docs/api/interfaces/SignalProtocolClientMediaDownloadCompletedResult.md +0 -37
  843. package/docs/api/interfaces/SignalProtocolClientMediaDownloadNotNeededResult.md +0 -25
  844. package/docs/api/interfaces/SignalProtocolClientMediaFailedResult.md +0 -19
  845. package/docs/api/interfaces/SignalProtocolClientMediaOperationOptions.md +0 -53
  846. package/docs/api/interfaces/SignalProtocolClientMediaPendingResult.md +0 -19
  847. package/docs/api/interfaces/SignalProtocolClientMediaProcessResult.md +0 -43
  848. package/docs/api/interfaces/SignalProtocolClientMediaSkippedResult.md +0 -25
  849. package/docs/api/interfaces/SignalProtocolClientMediaUploadCompletedResult.md +0 -31
  850. package/docs/api/interfaces/SignalProtocolClientProcessPendingMediaOptions.md +0 -87
  851. package/docs/api/interfaces/SignalProtocolClientSaveDownloadedAttachmentInput.md +0 -25
  852. package/docs/api/interfaces/SignalProtocolClientSaveUploadedAttachmentInput.md +0 -25
  853. package/docs/api/interfaces/SignalProtocolClientSyncDeleteInput.md +0 -19
  854. package/docs/api/interfaces/SignalProtocolConfig.md +0 -50
  855. package/docs/api/interfaces/SignalRemoteObjectStore.md +0 -88
  856. package/docs/api/interfaces/SkippedSenderMessageKey.md +0 -26
  857. package/docs/api/interfaces/TaskNotificationAckSyncInput.md +0 -31
  858. package/docs/api/interfaces/TripleRatchetState.md +0 -64
  859. package/docs/api/interfaces/UserRecord.md +0 -71
  860. package/docs/api/interfaces/UsernameStateSyncInput.md +0 -19
  861. package/docs/api/interfaces/VerificationStateSyncInput.md +0 -31
  862. package/docs/api/interfaces/VersionNegotiationState.md +0 -84
  863. package/docs/api/interfaces/ViewOnceOpenSyncInput.md +0 -19
  864. package/docs/api/namespaces/ProtocolAddress/README.md +0 -33
  865. package/docs/api/namespaces/ProtocolAddress/functions/create.md +0 -41
  866. package/docs/api/namespaces/ProtocolAddress/functions/equals.md +0 -39
  867. package/docs/api/namespaces/ProtocolAddress/functions/fromStorageKey.md +0 -36
  868. package/docs/api/namespaces/ProtocolAddress/functions/isUser.md +0 -39
  869. package/docs/api/namespaces/ProtocolAddress/functions/isValid.md +0 -34
  870. package/docs/api/namespaces/ProtocolAddress/functions/parse.md +0 -41
  871. package/docs/api/namespaces/ProtocolAddress/functions/toStorageKey.md +0 -38
  872. package/docs/api/namespaces/ProtocolAddress/functions/toString.md +0 -34
  873. package/docs/api/namespaces/SessionRecord/README.md +0 -30
  874. package/docs/api/namespaces/SessionRecord/functions/archiveCurrent.md +0 -40
  875. package/docs/api/namespaces/SessionRecord/functions/archiveCurrentState.md +0 -34
  876. package/docs/api/namespaces/SessionRecord/functions/create.md +0 -25
  877. package/docs/api/namespaces/SessionRecord/functions/deserialize.md +0 -29
  878. package/docs/api/namespaces/SessionRecord/functions/findSession.md +0 -34
  879. package/docs/api/namespaces/SessionRecord/functions/getAllSessions.md +0 -25
  880. package/docs/api/namespaces/SessionRecord/functions/getArchivedCount.md +0 -25
  881. package/docs/api/namespaces/SessionRecord/functions/hasCurrentSession.md +0 -25
  882. package/docs/api/namespaces/SessionRecord/functions/hasUsableSenderChain.md +0 -36
  883. package/docs/api/namespaces/SessionRecord/functions/promoteSession.md +0 -34
  884. package/docs/api/namespaces/SessionRecord/functions/serialize.md +0 -28
  885. package/docs/api/namespaces/SessionRecord/variables/MAX_ARCHIVED_SESSIONS.md +0 -14
  886. package/docs/api/namespaces/SessionState/README.md +0 -15
  887. package/docs/api/namespaces/SessionState/functions/getSessionId.md +0 -32
  888. package/docs/api/namespaces/blocking/README.md +0 -43
  889. package/docs/api/namespaces/encoding/README.md +0 -33
  890. package/docs/api/namespaces/encoding/functions/base64ToUrlSafe.md +0 -28
  891. package/docs/api/namespaces/encoding/functions/bytesToBase64.md +0 -21
  892. package/docs/api/namespaces/encoding/functions/bytesToString.md +0 -21
  893. package/docs/api/namespaces/encoding/functions/bytesToUrlSafeBase64.md +0 -33
  894. package/docs/api/namespaces/encoding/functions/concatBytes.md +0 -21
  895. package/docs/api/namespaces/encoding/functions/stringToBytes.md +0 -21
  896. package/docs/api/namespaces/encoding/functions/urlSafeToBase64.md +0 -27
  897. package/docs/api/namespaces/keys/README.md +0 -126
  898. package/docs/api/namespaces/keys/functions/acceptContactIdentityRotation.md +0 -33
  899. package/docs/api/namespaces/keys/functions/assertIdentityCommitment.md +0 -25
  900. package/docs/api/namespaces/keys/functions/compositeIdentitiesEqual.md +0 -23
  901. package/docs/api/namespaces/keys/functions/createCompositeIdentityV1.md +0 -19
  902. package/docs/api/namespaces/keys/functions/createPreKeySignatureContext.md +0 -31
  903. package/docs/api/namespaces/keys/functions/createUnverifiedContactIdentityRecord.md +0 -23
  904. package/docs/api/namespaces/keys/functions/decodeCompositeIdentityV1.md +0 -19
  905. package/docs/api/namespaces/keys/functions/deriveIdentityCommitment.md +0 -19
  906. package/docs/api/namespaces/keys/functions/encodeCompositeIdentityV1.md +0 -19
  907. package/docs/api/namespaces/keys/functions/evaluateContactIdentityCandidate.md +0 -27
  908. package/docs/api/namespaces/keys/functions/generateEcOneTimePreKeys.md +0 -37
  909. package/docs/api/namespaces/keys/functions/generateEcSignedPreKey.md +0 -39
  910. package/docs/api/namespaces/keys/functions/generateEcSignedPreKeyId.md +0 -21
  911. package/docs/api/namespaces/keys/functions/generateIdentityKeyPair.md +0 -24
  912. package/docs/api/namespaces/keys/functions/generateKemOneTimePreKeys.md +0 -47
  913. package/docs/api/namespaces/keys/functions/generateKyberLastResortPreKey.md +0 -37
  914. package/docs/api/namespaces/keys/functions/generateRegistrationId.md +0 -13
  915. package/docs/api/namespaces/keys/functions/signMlKem1024PreKey.md +0 -29
  916. package/docs/api/namespaces/keys/functions/signPreKey.md +0 -31
  917. package/docs/api/namespaces/keys/functions/validateContactIdentityRecord.md +0 -19
  918. package/docs/api/namespaces/keys/functions/verifyContactIdentityRecord.md +0 -31
  919. package/docs/api/namespaces/keys/functions/verifyMlKem1024PreKey.md +0 -33
  920. package/docs/api/namespaces/keys/functions/verifyPreKeySignature.md +0 -35
  921. package/docs/api/namespaces/keys/interfaces/CompositeIdentityV1.md +0 -33
  922. package/docs/api/namespaces/keys/interfaces/ContactIdentityRecord.md +0 -53
  923. package/docs/api/namespaces/keys/interfaces/KemOneTimePreKey.md +0 -43
  924. package/docs/api/namespaces/keys/type-aliases/IdentityCandidateStatus.md +0 -9
  925. package/docs/api/namespaces/keys/type-aliases/IdentityTrustState.md +0 -9
  926. package/docs/api/namespaces/keys/type-aliases/IdentityType.md +0 -9
  927. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_ED25519_TAG.md +0 -9
  928. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_LENGTH.md +0 -9
  929. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_VERSION.md +0 -9
  930. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_X25519_TAG.md +0 -9
  931. package/docs/api/namespaces/keys/variables/IDENTITY_COMMITMENT_V1_DOMAIN.md +0 -9
  932. package/docs/api/namespaces/keys/variables/PREKEY_ALGORITHM_ML_KEM_1024.md +0 -9
  933. package/docs/api/namespaces/keys/variables/PREKEY_ALGORITHM_X25519.md +0 -9
  934. package/docs/api/namespaces/keys/variables/PREKEY_SIGNATURE_V1_DOMAIN.md +0 -9
  935. package/docs/api/namespaces/media/README.md +0 -105
  936. package/docs/api/namespaces/media/classes/MediaAttachmentError.md +0 -57
  937. package/docs/api/namespaces/media/functions/createByteRangeMediaAttachmentTransfer.md +0 -19
  938. package/docs/api/namespaces/media/functions/createMediaAttachmentDeliveryId.md +0 -29
  939. package/docs/api/namespaces/media/functions/createMediaAttachmentId.md +0 -19
  940. package/docs/api/namespaces/media/functions/createMediaAttachmentMessage.md +0 -25
  941. package/docs/api/namespaces/media/functions/createMediaAttachmentPointer.md +0 -19
  942. package/docs/api/namespaces/media/functions/createTusMediaAttachmentTransfer.md +0 -19
  943. package/docs/api/namespaces/media/functions/deleteMediaAttachment.md +0 -23
  944. package/docs/api/namespaces/media/functions/executeMediaAttachmentJob.md +0 -23
  945. package/docs/api/namespaces/media/functions/isMediaAttachmentFlagSet.md +0 -19
  946. package/docs/api/namespaces/media/functions/parseMediaAttachmentMessage.md +0 -19
  947. package/docs/api/namespaces/media/functions/planMediaAttachmentCleanup.md +0 -23
  948. package/docs/api/namespaces/media/functions/planMediaAttachmentCleanupJobs.md +0 -19
  949. package/docs/api/namespaces/media/functions/planMediaAttachmentDeleteSync.md +0 -19
  950. package/docs/api/namespaces/media/functions/planMediaAttachmentDownloadJob.md +0 -19
  951. package/docs/api/namespaces/media/functions/planMediaAttachmentOpen.md +0 -19
  952. package/docs/api/namespaces/media/functions/planMediaAttachmentProcessing.md +0 -19
  953. package/docs/api/namespaces/media/functions/planMediaAttachmentUploadJob.md +0 -19
  954. package/docs/api/namespaces/media/functions/prepareMediaAttachmentUpload.md +0 -30
  955. package/docs/api/namespaces/media/functions/resolveMediaAttachment.md +0 -30
  956. package/docs/api/namespaces/media/functions/serializeMediaAttachmentMessage.md +0 -25
  957. package/docs/api/namespaces/media/functions/validateMediaAttachmentPolicy.md +0 -23
  958. package/docs/api/namespaces/media/interfaces/ByteRangeMediaAttachmentPartialStore.md +0 -68
  959. package/docs/api/namespaces/media/interfaces/ByteRangeMediaAttachmentTransferOptions.md +0 -91
  960. package/docs/api/namespaces/media/interfaces/DeleteMediaAttachmentOptions.md +0 -25
  961. package/docs/api/namespaces/media/interfaces/DeleteMediaAttachmentResult.md +0 -19
  962. package/docs/api/namespaces/media/interfaces/ExecuteMediaAttachmentJobOptions.md +0 -157
  963. package/docs/api/namespaces/media/interfaces/MediaAttachmentBackgroundJob.md +0 -85
  964. package/docs/api/namespaces/media/interfaces/MediaAttachmentCleanupPlan.md +0 -37
  965. package/docs/api/namespaces/media/interfaces/MediaAttachmentJobExecutionResult.md +0 -55
  966. package/docs/api/namespaces/media/interfaces/MediaAttachmentMessage.md +0 -31
  967. package/docs/api/namespaces/media/interfaces/MediaAttachmentOpenDecision.md +0 -31
  968. package/docs/api/namespaces/media/interfaces/MediaAttachmentPointer.md +0 -133
  969. package/docs/api/namespaces/media/interfaces/MediaAttachmentPolicy.md +0 -67
  970. package/docs/api/namespaces/media/interfaces/MediaAttachmentProcessingPlan.md +0 -73
  971. package/docs/api/namespaces/media/interfaces/MediaAttachmentProgress.md +0 -69
  972. package/docs/api/namespaces/media/interfaces/MediaAttachmentResumeState.md +0 -37
  973. package/docs/api/namespaces/media/interfaces/MediaAttachmentRetryOptions.md +0 -31
  974. package/docs/api/namespaces/media/interfaces/MediaAttachmentTransfer.md +0 -51
  975. package/docs/api/namespaces/media/interfaces/MediaAttachmentTransferCheckpoint.md +0 -69
  976. package/docs/api/namespaces/media/interfaces/MediaAttachmentTransferOptions.md +0 -67
  977. package/docs/api/namespaces/media/interfaces/MediaAttachmentUploadJobData.md +0 -19
  978. package/docs/api/namespaces/media/interfaces/MediaAttachmentUploadResponse.md +0 -25
  979. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentCleanupJobsInput.md +0 -61
  980. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentDeleteSyncInput.md +0 -25
  981. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentDownloadJobInput.md +0 -161
  982. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentOpenInput.md +0 -25
  983. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentProcessingInput.md +0 -83
  984. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentUploadJobInput.md +0 -147
  985. package/docs/api/namespaces/media/interfaces/PrepareMediaAttachmentUploadOptions.md +0 -144
  986. package/docs/api/namespaces/media/interfaces/ResolveMediaAttachmentOptions.md +0 -55
  987. package/docs/api/namespaces/media/interfaces/ResolvedMediaAttachment.md +0 -109
  988. package/docs/api/namespaces/media/interfaces/TusMediaAttachmentTransferOptions.md +0 -85
  989. package/docs/api/namespaces/media/type-aliases/CreateMediaAttachmentPointerInput.md +0 -15
  990. package/docs/api/namespaces/media/type-aliases/MediaAttachmentCheckpointCallback.md +0 -19
  991. package/docs/api/namespaces/media/type-aliases/MediaAttachmentCleanupReason.md +0 -9
  992. package/docs/api/namespaces/media/type-aliases/MediaAttachmentErrorCode.md +0 -9
  993. package/docs/api/namespaces/media/type-aliases/MediaAttachmentFlag.md +0 -9
  994. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobExecutionStatus.md +0 -9
  995. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobOperation.md +0 -9
  996. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobPriority.md +0 -9
  997. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobSkipReason.md +0 -9
  998. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobSource.md +0 -9
  999. package/docs/api/namespaces/media/type-aliases/MediaAttachmentKnownIds.md +0 -9
  1000. package/docs/api/namespaces/media/type-aliases/MediaAttachmentMessageType.md +0 -9
  1001. package/docs/api/namespaces/media/type-aliases/MediaAttachmentProgressCallback.md +0 -19
  1002. package/docs/api/namespaces/media/variables/MEDIA_ATTACHMENT_POLICY_DEFAULTS.md +0 -47
  1003. package/docs/api/namespaces/media/variables/MEDIA_ATTACHMENT_POLICY_PRESETS.md +0 -95
  1004. package/docs/api/namespaces/media/variables/MediaAttachmentCleanupReason.md +0 -27
  1005. package/docs/api/namespaces/media/variables/MediaAttachmentErrorCode.md +0 -75
  1006. package/docs/api/namespaces/media/variables/MediaAttachmentFlag.md +0 -23
  1007. package/docs/api/namespaces/media/variables/MediaAttachmentJobExecutionStatus.md +0 -19
  1008. package/docs/api/namespaces/media/variables/MediaAttachmentJobOperation.md +0 -31
  1009. package/docs/api/namespaces/media/variables/MediaAttachmentJobPriority.md +0 -23
  1010. package/docs/api/namespaces/media/variables/MediaAttachmentJobSource.md +0 -51
  1011. package/docs/api/namespaces/media/variables/MediaAttachmentMessageType.md +0 -15
  1012. package/docs/api/namespaces/media/variables/downloadMediaAttachment.md +0 -30
  1013. package/docs/api/namespaces/safety/README.md +0 -61
  1014. package/docs/api/namespaces/safety/classes/DisplayableFingerprint.md +0 -108
  1015. package/docs/api/namespaces/safety/classes/Fingerprint.md +0 -104
  1016. package/docs/api/namespaces/safety/classes/ScannableFingerprint.md +0 -209
  1017. package/docs/api/namespaces/safety/functions/base64ToBytes.md +0 -21
  1018. package/docs/api/namespaces/safety/functions/clearFingerprintCache.md +0 -15
  1019. package/docs/api/namespaces/safety/functions/compareSafetyNumbers.md +0 -25
  1020. package/docs/api/namespaces/safety/functions/createFingerprintData.md +0 -60
  1021. package/docs/api/namespaces/safety/functions/extractQrData.md +0 -34
  1022. package/docs/api/namespaces/safety/functions/generateCompositeSafetyNumber.md +0 -39
  1023. package/docs/api/namespaces/safety/functions/generateEmojiFingerprint.md +0 -24
  1024. package/docs/api/namespaces/safety/functions/generateSingleKeyReferenceSafetyNumber.md +0 -51
  1025. package/docs/api/namespaces/safety/functions/generateVerifySchemeUrl.md +0 -32
  1026. package/docs/api/namespaces/safety/functions/generateVerifyUrl.md +0 -49
  1027. package/docs/api/namespaces/safety/functions/isValidSafetyNumber.md +0 -21
  1028. package/docs/api/namespaces/safety/functions/isVerifyUrl.md +0 -45
  1029. package/docs/api/namespaces/safety/functions/parseVerifyUrl.md +0 -31
  1030. package/docs/api/namespaces/safety/interfaces/FingerprintData.md +0 -52
  1031. package/docs/api/namespaces/safety/interfaces/SafetyNumber.md +0 -49
  1032. package/docs/api/namespaces/safety/interfaces/VerifyLinkConfig.md +0 -28
  1033. package/docs/api/namespaces/safety/interfaces/VerifyUrlParams.md +0 -49
  1034. package/docs/api/namespaces/safety/type-aliases/CompareResult.md +0 -21
  1035. package/docs/api/namespaces/safety/variables/DEFAULT_VERIFY_LINK_CONFIG.md +0 -12
  1036. package/docs/api/namespaces/safety/variables/FINGERPRINT_ITERATIONS.md +0 -12
  1037. package/docs/api/namespaces/safety/variables/FINGERPRINT_VERSION.md +0 -12
  1038. package/docs/api/namespaces/safety/variables/VERIFY_BASE_URL.md +0 -11
  1039. package/docs/api/namespaces/safety/variables/VERIFY_SCHEME_URL.md +0 -11
  1040. package/docs/api/type-aliases/Base64.md +0 -20
  1041. package/docs/api/type-aliases/BraidPolicy.md +0 -11
  1042. package/docs/api/type-aliases/Bytes.md +0 -20
  1043. package/docs/api/type-aliases/Ciphertext.md +0 -21
  1044. package/docs/api/type-aliases/DeviceType.md +0 -11
  1045. package/docs/api/type-aliases/DownloadedAttachment.md +0 -11
  1046. package/docs/api/type-aliases/GroupId.md +0 -27
  1047. package/docs/api/type-aliases/Hex.md +0 -20
  1048. package/docs/api/type-aliases/HookName.md +0 -11
  1049. package/docs/api/type-aliases/PostQuantumPolicy.md +0 -11
  1050. package/docs/api/type-aliases/PreparedAttachmentUpload.md +0 -14
  1051. package/docs/api/type-aliases/PrivateKey.md +0 -22
  1052. package/docs/api/type-aliases/ProgressCallback.md +0 -45
  1053. package/docs/api/type-aliases/PublicKey.md +0 -22
  1054. package/docs/api/type-aliases/RemoteObjectCompleteUploadRequest.md +0 -19
  1055. package/docs/api/type-aliases/RemoteObjectDeleteRequest.md +0 -19
  1056. package/docs/api/type-aliases/RemoteObjectDownloadRequest.md +0 -19
  1057. package/docs/api/type-aliases/RemoteObjectUploadRequest.md +0 -42
  1058. package/docs/api/type-aliases/SCKAMode.md +0 -11
  1059. package/docs/api/type-aliases/SealedSenderAuth.md +0 -15
  1060. package/docs/api/type-aliases/SignalProtocolClientMediaCleanupInput.md +0 -9
  1061. package/docs/api/type-aliases/SignalProtocolClientMediaCleanupResult.md +0 -9
  1062. package/docs/api/type-aliases/SignalProtocolClientMediaDownloadInput.md +0 -9
  1063. package/docs/api/type-aliases/SignalProtocolClientMediaDownloadResult.md +0 -9
  1064. package/docs/api/type-aliases/SignalProtocolClientMediaOperationResult.md +0 -9
  1065. package/docs/api/type-aliases/SignalProtocolClientMediaUploadInput.md +0 -9
  1066. package/docs/api/type-aliases/SignalProtocolClientMediaUploadResult.md +0 -9
  1067. package/docs/api/type-aliases/Signature.md +0 -21
  1068. package/docs/api/type-aliases/Unsubscribe.md +0 -15
  1069. package/docs/api/variables/BraidPolicy.md +0 -21
  1070. package/docs/api/variables/DEFAULT_DEVICE_ID.md +0 -12
  1071. package/docs/api/variables/DOUBLE_RATCHET_SPEC.md +0 -11
  1072. package/docs/api/variables/GROUP_V2_PREFIX.md +0 -11
  1073. package/docs/api/variables/KEY_REFRESH_INTERVAL_MS_DEFAULT.md +0 -11
  1074. package/docs/api/variables/MAX_MESSAGE_KEYS.md +0 -14
  1075. package/docs/api/variables/MAX_PREKEY_AGE_MS_DEFAULT.md +0 -11
  1076. package/docs/api/variables/MAX_RECEIVER_CHAINS.md +0 -14
  1077. package/docs/api/variables/MAX_REGISTRATION_ID.md +0 -16
  1078. package/docs/api/variables/MAX_SKIP.md +0 -11
  1079. package/docs/api/variables/MESSAGE_FORMAT.md +0 -11
  1080. package/docs/api/variables/MIN_REGISTRATION_ID.md +0 -16
  1081. package/docs/api/variables/ML_KEM_BRAID_SPEC.md +0 -11
  1082. package/docs/api/variables/ONE_TIME_PREKEY_BATCH_SIZE.md +0 -21
  1083. package/docs/api/variables/PQXDH_SPEC.md +0 -11
  1084. package/docs/api/variables/PostQuantumPolicy.md +0 -21
  1085. package/docs/api/variables/SENDER_KEY_FORMAT.md +0 -11
  1086. package/docs/api/variables/SENDER_KEY_SPEC.md +0 -11
  1087. package/docs/api/variables/SESAME_SPEC.md +0 -11
  1088. package/docs/api/variables/SESSION_FORMAT.md +0 -11
  1089. package/docs/api/variables/SPQR_LIMITS_DEFAULTS.md +0 -11
  1090. package/docs/api/variables/X3DH_SPEC.md +0 -9
  1091. package/docs/api/variables/defaultSignalLogger.md +0 -32
  1092. package/local/store/mock/README.md +0 -27
  1093. package/remote/relay/mock/README.md +0 -32
  1094. /package/dist/internal/{groups-v2 → groups}/invite-link.d.ts +0 -0
  1095. /package/dist/internal/{groups-v2 → groups}/invite-link.js +0 -0
@@ -0,0 +1,723 @@
1
+ import { MINUTE, RateLimiter, isRateLimitError, } from '@convex-dev/rate-limiter';
2
+ import { ConvexError, v } from 'convex/values';
3
+ import { base64ToBytes, bytesToBase64, } from '../../../../internal/crypto/utils.js';
4
+ import { MAX_DEVICES } from '../../../../device/constants.js';
5
+ import { serializeReceivedMessage } from '../../../../internal/protocol/sealed-sender/v2-binary.js';
6
+ import { asBase64 } from '../../../../types/utils.js';
7
+ import { components } from './_generated/api.js';
8
+ import { mutation, query } from './_generated/server.js';
9
+ import { authorizeAccessKey, authorizeGroupSendToken, callerIdentityArgs, rememberAccount, } from './accounts.js';
10
+ import { relayError, unauthorized } from './errors.js';
11
+ const MESSAGE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
12
+ const MAX_PENDING_MESSAGES = 1000;
13
+ const MAX_PENDING_RETRY_REQUESTS = 1000;
14
+ const MAX_MULTI_RECIPIENT_DEVICES = 1000;
15
+ /**
16
+ * Ceiling on a single message's content, before base64 framing.
17
+ *
18
+ * 96 KiB, and the same 96 KiB for the shared multi-recipient ciphertext.
19
+ * The reference validates what each recipient will *receive* — the
20
+ * one-byte version, that recipient's key material, and the shared data —
21
+ * against a single 96 KiB message-size constant, on the individual and
22
+ * multi-recipient paths alike; its separate 256 KiB constant is an HTTP
23
+ * entity-read cap on the whole request (shared payload plus every
24
+ * recipient block), not a content ceiling, and an earlier version of this
25
+ * file mistook it for one. The shared ciphertext is the dominant term of
26
+ * the per-recipient view, so it is what the ceiling binds here.
27
+ *
28
+ * The columns are base64 strings, so the byte ceilings are enforced as
29
+ * string-length ceilings: base64 emits 4 characters per started group of 3
30
+ * bytes, which is 4 * ceil(n / 3) — the ceiling belongs inside the division,
31
+ * or a payload whose size is not a multiple of 3 encodes 2 characters past
32
+ * the advertised limit and full-size messages are refused.
33
+ */
34
+ const base64LengthOf = (byteLength) => 4 * Math.ceil(byteLength / 3);
35
+ const MAX_MESSAGE_BYTES = 96 * 1024;
36
+ const MAX_MULTI_RECIPIENT_MESSAGE_BYTES = 96 * 1024;
37
+ const MAX_CIPHERTEXT_LENGTH = base64LengthOf(MAX_MESSAGE_BYTES);
38
+ const MAX_MULTI_RECIPIENT_CIPHERTEXT_LENGTH = base64LengthOf(MAX_MULTI_RECIPIENT_MESSAGE_BYTES);
39
+ /**
40
+ * Inbound budget per recipient, spent in ciphertext bytes.
41
+ *
42
+ * Keyed by the *target*, because that is the only stable identity on these
43
+ * paths: a sealed sender is anonymous by design, so any per-sender limit is
44
+ * either meaningless or a hole. The reference implementation bounds inbound
45
+ * message bytes per destination the same way, on its identified and sealed
46
+ * single-recipient paths alike.
47
+ *
48
+ * What this closes is unbounded queue flooding: without it, one anonymous
49
+ * caller holding a valid access key — or any account-authenticated caller on
50
+ * the identified path — can grow a victim's `messages` table without limit
51
+ * for the whole retention window. The budget is generous for real traffic
52
+ * (sealed envelopes run 1-2 KiB, so the sustained rate is hundreds of
53
+ * messages a minute per recipient) and fatal for floods.
54
+ *
55
+ * The multi-recipient path is deliberately not metered, matching the
56
+ * reference: a group-send token already prices that path, and a per-recipient
57
+ * budget there would let one noisy group partially starve delivery to its
58
+ * quietest member. Verified against the reference's MessageController: its
59
+ * inbound-bytes limiter is validated only in `sendIndividualMessage`, never
60
+ * on the multi-recipient route. Metering here would also have to fail the
61
+ * whole fan-out rather than one recipient, since the charge and the inserts
62
+ * share a transaction — so a single recipient at their ceiling would block
63
+ * delivery to everyone else in the call.
64
+ *
65
+ * What the exemption assumes is that one call fans out to distinct devices.
66
+ * The reference gets that from its wire format, which parses recipients into
67
+ * a map keyed by service ID; the flat array here does not, so the handler
68
+ * rejects a repeated device explicitly.
69
+ */
70
+ const rateLimiter = new RateLimiter(components.rateLimiter, {
71
+ inboundMessageBytes: {
72
+ kind: 'token bucket',
73
+ rate: 1024 * 1024,
74
+ period: MINUTE,
75
+ capacity: 4 * 1024 * 1024,
76
+ },
77
+ // Sub-limit for the identified path, keyed by (sender, target). The
78
+ // shared per-target bucket is forced on the sealed path — there is no
79
+ // sender identity to key on — but on the identified path there is one,
80
+ // and without this a single authenticated account could drain a victim's
81
+ // whole shared budget and 429 every other sender indefinitely. A quarter
82
+ // of the shared bucket keeps one sender from monopolizing it while
83
+ // leaving any real conversation far below the ceiling.
84
+ inboundMessageBytesPerSender: {
85
+ kind: 'token bucket',
86
+ rate: 256 * 1024,
87
+ period: MINUTE,
88
+ capacity: 1024 * 1024,
89
+ },
90
+ // Counted, not metered by size: a retry request is a fixed-shape row. A
91
+ // client coming back from a broken session legitimately asks for one per
92
+ // message it could not decrypt, so the burst allowance is generous. What
93
+ // this bounds is the *rate*, not the total: a refilling bucket never
94
+ // refuses a patient caller, so a hostile account can still accrete rows
95
+ // against a target at the refill rate for as long as it cares to, up to
96
+ // whatever the seven-day TTL retains. That is a storage-and-noise cost,
97
+ // not a denial — the target reads the oldest page first and can drain —
98
+ // and the row TTL, not this bucket, is what ultimately bounds it.
99
+ retryRequests: {
100
+ kind: 'token bucket',
101
+ rate: 120,
102
+ period: MINUTE,
103
+ capacity: 240,
104
+ },
105
+ });
106
+ /** Approximate decoded size of a base64 column, for budget accounting. */
107
+ function ciphertextBytes(encoded) {
108
+ return Math.floor((encoded.length * 3) / 4);
109
+ }
110
+ function requireCiphertextWithin(encoded, maxLength) {
111
+ if (encoded.length > maxLength) {
112
+ throw relayError('INVALID_REQUEST', 413, 'Message content exceeds the maximum size');
113
+ }
114
+ }
115
+ /**
116
+ * Re-throw a limiter rejection as a 429, or pass anything else through.
117
+ *
118
+ * The component's limiter writes inside the caller's transaction, so this
119
+ * only ever shapes the error — the charges themselves are undone by the
120
+ * throw, whichever limit produced it.
121
+ */
122
+ function rethrowRateLimited(error, message) {
123
+ if (isRateLimitError(error)) {
124
+ throw relayError('RATE_LIMITED', 429, message, {
125
+ retryAfter: error.data.retryAfter,
126
+ });
127
+ }
128
+ if (error instanceof ConvexError) {
129
+ const data = error.data;
130
+ if (data.kind === 'RateLimited') {
131
+ throw relayError('RATE_LIMITED', 429, message, {
132
+ retryAfter: typeof data.retryAfter === 'number' ? data.retryAfter : undefined,
133
+ });
134
+ }
135
+ }
136
+ throw error;
137
+ }
138
+ async function chargeInboundBudget(ctx, targetUserId, bytes, senderUserId) {
139
+ try {
140
+ // Order between the two buckets carries no meaning: both charges are
141
+ // written in this mutation's transaction, so whichever limit throws
142
+ // discards the other's spend along with everything else. The sub-limit
143
+ // runs first only because it is the more specific diagnosis of the two.
144
+ if (senderUserId !== undefined) {
145
+ await rateLimiter.limit(ctx, 'inboundMessageBytesPerSender', {
146
+ key: JSON.stringify([senderUserId, targetUserId]),
147
+ count: bytes,
148
+ throws: true,
149
+ });
150
+ }
151
+ await rateLimiter.limit(ctx, 'inboundMessageBytes', {
152
+ key: targetUserId,
153
+ count: bytes,
154
+ throws: true,
155
+ });
156
+ }
157
+ catch (error) {
158
+ rethrowRateLimited(error, 'Inbound message rate limit exceeded for this recipient');
159
+ }
160
+ }
161
+ /**
162
+ * Bound how fast one account can create retry-request rows.
163
+ *
164
+ * These rows carry no caller-supplied content, so there is nothing to bound
165
+ * by size — the cost is the row itself, held for the full retention window.
166
+ * Nothing else on this path constrains them: the request names an original
167
+ * sender it never has to have talked to, so there is no relationship to
168
+ * check either.
169
+ */
170
+ async function chargeRetryRequest(ctx, requesterUserId) {
171
+ try {
172
+ await rateLimiter.limit(ctx, 'retryRequests', {
173
+ key: requesterUserId,
174
+ throws: true,
175
+ });
176
+ }
177
+ catch (error) {
178
+ rethrowRateLimited(error, 'Retry-request rate limit exceeded');
179
+ }
180
+ }
181
+ /**
182
+ * Reject a sealed single-recipient send whose target device does not exist.
183
+ *
184
+ * The multi-recipient path already reports unknown devices through
185
+ * `uuids404`, and the reference implementation refuses sealed sends to
186
+ * unknown destinations outright. Without this check the path is a write
187
+ * primitive for rows nothing will ever read: an anonymous caller can address
188
+ * arbitrary device IDs and every insert sits in the table for the full
189
+ * retention window.
190
+ */
191
+ async function requireActiveDevice(ctx, userId, deviceId) {
192
+ const device = await ctx.db
193
+ .query('devices')
194
+ .withIndex('by_user_id_and_device_id', (q) => q.eq('userId', userId).eq('deviceId', deviceId))
195
+ .unique();
196
+ if (!device?.registered || !device.enabled) {
197
+ throw relayError('NOT_FOUND', 404, 'Unknown destination device');
198
+ }
199
+ }
200
+ const messageTypeValidator = v.union(v.literal('ciphertext'), v.literal('prekey_bundle'), v.literal('sender_key'), v.literal('server_delivery_receipt'), v.literal('unidentified_sender'));
201
+ const receiptValidator = v.object({
202
+ messageId: v.string(),
203
+ serverTimestamp: v.number(),
204
+ });
205
+ const pendingMessageValidator = v.object({
206
+ id: v.string(),
207
+ targetUserId: v.string(),
208
+ targetDeviceId: v.number(),
209
+ senderUserId: v.string(),
210
+ senderDeviceId: v.number(),
211
+ ciphertext: v.string(),
212
+ messageType: messageTypeValidator,
213
+ urgent: v.optional(v.boolean()),
214
+ ephemeral: v.optional(v.boolean()),
215
+ timestamp: v.number(),
216
+ serverTimestamp: v.number(),
217
+ clientMessageId: v.optional(v.string()),
218
+ expiresAt: v.number(),
219
+ });
220
+ const retryReasonValidator = v.union(v.literal('NO_SESSION'), v.literal('DECRYPTION_FAILED'), v.literal('SESSION_EXPIRED'), v.literal('INVALID_MESSAGE'), v.literal('STALE_DEVICE_LIST'), v.literal('IDENTITY_KEY_MISMATCH'));
221
+ async function insertMessage(ctx, input) {
222
+ if (input.clientMessageId !== undefined) {
223
+ const existing = await ctx.db
224
+ .query('messages')
225
+ .withIndex('by_target_and_client_message_id', (q) => q
226
+ .eq('targetUserId', input.targetUserId)
227
+ .eq('targetDeviceId', input.targetDeviceId)
228
+ .eq('senderUserId', input.senderUserId)
229
+ .eq('clientMessageId', input.clientMessageId))
230
+ .unique();
231
+ if (existing) {
232
+ return {
233
+ messageId: existing.messageId,
234
+ serverTimestamp: existing.serverTimestamp,
235
+ };
236
+ }
237
+ }
238
+ const serverTimestamp = Date.now();
239
+ const messageId = crypto.randomUUID();
240
+ await ctx.db.insert('messages', {
241
+ ...input,
242
+ messageId,
243
+ serverTimestamp,
244
+ expiresAt: serverTimestamp + MESSAGE_TTL_MS,
245
+ });
246
+ return { messageId, serverTimestamp };
247
+ }
248
+ export const send = mutation({
249
+ args: {
250
+ ...callerIdentityArgs,
251
+ targetUserId: v.string(),
252
+ targetDeviceId: v.number(),
253
+ senderDeviceId: v.number(),
254
+ ciphertext: v.string(),
255
+ messageType: messageTypeValidator,
256
+ urgent: v.optional(v.boolean()),
257
+ ephemeral: v.optional(v.boolean()),
258
+ timestamp: v.number(),
259
+ clientMessageId: v.optional(v.string()),
260
+ recipientRegistrationId: v.optional(v.number()),
261
+ },
262
+ returns: receiptValidator,
263
+ handler: async (ctx, input) => {
264
+ await rememberAccount(ctx, input);
265
+ requireCiphertextWithin(input.ciphertext, MAX_CIPHERTEXT_LENGTH);
266
+ if (input.recipientRegistrationId !== undefined) {
267
+ const registration = await ctx.db
268
+ .query('identityRegistrations')
269
+ .withIndex('by_user_id_and_device_id_and_identity_type', (q) => q
270
+ .eq('userId', input.targetUserId)
271
+ .eq('deviceId', input.targetDeviceId)
272
+ .eq('identityType', 'aci'))
273
+ .unique();
274
+ if (registration &&
275
+ registration.registrationId !== input.recipientRegistrationId) {
276
+ // Names only the stale device, matching the reference's 410 body.
277
+ // The current registration ID stays out: the sender re-fetches the
278
+ // prekey bundle to recover, and that path is rate limited, whereas
279
+ // this one would otherwise hand any account-authenticated caller a
280
+ // free oracle for registration-ID changes on arbitrary devices.
281
+ throw relayError('STALE_DEVICE', 410, 'Recipient device registration changed', {
282
+ staleDevices: [input.targetDeviceId],
283
+ reason: 'device_reinstalled',
284
+ });
285
+ }
286
+ }
287
+ // Placed after the registration check for readability, not for safety: a
288
+ // send that 410s could charge first and still cost nothing, because the
289
+ // throw rolls the charge back with the rest of the mutation. Nothing on
290
+ // this path depends on the order.
291
+ await chargeInboundBudget(ctx, input.targetUserId, ciphertextBytes(input.ciphertext), input.callerUserId);
292
+ return await insertMessage(ctx, {
293
+ targetUserId: input.targetUserId,
294
+ targetDeviceId: input.targetDeviceId,
295
+ senderUserId: input.callerUserId,
296
+ senderDeviceId: input.senderDeviceId,
297
+ ciphertext: input.ciphertext,
298
+ messageType: input.messageType,
299
+ urgent: input.urgent,
300
+ ephemeral: input.ephemeral,
301
+ timestamp: input.timestamp,
302
+ clientMessageId: input.clientMessageId,
303
+ });
304
+ },
305
+ });
306
+ export const getPendingMessages = query({
307
+ args: {
308
+ ...callerIdentityArgs,
309
+ deviceId: v.number(),
310
+ },
311
+ returns: v.array(pendingMessageValidator),
312
+ handler: async (ctx, input) => {
313
+ // Read-time expiry filter: the hourly cron eventually deletes expired
314
+ // rows, but until it runs they must neither be delivered nor consume
315
+ // the pending-message budget.
316
+ //
317
+ // Date.now() is fixed per transaction and cached with the query result,
318
+ // so a subscribed client does not see a row drop out the instant it
319
+ // expires — only when a write to this index range invalidates the
320
+ // subscription, which any new message for this device or the cron's
321
+ // delete does. Staleness is therefore bounded by the cron interval, and
322
+ // the effect is a message delivered late rather than one delivered
323
+ // wrongly: expiresAt is a retention bound, not an authorization gate.
324
+ const now = Date.now();
325
+ const rows = (await ctx.db
326
+ .query('messages')
327
+ .withIndex('by_target_user_id_and_target_device_id', (q) => q
328
+ .eq('targetUserId', input.callerUserId)
329
+ .eq('targetDeviceId', input.deviceId))
330
+ .take(MAX_PENDING_MESSAGES)).filter((row) => row.expiresAt > now);
331
+ // Multi-recipient rows store only their per-recipient prefix; the wire
332
+ // form is reassembled here from the once-stored shared payload. The
333
+ // payload shares the row's exact expiresAt, and the filter above has
334
+ // already dropped expired rows, so a missing payload is not a benign
335
+ // expiry race — it is an integrity fault, and it is served as one.
336
+ const sharedByPayloadId = new Map();
337
+ const wireCiphertext = async (row) => {
338
+ if (row.sharedPayloadId === undefined)
339
+ return row.ciphertext;
340
+ let shared = sharedByPayloadId.get(row.sharedPayloadId);
341
+ if (!shared) {
342
+ const payloadId = row.sharedPayloadId;
343
+ const payload = await ctx.db
344
+ .query('multiRecipientPayloads')
345
+ .withIndex('by_payload_id', (q) => q.eq('payloadId', payloadId))
346
+ .unique();
347
+ if (!payload) {
348
+ // ConvexError so the structured {code, status} survives
349
+ // serialization, matching the groups module's integrity-fault
350
+ // rejections. Not a RelayErrorCode: those name request faults,
351
+ // and this one is the server's.
352
+ throw new ConvexError({
353
+ code: 'INTERNAL_ERROR',
354
+ status: 500,
355
+ message: 'Shared multi-recipient payload is missing for a live message',
356
+ });
357
+ }
358
+ shared = base64ToBytes(asBase64(payload.sharedBase64));
359
+ sharedByPayloadId.set(row.sharedPayloadId, shared);
360
+ }
361
+ const prefix = base64ToBytes(asBase64(row.ciphertext));
362
+ const wire = new Uint8Array(prefix.length + shared.length);
363
+ wire.set(prefix, 0);
364
+ wire.set(shared, prefix.length);
365
+ return bytesToBase64(wire);
366
+ };
367
+ return Promise.all(rows.map(async ({ messageId, targetUserId, targetDeviceId, senderUserId, senderDeviceId, messageType, urgent, ephemeral, timestamp, serverTimestamp, clientMessageId, expiresAt, ...row }) => ({
368
+ id: messageId,
369
+ targetUserId,
370
+ targetDeviceId,
371
+ senderUserId,
372
+ senderDeviceId,
373
+ ciphertext: await wireCiphertext(row),
374
+ messageType,
375
+ urgent,
376
+ ephemeral,
377
+ timestamp,
378
+ serverTimestamp,
379
+ clientMessageId,
380
+ expiresAt,
381
+ })));
382
+ },
383
+ });
384
+ export const markDelivered = mutation({
385
+ args: {
386
+ ...callerIdentityArgs,
387
+ messageId: v.string(),
388
+ },
389
+ returns: v.null(),
390
+ handler: async (ctx, input) => {
391
+ await rememberAccount(ctx, input);
392
+ const message = await ctx.db
393
+ .query('messages')
394
+ .withIndex('by_message_id', (q) => q.eq('messageId', input.messageId))
395
+ .unique();
396
+ if (!message)
397
+ return null;
398
+ if (message.targetUserId !== input.callerUserId) {
399
+ throw unauthorized('only the target account can mark a message delivered');
400
+ }
401
+ await ctx.db.delete(message._id);
402
+ return null;
403
+ },
404
+ });
405
+ // There is deliberately no `getGroupMembers` endpoint, and the component
406
+ // derives no membership map from group state: group authorization is proved
407
+ // entirely by zero-knowledge presentations, so `groups` rows never name an
408
+ // account. Membership is local-first — senders resolve fan-out recipients
409
+ // from their own decrypted group state and supply them to the send path.
410
+ //
411
+ // Nothing a `messages` row stores *names* a group either. The row carries a
412
+ // `sender_key` message type, which says the payload is group traffic without
413
+ // saying which group, and the distribution identifier inside the frame is
414
+ // opaque.
415
+ //
416
+ // That closes the group's name, not the group partition, and the difference is
417
+ // easy to overstate. The distribution identifier is unencrypted, sits inside
418
+ // the `ciphertext` column, and is stable for the life of a sender key — keys
419
+ // rotate on membership change, never on a timer — so grouping rows by it
420
+ // recovers a sender's group traffic. One send also produces byte-identical
421
+ // ciphertext on every recipient row, and the multi-recipient sealed path is
422
+ // handed the roster outright. An operator therefore sees who talked to whom
423
+ // and can partition those pairs into unlabeled groups; what it cannot do is
424
+ // put a meaningful, cross-send label on one. See the group metadata privacy
425
+ // note in README.md, which states the remaining channels in full.
426
+ export const getActiveDevices = query({
427
+ args: {
428
+ ...callerIdentityArgs,
429
+ userId: v.string(),
430
+ },
431
+ returns: v.array(v.object({
432
+ userId: v.string(),
433
+ deviceId: v.number(),
434
+ })),
435
+ handler: async (ctx, input) => {
436
+ const rows = await ctx.db
437
+ .query('devices')
438
+ .withIndex('by_user_id', (q) => q.eq('userId', input.userId))
439
+ .take(MAX_DEVICES);
440
+ return rows
441
+ .filter((row) => row.registered && row.enabled)
442
+ .map((row) => ({
443
+ userId: input.userId,
444
+ deviceId: row.deviceId,
445
+ }));
446
+ },
447
+ });
448
+ async function authorizeUnidentified(ctx, recipients, auth) {
449
+ const hasAccessKey = auth.unidentifiedAccessKey !== undefined;
450
+ const hasGroupToken = auth.groupSendToken !== undefined;
451
+ if (hasAccessKey === hasGroupToken) {
452
+ throw unauthorized('exactly one sealed-sender authorization is required');
453
+ }
454
+ if (auth.groupSendToken !== undefined) {
455
+ // The caller names the ACI it claims for each recipient so the token —
456
+ // which endorses ACIs, not user IDs — can be verified before any account
457
+ // is read. See authorizeGroupSendToken for why that ordering matters.
458
+ const named = [];
459
+ for (const recipient of recipients) {
460
+ if (recipient.aciBytes === undefined) {
461
+ throw unauthorized('a group-send token requires an ACI for every recipient');
462
+ }
463
+ named.push({ userId: recipient.userId, aciBytes: recipient.aciBytes });
464
+ }
465
+ await authorizeGroupSendToken(ctx, named, auth.groupSendToken);
466
+ return;
467
+ }
468
+ const distinctRecipients = [
469
+ ...new Set(recipients.map((recipient) => recipient.userId)),
470
+ ];
471
+ for (const userId of distinctRecipients) {
472
+ await authorizeAccessKey(ctx, userId, auth.unidentifiedAccessKey);
473
+ }
474
+ }
475
+ export const sendUnidentified = mutation({
476
+ args: {
477
+ targetUserId: v.string(),
478
+ targetDeviceId: v.number(),
479
+ /** The recipient ACI the caller claims; required with a group-send
480
+ * token, which endorses ACIs rather than user IDs. */
481
+ targetAciBytes: v.optional(v.bytes()),
482
+ ciphertext: v.string(),
483
+ timestamp: v.number(),
484
+ clientMessageId: v.optional(v.string()),
485
+ unidentifiedAccessKey: v.optional(v.string()),
486
+ groupSendToken: v.optional(v.bytes()),
487
+ },
488
+ returns: receiptValidator,
489
+ handler: async (ctx, input) => {
490
+ requireCiphertextWithin(input.ciphertext, MAX_CIPHERTEXT_LENGTH);
491
+ await authorizeUnidentified(ctx, [{ userId: input.targetUserId, aciBytes: input.targetAciBytes }], input);
492
+ await requireActiveDevice(ctx, input.targetUserId, input.targetDeviceId);
493
+ await chargeInboundBudget(ctx, input.targetUserId, ciphertextBytes(input.ciphertext));
494
+ return await insertMessage(ctx, {
495
+ targetUserId: input.targetUserId,
496
+ targetDeviceId: input.targetDeviceId,
497
+ senderUserId: '',
498
+ senderDeviceId: 0,
499
+ ciphertext: input.ciphertext,
500
+ messageType: 'unidentified_sender',
501
+ timestamp: input.timestamp,
502
+ clientMessageId: input.clientMessageId,
503
+ });
504
+ },
505
+ });
506
+ const multiRecipientValidator = v.object({
507
+ userId: v.string(),
508
+ deviceId: v.number(),
509
+ registrationId: v.number(),
510
+ /** The recipient ACI the caller claims; required with a group-send token,
511
+ * which endorses ACIs rather than user IDs. */
512
+ aciBytes: v.optional(v.bytes()),
513
+ encryptedMessageKeyBase64: v.string(),
514
+ authenticationTagBase64: v.string(),
515
+ });
516
+ export const sendMultiRecipientUnidentified = mutation({
517
+ args: {
518
+ recipients: v.array(multiRecipientValidator),
519
+ ephemeralPublicBase64: v.string(),
520
+ messageCiphertextBase64: v.string(),
521
+ timestamp: v.number(),
522
+ clientMessageId: v.optional(v.string()),
523
+ unidentifiedAccessKey: v.optional(v.string()),
524
+ groupSendToken: v.optional(v.bytes()),
525
+ },
526
+ returns: v.object({
527
+ messageId: v.string(),
528
+ serverTimestamp: v.number(),
529
+ uuids404: v.array(v.string()),
530
+ }),
531
+ handler: async (ctx, input) => {
532
+ if (input.recipients.length > MAX_MULTI_RECIPIENT_DEVICES) {
533
+ throw relayError('INVALID_REQUEST', 400, `Multi-recipient delivery supports at most ${MAX_MULTI_RECIPIENT_DEVICES} devices`);
534
+ }
535
+ requireCiphertextWithin(input.messageCiphertextBase64, MAX_MULTI_RECIPIENT_CIPHERTEXT_LENGTH);
536
+ // Per-recipient key material is a fixed-size key and tag; the reference
537
+ // budgets ~100 bytes per recipient block. 512 base64 characters is far
538
+ // above any real encoding and far below a useful flood.
539
+ //
540
+ // One entry per (userId, deviceId). Each accepted entry stores only its
541
+ // own key material next to a reference to the once-stored shared
542
+ // payload, but a repeat is still rejected rather than collapsed — a
543
+ // group-send token endorses the recipient *set*, saying nothing about
544
+ // how many times a member may appear in it, a repeat is a client bug,
545
+ // and quietly picking one of two conflicting key blocks would bury it.
546
+ const seenDevices = new Set();
547
+ for (const recipient of input.recipients) {
548
+ requireCiphertextWithin(recipient.encryptedMessageKeyBase64, 512);
549
+ requireCiphertextWithin(recipient.authenticationTagBase64, 512);
550
+ const deviceKey = JSON.stringify([recipient.userId, recipient.deviceId]);
551
+ if (seenDevices.has(deviceKey)) {
552
+ throw relayError('INVALID_REQUEST', 400, 'Multi-recipient delivery names the same device more than once');
553
+ }
554
+ seenDevices.add(deviceKey);
555
+ }
556
+ await authorizeUnidentified(ctx, input.recipients.map((recipient) => ({
557
+ userId: recipient.userId,
558
+ aciBytes: recipient.aciBytes,
559
+ })), input);
560
+ const ephemeralPublic = base64ToBytes(asBase64(input.ephemeralPublicBase64));
561
+ const messageCiphertext = base64ToBytes(asBase64(input.messageCiphertextBase64));
562
+ // The shared remainder — ephemeral public key and message ciphertext —
563
+ // is stored once and referenced from every accepted recipient row,
564
+ // matching the reference's message store, which inserts one shared
565
+ // multi-recipient payload and hands each recipient a pointer. Storing
566
+ // a copy per row turns a ~100 KiB send into recipient-count times that
567
+ // in one transaction. Created lazily on the first accepted recipient;
568
+ // a request whose recipients all 404 (or all deduplicate) stores
569
+ // nothing new beyond, at worst, one TTL-reaped orphan payload.
570
+ const sharedLength = ephemeralPublic.length + messageCiphertext.length;
571
+ let sharedPayloadId;
572
+ const ensureSharedPayload = async (shared) => {
573
+ if (sharedPayloadId === undefined) {
574
+ sharedPayloadId = crypto.randomUUID();
575
+ await ctx.db.insert('multiRecipientPayloads', {
576
+ payloadId: sharedPayloadId,
577
+ sharedBase64: bytesToBase64(shared),
578
+ expiresAt: Date.now() + MESSAGE_TTL_MS,
579
+ });
580
+ }
581
+ return sharedPayloadId;
582
+ };
583
+ let first;
584
+ const uuids404 = new Set();
585
+ for (const recipient of input.recipients) {
586
+ const device = await ctx.db
587
+ .query('devices')
588
+ .withIndex('by_user_id_and_device_id', (q) => q
589
+ .eq('userId', recipient.userId)
590
+ .eq('deviceId', recipient.deviceId))
591
+ .unique();
592
+ if (!device?.registered || !device.enabled) {
593
+ uuids404.add(recipient.userId);
594
+ continue;
595
+ }
596
+ const registration = await ctx.db
597
+ .query('identityRegistrations')
598
+ .withIndex('by_user_id_and_device_id_and_identity_type', (q) => q
599
+ .eq('userId', recipient.userId)
600
+ .eq('deviceId', recipient.deviceId)
601
+ .eq('identityType', 'aci'))
602
+ .unique();
603
+ if (registration &&
604
+ registration.registrationId !== recipient.registrationId) {
605
+ uuids404.add(recipient.userId);
606
+ continue;
607
+ }
608
+ // The canonical serializer builds (and validates) the full wire
609
+ // form; the row keeps only the per-recipient prefix — version byte
610
+ // and key material — and delivery reattaches the shared suffix.
611
+ const receivedMessage = serializeReceivedMessage(base64ToBytes(asBase64(recipient.encryptedMessageKeyBase64)), base64ToBytes(asBase64(recipient.authenticationTagBase64)), ephemeralPublic, messageCiphertext);
612
+ const prefix = receivedMessage.subarray(0, receivedMessage.length - sharedLength);
613
+ const result = await insertMessage(ctx, {
614
+ targetUserId: recipient.userId,
615
+ targetDeviceId: recipient.deviceId,
616
+ senderUserId: '',
617
+ senderDeviceId: 0,
618
+ ciphertext: bytesToBase64(prefix),
619
+ messageType: 'unidentified_sender',
620
+ timestamp: input.timestamp,
621
+ clientMessageId: input.clientMessageId,
622
+ sharedPayloadId: await ensureSharedPayload(receivedMessage.subarray(receivedMessage.length - sharedLength)),
623
+ });
624
+ first ??= result;
625
+ }
626
+ const fallbackTimestamp = Date.now();
627
+ return {
628
+ messageId: first?.messageId ?? `multi-${crypto.randomUUID()}`,
629
+ serverTimestamp: first?.serverTimestamp ?? fallbackTimestamp,
630
+ uuids404: [...uuids404],
631
+ };
632
+ },
633
+ });
634
+ export const sendRetryRequest = mutation({
635
+ args: {
636
+ ...callerIdentityArgs,
637
+ requesterDeviceId: v.number(),
638
+ originalSenderUserId: v.string(),
639
+ originalSenderDeviceId: v.number(),
640
+ failedTimestamp: v.number(),
641
+ timestamp: v.number(),
642
+ reason: retryReasonValidator,
643
+ },
644
+ returns: v.null(),
645
+ handler: async (ctx, input) => {
646
+ await rememberAccount(ctx, input);
647
+ await chargeRetryRequest(ctx, input.callerUserId);
648
+ await ctx.db.insert('retryRequests', {
649
+ requestId: crypto.randomUUID(),
650
+ requesterUserId: input.callerUserId,
651
+ requesterDeviceId: input.requesterDeviceId,
652
+ originalSenderUserId: input.originalSenderUserId,
653
+ originalSenderDeviceId: input.originalSenderDeviceId,
654
+ failedTimestamp: input.failedTimestamp,
655
+ timestamp: input.timestamp,
656
+ reason: input.reason,
657
+ expiresAt: Date.now() + MESSAGE_TTL_MS,
658
+ });
659
+ return null;
660
+ },
661
+ });
662
+ const retryRequestValidator = v.object({
663
+ id: v.string(),
664
+ requesterUserId: v.string(),
665
+ requesterDeviceId: v.number(),
666
+ originalSenderUserId: v.string(),
667
+ originalSenderDeviceId: v.number(),
668
+ failedTimestamp: v.number(),
669
+ timestamp: v.number(),
670
+ reason: retryReasonValidator,
671
+ });
672
+ export const getPendingRetryRequests = query({
673
+ args: {
674
+ ...callerIdentityArgs,
675
+ deviceId: v.number(),
676
+ },
677
+ returns: v.array(retryRequestValidator),
678
+ handler: async (ctx, input) => {
679
+ // Same read-time expiry filter and the same transaction-fixed clock as
680
+ // getPendingMessages: an expired retry request may survive in a cached
681
+ // subscription until the hourly cron deletes it. Acting on a stale retry
682
+ // request costs one redundant re-send, so the window is harmless.
683
+ const now = Date.now();
684
+ const rows = (await ctx.db
685
+ .query('retryRequests')
686
+ .withIndex('by_original_sender_user_id_and_original_sender_device_id', (q) => q
687
+ .eq('originalSenderUserId', input.callerUserId)
688
+ .eq('originalSenderDeviceId', input.deviceId))
689
+ .take(MAX_PENDING_RETRY_REQUESTS)).filter((row) => row.expiresAt > now);
690
+ return rows.map(({ requestId, ...request }) => ({
691
+ id: requestId,
692
+ requesterUserId: request.requesterUserId,
693
+ requesterDeviceId: request.requesterDeviceId,
694
+ originalSenderUserId: request.originalSenderUserId,
695
+ originalSenderDeviceId: request.originalSenderDeviceId,
696
+ failedTimestamp: request.failedTimestamp,
697
+ timestamp: request.timestamp,
698
+ reason: request.reason,
699
+ }));
700
+ },
701
+ });
702
+ export const markRetryRequestHandled = mutation({
703
+ args: {
704
+ ...callerIdentityArgs,
705
+ requestId: v.string(),
706
+ },
707
+ returns: v.null(),
708
+ handler: async (ctx, input) => {
709
+ await rememberAccount(ctx, input);
710
+ const request = await ctx.db
711
+ .query('retryRequests')
712
+ .withIndex('by_request_id', (q) => q.eq('requestId', input.requestId))
713
+ .unique();
714
+ if (!request)
715
+ return null;
716
+ if (request.originalSenderUserId !== input.callerUserId) {
717
+ throw unauthorized('only the original sender can handle a retry request');
718
+ }
719
+ await ctx.db.delete(request._id);
720
+ return null;
721
+ },
722
+ });
723
+ //# sourceMappingURL=messages.js.map