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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1594) hide show
  1. package/ADAPTERS.md +195 -0
  2. package/ARCHITECTURE.md +206 -0
  3. package/CHANGELOG.md +13 -0
  4. package/LICENSE +661 -0
  5. package/NOTICE +27 -0
  6. package/README.md +152 -0
  7. package/SECURITY.md +125 -0
  8. package/THIRD_PARTY_NOTICES.md +31 -0
  9. package/TROUBLESHOOTING.md +203 -0
  10. package/blocking/README.md +42 -0
  11. package/client/README.md +169 -0
  12. package/device/README.md +166 -0
  13. package/dist/blocking/index.d.ts +4 -0
  14. package/dist/blocking/index.d.ts.map +1 -0
  15. package/dist/blocking/index.js +2 -0
  16. package/dist/blocking/index.js.map +1 -0
  17. package/dist/blocking/manager.d.ts +27 -0
  18. package/dist/blocking/manager.d.ts.map +1 -0
  19. package/dist/blocking/manager.js +61 -0
  20. package/dist/blocking/manager.js.map +1 -0
  21. package/dist/blocking/types.d.ts +43 -0
  22. package/dist/blocking/types.d.ts.map +1 -0
  23. package/dist/blocking/types.js +9 -0
  24. package/dist/blocking/types.js.map +1 -0
  25. package/dist/client/client.d.ts +1281 -0
  26. package/dist/client/client.d.ts.map +1 -0
  27. package/dist/client/client.js +2296 -0
  28. package/dist/client/client.js.map +1 -0
  29. package/dist/client/compose.d.ts +105 -0
  30. package/dist/client/compose.d.ts.map +1 -0
  31. package/dist/client/compose.js +41 -0
  32. package/dist/client/compose.js.map +1 -0
  33. package/dist/client/config.d.ts +707 -0
  34. package/dist/client/config.d.ts.map +1 -0
  35. package/dist/client/config.js +19 -0
  36. package/dist/client/config.js.map +1 -0
  37. package/dist/client/constants.d.ts +48 -0
  38. package/dist/client/constants.d.ts.map +1 -0
  39. package/dist/client/constants.js +40 -0
  40. package/dist/client/constants.js.map +1 -0
  41. package/dist/client/content-adapter.d.ts +106 -0
  42. package/dist/client/content-adapter.d.ts.map +1 -0
  43. package/dist/client/content-adapter.js +423 -0
  44. package/dist/client/content-adapter.js.map +1 -0
  45. package/dist/client/dual-store.d.ts +70 -0
  46. package/dist/client/dual-store.d.ts.map +1 -0
  47. package/dist/client/dual-store.js +123 -0
  48. package/dist/client/dual-store.js.map +1 -0
  49. package/dist/client/endorsement-manager.d.ts +143 -0
  50. package/dist/client/endorsement-manager.d.ts.map +1 -0
  51. package/dist/client/endorsement-manager.js +259 -0
  52. package/dist/client/endorsement-manager.js.map +1 -0
  53. package/dist/client/event-hooks.d.ts +330 -0
  54. package/dist/client/event-hooks.d.ts.map +1 -0
  55. package/dist/client/event-hooks.js +59 -0
  56. package/dist/client/event-hooks.js.map +1 -0
  57. package/dist/client/files.d.ts +73 -0
  58. package/dist/client/files.d.ts.map +1 -0
  59. package/dist/client/files.js +192 -0
  60. package/dist/client/files.js.map +1 -0
  61. package/dist/client/groups.d.ts +204 -0
  62. package/dist/client/groups.d.ts.map +1 -0
  63. package/dist/client/groups.js +340 -0
  64. package/dist/client/groups.js.map +1 -0
  65. package/dist/client/headless.d.ts +99 -0
  66. package/dist/client/headless.d.ts.map +1 -0
  67. package/dist/client/headless.js +163 -0
  68. package/dist/client/headless.js.map +1 -0
  69. package/dist/client/index.d.ts +33 -0
  70. package/dist/client/index.d.ts.map +1 -0
  71. package/dist/client/index.js +7 -0
  72. package/dist/client/index.js.map +1 -0
  73. package/dist/client/key-rotation-core.d.ts +167 -0
  74. package/dist/client/key-rotation-core.d.ts.map +1 -0
  75. package/dist/client/key-rotation-core.js +459 -0
  76. package/dist/client/key-rotation-core.js.map +1 -0
  77. package/dist/client/key-rotation.d.ts +45 -0
  78. package/dist/client/key-rotation.d.ts.map +1 -0
  79. package/dist/client/key-rotation.js +174 -0
  80. package/dist/client/key-rotation.js.map +1 -0
  81. package/dist/client/media.d.ts +173 -0
  82. package/dist/client/media.d.ts.map +1 -0
  83. package/dist/client/media.js +476 -0
  84. package/dist/client/media.js.map +1 -0
  85. package/dist/client/messages.d.ts +131 -0
  86. package/dist/client/messages.d.ts.map +1 -0
  87. package/dist/client/messages.js +546 -0
  88. package/dist/client/messages.js.map +1 -0
  89. package/dist/client/multi-device.d.ts +73 -0
  90. package/dist/client/multi-device.d.ts.map +1 -0
  91. package/dist/client/multi-device.js +104 -0
  92. package/dist/client/multi-device.js.map +1 -0
  93. package/dist/client/prekeys.d.ts +133 -0
  94. package/dist/client/prekeys.d.ts.map +1 -0
  95. package/dist/client/prekeys.js +608 -0
  96. package/dist/client/prekeys.js.map +1 -0
  97. package/dist/client/relay-subscription.d.ts +83 -0
  98. package/dist/client/relay-subscription.d.ts.map +1 -0
  99. package/dist/client/relay-subscription.js +353 -0
  100. package/dist/client/relay-subscription.js.map +1 -0
  101. package/dist/client/retry-utils.d.ts +42 -0
  102. package/dist/client/retry-utils.d.ts.map +1 -0
  103. package/dist/client/retry-utils.js +107 -0
  104. package/dist/client/retry-utils.js.map +1 -0
  105. package/dist/client/retry.d.ts +121 -0
  106. package/dist/client/retry.d.ts.map +1 -0
  107. package/dist/client/retry.js +499 -0
  108. package/dist/client/retry.js.map +1 -0
  109. package/dist/client/sealed-sender-ops.d.ts +61 -0
  110. package/dist/client/sealed-sender-ops.d.ts.map +1 -0
  111. package/dist/client/sealed-sender-ops.js +173 -0
  112. package/dist/client/sealed-sender-ops.js.map +1 -0
  113. package/dist/client/sessions.d.ts +108 -0
  114. package/dist/client/sessions.d.ts.map +1 -0
  115. package/dist/client/sessions.js +367 -0
  116. package/dist/client/sessions.js.map +1 -0
  117. package/dist/client/signal-service-cipher.d.ts +331 -0
  118. package/dist/client/signal-service-cipher.d.ts.map +1 -0
  119. package/dist/client/signal-service-cipher.js +1506 -0
  120. package/dist/client/signal-service-cipher.js.map +1 -0
  121. package/dist/client/state.d.ts +147 -0
  122. package/dist/client/state.d.ts.map +1 -0
  123. package/dist/client/state.js +226 -0
  124. package/dist/client/state.js.map +1 -0
  125. package/dist/client/types.d.ts +423 -0
  126. package/dist/client/types.d.ts.map +1 -0
  127. package/dist/client/types.js +42 -0
  128. package/dist/client/types.js.map +1 -0
  129. package/dist/device/connection.d.ts +46 -0
  130. package/dist/device/connection.d.ts.map +1 -0
  131. package/dist/device/connection.js +239 -0
  132. package/dist/device/connection.js.map +1 -0
  133. package/dist/device/constants.d.ts +69 -0
  134. package/dist/device/constants.d.ts.map +1 -0
  135. package/dist/device/constants.js +64 -0
  136. package/dist/device/constants.js.map +1 -0
  137. package/dist/device/device-id.d.ts +45 -0
  138. package/dist/device/device-id.d.ts.map +1 -0
  139. package/dist/device/device-id.js +87 -0
  140. package/dist/device/device-id.js.map +1 -0
  141. package/dist/device/device-name-crypto.d.ts +39 -0
  142. package/dist/device/device-name-crypto.d.ts.map +1 -0
  143. package/dist/device/device-name-crypto.js +165 -0
  144. package/dist/device/device-name-crypto.js.map +1 -0
  145. package/dist/device/index.d.ts +31 -0
  146. package/dist/device/index.d.ts.map +1 -0
  147. package/dist/device/index.js +35 -0
  148. package/dist/device/index.js.map +1 -0
  149. package/dist/device/lifecycle/index.d.ts +25 -0
  150. package/dist/device/lifecycle/index.d.ts.map +1 -0
  151. package/dist/device/lifecycle/index.js +3 -0
  152. package/dist/device/lifecycle/index.js.map +1 -0
  153. package/dist/device/lifecycle/manager.d.ts +273 -0
  154. package/dist/device/lifecycle/manager.d.ts.map +1 -0
  155. package/dist/device/lifecycle/manager.js +1229 -0
  156. package/dist/device/lifecycle/manager.js.map +1 -0
  157. package/dist/device/lifecycle/types.d.ts +372 -0
  158. package/dist/device/lifecycle/types.d.ts.map +1 -0
  159. package/dist/device/lifecycle/types.js +10 -0
  160. package/dist/device/lifecycle/types.js.map +1 -0
  161. package/dist/device/lifecycle/utils.d.ts +37 -0
  162. package/dist/device/lifecycle/utils.d.ts.map +1 -0
  163. package/dist/device/lifecycle/utils.js +79 -0
  164. package/dist/device/lifecycle/utils.js.map +1 -0
  165. package/dist/device/provisioning.d.ts +249 -0
  166. package/dist/device/provisioning.d.ts.map +1 -0
  167. package/dist/device/provisioning.js +439 -0
  168. package/dist/device/provisioning.js.map +1 -0
  169. package/dist/device/transfer.d.ts +231 -0
  170. package/dist/device/transfer.d.ts.map +1 -0
  171. package/dist/device/transfer.js +628 -0
  172. package/dist/device/transfer.js.map +1 -0
  173. package/dist/device/types.d.ts +275 -0
  174. package/dist/device/types.d.ts.map +1 -0
  175. package/dist/device/types.js +42 -0
  176. package/dist/device/types.js.map +1 -0
  177. package/dist/encoding/base64.d.ts +14 -0
  178. package/dist/encoding/base64.d.ts.map +1 -0
  179. package/dist/encoding/base64.js +2 -0
  180. package/dist/encoding/base64.js.map +1 -0
  181. package/dist/encoding/hex.d.ts +14 -0
  182. package/dist/encoding/hex.d.ts.map +1 -0
  183. package/dist/encoding/hex.js +2 -0
  184. package/dist/encoding/hex.js.map +1 -0
  185. package/dist/encoding/index.d.ts +17 -0
  186. package/dist/encoding/index.d.ts.map +1 -0
  187. package/dist/encoding/index.js +3 -0
  188. package/dist/encoding/index.js.map +1 -0
  189. package/dist/files/index.d.ts +16 -0
  190. package/dist/files/index.d.ts.map +1 -0
  191. package/dist/files/index.js +15 -0
  192. package/dist/files/index.js.map +1 -0
  193. package/dist/groups/index.d.ts +12 -0
  194. package/dist/groups/index.d.ts.map +1 -0
  195. package/dist/groups/index.js +9 -0
  196. package/dist/groups/index.js.map +1 -0
  197. package/dist/hooks/index.d.ts +20 -0
  198. package/dist/hooks/index.d.ts.map +1 -0
  199. package/dist/hooks/index.js +6 -0
  200. package/dist/hooks/index.js.map +1 -0
  201. package/dist/hooks/use-connection-presence.d.ts +68 -0
  202. package/dist/hooks/use-connection-presence.d.ts.map +1 -0
  203. package/dist/hooks/use-connection-presence.js +300 -0
  204. package/dist/hooks/use-connection-presence.js.map +1 -0
  205. package/dist/hooks/use-group-membership.d.ts +66 -0
  206. package/dist/hooks/use-group-membership.d.ts.map +1 -0
  207. package/dist/hooks/use-group-membership.js +156 -0
  208. package/dist/hooks/use-group-membership.js.map +1 -0
  209. package/dist/hooks/use-key-rotation.d.ts +119 -0
  210. package/dist/hooks/use-key-rotation.d.ts.map +1 -0
  211. package/dist/hooks/use-key-rotation.js +198 -0
  212. package/dist/hooks/use-key-rotation.js.map +1 -0
  213. package/dist/hooks/use-session-health.d.ts +51 -0
  214. package/dist/hooks/use-session-health.d.ts.map +1 -0
  215. package/dist/hooks/use-session-health.js +59 -0
  216. package/dist/hooks/use-session-health.js.map +1 -0
  217. package/dist/hooks/use-single-flight.d.ts +29 -0
  218. package/dist/hooks/use-single-flight.d.ts.map +1 -0
  219. package/dist/hooks/use-single-flight.js +59 -0
  220. package/dist/hooks/use-single-flight.js.map +1 -0
  221. package/dist/index.d.ts +203 -0
  222. package/dist/index.d.ts.map +1 -0
  223. package/dist/index.js +169 -0
  224. package/dist/index.js.map +1 -0
  225. package/dist/internal/crypto/ec/ed25519.d.ts +78 -0
  226. package/dist/internal/crypto/ec/ed25519.d.ts.map +1 -0
  227. package/dist/internal/crypto/ec/ed25519.js +108 -0
  228. package/dist/internal/crypto/ec/ed25519.js.map +1 -0
  229. package/dist/internal/crypto/ec/index.d.ts +5 -0
  230. package/dist/internal/crypto/ec/index.d.ts.map +1 -0
  231. package/dist/internal/crypto/ec/index.js +4 -0
  232. package/dist/internal/crypto/ec/index.js.map +1 -0
  233. package/dist/internal/crypto/ec/x25519-validation.d.ts +70 -0
  234. package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -0
  235. package/dist/internal/crypto/ec/x25519-validation.js +137 -0
  236. package/dist/internal/crypto/ec/x25519-validation.js.map +1 -0
  237. package/dist/internal/crypto/ec/x25519.d.ts +91 -0
  238. package/dist/internal/crypto/ec/x25519.d.ts.map +1 -0
  239. package/dist/internal/crypto/ec/x25519.js +124 -0
  240. package/dist/internal/crypto/ec/x25519.js.map +1 -0
  241. package/dist/internal/crypto/hash/index.d.ts +4 -0
  242. package/dist/internal/crypto/hash/index.d.ts.map +1 -0
  243. package/dist/internal/crypto/hash/index.js +3 -0
  244. package/dist/internal/crypto/hash/index.js.map +1 -0
  245. package/dist/internal/crypto/hash/sha256.d.ts +24 -0
  246. package/dist/internal/crypto/hash/sha256.d.ts.map +1 -0
  247. package/dist/internal/crypto/hash/sha256.js +23 -0
  248. package/dist/internal/crypto/hash/sha256.js.map +1 -0
  249. package/dist/internal/crypto/hash/sha512.d.ts +16 -0
  250. package/dist/internal/crypto/hash/sha512.d.ts.map +1 -0
  251. package/dist/internal/crypto/hash/sha512.js +27 -0
  252. package/dist/internal/crypto/hash/sha512.js.map +1 -0
  253. package/dist/internal/crypto/index.d.ts +60 -0
  254. package/dist/internal/crypto/index.d.ts.map +1 -0
  255. package/dist/internal/crypto/index.js +107 -0
  256. package/dist/internal/crypto/index.js.map +1 -0
  257. package/dist/internal/crypto/kdf/hkdf.d.ts +300 -0
  258. package/dist/internal/crypto/kdf/hkdf.d.ts.map +1 -0
  259. package/dist/internal/crypto/kdf/hkdf.js +452 -0
  260. package/dist/internal/crypto/kdf/hkdf.js.map +1 -0
  261. package/dist/internal/crypto/kdf/index.d.ts +4 -0
  262. package/dist/internal/crypto/kdf/index.d.ts.map +1 -0
  263. package/dist/internal/crypto/kdf/index.js +3 -0
  264. package/dist/internal/crypto/kdf/index.js.map +1 -0
  265. package/dist/internal/crypto/kdf/pbkdf2.d.ts +42 -0
  266. package/dist/internal/crypto/kdf/pbkdf2.d.ts.map +1 -0
  267. package/dist/internal/crypto/kdf/pbkdf2.js +44 -0
  268. package/dist/internal/crypto/kdf/pbkdf2.js.map +1 -0
  269. package/dist/internal/crypto/key-prefix.d.ts +82 -0
  270. package/dist/internal/crypto/key-prefix.d.ts.map +1 -0
  271. package/dist/internal/crypto/key-prefix.js +116 -0
  272. package/dist/internal/crypto/key-prefix.js.map +1 -0
  273. package/dist/internal/crypto/pq/index.d.ts +3 -0
  274. package/dist/internal/crypto/pq/index.d.ts.map +1 -0
  275. package/dist/internal/crypto/pq/index.js +2 -0
  276. package/dist/internal/crypto/pq/index.js.map +1 -0
  277. package/dist/internal/crypto/pq/kyber.d.ts +232 -0
  278. package/dist/internal/crypto/pq/kyber.d.ts.map +1 -0
  279. package/dist/internal/crypto/pq/kyber.js +317 -0
  280. package/dist/internal/crypto/pq/kyber.js.map +1 -0
  281. package/dist/internal/crypto/random.d.ts +22 -0
  282. package/dist/internal/crypto/random.d.ts.map +1 -0
  283. package/dist/internal/crypto/random.js +45 -0
  284. package/dist/internal/crypto/random.js.map +1 -0
  285. package/dist/internal/crypto/symmetric/aes-ctr.d.ts +73 -0
  286. package/dist/internal/crypto/symmetric/aes-ctr.d.ts.map +1 -0
  287. package/dist/internal/crypto/symmetric/aes-ctr.js +98 -0
  288. package/dist/internal/crypto/symmetric/aes-ctr.js.map +1 -0
  289. package/dist/internal/crypto/symmetric/aes-gcm-siv.d.ts +77 -0
  290. package/dist/internal/crypto/symmetric/aes-gcm-siv.d.ts.map +1 -0
  291. package/dist/internal/crypto/symmetric/aes-gcm-siv.js +111 -0
  292. package/dist/internal/crypto/symmetric/aes-gcm-siv.js.map +1 -0
  293. package/dist/internal/crypto/symmetric/aes.d.ts +211 -0
  294. package/dist/internal/crypto/symmetric/aes.d.ts.map +1 -0
  295. package/dist/internal/crypto/symmetric/aes.js +386 -0
  296. package/dist/internal/crypto/symmetric/aes.js.map +1 -0
  297. package/dist/internal/crypto/symmetric/hmac.d.ts +32 -0
  298. package/dist/internal/crypto/symmetric/hmac.d.ts.map +1 -0
  299. package/dist/internal/crypto/symmetric/hmac.js +20 -0
  300. package/dist/internal/crypto/symmetric/hmac.js.map +1 -0
  301. package/dist/internal/crypto/symmetric/index.d.ts +9 -0
  302. package/dist/internal/crypto/symmetric/index.d.ts.map +1 -0
  303. package/dist/internal/crypto/symmetric/index.js +8 -0
  304. package/dist/internal/crypto/symmetric/index.js.map +1 -0
  305. package/dist/internal/crypto/symmetric/mac.d.ts +154 -0
  306. package/dist/internal/crypto/symmetric/mac.d.ts.map +1 -0
  307. package/dist/internal/crypto/symmetric/mac.js +292 -0
  308. package/dist/internal/crypto/symmetric/mac.js.map +1 -0
  309. package/dist/internal/crypto/symmetric/padding.d.ts +55 -0
  310. package/dist/internal/crypto/symmetric/padding.d.ts.map +1 -0
  311. package/dist/internal/crypto/symmetric/padding.js +90 -0
  312. package/dist/internal/crypto/symmetric/padding.js.map +1 -0
  313. package/dist/internal/crypto/symmetric/streaming-aead.d.ts +89 -0
  314. package/dist/internal/crypto/symmetric/streaming-aead.d.ts.map +1 -0
  315. package/dist/internal/crypto/symmetric/streaming-aead.js +253 -0
  316. package/dist/internal/crypto/symmetric/streaming-aead.js.map +1 -0
  317. package/dist/internal/crypto/utils.d.ts +119 -0
  318. package/dist/internal/crypto/utils.d.ts.map +1 -0
  319. package/dist/internal/crypto/utils.js +366 -0
  320. package/dist/internal/crypto/utils.js.map +1 -0
  321. package/dist/internal/crypto/validation.d.ts +45 -0
  322. package/dist/internal/crypto/validation.d.ts.map +1 -0
  323. package/dist/internal/crypto/validation.js +37 -0
  324. package/dist/internal/crypto/validation.js.map +1 -0
  325. package/dist/internal/encoding/index.d.ts +2 -0
  326. package/dist/internal/encoding/index.d.ts.map +1 -0
  327. package/dist/internal/encoding/index.js +2 -0
  328. package/dist/internal/encoding/index.js.map +1 -0
  329. package/dist/internal/encoding/proto/envelope.d.ts +120 -0
  330. package/dist/internal/encoding/proto/envelope.d.ts.map +1 -0
  331. package/dist/internal/encoding/proto/envelope.js +160 -0
  332. package/dist/internal/encoding/proto/envelope.js.map +1 -0
  333. package/dist/internal/encoding/proto/index.d.ts +25 -0
  334. package/dist/internal/encoding/proto/index.d.ts.map +1 -0
  335. package/dist/internal/encoding/proto/index.js +30 -0
  336. package/dist/internal/encoding/proto/index.js.map +1 -0
  337. package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts +118 -0
  338. package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts.map +1 -0
  339. package/dist/internal/encoding/proto/pq-ratchet-serialize.js +383 -0
  340. package/dist/internal/encoding/proto/pq-ratchet-serialize.js.map +1 -0
  341. package/dist/internal/encoding/proto/primitives.d.ts +98 -0
  342. package/dist/internal/encoding/proto/primitives.d.ts.map +1 -0
  343. package/dist/internal/encoding/proto/primitives.js +179 -0
  344. package/dist/internal/encoding/proto/primitives.js.map +1 -0
  345. package/dist/internal/encoding/proto/sender-key-message.d.ts +147 -0
  346. package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -0
  347. package/dist/internal/encoding/proto/sender-key-message.js +220 -0
  348. package/dist/internal/encoding/proto/sender-key-message.js.map +1 -0
  349. package/dist/internal/encoding/proto/signal-message.d.ts +174 -0
  350. package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -0
  351. package/dist/internal/encoding/proto/signal-message.js +372 -0
  352. package/dist/internal/encoding/proto/signal-message.js.map +1 -0
  353. package/dist/internal/groups/group-id.d.ts +74 -0
  354. package/dist/internal/groups/group-id.d.ts.map +1 -0
  355. package/dist/internal/groups/group-id.js +63 -0
  356. package/dist/internal/groups/group-id.js.map +1 -0
  357. package/dist/internal/groups/index.d.ts +15 -0
  358. package/dist/internal/groups/index.d.ts.map +1 -0
  359. package/dist/internal/groups/index.js +2 -0
  360. package/dist/internal/groups/index.js.map +1 -0
  361. package/dist/internal/groups-v2/access-control.d.ts +101 -0
  362. package/dist/internal/groups-v2/access-control.d.ts.map +1 -0
  363. package/dist/internal/groups-v2/access-control.js +184 -0
  364. package/dist/internal/groups-v2/access-control.js.map +1 -0
  365. package/dist/internal/groups-v2/change-actions.d.ts +35 -0
  366. package/dist/internal/groups-v2/change-actions.d.ts.map +1 -0
  367. package/dist/internal/groups-v2/change-actions.js +358 -0
  368. package/dist/internal/groups-v2/change-actions.js.map +1 -0
  369. package/dist/internal/groups-v2/encrypted-state.d.ts +121 -0
  370. package/dist/internal/groups-v2/encrypted-state.d.ts.map +1 -0
  371. package/dist/internal/groups-v2/encrypted-state.js +455 -0
  372. package/dist/internal/groups-v2/encrypted-state.js.map +1 -0
  373. package/dist/internal/groups-v2/index.d.ts +14 -0
  374. package/dist/internal/groups-v2/index.d.ts.map +1 -0
  375. package/dist/internal/groups-v2/index.js +11 -0
  376. package/dist/internal/groups-v2/index.js.map +1 -0
  377. package/dist/internal/groups-v2/invite-link.d.ts +55 -0
  378. package/dist/internal/groups-v2/invite-link.d.ts.map +1 -0
  379. package/dist/internal/groups-v2/invite-link.js +111 -0
  380. package/dist/internal/groups-v2/invite-link.js.map +1 -0
  381. package/dist/internal/groups-v2/manager.d.ts +351 -0
  382. package/dist/internal/groups-v2/manager.d.ts.map +1 -0
  383. package/dist/internal/groups-v2/manager.js +1093 -0
  384. package/dist/internal/groups-v2/manager.js.map +1 -0
  385. package/dist/internal/groups-v2/types.d.ts +371 -0
  386. package/dist/internal/groups-v2/types.d.ts.map +1 -0
  387. package/dist/internal/groups-v2/types.js +61 -0
  388. package/dist/internal/groups-v2/types.js.map +1 -0
  389. package/dist/internal/manager/index.d.ts +16 -0
  390. package/dist/internal/manager/index.d.ts.map +1 -0
  391. package/dist/internal/manager/index.js +2 -0
  392. package/dist/internal/manager/index.js.map +1 -0
  393. package/dist/internal/manager/manager.d.ts +378 -0
  394. package/dist/internal/manager/manager.d.ts.map +1 -0
  395. package/dist/internal/manager/manager.js +1079 -0
  396. package/dist/internal/manager/manager.js.map +1 -0
  397. package/dist/internal/protocol/double-ratchet/chains.d.ts +135 -0
  398. package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -0
  399. package/dist/internal/protocol/double-ratchet/chains.js +417 -0
  400. package/dist/internal/protocol/double-ratchet/chains.js.map +1 -0
  401. package/dist/internal/protocol/double-ratchet/index.d.ts +20 -0
  402. package/dist/internal/protocol/double-ratchet/index.d.ts.map +1 -0
  403. package/dist/internal/protocol/double-ratchet/index.js +21 -0
  404. package/dist/internal/protocol/double-ratchet/index.js.map +1 -0
  405. package/dist/internal/protocol/double-ratchet/ratchet.d.ts +231 -0
  406. package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -0
  407. package/dist/internal/protocol/double-ratchet/ratchet.js +198 -0
  408. package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -0
  409. package/dist/internal/protocol/index.d.ts +24 -0
  410. package/dist/internal/protocol/index.d.ts.map +1 -0
  411. package/dist/internal/protocol/index.js +9 -0
  412. package/dist/internal/protocol/index.js.map +1 -0
  413. package/dist/internal/protocol/pqxdh/index.d.ts +19 -0
  414. package/dist/internal/protocol/pqxdh/index.d.ts.map +1 -0
  415. package/dist/internal/protocol/pqxdh/index.js +16 -0
  416. package/dist/internal/protocol/pqxdh/index.js.map +1 -0
  417. package/dist/internal/protocol/pqxdh/pqxdh.d.ts +141 -0
  418. package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -0
  419. package/dist/internal/protocol/pqxdh/pqxdh.js +399 -0
  420. package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -0
  421. package/dist/internal/protocol/sealed-sender/certificate.d.ts +94 -0
  422. package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -0
  423. package/dist/internal/protocol/sealed-sender/certificate.js +254 -0
  424. package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -0
  425. package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts +46 -0
  426. package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts.map +1 -0
  427. package/dist/internal/protocol/sealed-sender/decryption-v2.js +184 -0
  428. package/dist/internal/protocol/sealed-sender/decryption-v2.js.map +1 -0
  429. package/dist/internal/protocol/sealed-sender/decryption.d.ts +59 -0
  430. package/dist/internal/protocol/sealed-sender/decryption.d.ts.map +1 -0
  431. package/dist/internal/protocol/sealed-sender/decryption.js +268 -0
  432. package/dist/internal/protocol/sealed-sender/decryption.js.map +1 -0
  433. package/dist/internal/protocol/sealed-sender/delivery-token.d.ts +48 -0
  434. package/dist/internal/protocol/sealed-sender/delivery-token.d.ts.map +1 -0
  435. package/dist/internal/protocol/sealed-sender/delivery-token.js +71 -0
  436. package/dist/internal/protocol/sealed-sender/delivery-token.js.map +1 -0
  437. package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts +56 -0
  438. package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts.map +1 -0
  439. package/dist/internal/protocol/sealed-sender/encryption-v2.js +169 -0
  440. package/dist/internal/protocol/sealed-sender/encryption-v2.js.map +1 -0
  441. package/dist/internal/protocol/sealed-sender/encryption.d.ts +66 -0
  442. package/dist/internal/protocol/sealed-sender/encryption.d.ts.map +1 -0
  443. package/dist/internal/protocol/sealed-sender/encryption.js +174 -0
  444. package/dist/internal/protocol/sealed-sender/encryption.js.map +1 -0
  445. package/dist/internal/protocol/sealed-sender/index.d.ts +23 -0
  446. package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -0
  447. package/dist/internal/protocol/sealed-sender/index.js +61 -0
  448. package/dist/internal/protocol/sealed-sender/index.js.map +1 -0
  449. package/dist/internal/protocol/sealed-sender/proto/index.d.ts +129 -0
  450. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -0
  451. package/dist/internal/protocol/sealed-sender/proto/index.js +267 -0
  452. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -0
  453. package/dist/internal/protocol/sealed-sender/types.d.ts +461 -0
  454. package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -0
  455. package/dist/internal/protocol/sealed-sender/types.js +99 -0
  456. package/dist/internal/protocol/sealed-sender/types.js.map +1 -0
  457. package/dist/internal/protocol/sealed-sender/v2-binary.d.ts +124 -0
  458. package/dist/internal/protocol/sealed-sender/v2-binary.d.ts.map +1 -0
  459. package/dist/internal/protocol/sealed-sender/v2-binary.js +295 -0
  460. package/dist/internal/protocol/sealed-sender/v2-binary.js.map +1 -0
  461. package/dist/internal/protocol/sealed-sender/v2-helpers.d.ts +107 -0
  462. package/dist/internal/protocol/sealed-sender/v2-helpers.d.ts.map +1 -0
  463. package/dist/internal/protocol/sealed-sender/v2-helpers.js +185 -0
  464. package/dist/internal/protocol/sealed-sender/v2-helpers.js.map +1 -0
  465. package/dist/internal/protocol/sender-keys/index.d.ts +11 -0
  466. package/dist/internal/protocol/sender-keys/index.d.ts.map +1 -0
  467. package/dist/internal/protocol/sender-keys/index.js +2 -0
  468. package/dist/internal/protocol/sender-keys/index.js.map +1 -0
  469. package/dist/internal/protocol/sender-keys/manager.d.ts +298 -0
  470. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -0
  471. package/dist/internal/protocol/sender-keys/manager.js +839 -0
  472. package/dist/internal/protocol/sender-keys/manager.js.map +1 -0
  473. package/dist/internal/protocol/spqr/braid-serialize.d.ts +128 -0
  474. package/dist/internal/protocol/spqr/braid-serialize.d.ts.map +1 -0
  475. package/dist/internal/protocol/spqr/braid-serialize.js +373 -0
  476. package/dist/internal/protocol/spqr/braid-serialize.js.map +1 -0
  477. package/dist/internal/protocol/spqr/braid.d.ts +164 -0
  478. package/dist/internal/protocol/spqr/braid.d.ts.map +1 -0
  479. package/dist/internal/protocol/spqr/braid.js +305 -0
  480. package/dist/internal/protocol/spqr/braid.js.map +1 -0
  481. package/dist/internal/protocol/spqr/index.d.ts +161 -0
  482. package/dist/internal/protocol/spqr/index.d.ts.map +1 -0
  483. package/dist/internal/protocol/spqr/index.js +115 -0
  484. package/dist/internal/protocol/spqr/index.js.map +1 -0
  485. package/dist/internal/protocol/spqr/message.d.ts +237 -0
  486. package/dist/internal/protocol/spqr/message.d.ts.map +1 -0
  487. package/dist/internal/protocol/spqr/message.js +298 -0
  488. package/dist/internal/protocol/spqr/message.js.map +1 -0
  489. package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.d.ts +174 -0
  490. package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.d.ts.map +1 -0
  491. package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.js +248 -0
  492. package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.js.map +1 -0
  493. package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.d.ts +29 -0
  494. package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.d.ts.map +1 -0
  495. package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.js +43 -0
  496. package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.js.map +1 -0
  497. package/dist/internal/protocol/spqr/ml-kem-braid/errors.d.ts +170 -0
  498. package/dist/internal/protocol/spqr/ml-kem-braid/errors.d.ts.map +1 -0
  499. package/dist/internal/protocol/spqr/ml-kem-braid/errors.js +249 -0
  500. package/dist/internal/protocol/spqr/ml-kem-braid/errors.js.map +1 -0
  501. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts +84 -0
  502. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts.map +1 -0
  503. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js +138 -0
  504. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js.map +1 -0
  505. package/dist/internal/protocol/spqr/ml-kem-braid/index.d.ts +45 -0
  506. package/dist/internal/protocol/spqr/ml-kem-braid/index.d.ts.map +1 -0
  507. package/dist/internal/protocol/spqr/ml-kem-braid/index.js +94 -0
  508. package/dist/internal/protocol/spqr/ml-kem-braid/index.js.map +1 -0
  509. package/dist/internal/protocol/spqr/ml-kem-braid/kdf.d.ts +52 -0
  510. package/dist/internal/protocol/spqr/ml-kem-braid/kdf.d.ts.map +1 -0
  511. package/dist/internal/protocol/spqr/ml-kem-braid/kdf.js +121 -0
  512. package/dist/internal/protocol/spqr/ml-kem-braid/kdf.js.map +1 -0
  513. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.d.ts +12 -0
  514. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.d.ts.map +1 -0
  515. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.js +15 -0
  516. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.js.map +1 -0
  517. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts +136 -0
  518. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts.map +1 -0
  519. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js +796 -0
  520. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js.map +1 -0
  521. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts +454 -0
  522. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts.map +1 -0
  523. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js +790 -0
  524. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js.map +1 -0
  525. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.d.ts +108 -0
  526. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.d.ts.map +1 -0
  527. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.js +125 -0
  528. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.js.map +1 -0
  529. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.d.ts +12 -0
  530. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.d.ts.map +1 -0
  531. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.js +5 -0
  532. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.js.map +1 -0
  533. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.d.ts +28 -0
  534. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.d.ts.map +1 -0
  535. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.js +13953 -0
  536. package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.js.map +1 -0
  537. package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.d.ts +40 -0
  538. package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.d.ts.map +1 -0
  539. package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.js +52 -0
  540. package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.js.map +1 -0
  541. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.d.ts +151 -0
  542. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.d.ts.map +1 -0
  543. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.js +297 -0
  544. package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.js.map +1 -0
  545. package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.d.ts +97 -0
  546. package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.d.ts.map +1 -0
  547. package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.js +201 -0
  548. package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.js.map +1 -0
  549. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts +249 -0
  550. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts.map +1 -0
  551. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js +731 -0
  552. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js.map +1 -0
  553. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts +127 -0
  554. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts.map +1 -0
  555. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +894 -0
  556. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -0
  557. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +387 -0
  558. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -0
  559. package/dist/internal/protocol/spqr/ml-kem-braid/types.js +121 -0
  560. package/dist/internal/protocol/spqr/ml-kem-braid/types.js.map +1 -0
  561. package/dist/internal/protocol/spqr/serialize.d.ts +149 -0
  562. package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -0
  563. package/dist/internal/protocol/spqr/serialize.js +370 -0
  564. package/dist/internal/protocol/spqr/serialize.js.map +1 -0
  565. package/dist/internal/protocol/spqr/spqr.d.ts +486 -0
  566. package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -0
  567. package/dist/internal/protocol/spqr/spqr.js +1031 -0
  568. package/dist/internal/protocol/spqr/spqr.js.map +1 -0
  569. package/dist/internal/protocol/spqr/validate.d.ts +35 -0
  570. package/dist/internal/protocol/spqr/validate.d.ts.map +1 -0
  571. package/dist/internal/protocol/spqr/validate.js +62 -0
  572. package/dist/internal/protocol/spqr/validate.js.map +1 -0
  573. package/dist/internal/protocol/triple-ratchet/index.d.ts +21 -0
  574. package/dist/internal/protocol/triple-ratchet/index.d.ts.map +1 -0
  575. package/dist/internal/protocol/triple-ratchet/index.js +19 -0
  576. package/dist/internal/protocol/triple-ratchet/index.js.map +1 -0
  577. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +233 -0
  578. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +1 -0
  579. package/dist/internal/protocol/triple-ratchet/ratchet.js +254 -0
  580. package/dist/internal/protocol/triple-ratchet/ratchet.js.map +1 -0
  581. package/dist/internal/protocol/username/generate.d.ts +9 -0
  582. package/dist/internal/protocol/username/generate.d.ts.map +1 -0
  583. package/dist/internal/protocol/username/generate.js +16 -0
  584. package/dist/internal/protocol/username/generate.js.map +1 -0
  585. package/dist/internal/protocol/username/hash.d.ts +74 -0
  586. package/dist/internal/protocol/username/hash.d.ts.map +1 -0
  587. package/dist/internal/protocol/username/hash.js +228 -0
  588. package/dist/internal/protocol/username/hash.js.map +1 -0
  589. package/dist/internal/protocol/username/link.d.ts +50 -0
  590. package/dist/internal/protocol/username/link.d.ts.map +1 -0
  591. package/dist/internal/protocol/username/link.js +187 -0
  592. package/dist/internal/protocol/username/link.js.map +1 -0
  593. package/dist/internal/protocol/username/proof.d.ts +34 -0
  594. package/dist/internal/protocol/username/proof.d.ts.map +1 -0
  595. package/dist/internal/protocol/username/proof.js +83 -0
  596. package/dist/internal/protocol/username/proof.js.map +1 -0
  597. package/dist/internal/protocol/version.d.ts +184 -0
  598. package/dist/internal/protocol/version.d.ts.map +1 -0
  599. package/dist/internal/protocol/version.js +163 -0
  600. package/dist/internal/protocol/version.js.map +1 -0
  601. package/dist/internal/protocol/x3dh/index.d.ts +15 -0
  602. package/dist/internal/protocol/x3dh/index.d.ts.map +1 -0
  603. package/dist/internal/protocol/x3dh/index.js +13 -0
  604. package/dist/internal/protocol/x3dh/index.js.map +1 -0
  605. package/dist/internal/protocol/x3dh/x3dh.d.ts +131 -0
  606. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -0
  607. package/dist/internal/protocol/x3dh/x3dh.js +261 -0
  608. package/dist/internal/protocol/x3dh/x3dh.js.map +1 -0
  609. package/dist/internal/protocol/zk/credentials/attributes.d.ts +157 -0
  610. package/dist/internal/protocol/zk/credentials/attributes.d.ts.map +1 -0
  611. package/dist/internal/protocol/zk/credentials/attributes.js +177 -0
  612. package/dist/internal/protocol/zk/credentials/attributes.js.map +1 -0
  613. package/dist/internal/protocol/zk/credentials/credentials.d.ts +129 -0
  614. package/dist/internal/protocol/zk/credentials/credentials.d.ts.map +1 -0
  615. package/dist/internal/protocol/zk/credentials/credentials.js +204 -0
  616. package/dist/internal/protocol/zk/credentials/credentials.js.map +1 -0
  617. package/dist/internal/protocol/zk/credentials/endorsements.d.ts +235 -0
  618. package/dist/internal/protocol/zk/credentials/endorsements.d.ts.map +1 -0
  619. package/dist/internal/protocol/zk/credentials/endorsements.js +520 -0
  620. package/dist/internal/protocol/zk/credentials/endorsements.js.map +1 -0
  621. package/dist/internal/protocol/zk/credentials/index.d.ts +14 -0
  622. package/dist/internal/protocol/zk/credentials/index.d.ts.map +1 -0
  623. package/dist/internal/protocol/zk/credentials/index.js +6 -0
  624. package/dist/internal/protocol/zk/credentials/index.js.map +1 -0
  625. package/dist/internal/protocol/zk/credentials/issuance.d.ts +135 -0
  626. package/dist/internal/protocol/zk/credentials/issuance.d.ts.map +1 -0
  627. package/dist/internal/protocol/zk/credentials/issuance.js +338 -0
  628. package/dist/internal/protocol/zk/credentials/issuance.js.map +1 -0
  629. package/dist/internal/protocol/zk/credentials/presentation.d.ts +160 -0
  630. package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -0
  631. package/dist/internal/protocol/zk/credentials/presentation.js +447 -0
  632. package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -0
  633. package/dist/internal/protocol/zk/groups/auth-credential.d.ts +191 -0
  634. package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -0
  635. package/dist/internal/protocol/zk/groups/auth-credential.js +377 -0
  636. package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -0
  637. package/dist/internal/protocol/zk/groups/client-zk-group-cipher.d.ts +73 -0
  638. package/dist/internal/protocol/zk/groups/client-zk-group-cipher.d.ts.map +1 -0
  639. package/dist/internal/protocol/zk/groups/client-zk-group-cipher.js +140 -0
  640. package/dist/internal/protocol/zk/groups/client-zk-group-cipher.js.map +1 -0
  641. package/dist/internal/protocol/zk/groups/group-params.d.ts +93 -0
  642. package/dist/internal/protocol/zk/groups/group-params.d.ts.map +1 -0
  643. package/dist/internal/protocol/zk/groups/group-params.js +184 -0
  644. package/dist/internal/protocol/zk/groups/group-params.js.map +1 -0
  645. package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts +245 -0
  646. package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts.map +1 -0
  647. package/dist/internal/protocol/zk/groups/group-send-endorsement.js +404 -0
  648. package/dist/internal/protocol/zk/groups/group-send-endorsement.js.map +1 -0
  649. package/dist/internal/protocol/zk/groups/index.d.ts +19 -0
  650. package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -0
  651. package/dist/internal/protocol/zk/groups/index.js +12 -0
  652. package/dist/internal/protocol/zk/groups/index.js.map +1 -0
  653. package/dist/internal/protocol/zk/groups/lizard.d.ts +51 -0
  654. package/dist/internal/protocol/zk/groups/lizard.d.ts.map +1 -0
  655. package/dist/internal/protocol/zk/groups/lizard.js +478 -0
  656. package/dist/internal/protocol/zk/groups/lizard.js.map +1 -0
  657. package/dist/internal/protocol/zk/groups/profile-key-commitment.d.ts +35 -0
  658. package/dist/internal/protocol/zk/groups/profile-key-commitment.d.ts.map +1 -0
  659. package/dist/internal/protocol/zk/groups/profile-key-commitment.js +99 -0
  660. package/dist/internal/protocol/zk/groups/profile-key-commitment.js.map +1 -0
  661. package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +195 -0
  662. package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -0
  663. package/dist/internal/protocol/zk/groups/profile-key-credential.js +370 -0
  664. package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -0
  665. package/dist/internal/protocol/zk/groups/profile-key-encryption.d.ts +45 -0
  666. package/dist/internal/protocol/zk/groups/profile-key-encryption.d.ts.map +1 -0
  667. package/dist/internal/protocol/zk/groups/profile-key-encryption.js +125 -0
  668. package/dist/internal/protocol/zk/groups/profile-key-encryption.js.map +1 -0
  669. package/dist/internal/protocol/zk/groups/profile-key-struct.d.ts +33 -0
  670. package/dist/internal/protocol/zk/groups/profile-key-struct.d.ts.map +1 -0
  671. package/dist/internal/protocol/zk/groups/profile-key-struct.js +62 -0
  672. package/dist/internal/protocol/zk/groups/profile-key-struct.js.map +1 -0
  673. package/dist/internal/protocol/zk/groups/profile-key-version.d.ts +17 -0
  674. package/dist/internal/protocol/zk/groups/profile-key-version.d.ts.map +1 -0
  675. package/dist/internal/protocol/zk/groups/profile-key-version.js +33 -0
  676. package/dist/internal/protocol/zk/groups/profile-key-version.js.map +1 -0
  677. package/dist/internal/protocol/zk/groups/server-params.d.ts +114 -0
  678. package/dist/internal/protocol/zk/groups/server-params.d.ts.map +1 -0
  679. package/dist/internal/protocol/zk/groups/server-params.js +146 -0
  680. package/dist/internal/protocol/zk/groups/server-params.js.map +1 -0
  681. package/dist/internal/protocol/zk/groups/uid-encryption.d.ts +41 -0
  682. package/dist/internal/protocol/zk/groups/uid-encryption.d.ts.map +1 -0
  683. package/dist/internal/protocol/zk/groups/uid-encryption.js +113 -0
  684. package/dist/internal/protocol/zk/groups/uid-encryption.js.map +1 -0
  685. package/dist/internal/protocol/zk/groups/uid-struct.d.ts +48 -0
  686. package/dist/internal/protocol/zk/groups/uid-struct.d.ts.map +1 -0
  687. package/dist/internal/protocol/zk/groups/uid-struct.js +77 -0
  688. package/dist/internal/protocol/zk/groups/uid-struct.js.map +1 -0
  689. package/dist/internal/protocol/zk/proofs/args.d.ts +33 -0
  690. package/dist/internal/protocol/zk/proofs/args.d.ts.map +1 -0
  691. package/dist/internal/protocol/zk/proofs/args.js +43 -0
  692. package/dist/internal/protocol/zk/proofs/args.js.map +1 -0
  693. package/dist/internal/protocol/zk/proofs/index.d.ts +13 -0
  694. package/dist/internal/protocol/zk/proofs/index.d.ts.map +1 -0
  695. package/dist/internal/protocol/zk/proofs/index.js +7 -0
  696. package/dist/internal/protocol/zk/proofs/index.js.map +1 -0
  697. package/dist/internal/protocol/zk/proofs/proof.d.ts +30 -0
  698. package/dist/internal/protocol/zk/proofs/proof.d.ts.map +1 -0
  699. package/dist/internal/protocol/zk/proofs/proof.js +48 -0
  700. package/dist/internal/protocol/zk/proofs/proof.js.map +1 -0
  701. package/dist/internal/protocol/zk/proofs/sho-sha256.d.ts +34 -0
  702. package/dist/internal/protocol/zk/proofs/sho-sha256.d.ts.map +1 -0
  703. package/dist/internal/protocol/zk/proofs/sho-sha256.js +138 -0
  704. package/dist/internal/protocol/zk/proofs/sho-sha256.js.map +1 -0
  705. package/dist/internal/protocol/zk/proofs/sho.d.ts +120 -0
  706. package/dist/internal/protocol/zk/proofs/sho.d.ts.map +1 -0
  707. package/dist/internal/protocol/zk/proofs/sho.js +221 -0
  708. package/dist/internal/protocol/zk/proofs/sho.js.map +1 -0
  709. package/dist/internal/protocol/zk/proofs/sign.d.ts +29 -0
  710. package/dist/internal/protocol/zk/proofs/sign.d.ts.map +1 -0
  711. package/dist/internal/protocol/zk/proofs/sign.js +34 -0
  712. package/dist/internal/protocol/zk/proofs/sign.js.map +1 -0
  713. package/dist/internal/protocol/zk/proofs/statement.d.ts +103 -0
  714. package/dist/internal/protocol/zk/proofs/statement.d.ts.map +1 -0
  715. package/dist/internal/protocol/zk/proofs/statement.js +282 -0
  716. package/dist/internal/protocol/zk/proofs/statement.js.map +1 -0
  717. package/dist/internal/sesame/device-registry.d.ts +208 -0
  718. package/dist/internal/sesame/device-registry.d.ts.map +1 -0
  719. package/dist/internal/sesame/device-registry.js +431 -0
  720. package/dist/internal/sesame/device-registry.js.map +1 -0
  721. package/dist/internal/sesame/index.d.ts +31 -0
  722. package/dist/internal/sesame/index.d.ts.map +1 -0
  723. package/dist/internal/sesame/index.js +40 -0
  724. package/dist/internal/sesame/index.js.map +1 -0
  725. package/dist/internal/sesame/manager.d.ts +351 -0
  726. package/dist/internal/sesame/manager.d.ts.map +1 -0
  727. package/dist/internal/sesame/manager.js +1760 -0
  728. package/dist/internal/sesame/manager.js.map +1 -0
  729. package/dist/internal/sesame/types.d.ts +840 -0
  730. package/dist/internal/sesame/types.d.ts.map +1 -0
  731. package/dist/internal/sesame/types.js +290 -0
  732. package/dist/internal/sesame/types.js.map +1 -0
  733. package/dist/internal/sesame/validation.d.ts +72 -0
  734. package/dist/internal/sesame/validation.d.ts.map +1 -0
  735. package/dist/internal/sesame/validation.js +136 -0
  736. package/dist/internal/sesame/validation.js.map +1 -0
  737. package/dist/internal/session/builder.d.ts +94 -0
  738. package/dist/internal/session/builder.d.ts.map +1 -0
  739. package/dist/internal/session/builder.js +266 -0
  740. package/dist/internal/session/builder.js.map +1 -0
  741. package/dist/internal/session/cipher.d.ts +256 -0
  742. package/dist/internal/session/cipher.d.ts.map +1 -0
  743. package/dist/internal/session/cipher.js +1222 -0
  744. package/dist/internal/session/cipher.js.map +1 -0
  745. package/dist/internal/session/decryption.d.ts +37 -0
  746. package/dist/internal/session/decryption.d.ts.map +1 -0
  747. package/dist/internal/session/decryption.js +256 -0
  748. package/dist/internal/session/decryption.js.map +1 -0
  749. package/dist/internal/session/factory.d.ts +161 -0
  750. package/dist/internal/session/factory.d.ts.map +1 -0
  751. package/dist/internal/session/factory.js +211 -0
  752. package/dist/internal/session/factory.js.map +1 -0
  753. package/dist/internal/session/handshake.d.ts +72 -0
  754. package/dist/internal/session/handshake.d.ts.map +1 -0
  755. package/dist/internal/session/handshake.js +343 -0
  756. package/dist/internal/session/handshake.js.map +1 -0
  757. package/dist/internal/session/identity-binding.d.ts +5 -0
  758. package/dist/internal/session/identity-binding.d.ts.map +1 -0
  759. package/dist/internal/session/identity-binding.js +15 -0
  760. package/dist/internal/session/identity-binding.js.map +1 -0
  761. package/dist/internal/session/index.d.ts +73 -0
  762. package/dist/internal/session/index.d.ts.map +1 -0
  763. package/dist/internal/session/index.js +75 -0
  764. package/dist/internal/session/index.js.map +1 -0
  765. package/dist/internal/session/keys.d.ts +220 -0
  766. package/dist/internal/session/keys.d.ts.map +1 -0
  767. package/dist/internal/session/keys.js +78 -0
  768. package/dist/internal/session/keys.js.map +1 -0
  769. package/dist/internal/session/ratchet.d.ts +97 -0
  770. package/dist/internal/session/ratchet.d.ts.map +1 -0
  771. package/dist/internal/session/ratchet.js +187 -0
  772. package/dist/internal/session/ratchet.js.map +1 -0
  773. package/dist/internal/session/session-resolver.d.ts +138 -0
  774. package/dist/internal/session/session-resolver.d.ts.map +1 -0
  775. package/dist/internal/session/session-resolver.js +190 -0
  776. package/dist/internal/session/session-resolver.js.map +1 -0
  777. package/dist/internal/session/state.d.ts +278 -0
  778. package/dist/internal/session/state.d.ts.map +1 -0
  779. package/dist/internal/session/state.js +167 -0
  780. package/dist/internal/session/state.js.map +1 -0
  781. package/dist/internal/session/types.d.ts +192 -0
  782. package/dist/internal/session/types.d.ts.map +1 -0
  783. package/dist/internal/session/types.js +16 -0
  784. package/dist/internal/session/types.js.map +1 -0
  785. package/dist/internal/session/validation.d.ts +145 -0
  786. package/dist/internal/session/validation.d.ts.map +1 -0
  787. package/dist/internal/session/validation.js +340 -0
  788. package/dist/internal/session/validation.js.map +1 -0
  789. package/dist/keys/branded.d.ts +85 -0
  790. package/dist/keys/branded.d.ts.map +1 -0
  791. package/dist/keys/branded.js +26 -0
  792. package/dist/keys/branded.js.map +1 -0
  793. package/dist/keys/generation.d.ts +101 -0
  794. package/dist/keys/generation.d.ts.map +1 -0
  795. package/dist/keys/generation.js +181 -0
  796. package/dist/keys/generation.js.map +1 -0
  797. package/dist/keys/identity.d.ts +27 -0
  798. package/dist/keys/identity.d.ts.map +1 -0
  799. package/dist/keys/identity.js +200 -0
  800. package/dist/keys/identity.js.map +1 -0
  801. package/dist/keys/index.d.ts +24 -0
  802. package/dist/keys/index.d.ts.map +1 -0
  803. package/dist/keys/index.js +22 -0
  804. package/dist/keys/index.js.map +1 -0
  805. package/dist/keys/prekey-signature.d.ts +13 -0
  806. package/dist/keys/prekey-signature.d.ts.map +1 -0
  807. package/dist/keys/prekey-signature.js +46 -0
  808. package/dist/keys/prekey-signature.js.map +1 -0
  809. package/dist/keys/types.d.ts +255 -0
  810. package/dist/keys/types.d.ts.map +1 -0
  811. package/dist/keys/types.js +11 -0
  812. package/dist/keys/types.js.map +1 -0
  813. package/dist/layers.d.ts +228 -0
  814. package/dist/layers.d.ts.map +1 -0
  815. package/dist/layers.js +328 -0
  816. package/dist/layers.js.map +1 -0
  817. package/dist/local/store/expo/adapter.d.ts +243 -0
  818. package/dist/local/store/expo/adapter.d.ts.map +1 -0
  819. package/dist/local/store/expo/adapter.js +619 -0
  820. package/dist/local/store/expo/adapter.js.map +1 -0
  821. package/dist/local/store/expo/database-key.d.ts +142 -0
  822. package/dist/local/store/expo/database-key.d.ts.map +1 -0
  823. package/dist/local/store/expo/database-key.js +312 -0
  824. package/dist/local/store/expo/database-key.js.map +1 -0
  825. package/dist/local/store/expo/db.d.ts +92 -0
  826. package/dist/local/store/expo/db.d.ts.map +1 -0
  827. package/dist/local/store/expo/db.js +142 -0
  828. package/dist/local/store/expo/db.js.map +1 -0
  829. package/dist/local/store/expo/index.d.ts +22 -0
  830. package/dist/local/store/expo/index.d.ts.map +1 -0
  831. package/dist/local/store/expo/index.js +10 -0
  832. package/dist/local/store/expo/index.js.map +1 -0
  833. package/dist/local/store/expo/key-storage.d.ts +422 -0
  834. package/dist/local/store/expo/key-storage.d.ts.map +1 -0
  835. package/dist/local/store/expo/key-storage.js +1292 -0
  836. package/dist/local/store/expo/key-storage.js.map +1 -0
  837. package/dist/local/store/expo/maintenance.d.ts +4 -0
  838. package/dist/local/store/expo/maintenance.d.ts.map +1 -0
  839. package/dist/local/store/expo/maintenance.js +36 -0
  840. package/dist/local/store/expo/maintenance.js.map +1 -0
  841. package/dist/local/store/expo/models/ec-one-time-prekey.d.ts +155 -0
  842. package/dist/local/store/expo/models/ec-one-time-prekey.d.ts.map +1 -0
  843. package/dist/local/store/expo/models/ec-one-time-prekey.js +309 -0
  844. package/dist/local/store/expo/models/ec-one-time-prekey.js.map +1 -0
  845. package/dist/local/store/expo/models/ec-signed-prekey.d.ts +189 -0
  846. package/dist/local/store/expo/models/ec-signed-prekey.d.ts.map +1 -0
  847. package/dist/local/store/expo/models/ec-signed-prekey.js +359 -0
  848. package/dist/local/store/expo/models/ec-signed-prekey.js.map +1 -0
  849. package/dist/local/store/expo/models/identity-key-id.d.ts +9 -0
  850. package/dist/local/store/expo/models/identity-key-id.d.ts.map +1 -0
  851. package/dist/local/store/expo/models/identity-key-id.js +10 -0
  852. package/dist/local/store/expo/models/identity-key-id.js.map +1 -0
  853. package/dist/local/store/expo/models/index.d.ts +20 -0
  854. package/dist/local/store/expo/models/index.d.ts.map +1 -0
  855. package/dist/local/store/expo/models/index.js +80 -0
  856. package/dist/local/store/expo/models/index.js.map +1 -0
  857. package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts +183 -0
  858. package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts.map +1 -0
  859. package/dist/local/store/expo/models/kyber-one-time-prekey.js +353 -0
  860. package/dist/local/store/expo/models/kyber-one-time-prekey.js.map +1 -0
  861. package/dist/local/store/expo/models/kyber-prekey-used.d.ts +37 -0
  862. package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +1 -0
  863. package/dist/local/store/expo/models/kyber-prekey-used.js +59 -0
  864. package/dist/local/store/expo/models/kyber-prekey-used.js.map +1 -0
  865. package/dist/local/store/expo/models/kyber-prekey.d.ts +172 -0
  866. package/dist/local/store/expo/models/kyber-prekey.d.ts.map +1 -0
  867. package/dist/local/store/expo/models/kyber-prekey.js +314 -0
  868. package/dist/local/store/expo/models/kyber-prekey.js.map +1 -0
  869. package/dist/local/store/expo/models/local-identity.d.ts +52 -0
  870. package/dist/local/store/expo/models/local-identity.d.ts.map +1 -0
  871. package/dist/local/store/expo/models/local-identity.js +166 -0
  872. package/dist/local/store/expo/models/local-identity.js.map +1 -0
  873. package/dist/local/store/expo/models/message-record.d.ts +198 -0
  874. package/dist/local/store/expo/models/message-record.d.ts.map +1 -0
  875. package/dist/local/store/expo/models/message-record.js +298 -0
  876. package/dist/local/store/expo/models/message-record.js.map +1 -0
  877. package/dist/local/store/expo/models/recipient-identity.d.ts +21 -0
  878. package/dist/local/store/expo/models/recipient-identity.d.ts.map +1 -0
  879. package/dist/local/store/expo/models/recipient-identity.js +66 -0
  880. package/dist/local/store/expo/models/recipient-identity.js.map +1 -0
  881. package/dist/local/store/expo/models/replaced-prekey-utils.d.ts +33 -0
  882. package/dist/local/store/expo/models/replaced-prekey-utils.d.ts.map +1 -0
  883. package/dist/local/store/expo/models/replaced-prekey-utils.js +54 -0
  884. package/dist/local/store/expo/models/replaced-prekey-utils.js.map +1 -0
  885. package/dist/local/store/expo/models/sender-key.d.ts +210 -0
  886. package/dist/local/store/expo/models/sender-key.d.ts.map +1 -0
  887. package/dist/local/store/expo/models/sender-key.js +379 -0
  888. package/dist/local/store/expo/models/sender-key.js.map +1 -0
  889. package/dist/local/store/expo/models/session.d.ts +175 -0
  890. package/dist/local/store/expo/models/session.d.ts.map +1 -0
  891. package/dist/local/store/expo/models/session.js +496 -0
  892. package/dist/local/store/expo/models/session.js.map +1 -0
  893. package/dist/local/store/expo/schema.d.ts +1734 -0
  894. package/dist/local/store/expo/schema.d.ts.map +1 -0
  895. package/dist/local/store/expo/schema.js +155 -0
  896. package/dist/local/store/expo/schema.js.map +1 -0
  897. package/dist/local/store/expo/secure-store-options.d.ts +10 -0
  898. package/dist/local/store/expo/secure-store-options.d.ts.map +1 -0
  899. package/dist/local/store/expo/secure-store-options.js +5 -0
  900. package/dist/local/store/expo/secure-store-options.js.map +1 -0
  901. package/dist/local/store/index.d.ts +41 -0
  902. package/dist/local/store/index.d.ts.map +1 -0
  903. package/dist/local/store/index.js +34 -0
  904. package/dist/local/store/index.js.map +1 -0
  905. package/dist/local/store/mock/adapter.d.ts +185 -0
  906. package/dist/local/store/mock/adapter.d.ts.map +1 -0
  907. package/dist/local/store/mock/adapter.js +875 -0
  908. package/dist/local/store/mock/adapter.js.map +1 -0
  909. package/dist/local/store/mock/index.d.ts +10 -0
  910. package/dist/local/store/mock/index.d.ts.map +1 -0
  911. package/dist/local/store/mock/index.js +6 -0
  912. package/dist/local/store/mock/index.js.map +1 -0
  913. package/dist/local/store/node/adapter.d.ts +85 -0
  914. package/dist/local/store/node/adapter.d.ts.map +1 -0
  915. package/dist/local/store/node/adapter.js +274 -0
  916. package/dist/local/store/node/adapter.js.map +1 -0
  917. package/dist/local/store/node/database-encryption.d.ts +109 -0
  918. package/dist/local/store/node/database-encryption.d.ts.map +1 -0
  919. package/dist/local/store/node/database-encryption.js +202 -0
  920. package/dist/local/store/node/database-encryption.js.map +1 -0
  921. package/dist/local/store/node/database-key.d.ts +124 -0
  922. package/dist/local/store/node/database-key.d.ts.map +1 -0
  923. package/dist/local/store/node/database-key.js +264 -0
  924. package/dist/local/store/node/database-key.js.map +1 -0
  925. package/dist/local/store/node/database.d.ts +156 -0
  926. package/dist/local/store/node/database.d.ts.map +1 -0
  927. package/dist/local/store/node/database.js +630 -0
  928. package/dist/local/store/node/database.js.map +1 -0
  929. package/dist/local/store/node/index.d.ts +11 -0
  930. package/dist/local/store/node/index.d.ts.map +1 -0
  931. package/dist/local/store/node/index.js +8 -0
  932. package/dist/local/store/node/index.js.map +1 -0
  933. package/dist/local/store/react-native/adapter.d.ts +240 -0
  934. package/dist/local/store/react-native/adapter.d.ts.map +1 -0
  935. package/dist/local/store/react-native/adapter.js +1108 -0
  936. package/dist/local/store/react-native/adapter.js.map +1 -0
  937. package/dist/local/store/react-native/index.d.ts +19 -0
  938. package/dist/local/store/react-native/index.d.ts.map +1 -0
  939. package/dist/local/store/react-native/index.js +6 -0
  940. package/dist/local/store/react-native/index.js.map +1 -0
  941. package/dist/local/store/react-native/storage.d.ts +39 -0
  942. package/dist/local/store/react-native/storage.d.ts.map +1 -0
  943. package/dist/local/store/react-native/storage.js +2 -0
  944. package/dist/local/store/react-native/storage.js.map +1 -0
  945. package/dist/local/store/session-codec.d.ts +5 -0
  946. package/dist/local/store/session-codec.d.ts.map +1 -0
  947. package/dist/local/store/session-codec.js +42 -0
  948. package/dist/local/store/session-codec.js.map +1 -0
  949. package/dist/local/store/web/adapter.d.ts +190 -0
  950. package/dist/local/store/web/adapter.d.ts.map +1 -0
  951. package/dist/local/store/web/adapter.js +1188 -0
  952. package/dist/local/store/web/adapter.js.map +1 -0
  953. package/dist/local/store/web/index.d.ts +11 -0
  954. package/dist/local/store/web/index.d.ts.map +1 -0
  955. package/dist/local/store/web/index.js +8 -0
  956. package/dist/local/store/web/index.js.map +1 -0
  957. package/dist/local/vault/expo-secure-store.d.ts +10 -0
  958. package/dist/local/vault/expo-secure-store.d.ts.map +1 -0
  959. package/dist/local/vault/expo-secure-store.js +23 -0
  960. package/dist/local/vault/expo-secure-store.js.map +1 -0
  961. package/dist/local/vault/index.d.ts +7 -0
  962. package/dist/local/vault/index.d.ts.map +1 -0
  963. package/dist/local/vault/index.js +2 -0
  964. package/dist/local/vault/index.js.map +1 -0
  965. package/dist/logger.d.ts +18 -0
  966. package/dist/logger.d.ts.map +1 -0
  967. package/dist/logger.js +71 -0
  968. package/dist/logger.js.map +1 -0
  969. package/dist/media/index.d.ts +524 -0
  970. package/dist/media/index.d.ts.map +1 -0
  971. package/dist/media/index.js +2053 -0
  972. package/dist/media/index.js.map +1 -0
  973. package/dist/profile/cipher.d.ts +125 -0
  974. package/dist/profile/cipher.d.ts.map +1 -0
  975. package/dist/profile/cipher.js +197 -0
  976. package/dist/profile/cipher.js.map +1 -0
  977. package/dist/profile/contact-state.d.ts +33 -0
  978. package/dist/profile/contact-state.d.ts.map +1 -0
  979. package/dist/profile/contact-state.js +77 -0
  980. package/dist/profile/contact-state.js.map +1 -0
  981. package/dist/profile/crypto.d.ts +65 -0
  982. package/dist/profile/crypto.d.ts.map +1 -0
  983. package/dist/profile/crypto.js +93 -0
  984. package/dist/profile/crypto.js.map +1 -0
  985. package/dist/profile/index.d.ts +26 -0
  986. package/dist/profile/index.d.ts.map +1 -0
  987. package/dist/profile/index.js +30 -0
  988. package/dist/profile/index.js.map +1 -0
  989. package/dist/profile/profile-key.d.ts +102 -0
  990. package/dist/profile/profile-key.d.ts.map +1 -0
  991. package/dist/profile/profile-key.js +229 -0
  992. package/dist/profile/profile-key.js.map +1 -0
  993. package/dist/profile/storage.d.ts +61 -0
  994. package/dist/profile/storage.d.ts.map +1 -0
  995. package/dist/profile/storage.js +145 -0
  996. package/dist/profile/storage.js.map +1 -0
  997. package/dist/profile/update-service.d.ts +53 -0
  998. package/dist/profile/update-service.d.ts.map +1 -0
  999. package/dist/profile/update-service.js +67 -0
  1000. package/dist/profile/update-service.js.map +1 -0
  1001. package/dist/remote/object-store/convex-r2/index.d.ts +11 -0
  1002. package/dist/remote/object-store/convex-r2/index.d.ts.map +1 -0
  1003. package/dist/remote/object-store/convex-r2/index.js +13 -0
  1004. package/dist/remote/object-store/convex-r2/index.js.map +1 -0
  1005. package/dist/remote/object-store/convex-r2/server/index.d.ts +2 -0
  1006. package/dist/remote/object-store/convex-r2/server/index.d.ts.map +1 -0
  1007. package/dist/remote/object-store/convex-r2/server/index.js +2 -0
  1008. package/dist/remote/object-store/convex-r2/server/index.js.map +1 -0
  1009. package/dist/remote/object-store/convex-r2/server.d.ts +126 -0
  1010. package/dist/remote/object-store/convex-r2/server.d.ts.map +1 -0
  1011. package/dist/remote/object-store/convex-r2/server.js +232 -0
  1012. package/dist/remote/object-store/convex-r2/server.js.map +1 -0
  1013. package/dist/remote/object-store/convex-r2/storage.d.ts +47 -0
  1014. package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -0
  1015. package/dist/remote/object-store/convex-r2/storage.js +55 -0
  1016. package/dist/remote/object-store/convex-r2/storage.js.map +1 -0
  1017. package/dist/remote/object-store/index.d.ts +8 -0
  1018. package/dist/remote/object-store/index.d.ts.map +1 -0
  1019. package/dist/remote/object-store/index.js +2 -0
  1020. package/dist/remote/object-store/index.js.map +1 -0
  1021. package/dist/remote/object-store/s3/index.d.ts +8 -0
  1022. package/dist/remote/object-store/s3/index.d.ts.map +1 -0
  1023. package/dist/remote/object-store/s3/index.js +10 -0
  1024. package/dist/remote/object-store/s3/index.js.map +1 -0
  1025. package/dist/remote/object-store/s3/storage.d.ts +44 -0
  1026. package/dist/remote/object-store/s3/storage.d.ts.map +1 -0
  1027. package/dist/remote/object-store/s3/storage.js +41 -0
  1028. package/dist/remote/object-store/s3/storage.js.map +1 -0
  1029. package/dist/remote/object-store/types.d.ts +80 -0
  1030. package/dist/remote/object-store/types.d.ts.map +1 -0
  1031. package/dist/remote/object-store/types.js +2 -0
  1032. package/dist/remote/object-store/types.js.map +1 -0
  1033. package/dist/remote/object-store/validation.d.ts +6 -0
  1034. package/dist/remote/object-store/validation.d.ts.map +1 -0
  1035. package/dist/remote/object-store/validation.js +93 -0
  1036. package/dist/remote/object-store/validation.js.map +1 -0
  1037. package/dist/remote/relay/convex/group-server.d.ts +118 -0
  1038. package/dist/remote/relay/convex/group-server.d.ts.map +1 -0
  1039. package/dist/remote/relay/convex/group-server.js +150 -0
  1040. package/dist/remote/relay/convex/group-server.js.map +1 -0
  1041. package/dist/remote/relay/convex/index.d.ts +39 -0
  1042. package/dist/remote/relay/convex/index.d.ts.map +1 -0
  1043. package/dist/remote/relay/convex/index.js +36 -0
  1044. package/dist/remote/relay/convex/index.js.map +1 -0
  1045. package/dist/remote/relay/convex/relay.d.ts +339 -0
  1046. package/dist/remote/relay/convex/relay.d.ts.map +1 -0
  1047. package/dist/remote/relay/convex/relay.js +1086 -0
  1048. package/dist/remote/relay/convex/relay.js.map +1 -0
  1049. package/dist/remote/relay/convex/types.d.ts +111 -0
  1050. package/dist/remote/relay/convex/types.d.ts.map +1 -0
  1051. package/dist/remote/relay/convex/types.js +19 -0
  1052. package/dist/remote/relay/convex/types.js.map +1 -0
  1053. package/dist/remote/relay/index.d.ts +34 -0
  1054. package/dist/remote/relay/index.d.ts.map +1 -0
  1055. package/dist/remote/relay/index.js +28 -0
  1056. package/dist/remote/relay/index.js.map +1 -0
  1057. package/dist/remote/relay/mock/adapter.d.ts +237 -0
  1058. package/dist/remote/relay/mock/adapter.d.ts.map +1 -0
  1059. package/dist/remote/relay/mock/adapter.js +939 -0
  1060. package/dist/remote/relay/mock/adapter.js.map +1 -0
  1061. package/dist/remote/relay/mock/index.d.ts +10 -0
  1062. package/dist/remote/relay/mock/index.d.ts.map +1 -0
  1063. package/dist/remote/relay/mock/index.js +6 -0
  1064. package/dist/remote/relay/mock/index.js.map +1 -0
  1065. package/dist/remote/relay/types.d.ts +756 -0
  1066. package/dist/remote/relay/types.d.ts.map +1 -0
  1067. package/dist/remote/relay/types.js +11 -0
  1068. package/dist/remote/relay/types.js.map +1 -0
  1069. package/dist/safety/core.d.ts +108 -0
  1070. package/dist/safety/core.d.ts.map +1 -0
  1071. package/dist/safety/core.js +299 -0
  1072. package/dist/safety/core.js.map +1 -0
  1073. package/dist/safety/fingerprint.d.ts +277 -0
  1074. package/dist/safety/fingerprint.d.ts.map +1 -0
  1075. package/dist/safety/fingerprint.js +339 -0
  1076. package/dist/safety/fingerprint.js.map +1 -0
  1077. package/dist/safety/index.d.ts +141 -0
  1078. package/dist/safety/index.d.ts.map +1 -0
  1079. package/dist/safety/index.js +230 -0
  1080. package/dist/safety/index.js.map +1 -0
  1081. package/dist/safety/protobuf.d.ts +34 -0
  1082. package/dist/safety/protobuf.d.ts.map +1 -0
  1083. package/dist/safety/protobuf.js +142 -0
  1084. package/dist/safety/protobuf.js.map +1 -0
  1085. package/dist/safety/url.d.ts +133 -0
  1086. package/dist/safety/url.d.ts.map +1 -0
  1087. package/dist/safety/url.js +242 -0
  1088. package/dist/safety/url.js.map +1 -0
  1089. package/dist/sealed-sender/index.d.ts +7 -0
  1090. package/dist/sealed-sender/index.d.ts.map +1 -0
  1091. package/dist/sealed-sender/index.js +6 -0
  1092. package/dist/sealed-sender/index.js.map +1 -0
  1093. package/dist/server-clock.d.ts +10 -0
  1094. package/dist/server-clock.d.ts.map +1 -0
  1095. package/dist/server-clock.js +27 -0
  1096. package/dist/server-clock.js.map +1 -0
  1097. package/dist/types/address.d.ts +171 -0
  1098. package/dist/types/address.d.ts.map +1 -0
  1099. package/dist/types/address.js +241 -0
  1100. package/dist/types/address.js.map +1 -0
  1101. package/dist/types/api.d.ts +1222 -0
  1102. package/dist/types/api.d.ts.map +1 -0
  1103. package/dist/types/api.js +5 -0
  1104. package/dist/types/api.js.map +1 -0
  1105. package/dist/types/errors.d.ts +772 -0
  1106. package/dist/types/errors.d.ts.map +1 -0
  1107. package/dist/types/errors.js +937 -0
  1108. package/dist/types/errors.js.map +1 -0
  1109. package/dist/types/index.d.ts +20 -0
  1110. package/dist/types/index.d.ts.map +1 -0
  1111. package/dist/types/index.js +33 -0
  1112. package/dist/types/index.js.map +1 -0
  1113. package/dist/types/messages.d.ts +257 -0
  1114. package/dist/types/messages.d.ts.map +1 -0
  1115. package/dist/types/messages.js +96 -0
  1116. package/dist/types/messages.js.map +1 -0
  1117. package/dist/types/protocol-config.d.ts +337 -0
  1118. package/dist/types/protocol-config.d.ts.map +1 -0
  1119. package/dist/types/protocol-config.js +178 -0
  1120. package/dist/types/protocol-config.js.map +1 -0
  1121. package/dist/types/protocol-constants.d.ts +122 -0
  1122. package/dist/types/protocol-constants.d.ts.map +1 -0
  1123. package/dist/types/protocol-constants.js +115 -0
  1124. package/dist/types/protocol-constants.js.map +1 -0
  1125. package/dist/types/session.d.ts +721 -0
  1126. package/dist/types/session.d.ts.map +1 -0
  1127. package/dist/types/session.js +340 -0
  1128. package/dist/types/session.js.map +1 -0
  1129. package/dist/types/trust.d.ts +168 -0
  1130. package/dist/types/trust.d.ts.map +1 -0
  1131. package/dist/types/trust.js +84 -0
  1132. package/dist/types/trust.js.map +1 -0
  1133. package/dist/types/utils.d.ts +93 -0
  1134. package/dist/types/utils.d.ts.map +1 -0
  1135. package/dist/types/utils.js +89 -0
  1136. package/dist/types/utils.js.map +1 -0
  1137. package/dist/username/index.d.ts +12 -0
  1138. package/dist/username/index.d.ts.map +1 -0
  1139. package/dist/username/index.js +11 -0
  1140. package/dist/username/index.js.map +1 -0
  1141. package/dist/username/link.d.ts +52 -0
  1142. package/dist/username/link.d.ts.map +1 -0
  1143. package/dist/username/link.js +87 -0
  1144. package/dist/username/link.js.map +1 -0
  1145. package/dist/utils/binary-transfer.d.ts +18 -0
  1146. package/dist/utils/binary-transfer.d.ts.map +1 -0
  1147. package/dist/utils/binary-transfer.js +27 -0
  1148. package/dist/utils/binary-transfer.js.map +1 -0
  1149. package/dist/utils/errors.d.ts +9 -0
  1150. package/dist/utils/errors.d.ts.map +1 -0
  1151. package/dist/utils/errors.js +15 -0
  1152. package/dist/utils/errors.js.map +1 -0
  1153. package/dist/utils/retry.d.ts +59 -0
  1154. package/dist/utils/retry.d.ts.map +1 -0
  1155. package/dist/utils/retry.js +136 -0
  1156. package/dist/utils/retry.js.map +1 -0
  1157. package/dist/versions.d.ts +62 -0
  1158. package/dist/versions.d.ts.map +1 -0
  1159. package/dist/versions.js +78 -0
  1160. package/dist/versions.js.map +1 -0
  1161. package/dist/zk/credentials.d.ts +10 -0
  1162. package/dist/zk/credentials.d.ts.map +1 -0
  1163. package/dist/zk/credentials.js +9 -0
  1164. package/dist/zk/credentials.js.map +1 -0
  1165. package/dist/zk/groups.d.ts +12 -0
  1166. package/dist/zk/groups.d.ts.map +1 -0
  1167. package/dist/zk/groups.js +11 -0
  1168. package/dist/zk/groups.js.map +1 -0
  1169. package/docs/ASSURANCE.md +102 -0
  1170. package/docs/CLIENT_COMPOSITION.md +189 -0
  1171. package/docs/DOCUMENTATION_STANDARDS.md +107 -0
  1172. package/docs/E2EE.md +35 -0
  1173. package/docs/ERROR_HANDLING.md +396 -0
  1174. package/docs/GETTING_STARTED.md +714 -0
  1175. package/docs/INTERFACES.md +187 -0
  1176. package/docs/PACKAGE_SURFACE.md +235 -0
  1177. package/docs/PROTOCOL_POLICY.md +109 -0
  1178. package/docs/RECIPES.md +389 -0
  1179. package/docs/SECURITY.md +199 -0
  1180. package/docs/api/README.md +471 -0
  1181. package/docs/api/classes/EncryptionError.md +112 -0
  1182. package/docs/api/classes/EndorsementManager.md +307 -0
  1183. package/docs/api/classes/SealedSenderAuthError.md +127 -0
  1184. package/docs/api/classes/ServerDerivedKeyPair.md +68 -0
  1185. package/docs/api/classes/ServerDerivedPublicKey.md +33 -0
  1186. package/docs/api/classes/ServerRootKeyPair.md +94 -0
  1187. package/docs/api/classes/ServerRootPublicKey.md +72 -0
  1188. package/docs/api/classes/SignalBlockingManager.md +106 -0
  1189. package/docs/api/classes/SignalProtocolClient.md +2651 -0
  1190. package/docs/api/classes/VerificationFailure.md +25 -0
  1191. package/docs/api/enumerations/ContentHint.md +63 -0
  1192. package/docs/api/enumerations/EncryptionErrorCode.md +488 -0
  1193. package/docs/api/enumerations/IdentityKeyChange.md +65 -0
  1194. package/docs/api/enumerations/MessageType.md +29 -0
  1195. package/docs/api/enumerations/TrustDirection.md +33 -0
  1196. package/docs/api/enumerations/TypingAction.md +31 -0
  1197. package/docs/api/functions/createDefaultSignalContentAdapter.md +13 -0
  1198. package/docs/api/functions/createDefaultSignalLogger.md +36 -0
  1199. package/docs/api/functions/createGroupId.md +32 -0
  1200. package/docs/api/functions/createSignalProtocolClient.md +36 -0
  1201. package/docs/api/functions/createSignalProtocolClientConfig.md +24 -0
  1202. package/docs/api/functions/extractGroupId.md +32 -0
  1203. package/docs/api/functions/formatVersion.md +25 -0
  1204. package/docs/api/functions/isCompatible.md +31 -0
  1205. package/docs/api/functions/isGroupId.md +37 -0
  1206. package/docs/api/functions/isSealedSenderAuthError.md +25 -0
  1207. package/docs/api/functions/parseVersion.md +29 -0
  1208. package/docs/api/functions/resolveSPQRLimits.md +21 -0
  1209. package/docs/api/functions/resolveSignalLogger.md +42 -0
  1210. package/docs/api/interfaces/AccountIdentityProvisioning.md +43 -0
  1211. package/docs/api/interfaces/AccountIdentityRotation.md +69 -0
  1212. package/docs/api/interfaces/AttachmentTransferOptions.md +49 -0
  1213. package/docs/api/interfaces/BlockedRecipientEntry.md +25 -0
  1214. package/docs/api/interfaces/BlockedRecipientsSyncInput.md +27 -0
  1215. package/docs/api/interfaces/ConfigurationSyncInput.md +19 -0
  1216. package/docs/api/interfaces/CredentialPublicKey.md +25 -0
  1217. package/docs/api/interfaces/DataMessageInput.md +21 -0
  1218. package/docs/api/interfaces/DecryptedEnvelope.md +95 -0
  1219. package/docs/api/interfaces/DecryptedGroup.md +86 -0
  1220. package/docs/api/interfaces/DeviceInfo.md +79 -0
  1221. package/docs/api/interfaces/DeviceRecord.md +87 -0
  1222. package/docs/api/interfaces/DeviceRegistration.md +27 -0
  1223. package/docs/api/interfaces/DoubleRatchetConfig.md +36 -0
  1224. package/docs/api/interfaces/EcOneTimePreKey.md +27 -0
  1225. package/docs/api/interfaces/EcSignedPreKey.md +39 -0
  1226. package/docs/api/interfaces/EcSignedPreKeyUpload.md +50 -0
  1227. package/docs/api/interfaces/EncryptionErrorContext.md +51 -0
  1228. package/docs/api/interfaces/Envelope.md +154 -0
  1229. package/docs/api/interfaces/ForceKeyResetResult.md +37 -0
  1230. package/docs/api/interfaces/GroupAuthorization.md +23 -0
  1231. package/docs/api/interfaces/GroupChangeEntry.md +42 -0
  1232. package/docs/api/interfaces/GroupMemberDevice.md +26 -0
  1233. package/docs/api/interfaces/IEcOneTimePreKeyStore.md +86 -0
  1234. package/docs/api/interfaces/IEcSignedPreKeyStore.md +132 -0
  1235. package/docs/api/interfaces/IGroupServer.md +120 -0
  1236. package/docs/api/interfaces/IGroupStateStore.md +128 -0
  1237. package/docs/api/interfaces/IIdentityKeyStore.md +312 -0
  1238. package/docs/api/interfaces/IKemPreKeyStore.md +144 -0
  1239. package/docs/api/interfaces/IKyberLastResortPreKeyStore.md +111 -0
  1240. package/docs/api/interfaces/ILogger.md +117 -0
  1241. package/docs/api/interfaces/IProtocolStore.md +1033 -0
  1242. package/docs/api/interfaces/ISenderKeyStore.md +417 -0
  1243. package/docs/api/interfaces/ISesameStore.md +249 -0
  1244. package/docs/api/interfaces/ISessionStore.md +178 -0
  1245. package/docs/api/interfaces/ISignalLocalSecretVault.md +71 -0
  1246. package/docs/api/interfaces/ISignalLocalStore.md +2053 -0
  1247. package/docs/api/interfaces/ISignalProtocolClient.md +1183 -0
  1248. package/docs/api/interfaces/ISignalProtocolManager.md +272 -0
  1249. package/docs/api/interfaces/ISignalRelayServer.md +1329 -0
  1250. package/docs/api/interfaces/IdentityKeyPair.md +49 -0
  1251. package/docs/api/interfaces/IncomingEnvelope.md +91 -0
  1252. package/docs/api/interfaces/InspectedSignalContent.md +43 -0
  1253. package/docs/api/interfaces/KDFChain.md +31 -0
  1254. package/docs/api/interfaces/KemLastResortPreKeyUpload.md +50 -0
  1255. package/docs/api/interfaces/KeyPair.md +23 -0
  1256. package/docs/api/interfaces/KyberPreKey.md +42 -0
  1257. package/docs/api/interfaces/MLKEMBraidAgentState.md +191 -0
  1258. package/docs/api/interfaces/MLKEMBraidMessage.md +49 -0
  1259. package/docs/api/interfaces/MediaAttachmentDeleteSyncInput.md +31 -0
  1260. package/docs/api/interfaces/MessageHeader.md +49 -0
  1261. package/docs/api/interfaces/MessageRecord.md +86 -0
  1262. package/docs/api/interfaces/ParsedReceiptContent.md +19 -0
  1263. package/docs/api/interfaces/ParsedTypingContent.md +19 -0
  1264. package/docs/api/interfaces/PreKeyMaintenanceStore.md +87 -0
  1265. package/docs/api/interfaces/PreKeyMessage.md +159 -0
  1266. package/docs/api/interfaces/PreKeyStatusResult.md +21 -0
  1267. package/docs/api/interfaces/PreKeyUpload.md +42 -0
  1268. package/docs/api/interfaces/ProcessEnvelopeOptions.md +72 -0
  1269. package/docs/api/interfaces/ProtocolAddress.md +38 -0
  1270. package/docs/api/interfaces/ProtocolStrategyConfig.md +91 -0
  1271. package/docs/api/interfaces/RatchetMessage.md +96 -0
  1272. package/docs/api/interfaces/ReadSyncEntryInput.md +19 -0
  1273. package/docs/api/interfaces/ReceiverChain.md +43 -0
  1274. package/docs/api/interfaces/RecipientUsernameSyncInput.md +31 -0
  1275. package/docs/api/interfaces/RelayPreKeyBundle.md +254 -0
  1276. package/docs/api/interfaces/RemoteObjectDownload.md +33 -0
  1277. package/docs/api/interfaces/RemoteObjectUpload.md +49 -0
  1278. package/docs/api/interfaces/ResolvedSPQRInfoStrings.md +27 -0
  1279. package/docs/api/interfaces/ResolvedSPQRLimits.md +37 -0
  1280. package/docs/api/interfaces/RetryRequest.md +80 -0
  1281. package/docs/api/interfaces/SCKAState.md +65 -0
  1282. package/docs/api/interfaces/SPQRLimits.md +40 -0
  1283. package/docs/api/interfaces/SPQRState.md +191 -0
  1284. package/docs/api/interfaces/SafetyNumber.md +60 -0
  1285. package/docs/api/interfaces/SafetyNumberConfirmation.md +46 -0
  1286. package/docs/api/interfaces/SealedSenderConfig.md +70 -0
  1287. package/docs/api/interfaces/SendOptions.md +191 -0
  1288. package/docs/api/interfaces/SendResult.md +93 -0
  1289. package/docs/api/interfaces/SenderKeyDistributionMessage.md +43 -0
  1290. package/docs/api/interfaces/SenderKeyState.md +76 -0
  1291. package/docs/api/interfaces/SenderKeysConfig.md +65 -0
  1292. package/docs/api/interfaces/SentSyncTranscriptInput.md +31 -0
  1293. package/docs/api/interfaces/ServiceId.md +19 -0
  1294. package/docs/api/interfaces/SesameMessage.md +84 -0
  1295. package/docs/api/interfaces/SesameStats.md +57 -0
  1296. package/docs/api/interfaces/SessionHealthResult.md +120 -0
  1297. package/docs/api/interfaces/SessionRecord.md +80 -0
  1298. package/docs/api/interfaces/SessionRecordMetadata.md +109 -0
  1299. package/docs/api/interfaces/SessionState.md +368 -0
  1300. package/docs/api/interfaces/SessionTrustCommit.md +58 -0
  1301. package/docs/api/interfaces/SignalBlockingHooks.md +44 -0
  1302. package/docs/api/interfaces/SignalBlockingManagerOptions.md +31 -0
  1303. package/docs/api/interfaces/SignalBlockingMirror.md +30 -0
  1304. package/docs/api/interfaces/SignalBlockingStore.md +83 -0
  1305. package/docs/api/interfaces/SignalContentAdapter.md +325 -0
  1306. package/docs/api/interfaces/SignalProtocolClientAdapterConfig.md +44 -0
  1307. package/docs/api/interfaces/SignalProtocolClientCompositionOptions.md +693 -0
  1308. package/docs/api/interfaces/SignalProtocolClientConfig.md +839 -0
  1309. package/docs/api/interfaces/SignalProtocolClientDeleteLocalAttachmentInput.md +25 -0
  1310. package/docs/api/interfaces/SignalProtocolClientHooks.md +506 -0
  1311. package/docs/api/interfaces/SignalProtocolClientIdentityConfig.md +35 -0
  1312. package/docs/api/interfaces/SignalProtocolClientLoadLocalAttachmentInput.md +187 -0
  1313. package/docs/api/interfaces/SignalProtocolClientLoadedLocalAttachment.md +19 -0
  1314. package/docs/api/interfaces/SignalProtocolClientMedia.md +83 -0
  1315. package/docs/api/interfaces/SignalProtocolClientMediaCompletedResult.md +25 -0
  1316. package/docs/api/interfaces/SignalProtocolClientMediaConfig.md +157 -0
  1317. package/docs/api/interfaces/SignalProtocolClientMediaDownloadCompletedResult.md +37 -0
  1318. package/docs/api/interfaces/SignalProtocolClientMediaDownloadNotNeededResult.md +25 -0
  1319. package/docs/api/interfaces/SignalProtocolClientMediaFailedResult.md +19 -0
  1320. package/docs/api/interfaces/SignalProtocolClientMediaOperationOptions.md +53 -0
  1321. package/docs/api/interfaces/SignalProtocolClientMediaPendingResult.md +19 -0
  1322. package/docs/api/interfaces/SignalProtocolClientMediaProcessResult.md +43 -0
  1323. package/docs/api/interfaces/SignalProtocolClientMediaSkippedResult.md +25 -0
  1324. package/docs/api/interfaces/SignalProtocolClientMediaUploadCompletedResult.md +31 -0
  1325. package/docs/api/interfaces/SignalProtocolClientProcessPendingMediaOptions.md +87 -0
  1326. package/docs/api/interfaces/SignalProtocolClientSaveDownloadedAttachmentInput.md +25 -0
  1327. package/docs/api/interfaces/SignalProtocolClientSaveUploadedAttachmentInput.md +25 -0
  1328. package/docs/api/interfaces/SignalProtocolClientSyncDeleteInput.md +19 -0
  1329. package/docs/api/interfaces/SignalProtocolConfig.md +50 -0
  1330. package/docs/api/interfaces/SignalRemoteObjectStore.md +88 -0
  1331. package/docs/api/interfaces/SkippedSenderMessageKey.md +26 -0
  1332. package/docs/api/interfaces/TaskNotificationAckSyncInput.md +31 -0
  1333. package/docs/api/interfaces/TripleRatchetState.md +64 -0
  1334. package/docs/api/interfaces/UserRecord.md +71 -0
  1335. package/docs/api/interfaces/UsernameStateSyncInput.md +19 -0
  1336. package/docs/api/interfaces/VerificationStateSyncInput.md +31 -0
  1337. package/docs/api/interfaces/VersionNegotiationState.md +84 -0
  1338. package/docs/api/interfaces/ViewOnceOpenSyncInput.md +19 -0
  1339. package/docs/api/namespaces/ProtocolAddress/README.md +33 -0
  1340. package/docs/api/namespaces/ProtocolAddress/functions/create.md +41 -0
  1341. package/docs/api/namespaces/ProtocolAddress/functions/equals.md +39 -0
  1342. package/docs/api/namespaces/ProtocolAddress/functions/fromStorageKey.md +36 -0
  1343. package/docs/api/namespaces/ProtocolAddress/functions/isUser.md +39 -0
  1344. package/docs/api/namespaces/ProtocolAddress/functions/isValid.md +34 -0
  1345. package/docs/api/namespaces/ProtocolAddress/functions/parse.md +41 -0
  1346. package/docs/api/namespaces/ProtocolAddress/functions/toStorageKey.md +38 -0
  1347. package/docs/api/namespaces/ProtocolAddress/functions/toString.md +34 -0
  1348. package/docs/api/namespaces/SessionRecord/README.md +30 -0
  1349. package/docs/api/namespaces/SessionRecord/functions/archiveCurrent.md +40 -0
  1350. package/docs/api/namespaces/SessionRecord/functions/archiveCurrentState.md +34 -0
  1351. package/docs/api/namespaces/SessionRecord/functions/create.md +25 -0
  1352. package/docs/api/namespaces/SessionRecord/functions/deserialize.md +29 -0
  1353. package/docs/api/namespaces/SessionRecord/functions/findSession.md +34 -0
  1354. package/docs/api/namespaces/SessionRecord/functions/getAllSessions.md +25 -0
  1355. package/docs/api/namespaces/SessionRecord/functions/getArchivedCount.md +25 -0
  1356. package/docs/api/namespaces/SessionRecord/functions/hasCurrentSession.md +25 -0
  1357. package/docs/api/namespaces/SessionRecord/functions/hasUsableSenderChain.md +36 -0
  1358. package/docs/api/namespaces/SessionRecord/functions/promoteSession.md +34 -0
  1359. package/docs/api/namespaces/SessionRecord/functions/serialize.md +28 -0
  1360. package/docs/api/namespaces/SessionRecord/variables/MAX_ARCHIVED_SESSIONS.md +14 -0
  1361. package/docs/api/namespaces/SessionState/README.md +15 -0
  1362. package/docs/api/namespaces/SessionState/functions/getSessionId.md +32 -0
  1363. package/docs/api/namespaces/blocking/README.md +43 -0
  1364. package/docs/api/namespaces/encoding/README.md +33 -0
  1365. package/docs/api/namespaces/encoding/functions/base64ToUrlSafe.md +28 -0
  1366. package/docs/api/namespaces/encoding/functions/bytesToBase64.md +21 -0
  1367. package/docs/api/namespaces/encoding/functions/bytesToString.md +21 -0
  1368. package/docs/api/namespaces/encoding/functions/bytesToUrlSafeBase64.md +33 -0
  1369. package/docs/api/namespaces/encoding/functions/concatBytes.md +21 -0
  1370. package/docs/api/namespaces/encoding/functions/stringToBytes.md +21 -0
  1371. package/docs/api/namespaces/encoding/functions/urlSafeToBase64.md +27 -0
  1372. package/docs/api/namespaces/keys/README.md +126 -0
  1373. package/docs/api/namespaces/keys/functions/acceptContactIdentityRotation.md +33 -0
  1374. package/docs/api/namespaces/keys/functions/assertIdentityCommitment.md +25 -0
  1375. package/docs/api/namespaces/keys/functions/compositeIdentitiesEqual.md +23 -0
  1376. package/docs/api/namespaces/keys/functions/createCompositeIdentityV1.md +19 -0
  1377. package/docs/api/namespaces/keys/functions/createPreKeySignatureContext.md +31 -0
  1378. package/docs/api/namespaces/keys/functions/createUnverifiedContactIdentityRecord.md +23 -0
  1379. package/docs/api/namespaces/keys/functions/decodeCompositeIdentityV1.md +19 -0
  1380. package/docs/api/namespaces/keys/functions/deriveIdentityCommitment.md +19 -0
  1381. package/docs/api/namespaces/keys/functions/encodeCompositeIdentityV1.md +19 -0
  1382. package/docs/api/namespaces/keys/functions/evaluateContactIdentityCandidate.md +27 -0
  1383. package/docs/api/namespaces/keys/functions/generateEcOneTimePreKeys.md +37 -0
  1384. package/docs/api/namespaces/keys/functions/generateEcSignedPreKey.md +39 -0
  1385. package/docs/api/namespaces/keys/functions/generateEcSignedPreKeyId.md +21 -0
  1386. package/docs/api/namespaces/keys/functions/generateIdentityKeyPair.md +24 -0
  1387. package/docs/api/namespaces/keys/functions/generateKemOneTimePreKeys.md +47 -0
  1388. package/docs/api/namespaces/keys/functions/generateKyberLastResortPreKey.md +37 -0
  1389. package/docs/api/namespaces/keys/functions/generateRegistrationId.md +13 -0
  1390. package/docs/api/namespaces/keys/functions/signMlKem1024PreKey.md +29 -0
  1391. package/docs/api/namespaces/keys/functions/signPreKey.md +31 -0
  1392. package/docs/api/namespaces/keys/functions/validateContactIdentityRecord.md +19 -0
  1393. package/docs/api/namespaces/keys/functions/verifyContactIdentityRecord.md +31 -0
  1394. package/docs/api/namespaces/keys/functions/verifyMlKem1024PreKey.md +33 -0
  1395. package/docs/api/namespaces/keys/functions/verifyPreKeySignature.md +35 -0
  1396. package/docs/api/namespaces/keys/interfaces/CompositeIdentityV1.md +33 -0
  1397. package/docs/api/namespaces/keys/interfaces/ContactIdentityRecord.md +53 -0
  1398. package/docs/api/namespaces/keys/interfaces/KemOneTimePreKey.md +43 -0
  1399. package/docs/api/namespaces/keys/type-aliases/IdentityCandidateStatus.md +9 -0
  1400. package/docs/api/namespaces/keys/type-aliases/IdentityTrustState.md +9 -0
  1401. package/docs/api/namespaces/keys/type-aliases/IdentityType.md +9 -0
  1402. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_ED25519_TAG.md +9 -0
  1403. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_LENGTH.md +9 -0
  1404. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_VERSION.md +9 -0
  1405. package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_X25519_TAG.md +9 -0
  1406. package/docs/api/namespaces/keys/variables/IDENTITY_COMMITMENT_V1_DOMAIN.md +9 -0
  1407. package/docs/api/namespaces/keys/variables/PREKEY_ALGORITHM_ML_KEM_1024.md +9 -0
  1408. package/docs/api/namespaces/keys/variables/PREKEY_ALGORITHM_X25519.md +9 -0
  1409. package/docs/api/namespaces/keys/variables/PREKEY_SIGNATURE_V1_DOMAIN.md +9 -0
  1410. package/docs/api/namespaces/media/README.md +105 -0
  1411. package/docs/api/namespaces/media/classes/MediaAttachmentError.md +57 -0
  1412. package/docs/api/namespaces/media/functions/createByteRangeMediaAttachmentTransfer.md +19 -0
  1413. package/docs/api/namespaces/media/functions/createMediaAttachmentDeliveryId.md +29 -0
  1414. package/docs/api/namespaces/media/functions/createMediaAttachmentId.md +19 -0
  1415. package/docs/api/namespaces/media/functions/createMediaAttachmentMessage.md +25 -0
  1416. package/docs/api/namespaces/media/functions/createMediaAttachmentPointer.md +19 -0
  1417. package/docs/api/namespaces/media/functions/createTusMediaAttachmentTransfer.md +19 -0
  1418. package/docs/api/namespaces/media/functions/deleteMediaAttachment.md +23 -0
  1419. package/docs/api/namespaces/media/functions/executeMediaAttachmentJob.md +23 -0
  1420. package/docs/api/namespaces/media/functions/isMediaAttachmentFlagSet.md +19 -0
  1421. package/docs/api/namespaces/media/functions/parseMediaAttachmentMessage.md +19 -0
  1422. package/docs/api/namespaces/media/functions/planMediaAttachmentCleanup.md +23 -0
  1423. package/docs/api/namespaces/media/functions/planMediaAttachmentCleanupJobs.md +19 -0
  1424. package/docs/api/namespaces/media/functions/planMediaAttachmentDeleteSync.md +19 -0
  1425. package/docs/api/namespaces/media/functions/planMediaAttachmentDownloadJob.md +19 -0
  1426. package/docs/api/namespaces/media/functions/planMediaAttachmentOpen.md +19 -0
  1427. package/docs/api/namespaces/media/functions/planMediaAttachmentProcessing.md +19 -0
  1428. package/docs/api/namespaces/media/functions/planMediaAttachmentUploadJob.md +19 -0
  1429. package/docs/api/namespaces/media/functions/prepareMediaAttachmentUpload.md +30 -0
  1430. package/docs/api/namespaces/media/functions/resolveMediaAttachment.md +30 -0
  1431. package/docs/api/namespaces/media/functions/serializeMediaAttachmentMessage.md +25 -0
  1432. package/docs/api/namespaces/media/functions/validateMediaAttachmentPolicy.md +23 -0
  1433. package/docs/api/namespaces/media/interfaces/ByteRangeMediaAttachmentPartialStore.md +68 -0
  1434. package/docs/api/namespaces/media/interfaces/ByteRangeMediaAttachmentTransferOptions.md +91 -0
  1435. package/docs/api/namespaces/media/interfaces/DeleteMediaAttachmentOptions.md +25 -0
  1436. package/docs/api/namespaces/media/interfaces/DeleteMediaAttachmentResult.md +19 -0
  1437. package/docs/api/namespaces/media/interfaces/ExecuteMediaAttachmentJobOptions.md +157 -0
  1438. package/docs/api/namespaces/media/interfaces/MediaAttachmentBackgroundJob.md +85 -0
  1439. package/docs/api/namespaces/media/interfaces/MediaAttachmentCleanupPlan.md +37 -0
  1440. package/docs/api/namespaces/media/interfaces/MediaAttachmentJobExecutionResult.md +55 -0
  1441. package/docs/api/namespaces/media/interfaces/MediaAttachmentMessage.md +31 -0
  1442. package/docs/api/namespaces/media/interfaces/MediaAttachmentOpenDecision.md +31 -0
  1443. package/docs/api/namespaces/media/interfaces/MediaAttachmentPointer.md +133 -0
  1444. package/docs/api/namespaces/media/interfaces/MediaAttachmentPolicy.md +67 -0
  1445. package/docs/api/namespaces/media/interfaces/MediaAttachmentProcessingPlan.md +73 -0
  1446. package/docs/api/namespaces/media/interfaces/MediaAttachmentProgress.md +69 -0
  1447. package/docs/api/namespaces/media/interfaces/MediaAttachmentResumeState.md +37 -0
  1448. package/docs/api/namespaces/media/interfaces/MediaAttachmentRetryOptions.md +31 -0
  1449. package/docs/api/namespaces/media/interfaces/MediaAttachmentTransfer.md +51 -0
  1450. package/docs/api/namespaces/media/interfaces/MediaAttachmentTransferCheckpoint.md +69 -0
  1451. package/docs/api/namespaces/media/interfaces/MediaAttachmentTransferOptions.md +67 -0
  1452. package/docs/api/namespaces/media/interfaces/MediaAttachmentUploadJobData.md +19 -0
  1453. package/docs/api/namespaces/media/interfaces/MediaAttachmentUploadResponse.md +25 -0
  1454. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentCleanupJobsInput.md +61 -0
  1455. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentDeleteSyncInput.md +25 -0
  1456. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentDownloadJobInput.md +161 -0
  1457. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentOpenInput.md +25 -0
  1458. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentProcessingInput.md +83 -0
  1459. package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentUploadJobInput.md +147 -0
  1460. package/docs/api/namespaces/media/interfaces/PrepareMediaAttachmentUploadOptions.md +144 -0
  1461. package/docs/api/namespaces/media/interfaces/ResolveMediaAttachmentOptions.md +55 -0
  1462. package/docs/api/namespaces/media/interfaces/ResolvedMediaAttachment.md +109 -0
  1463. package/docs/api/namespaces/media/interfaces/TusMediaAttachmentTransferOptions.md +85 -0
  1464. package/docs/api/namespaces/media/type-aliases/CreateMediaAttachmentPointerInput.md +15 -0
  1465. package/docs/api/namespaces/media/type-aliases/MediaAttachmentCheckpointCallback.md +19 -0
  1466. package/docs/api/namespaces/media/type-aliases/MediaAttachmentCleanupReason.md +9 -0
  1467. package/docs/api/namespaces/media/type-aliases/MediaAttachmentErrorCode.md +9 -0
  1468. package/docs/api/namespaces/media/type-aliases/MediaAttachmentFlag.md +9 -0
  1469. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobExecutionStatus.md +9 -0
  1470. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobOperation.md +9 -0
  1471. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobPriority.md +9 -0
  1472. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobSkipReason.md +9 -0
  1473. package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobSource.md +9 -0
  1474. package/docs/api/namespaces/media/type-aliases/MediaAttachmentKnownIds.md +9 -0
  1475. package/docs/api/namespaces/media/type-aliases/MediaAttachmentMessageType.md +9 -0
  1476. package/docs/api/namespaces/media/type-aliases/MediaAttachmentProgressCallback.md +19 -0
  1477. package/docs/api/namespaces/media/variables/MEDIA_ATTACHMENT_POLICY_DEFAULTS.md +47 -0
  1478. package/docs/api/namespaces/media/variables/MEDIA_ATTACHMENT_POLICY_PRESETS.md +95 -0
  1479. package/docs/api/namespaces/media/variables/MediaAttachmentCleanupReason.md +27 -0
  1480. package/docs/api/namespaces/media/variables/MediaAttachmentErrorCode.md +75 -0
  1481. package/docs/api/namespaces/media/variables/MediaAttachmentFlag.md +23 -0
  1482. package/docs/api/namespaces/media/variables/MediaAttachmentJobExecutionStatus.md +19 -0
  1483. package/docs/api/namespaces/media/variables/MediaAttachmentJobOperation.md +31 -0
  1484. package/docs/api/namespaces/media/variables/MediaAttachmentJobPriority.md +23 -0
  1485. package/docs/api/namespaces/media/variables/MediaAttachmentJobSource.md +51 -0
  1486. package/docs/api/namespaces/media/variables/MediaAttachmentMessageType.md +15 -0
  1487. package/docs/api/namespaces/media/variables/downloadMediaAttachment.md +30 -0
  1488. package/docs/api/namespaces/safety/README.md +61 -0
  1489. package/docs/api/namespaces/safety/classes/DisplayableFingerprint.md +108 -0
  1490. package/docs/api/namespaces/safety/classes/Fingerprint.md +104 -0
  1491. package/docs/api/namespaces/safety/classes/ScannableFingerprint.md +209 -0
  1492. package/docs/api/namespaces/safety/functions/base64ToBytes.md +21 -0
  1493. package/docs/api/namespaces/safety/functions/clearFingerprintCache.md +15 -0
  1494. package/docs/api/namespaces/safety/functions/compareSafetyNumbers.md +25 -0
  1495. package/docs/api/namespaces/safety/functions/createFingerprintData.md +60 -0
  1496. package/docs/api/namespaces/safety/functions/extractQrData.md +34 -0
  1497. package/docs/api/namespaces/safety/functions/generateCompositeSafetyNumber.md +39 -0
  1498. package/docs/api/namespaces/safety/functions/generateEmojiFingerprint.md +24 -0
  1499. package/docs/api/namespaces/safety/functions/generateSingleKeyReferenceSafetyNumber.md +51 -0
  1500. package/docs/api/namespaces/safety/functions/generateVerifySchemeUrl.md +32 -0
  1501. package/docs/api/namespaces/safety/functions/generateVerifyUrl.md +49 -0
  1502. package/docs/api/namespaces/safety/functions/isValidSafetyNumber.md +21 -0
  1503. package/docs/api/namespaces/safety/functions/isVerifyUrl.md +45 -0
  1504. package/docs/api/namespaces/safety/functions/parseVerifyUrl.md +31 -0
  1505. package/docs/api/namespaces/safety/interfaces/FingerprintData.md +52 -0
  1506. package/docs/api/namespaces/safety/interfaces/SafetyNumber.md +49 -0
  1507. package/docs/api/namespaces/safety/interfaces/VerifyLinkConfig.md +28 -0
  1508. package/docs/api/namespaces/safety/interfaces/VerifyUrlParams.md +49 -0
  1509. package/docs/api/namespaces/safety/type-aliases/CompareResult.md +21 -0
  1510. package/docs/api/namespaces/safety/variables/DEFAULT_VERIFY_LINK_CONFIG.md +12 -0
  1511. package/docs/api/namespaces/safety/variables/FINGERPRINT_ITERATIONS.md +12 -0
  1512. package/docs/api/namespaces/safety/variables/FINGERPRINT_VERSION.md +12 -0
  1513. package/docs/api/namespaces/safety/variables/VERIFY_BASE_URL.md +11 -0
  1514. package/docs/api/namespaces/safety/variables/VERIFY_SCHEME_URL.md +11 -0
  1515. package/docs/api/type-aliases/Base64.md +20 -0
  1516. package/docs/api/type-aliases/BraidPolicy.md +11 -0
  1517. package/docs/api/type-aliases/Bytes.md +20 -0
  1518. package/docs/api/type-aliases/Ciphertext.md +21 -0
  1519. package/docs/api/type-aliases/DeviceType.md +11 -0
  1520. package/docs/api/type-aliases/DownloadedAttachment.md +11 -0
  1521. package/docs/api/type-aliases/GroupId.md +27 -0
  1522. package/docs/api/type-aliases/Hex.md +20 -0
  1523. package/docs/api/type-aliases/HookName.md +11 -0
  1524. package/docs/api/type-aliases/PostQuantumPolicy.md +11 -0
  1525. package/docs/api/type-aliases/PreparedAttachmentUpload.md +14 -0
  1526. package/docs/api/type-aliases/PrivateKey.md +22 -0
  1527. package/docs/api/type-aliases/ProgressCallback.md +45 -0
  1528. package/docs/api/type-aliases/PublicKey.md +22 -0
  1529. package/docs/api/type-aliases/RemoteObjectCompleteUploadRequest.md +19 -0
  1530. package/docs/api/type-aliases/RemoteObjectDeleteRequest.md +19 -0
  1531. package/docs/api/type-aliases/RemoteObjectDownloadRequest.md +19 -0
  1532. package/docs/api/type-aliases/RemoteObjectUploadRequest.md +42 -0
  1533. package/docs/api/type-aliases/SCKAMode.md +11 -0
  1534. package/docs/api/type-aliases/SealedSenderAuth.md +15 -0
  1535. package/docs/api/type-aliases/SignalProtocolClientMediaCleanupInput.md +9 -0
  1536. package/docs/api/type-aliases/SignalProtocolClientMediaCleanupResult.md +9 -0
  1537. package/docs/api/type-aliases/SignalProtocolClientMediaDownloadInput.md +9 -0
  1538. package/docs/api/type-aliases/SignalProtocolClientMediaDownloadResult.md +9 -0
  1539. package/docs/api/type-aliases/SignalProtocolClientMediaOperationResult.md +9 -0
  1540. package/docs/api/type-aliases/SignalProtocolClientMediaUploadInput.md +9 -0
  1541. package/docs/api/type-aliases/SignalProtocolClientMediaUploadResult.md +9 -0
  1542. package/docs/api/type-aliases/Signature.md +21 -0
  1543. package/docs/api/type-aliases/Unsubscribe.md +15 -0
  1544. package/docs/api/variables/BraidPolicy.md +21 -0
  1545. package/docs/api/variables/DEFAULT_DEVICE_ID.md +12 -0
  1546. package/docs/api/variables/DOUBLE_RATCHET_SPEC.md +11 -0
  1547. package/docs/api/variables/GROUP_V2_PREFIX.md +11 -0
  1548. package/docs/api/variables/KEY_REFRESH_INTERVAL_MS_DEFAULT.md +11 -0
  1549. package/docs/api/variables/MAX_MESSAGE_KEYS.md +14 -0
  1550. package/docs/api/variables/MAX_PREKEY_AGE_MS_DEFAULT.md +11 -0
  1551. package/docs/api/variables/MAX_RECEIVER_CHAINS.md +14 -0
  1552. package/docs/api/variables/MAX_REGISTRATION_ID.md +16 -0
  1553. package/docs/api/variables/MAX_SKIP.md +11 -0
  1554. package/docs/api/variables/MESSAGE_FORMAT.md +11 -0
  1555. package/docs/api/variables/MIN_REGISTRATION_ID.md +16 -0
  1556. package/docs/api/variables/ML_KEM_BRAID_SPEC.md +11 -0
  1557. package/docs/api/variables/ONE_TIME_PREKEY_BATCH_SIZE.md +21 -0
  1558. package/docs/api/variables/PQXDH_SPEC.md +11 -0
  1559. package/docs/api/variables/PostQuantumPolicy.md +21 -0
  1560. package/docs/api/variables/SENDER_KEY_FORMAT.md +11 -0
  1561. package/docs/api/variables/SENDER_KEY_SPEC.md +11 -0
  1562. package/docs/api/variables/SESAME_SPEC.md +11 -0
  1563. package/docs/api/variables/SESSION_FORMAT.md +11 -0
  1564. package/docs/api/variables/SPQR_LIMITS_DEFAULTS.md +11 -0
  1565. package/docs/api/variables/X3DH_SPEC.md +9 -0
  1566. package/docs/api/variables/defaultSignalLogger.md +32 -0
  1567. package/encoding/README.md +32 -0
  1568. package/files/README.md +37 -0
  1569. package/groups/README.md +42 -0
  1570. package/hooks/README.md +40 -0
  1571. package/keys/README.md +121 -0
  1572. package/local/store/README.md +120 -0
  1573. package/local/store/expo/README.md +73 -0
  1574. package/local/store/mock/README.md +27 -0
  1575. package/local/store/node/README.md +35 -0
  1576. package/local/store/react-native/README.md +39 -0
  1577. package/local/store/web/README.md +65 -0
  1578. package/local/vault/README.md +32 -0
  1579. package/media/README.md +73 -0
  1580. package/package.json +436 -0
  1581. package/profile/README.md +44 -0
  1582. package/remote/README.md +219 -0
  1583. package/remote/object-store/README.md +45 -0
  1584. package/remote/object-store/convex-r2/README.md +85 -0
  1585. package/remote/object-store/s3/README.md +35 -0
  1586. package/remote/relay/README.md +38 -0
  1587. package/remote/relay/convex/README.md +54 -0
  1588. package/remote/relay/mock/README.md +32 -0
  1589. package/safety/README.md +42 -0
  1590. package/sealed-sender/README.md +32 -0
  1591. package/types/README.md +36 -0
  1592. package/username/README.md +37 -0
  1593. package/utils/README.md +37 -0
  1594. package/zk/README.md +36 -0
