@open-e2ee/signal-protocol-sdk 8.1.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/ADAPTERS.md +13 -31
  2. package/ARCHITECTURE.md +5 -7
  3. package/CHANGELOG.md +258 -0
  4. package/README.md +36 -48
  5. package/SECURITY.md +2 -2
  6. package/client/README.md +9 -0
  7. package/device/README.md +16 -7
  8. package/dist/client/client.d.ts +25 -16
  9. package/dist/client/client.d.ts.map +1 -1
  10. package/dist/client/client.js +115 -95
  11. package/dist/client/client.js.map +1 -1
  12. package/dist/client/config.d.ts +10 -17
  13. package/dist/client/config.d.ts.map +1 -1
  14. package/dist/client/config.js.map +1 -1
  15. package/dist/client/event-hooks.js +27 -0
  16. package/dist/client/event-hooks.js.map +1 -1
  17. package/dist/client/group-outbox.d.ts +31 -1
  18. package/dist/client/group-outbox.d.ts.map +1 -1
  19. package/dist/client/group-outbox.js +67 -58
  20. package/dist/client/group-outbox.js.map +1 -1
  21. package/dist/client/group-receive-authorization.d.ts +5 -0
  22. package/dist/client/group-receive-authorization.d.ts.map +1 -0
  23. package/dist/client/group-receive-authorization.js +32 -0
  24. package/dist/client/group-receive-authorization.js.map +1 -0
  25. package/dist/client/group-sender-key-operations.d.ts +15 -0
  26. package/dist/client/group-sender-key-operations.d.ts.map +1 -0
  27. package/dist/client/group-sender-key-operations.js +31 -0
  28. package/dist/client/group-sender-key-operations.js.map +1 -0
  29. package/dist/client/groups.d.ts +3 -1
  30. package/dist/client/groups.d.ts.map +1 -1
  31. package/dist/client/groups.js +5 -2
  32. package/dist/client/groups.js.map +1 -1
  33. package/dist/client/hosted-anonymous-delivery.d.ts +9 -1
  34. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  35. package/dist/client/hosted-anonymous-delivery.js +61 -22
  36. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  37. package/dist/client/hosted-transport.d.ts +7 -0
  38. package/dist/client/hosted-transport.d.ts.map +1 -1
  39. package/dist/client/hosted-transport.js +44 -6
  40. package/dist/client/hosted-transport.js.map +1 -1
  41. package/dist/client/key-rotation.d.ts.map +1 -1
  42. package/dist/client/key-rotation.js +2 -4
  43. package/dist/client/key-rotation.js.map +1 -1
  44. package/dist/client/prekeys.d.ts.map +1 -1
  45. package/dist/client/prekeys.js +1 -1
  46. package/dist/client/prekeys.js.map +1 -1
  47. package/dist/client/relay-device-refusal.d.ts +32 -0
  48. package/dist/client/relay-device-refusal.d.ts.map +1 -0
  49. package/dist/client/relay-device-refusal.js +36 -0
  50. package/dist/client/relay-device-refusal.js.map +1 -0
  51. package/dist/client/relay-subscription.d.ts +2 -0
  52. package/dist/client/relay-subscription.d.ts.map +1 -1
  53. package/dist/client/relay-subscription.js +3 -1
  54. package/dist/client/relay-subscription.js.map +1 -1
  55. package/dist/client/relay-work.d.ts +26 -0
  56. package/dist/client/relay-work.d.ts.map +1 -1
  57. package/dist/client/relay-work.js +37 -0
  58. package/dist/client/relay-work.js.map +1 -1
  59. package/dist/client/sealed-sender.d.ts.map +1 -1
  60. package/dist/client/sealed-sender.js +12 -17
  61. package/dist/client/sealed-sender.js.map +1 -1
  62. package/dist/client/sender-key-distribution.d.ts.map +1 -1
  63. package/dist/client/sender-key-distribution.js +4 -1
  64. package/dist/client/sender-key-distribution.js.map +1 -1
  65. package/dist/client/sessions.d.ts.map +1 -1
  66. package/dist/client/sessions.js +2 -4
  67. package/dist/client/sessions.js.map +1 -1
  68. package/dist/client/signal-service-cipher.d.ts +94 -6
  69. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  70. package/dist/client/signal-service-cipher.js +483 -184
  71. package/dist/client/signal-service-cipher.js.map +1 -1
  72. package/dist/client/types.d.ts +7 -0
  73. package/dist/client/types.d.ts.map +1 -1
  74. package/dist/client/types.js.map +1 -1
  75. package/dist/index.d.ts +27 -21
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +8 -17
  78. package/dist/index.js.map +1 -1
  79. package/dist/internal/crypto/pq/kyber.d.ts +1 -1
  80. package/dist/internal/crypto/pq/kyber.js +1 -1
  81. package/dist/internal/encoding/proto/sender-key-message.d.ts +2 -2
  82. package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -1
  83. package/dist/internal/encoding/proto/sender-key-message.js +5 -2
  84. package/dist/internal/encoding/proto/sender-key-message.js.map +1 -1
  85. package/dist/internal/groups/manager.d.ts.map +1 -1
  86. package/dist/internal/groups/manager.js +5 -2
  87. package/dist/internal/groups/manager.js.map +1 -1
  88. package/dist/internal/groups/wire.d.ts +0 -2
  89. package/dist/internal/groups/wire.d.ts.map +1 -1
  90. package/dist/internal/groups/wire.js +0 -6
  91. package/dist/internal/groups/wire.js.map +1 -1
  92. package/dist/internal/manager/manager.d.ts +8 -7
  93. package/dist/internal/manager/manager.d.ts.map +1 -1
  94. package/dist/internal/manager/manager.js +34 -37
  95. package/dist/internal/manager/manager.js.map +1 -1
  96. package/dist/internal/protocol/double-ratchet/ratchet.d.ts +0 -17
  97. package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
  98. package/dist/internal/protocol/double-ratchet/ratchet.js +0 -4
  99. package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
  100. package/dist/internal/protocol/sealed-sender/certificate.d.ts +2 -32
  101. package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -1
  102. package/dist/internal/protocol/sealed-sender/certificate.js +4 -85
  103. package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
  104. package/dist/internal/protocol/sealed-sender/index.d.ts +2 -2
  105. package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -1
  106. package/dist/internal/protocol/sealed-sender/index.js +2 -6
  107. package/dist/internal/protocol/sealed-sender/index.js.map +1 -1
  108. package/dist/internal/protocol/sealed-sender/proto/index.d.ts +0 -19
  109. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  110. package/dist/internal/protocol/sealed-sender/proto/index.js +1 -48
  111. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  112. package/dist/internal/protocol/sender-keys/manager.d.ts +9 -13
  113. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  114. package/dist/internal/protocol/sender-keys/manager.js +90 -95
  115. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  116. package/dist/internal/protocol/spqr/index.d.ts +1 -1
  117. package/dist/internal/protocol/spqr/index.d.ts.map +1 -1
  118. package/dist/internal/protocol/spqr/index.js +2 -2
  119. package/dist/internal/protocol/spqr/index.js.map +1 -1
  120. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts +0 -2
  121. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts.map +1 -1
  122. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js +4 -12
  123. package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js.map +1 -1
  124. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts.map +1 -1
  125. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js +1 -3
  126. package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js.map +1 -1
  127. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +1 -0
  128. package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -1
  129. package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -1
  130. package/dist/internal/protocol/spqr/serialize.js +1 -4
  131. package/dist/internal/protocol/spqr/serialize.js.map +1 -1
  132. package/dist/internal/protocol/spqr/spqr.d.ts +1 -1
  133. package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
  134. package/dist/internal/protocol/spqr/spqr.js +2 -3
  135. package/dist/internal/protocol/spqr/spqr.js.map +1 -1
  136. package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -1
  137. package/dist/internal/protocol/x3dh/x3dh.js +1 -1
  138. package/dist/internal/protocol/x3dh/x3dh.js.map +1 -1
  139. package/dist/internal/protocol/zk/credentials/credentials.d.ts +3 -54
  140. package/dist/internal/protocol/zk/credentials/credentials.d.ts.map +1 -1
  141. package/dist/internal/protocol/zk/credentials/credentials.js +4 -91
  142. package/dist/internal/protocol/zk/credentials/credentials.js.map +1 -1
  143. package/dist/internal/protocol/zk/credentials/endorsements.d.ts +3 -64
  144. package/dist/internal/protocol/zk/credentials/endorsements.d.ts.map +1 -1
  145. package/dist/internal/protocol/zk/credentials/endorsements.js +4 -134
  146. package/dist/internal/protocol/zk/credentials/endorsements.js.map +1 -1
  147. package/dist/internal/protocol/zk/credentials/index.d.ts +3 -3
  148. package/dist/internal/protocol/zk/credentials/index.d.ts.map +1 -1
  149. package/dist/internal/protocol/zk/credentials/index.js +3 -3
  150. package/dist/internal/protocol/zk/credentials/index.js.map +1 -1
  151. package/dist/internal/protocol/zk/credentials/issuance.d.ts +3 -26
  152. package/dist/internal/protocol/zk/credentials/issuance.d.ts.map +1 -1
  153. package/dist/internal/protocol/zk/credentials/issuance.js +3 -80
  154. package/dist/internal/protocol/zk/credentials/issuance.js.map +1 -1
  155. package/dist/internal/protocol/zk/credentials/presentation.d.ts +4 -73
  156. package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -1
  157. package/dist/internal/protocol/zk/credentials/presentation.js +4 -152
  158. package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -1
  159. package/dist/internal/protocol/zk/groups/auth-credential.d.ts +1 -61
  160. package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -1
  161. package/dist/internal/protocol/zk/groups/auth-credential.js +2 -196
  162. package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -1
  163. package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts +1 -86
  164. package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts.map +1 -1
  165. package/dist/internal/protocol/zk/groups/group-send-endorsement.js +1 -152
  166. package/dist/internal/protocol/zk/groups/group-send-endorsement.js.map +1 -1
  167. package/dist/internal/protocol/zk/groups/index.d.ts +4 -4
  168. package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -1
  169. package/dist/internal/protocol/zk/groups/index.js +4 -4
  170. package/dist/internal/protocol/zk/groups/index.js.map +1 -1
  171. package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +2 -57
  172. package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -1
  173. package/dist/internal/protocol/zk/groups/profile-key-credential.js +2 -174
  174. package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -1
  175. package/dist/internal/protocol/zk/groups/server-params.d.ts +8 -72
  176. package/dist/internal/protocol/zk/groups/server-params.d.ts.map +1 -1
  177. package/dist/internal/protocol/zk/groups/server-params.js +8 -108
  178. package/dist/internal/protocol/zk/groups/server-params.js.map +1 -1
  179. package/dist/internal/protocol/zk/proofs/sign.d.ts +1 -2
  180. package/dist/internal/protocol/zk/proofs/sign.d.ts.map +1 -1
  181. package/dist/internal/protocol/zk/proofs/sign.js +2 -11
  182. package/dist/internal/protocol/zk/proofs/sign.js.map +1 -1
  183. package/dist/internal/sesame/device-registry.d.ts +24 -4
  184. package/dist/internal/sesame/device-registry.d.ts.map +1 -1
  185. package/dist/internal/sesame/device-registry.js +55 -28
  186. package/dist/internal/sesame/device-registry.js.map +1 -1
  187. package/dist/internal/sesame/manager.d.ts +79 -11
  188. package/dist/internal/sesame/manager.d.ts.map +1 -1
  189. package/dist/internal/sesame/manager.js +381 -280
  190. package/dist/internal/sesame/manager.js.map +1 -1
  191. package/dist/internal/session/cipher.d.ts +0 -5
  192. package/dist/internal/session/cipher.d.ts.map +1 -1
  193. package/dist/internal/session/cipher.js +3 -9
  194. package/dist/internal/session/cipher.js.map +1 -1
  195. package/dist/internal/session/ratchet.d.ts.map +1 -1
  196. package/dist/internal/session/ratchet.js +0 -2
  197. package/dist/internal/session/ratchet.js.map +1 -1
  198. package/dist/internal/session/record-locks.d.ts +46 -0
  199. package/dist/internal/session/record-locks.d.ts.map +1 -0
  200. package/dist/internal/session/record-locks.js +72 -0
  201. package/dist/internal/session/record-locks.js.map +1 -0
  202. package/dist/local/store/expo/adapter.d.ts +8 -2
  203. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  204. package/dist/local/store/expo/adapter.js +24 -3
  205. package/dist/local/store/expo/adapter.js.map +1 -1
  206. package/dist/local/store/expo/driver.d.ts +7 -0
  207. package/dist/local/store/expo/driver.d.ts.map +1 -1
  208. package/dist/local/store/expo/driver.js +16 -0
  209. package/dist/local/store/expo/driver.js.map +1 -1
  210. package/dist/local/store/key-value/adapter.d.ts +3 -3
  211. package/dist/local/store/key-value/adapter.d.ts.map +1 -1
  212. package/dist/local/store/key-value/adapter.js +91 -53
  213. package/dist/local/store/key-value/adapter.js.map +1 -1
  214. package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -1
  215. package/dist/local/store/key-value/backend-conformance.js +25 -0
  216. package/dist/local/store/key-value/backend-conformance.js.map +1 -1
  217. package/dist/local/store/key-value/batch.d.ts +3 -1
  218. package/dist/local/store/key-value/batch.d.ts.map +1 -1
  219. package/dist/local/store/key-value/batch.js +9 -1
  220. package/dist/local/store/key-value/batch.js.map +1 -1
  221. package/dist/local/store/key-value/storage.d.ts +6 -0
  222. package/dist/local/store/key-value/storage.d.ts.map +1 -1
  223. package/dist/local/store/key-value/transactional-backend.d.ts +1 -1
  224. package/dist/local/store/key-value/transactional-backend.js +1 -1
  225. package/dist/local/store/memory/adapter.d.ts +13 -3
  226. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  227. package/dist/local/store/memory/adapter.js +122 -73
  228. package/dist/local/store/memory/adapter.js.map +1 -1
  229. package/dist/local/store/reliability.d.ts +16 -0
  230. package/dist/local/store/reliability.d.ts.map +1 -1
  231. package/dist/local/store/reliability.js +58 -28
  232. package/dist/local/store/reliability.js.map +1 -1
  233. package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
  234. package/dist/local/store/sqlite/migrations.js +18 -0
  235. package/dist/local/store/sqlite/migrations.js.map +1 -1
  236. package/dist/local/store/sqlite/models/skipped-sender-key.d.ts +3 -3
  237. package/dist/local/store/sqlite/models/skipped-sender-key.d.ts.map +1 -1
  238. package/dist/local/store/sqlite/models/skipped-sender-key.js +13 -17
  239. package/dist/local/store/sqlite/models/skipped-sender-key.js.map +1 -1
  240. package/dist/local/store/sqlite/store.d.ts +3 -3
  241. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  242. package/dist/local/store/sqlite/store.js +53 -23
  243. package/dist/local/store/sqlite/store.js.map +1 -1
  244. package/dist/local/store/web/adapter.d.ts +3 -3
  245. package/dist/local/store/web/adapter.d.ts.map +1 -1
  246. package/dist/local/store/web/adapter.js +122 -73
  247. package/dist/local/store/web/adapter.js.map +1 -1
  248. package/dist/local/vault/electron-safe-storage.d.ts.map +1 -1
  249. package/dist/local/vault/electron-safe-storage.js +15 -2
  250. package/dist/local/vault/electron-safe-storage.js.map +1 -1
  251. package/dist/profile/index.d.ts +2 -1
  252. package/dist/profile/index.d.ts.map +1 -1
  253. package/dist/profile/index.js +2 -1
  254. package/dist/profile/index.js.map +1 -1
  255. package/dist/profile/own-profile-key.d.ts +42 -0
  256. package/dist/profile/own-profile-key.d.ts.map +1 -0
  257. package/dist/profile/own-profile-key.js +64 -0
  258. package/dist/profile/own-profile-key.js.map +1 -0
  259. package/dist/profile/profile-key.d.ts +1 -34
  260. package/dist/profile/profile-key.d.ts.map +1 -1
  261. package/dist/profile/profile-key.js +3 -63
  262. package/dist/profile/profile-key.js.map +1 -1
  263. package/dist/profile/update-service.js +1 -1
  264. package/dist/profile/update-service.js.map +1 -1
  265. package/dist/remote/relay/index.d.ts +4 -7
  266. package/dist/remote/relay/index.d.ts.map +1 -1
  267. package/dist/remote/relay/index.js +5 -7
  268. package/dist/remote/relay/index.js.map +1 -1
  269. package/dist/remote/relay/types.d.ts +3 -3
  270. package/dist/types/api.d.ts +29 -8
  271. package/dist/types/api.d.ts.map +1 -1
  272. package/dist/username/link.d.ts.map +1 -1
  273. package/dist/username/link.js +1 -5
  274. package/dist/username/link.js.map +1 -1
  275. package/dist/utils/bounded-fan-out.d.ts +99 -0
  276. package/dist/utils/bounded-fan-out.d.ts.map +1 -0
  277. package/dist/utils/bounded-fan-out.js +180 -0
  278. package/dist/utils/bounded-fan-out.js.map +1 -0
  279. package/dist/utils/keyed-lock.d.ts +16 -0
  280. package/dist/utils/keyed-lock.d.ts.map +1 -0
  281. package/dist/utils/keyed-lock.js +39 -0
  282. package/dist/utils/keyed-lock.js.map +1 -0
  283. package/dist/versions.d.ts +3 -3
  284. package/dist/versions.js +3 -3
  285. package/dist/zk/credentials.d.ts +2 -2
  286. package/dist/zk/credentials.js +2 -2
  287. package/dist/zk/groups.d.ts +3 -3
  288. package/dist/zk/groups.d.ts.map +1 -1
  289. package/dist/zk/groups.js +3 -3
  290. package/dist/zk/groups.js.map +1 -1
  291. package/docs/ASSURANCE.md +69 -28
  292. package/docs/CLIENT_COMPOSITION.md +9 -3
  293. package/docs/DEVIATIONS.md +45 -27
  294. package/docs/GETTING_STARTED.md +42 -320
  295. package/docs/INTERFACES.md +7 -7
  296. package/docs/PACKAGE_SURFACE.md +14 -16
  297. package/docs/RECIPES.md +6 -112
  298. package/groups/README.md +9 -1
  299. package/hooks/README.md +11 -2
  300. package/local/store/README.md +26 -6
  301. package/local/store/expo/README.md +18 -5
  302. package/local/store/key-value/README.md +5 -3
  303. package/local/store/node/README.md +2 -1
  304. package/local/store/web-sqlite/README.md +28 -8
  305. package/local/vault/README.md +21 -2
  306. package/package.json +1 -30
  307. package/remote/README.md +12 -78
  308. package/remote/object-store/convex-r2/README.md +20 -42
  309. package/remote/relay/README.md +21 -18
  310. package/zk/README.md +6 -7
  311. package/dist/client/dual-store.d.ts +0 -70
  312. package/dist/client/dual-store.d.ts.map +0 -1
  313. package/dist/client/dual-store.js +0 -123
  314. package/dist/client/dual-store.js.map +0 -1
  315. package/dist/client/multi-device.d.ts +0 -74
  316. package/dist/client/multi-device.d.ts.map +0 -1
  317. package/dist/client/multi-device.js +0 -105
  318. package/dist/client/multi-device.js.map +0 -1
  319. package/dist/groups/server.d.ts +0 -10
  320. package/dist/groups/server.d.ts.map +0 -1
  321. package/dist/groups/server.js +0 -6
  322. package/dist/groups/server.js.map +0 -1
  323. package/dist/internal/encoding/index.d.ts +0 -2
  324. package/dist/internal/encoding/index.d.ts.map +0 -1
  325. package/dist/internal/encoding/index.js +0 -2
  326. package/dist/internal/encoding/index.js.map +0 -1
  327. package/dist/internal/groups/server-engine.d.ts +0 -118
  328. package/dist/internal/groups/server-engine.d.ts.map +0 -1
  329. package/dist/internal/groups/server-engine.js +0 -1268
  330. package/dist/internal/groups/server-engine.js.map +0 -1
  331. package/dist/internal/protocol/index.d.ts +0 -24
  332. package/dist/internal/protocol/index.d.ts.map +0 -1
  333. package/dist/internal/protocol/index.js +0 -9
  334. package/dist/internal/protocol/index.js.map +0 -1
  335. package/dist/internal/protocol/sealed-sender/trust-root.d.ts +0 -56
  336. package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +0 -1
  337. package/dist/internal/protocol/sealed-sender/trust-root.js +0 -90
  338. package/dist/internal/protocol/sealed-sender/trust-root.js.map +0 -1
  339. package/dist/internal/protocol/triple-ratchet/index.d.ts +0 -21
  340. package/dist/internal/protocol/triple-ratchet/index.d.ts.map +0 -1
  341. package/dist/internal/protocol/triple-ratchet/index.js +0 -19
  342. package/dist/internal/protocol/triple-ratchet/index.js.map +0 -1
  343. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +0 -233
  344. package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +0 -1
  345. package/dist/internal/protocol/triple-ratchet/ratchet.js +0 -254
  346. package/dist/internal/protocol/triple-ratchet/ratchet.js.map +0 -1
  347. package/dist/internal/protocol/zk/proofs/index.d.ts +0 -13
  348. package/dist/internal/protocol/zk/proofs/index.d.ts.map +0 -1
  349. package/dist/internal/protocol/zk/proofs/index.js +0 -7
  350. package/dist/internal/protocol/zk/proofs/index.js.map +0 -1
  351. package/dist/local/store/sqlite/index.d.ts +0 -20
  352. package/dist/local/store/sqlite/index.d.ts.map +0 -1
  353. package/dist/local/store/sqlite/index.js +0 -18
  354. package/dist/local/store/sqlite/index.js.map +0 -1
  355. package/dist/remote/object-store/convex-r2/server/index.d.ts +0 -2
  356. package/dist/remote/object-store/convex-r2/server/index.d.ts.map +0 -1
  357. package/dist/remote/object-store/convex-r2/server/index.js +0 -2
  358. package/dist/remote/object-store/convex-r2/server/index.js.map +0 -1
  359. package/dist/remote/object-store/convex-r2/server.d.ts +0 -129
  360. package/dist/remote/object-store/convex-r2/server.d.ts.map +0 -1
  361. package/dist/remote/object-store/convex-r2/server.js +0 -244
  362. package/dist/remote/object-store/convex-r2/server.js.map +0 -1
  363. package/dist/remote/relay/memory/adapter.d.ts +0 -252
  364. package/dist/remote/relay/memory/adapter.d.ts.map +0 -1
  365. package/dist/remote/relay/memory/adapter.js +0 -1058
  366. package/dist/remote/relay/memory/adapter.js.map +0 -1
  367. package/dist/remote/relay/memory/failures.d.ts +0 -58
  368. package/dist/remote/relay/memory/failures.d.ts.map +0 -1
  369. package/dist/remote/relay/memory/failures.js +0 -124
  370. package/dist/remote/relay/memory/failures.js.map +0 -1
  371. package/dist/remote/relay/memory/group-server.d.ts +0 -13
  372. package/dist/remote/relay/memory/group-server.d.ts.map +0 -1
  373. package/dist/remote/relay/memory/group-server.js +0 -19
  374. package/dist/remote/relay/memory/group-server.js.map +0 -1
  375. package/dist/remote/relay/memory/index.d.ts +0 -11
  376. package/dist/remote/relay/memory/index.d.ts.map +0 -1
  377. package/dist/remote/relay/memory/index.js +0 -7
  378. package/dist/remote/relay/memory/index.js.map +0 -1
  379. package/examples/browser/README.md +0 -35
  380. package/examples/browser/index.html +0 -27
  381. package/examples/browser/src/exchange.ts +0 -69
  382. package/examples/browser/src/main.ts +0 -63
  383. package/examples/browser/src/style.css +0 -9
  384. package/examples/browser/src/worker.ts +0 -10
  385. package/examples/browser/vite.config.ts +0 -9
  386. package/remote/relay/memory/README.md +0 -72
  387. package/scripts/oe-groups.mjs +0 -166
