@open-e2ee/signal-protocol-sdk 13.5.2 → 14.1.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 (179) hide show
  1. package/CHANGELOG.md +369 -0
  2. package/README.md +9 -8
  3. package/SECURITY.md +2 -2
  4. package/client/README.md +5 -3
  5. package/device/README.md +4 -3
  6. package/dist/client/client.d.ts +20 -55
  7. package/dist/client/client.d.ts.map +1 -1
  8. package/dist/client/client.js +133 -165
  9. package/dist/client/client.js.map +1 -1
  10. package/dist/client/content-adapter.d.ts +35 -6
  11. package/dist/client/content-adapter.d.ts.map +1 -1
  12. package/dist/client/content-adapter.js +28 -0
  13. package/dist/client/content-adapter.js.map +1 -1
  14. package/dist/client/event-hooks.d.ts +22 -11
  15. package/dist/client/event-hooks.d.ts.map +1 -1
  16. package/dist/client/event-hooks.js.map +1 -1
  17. package/dist/client/group-fetcher.d.ts.map +1 -1
  18. package/dist/client/group-fetcher.js +43 -0
  19. package/dist/client/group-fetcher.js.map +1 -1
  20. package/dist/client/group-key-sync.d.ts +65 -0
  21. package/dist/client/group-key-sync.d.ts.map +1 -0
  22. package/dist/client/group-key-sync.js +286 -0
  23. package/dist/client/group-key-sync.js.map +1 -0
  24. package/dist/client/group-outbox.d.ts +20 -6
  25. package/dist/client/group-outbox.d.ts.map +1 -1
  26. package/dist/client/group-outbox.js +153 -80
  27. package/dist/client/group-outbox.js.map +1 -1
  28. package/dist/client/group-receive-authorization.d.ts +16 -9
  29. package/dist/client/group-receive-authorization.d.ts.map +1 -1
  30. package/dist/client/group-receive-authorization.js +25 -16
  31. package/dist/client/group-receive-authorization.js.map +1 -1
  32. package/dist/client/hosted-anonymous-delivery.d.ts +13 -1
  33. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  34. package/dist/client/hosted-anonymous-delivery.js +48 -5
  35. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  36. package/dist/client/hosted-mailbox-subscription.d.ts +6 -5
  37. package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
  38. package/dist/client/hosted-mailbox-subscription.js +4 -8
  39. package/dist/client/hosted-mailbox-subscription.js.map +1 -1
  40. package/dist/client/hosted-sandbox-identity.d.ts +66 -3
  41. package/dist/client/hosted-sandbox-identity.d.ts.map +1 -1
  42. package/dist/client/hosted-sandbox-identity.js +136 -45
  43. package/dist/client/hosted-sandbox-identity.js.map +1 -1
  44. package/dist/client/hosted-transport.d.ts +12 -0
  45. package/dist/client/hosted-transport.d.ts.map +1 -1
  46. package/dist/client/hosted-transport.js +85 -43
  47. package/dist/client/hosted-transport.js.map +1 -1
  48. package/dist/client/hosted.d.ts +13 -10
  49. package/dist/client/hosted.d.ts.map +1 -1
  50. package/dist/client/hosted.js +13 -10
  51. package/dist/client/hosted.js.map +1 -1
  52. package/dist/client/index.d.ts +2 -2
  53. package/dist/client/index.d.ts.map +1 -1
  54. package/dist/client/index.js +1 -1
  55. package/dist/client/index.js.map +1 -1
  56. package/dist/client/receive-queue.d.ts +3 -4
  57. package/dist/client/receive-queue.d.ts.map +1 -1
  58. package/dist/client/receive-queue.js +24 -32
  59. package/dist/client/receive-queue.js.map +1 -1
  60. package/dist/client/relay-period-close.d.ts +35 -0
  61. package/dist/client/relay-period-close.d.ts.map +1 -0
  62. package/dist/client/relay-period-close.js +63 -0
  63. package/dist/client/relay-period-close.js.map +1 -0
  64. package/dist/client/relay-subscription.d.ts.map +1 -1
  65. package/dist/client/relay-subscription.js +4 -9
  66. package/dist/client/relay-subscription.js.map +1 -1
  67. package/dist/client/retry-request-envelope.d.ts +4 -2
  68. package/dist/client/retry-request-envelope.d.ts.map +1 -1
  69. package/dist/client/retry-request-envelope.js +6 -4
  70. package/dist/client/retry-request-envelope.js.map +1 -1
  71. package/dist/client/retry-request-lifecycle.d.ts +7 -8
  72. package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
  73. package/dist/client/retry-request-lifecycle.js +10 -7
  74. package/dist/client/retry-request-lifecycle.js.map +1 -1
  75. package/dist/client/retry-terminal-recovery.d.ts +14 -15
  76. package/dist/client/retry-terminal-recovery.d.ts.map +1 -1
  77. package/dist/client/retry-terminal-recovery.js +16 -17
  78. package/dist/client/retry-terminal-recovery.js.map +1 -1
  79. package/dist/client/retry-utils.d.ts +22 -0
  80. package/dist/client/retry-utils.d.ts.map +1 -1
  81. package/dist/client/retry-utils.js +30 -0
  82. package/dist/client/retry-utils.js.map +1 -1
  83. package/dist/client/send-deadline.d.ts +3 -2
  84. package/dist/client/send-deadline.d.ts.map +1 -1
  85. package/dist/client/send-deadline.js +6 -1
  86. package/dist/client/send-deadline.js.map +1 -1
  87. package/dist/client/send-timestamp.d.ts +71 -14
  88. package/dist/client/send-timestamp.d.ts.map +1 -1
  89. package/dist/client/send-timestamp.js +87 -19
  90. package/dist/client/send-timestamp.js.map +1 -1
  91. package/dist/client/signal-service-cipher.d.ts +125 -13
  92. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  93. package/dist/client/signal-service-cipher.js +413 -102
  94. package/dist/client/signal-service-cipher.js.map +1 -1
  95. package/dist/client/types.d.ts +21 -16
  96. package/dist/client/types.d.ts.map +1 -1
  97. package/dist/client/types.js.map +1 -1
  98. package/dist/index.d.ts +2 -2
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +1 -1
  101. package/dist/index.js.map +1 -1
  102. package/dist/internal/groups/key-sync-ledger.d.ts +65 -0
  103. package/dist/internal/groups/key-sync-ledger.d.ts.map +1 -0
  104. package/dist/internal/groups/key-sync-ledger.js +104 -0
  105. package/dist/internal/groups/key-sync-ledger.js.map +1 -0
  106. package/dist/internal/groups/receive-record.d.ts +4 -1
  107. package/dist/internal/groups/receive-record.d.ts.map +1 -1
  108. package/dist/internal/groups/receive-record.js.map +1 -1
  109. package/dist/internal/session/cipher.d.ts.map +1 -1
  110. package/dist/internal/session/cipher.js +14 -0
  111. package/dist/internal/session/cipher.js.map +1 -1
  112. package/dist/local/store/conformance/cases/durability.d.ts.map +1 -1
  113. package/dist/local/store/conformance/cases/durability.js +6 -0
  114. package/dist/local/store/conformance/cases/durability.js.map +1 -1
  115. package/dist/local/store/conformance/records.d.ts.map +1 -1
  116. package/dist/local/store/conformance/records.js +3 -0
  117. package/dist/local/store/conformance/records.js.map +1 -1
  118. package/dist/local/store/expo/adapter.js +2 -2
  119. package/dist/local/store/expo/adapter.js.map +1 -1
  120. package/dist/local/store/key-value/adapter.d.ts +6 -5
  121. package/dist/local/store/key-value/adapter.d.ts.map +1 -1
  122. package/dist/local/store/key-value/adapter.js +21 -19
  123. package/dist/local/store/key-value/adapter.js.map +1 -1
  124. package/dist/local/store/key-value/receive-work.d.ts +0 -5
  125. package/dist/local/store/key-value/receive-work.d.ts.map +1 -1
  126. package/dist/local/store/key-value/receive-work.js +0 -16
  127. package/dist/local/store/key-value/receive-work.js.map +1 -1
  128. package/dist/local/store/node/adapter.js +2 -2
  129. package/dist/local/store/node/adapter.js.map +1 -1
  130. package/dist/local/store/react-native/adapter.js +2 -2
  131. package/dist/local/store/react-native/adapter.js.map +1 -1
  132. package/dist/local/store/receive-work.d.ts +32 -32
  133. package/dist/local/store/receive-work.d.ts.map +1 -1
  134. package/dist/local/store/receive-work.js +112 -65
  135. package/dist/local/store/receive-work.js.map +1 -1
  136. package/dist/local/store/received-content.d.ts +0 -5
  137. package/dist/local/store/received-content.d.ts.map +1 -1
  138. package/dist/local/store/received-content.js +0 -17
  139. package/dist/local/store/received-content.js.map +1 -1
  140. package/dist/local/store/reliability.d.ts +191 -53
  141. package/dist/local/store/reliability.d.ts.map +1 -1
  142. package/dist/local/store/reliability.js +517 -37
  143. package/dist/local/store/reliability.js.map +1 -1
  144. package/dist/local/store/sqlite/key-storage/metadata.d.ts +1 -8
  145. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
  146. package/dist/local/store/sqlite/key-storage/metadata.js +1 -18
  147. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
  148. package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
  149. package/dist/local/store/sqlite/migrations.js +8 -0
  150. package/dist/local/store/sqlite/migrations.js.map +1 -1
  151. package/dist/local/store/sqlite/store.d.ts +5 -5
  152. package/dist/local/store/sqlite/store.d.ts.map +1 -1
  153. package/dist/local/store/sqlite/store.js +29 -9
  154. package/dist/local/store/sqlite/store.js.map +1 -1
  155. package/dist/local/store/web/adapter.d.ts +11 -10
  156. package/dist/local/store/web/adapter.d.ts.map +1 -1
  157. package/dist/local/store/web/adapter.js +69 -51
  158. package/dist/local/store/web/adapter.js.map +1 -1
  159. package/dist/local/store/web-sqlite/adapter.js +2 -2
  160. package/dist/local/store/web-sqlite/adapter.js.map +1 -1
  161. package/dist/remote/relay/request-admission.d.ts +5 -3
  162. package/dist/remote/relay/request-admission.d.ts.map +1 -1
  163. package/dist/remote/relay/request-admission.js +2 -1
  164. package/dist/remote/relay/request-admission.js.map +1 -1
  165. package/dist/remote/relay/types.d.ts +1 -1
  166. package/dist/types/api.d.ts +50 -71
  167. package/dist/types/api.d.ts.map +1 -1
  168. package/dist/types/errors.d.ts +52 -18
  169. package/dist/types/errors.d.ts.map +1 -1
  170. package/dist/types/errors.js +58 -17
  171. package/dist/types/errors.js.map +1 -1
  172. package/docs/ASSURANCE.md +8 -8
  173. package/docs/CLIENT_COMPOSITION.md +4 -2
  174. package/docs/DEVIATIONS.md +175 -11
  175. package/docs/ERROR_HANDLING.md +38 -23
  176. package/docs/GETTING_STARTED.md +22 -2
  177. package/local/store/README.md +32 -8
  178. package/package.json +7 -2
  179. package/remote/relay/README.md +4 -2