@@ -0,0 +1,608 @@
1
+ /**
2
+ * Prekey management and server synchronization for SignalProtocolClient
3
+ *
4
+ * Extracted from SignalProtocolClient class to reduce file size.
5
+ * Handles prekey bundle upload, verification, and regeneration.
6
+ */
7
+ import { EncryptionError, EncryptionErrorCode, ONE_TIME_PREKEY_BATCH_SIZE } from '../types/index.js';
8
+ import { generateKemOneTimePreKeys, generateEcOneTimePreKeys, generateEcSignedPreKey, generateKyberLastResortPreKey, } from '../keys/index.js';
9
+ import { getActiveIdentityTypes, PREKEY_CHECK_THROTTLE_MS_DEFAULT, } from './config.js';
10
+ import { MAX_UNACKNOWLEDGED_SESSION_AGE_MS } from './config.js';
11
+ import { MIN_PREKEY_REPLENISHMENT_THRESHOLD } from './key-rotation-core.js';
12
+ const lastPreKeySyncTimeByClient = new Map();
13
+ const lastPreKeyStatusCheckTimeByIdentity = new Map();
14
+ function getClientThrottleKey(ctx) {
15
+ return `${ctx.userId}:${ctx.deviceId}`;
16
+ }
17
+ function getStatusThrottleKey(ctx, identityType) {
18
+ return `${ctx.userId}:${ctx.deviceId}:${identityType}`;
19
+ }
20
+ async function isServerInSyncForIdentity(ctx, identityType) {
21
+ if (!ctx.relay)
22
+ return false;
23
+ const [localSignedPreKey, localKyberPreKey] = await Promise.all([
24
+ ctx.storage.getEcSignedPreKey(undefined, identityType),
25
+ ctx.storage.getKyberPreKey(identityType),
26
+ ]);
27
+ // Local key material is incomplete, so throttled sync must not skip.
28
+ if (!localSignedPreKey || !localKyberPreKey) {
29
+ return false;
30
+ }
31
+ const [serverSignedMeta, serverKyberMeta, serverEcCount, serverKemCount] = await Promise.all([
32
+ ctx.relay.getEcSignedPreKeyMetadata(ctx.userId, ctx.deviceId, identityType),
33
+ ctx.relay.getKemLastResortPreKeyMetadata(ctx.userId, ctx.deviceId, identityType),
34
+ ctx.relay.getPreKeyCount(ctx.userId, ctx.deviceId, 'ec', identityType),
35
+ ctx.relay.getPreKeyCount(ctx.userId, ctx.deviceId, 'kem', identityType),
36
+ ]);
37
+ if (!serverSignedMeta || !serverKyberMeta) {
38
+ return false;
39
+ }
40
+ const signedKeyMatches = serverSignedMeta.keyId === localSignedPreKey.keyId &&
41
+ serverSignedMeta.publicKey === localSignedPreKey.publicKey;
42
+ const kyberKeyMatches = serverKyberMeta.keyId === localKyberPreKey.keyId &&
43
+ serverKyberMeta.publicKey === localKyberPreKey.publicKey;
44
+ const hasEnoughPreKeys = serverEcCount >= MIN_PREKEY_REPLENISHMENT_THRESHOLD &&
45
+ serverKemCount >= MIN_PREKEY_REPLENISHMENT_THRESHOLD;
46
+ return signedKeyMatches && kyberKeyMatches && hasEnoughPreKeys;
47
+ }
48
+ async function isServerInSyncForAllActiveIdentities(ctx) {
49
+ if (!ctx.relay)
50
+ return false;
51
+ for (const identityType of getActiveIdentityTypes(ctx.config)) {
52
+ const inSync = await isServerInSyncForIdentity(ctx, identityType);
53
+ if (!inSync) {
54
+ return false;
55
+ }
56
+ }
57
+ return true;
58
+ }
59
+ /**
60
+ * Reset the prekey-check throttle for controlled local resets.
61
+ */
62
+ export function resetPreKeyCheckThrottle() {
63
+ lastPreKeySyncTimeByClient.clear();
64
+ lastPreKeyStatusCheckTimeByIdentity.clear();
65
+ }
66
+ /**
67
+ * Sync the public prekey bundle to the configured relay.
68
+ *
69
+ * Performs:
70
+ * 1. Generates prekey bundle if not already present (identity, signed, one-time prekeys)
71
+ * 2. Generates KEM prekey material if not already present
72
+ * 3. Uploads public keys to the relay server
73
+ * 4. Provides progress updates
74
+ *
75
+ * @param ctx - Prekey context with dependencies
76
+ * @param onProgress - Optional progress callback
77
+ * @param options - Optional options (e.g., force to bypass throttle)
78
+ */
79
+ export async function syncToServer(ctx, onProgress, options) {
80
+ if (!ctx.relay) {
81
+ throw new EncryptionError('Relay server not configured', EncryptionErrorCode.INITIALIZATION_FAILED);
82
+ }
83
+ // Throttle prekey checks (skip if within throttle window), but never skip
84
+ // when the server is missing bootstrap material for any active identity type.
85
+ const clientKey = getClientThrottleKey(ctx);
86
+ const lastSync = lastPreKeySyncTimeByClient.get(clientKey) ?? 0;
87
+ if (!options?.force && lastSync > 0) {
88
+ const throttleMs = ctx.config.preKeyCheckThrottleMs ?? PREKEY_CHECK_THROTTLE_MS_DEFAULT;
89
+ if (Date.now() - lastSync < throttleMs) {
90
+ const serverReady = await isServerInSyncForAllActiveIdentities(ctx);
91
+ if (serverReady) {
92
+ ctx.logger.debug('Prekey sync throttled', { category: 'E2EE' });
93
+ return;
94
+ }
95
+ }
96
+ }
97
+ try {
98
+ onProgress?.({
99
+ stage: 'generating-keys',
100
+ percent: 20,
101
+ message: 'Creating your encryption keys...',
102
+ });
103
+ // Sync active identity types (ACI always; PNI only for phone-number apps)
104
+ for (const identityType of getActiveIdentityTypes(ctx.config)) {
105
+ await syncIdentityToServer(ctx, identityType, onProgress);
106
+ }
107
+ onProgress?.({
108
+ stage: 'complete',
109
+ percent: 100,
110
+ message: 'Your device is secured',
111
+ });
112
+ ctx.logger.debug('Synced identity types to server with PQXDH support', {
113
+ category: 'E2EE',
114
+ data: {
115
+ userId: ctx.userId,
116
+ deviceId: ctx.deviceId,
117
+ },
118
+ });
119
+ lastPreKeySyncTimeByClient.set(clientKey, Date.now());
120
+ }
121
+ catch (error) {
122
+ throw new EncryptionError('Failed to sync with server', EncryptionErrorCode.INITIALIZATION_FAILED, { originalError: error });
123
+ }
124
+ }
125
+ /**
126
+ * Sync the public prekey bundle for a specific identity type to the relay.
127
+ *
128
+ * Performs per-identity-type:
129
+ * 1. Generates prekey bundle if not already present
130
+ * 2. Generates KEM prekey material if not already present
131
+ * 3. Uploads public keys to the relay
132
+ *
133
+ * ACI and PNI inventories are synchronized independently.
134
+ *
135
+ * @param ctx - Prekey context with dependencies
136
+ * @param identityType - 'aci' or 'pni'
137
+ * @param onProgress - Optional progress callback
138
+ */
139
+ export async function syncIdentityToServer(ctx, identityType, onProgress) {
140
+ const preKeyMaintenance = ctx.config.preKeyMaintenance;
141
+ // Generate prekey bundle if signed prekey doesn't exist
142
+ // Note: initialize() generates identity key, but generatePreKeyBundle()
143
+ // is needed to create signed prekey and one-time prekeys
144
+ const existingSignedPreKey = await ctx.storage.getEcSignedPreKey(undefined, identityType);
145
+ if (!existingSignedPreKey) {
146
+ await ctx.manager.generatePreKeyBundle(ctx.userId, ctx.deviceId, identityType);
147
+ }
148
+ // Get keys from storage
149
+ const identityKey = await ctx.storage.getIdentityKey(identityType);
150
+ const signedPreKey = await ctx.storage.getEcSignedPreKey(undefined, identityType);
151
+ const oneTimePreKeys = await ctx.storage.getEcOneTimePreKeys(identityType);
152
+ if (!identityKey || !signedPreKey) {
153
+ throw new Error(`Keys not generated - identity or signed prekey missing (${identityType})`);
154
+ }
155
+ // Check if Kyber prekey already exists
156
+ let kyberPreKey = await ctx.storage.getKyberPreKey(identityType);
157
+ if (!kyberPreKey) {
158
+ onProgress?.({
159
+ stage: 'generating-kyber',
160
+ percent: 50,
161
+ message: 'Generating post-quantum prekeys...',
162
+ detail: { current: 0, total: 1 },
163
+ });
164
+ kyberPreKey = await generateKyberLastResortPreKey(identityKey, 1);
165
+ // Store Kyber prekey locally
166
+ await ctx.storage.storeKyberPreKey(kyberPreKey, identityType);
167
+ onProgress?.({
168
+ stage: 'generating-kyber',
169
+ percent: 60,
170
+ message: 'Post-quantum prekeys ready',
171
+ detail: { current: 1, total: 1 },
172
+ });
173
+ }
174
+ // Quick check: is the server already in sync for this identity type?
175
+ // This turns a 5+ mutation sequence into 3 lightweight query checks on most app opens.
176
+ const serverSignedMeta = await ctx.relay.getEcSignedPreKeyMetadata(ctx.userId, ctx.deviceId, identityType);
177
+ const serverKyberMeta = await ctx.relay.getKemLastResortPreKeyMetadata(ctx.userId, ctx.deviceId, identityType);
178
+ const serverEcCount = await ctx.relay.getPreKeyCount(ctx.userId, ctx.deviceId, 'ec', identityType);
179
+ const serverKemCount = await ctx.relay.getPreKeyCount(ctx.userId, ctx.deviceId, 'kem', identityType);
180
+ const signedKeyMatches = serverSignedMeta &&
181
+ serverSignedMeta.keyId === signedPreKey.keyId &&
182
+ serverSignedMeta.publicKey === signedPreKey.publicKey;
183
+ const kyberKeyMatches = !kyberPreKey ||
184
+ (serverKyberMeta &&
185
+ serverKyberMeta.keyId === kyberPreKey.keyId &&
186
+ serverKyberMeta.publicKey === kyberPreKey.publicKey);
187
+ // Require independent EC and KEM inventory thresholds.
188
+ const hasEnoughPreKeys = serverEcCount >= MIN_PREKEY_REPLENISHMENT_THRESHOLD &&
189
+ serverKemCount >= MIN_PREKEY_REPLENISHMENT_THRESHOLD;
190
+ if (signedKeyMatches && kyberKeyMatches && hasEnoughPreKeys) {
191
+ ctx.logger.debug(`syncToServer: ${identityType} server already in sync, skipping uploads`, {
192
+ category: 'E2EE',
193
+ data: { identityType, serverEcCount, serverKemCount },
194
+ });
195
+ return;
196
+ }
197
+ onProgress?.({
198
+ stage: 'uploading',
199
+ percent: 75,
200
+ message: 'Syncing keys to your account...',
201
+ });
202
+ // Provision this device against the account identity. A different tuple must
203
+ // go through the relay's explicit compare-and-swap rotation operation.
204
+ const { createCompositeIdentityV1 } = await import('../keys/identity.js');
205
+ await ctx.relay.provisionIdentityKey({
206
+ userId: ctx.userId,
207
+ deviceId: ctx.deviceId,
208
+ identity: createCompositeIdentityV1(identityKey),
209
+ registrationId: identityKey.registrationId,
210
+ identityType,
211
+ });
212
+ // Replenish EC one-time prekeys if server is low (mirrors KEM replenishment below)
213
+ const MAX_EC_PREKEYS = 200;
214
+ const availableSlots = Math.max(0, MAX_EC_PREKEYS - serverEcCount);
215
+ if (serverEcCount < MIN_PREKEY_REPLENISHMENT_THRESHOLD &&
216
+ oneTimePreKeys.length < availableSlots) {
217
+ // Mark existing active one-time prekeys as replaced before generating new batch
218
+ await preKeyMaintenance?.markEcOneTimePreKeysReplaced(identityType);
219
+ // Determine next key ID from existing local prekeys
220
+ const maxExistingId = oneTimePreKeys.reduce((max, k) => Math.max(max, k.keyId), -1);
221
+ const startId = maxExistingId + 1;
222
+ const toGenerate = Math.min(ONE_TIME_PREKEY_BATCH_SIZE, availableSlots - oneTimePreKeys.length);
223
+ const freshPreKeys = await generateEcOneTimePreKeys(toGenerate, startId);
224
+ await ctx.storage.storeEcOneTimePreKeys(freshPreKeys, identityType);
225
+ oneTimePreKeys.push(...freshPreKeys);
226
+ onProgress?.({
227
+ stage: 'generating-keys',
228
+ percent: 30,
229
+ message: 'Encryption keys ready',
230
+ detail: { current: freshPreKeys.length, total: toGenerate },
231
+ });
232
+ ctx.logger.debug('Generated fresh EC one-time prekeys', {
233
+ category: 'E2EE',
234
+ data: { identityType, count: freshPreKeys.length, startId },
235
+ });
236
+ }
237
+ const oneTimePreKeysToUpload = oneTimePreKeys.slice(0, availableSlots);
238
+ ctx.logger.debug('One-time prekey upload calculation', {
239
+ category: 'E2EE',
240
+ data: {
241
+ identityType,
242
+ serverPreKeyCount: serverEcCount,
243
+ availableSlots,
244
+ uploading: oneTimePreKeysToUpload.length,
245
+ },
246
+ });
247
+ // Build prekey batch for upload
248
+ const preKeyUploads = [
249
+ // Signed prekey (rotated weekly)
250
+ {
251
+ type: 'ecSignedPreKey',
252
+ keyId: signedPreKey.keyId,
253
+ publicKey: signedPreKey.publicKey,
254
+ signature: signedPreKey.signature,
255
+ },
256
+ // One-time prekeys (consumed on use) - only upload what server can accept
257
+ ...oneTimePreKeysToUpload.map((k) => ({
258
+ type: 'ecPreKey',
259
+ keyId: k.keyId,
260
+ publicKey: k.publicKey,
261
+ })),
262
+ ];
263
+ // Add Kyber last-resort prekey if available (for post-quantum security)
264
+ if (kyberPreKey) {
265
+ preKeyUploads.push({
266
+ type: 'kemLastResortPreKey',
267
+ keyId: kyberPreKey.keyId,
268
+ publicKey: kyberPreKey.publicKey,
269
+ signature: kyberPreKey.signature,
270
+ });
271
+ }
272
+ // Check and upload KEM one-time prekeys (per-session post-quantum forward secrecy)
273
+ // Re-fetch KEM count because a concurrent consumer may have changed it.
274
+ const serverKemPreKeyCount = await ctx.relay.getPreKeyCount(ctx.userId, ctx.deviceId, 'kem', identityType);
275
+ if (serverKemPreKeyCount < MIN_PREKEY_REPLENISHMENT_THRESHOLD) {
276
+ // Mark existing active KEM one-time prekeys as replaced before generating new batch
277
+ await preKeyMaintenance?.markKyberOneTimePreKeysReplaced(identityType);
278
+ // Get existing local KEM one-time prekeys to determine next ID
279
+ const existingKemPreKeys = await ctx.storage.getKemOneTimePreKeys(identityType);
280
+ const maxExistingId = existingKemPreKeys.reduce((max, k) => Math.max(max, k.keyId), -1);
281
+ const startId = maxExistingId + 1;
282
+ // Generate new KEM one-time prekeys
283
+ const kemOneTimePreKeys = await generateKemOneTimePreKeys(identityKey, ONE_TIME_PREKEY_BATCH_SIZE, startId);
284
+ // Store locally
285
+ await ctx.storage.storeKemOneTimePreKeys(kemOneTimePreKeys, identityType);
286
+ onProgress?.({
287
+ stage: 'generating-kyber',
288
+ percent: 65,
289
+ message: 'Post-quantum prekeys ready',
290
+ detail: { current: kemOneTimePreKeys.length, total: ONE_TIME_PREKEY_BATCH_SIZE },
291
+ });
292
+ // Add to upload batch
293
+ for (const k of kemOneTimePreKeys) {
294
+ preKeyUploads.push({
295
+ type: 'kemOneTimePreKey',
296
+ keyId: k.keyId,
297
+ publicKey: k.publicKey,
298
+ signature: k.signature,
299
+ });
300
+ }
301
+ ctx.logger.debug('Generated and uploading KEM one-time prekeys', {
302
+ category: 'E2EE',
303
+ data: { identityType, count: kemOneTimePreKeys.length, startId },
304
+ });
305
+ }
306
+ // Upload all prekeys to server (with identity type)
307
+ onProgress?.({
308
+ stage: 'uploading',
309
+ percent: 85,
310
+ message: 'Syncing keys to your account...',
311
+ });
312
+ await ctx.relay.uploadPreKeys(ctx.userId, ctx.deviceId, preKeyUploads, identityType);
313
+ onProgress?.({
314
+ stage: 'uploading',
315
+ percent: 95,
316
+ message: 'Keys synced',
317
+ });
318
+ // Cull replaced one-time prekeys only after the replacement upload succeeds.
319
+ if (preKeyMaintenance) {
320
+ try {
321
+ await preKeyMaintenance.cullReplacedOneTimePreKeys(MAX_UNACKNOWLEDGED_SESSION_AGE_MS, identityType);
322
+ }
323
+ catch {
324
+ // Best-effort cleanup — non-critical
325
+ }
326
+ }
327
+ ctx.logger.debug(`Synced ${identityType} to server with PQXDH support`, {
328
+ category: 'E2EE',
329
+ data: {
330
+ userId: ctx.userId,
331
+ deviceId: ctx.deviceId,
332
+ identityType,
333
+ hasKyberPreKey: true,
334
+ },
335
+ });
336
+ }
337
+ /**
338
+ * Regenerate prekeys with fresh IDs
339
+ *
340
+ * Per PQXDH §4.13, identifier collisions (same keyId, different publicKey)
341
+ * cause MAC verification failures. This method:
342
+ * 1. Gets the current max keyId from storage
343
+ * 2. Generates NEW prekeys with incremented IDs
344
+ * 3. Uploads to server (replacing old bundle)
345
+ *
346
+ * Called automatically on stale-prekey detection and as a recovery mechanism
347
+ * for persistent MAC verification failures.
348
+ *
349
+ * @param ctx - Prekey context with dependencies
350
+ * @throws EncryptionError if relay not configured or operation fails
351
+ */
352
+ export async function regeneratePreKeysWithFreshIds(ctx, identityType = 'aci') {
353
+ if (!ctx.relay) {
354
+ throw new EncryptionError('Cannot regenerate prekeys: relay not configured', EncryptionErrorCode.INITIALIZATION_FAILED);
355
+ }
356
+ // Get identity key for signing new prekeys
357
+ const identityKey = await ctx.storage.getIdentityKey(identityType);
358
+ if (!identityKey) {
359
+ throw new EncryptionError('Cannot regenerate prekeys: identity key not found', EncryptionErrorCode.INITIALIZATION_FAILED);
360
+ }
361
+ // Get current max ID for signed prekey (uses sequential IDs)
362
+ const currentSignedId = await ctx.storage.getEcSignedPreKeyMaxId(identityType);
363
+ const newSignedId = currentSignedId + 1;
364
+ // Per PQXDH spec Section 3.2: Kyber last-resort prekey always uses ID 1
365
+ // Unlike signed prekeys, Kyber prekeys use upsert semantics (replace, not accumulate)
366
+ const newKyberId = 1;
367
+ ctx.logger.info('Regenerating prekeys with fresh IDs (identifier collision recovery)', {
368
+ category: 'E2EE',
369
+ data: {
370
+ oldSignedId: currentSignedId,
371
+ newSignedId,
372
+ kyberIdFixed: newKyberId, // Always 1 per PQXDH spec
373
+ },
374
+ });
375
+ // Generate new signed prekey with fresh sequential ID
376
+ const newSignedPreKey = await generateEcSignedPreKey(identityKey, newSignedId);
377
+ // Generate new Kyber prekey with fresh ID
378
+ const newKyberPreKey = await generateKyberLastResortPreKey(identityKey, newKyberId);
379
+ // Store new prekeys (replaces old ones)
380
+ await ctx.storage.storeEcSignedPreKey(newSignedPreKey, identityType);
381
+ await ctx.storage.storeKyberPreKey(newKyberPreKey, identityType);
382
+ // Build prekey upload batch
383
+ const preKeyUploads = [
384
+ {
385
+ type: 'ecSignedPreKey',
386
+ keyId: newSignedPreKey.keyId,
387
+ publicKey: newSignedPreKey.publicKey,
388
+ signature: newSignedPreKey.signature,
389
+ },
390
+ {
391
+ type: 'kemLastResortPreKey',
392
+ keyId: newKyberPreKey.keyId,
393
+ publicKey: newKyberPreKey.publicKey,
394
+ signature: newKyberPreKey.signature,
395
+ },
396
+ ];
397
+ // Clear stale KEM one-time prekeys before uploading fresh bundle
398
+ // Prevents PQXDH §4.13 identifier collisions (old one-time keys with stale IDs)
399
+ const clearResult = await ctx.relay.clearStaleKemPreKeys(ctx.userId, ctx.deviceId, identityType);
400
+ if (clearResult.cleared > 0) {
401
+ ctx.logger.info('Cleared stale KEM one-time prekeys before rotation', {
402
+ category: 'E2EE',
403
+ data: { clearedCount: clearResult.cleared },
404
+ });
405
+ }
406
+ // Upload to server
407
+ await ctx.relay.uploadPreKeys(ctx.userId, ctx.deviceId, preKeyUploads, identityType);
408
+ // Verify server has correct keys
409
+ await verifyServerKeys(ctx, { keyId: newSignedPreKey.keyId, publicKey: newSignedPreKey.publicKey }, { keyId: newKyberPreKey.keyId, publicKey: newKyberPreKey.publicKey }, 'regeneratePreKeysWithFreshIds', identityType);
410
+ ctx.logger.info('Prekey rotation complete - fresh bundle uploaded', {
411
+ category: 'E2EE',
412
+ data: {
413
+ signedPreKeyId: newSignedPreKey.keyId,
414
+ kyberPreKeyId: newKyberPreKey.keyId,
415
+ verified: true,
416
+ },
417
+ });
418
+ }
419
+ /**
420
+ * Force complete key reset (development/debugging only).
421
+ *
422
+ * WARNING: This is a "nuclear option" that will:
423
+ * - Delete ALL sessions (breaking existing conversations)
424
+ * - Delete ALL prekeys
425
+ * - Generate fresh prekeys with keyId=1
426
+ * - Upload new bundle to server
427
+ *
428
+ * Use only when:
429
+ * - Keys are known to be desynchronized (development)
430
+ * - Automated recovery has failed
431
+ * - User explicitly requests key reset
432
+ *
433
+ * @param ctx - Prekey context with dependencies
434
+ * @throws EncryptionError if relay not configured or operation fails
435
+ */
436
+ export async function forceCompleteKeyReset(ctx, identityType = 'aci') {
437
+ if (!ctx.relay) {
438
+ throw new EncryptionError('Cannot force key reset: relay not configured', EncryptionErrorCode.INITIALIZATION_FAILED);
439
+ }
440
+ ctx.logger.warn('Force key reset triggered - all sessions will be invalidated', {
441
+ category: 'E2EE',
442
+ });
443
+ // Get identity key for signing (we keep identity, just reset sessions and prekeys)
444
+ const identityKey = await ctx.storage.getIdentityKey(identityType);
445
+ if (!identityKey) {
446
+ throw new EncryptionError('Cannot force key reset: identity key not found', EncryptionErrorCode.INITIALIZATION_FAILED);
447
+ }
448
+ // Delete all sessions
449
+ await ctx.storage.clearAllSessions();
450
+ const sessionStats = await ctx.storage.getDetailedStats();
451
+ const deletedSessions = sessionStats.sessions; // Should be 0 after clear
452
+ // Delete all prekeys
453
+ const deletedPreKeys = await ctx.storage.deleteAllPreKeys(identityType);
454
+ // Generate fresh prekeys with keyId=1
455
+ const newSignedPreKey = await generateEcSignedPreKey(identityKey, 1 // Start fresh with ID 1
456
+ );
457
+ const newKyberPreKey = await generateKyberLastResortPreKey(identityKey, 1 // Start fresh with ID 1
458
+ );
459
+ // Store new prekeys
460
+ await ctx.storage.storeEcSignedPreKey(newSignedPreKey, identityType);
461
+ await ctx.storage.storeKyberPreKey(newKyberPreKey, identityType);
462
+ // Build prekey upload batch
463
+ const preKeyUploads = [
464
+ {
465
+ type: 'ecSignedPreKey',
466
+ keyId: newSignedPreKey.keyId,
467
+ publicKey: newSignedPreKey.publicKey,
468
+ signature: newSignedPreKey.signature,
469
+ },
470
+ {
471
+ type: 'kemLastResortPreKey',
472
+ keyId: newKyberPreKey.keyId,
473
+ publicKey: newKyberPreKey.publicKey,
474
+ signature: newKyberPreKey.signature,
475
+ },
476
+ ];
477
+ // Clear stale KEM one-time prekeys before uploading fresh bundle
478
+ const clearResult = await ctx.relay.clearStaleKemPreKeys(ctx.userId, ctx.deviceId, identityType);
479
+ if (clearResult.cleared > 0) {
480
+ ctx.logger.info('Cleared stale KEM one-time prekeys during key reset', {
481
+ category: 'E2EE',
482
+ data: { clearedCount: clearResult.cleared },
483
+ });
484
+ }
485
+ // Upload to server
486
+ await ctx.relay.uploadPreKeys(ctx.userId, ctx.deviceId, preKeyUploads, identityType);
487
+ // Verify server has correct keys
488
+ await verifyServerKeys(ctx, { keyId: newSignedPreKey.keyId, publicKey: newSignedPreKey.publicKey }, { keyId: newKyberPreKey.keyId, publicKey: newKyberPreKey.publicKey }, 'forceCompleteKeyReset', identityType);
489
+ ctx.logger.warn('Force key reset complete - fresh bundle uploaded', {
490
+ category: 'E2EE',
491
+ data: {
492
+ deletedSessions,
493
+ deletedPreKeys,
494
+ newSignedPreKeyId: newSignedPreKey.keyId,
495
+ newKyberPreKeyId: newKyberPreKey.keyId,
496
+ },
497
+ });
498
+ return {
499
+ deletedSessions,
500
+ deletedPreKeys,
501
+ };
502
+ }
503
+ /**
504
+ * Verify server has correct keys after upload
505
+ *
506
+ * Called after uploadPreKeys() to confirm the server received our keys correctly.
507
+ * This catches silent upload failures or server-side issues that could cause
508
+ * MAC failures when remote clients fetch stale bundles.
509
+ *
510
+ * @param ctx - Prekey context with dependencies
511
+ * @param signedPreKey - The signed prekey that was uploaded
512
+ * @param kyberPreKey - Optional Kyber prekey that was uploaded
513
+ * @param operation - Operation name for logging context
514
+ * @throws EncryptionError if verification fails
515
+ */
516
+ export async function verifyServerKeys(ctx, signedPreKey, kyberPreKey, operation, identityType = 'aci') {
517
+ if (!ctx.relay) {
518
+ throw new EncryptionError('Cannot verify server keys: relay not configured', EncryptionErrorCode.INITIALIZATION_FAILED);
519
+ }
520
+ // Verify signed prekey
521
+ const serverSignedMetadata = await ctx.relay.getEcSignedPreKeyMetadata(ctx.userId, ctx.deviceId, identityType);
522
+ if (!serverSignedMetadata) {
523
+ throw new EncryptionError('Server has no signed prekey after upload', EncryptionErrorCode.INITIALIZATION_FAILED);
524
+ }
525
+ if (serverSignedMetadata.publicKey !== signedPreKey.publicKey) {
526
+ ctx.logger.error('Server signed prekey mismatch after upload', {
527
+ category: 'E2EE',
528
+ data: {
529
+ local: signedPreKey.publicKey.substring(0, 20) + '...',
530
+ server: serverSignedMetadata.publicKey.substring(0, 20) + '...',
531
+ operation,
532
+ },
533
+ });
534
+ throw new EncryptionError('Failed to verify signed prekey on server - key mismatch detected', EncryptionErrorCode.INITIALIZATION_FAILED);
535
+ }
536
+ // Verify Kyber prekey if provided
537
+ if (kyberPreKey) {
538
+ const serverKyberMetadata = await ctx.relay.getKemLastResortPreKeyMetadata(ctx.userId, ctx.deviceId, identityType);
539
+ if (!serverKyberMetadata) {
540
+ throw new EncryptionError('Server has no Kyber prekey after upload', EncryptionErrorCode.INITIALIZATION_FAILED);
541
+ }
542
+ if (serverKyberMetadata.publicKey !== kyberPreKey.publicKey) {
543
+ ctx.logger.error('Server Kyber prekey mismatch after upload', {
544
+ category: 'E2EE',
545
+ data: {
546
+ local: kyberPreKey.publicKey.substring(0, 20) + '...',
547
+ server: serverKyberMetadata.publicKey.substring(0, 20) + '...',
548
+ operation,
549
+ },
550
+ });
551
+ throw new EncryptionError('Failed to verify Kyber prekey on server - key mismatch detected', EncryptionErrorCode.INITIALIZATION_FAILED);
552
+ }
553
+ }
554
+ ctx.logger.debug('Server key verification passed', {
555
+ category: 'E2EE',
556
+ data: { operation, hasKyberKey: !!kyberPreKey },
557
+ });
558
+ }
559
+ /**
560
+ * Check prekey status and determine if replenishment is needed
561
+ *
562
+ * @param ctx - Client context with dependencies
563
+ * @param threshold - Threshold below which replenishment is needed (default: 50)
564
+ * @param onPreKeyLow - Optional callback when prekeys are low
565
+ * @param identityType - Identity type to check (default: 'aci')
566
+ * @param options - Optional options (e.g., force to bypass throttle)
567
+ * @returns Prekey status with remaining count and replenishment flag
568
+ */
569
+ export async function checkPreKeyStatus(ctx, threshold = 50, onPreKeyLow, identityType = 'aci', options) {
570
+ const statusKey = getStatusThrottleKey(ctx, identityType);
571
+ const lastStatusCheck = lastPreKeyStatusCheckTimeByIdentity.get(statusKey) ?? 0;
572
+ // Throttle check (unless forced or first check)
573
+ if (!options?.force && lastStatusCheck > 0) {
574
+ const throttleMs = ctx.config.preKeyCheckThrottleMs ?? PREKEY_CHECK_THROTTLE_MS_DEFAULT;
575
+ if (Date.now() - lastStatusCheck < throttleMs) {
576
+ ctx.logger.debug('Prekey status check throttled', { category: 'E2EE' });
577
+ return { oneTimePreKeysRemaining: -1, needsReplenishment: false };
578
+ }
579
+ }
580
+ const prekeys = await ctx.storage.getEcOneTimePreKeys(identityType);
581
+ const remaining = prekeys.length;
582
+ const needsReplenishment = remaining < threshold;
583
+ // Call the onPreKeyLow callback if configured and below threshold
584
+ if (needsReplenishment && onPreKeyLow) {
585
+ try {
586
+ onPreKeyLow(remaining);
587
+ }
588
+ catch (error) {
589
+ ctx.logger.warn('onPreKeyLow callback failed', {
590
+ category: 'E2EE',
591
+ data: { error: error.message },
592
+ });
593
+ }
594
+ }
595
+ // Log warning when prekeys are running low
596
+ if (needsReplenishment) {
597
+ ctx.logger.warn('One-time prekeys running low', {
598
+ category: 'E2EE',
599
+ data: { remaining, threshold },
600
+ });
601
+ }
602
+ lastPreKeyStatusCheckTimeByIdentity.set(statusKey, Date.now());
603
+ return {
604
+ oneTimePreKeysRemaining: remaining,
605
+ needsReplenishment,
606
+ };
607
+ }
608
+ //# sourceMappingURL=prekeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prekeys.js","sourceRoot":"","sources":["../../client/prekeys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAE5F,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,sBAAsB,EACtB,gCAAgC,GAEjC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAKzE,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC7D,MAAM,mCAAmC,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEtE,SAAS,oBAAoB,CAAC,GAAgC;IAC5D,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,oBAAoB,CAC3B,GAAgC,EAChC,YAA0B;IAE1B,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,YAAY,EAAE,CAAC;AAC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