@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,6 +1,6 @@
|
|
|
1
1
|
let retainCleanup;
|
|
2
2
|
/** A strict-resume refusal. An unresolved cleanup remains owned by this error. */
|
|
3
|
-
export class
|
|
3
|
+
export class HostedSignalProtocolRelayResumeError extends Error {
|
|
4
4
|
code;
|
|
5
5
|
phase;
|
|
6
6
|
#cleanup;
|
|
@@ -41,4 +41,7 @@ export class HostedRelayResumeError extends Error {
|
|
|
41
41
|
export function retainHostedResumeCleanup(error, cleanup) {
|
|
42
42
|
retainCleanup(error, cleanup);
|
|
43
43
|
}
|
|
44
|
+
// Names before the Signal Protocol Relay rename. SDK 15.0.0 removes them.
|
|
45
|
+
/** @deprecated Use `HostedSignalProtocolRelayResumeError`. SDK 15.0.0 removes this name. */
|
|
46
|
+
export const HostedRelayResumeError = HostedSignalProtocolRelayResumeError;
|
|
44
47
|
//# sourceMappingURL=hosted-resume-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-resume-error.js","sourceRoot":"","sources":["../../client/hosted-resume-error.ts"],"names":[],"mappings":"AAiBA,IAAI,aAGK,CAAC;AACV,kFAAkF;AAClF,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"hosted-resume-error.js","sourceRoot":"","sources":["../../client/hosted-resume-error.ts"],"names":[],"mappings":"AAiBA,IAAI,aAGK,CAAC;AACV,kFAAkF;AAClF,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IAOlD,IAAI;IACJ,KAAK;IAPhB,QAAQ,CAAuB;IAC/B,SAAS,CAAiB;IAC1B,MAAM,CAAC,gBAAgB,GAAG,CAAC,aAAa,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC5D,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,YACW,IAA8C,EAC9C,KAA2C,EACpD,OAAsB;QAEtB,KAAK,CAAC,kDAAkD,EAAE,OAAO,CAAC,CAAC;oBAJ1D,IAAI;qBACJ,KAAK;QAId,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;IACD,8EAA8E;IAC9E,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;IACrC,CAAC;IACD,iFAAiF;IACjF,KAAK,CAAC,YAAY;QAChB,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,EAAE;YAC3B,MAAM,OAAO,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC5B,CAAC,CAAC,EAAE,CAAC;QACL,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC;QACvB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC7B,CAAC;IACH,CAAC;CACF;AACD,8EAA8E;AAC9E,MAAM,UAAU,yBAAyB,CACvC,KAA2C,EAC3C,OAA4B;IAE5B,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,0EAA0E;AAC1E,4FAA4F;AAC5F,MAAM,CAAC,MAAM,sBAAsB,GAAG,oCAAoC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DefaultSignalProtocolClient } from './client.js';
|
|
2
2
|
import { type HostedSignalProtocolClientOptions } from './hosted.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type HostedSignalProtocolRelayResumeProgressCallback } from './hosted-resume-error.js';
|
|
4
4
|
/** Existing hosted options without any registration/assertion authority. */
|
|
5
5
|
export type HostedSignalProtocolResumeOptions = Omit<HostedSignalProtocolClientOptions, 'adapters' | 'hosted'> & {
|
|
6
6
|
readonly adapters: Omit<HostedSignalProtocolClientOptions['adapters'], 'protocolManager'> & {
|
|
@@ -10,7 +10,7 @@ export type HostedSignalProtocolResumeOptions = Omit<HostedSignalProtocolClientO
|
|
|
10
10
|
readonly getIdentityAssertion?: never;
|
|
11
11
|
readonly assertionPurpose?: never;
|
|
12
12
|
readonly assurance?: never;
|
|
13
|
-
readonly onProgress?:
|
|
13
|
+
readonly onProgress?: HostedSignalProtocolRelayResumeProgressCallback;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -18,7 +18,7 @@ export type HostedSignalProtocolResumeOptions = Omit<HostedSignalProtocolClientO
|
|
|
18
18
|
* Renews the token and starts the ordinary client, including prekey maintenance and
|
|
19
19
|
* automatic subscription. Never requests assertions or registers a replacement.
|
|
20
20
|
* The caller owns the already-open store and must not use it concurrently.
|
|
21
|
-
* On an unresolved stop, the thrown
|
|
21
|
+
* On an unresolved stop, the thrown HostedSignalProtocolRelayResumeError owns retryCleanup().
|
|
22
22
|
*/
|
|
23
23
|
export declare function resumeHostedSignalProtocolClient(options: HostedSignalProtocolResumeOptions): Promise<DefaultSignalProtocolClient>;
|
|
24
24
|
//# sourceMappingURL=hosted-resume.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-resume.d.ts","sourceRoot":"","sources":["../../client/hosted-resume.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,UAAU,CAAC;AAElB,OAAO,
|
|
1
|
+
{"version":3,"file":"hosted-resume.d.ts","sourceRoot":"","sources":["../../client/hosted-resume.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,UAAU,CAAC;AAElB,OAAO,EAIL,KAAK,iCAAiC,EACvC,MAAM,UAAU,CAAC;AAIlB,OAAO,EAIL,KAAK,+CAA+C,EACrD,MAAM,uBAAuB,CAAC;AAE/B,4EAA4E;AAC5E,MAAM,MAAM,iCAAiC,GAAG,IAAI,CAClD,iCAAiC,EACjC,UAAU,GAAG,QAAQ,CACtB,GAAG;IACF,QAAQ,CAAC,QAAQ,EAAE,IAAI,CACrB,iCAAiC,CAAC,UAAU,CAAC,EAC7C,iBAAiB,CAClB,GAAG;QAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,IAAI,CACnB,iCAAiC,CAAC,QAAQ,CAAC,EAC3C,sBAAsB,GAAG,kBAAkB,GAAG,WAAW,GAAG,YAAY,CACzE,GAAG;QACF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC;QACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;QAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;QAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,+CAA+C,CAAC;KACvE,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAoGtC"}
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import { readRetainedIdentities, RetainedIdentityError, } from '../internal/manager/retained-identity.js';
|
|
3
3
|
import { createClientWithRetainedIdentities, } from './client.js';
|
|
4
4
|
import { ClientStartupCleanupError } from './startup-cleanup.js';
|
|
5
|
-
import { createClientFromHostedResult, getExistingDeviceAuthentication, } from './hosted.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { createClientFromHostedResult, getExistingDeviceAuthentication, hostedSignalProtocolRelayUrl, } from './hosted.js';
|
|
6
|
+
import { resolveHostedSignalProtocolRelayConnection } from './hosted-connection.js';
|
|
7
|
+
import { resumeHostedSignalProtocolRelayTransport } from './hosted-transport.js';
|
|
8
|
+
import { assertHostedSignalProtocolRelayProfileKeys } from './hosted-profile-keys.js';
|
|
9
|
+
import { HostedSignalProtocolRelayResumeError, retainHostedResumeCleanup, } from './hosted-resume-error.js';
|
|
10
10
|
/**
|
|
11
11
|
* Require the existing permanent identities, device key and scoped hosted session.
|
|
12
12
|
* Renews the token and starts the ordinary client, including prekey maintenance and
|
|
13
13
|
* automatic subscription. Never requests assertions or registers a replacement.
|
|
14
14
|
* The caller owns the already-open store and must not use it concurrently.
|
|
15
|
-
* On an unresolved stop, the thrown
|
|
15
|
+
* On an unresolved stop, the thrown HostedSignalProtocolRelayResumeError owns retryCleanup().
|
|
16
16
|
*/
|
|
17
17
|
export async function resumeHostedSignalProtocolClient(options) {
|
|
18
18
|
const { adapters, hosted, ...clientOptions } = options;
|
|
@@ -21,7 +21,7 @@ export async function resumeHostedSignalProtocolClient(options) {
|
|
|
21
21
|
throw new TypeError('Strict hosted resume does not accept registration options or a custom protocol manager.');
|
|
22
22
|
}
|
|
23
23
|
if (hosted.profileKeys !== undefined)
|
|
24
|
-
|
|
24
|
+
assertHostedSignalProtocolRelayProfileKeys(hosted.profileKeys);
|
|
25
25
|
let phase = 'reading-local-state';
|
|
26
26
|
let captured;
|
|
27
27
|
const progress = (next) => {
|
|
@@ -32,9 +32,9 @@ export async function resumeHostedSignalProtocolClient(options) {
|
|
|
32
32
|
progress('reading-local-state');
|
|
33
33
|
// Hosted composition activates ACI. The manager checks all actual active types.
|
|
34
34
|
const identities = await readRetainedIdentities(adapters.storage, ['aci']);
|
|
35
|
-
const connection = await
|
|
35
|
+
const connection = await resolveHostedSignalProtocolRelayConnection(hostedSignalProtocolRelayUrl(hosted, 'resumeHostedSignalProtocolClient'));
|
|
36
36
|
const deviceAuthentication = await getExistingDeviceAuthentication(adapters.storage, connection.publishableKey, true);
|
|
37
|
-
const resumed = await
|
|
37
|
+
const resumed = await resumeHostedSignalProtocolRelayTransport({
|
|
38
38
|
connection,
|
|
39
39
|
deviceAuthentication,
|
|
40
40
|
storage: adapters.storage,
|
|
@@ -42,7 +42,7 @@ export async function resumeHostedSignalProtocolClient(options) {
|
|
|
42
42
|
onAuthenticating: () => progress('authenticating'),
|
|
43
43
|
});
|
|
44
44
|
if (!resumed)
|
|
45
|
-
throw new
|
|
45
|
+
throw new HostedSignalProtocolRelayResumeError('RETAINED_SESSION_UNAVAILABLE', 'reading-local-state');
|
|
46
46
|
progress('initializing');
|
|
47
47
|
const client = await createClientFromHostedResult(resumed, connection, adapters, clientOptions, hosted.sealedSenderAccessMode, resumed.remoteObjectStore, resumed.transport, hosted.profileKeys, async (userId, config) => {
|
|
48
48
|
captured = await createClientWithRetainedIdentities(userId, config, identities);
|
|
@@ -64,7 +64,7 @@ export async function resumeHostedSignalProtocolClient(options) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
if (failure instanceof ClientStartupCleanupError) {
|
|
67
|
-
const error = new
|
|
67
|
+
const error = new HostedSignalProtocolRelayResumeError('RESUME_CLEANUP_UNRESOLVED', phase, { cause: failure.failure });
|
|
68
68
|
retainHostedResumeCleanup(error, failure.retryCleanup);
|
|
69
69
|
throw error;
|
|
70
70
|
}
|
|
@@ -74,7 +74,7 @@ export async function resumeHostedSignalProtocolClient(options) {
|
|
|
74
74
|
: failure.reason === 'unreadable'
|
|
75
75
|
? 'RETAINED_STATE_UNREADABLE'
|
|
76
76
|
: 'RETAINED_IDENTITY_UNAVAILABLE';
|
|
77
|
-
throw new
|
|
77
|
+
throw new HostedSignalProtocolRelayResumeError(code, phase, { cause: failure });
|
|
78
78
|
}
|
|
79
79
|
throw failure;
|
|
80
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-resume.js","sourceRoot":"","sources":["../../client/hosted-resume.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,kCAAkC,GAEnC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,
|
|
1
|
+
{"version":3,"file":"hosted-resume.js","sourceRoot":"","sources":["../../client/hosted-resume.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,kCAAkC,GAEnC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,4BAA4B,GAE7B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,0CAA0C,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,0CAA0C,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EACL,oCAAoC,EACpC,yBAAyB,GAG1B,MAAM,uBAAuB,CAAC;AAsB/B;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CAAC,OAAO,EAAE,CAC3B,CAAC;YACF,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,IAAI,OAAO,YAAY,qBAAqB,EAAE,CAAC;YAC7C,MAAM,IAAI,GACR,OAAO,CAAC,MAAM,KAAK,SAAS;gBAC1B,CAAC,CAAC,2BAA2B;gBAC7B,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY;oBAC/B,CAAC,CAAC,2BAA2B;oBAC7B,CAAC,CAAC,+BAA+B,CAAC;YACxC,MAAM,IAAI,oCAAoC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,OAAO,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -12,21 +12,98 @@ import type { GetIdentityAssertion } from './hosted.js';
|
|
|
12
12
|
* Sandbox account. Another device of the account joins through device linking.
|
|
13
13
|
*
|
|
14
14
|
* The callback rejects a request for a production environment, for recovery,
|
|
15
|
-
* for provider migration, or for recent or step-up assurance.
|
|
16
|
-
*
|
|
15
|
+
* for provider migration, or for recent or step-up assurance. This helper is
|
|
16
|
+
* the Sandbox-only guard, and it is not deprecated. For a Production project in
|
|
17
|
+
* device-owned mode, use {@link hostedSignalProtocolRelayDeviceOwnedIdentity}. For a
|
|
18
|
+
* Production project in application-bound mode, supply a `getIdentityAssertion`
|
|
19
|
+
* callback that returns an assertion from your backend.
|
|
20
|
+
*
|
|
21
|
+
* The key is stored under a metadata key prefix followed by the base64
|
|
22
|
+
* SHA-256 digest of the publishable key. The helper reads the prefix
|
|
23
|
+
* `'signalRelay.sandboxIdentity.v2:'` first and the prefix
|
|
24
|
+
* `'hostedRelay.sandboxIdentity.v1:'` second. This release stores a new key
|
|
25
|
+
* under `'hostedRelay.sandboxIdentity.v1:'`, the prefix that SDK 14.1.0 and
|
|
26
|
+
* earlier read and write. A later release stores a new key under
|
|
27
|
+
* `'signalRelay.sandboxIdentity.v2:'`. SDK 15 still reads the earlier prefix,
|
|
28
|
+
* so an existing Sandbox account keeps its key. Both helpers keep this
|
|
29
|
+
* persisted format. So for the same store and publishable key, both helpers
|
|
30
|
+
* sign with the same key.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const storage = inMemoryStore();
|
|
35
|
+
* const client = await createHostedSignalProtocolClient({
|
|
36
|
+
* adapters: { storage },
|
|
37
|
+
* hosted: {
|
|
38
|
+
* signalProtocolRelayUrl: process.env.OPEN_E2EE_SIGNAL_RELAY_URL ?? process.env.OPEN_E2EE_RELAY_URL!,
|
|
39
|
+
* getIdentityAssertion: hostedSignalProtocolRelaySandboxIdentity(storage),
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function hostedSignalProtocolRelaySandboxIdentity(storage: SignalProtocolLocalStore): GetIdentityAssertion;
|
|
45
|
+
/**
|
|
46
|
+
* Creates the identity assertion callback for a device-owned account in a
|
|
47
|
+
* Sandbox environment, or in a Production environment that is configured in
|
|
17
48
|
* device-owned identity mode.
|
|
18
49
|
*
|
|
50
|
+
* The callback signs a short-lived device-owned assertion with an Ed25519 key
|
|
51
|
+
* that it keeps in `storage`. It creates the key on the first call and uses the
|
|
52
|
+
* same key after that, so the Relay returns the same account each time the
|
|
53
|
+
* device registers. The key is separate for each publishable key. Pass the
|
|
54
|
+
* same store as `adapters.storage`. The key never leaves the store. A device
|
|
55
|
+
* that loses the store loses the account, and its next registration creates a
|
|
56
|
+
* new account: the Relay refuses device-owned recovery. Another device of the
|
|
57
|
+
* account joins through device linking.
|
|
58
|
+
*
|
|
59
|
+
* The assertion is a compact JWS. Its protected header is
|
|
60
|
+
* `{ alg: 'EdDSA', typ: 'JWT', jwk: { kty: 'OKP', crv: 'Ed25519', x } }`,
|
|
61
|
+
* where `x` is the base64url public key. Its claims are:
|
|
62
|
+
*
|
|
63
|
+
* - `iss`: `'https://relay.open-e2ee.dev/device-owned'`.
|
|
64
|
+
* - `aud`: the publishable key of the request.
|
|
65
|
+
* - `sub`: the RFC 7638 SHA-256 thumbprint of the embedded JWK, base64url.
|
|
66
|
+
* - `iat` and `nbf`: the issue time in seconds. `exp`: `iat + 300`.
|
|
67
|
+
* - `jti`: a new UUID for each assertion.
|
|
68
|
+
* - `purpose`: `'register'`. `assurance`: `'normal'`.
|
|
69
|
+
* `token_use`: `'identity'`.
|
|
70
|
+
*
|
|
71
|
+
* The callback rejects a request for an environment other than Sandbox or
|
|
72
|
+
* Production, for recovery, for refresh or provider migration, or for recent or
|
|
73
|
+
* step-up assurance. It creates no key for a request that it rejects.
|
|
74
|
+
*
|
|
75
|
+
* The Production project must be configured in device-owned identity mode. A
|
|
76
|
+
* project in application-bound mode refuses this assertion with
|
|
77
|
+
* `ASSERTION_INVALID`. For that mode, supply a `getIdentityAssertion` callback
|
|
78
|
+
* that returns an assertion from your backend.
|
|
79
|
+
*
|
|
80
|
+
* The key is stored under a metadata key prefix followed by the base64
|
|
81
|
+
* SHA-256 digest of the publishable key. The helper reads the prefix
|
|
82
|
+
* `'signalRelay.sandboxIdentity.v2:'` first and the prefix
|
|
83
|
+
* `'hostedRelay.sandboxIdentity.v1:'` second. This release stores a new key
|
|
84
|
+
* under `'hostedRelay.sandboxIdentity.v1:'`, the prefix that SDK 14.1.0 and
|
|
85
|
+
* earlier read and write. A later release stores a new key under
|
|
86
|
+
* `'signalRelay.sandboxIdentity.v2:'`. SDK 15 still reads the earlier prefix,
|
|
87
|
+
* so an existing account keeps its key. Both helpers keep this persisted
|
|
88
|
+
* format. So for the same store and publishable key, this helper and
|
|
89
|
+
* {@link hostedSignalProtocolRelaySandboxIdentity} sign with the same key, and
|
|
90
|
+
* the Relay returns the same account.
|
|
91
|
+
*
|
|
19
92
|
* @example
|
|
20
93
|
* ```ts
|
|
21
94
|
* const storage = inMemoryStore();
|
|
22
95
|
* const client = await createHostedSignalProtocolClient({
|
|
23
96
|
* adapters: { storage },
|
|
24
97
|
* hosted: {
|
|
25
|
-
*
|
|
26
|
-
* getIdentityAssertion:
|
|
98
|
+
* signalProtocolRelayUrl: process.env.OPEN_E2EE_SIGNAL_RELAY_URL ?? process.env.OPEN_E2EE_RELAY_URL!,
|
|
99
|
+
* getIdentityAssertion: hostedSignalProtocolRelayDeviceOwnedIdentity(storage),
|
|
27
100
|
* },
|
|
28
101
|
* });
|
|
29
102
|
* ```
|
|
30
103
|
*/
|
|
31
|
-
export declare function
|
|
104
|
+
export declare function hostedSignalProtocolRelayDeviceOwnedIdentity(storage: SignalProtocolLocalStore): GetIdentityAssertion;
|
|
105
|
+
/** @deprecated Use `hostedSignalProtocolRelayDeviceOwnedIdentity`. SDK 15.0.0 removes this name. */
|
|
106
|
+
export declare const hostedRelayDeviceOwnedIdentity: typeof hostedSignalProtocolRelayDeviceOwnedIdentity;
|
|
107
|
+
/** @deprecated Use `hostedSignalProtocolRelaySandboxIdentity`. SDK 15.0.0 removes this name. */
|
|
108
|
+
export declare const hostedRelaySandboxIdentity: typeof hostedSignalProtocolRelaySandboxIdentity;
|
|
32
109
|
//# sourceMappingURL=hosted-sandbox-identity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-sandbox-identity.d.ts","sourceRoot":"","sources":["../../client/hosted-sandbox-identity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hosted-sandbox-identity.d.ts","sourceRoot":"","sources":["../../client/hosted-sandbox-identity.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAU,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAA4B,MAAM,UAAU,CAAC;AAkM/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,wBAAwB,GAChC,oBAAoB,CAEtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,wBAAwB,GAChC,oBAAoB,CAEtB;AAGD,oGAAoG;AACpG,eAAO,MAAM,8BAA8B,qDAA+C,CAAC;AAC3F,gGAAgG;AAChG,eAAO,MAAM,0BAA0B,iDAA2C,CAAC"}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Device-owned identity for
|
|
2
|
+
* Device-owned identity for the Signal Protocol Relay.
|
|
3
3
|
*
|
|
4
|
-
* A Sandbox environment
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* A Sandbox environment, and a Production environment in device-owned mode,
|
|
5
|
+
* verify a device-owned assertion: a JWT that the device signs with its own
|
|
6
|
+
* Ed25519 key and that carries the public key in its header. The Relay binds
|
|
7
|
+
* the account to the RFC 7638 thumbprint of that key. So the key is the
|
|
8
|
+
* account identity in the environment, and this module keeps it in the
|
|
9
|
+
* device-local store next to the protocol identity. A device that loses its
|
|
10
|
+
* store loses the account. Another device of the account joins through device
|
|
11
|
+
* linking, not with a copy of this key.
|
|
11
12
|
*
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The helpers sign only registration assertions. `hostedSignalProtocolRelaySandboxIdentity`
|
|
14
|
+
* serves only a Sandbox connection. `hostedSignalProtocolRelayDeviceOwnedIdentity` serves a
|
|
15
|
+
* Sandbox connection or a device-owned Production connection. An
|
|
16
|
+
* application-bound Production project needs an application callback. Recovery
|
|
17
|
+
* and provider migration need an identity provider that authenticates the user.
|
|
15
18
|
*/
|
|
16
19
|
import { base64ToBytes, bytesToBase64, bytesToUrlSafeBase64, generateSigningKeyPair, generateUuidV4, sha256, sign, stringToBytes, verify, } from '../internal/crypto/index.js';
|
|
17
|
-
|
|
20
|
+
import { hostedStoreRecordKey, readHostedStoreRecord, writeHostedStoreRecord, } from './hosted-store-records.js';
|
|
21
|
+
/**
|
|
22
|
+
* The metadata key prefixes of the stored device-owned key. They are a
|
|
23
|
+
* persisted format that both helpers keep. A read that skipped the earlier
|
|
24
|
+
* prefix would orphan the existing keys, and so the existing accounts.
|
|
25
|
+
*/
|
|
26
|
+
const SANDBOX_IDENTITY_METADATA_PREFIX = {
|
|
27
|
+
current: 'signalRelay.sandboxIdentity.v2:',
|
|
28
|
+
earlier: 'hostedRelay.sandboxIdentity.v1:',
|
|
29
|
+
};
|
|
18
30
|
const DEVICE_OWNED_ISSUER = 'https://relay.open-e2ee.dev/device-owned';
|
|
19
31
|
/** The Relay accepts a lifetime of up to 600 seconds. */
|
|
20
32
|
const ASSERTION_LIFETIME_SECONDS = 300;
|
|
@@ -53,15 +65,15 @@ function decodeStoredKey(value) {
|
|
|
53
65
|
};
|
|
54
66
|
}
|
|
55
67
|
async function metadataKey(publishableKey) {
|
|
56
|
-
return
|
|
68
|
+
return hostedStoreRecordKey(SANDBOX_IDENTITY_METADATA_PREFIX, bytesToBase64(await sha256(stringToBytes(publishableKey))));
|
|
57
69
|
}
|
|
58
70
|
async function loadOrCreateKey(storage, publishableKey) {
|
|
59
71
|
const key = await metadataKey(publishableKey);
|
|
60
|
-
const stored = await storage
|
|
72
|
+
const stored = await readHostedStoreRecord(storage, key);
|
|
61
73
|
if (stored)
|
|
62
74
|
return decodeStoredKey(stored);
|
|
63
75
|
const created = await generateSigningKeyPair();
|
|
64
|
-
await storage
|
|
76
|
+
await writeHostedStoreRecord(storage, key, JSON.stringify(created));
|
|
65
77
|
return created;
|
|
66
78
|
}
|
|
67
79
|
/**
|
|
@@ -84,51 +96,38 @@ function sandboxIdentityKey(storage, publishableKey) {
|
|
|
84
96
|
pending.set(publishableKey, created);
|
|
85
97
|
return created;
|
|
86
98
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
const SANDBOX_SCOPE = {
|
|
100
|
+
name: 'sandbox identity',
|
|
101
|
+
environments: ['sandbox'],
|
|
102
|
+
environmentsLabel: 'a Sandbox environment',
|
|
103
|
+
};
|
|
104
|
+
const DEVICE_OWNED_SCOPE = {
|
|
105
|
+
name: 'device-owned identity',
|
|
106
|
+
environments: ['sandbox', 'production'],
|
|
107
|
+
environmentsLabel: 'a Sandbox or Production environment',
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Accepts only a normal-assurance registration request for an environment of
|
|
111
|
+
* the scope. The Relay refuses device-owned recovery and migration away from
|
|
112
|
+
* device-owned mode, so registration is the whole device-owned path.
|
|
113
|
+
*/
|
|
114
|
+
function assertRegistration(request, scope) {
|
|
115
|
+
if (!scope.environments.includes(request.environment)) {
|
|
116
|
+
throw new Error(`Signal Protocol Relay ${scope.name} works only with ${scope.environmentsLabel}`);
|
|
90
117
|
}
|
|
91
118
|
if (request.purpose !== 'register' || request.migration !== undefined) {
|
|
92
|
-
throw new Error(
|
|
119
|
+
throw new Error(`Signal Protocol Relay ${scope.name} supports only device registration`);
|
|
93
120
|
}
|
|
94
121
|
if (request.assurance !== undefined && request.assurance !== 'normal') {
|
|
95
|
-
throw new Error(
|
|
122
|
+
throw new Error(`Signal Protocol Relay ${scope.name} cannot assert recent or step-up assurance`);
|
|
96
123
|
}
|
|
97
124
|
}
|
|
98
125
|
function encodeSegment(value) {
|
|
99
126
|
return bytesToUrlSafeBase64(stringToBytes(JSON.stringify(value)));
|
|
100
127
|
}
|
|
101
|
-
|
|
102
|
-
* Creates the identity assertion callback for a Sandbox environment of the
|
|
103
|
-
* Signal Protocol Relay.
|
|
104
|
-
*
|
|
105
|
-
* The callback signs a short-lived device-owned assertion with an Ed25519 key
|
|
106
|
-
* that it keeps in `storage`. It creates the key on the first call and uses the
|
|
107
|
-
* same key after that, so the Relay returns the same account each time the
|
|
108
|
-
* device registers. The key is separate for each publishable key. Pass the
|
|
109
|
-
* same store as `adapters.storage`. A device that loses the store loses the
|
|
110
|
-
* Sandbox account. Another device of the account joins through device linking.
|
|
111
|
-
*
|
|
112
|
-
* The callback rejects a request for a production environment, for recovery,
|
|
113
|
-
* for provider migration, or for recent or step-up assurance. Production needs
|
|
114
|
-
* a `getIdentityAssertion` callback for its configured application-bound or
|
|
115
|
-
* device-owned identity mode.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```ts
|
|
119
|
-
* const storage = inMemoryStore();
|
|
120
|
-
* const client = await createHostedSignalProtocolClient({
|
|
121
|
-
* adapters: { storage },
|
|
122
|
-
* hosted: {
|
|
123
|
-
* relayUrl: process.env.OPEN_E2EE_RELAY_URL!,
|
|
124
|
-
* getIdentityAssertion: hostedRelaySandboxIdentity(storage),
|
|
125
|
-
* },
|
|
126
|
-
* });
|
|
127
|
-
* ```
|
|
128
|
-
*/
|
|
129
|
-
export function hostedRelaySandboxIdentity(storage) {
|
|
128
|
+
function deviceOwnedIdentity(storage, scope) {
|
|
130
129
|
return async (request) => {
|
|
131
|
-
|
|
130
|
+
assertRegistration(request, scope);
|
|
132
131
|
const key = await sandboxIdentityKey(storage, request.publishableKey);
|
|
133
132
|
const x = bytesToUrlSafeBase64(base64ToBytes(key.publicKey));
|
|
134
133
|
const jwk = { crv: 'Ed25519', kty: 'OKP', x };
|
|
@@ -154,4 +153,115 @@ export function hostedRelaySandboxIdentity(storage) {
|
|
|
154
153
|
return `${signingInput}.${bytesToUrlSafeBase64(base64ToBytes(signature))}`;
|
|
155
154
|
};
|
|
156
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Creates the identity assertion callback for a Sandbox environment of the
|
|
158
|
+
* Signal Protocol Relay.
|
|
159
|
+
*
|
|
160
|
+
* The callback signs a short-lived device-owned assertion with an Ed25519 key
|
|
161
|
+
* that it keeps in `storage`. It creates the key on the first call and uses the
|
|
162
|
+
* same key after that, so the Relay returns the same account each time the
|
|
163
|
+
* device registers. The key is separate for each publishable key. Pass the
|
|
164
|
+
* same store as `adapters.storage`. A device that loses the store loses the
|
|
165
|
+
* Sandbox account. Another device of the account joins through device linking.
|
|
166
|
+
*
|
|
167
|
+
* The callback rejects a request for a production environment, for recovery,
|
|
168
|
+
* for provider migration, or for recent or step-up assurance. This helper is
|
|
169
|
+
* the Sandbox-only guard, and it is not deprecated. For a Production project in
|
|
170
|
+
* device-owned mode, use {@link hostedSignalProtocolRelayDeviceOwnedIdentity}. For a
|
|
171
|
+
* Production project in application-bound mode, supply a `getIdentityAssertion`
|
|
172
|
+
* callback that returns an assertion from your backend.
|
|
173
|
+
*
|
|
174
|
+
* The key is stored under a metadata key prefix followed by the base64
|
|
175
|
+
* SHA-256 digest of the publishable key. The helper reads the prefix
|
|
176
|
+
* `'signalRelay.sandboxIdentity.v2:'` first and the prefix
|
|
177
|
+
* `'hostedRelay.sandboxIdentity.v1:'` second. This release stores a new key
|
|
178
|
+
* under `'hostedRelay.sandboxIdentity.v1:'`, the prefix that SDK 14.1.0 and
|
|
179
|
+
* earlier read and write. A later release stores a new key under
|
|
180
|
+
* `'signalRelay.sandboxIdentity.v2:'`. SDK 15 still reads the earlier prefix,
|
|
181
|
+
* so an existing Sandbox account keeps its key. Both helpers keep this
|
|
182
|
+
* persisted format. So for the same store and publishable key, both helpers
|
|
183
|
+
* sign with the same key.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const storage = inMemoryStore();
|
|
188
|
+
* const client = await createHostedSignalProtocolClient({
|
|
189
|
+
* adapters: { storage },
|
|
190
|
+
* hosted: {
|
|
191
|
+
* signalProtocolRelayUrl: process.env.OPEN_E2EE_SIGNAL_RELAY_URL ?? process.env.OPEN_E2EE_RELAY_URL!,
|
|
192
|
+
* getIdentityAssertion: hostedSignalProtocolRelaySandboxIdentity(storage),
|
|
193
|
+
* },
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
export function hostedSignalProtocolRelaySandboxIdentity(storage) {
|
|
198
|
+
return deviceOwnedIdentity(storage, SANDBOX_SCOPE);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Creates the identity assertion callback for a device-owned account in a
|
|
202
|
+
* Sandbox environment, or in a Production environment that is configured in
|
|
203
|
+
* device-owned identity mode.
|
|
204
|
+
*
|
|
205
|
+
* The callback signs a short-lived device-owned assertion with an Ed25519 key
|
|
206
|
+
* that it keeps in `storage`. It creates the key on the first call and uses the
|
|
207
|
+
* same key after that, so the Relay returns the same account each time the
|
|
208
|
+
* device registers. The key is separate for each publishable key. Pass the
|
|
209
|
+
* same store as `adapters.storage`. The key never leaves the store. A device
|
|
210
|
+
* that loses the store loses the account, and its next registration creates a
|
|
211
|
+
* new account: the Relay refuses device-owned recovery. Another device of the
|
|
212
|
+
* account joins through device linking.
|
|
213
|
+
*
|
|
214
|
+
* The assertion is a compact JWS. Its protected header is
|
|
215
|
+
* `{ alg: 'EdDSA', typ: 'JWT', jwk: { kty: 'OKP', crv: 'Ed25519', x } }`,
|
|
216
|
+
* where `x` is the base64url public key. Its claims are:
|
|
217
|
+
*
|
|
218
|
+
* - `iss`: `'https://relay.open-e2ee.dev/device-owned'`.
|
|
219
|
+
* - `aud`: the publishable key of the request.
|
|
220
|
+
* - `sub`: the RFC 7638 SHA-256 thumbprint of the embedded JWK, base64url.
|
|
221
|
+
* - `iat` and `nbf`: the issue time in seconds. `exp`: `iat + 300`.
|
|
222
|
+
* - `jti`: a new UUID for each assertion.
|
|
223
|
+
* - `purpose`: `'register'`. `assurance`: `'normal'`.
|
|
224
|
+
* `token_use`: `'identity'`.
|
|
225
|
+
*
|
|
226
|
+
* The callback rejects a request for an environment other than Sandbox or
|
|
227
|
+
* Production, for recovery, for refresh or provider migration, or for recent or
|
|
228
|
+
* step-up assurance. It creates no key for a request that it rejects.
|
|
229
|
+
*
|
|
230
|
+
* The Production project must be configured in device-owned identity mode. A
|
|
231
|
+
* project in application-bound mode refuses this assertion with
|
|
232
|
+
* `ASSERTION_INVALID`. For that mode, supply a `getIdentityAssertion` callback
|
|
233
|
+
* that returns an assertion from your backend.
|
|
234
|
+
*
|
|
235
|
+
* The key is stored under a metadata key prefix followed by the base64
|
|
236
|
+
* SHA-256 digest of the publishable key. The helper reads the prefix
|
|
237
|
+
* `'signalRelay.sandboxIdentity.v2:'` first and the prefix
|
|
238
|
+
* `'hostedRelay.sandboxIdentity.v1:'` second. This release stores a new key
|
|
239
|
+
* under `'hostedRelay.sandboxIdentity.v1:'`, the prefix that SDK 14.1.0 and
|
|
240
|
+
* earlier read and write. A later release stores a new key under
|
|
241
|
+
* `'signalRelay.sandboxIdentity.v2:'`. SDK 15 still reads the earlier prefix,
|
|
242
|
+
* so an existing account keeps its key. Both helpers keep this persisted
|
|
243
|
+
* format. So for the same store and publishable key, this helper and
|
|
244
|
+
* {@link hostedSignalProtocolRelaySandboxIdentity} sign with the same key, and
|
|
245
|
+
* the Relay returns the same account.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* const storage = inMemoryStore();
|
|
250
|
+
* const client = await createHostedSignalProtocolClient({
|
|
251
|
+
* adapters: { storage },
|
|
252
|
+
* hosted: {
|
|
253
|
+
* signalProtocolRelayUrl: process.env.OPEN_E2EE_SIGNAL_RELAY_URL ?? process.env.OPEN_E2EE_RELAY_URL!,
|
|
254
|
+
* getIdentityAssertion: hostedSignalProtocolRelayDeviceOwnedIdentity(storage),
|
|
255
|
+
* },
|
|
256
|
+
* });
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
export function hostedSignalProtocolRelayDeviceOwnedIdentity(storage) {
|
|
260
|
+
return deviceOwnedIdentity(storage, DEVICE_OWNED_SCOPE);
|
|
261
|
+
}
|
|
262
|
+
// Names before the Signal Protocol Relay rename. SDK 15.0.0 removes them.
|
|
263
|
+
/** @deprecated Use `hostedSignalProtocolRelayDeviceOwnedIdentity`. SDK 15.0.0 removes this name. */
|
|
264
|
+
export const hostedRelayDeviceOwnedIdentity = hostedSignalProtocolRelayDeviceOwnedIdentity;
|
|
265
|
+
/** @deprecated Use `hostedSignalProtocolRelaySandboxIdentity`. SDK 15.0.0 removes this name. */
|
|
266
|
+
export const hostedRelaySandboxIdentity = hostedSignalProtocolRelaySandboxIdentity;
|
|
157
267
|
//# sourceMappingURL=hosted-sandbox-identity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-sandbox-identity.js","sourceRoot":"","sources":["../../client/hosted-sandbox-identity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hosted-sandbox-identity.js","sourceRoot":"","sources":["../../client/hosted-sandbox-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,MAAM,EACN,IAAI,EACJ,aAAa,EACb,MAAM,GACP,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,MAAM,gCAAgC,GAA4B;IAChE,OAAO,EAAE,iCAAiC;IAC1C,OAAO,EAAE,iCAAiC;CAC3C,CAAC;AACF,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AACvE,yDAAyD;AACzD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAO7B,+DAA+D;AAC/D,MAAM,WAAW,GAAG,IAAI,OAAO,EAG5B,CAAC;AAEJ,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAC5E,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAA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AAED,0EAA0E;AAC1E,oGAAoG;AACpG,MAAM,CAAC,MAAM,8BAA8B,GAAG,4CAA4C,CAAC;AAC3F,gGAAgG;AAChG,MAAM,CAAC,MAAM,0BAA0B,GAAG,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metadata keys of the hosted records in the application store.
|
|
3
|
+
*
|
|
4
|
+
* Each hosted record has two keys. The current key has the prefix
|
|
5
|
+
* `signalRelay.<record>.v2:`. The earlier key has the `.v1:` prefix that SDK
|
|
6
|
+
* 14.1.0 and earlier read and write. Each file that owns a record names its
|
|
7
|
+
* two prefixes. The suffix after the prefix is the same in the two keys.
|
|
8
|
+
*
|
|
9
|
+
* In this release a read takes the current key first and the earlier key
|
|
10
|
+
* second, and a write keeps the earlier key. So a store that SDK 14.1.0 wrote
|
|
11
|
+
* opens with its records, and a return to SDK 14.1.0 still finds every
|
|
12
|
+
* record. A later release writes the current key. A write also updates a
|
|
13
|
+
* current key that the store holds, so the current key, which a read prefers,
|
|
14
|
+
* never keeps a value that a later write replaced. SDK 15 still reads the
|
|
15
|
+
* earlier key.
|
|
16
|
+
*/
|
|
17
|
+
import type { SignalProtocolLocalStore } from '../types/index.js';
|
|
18
|
+
/** The two metadata key prefixes of one hosted record. */
|
|
19
|
+
export interface HostedStoreRecordPrefix {
|
|
20
|
+
/** The `signalRelay.<record>.v2:` prefix. A read takes it first. */
|
|
21
|
+
readonly current: string;
|
|
22
|
+
/** The `.v1:` prefix that SDK 14.1.0 writes. A read takes it second. */
|
|
23
|
+
readonly earlier: string;
|
|
24
|
+
}
|
|
25
|
+
/** The two metadata keys of one hosted record. */
|
|
26
|
+
export type HostedStoreRecordKey = HostedStoreRecordPrefix;
|
|
27
|
+
type RecordReader = Pick<SignalProtocolLocalStore, 'getMetadata'>;
|
|
28
|
+
type RecordWriter = Pick<SignalProtocolLocalStore, 'getMetadata' | 'setMetadata'>;
|
|
29
|
+
type RecordRemover = Pick<SignalProtocolLocalStore, 'deleteMetadata'>;
|
|
30
|
+
/** The keys of the record that `suffix` names under `prefix`. */
|
|
31
|
+
export declare function hostedStoreRecordKey(prefix: HostedStoreRecordPrefix, suffix: string): HostedStoreRecordKey;
|
|
32
|
+
/**
|
|
33
|
+
* The stored value of a record, or `null` when neither key holds one. The
|
|
34
|
+
* current key wins when the store holds both keys.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readHostedStoreRecord(store: RecordReader, key: HostedStoreRecordKey): Promise<string | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Stores a record under its earlier key. It first replaces a current key that
|
|
39
|
+
* the store holds, so that a failure between the two writes leaves the newer
|
|
40
|
+
* value under the key that a read prefers.
|
|
41
|
+
*/
|
|
42
|
+
export declare function writeHostedStoreRecord(store: RecordWriter, key: HostedStoreRecordKey, value: string): Promise<void>;
|
|
43
|
+
/** Deletes both keys of a record, so a read finds no earlier value. */
|
|
44
|
+
export declare function deleteHostedStoreRecord(store: RecordRemover, key: HostedStoreRecordKey): Promise<void>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=hosted-store-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-store-records.d.ts","sourceRoot":"","sources":["../../client/hosted-store-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD,0DAA0D;AAC1D,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAE3D,KAAK,YAAY,GAAG,IAAI,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;AAClE,KAAK,YAAY,GAAG,IAAI,CAAC,wBAAwB,EAAE,aAAa,GAAG,aAAa,CAAC,CAAC;AAClF,KAAK,aAAa,GAAG,IAAI,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAEtE,iEAAiE;AACjE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,MAAM,GACb,oBAAoB,CAKtB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGxB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,oBAAoB,EACzB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,uEAAuE;AACvE,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The keys of the record that `suffix` names under `prefix`. */
|
|
2
|
+
export function hostedStoreRecordKey(prefix, suffix) {
|
|
3
|
+
return {
|
|
4
|
+
current: `${prefix.current}${suffix}`,
|
|
5
|
+
earlier: `${prefix.earlier}${suffix}`,
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The stored value of a record, or `null` when neither key holds one. The
|
|
10
|
+
* current key wins when the store holds both keys.
|
|
11
|
+
*/
|
|
12
|
+
export async function readHostedStoreRecord(store, key) {
|
|
13
|
+
const current = await store.getMetadata(key.current);
|
|
14
|
+
return current !== null ? current : store.getMetadata(key.earlier);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stores a record under its earlier key. It first replaces a current key that
|
|
18
|
+
* the store holds, so that a failure between the two writes leaves the newer
|
|
19
|
+
* value under the key that a read prefers.
|
|
20
|
+
*/
|
|
21
|
+
export async function writeHostedStoreRecord(store, key, value) {
|
|
22
|
+
if ((await store.getMetadata(key.current)) !== null) {
|
|
23
|
+
await store.setMetadata(key.current, value);
|
|
24
|
+
}
|
|
25
|
+
await store.setMetadata(key.earlier, value);
|
|
26
|
+
}
|
|
27
|
+
/** Deletes both keys of a record, so a read finds no earlier value. */
|
|
28
|
+
export async function deleteHostedStoreRecord(store, key) {
|
|
29
|
+
await store.deleteMetadata(key.current);
|
|
30
|
+
await store.deleteMetadata(key.earlier);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=hosted-store-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-store-records.js","sourceRoot":"","sources":["../../client/hosted-store-records.ts"],"names":[],"mappings":"AAiCA,iEAAiE;AACjE,MAAM,UAAU,oBAAoB,CAClC,MAA+B,EAC/B,MAAc;IAEd,OAAO;QACL,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE;QACrC,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE;KACtC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAmB,EACnB,GAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrD,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAAmB,EACnB,GAAyB,EACzB,KAAa;IAEb,IAAI,CAAC,MAAM,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACpD,MAAM,KAAK,CAAC,WAAW,CAAC,GAAG,C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