@@ -301,7 +301,8 @@ The kit has these cases:
301
301
  - receive record listing: arrival order, then work ID order, an exclusive
302
302
  `after` cursor, the default page size, and the filters
303
303
  - receive record completion and usage
304
- - durability after reopen: each kind of write survives a reopen
304
+ - durability after reopen: each kind of write survives a reopen, including a
305
+ metadata value in the shape of the group key sync ledger
305
306
  - no plaintext at rest: the stored bytes hold no known plaintext. It runs
306
307
  only when the store declares a cipher.
307
308
  - protection declaration: `store.protection` is a valid declaration
@@ -348,6 +349,13 @@ An `SignalProtocolLocalStore` implementation must preserve:
348
349
  encryption at rest and the custody of its key. Client creation fails
349
350
  without one, and [Content Recovery](../../docs/PROTOCOL_POLICY.md#content-recovery)
350
351
  reads it
352
+ - each metadata value across a close and a reopen, with an atomic
353
+ `compareAndSetMetadata` for one key. The group key sync ledger keeps, for
354
+ each group, the own devices whose `GroupKeySync` copy the relay accepted
355
+ and the own device that sent this device the key, under the metadata key
356
+ prefix `open-e2ee:group-key-sync:v1:`. A store that
357
+ loses a value causes one more `GroupKeySync` for each own device that the
358
+ value marked
351
359
 
352
360
  ## Session Record Shape
353
361
 
@@ -409,7 +417,7 @@ with `assertBackendConformance`.
409
417
 
410
418
  ## Design Notes
411
419
 
412
- Reviewed: 2026-10-24.
420
+ Reviewed: 2026-11-02.
413
421
 
414
422
  Receive records use the same encryption and transaction boundary as protocol state.
415
423
 
@@ -463,12 +471,28 @@ hash of the group ID, not the group ID. A SQLite store with
463
471
  `encryptionAtRest: false` and the in-memory store keep the records without
464
472
  encryption.
465
473
 
466
- At the first open after an upgrade from an earlier SDK, each durable store
467
- converts the legacy received-content rows to receive records, and writes the
468
- conversion marker last. An interrupted conversion continues at the next open,
469
- and skips each row that already has a record. A row that does not parse stays
470
- under its legacy key. The store logs the key, never the value, and keeps the
471
- key in the marker.
474
+ At each open, each durable store deletes every SDK 11 received-content row
475
+ and every converted receive record that waits for its envelope. It also
476
+ deletes the conversion marker of SDK 13.x. When the open deletes a row or a
477
+ record, the store logs one line with the code
478
+ `LEGACY_RECEIVED_CONTENT_DELETED` and two counts: `count`, the deleted rows and
479
+ records, and `readable`, the deleted rows that parsed. The line holds no key
480
+ and no value. No marker records the sweep. An interrupted sweep deletes the
481
+ rest at the next open, and an open that finds nothing logs nothing.
482
+
483
+ A readable SDK 11 row is in a store that SDK 12.0.0 or later never opened.
484
+ The first open of SDK 12.0.0 through 13.x converted each readable row to a
485
+ receive record that waits for its envelope, and deleted the row. The sweep
486
+ deletes each readable row and counts it in `readable`. The sweep relies on
487
+ the Relay retention constraint. The Relay keeps an undelivered envelope for
488
+ at most its retention period, 30 days in production. Where the constraint
489
+ holds, no SDK version gives the content of such a row to the application.
490
+
491
+ The constraint does not cover a device that received the content on SDK 11
492
+ inside the last 30 days. For that device, 13.x would convert the row and
493
+ complete it when the Relay delivers the envelope again. This release deletes
494
+ the row at first open instead, and the sweep does not restore it. The
495
+ in-memory store keeps no data across a restart and has no sweep.
472
496
 
473
497
  The IndexedDB web store and the key-value store also encrypt each metadata
474
498
  value with their store key. Their metadata key names stay in clear text. Some
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-e2ee/signal-protocol-sdk",
3
- "version": "13.5.2",
3
+ "version": "14.1.0",
4
4
  "description": "Pure TypeScript Signal Protocol SDK for encrypted chat in Expo, React Native, browsers, and Node. Post-quantum by default.",
5
5
  "keywords": [
6
6
  "open-e2ee",
@@ -422,8 +422,13 @@
422
422
  "xcode": {
423
423
  "uuid": "11.1.1"
424
424
  },
425
+ "@expo/cli": {
426
+ "zod": "^4.6.6"
427
+ },
425
428
  "brace-expansion": "^5.0.12",
426
- "image-size": "file:./vendor/image-size-disabled"
429
+ "glob": "^14.0.2",
430
+ "image-size": "file:./vendor/image-size-disabled",
431
+ "minimatch": "^11.0.1"
427
432
  },
428
433
  "devDependencies": {
429
434
  "@op-engineering/op-sqlite": "^18.2.5",
@@ -31,8 +31,10 @@ const signal = await createHostedSignalProtocolClient({
31
31
  `oe new` writes `relayUrl` to `.env.local` as `OPEN_E2EE_RELAY_URL`, with the
32
32
  public prefix of the framework in a Next.js, Expo, or Vite application. Supply
33
33
  `storage` for this device and `getIdentityAssertion`. In a Sandbox environment,
34
- pass `hostedRelaySandboxIdentity(storage)`. In production, pass the callback of
35
- your identity provider.
34
+ pass `hostedRelaySandboxIdentity(storage)`. In a production project in
35
+ device-owned mode, pass `hostedRelayDeviceOwnedIdentity(storage)`. In a
36
+ production project in application-bound mode, pass a callback that returns an
37
+ assertion from your backend.
36
38
 
37
39
  For advanced integrations, implement the `SignalProtocolRelayServer` client
38
40
  transport against your own backend. That backend must authenticate