@open-e2ee/signal-protocol-sdk 2.0.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/ADAPTERS.md +10 -17
  2. package/ARCHITECTURE.md +1 -2
  3. package/CHANGELOG.md +74 -0
  4. package/LICENSE +11 -655
  5. package/LICENSE-APACHE +201 -0
  6. package/LICENSE-MIT +21 -0
  7. package/NOTICE +5 -7
  8. package/README.md +11 -11
  9. package/SECURITY.md +2 -2
  10. package/TROUBLESHOOTING.md +2 -6
  11. package/client/README.md +34 -16
  12. package/device/README.md +1 -1
  13. package/dist/client/client.d.ts +13 -2
  14. package/dist/client/client.d.ts.map +1 -1
  15. package/dist/client/client.js +136 -73
  16. package/dist/client/client.js.map +1 -1
  17. package/dist/client/config.d.ts +14 -18
  18. package/dist/client/config.d.ts.map +1 -1
  19. package/dist/client/config.js.map +1 -1
  20. package/dist/client/content-adapter.d.ts +2 -0
  21. package/dist/client/content-adapter.d.ts.map +1 -1
  22. package/dist/client/content-adapter.js +4 -0
  23. package/dist/client/content-adapter.js.map +1 -1
  24. package/dist/client/endorsement-manager.d.ts +4 -1
  25. package/dist/client/endorsement-manager.d.ts.map +1 -1
  26. package/dist/client/endorsement-manager.js +14 -6
  27. package/dist/client/endorsement-manager.js.map +1 -1
  28. package/dist/client/group-authority.d.ts +8 -0
  29. package/dist/client/group-authority.d.ts.map +1 -0
  30. package/dist/client/group-authority.js +2 -0
  31. package/dist/client/group-authority.js.map +1 -0
  32. package/dist/client/headless.d.ts +3 -8
  33. package/dist/client/headless.d.ts.map +1 -1
  34. package/dist/client/headless.js +3 -8
  35. package/dist/client/headless.js.map +1 -1
  36. package/dist/client/hosted-anonymous-delivery.d.ts +32 -0
  37. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -0
  38. package/dist/client/hosted-anonymous-delivery.js +239 -0
  39. package/dist/client/hosted-anonymous-delivery.js.map +1 -0
  40. package/dist/client/hosted-connection.d.ts +1 -1
  41. package/dist/client/hosted-connection.d.ts.map +1 -1
  42. package/dist/client/hosted-connection.js +18 -51
  43. package/dist/client/hosted-connection.js.map +1 -1
  44. package/dist/client/hosted-group-authority.d.ts +11 -0
  45. package/dist/client/hosted-group-authority.d.ts.map +1 -0
  46. package/dist/client/hosted-group-authority.js +96 -0
  47. package/dist/client/hosted-group-authority.js.map +1 -0
  48. package/dist/client/hosted-groups.d.ts +31 -0
  49. package/dist/client/hosted-groups.d.ts.map +1 -0
  50. package/dist/client/hosted-groups.js +217 -0
  51. package/dist/client/hosted-groups.js.map +1 -0
  52. package/dist/client/hosted-mailbox-subscription.d.ts +34 -0
  53. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -0
  54. package/dist/client/hosted-mailbox-subscription.js +257 -0
  55. package/dist/client/hosted-mailbox-subscription.js.map +1 -0
  56. package/dist/client/hosted-prekey-publication.d.ts +51 -0
  57. package/dist/client/hosted-prekey-publication.d.ts.map +1 -0
  58. package/dist/client/hosted-prekey-publication.js +249 -0
  59. package/dist/client/hosted-prekey-publication.js.map +1 -0
  60. package/dist/client/hosted-push.d.ts +4 -5
  61. package/dist/client/hosted-push.d.ts.map +1 -1
  62. package/dist/client/hosted-push.js +22 -22
  63. package/dist/client/hosted-push.js.map +1 -1
  64. package/dist/client/hosted-transport.d.ts +57 -35
  65. package/dist/client/hosted-transport.d.ts.map +1 -1
  66. package/dist/client/hosted-transport.js +666 -341
  67. package/dist/client/hosted-transport.js.map +1 -1
  68. package/dist/client/hosted-trust.d.ts +29 -0
  69. package/dist/client/hosted-trust.d.ts.map +1 -0
  70. package/dist/client/hosted-trust.js +28 -0
  71. package/dist/client/hosted-trust.js.map +1 -0
  72. package/dist/client/hosted.d.ts +18 -13
  73. package/dist/client/hosted.d.ts.map +1 -1
  74. package/dist/client/hosted.js +78 -34
  75. package/dist/client/hosted.js.map +1 -1
  76. package/dist/client/index.d.ts +14 -14
  77. package/dist/client/index.d.ts.map +1 -1
  78. package/dist/client/index.js +7 -7
  79. package/dist/client/index.js.map +1 -1
  80. package/dist/client/key-rotation-core.d.ts +8 -0
  81. package/dist/client/key-rotation-core.d.ts.map +1 -1
  82. package/dist/client/key-rotation-core.js +12 -1
  83. package/dist/client/key-rotation-core.js.map +1 -1
  84. package/dist/client/key-rotation.d.ts +2 -1
  85. package/dist/client/key-rotation.d.ts.map +1 -1
  86. package/dist/client/key-rotation.js +4 -4
  87. package/dist/client/key-rotation.js.map +1 -1
  88. package/dist/client/media-queue-persistence.d.ts +14 -0
  89. package/dist/client/media-queue-persistence.d.ts.map +1 -0
  90. package/dist/client/media-queue-persistence.js +123 -0
  91. package/dist/client/media-queue-persistence.js.map +1 -0
  92. package/dist/client/media-upload-budget.d.ts +3 -0
  93. package/dist/client/media-upload-budget.d.ts.map +1 -0
  94. package/dist/client/media-upload-budget.js +27 -0
  95. package/dist/client/media-upload-budget.js.map +1 -0
  96. package/dist/client/media.d.ts +51 -15
  97. package/dist/client/media.d.ts.map +1 -1
  98. package/dist/client/media.js +541 -73
  99. package/dist/client/media.js.map +1 -1
  100. package/dist/client/messages.d.ts.map +1 -1
  101. package/dist/client/messages.js +13 -14
  102. package/dist/client/messages.js.map +1 -1
  103. package/dist/client/prekeys.d.ts.map +1 -1
  104. package/dist/client/prekeys.js +131 -43
  105. package/dist/client/prekeys.js.map +1 -1
  106. package/dist/client/relay-subscription.d.ts +4 -0
  107. package/dist/client/relay-subscription.d.ts.map +1 -1
  108. package/dist/client/relay-subscription.js +58 -25
  109. package/dist/client/relay-subscription.js.map +1 -1
  110. package/dist/client/sender-key-distribution.d.ts +8 -0
  111. package/dist/client/sender-key-distribution.d.ts.map +1 -0
  112. package/dist/client/sender-key-distribution.js +59 -0
  113. package/dist/client/sender-key-distribution.js.map +1 -0
  114. package/dist/client/signal-service-cipher.d.ts +7 -3
  115. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  116. package/dist/client/signal-service-cipher.js +41 -16
  117. package/dist/client/signal-service-cipher.js.map +1 -1
  118. package/dist/device/{expo-metadata.d.ts → expo/index.d.ts} +3 -3
  119. package/dist/device/expo/index.d.ts.map +1 -0
  120. package/dist/device/{expo-metadata.js → expo/index.js} +2 -2
  121. package/dist/device/expo/index.js.map +1 -0
  122. package/dist/device/index.js +1 -1
  123. package/dist/device/index.js.map +1 -1
  124. package/dist/device/provisioning.d.ts +1 -1
  125. package/dist/device/provisioning.js +1 -1
  126. package/dist/device/types.d.ts +1 -1
  127. package/dist/groups/server.d.ts +10 -0
  128. package/dist/groups/server.d.ts.map +1 -0
  129. package/dist/groups/server.js +6 -0
  130. package/dist/groups/server.js.map +1 -0
  131. package/dist/hooks/use-connection-presence.d.ts +2 -4
  132. package/dist/hooks/use-connection-presence.d.ts.map +1 -1
  133. package/dist/hooks/use-connection-presence.js +2 -4
  134. package/dist/hooks/use-connection-presence.js.map +1 -1
  135. package/dist/index.d.ts +51 -49
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +25 -24
  138. package/dist/index.js.map +1 -1
  139. package/dist/internal/groups/authority-certificate.d.ts +22 -0
  140. package/dist/internal/groups/authority-certificate.d.ts.map +1 -0
  141. package/dist/internal/groups/authority-certificate.js +99 -0
  142. package/dist/internal/groups/authority-certificate.js.map +1 -0
  143. package/dist/internal/groups/error-details.d.ts +9 -0
  144. package/dist/internal/groups/error-details.d.ts.map +1 -0
  145. package/dist/internal/groups/error-details.js +30 -0
  146. package/dist/internal/groups/error-details.js.map +1 -0
  147. package/dist/internal/groups/manager.d.ts +5 -0
  148. package/dist/internal/groups/manager.d.ts.map +1 -1
  149. package/dist/internal/groups/manager.js +3 -0
  150. package/dist/internal/groups/manager.js.map +1 -1
  151. package/dist/internal/groups/server-engine.d.ts +7 -0
  152. package/dist/internal/groups/server-engine.d.ts.map +1 -1
  153. package/dist/internal/groups/server-engine.js +51 -19
  154. package/dist/internal/groups/server-engine.js.map +1 -1
  155. package/dist/internal/groups/wire.d.ts.map +1 -1
  156. package/dist/internal/groups/wire.js +10 -9
  157. package/dist/internal/groups/wire.js.map +1 -1
  158. package/dist/internal/manager/manager.d.ts +1 -1
  159. package/dist/internal/manager/manager.d.ts.map +1 -1
  160. package/dist/internal/manager/manager.js +22 -25
  161. package/dist/internal/manager/manager.js.map +1 -1
  162. package/dist/internal/protocol/sender-keys/manager.d.ts +1 -1
  163. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  164. package/dist/internal/protocol/sender-keys/manager.js +27 -14
  165. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  166. package/dist/internal/sesame/manager.d.ts +2 -2
  167. package/dist/internal/sesame/manager.d.ts.map +1 -1
  168. package/dist/internal/sesame/manager.js +6 -6
  169. package/dist/internal/sesame/manager.js.map +1 -1
  170. package/dist/internal/sesame/types.d.ts +1 -1
  171. package/dist/internal/sesame/types.d.ts.map +1 -1
  172. package/dist/internal/session/cipher.d.ts +1 -1
  173. package/dist/internal/session/cipher.d.ts.map +1 -1
  174. package/dist/internal/session/cipher.js +31 -28
  175. package/dist/internal/session/cipher.js.map +1 -1
  176. package/dist/layers.d.ts +1 -1
  177. package/dist/layers.d.ts.map +1 -1
  178. package/dist/layers.js +1 -1
  179. package/dist/layers.js.map +1 -1
  180. package/dist/local/store/expo/adapter.d.ts +8 -2
  181. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  182. package/dist/local/store/expo/adapter.js +28 -9
  183. package/dist/local/store/expo/adapter.js.map +1 -1
  184. package/dist/local/store/expo/key-storage.d.ts +7 -1
  185. package/dist/local/store/expo/key-storage.d.ts.map +1 -1
  186. package/dist/local/store/expo/key-storage.js +82 -17
  187. package/dist/local/store/expo/key-storage.js.map +1 -1
  188. package/dist/local/store/expo/models/kyber-prekey-used.d.ts +1 -4
  189. package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +1 -1
  190. package/dist/local/store/expo/models/kyber-prekey-used.js +23 -9
  191. package/dist/local/store/expo/models/kyber-prekey-used.js.map +1 -1
  192. package/dist/local/store/expo/models/kyber-prekey.d.ts +4 -4
  193. package/dist/local/store/expo/models/kyber-prekey.d.ts.map +1 -1
  194. package/dist/local/store/expo/models/kyber-prekey.js +67 -26
  195. package/dist/local/store/expo/models/kyber-prekey.js.map +1 -1
  196. package/dist/local/store/expo/schema.d.ts +21 -2
  197. package/dist/local/store/expo/schema.d.ts.map +1 -1
  198. package/dist/local/store/expo/schema.js +10 -2
  199. package/dist/local/store/expo/schema.js.map +1 -1
  200. package/dist/local/store/kyber-prekey-lifecycle.d.ts +46 -0
  201. package/dist/local/store/kyber-prekey-lifecycle.d.ts.map +1 -0
  202. package/dist/local/store/kyber-prekey-lifecycle.js +88 -0
  203. package/dist/local/store/kyber-prekey-lifecycle.js.map +1 -0
  204. package/dist/local/store/memory/adapter.d.ts +11 -3
  205. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  206. package/dist/local/store/memory/adapter.js +113 -28
  207. package/dist/local/store/memory/adapter.js.map +1 -1
  208. package/dist/local/store/node/adapter.d.ts +8 -2
  209. package/dist/local/store/node/adapter.d.ts.map +1 -1
  210. package/dist/local/store/node/adapter.js +31 -13
  211. package/dist/local/store/node/adapter.js.map +1 -1
  212. package/dist/local/store/node/database-file-commit.d.ts +8 -0
  213. package/dist/local/store/node/database-file-commit.d.ts.map +1 -0
  214. package/dist/local/store/node/database-file-commit.js +62 -0
  215. package/dist/local/store/node/database-file-commit.js.map +1 -0
  216. package/dist/local/store/node/database-key.d.ts +6 -1
  217. package/dist/local/store/node/database-key.d.ts.map +1 -1
  218. package/dist/local/store/node/database-key.js +79 -44
  219. package/dist/local/store/node/database-key.js.map +1 -1
  220. package/dist/local/store/node/database-lock.d.ts +8 -0
  221. package/dist/local/store/node/database-lock.d.ts.map +1 -0
  222. package/dist/local/store/node/database-lock.js +44 -0
  223. package/dist/local/store/node/database-lock.js.map +1 -0
  224. package/dist/local/store/node/database.d.ts +15 -14
  225. package/dist/local/store/node/database.d.ts.map +1 -1
  226. package/dist/local/store/node/database.js +197 -202
  227. package/dist/local/store/node/database.js.map +1 -1
  228. package/dist/local/store/react-native/adapter.d.ts +8 -2
  229. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  230. package/dist/local/store/react-native/adapter.js +151 -66
  231. package/dist/local/store/react-native/adapter.js.map +1 -1
  232. package/dist/local/store/received-content.d.ts +9 -0
  233. package/dist/local/store/received-content.d.ts.map +1 -0
  234. package/dist/local/store/received-content.js +46 -0
  235. package/dist/local/store/received-content.js.map +1 -0
  236. package/dist/local/store/reliability.d.ts +2 -2
  237. package/dist/local/store/reliability.d.ts.map +1 -1
  238. package/dist/local/store/reliability.js +7 -4
  239. package/dist/local/store/reliability.js.map +1 -1
  240. package/dist/local/store/web/adapter.d.ts +8 -2
  241. package/dist/local/store/web/adapter.d.ts.map +1 -1
  242. package/dist/local/store/web/adapter.js +206 -73
  243. package/dist/local/store/web/adapter.js.map +1 -1
  244. package/dist/media/index.d.ts +71 -61
  245. package/dist/media/index.d.ts.map +1 -1
  246. package/dist/media/index.js +550 -386
  247. package/dist/media/index.js.map +1 -1
  248. package/dist/media/prepared-upload.d.ts +37 -0
  249. package/dist/media/prepared-upload.d.ts.map +1 -0
  250. package/dist/media/prepared-upload.js +46 -0
  251. package/dist/media/prepared-upload.js.map +1 -0
  252. package/dist/remote/object-store/convex-r2/server.d.ts +2 -1
  253. package/dist/remote/object-store/convex-r2/server.d.ts.map +1 -1
  254. package/dist/remote/object-store/convex-r2/server.js +4 -0
  255. package/dist/remote/object-store/convex-r2/server.js.map +1 -1
  256. package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -1
  257. package/dist/remote/object-store/convex-r2/storage.js +1 -0
  258. package/dist/remote/object-store/convex-r2/storage.js.map +1 -1
  259. package/dist/remote/object-store/index.d.ts +3 -1
  260. package/dist/remote/object-store/index.d.ts.map +1 -1
  261. package/dist/remote/object-store/index.js +1 -1
  262. package/dist/remote/object-store/index.js.map +1 -1
  263. package/dist/remote/object-store/s3/storage.d.ts +3 -1
  264. package/dist/remote/object-store/s3/storage.d.ts.map +1 -1
  265. package/dist/remote/object-store/s3/storage.js +9 -2
  266. package/dist/remote/object-store/s3/storage.js.map +1 -1
  267. package/dist/remote/object-store/types.d.ts +33 -4
  268. package/dist/remote/object-store/types.d.ts.map +1 -1
  269. package/dist/remote/object-store/upload-error.d.ts +23 -0
  270. package/dist/remote/object-store/upload-error.d.ts.map +1 -0
  271. package/dist/remote/object-store/upload-error.js +33 -0
  272. package/dist/remote/object-store/upload-error.js.map +1 -0
  273. package/dist/remote/object-store/validation.d.ts +7 -1
  274. package/dist/remote/object-store/validation.d.ts.map +1 -1
  275. package/dist/remote/object-store/validation.js +39 -25
  276. package/dist/remote/object-store/validation.js.map +1 -1
  277. package/dist/remote/relay/index.d.ts +5 -12
  278. package/dist/remote/relay/index.d.ts.map +1 -1
  279. package/dist/remote/relay/index.js +4 -11
  280. package/dist/remote/relay/index.js.map +1 -1
  281. package/dist/remote/relay/memory/adapter.d.ts +2 -1
  282. package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
  283. package/dist/remote/relay/memory/adapter.js +10 -0
  284. package/dist/remote/relay/memory/adapter.js.map +1 -1
  285. package/dist/remote/relay/types.d.ts +28 -17
  286. package/dist/remote/relay/types.d.ts.map +1 -1
  287. package/dist/types/api.d.ts +36 -1
  288. package/dist/types/api.d.ts.map +1 -1
  289. package/dist/types/session.d.ts +6 -0
  290. package/dist/types/session.d.ts.map +1 -1
  291. package/dist/types/session.js.map +1 -1
  292. package/docs/ASSURANCE.md +7 -7
  293. package/docs/CLIENT_COMPOSITION.md +12 -19
  294. package/docs/DEVIATIONS.md +1 -1
  295. package/docs/DOCUMENTATION_STANDARDS.md +4 -0
  296. package/docs/GETTING_STARTED.md +23 -38
  297. package/docs/INTERFACES.md +22 -13
  298. package/docs/PACKAGE_SURFACE.md +5 -12
  299. package/docs/RECIPES.md +10 -23
  300. package/examples/browser/index.html +2 -2
  301. package/local/store/README.md +16 -1
  302. package/local/store/expo/README.md +23 -19
  303. package/local/store/node/README.md +29 -0
  304. package/media/README.md +94 -0
  305. package/package.json +17 -27
  306. package/remote/README.md +16 -16
  307. package/remote/object-store/README.md +8 -0
  308. package/remote/object-store/s3/README.md +10 -1
  309. package/remote/relay/README.md +3 -2
  310. package/COMMERCIAL.md +0 -56
  311. package/dist/device/expo-metadata.d.ts.map +0 -1
  312. package/dist/device/expo-metadata.js.map +0 -1
  313. package/dist/remote/relay/convex/backend.d.ts +0 -394
  314. package/dist/remote/relay/convex/backend.d.ts.map +0 -1
  315. package/dist/remote/relay/convex/backend.js +0 -678
  316. package/dist/remote/relay/convex/backend.js.map +0 -1
  317. package/dist/remote/relay/convex/component/_generated/api.d.ts +0 -58
  318. package/dist/remote/relay/convex/component/_generated/api.d.ts.map +0 -1
  319. package/dist/remote/relay/convex/component/_generated/api.js +0 -31
  320. package/dist/remote/relay/convex/component/_generated/api.js.map +0 -1
  321. package/dist/remote/relay/convex/component/_generated/component.d.ts +0 -475
  322. package/dist/remote/relay/convex/component/_generated/component.d.ts.map +0 -1
  323. package/dist/remote/relay/convex/component/_generated/component.js +0 -11
  324. package/dist/remote/relay/convex/component/_generated/component.js.map +0 -1
  325. package/dist/remote/relay/convex/component/_generated/dataModel.d.ts +0 -46
  326. package/dist/remote/relay/convex/component/_generated/dataModel.d.ts.map +0 -1
  327. package/dist/remote/relay/convex/component/_generated/dataModel.js +0 -11
  328. package/dist/remote/relay/convex/component/_generated/dataModel.js.map +0 -1
  329. package/dist/remote/relay/convex/component/_generated/server.d.ts +0 -129
  330. package/dist/remote/relay/convex/component/_generated/server.d.ts.map +0 -1
  331. package/dist/remote/relay/convex/component/_generated/server.js +0 -79
  332. package/dist/remote/relay/convex/component/_generated/server.js.map +0 -1
  333. package/dist/remote/relay/convex/component/accounts.d.ts +0 -45
  334. package/dist/remote/relay/convex/component/accounts.d.ts.map +0 -1
  335. package/dist/remote/relay/convex/component/accounts.js +0 -184
  336. package/dist/remote/relay/convex/component/accounts.js.map +0 -1
  337. package/dist/remote/relay/convex/component/certificates.d.ts +0 -10
  338. package/dist/remote/relay/convex/component/certificates.d.ts.map +0 -1
  339. package/dist/remote/relay/convex/component/certificates.js +0 -126
  340. package/dist/remote/relay/convex/component/certificates.js.map +0 -1
  341. package/dist/remote/relay/convex/component/cleanup.d.ts +0 -32
  342. package/dist/remote/relay/convex/component/cleanup.d.ts.map +0 -1
  343. package/dist/remote/relay/convex/component/cleanup.js +0 -146
  344. package/dist/remote/relay/convex/component/cleanup.js.map +0 -1
  345. package/dist/remote/relay/convex/component/convex.config.d.ts +0 -5
  346. package/dist/remote/relay/convex/component/convex.config.d.ts.map +0 -1
  347. package/dist/remote/relay/convex/component/convex.config.js +0 -35
  348. package/dist/remote/relay/convex/component/convex.config.js.map +0 -1
  349. package/dist/remote/relay/convex/component/crons.d.ts +0 -3
  350. package/dist/remote/relay/convex/component/crons.d.ts.map +0 -1
  351. package/dist/remote/relay/convex/component/crons.js +0 -10
  352. package/dist/remote/relay/convex/component/crons.js.map +0 -1
  353. package/dist/remote/relay/convex/component/devices.d.ts +0 -102
  354. package/dist/remote/relay/convex/component/devices.d.ts.map +0 -1
  355. package/dist/remote/relay/convex/component/devices.js +0 -300
  356. package/dist/remote/relay/convex/component/devices.js.map +0 -1
  357. package/dist/remote/relay/convex/component/errors.d.ts +0 -22
  358. package/dist/remote/relay/convex/component/errors.d.ts.map +0 -1
  359. package/dist/remote/relay/convex/component/errors.js +0 -17
  360. package/dist/remote/relay/convex/component/errors.js.map +0 -1
  361. package/dist/remote/relay/convex/component/groups.d.ts +0 -63
  362. package/dist/remote/relay/convex/component/groups.d.ts.map +0 -1
  363. package/dist/remote/relay/convex/component/groups.js +0 -341
  364. package/dist/remote/relay/convex/component/groups.js.map +0 -1
  365. package/dist/remote/relay/convex/component/keys.d.ts +0 -130
  366. package/dist/remote/relay/convex/component/keys.d.ts.map +0 -1
  367. package/dist/remote/relay/convex/component/keys.js +0 -578
  368. package/dist/remote/relay/convex/component/keys.js.map +0 -1
  369. package/dist/remote/relay/convex/component/messages.d.ts +0 -105
  370. package/dist/remote/relay/convex/component/messages.d.ts.map +0 -1
  371. package/dist/remote/relay/convex/component/messages.js +0 -702
  372. package/dist/remote/relay/convex/component/messages.js.map +0 -1
  373. package/dist/remote/relay/convex/component/provisioning.d.ts +0 -92
  374. package/dist/remote/relay/convex/component/provisioning.d.ts.map +0 -1
  375. package/dist/remote/relay/convex/component/provisioning.js +0 -360
  376. package/dist/remote/relay/convex/component/provisioning.js.map +0 -1
  377. package/dist/remote/relay/convex/component/runtime.d.ts +0 -18
  378. package/dist/remote/relay/convex/component/runtime.d.ts.map +0 -1
  379. package/dist/remote/relay/convex/component/runtime.js +0 -144
  380. package/dist/remote/relay/convex/component/runtime.js.map +0 -1
  381. package/dist/remote/relay/convex/component/schema.d.ts +0 -358
  382. package/dist/remote/relay/convex/component/schema.d.ts.map +0 -1
  383. package/dist/remote/relay/convex/component/schema.js +0 -288
  384. package/dist/remote/relay/convex/component/schema.js.map +0 -1
  385. package/dist/remote/relay/convex/component/zkAuth.d.ts +0 -18
  386. package/dist/remote/relay/convex/component/zkAuth.d.ts.map +0 -1
  387. package/dist/remote/relay/convex/component/zkAuth.js +0 -86
  388. package/dist/remote/relay/convex/component/zkAuth.js.map +0 -1
  389. package/dist/remote/relay/convex/constants.d.ts +0 -3
  390. package/dist/remote/relay/convex/constants.d.ts.map +0 -1
  391. package/dist/remote/relay/convex/constants.js +0 -3
  392. package/dist/remote/relay/convex/constants.js.map +0 -1
  393. package/dist/remote/relay/convex/group-server.d.ts +0 -123
  394. package/dist/remote/relay/convex/group-server.d.ts.map +0 -1
  395. package/dist/remote/relay/convex/group-server.js +0 -184
  396. package/dist/remote/relay/convex/group-server.js.map +0 -1
  397. package/dist/remote/relay/convex/index.d.ts +0 -42
  398. package/dist/remote/relay/convex/index.d.ts.map +0 -1
  399. package/dist/remote/relay/convex/index.js +0 -38
  400. package/dist/remote/relay/convex/index.js.map +0 -1
  401. package/dist/remote/relay/convex/relay.d.ts +0 -323
  402. package/dist/remote/relay/convex/relay.d.ts.map +0 -1
  403. package/dist/remote/relay/convex/relay.js +0 -1144
  404. package/dist/remote/relay/convex/relay.js.map +0 -1
  405. package/dist/remote/relay/convex/types.d.ts +0 -24
  406. package/dist/remote/relay/convex/types.d.ts.map +0 -1
  407. package/dist/remote/relay/convex/types.js +0 -14
  408. package/dist/remote/relay/convex/types.js.map +0 -1
  409. package/remote/relay/convex/README.md +0 -61
  410. package/remote/relay/convex/component/README.md +0 -462