package/ADAPTERS.md CHANGED
@@ -18,8 +18,10 @@ The relay interface handles server-owned Signal Protocol state:
18
18
  Use:
19
19
 
20
20
  - the OpenE2EE Signal Protocol Relay through `createHostedSignalProtocolClient()` from the package root
21
- - `InMemorySignalProtocolRelayServer` from `@open-e2ee/signal-protocol-sdk/remote/relay/memory`
22
- - or a custom implementation
21
+ - a custom client transport that implements `SignalProtocolRelayServer`
22
+
23
+ The published package contains client code and transport contracts. It does not
24
+ include a relay server implementation.
23
25
 
24
26
  ### Storage: `SignalProtocolLocalStore`
25
27
 
@@ -74,8 +76,6 @@ Optional encrypted file upload/download support for two-layer attachment encrypt
74
76
  Use:
75
77
 
76
78
  - `ConvexR2ObjectStore` from `@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2`
77
- - `defineConvexR2ObjectStore` from the server-only
78
- `@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2/server` entry point
79
79
  - `S3ObjectStore` from `@open-e2ee/signal-protocol-sdk/remote/object-store/s3`
80
80
  - or a custom implementation
81
81
 
@@ -85,9 +85,8 @@ credentials remain on the backend.
85
85
 
86
86
  Upload requests carry a retry/idempotency `requestId`. The backend returns the
