@open-e2ee/signal-protocol-sdk 11.0.0 → 12.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.
- package/ADAPTERS.md +4 -4
- package/ARCHITECTURE.md +6 -8
- package/CHANGELOG.md +1315 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/TROUBLESHOOTING.md +1 -1
- package/client/README.md +70 -37
- package/device/README.md +39 -85
- package/dist/client/client.d.ts +334 -63
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +1168 -184
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +40 -32
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/constants.d.ts +42 -8
- package/dist/client/constants.d.ts.map +1 -1
- package/dist/client/constants.js +48 -3
- package/dist/client/constants.js.map +1 -1
- package/dist/client/content-adapter.d.ts +80 -0
- package/dist/client/content-adapter.d.ts.map +1 -1
- package/dist/client/content-adapter.js +225 -12
- package/dist/client/content-adapter.js.map +1 -1
- package/dist/client/delivery-error.d.ts +150 -0
- package/dist/client/delivery-error.d.ts.map +1 -0
- package/dist/client/delivery-error.js +226 -0
- package/dist/client/delivery-error.js.map +1 -0
- package/dist/client/delivery-status.d.ts +32 -6
- package/dist/client/delivery-status.d.ts.map +1 -1
- package/dist/client/delivery-status.js +61 -13
- package/dist/client/delivery-status.js.map +1 -1
- package/dist/client/device-set-reconciliation.d.ts +196 -0
- package/dist/client/device-set-reconciliation.d.ts.map +1 -0
- package/dist/client/device-set-reconciliation.js +282 -0
- package/dist/client/device-set-reconciliation.js.map +1 -0
- package/dist/client/distribution-records.d.ts +29 -0
- package/dist/client/distribution-records.d.ts.map +1 -0
- package/dist/client/distribution-records.js +33 -0
- package/dist/client/distribution-records.js.map +1 -0
- package/dist/client/event-hooks.d.ts +280 -14
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +8 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/group-device-set.d.ts +47 -0
- package/dist/client/group-device-set.d.ts.map +1 -0
- package/dist/client/group-device-set.js +65 -0
- package/dist/client/group-device-set.js.map +1 -0
- package/dist/client/group-fetcher.d.ts +116 -0
- package/dist/client/group-fetcher.d.ts.map +1 -0
- package/dist/client/group-fetcher.js +598 -0
- package/dist/client/group-fetcher.js.map +1 -0
- package/dist/client/group-outbox.d.ts +172 -10
- package/dist/client/group-outbox.d.ts.map +1 -1
- package/dist/client/group-outbox.js +915 -74
- package/dist/client/group-outbox.js.map +1 -1
- package/dist/client/group-receive-authorization.d.ts +127 -4
- package/dist/client/group-receive-authorization.d.ts.map +1 -1
- package/dist/client/group-receive-authorization.js +270 -20
- package/dist/client/group-receive-authorization.js.map +1 -1
- package/dist/client/group-sealed-sender.d.ts +3 -0
- package/dist/client/group-sealed-sender.d.ts.map +1 -1
- package/dist/client/group-sealed-sender.js +1 -0
- package/dist/client/group-sealed-sender.js.map +1 -1
- package/dist/client/group-sender-key-operations.d.ts +14 -3
- package/dist/client/group-sender-key-operations.d.ts.map +1 -1
- package/dist/client/group-sender-key-operations.js +26 -5
- package/dist/client/group-sender-key-operations.js.map +1 -1
- package/dist/client/groups.d.ts +5 -5
- package/dist/client/groups.d.ts.map +1 -1
- package/dist/client/groups.js +5 -4
- package/dist/client/groups.js.map +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts +61 -9
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
- package/dist/client/hosted-anonymous-delivery.js +242 -48
- package/dist/client/hosted-anonymous-delivery.js.map +1 -1
- package/dist/client/hosted-assertion-id.d.ts +7 -0
- package/dist/client/hosted-assertion-id.d.ts.map +1 -0
- package/dist/client/hosted-assertion-id.js +51 -0
- package/dist/client/hosted-assertion-id.js.map +1 -0
- package/dist/client/hosted-mailbox-subscription.d.ts +34 -2
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +87 -17
- package/dist/client/hosted-mailbox-subscription.js.map +1 -1
- package/dist/client/hosted-push.d.ts +22 -4
- package/dist/client/hosted-push.d.ts.map +1 -1
- package/dist/client/hosted-push.js +75 -22
- package/dist/client/hosted-push.js.map +1 -1
- package/dist/client/hosted-transport.d.ts +22 -28
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +115 -55
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted.d.ts +10 -4
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +10 -4
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +5 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/messages.d.ts +25 -3
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +111 -20
- package/dist/client/messages.js.map +1 -1
- package/dist/client/receive-admission.d.ts +58 -0
- package/dist/client/receive-admission.d.ts.map +1 -0
- package/dist/client/receive-admission.js +78 -0
- package/dist/client/receive-admission.js.map +1 -0
- package/dist/client/receive-expiry.d.ts +31 -0
- package/dist/client/receive-expiry.d.ts.map +1 -0
- package/dist/client/receive-expiry.js +35 -0
- package/dist/client/receive-expiry.js.map +1 -0
- package/dist/client/receive-hook-bound.d.ts +50 -0
- package/dist/client/receive-hook-bound.d.ts.map +1 -0
- package/dist/client/receive-hook-bound.js +115 -0
- package/dist/client/receive-hook-bound.js.map +1 -0
- package/dist/client/receive-queue.d.ts +299 -0
- package/dist/client/receive-queue.d.ts.map +1 -0
- package/dist/client/receive-queue.js +1420 -0
- package/dist/client/receive-queue.js.map +1 -0
- package/dist/client/receive-work-seed.d.ts +54 -0
- package/dist/client/receive-work-seed.d.ts.map +1 -0
- package/dist/client/receive-work-seed.js +116 -0
- package/dist/client/receive-work-seed.js.map +1 -0
- package/dist/client/recovery-driver.d.ts +25 -0
- package/dist/client/recovery-driver.d.ts.map +1 -0
- package/dist/client/recovery-driver.js +121 -0
- package/dist/client/recovery-driver.js.map +1 -0
- package/dist/client/relay-acceptance.d.ts +20 -7
- package/dist/client/relay-acceptance.d.ts.map +1 -1
- package/dist/client/relay-acceptance.js +30 -12
- package/dist/client/relay-acceptance.js.map +1 -1
- package/dist/client/relay-device-refusal.d.ts +18 -0
- package/dist/client/relay-device-refusal.d.ts.map +1 -1
- package/dist/client/relay-device-refusal.js +31 -0
- package/dist/client/relay-device-refusal.js.map +1 -1
- package/dist/client/relay-sealed-route.d.ts +36 -0
- package/dist/client/relay-sealed-route.d.ts.map +1 -0
- package/dist/client/relay-sealed-route.js +45 -0
- package/dist/client/relay-sealed-route.js.map +1 -0
- package/dist/client/relay-subscription.d.ts +56 -13
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +193 -123
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/resendable-content.d.ts +98 -0
- package/dist/client/resendable-content.d.ts.map +1 -0
- package/dist/client/resendable-content.js +136 -0
- package/dist/client/resendable-content.js.map +1 -0
- package/dist/client/retry-family.d.ts +57 -10
- package/dist/client/retry-family.d.ts.map +1 -1
- package/dist/client/retry-family.js +54 -12
- package/dist/client/retry-family.js.map +1 -1
- package/dist/client/retry-request-envelope.d.ts +107 -8
- package/dist/client/retry-request-envelope.d.ts.map +1 -1
- package/dist/client/retry-request-envelope.js +172 -23
- package/dist/client/retry-request-envelope.js.map +1 -1
- package/dist/client/retry-request-lifecycle.d.ts +70 -14
- package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
- package/dist/client/retry-request-lifecycle.js +162 -32
- package/dist/client/retry-request-lifecycle.js.map +1 -1
- package/dist/client/retry-terminal-recovery.d.ts +100 -0
- package/dist/client/retry-terminal-recovery.d.ts.map +1 -0
- package/dist/client/retry-terminal-recovery.js +164 -0
- package/dist/client/retry-terminal-recovery.js.map +1 -0
- package/dist/client/retry-utils.d.ts +27 -0
- package/dist/client/retry-utils.d.ts.map +1 -1
- package/dist/client/retry-utils.js +46 -0
- package/dist/client/retry-utils.js.map +1 -1
- package/dist/client/retry.d.ts +100 -12
- package/dist/client/retry.d.ts.map +1 -1
- package/dist/client/retry.js +619 -116
- package/dist/client/retry.js.map +1 -1
- package/dist/client/sealed-sender.d.ts +23 -6
- package/dist/client/sealed-sender.d.ts.map +1 -1
- package/dist/client/sealed-sender.js +30 -6
- package/dist/client/sealed-sender.js.map +1 -1
- package/dist/client/sessions.d.ts +2 -2
- package/dist/client/sessions.js +2 -2
- package/dist/client/signal-service-cipher.d.ts +726 -19
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +2260 -342
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/state.d.ts +5 -0
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/state.js +11 -1
- package/dist/client/state.js.map +1 -1
- package/dist/client/storage-protection.d.ts +64 -0
- package/dist/client/storage-protection.d.ts.map +1 -0
- package/dist/client/storage-protection.js +150 -0
- package/dist/client/storage-protection.js.map +1 -0
- package/dist/client/types.d.ts +149 -15
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/device/constants.d.ts +0 -5
- package/dist/device/constants.d.ts.map +1 -1
- package/dist/device/constants.js +0 -5
- package/dist/device/constants.js.map +1 -1
- package/dist/device/expo/index.d.ts +4 -17
- package/dist/device/expo/index.d.ts.map +1 -1
- package/dist/device/expo/index.js +4 -23
- package/dist/device/expo/index.js.map +1 -1
- package/dist/device/index.d.ts +0 -2
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +0 -7
- package/dist/device/index.js.map +1 -1
- package/dist/device/lifecycle/manager.d.ts +5 -4
- package/dist/device/lifecycle/manager.d.ts.map +1 -1
- package/dist/device/lifecycle/manager.js +16 -16
- package/dist/device/lifecycle/manager.js.map +1 -1
- package/dist/device/lifecycle/types.d.ts +2 -2
- package/dist/device/lifecycle/types.d.ts.map +1 -1
- package/dist/device/react-native/index.d.ts +4 -15
- package/dist/device/react-native/index.d.ts.map +1 -1
- package/dist/device/react-native/index.js +4 -21
- package/dist/device/react-native/index.js.map +1 -1
- package/dist/device/types.d.ts +1 -1
- package/dist/groups/index.d.ts +1 -1
- package/dist/groups/index.d.ts.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/crypto/ec/x25519-validation.d.ts +0 -1
- package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -1
- package/dist/internal/crypto/ec/x25519-validation.js +0 -1
- package/dist/internal/crypto/ec/x25519-validation.js.map +1 -1
- package/dist/internal/crypto/validation.d.ts +2 -2
- package/dist/internal/groups/index.d.ts +1 -0
- package/dist/internal/groups/index.d.ts.map +1 -1
- package/dist/internal/groups/index.js +1 -0
- package/dist/internal/groups/index.js.map +1 -1
- package/dist/internal/groups/manager.d.ts +37 -16
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +46 -1
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/receive-record.d.ts +78 -0
- package/dist/internal/groups/receive-record.d.ts.map +1 -0
- package/dist/internal/groups/receive-record.js +43 -0
- package/dist/internal/groups/receive-record.js.map +1 -0
- package/dist/internal/groups/sdk-store.d.ts +27 -3
- package/dist/internal/groups/sdk-store.d.ts.map +1 -1
- package/dist/internal/groups/sdk-store.js +151 -19
- package/dist/internal/groups/sdk-store.js.map +1 -1
- package/dist/internal/groups/wire.d.ts +12 -1
- package/dist/internal/groups/wire.d.ts.map +1 -1
- package/dist/internal/groups/wire.js +36 -0
- package/dist/internal/groups/wire.js.map +1 -1
- package/dist/internal/manager/index.d.ts +1 -1
- package/dist/internal/manager/manager.d.ts +20 -19
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +56 -39
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/chains.d.ts +4 -18
- package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -1
- package/dist/internal/protocol/double-ratchet/chains.js +23 -74
- package/dist/internal/protocol/double-ratchet/chains.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/index.d.ts +1 -1
- package/dist/internal/protocol/double-ratchet/index.d.ts.map +1 -1
- package/dist/internal/protocol/double-ratchet/index.js +1 -1
- package/dist/internal/protocol/double-ratchet/index.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts +5 -7
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
- package/dist/internal/protocol/double-ratchet/ratchet.js +4 -6
- package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
- package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -1
- package/dist/internal/protocol/pqxdh/pqxdh.js +2 -1
- package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.d.ts +6 -8
- package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.js +8 -9
- package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
- package/dist/internal/protocol/sender-keys/handoff-ledger.d.ts +110 -0
- package/dist/internal/protocol/sender-keys/handoff-ledger.d.ts.map +1 -0
- package/dist/internal/protocol/sender-keys/handoff-ledger.js +124 -0
- package/dist/internal/protocol/sender-keys/handoff-ledger.js.map +1 -0
- package/dist/internal/protocol/sender-keys/manager.d.ts +71 -62
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +228 -175
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/protocol/spqr/index.d.ts +2 -2
- package/dist/internal/protocol/spqr/index.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/index.js +2 -2
- package/dist/internal/protocol/spqr/index.js.map +1 -1
- package/dist/internal/protocol/spqr/serialize.d.ts +9 -1
- package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/serialize.js +56 -16
- package/dist/internal/protocol/spqr/serialize.js.map +1 -1
- package/dist/internal/protocol/spqr/spqr.d.ts +1 -14
- package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/spqr.js +54 -42
- package/dist/internal/protocol/spqr/spqr.js.map +1 -1
- package/dist/internal/protocol/spqr/validate.d.ts +26 -6
- package/dist/internal/protocol/spqr/validate.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/validate.js +49 -21
- package/dist/internal/protocol/spqr/validate.js.map +1 -1
- package/dist/internal/sesame/index.d.ts +1 -1
- package/dist/internal/sesame/index.d.ts.map +1 -1
- package/dist/internal/sesame/index.js.map +1 -1
- package/dist/internal/sesame/manager.d.ts +66 -13
- package/dist/internal/sesame/manager.d.ts.map +1 -1
- package/dist/internal/sesame/manager.js +221 -87
- package/dist/internal/sesame/manager.js.map +1 -1
- package/dist/internal/sesame/types.d.ts +95 -17
- package/dist/internal/sesame/types.d.ts.map +1 -1
- package/dist/internal/sesame/types.js +17 -0
- package/dist/internal/sesame/types.js.map +1 -1
- package/dist/internal/session/builder.d.ts +5 -5
- package/dist/internal/session/builder.d.ts.map +1 -1
- package/dist/internal/session/builder.js +12 -17
- package/dist/internal/session/builder.js.map +1 -1
- package/dist/internal/session/cipher.d.ts +13 -11
- package/dist/internal/session/cipher.d.ts.map +1 -1
- package/dist/internal/session/cipher.js +40 -22
- package/dist/internal/session/cipher.js.map +1 -1
- package/dist/internal/session/factory.d.ts +5 -5
- package/dist/internal/session/factory.d.ts.map +1 -1
- package/dist/internal/session/factory.js +4 -4
- package/dist/internal/session/factory.js.map +1 -1
- package/dist/internal/session/handshake.d.ts +14 -16
- package/dist/internal/session/handshake.d.ts.map +1 -1
- package/dist/internal/session/handshake.js +18 -75
- package/dist/internal/session/handshake.js.map +1 -1
- package/dist/internal/session/index.d.ts +1 -1
- package/dist/internal/session/index.js +1 -1
- package/dist/internal/session/record-locks.d.ts +17 -6
- package/dist/internal/session/record-locks.d.ts.map +1 -1
- package/dist/internal/session/record-locks.js +43 -7
- package/dist/internal/session/record-locks.js.map +1 -1
- package/dist/internal/session/session-resolver.d.ts +1 -1
- package/dist/internal/session/session-resolver.js +1 -1
- package/dist/internal/session/state.d.ts +2 -2
- package/dist/internal/session/state.js +1 -1
- package/dist/internal/session/types.d.ts +4 -12
- package/dist/internal/session/types.d.ts.map +1 -1
- package/dist/internal/session/types.js +1 -1
- package/dist/keys/generation.d.ts +2 -2
- package/dist/keys/generation.js +2 -2
- package/dist/keys/types.d.ts +5 -5
- package/dist/keys/types.d.ts.map +1 -1
- package/dist/keys/types.js +1 -1
- package/dist/layers.d.ts +1 -1
- package/dist/layers.js +2 -2
- package/dist/layers.js.map +1 -1
- package/dist/local/store/expo/adapter.d.ts.map +1 -1
- package/dist/local/store/expo/adapter.js +12 -8
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/key-value/adapter.d.ts +76 -10
- package/dist/local/store/key-value/adapter.d.ts.map +1 -1
- package/dist/local/store/key-value/adapter.js +367 -61
- package/dist/local/store/key-value/adapter.js.map +1 -1
- package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -1
- package/dist/local/store/key-value/backend-conformance.js +74 -0
- package/dist/local/store/key-value/backend-conformance.js.map +1 -1
- package/dist/local/store/key-value/batch.d.ts +2 -0
- package/dist/local/store/key-value/batch.d.ts.map +1 -1
- package/dist/local/store/key-value/batch.js +26 -0
- package/dist/local/store/key-value/batch.js.map +1 -1
- package/dist/local/store/key-value/receive-work.d.ts +55 -0
- package/dist/local/store/key-value/receive-work.d.ts.map +1 -0
- package/dist/local/store/key-value/receive-work.js +162 -0
- package/dist/local/store/key-value/receive-work.js.map +1 -0
- package/dist/local/store/key-value/send-log.d.ts +61 -0
- package/dist/local/store/key-value/send-log.d.ts.map +1 -0
- package/dist/local/store/key-value/send-log.js +430 -0
- package/dist/local/store/key-value/send-log.js.map +1 -0
- package/dist/local/store/key-value/sender-key-handoff.d.ts +68 -0
- package/dist/local/store/key-value/sender-key-handoff.d.ts.map +1 -0
- package/dist/local/store/key-value/sender-key-handoff.js +189 -0
- package/dist/local/store/key-value/sender-key-handoff.js.map +1 -0
- package/dist/local/store/key-value/storage.d.ts +15 -0
- package/dist/local/store/key-value/storage.d.ts.map +1 -1
- package/dist/local/store/keyed-index.d.ts +23 -0
- package/dist/local/store/keyed-index.d.ts.map +1 -0
- package/dist/local/store/keyed-index.js +41 -0
- package/dist/local/store/keyed-index.js.map +1 -0
- package/dist/local/store/memory/adapter.d.ts +44 -12
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +197 -46
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/memory/send-log.d.ts +42 -0
- package/dist/local/store/memory/send-log.d.ts.map +1 -0
- package/dist/local/store/memory/send-log.js +190 -0
- package/dist/local/store/memory/send-log.js.map +1 -0
- package/dist/local/store/node/adapter.d.ts.map +1 -1
- package/dist/local/store/node/adapter.js +8 -6
- package/dist/local/store/node/adapter.js.map +1 -1
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +12 -8
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/receive-work.d.ts +87 -0
- package/dist/local/store/receive-work.d.ts.map +1 -0
- package/dist/local/store/receive-work.js +204 -0
- package/dist/local/store/receive-work.js.map +1 -0
- package/dist/local/store/received-content.d.ts +3 -3
- package/dist/local/store/received-content.d.ts.map +1 -1
- package/dist/local/store/received-content.js +2 -11
- package/dist/local/store/received-content.js.map +1 -1
- package/dist/local/store/reliability.d.ts +317 -18
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +371 -46
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/local/store/send-log-order.d.ts +15 -0
- package/dist/local/store/send-log-order.d.ts.map +1 -0
- package/dist/local/store/send-log-order.js +24 -0
- package/dist/local/store/send-log-order.js.map +1 -0
- package/dist/local/store/sender-key-handoff-index.d.ts +38 -0
- package/dist/local/store/sender-key-handoff-index.d.ts.map +1 -0
- package/dist/local/store/sender-key-handoff-index.js +101 -0
- package/dist/local/store/sender-key-handoff-index.js.map +1 -0
- package/dist/local/store/sender-key-handoff-table.d.ts +29 -0
- package/dist/local/store/sender-key-handoff-table.d.ts.map +1 -0
- package/dist/local/store/sender-key-handoff-table.js +97 -0
- package/dist/local/store/sender-key-handoff-table.js.map +1 -0
- package/dist/local/store/sqlite/encryption.d.ts +8 -1
- package/dist/local/store/sqlite/encryption.d.ts.map +1 -1
- package/dist/local/store/sqlite/encryption.js +9 -0
- package/dist/local/store/sqlite/encryption.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/index.d.ts +25 -4
- package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/index.js +68 -7
- package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/message-records.d.ts +16 -4
- package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/message-records.js +49 -6
- package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/metadata.d.ts +8 -7
- package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/metadata.js +17 -15
- package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/receive-work.d.ts +27 -0
- package/dist/local/store/sqlite/key-storage/receive-work.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/receive-work.js +98 -0
- package/dist/local/store/sqlite/key-storage/receive-work.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/send-log.d.ts +27 -0
- package/dist/local/store/sqlite/key-storage/send-log.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/send-log.js +178 -0
- package/dist/local/store/sqlite/key-storage/send-log.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts +27 -0
- package/dist/local/store/sqlite/key-storage/sender-key-handoff.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/sender-key-handoff.js +75 -0
- package/dist/local/store/sqlite/key-storage/sender-key-handoff.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/session-trust.d.ts +2 -2
- package/dist/local/store/sqlite/key-storage/session-trust.js +5 -5
- package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -1
- package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/local/store/sqlite/migrations.js +101 -0
- package/dist/local/store/sqlite/migrations.js.map +1 -1
- package/dist/local/store/sqlite/models/index.d.ts +2 -1
- package/dist/local/store/sqlite/models/index.d.ts.map +1 -1
- package/dist/local/store/sqlite/models/index.js +5 -1
- package/dist/local/store/sqlite/models/index.js.map +1 -1
- package/dist/local/store/sqlite/models/message-record.d.ts +15 -0
- package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -1
- package/dist/local/store/sqlite/models/message-record.js +24 -0
- package/dist/local/store/sqlite/models/message-record.js.map +1 -1
- package/dist/local/store/sqlite/models/send-log.d.ts +51 -0
- package/dist/local/store/sqlite/models/send-log.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/send-log.js +206 -0
- package/dist/local/store/sqlite/models/send-log.js.map +1 -0
- package/dist/local/store/sqlite/open-store.d.ts +9 -1
- package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
- package/dist/local/store/sqlite/open-store.js +20 -1
- package/dist/local/store/sqlite/open-store.js.map +1 -1
- package/dist/local/store/sqlite/schema.d.ts +34 -1
- package/dist/local/store/sqlite/schema.d.ts.map +1 -1
- package/dist/local/store/sqlite/schema.js +14 -0
- package/dist/local/store/sqlite/schema.js.map +1 -1
- package/dist/local/store/sqlite/store.d.ts +61 -11
- package/dist/local/store/sqlite/store.d.ts.map +1 -1
- package/dist/local/store/sqlite/store.js +191 -27
- package/dist/local/store/sqlite/store.js.map +1 -1
- package/dist/local/store/web/adapter.d.ts +76 -8
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +579 -127
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/local/store/web/receive-work.d.ts +57 -0
- package/dist/local/store/web/receive-work.d.ts.map +1 -0
- package/dist/local/store/web/receive-work.js +99 -0
- package/dist/local/store/web/receive-work.js.map +1 -0
- package/dist/local/store/web/send-log.d.ts +92 -0
- package/dist/local/store/web/send-log.d.ts.map +1 -0
- package/dist/local/store/web/send-log.js +267 -0
- package/dist/local/store/web/send-log.js.map +1 -0
- package/dist/local/store/web/sender-key-handoff.d.ts +81 -0
- package/dist/local/store/web/sender-key-handoff.d.ts.map +1 -0
- package/dist/local/store/web/sender-key-handoff.js +156 -0
- package/dist/local/store/web/sender-key-handoff.js.map +1 -0
- package/dist/local/store/web-sqlite/adapter.d.ts +2 -0
- package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
- package/dist/local/store/web-sqlite/adapter.js +12 -6
- package/dist/local/store/web-sqlite/adapter.js.map +1 -1
- package/dist/local/vault/custody.d.ts +8 -0
- package/dist/local/vault/custody.d.ts.map +1 -0
- package/dist/local/vault/custody.js +9 -0
- package/dist/local/vault/custody.js.map +1 -0
- package/dist/local/vault/electron-safe-storage.d.ts +3 -1
- package/dist/local/vault/electron-safe-storage.d.ts.map +1 -1
- package/dist/local/vault/electron-safe-storage.js +2 -0
- package/dist/local/vault/electron-safe-storage.js.map +1 -1
- package/dist/local/vault/expo-secure-store.d.ts +3 -1
- package/dist/local/vault/expo-secure-store.d.ts.map +1 -1
- package/dist/local/vault/expo-secure-store.js +2 -0
- package/dist/local/vault/expo-secure-store.js.map +1 -1
- package/dist/local/vault/indexed-db.d.ts +3 -1
- package/dist/local/vault/indexed-db.d.ts.map +1 -1
- package/dist/local/vault/indexed-db.js +2 -0
- package/dist/local/vault/indexed-db.js.map +1 -1
- package/dist/local/vault/react-native-keychain.d.ts +3 -1
- package/dist/local/vault/react-native-keychain.d.ts.map +1 -1
- package/dist/local/vault/react-native-keychain.js +2 -0
- package/dist/local/vault/react-native-keychain.js.map +1 -1
- package/dist/remote/relay/device-set.d.ts +94 -0
- package/dist/remote/relay/device-set.d.ts.map +1 -0
- package/dist/remote/relay/device-set.js +156 -0
- package/dist/remote/relay/device-set.js.map +1 -0
- package/dist/remote/relay/types.d.ts +92 -107
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/safety/core.d.ts +15 -6
- package/dist/safety/core.d.ts.map +1 -1
- package/dist/safety/core.js +41 -27
- package/dist/safety/core.js.map +1 -1
- package/dist/safety/index.d.ts +2 -1
- package/dist/safety/index.d.ts.map +1 -1
- package/dist/safety/index.js +12 -18
- package/dist/safety/index.js.map +1 -1
- package/dist/types/api.d.ts +707 -62
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +14 -33
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +14 -24
- package/dist/types/errors.js.map +1 -1
- package/dist/types/messages.d.ts +2 -2
- package/dist/types/messages.js +1 -1
- package/dist/types/protocol-config.d.ts +175 -42
- package/dist/types/protocol-config.d.ts.map +1 -1
- package/dist/types/protocol-config.js +19 -38
- package/dist/types/protocol-config.js.map +1 -1
- package/dist/types/protocol-constants.d.ts +6 -6
- package/dist/types/protocol-constants.js +6 -6
- package/dist/types/session.d.ts +7 -7
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js +39 -21
- package/dist/types/session.js.map +1 -1
- package/dist/username/link.d.ts +2 -2
- package/dist/username/link.js +2 -2
- package/dist/utils/origin-lock.d.ts +45 -0
- package/dist/utils/origin-lock.d.ts.map +1 -0
- package/dist/utils/origin-lock.js +80 -0
- package/dist/utils/origin-lock.js.map +1 -0
- package/docs/ASSURANCE.md +6 -6
- package/docs/CLIENT_COMPOSITION.md +2 -2
- package/docs/DEVIATIONS.md +677 -182
- package/docs/E2EE.md +1 -1
- package/docs/ERROR_HANDLING.md +165 -2
- package/docs/GETTING_STARTED.md +7 -4
- package/docs/INTERFACES.md +1 -1
- package/docs/PACKAGE_SURFACE.md +6 -5
- package/docs/PROTOCOL_POLICY.md +102 -22
- package/docs/RECIPES.md +3 -15
- package/docs/SECURITY.md +90 -5
- package/keys/README.md +3 -3
- package/local/store/README.md +78 -14
- package/local/store/key-value/README.md +14 -3
- package/local/store/node/README.md +8 -3
- package/local/store/web/README.md +9 -0
- package/local/store/web-sqlite/README.md +14 -2
- package/local/vault/README.md +21 -0
- package/package.json +1 -6
- package/remote/README.md +0 -1
- package/remote/relay/README.md +2 -2
- package/dist/device/provisioning.d.ts +0 -242
- package/dist/device/provisioning.d.ts.map +0 -1
- package/dist/device/provisioning.js +0 -421
- package/dist/device/provisioning.js.map +0 -1
- package/dist/internal/protocol/x3dh/index.d.ts +0 -15
- package/dist/internal/protocol/x3dh/index.d.ts.map +0 -1
- package/dist/internal/protocol/x3dh/index.js +0 -13
- package/dist/internal/protocol/x3dh/index.js.map +0 -1
- package/dist/internal/protocol/x3dh/x3dh.d.ts +0 -131
- package/dist/internal/protocol/x3dh/x3dh.d.ts.map +0 -1
- package/dist/internal/protocol/x3dh/x3dh.js +0 -261
- package/dist/internal/protocol/x3dh/x3dh.js.map +0 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The receive queue: the processor of the stored receive records.
|
|
3
|
+
*
|
|
4
|
+
* A Relay receive commits its decrypted content as a receive record, and
|
|
5
|
+
* holds the record while it runs. The Relay subscription and the hosted
|
|
6
|
+
* pull hold the record until the acknowledgment of its envelope settles.
|
|
7
|
+
* `receiveIncomingEnvelopes` and `processIncomingEnvelope` hold it until the
|
|
8
|
+
* commit ends, because the application acknowledges after the call returns.
|
|
9
|
+
* After the release, the queue decides on the group of the content, gives it
|
|
10
|
+
* to the application, sends the E2EE delivery receipt, and completes the
|
|
11
|
+
* record. A record that waits for its group state stays on the device, not
|
|
12
|
+
* at the Relay.
|
|
13
|
+
*
|
|
14
|
+
* The queue processes the records of one conversation in arrival order. A
|
|
15
|
+
* record that waits, for its group or after a failed hook below the attempt
|
|
16
|
+
* cap, holds back each later record of its conversation. See "Order key".
|
|
17
|
+
* Each pass runs these steps on each record, in arrival order:
|
|
18
|
+
*
|
|
19
|
+
* - A record that has expired (`MAX_RECEIVE_WORK_AGE_MS`, 30 days) and owes
|
|
20
|
+
* no receipt runs `onReceiveExpired`, then completes with the `expired`
|
|
21
|
+
* outcome. A `receipt-due` record that has expired, or whose receipt
|
|
22
|
+
* lifespan of 1 day after its `dueAt` has ended, completes with no
|
|
23
|
+
* receipt and no report: the application has its content.
|
|
24
|
+
* - A `decrypted` record gets its group decision. Authorized content goes
|
|
25
|
+
* to the application, and the record then completes or moves to
|
|
26
|
+
* `receipt-due`. Denied content runs `onDecryptionError` and completes
|
|
27
|
+
* with the `denied` outcome. Content whose group state must update first
|
|
28
|
+
* waits until its retry time or until a fetch of its group completes.
|
|
29
|
+
* - A `receipt-due` record waits for the receipt decision of the Relay for
|
|
30
|
+
* no longer than the reply window, then sends its receipt and completes.
|
|
31
|
+
* - An `awaiting-completion` record waits for `completeReceive` or expiry.
|
|
32
|
+
*
|
|
33
|
+
* A pass runs after the release of each held record, when a fetch of a group
|
|
34
|
+
* completes, at start, at the earliest due time of the records, and from
|
|
35
|
+
* `processPendingReceives`. Each pass is relay work, so a client stop stops
|
|
36
|
+
* it, and its hooks run through that work. At start, before the retry
|
|
37
|
+
* request lifecycle starts, the queue writes outcome 1 again for each
|
|
38
|
+
* stored resend, so the retry deadline never resets a session whose resend
|
|
39
|
+
* content the device holds.
|
|
40
|
+
*
|
|
41
|
+
* Signal equivalence. The order is Signal's. Signal commits the ratchet
|
|
42
|
+
* step and the decrypted content in one transaction, acknowledges after
|
|
43
|
+
* that commit, and sends no acknowledgment when the commit fails. Content
|
|
44
|
+
* that waits for its group stays on the device after the acknowledgment.
|
|
45
|
+
* One Signal client keeps it in a job with a 30-day life. The E2EE delivery
|
|
46
|
+
* receipt goes out only after the group checks, as in another Signal
|
|
47
|
+
* client. It is the only proof that the
|
|
48
|
+
* application processed the content. A Relay delivery receipt that the
|
|
49
|
+
* acknowledgment produces means only that the device holds the content.
|
|
50
|
+
* A resend clears its pending retry only after its processing, as in one
|
|
51
|
+
* Signal client, so `onDeliveryRecovered` waits for the completed record.
|
|
52
|
+
*
|
|
53
|
+
* Order key. A waiting record holds back the later records of its
|
|
54
|
+
* conversation, as one Signal client queues its message jobs per
|
|
55
|
+
* conversation. Group
|
|
56
|
+
* content keys by its group, a sent transcript of this account keys by its
|
|
57
|
+
* destination, and other content keys by its sender account, not by its
|
|
58
|
+
* sender device. So a blocked group holds back the later records of that
|
|
59
|
+
* group from every sender, and direct chats and other groups make
|
|
60
|
+
* progress. The pass learns the conversation of pairwise content only when
|
|
61
|
+
* it restores the content, before the group decision. A record that the
|
|
62
|
+
* pass has not restored keys by the group that it stores, otherwise by its
|
|
63
|
+
* sender account. The queue keeps the key of each restored record in
|
|
64
|
+
* memory, so a record in backoff holds back its conversation and not only
|
|
65
|
+
* its sender account. A record of a group that waits behind an earlier
|
|
66
|
+
* record of that group is written as a record that waits for an update of
|
|
67
|
+
* the group, so the group share of the admission counts it. The commit
|
|
68
|
+
* order stays per sender device by `(arrivalSeq, workId)`. Tests:
|
|
69
|
+
* "processes the records of each sender account in arrival order", "a
|
|
70
|
+
* direct message delivers while an earlier group message of its sender
|
|
71
|
+
* waits for its group", "a message in another group makes progress while a
|
|
72
|
+
* blocked group record of its sender waits", "a blocked head that expires
|
|
73
|
+
* lets the later records of its conversation through", "direct messages
|
|
74
|
+
* progress while global room exists with pairwise group overshoot", and
|
|
75
|
+
* the conversation tests: "a sent transcript waits only behind an earlier
|
|
76
|
+
* transcript to its destination", "a direct message from a second device
|
|
77
|
+
* of a sender waits behind a refused record of its first device", "a
|
|
78
|
+
* record that fails before its restore holds back only its sender
|
|
79
|
+
* account", "a group record that blocks after its decrypt holds back its
|
|
80
|
+
* group from every sender", "pairwise content of a blocked group waits
|
|
81
|
+
* behind the group and delivers after the fetch", "a second sender in a
|
|
82
|
+
* blocked group waits in the group and delivers its direct message".
|
|
83
|
+
*
|
|
84
|
+
* The deviations, each with its constraint and its tests:
|
|
85
|
+
*
|
|
86
|
+
* - Failed hook. One Signal client retries cached content every 2 minutes
|
|
87
|
+
* and deletes it after 10 attempts or 45 days. Another retries a job only
|
|
88
|
+
* on a network error, a missing redemption credential, or a busy group
|
|
89
|
+
* change, and drops the content on other errors. The queue keeps the content
|
|
90
|
+
* until it expires, because the hook is application code: the SDK cannot
|
|
91
|
+
* tell a lasting failure from a passing one, and a drop loses content
|
|
92
|
+
* whose ratchet step is spent. A timer retries the hook after
|
|
93
|
+
* `RECEIVE_RETRY_BACKOFF_MS`. The record keeps a durable `hookAttempts`
|
|
94
|
+
* count, written with the revision check before the hook runs. The first
|
|
95
|
+
* client also counts an attempt of an entry before it processes it. So a
|
|
96
|
+
* hook that ends the process counts as an attempt, and a pass that loses
|
|
97
|
+
* the revision check skips the record. Only the hook stage counts an
|
|
98
|
+
* attempt, so a throw in `restoreCommitted` or in the group decision adds
|
|
99
|
+
* no count and reaches no cap. After `RECEIVE_HOOK_ATTEMPT_CAP` attempts,
|
|
100
|
+
* the cap of 10 of the first client, the record no longer holds
|
|
101
|
+
* back the later records of its conversation, so one failing message
|
|
102
|
+
* never stalls its conversation, as on Signal. Each start then offers it
|
|
103
|
+
* to the hook once: in the start pass, or at the registration of
|
|
104
|
+
* `onMessageDecrypted` when the start pass had no hook. After that offer,
|
|
105
|
+
* or after the attempt that reaches the cap, only `processPendingReceives`
|
|
106
|
+
* runs it again before the next start, and `discardPendingReceive`
|
|
107
|
+
* removes it. In that pass, the record at the cap runs after the other
|
|
108
|
+
* records of the pass, so a hook that ends the process on it still lets
|
|
109
|
+
* the later records of its conversation deliver first. Only an earlier
|
|
110
|
+
* record of its conversation holds it back in that pass. A later record that
|
|
111
|
+
* waits, such as for its group, does not. A pass that ends before the
|
|
112
|
+
* records at the cap run, at its deadline or at any failed page read,
|
|
113
|
+
* leaves them to the next pass. The process then ends at each start until the
|
|
114
|
+
* record expires or the application discards it. The first client deletes
|
|
115
|
+
* the entry at the cap at startup, before it processes any entry, and loses the
|
|
116
|
+
* message. The SDK keeps the record because an application update can
|
|
117
|
+
* repair the hook. Tests: "keeps the content of a rejected application
|
|
118
|
+
* write across its replay", "a hook that always fails stops
|
|
119
|
+
* holding back its conversation after the attempt cap", "the hook attempt count
|
|
120
|
+
* survives a restart", "a hook that ends the process counts toward the
|
|
121
|
+
* attempt cap", "a hook that ends the process on a record at the cap lets
|
|
122
|
+
* the later records of its conversation deliver", "a record at the cap
|
|
123
|
+
* runs while a later record of its conversation waits for its group", "a
|
|
124
|
+
* record at the cap waits behind an earlier record of its conversation
|
|
125
|
+
* that waits for its group", "a record at the cap that holds back its
|
|
126
|
+
* conversation holds back the later records at the cap", "a start pass that fails at its first page
|
|
127
|
+
* read leaves the records at the cap to the next pass", "a capped-retry
|
|
128
|
+
* pass that fails at a page read leaves the records at the cap to the
|
|
129
|
+
* next pass", "a capped-retry pass that reaches its deadline before the
|
|
130
|
+
* records at the cap leaves them to the next pass", "a record that
|
|
131
|
+
* reaches the cap in a pass that reaches its deadline waits for a
|
|
132
|
+
* capped-retry trigger", "a call to processPendingReceives after a failed
|
|
133
|
+
* start pass retries the records at the cap once", "an ordinary pass
|
|
134
|
+
* that fails at a page read leaves no capped retry due", "a record at
|
|
135
|
+
* the cap is offered once at start and not again at the hook
|
|
136
|
+
* registration", "a record that reaches the cap is not offered again
|
|
137
|
+
* before the next start", "discardPendingReceive removes a record at the
|
|
138
|
+
* cap with no receipt, no hook call, and no expiry report".
|
|
139
|
+
* - Missing hook. Signal always has its processor. `create()` resumes the
|
|
140
|
+
* stored records before the application can register
|
|
141
|
+
* `onMessageDecrypted`, so a stored record waits with no backoff, as a job
|
|
142
|
+
* of one Signal client waits for its network constraint, and the hook
|
|
143
|
+
* registration wakes it. The Relay subscription and `receiveIncomingEnvelopes` refuse
|
|
144
|
+
* to start without the hook. Test: "keeps a stored
|
|
145
|
+
* receive with no hook and no backoff, and the hook registration delivers
|
|
146
|
+
* it".
|
|
147
|
+
* - Hook bound. One Signal client bounds its receive pipeline at 2 minutes
|
|
148
|
+
* and its application handlers at 30 minutes. The SDK waits for each
|
|
149
|
+
* application hook of a pass for at most `receiveHookTimeoutMs`, 2 minutes by default, as the founder ruling on the hook bound sets. A timeout counts
|
|
150
|
+
* as a hook failure of that call, and a late settle writes nothing.
|
|
151
|
+
* Tests: "onMessageDecrypted: a hung hook counts one attempt per pass and
|
|
152
|
+
* holds back its conversation until the cap", "onMessageDecrypted: a settle
|
|
153
|
+
* after the bound writes nothing, and the next attempt delivers", and one
|
|
154
|
+
* timeout test for each other await site.
|
|
155
|
+
* - Expiry hook. One Signal client drops an expired job with no report,
|
|
156
|
+
* and another deletes the expired row. The queue
|
|
157
|
+
* runs `onReceiveExpired` first, because the application, not the SDK,
|
|
158
|
+
* shows the user that a message is lost. Before the hook, the queue reads
|
|
159
|
+
* the record again. A record that another path completed after the list
|
|
160
|
+
* of the pass and before this read, such as at the redelivery of its
|
|
161
|
+
* envelope, gets no report. A record that another path wrote in that time
|
|
162
|
+
* expires in a later pass, from its new revision. Expiry is by age only,
|
|
163
|
+
* never by the hook attempt count, because a pass also runs on events,
|
|
164
|
+
* such as an arrival or a group fetch, and a count would measure the
|
|
165
|
+
* events and not the wait (design v5 deviation 5). Tests: the expiry
|
|
166
|
+
* suite, and in it "a record that another path completes after the pass
|
|
167
|
+
* lists it expires with no report", "a record that another path writes
|
|
168
|
+
* after the pass lists it expires in a later pass".
|
|
169
|
+
* - Helper completion. One Signal client confirms a receive after its own
|
|
170
|
+
* save. An SDK customer owns its message store,
|
|
171
|
+
* so a helper record waits in `awaiting-completion` for `completeReceive`
|
|
172
|
+
* (design v5 deviation 6). Tests: V11, V12, and the helper completion
|
|
173
|
+
* suite.
|
|
174
|
+
* - Durable receipt. One Signal client batches the receipt in memory, so a
|
|
175
|
+
* crash can lose it. Another keeps it in a stored job with a 1-day life
|
|
176
|
+
* and no attempt limit. The queue keeps it durable, as that stored job
|
|
177
|
+
* does, in a `receipt-due` record. The Relay can own the receipt, and its decision
|
|
178
|
+
* comes in the reply to the acknowledgment, so the record keeps the
|
|
179
|
+
* receipt and the decision across a restart, and stays in flight until its
|
|
180
|
+
* completion is written. Tests: V7, V8,
|
|
181
|
+
* "a ReceiptSendTerminalError completes with no receipt", "keeps a Relay
|
|
182
|
+
* receipt decision that arrives while the record waits, across a restart".
|
|
183
|
+
* - Receipt lifetime. The Signal client with the stored job stops its receipt
|
|
184
|
+
* retries 1 day after it creates the job, after the message is processed.
|
|
185
|
+
* The queue sends a receipt only until `RECEIPT_LIFESPAN_MS`, 1 day,
|
|
186
|
+
* after the `dueAt` that the move to `receipt-due` writes. That `dueAt` is
|
|
187
|
+
* when the receipt becomes owed, so the lifespan of that job starts there.
|
|
188
|
+
* It includes the receipt-join wait, and the in-memory receipt backoff
|
|
189
|
+
* does not change it. At the end of the lifespan, the record completes
|
|
190
|
+
* with no receipt, no `onMessageDecrypted` call, and no
|
|
191
|
+
* `onReceiveExpired` report. A
|
|
192
|
+
* `receipt-due` record past its 30-day age before then completes in the
|
|
193
|
+
* same way (ruling Q6). The completion of a resend record still reports
|
|
194
|
+
* `onDeliveryRecovered` through its gate. Two other
|
|
195
|
+
* limits of the queue have their own notes: two processes that share one
|
|
196
|
+
* store can overshoot a bound (Q16, see `receive-admission.ts`), and the
|
|
197
|
+
* memory store loses the queue at a restart (T-36). In Q16, each process
|
|
198
|
+
* also keeps its own arrival counter, so a record of one process can sort
|
|
199
|
+
* before a record that another process admitted earlier (see
|
|
200
|
+
* `receive-work-seed.ts`). Tests: "Q6 deletes a receipt-due record past
|
|
201
|
+
* its 30-day age with no receipt, no onMessageDecrypted call, and no
|
|
202
|
+
* onReceiveExpired report", "sends a receipt 1 ms before the end of its
|
|
203
|
+
* 1-day lifespan", "completes a receipt-due record at the end of its
|
|
204
|
+
* 1-day lifespan with no receipt and no report", "a resend record at the
|
|
205
|
+
* end of its receipt lifespan still reports onDeliveryRecovered", "a
|
|
206
|
+
* running client stops its receipt retries at the end of the lifespan".
|
|
207
|
+
* - Bounds. Signal has no device bound on deferred content. The SDK shares a
|
|
208
|
+
* storage budget with the application in a browser and on mobile, so
|
|
209
|
+
* admission checks `maxItems`, `maxBytes`, and `blockedGroupShare` before
|
|
210
|
+
* decrypt, and a refusal is not acknowledged. A refused envelope stays at
|
|
211
|
+
* the Relay and expires there at the project TTL with no local hook. While
|
|
212
|
+
* the mailbox of the device is full, the Relay refuses a new message to it
|
|
213
|
+
* with `MAILBOX_FULL` to its sender. A refusal does not stall the messages
|
|
214
|
+
* behind it: the socket acknowledges each page, and an HTTP pull sends
|
|
215
|
+
* the Relay cursor of the page before it. Tests: the bounds suite.
|
|
216
|
+
* - Outcome 1 before the acknowledgment. The SDK retry lifecycle can reset a
|
|
217
|
+
* session at its deadline, and Signal has no such reset. So the commit of
|
|
218
|
+
* a resend writes the failed envelope as fulfilled before the
|
|
219
|
+
* acknowledgment, and the start writes it again before the lifecycle
|
|
220
|
+
* starts. Tests: both V9 tests, "the retry deadline never deletes a
|
|
221
|
+
* committed receive record".
|
|
222
|
+
* - The separate sender key install and its replay: see `restoreCommitted`.
|
|
223
|
+
* - Converted SDK 11 rows have no Signal form. The data-preserving migration
|
|
224
|
+
* rule keeps them, and the redelivered envelope fills them. Tests: the
|
|
225
|
+
* legacy conversion suite and the converted row tests.
|
|
226
|
+
*/
|
|
227
|
+
import type { ReceiveWorkRecord } from '../types/api.js';
|
|
228
|
+
import { type ProcessedEnvelopeOutcome } from '../local/store/reliability.js';
|
|
229
|
+
import { type RelaySubscriptionCallbacks, type RelaySubscriptionContext, type RelaySubscriptionState } from './relay-subscription.js';
|
|
230
|
+
import type { CommittedSender, GroupContentDecision } from './signal-service-cipher.js';
|
|
231
|
+
import type { SignalProtocolClientContext } from './types.js';
|
|
232
|
+
/**
|
|
233
|
+
* A failed hook or receipt send of one record runs again after this time.
|
|
234
|
+
* Signal drops or counts such failures. See "Failed hook" in the module
|
|
235
|
+
* comment for the reason the queue retries until expiry.
|
|
236
|
+
*/
|
|
237
|
+
export declare const RECEIVE_RETRY_BACKOFF_MS = 30000;
|
|
238
|
+
/**
|
|
239
|
+
* After this many `onMessageDecrypted` attempts, a record no longer
|
|
240
|
+
* holds back the later records of its conversation. One Signal client
|
|
241
|
+
* has the same cap. See "Failed hook" in the module comment.
|
|
242
|
+
*/
|
|
243
|
+
export declare const RECEIVE_HOOK_ATTEMPT_CAP = 10;
|
|
244
|
+
/**
|
|
245
|
+
* A `receipt-due` record sends its receipt only for this time after the
|
|
246
|
+
* `dueAt` of its receipt-due stage: 1 day, the lifespan of the stored
|
|
247
|
+
* receipt job of one Signal client. See "Receipt lifetime" in the module comment.
|
|
248
|
+
*/
|
|
249
|
+
export declare const RECEIPT_LIFESPAN_MS: number;
|
|
250
|
+
/** The context of one queue pass. Its hooks call the app through the pass work. */
|
|
251
|
+
export interface ReceiveQueuePass {
|
|
252
|
+
readonly ctx: RelaySubscriptionContext;
|
|
253
|
+
readonly state: RelaySubscriptionState;
|
|
254
|
+
readonly callbacks: RelaySubscriptionCallbacks;
|
|
255
|
+
}
|
|
256
|
+
/** The result of `processPendingReceives`. */
|
|
257
|
+
export interface ReceiveQueuePassResult {
|
|
258
|
+
/** The records that the pass delivered, denied, expired, or completed. */
|
|
259
|
+
readonly processed: number;
|
|
260
|
+
/** The records that still wait for processing or for their receipt. */
|
|
261
|
+
readonly remaining: number;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Complete one receive record (outcome 2, or a terminal outcome): delete it
|
|
265
|
+
* and write the processed record of its envelope in one store step. A
|
|
266
|
+
* completed resend also marks its failed envelope fulfilled and completed in
|
|
267
|
+
* the same step, then runs `onDeliveryRecovered` through the completion gate. An
|
|
268
|
+
* expired or denied resend never marks its failed envelope completed.
|
|
269
|
+
*
|
|
270
|
+
* @returns False, with nothing written, when the stored revision changed.
|
|
271
|
+
*/
|
|
272
|
+
export declare function completeReceiveWork(ctx: Pick<SignalProtocolClientContext, 'storage' | 'hooks' | 'logger'>, record: ReceiveWorkRecord, outcome?: ProcessedEnvelopeOutcome): Promise<boolean>;
|
|
273
|
+
/**
|
|
274
|
+
* Deny committed content: run `onDecryptionError`, then write the
|
|
275
|
+
* processed `denied` record. With a receive record, the write is the
|
|
276
|
+
* completion of the record. No receipt and no retry request go out.
|
|
277
|
+
*/
|
|
278
|
+
export declare function denyReceiveWork(ctx: Pick<SignalProtocolClientContext, 'storage' | 'hooks' | 'logger'>, record: ReceiveWorkRecord | null, sender: CommittedSender & {
|
|
279
|
+
readonly envelopeId?: string;
|
|
280
|
+
readonly workId?: string;
|
|
281
|
+
}, error: Error): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Write a record whose group state must update first. The record waits
|
|
284
|
+
* until its retry time, or until a fetch of its group completes.
|
|
285
|
+
*
|
|
286
|
+
* @returns The time of the next attempt. It is never after the expiry.
|
|
287
|
+
*/
|
|
288
|
+
export declare function blockReceiveWork(ctx: Pick<SignalProtocolClientContext, 'storage' | 'logger'>, record: ReceiveWorkRecord, sender: CommittedSender, decision: Extract<GroupContentDecision, {
|
|
289
|
+
kind: 'unavailable';
|
|
290
|
+
}>, now: number, expiresAt: number): Promise<number>;
|
|
291
|
+
/**
|
|
292
|
+
* Move a helper record with authorized content to `awaiting-completion`.
|
|
293
|
+
* The record then waits for `completeReceive` or for its expiry.
|
|
294
|
+
*
|
|
295
|
+
* @param groupId - The group of the authorized content, or null
|
|
296
|
+
* @returns The written record, or null when the stored revision changed
|
|
297
|
+
*/
|
|
298
|
+
export declare function awaitReceiveCompletion(ctx: Pick<SignalProtocolClientContext, 'storage'>, record: ReceiveWorkRecord, groupId: string | null, expiresAt: number): Promise<ReceiveWorkRecord | null>;
|
|
299
|
+
//# sourceMappingURL=receive-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receive-queue.d.ts","sourceRoot":"","sources":["../../client/receive-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiOG;AAIH,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAML,KAAK,wBAAwB,EAE9B,MAAM,4BAA4B,CAAC;AAcpC,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAEV,eAAe,EACf,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAsB,CAAC;AAKvD,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,wBAAwB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC;CAChD;AAED,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAgMD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,IAAI,CAAC,2BAA2B,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC,EACtE,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAyCD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,IAAI,CAAC,2BAA2B,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC,EACtE,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAChC,MAAM,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EACpF,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,IAAI,CAAC,2BAA2B,EAAE,SAAS,GAAG,QAAQ,CAAC,EAC5D,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,OAAO,CAAC,oBAAoB,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,EAChE,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,IAAI,CAAC,2BAA2B,EAAE,SAAS,CAAC,EACjD,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAWnC"}
|