@@ -1,288 +0,0 @@
1
- import { defineSchema, defineTable } from 'convex/server';
2
- import { v } from 'convex/values';
3
- export default defineSchema({
4
- accounts: defineTable({
5
- userId: v.string(),
6
- aciBytes: v.bytes(),
7
- pniBytes: v.optional(v.bytes()),
8
- unidentifiedAccessKey: v.optional(v.string()),
9
- updatedAt: v.number(),
10
- })
11
- .index('by_user_id', ['userId'])
12
- // One ACI, one account: rememberAccount refuses a cross-account claim
13
- // over this index at write time. (Sealed-sender binding reads by user ID
14
- // and compares the stored ACI. This index exists for the uniqueness
15
- // check alone.)
16
- .index('by_aci_bytes', ['aciBytes']),
17
- devices: defineTable({
18
- userId: v.string(),
19
- deviceId: v.number(),
20
- encryptedDeviceName: v.optional(v.bytes()),
21
- deviceType: v.optional(v.union(v.literal('mobile'), v.literal('desktop'), v.literal('tablet'), v.literal('web'))),
22
- registered: v.boolean(),
23
- linked: v.boolean(),
24
- enabled: v.boolean(),
25
- active: v.boolean(),
26
- lastSeen: v.number(),
27
- createdAt: v.number(),
28
- linkedAt: v.optional(v.number()),
29
- // Identifies *this* registration of the slot. Device rows are reused
30
- // across registrations. The `db.replace` call keeps the row id, and the
31
- // deviceId is a small slot number. Neither identifies which link produced
32
- // the current occupant. Every register and every link mints a fresh
33
- // token, and the server never returns it to clients.
34
- linkToken: v.optional(v.string()),
35
- })
36
- .index('by_user_id', ['userId'])
37
- .index('by_user_id_and_device_id', ['userId', 'deviceId']),
38
- deviceHeartbeats: defineTable({
39
- userId: v.string(),
40
- deviceId: v.number(),
41
- lastSeen: v.number(),
42
- }).index('by_user_id_and_device_id', ['userId', 'deviceId']),
43
- identityKeys: defineTable({
44
- userId: v.string(),
45
- identityType: v.union(v.literal('aci'), v.literal('pni')),
46
- compositeIdentity: v.string(),
47
- createdAt: v.number(),
48
- updatedAt: v.number(),
49
- }).index('by_user_id_and_identity_type', [
50
- 'userId',
51
- 'identityType',
52
- ]),
53
- identityRegistrations: defineTable({
54
- userId: v.string(),
55
- deviceId: v.number(),
56
- identityType: v.union(v.literal('aci'), v.literal('pni')),
57
- registrationId: v.number(),
58
- updatedAt: v.number(),
59
- })
60
- .index('by_user_id_and_device_id_and_identity_type', [
61
- 'userId',
62
- 'deviceId',
63
- 'identityType',
64
- ])
65
- .index('by_user_id_and_identity_type', [
66
- 'userId',
67
- 'identityType',
68
- ]),
69
- ecPreKeys: defineTable({
70
- userId: v.string(),
71
- deviceId: v.number(),
72
- identityType: v.union(v.literal('aci'), v.literal('pni')),
73
- keyId: v.number(),
74
- publicKey: v.string(),
75
- uploadedAt: v.number(),
76
- consumedAt: v.optional(v.number()),
77
- })
78
- .index('by_user_id_and_device_id_and_identity_type_and_key_id', [
79
- 'userId',
80
- 'deviceId',
81
- 'identityType',
82
- 'keyId',
83
- ])
84
- .index('by_user_id_and_device_id_and_identity_type_and_consumed_at', ['userId', 'deviceId', 'identityType', 'consumedAt'])
85
- .index('by_user_id_and_identity_type', [
86
- 'userId',
87
- 'identityType',
88
- ]),
89
- ecSignedPreKeys: defineTable({
90
- userId: v.string(),
91
- deviceId: v.number(),
92
- identityType: v.union(v.literal('aci'), v.literal('pni')),
93
- keyId: v.number(),
94
- publicKey: v.string(),
95
- signature: v.string(),
96
- createdAt: v.number(),
97
- expiresAt: v.number(),
98
- })
99
- .index('by_user_id_and_device_id_and_identity_type', [
100
- 'userId',
101
- 'deviceId',
102
- 'identityType',
103
- ])
104
- .index('by_user_id_and_identity_type', [
105
- 'userId',
106
- 'identityType',
107
- ]),
108
- kemOneTimePreKeys: defineTable({
109
- userId: v.string(),
110
- deviceId: v.number(),
111
- identityType: v.union(v.literal('aci'), v.literal('pni')),
112
- keyId: v.number(),
113
- publicKey: v.string(),
114
- signature: v.optional(v.string()),
115
- uploadedAt: v.number(),
116
- consumedAt: v.optional(v.number()),
117
- })
118
- .index('by_user_id_and_device_id_and_identity_type_and_key_id', [
119
- 'userId',
120
- 'deviceId',
121
- 'identityType',
122
- 'keyId',
123
- ])
124
- .index('by_user_id_and_device_id_and_identity_type_and_consumed_at', ['userId', 'deviceId', 'identityType', 'consumedAt'])
125
- .index('by_user_id_and_identity_type', ['userId', 'identityType'])
126
- .index('by_consumed_at_and_uploaded_at', [
127
- 'consumedAt',
128
- 'uploadedAt',
129
- ])
130
- .index('by_uploaded_at', ['uploadedAt']),
131
- kemLastResortPreKeys: defineTable({
132
- userId: v.string(),
133
- deviceId: v.number(),
134
- identityType: v.union(v.literal('aci'), v.literal('pni')),
135
- keyId: v.number(),
136
- publicKey: v.string(),
137
- signature: v.string(),
138
- createdAt: v.number(),
139
- expiresAt: v.number(),
140
- })
141
- .index('by_user_id_and_device_id_and_identity_type', [
142
- 'userId',
143
- 'deviceId',
144
- 'identityType',
145
- ])
146
- .index('by_user_id_and_identity_type', ['userId', 'identityType'])
147
- .index('by_expires_at', ['expiresAt']),
148
- messages: defineTable({
149
- messageId: v.string(),
150
- targetUserId: v.string(),
151
- targetDeviceId: v.number(),
152
- senderUserId: v.string(),
153
- senderDeviceId: v.number(),
154
- ciphertext: v.string(),
155
- messageType: v.union(v.literal('ciphertext'), v.literal('prekey_bundle'), v.literal('sender_key'), v.literal('server_delivery_receipt'), v.literal('unidentified_sender')),
156
- deliveryClass: v.union(v.literal('user-visible'), v.literal('background-sync'), v.literal('ephemeral')),
157
- timestamp: v.number(),
158
- serverTimestamp: v.number(),
159
- clientMessageId: v.optional(v.string()),
160
- // Present on multi-recipient rows: `ciphertext` then holds only the
161
- // version byte and this recipient's key material, and the shared
162
- // remainder lives once in `multiRecipientPayloads`.
163
- sharedPayloadId: v.optional(v.string()),
164
- expiresAt: v.number(),
165
- })
166
- .index('by_message_id', ['messageId'])
167
- .index('by_target_user_id_and_target_device_id', [
168
- 'targetUserId',
169
- 'targetDeviceId',
170
- ])
171
- // Deduplication is per (recipient device, claimed sender): a
172
- // `clientMessageId` only ever collapses retries from the same sender.
173
- // Without `senderUserId`, two senders that mint non-random client message
174
- // IDs, such as a counter or a timestamp, silently suppress each other's
175
- // messages. The suppressed sender receives the other sender's message ID
176
- // and server timestamp.
177
- .index('by_target_and_client_message_id', [
178
- 'targetUserId',
179
- 'targetDeviceId',
180
- 'senderUserId',
181
- 'clientMessageId',
182
- ])
183
- .index('by_expires_at', ['expiresAt']),
184
- // The shared portion of a multi-recipient sealed-sender message
185
- // (ephemeral public key and message ciphertext), stored once per send.
186
- // The per-recipient message rows carry only their 48 bytes of key
187
- // material plus a reference here, and delivery reassembles the wire
188
- // form. This is the reference's shape. Its message store inserts one
189
- // shared multi-recipient payload and hands each recipient a pointer.
190
- // Storing a copy per recipient turns one send into an amplification of
191
- // itself.
192
- //
193
- // Rows share the message queue's retention and are reaped by TTL, not by
194
- // delivery. The last reader must not have to know it is last.
195
- multiRecipientPayloads: defineTable({
196
- payloadId: v.string(),
197
- sharedBase64: v.string(),
198
- expiresAt: v.number(),
199
- })
200
- .index('by_payload_id', ['payloadId'])
201
- .index('by_expires_at', ['expiresAt']),
202
- retryRequests: defineTable({
203
- requestId: v.string(),
204
- requesterUserId: v.string(),
205
- requesterDeviceId: v.number(),
206
- originalSenderUserId: v.string(),
207
- originalSenderDeviceId: v.number(),
208
- failedTimestamp: v.number(),
209
- timestamp: v.number(),
210
- reason: v.union(v.literal('NO_SESSION'), v.literal('DECRYPTION_FAILED'), v.literal('SESSION_EXPIRED'), v.literal('STALE_DEVICE_LIST'), v.literal('IDENTITY_KEY_MISMATCH')),
211
- // Retry requests share the message queue's seven-day retention: if the
212
- // original sender never returns to handle one, the row is
213
- // garbage-collected instead of persisting forever.
214
- expiresAt: v.number(),
215
- })
216
- .index('by_request_id', ['requestId'])
217
- .index('by_original_sender_user_id_and_original_sender_device_id', ['originalSenderUserId', 'originalSenderDeviceId'])
218
- .index('by_expires_at', ['expiresAt']),
219
- provisioningSessions: defineTable({
220
- sessionId: v.string(),
221
- userId: v.string(),
222
- ephemeralPublicKey: v.string(),
223
- newDeviceEphemeralPublicKey: v.optional(v.string()),
224
- deviceMetadata: v.optional(v.object({
225
- platform: v.optional(v.string()),
226
- appVersion: v.optional(v.string()),
227
- osVersion: v.optional(v.string()),
228
- })),
229
- encryptedMessage: v.optional(v.string()),
230
- assignedDeviceId: v.optional(v.number()),
231
- // `linkToken` of the device row this session created at completion.
232
- // Teardown deletes a device only when the tokens match, so a device
233
- // re-registered into the freed slot is never reaped. A millisecond
234
- // timestamp is ambiguous here. Two links landing in the same millisecond
235
- // on the same reused slot produce equal stamps, and teardown would then
236
- // reap the wrong link.
237
- linkedDeviceToken: v.optional(v.string()),
238
- // `expired` is deliberately absent: it is never stored. Mutations
239
- // reject expired sessions with a throw, which rolls back any patch. The
240
- // cleanup cron deletes expired rows outright, and
241
- // `getProvisioningMessage` reports expiry as a computed status.
242
- status: v.union(v.literal('waiting'), v.literal('connected'), v.literal('ready'), v.literal('linked_pending_ack'), v.literal('completed'), v.literal('rolled_back')),
243
- createdAt: v.number(),
244
- expiresAt: v.number(),
245
- })
246
- .index('by_session_id', ['sessionId'])
247
- .index('by_user_id', ['userId'])
248
- .index('by_expires_at', ['expiresAt']),
249
- senderCertificates: defineTable({
250
- userId: v.string(),
251
- deviceId: v.number(),
252
- identityType: v.union(v.literal('aci'), v.literal('pni')),
253
- identityKey: v.string(),
254
- certificate: v.string(),
255
- certificateContract: v.literal('scoped'),
256
- issuedAt: v.number(),
257
- expiresAt: v.number(),
258
- })
259
- .index('by_user_id_and_device_id_and_identity_type', [
260
- 'userId',
261
- 'deviceId',
262
- 'identityType',
263
- ])
264
- .index('by_user_id_and_identity_type', [
265
- 'userId',
266
- 'identityType',
267
- ]),
268
- groups: defineTable({
269
- groupId: v.string(),
270
- encryptedState: v.bytes(),
271
- version: v.number(),
272
- }).index('by_group_id', ['groupId']),
273
- groupChanges: defineTable({
274
- groupId: v.string(),
275
- version: v.number(),
276
- actions: v.bytes(),
277
- serverSignature: v.bytes(),
278
- changeEpoch: v.number(),
279
- timestamp: v.number(),
280
- }).index('by_group_id_version', ['groupId', 'version']),
281
- groupSnapshots: defineTable({
282
- groupId: v.string(),
283
- version: v.number(),
284
- encryptedState: v.bytes(),
285
- baselineSignature: v.bytes(),
286
- }).index('by_group_id_version', ['groupId', 'version']),
287
- });
288
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../remote/relay/convex/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,eAAe,YAAY,CAAC;IAC1B,QAAQ,EAAE,WAAW,CAAC;QACpB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;QACnB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC/B,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;SACC,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;QAChC,sEAAsE;QACtE,yEAAyE;QACzE,oEAAoE;QACpE,gBAAgB;SACf,KAAK,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,EAAE,WAAW,CAAC;QACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,Q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C,MAAM,EAAE;QACnB,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE;QACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,SAAS,CAAC,CAAC;IACpC,YAAY,EAAE,WAAW,CAAC;QACxB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE;QAClB,eAAe,EAAE,CAAC,CAAC,KAAK,EAAE;QAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvD,cAAc,EAAE,WAAW,CAAC;QAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE;QACzB,iBAAiB,EAAE,CAAC,CAAC,KAAK,EAAE;KAC7B,CAAC,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CACxD,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- export declare const issueAuthCredentialMutation: import("convex/server").RegisteredMutation<"public", {
2
- aciBytes: ArrayBuffer;
3
- pniBytes?: ArrayBuffer | undefined;
4
- userId?: string | undefined;
5
- }, Promise<ArrayBuffer>>;
6
- export declare const issueProfileKeyCredentialMutation: import("convex/server").RegisteredMutation<"public", {
7
- aciBytes: ArrayBuffer;
8
- pniBytes?: ArrayBuffer | undefined;
9
- request: ArrayBuffer;
10
- userId?: string | undefined;
11
- }, Promise<ArrayBuffer>>;
12
- export declare const setUnidentifiedAccessKeyMutation: import("convex/server").RegisteredMutation<"public", {
13
- accessKey: ArrayBuffer;
14
- aciBytes: ArrayBuffer;
15
- pniBytes?: ArrayBuffer | undefined;
16
- userId?: string | undefined;
17
- }, Promise<null>>;
18
- //# sourceMappingURL=zkAuth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zkAuth.d.ts","sourceRoot":"","sources":["../../../../../remote/relay/convex/component/zkAuth.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,2BAA2B;;;;wBAyBtC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;wBAgC5C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;iBAkB3C,CAAC"}
@@ -1,86 +0,0 @@
1
- import { v } from 'convex/values';
2
- import { mutation } from './_generated/server.js';
3
- import { groupServerRuntime, groupServerSecretParams, serviceIds, } from './runtime.js';
4
- import { issueAuthCredential, serializeAuthCredentialResponse, } from '../../../../internal/protocol/zk/groups/auth-credential.js';
5
- import { SECONDS_PER_DAY } from '../../../../internal/protocol/zk/groups/group-params.js';
6
- import { deserializeProfileKeyCredentialRequest, issueProfileKeyCredential, serializeProfileKeyCredentialResponse, } from '../../../../internal/protocol/zk/groups/profile-key-credential.js';
7
- import { rememberAccount, setUnidentifiedAccessKey, } from './accounts.js';
8
- const UNIDENTIFIED_ACCESS_KEY_LENGTH = 16;
9
- const identityArgs = {
10
- userId: v.optional(v.string()),
11
- aciBytes: v.bytes(),
12
- pniBytes: v.optional(v.bytes()),
13
- };
14
- function toArrayBuffer(value) {
15
- return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength);
16
- }
17
- function requireAccessKey(value) {
18
- const accessKey = new Uint8Array(value);
19
- if (accessKey.length !== UNIDENTIFIED_ACCESS_KEY_LENGTH) {
20
- throw new Error(`accessKey must be ${UNIDENTIFIED_ACCESS_KEY_LENGTH} bytes`);
21
- }
22
- return accessKey;
23
- }
24
- export const issueAuthCredentialMutation = mutation({
25
- args: identityArgs,
26
- returns: v.bytes(),
27
- handler: async (ctx, input) => {
28
- const { aci, pni } = serviceIds(input);
29
- if (input.userId !== undefined) {
30
- await rememberAccount(ctx, {
31
- callerUserId: input.userId,
32
- callerAciBytes: input.aciBytes,
33
- callerPniBytes: input.pniBytes,
34
- });
35
- }
36
- const runtime = groupServerRuntime();
37
- const nowSeconds = Math.floor(runtime.now() / 1000);
38
- const redemptionTime = Math.floor(nowSeconds / SECONDS_PER_DAY) * SECONDS_PER_DAY;
39
- const response = issueAuthCredential(groupServerSecretParams().credentialKeyPair, aci, pni, redemptionTime, runtime.randomBytes(32));
40
- return toArrayBuffer(serializeAuthCredentialResponse(response));
41
- },
42
- });
43
- export const issueProfileKeyCredentialMutation = mutation({
44
- args: {
45
- ...identityArgs,
46
- request: v.bytes(),
47
- },
48
- returns: v.bytes(),
49
- handler: async (ctx, input) => {
50
- const { aci } = serviceIds(input);
51
- if (input.userId !== undefined) {
52
- await rememberAccount(ctx, {
53
- callerUserId: input.userId,
54
- callerAciBytes: input.aciBytes,
55
- callerPniBytes: input.pniBytes,
56
- });
57
- }
58
- const request = deserializeProfileKeyCredentialRequest(new Uint8Array(input.request));
59
- const runtime = groupServerRuntime();
60
- const nowSeconds = Math.floor(runtime.now() / 1000);
61
- const redemptionTime = Math.floor(nowSeconds / SECONDS_PER_DAY) * SECONDS_PER_DAY +
62
- 2 * SECONDS_PER_DAY;
63
- const response = issueProfileKeyCredential(groupServerSecretParams().profileKeyCredentialKeyPair, aci, request, redemptionTime, runtime.randomBytes(32));
64
- return toArrayBuffer(serializeProfileKeyCredentialResponse(response));
65
- },
66
- });
67
- export const setUnidentifiedAccessKeyMutation = mutation({
68
- args: {
69
- ...identityArgs,
70
- accessKey: v.bytes(),
71
- },
72
- returns: v.null(),
73
- handler: async (ctx, input) => {
74
- if (input.userId === undefined) {
75
- throw new Error('Authenticated userId is required');
76
- }
77
- await rememberAccount(ctx, {
78
- callerUserId: input.userId,
79
- callerAciBytes: input.aciBytes,
80
- callerPniBytes: input.pniBytes,
81
- });
82
- await setUnidentifiedAccessKey(ctx, input.userId, requireAccessKey(input.accessKey));
83
- return null;
84
- },
85
- });
86
- //# sourceMappingURL=zkAuth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zkAuth.js","sourceRoot":"","sources":["../../../../../remote/relay/convex/component/zkAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AACvF,OAAO,EACL,sCAAsC,EACtC,yBAAyB,EACzB,qCAAqC,GACtC,MAAM,gEAAgE,CAAC;AACxE,OAAO,EACL,eAAe,EACf,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;CAChC,CAAC;AAEF,SAAS,aAAa,CAAC,KAAiB;IACtC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CACvB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CACrB,CAAC;AACnB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAkB;IAC1C,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,SAAS,CAAC,MAAM,KAAK,8BAA8B,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,qBAAqB,8BAA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,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,eAAe,CAAC,GAAG,EAAE;YACzB,YAAY,EAAE,KAAK,CAAC,MAAM;YAC1B,cAAc,EAAE,KAAK,CAAC,QAAQ;YAC9B,cAAc,EAAE,KAAK,CAAC,QAAQ;SAC/B,CAAC,CAAC;QACH,MAAM,wBAAwB,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- /** Convex environment variable containing the deployment's base64 32-byte seed. */
2
- export declare const CONVEX_GROUP_SERVER_SECRET_ENV_VAR = "OE_GROUPS_SERVER_SECRET";
3
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../remote/relay/convex/constants.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,eAAO,MAAM,kCAAkC,4BACpB,CAAC"}
@@ -1,3 +0,0 @@
1
- /** Convex environment variable containing the deployment's base64 32-byte seed. */
2
- export const CONVEX_GROUP_SERVER_SECRET_ENV_VAR = 'OE_GROUPS_SERVER_SECRET';
3
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../remote/relay/convex/constants.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,kCAAkC,GAC7C,yBAAyB,CAAC"}
@@ -1,123 +0,0 @@
1
- /**
2
- * ConvexGroupServer
3
- *
4
- * Implementation of IGroupServer using Convex mutations/queries for
5
- * server-side encrypted group state storage.
6
- *
7
- * This is a client transport adapter, not an enforcing group server. The
8
- * application-supplied Convex functions must implement the enforcing-server
9
- * obligations. This adapter bridges IGroupServer (Uint8Array) to Convex
10
- * v.bytes() (ArrayBuffer).
11
- *
12
- * The application supplies its generated Convex function references. Those
13
- * functions retain responsibility for authentication, authorization, and
14
- * persistence policy.
15
- */
16
- import type { ConvexReactClient } from 'convex/react';
17
- import type { ConvexHttpClient } from 'convex/browser';
18
- import type { FunctionReference } from 'convex/server';
19
- import type { IGroupServer, GroupAuthorization, GroupChangeLogEntry, GroupChangeLogPage, GroupSnapshot } from '../../../internal/groups/manager.js';
20
- /**
21
- * Either ConvexReactClient or ConvexHttpClient can be used.
22
- * This allows the adapter to work in both React contexts and background tasks.
23
- */
24
- export {};
25
- type ConvexClient = ConvexReactClient | ConvexHttpClient;
26
- export interface ConvexGroupServerApi {
27
- createGroup: FunctionReference<'mutation'>;
28
- getGroup: FunctionReference<'query'>;
29
- getGroupJoinInfo: FunctionReference<'query'>;
30
- getGroupChanges: FunctionReference<'query'>;
31
- submitGroupChange: FunctionReference<'mutation'>;
32
- }
33
- /**
34
- * ConvexGroupServer - Implementation of IGroupServer
35
- *
36
- * Bridges IGroupServer (Uint8Array-based) to Convex group mutations/queries
37
- * (ArrayBuffer-based). All binary conversion happens at this boundary.
38
- *
39
- * @example
40
- * ```typescript
41
- * import { ConvexReactClient } from 'convex/react';
42
- * import {
43
- * ConvexGroupServer,
44
- * type ConvexGroupServerApi,
45
- * } from '@open-e2ee/signal-protocol-sdk/remote/relay/convex';
46
- * import { api } from '../convex/_generated/api';
47
- *
48
- * const convex = new ConvexReactClient(process.env.CONVEX_URL!);
49
- * const groupApi = api.signal.groups satisfies ConvexGroupServerApi;
50
- * const groupServer = new ConvexGroupServer(convex, groupApi);
51
- *
52
- * // Use with GroupManager
53
- * const manager = new GroupManager({
54
- * server: groupServer,
55
- * store: localStore,
56
- * ...
57
- * });
58
- * ```
59
- */
60
- export declare class ConvexGroupServer implements IGroupServer {
61
- private convex;
62
- private api;
63
- constructor(convex: ConvexClient, api: ConvexGroupServerApi);
64
- /**
65
- * Create a new encrypted group on the server.
66
- *
67
- * @param groupId - 32-byte group identifier (derived from GroupSecretParams)
68
- * @param encryptedState - Serialized EncryptedGroup (JSON with hex-encoded binary fields)
69
- * @param authorization - ZK auth credential presentation + group public params
70
- */
71
- createGroup(groupId: Uint8Array, encryptedState: Uint8Array, authorization: GroupAuthorization): Promise<void>;
72
- /**
73
- * Get encrypted group state from the server.
74
- *
75
- * @param groupId - 32-byte group identifier
76
- * @param authorization - ZK auth credential presentation + group public params
77
- * @param version - Optional exact historical version
78
- * @returns Encrypted state and version, or null if group/version does not exist
79
- */
80
- getGroup(groupId: Uint8Array, authorization: GroupAuthorization, version?: number): Promise<GroupSnapshot | null>;
81
- getGroupJoinInfo(groupId: Uint8Array, inviteLinkPassword: Uint8Array, authorization: GroupAuthorization): Promise<{
82
- encryptedJoinInfo: Uint8Array;
83
- version: number;
84
- } | null>;
85
- /**
86
- * Get one page of change log entries from a given version.
87
- *
88
- * Used for incremental group state sync. The enforcing backend authorizes
89
- * at the requested snapshot, requires the requester to be a member there.
90
- * Pending principals catch up by snapshot instead (S10a). It returns
91
- * changes through the first transition that revokes the requester,
92
- * inclusive. A page cut for size sets `hasMore`. Resume from the last
93
- * served version.
94
- *
95
- * @param groupId - 32-byte group identifier
96
- * @param fromVersion - Version to start from (exclusive)
97
- * @param authorization - ZK auth credential presentation + group public params
98
- * @returns One change-log page with encrypted changes and server signatures
99
- */
100
- getGroupChanges(groupId: Uint8Array, fromVersion: number, authorization: GroupAuthorization): Promise<GroupChangeLogPage>;
101
- /**
102
- * Submit a group change with optimistic concurrency control.
103
- *
104
- * The application server validates and applies the ciphertext Actions,
105
- * signs the exact accepted bytes, and stores the transition atomically.
106
- *
107
- * @param groupId - 32-byte group identifier
108
- * @param expectedVersion - Current version for optimistic concurrency
109
- * @param actions - Client-proposed serialized encrypted Actions
110
- * @param inviteLinkPassword - Independently verified link-join credential
111
- * @param authorization - ZK auth credential presentation + group public params
112
- * @returns Exact accepted Actions and their server signature
113
- */
114
- submitGroupChange(groupId: Uint8Array, expectedVersion: number, actions: Uint8Array, inviteLinkPassword: Uint8Array, authorization: GroupAuthorization): Promise<GroupChangeLogEntry>;
115
- /**
116
- * Convert Uint8Array to ArrayBuffer for Convex v.bytes() args.
117
- *
118
- * Handles the case where the Uint8Array is a view into a larger buffer
119
- * by slicing to the exact byte range.
120
- */
121
- private toBytes;
122
- }
123
- //# sourceMappingURL=group-server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"group-server.d.ts","sourceRoot":"","sources":["../../../../remote/relay/convex/group-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACd,MAAM,kCAAkC,CAAC;AAE1C;;;GAGG;AACH,OAAO,EAAE,CAAC;AACV,KAAK,YAAY,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3C,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACrC,gBAAgB,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC7C,eAAe,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5C,iBAAiB,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IAElD,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,GAAG;IAFb,YACU,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,oBAAoB,EAC/B;IAMJ;;;;;;OAMG;IACG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