@open-e2ee/signal-protocol-sdk 10.1.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 +1413 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/TROUBLESHOOTING.md +1 -1
- package/client/README.md +84 -37
- package/device/README.md +39 -85
- package/dist/client/client.d.ts +342 -62
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +1195 -179
- 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 +308 -6
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +9 -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-device-standing.d.ts +52 -0
- package/dist/client/hosted-device-standing.d.ts.map +1 -0
- package/dist/client/hosted-device-standing.js +74 -0
- package/dist/client/hosted-device-standing.js.map +1 -0
- package/dist/client/hosted-mailbox-subscription.d.ts +48 -3
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +288 -74
- 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 +167 -69
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted.d.ts +22 -5
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +122 -45
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +6 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -1
- 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 +118 -17
- package/dist/client/messages.js.map +1 -1
- package/dist/client/one-time-prekey-refill.d.ts +7 -0
- package/dist/client/one-time-prekey-refill.d.ts.map +1 -1
- package/dist/client/one-time-prekey-refill.js +5 -1
- package/dist/client/one-time-prekey-refill.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 +30 -0
- package/dist/client/relay-acceptance.d.ts.map +1 -1
- package/dist/client/relay-acceptance.js +55 -0
- 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 +220 -150
- 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 +68 -19
- package/dist/client/retry-family.d.ts.map +1 -1
- package/dist/client/retry-family.js +59 -17
- package/dist/client/retry-family.js.map +1 -1
- package/dist/client/retry-request-envelope.d.ts +145 -18
- package/dist/client/retry-request-envelope.d.ts.map +1 -1
- package/dist/client/retry-request-envelope.js +301 -64
- package/dist/client/retry-request-envelope.js.map +1 -1
- package/dist/client/retry-request-lifecycle.d.ts +157 -0
- package/dist/client/retry-request-lifecycle.d.ts.map +1 -0
- package/dist/client/retry-request-lifecycle.js +437 -0
- package/dist/client/retry-request-lifecycle.js.map +1 -0
- 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 +106 -18
- package/dist/client/retry.d.ts.map +1 -1
- package/dist/client/retry.js +687 -139
- 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 +2265 -343
- 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 +411 -14
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +532 -58
- 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 +104 -110
- 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/dist/utils/retry.d.ts +2 -0
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +7 -0
- package/dist/utils/retry.js.map +1 -1
- 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 +235 -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
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wire form of a retry request.
|
|
3
3
|
*
|
|
4
|
-
* A retry request
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* A retry request is a mailbox envelope with `messageType: 'retry_request'`.
|
|
5
|
+
* The envelope sender is the requester, so the payload never carries it.
|
|
6
|
+
* The `ciphertext` field holds canonical base64 of a small UTF-8 JSON
|
|
7
|
+
* payload. The payload is not ratchet-encrypted. It holds only what the
|
|
8
|
+
* requester knows about the failed message.
|
|
9
|
+
*
|
|
10
|
+
* The request record stores the identified form of the envelope.
|
|
11
|
+
* `retryRequestPost` seals it at each post when an access key of the target
|
|
12
|
+
* permits it: the seal holds the same payload as `PLAINTEXT_CONTENT`, and
|
|
13
|
+
* the sender certificate in the seal names the requester. Otherwise the
|
|
14
|
+
* post is identified, and the relay stamps the requester, only when the
|
|
15
|
+
* sealed sender delivery mode permits it.
|
|
9
16
|
*
|
|
10
17
|
* The requester keeps one request record for each failed envelope. The record
|
|
11
18
|
* holds a random retry ID, and every wire ID of the request family derives from
|
|
@@ -13,20 +20,32 @@
|
|
|
13
20
|
* `:<n>` from attempt 2. The resend and the null message carry the attempt
|
|
14
21
|
* number of the request that they answer. The failed envelope ID travels
|
|
15
22
|
* only in the payload.
|
|
16
|
-
* The requester stores each request envelope before the post
|
|
17
|
-
*
|
|
23
|
+
* The requester stores each request envelope before the post. After a post
|
|
24
|
+
* that fails with a retryable class, the retry request scheduler posts the
|
|
25
|
+
* stored envelope again, until the deadline of the record.
|
|
26
|
+
*
|
|
27
|
+
* A relay can assign its own envelope ID. The payload then also carries the
|
|
28
|
+
* client message ID of the failed envelope, the ID that the sender chose. A
|
|
29
|
+
* request without a ratchet key names a failed sender-key message.
|
|
18
30
|
*/
|
|
31
|
+
import { SealedSenderAuthError } from '../types/errors.js';
|
|
19
32
|
import { RetryReason } from '../internal/sesame/types.js';
|
|
20
33
|
import { base64ToBytes, bytesToBase64, generateUuidV4, stringToBytes } from '../internal/crypto/index.js';
|
|
21
34
|
import { utf8Decode } from '../internal/platform/index.js';
|
|
22
|
-
import { isRetryId, retryAttemptClientMessageId, retryRequestClientMessageId, storeRetryRequest, } from '../local/store/reliability.js';
|
|
23
|
-
import { relayOperationRefusal } from './relay-acceptance.js';
|
|
35
|
+
import { isRetryId, RETRY_REQUEST_DEADLINE_MS, retryAttemptClientMessageId, retryRequestClientMessageId, storeRetryRequest, updateRetryRequest, } from '../local/store/reliability.js';
|
|
36
|
+
import { classifyRetryRequestPostFailure, relayOperationRefusal, } from './relay-acceptance.js';
|
|
37
|
+
import { rethrowRelayWorkStopped } from './relay-work.js';
|
|
38
|
+
import { isStaleDeviceRefusal } from './relay-device-refusal.js';
|
|
39
|
+
import { MAX_RETRY_RESPONSES_PER_MESSAGE } from './constants.js';
|
|
24
40
|
/** The payload version that this client writes and reads. */
|
|
25
41
|
const RETRY_REQUEST_PAYLOAD_VERSION = 1;
|
|
26
42
|
/** The decoder refuses a longer `ciphertext` value before it decodes it. */
|
|
27
43
|
export const MAX_RETRY_REQUEST_CIPHERTEXT_LENGTH = 2_048;
|
|
28
|
-
/**
|
|
29
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The Relay refuses a longer message ID, so a failed envelope ID and a
|
|
46
|
+
* failed client message ID are 1 to this many characters.
|
|
47
|
+
*/
|
|
48
|
+
const MAX_MESSAGE_ID_LENGTH = 128;
|
|
30
49
|
/** The decoded ratchet key is 1 to this many bytes. */
|
|
31
50
|
const MAX_RATCHET_KEY_BYTES = 64;
|
|
32
51
|
const RETRY_REASONS = new Set(Object.values(RetryReason));
|
|
@@ -48,6 +67,10 @@ export async function retryRequestEnvelope(request, sender, failed) {
|
|
|
48
67
|
timestamp: request.timestamp,
|
|
49
68
|
...(request.ratchetKey === undefined ? {} : { ratchetKey: request.ratchetKey }),
|
|
50
69
|
...(failed && { failedEnvelopeId: failed.failedEnvelopeId, retryId: failed.retryId }),
|
|
70
|
+
// The sender chose this ID. A value that the decoder refuses is left out.
|
|
71
|
+
...(isMessageId(request.failedClientMessageId) && {
|
|
72
|
+
failedClientMessageId: request.failedClientMessageId,
|
|
73
|
+
}),
|
|
51
74
|
};
|
|
52
75
|
return {
|
|
53
76
|
targetUserId: request.originalSenderUserId,
|
|
@@ -63,19 +86,108 @@ export async function retryRequestEnvelope(request, sender, failed) {
|
|
|
63
86
|
: await generateUuidV4(),
|
|
64
87
|
};
|
|
65
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Make the function that posts one retry request envelope, by the sealed
|
|
91
|
+
* sender delivery mode, as a receipt goes.
|
|
92
|
+
*
|
|
93
|
+
* With an access key of the target, the post is sealed: the Relay sees the
|
|
94
|
+
* target, the timing and the size, and not the requester. The sealed post
|
|
95
|
+
* keeps the client message ID and the timestamp of the envelope, so the
|
|
96
|
+
* Relay deduplicates the attempt by the same operation as an identified
|
|
97
|
+
* post. When the Relay refuses the access key, the post goes identified
|
|
98
|
+
* only when the delivery mode permits it. When `seal` resolves to
|
|
99
|
+
* undefined, the post goes identified. In `'required'` mode `seal` throws
|
|
100
|
+
* instead, and nothing goes identified. The caller classifies each error
|
|
101
|
+
* of the post.
|
|
102
|
+
*
|
|
103
|
+
* When the Relay refuses the post as `STALE_DEVICE`, the target device has
|
|
104
|
+
* a new registration. The post then refreshes the session with the device
|
|
105
|
+
* once from a fresh bundle, and posts the same envelope again, sealed and
|
|
106
|
+
* named with the new session, as a receipt goes. The request is plaintext,
|
|
107
|
+
* so nothing is encrypted again. A refresh that finds no bundle,
|
|
108
|
+
* or a second refusal, throws the refusal. A refresh that fails for another
|
|
109
|
+
* reason throws StaleSessionRefreshError, which classifies as a transport
|
|
110
|
+
* outage, so the next post refreshes again.
|
|
111
|
+
*
|
|
112
|
+
* @param seal - Seals the payload. Without it, each post is identified.
|
|
113
|
+
* @param relay - Posts the sealed envelope.
|
|
114
|
+
* @param sendIdentified - Posts the identified envelope.
|
|
115
|
+
* @param registrationOf - The registration ID of the current session with
|
|
116
|
+
* the target device. The identified envelope names it, as the sealed body
|
|
117
|
+
* does, so the Relay refuses the post to a reinstalled device. With no
|
|
118
|
+
* session, or without this function, the envelope names none.
|
|
119
|
+
* @param refreshStaleSession - Refreshes the session with a refused device.
|
|
120
|
+
* Resolves to true when the new session is ready. Without it, a stale
|
|
121
|
+
* refusal throws.
|
|
122
|
+
*/
|
|
123
|
+
export function retryRequestPost(seal, relay, sendIdentified, registrationOf, refreshStaleSession) {
|
|
124
|
+
const post = async (envelope) => {
|
|
125
|
+
const payloadBase64 = typeof envelope.ciphertext === 'string'
|
|
126
|
+
? envelope.ciphertext
|
|
127
|
+
: bytesToBase64(envelope.ciphertext);
|
|
128
|
+
const sealed = await seal?.(envelope.targetUserId, envelope.targetDeviceId, payloadBase64);
|
|
129
|
+
if (sealed) {
|
|
130
|
+
// The seal resolves only when the relay has anonymous delivery.
|
|
131
|
+
if (!relay?.sendMultiRecipientUnidentified) {
|
|
132
|
+
throw new Error('Relay has no anonymous delivery for a sealed retry request');
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
return await relay.sendMultiRecipientUnidentified(sealed.sentMessageBase64, sealed.auth, envelope.timestamp, envelope.deliveryClass, [envelope.targetUserId], envelope.clientMessageId);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (!(error instanceof SealedSenderAuthError) || !sealed.identifiedFallback)
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const recipientRegistrationId = await registrationOf?.(envelope.targetUserId, envelope.targetDeviceId);
|
|
143
|
+
return sendIdentified(recipientRegistrationId === undefined ? envelope : { ...envelope, recipientRegistrationId });
|
|
144
|
+
};
|
|
145
|
+
return async (envelope) => {
|
|
146
|
+
try {
|
|
147
|
+
return await post(envelope);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (!refreshStaleSession || !isStaleDeviceRefusal(error))
|
|
151
|
+
throw error;
|
|
152
|
+
const refreshed = await refreshStaleSession(envelope.targetUserId, envelope.targetDeviceId);
|
|
153
|
+
if (!refreshed)
|
|
154
|
+
throw error;
|
|
155
|
+
return post(envelope);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Tell whether a stored request attempt is answered and is the last
|
|
161
|
+
* attempt of its request. A sender answers at most
|
|
162
|
+
* `MAX_RETRY_RESPONSES_PER_MESSAGE` requests for one message, so when the
|
|
163
|
+
* resend that answered this attempt also fails, the request ends.
|
|
164
|
+
*/
|
|
165
|
+
export function answeredLastRetryAttempt(stored) {
|
|
166
|
+
return stored.answered && stored.attempt >= MAX_RETRY_RESPONSES_PER_MESSAGE;
|
|
167
|
+
}
|
|
168
|
+
/** The shortest wait before the next post of a stored attempt. */
|
|
169
|
+
const MIN_RETRY_REQUEST_BACKOFF_MS = 60_000;
|
|
170
|
+
/** The longest wait before the next post of a stored attempt. */
|
|
171
|
+
const MAX_RETRY_REQUEST_BACKOFF_MS = 60 * 60_000;
|
|
66
172
|
/**
|
|
67
173
|
* Post the retry request for one failed envelope.
|
|
68
174
|
*
|
|
69
175
|
* Without a failed envelope ID, it creates a request and posts it under a
|
|
70
|
-
* new UUID,
|
|
71
|
-
*
|
|
72
|
-
* stores it before the post
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
176
|
+
* new UUID, stores nothing, and throws when the post fails. Otherwise the
|
|
177
|
+
* request record owns the request. With no record, it creates attempt 1
|
|
178
|
+
* with a new retry ID and stores it before the post, due at once. A
|
|
179
|
+
* record that ended posts nothing. At the deadline of the record, the
|
|
180
|
+
* request ends as `expired-content` and posts nothing. When a member
|
|
181
|
+
* failed and the stored attempt is answered, it creates the next attempt
|
|
182
|
+
* under the same retry ID, with the same deadline, and posts it. When that
|
|
183
|
+
* answered attempt is the last one, as `answeredLastRetryAttempt` tells,
|
|
184
|
+
* the request ends as `attempts-exhausted` and posts nothing. Otherwise it
|
|
185
|
+
* posts the stored attempt, as `postStoredRetryRequest` does.
|
|
186
|
+
*
|
|
187
|
+
* Each new attempt carries the failed client message ID, the content hint,
|
|
188
|
+
* the sender, the receive time and the delivery error state of the stored
|
|
189
|
+
* record. Attempt 1 takes them from `failed`, with the time of now as the
|
|
190
|
+
* receive time.
|
|
79
191
|
*
|
|
80
192
|
* @param store - The local store that keeps the request records.
|
|
81
193
|
* @param failed - The failed envelope and its stored request.
|
|
@@ -87,55 +199,168 @@ export async function retryRequestEnvelope(request, sender, failed) {
|
|
|
87
199
|
export async function postRetryRequest(store, failed, createRequest, sender, send) {
|
|
88
200
|
const failedEnvelopeId = failed.id;
|
|
89
201
|
if (failedEnvelopeId === undefined) {
|
|
90
|
-
|
|
91
|
-
|
|
202
|
+
const request = withFailedClientMessageId(await createRequest(), failed.clientMessageId);
|
|
203
|
+
await send(await retryRequestEnvelope(request, sender));
|
|
204
|
+
return 'posted';
|
|
92
205
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
catch (error) {
|
|
98
|
-
if (relayOperationRefusal(error) !== 'RETRY_CONFLICT')
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const create = async (attempt, retryId) => {
|
|
103
|
-
const envelope = await retryRequestEnvelope(await createRequest(), sender, {
|
|
206
|
+
const attempts = retryRequestAttempts(store, createRequest, sender, send);
|
|
207
|
+
const { stored } = failed;
|
|
208
|
+
if (!stored) {
|
|
209
|
+
return attempts.postNew(await attempts.create({
|
|
104
210
|
failedEnvelopeId,
|
|
105
|
-
retryId,
|
|
106
|
-
attempt,
|
|
107
|
-
});
|
|
108
|
-
await storeRetryRequest(store, {
|
|
109
|
-
failedEnvelopeId,
|
|
110
|
-
retryId,
|
|
111
|
-
attempt,
|
|
112
|
-
requestedAt: envelope.timestamp,
|
|
211
|
+
retryId: await generateUuidV4(),
|
|
212
|
+
attempt: 1,
|
|
113
213
|
...(failed.fingerprint !== undefined && { fingerprint: failed.fingerprint }),
|
|
214
|
+
...(failed.groupMessage && { groupMessage: true }),
|
|
215
|
+
...(failed.clientMessageId !== undefined && {
|
|
216
|
+
failedClientMessageId: failed.clientMessageId,
|
|
217
|
+
}),
|
|
218
|
+
...(failed.groupId !== undefined && { groupId: failed.groupId }),
|
|
219
|
+
receivedAt: Date.now(),
|
|
220
|
+
...(failed.contentHint !== undefined && { contentHint: failed.contentHint }),
|
|
221
|
+
...(failed.sender !== undefined && { failedSender: failed.sender }),
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
if (stored.terminal !== undefined || stored.envelope === undefined)
|
|
225
|
+
return 'terminal';
|
|
226
|
+
if (Date.now() >= stored.deadlineAt)
|
|
227
|
+
return attempts.end(stored, 'expired-content');
|
|
228
|
+
if (failed.member !== undefined && stored.answered) {
|
|
229
|
+
if (answeredLastRetryAttempt(stored))
|
|
230
|
+
return attempts.end(stored, 'attempts-exhausted');
|
|
231
|
+
return attempts.postNew(await attempts.next(stored));
|
|
232
|
+
}
|
|
233
|
+
return attempts.postStored(stored);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Post the stored attempt of a retry request again, with its stored bytes
|
|
237
|
+
* and ID. When the Relay refuses it with OPERATION_EXPIRED, it creates the
|
|
238
|
+
* next attempt under the same retry ID, with the same deadline, replaces
|
|
239
|
+
* the record in one write, and posts it.
|
|
240
|
+
*
|
|
241
|
+
* Each post classifies its failure. A RETRY_CONFLICT answer completes the
|
|
242
|
+
* attempt, because the Relay holds an earlier encryption of it. A
|
|
243
|
+
* conclusive class stores the terminal state, with `emitted` false, and
|
|
244
|
+
* gives 'terminal'. A retryable class stores the class and the next
|
|
245
|
+
* attempt time, the age of the attempt from 1 minute to 1 hour from now,
|
|
246
|
+
* and gives 'pending'. A post that the Relay accepts clears both.
|
|
247
|
+
*
|
|
248
|
+
* @param store - The local store that keeps the request records.
|
|
249
|
+
* @param stored - The stored attempt. It has an envelope.
|
|
250
|
+
* @param createRequest - Creates the request of a new attempt.
|
|
251
|
+
* @param sender - The local identity, which sends the envelope.
|
|
252
|
+
* @param send - Posts one request envelope.
|
|
253
|
+
*/
|
|
254
|
+
export async function postStoredRetryRequest(store, stored, createRequest, sender, send) {
|
|
255
|
+
return retryRequestAttempts(store, createRequest, sender, send).postStored(stored);
|
|
256
|
+
}
|
|
257
|
+
/** The attempt steps of one retry request. */
|
|
258
|
+
function retryRequestAttempts(store, createRequest, sender, send) {
|
|
259
|
+
const update = (record, changes) => updateRetryRequest(store, record.failedEnvelopeId, record.retryId, record.attempt, changes);
|
|
260
|
+
/**
|
|
261
|
+
* Create and store a new attempt. Attempt 1 sets the deadline from its
|
|
262
|
+
* own time, the first failure. The attempt is due at its own time until
|
|
263
|
+
* its post settles, so the scheduler posts it again when a stop or a
|
|
264
|
+
* crash ends the post.
|
|
265
|
+
*/
|
|
266
|
+
const create = async (attempt) => {
|
|
267
|
+
const request = withFailedClientMessageId(await createRequest(), attempt.failedClientMessageId);
|
|
268
|
+
const envelope = await retryRequestEnvelope(request, sender, attempt);
|
|
269
|
+
const record = {
|
|
270
|
+
failedEnvelopeId: attempt.failedEnvelopeId,
|
|
271
|
+
retryId: attempt.retryId,
|
|
272
|
+
attempt: attempt.attempt,
|
|
273
|
+
requestedAt: envelope.timestamp,
|
|
274
|
+
...(attempt.fingerprint !== undefined && { fingerprint: attempt.fingerprint }),
|
|
275
|
+
...(attempt.groupId !== undefined && { groupId: attempt.groupId }),
|
|
114
276
|
answered: false,
|
|
277
|
+
...(attempt.groupMessage && { groupMessage: true }),
|
|
278
|
+
...(attempt.failedClientMessageId !== undefined && {
|
|
279
|
+
failedClientMessageId: attempt.failedClientMessageId,
|
|
280
|
+
}),
|
|
281
|
+
...(attempt.groupId !== undefined && { groupId: attempt.groupId }),
|
|
282
|
+
...(attempt.receivedAt !== undefined && { receivedAt: attempt.receivedAt }),
|
|
283
|
+
...(attempt.contentHint !== undefined && { contentHint: attempt.contentHint }),
|
|
284
|
+
...(attempt.failedSender !== undefined && { failedSender: attempt.failedSender }),
|
|
285
|
+
...(attempt.errorShown && { errorShown: true }),
|
|
286
|
+
...(attempt.recoveredEmitted && { recoveredEmitted: true }),
|
|
287
|
+
deadlineAt: attempt.deadlineAt ?? envelope.timestamp + RETRY_REQUEST_DEADLINE_MS,
|
|
288
|
+
nextAttemptAt: envelope.timestamp,
|
|
115
289
|
envelope,
|
|
290
|
+
};
|
|
291
|
+
await storeRetryRequest(store, record);
|
|
292
|
+
return record;
|
|
293
|
+
};
|
|
294
|
+
/** Create the attempt after the stored one, with the same retry ID and deadline. */
|
|
295
|
+
const next = (stored) => create({
|
|
296
|
+
failedEnvelopeId: stored.failedEnvelopeId,
|
|
297
|
+
retryId: stored.retryId,
|
|
298
|
+
attempt: stored.attempt + 1,
|
|
299
|
+
fingerprint: stored.fingerprint,
|
|
300
|
+
groupMessage: stored.groupMessage,
|
|
301
|
+
failedClientMessageId: stored.failedClientMessageId,
|
|
302
|
+
groupId: stored.groupId,
|
|
303
|
+
receivedAt: stored.receivedAt,
|
|
304
|
+
contentHint: stored.contentHint,
|
|
305
|
+
failedSender: stored.failedSender,
|
|
306
|
+
errorShown: stored.errorShown,
|
|
307
|
+
recoveredEmitted: stored.recoveredEmitted,
|
|
308
|
+
deadlineAt: stored.deadlineAt,
|
|
309
|
+
});
|
|
310
|
+
const end = async (stored, terminal) => {
|
|
311
|
+
await update(stored, {
|
|
312
|
+
terminal: { class: terminal, at: Date.now(), emitted: false },
|
|
313
|
+
nextAttemptAt: undefined,
|
|
116
314
|
});
|
|
117
|
-
return
|
|
315
|
+
return 'terminal';
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Post one attempt. `fresh` is true for an attempt that this call
|
|
319
|
+
* created: OPERATION_EXPIRED then means a clock outside the admission
|
|
320
|
+
* window, and counts as a transport outage.
|
|
321
|
+
*/
|
|
322
|
+
const post = async (record, fresh) => {
|
|
323
|
+
try {
|
|
324
|
+
await send(record.envelope);
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
rethrowRelayWorkStopped(error);
|
|
328
|
+
const refusal = relayOperationRefusal(error);
|
|
329
|
+
if (refusal === 'OPERATION_EXPIRED' && !fresh) {
|
|
330
|
+
// The Relay no longer admits or replays the stored operation. The
|
|
331
|
+
// new attempt replaces the record before its post.
|
|
332
|
+
return post(await next(record), true);
|
|
333
|
+
}
|
|
334
|
+
if (refusal !== 'RETRY_CONFLICT') {
|
|
335
|
+
const failure = refusal === 'OPERATION_EXPIRED'
|
|
336
|
+
? { retry: 'transport-outage' }
|
|
337
|
+
: classifyRetryRequestPostFailure(error);
|
|
338
|
+
if ('terminal' in failure) {
|
|
339
|
+
await update(record, {
|
|
340
|
+
terminal: { class: failure.terminal, at: Date.now(), emitted: false },
|
|
341
|
+
nextAttemptAt: undefined,
|
|
342
|
+
lastFailureClass: undefined,
|
|
343
|
+
});
|
|
344
|
+
return 'terminal';
|
|
345
|
+
}
|
|
346
|
+
const now = Date.now();
|
|
347
|
+
const wait = Math.min(MAX_RETRY_REQUEST_BACKOFF_MS, Math.max(MIN_RETRY_REQUEST_BACKOFF_MS, now - record.requestedAt));
|
|
348
|
+
await update(record, { lastFailureClass: failure.retry, nextAttemptAt: now + wait });
|
|
349
|
+
return 'pending';
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (record.nextAttemptAt !== undefined || record.lastFailureClass !== undefined) {
|
|
353
|
+
await update(record, { nextAttemptAt: undefined, lastFailureClass: undefined });
|
|
354
|
+
}
|
|
355
|
+
return 'posted';
|
|
356
|
+
};
|
|
357
|
+
return {
|
|
358
|
+
create,
|
|
359
|
+
next,
|
|
360
|
+
end,
|
|
361
|
+
postNew: (record) => post(record, true),
|
|
362
|
+
postStored: (stored) => post(stored, false),
|
|
118
363
|
};
|
|
119
|
-
if (!failed.stored) {
|
|
120
|
-
await post(await create(1, await generateUuidV4()));
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const { attempt, retryId } = failed.stored;
|
|
124
|
-
if (failed.member !== undefined && failed.stored.answered) {
|
|
125
|
-
await post(await create(attempt + 1, retryId));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
try {
|
|
129
|
-
await post(failed.stored.envelope);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
if (relayOperationRefusal(error) !== 'OPERATION_EXPIRED')
|
|
134
|
-
throw error;
|
|
135
|
-
}
|
|
136
|
-
// The Relay no longer admits or replays the stored operation. The new
|
|
137
|
-
// attempt replaces the record before its post.
|
|
138
|
-
await post(await create(attempt + 1, retryId));
|
|
139
364
|
}
|
|
140
365
|
/**
|
|
141
366
|
* Read a `retry_request` envelope that the local device received.
|
|
@@ -177,7 +402,7 @@ export function readRetryRequestEnvelope(envelope, local) {
|
|
|
177
402
|
if (payload.v !== RETRY_REQUEST_PAYLOAD_VERSION) {
|
|
178
403
|
return { ok: false, cause: 'payload version is not supported' };
|
|
179
404
|
}
|
|
180
|
-
const { failedTimestamp, deviceId, reason, timestamp, ratchetKey, failedEnvelopeId, retryId } = payload;
|
|
405
|
+
const { failedTimestamp, deviceId, reason, timestamp, ratchetKey, failedEnvelopeId, retryId, failedClientMessageId, } = payload;
|
|
181
406
|
if (!Number.isSafeInteger(failedTimestamp) || failedTimestamp <= 0) {
|
|
182
407
|
return { ok: false, cause: 'failedTimestamp is not valid' };
|
|
183
408
|
}
|
|
@@ -201,12 +426,15 @@ export function readRetryRequestEnvelope(envelope, local) {
|
|
|
201
426
|
if (failedEnvelopeId !== undefined &&
|
|
202
427
|
(typeof failedEnvelopeId !== 'string' ||
|
|
203
428
|
failedEnvelopeId.length < 1 ||
|
|
204
|
-
failedEnvelopeId.length >
|
|
429
|
+
failedEnvelopeId.length > MAX_MESSAGE_ID_LENGTH)) {
|
|
205
430
|
return { ok: false, cause: 'failedEnvelopeId is not valid' };
|
|
206
431
|
}
|
|
207
432
|
if (retryId !== undefined && !isRetryId(retryId)) {
|
|
208
433
|
return { ok: false, cause: 'retryId is not valid' };
|
|
209
434
|
}
|
|
435
|
+
if (failedClientMessageId !== undefined && !isMessageId(failedClientMessageId)) {
|
|
436
|
+
return { ok: false, cause: 'failedClientMessageId is not valid' };
|
|
437
|
+
}
|
|
210
438
|
// The sender derives the resend IDs from the retry ID and keys its record by
|
|
211
439
|
// the failed envelope ID, so a payload carries both or neither.
|
|
212
440
|
if ((failedEnvelopeId === undefined) !== (retryId === undefined)) {
|
|
@@ -226,12 +454,21 @@ export function readRetryRequestEnvelope(envelope, local) {
|
|
|
226
454
|
timestamp: timestamp,
|
|
227
455
|
reason: reason,
|
|
228
456
|
...(ratchetKey === undefined ? {} : { ratchetKey: ratchetKey }),
|
|
457
|
+
...(failedClientMessageId === undefined ? {} : { failedClientMessageId }),
|
|
229
458
|
},
|
|
230
459
|
...(retryId === undefined
|
|
231
460
|
? {}
|
|
232
461
|
: { retry: { failedEnvelopeId: failedEnvelopeId, retryId: retryId } }),
|
|
233
462
|
};
|
|
234
463
|
}
|
|
464
|
+
/** The request with the failed client message ID, when there is one. */
|
|
465
|
+
function withFailedClientMessageId(request, failedClientMessageId) {
|
|
466
|
+
return failedClientMessageId === undefined ? request : { ...request, failedClientMessageId };
|
|
467
|
+
}
|
|
468
|
+
/** True for a string of 1 to `MAX_MESSAGE_ID_LENGTH` characters. */
|
|
469
|
+
function isMessageId(value) {
|
|
470
|
+
return typeof value === 'string' && value.length >= 1 && value.length <= MAX_MESSAGE_ID_LENGTH;
|
|
471
|
+
}
|
|
235
472
|
/** Decode canonical base64, or return undefined. */
|
|
236
473
|
function canonicalBase64Bytes(value) {
|
|
237
474
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-request-envelope.js","sourceRoot":"","sources":["../../client/retry-request-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAA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AAO,EAAE,qBAAqB,EAAE,CAAC;AAC/F,CAAC;AAED,oEAAoE;AACpE,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,qBAAqB,CAAC;AACjG,CAAC;AAED,oDAAoD;AACpD,SAAS,oBAAoB,CAAC,KAAa;IACzC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,aAAa,CAAC,KAAe,CAAC,CAAC;QAC7C,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lifecycle of a retry request on the requester device.
|
|
3
|
+
*
|
|
4
|
+
* The request record of a failed envelope owns its retry request from the
|
|
5
|
+
* first post to the answer or to a terminal state. A redelivery of the
|
|
6
|
+
* failed envelope posts nothing while the record exists. A post that fails
|
|
7
|
+
* with a retryable class is posted again by the scheduler at its next
|
|
8
|
+
* attempt time. A post that fails with a conclusive class, the deadline of
|
|
9
|
+
* the record, a failed resend of the last answered attempt, and an
|
|
10
|
+
* exhausted abuse allowance end the request. Each end calls the
|
|
11
|
+
* `onRetryTerminal` hook at least once: the record is marked emitted only
|
|
12
|
+
* after the hook returns. Each request and each scheduler pass also checks
|
|
13
|
+
* the delivery error of the record, as `reportDeliveryError` tells. Each
|
|
14
|
+
* scheduler pass also runs a recovery that the hook did not mark, as
|
|
15
|
+
* `reportDeliveryRecovered` tells.
|
|
16
|
+
*/
|
|
17
|
+
import type { Logger } from '../logger.js';
|
|
18
|
+
import type { Envelope } from '../remote/relay/types.js';
|
|
19
|
+
import type { RetryRequest } from '../internal/sesame/types.js';
|
|
20
|
+
import type { ContentHint } from '../types/messages.js';
|
|
21
|
+
import { storeRetryRequest } from '../local/store/reliability.js';
|
|
22
|
+
import type { SignalProtocolClientHooks } from './event-hooks.js';
|
|
23
|
+
import type { RetryFamilyReceive } from './retry-family.js';
|
|
24
|
+
import { type RetryPostOutcome, type RetryRequestDevice } from './retry-request-envelope.js';
|
|
25
|
+
import { type RetryTerminalResetContext, type RetryTerminalResetSteps } from './retry-terminal-recovery.js';
|
|
26
|
+
type RetryRequestStore = Parameters<typeof storeRetryRequest>[0];
|
|
27
|
+
/**
|
|
28
|
+
* What the retry request of one failed decrypt did.
|
|
29
|
+
*
|
|
30
|
+
* - `posted`, `pending`, `terminal`: as `postRetryRequest` gives them. A
|
|
31
|
+
* terminal request also called the hook.
|
|
32
|
+
* - `owned`: the record of the failed envelope owns the request, so a
|
|
33
|
+
* redelivery of the failed envelope posted nothing.
|
|
34
|
+
* - `deferred`: the rate limit refused a member, and the next attempt waits
|
|
35
|
+
* for the end of the limit window.
|
|
36
|
+
* - `skipped`: nothing was posted or stored.
|
|
37
|
+
*/
|
|
38
|
+
export type RetryRequestOutcome = RetryPostOutcome | 'owned' | 'deferred' | 'skipped';
|
|
39
|
+
/**
|
|
40
|
+
* Tell whether the receive path acknowledges a failed envelope after its
|
|
41
|
+
* retry request. A failed envelope is acknowledged once a record owns its
|
|
42
|
+
* request. A member is acknowledged only when its request attempt is posted
|
|
43
|
+
* or ended, so a member that waits is delivered again.
|
|
44
|
+
*/
|
|
45
|
+
export declare function acknowledgesRetryRequest(outcome: RetryRequestOutcome, member: boolean): boolean;
|
|
46
|
+
/** What the requester uses to ask for a resend after one failed decrypt. */
|
|
47
|
+
export interface RetryRequestSource {
|
|
48
|
+
readonly storage: RetryRequestStore;
|
|
49
|
+
readonly logger: Required<Logger>;
|
|
50
|
+
readonly hooks: SignalProtocolClientHooks | undefined;
|
|
51
|
+
/** The local identity, which sends the request envelope. */
|
|
52
|
+
readonly local: RetryRequestDevice;
|
|
53
|
+
/** The user ID of the failed sender. A new record stores it. */
|
|
54
|
+
readonly senderUserId: string;
|
|
55
|
+
/** The device ID of the failed sender. A new record stores it. */
|
|
56
|
+
readonly senderDeviceId: number;
|
|
57
|
+
/** Spends one request of the rate limit of the sender. False when refused. */
|
|
58
|
+
allow(): boolean;
|
|
59
|
+
/** The rate limit window, for the log line and the cooldown of a member. */
|
|
60
|
+
readonly windowMs: number;
|
|
61
|
+
/** Posts one request envelope. Without it, nothing is posted. */
|
|
62
|
+
readonly send: ((envelope: Envelope) => Promise<unknown>) | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* What the failed envelope itself names. A member is a resend or a null
|
|
65
|
+
* message of a stored request, so the stored record names its failed
|
|
66
|
+
* envelope, and the request ignores these.
|
|
67
|
+
*/
|
|
68
|
+
readonly failedEnvelope?: {
|
|
69
|
+
/** The client message ID that the relay delivered with the envelope. */
|
|
70
|
+
readonly clientMessageId?: string;
|
|
71
|
+
/** True when the envelope is a sender-key message. */
|
|
72
|
+
readonly senderKey: boolean;
|
|
73
|
+
/** True when the request record stores the envelope as a group message. */
|
|
74
|
+
readonly groupMessage?: boolean;
|
|
75
|
+
/** The group of the envelope, when the local device knows it. */
|
|
76
|
+
readonly groupId?: string;
|
|
77
|
+
/** The content hint of the envelope, which sets the time of its delivery error. */
|
|
78
|
+
readonly contentHint?: ContentHint;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Creates the request of a new attempt. `senderKey` is true when the
|
|
82
|
+
* failed envelope is a sender-key message, so the request has no ratchet
|
|
83
|
+
* key.
|
|
84
|
+
*/
|
|
85
|
+
createRequest(senderKey: boolean): Promise<RetryRequest>;
|
|
86
|
+
/** Arms the scheduler for the next attempt time or the deadline of a record. */
|
|
87
|
+
readonly schedule: ((at: number) => void) | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The raw group ID of the failed envelope, when it is a group message
|
|
90
|
+
* whose group the receive resolved. A new record stores it, before the
|
|
91
|
+
* group of `failedEnvelope`.
|
|
92
|
+
*/
|
|
93
|
+
readonly groupId?: string;
|
|
94
|
+
/** The session reset of an `expired-content` end. Without it, nothing resets. */
|
|
95
|
+
readonly reset: RetryTerminalResetSteps | undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Call the `onRetryTerminal` hook for the terminal state of a request
|
|
99
|
+
* record, once. It reads the record, and when the terminal state is not
|
|
100
|
+
* emitted, it first resets the session of an `expired-content` end with
|
|
101
|
+
* `resetRetryTerminalSession`. It then calls the hook and stores the state
|
|
102
|
+
* as emitted. The other classes reset nothing.
|
|
103
|
+
*
|
|
104
|
+
* The hook is called directly, not through `callHook`, so a hook that
|
|
105
|
+
* throws, and the RelayWorkStopped of a stop or of the reset, propagate and
|
|
106
|
+
* leave the state not emitted. The rule is: mark only after the hook
|
|
107
|
+
* returns, and keep the caller alive. The scheduler logs the error and goes
|
|
108
|
+
* on with the next record, and the receive path does not acknowledge the
|
|
109
|
+
* failed envelope. The next scheduler pass, at the next start or the next
|
|
110
|
+
* armed time, or the redelivery continues the reset from its stored steps
|
|
111
|
+
* and calls the hook again. The record holds no emit count, so a hook that
|
|
112
|
+
* keeps throwing runs once each pass until the record expires.
|
|
113
|
+
*/
|
|
114
|
+
export declare function emitRetryTerminal(context: RetryTerminalResetContext, failedEnvelopeId: string): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Ask for a resend after a failed decrypt, through the retry family of the
|
|
117
|
+
* envelope.
|
|
118
|
+
*
|
|
119
|
+
* - A failed envelope with a record posts nothing and gives `owned`. It
|
|
120
|
+
* only calls the hook for a terminal state that is not emitted. The rate
|
|
121
|
+
* limit does not count it.
|
|
122
|
+
* - A failed envelope with no record spends one request of the rate limit.
|
|
123
|
+
* A refusal stores a record that ends as `abuse-allowance-exhausted`.
|
|
124
|
+
* - A member of a request that ended posts nothing and gives `terminal`.
|
|
125
|
+
* - A member whose stored attempt is answered and is the last attempt, as
|
|
126
|
+
* `answeredLastRetryAttempt` tells, ends the request as
|
|
127
|
+
* `attempts-exhausted` and gives `terminal`. The rate limit does not
|
|
128
|
+
* count it.
|
|
129
|
+
* - A member whose stored attempt is answered, or that has no record,
|
|
130
|
+
* spends one request of the rate limit, unless an earlier refusal set a
|
|
131
|
+
* next attempt time that has not come. A refusal sets that time to the
|
|
132
|
+
* end of the limit window and gives `deferred`.
|
|
133
|
+
* - A member whose stored attempt is not answered posts it again, with no
|
|
134
|
+
* rate limit.
|
|
135
|
+
*
|
|
136
|
+
* After a post, a terminal outcome calls the hook, and any other outcome
|
|
137
|
+
* arms the scheduler for the record. Then, for each failed envelope with
|
|
138
|
+
* an ID, it runs `onDeliveryError` when the error of the record is due,
|
|
139
|
+
* and arms the scheduler for an error that is due later.
|
|
140
|
+
*/
|
|
141
|
+
export declare function requestRetryInFamily(family: RetryFamilyReceive, fingerprint: string | undefined, source: RetryRequestSource): Promise<RetryRequestOutcome>;
|
|
142
|
+
/**
|
|
143
|
+
* The context of one scheduler pass: the hooks run through the relay work
|
|
144
|
+
* of the pass. Without `send`, the pass only calls the hooks for terminal
|
|
145
|
+
* states and delivery errors.
|
|
146
|
+
*/
|
|
147
|
+
export interface RetryRequestPass {
|
|
148
|
+
readonly storage: RetryRequestStore;
|
|
149
|
+
readonly logger: Required<Logger>;
|
|
150
|
+
readonly hooks: SignalProtocolClientHooks | undefined;
|
|
151
|
+
readonly local: RetryRequestDevice;
|
|
152
|
+
readonly send: ((envelope: Envelope) => Promise<unknown>) | undefined;
|
|
153
|
+
/** The session reset of an `expired-content` end. Without it, nothing resets. */
|
|
154
|
+
readonly reset: RetryTerminalResetSteps | undefined;
|
|
155
|
+
}
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=retry-request-lifecycle.d.ts.map
|