87
87
  canonical `objectId` used in encrypted attachment pointers. Provider keys stay
88
- private to the backend. The Convex server helper can supply generic validators,
89
- R2 calls, expiry parsing, and metadata verification, while app-owned internal
90
- functions retain authentication, authorization, and persistence.
88
+ private to the backend. The application supplies the object-store broker and
89
+ owns its authentication, authorization, persistence, and provider integration.
91
90
 
92
91
  ### Local secret vault: `SignalProtocolLocalSecretVault`
93
92
 
@@ -153,27 +152,11 @@ const signal = await createHostedSignalProtocolClient({
153
152
  See the [Expo storage guide](./local/store/expo/README.md) for the required
154
153
  database and SQLCipher bootstrap.
155
154
 
156
- ### Local development with a shared relay
157
-
158
- <!-- doc-snippet:run adapters-shared-relay expect="" -->
159
- ```ts
160
- // Real protocol and cryptography; simulated in-memory infrastructure.
161
- import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
162
- import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
163
- import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
155
+ ### Sandbox development
164
156
 
165
- const relay = inMemoryRelay();
166
-
167
- const alice = await createSignalProtocolClient({
168
- identity: { userId: "alice" },
169
- adapters: { storage: inMemoryStore(), relay },
170
- });
171
-
172
- const bob = await createSignalProtocolClient({
173
- identity: { userId: "bob" },
174
- adapters: { storage: inMemoryStore(), relay },
175
- });
176
- ```
157
+ Use a Sandbox connection URL from the OpenE2EE console with the hosted client.
158
+ The same authentication and device-local storage contracts apply in Sandbox.
159
+ See the [client guide](./client/README.md#with-relay).
177
160
 
178
161
  ## Security Expectations
179
162
 
@@ -231,10 +214,9 @@ const signal = await createSignalProtocolClient({
231
214
 
232
215
  ## Verifiable adapter design
233
216
 
234
- In-memory relay and storage adapters provide deterministic behavior for
235
- development environments. Production adapters remain dependency-injected so
236
- applications can evaluate storage, delivery, and failure behavior without
237
- reaching into client internals.
217
+ The in-memory local store supports temporary device state during development.
218
+ Use the Signal Protocol Relay Sandbox for authenticated delivery. Applications
219
+ can supply custom adapters through the public client contracts.
238
220
 
239
221
  ## Related Docs
240
222
 
package/ARCHITECTURE.md CHANGED
@@ -41,7 +41,7 @@ compatibility shim when a boundary is wrong.
41
41
  | Public feature surfaces | [blocking/](./blocking/), [groups/](./groups/), [media/](./media/), [profile/](./profile/), [sealed-sender/](./sealed-sender/), [username/](./username/), [zk/](./zk/) | App-facing helpers that compose protocol, media, or account-state behavior without joining the inward dependency hierarchy |
42
42
  | Public utility surfaces | [encoding/](./encoding/), [files/](./files/), [hooks/](./hooks/), [utils/](./utils/), `logger.ts`, `server-clock.ts`, `versions.ts` | Stable helpers, React hooks, logging, clock estimation, version metadata, and file/encoding utilities |
43
43
  | Local adapters | [local/](./local/) | Local protocol stores and secret vault integrations |
44
- | Remote adapters | [remote/](./remote/) | Relay and object-store ports plus in-memory, R2, and S3 adapters |
44
+ | Remote adapters | [remote/](./remote/) | Relay and object-store ports plus hosted, R2, and S3 client adapters |
45
45
  | Device features | [device/](./device/) | Device IDs, provisioning, linked-device lifecycle and transfer |
46
46
 
47
47
  ## Documentation Ownership
@@ -75,9 +75,7 @@ Platform and backend integrations are explicit subpaths such as:
75
75
  - `@open-e2ee/signal-protocol-sdk/local/store/expo`
76
76
  - `@open-e2ee/signal-protocol-sdk/local/store/react-native`
77
77
  - `@open-e2ee/signal-protocol-sdk/local/store/memory`
78
- - `@open-e2ee/signal-protocol-sdk/remote/relay/memory`
79
78
  - `@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2`
80
- - `@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2/server`
81
79
  - `@open-e2ee/signal-protocol-sdk/remote/object-store/s3`
82
80
  - `@open-e2ee/signal-protocol-sdk/client/compose`
83
81
  - `@open-e2ee/signal-protocol-sdk/device`
@@ -128,10 +126,10 @@ policy fields `protocol.postQuantum` and `protocol.braid`.
128
126
 
129
127
  The provider-neutral object-store port separates a retry/idempotency
130
128
  `requestId`, the canonical `objectId` carried in encrypted pointers, and the
131
- private provider key. The Convex R2 client entry calls app-owned public broker
132
- functions. Its server-only sibling can register generic broker mechanics, but
133
- the consuming app still owns the R2 component, authentication, authorization,
134
- object records, credentials, and bucket.
129
+ private provider key. The Convex R2 client entry calls application-owned broker functions.
130
+ The application owns the R2 component, authentication, authorization, object
131
+ records, credentials, and bucket. The published package contains client adapters
132
+ and contracts. Relay and object-store server implementations run separately.
135
133
 
136
134
  `types/protocol-config.ts` owns protocol-domain configuration and constants shared by client, session, protocol, and adapters:
137
135
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,263 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.0.0
4
+
5
+ 9.0.0 is a major release. The entries below give the details. To upgrade from
6
+ 8.2.0:
7
+
8
+ 1. **Reset group Sender Key state.** Sender Keys now use format `v2`. Discard
9
+ queued group sends, reset sender-key state on every device, and
10
+ redistribute keys with upgraded peers.
11
+ 2. **Update custom local stores.** A receive commit applies
12
+ `SenderKeyReceiveCommit.skippedKeys` atomically with the record. Skipped
13
+ keys carry `senderKeyId`. Key-value backends implement
14
+ `pruneSkippedSenderKeys` inside `atomicWrite`.
15
+ 3. **Use only client exports.** The public package no longer exports relay
16
+ implementations, the group server engine, or credential and certificate
17
+ issuers.
18
+ 4. **Check group IDs on receive.** With a group store, a managed-format group
19
+ ID needs verified local state. `onGroupSenderKeyRotated` receives the raw
20
+ group ID.
21
+
22
+ - **Fixed: overlapping Braid sessions complete their key exchanges independently.**
23
+ The incremental KEM no longer caches a commitment shared across sessions.
24
+ It no longer rejects a valid encapsulation key from an interleaved session.
25
+ Interleaved sessions now use their own key material, including after state restore.
26
+ The wire format and persisted state format remain unchanged.
27
+ - **Corrected: SPQR recovery and key-derivation documentation.** Braid recovery
28
+ depends on delivered chunks and peer replies, with no fixed message-count bound.
29
+ The notes now describe the production message-key expansion and supported limits.
30
+ - **Fixed: managed announcement groups enforce the sender's role.** Both
31
+ encryption paths require an administrator. All group message receive paths
32
+ apply the same rule before consuming a message key. Member key distributions
33
+ and ad-hoc Sender Keys remain available.
34
+ - **Fixed: group receives fail closed for a managed group ID without a master key.**
35
+ With a group store, a raw group ID in the managed format (the 32-byte group
36
+ identifier in lowercase hex) requires verified local state on every receive
37
+ path. Ad-hoc Sender Keys remain available for IDs in other formats. The public
38
+ group receive methods accept ad-hoc Sender Keys without a group store.
39
+ - **Fixed: membership changes rotate the active sender key.** The callback
40
+ used a prefixed group identifier for a separate record. Sends continued
41
+ using the old record, which let removed members decrypt new messages. The
42
+ callback now uses the send path's raw identifier and persists pending key
43
+ distribution. The next send distributes the new key before its ciphertext.
44
+ Restart and outbox write failure preserve that pending distribution.
45
+ - **Fixed: public Sender Key operations use one record for raw and prefixed group IDs.**
46
+ - **Changed: `onGroupSenderKeyRotated` receives the raw group ID.** Automatic
47
+ and manual rotation pass the ID without the `open-e2ee:group:` prefix.
48
+ - **Changed: Sender Key getters wait for an active operation on the group.**
49
+ `hasGroupSenderKey`, `getGroupSenderKeyDistribution`, and
50
+ `getGroupSenderKeyStats` return state after an active send, rotation, or
51
+ receive for that group completes.
52
+ - **Fixed: concurrent sends cannot overwrite completed group key rotation.**
53
+ Group operations share a lock through preparation, persistence, and relay
54
+ posting. Pending distributions stay paired with their ciphertext. An older
55
+ outbox retry preserves a later key's pending distribution.
56
+ - **Fixed: client stop releases group receive lock waits held behind a group send.**
57
+ - **Fixed: a group attachment upload no longer blocks receives for that group.**
58
+ The group lock covers the Sender Key work only. A separate ordering lock
59
+ keeps sends to the group in order across the upload.
60
+ - **Fixed: hooks of a group send run after the group lock.** A hook such as
61
+ `onSessionEstablished` that called `hasGroupSenderKey` for the same group
62
+ deadlocked the send. The client now calls these hooks after the group
63
+ operation finishes.
64
+ - **Corrected: group implementation ownership.** Signal publishes its group
65
+ server in `storage-service`. The internal SDK contains the enforcing engine
66
+ used by the OpenE2EE Signal Protocol Relay.
67
+ - **Fixed: Sender Keys archive rollback.** Distribution processing and local
68
+ rotation update the cache after storage succeeds. A failed write preserves
69
+ delayed messages through later receives, retries, and manager restarts.
70
+ - **Fixed: Sender Keys cache isolation.** Group, sender, and device tuples now
71
+ retain separate archived states when identifiers contain delimiters.
72
+ This preserves delayed messages and record ownership across creation,
73
+ rotation, deletion, and manager restarts. Cache lookups no longer use
74
+ another tuple's archived key.
75
+ - **Fixed: atomic group receives.** Skipped-key additions and eviction now commit with state and
76
+ optional received content. Current and archived generations use this boundary,
77
+ including receives without a durable ID. Custom local stores must apply
78
+ `SenderKeyReceiveCommit.skippedKeys` atomically with the record. Custom
79
+ key-value backends must implement `pruneSkippedSenderKeys` inside `atomicWrite`.
80
+ - **Fixed: skipped Sender Keys remain separate across rotations.** Each stored
81
+ key now includes its distribution identifier. A delayed message uses the
82
+ correct generation even when two generations share the same chain index.
83
+ Atomic receive commits consume only that generation's key. Custom local
84
+ stores must add `senderKeyId` to skipped-key lookup, storage, and deletion.
85
+ `SenderKeyReceiveCommit.consumedSkippedKey` now carries the identifier and index.
86
+ - **Changed: Sender Keys use HKDF-Extract before HKDF-Expand.** This corrects
87
+ message-key derivation to match the reference algorithm. Sender-key state
88
+ and distribution messages now require `senderKeyVersion: 'v2'`. Signed
89
+ frames require version byte `0x44`. Old state, distributions, and frames
90
+ fail closed. Before upgrading, discard queued group sends and reset group
91
+ sender-key state on every device. Then redistribute keys with upgraded peers.
92
+
93
+ SQLite discards skipped keys from its old schema because they lack generation
94
+ identifiers. This pre-launch break provides no legacy derivation or reader.
95
+ - **Breaking: public exports contain only client code.** Relay implementations
96
+ and the group server engine stay private. The public package also excludes
97
+ credential issuers, certificate issuers, and the group administration CLI.
98
+ The private repository retains these implementations and entry points.
99
+ Client transports, storage adapters, group encryption, credential receipt,
100
+ and presentation remain public. Public guides use OpenE2EE Signal Protocol Relay.
101
+ - **Changed: public exports check a declaration inventory.** Each mixed module
102
+ classifies its client and server declarations. An unclassified declaration or
103
+ class member fails the export. TypeDoc generates API documentation from the
104
+ projected client source. Build and package checks verify that the public
105
+ artifact excludes server code. Release checks also verify SDK imports in
106
+ source examples, declarations, and generated documentation against public exports.
107
+
108
+ ## 8.2.0
109
+
110
+ - **Changed: a group send posts to the member devices at the same time.**
111
+ Before, a group send posted each sender-key distribution message, each
112
+ device post, and each copy for the sender's other devices one after the
113
+ other. Now each phase of a group send posts at the same time, under the
114
+ client's bound of 4 relay requests, and a phase starts only after the phase
115
+ before it settles: the sender-key distribution messages, then their
116
+ confirmation, then the group message and its device posts, then the copies.
117
+ A failure for one device does not stop the other devices of the phase.
118
+ After every device of the phase settles, the send rejects with the error of
119
+ the first failed device in member order. When a distribution message fails,
120
+ the stored send keeps only the distribution messages that the relay did not
121
+ accept, so a replay with the same `clientMessageId` posts only those. The
122
+ sessions for the members are set up at the same time, and the index in the
123
+ `clientMessageId` of each distribution message follows the member order.
124
+ - **Changed: a group send that distributes a new sender key reads each
125
+ member's device list once.** Before, such a send read the list of a member
126
+ up to three times: to prepare the distribution, to set up the sessions, and
127
+ to send the group message. The device posts of one group send check and
128
+ refresh the group's endorsements one at a time, so one refresh serves them
129
+ all.
130
+ - **Changed: a direct send posts to each device of the recipient at the same
131
+ time.** Before, a direct send posted to one device after the other. A
132
+ failure for one device stopped the posts to the devices after it. Now the
133
+ send posts to every device at the same time, and a failure for one device
134
+ does not stop the other devices. After every device settles, the send
135
+ rejects with the error of the first failed device in recipient order. The
136
+ copies for the sender's other devices start only after every device post
137
+ settles. These copies, and the copies of read state and other account
138
+ state, also post at the same time. A replay with the same `clientMessageId`
139
+ posts to every device again. A relay that remembers the result of a device
140
+ does not store the message again. After the hosted Relay forgets a result
141
+ (60 s), that device gets a second copy, and the recipient drops it as a
142
+ duplicate. When two sealed-sender posts of one send fail authorization,
143
+ the access mode steps down two times, to `DISABLED`, as before.
144
+ - **Changed: one client has at most 4 relay requests in flight.** The device
145
+ posts and copies of a direct send, the prekey fetches of session setup, and
146
+ the requests of hosted sealed-sender delivery share this bound. The clients
147
+ that use one hosted Relay transport share one bound. A request that finds
148
+ the 4 slots full waits, and the waiting requests start in the order that
149
+ they came.
150
+ - **Changed: a direct send through the hosted Relay posts before it reads
151
+ the recipient's device list, when this process read the list less than
152
+ 5 min before.** Before, a direct send to a recipient whose list was more
153
+ than 60 s old waited for the device-list read before it posted. Now the
154
+ send posts to the known devices, reads the list, and in the same send posts
155
+ the same message to each device that the list newly shows. A device linked
156
+ 60 s to 300 s before a send now receives that send. A send after a restart,
157
+ after 5 min, or after reads that failed, still waits for the read. The
158
+ stored send records the pending read, so a replay reads the list before it
159
+ completes. Sender key distribution, and sends through the Convex and memory
160
+ relays, keep the read before the post.
161
+ - **Changed: a direct send through the hosted Relay that posts before the
162
+ read drops a removed device.** Before, a send threw the Relay's `NOT_FOUND`
163
+ when a post named the mailbox of a device that the recipient had removed.
164
+ Now such a send waits for its device-list read, drops that device from the
165
+ send and its result, and succeeds. A `NOT_FOUND` for a device that the list
166
+ still shows, or when the read fails, still fails the send. A send that does
167
+ not read the list, because the last read is less than 60 s old, still
168
+ throws.
169
+ - **Fixed: a sealed-sender send through the hosted Relay repairs a device
170
+ that the Relay refuses as `STALE_DEVICE`.** The identified path fetched a
171
+ new prekey bundle and sent again, but the sealed path threw. Now both paths
172
+ repair the device.
173
+ - **Fixed: a device-list time later than the clock counts as old.** When the
174
+ wall clock went back, a send used the old list until the clock passed that
175
+ time again. Now the send reads the list.
176
+ - **Fixed: an app entry that awaits SDK work at the top level finishes.**
177
+ When a bundler splits code, each module that the SDK loaded with `import()`
178
+ got its own chunk. That chunk imported the app's entry chunk, so it waited
179
+ for the entry module to finish evaluation. An entry module that awaited a
180
+ send or a sync at the top level never finished, and the SDK work stopped. In
181
+ a Vite 8 build, the first send stopped. Now the SDK loads with `import()`
182
+ only a module that imports nothing, so no SDK chunk imports the entry chunk.
183
+ The SDK loads the other modules with static imports.
184
+ - **Changed: session setup fetches the prekey bundles of a recipient's
185
+ devices in parallel.** Before, a send that set up sessions with a
186
+ recipient fetched one prekey bundle for each device in turn. Now the
187
+ fetches run at the same time, and one client has at most 4 of these relay
188
+ requests in flight, also when it sets up sessions with more than one
189
+ recipient. The client then establishes the sessions one at a time, so
190
+ every device gets its session and its device record on every store. A
191
+ device with no bundle, or a device whose fetch fails, does not stop the
192
+ other devices.
193
+ - **Fixed: an encrypted Expo store on the web fails before it uses the
194
+ vault.** The web build of `expo-sqlite` has no SQLCipher, and Expo
195
+ SecureStore has no web implementation. `expoStore()` on the web rejected
196
+ with `KEY_STORAGE_ERROR` from the default vault, and with a custom vault it
197
+ wrote a key before it rejected. Now `expoStore()` and `resetExpoStore()`
198
+ reject with `SqliteEncryptionUnavailableError` (`KEY_STORAGE_ERROR`) when the
199
+ `expo-sqlite` build has no SQLCipher, before they use the vault or a file.
200
+ The same refusal applies to a native build without the `useSQLCipher`
201
+ option. `encryptionAtRest: false` still opens a store without encryption. The
202
+ guide names `./local/store/web-sqlite` for encrypted browser storage.
203
+ - **Fixed: the Electron vault names the Secret portal key.** On Linux, a
204
+ Chromium feature can make `safeStorage` use that key. The feature is
205
+ `SecretPortalKeyProviderUseForEncryption`, and the ciphertext starts with
206
+ `v12`. The vault refused that key, but its `KEY_STORAGE_ERROR` named the
207
+ fixed fallback key.
208
+ Now the error names the Secret portal. Outside a Flatpak or Snap sandbox,
209
+ the portal gives the same key to each Electron app of the user. The vault
210
+ still refuses the key, and the vault file does not change.
211
+ - **Fixed: concurrent SESAME writes for one user keep every change.** Each
212
+ write of a SESAME user record or device record reads the record, changes
213
+ it, and writes it back. Two concurrent writes for one user could both read
214
+ before either wrote, and the second write then removed the change of the
215
+ first: a device that a concurrent `addDevice` added, a session, or a
216
+ cleared verification flag. Now a per-user lock orders these writes in
217
+ `DefaultSesameManager`, on every store. The lock orders the writes of one
218
+ client process only. It does not order two browser tabs or two processes
219
+ that share one store.
220
+ - **Changed: hosted sealed-sender delivery reads the recipients at the same
221
+ time.** Before a sealed-sender send through the hosted Relay, the transport
222
+ reads the device directory of each recipient account that it has not
223
+ cached. It read one account after the other. Now it reads the accounts at
224
+ the same time, with one read for each account, also when two sends need
225
+ the same account. A direct send also delivers to each device of the
226
+ recipient at the same time. At most four of these requests are in flight
227
+ for each client. A failure for one device no longer stops the delivery to
228
+ the other devices. After every device settles, the send rejects with the
229
+ error of the first failed device in recipient order, and a successful send
230
+ returns the server timestamp of the last device in that order.
231
+ - **Fixed: SESAME writes and store sweeps keep a newer session.** A SESAME
232
+ write that carries a session read it before the protocol took the session
233
+ lock. When a send or a receive committed a newer session between that read
234
+ and the write, the write put the older session back, and the next send
235
+ used a message key again. `deleteStaleRecords()` and
236
+ `cleanupExpiredSessions()` read the records, decided, and wrote without a
237
+ lock, so they could delete a device that got a session after the read, or
238
+ write back a session and a verification flag that a SESAME write had
239
+ changed. Now these writes and each device change of a sweep take the
240
+ session lock of the device and then the per-user lock, and read the
241
+ records under them. A PreKeyMessage receive now compares the incoming
242
+ identity with the identity that the store pins when it writes. An identity
243
+ pinned while the message decrypts gets `pendingVerification` and an
244
+ identity change event. It is no longer replaced. The locks order one
245
+ client process only.
246
+ - **Fixed: key cleanup, session setup, and device removal keep a newer
247
+ session.** `cleanupExpiredKeys()` read the session and wrote it back
248
+ without the session lock. `establishSession()` registered the session
249
+ state that it read after the session was established. When a send
250
+ committed a newer state between the read and the write, the write put the
251
+ older state back, and the next send used a message key again. When the
252
+ device list of a recipient no longer listed a device, or listed a new
253
+ identity for it, the removal deleted the session under the per-user lock
254
+ only, so a send that was in progress could put the session of the removed
255
+ device back. Now the cleanup runs under the session lock. Session setup
256
+ registers the state of the session that the store holds under the session
257
+ lock. A device removal takes the session lock of the device and then the
258
+ per-user lock. Two device-list syncs for one recipient still run one after
259
+ the other. The locks order one client process only.
260
+
3
261
  ## 8.1.0
4
262
 
5
263
  - **Changed: the web SQLite store is no longer experimental.** Its last
package/README.md CHANGED
@@ -11,8 +11,6 @@ Add encrypted messaging to Expo, React Native, browser, and Node applications. T
11
11
 
12
12
  The default policy requires post-quantum session establishment and ratcheting. The protocol implementation is open source under the MIT License or the Apache License 2.0, at your option.
13
13
 
14
- [**Run an encrypted exchange in your browser**](https://open-e2ee.dev/playground) · [Edit on StackBlitz](https://stackblitz.com/fork/github/open-e2ee/signal-protocol-js/tree/v8.1.0/examples/browser) · [Run on Expo / Hermes](./examples/expo/README.md)
15
-
16
14
  [![License: MIT OR Apache-2.0](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-2f6f5e)](./LICENSE)
17
15
  [![npm version](https://img.shields.io/npm/v/@open-e2ee/signal-protocol-sdk)](https://www.npmjs.com/package/@open-e2ee/signal-protocol-sdk)
18
16
  [![npm provenance](https://img.shields.io/badge/npm-provenance-2f6f5e)](https://www.npmjs.com/package/@open-e2ee/signal-protocol-sdk#provenance)
@@ -28,22 +26,20 @@ https://github.com/user-attachments/assets/d8002bc3-c037-41b6-8f48-4008f2d49e6c
28
26
 
29
27
  The [visual demo](https://open-e2ee.dev/#demo) shows the envelope, ratchets, relay mailbox, and decrypted result. On desktop, type a message and inspect each step. On mobile, a recorded protocol run replays at reading pace. Displayed timings exclude network time.
30
28
 
31
- The [console example](https://open-e2ee.dev/playground) executes in your browser on desktop or mobile. It creates Alice and Bob, sends your message, and decrypts a reply. The page and developer console show the actual output. [Read the complete source](./examples/browser/src/exchange.ts) or [run it locally](./examples/browser/README.md).
32
-
33
- Both examples use real protocol code and cryptography. An in-memory relay holds their envelopes. They need no account or backend project.
29
+ The demonstrations use real protocol code and cryptography. Application integration requires device-local storage and authenticated delivery.
34
30
 
35
31
  ## What the SDK handles
36
32
 
37
33
  - **Session establishment and ratcheting.** PQXDH establishes sessions. The ML-KEM Braid ratchet adds post-quantum key updates. Required post-quantum operations fail closed.
38
34
  - **Chat features.** Multi-device messaging, groups, sealed sender, encrypted attachments, and safety-number verification use the same package.
39
35
  - **Device-local state.** Storage adapters keep identities, sessions, and message state on the device.
40
- - **Delivery through an adapter.** Operate your own relay or use [OpenE2EE Signal Protocol Relay](https://open-e2ee.dev/relay).
36
+ - **Hosted delivery.** Connect to [OpenE2EE Signal Protocol Relay](https://open-e2ee.dev/relay) with the hosted client factory. Advanced integrations can supply a custom transport.
41
37
 
42
38
  The relay never needs message plaintext or device private keys.
43
39
 
44
40
  OpenE2EE implements a versioned profile of the published Signal Protocol specifications. It is not affiliated with Signal Messenger and is **not wire-compatible with Signal Messenger or libsignal**. Messages, identities, and safety numbers do not interoperate. See the [notice](./NOTICE) and [documented deviations](./docs/DEVIATIONS.md).
45
41
 
46
- Version `8.1.x`. Public APIs and persisted formats follow semantic versioning.
42
+ Version `9.0.x`. Public APIs and persisted formats follow semantic versioning.
47
43
 
48
44
  ## Install
49
45
 
@@ -51,54 +47,46 @@ Version `8.1.x`. Public APIs and persisted formats follow semantic versioning.
51
47
  npm install @open-e2ee/signal-protocol-sdk
52
48
  ```
53
49
 
54
- Use a current Node LTS release for local development. Each runtime example lists its build requirements.
50
+ Use a current Node LTS release for local development. The storage guides list platform requirements.
55
51
 
56
- ## Run a local encrypted round trip
52
+ ## Connect to the Signal Protocol Relay
57
53
 
58
- Save this as `quickstart.mjs`, then run `node quickstart.mjs`. It uses development-only in-memory adapters so that you can prove the message flow without a backend project.
54
+ Create a Relay project in the [OpenE2EE console](https://console.open-e2ee.dev).
55
+ Configure its identity provider and copy the environment's connection URL.
56
+ Your application supplies a device-local store and `getIdentityAssertion`, which
57
+ returns a short-lived signed assertion for the signed-in user.
59
58
 
60
- <!-- doc-snippet:run readme-quick-start expect="alice: hello" -->
61
- ```ts
62
- // Real protocol and cryptography; simulated in-memory infrastructure.
63
- import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
64
- import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
65
- import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
66
-
67
- const relay = inMemoryRelay();
68
- await relay.registerDevice("alice", { encryptedDeviceName: new ArrayBuffer(0) });
69
- await relay.registerDevice("bob", { encryptedDeviceName: new ArrayBuffer(0) });
70
-
71
- const alice = await createSignalProtocolClient({
72
- identity: { userId: "alice" },
73
- adapters: { storage: inMemoryStore(), relay },
74
- });
75
- const bob = await createSignalProtocolClient({
76
- identity: { userId: "bob" },
77
- adapters: { storage: inMemoryStore(), relay },
78
- });
59
+ This example needs that application setup. It is not an offline script.
79
60
 
80
- const delivered = new Promise((resolve) => {
81
- bob.registerHook("onMessageDecrypted", async (message) => {
82
- console.log(`${message.senderId}: ${message.content}`);
83
- bob.stopRelaySubscription();
84
- resolve(undefined);
85
- });
61
+ <!-- doc-snippet:skip requires-external-context -->
62
+ ```ts
63
+ import { createHostedSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
64
+
65
+ const signal = await createHostedSignalProtocolClient({
66
+ adapters: { storage },
67
+ hosted: {
68
+ relayUrl,
69
+ getIdentityAssertion,
70
+ },
86
71
  });
87
-
88
- await alice.send("bob", "hello");
89
- bob.startRelaySubscription();
90
- await delivered;
91
72
  ```
92
73
 
93
- Expected output:
74
+ Register a handler before you start incoming delivery. Persist each message
75
+ before the handler resolves, and use its ID to make repeated writes idempotent.
94
76
 
95
- ```text
96
- alice: hello
77
+ <!-- doc-snippet:skip requires-external-context -->
78
+ ```ts
79
+ signal.registerHook("onMessageDecrypted", async (message) => {
80
+ await appMessages.accept(message);
81
+ });
82
+ signal.startRelaySubscription();
83
+ await signal.send(recipientUserId, "hello");
97
84
  ```
98
85
 
99
- The client factory creates or loads each device identity. When given a relay, it also publishes the public prekey bundle. `send()` fetches Bob's bundle and starts the required post-quantum session. It then gives ciphertext plus routing metadata to the relay. Bob's subscription retrieves and decrypts the envelope on his device.
100
-
101
- The in-memory store loses identities, sessions, and ratchet state on restart. The in-memory relay has no authentication, authorization, or durable storage. Do not ship either adapter. Continue with the [documentation quickstart](https://docs.open-e2ee.dev/start/quickstart), which explains key custody, relay metadata, prekey replenishment, additional devices, and recovery policy.
86
+ The hosted factory authenticates and registers the device, then publishes its
87
+ public prekeys. `send()` establishes the recipient sessions and sends encrypted
88
+ envelopes. The receive handler gets plaintext after device-local decryption.
89
+ See [client composition](./docs/CLIENT_COMPOSITION.md) for platform setup.
102
90
 
103
91
  ## Use your app’s storage and relay
104
92
 
@@ -106,14 +94,14 @@ Choose the device-local store for your runtime. Then supply a relay that authent
106
94
 
107
95
  | Runtime | Storage path | Deployment boundary |
108
96
  |---|---|---|
109
- | Expo | [`expoStore`](./local/store/expo/README.md) | Enable SQLCipher in the expo-sqlite config plugin. The SDK owns the database file, its key, and its migrations. Requires a native development or release build. [Run the Hermes example](./examples/expo/README.md); Expo Go does not include SQLCipher. |
97
+ | Expo | [`expoStore`](./local/store/expo/README.md) | Enable SQLCipher in the expo-sqlite config plugin. The SDK owns the database file, its key, and its migrations. Requires a native development or release build. Expo Go does not include SQLCipher. |
110
98
  | Browser | [`webSqliteStore`](./local/store/web-sqlite/README.md) | Needs the origin private file system and a CSP that allows `'wasm-unsafe-eval'`. The SDK owns the database file, its key, and its migrations. The key sits in IndexedDB in the same origin, so same-origin JavaScript can read it. Without the origin private file system, the open fails with `OPFS_UNAVAILABLE`. |
111
99
  | Browser without the origin private file system | [`indexedDbStore`](./local/store/web/README.md) | Use a secure context and a restrictive CSP. Same-origin JavaScript can access stored records and their key. [Browser setup](https://docs.open-e2ee.dev/start/browser). |
112
100
  | Bare React Native | [`reactNativeStore`](./local/store/react-native/README.md) | Enable SQLCipher with `"op-sqlite": { "sqlcipher": true }` in the app's `package.json`, and install `react-native-keychain`. The SDK owns the database file, its key, and its migrations. Requires a native build; with SQLCipher on, op-sqlite conflicts on iOS with `expo-sqlite`, `expo-updates`, and `use_frameworks!`. |
113
101
  | Own key-value engine | [`keyValueStore`](./local/store/key-value/README.md) | Provide an atomic, durable key-value backend and a keychain-backed secret vault, and run the exported backend conformance kit. A Realm backend is included. |
114
102
  | Node and Electron | [`nodeStore`](./local/store/node/README.md) | Install `better-sqlite3-multiple-ciphers` and pass a private directory on a local file system and a secret vault. In Electron, open it in the main process with the safeStorage vault. The SDK owns the database file, its key, and its migrations. |
115
103
 
116
- React Native support starts at React Native 0.83.6 and Expo SDK 55. The peer ranges have no upper bound. CI checks these versions:
104
+ React Native support starts at React Native 0.83.6 and Expo SDK 55. The peer ranges have no upper bound. Internal CI checks these versions:
117
105
 
118
106
  | CI check | Versions |
119
107
  |---|---|
@@ -129,7 +117,7 @@ The [adapter guide](./ADAPTERS.md) defines every storage, relay, vault, and obje
129
117
 
130
118
  ## Security and assurance
131
119
 
132
- The SDK is open source. Our engineering tests remain private. We publish the [testing methodology and dated results](./docs/ASSURANCE.md), including what readers can and cannot verify from this repository. Public CI rebuilds the package, checks types and dependencies, and runs the documented examples.
120
+ The SDK is open source. Our engineering tests remain private. We publish the [testing methodology and dated results](./docs/ASSURANCE.md), including what readers can and cannot verify from this repository. Public CI rebuilds the client package, checks types and dependencies, and validates the public import surface.
133
121
 
134
122
  > Reviewed continuously by adversarial AI agents; not audited by any independent firm.
135
123
 
package/SECURITY.md CHANGED
@@ -7,8 +7,8 @@ backports.
7
7
 
8
8
  | Version | Supported |
9
9
  | ------- | ------------------ |
10
- | 8.1.x | :white_check_mark: |
11
- | < 8.1.0 | :x: |
10
+ | 9.0.x | :white_check_mark: |
11
+ | < 9.0.0 | :x: |
12
12
 
13
13
  ## Reporting a Vulnerability
14
14
 
package/client/README.md CHANGED
@@ -33,6 +33,15 @@ await signal.encryptMessage(bob, 'hello');
33
33
 
34
34
  ### With relay
35
35
 
36
+ Create a Relay project in the OpenE2EE console and configure its identity
37
+ provider. Copy the environment connection URL into your application. Supply
38
+ `getIdentityAssertion` from your authentication integration. It returns a
39
+ short-lived signed assertion for the signed-in user.
40
+
41
+ The hosted factory registers the device and publishes its public prekeys.
42
+ The published SDK contains client code and transport contracts. Relay server
43
+ implementations run separately.
44
+
36
45
  <!-- doc-snippet:skip requires-external-context -->
37
46
  ```ts
38
47
  import { createHostedSignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';
package/device/README.md CHANGED
@@ -28,15 +28,24 @@ and lifecycle state in the `SignalProtocolLocalSecretVault` that the
28
28
  application passes, and they take platform metadata as an input. They omit each
29
29
  metadata field that the application does not supply.
30
30
 
31
- Two platform entries read that metadata:
31
+ Two platform entries read that metadata. Install the peers of the entry that
32
+ you use.
32
33
 
33
- - `@open-e2ee/signal-protocol-sdk/device/expo` reads `react-native`,
34
- `expo-constants`, and `expo-device`.
35
- - `@open-e2ee/signal-protocol-sdk/device/react-native` reads `react-native` and
36
- `react-native-device-info`.
34
+ `@open-e2ee/signal-protocol-sdk/device/expo` reads `react-native` 0.83.6 or
35
+ later, `expo-constants` 55.0.7 or later, and `expo-device` 55.0.15 or later.
37
36
 
38
- Install the optional peer dependencies of the platform entry you use. The
39
- lifecycle core is available from:
37
+ ```sh
38
+ npx expo install react-native expo-constants expo-device
39
+ ```
40
+
41
+ `@open-e2ee/signal-protocol-sdk/device/react-native` reads `react-native`
42
+ 0.83.6 or later and `react-native-device-info` 15.0.1 or later.
43
+
44
+ ```sh
45
+ npm install react-native react-native-device-info
46
+ ```
47
+
48
+ The lifecycle core is available from:
40
49
 
41
50
  <!-- doc-snippet:skip requires-external-context -->
42
51
  ```ts