@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
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { SignalProtocolRelayServer, Envelope, GroupMemberDevice } from '../remote/relay/types.js';
|
|
16
16
|
import type { SignalProtocolRemoteObjectStore } from '../remote/object-store/index.js';
|
|
17
|
-
import type { SignalProtocolLocalStore } from '../types/index.js';
|
|
17
|
+
import type { SignalProtocolLocalStore, ReceiveWorkRecord, ReceiveWorkSeed } from '../types/index.js';
|
|
18
|
+
import type { SenderKeyHandoffDevice } from '../types/api.js';
|
|
18
19
|
import type { DecryptedEnvelope } from './event-hooks.js';
|
|
19
|
-
import type
|
|
20
|
+
import { type SesameManager, type SesameMessage } from '../internal/sesame/types.js';
|
|
20
21
|
import { type Logger } from '../logger.js';
|
|
21
|
-
import { SenderKeyManager } from '../internal/protocol/sender-keys/index.js';
|
|
22
|
+
import { SenderKeyManager, type SenderKeyDistributionMessage } from '../internal/protocol/sender-keys/index.js';
|
|
22
23
|
import type { EndorsementManager } from './endorsement-manager.js';
|
|
23
|
-
import type
|
|
24
|
+
import { GroupReceiveRefusedError, GroupReceiveUnavailableError, type GroupReceiveEvaluator } from './group-receive-authorization.js';
|
|
24
25
|
import type { PreparedAttachmentUpload, SealedReceipt, SendOptions, SendResult } from './types.js';
|
|
25
26
|
import { ContentHint } from '../types/messages.js';
|
|
26
|
-
import { type BlockedRecipientsSyncInput, type ConfigurationSyncInput, type MediaAttachmentDeleteSyncInput, type ReadSyncEntryInput, type RecipientUsernameSyncInput, type SignalProtocolContentAdapter, type TaskNotificationAckSyncInput, type UsernameStateSyncInput, type VerificationStateSyncInput, type ViewOnceOpenSyncInput } from './content-adapter.js';
|
|
27
|
+
import { type BlockedRecipientsSyncInput, type ConfigurationSyncInput, type GroupContentContext, type InspectedSignalProtocolContent, type MediaAttachmentDeleteSyncInput, type ReadSyncEntryInput, type RecipientUsernameSyncInput, type SignalProtocolContentAdapter, type TaskNotificationAckSyncInput, type UsernameStateSyncInput, type VerificationStateSyncInput, type ViewOnceOpenSyncInput } from './content-adapter.js';
|
|
27
28
|
import { type RetryResendTarget } from '../local/store/reliability.js';
|
|
28
29
|
import { type BoundedFanOut } from '../utils/bounded-fan-out.js';
|
|
30
|
+
import { RelayProtocolError } from './device-set-reconciliation.js';
|
|
29
31
|
import { type SealedSenderProvider as SealedSenderProviderContract } from './sealed-sender.js';
|
|
30
32
|
import { type ContactProfileStateStore } from '../profile/contact-state.js';
|
|
31
33
|
/**
|
|
@@ -37,6 +39,11 @@ export declare const RECIPIENT_DEVICE_LIST_FRESH_MILLISECONDS = 60000;
|
|
|
37
39
|
export declare function sortEnvelopesForDecryption<T extends {
|
|
38
40
|
messageType?: string;
|
|
39
41
|
}>(envelopes: T[]): T[];
|
|
42
|
+
/**
|
|
43
|
+
* Give a send error the logical-send identifier of its send, so
|
|
44
|
+
* `isOutgoingMessageError` is true for it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function attachClientMessageId(error: unknown, clientMessageId: string): Error;
|
|
40
47
|
/**
|
|
41
48
|
* Sealed sender context provider callback
|
|
42
49
|
*
|
|
@@ -97,6 +104,98 @@ export interface SendSessionCallbacks {
|
|
|
97
104
|
*/
|
|
98
105
|
export type EndorsementRefresher = (groupId: string, memberUserIds: string[]) => Promise<boolean>;
|
|
99
106
|
export type GroupSendBarrierChecker = (groupId: string) => Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* The receive record that a decrypt commits with its ratchet step, and the
|
|
109
|
+
* admission that runs the decrypt.
|
|
110
|
+
*/
|
|
111
|
+
export interface ReceiveCommit {
|
|
112
|
+
/** The receive record ID: the delivered fingerprint of the envelope. */
|
|
113
|
+
readonly workId: string;
|
|
114
|
+
/**
|
|
115
|
+
* Build the record seed for the envelope that the decrypt opens. The
|
|
116
|
+
* envelope is the inner envelope of a seal. It never throws.
|
|
117
|
+
*/
|
|
118
|
+
readonly seed: (envelope: Envelope, arrivedSealed: boolean) => ReceiveWorkSeed;
|
|
119
|
+
/**
|
|
120
|
+
* Run the decrypt under the receive admission. Null when the queue has no
|
|
121
|
+
* room: then nothing is decrypted.
|
|
122
|
+
*
|
|
123
|
+
* @param groupId - The raw group of a sender-key message, or null
|
|
124
|
+
*/
|
|
125
|
+
readonly admit: <T>(groupId: string | null, decrypt: () => Promise<T>) => Promise<{
|
|
126
|
+
value: T;
|
|
127
|
+
} | null>;
|
|
128
|
+
}
|
|
129
|
+
/** The options of one envelope commit. */
|
|
130
|
+
export interface EnvelopeCommitOptions {
|
|
131
|
+
/** The trust roots of an unidentified_sender envelope. */
|
|
132
|
+
sealedSender?: import('./config.js').SealedSenderConfig | undefined;
|
|
133
|
+
/** When it aborts while the commit waits for a lock, the commit throws RelayWorkStopped. */
|
|
134
|
+
stopSignal?: AbortSignal | undefined;
|
|
135
|
+
/** The receive record to commit. Without it, the decrypt commits no record. */
|
|
136
|
+
work?: ReceiveCommit | undefined;
|
|
137
|
+
}
|
|
138
|
+
/** The sender of committed content. */
|
|
139
|
+
export interface CommittedSender {
|
|
140
|
+
/** The envelope ID, or the sender and the admission time for an envelope with no ID. */
|
|
141
|
+
readonly messageId: string;
|
|
142
|
+
readonly senderUserId: string;
|
|
143
|
+
readonly senderDeviceId: number;
|
|
144
|
+
}
|
|
145
|
+
/** Content that a decrypt committed, checked, and whose distribution installed. */
|
|
146
|
+
export interface CommittedContent extends CommittedSender {
|
|
147
|
+
readonly messageType: DecryptedEnvelope['messageType'];
|
|
148
|
+
readonly serverTimestamp?: number;
|
|
149
|
+
readonly arrivedSealed: boolean;
|
|
150
|
+
readonly plaintext: string;
|
|
151
|
+
readonly inspected: InspectedSignalProtocolContent;
|
|
152
|
+
/** The raw group of the sender key that decrypted the content, or null. */
|
|
153
|
+
readonly transportGroupId: string | null;
|
|
154
|
+
/** The raw group of a distribution that the content carries, or null. */
|
|
155
|
+
readonly distributionGroupId: string | null;
|
|
156
|
+
/** The time of the first durable admission. */
|
|
157
|
+
readonly receivedAt: number;
|
|
158
|
+
}
|
|
159
|
+
/** The result of one envelope commit. */
|
|
160
|
+
export type EnvelopeCommit = {
|
|
161
|
+
readonly kind: 'committed';
|
|
162
|
+
/** The committed receive record. Null with no `work`. */
|
|
163
|
+
readonly record: ReceiveWorkRecord | null;
|
|
164
|
+
/** True when a stored record gave the content, with no ratchet step. */
|
|
165
|
+
readonly reused: boolean;
|
|
166
|
+
readonly content: CommittedContent;
|
|
167
|
+
}
|
|
168
|
+
/** The queue has no room. Nothing is decrypted. */
|
|
169
|
+
| {
|
|
170
|
+
readonly kind: 'refused';
|
|
171
|
+
}
|
|
172
|
+
/** The record holds no content any more: the application got it. */
|
|
173
|
+
| {
|
|
174
|
+
readonly kind: 'settled';
|
|
175
|
+
readonly record: ReceiveWorkRecord;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The content failed a check after its commit. The ratchet step is spent,
|
|
179
|
+
* and no distribution installed.
|
|
180
|
+
*/
|
|
181
|
+
| ({
|
|
182
|
+
readonly kind: 'denied';
|
|
183
|
+
readonly error: Error;
|
|
184
|
+
readonly record: ReceiveWorkRecord | null;
|
|
185
|
+
} & CommittedSender);
|
|
186
|
+
/** The group decision on committed content. */
|
|
187
|
+
export type GroupContentDecision = {
|
|
188
|
+
readonly kind: 'authorized';
|
|
189
|
+
readonly groupId: string | null;
|
|
190
|
+
} | {
|
|
191
|
+
readonly kind: 'denied';
|
|
192
|
+
readonly error: GroupReceiveRefusedError;
|
|
193
|
+
} | {
|
|
194
|
+
readonly kind: 'unavailable';
|
|
195
|
+
readonly error: GroupReceiveUnavailableError;
|
|
196
|
+
/** The raw group whose state must update first. */
|
|
197
|
+
readonly groupId: string;
|
|
198
|
+
};
|
|
100
199
|
/**
|
|
101
200
|
* SignalProtocolServiceCipher - Routes encryption and decryption to appropriate ciphers
|
|
102
201
|
*
|
|
@@ -130,24 +229,61 @@ export declare class SignalProtocolServiceCipher {
|
|
|
130
229
|
private readonly fanOut;
|
|
131
230
|
private readonly lock;
|
|
132
231
|
private readonly groupSenderKeys;
|
|
232
|
+
private readonly senderKeyHandoffs;
|
|
133
233
|
private sessionCallbacks?;
|
|
134
234
|
private readonly recipientDeviceListCheckedAt;
|
|
135
235
|
private sealedSenderProvider?;
|
|
136
236
|
private sealedSenderDeliveryMode;
|
|
137
237
|
private sealedSenderIdentifiedFallback?;
|
|
238
|
+
private relayProtocolErrorReporter?;
|
|
138
239
|
private contactProfileStateStore?;
|
|
139
240
|
private endorsementManager?;
|
|
140
241
|
private endorsementManagerResolver?;
|
|
141
242
|
private endorsementRefresher?;
|
|
142
243
|
private groupSendBarrierChecker?;
|
|
143
|
-
private
|
|
244
|
+
private groupReceiveEvaluator?;
|
|
144
245
|
private groupSecretParamsProvider?;
|
|
246
|
+
private groupContextProvider?;
|
|
145
247
|
constructor(userId: string, deviceId: number, sesameManager: SesameManager, senderKeyManager: SenderKeyManager, storage: SignalProtocolLocalStore, relay?: SignalProtocolRelayServer | undefined, remoteObjectStore?: SignalProtocolRemoteObjectStore | undefined, contentAdapter?: SignalProtocolContentAdapter | undefined, logger?: Required<Logger>, fanOut?: BoundedFanOut);
|
|
146
248
|
private getResolvedContentAdapter;
|
|
147
249
|
private getDirectConversationId;
|
|
148
250
|
private buildSentSyncTranscript;
|
|
149
251
|
private encodeLosslessPlaintext;
|
|
150
252
|
private uploadSyncMessages;
|
|
253
|
+
/** A stored sync copy that names the registration of the own device's current session. */
|
|
254
|
+
private prepareStoredSyncMessage;
|
|
255
|
+
/**
|
|
256
|
+
* Post one sync copy to an own device, identified, with the registration
|
|
257
|
+
* of the device's session. When the relay refuses the device as stale, the
|
|
258
|
+
* session of the device is refreshed once, `repair.rebuild` encrypts the
|
|
259
|
+
* transcript again for the device, the new copy replaces the refused copy
|
|
260
|
+
* in the intent named by `repair.intentId`, and the new copy is posted
|
|
261
|
+
* under a repair ID. When the relay refuses the new copy as stale too, the
|
|
262
|
+
* session of the device is archived, the copy leaves the intent, and a
|
|
263
|
+
* warning is logged. The post then resolves, so the send completes without
|
|
264
|
+
* the copy.
|
|
265
|
+
*
|
|
266
|
+
* @throws {EncryptionError} SESSION_ESTABLISHMENT_FAILED when the refresh
|
|
267
|
+
* fails or the rebuild gives the device no copy. The copy stays in the
|
|
268
|
+
* intent, so a replay posts it again.
|
|
269
|
+
*/
|
|
270
|
+
private postSyncMessage;
|
|
271
|
+
/**
|
|
272
|
+
* Refresh the session of an own device that refused a sync copy as stale,
|
|
273
|
+
* encrypt the transcript again for the device, and replace the stored copy
|
|
274
|
+
* before its post. The refused ciphertext is never posted again.
|
|
275
|
+
*
|
|
276
|
+
* @throws {EncryptionError} SESSION_ESTABLISHMENT_FAILED when the refresh
|
|
277
|
+
* fails or the rebuild gives the device no copy. The stored copy stays,
|
|
278
|
+
* and the refreshed session is not archived.
|
|
279
|
+
*/
|
|
280
|
+
private repairRefusedSyncCopyInTurn;
|
|
281
|
+
/**
|
|
282
|
+
* Send one relay request of a sync copy to an own device.
|
|
283
|
+
*
|
|
284
|
+
* @returns The relay receipt of the post
|
|
285
|
+
*/
|
|
286
|
+
private postSyncCopy;
|
|
151
287
|
/**
|
|
152
288
|
* Run one relay phase of a send: a task for each device message, at the same
|
|
153
289
|
* time, under the client's relay request bound. Every device is attempted.
|
|
@@ -189,7 +325,19 @@ export declare class SignalProtocolServiceCipher {
|
|
|
189
325
|
setSealedSenderProvider(provider: SealedSenderProvider): void;
|
|
190
326
|
setSealedSenderDeliveryMode(mode: import('./config.js').SealedSenderDeliveryMode): void;
|
|
191
327
|
setSealedSenderIdentifiedFallback(callback: NonNullable<import('./config.js').SealedSenderConfig['onIdentifiedFallback']>): void;
|
|
328
|
+
/**
|
|
329
|
+
* Set the reporter of a protocol error that no send result carries.
|
|
330
|
+
* Called by SignalProtocolClient after construction. A sync payload has no
|
|
331
|
+
* send result, so the reporter gives its error to the app.
|
|
332
|
+
*/
|
|
333
|
+
setRelayProtocolErrorReporter(report: (error: RelayProtocolError) => Promise<void>): void;
|
|
192
334
|
private reportIdentifiedFallback;
|
|
335
|
+
/**
|
|
336
|
+
* Restrict the cached unidentified access mode of a recipient after the
|
|
337
|
+
* relay rejects a sealed-sender authorization. A failure to update the mode
|
|
338
|
+
* does not block delivery.
|
|
339
|
+
*/
|
|
340
|
+
private restrictUnidentifiedAccessMode;
|
|
193
341
|
private useIdentifiedDeliveryOrThrow;
|
|
194
342
|
setContactProfileStateStore(store: ContactProfileStateStore): void;
|
|
195
343
|
/**
|
|
@@ -221,22 +369,131 @@ export declare class SignalProtocolServiceCipher {
|
|
|
221
369
|
* @param provider - Async callback returning GroupSecretParams or null
|
|
222
370
|
*/
|
|
223
371
|
setGroupSecretParamsProvider(provider: (groupId: string) => Promise<import('../internal/protocol/zk/groups/group-params.js').GroupSecretParams | null>): void;
|
|
224
|
-
/**
|
|
225
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Set the provider of the group context that each new send to a managed
|
|
374
|
+
* group carries. It answers null for a group with no master key.
|
|
375
|
+
*/
|
|
376
|
+
setGroupContextProvider(provider: (groupId: string) => Promise<GroupContentContext | null>): void;
|
|
377
|
+
/** The content of a new group send, with the context of a managed group in it. */
|
|
378
|
+
private contentWithGroupContext;
|
|
379
|
+
/**
|
|
380
|
+
* Decide on received managed-group content against verified group state.
|
|
381
|
+
* Without an evaluator, managed-group content is refused.
|
|
382
|
+
*/
|
|
383
|
+
setGroupReceiveEvaluator(evaluate: GroupReceiveEvaluator): void;
|
|
226
384
|
/**
|
|
227
385
|
* Decrypt incoming envelope - routes to appropriate cipher
|
|
228
386
|
*
|
|
229
387
|
* Routes based on envelope type:
|
|
230
|
-
* -
|
|
388
|
+
* - sender_key → Group cipher (Sender Keys)
|
|
231
389
|
* - otherwise → Pairwise cipher (SESAME/Double Ratchet)
|
|
232
390
|
*
|
|
391
|
+
* The decrypt commits no receive record. It installs a distribution that
|
|
392
|
+
* the content carries, and it runs the group decision of managed-group
|
|
393
|
+
* content before it returns, as `commitEnvelope`, `decideGroupContent`,
|
|
394
|
+
* and `decryptedEnvelopeOf` tell.
|
|
395
|
+
*
|
|
233
396
|
* @param envelope - Encrypted envelope from relay
|
|
397
|
+
* @param sealedSenderConfig - The trust roots of an unidentified_sender envelope
|
|
398
|
+
* @param stopSignal - When it aborts while the decrypt waits for a lock,
|
|
399
|
+
* the decrypt throws RelayWorkStopped
|
|
234
400
|
* @returns Decrypted envelope ready for ContentManager
|
|
235
401
|
* @throws {EncryptionError} DECRYPTION_FAILED if decryption fails
|
|
402
|
+
* @throws {SealedRetryRequestReceived} for a seal that holds a retry request
|
|
236
403
|
*
|
|
237
404
|
* @see https://signal.org/docs/specifications/sesame/
|
|
238
405
|
*/
|
|
239
|
-
decrypt(envelope: Envelope, sealedSenderConfig?: import('./config.js').SealedSenderConfig,
|
|
406
|
+
decrypt(envelope: Envelope, sealedSenderConfig?: import('./config.js').SealedSenderConfig, stopSignal?: AbortSignal): Promise<DecryptedEnvelope>;
|
|
407
|
+
/**
|
|
408
|
+
* Decrypt one envelope and commit its receive record in the same store
|
|
409
|
+
* transaction as the ratchet step. Then check the content and install a
|
|
410
|
+
* distribution that it carries. The group decision does not run here.
|
|
411
|
+
*
|
|
412
|
+
* With `work`, the commit first reads the record of `work.workId`. A
|
|
413
|
+
* record that holds plaintext is a redelivery: the commit reuses the
|
|
414
|
+
* plaintext, spends no ratchet step, and installs the distribution of a
|
|
415
|
+
* Relay record again. A caller record installs nothing.
|
|
416
|
+
* A record that holds no plaintext ends `settled`. With no record, the
|
|
417
|
+
* admission of `work` runs the decrypt, so a full queue ends `refused`
|
|
418
|
+
* with nothing decrypted. A check that fails after the commit ends
|
|
419
|
+
* `denied`, because the ratchet step is spent.
|
|
420
|
+
*
|
|
421
|
+
* @throws {EncryptionError} when the decrypt fails. Nothing is committed.
|
|
422
|
+
* @throws {SealedRetryRequestReceived} for a seal that holds a retry request
|
|
423
|
+
*/
|
|
424
|
+
commitEnvelope(envelope: Envelope, options?: EnvelopeCommitOptions): Promise<EnvelopeCommit>;
|
|
425
|
+
private commitAt;
|
|
426
|
+
/** Open a sealed envelope and return the envelope that it holds. */
|
|
427
|
+
private unsealEnvelope;
|
|
428
|
+
/**
|
|
429
|
+
* Fill the sender fields of a converted legacy record from its
|
|
430
|
+
* redelivered envelope. The record keeps its age and its arrival order.
|
|
431
|
+
*/
|
|
432
|
+
private fillAwaitingEnvelope;
|
|
433
|
+
/**
|
|
434
|
+
* The checks of committed content that run before its distribution
|
|
435
|
+
* installs: the replay check, sync content from another account, and a
|
|
436
|
+
* distribution inside a sender-key message.
|
|
437
|
+
*/
|
|
438
|
+
private checkCommittedContent;
|
|
439
|
+
/**
|
|
440
|
+
* The committed content of a stored receive record, for the receive queue
|
|
441
|
+
* after the release of the record and for a helper receive. It decrypts nothing.
|
|
442
|
+
* It runs the content checks again, so a crash between a failed check and
|
|
443
|
+
* its denied record denies again.
|
|
444
|
+
*
|
|
445
|
+
* For a Relay record it installs the distribution of the content again.
|
|
446
|
+
* One Signal client puts the install in the buffered store of the ratchet step
|
|
447
|
+
* and writes both in one transaction before the acknowledgment. The local
|
|
448
|
+
* store contract commits a session
|
|
449
|
+
* with its receive record, and sender keys apart from it under the group
|
|
450
|
+
* lock, so the commit stores the record before its install, and an install
|
|
451
|
+
* can fail after the commit. A redelivery replays the install, but a pass
|
|
452
|
+
* can complete the record before the redelivery comes, and the key is then
|
|
453
|
+
* lost. A replay of an installed distribution changes nothing while its
|
|
454
|
+
* key is the current state or one of the kept previous states. When the
|
|
455
|
+
* key is neither, the replay installs it again as the current state, and
|
|
456
|
+
* when the record already holds 5 states, the oldest state goes. Test: "the
|
|
457
|
+
* subscription handler returns true only after the commit, the sender key
|
|
458
|
+
* install, and the outcome-1 write". A caller record installs nothing: its
|
|
459
|
+
* commit gives the distribution to the caller and installs no sender key.
|
|
460
|
+
* Test: "gives the content once, and the failed message is a duplicate
|
|
461
|
+
* after a restart".
|
|
462
|
+
*
|
|
463
|
+
* @param record - A record that holds plaintext and its sender. A
|
|
464
|
+
* converted legacy record waits for its envelope, and has no sender.
|
|
465
|
+
* @param stopSignal - Stops the wait for the sender key lock.
|
|
466
|
+
* @returns `committed` with the content, or `denied` when a check fails
|
|
467
|
+
*/
|
|
468
|
+
restoreCommitted(record: ReceiveWorkRecord, stopSignal?: AbortSignal): Promise<Extract<EnvelopeCommit, {
|
|
469
|
+
kind: 'committed' | 'denied';
|
|
470
|
+
}>>;
|
|
471
|
+
/**
|
|
472
|
+
* Install an authenticated distribution. A copy of an installed
|
|
473
|
+
* distribution changes nothing while its key is the current state or a
|
|
474
|
+
* kept previous state, so a replay of the install is safe. A copy of a key
|
|
475
|
+
* that is neither installs again as the current state, and when the
|
|
476
|
+
* record already holds 5 states, the oldest state goes.
|
|
477
|
+
*
|
|
478
|
+
* @returns The raw group of the distribution
|
|
479
|
+
*/
|
|
480
|
+
installDistribution(senderUserId: string, senderDeviceId: number, distribution: NonNullable<InspectedSignalProtocolContent['senderKeyDistribution']>, stopSignal?: AbortSignal): Promise<string>;
|
|
481
|
+
/**
|
|
482
|
+
* Decide on committed managed-group content against verified group state.
|
|
483
|
+
* Content that names no managed group and carries no context needs no
|
|
484
|
+
* decision.
|
|
485
|
+
*
|
|
486
|
+
* @returns `authorized` with the group of the content, or null for content
|
|
487
|
+
* of no group. `denied` with the refusal. `unavailable` with the raw
|
|
488
|
+
* group whose state must update first.
|
|
489
|
+
*/
|
|
490
|
+
decideGroupContent(content: CommittedContent): Promise<GroupContentDecision>;
|
|
491
|
+
/**
|
|
492
|
+
* The envelope that the application gets for authorized content.
|
|
493
|
+
*
|
|
494
|
+
* @param resolvedGroupId - The group of the content, from `decideGroupContent`
|
|
495
|
+
*/
|
|
496
|
+
decryptedEnvelopeOf(content: CommittedContent, resolvedGroupId: string | null): DecryptedEnvelope;
|
|
240
497
|
/**
|
|
241
498
|
* Encrypt outgoing message - routes based on recipient type
|
|
242
499
|
*
|
|
@@ -289,7 +546,12 @@ export declare class SignalProtocolServiceCipher {
|
|
|
289
546
|
* @param options - The client timestamp and the content hint of the
|
|
290
547
|
* message, and the retry request that a retry resend answers. Without a
|
|
291
548
|
* retry target, the client message ID is a new UUID and nothing is
|
|
292
|
-
* stored. The timestamp goes in the envelope
|
|
549
|
+
* stored. The timestamp goes in the envelope. With `senderKeyHandoff`,
|
|
550
|
+
* the content carries that own sender key of the raw group: each
|
|
551
|
+
* encryption keeps the key, and when the Relay accepts the bytes, the
|
|
552
|
+
* send records a handoff row of the key that they carry. A post that the
|
|
553
|
+
* Relay answers with RETRY_CONFLICT records no row, because the Relay
|
|
554
|
+
* holds an earlier encryption
|
|
293
555
|
* @param stopSignal - The stop signal of the relay work that sends. When it
|
|
294
556
|
* aborts while the send waits for the recipient's lock, the send throws
|
|
295
557
|
* RelayWorkStopped
|
|
@@ -303,10 +565,44 @@ export declare class SignalProtocolServiceCipher {
|
|
|
303
565
|
timestamp: number;
|
|
304
566
|
contentHint?: ContentHint;
|
|
305
567
|
retry?: RetryResendTarget;
|
|
568
|
+
senderKeyHandoff?: {
|
|
569
|
+
groupId: string;
|
|
570
|
+
senderKeyId: string;
|
|
571
|
+
generation: number;
|
|
572
|
+
};
|
|
306
573
|
}, stopSignal?: AbortSignal): Promise<boolean>;
|
|
307
574
|
/** Post the encrypted bytes of a resend with their operation epoch, under one client message ID. */
|
|
308
575
|
private postResend;
|
|
309
|
-
/**
|
|
576
|
+
/**
|
|
577
|
+
* The sealed authorization of one resend post, or null when the post goes
|
|
578
|
+
* identified. A stored group endorsement resolves again for the device's
|
|
579
|
+
* account, and resolves to null when the group has none for it.
|
|
580
|
+
*/
|
|
581
|
+
private resolveResendAuthorization;
|
|
582
|
+
/**
|
|
583
|
+
* The group of the group send that this client sent to the user at this
|
|
584
|
+
* client timestamp, if any. A retry request names the failed message by
|
|
585
|
+
* its timestamp, and the pre-messages of a group send have the timestamp
|
|
586
|
+
* of the send. The members of a send name only its recipients. They are
|
|
587
|
+
* never a source of current membership.
|
|
588
|
+
*/
|
|
589
|
+
findSentGroupId(recipientUserId: string, clientTimestamp: number): Promise<string | undefined>;
|
|
590
|
+
/**
|
|
591
|
+
* The current sender-key distribution of this device for a group, at the
|
|
592
|
+
* current chain index, or null when the device has no sender key for the
|
|
593
|
+
* group. It is read in the group operation, so no send or rotation of the
|
|
594
|
+
* group runs at the same time.
|
|
595
|
+
*/
|
|
596
|
+
currentGroupDistribution(groupId: string, stopSignal?: AbortSignal): Promise<{
|
|
597
|
+
groupId: string;
|
|
598
|
+
distribution: SenderKeyDistributionMessage;
|
|
599
|
+
} | null>;
|
|
600
|
+
/**
|
|
601
|
+
* Encrypt one attempt of a resend, with the current time as its operation
|
|
602
|
+
* epoch. The resend of a group send's message takes the sealed
|
|
603
|
+
* authorization of a pre-message: the recipient's access key first, then
|
|
604
|
+
* the group endorsement of the recipient's account.
|
|
605
|
+
*/
|
|
310
606
|
private encryptResend;
|
|
311
607
|
/**
|
|
312
608
|
* Encrypt and upload attachment data without sending a standalone message.
|
|
@@ -318,6 +614,21 @@ export declare class SignalProtocolServiceCipher {
|
|
|
318
614
|
* Convert Envelope to SesameMessage for SESAME receive path
|
|
319
615
|
*/
|
|
320
616
|
private toSesameMessage;
|
|
617
|
+
/**
|
|
618
|
+
* Archive the session with one device, for the session reset of a retry
|
|
619
|
+
* request that ended as `expired-content`.
|
|
620
|
+
*
|
|
621
|
+
* The archive takes the decrypt lock of the device first, so each decrypt
|
|
622
|
+
* from the device in progress ends before it, and a decrypt that starts
|
|
623
|
+
* later reads the archived state. Under the device locks of the session
|
|
624
|
+
* manager, it then archives the session in the protocol store and in the
|
|
625
|
+
* device record. The next send to the user reads its device list again
|
|
626
|
+
* and starts a new session with the device.
|
|
627
|
+
*
|
|
628
|
+
* @param stopSignal - When it aborts while the archive waits for the
|
|
629
|
+
* decrypt lock, nothing is archived and the call throws RelayWorkStopped
|
|
630
|
+
*/
|
|
631
|
+
archiveDeviceSession(userId: string, deviceId: number, stopSignal?: AbortSignal): Promise<void>;
|
|
321
632
|
/**
|
|
322
633
|
* Decrypt a pairwise message via SESAME
|
|
323
634
|
*
|
|
@@ -325,15 +636,27 @@ export declare class SignalProtocolServiceCipher {
|
|
|
325
636
|
*
|
|
326
637
|
* @throws {EncryptionError} DECRYPTION_FAILED if decryption fails
|
|
327
638
|
*/
|
|
328
|
-
decryptPairwise(sesameMessage: SesameMessage,
|
|
639
|
+
decryptPairwise(sesameMessage: SesameMessage, seed?: ReceiveWorkSeed): Promise<string>;
|
|
640
|
+
/**
|
|
641
|
+
* Resolve the group of a framed SenderKeyMessage from the distribution
|
|
642
|
+
* identifier inside the frame.
|
|
643
|
+
*
|
|
644
|
+
* @throws {EncryptionError} SESSION_NOT_FOUND when no stored sender key
|
|
645
|
+
* claims the identifier
|
|
646
|
+
*/
|
|
647
|
+
private resolveFramedGroup;
|
|
329
648
|
/**
|
|
330
649
|
* Decrypt a group message via Sender Keys.
|
|
331
650
|
*
|
|
332
651
|
* The envelope names no group, so the group is resolved from the opaque
|
|
333
652
|
* distribution identifier inside the frame and returned alongside the
|
|
334
653
|
* plaintext. Callers need it for the conversation ID and cannot read it off
|
|
335
|
-
* the envelope.
|
|
654
|
+
* the envelope. The admission runs inside the group lock, so it sees the
|
|
655
|
+
* group before the decrypt.
|
|
336
656
|
*
|
|
657
|
+
* @param seed - Builds the receive record that commits with the ratchet step
|
|
658
|
+
* @param admit - Runs the decrypt under the receive admission
|
|
659
|
+
* @returns Null when the admission refuses the decrypt
|
|
337
660
|
* @throws {EncryptionError} DECRYPTION_FAILED if decryption fails
|
|
338
661
|
*/
|
|
339
662
|
private decryptGroup;
|
|
@@ -349,6 +672,11 @@ export declare class SignalProtocolServiceCipher {
|
|
|
349
672
|
* without a relay read. The relay gives no device-set version, so the window
|
|
350
673
|
* is the only bound on how long a linked or removed device goes unseen.
|
|
351
674
|
*
|
|
675
|
+
* A relay that compares device sets refuses a declared post that misses a
|
|
676
|
+
* device or names a removed one, so on such a relay a recipient with an
|
|
677
|
+
* active session is sent to without a relay read at any age. Only a
|
|
678
|
+
* recipient with no session has its list read.
|
|
679
|
+
*
|
|
352
680
|
* A direct send may post before the read when the relay refuses every post
|
|
353
681
|
* to a removed device's mailbox, this client read the list in this process,
|
|
354
682
|
* and that read is younger than
|
|
@@ -380,6 +708,35 @@ export declare class SignalProtocolServiceCipher {
|
|
|
380
708
|
* failed and the known devices still receive
|
|
381
709
|
*/
|
|
382
710
|
private readRecipientDeviceList;
|
|
711
|
+
/**
|
|
712
|
+
* Read the sender's own device list.
|
|
713
|
+
*
|
|
714
|
+
* A listed own device with no session gets one first, and each own device
|
|
715
|
+
* record that the list does not show is removed. With no relay there is no
|
|
716
|
+
* list and no sync copy.
|
|
717
|
+
*
|
|
718
|
+
* On a relay that compares device sets, a send declares the own devices
|
|
719
|
+
* that it holds records for, and reads no own list before its recipient
|
|
720
|
+
* post. A 409 or a declared 410 answer to a sync post repairs the own
|
|
721
|
+
* records, as Signal learns of a new or removed own device. A declared
|
|
722
|
+
* direct send reads the own list only when a recipient receipt sets
|
|
723
|
+
* `needsSync` and the send holds no own device record, and a failed read
|
|
724
|
+
* leaves the sync phase pending without failing the send. On a relay that
|
|
725
|
+
* does not compare, each send reads the own list before its recipient
|
|
726
|
+
* post, and a failed read fails the send.
|
|
727
|
+
*
|
|
728
|
+
* @returns The listed own devices other than this device, in list order
|
|
729
|
+
*/
|
|
730
|
+
private readOwnDeviceList;
|
|
731
|
+
/**
|
|
732
|
+
* Remove each device record that the device list does not name, and
|
|
733
|
+
* relist each removed record that it names again. A record that is already
|
|
734
|
+
* removed and still unlisted stays as it is, so a second sweep writes no
|
|
735
|
+
* archive and emits no event.
|
|
736
|
+
*
|
|
737
|
+
* @returns The devices that this sweep removed
|
|
738
|
+
*/
|
|
739
|
+
private reconcileDeviceRecords;
|
|
383
740
|
/**
|
|
384
741
|
* Encrypt to a single user (all their devices) via SESAME
|
|
385
742
|
*/
|
|
@@ -409,16 +766,29 @@ export declare class SignalProtocolServiceCipher {
|
|
|
409
766
|
* timestamp, so each device receives the same message.
|
|
410
767
|
*/
|
|
411
768
|
private reconcileDirectIntent;
|
|
769
|
+
/**
|
|
770
|
+
* Apply a read of the sender's own device list to a direct intent on
|
|
771
|
+
* replay: drop the sync copy of each own device that the list does not
|
|
772
|
+
* show, and add a sent transcript of the caller's content for each listed
|
|
773
|
+
* own device that the intent does not address.
|
|
774
|
+
*/
|
|
775
|
+
private reconcileDirectSyncDevices;
|
|
776
|
+
/**
|
|
777
|
+
* A sent transcript of a stored direct send for each own device in
|
|
778
|
+
* `deviceIds` that has a session.
|
|
779
|
+
*/
|
|
780
|
+
private prepareDirectSyncMessages;
|
|
412
781
|
/** The sealed-sender context of a new transmission for a stored direct intent. */
|
|
413
782
|
private resolveStoredDirectSealedSender;
|
|
414
783
|
private prepareStoredDirectDeviceMessage;
|
|
415
784
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
* before it fails.
|
|
785
|
+
* Run the session repair of one recipient in turn. The device posts of a
|
|
786
|
+
* send run at the same time, so the repairs for one recipient take turns:
|
|
787
|
+
* the first session commit with a user pins the user's contact identity,
|
|
788
|
+
* and a concurrent commit that read the store before it fails.
|
|
421
789
|
*/
|
|
790
|
+
private inRepairTurn;
|
|
791
|
+
/** Refresh the session of a rejected device and replace its transmission. */
|
|
422
792
|
private repairRejectedDirectDeviceMessage;
|
|
423
793
|
private repairRejectedDirectDeviceMessageInTurn;
|
|
424
794
|
private sendStoredDirectDeviceMessage;
|
|
@@ -430,8 +800,271 @@ export declare class SignalProtocolServiceCipher {
|
|
|
430
800
|
* its result or its refusal.
|
|
431
801
|
*/
|
|
432
802
|
private sendStoredDirectIntent;
|
|
803
|
+
/** True when the relay compares declared device sets, so each send declares them. */
|
|
804
|
+
private declaresDeviceSets;
|
|
805
|
+
/**
|
|
806
|
+
* The own devices other than this device that have a local device record
|
|
807
|
+
* not marked removed.
|
|
808
|
+
*/
|
|
809
|
+
private localOwnDevices;
|
|
810
|
+
/**
|
|
811
|
+
* Run one declared phase of a send until the relay accepts every post.
|
|
812
|
+
*
|
|
813
|
+
* Each pass posts every message of the phase, and each post declares every
|
|
814
|
+
* device of its account that the phase addresses. A device that an earlier
|
|
815
|
+
* pass posted gets its stored bytes again. After a refusal, the repair
|
|
816
|
+
* archives and removes each extra device, refreshes the session of each
|
|
817
|
+
* stale device, starts a session with each missing device, and encrypts the
|
|
818
|
+
* message again only for each refreshed or added device. A listed device
|
|
819
|
+
* with no prekey bundle gets no message, so the next pass declares the
|
|
820
|
+
* account without it and the relay refuses the account again. The repair
|
|
821
|
+
* write stores each such device in the intent, so a replay after a restart
|
|
822
|
+
* or a stop starts a session with it before its first post.
|
|
823
|
+
*
|
|
824
|
+
* An account whose stored devices all lack a bundle has no post, so the
|
|
825
|
+
* pass refuses it here. For such an account, a bundle fetch that answers
|
|
826
|
+
* NOT_FOUND removes the device record. Each other device that the record
|
|
827
|
+
* still holds gets a message in the same repair when it has a session or a
|
|
828
|
+
* bundle. An account left with no device record gets one list read.
|
|
829
|
+
*
|
|
830
|
+
* @returns The answers of the last pass and the messages that it posted
|
|
831
|
+
* @throws {DeviceSetReconciliationError} when the phase ends unresolved
|
|
832
|
+
*/
|
|
833
|
+
private runDeclaredPhase;
|
|
834
|
+
/**
|
|
835
|
+
* Repair the devices of one account that a refusal names. The caller runs
|
|
836
|
+
* it in the repair turn of the account. An extra device loses its session,
|
|
837
|
+
* its handoff rows, and its record. A stale device gets a new session,
|
|
838
|
+
* unless its current session already has a registration other than the
|
|
839
|
+
* one that the refused post named. A missing device gets a session.
|
|
840
|
+
*
|
|
841
|
+
* Only a listed device with no prekey bundle is bundle-missing, and the
|
|
842
|
+
* loop waits for it. Any other failure to start a session, such as an
|
|
843
|
+
* identity that the store does not trust, ends the send with its error.
|
|
844
|
+
*
|
|
845
|
+
* An unposted account is one that the pass refused here, because each of
|
|
846
|
+
* its stored devices lacked a bundle. The Relay answers NOT_FOUND for the
|
|
847
|
+
* bundle of a device that it does not register, and for a registered
|
|
848
|
+
* device that has no uploaded prekeys. Thus such a device of an unposted
|
|
849
|
+
* account loses its record and leaves the send. The repair then starts a
|
|
850
|
+
* session with each other device that the account record still holds. A
|
|
851
|
+
* device that has a session already counts as started, so it gets a
|
|
852
|
+
* message in the same repair turn. When the account holds no device
|
|
853
|
+
* record, the repair reads its device list once and starts a session with
|
|
854
|
+
* each listed device. A device with no bundle is bundle-missing again, and
|
|
855
|
+
* the restart bound stops the loop.
|
|
856
|
+
*
|
|
857
|
+
* @returns The devices that leave the send, the refreshed or added devices
|
|
858
|
+
* that have a current session, and the devices that got no session
|
|
859
|
+
* @throws The first error of a session start that failed for a reason other
|
|
860
|
+
* than a missing prekey bundle
|
|
861
|
+
*/
|
|
862
|
+
private repairRefusedDevices;
|
|
863
|
+
/**
|
|
864
|
+
* Mark a send result whose relay accepted a declared post without the
|
|
865
|
+
* `deviceSetChecked` mark. The send is delivered, and a second post could
|
|
866
|
+
* deliver it twice, so the result does not change. The client reports the
|
|
867
|
+
* error once through `onRelayProtocolError`.
|
|
868
|
+
*/
|
|
869
|
+
private markUncheckedDeclaredPosts;
|
|
870
|
+
/**
|
|
871
|
+
* The protocol error of declared posts that the relay accepted without the
|
|
872
|
+
* `deviceSetChecked` mark. The client logs one warning for it.
|
|
873
|
+
*/
|
|
874
|
+
private uncheckedDeclaredPostError;
|
|
875
|
+
/**
|
|
876
|
+
* Replay a stored direct send on a relay that compares device sets. A
|
|
877
|
+
* terminal send starts a new run at 0 restarts. A completed send with a
|
|
878
|
+
* pending sync phase posts only its sync messages. It first reads the own
|
|
879
|
+
* device list when the send could not read it: the phase has no sync
|
|
880
|
+
* message and stores no own device with no bundle. A stored device with no
|
|
881
|
+
* bundle goes through the sync phase, which refuses it as missing and
|
|
882
|
+
* retries it as the live run does. A send that is not terminal resumes
|
|
883
|
+
* with its stored restart counts.
|
|
884
|
+
*/
|
|
885
|
+
private replayDeclaredDirectIntent;
|
|
886
|
+
/**
|
|
887
|
+
* Add the sync copies of a direct intent from one read of the own device
|
|
888
|
+
* list. A failed read is logged and does not fail the send.
|
|
889
|
+
*
|
|
890
|
+
* @returns The intent, and true when the read failed
|
|
891
|
+
*/
|
|
892
|
+
private addDeclaredDirectSync;
|
|
893
|
+
/**
|
|
894
|
+
* Post a stored direct intent on a relay that compares device sets: the
|
|
895
|
+
* recipient phase first, then the sync phase (§5.4, §5.6). The recipient
|
|
896
|
+
* result is stored before the sync phase starts. A failed sync phase gives
|
|
897
|
+
* `syncPending` and does not fail the send, and the intent keeps the sync
|
|
898
|
+
* messages for a replay.
|
|
899
|
+
*/
|
|
900
|
+
private sendDeclaredDirectIntent;
|
|
901
|
+
/** Encrypt the sync copy of a direct intent again for one own device. */
|
|
902
|
+
private directSyncEncrypt;
|
|
903
|
+
/**
|
|
904
|
+
* Run the declared sync phase of a completed intent. The phase has its own
|
|
905
|
+
* restart count. A failure or an unresolved end is logged and leaves the
|
|
906
|
+
* phase pending. The outcome keeps the receipt of each accepted sync post,
|
|
907
|
+
* also when the phase fails, so the send reports a receipt without the
|
|
908
|
+
* `deviceSetChecked` mark.
|
|
909
|
+
*/
|
|
910
|
+
private finishDeclaredSync;
|
|
911
|
+
/**
|
|
912
|
+
* Post a sync payload to the own devices that this device holds records
|
|
913
|
+
* for, on a relay that compares device sets. The posts share one operation
|
|
914
|
+
* ID, so a restart posts the stored bytes of an accepted device again
|
|
915
|
+
* under the same ID. With no own device record, nothing is posted. A sync
|
|
916
|
+
* payload has no send result, so the reporter gives the protocol error of
|
|
917
|
+
* an accepted post without the `deviceSetChecked` mark to the app.
|
|
918
|
+
*
|
|
919
|
+
* @throws {DeviceSetReconciliationError} when the phase ends unresolved
|
|
920
|
+
*/
|
|
921
|
+
private sendDeclaredSyncPayload;
|
|
433
922
|
private encryptToGroupWithOutbox;
|
|
923
|
+
/**
|
|
924
|
+
* The declared work of a group send on a relay that compares device sets
|
|
925
|
+
* (§5.5 of the device-set contract).
|
|
926
|
+
*/
|
|
927
|
+
private groupDeviceSetContext;
|
|
928
|
+
/**
|
|
929
|
+
* The devices of the group members on a relay that compares device sets.
|
|
930
|
+
* Each member with a local device record gives the devices of that record,
|
|
931
|
+
* and the sender device is left out. Only another member with no record
|
|
932
|
+
* has its device list read (§5.2 of the device-set contract).
|
|
933
|
+
*/
|
|
934
|
+
private localGroupMemberDevices;
|
|
434
935
|
private prepareStoredGroupDeviceMessage;
|
|
936
|
+
/** A copy of a stored device message with the sealed transport of its ciphertext. */
|
|
937
|
+
private sealStoredDeviceMessage;
|
|
938
|
+
/**
|
|
939
|
+
* The sealed-sender context of a sender-key pre-message. A pre-message goes
|
|
940
|
+
* to one recipient, so the recipient's access key comes first, and the
|
|
941
|
+
* group endorsement serves a member with no access key. Resolves to null
|
|
942
|
+
* when the pre-message goes identified, and throws SEALED_SENDER_REQUIRED
|
|
943
|
+
* in required mode when neither authorization resolves.
|
|
944
|
+
*/
|
|
945
|
+
private resolveDistributionSealedSender;
|
|
946
|
+
/**
|
|
947
|
+
* The transport of one stored pre-message for this dispatch. The
|
|
948
|
+
* authorization resolves again at each dispatch, so a required send checks
|
|
949
|
+
* its privacy before any post. A pre-message that has no sealed transport
|
|
950
|
+
* is sealed from its stored ciphertext, with no new ratchet effect.
|
|
951
|
+
*/
|
|
952
|
+
private authorizePreMessage;
|
|
953
|
+
/**
|
|
954
|
+
* Post one pre-message once, sealed when its transport has an
|
|
955
|
+
* authorization. The relay can reject an access key that the client
|
|
956
|
+
* guessed, for a recipient whose access mode it never learned. The
|
|
957
|
+
* rejection restricts the cached mode, and the post goes again with the
|
|
958
|
+
* group endorsement. A preferred post goes identified only when no sealed
|
|
959
|
+
* authorization is accepted. A required post fails then.
|
|
960
|
+
*/
|
|
961
|
+
private sendPreMessage;
|
|
962
|
+
/**
|
|
963
|
+
* The group endorsement of one pre-message recipient, or null when the
|
|
964
|
+
* group has none for the recipient.
|
|
965
|
+
*/
|
|
966
|
+
private resolveDistributionEndorsement;
|
|
967
|
+
/** One relay post of a stored pre-message, sealed when `auth` is given. */
|
|
968
|
+
private postStoredPreMessage;
|
|
969
|
+
/**
|
|
970
|
+
* Post one pre-message, and repair its session once if the device refuses
|
|
971
|
+
* it conclusively. A NOT_FOUND refusal of a device that the recipient's
|
|
972
|
+
* device list no longer shows drops the pre-message, as a direct send
|
|
973
|
+
* drops a removed device. A replay whose sender key rotated since the send
|
|
974
|
+
* refreshes the session and drops the pre-message, because it has no
|
|
975
|
+
* distribution of the key of the send. Resolves to the pre-message that the
|
|
976
|
+
* relay accepted or that the send dropped, with the outcome.
|
|
977
|
+
*/
|
|
978
|
+
private postPreMessage;
|
|
979
|
+
/**
|
|
980
|
+
* Delete the sender-key handoff rows of one device in one group, so the
|
|
981
|
+
* next send gives the current key to that device. True when a row was
|
|
982
|
+
* deleted. The caller runs it in the sender-key turn of the group.
|
|
983
|
+
*/
|
|
984
|
+
invalidateSenderKeyHandoff(groupId: string, device: SenderKeyHandoffDevice): Promise<boolean>;
|
|
985
|
+
/**
|
|
986
|
+
* Delete the sender-key handoff rows of every device of one account in
|
|
987
|
+
* every group. True when a row was deleted.
|
|
988
|
+
*/
|
|
989
|
+
invalidateAccountSenderKeyHandoffs(userId: string): Promise<boolean>;
|
|
990
|
+
/**
|
|
991
|
+
* Delete the sender-key handoff rows that no current own key covers: every
|
|
992
|
+
* row of a group with no own sender key, and each row whose senderKeyId is
|
|
993
|
+
* not the current one. Each group runs in its own sender-key turn.
|
|
994
|
+
*
|
|
995
|
+
* @returns The count of deleted rows.
|
|
996
|
+
*/
|
|
997
|
+
sweepSenderKeyHandoffs(): Promise<number>;
|
|
998
|
+
/**
|
|
999
|
+
* Record the handoff row of a pre-message that the Relay accepted. A
|
|
1000
|
+
* pre-message with no handoff key or no registration ID, as an intent from
|
|
1001
|
+
* an earlier SDK version stores it, records no row, so the next send gives
|
|
1002
|
+
* the key again.
|
|
1003
|
+
*/
|
|
1004
|
+
private recordSenderKeyHandoff;
|
|
1005
|
+
/**
|
|
1006
|
+
* True when the relay refused this pre-message with NOT_FOUND and the
|
|
1007
|
+
* recipient's device list no longer shows the device. A device that the
|
|
1008
|
+
* list still shows keeps the refusal as a failure.
|
|
1009
|
+
*/
|
|
1010
|
+
private isRemovedDeviceRefusal;
|
|
1011
|
+
/**
|
|
1012
|
+
* Refresh the session of a device that refused a pre-message, encrypt the
|
|
1013
|
+
* distribution again, and replace the stored pre-message before its post.
|
|
1014
|
+
* The saved refused ciphertext is never posted again. Resolves to
|
|
1015
|
+
* undefined when a replay has no distribution of the key of the send.
|
|
1016
|
+
*/
|
|
1017
|
+
private repairRejectedPreMessageInTurn;
|
|
1018
|
+
/**
|
|
1019
|
+
* The distribution of a replayed send. The attempt that prepared the send
|
|
1020
|
+
* kept its distribution in memory only, because the outbox is not
|
|
1021
|
+
* encrypted and must hold no chain key. A replay rebuilds the distribution
|
|
1022
|
+
* from the current sender key. Its chain index is past the group message
|
|
1023
|
+
* of the send, so a device that installs it decrypts the later group
|
|
1024
|
+
* messages of the sender, but not this one. Resolves to undefined when the
|
|
1025
|
+
* current sender key is not the key of the send: a rotation since the
|
|
1026
|
+
* send deleted the handoff rows of the group, and the next send gives the
|
|
1027
|
+
* current key to each device.
|
|
1028
|
+
*/
|
|
1029
|
+
private currentDistribution;
|
|
1030
|
+
/**
|
|
1031
|
+
* The sender-key pre-messages that give the key of a stored group send to
|
|
1032
|
+
* the listed devices of other members that need it. The attempt that
|
|
1033
|
+
* prepared the send gives the distribution at the chain index of its group
|
|
1034
|
+
* message. A replay gives the current distribution when the current key is
|
|
1035
|
+
* still the key of the send. When the key rotated, a replay gives no
|
|
1036
|
+
* pre-message. The added devices recover through a retry request, and the
|
|
1037
|
+
* next send gives them the current key. `listed` holds only the devices
|
|
1038
|
+
* that can get a pre-message, as `GroupOutboxContext.prepareSenderKeyHandoffs`
|
|
1039
|
+
* states. A device that a stored pre-message of the intent targets gets no
|
|
1040
|
+
* second one. Each pre-message gets a new transport identity.
|
|
1041
|
+
*/
|
|
1042
|
+
private prepareIntentSenderKeyHandoffs;
|
|
1043
|
+
/**
|
|
1044
|
+
* Repair a group device post that the Relay refused as a stale device. When
|
|
1045
|
+
* the session still has the refused registration, the repair refreshes the
|
|
1046
|
+
* session, and the archive deletes the handoff rows of the device. When an
|
|
1047
|
+
* earlier repair of this attempt already refreshed it, the session stays.
|
|
1048
|
+
* Then the device gets the key of the send when it has no row, and a new
|
|
1049
|
+
* device message with the registration of the current session.
|
|
1050
|
+
*/
|
|
1051
|
+
private repairStaleGroupDevice;
|
|
1052
|
+
/** The plaintext bytes of a sender-key distribution pre-message. */
|
|
1053
|
+
private serializeSenderKeyDistribution;
|
|
1054
|
+
/**
|
|
1055
|
+
* Refresh the group's endorsements when the cache lacks one of the
|
|
1056
|
+
* recipients or expires soon. Resolves to the endorsement manager, or to
|
|
1057
|
+
* null when the client has none.
|
|
1058
|
+
*/
|
|
1059
|
+
private refreshGroupSendEndorsements;
|
|
1060
|
+
/**
|
|
1061
|
+
* Refresh the endorsements of a send's pre-messages before their
|
|
1062
|
+
* authorization resolves. A membership change clears the endorsements, and
|
|
1063
|
+
* a pre-message to a member with no access key needs one to stay sealed.
|
|
1064
|
+
* The refresh takes every recipient at once, so the group message reuses
|
|
1065
|
+
* it. It runs only when the send can seal a post with an endorsement.
|
|
1066
|
+
*/
|
|
1067
|
+
private refreshPreMessageEndorsements;
|
|
435
1068
|
private resolveGroupSendAuthorization;
|
|
436
1069
|
private serializeDirectSealedSenderMessage;
|
|
437
1070
|
/**
|
|
@@ -470,6 +1103,31 @@ export declare class SignalProtocolServiceCipher {
|
|
|
470
1103
|
* group send endorsement.
|
|
471
1104
|
*/
|
|
472
1105
|
sealReceipt(recipientUserId: string, recipientDeviceId: number, ciphertextBase64: string): Promise<SealedReceipt | undefined>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Seal a retry request for anonymous delivery. The seal holds the payload
|
|
1108
|
+
* of the identified envelope as `PLAINTEXT_CONTENT`, and the certificate in
|
|
1109
|
+
* the seal names the requester. A retry request follows the sealed sender
|
|
1110
|
+
* delivery mode, as a receipt does. Resolves to undefined when the request
|
|
1111
|
+
* goes identified: sealed sender is disabled, or it is preferred and the
|
|
1112
|
+
* relay has no anonymous delivery or this client knows no access key of
|
|
1113
|
+
* the recipient. In `'required'` mode a request that cannot be sealed
|
|
1114
|
+
* throws `SEALED_SENDER_REQUIRED`, and the sealed request permits no
|
|
1115
|
+
* identified fallback. A retry request never uses a group send
|
|
1116
|
+
* endorsement.
|
|
1117
|
+
*/
|
|
1118
|
+
sealRetryRequest(recipientUserId: string, recipientDeviceId: number, payloadBase64: string): Promise<SealedReceipt | undefined>;
|
|
1119
|
+
/**
|
|
1120
|
+
* The registration ID of the current session with one device. A receipt
|
|
1121
|
+
* and a retry request name it, in the sealed body and on the identified
|
|
1122
|
+
* envelope, so the Relay refuses the post to a reinstalled device.
|
|
1123
|
+
* Undefined when this client has no session with the device.
|
|
1124
|
+
*/
|
|
1125
|
+
recipientRegistrationId(userId: string, deviceId: number): Promise<number | undefined>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Seal one direct control envelope under the access key of its recipient.
|
|
1128
|
+
* The body names the registration of the current session with the device.
|
|
1129
|
+
*/
|
|
1130
|
+
private sealWithAccessKey;
|
|
473
1131
|
/**
|
|
474
1132
|
* Send a single ciphertext to a device, optionally wrapping with sealed sender.
|
|
475
1133
|
*
|
|
@@ -499,6 +1157,55 @@ export declare class SignalProtocolServiceCipher {
|
|
|
499
1157
|
*/
|
|
500
1158
|
private resolveGroupMemberDevices;
|
|
501
1159
|
private prepareGroupSenderKeyPayload;
|
|
1160
|
+
/**
|
|
1161
|
+
* Read the current distribution of the own sender key, then encrypt the
|
|
1162
|
+
* group message with that key. The distribution is at the chain index of
|
|
1163
|
+
* the message.
|
|
1164
|
+
*/
|
|
1165
|
+
private encryptWithCurrentDistribution;
|
|
1166
|
+
/**
|
|
1167
|
+
* The sender-key pre-messages of a send: one distribution pre-message for
|
|
1168
|
+
* each listed device of another member that has no handoff row for the
|
|
1169
|
+
* current key and the current session with the device. A device with no
|
|
1170
|
+
* session gets one first, and the freshness window of the device list
|
|
1171
|
+
* does not apply to it. The sender's own devices are never targets: they
|
|
1172
|
+
* get the transcript.
|
|
1173
|
+
*
|
|
1174
|
+
* Each recipient has a session and a resolved privacy policy before the
|
|
1175
|
+
* first distribution encryption, so a required send that cannot seal a
|
|
1176
|
+
* pre-message makes no peer ratchet effect.
|
|
1177
|
+
*
|
|
1178
|
+
* A device that cannot take the distribution is skipped, and the next send
|
|
1179
|
+
* tries it again, because it has no row. Only the listed devices count for
|
|
1180
|
+
* the failure rule. The send fails for a member when each listed device of
|
|
1181
|
+
* the member that needs the key fails, and no other listed device of the
|
|
1182
|
+
* member has the key. A listed device has the key when it has a row, or
|
|
1183
|
+
* when a `pending` pre-message targets it, so such a device is not a
|
|
1184
|
+
* target. `GroupOutboxContext.prepareSenderKeyHandoffs` states the same
|
|
1185
|
+
* rule.
|
|
1186
|
+
*/
|
|
1187
|
+
private prepareSenderKeyHandoffMessages;
|
|
1188
|
+
/**
|
|
1189
|
+
* Each member device with the registration ID of its current session. A
|
|
1190
|
+
* device whose record is marked removed has none, so it needs the key and
|
|
1191
|
+
* the session step reads its device list again, which relists it.
|
|
1192
|
+
*/
|
|
1193
|
+
private senderKeyHandoffTargets;
|
|
1194
|
+
/**
|
|
1195
|
+
* Give a session to each device of one member that needs the sender key
|
|
1196
|
+
* and has none. The freshness window of the device list does not apply.
|
|
1197
|
+
* The list is the one that this send read.
|
|
1198
|
+
*/
|
|
1199
|
+
private ensureSenderKeyHandoffSessions;
|
|
1200
|
+
/**
|
|
1201
|
+
* Encrypt the distribution for each device of one member that needs it.
|
|
1202
|
+
* Each pre-message carries the registration ID of the session that
|
|
1203
|
+
* encrypted it and the key that it gives, for the handoff row.
|
|
1204
|
+
*
|
|
1205
|
+
* @param handedOff - The count of listed devices of the member that have a
|
|
1206
|
+
* row or that a pending pre-message targets
|
|
1207
|
+
*/
|
|
1208
|
+
private prepareUserSenderKeyHandoffs;
|
|
502
1209
|
/**
|
|
503
1210
|
* Encrypt to a group via Sender Keys (O(1) encryption)
|
|
504
1211
|
*
|