@open-e2ee/signal-protocol-sdk 14.0.0 → 14.2.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 +5 -5
- package/ARCHITECTURE.md +1 -1
- package/CHANGELOG.md +461 -0
- package/README.md +21 -15
- package/SECURITY.md +2 -2
- package/TROUBLESHOOTING.md +1 -1
- package/client/README.md +35 -22
- package/device/README.md +5 -5
- package/dist/client/client.d.ts +44 -34
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +221 -146
- package/dist/client/client.js.map +1 -1
- package/dist/client/compose.d.ts +7 -5
- package/dist/client/compose.d.ts.map +1 -1
- package/dist/client/compose.js +7 -2
- package/dist/client/compose.js.map +1 -1
- package/dist/client/config.d.ts +23 -14
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/content-adapter.d.ts +9 -0
- package/dist/client/content-adapter.d.ts.map +1 -1
- package/dist/client/content-adapter.js +6 -0
- package/dist/client/content-adapter.js.map +1 -1
- package/dist/client/delivery-status.d.ts +2 -2
- package/dist/client/delivery-status.d.ts.map +1 -1
- package/dist/client/delivery-status.js +10 -4
- package/dist/client/delivery-status.js.map +1 -1
- package/dist/client/device-set-reconciliation.d.ts +24 -16
- package/dist/client/device-set-reconciliation.d.ts.map +1 -1
- package/dist/client/device-set-reconciliation.js +17 -14
- package/dist/client/device-set-reconciliation.js.map +1 -1
- package/dist/client/event-hooks.d.ts +22 -7
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +35 -5
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/group-device-set.d.ts +1 -1
- package/dist/client/group-device-set.d.ts.map +1 -1
- package/dist/client/group-key-sync.js +1 -1
- package/dist/client/group-key-sync.js.map +1 -1
- package/dist/client/group-outbox.d.ts +7 -7
- package/dist/client/group-outbox.d.ts.map +1 -1
- package/dist/client/group-outbox.js +24 -24
- package/dist/client/group-outbox.js.map +1 -1
- package/dist/client/group-sealed-sender.d.ts +1 -1
- package/dist/client/group-sealed-sender.d.ts.map +1 -1
- package/dist/client/group-sender-key-operations.js +1 -1
- package/dist/client/group-sender-key-operations.js.map +1 -1
- package/dist/client/headless.d.ts +6 -6
- package/dist/client/headless.d.ts.map +1 -1
- package/dist/client/headless.js +7 -7
- package/dist/client/headless.js.map +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts +18 -6
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
- package/dist/client/hosted-anonymous-delivery.js +63 -20
- package/dist/client/hosted-anonymous-delivery.js.map +1 -1
- package/dist/client/hosted-assertion-id.d.ts +1 -1
- package/dist/client/hosted-assertion-id.d.ts.map +1 -1
- package/dist/client/hosted-assertion-id.js +1 -1
- package/dist/client/hosted-assertion-id.js.map +1 -1
- package/dist/client/hosted-connection.d.ts +5 -5
- package/dist/client/hosted-connection.d.ts.map +1 -1
- package/dist/client/hosted-connection.js +32 -32
- package/dist/client/hosted-connection.js.map +1 -1
- package/dist/client/hosted-device-link-transport.d.ts +2 -2
- package/dist/client/hosted-device-link-transport.d.ts.map +1 -1
- package/dist/client/hosted-device-link-transport.js +1 -1
- package/dist/client/hosted-device-link-transport.js.map +1 -1
- package/dist/client/hosted-device-link.d.ts +5 -1
- package/dist/client/hosted-device-link.d.ts.map +1 -1
- package/dist/client/hosted-device-link.js +7 -4
- package/dist/client/hosted-device-link.js.map +1 -1
- package/dist/client/hosted-device-standing.d.ts +13 -5
- package/dist/client/hosted-device-standing.d.ts.map +1 -1
- package/dist/client/hosted-device-standing.js +11 -6
- package/dist/client/hosted-device-standing.js.map +1 -1
- package/dist/client/hosted-group-authority.d.ts +2 -2
- package/dist/client/hosted-group-authority.d.ts.map +1 -1
- package/dist/client/hosted-group-authority.js +8 -8
- package/dist/client/hosted-group-authority.js.map +1 -1
- package/dist/client/hosted-groups.d.ts +4 -4
- package/dist/client/hosted-groups.d.ts.map +1 -1
- package/dist/client/hosted-groups.js +8 -8
- package/dist/client/hosted-groups.js.map +1 -1
- package/dist/client/hosted-http-error.d.ts +8 -4
- package/dist/client/hosted-http-error.d.ts.map +1 -1
- package/dist/client/hosted-http-error.js +7 -4
- package/dist/client/hosted-http-error.js.map +1 -1
- package/dist/client/hosted-mailbox-subscription.d.ts +16 -15
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +21 -25
- package/dist/client/hosted-mailbox-subscription.js.map +1 -1
- package/dist/client/hosted-prekey-publication.d.ts +9 -9
- package/dist/client/hosted-prekey-publication.d.ts.map +1 -1
- package/dist/client/hosted-prekey-publication.js.map +1 -1
- package/dist/client/hosted-presence-frames.d.ts +62 -38
- package/dist/client/hosted-presence-frames.d.ts.map +1 -1
- package/dist/client/hosted-presence-frames.js +4 -2
- package/dist/client/hosted-presence-frames.js.map +1 -1
- package/dist/client/hosted-presence.d.ts +22 -14
- package/dist/client/hosted-presence.d.ts.map +1 -1
- package/dist/client/hosted-presence.js +26 -17
- package/dist/client/hosted-presence.js.map +1 -1
- package/dist/client/hosted-profile-keys.d.ts +3 -1
- package/dist/client/hosted-profile-keys.d.ts.map +1 -1
- package/dist/client/hosted-profile-keys.js +19 -15
- package/dist/client/hosted-profile-keys.js.map +1 -1
- package/dist/client/hosted-push.d.ts +38 -16
- package/dist/client/hosted-push.d.ts.map +1 -1
- package/dist/client/hosted-push.js +11 -5
- package/dist/client/hosted-push.js.map +1 -1
- package/dist/client/hosted-resume-error.d.ts +21 -9
- package/dist/client/hosted-resume-error.d.ts.map +1 -1
- package/dist/client/hosted-resume-error.js +4 -1
- package/dist/client/hosted-resume-error.js.map +1 -1
- package/dist/client/hosted-resume.d.ts +3 -3
- package/dist/client/hosted-resume.d.ts.map +1 -1
- package/dist/client/hosted-resume.js +12 -12
- package/dist/client/hosted-resume.js.map +1 -1
- package/dist/client/hosted-sandbox-identity.d.ts +82 -5
- package/dist/client/hosted-sandbox-identity.d.ts.map +1 -1
- package/dist/client/hosted-sandbox-identity.js +160 -50
- package/dist/client/hosted-sandbox-identity.js.map +1 -1
- package/dist/client/hosted-store-records.d.ts +46 -0
- package/dist/client/hosted-store-records.d.ts.map +1 -0
- package/dist/client/hosted-store-records.js +32 -0
- package/dist/client/hosted-store-records.js.map +1 -0
- package/dist/client/hosted-transport.d.ts +53 -33
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +225 -138
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted-trust.d.ts +1 -1
- package/dist/client/hosted-trust.d.ts.map +1 -1
- package/dist/client/hosted-trust.js +1 -1
- package/dist/client/hosted-trust.js.map +1 -1
- package/dist/client/hosted.d.ts +144 -75
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +106 -61
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/key-rotation-core.d.ts +4 -4
- package/dist/client/key-rotation-core.d.ts.map +1 -1
- package/dist/client/key-rotation-core.js +8 -8
- package/dist/client/key-rotation-core.js.map +1 -1
- package/dist/client/key-rotation.js +2 -2
- package/dist/client/key-rotation.js.map +1 -1
- package/dist/client/messages.d.ts +3 -3
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +18 -18
- package/dist/client/messages.js.map +1 -1
- package/dist/client/one-time-prekey-refill.d.ts +1 -1
- package/dist/client/one-time-prekey-refill.d.ts.map +1 -1
- package/dist/client/prekeys.js +17 -17
- package/dist/client/prekeys.js.map +1 -1
- package/dist/client/receive-queue.d.ts +4 -4
- package/dist/client/receive-queue.d.ts.map +1 -1
- package/dist/client/receive-queue.js +29 -29
- package/dist/client/receive-queue.js.map +1 -1
- package/dist/client/receive-work-seed.d.ts +6 -2
- package/dist/client/receive-work-seed.d.ts.map +1 -1
- package/dist/client/receive-work-seed.js.map +1 -1
- package/dist/client/recovery-driver.js +7 -7
- package/dist/client/recovery-driver.js.map +1 -1
- package/dist/client/retry-request-envelope.d.ts +3 -3
- package/dist/client/retry-request-envelope.d.ts.map +1 -1
- package/dist/client/retry-request-envelope.js +10 -10
- package/dist/client/retry-request-envelope.js.map +1 -1
- package/dist/client/retry-request-lifecycle.d.ts +1 -1
- package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
- package/dist/client/retry-request-lifecycle.js +8 -8
- package/dist/client/retry-request-lifecycle.js.map +1 -1
- package/dist/client/retry-terminal-recovery.js +2 -2
- package/dist/client/retry-terminal-recovery.js.map +1 -1
- package/dist/client/retry.js +13 -13
- package/dist/client/retry.js.map +1 -1
- package/dist/client/sealed-sender.d.ts +13 -4
- package/dist/client/sealed-sender.d.ts.map +1 -1
- package/dist/client/sealed-sender.js +27 -15
- package/dist/client/sealed-sender.js.map +1 -1
- package/dist/client/send-deadline.d.ts +8 -7
- package/dist/client/send-deadline.d.ts.map +1 -1
- package/dist/client/send-deadline.js +41 -23
- package/dist/client/send-deadline.js.map +1 -1
- package/dist/client/send-intent-driver.js +9 -9
- package/dist/client/send-intent-driver.js.map +1 -1
- package/dist/client/sessions.js +11 -11
- package/dist/client/sessions.js.map +1 -1
- package/dist/client/{relay-acceptance.d.ts → signal-relay-acceptance.d.ts} +9 -9
- package/dist/client/signal-relay-acceptance.d.ts.map +1 -0
- package/dist/client/{relay-acceptance.js → signal-relay-acceptance.js} +7 -7
- package/dist/client/signal-relay-acceptance.js.map +1 -0
- package/dist/client/{relay-device-refusal.d.ts → signal-relay-device-refusal.d.ts} +7 -7
- package/dist/client/signal-relay-device-refusal.d.ts.map +1 -0
- package/dist/client/{relay-device-refusal.js → signal-relay-device-refusal.js} +9 -9
- package/dist/client/signal-relay-device-refusal.js.map +1 -0
- package/dist/client/{relay-lifecycle.d.ts → signal-relay-lifecycle.d.ts} +21 -11
- package/dist/client/signal-relay-lifecycle.d.ts.map +1 -0
- package/dist/client/{relay-lifecycle.js → signal-relay-lifecycle.js} +19 -9
- package/dist/client/signal-relay-lifecycle.js.map +1 -0
- package/dist/client/signal-relay-period-close.d.ts +35 -0
- package/dist/client/signal-relay-period-close.d.ts.map +1 -0
- package/dist/client/signal-relay-period-close.js +63 -0
- package/dist/client/signal-relay-period-close.js.map +1 -0
- package/dist/client/{relay-protocol.d.ts → signal-relay-protocol.d.ts} +12 -8
- package/dist/client/signal-relay-protocol.d.ts.map +1 -0
- package/dist/client/{relay-protocol.js → signal-relay-protocol.js} +13 -10
- package/dist/client/signal-relay-protocol.js.map +1 -0
- package/dist/client/{relay-receipt-intake.d.ts → signal-relay-receipt-intake.d.ts} +12 -12
- package/dist/client/signal-relay-receipt-intake.d.ts.map +1 -0
- package/dist/client/{relay-receipt-intake.js → signal-relay-receipt-intake.js} +9 -9
- package/dist/client/signal-relay-receipt-intake.js.map +1 -0
- package/dist/client/{relay-receipt-join.d.ts → signal-relay-receipt-join.d.ts} +8 -8
- package/dist/client/signal-relay-receipt-join.d.ts.map +1 -0
- package/dist/client/{relay-receipt-join.js → signal-relay-receipt-join.js} +11 -11
- package/dist/client/signal-relay-receipt-join.js.map +1 -0
- package/dist/client/{relay-request-deadline.d.ts → signal-relay-request-deadline.d.ts} +3 -3
- package/dist/client/signal-relay-request-deadline.d.ts.map +1 -0
- package/dist/client/{relay-request-deadline.js → signal-relay-request-deadline.js} +4 -4
- package/dist/client/signal-relay-request-deadline.js.map +1 -0
- package/dist/client/{relay-sealed-route.d.ts → signal-relay-sealed-route.d.ts} +1 -1
- package/dist/client/signal-relay-sealed-route.d.ts.map +1 -0
- package/dist/client/{relay-sealed-route.js → signal-relay-sealed-route.js} +1 -1
- package/dist/client/signal-relay-sealed-route.js.map +1 -0
- package/dist/client/{relay-subscription.d.ts → signal-relay-subscription.d.ts} +12 -12
- package/dist/client/signal-relay-subscription.d.ts.map +1 -0
- package/dist/client/{relay-subscription.js → signal-relay-subscription.js} +23 -23
- package/dist/client/signal-relay-subscription.js.map +1 -0
- package/dist/client/{relay-work.d.ts → signal-relay-work.d.ts} +7 -7
- package/dist/client/signal-relay-work.d.ts.map +1 -0
- package/dist/client/{relay-work.js → signal-relay-work.js} +13 -13
- package/dist/client/signal-relay-work.js.map +1 -0
- package/dist/client/signal-service-cipher.d.ts +11 -9
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +103 -98
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/state.d.ts +4 -4
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/state.js +3 -3
- package/dist/client/state.js.map +1 -1
- package/dist/client/types.d.ts +13 -4
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/device/connection.d.ts +10 -4
- package/dist/device/connection.d.ts.map +1 -1
- package/dist/device/connection.js +8 -3
- package/dist/device/connection.js.map +1 -1
- package/dist/device/index.d.ts +2 -2
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +1 -1
- package/dist/device/index.js.map +1 -1
- package/dist/device/types.d.ts +3 -1
- package/dist/device/types.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-signal-relay-connection-state.d.ts +40 -0
- package/dist/hooks/use-signal-relay-connection-state.d.ts.map +1 -0
- package/dist/hooks/use-signal-relay-connection-state.js +45 -0
- package/dist/hooks/use-signal-relay-connection-state.js.map +1 -0
- package/dist/hooks/use-signal-relay-lifecycle.d.ts +43 -0
- package/dist/hooks/use-signal-relay-lifecycle.d.ts.map +1 -0
- package/dist/hooks/use-signal-relay-lifecycle.js +38 -0
- package/dist/hooks/use-signal-relay-lifecycle.js.map +1 -0
- package/dist/index.d.ts +18 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/groups/authority-certificate.d.ts +7 -1
- package/dist/internal/groups/authority-certificate.d.ts.map +1 -1
- package/dist/internal/groups/authority-certificate.js +29 -6
- package/dist/internal/groups/authority-certificate.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.js +2 -2
- package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +5 -5
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/sesame/device-registry.d.ts +13 -13
- package/dist/internal/sesame/device-registry.d.ts.map +1 -1
- package/dist/internal/sesame/device-registry.js +20 -20
- package/dist/internal/sesame/device-registry.js.map +1 -1
- package/dist/local/store/receive-work.d.ts +29 -0
- package/dist/local/store/receive-work.d.ts.map +1 -1
- package/dist/local/store/receive-work.js +58 -1
- package/dist/local/store/receive-work.js.map +1 -1
- package/dist/local/store/received-content.d.ts +1 -1
- package/dist/local/store/received-content.d.ts.map +1 -1
- package/dist/local/store/reliability.d.ts +11 -3
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +4 -0
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/index.d.ts +3 -9
- package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts +1 -7
- package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/signed-prekeys.js.map +1 -1
- package/dist/local/store/sqlite/models/kyber-prekey.d.ts +4 -9
- package/dist/local/store/sqlite/models/kyber-prekey.d.ts.map +1 -1
- package/dist/local/store/sqlite/models/kyber-prekey.js +4 -1
- package/dist/local/store/sqlite/models/kyber-prekey.js.map +1 -1
- package/dist/local/store/sqlite/store.d.ts.map +1 -1
- package/dist/local/store/sqlite/store.js +1 -2
- package/dist/local/store/sqlite/store.js.map +1 -1
- package/dist/remote/signal-relay/connection-state.d.ts +16 -0
- package/dist/remote/signal-relay/connection-state.d.ts.map +1 -0
- package/dist/remote/{relay → signal-relay}/connection-state.js +1 -1
- package/dist/remote/signal-relay/connection-state.js.map +1 -0
- package/dist/remote/{relay → signal-relay}/device-set.d.ts +3 -3
- package/dist/remote/signal-relay/device-set.d.ts.map +1 -0
- package/dist/remote/{relay → signal-relay}/device-set.js +7 -7
- package/dist/remote/signal-relay/device-set.js.map +1 -0
- package/dist/remote/{relay → signal-relay}/index.d.ts +3 -3
- package/dist/remote/signal-relay/index.d.ts.map +1 -0
- package/dist/remote/{relay → signal-relay}/index.js +2 -2
- package/dist/remote/signal-relay/index.js.map +1 -0
- package/dist/remote/{relay → signal-relay}/request-admission.d.ts +7 -5
- package/dist/remote/signal-relay/request-admission.d.ts.map +1 -0
- package/dist/remote/{relay → signal-relay}/request-admission.js +7 -6
- package/dist/remote/signal-relay/request-admission.js.map +1 -0
- package/dist/remote/{relay → signal-relay}/types.d.ts +30 -12
- package/dist/remote/signal-relay/types.d.ts.map +1 -0
- package/dist/remote/{relay → signal-relay}/types.js +1 -1
- package/dist/remote/signal-relay/types.js.map +1 -0
- package/dist/safety/core.d.ts +1 -1
- package/dist/safety/core.js +1 -1
- package/dist/types/api.d.ts +43 -20
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +55 -7
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +61 -8
- package/dist/types/errors.js.map +1 -1
- package/dist/types/renamed-member.d.ts +41 -0
- package/dist/types/renamed-member.d.ts.map +1 -0
- package/dist/types/renamed-member.js +73 -0
- package/dist/types/renamed-member.js.map +1 -0
- package/dist/utils/bounded-fan-out.d.ts +2 -2
- package/dist/utils/bounded-fan-out.d.ts.map +1 -1
- package/dist/utils/bounded-fan-out.js +2 -2
- package/dist/utils/bounded-fan-out.js.map +1 -1
- package/dist/utils/retry.d.ts +3 -3
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +4 -3
- package/dist/utils/retry.js.map +1 -1
- package/docs/ASSURANCE.md +8 -8
- package/docs/CLIENT_COMPOSITION.md +11 -7
- package/docs/DEVIATIONS.md +58 -8
- package/docs/ERROR_HANDLING.md +24 -24
- package/docs/GETTING_STARTED.md +25 -16
- package/docs/INTERFACES.md +5 -5
- package/docs/PACKAGE_SURFACE.md +14 -4
- package/docs/PROTOCOL_POLICY.md +4 -4
- package/docs/RECIPES.md +274 -15
- package/hooks/README.md +11 -11
- package/local/store/expo/README.md +1 -1
- package/local/store/key-value/README.md +2 -2
- package/local/store/node/README.md +1 -1
- package/local/store/react-native/README.md +1 -1
- package/local/store/web/README.md +1 -1
- package/local/store/web-sqlite/README.md +2 -2
- package/package.json +22 -7
- package/remote/README.md +4 -4
- package/remote/object-store/convex-r2/README.md +1 -1
- package/remote/{relay → signal-relay}/README.md +16 -6
- package/dist/client/relay-acceptance.d.ts.map +0 -1
- package/dist/client/relay-acceptance.js.map +0 -1
- package/dist/client/relay-device-refusal.d.ts.map +0 -1
- package/dist/client/relay-device-refusal.js.map +0 -1
- package/dist/client/relay-lifecycle.d.ts.map +0 -1
- package/dist/client/relay-lifecycle.js.map +0 -1
- package/dist/client/relay-protocol.d.ts.map +0 -1
- package/dist/client/relay-protocol.js.map +0 -1
- package/dist/client/relay-receipt-intake.d.ts.map +0 -1
- package/dist/client/relay-receipt-intake.js.map +0 -1
- package/dist/client/relay-receipt-join.d.ts.map +0 -1
- package/dist/client/relay-receipt-join.js.map +0 -1
- package/dist/client/relay-request-deadline.d.ts.map +0 -1
- package/dist/client/relay-request-deadline.js.map +0 -1
- package/dist/client/relay-sealed-route.d.ts.map +0 -1
- package/dist/client/relay-sealed-route.js.map +0 -1
- package/dist/client/relay-subscription.d.ts.map +0 -1
- package/dist/client/relay-subscription.js.map +0 -1
- package/dist/client/relay-work.d.ts.map +0 -1
- package/dist/client/relay-work.js.map +0 -1
- package/dist/hooks/use-relay-connection-state.d.ts +0 -32
- package/dist/hooks/use-relay-connection-state.d.ts.map +0 -1
- package/dist/hooks/use-relay-connection-state.js +0 -31
- package/dist/hooks/use-relay-connection-state.js.map +0 -1
- package/dist/hooks/use-relay-lifecycle.d.ts +0 -36
- package/dist/hooks/use-relay-lifecycle.d.ts.map +0 -1
- package/dist/hooks/use-relay-lifecycle.js +0 -35
- package/dist/hooks/use-relay-lifecycle.js.map +0 -1
- package/dist/remote/relay/connection-state.d.ts +0 -16
- package/dist/remote/relay/connection-state.d.ts.map +0 -1
- package/dist/remote/relay/connection-state.js.map +0 -1
- package/dist/remote/relay/device-set.d.ts.map +0 -1
- package/dist/remote/relay/device-set.js.map +0 -1
- package/dist/remote/relay/index.d.ts.map +0 -1
- package/dist/remote/relay/index.js.map +0 -1
- package/dist/remote/relay/request-admission.d.ts.map +0 -1
- package/dist/remote/relay/request-admission.js.map +0 -1
- package/dist/remote/relay/types.d.ts.map +0 -1
- package/dist/remote/relay/types.js.map +0 -1
package/dist/client/client.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* // Supply a device-local store and the configured identity-provider callback.
|
|
16
16
|
* const signal = await createHostedSignalProtocolClient({
|
|
17
17
|
* adapters: { storage },
|
|
18
|
-
* hosted: {
|
|
18
|
+
* hosted: { signalProtocolRelayUrl, getIdentityAssertion },
|
|
19
19
|
* });
|
|
20
20
|
*
|
|
21
21
|
* await signal.send(recipientUserId, 'Hello!');
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ```typescript
|
|
26
26
|
* const signal = await createSignalProtocolClient({
|
|
27
27
|
* identity: { userId },
|
|
28
|
-
* adapters: { storage,
|
|
28
|
+
* adapters: { storage, signalProtocolRelay },
|
|
29
29
|
* protocol: { postQuantum: 'required', braid: 'required' },
|
|
30
30
|
* });
|
|
31
31
|
* ```
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*
|
|
37
37
|
* const signal = await DefaultSignalProtocolClient.create(userId, {
|
|
38
38
|
* storage,
|
|
39
|
-
*
|
|
39
|
+
* signalProtocolRelay,
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
@@ -53,10 +53,11 @@ import { base64ToBytes, bytesToBase64, constantTimeEqual, generateUuidV4 } from
|
|
|
53
53
|
import { deriveGroupSecretParams, getGroupPublicParams } from '../internal/protocol/zk/groups/index.js';
|
|
54
54
|
import { SERVICE_ID_ACI } from '../internal/protocol/zk/groups/uid-struct.js';
|
|
55
55
|
import { deserializeSenderCertificate, validateSenderCertificate, } from '../internal/protocol/sealed-sender/index.js';
|
|
56
|
-
import { assertHookName, callHook, deferHooks, } from './event-hooks.js';
|
|
57
|
-
import {
|
|
56
|
+
import { assertHookName, assertRenamedHooks, callHook, currentHookName, deferHooks, } from './event-hooks.js';
|
|
57
|
+
import { readRenamedImplementation, readRenamedOption } from '../types/renamed-member.js';
|
|
58
|
+
import { signalRelayProtocolErrorOf } from './device-set-reconciliation.js';
|
|
58
59
|
import { DeliveryStatusTracker } from './delivery-status.js';
|
|
59
|
-
import {
|
|
60
|
+
import { signalRelayReceiptIntakeOf } from './signal-relay-receipt-intake.js';
|
|
60
61
|
import { ProtocolAddress } from '../types/address.js';
|
|
61
62
|
import { getActiveIdentityTypes, resolveSignalProtocolStrategy, SEALED_SENDER_CERTIFICATE_MARGIN_MS, } from './config.js';
|
|
62
63
|
import { resolveSignalProtocolLogger } from '../logger.js';
|
|
@@ -76,7 +77,7 @@ import { profileKeyExchange } from './profile-key-exchange.js';
|
|
|
76
77
|
import { attachClientMessageId, SignalProtocolServiceCipher, sortEnvelopesForDecryption, } from './signal-service-cipher.js';
|
|
77
78
|
import { establishMultiDeviceSessions } from '../internal/sesame/device-registry.js';
|
|
78
79
|
import { isPartialCommitKyberPreKeyUse, isRetryableDecryptionError } from './retry-utils.js';
|
|
79
|
-
import { envelopeTypeForContent, SealedRetryRequestReceived, unsealMessage } from './sealed-sender.js';
|
|
80
|
+
import { envelopeTypeForContent, SealedRetryRequestReceived, sealedSenderSignalProtocolRelayScopeId, unsealMessage, } from './sealed-sender.js';
|
|
80
81
|
import { ResendableContent } from './resendable-content.js';
|
|
81
82
|
import { decideContentRecovery, readLocalStoreProtection, resolveContentRecoveryPolicy, resolveReceiveQueuePolicy, } from './storage-protection.js';
|
|
82
83
|
import { ReceiptType } from './types.js';
|
|
@@ -96,16 +97,16 @@ import { manualResendOutcomeEvent, SEND_END_REPORT, sendOutcomeEvent, } from './
|
|
|
96
97
|
import { intentContent, SendIntentDriver } from './send-intent-driver.js';
|
|
97
98
|
import { checkNewSendTimestamp, releaseNewSendTimestampWithLock, reserveNewSendTimestamp, SEND_TIMESTAMP_ORIGIN, } from './send-timestamp.js';
|
|
98
99
|
import { deliveredEnvelopeFingerprint } from '../local/store/received-content.js';
|
|
99
|
-
import { RECEIVE_WORK_DEFAULT_LIMIT } from '../local/store/receive-work.js';
|
|
100
|
+
import { isSignalProtocolRelayOrigin, RECEIVE_WORK_DEFAULT_LIMIT, reportedReceiveWorkOrigin, } from '../local/store/receive-work.js';
|
|
100
101
|
import { awaitReceiveCompletion, blockReceiveWork, completeReceiveWork, denyReceiveWork, ReceiveQueue, } from './receive-queue.js';
|
|
101
102
|
import { receiveExpiresAt } from './receive-expiry.js';
|
|
102
103
|
import { boundReceiveHooks } from './receive-hook-bound.js';
|
|
103
104
|
import { createReceiveCommit } from './receive-work-seed.js';
|
|
104
|
-
import * as
|
|
105
|
-
import {
|
|
105
|
+
import * as SignalProtocolRelaySubscriptionOps from './signal-relay-subscription.js';
|
|
106
|
+
import { signalRelayReceiptJoinOf } from './signal-relay-receipt-join.js';
|
|
106
107
|
import { SignalProtocolClientState, SIGNAL_PROTOCOL_CLIENT_CONSTANTS } from './state.js';
|
|
107
|
-
import {
|
|
108
|
-
import { StaleSessionRefreshError } from './relay-device-refusal.js';
|
|
108
|
+
import { clientSignalProtocolRelayFanOut, rethrowSignalProtocolRelayWorkStopped, RelayWorkStopped, } from './signal-relay-work.js';
|
|
109
|
+
import { StaleSessionRefreshError } from './signal-relay-device-refusal.js';
|
|
109
110
|
import { deleteMediaAttachment, resolveMediaAttachment, } from '../media/index.js';
|
|
110
111
|
import { StorageBackedSignalProtocolClientMedia } from './media.js';
|
|
111
112
|
// Group state (Signal Private Group System)
|
|
@@ -122,6 +123,55 @@ const storageLock = new AsyncLock({
|
|
|
122
123
|
timeout: 30000, // 30 second timeout for storage initialization
|
|
123
124
|
maxPending: 100, // Limit pending operations
|
|
124
125
|
});
|
|
126
|
+
/**
|
|
127
|
+
* The connection state of a relay, read through `readRenamedImplementation`.
|
|
128
|
+
*/
|
|
129
|
+
function signalProtocolRelayConnectionStateOf(signalProtocolRelay) {
|
|
130
|
+
return readRenamedImplementation(signalProtocolRelay, 'signalProtocolRelayConnectionState', 'relayConnectionState');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Subscribe to the connection transitions of a relay, through
|
|
134
|
+
* `readRenamedImplementation`. A relay with neither member gives no
|
|
135
|
+
* subscription.
|
|
136
|
+
*/
|
|
137
|
+
function subscribeSignalProtocolRelayConnectionStateOf(signalProtocolRelay, listener) {
|
|
138
|
+
return readRenamedImplementation(signalProtocolRelay, 'subscribeSignalProtocolRelayConnectionState', 'subscribeRelayConnectionState')?.(listener);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Give each renamed option of a client configuration its new name.
|
|
142
|
+
*
|
|
143
|
+
* @throws SignalProtocolRelayNameConflictError when an option and its
|
|
144
|
+
* deprecated name hold different values.
|
|
145
|
+
*/
|
|
146
|
+
function withSignalProtocolRelayNames(config) {
|
|
147
|
+
const operation = 'DefaultSignalProtocolClient.create';
|
|
148
|
+
const { relay: earlierSignalProtocolRelay, ...rest } = config;
|
|
149
|
+
const signalProtocolRelay = readRenamedOption(config.signalProtocolRelay, earlierSignalProtocolRelay, {
|
|
150
|
+
newName: 'signalProtocolRelay',
|
|
151
|
+
earlierName: 'relay',
|
|
152
|
+
operation,
|
|
153
|
+
});
|
|
154
|
+
if (config.hooks)
|
|
155
|
+
assertRenamedHooks(config.hooks, operation);
|
|
156
|
+
const sealedSender = config.sealedSender;
|
|
157
|
+
let resolvedSealedSender = sealedSender;
|
|
158
|
+
if (sealedSender && sealedSender.relayScopeId !== undefined) {
|
|
159
|
+
const { relayScopeId: earlierScopeId, ...sealedRest } = sealedSender;
|
|
160
|
+
resolvedSealedSender = {
|
|
161
|
+
...sealedRest,
|
|
162
|
+
signalProtocolRelayScopeId: readRenamedOption(sealedSender.signalProtocolRelayScopeId, earlierScopeId, {
|
|
163
|
+
newName: 'sealedSender.signalProtocolRelayScopeId',
|
|
164
|
+
earlierName: 'sealedSender.relayScopeId',
|
|
165
|
+
operation,
|
|
166
|
+
}),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
...rest,
|
|
171
|
+
...(signalProtocolRelay === undefined ? {} : { signalProtocolRelay }),
|
|
172
|
+
...(resolvedSealedSender === undefined ? {} : { sealedSender: resolvedSealedSender }),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
125
175
|
/** The reason of a `denied` receive outcome. */
|
|
126
176
|
function receiveDenialReason(error) {
|
|
127
177
|
if (error instanceof GroupReceiveRefusedError)
|
|
@@ -168,7 +218,7 @@ export class DefaultSignalProtocolClient {
|
|
|
168
218
|
static #retainedFactory = (createRetainedClient = (userId, config, identities) => DefaultSignalProtocolClient.#createOwned(userId, config, identities));
|
|
169
219
|
manager;
|
|
170
220
|
_storage;
|
|
171
|
-
|
|
221
|
+
signalProtocolRelay;
|
|
172
222
|
remoteObjectStore;
|
|
173
223
|
config;
|
|
174
224
|
_userId;
|
|
@@ -238,7 +288,7 @@ export class DefaultSignalProtocolClient {
|
|
|
238
288
|
get contentRecoveryStatus() {
|
|
239
289
|
return this._contentRecoveryStatus;
|
|
240
290
|
}
|
|
241
|
-
|
|
291
|
+
stoppedSignalProtocolRelayConnection = {
|
|
242
292
|
state: 'stopped',
|
|
243
293
|
since: Date.now(),
|
|
244
294
|
};
|
|
@@ -246,21 +296,31 @@ export class DefaultSignalProtocolClient {
|
|
|
246
296
|
* The connection state of the relay subscription. Reads `stopped` when no
|
|
247
297
|
* relay is configured.
|
|
248
298
|
*
|
|
249
|
-
* @see SignalProtocolClient.
|
|
299
|
+
* @see SignalProtocolClient.signalProtocolRelayConnectionState
|
|
250
300
|
*/
|
|
301
|
+
get signalProtocolRelayConnectionState() {
|
|
302
|
+
return ((this.signalProtocolRelay && signalProtocolRelayConnectionStateOf(this.signalProtocolRelay)) ??
|
|
303
|
+
this.stoppedSignalProtocolRelayConnection);
|
|
304
|
+
}
|
|
305
|
+
/** @deprecated Use `signalProtocolRelayConnectionState`. SDK 15.0.0 removes this name. */
|
|
251
306
|
get relayConnectionState() {
|
|
252
|
-
return this.
|
|
307
|
+
return this.signalProtocolRelayConnectionState;
|
|
253
308
|
}
|
|
254
309
|
/**
|
|
255
310
|
* Subscribe to relay connection transitions. Without a relay, the listener
|
|
256
311
|
* never runs.
|
|
257
312
|
*
|
|
258
|
-
* @see SignalProtocolClient.
|
|
313
|
+
* @see SignalProtocolClient.subscribeSignalProtocolRelayConnectionState
|
|
259
314
|
*/
|
|
315
|
+
subscribeSignalProtocolRelayConnectionState(listener) {
|
|
316
|
+
return ((this.signalProtocolRelay && subscribeSignalProtocolRelayConnectionStateOf(this.signalProtocolRelay, listener)) ??
|
|
317
|
+
(() => undefined));
|
|
318
|
+
}
|
|
319
|
+
/** @deprecated Use `subscribeSignalProtocolRelayConnectionState`. SDK 15.0.0 removes this name. */
|
|
260
320
|
subscribeRelayConnectionState(listener) {
|
|
261
|
-
return this.
|
|
321
|
+
return this.subscribeSignalProtocolRelayConnectionState(listener);
|
|
262
322
|
}
|
|
263
|
-
|
|
323
|
+
signalProtocolRelayUnsubscribe;
|
|
264
324
|
/**
|
|
265
325
|
* Cached sender certificate for sealed sender.
|
|
266
326
|
* Lazily fetched and refreshed one hour before its signed expiration.
|
|
@@ -274,7 +334,7 @@ export class DefaultSignalProtocolClient {
|
|
|
274
334
|
state = new SignalProtocolClientState();
|
|
275
335
|
/**
|
|
276
336
|
* The delivery receipt sends in progress, from a batch timer, the batch
|
|
277
|
-
* bound,
|
|
337
|
+
* bound, stopSignalProtocolRelaySubscription(), or stop(): the relay work item of each
|
|
278
338
|
* send, and the promise that settles when the send finishes. While stop()
|
|
279
339
|
* holds the batches, only stop() starts a send. stop() waits until its
|
|
280
340
|
* receipt deadline for the sends that are in progress when it starts,
|
|
@@ -285,19 +345,19 @@ export class DefaultSignalProtocolClient {
|
|
|
285
345
|
/**
|
|
286
346
|
* Posts the stored retry requests at their next attempt times, ends them
|
|
287
347
|
* at their deadlines, and calls `onRetryTerminal`. create() and
|
|
288
|
-
*
|
|
348
|
+
* startSignalProtocolRelaySubscription() start it when a relay is configured, and stop()
|
|
289
349
|
* stops it. Each pass is relay work, so its hooks run through that work.
|
|
290
350
|
*/
|
|
291
|
-
retryRequests = new RetryRequestScheduler(this.state.
|
|
292
|
-
const
|
|
293
|
-
const context = { ...this.
|
|
351
|
+
retryRequests = new RetryRequestScheduler(this.state.signalRelayWork, (work) => {
|
|
352
|
+
const signalProtocolRelay = this.signalProtocolRelay;
|
|
353
|
+
const context = { ...this.signalRelayWorkContext(work), stopSignal: work.stopSignal };
|
|
294
354
|
return {
|
|
295
355
|
storage: this._storage,
|
|
296
356
|
logger: this.logger,
|
|
297
357
|
hooks: work.wrapHooks(this.hooks),
|
|
298
358
|
local: { userId: this.userId, deviceId: this.deviceId },
|
|
299
|
-
send:
|
|
300
|
-
? retryRequestPost((recipientUserId, recipientDeviceId, payloadBase64) => this.cipher.sealRetryRequest(recipientUserId, recipientDeviceId, payloadBase64),
|
|
359
|
+
send: signalProtocolRelay
|
|
360
|
+
? retryRequestPost((recipientUserId, recipientDeviceId, payloadBase64) => this.cipher.sealRetryRequest(recipientUserId, recipientDeviceId, payloadBase64), signalProtocolRelay, (envelope) => signalProtocolRelay.send(envelope), (recipientUserId, recipientDeviceId) => this.cipher.recipientRegistrationId(recipientUserId, recipientDeviceId), (recipientUserId, recipientDeviceId) => this.refreshRefusedSession(context, recipientUserId, recipientDeviceId))
|
|
301
361
|
: undefined,
|
|
302
362
|
reset: this.retryTerminalReset(context),
|
|
303
363
|
};
|
|
@@ -308,8 +368,8 @@ export class DefaultSignalProtocolClient {
|
|
|
308
368
|
* transition to connected, and stop() stops it. Each pass is relay work,
|
|
309
369
|
* so its hooks run through that work.
|
|
310
370
|
*/
|
|
311
|
-
resendJobs = new ResendJobDriver(this.state.
|
|
312
|
-
const ctx = this.
|
|
371
|
+
resendJobs = new ResendJobDriver(this.state.signalRelayWork, (work) => {
|
|
372
|
+
const ctx = this.signalRelayWorkContext(work);
|
|
313
373
|
return {
|
|
314
374
|
storage: this._storage,
|
|
315
375
|
logger: this.logger,
|
|
@@ -368,9 +428,9 @@ export class DefaultSignalProtocolClient {
|
|
|
368
428
|
this.hooks = config.hooks || {};
|
|
369
429
|
this.contentAdapter = config.contentAdapter ?? createDefaultSignalProtocolContentAdapter();
|
|
370
430
|
// Dependency injection: use the provided relay adapter when configured.
|
|
371
|
-
this.
|
|
431
|
+
this.signalProtocolRelay = config.signalProtocolRelay;
|
|
372
432
|
// A relay adapter that sends relay requests itself shares its bound.
|
|
373
|
-
this.fanOut =
|
|
433
|
+
this.fanOut = clientSignalProtocolRelayFanOut(config.signalProtocolRelay);
|
|
374
434
|
// Dependency injection: use the remote object store for encrypted attachments.
|
|
375
435
|
this.remoteObjectStore = config.remoteObjectStore;
|
|
376
436
|
// Dependency injection: Storage is always provided by create() callers.
|
|
@@ -378,8 +438,8 @@ export class DefaultSignalProtocolClient {
|
|
|
378
438
|
throw new Error('Storage must be provided by DefaultSignalProtocolClient.create() callers');
|
|
379
439
|
}
|
|
380
440
|
this._storage = config.storage;
|
|
381
|
-
this.sendIntents = new SendIntentDriver(this.state.
|
|
382
|
-
const context = this.
|
|
441
|
+
this.sendIntents = new SendIntentDriver(this.state.signalRelayWork, this._storage, this.logger, (work) => {
|
|
442
|
+
const context = this.signalRelayWorkContext(work);
|
|
383
443
|
return {
|
|
384
444
|
end: (clientMessageId, report) => this.cipher.endPastDeadlineIntent(clientMessageId, report),
|
|
385
445
|
replay: async (intent, content, report) => {
|
|
@@ -403,7 +463,7 @@ export class DefaultSignalProtocolClient {
|
|
|
403
463
|
this.contentRecoveryPolicy = resolveContentRecoveryPolicy(config.protocol?.contentRecovery);
|
|
404
464
|
// Each queue pass runs as relay work, so its hooks call the app through
|
|
405
465
|
// that work and a stop ends it. Each hook runs under the receive hook bound.
|
|
406
|
-
this.receiveQueue = new ReceiveQueue(this.state.
|
|
466
|
+
this.receiveQueue = new ReceiveQueue(this.state.signalRelayWork, resolveReceiveQueuePolicy(config.protocol?.receiveQueue), (work) => {
|
|
407
467
|
const ctx = this.receivePassContext(work);
|
|
408
468
|
return {
|
|
409
469
|
ctx: {
|
|
@@ -412,8 +472,8 @@ export class DefaultSignalProtocolClient {
|
|
|
412
472
|
receiveQueue: this.receiveQueue,
|
|
413
473
|
stopSignal: work.stopSignal,
|
|
414
474
|
},
|
|
415
|
-
state: this.
|
|
416
|
-
callbacks: this.
|
|
475
|
+
state: this.signalRelaySubscriptionState,
|
|
476
|
+
callbacks: this.signalRelaySubscriptionCallbacks(ctx, work.stopSignal),
|
|
417
477
|
};
|
|
418
478
|
}, () => this.cleanupStaleDeviceRecords());
|
|
419
479
|
this._contentRecoveryStatus = decideContentRecovery(readLocalStoreProtection(this._storage), this.contentRecoveryPolicy, config.groups?.resolveAciBytesByUserIds
|
|
@@ -466,7 +526,7 @@ export class DefaultSignalProtocolClient {
|
|
|
466
526
|
const cached = sessions.get(authority);
|
|
467
527
|
if (cached)
|
|
468
528
|
return cached;
|
|
469
|
-
const capability = this.
|
|
529
|
+
const capability = this.signalProtocolRelay?.groupServer;
|
|
470
530
|
const server = groupConfig.server ?? capability?.server;
|
|
471
531
|
const issueCredential = groupConfig.issueCredential ??
|
|
472
532
|
(capability ? () => capability.issueAuthCredential(this._userId, authority.authorityKeyId) : undefined);
|
|
@@ -522,13 +582,13 @@ export class DefaultSignalProtocolClient {
|
|
|
522
582
|
this.groupManager = this.groupSessionFor(config.groups).manager;
|
|
523
583
|
}
|
|
524
584
|
// Initialize cipher for encrypt/decrypt coordination
|
|
525
|
-
this.cipher = new SignalProtocolServiceCipher(this._userId, deviceId, this.sesameManager, this.senderKeyManager, this._storage, this.
|
|
585
|
+
this.cipher = new SignalProtocolServiceCipher(this._userId, deviceId, this.sesameManager, this.senderKeyManager, this._storage, this.signalProtocolRelay, this.remoteObjectStore, this.contentAdapter, this.logger, this.fanOut);
|
|
526
586
|
if (this.groupManager) {
|
|
527
587
|
this.cipher.setGroupSendBarrierChecker((groupId) => this.groupManager.assertGroupSendAllowed(groupId));
|
|
528
588
|
}
|
|
529
589
|
// The client applies each Relay delivery receipt of its relay.
|
|
530
|
-
if (this.
|
|
531
|
-
|
|
590
|
+
if (this.signalProtocolRelay) {
|
|
591
|
+
signalRelayReceiptIntakeOf(this.signalProtocolRelay)?.subscribe((receipt) => this.receiveSignalProtocolRelayReceipt(receipt));
|
|
532
592
|
}
|
|
533
593
|
// Set up auto-session establishment and stale-session refresh.
|
|
534
594
|
// This enables lazy session creation when sending to users without established sessions
|
|
@@ -536,7 +596,7 @@ export class DefaultSignalProtocolClient {
|
|
|
536
596
|
if (sessions)
|
|
537
597
|
this.cipher.setSessionCallbacks(sessions);
|
|
538
598
|
// A sync payload has no send result, so the cipher reports its error.
|
|
539
|
-
this.cipher.
|
|
599
|
+
this.cipher.setSignalProtocolRelayProtocolErrorReporter((error) => callHook(this.hooks, 'onSignalProtocolRelayProtocolError', error));
|
|
540
600
|
if (config?.sealedSender) {
|
|
541
601
|
this.cipher.setSealedSenderDeliveryMode(config.sealedSender.deliveryMode ?? 'preferred');
|
|
542
602
|
if (config.sealedSender.onIdentifiedFallback) {
|
|
@@ -582,7 +642,7 @@ export class DefaultSignalProtocolClient {
|
|
|
582
642
|
// The receive queue owns the content that waits on a group.
|
|
583
643
|
hasBlockedContent: async (groupId) => (await this._storage.receiveWorkUsage({ groupId })).items > 0,
|
|
584
644
|
onFetched: (groupId) => this.receiveQueue.wake(groupId),
|
|
585
|
-
runInBackground: (pass) => this.state.
|
|
645
|
+
runInBackground: (pass) => this.state.signalRelayWork.run(() => pass()),
|
|
586
646
|
logger: this.logger,
|
|
587
647
|
});
|
|
588
648
|
this.groupFetcher = fetcher;
|
|
@@ -593,7 +653,7 @@ export class DefaultSignalProtocolClient {
|
|
|
593
653
|
...(config.aci?.uuid && { localAci: config.aci.uuid }),
|
|
594
654
|
ownDevices: () => this.cipher.localOwnSyncDevices(),
|
|
595
655
|
send: (input, deviceIds, stopSignal) => this.cipher.sendGroupKeySyncToLocalOtherDevices(input, deviceIds, stopSignal),
|
|
596
|
-
runInBackground: (job) => this.state.
|
|
656
|
+
runInBackground: (job) => this.state.signalRelayWork.run((work) => job(work.stopSignal)),
|
|
597
657
|
logger: this.logger,
|
|
598
658
|
});
|
|
599
659
|
this.groupKeySync = keySync;
|
|
@@ -637,11 +697,11 @@ export class DefaultSignalProtocolClient {
|
|
|
637
697
|
// missing members.
|
|
638
698
|
if (config?.groups?.endorsementManager &&
|
|
639
699
|
this.groupStore &&
|
|
640
|
-
this.
|
|
700
|
+
this.signalProtocolRelay?.refreshGroupSendEndorsements &&
|
|
641
701
|
this.groupManager) {
|
|
642
702
|
const groupConfig = config.groups;
|
|
643
703
|
const groupStore = this.groupStore;
|
|
644
|
-
const
|
|
704
|
+
const signalProtocolRelay = this.signalProtocolRelay;
|
|
645
705
|
const selfUserId = this._userId;
|
|
646
706
|
this.cipher.setEndorsementRefresher(async (groupId, memberUserIds) => {
|
|
647
707
|
const { manager: groupManager, endorsementManager } = await this.resolveGroupSession();
|
|
@@ -657,7 +717,7 @@ export class DefaultSignalProtocolClient {
|
|
|
657
717
|
// 3. Derive the protocol identifier, not the display identifier's UTF-8 bytes.
|
|
658
718
|
const groupIdBytes = getGroupPublicParams(secretParams).groupId;
|
|
659
719
|
// 4. Fetch fresh endorsements from server
|
|
660
|
-
const { endorsements } = await
|
|
720
|
+
const { endorsements } = await signalProtocolRelay.refreshGroupSendEndorsements(groupIdBytes, authorization);
|
|
661
721
|
// 5. Get cached group state for member ordering (server order)
|
|
662
722
|
const state = await groupStore.getGroupState(groupId);
|
|
663
723
|
if (!state || state.members.length === 0)
|
|
@@ -716,7 +776,8 @@ export class DefaultSignalProtocolClient {
|
|
|
716
776
|
deviceId: this.deviceId,
|
|
717
777
|
manager: this.manager,
|
|
718
778
|
storage: this._storage,
|
|
719
|
-
|
|
779
|
+
signalProtocolRelay: this.signalProtocolRelay,
|
|
780
|
+
relay: this.signalProtocolRelay,
|
|
720
781
|
remoteObjectStore: this.remoteObjectStore,
|
|
721
782
|
config: this.config,
|
|
722
783
|
logger: this.logger,
|
|
@@ -741,11 +802,11 @@ export class DefaultSignalProtocolClient {
|
|
|
741
802
|
* `onDelivered` hook. The replay announces each delivery whose hook did not
|
|
742
803
|
* return.
|
|
743
804
|
*/
|
|
744
|
-
async
|
|
805
|
+
async receiveSignalProtocolRelayReceipt(receipt) {
|
|
745
806
|
let announced = false;
|
|
746
|
-
await this.state.
|
|
807
|
+
await this.state.signalRelayWork.run(async (work) => {
|
|
747
808
|
work.proceed();
|
|
748
|
-
const events = await this.deliveries.
|
|
809
|
+
const events = await this.deliveries.applySignalProtocolRelayReceipt(receipt);
|
|
749
810
|
await this.deliveries.announce(work.wrapHooks(this.hooks), events);
|
|
750
811
|
announced = true;
|
|
751
812
|
});
|
|
@@ -758,7 +819,7 @@ export class DefaultSignalProtocolClient {
|
|
|
758
819
|
* the next receipt for the message announces it again.
|
|
759
820
|
*/
|
|
760
821
|
releaseDeliveries(clientMessageId) {
|
|
761
|
-
void this.state.
|
|
822
|
+
void this.state.signalRelayWork
|
|
762
823
|
.run(async (work) => {
|
|
763
824
|
work.proceed();
|
|
764
825
|
const events = await this.deliveries.release(clientMessageId);
|
|
@@ -802,8 +863,8 @@ export class DefaultSignalProtocolClient {
|
|
|
802
863
|
if (sealedSender.certificateProvider) {
|
|
803
864
|
certBase64 = await sealedSender.certificateProvider();
|
|
804
865
|
}
|
|
805
|
-
else if (this.
|
|
806
|
-
certBase64 = await this.
|
|
866
|
+
else if (this.signalProtocolRelay?.fetchSenderCertificate) {
|
|
867
|
+
certBase64 = await this.signalProtocolRelay.fetchSenderCertificate(this.deviceId);
|
|
807
868
|
}
|
|
808
869
|
else {
|
|
809
870
|
throw new EncryptionError('No sender certificate provider configured. Set sealedSender.certificateProvider or use a relay that supports fetchSenderCertificate.', EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
@@ -812,7 +873,7 @@ export class DefaultSignalProtocolClient {
|
|
|
812
873
|
try {
|
|
813
874
|
certificate = deserializeSenderCertificate(base64ToBytes(certBase64));
|
|
814
875
|
await validateSenderCertificate(certificate, sealedSender.trustRoots.map((root) => bytesToBase64(root)), now, {
|
|
815
|
-
expectedRelayScopeId: bytesToBase64(sealedSender
|
|
876
|
+
expectedRelayScopeId: bytesToBase64(sealedSenderSignalProtocolRelayScopeId(sealedSender)),
|
|
816
877
|
revokedIssuerKeyIds: sealedSender.revokedIssuerKeyIds,
|
|
817
878
|
});
|
|
818
879
|
const identity = await this._storage.getIdentityKey();
|
|
@@ -885,10 +946,10 @@ export class DefaultSignalProtocolClient {
|
|
|
885
946
|
};
|
|
886
947
|
}
|
|
887
948
|
/**
|
|
888
|
-
* Get relay subscription state (passed to relay-subscription module)
|
|
949
|
+
* Get relay subscription state (passed to signal-relay-subscription module)
|
|
889
950
|
*/
|
|
890
|
-
get
|
|
891
|
-
return this.state.
|
|
951
|
+
get signalRelaySubscriptionState() {
|
|
952
|
+
return this.state.getSignalProtocolRelaySubscriptionState();
|
|
892
953
|
}
|
|
893
954
|
/**
|
|
894
955
|
* Get relay subscription callbacks (delegate back to DefaultSignalProtocolClient methods).
|
|
@@ -897,12 +958,12 @@ export class DefaultSignalProtocolClient {
|
|
|
897
958
|
* its own. A retry request runs in the current work, so a stop of that work
|
|
898
959
|
* reaches the receive route, and the route keeps the request envelope.
|
|
899
960
|
*/
|
|
900
|
-
|
|
961
|
+
signalRelaySubscriptionCallbacks(ctx, stopSignal) {
|
|
901
962
|
return {
|
|
902
963
|
forcePreKeyRotation: () => this.regeneratePreKeysWithFreshIds(),
|
|
903
964
|
handleDeliveryReceipt: (envelope, receipt) => this.handleDeliveryReceipt(envelope, receipt, ctx),
|
|
904
965
|
handleTypingIndicator: (envelope, typing) => this.handleTypingIndicator(envelope, typing, ctx),
|
|
905
|
-
sendDeliveryReceipt: (userId, timestamps) => this.
|
|
966
|
+
sendDeliveryReceipt: (userId, timestamps) => this.sendDeliveryReceiptAsSignalProtocolRelayWork(userId, timestamps),
|
|
906
967
|
handleRetryRequest: (request, retry) => RetryOps.handleRetryRequestAndResend(ctx, request, this.retryResponseState, this.retryCallbacks(stopSignal, ctx), this.retryConfig, retry),
|
|
907
968
|
};
|
|
908
969
|
}
|
|
@@ -916,12 +977,12 @@ export class DefaultSignalProtocolClient {
|
|
|
916
977
|
* so the receive queue keeps the receipt and sends it after the next
|
|
917
978
|
* start
|
|
918
979
|
*/
|
|
919
|
-
async
|
|
980
|
+
async sendDeliveryReceiptAsSignalProtocolRelayWork(userId, timestamps) {
|
|
920
981
|
let sent = false;
|
|
921
|
-
await this.state.
|
|
982
|
+
await this.state.signalRelayWork.run(async (work) => {
|
|
922
983
|
const send = this.sendDeliveryReceipt(userId, timestamps, {
|
|
923
|
-
...this.
|
|
924
|
-
stopSignal: this.state.
|
|
984
|
+
...this.signalRelayWorkContext(work),
|
|
985
|
+
stopSignal: this.state.signalRelayWork.stopSignal,
|
|
925
986
|
});
|
|
926
987
|
this.deliveryReceiptSends.set(work, send);
|
|
927
988
|
try {
|
|
@@ -941,7 +1002,7 @@ export class DefaultSignalProtocolClient {
|
|
|
941
1002
|
* promises settle when the sends finish. They never reject.
|
|
942
1003
|
*/
|
|
943
1004
|
flushPendingDeliveryReceipts() {
|
|
944
|
-
return
|
|
1005
|
+
return SignalProtocolRelaySubscriptionOps.flushPendingReceipts(this.signalRelaySubscriptionState.receiptAccumulator, (userId, timestamps) => this.sendDeliveryReceiptAsSignalProtocolRelayWork(userId, timestamps), this.logger);
|
|
945
1006
|
}
|
|
946
1007
|
/**
|
|
947
1008
|
* Wait for the receipt sends that stop() waits for, with their app hooks,
|
|
@@ -966,8 +1027,8 @@ export class DefaultSignalProtocolClient {
|
|
|
966
1027
|
* requests. There are none without a relay.
|
|
967
1028
|
*/
|
|
968
1029
|
retryTerminalReset(context) {
|
|
969
|
-
const
|
|
970
|
-
if (!
|
|
1030
|
+
const signalProtocolRelay = this.signalProtocolRelay;
|
|
1031
|
+
if (!signalProtocolRelay)
|
|
971
1032
|
return undefined;
|
|
972
1033
|
const { stopSignal } = context;
|
|
973
1034
|
return {
|
|
@@ -987,7 +1048,7 @@ export class DefaultSignalProtocolClient {
|
|
|
987
1048
|
sendNullMessage: async ({ userId, deviceId }) => {
|
|
988
1049
|
const address = ProtocolAddress.create(userId, deviceId);
|
|
989
1050
|
if (!(await SessionOps.hasSession(context, address))) {
|
|
990
|
-
const bundle = await this.fanOut.request(() =>
|
|
1051
|
+
const bundle = await this.fanOut.request(() => signalProtocolRelay.fetchPreKeyBundle(userId, deviceId), stopSignal);
|
|
991
1052
|
if (!bundle)
|
|
992
1053
|
throw new Error('No prekey bundle for the device of a session reset');
|
|
993
1054
|
await SessionOps.establishSession(context, this.sesameManager, address, bundle);
|
|
@@ -1011,12 +1072,12 @@ export class DefaultSignalProtocolClient {
|
|
|
1011
1072
|
* session, and the next post uses it.
|
|
1012
1073
|
*/
|
|
1013
1074
|
async refreshRefusedSession(context, recipientUserId, recipientDeviceId) {
|
|
1014
|
-
const
|
|
1015
|
-
if (!
|
|
1075
|
+
const signalProtocolRelay = this.signalProtocolRelay;
|
|
1076
|
+
if (!signalProtocolRelay)
|
|
1016
1077
|
return false;
|
|
1017
1078
|
const address = ProtocolAddress.create(recipientUserId, recipientDeviceId);
|
|
1018
1079
|
try {
|
|
1019
|
-
const freshBundle = await this.fanOut.request(() =>
|
|
1080
|
+
const freshBundle = await this.fanOut.request(() => signalProtocolRelay.fetchPreKeyBundle(recipientUserId, recipientDeviceId), context.stopSignal);
|
|
1020
1081
|
if (!freshBundle) {
|
|
1021
1082
|
// Per SESAME §3.2: the session is archived, not deleted, to decrypt
|
|
1022
1083
|
// delayed messages. No bundle is terminal for the post.
|
|
@@ -1044,7 +1105,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1044
1105
|
return true;
|
|
1045
1106
|
}
|
|
1046
1107
|
catch (error) {
|
|
1047
|
-
|
|
1108
|
+
rethrowSignalProtocolRelayWorkStopped(error);
|
|
1048
1109
|
this.logger.warn('Failed to refresh stale session, the post retries', {
|
|
1049
1110
|
category: 'E2EE',
|
|
1050
1111
|
data: { recipientUserId, recipientDeviceId, error: error.message },
|
|
@@ -1053,7 +1114,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1053
1114
|
}
|
|
1054
1115
|
}
|
|
1055
1116
|
/** Client context whose hooks call the app through the given relay work. */
|
|
1056
|
-
|
|
1117
|
+
signalRelayWorkContext(work) {
|
|
1057
1118
|
return { ...this.ctx, hooks: work.wrapHooks(this.hooks) };
|
|
1058
1119
|
}
|
|
1059
1120
|
/**
|
|
@@ -1072,14 +1133,14 @@ export class DefaultSignalProtocolClient {
|
|
|
1072
1133
|
* the stop signal ends it. There are none without a relay.
|
|
1073
1134
|
*/
|
|
1074
1135
|
sendSessionCallbacks(context, stopSignal) {
|
|
1075
|
-
const
|
|
1076
|
-
if (!
|
|
1136
|
+
const signalProtocolRelay = this.signalProtocolRelay;
|
|
1137
|
+
if (!signalProtocolRelay)
|
|
1077
1138
|
return undefined;
|
|
1078
1139
|
const establishSession = (address, bundle) => SessionOps.establishSession(context(), this.sesameManager, address, bundle);
|
|
1079
1140
|
return {
|
|
1080
|
-
establishSessions: (recipientUserId, listedDevices) => establishMultiDeviceSessions(this,
|
|
1141
|
+
establishSessions: (recipientUserId, listedDevices) => establishMultiDeviceSessions(this, signalProtocolRelay, recipientUserId, {
|
|
1081
1142
|
establishSession,
|
|
1082
|
-
rethrowFatal:
|
|
1143
|
+
rethrowFatal: rethrowSignalProtocolRelayWorkStopped,
|
|
1083
1144
|
fanOut: this.fanOut,
|
|
1084
1145
|
stopSignal,
|
|
1085
1146
|
...(listedDevices && { listedDevices }),
|
|
@@ -1097,7 +1158,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1097
1158
|
data: { recipientUserId, recipientDeviceId },
|
|
1098
1159
|
});
|
|
1099
1160
|
// 2. Fetch fresh prekey bundle
|
|
1100
|
-
const freshBundle = await this.fanOut.request(() =>
|
|
1161
|
+
const freshBundle = await this.fanOut.request(() => signalProtocolRelay.fetchPreKeyBundle(recipientUserId, recipientDeviceId), stopSignal);
|
|
1101
1162
|
if (!freshBundle) {
|
|
1102
1163
|
this.logger.warn('No prekey bundle available for stale session refresh', {
|
|
1103
1164
|
category: 'E2EE',
|
|
@@ -1119,7 +1180,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1119
1180
|
return true;
|
|
1120
1181
|
}
|
|
1121
1182
|
catch (error) {
|
|
1122
|
-
|
|
1183
|
+
rethrowSignalProtocolRelayWorkStopped(error);
|
|
1123
1184
|
this.logger.error('Failed to refresh stale session', {
|
|
1124
1185
|
category: 'E2EE',
|
|
1125
1186
|
data: {
|
|
@@ -1154,7 +1215,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1154
1215
|
/**
|
|
1155
1216
|
* Get relay subscription config
|
|
1156
1217
|
*/
|
|
1157
|
-
get
|
|
1218
|
+
get signalRelaySubscriptionConfig() {
|
|
1158
1219
|
return {
|
|
1159
1220
|
keyRotationDebounceMs: SIGNAL_PROTOCOL_CLIENT_CONSTANTS.KEY_ROTATION_DEBOUNCE_MS,
|
|
1160
1221
|
};
|
|
@@ -1189,10 +1250,10 @@ export class DefaultSignalProtocolClient {
|
|
|
1189
1250
|
* });
|
|
1190
1251
|
*
|
|
1191
1252
|
* // With an application-owned authenticated relay transport.
|
|
1192
|
-
* const
|
|
1253
|
+
* const signalProtocolRelay = appSignalProtocolRelayTransport;
|
|
1193
1254
|
* const signal = await DefaultSignalProtocolClient.create('user-123', {
|
|
1194
1255
|
* storage,
|
|
1195
|
-
*
|
|
1256
|
+
* signalProtocolRelay,
|
|
1196
1257
|
* onProgress: ({ stage, percent, message }) => {
|
|
1197
1258
|
* console.log(`${stage}: ${percent}% - ${message}`);
|
|
1198
1259
|
* }
|
|
@@ -1202,7 +1263,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1202
1263
|
* const signal = await DefaultSignalProtocolClient.create('user-123', {
|
|
1203
1264
|
* deviceId: 1,
|
|
1204
1265
|
* storage,
|
|
1205
|
-
*
|
|
1266
|
+
* signalProtocolRelay,
|
|
1206
1267
|
* protocol: { postQuantum: 'required', braid: 'required' },
|
|
1207
1268
|
* onProgress,
|
|
1208
1269
|
* enableDebugLogging: true,
|
|
@@ -1220,6 +1281,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1220
1281
|
return DefaultSignalProtocolClient.#createOwned(userId, config);
|
|
1221
1282
|
}
|
|
1222
1283
|
static async #createOwned(userId, config, retained) {
|
|
1284
|
+
config = withSignalProtocolRelayNames(config);
|
|
1223
1285
|
const deviceId = config?.deviceId ?? 1; // Default to primary device
|
|
1224
1286
|
// Use locking to prevent race conditions when multiple create() calls happen concurrently.
|
|
1225
1287
|
// The lock allows only one storage instance per userId, which prevents database lock
|
|
@@ -1289,7 +1351,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1289
1351
|
}
|
|
1290
1352
|
// Auto-sync to server if relay provided
|
|
1291
1353
|
let syncFailed = false;
|
|
1292
|
-
if (finalConfig?.
|
|
1354
|
+
if (finalConfig?.signalProtocolRelay) {
|
|
1293
1355
|
try {
|
|
1294
1356
|
await client.syncToServer(finalConfig.onProgress);
|
|
1295
1357
|
}
|
|
@@ -1301,18 +1363,18 @@ export class DefaultSignalProtocolClient {
|
|
|
1301
1363
|
syncFailed = true;
|
|
1302
1364
|
}
|
|
1303
1365
|
}
|
|
1304
|
-
client._syncStatus = finalConfig?.
|
|
1366
|
+
client._syncStatus = finalConfig?.signalProtocolRelay ? (syncFailed ? 'failed' : 'synced') : 'none';
|
|
1305
1367
|
// Start relay subscription if relay is configured with onMessageDecrypted hook
|
|
1306
1368
|
// Only subscribe if sync succeeded - subscriptions require a valid server session
|
|
1307
|
-
if (!syncFailed && finalConfig?.
|
|
1308
|
-
client.
|
|
1369
|
+
if (!syncFailed && finalConfig?.signalProtocolRelay && finalConfig?.hooks?.onMessageDecrypted) {
|
|
1370
|
+
client.startSignalProtocolRelaySubscription();
|
|
1309
1371
|
}
|
|
1310
1372
|
// Post the stored retry requests whose next attempt time has come, and
|
|
1311
1373
|
// end the requests past their deadlines. Run the pending resend jobs.
|
|
1312
1374
|
// The passes run in the background.
|
|
1313
1375
|
// The receive queue resumes the stored receive records first. With no
|
|
1314
1376
|
// relay, it serves the helper receives alone.
|
|
1315
|
-
if (finalConfig?.
|
|
1377
|
+
if (finalConfig?.signalProtocolRelay)
|
|
1316
1378
|
client.startRetryRequests();
|
|
1317
1379
|
else
|
|
1318
1380
|
void client.receiveQueue.start();
|
|
@@ -1400,7 +1462,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1400
1462
|
* Normal sync and the managed device link never call this operation.
|
|
1401
1463
|
*/
|
|
1402
1464
|
async rotateAccountIdentity(expectedCurrentCommitment, identityType = 'aci') {
|
|
1403
|
-
if (!this.config.
|
|
1465
|
+
if (!this.config.signalProtocolRelay) {
|
|
1404
1466
|
throw new EncryptionError('Relay server not configured', EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
1405
1467
|
}
|
|
1406
1468
|
if (expectedCurrentCommitment.length !== 32) {
|
|
@@ -1412,7 +1474,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1412
1474
|
}
|
|
1413
1475
|
this._syncStatus = 'failed';
|
|
1414
1476
|
try {
|
|
1415
|
-
await this.config.
|
|
1477
|
+
await this.config.signalProtocolRelay.rotateIdentityKey({
|
|
1416
1478
|
userId: this.userId,
|
|
1417
1479
|
deviceId: this.deviceId,
|
|
1418
1480
|
identity: createCompositeIdentityV1(replacement),
|
|
@@ -1557,7 +1619,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1557
1619
|
async regeneratePreKeysWithFreshIds() {
|
|
1558
1620
|
await PreKeyOps.regeneratePreKeysWithFreshIds(this.ctx);
|
|
1559
1621
|
const now = Date.now();
|
|
1560
|
-
// Update debounce timestamp so concurrent call sites (relay-subscription + retry.ts)
|
|
1622
|
+
// Update debounce timestamp so concurrent call sites (signal-relay-subscription + retry.ts)
|
|
1561
1623
|
// do not both trigger rotation for the same stale prekey event.
|
|
1562
1624
|
this.state.setLastPreKeyRotationTime(now);
|
|
1563
1625
|
// Persist the debounce timestamp across application restarts.
|
|
@@ -1697,8 +1759,8 @@ export class DefaultSignalProtocolClient {
|
|
|
1697
1759
|
async markMessageDeliveredSilently(envelopeId, options) {
|
|
1698
1760
|
if (!envelopeId)
|
|
1699
1761
|
return;
|
|
1700
|
-
if (this.
|
|
1701
|
-
await this.
|
|
1762
|
+
if (this.signalProtocolRelay?.markDelivered) {
|
|
1763
|
+
await this.signalProtocolRelay.markDelivered(envelopeId).catch((_error) => {
|
|
1702
1764
|
this.logger.warn('Failed to mark delivered', {
|
|
1703
1765
|
category: 'E2EE',
|
|
1704
1766
|
data: { envelopeId },
|
|
@@ -1977,7 +2039,7 @@ export class DefaultSignalProtocolClient {
|
|
|
1977
2039
|
}
|
|
1978
2040
|
let commit;
|
|
1979
2041
|
try {
|
|
1980
|
-
commit = await this.cipher.commitEnvelope(this.
|
|
2042
|
+
commit = await this.cipher.commitEnvelope(this.signalRelayEnvelopeOf(envelope), {
|
|
1981
2043
|
sealedSender: this.config.sealedSender,
|
|
1982
2044
|
});
|
|
1983
2045
|
}
|
|
@@ -2007,7 +2069,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2007
2069
|
};
|
|
2008
2070
|
}
|
|
2009
2071
|
/** The Relay envelope of an envelope that the application passed. */
|
|
2010
|
-
|
|
2072
|
+
signalRelayEnvelopeOf(envelope) {
|
|
2011
2073
|
return {
|
|
2012
2074
|
...envelope,
|
|
2013
2075
|
targetUserId: this.userId,
|
|
@@ -2054,7 +2116,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2054
2116
|
return { outcome: { kind: 'duplicate' } };
|
|
2055
2117
|
}
|
|
2056
2118
|
// The receive queue delivers a Relay record to onMessageDecrypted.
|
|
2057
|
-
if (record.origin
|
|
2119
|
+
if (isSignalProtocolRelayOrigin(record.origin)) {
|
|
2058
2120
|
return {
|
|
2059
2121
|
outcome: { kind: 'pending', messageId: record.messageId, reason: 'queued' },
|
|
2060
2122
|
};
|
|
@@ -2102,7 +2164,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2102
2164
|
senderKeyDistribution: content.inspected.senderKeyDistribution !== undefined,
|
|
2103
2165
|
content: content.inspected.senderKeyDistribution === undefined ||
|
|
2104
2166
|
content.inspected.senderKeyDistributionOnly === false,
|
|
2105
|
-
...
|
|
2167
|
+
...SignalProtocolRelaySubscriptionOps.groupOfFulfill(content),
|
|
2106
2168
|
});
|
|
2107
2169
|
// A GroupKeySync from an own device is SDK content, so the caller
|
|
2108
2170
|
// never gets it.
|
|
@@ -2211,7 +2273,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2211
2273
|
const failure = { reported: false };
|
|
2212
2274
|
let admitted;
|
|
2213
2275
|
try {
|
|
2214
|
-
const seed = handle.commit.seed(this.
|
|
2276
|
+
const seed = handle.commit.seed(this.signalRelayEnvelopeOf(inner), arrivedSealed);
|
|
2215
2277
|
if (inner.messageType === 'sender_key') {
|
|
2216
2278
|
// `sender_key` says the payload is a framed SenderKeyMessage. It
|
|
2217
2279
|
// does not say which group, so the group comes from the frame's
|
|
@@ -2319,7 +2381,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2319
2381
|
return {
|
|
2320
2382
|
messageId: record.messageId,
|
|
2321
2383
|
stage: ready ? 'awaiting-completion' : 'decrypted',
|
|
2322
|
-
origin: record.origin,
|
|
2384
|
+
origin: reportedReceiveWorkOrigin(record.origin),
|
|
2323
2385
|
receivedAt: record.receivedAt,
|
|
2324
2386
|
senderId: record.senderUserId,
|
|
2325
2387
|
senderDeviceId: record.senderDeviceId,
|
|
@@ -2387,7 +2449,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2387
2449
|
*
|
|
2388
2450
|
* The content reaches onMessageDecrypted in a later pass of the receive
|
|
2389
2451
|
* queue, after this call returns. After `stop()`, the content waits for
|
|
2390
|
-
* the next start of the queue from `
|
|
2452
|
+
* the next start of the queue from `startSignalProtocolRelaySubscription`, or for
|
|
2391
2453
|
* `processPendingReceives`.
|
|
2392
2454
|
*/
|
|
2393
2455
|
async receiveIncomingEnvelopes(envelopes) {
|
|
@@ -2419,7 +2481,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2419
2481
|
for (const envelope of sortEnvelopesForDecryption(envelopes)) {
|
|
2420
2482
|
releases.push(this.receiveQueue.hold(await deliveredEnvelopeFingerprint(this.userId, this.deviceId, envelope)));
|
|
2421
2483
|
try {
|
|
2422
|
-
const processed = await
|
|
2484
|
+
const processed = await SignalProtocolRelaySubscriptionOps.processSignalProtocolRelayMessage(context, this.signalRelayEnvelopeOf(envelope), this.signalRelaySubscriptionState, this.signalRelaySubscriptionCallbacks(context), { ...this.signalRelaySubscriptionConfig, acknowledgeFailures: false });
|
|
2423
2485
|
(processed ? processedMessageIds : failedMessageIds).push(envelope.id);
|
|
2424
2486
|
}
|
|
2425
2487
|
catch {
|
|
@@ -2529,13 +2591,13 @@ export class DefaultSignalProtocolClient {
|
|
|
2529
2591
|
* receipt of a shared body), it throws the first such refusal. Otherwise it
|
|
2530
2592
|
* throws an `Error` with the stored code of the first refused device that
|
|
2531
2593
|
* has one, in the order of the destinations. Otherwise it throws
|
|
2532
|
-
* `
|
|
2594
|
+
* `SendNeverAcceptedBySignalProtocolRelayError` with code `SEND_NEVER_ACCEPTED`. A send
|
|
2533
2595
|
* error before the deadline gives `deadlineAt`, and `retryable` is true
|
|
2534
2596
|
* when a replay can still post the send.
|
|
2535
2597
|
*
|
|
2536
2598
|
* A backdated `timestamp` shortens the deadline. A send with a timestamp
|
|
2537
2599
|
* 23 hours old has at most 1 hour to post. A send with a timestamp 24 hours
|
|
2538
|
-
* old posts nothing and throws `
|
|
2600
|
+
* old posts nothing and throws `SendNeverAcceptedBySignalProtocolRelayError`.
|
|
2539
2601
|
*
|
|
2540
2602
|
* @param recipientId - User ID or group ID (groups use the package group ID prefix)
|
|
2541
2603
|
* @param content - DataMessageInput, string, or Uint8Array to encrypt and send
|
|
@@ -2715,12 +2777,12 @@ export class DefaultSignalProtocolClient {
|
|
|
2715
2777
|
}
|
|
2716
2778
|
// A Relay that accepted a declared post without comparing it does not
|
|
2717
2779
|
// change the result. The hook reports it once for the completed send.
|
|
2718
|
-
const protocolError =
|
|
2780
|
+
const protocolError = signalRelayProtocolErrorOf(result);
|
|
2719
2781
|
this.releaseDeliveries(clientMessageId);
|
|
2720
2782
|
if (profileKey)
|
|
2721
2783
|
await profileKeys?.delivered(recipientId, profileKey);
|
|
2722
2784
|
if (protocolError)
|
|
2723
|
-
await callHook(context.hooks, '
|
|
2785
|
+
await callHook(context.hooks, 'onSignalProtocolRelayProtocolError', protocolError);
|
|
2724
2786
|
return result;
|
|
2725
2787
|
}
|
|
2726
2788
|
/** @see SignalProtocolClient.resendMessage */
|
|
@@ -2825,10 +2887,10 @@ export class DefaultSignalProtocolClient {
|
|
|
2825
2887
|
* ```
|
|
2826
2888
|
*/
|
|
2827
2889
|
async markAsRead(messageId) {
|
|
2828
|
-
if (!this.
|
|
2890
|
+
if (!this.signalProtocolRelay) {
|
|
2829
2891
|
throw new EncryptionError('Relay server not configured', EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
2830
2892
|
}
|
|
2831
|
-
await this.
|
|
2893
|
+
await this.signalProtocolRelay.markDelivered(messageId);
|
|
2832
2894
|
this.logger.debug('Message marked as read', {
|
|
2833
2895
|
category: 'E2EE',
|
|
2834
2896
|
data: { messageId },
|
|
@@ -2850,7 +2912,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2850
2912
|
* @example
|
|
2851
2913
|
* ```typescript
|
|
2852
2914
|
* // In ServicesProvider: wire up ContentManager after creation
|
|
2853
|
-
* const signal = await DefaultSignalProtocolClient.create(userId, { storage,
|
|
2915
|
+
* const signal = await DefaultSignalProtocolClient.create(userId, { storage, signalProtocolRelay });
|
|
2854
2916
|
* const content = new ContentManager({ db, signal });
|
|
2855
2917
|
*
|
|
2856
2918
|
* signal.registerHook('onMessageDecrypted', content.getDecryptionHook());
|
|
@@ -2861,7 +2923,8 @@ export class DefaultSignalProtocolClient {
|
|
|
2861
2923
|
*/
|
|
2862
2924
|
registerHook(name, callback) {
|
|
2863
2925
|
assertHookName(name);
|
|
2864
|
-
|
|
2926
|
+
// A deprecated hook name registers the hook under its new name.
|
|
2927
|
+
this.hooks[currentHookName(name)] = callback;
|
|
2865
2928
|
// Received content waits for this hook, or failed in the hook before.
|
|
2866
2929
|
if (name === 'onMessageDecrypted')
|
|
2867
2930
|
this.receiveQueue.retryFailedHooks();
|
|
@@ -2871,7 +2934,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2871
2934
|
});
|
|
2872
2935
|
}
|
|
2873
2936
|
// ============================================================================
|
|
2874
|
-
// RELAY SUBSCRIPTION (Auto-decrypt and notify ContentManager via hook)
|
|
2937
|
+
// SIGNAL PROTOCOL RELAY SUBSCRIPTION (Auto-decrypt and notify ContentManager via hook)
|
|
2875
2938
|
// ============================================================================
|
|
2876
2939
|
/**
|
|
2877
2940
|
* Start relay subscription for automatic message decryption
|
|
@@ -2890,10 +2953,10 @@ export class DefaultSignalProtocolClient {
|
|
|
2890
2953
|
* A call while stop() runs is refused and logged; start again after stop()
|
|
2891
2954
|
* resolves.
|
|
2892
2955
|
*
|
|
2893
|
-
* @see SignalProtocolClient.
|
|
2956
|
+
* @see SignalProtocolClient.startSignalProtocolRelaySubscription
|
|
2894
2957
|
*/
|
|
2895
|
-
|
|
2896
|
-
if (!this.
|
|
2958
|
+
startSignalProtocolRelaySubscription() {
|
|
2959
|
+
if (!this.signalProtocolRelay) {
|
|
2897
2960
|
this.logger.warn('Cannot start relay subscription: relay not configured', {
|
|
2898
2961
|
category: 'E2EE',
|
|
2899
2962
|
});
|
|
@@ -2913,7 +2976,7 @@ export class DefaultSignalProtocolClient {
|
|
|
2913
2976
|
return;
|
|
2914
2977
|
}
|
|
2915
2978
|
// Avoid duplicate subscriptions
|
|
2916
|
-
if (this.
|
|
2979
|
+
if (this.signalProtocolRelayUnsubscribe) {
|
|
2917
2980
|
this.logger.debug('Relay subscription already active', {
|
|
2918
2981
|
category: 'E2EE',
|
|
2919
2982
|
});
|
|
@@ -2924,15 +2987,15 @@ export class DefaultSignalProtocolClient {
|
|
|
2924
2987
|
data: { userId: this.userId, deviceId: this.deviceId },
|
|
2925
2988
|
});
|
|
2926
2989
|
this.startRetryRequests();
|
|
2927
|
-
this.
|
|
2928
|
-
const handled = this.state.
|
|
2929
|
-
const ctx = this.
|
|
2930
|
-
return
|
|
2990
|
+
this.signalProtocolRelayUnsubscribe = this.signalProtocolRelay.subscribe(this.userId, this.deviceId, (envelope) => {
|
|
2991
|
+
const handled = this.state.signalRelayWork.run((work) => {
|
|
2992
|
+
const ctx = this.signalRelayWorkContext(work);
|
|
2993
|
+
return SignalProtocolRelaySubscriptionOps.handleSignalProtocolRelayMessage({
|
|
2931
2994
|
...ctx,
|
|
2932
2995
|
cipher: this.cipher,
|
|
2933
2996
|
receiveQueue: this.receiveQueue,
|
|
2934
2997
|
stopSignal: work.stopSignal,
|
|
2935
|
-
}, envelope, this.
|
|
2998
|
+
}, envelope, this.signalRelaySubscriptionState, this.signalRelaySubscriptionCallbacks(ctx, work.stopSignal), this.signalRelaySubscriptionConfig);
|
|
2936
2999
|
});
|
|
2937
3000
|
handled.catch((error) => {
|
|
2938
3001
|
// The relay delivers an envelope that it did not acknowledge again.
|
|
@@ -2949,8 +3012,8 @@ export class DefaultSignalProtocolClient {
|
|
|
2949
3012
|
return handled;
|
|
2950
3013
|
}, {
|
|
2951
3014
|
// Batching callbacks for notification coalescing
|
|
2952
|
-
onBatchStart: () => this.
|
|
2953
|
-
onBatchEnd: () => this.
|
|
3015
|
+
onBatchStart: () => this.setSignalProtocolRelayBatching(true),
|
|
3016
|
+
onBatchEnd: () => this.setSignalProtocolRelayBatching(false),
|
|
2954
3017
|
});
|
|
2955
3018
|
}
|
|
2956
3019
|
/**
|
|
@@ -2991,48 +3054,60 @@ export class DefaultSignalProtocolClient {
|
|
|
2991
3054
|
});
|
|
2992
3055
|
void this.groupKeySync?.start();
|
|
2993
3056
|
void this.resendJobs.start();
|
|
2994
|
-
const
|
|
2995
|
-
if (this.resendJobsOnConnect === undefined &&
|
|
2996
|
-
this.resendJobsOnConnect =
|
|
3057
|
+
const signalProtocolRelay = this.signalProtocolRelay;
|
|
3058
|
+
if (this.resendJobsOnConnect === undefined && signalProtocolRelay) {
|
|
3059
|
+
this.resendJobsOnConnect = subscribeSignalProtocolRelayConnectionStateOf(signalProtocolRelay, (connection) => {
|
|
2997
3060
|
if (connection.state === 'connected')
|
|
2998
3061
|
void this.resendJobs.start();
|
|
2999
3062
|
});
|
|
3000
3063
|
}
|
|
3001
3064
|
void this.sendIntents.start();
|
|
3002
|
-
if (this.sendDriverOnConnect === undefined &&
|
|
3003
|
-
this.sendDriverOnConnect =
|
|
3065
|
+
if (this.sendDriverOnConnect === undefined && signalProtocolRelay && this.sendIntents.enabled) {
|
|
3066
|
+
this.sendDriverOnConnect = subscribeSignalProtocolRelayConnectionStateOf(signalProtocolRelay, (connection) => {
|
|
3004
3067
|
if (connection.state === 'connected')
|
|
3005
3068
|
void this.sendIntents.start();
|
|
3006
3069
|
});
|
|
3007
3070
|
}
|
|
3008
3071
|
}
|
|
3072
|
+
/** Tell the content adapter that a relay batch starts or ends. */
|
|
3073
|
+
setSignalProtocolRelayBatching(active) {
|
|
3074
|
+
readRenamedImplementation(this.contentAdapter, 'setSignalProtocolRelayBatching', 'setRelayBatching')?.(active);
|
|
3075
|
+
}
|
|
3076
|
+
/** @deprecated Use `startSignalProtocolRelaySubscription`. SDK 15.0.0 removes this name. */
|
|
3077
|
+
startRelaySubscription() {
|
|
3078
|
+
this.startSignalProtocolRelaySubscription();
|
|
3079
|
+
}
|
|
3009
3080
|
/**
|
|
3010
3081
|
* Stop the relay subscription
|
|
3011
3082
|
*
|
|
3012
3083
|
* Pauses message processing via the relay subscription without destroying
|
|
3013
|
-
* DefaultSignalProtocolClient state.
|
|
3084
|
+
* DefaultSignalProtocolClient state. startSignalProtocolRelaySubscription() restarts the subscription.
|
|
3014
3085
|
*
|
|
3015
3086
|
* Use this when the app backgrounds to let the background task handle messages.
|
|
3016
3087
|
* Resume when the app foregrounds for real-time message delivery.
|
|
3017
3088
|
*
|
|
3018
|
-
* @see SignalProtocolClient.
|
|
3089
|
+
* @see SignalProtocolClient.stopSignalProtocolRelaySubscription
|
|
3019
3090
|
*/
|
|
3020
|
-
|
|
3091
|
+
stopSignalProtocolRelaySubscription() {
|
|
3021
3092
|
// Send the batched delivery receipts before unsubscribing. During the
|
|
3022
3093
|
// hold, stop() sends the batches that wait at each of its flushes and
|
|
3023
3094
|
// drops a batch made after its last flush.
|
|
3024
|
-
if (!this.
|
|
3095
|
+
if (!this.signalRelaySubscriptionState.receiptAccumulator.held) {
|
|
3025
3096
|
this.flushPendingDeliveryReceipts();
|
|
3026
3097
|
}
|
|
3027
|
-
if (this.
|
|
3028
|
-
this.
|
|
3029
|
-
this.
|
|
3098
|
+
if (this.signalProtocolRelayUnsubscribe) {
|
|
3099
|
+
this.signalProtocolRelayUnsubscribe();
|
|
3100
|
+
this.signalProtocolRelayUnsubscribe = undefined;
|
|
3030
3101
|
this.logger.debug('Relay subscription stopped', {
|
|
3031
3102
|
category: 'E2EE',
|
|
3032
3103
|
data: { userId: this.userId, deviceId: this.deviceId },
|
|
3033
3104
|
});
|
|
3034
3105
|
}
|
|
3035
3106
|
}
|
|
3107
|
+
/** @deprecated Use `stopSignalProtocolRelaySubscription`. SDK 15.0.0 removes this name. */
|
|
3108
|
+
stopRelaySubscription() {
|
|
3109
|
+
this.stopSignalProtocolRelaySubscription();
|
|
3110
|
+
}
|
|
3036
3111
|
/**
|
|
3037
3112
|
* Send delivery receipt to original sender (all devices)
|
|
3038
3113
|
*
|
|
@@ -3184,7 +3259,7 @@ export class DefaultSignalProtocolClient {
|
|
|
3184
3259
|
* wait for the send.
|
|
3185
3260
|
*/
|
|
3186
3261
|
receiptContext() {
|
|
3187
|
-
return { ...this.ctx, stopSignal: this.state.
|
|
3262
|
+
return { ...this.ctx, stopSignal: this.state.signalRelayWork.stopSignal };
|
|
3188
3263
|
}
|
|
3189
3264
|
/**
|
|
3190
3265
|
* Internal method to send receipt (delivery or read)
|
|
@@ -3226,7 +3301,7 @@ export class DefaultSignalProtocolClient {
|
|
|
3226
3301
|
* waits for those sends until the same deadline. It does this again while
|
|
3227
3302
|
* the deadline is not past. stop() holds the receipt batches from its
|
|
3228
3303
|
* first flush until it clears its tracking state. During the hold,
|
|
3229
|
-
*
|
|
3304
|
+
* stopSignalProtocolRelaySubscription() does not send them, and stop() drops a receipt
|
|
3230
3305
|
* batched after its last flush. At the deadline it stops each receipt
|
|
3231
3306
|
* send that is left: a send that waits in an app hook stops, and that
|
|
3232
3307
|
* receipt is not sent. A send that is in its relay call at the deadline
|
|
@@ -3241,7 +3316,7 @@ export class DefaultSignalProtocolClient {
|
|
|
3241
3316
|
* the work after the hook and writes nothing more. The relay delivers the
|
|
3242
3317
|
* envelope again after the next start.
|
|
3243
3318
|
*
|
|
3244
|
-
* A call to
|
|
3319
|
+
* A call to startSignalProtocolRelaySubscription() while stop() runs is refused and
|
|
3245
3320
|
* logged; start again after stop() resolves. A stop() call that overlaps a
|
|
3246
3321
|
* running stop() waits for it and settles as it settles.
|
|
3247
3322
|
*
|
|
@@ -3290,30 +3365,30 @@ export class DefaultSignalProtocolClient {
|
|
|
3290
3365
|
// progress, except a send that an earlier stop() stopped, and start the
|
|
3291
3366
|
// send of the batched delivery receipts, once each, as relay work. Until
|
|
3292
3367
|
// the end of step 6, a delivery that finishes batches its receipt with no
|
|
3293
|
-
// timer, and
|
|
3368
|
+
// timer, and stopSignalProtocolRelaySubscription() does not send it. Step 5 sends the
|
|
3294
3369
|
// batches that wait at the end of each wait, again while the deadline is
|
|
3295
3370
|
// not past. A receipt batched after its last flush is dropped in step 6
|
|
3296
|
-
const receiptDeadline = Date.now() +
|
|
3371
|
+
const receiptDeadline = Date.now() + SignalProtocolRelaySubscriptionOps.STOP_RECEIPT_FLUSH_MS;
|
|
3297
3372
|
const receiptSends = [
|
|
3298
3373
|
...[...this.deliveryReceiptSends]
|
|
3299
3374
|
.filter(([work]) => !work.stopSignal.aborted)
|
|
3300
3375
|
.map(([, send]) => send),
|
|
3301
3376
|
...this.flushPendingDeliveryReceipts(),
|
|
3302
3377
|
];
|
|
3303
|
-
const receiptAccumulator = this.
|
|
3378
|
+
const receiptAccumulator = this.signalRelaySubscriptionState.receiptAccumulator;
|
|
3304
3379
|
receiptAccumulator.held = true;
|
|
3305
3380
|
try {
|
|
3306
3381
|
// 2. Stop relay subscription. Clear it before the call, so a call that
|
|
3307
3382
|
// the unsubscribe makes does not unsubscribe it again. If the call
|
|
3308
3383
|
// throws, put it back, so the next stop() calls it again
|
|
3309
|
-
const
|
|
3310
|
-
this.
|
|
3311
|
-
if (
|
|
3384
|
+
const signalProtocolRelayUnsubscribe = this.signalProtocolRelayUnsubscribe;
|
|
3385
|
+
this.signalProtocolRelayUnsubscribe = undefined;
|
|
3386
|
+
if (signalProtocolRelayUnsubscribe) {
|
|
3312
3387
|
try {
|
|
3313
|
-
|
|
3388
|
+
signalProtocolRelayUnsubscribe();
|
|
3314
3389
|
}
|
|
3315
3390
|
catch (error) {
|
|
3316
|
-
this.
|
|
3391
|
+
this.signalProtocolRelayUnsubscribe ??= signalProtocolRelayUnsubscribe;
|
|
3317
3392
|
throw error;
|
|
3318
3393
|
}
|
|
3319
3394
|
this.logger.debug('Relay subscription stopped', { category: 'E2EE' });
|
|
@@ -3327,7 +3402,7 @@ export class DefaultSignalProtocolClient {
|
|
|
3327
3402
|
// start. A receipt send is not stopped here, because the relay has the
|
|
3328
3403
|
// acknowledgment of its messages and does not deliver them again
|
|
3329
3404
|
if (receiptSends.length > 0) {
|
|
3330
|
-
this.state.
|
|
3405
|
+
this.state.signalRelayWork.stopAllExcept(new Set(this.deliveryReceiptSends.keys()));
|
|
3331
3406
|
await this.waitForStopReceiptSends(receiptSends, receiptDeadline - Date.now());
|
|
3332
3407
|
}
|
|
3333
3408
|
// 4. Stop the relay work in progress and wait for its SDK work. Work
|
|
@@ -3336,7 +3411,7 @@ export class DefaultSignalProtocolClient {
|
|
|
3336
3411
|
// receipt send that waits in an app hook after the deadline stops, and
|
|
3337
3412
|
// that receipt is not sent. A receipt send that is still in its relay
|
|
3338
3413
|
// call is waited for, and that receipt can still be sent
|
|
3339
|
-
await this.state.
|
|
3414
|
+
await this.state.signalRelayWork.settle();
|
|
3340
3415
|
// 5. A delivery can finish during steps 3, 4, and 5, and the relay does
|
|
3341
3416
|
// not deliver it again. A delivery that waits for the Relay reply to its
|
|
3342
3417
|
// acknowledgment gets no reply after the unsubscribe, so release it to
|
|
@@ -3344,14 +3419,14 @@ export class DefaultSignalProtocolClient {
|
|
|
3344
3419
|
// wait for them until the same receipt deadline, and stop what is left
|
|
3345
3420
|
// as step 4 does. Do this again while a batch waits and the deadline
|
|
3346
3421
|
// is not past
|
|
3347
|
-
const receiptJoin = this.
|
|
3422
|
+
const receiptJoin = this.signalProtocolRelay === undefined ? undefined : signalRelayReceiptJoinOf(this.signalProtocolRelay);
|
|
3348
3423
|
do {
|
|
3349
3424
|
receiptJoin?.release();
|
|
3350
3425
|
const lateReceiptSends = this.flushPendingDeliveryReceipts();
|
|
3351
3426
|
if (lateReceiptSends.length === 0)
|
|
3352
3427
|
break;
|
|
3353
3428
|
await this.waitForStopReceiptSends(lateReceiptSends, receiptDeadline - Date.now());
|
|
3354
|
-
await this.state.
|
|
3429
|
+
await this.state.signalRelayWork.settle();
|
|
3355
3430
|
} while (Date.now() < receiptDeadline);
|
|
3356
3431
|
// 6. Release a delivery that started to wait for its reply after the
|
|
3357
3432
|
// last release, so that no reply timer batches its receipt after
|