@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { signalRelayAnswerVersion } from './signal-relay-protocol.js';
|
|
2
2
|
/**
|
|
3
3
|
* The acceptance of a whole send from the acceptance of each of its posts.
|
|
4
4
|
*
|
|
@@ -8,7 +8,7 @@ import { relayAnswerVersion } from './relay-protocol.js';
|
|
|
8
8
|
* The device-set marks are not part of the aggregate. The device-set
|
|
9
9
|
* reconciliation reads them from each post.
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
11
|
+
export function aggregateSignalProtocolRelayAcceptance(posts) {
|
|
12
12
|
if (posts.length === 0)
|
|
13
13
|
return {};
|
|
14
14
|
const duplicates = posts.map((post) => post.duplicate);
|
|
@@ -52,13 +52,13 @@ export function sendResultAcceptance(acceptances) {
|
|
|
52
52
|
* the error as the answer to a request of protocol version 2 or later. An
|
|
53
53
|
* unmarked error and a version 1 answer carry it as an unknown code.
|
|
54
54
|
*/
|
|
55
|
-
export function
|
|
55
|
+
export function signalRelayOperationRefusal(error) {
|
|
56
56
|
if (error === null || typeof error !== 'object')
|
|
57
57
|
return undefined;
|
|
58
58
|
const { code } = error;
|
|
59
59
|
if (code === 'OPERATION_EXPIRED' || code === 'RETRY_CONFLICT')
|
|
60
60
|
return code;
|
|
61
|
-
if (code === 'DELIVERY_ALREADY_ACCEPTED' && (
|
|
61
|
+
if (code === 'DELIVERY_ALREADY_ACCEPTED' && (signalRelayAnswerVersion(error) ?? 1) >= 2) {
|
|
62
62
|
return code;
|
|
63
63
|
}
|
|
64
64
|
return undefined;
|
|
@@ -68,8 +68,8 @@ export function relayOperationRefusal(error) {
|
|
|
68
68
|
* message ID of the post: RETRY_CONFLICT, or DELIVERY_ALREADY_ACCEPTED under
|
|
69
69
|
* protocol version 2. A post reads both answers in the same way.
|
|
70
70
|
*/
|
|
71
|
-
export function
|
|
72
|
-
const refusal =
|
|
71
|
+
export function signalRelayHoldsMessageId(error) {
|
|
72
|
+
const refusal = signalRelayOperationRefusal(error);
|
|
73
73
|
return refusal === 'RETRY_CONFLICT' || refusal === 'DELIVERY_ALREADY_ACCEPTED';
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -127,4 +127,4 @@ export function classifyRetryRequestPostFailure(error) {
|
|
|
127
127
|
return { terminal: 'revoked-authority' };
|
|
128
128
|
return { retry: 'transport-outage' };
|
|
129
129
|
}
|
|
130
|
-
//# sourceMappingURL=relay-acceptance.js.map
|
|
130
|
+
//# sourceMappingURL=signal-relay-acceptance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-acceptance.js","sourceRoot":"","sources":["../../client/signal-relay-acceptance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAgBnE;;;;;;;;GAQG;AACH,MAAM,UAAU,sCAAsC,CACpD,KAAoF;IAEpF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,O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S,EAAE,GAAG,KAInC,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC;IAClF,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACrF,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,QAAQ;YAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpC,CAAC;IACD,IAAI,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAC3C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC1D,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IACpD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAC/E,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
17
|
/** The device that a relay refused, and why. */
|
|
18
|
-
export interface
|
|
18
|
+
export interface SignalProtocolRelayDeviceRefusal {
|
|
19
19
|
/** NOT_FOUND: the device's mailbox is gone. STALE_DEVICE: its registration changed. */
|
|
20
|
-
readonly code:
|
|
20
|
+
readonly code: SignalProtocolRelayDeviceRefusalCode;
|
|
21
21
|
readonly userId: string;
|
|
22
22
|
readonly deviceId: number;
|
|
23
23
|
}
|
|
24
24
|
/** Declare that this relay refuses every post to a removed device's mailbox. */
|
|
25
|
-
export declare function declareRefusesRemovedDevices(
|
|
25
|
+
export declare function declareRefusesRemovedDevices(signalProtocolRelay: object): void;
|
|
26
26
|
/** True only for the relay object that declared itself. A wrapper is not declared. */
|
|
27
|
-
export declare function refusesRemovedDevices(
|
|
27
|
+
export declare function refusesRemovedDevices(signalProtocolRelay: object): boolean;
|
|
28
28
|
/** Mark an error as the relay's refusal of one device. Returns the same error. */
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function markSignalProtocolRelayDeviceRefusal<T extends Error>(error: T, refusal: SignalProtocolRelayDeviceRefusal): T;
|
|
30
30
|
/** The refusal that a relay marked on this error, if any. */
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function signalRelayDeviceRefusal(error: unknown): SignalProtocolRelayDeviceRefusal | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* True when the relay refused one direct post because the registration of
|
|
34
34
|
* its device changed: a marked `STALE_DEVICE` refusal, or a relay error whose
|
|
@@ -47,4 +47,4 @@ export declare class StaleSessionRefreshError extends Error {
|
|
|
47
47
|
readonly name = "StaleSessionRefreshError";
|
|
48
48
|
constructor(userId: string, deviceId: number, cause: unknown);
|
|
49
49
|
}
|
|
50
|
-
//# sourceMappingURL=relay-device-refusal.d.ts.map
|
|
50
|
+
//# sourceMappingURL=signal-relay-device-refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-device-refusal.d.ts","sourceRoot":"","sources":["../../client/signal-relay-device-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,gDAAgD;AAChD,MAAM,WAAW,gCAAgC;IAC/C,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,oCAAoC,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAKD,gFAAgF;AAChF,wBAAgB,4BAA4B,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAE9E;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED,kFAAkF;AAClF,wBAAgB,oCAAoC,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,gCAAgC,GAAG,CAAC,CAG5H;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gCAAgC,GAAG,SAAS,CAErG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS5D;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAI/C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAJ3B,SAAkB,IAAI,8BAA8B;IAEpD,YACW,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EACzB,KAAK,EAAE,OAAO,EAGf;CACF"}
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const refusingSignalProtocolRelays = new WeakSet();
|
|
18
18
|
const refusals = new WeakMap();
|
|
19
19
|
/** Declare that this relay refuses every post to a removed device's mailbox. */
|
|
20
|
-
export function declareRefusesRemovedDevices(
|
|
21
|
-
|
|
20
|
+
export function declareRefusesRemovedDevices(signalProtocolRelay) {
|
|
21
|
+
refusingSignalProtocolRelays.add(signalProtocolRelay);
|
|
22
22
|
}
|
|
23
23
|
/** True only for the relay object that declared itself. A wrapper is not declared. */
|
|
24
|
-
export function refusesRemovedDevices(
|
|
25
|
-
return
|
|
24
|
+
export function refusesRemovedDevices(signalProtocolRelay) {
|
|
25
|
+
return refusingSignalProtocolRelays.has(signalProtocolRelay);
|
|
26
26
|
}
|
|
27
27
|
/** Mark an error as the relay's refusal of one device. Returns the same error. */
|
|
28
|
-
export function
|
|
28
|
+
export function markSignalProtocolRelayDeviceRefusal(error, refusal) {
|
|
29
29
|
refusals.set(error, { ...refusal });
|
|
30
30
|
return error;
|
|
31
31
|
}
|
|
32
32
|
/** The refusal that a relay marked on this error, if any. */
|
|
33
|
-
export function
|
|
33
|
+
export function signalRelayDeviceRefusal(error) {
|
|
34
34
|
return error !== null && typeof error === 'object' ? refusals.get(error) : undefined;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -39,7 +39,7 @@ export function relayDeviceRefusal(error) {
|
|
|
39
39
|
* data names `STALE_DEVICE`.
|
|
40
40
|
*/
|
|
41
41
|
export function isStaleDeviceRefusal(error) {
|
|
42
|
-
if (
|
|
42
|
+
if (signalRelayDeviceRefusal(error)?.code === 'STALE_DEVICE')
|
|
43
43
|
return true;
|
|
44
44
|
if (error === null || typeof error !== 'object' || !('data' in error))
|
|
45
45
|
return false;
|
|
@@ -64,4 +64,4 @@ export class StaleSessionRefreshError extends Error {
|
|
|
64
64
|
this.deviceId = deviceId;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
//# sourceMappingURL=relay-device-refusal.js.map
|
|
67
|
+
//# sourceMappingURL=signal-relay-device-refusal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-device-refusal.js","sourceRoot":"","sources":["../../client/signal-relay-device-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,MAAM,4BAA4B,GAAG,IAAI,OAAO,EAAU,CAAC;AAC3D,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA4C,CAAC;AAEzE,gFAAgF;AAChF,MAAM,UAAU,4BAA4B,CAAC,mBAA2B;IACtE,4BAA4B,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACxD,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,qBAAqB,CAAC,mBAA2B;IAC/D,OAAO,4BA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/types.js';
|
|
1
|
+
import type { Unsubscribe } from '../remote/signal-relay/types.js';
|
|
2
2
|
import type { SignalProtocolClient } from '../types/api.js';
|
|
3
3
|
/**
|
|
4
|
-
* The part of an app state source that `
|
|
4
|
+
* The part of an app state source that `bindSignalProtocolRelayLifecycle` reads.
|
|
5
5
|
*
|
|
6
6
|
* React Native's `AppState` satisfies it. The client entry does not import
|
|
7
7
|
* react-native, so any source with this shape can drive the binding.
|
|
8
8
|
*/
|
|
9
|
-
export interface
|
|
9
|
+
export interface SignalProtocolRelayLifecycleAppState {
|
|
10
10
|
/**
|
|
11
11
|
* The state at bind time, for example `active` or `background`. React
|
|
12
12
|
* Native reports `null` when its native AppState module is not available.
|
|
@@ -18,8 +18,8 @@ export interface RelayLifecycleAppState {
|
|
|
18
18
|
remove(): void;
|
|
19
19
|
} | (() => void);
|
|
20
20
|
}
|
|
21
|
-
/** Options for `
|
|
22
|
-
export interface
|
|
21
|
+
/** Options for `bindSignalProtocolRelayLifecycle`. */
|
|
22
|
+
export interface SignalProtocolRelayLifecycleOptions {
|
|
23
23
|
/**
|
|
24
24
|
* Keep the relay socket open in the background, for example while an Android
|
|
25
25
|
* foreground service runs. The binding then does nothing. Default: `false`.
|
|
@@ -30,9 +30,9 @@ export interface RelayLifecycleOptions {
|
|
|
30
30
|
* Stops the relay subscription when the app goes to the background and starts
|
|
31
31
|
* it again when the app becomes active.
|
|
32
32
|
*
|
|
33
|
-
* - `background` calls `
|
|
33
|
+
* - `background` calls `stopSignalProtocolRelaySubscription()`, which closes the socket with
|
|
34
34
|
* code 1000. The Relay records a client close.
|
|
35
|
-
* - `active` calls `
|
|
35
|
+
* - `active` calls `startSignalProtocolRelaySubscription()`, but only after a stop that this
|
|
36
36
|
* binding made. The Relay replays retained messages over the new socket.
|
|
37
37
|
* - `inactive` and other states change nothing. There is no grace delay.
|
|
38
38
|
* - A subscription that is `stopped` stays stopped, so an app stop is kept.
|
|
@@ -41,6 +41,10 @@ export interface RelayLifecycleOptions {
|
|
|
41
41
|
* Call the returned function before `stop()` on the client. It removes the
|
|
42
42
|
* listener and does not start or stop the subscription.
|
|
43
43
|
*
|
|
44
|
+
* An object that has only the deprecated member names, such as
|
|
45
|
+
* `stopRelaySubscription()`, also drives the binding. The binding reads each
|
|
46
|
+
* new name first.
|
|
47
|
+
*
|
|
44
48
|
* @param signal - The Signal Protocol client
|
|
45
49
|
* @param appState - React Native's `AppState`, or an object of the same shape
|
|
46
50
|
* @param options - Binding options
|
|
@@ -49,13 +53,19 @@ export interface RelayLifecycleOptions {
|
|
|
49
53
|
* @example
|
|
50
54
|
* ```typescript
|
|
51
55
|
* import { AppState } from 'react-native';
|
|
52
|
-
* import {
|
|
56
|
+
* import { bindSignalProtocolRelayLifecycle } from '@open-e2ee/signal-protocol-sdk/client';
|
|
53
57
|
*
|
|
54
|
-
* const unbind =
|
|
58
|
+
* const unbind = bindSignalProtocolRelayLifecycle(signal, AppState);
|
|
55
59
|
* // At sign-out:
|
|
56
60
|
* unbind();
|
|
57
61
|
* await signal.stop();
|
|
58
62
|
* ```
|
|
59
63
|
*/
|
|
60
|
-
export declare function
|
|
61
|
-
|
|
64
|
+
export declare function bindSignalProtocolRelayLifecycle(signal: Pick<SignalProtocolClient, 'signalProtocolRelayConnectionState' | 'startSignalProtocolRelaySubscription' | 'stopSignalProtocolRelaySubscription'> | Pick<SignalProtocolClient, 'relayConnectionState' | 'startRelaySubscription' | 'stopRelaySubscription'>, appState: SignalProtocolRelayLifecycleAppState, { keepOpenInBackground }?: SignalProtocolRelayLifecycleOptions): Unsubscribe;
|
|
65
|
+
/** @deprecated Use `bindSignalProtocolRelayLifecycle`. SDK 15.0.0 removes this name. */
|
|
66
|
+
export declare const bindRelayLifecycle: typeof bindSignalProtocolRelayLifecycle;
|
|
67
|
+
/** @deprecated Use `SignalProtocolRelayLifecycleAppState`. SDK 15.0.0 removes this name. */
|
|
68
|
+
export type RelayLifecycleAppState = SignalProtocolRelayLifecycleAppState;
|
|
69
|
+
/** @deprecated Use `SignalProtocolRelayLifecycleOptions`. SDK 15.0.0 removes this name. */
|
|
70
|
+
export type RelayLifecycleOptions = SignalProtocolRelayLifecycleOptions;
|
|
71
|
+
//# sourceMappingURL=signal-relay-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-lifecycle.d.ts","sourceRoot":"","sources":["../../client/signal-relay-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,uFAAuF;IACvF,gBAAgB,CACd,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAChC;QAAE,MAAM,IAAI,IAAI,CAAA;KAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;CACtC;AAED,sDAAsD;AACtD,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EACF,IAAI,CACF,oBAAoB,EAClB,oCAAoC,GACpC,sCAAsC,GACtC,qCAAqC,CACxC,GACD,IAAI,CACF,oBAAoB,EACpB,sBAAsB,GAAG,wBAAwB,GAAG,uBAAuB,CAC5E,EACL,QAAQ,EAAE,oCAAoC,EAC9C,EAAE,oBAA4B,EAAE,GAAE,mCAAwC,GACzE,WAAW,CA8Cb;AAGD,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,yCAAmC,CAAC;AACnE,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,oCAAoC,CAAC;AAC1E,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG,mCAAmC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { readRenamedImplementation } from '../types/renamed-member.js';
|
|
1
2
|
/**
|
|
2
3
|
* Stops the relay subscription when the app goes to the background and starts
|
|
3
4
|
* it again when the app becomes active.
|
|
4
5
|
*
|
|
5
|
-
* - `background` calls `
|
|
6
|
+
* - `background` calls `stopSignalProtocolRelaySubscription()`, which closes the socket with
|
|
6
7
|
* code 1000. The Relay records a client close.
|
|
7
|
-
* - `active` calls `
|
|
8
|
+
* - `active` calls `startSignalProtocolRelaySubscription()`, but only after a stop that this
|
|
8
9
|
* binding made. The Relay replays retained messages over the new socket.
|
|
9
10
|
* - `inactive` and other states change nothing. There is no grace delay.
|
|
10
11
|
* - A subscription that is `stopped` stays stopped, so an app stop is kept.
|
|
@@ -13,6 +14,10 @@
|
|
|
13
14
|
* Call the returned function before `stop()` on the client. It removes the
|
|
14
15
|
* listener and does not start or stop the subscription.
|
|
15
16
|
*
|
|
17
|
+
* An object that has only the deprecated member names, such as
|
|
18
|
+
* `stopRelaySubscription()`, also drives the binding. The binding reads each
|
|
19
|
+
* new name first.
|
|
20
|
+
*
|
|
16
21
|
* @param signal - The Signal Protocol client
|
|
17
22
|
* @param appState - React Native's `AppState`, or an object of the same shape
|
|
18
23
|
* @param options - Binding options
|
|
@@ -21,28 +26,30 @@
|
|
|
21
26
|
* @example
|
|
22
27
|
* ```typescript
|
|
23
28
|
* import { AppState } from 'react-native';
|
|
24
|
-
* import {
|
|
29
|
+
* import { bindSignalProtocolRelayLifecycle } from '@open-e2ee/signal-protocol-sdk/client';
|
|
25
30
|
*
|
|
26
|
-
* const unbind =
|
|
31
|
+
* const unbind = bindSignalProtocolRelayLifecycle(signal, AppState);
|
|
27
32
|
* // At sign-out:
|
|
28
33
|
* unbind();
|
|
29
34
|
* await signal.stop();
|
|
30
35
|
* ```
|
|
31
36
|
*/
|
|
32
|
-
export function
|
|
37
|
+
export function bindSignalProtocolRelayLifecycle(signal, appState, { keepOpenInBackground = false } = {}) {
|
|
33
38
|
if (keepOpenInBackground)
|
|
34
39
|
return () => undefined;
|
|
40
|
+
const client = signal;
|
|
35
41
|
let stoppedByBinding = false;
|
|
36
42
|
const apply = (state) => {
|
|
37
43
|
if (state === 'background') {
|
|
38
|
-
|
|
44
|
+
const connectionState = readRenamedImplementation(client, 'signalProtocolRelayConnectionState', 'relayConnectionState');
|
|
45
|
+
if (stoppedByBinding || connectionState?.state === 'stopped')
|
|
39
46
|
return;
|
|
40
47
|
stoppedByBinding = true;
|
|
41
|
-
|
|
48
|
+
readRenamedImplementation(client, 'stopSignalProtocolRelaySubscription', 'stopRelaySubscription')?.();
|
|
42
49
|
}
|
|
43
50
|
else if (state === 'active' && stoppedByBinding) {
|
|
44
51
|
stoppedByBinding = false;
|
|
45
|
-
|
|
52
|
+
readRenamedImplementation(client, 'startSignalProtocolRelaySubscription', 'startRelaySubscription')?.();
|
|
46
53
|
}
|
|
47
54
|
};
|
|
48
55
|
const subscription = appState.addEventListener('change', apply);
|
|
@@ -58,4 +65,7 @@ export function bindRelayLifecycle(signal, appState, { keepOpenInBackground = fa
|
|
|
58
65
|
subscription.remove();
|
|
59
66
|
};
|
|
60
67
|
}
|
|
61
|
-
|
|
68
|
+
// Names before the Signal Protocol Relay rename. SDK 15.0.0 removes them.
|
|
69
|
+
/** @deprecated Use `bindSignalProtocolRelayLifecycle`. SDK 15.0.0 removes this name. */
|
|
70
|
+
export const bindRelayLifecycle = bindSignalProtocolRelayLifecycle;
|
|
71
|
+
//# sourceMappingURL=signal-relay-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-lifecycle.js","sourceRoot":"","sources":["../../client/signal-relay-lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AA+Bp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,CAAC;AAED,0EAA0E;AAC1E,wFAAwF;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAG,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relay period close: the Relay's PERIOD_CLOSED refusal of one delivery post,
|
|
3
|
+
* and the one repeat of the same request that follows it.
|
|
4
|
+
*
|
|
5
|
+
* The Relay refuses a new admission with PERIOD_CLOSED when its admission
|
|
6
|
+
* period ended before the admission. The refusal comes after the duplicate
|
|
7
|
+
* check and before the Relay stores anything, and the Relay reads the period
|
|
8
|
+
* again for each request. So the refusal proves that the Relay did not
|
|
9
|
+
* accept the post, and one repeat of the same request can be admitted in the
|
|
10
|
+
* next period. The repeat keeps the message ID, the operation epoch, and the
|
|
11
|
+
* bytes of the post. A second PERIOD_CLOSED reaches the caller, and the send
|
|
12
|
+
* keeps the device pending.
|
|
13
|
+
*
|
|
14
|
+
* The sealed route gives each code outside its safe codes as DELIVERY_FAILED,
|
|
15
|
+
* so its carrier marks a PERIOD_CLOSED error here.
|
|
16
|
+
*
|
|
17
|
+
* No package entry exports this module. The mark is internal to the SDK.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
/** Mark an error as the Relay's PERIOD_CLOSED refusal. Returns the same error. */
|
|
22
|
+
export declare function markPeriodClosed<T>(error: T): T;
|
|
23
|
+
/** True when the Relay refused the post with PERIOD_CLOSED. */
|
|
24
|
+
export declare function isPeriodClosed(error: unknown): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Make the repeat rule of one post. Each call of the returned function runs
|
|
27
|
+
* `post`. After a PERIOD_CLOSED answer, it awaits `beforeRepeat` and runs the
|
|
28
|
+
* same post one more time. The rule repeats once for the whole post, also
|
|
29
|
+
* when the post makes more requests for other reasons, so a second
|
|
30
|
+
* PERIOD_CLOSED reaches the caller. Each other answer reaches the caller.
|
|
31
|
+
* When `beforeRepeat` rejects, no repeat starts and the PERIOD_CLOSED error
|
|
32
|
+
* is thrown.
|
|
33
|
+
*/
|
|
34
|
+
export declare function onePeriodClosedRetry(): <T>(post: () => Promise<T>, beforeRepeat?: () => Promise<void>) => Promise<T>;
|
|
35
|
+
//# sourceMappingURL=signal-relay-period-close.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-period-close.d.ts","sourceRoot":"","sources":["../../client/signal-relay-period-close.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAG/C;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,CAAC,EACxC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAC/B,OAAO,CAAC,CAAC,CAAC,CAgBd"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relay period close: the Relay's PERIOD_CLOSED refusal of one delivery post,
|
|
3
|
+
* and the one repeat of the same request that follows it.
|
|
4
|
+
*
|
|
5
|
+
* The Relay refuses a new admission with PERIOD_CLOSED when its admission
|
|
6
|
+
* period ended before the admission. The refusal comes after the duplicate
|
|
7
|
+
* check and before the Relay stores anything, and the Relay reads the period
|
|
8
|
+
* again for each request. So the refusal proves that the Relay did not
|
|
9
|
+
* accept the post, and one repeat of the same request can be admitted in the
|
|
10
|
+
* next period. The repeat keeps the message ID, the operation epoch, and the
|
|
11
|
+
* bytes of the post. A second PERIOD_CLOSED reaches the caller, and the send
|
|
12
|
+
* keeps the device pending.
|
|
13
|
+
*
|
|
14
|
+
* The sealed route gives each code outside its safe codes as DELIVERY_FAILED,
|
|
15
|
+
* so its carrier marks a PERIOD_CLOSED error here.
|
|
16
|
+
*
|
|
17
|
+
* No package entry exports this module. The mark is internal to the SDK.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
const periodClosed = new WeakSet();
|
|
22
|
+
/** Mark an error as the Relay's PERIOD_CLOSED refusal. Returns the same error. */
|
|
23
|
+
export function markPeriodClosed(error) {
|
|
24
|
+
if (error !== null && typeof error === 'object')
|
|
25
|
+
periodClosed.add(error);
|
|
26
|
+
return error;
|
|
27
|
+
}
|
|
28
|
+
/** True when the Relay refused the post with PERIOD_CLOSED. */
|
|
29
|
+
export function isPeriodClosed(error) {
|
|
30
|
+
if (error === null || typeof error !== 'object')
|
|
31
|
+
return false;
|
|
32
|
+
return periodClosed.has(error) || error.code === 'PERIOD_CLOSED';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Make the repeat rule of one post. Each call of the returned function runs
|
|
36
|
+
* `post`. After a PERIOD_CLOSED answer, it awaits `beforeRepeat` and runs the
|
|
37
|
+
* same post one more time. The rule repeats once for the whole post, also
|
|
38
|
+
* when the post makes more requests for other reasons, so a second
|
|
39
|
+
* PERIOD_CLOSED reaches the caller. Each other answer reaches the caller.
|
|
40
|
+
* When `beforeRepeat` rejects, no repeat starts and the PERIOD_CLOSED error
|
|
41
|
+
* is thrown.
|
|
42
|
+
*/
|
|
43
|
+
export function onePeriodClosedRetry() {
|
|
44
|
+
let spent = false;
|
|
45
|
+
return async (post, beforeRepeat) => {
|
|
46
|
+
try {
|
|
47
|
+
return await post();
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (spent || !isPeriodClosed(error))
|
|
51
|
+
throw error;
|
|
52
|
+
spent = true;
|
|
53
|
+
try {
|
|
54
|
+
await beforeRepeat?.();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
return post();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=signal-relay-period-close.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-period-close.js","sourceRoot":"","sources":["../../client/signal-relay-period-close.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU,CAAC;AAE3C,kFAAkF;AAClF,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAK,KAA4B,CAAC,IAAI,KAAK,eAAe,CAAC;AAC3F,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB;IAIlC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;QAClC,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;gBAAE,MAAM,KAAK,CAAC;YACjD,KAAK,GAAG,IAAI,CAAC;YACb,IAAI,CAAC;gBACH,MAAM,YAAY,EAAE,EAAE,CAAC;YACzB,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -25,18 +25,18 @@ export declare const RELAY_AUTH_PROTOCOL_PREFIX = "open-e2ee-relay.auth.";
|
|
|
25
25
|
/** The HTTP header that carries the protocol version. */
|
|
26
26
|
export declare const RELAY_PROTOCOL_HEADER = "x-open-e2ee-relay-protocol";
|
|
27
27
|
/** The subprotocol token of a protocol version, for example `open-e2ee-relay.v1`. */
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function signalRelayProtocolToken(version: number): string;
|
|
29
29
|
/** The headers that put a protocol version on an HTTP request. */
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function signalRelayProtocolHeadersFor(version: number): Record<string, string>;
|
|
31
31
|
/** The headers that put this SDK's default protocol version on an HTTP request. */
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function signalRelayProtocolHeaders(): Record<string, string>;
|
|
33
33
|
/**
|
|
34
34
|
* The Relay no longer serves the protocol version of this SDK. The same
|
|
35
35
|
* request fails again until the application ships a newer SDK, so the SDK
|
|
36
36
|
* does not retry it. The mailbox subscription stops with the reason
|
|
37
37
|
* `upgrade-required` for the same refusal on its socket.
|
|
38
38
|
*/
|
|
39
|
-
export declare class
|
|
39
|
+
export declare class HostedSignalProtocolRelayUpgradeRequiredError extends Error {
|
|
40
40
|
readonly code = "UPGRADE_REQUIRED";
|
|
41
41
|
/** The HTTP status of the refusal, 426 from a current Relay. */
|
|
42
42
|
readonly status: number;
|
|
@@ -50,7 +50,7 @@ export declare class HostedRelayUpgradeRequiredError extends Error {
|
|
|
50
50
|
constructor(status: number, version?: number);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Throws `
|
|
53
|
+
* Throws `HostedSignalProtocolRelayUpgradeRequiredError` when a Relay error body has the
|
|
54
54
|
* code `UPGRADE_REQUIRED`, at any error status. The body code is the
|
|
55
55
|
* contract, not the status. The error names `version`, the protocol version
|
|
56
56
|
* that the request sent.
|
|
@@ -61,11 +61,15 @@ export declare function throwIfUpgradeRequired(status: number, body: unknown, ve
|
|
|
61
61
|
* `version`. The meaning of some codes depends on that version. Returns
|
|
62
62
|
* the same error.
|
|
63
63
|
*/
|
|
64
|
-
export declare function
|
|
64
|
+
export declare function markSignalProtocolRelayAnswerVersion<T extends object>(error: T, version: number): T;
|
|
65
65
|
/**
|
|
66
66
|
* The protocol version of the request that a Relay error answers, or
|
|
67
67
|
* undefined when no hosted carrier marked the error. A custom relay marks
|
|
68
68
|
* no error.
|
|
69
69
|
*/
|
|
70
|
-
export declare function
|
|
71
|
-
|
|
70
|
+
export declare function signalRelayAnswerVersion(error: unknown): number | undefined;
|
|
71
|
+
/** @deprecated Use `HostedSignalProtocolRelayUpgradeRequiredError`. SDK 15.0.0 removes this name. */
|
|
72
|
+
export declare const HostedRelayUpgradeRequiredError: typeof HostedSignalProtocolRelayUpgradeRequiredError;
|
|
73
|
+
/** @deprecated Use `HostedSignalProtocolRelayUpgradeRequiredError`. SDK 15.0.0 removes this name. */
|
|
74
|
+
export type HostedRelayUpgradeRequiredError = HostedSignalProtocolRelayUpgradeRequiredError;
|
|
75
|
+
//# sourceMappingURL=signal-relay-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-protocol.d.ts","sourceRoot":"","sources":["../../client/signal-relay-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAQxC,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAElE,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,qFAAqF;AACrF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,kEAAkE;AAClE,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAErF;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEnE;AAED;;;;;GAKG;AACH,qBAAa,6CAA8C,SAAQ,KAAK;IACtE,SAAgB,IAAI,sBAAsB;IAC1C,gEAAgE;IAChE,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,iEAAiE;IACjE,SAAgB,SAAS,SAAS;IAElC;;;;OAIG;IACH,YAAmB,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAMlD;CACF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAWN;AAKD;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAGnG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI3E;AAGD,qGAAqG;AACrG,eAAO,MAAM,+BAA+B,sDAAgD,CAAC;AAC7F,qGAAqG;AACrG,MAAM,MAAM,+BAA+B,GAAG,6CAA6C,CAAC"}
|
|
@@ -29,16 +29,16 @@ export const RELAY_AUTH_PROTOCOL_PREFIX = "open-e2ee-relay.auth.";
|
|
|
29
29
|
/** The HTTP header that carries the protocol version. */
|
|
30
30
|
export const RELAY_PROTOCOL_HEADER = "x-open-e2ee-relay-protocol";
|
|
31
31
|
/** The subprotocol token of a protocol version, for example `open-e2ee-relay.v1`. */
|
|
32
|
-
export function
|
|
32
|
+
export function signalRelayProtocolToken(version) {
|
|
33
33
|
return `${RELAY_PROTOCOL_TOKEN_PREFIX}${version}`;
|
|
34
34
|
}
|
|
35
35
|
/** The headers that put a protocol version on an HTTP request. */
|
|
36
|
-
export function
|
|
36
|
+
export function signalRelayProtocolHeadersFor(version) {
|
|
37
37
|
return { [RELAY_PROTOCOL_HEADER]: String(version) };
|
|
38
38
|
}
|
|
39
39
|
/** The headers that put this SDK's default protocol version on an HTTP request. */
|
|
40
|
-
export function
|
|
41
|
-
return
|
|
40
|
+
export function signalRelayProtocolHeaders() {
|
|
41
|
+
return signalRelayProtocolHeadersFor(RELAY_PROTOCOL_VERSION);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* The Relay no longer serves the protocol version of this SDK. The same
|
|
@@ -46,7 +46,7 @@ export function relayProtocolHeaders() {
|
|
|
46
46
|
* does not retry it. The mailbox subscription stops with the reason
|
|
47
47
|
* `upgrade-required` for the same refusal on its socket.
|
|
48
48
|
*/
|
|
49
|
-
export class
|
|
49
|
+
export class HostedSignalProtocolRelayUpgradeRequiredError extends Error {
|
|
50
50
|
code = "UPGRADE_REQUIRED";
|
|
51
51
|
/** The HTTP status of the refusal, 426 from a current Relay. */
|
|
52
52
|
status;
|
|
@@ -64,7 +64,7 @@ export class HostedRelayUpgradeRequiredError extends Error {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* Throws `
|
|
67
|
+
* Throws `HostedSignalProtocolRelayUpgradeRequiredError` when a Relay error body has the
|
|
68
68
|
* code `UPGRADE_REQUIRED`, at any error status. The body code is the
|
|
69
69
|
* contract, not the status. The error names `version`, the protocol version
|
|
70
70
|
* that the request sent.
|
|
@@ -77,7 +77,7 @@ export function throwIfUpgradeRequired(status, body, version) {
|
|
|
77
77
|
body.error !== null &&
|
|
78
78
|
"code" in body.error &&
|
|
79
79
|
body.error.code === "UPGRADE_REQUIRED")
|
|
80
|
-
throw new
|
|
80
|
+
throw new HostedSignalProtocolRelayUpgradeRequiredError(status, version);
|
|
81
81
|
}
|
|
82
82
|
/** The protocol version of the request that each Relay error answers. */
|
|
83
83
|
const answerVersions = new WeakMap();
|
|
@@ -86,7 +86,7 @@ const answerVersions = new WeakMap();
|
|
|
86
86
|
* `version`. The meaning of some codes depends on that version. Returns
|
|
87
87
|
* the same error.
|
|
88
88
|
*/
|
|
89
|
-
export function
|
|
89
|
+
export function markSignalProtocolRelayAnswerVersion(error, version) {
|
|
90
90
|
answerVersions.set(error, version);
|
|
91
91
|
return error;
|
|
92
92
|
}
|
|
@@ -95,9 +95,12 @@ export function markRelayAnswerVersion(error, version) {
|
|
|
95
95
|
* undefined when no hosted carrier marked the error. A custom relay marks
|
|
96
96
|
* no error.
|
|
97
97
|
*/
|
|
98
|
-
export function
|
|
98
|
+
export function signalRelayAnswerVersion(error) {
|
|
99
99
|
return error !== null && typeof error === "object"
|
|
100
100
|
? answerVersions.get(error)
|
|
101
101
|
: undefined;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
// Names before the Signal Protocol Relay rename. SDK 15.0.0 removes them.
|
|
104
|
+
/** @deprecated Use `HostedSignalProtocolRelayUpgradeRequiredError`. SDK 15.0.0 removes this name. */
|
|
105
|
+
export const HostedRelayUpgradeRequiredError = HostedSignalProtocolRelayUpgradeRequiredError;
|
|
106
|
+
//# sourceMappingURL=signal-relay-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-protocol.js","sourceRoot":"","sources":["../../client/signal-relay-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,sFAAsF;AACtF,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,6EAA6E;AAC7E,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAExD,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAElE,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAElE,qFAAqF;AACrF,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,OAAO,GAAG,2BAA2B,GAAG,OAAO,EAAE,CAAC;AACpD,CAAC;AAED,kEAAkE;AAClE,MAAM,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AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAChD,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,0EAA0E;AAC1E,qGAAqG;AACrG,MAAM,CAAC,MAAM,+BAA+B,GAAG,6CAA6C,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
20
|
/** One Relay delivery receipt, as the Relay sends it to the sender. */
|
|
21
|
-
export interface
|
|
21
|
+
export interface SignalProtocolRelayDeliveryReceipt {
|
|
22
22
|
/** The stable identity of the receipt. A replay carries the same value. */
|
|
23
23
|
readonly receiptId: string;
|
|
24
24
|
/** The recipient device that acknowledged the messages. */
|
|
@@ -36,35 +36,35 @@ export interface RelayDeliveryReceipt {
|
|
|
36
36
|
* order. A listener that throws fails the hand-off, so the receipt is not
|
|
37
37
|
* acknowledged and the Relay replays it.
|
|
38
38
|
*/
|
|
39
|
-
export type
|
|
39
|
+
export type SignalProtocolRelayDeliveryReceiptListener = (receipt: SignalProtocolRelayDeliveryReceipt) => void | Promise<void>;
|
|
40
40
|
/** The intake that a client binds to. */
|
|
41
|
-
export interface
|
|
42
|
-
subscribe(listener:
|
|
41
|
+
export interface SignalProtocolRelayReceiptIntake {
|
|
42
|
+
subscribe(listener: SignalProtocolRelayDeliveryReceiptListener): Unsubscribe;
|
|
43
43
|
}
|
|
44
44
|
/** A `delivery-receipt` frame holds no more receipts than this. */
|
|
45
45
|
export declare const MAXIMUM_RECEIPTS_PER_FRAME = 32;
|
|
46
46
|
/** Decodes one receipt of a `delivery-receipt` frame or a pull page. Throws when it is invalid. */
|
|
47
|
-
export declare function
|
|
47
|
+
export declare function decodeSignalProtocolRelayDeliveryReceipt(value: unknown): SignalProtocolRelayDeliveryReceipt;
|
|
48
48
|
/** Decodes the receipt list of a frame or a pull page. Throws when any receipt is invalid. */
|
|
49
|
-
export declare function
|
|
49
|
+
export declare function decodeSignalProtocolRelayDeliveryReceipts(value: unknown, maximum?: number): readonly SignalProtocolRelayDeliveryReceipt[];
|
|
50
50
|
/**
|
|
51
51
|
* The receipt inbox of one relay. It hands each receipt off to the bound
|
|
52
52
|
* listeners once, by `receiptId`.
|
|
53
53
|
*/
|
|
54
|
-
export declare class
|
|
54
|
+
export declare class SignalProtocolRelayReceiptInbox implements SignalProtocolRelayReceiptIntake {
|
|
55
55
|
private readonly listeners;
|
|
56
56
|
private readonly handedOff;
|
|
57
|
-
subscribe(listener:
|
|
57
|
+
subscribe(listener: SignalProtocolRelayDeliveryReceiptListener): Unsubscribe;
|
|
58
58
|
/**
|
|
59
59
|
* Hands one receipt off to each listener in order, unless an earlier
|
|
60
60
|
* hand-off of its `receiptId` completed. Resolves when the receipt may be
|
|
61
61
|
* acknowledged. Rejects when a listener throws; the next replay then hands
|
|
62
62
|
* the receipt off again.
|
|
63
63
|
*/
|
|
64
|
-
handOff(receipt:
|
|
64
|
+
handOff(receipt: SignalProtocolRelayDeliveryReceipt): Promise<void>;
|
|
65
65
|
}
|
|
66
66
|
/** Declare the receipt intake of this relay. */
|
|
67
|
-
export declare function
|
|
67
|
+
export declare function declareSignalProtocolRelayReceiptIntake(signalRelay: object, intake: SignalProtocolRelayReceiptIntake): void;
|
|
68
68
|
/** The receipt intake that this relay object declared. A wrapper declares none. */
|
|
69
|
-
export declare function
|
|
70
|
-
//# sourceMappingURL=relay-receipt-intake.d.ts.map
|
|
69
|
+
export declare function signalRelayReceiptIntakeOf(signalRelay: object): SignalProtocolRelayReceiptIntake | undefined;
|
|
70
|
+
//# sourceMappingURL=signal-relay-receipt-intake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-relay-receipt-intake.d.ts","sourceRoot":"","sources":["../../client/signal-relay-receipt-intake.ts"],"names":[],"mappings":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