@open-e2ee/signal-protocol-sdk 8.1.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADAPTERS.md +13 -31
- package/ARCHITECTURE.md +5 -7
- package/CHANGELOG.md +258 -0
- package/README.md +36 -48
- package/SECURITY.md +2 -2
- package/client/README.md +9 -0
- package/device/README.md +16 -7
- package/dist/client/client.d.ts +25 -16
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +115 -95
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +10 -17
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/event-hooks.js +27 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/group-outbox.d.ts +31 -1
- package/dist/client/group-outbox.d.ts.map +1 -1
- package/dist/client/group-outbox.js +67 -58
- package/dist/client/group-outbox.js.map +1 -1
- package/dist/client/group-receive-authorization.d.ts +5 -0
- package/dist/client/group-receive-authorization.d.ts.map +1 -0
- package/dist/client/group-receive-authorization.js +32 -0
- package/dist/client/group-receive-authorization.js.map +1 -0
- package/dist/client/group-sender-key-operations.d.ts +15 -0
- package/dist/client/group-sender-key-operations.d.ts.map +1 -0
- package/dist/client/group-sender-key-operations.js +31 -0
- package/dist/client/group-sender-key-operations.js.map +1 -0
- package/dist/client/groups.d.ts +3 -1
- package/dist/client/groups.d.ts.map +1 -1
- package/dist/client/groups.js +5 -2
- package/dist/client/groups.js.map +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts +9 -1
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
- package/dist/client/hosted-anonymous-delivery.js +61 -22
- package/dist/client/hosted-anonymous-delivery.js.map +1 -1
- package/dist/client/hosted-transport.d.ts +7 -0
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +44 -6
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/key-rotation.d.ts.map +1 -1
- package/dist/client/key-rotation.js +2 -4
- package/dist/client/key-rotation.js.map +1 -1
- package/dist/client/prekeys.d.ts.map +1 -1
- package/dist/client/prekeys.js +1 -1
- package/dist/client/prekeys.js.map +1 -1
- package/dist/client/relay-device-refusal.d.ts +32 -0
- package/dist/client/relay-device-refusal.d.ts.map +1 -0
- package/dist/client/relay-device-refusal.js +36 -0
- package/dist/client/relay-device-refusal.js.map +1 -0
- package/dist/client/relay-subscription.d.ts +2 -0
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +3 -1
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/relay-work.d.ts +26 -0
- package/dist/client/relay-work.d.ts.map +1 -1
- package/dist/client/relay-work.js +37 -0
- package/dist/client/relay-work.js.map +1 -1
- package/dist/client/sealed-sender.d.ts.map +1 -1
- package/dist/client/sealed-sender.js +12 -17
- package/dist/client/sealed-sender.js.map +1 -1
- package/dist/client/sender-key-distribution.d.ts.map +1 -1
- package/dist/client/sender-key-distribution.js +4 -1
- package/dist/client/sender-key-distribution.js.map +1 -1
- package/dist/client/sessions.d.ts.map +1 -1
- package/dist/client/sessions.js +2 -4
- package/dist/client/sessions.js.map +1 -1
- package/dist/client/signal-service-cipher.d.ts +94 -6
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +483 -184
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/types.d.ts +7 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/index.d.ts +27 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -17
- package/dist/index.js.map +1 -1
- package/dist/internal/crypto/pq/kyber.d.ts +1 -1
- package/dist/internal/crypto/pq/kyber.js +1 -1
- package/dist/internal/encoding/proto/sender-key-message.d.ts +2 -2
- package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -1
- package/dist/internal/encoding/proto/sender-key-message.js +5 -2
- package/dist/internal/encoding/proto/sender-key-message.js.map +1 -1
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +5 -2
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/wire.d.ts +0 -2
- package/dist/internal/groups/wire.d.ts.map +1 -1
- package/dist/internal/groups/wire.js +0 -6
- package/dist/internal/groups/wire.js.map +1 -1
- package/dist/internal/manager/manager.d.ts +8 -7
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +34 -37
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts +0 -17
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
- package/dist/internal/protocol/double-ratchet/ratchet.js +0 -4
- package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.d.ts +2 -32
- package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.js +4 -85
- package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/index.d.ts +2 -2
- package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/index.js +2 -6
- package/dist/internal/protocol/sealed-sender/index.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +0 -19
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +1 -48
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts +9 -13
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +90 -95
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/protocol/spqr/index.d.ts +1 -1
- package/dist/internal/protocol/spqr/index.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/index.js +2 -2
- package/dist/internal/protocol/spqr/index.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts +0 -2
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js +4 -12
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js +1 -3
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/serialize.js +1 -4
- package/dist/internal/protocol/spqr/serialize.js.map +1 -1
- package/dist/internal/protocol/spqr/spqr.d.ts +1 -1
- package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/spqr.js +2 -3
- package/dist/internal/protocol/spqr/spqr.js.map +1 -1
- package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -1
- package/dist/internal/protocol/x3dh/x3dh.js +1 -1
- package/dist/internal/protocol/x3dh/x3dh.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.d.ts +3 -54
- package/dist/internal/protocol/zk/credentials/credentials.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.js +4 -91
- package/dist/internal/protocol/zk/credentials/credentials.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts +3 -64
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/endorsements.js +4 -134
- package/dist/internal/protocol/zk/credentials/endorsements.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/index.d.ts +3 -3
- package/dist/internal/protocol/zk/credentials/index.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/index.js +3 -3
- package/dist/internal/protocol/zk/credentials/index.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/issuance.d.ts +3 -26
- package/dist/internal/protocol/zk/credentials/issuance.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/issuance.js +3 -80
- package/dist/internal/protocol/zk/credentials/issuance.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.d.ts +4 -73
- package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.js +4 -152
- package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -1
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts +1 -61
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/auth-credential.js +2 -196
- package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -1
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts +1 -86
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js +1 -152
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js.map +1 -1
- package/dist/internal/protocol/zk/groups/index.d.ts +4 -4
- package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/index.js +4 -4
- package/dist/internal/protocol/zk/groups/index.js.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +2 -57
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-credential.js +2 -174
- package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -1
- package/dist/internal/protocol/zk/groups/server-params.d.ts +8 -72
- package/dist/internal/protocol/zk/groups/server-params.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/server-params.js +8 -108
- package/dist/internal/protocol/zk/groups/server-params.js.map +1 -1
- package/dist/internal/protocol/zk/proofs/sign.d.ts +1 -2
- package/dist/internal/protocol/zk/proofs/sign.d.ts.map +1 -1
- package/dist/internal/protocol/zk/proofs/sign.js +2 -11
- package/dist/internal/protocol/zk/proofs/sign.js.map +1 -1
- package/dist/internal/sesame/device-registry.d.ts +24 -4
- package/dist/internal/sesame/device-registry.d.ts.map +1 -1
- package/dist/internal/sesame/device-registry.js +55 -28
- package/dist/internal/sesame/device-registry.js.map +1 -1
- package/dist/internal/sesame/manager.d.ts +79 -11
- package/dist/internal/sesame/manager.d.ts.map +1 -1
- package/dist/internal/sesame/manager.js +381 -280
- package/dist/internal/sesame/manager.js.map +1 -1
- package/dist/internal/session/cipher.d.ts +0 -5
- package/dist/internal/session/cipher.d.ts.map +1 -1
- package/dist/internal/session/cipher.js +3 -9
- package/dist/internal/session/cipher.js.map +1 -1
- package/dist/internal/session/ratchet.d.ts.map +1 -1
- package/dist/internal/session/ratchet.js +0 -2
- package/dist/internal/session/ratchet.js.map +1 -1
- package/dist/internal/session/record-locks.d.ts +46 -0
- package/dist/internal/session/record-locks.d.ts.map +1 -0
- package/dist/internal/session/record-locks.js +72 -0
- package/dist/internal/session/record-locks.js.map +1 -0
- package/dist/local/store/expo/adapter.d.ts +8 -2
- package/dist/local/store/expo/adapter.d.ts.map +1 -1
- package/dist/local/store/expo/adapter.js +24 -3
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/expo/driver.d.ts +7 -0
- package/dist/local/store/expo/driver.d.ts.map +1 -1
- package/dist/local/store/expo/driver.js +16 -0
- package/dist/local/store/expo/driver.js.map +1 -1
- package/dist/local/store/key-value/adapter.d.ts +3 -3
- package/dist/local/store/key-value/adapter.d.ts.map +1 -1
- package/dist/local/store/key-value/adapter.js +91 -53
- package/dist/local/store/key-value/adapter.js.map +1 -1
- package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -1
- package/dist/local/store/key-value/backend-conformance.js +25 -0
- package/dist/local/store/key-value/backend-conformance.js.map +1 -1
- package/dist/local/store/key-value/batch.d.ts +3 -1
- package/dist/local/store/key-value/batch.d.ts.map +1 -1
- package/dist/local/store/key-value/batch.js +9 -1
- package/dist/local/store/key-value/batch.js.map +1 -1
- package/dist/local/store/key-value/storage.d.ts +6 -0
- package/dist/local/store/key-value/storage.d.ts.map +1 -1
- package/dist/local/store/key-value/transactional-backend.d.ts +1 -1
- package/dist/local/store/key-value/transactional-backend.js +1 -1
- package/dist/local/store/memory/adapter.d.ts +13 -3
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +122 -73
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/reliability.d.ts +16 -0
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +58 -28
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/local/store/sqlite/migrations.js +18 -0
- package/dist/local/store/sqlite/migrations.js.map +1 -1
- package/dist/local/store/sqlite/models/skipped-sender-key.d.ts +3 -3
- package/dist/local/store/sqlite/models/skipped-sender-key.d.ts.map +1 -1
- package/dist/local/store/sqlite/models/skipped-sender-key.js +13 -17
- package/dist/local/store/sqlite/models/skipped-sender-key.js.map +1 -1
- package/dist/local/store/sqlite/store.d.ts +3 -3
- package/dist/local/store/sqlite/store.d.ts.map +1 -1
- package/dist/local/store/sqlite/store.js +53 -23
- package/dist/local/store/sqlite/store.js.map +1 -1
- package/dist/local/store/web/adapter.d.ts +3 -3
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +122 -73
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/local/vault/electron-safe-storage.d.ts.map +1 -1
- package/dist/local/vault/electron-safe-storage.js +15 -2
- package/dist/local/vault/electron-safe-storage.js.map +1 -1
- package/dist/profile/index.d.ts +2 -1
- package/dist/profile/index.d.ts.map +1 -1
- package/dist/profile/index.js +2 -1
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/own-profile-key.d.ts +42 -0
- package/dist/profile/own-profile-key.d.ts.map +1 -0
- package/dist/profile/own-profile-key.js +64 -0
- package/dist/profile/own-profile-key.js.map +1 -0
- package/dist/profile/profile-key.d.ts +1 -34
- package/dist/profile/profile-key.d.ts.map +1 -1
- package/dist/profile/profile-key.js +3 -63
- package/dist/profile/profile-key.js.map +1 -1
- package/dist/profile/update-service.js +1 -1
- package/dist/profile/update-service.js.map +1 -1
- package/dist/remote/relay/index.d.ts +4 -7
- package/dist/remote/relay/index.d.ts.map +1 -1
- package/dist/remote/relay/index.js +5 -7
- package/dist/remote/relay/index.js.map +1 -1
- package/dist/remote/relay/types.d.ts +3 -3
- package/dist/types/api.d.ts +29 -8
- package/dist/types/api.d.ts.map +1 -1
- package/dist/username/link.d.ts.map +1 -1
- package/dist/username/link.js +1 -5
- package/dist/username/link.js.map +1 -1
- package/dist/utils/bounded-fan-out.d.ts +99 -0
- package/dist/utils/bounded-fan-out.d.ts.map +1 -0
- package/dist/utils/bounded-fan-out.js +180 -0
- package/dist/utils/bounded-fan-out.js.map +1 -0
- package/dist/utils/keyed-lock.d.ts +16 -0
- package/dist/utils/keyed-lock.d.ts.map +1 -0
- package/dist/utils/keyed-lock.js +39 -0
- package/dist/utils/keyed-lock.js.map +1 -0
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +3 -3
- package/dist/zk/credentials.d.ts +2 -2
- package/dist/zk/credentials.js +2 -2
- package/dist/zk/groups.d.ts +3 -3
- package/dist/zk/groups.d.ts.map +1 -1
- package/dist/zk/groups.js +3 -3
- package/dist/zk/groups.js.map +1 -1
- package/docs/ASSURANCE.md +69 -28
- package/docs/CLIENT_COMPOSITION.md +9 -3
- package/docs/DEVIATIONS.md +45 -27
- package/docs/GETTING_STARTED.md +42 -320
- package/docs/INTERFACES.md +7 -7
- package/docs/PACKAGE_SURFACE.md +14 -16
- package/docs/RECIPES.md +6 -112
- package/groups/README.md +9 -1
- package/hooks/README.md +11 -2
- package/local/store/README.md +26 -6
- package/local/store/expo/README.md +18 -5
- package/local/store/key-value/README.md +5 -3
- package/local/store/node/README.md +2 -1
- package/local/store/web-sqlite/README.md +28 -8
- package/local/vault/README.md +21 -2
- package/package.json +1 -30
- package/remote/README.md +12 -78
- package/remote/object-store/convex-r2/README.md +20 -42
- package/remote/relay/README.md +21 -18
- package/zk/README.md +6 -7
- package/dist/client/dual-store.d.ts +0 -70
- package/dist/client/dual-store.d.ts.map +0 -1
- package/dist/client/dual-store.js +0 -123
- package/dist/client/dual-store.js.map +0 -1
- package/dist/client/multi-device.d.ts +0 -74
- package/dist/client/multi-device.d.ts.map +0 -1
- package/dist/client/multi-device.js +0 -105
- package/dist/client/multi-device.js.map +0 -1
- package/dist/groups/server.d.ts +0 -10
- package/dist/groups/server.d.ts.map +0 -1
- package/dist/groups/server.js +0 -6
- package/dist/groups/server.js.map +0 -1
- package/dist/internal/encoding/index.d.ts +0 -2
- package/dist/internal/encoding/index.d.ts.map +0 -1
- package/dist/internal/encoding/index.js +0 -2
- package/dist/internal/encoding/index.js.map +0 -1
- package/dist/internal/groups/server-engine.d.ts +0 -118
- package/dist/internal/groups/server-engine.d.ts.map +0 -1
- package/dist/internal/groups/server-engine.js +0 -1268
- package/dist/internal/groups/server-engine.js.map +0 -1
- package/dist/internal/protocol/index.d.ts +0 -24
- package/dist/internal/protocol/index.d.ts.map +0 -1
- package/dist/internal/protocol/index.js +0 -9
- package/dist/internal/protocol/index.js.map +0 -1
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts +0 -56
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +0 -1
- package/dist/internal/protocol/sealed-sender/trust-root.js +0 -90
- package/dist/internal/protocol/sealed-sender/trust-root.js.map +0 -1
- package/dist/internal/protocol/triple-ratchet/index.d.ts +0 -21
- package/dist/internal/protocol/triple-ratchet/index.d.ts.map +0 -1
- package/dist/internal/protocol/triple-ratchet/index.js +0 -19
- package/dist/internal/protocol/triple-ratchet/index.js.map +0 -1
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +0 -233
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +0 -1
- package/dist/internal/protocol/triple-ratchet/ratchet.js +0 -254
- package/dist/internal/protocol/triple-ratchet/ratchet.js.map +0 -1
- package/dist/internal/protocol/zk/proofs/index.d.ts +0 -13
- package/dist/internal/protocol/zk/proofs/index.d.ts.map +0 -1
- package/dist/internal/protocol/zk/proofs/index.js +0 -7
- package/dist/internal/protocol/zk/proofs/index.js.map +0 -1
- package/dist/local/store/sqlite/index.d.ts +0 -20
- package/dist/local/store/sqlite/index.d.ts.map +0 -1
- package/dist/local/store/sqlite/index.js +0 -18
- package/dist/local/store/sqlite/index.js.map +0 -1
- package/dist/remote/object-store/convex-r2/server/index.d.ts +0 -2
- package/dist/remote/object-store/convex-r2/server/index.d.ts.map +0 -1
- package/dist/remote/object-store/convex-r2/server/index.js +0 -2
- package/dist/remote/object-store/convex-r2/server/index.js.map +0 -1
- package/dist/remote/object-store/convex-r2/server.d.ts +0 -129
- package/dist/remote/object-store/convex-r2/server.d.ts.map +0 -1
- package/dist/remote/object-store/convex-r2/server.js +0 -244
- package/dist/remote/object-store/convex-r2/server.js.map +0 -1
- package/dist/remote/relay/memory/adapter.d.ts +0 -252
- package/dist/remote/relay/memory/adapter.d.ts.map +0 -1
- package/dist/remote/relay/memory/adapter.js +0 -1058
- package/dist/remote/relay/memory/adapter.js.map +0 -1
- package/dist/remote/relay/memory/failures.d.ts +0 -58
- package/dist/remote/relay/memory/failures.d.ts.map +0 -1
- package/dist/remote/relay/memory/failures.js +0 -124
- package/dist/remote/relay/memory/failures.js.map +0 -1
- package/dist/remote/relay/memory/group-server.d.ts +0 -13
- package/dist/remote/relay/memory/group-server.d.ts.map +0 -1
- package/dist/remote/relay/memory/group-server.js +0 -19
- package/dist/remote/relay/memory/group-server.js.map +0 -1
- package/dist/remote/relay/memory/index.d.ts +0 -11
- package/dist/remote/relay/memory/index.d.ts.map +0 -1
- package/dist/remote/relay/memory/index.js +0 -7
- package/dist/remote/relay/memory/index.js.map +0 -1
- package/examples/browser/README.md +0 -35
- package/examples/browser/index.html +0 -27
- package/examples/browser/src/exchange.ts +0 -69
- package/examples/browser/src/main.ts +0 -63
- package/examples/browser/src/style.css +0 -9
- package/examples/browser/src/worker.ts +0 -10
- package/examples/browser/vite.config.ts +0 -9
- package/remote/relay/memory/README.md +0 -72
- package/scripts/oe-groups.mjs +0 -166
|
@@ -22,14 +22,11 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { ShoHmacSha256, RistrettoPoint } from '../proofs/sho.js';
|
|
24
24
|
import { IssuanceProofBuilder, BlindingKeyPair, VerificationFailure, } from '../credentials/issuance.js';
|
|
25
|
-
import { PresentationProofBuilder
|
|
25
|
+
import { PresentationProofBuilder } from '../credentials/presentation.js';
|
|
26
26
|
import { uidStructFromServiceId } from './uid-struct.js';
|
|
27
27
|
import { profileKeyStructNew } from './profile-key-struct.js';
|
|
28
|
-
import { UidEncryptionDomain } from './uid-encryption.js';
|
|
29
|
-
import { ProfileKeyEncryptionDomain } from './profile-key-encryption.js';
|
|
30
28
|
import { SECONDS_PER_DAY } from './group-params.js';
|
|
31
|
-
import {
|
|
32
|
-
import { Ciphertext } from '../credentials/attributes.js';
|
|
29
|
+
import { bytesToScalarCanonical } from '../proofs/sho.js';
|
|
33
30
|
const enc = new TextEncoder();
|
|
34
31
|
// ---------------------------------------------------------------------------
|
|
35
32
|
// Constants
|
|
@@ -92,39 +89,6 @@ export function createProfileKeyCredentialRequest(aci, profileKeyBytes, randomne
|
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
// ---------------------------------------------------------------------------
|
|
95
|
-
// Issuance (server side)
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
/**
|
|
98
|
-
* Issue an ExpiringProfileKeyCredential for an authenticated ACI, blinded
|
|
99
|
-
* ProfileKey request, and redemption time.
|
|
100
|
-
*
|
|
101
|
-
* Called by the server. Produces an issuance proof that the client can verify
|
|
102
|
-
* to extract the credential.
|
|
103
|
-
*
|
|
104
|
-
* The issuer sees the authenticated ACI and redemption time. It never receives
|
|
105
|
-
* the raw profile key or the client's blinding secret.
|
|
106
|
-
*
|
|
107
|
-
* CRITICAL: Use different randomness for each issuance. Reusing randomness
|
|
108
|
-
* effectively reveals the server's private key.
|
|
109
|
-
*
|
|
110
|
-
* @param credentialKeyPair - The server's profile key credential signing key pair
|
|
111
|
-
* @param aci - The user's ACI ServiceId
|
|
112
|
-
* @param request - Client-created blinded profile-key request
|
|
113
|
-
* @param redemptionTime - Day-aligned epoch timestamp (seconds)
|
|
114
|
-
* @param randomness - At least 32 bytes of cryptographically secure randomness
|
|
115
|
-
* @returns The issuance response to send to the client
|
|
116
|
-
*/
|
|
117
|
-
export function issueProfileKeyCredential(credentialKeyPair, aci, request, redemptionTime, randomness) {
|
|
118
|
-
const aciUid = uidStructFromServiceId(aci);
|
|
119
|
-
const builder = new IssuanceProofBuilder(CREDENTIAL_LABEL);
|
|
120
|
-
builder.addAttribute(aciUid);
|
|
121
|
-
builder.addPublicAttribute(redemptionTimePublicAttribute(redemptionTime));
|
|
122
|
-
const issuanceProof = builder
|
|
123
|
-
.addBlindedAttribute(request.blindedProfileKey)
|
|
124
|
-
.issue(credentialKeyPair, request.blindingPublicKey, randomness);
|
|
125
|
-
return { issuanceProof, redemptionTime };
|
|
126
|
-
}
|
|
127
|
-
// ---------------------------------------------------------------------------
|
|
128
92
|
// Receive (client side)
|
|
129
93
|
// ---------------------------------------------------------------------------
|
|
130
94
|
/**
|
|
@@ -215,39 +179,6 @@ export function presentProfileKeyCredential(publicKey, credential, groupSecretPa
|
|
|
215
179
|
};
|
|
216
180
|
}
|
|
217
181
|
// ---------------------------------------------------------------------------
|
|
218
|
-
// Verification (server side)
|
|
219
|
-
// ---------------------------------------------------------------------------
|
|
220
|
-
/**
|
|
221
|
-
* Verify a ProfileKeyCredentialPresentation against the server's key pair and
|
|
222
|
-
* the group's public parameters.
|
|
223
|
-
*
|
|
224
|
-
* Called by the server. Checks that:
|
|
225
|
-
* 1. The presentation proof is valid (ZK verification)
|
|
226
|
-
* 2. The credential has not expired (redemptionTime >= currentTime)
|
|
227
|
-
*
|
|
228
|
-
* @param credentialKeyPair - The server's profile key credential signing key pair
|
|
229
|
-
* @param groupPublicParams - The group's public parameters
|
|
230
|
-
* @param presentation - The client's presentation proof
|
|
231
|
-
* @param currentTime - Current time in epoch seconds for expiry check
|
|
232
|
-
* @returns true if the presentation is valid
|
|
233
|
-
* @throws {VerificationFailure} If the presentation proof is invalid or expired
|
|
234
|
-
*/
|
|
235
|
-
export function verifyProfileKeyCredentialPresentation(credentialKeyPair, groupPublicParams, presentation, currentTime) {
|
|
236
|
-
const { proof, uidEncCiphertext, profileKeyEncCiphertext, redemptionTime } = presentation;
|
|
237
|
-
// Reject when the current time reaches or exceeds credential expiration.
|
|
238
|
-
if (currentTime >= redemptionTime) {
|
|
239
|
-
throw new VerificationFailure();
|
|
240
|
-
}
|
|
241
|
-
const verifier = new PresentationProofVerifier(CREDENTIAL_LABEL);
|
|
242
|
-
// ACI checked against UID encryption public key
|
|
243
|
-
verifier.addAttribute(uidEncCiphertext, groupPublicParams.uidEncPublicKey);
|
|
244
|
-
// ProfileKey checked against PROFILE KEY encryption public key (different!)
|
|
245
|
-
verifier.addAttribute(profileKeyEncCiphertext, groupPublicParams.profileKeyEncPublicKey);
|
|
246
|
-
verifier.addPublicAttribute(redemptionTimePublicAttribute(redemptionTime));
|
|
247
|
-
verifier.verify(credentialKeyPair, proof);
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
// ---------------------------------------------------------------------------
|
|
251
182
|
// Serialization helpers
|
|
252
183
|
// ---------------------------------------------------------------------------
|
|
253
184
|
const Point = RistrettoPoint;
|
|
@@ -266,53 +197,6 @@ export function serializeProfileKeyCredentialRequest(request) {
|
|
|
266
197
|
points.forEach((point, index) => bytes.set(point.toBytes(), index * 32));
|
|
267
198
|
return bytes;
|
|
268
199
|
}
|
|
269
|
-
/** Deserialize and validate the fixed-width blinded request. */
|
|
270
|
-
export function deserializeProfileKeyCredentialRequest(bytes) {
|
|
271
|
-
if (bytes.length !== PROFILE_KEY_CREDENTIAL_REQUEST_LENGTH) {
|
|
272
|
-
throw new Error('deserializeProfileKeyCredentialRequest: invalid length');
|
|
273
|
-
}
|
|
274
|
-
const point = (index) => Point.fromBytes(bytes.subarray(index * 32, (index + 1) * 32));
|
|
275
|
-
return {
|
|
276
|
-
blindingPublicKey: { Y: point(0) },
|
|
277
|
-
blindedProfileKey: {
|
|
278
|
-
blindedPoints: [
|
|
279
|
-
{ D1: point(1), D2: point(2) },
|
|
280
|
-
{ D1: point(3), D2: point(4) },
|
|
281
|
-
],
|
|
282
|
-
},
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Serialize an ExpiringProfileKeyCredentialResponse to bytes.
|
|
287
|
-
*
|
|
288
|
-
* Format:
|
|
289
|
-
* [redemptionTime: 8 bytes BE u64]
|
|
290
|
-
* [credential.t: 32 bytes scalar LE]
|
|
291
|
-
* [credential.U: 32 bytes point]
|
|
292
|
-
* [credential.S1: 32 bytes point]
|
|
293
|
-
* [credential.S2: 32 bytes point]
|
|
294
|
-
* [pokshoProof: remaining bytes]
|
|
295
|
-
*/
|
|
296
|
-
export function serializeProfileKeyCredentialResponse(response) {
|
|
297
|
-
const { issuanceProof, redemptionTime } = response;
|
|
298
|
-
const tBytes = scalarToBytes(issuanceProof.credential.t);
|
|
299
|
-
const uBytes = issuanceProof.credential.U.toBytes();
|
|
300
|
-
const s1Bytes = issuanceProof.credential.S1.toBytes();
|
|
301
|
-
const s2Bytes = issuanceProof.credential.S2.toBytes();
|
|
302
|
-
const proofBytes = issuanceProof.pokshoProof;
|
|
303
|
-
if (proofBytes.length !== 352) {
|
|
304
|
-
throw new Error('serializeProfileKeyCredentialResponse: invalid proof length');
|
|
305
|
-
}
|
|
306
|
-
const buf = new Uint8Array(8 + 32 + 32 + 32 + 32 + proofBytes.length);
|
|
307
|
-
const view = new DataView(buf.buffer);
|
|
308
|
-
view.setBigUint64(0, BigInt(redemptionTime), false);
|
|
309
|
-
buf.set(tBytes, 8);
|
|
310
|
-
buf.set(uBytes, 40);
|
|
311
|
-
buf.set(s1Bytes, 72);
|
|
312
|
-
buf.set(s2Bytes, 104);
|
|
313
|
-
buf.set(proofBytes, 136);
|
|
314
|
-
return buf;
|
|
315
|
-
}
|
|
316
200
|
/**
|
|
317
201
|
* Deserialize an ExpiringProfileKeyCredentialResponse from bytes.
|
|
318
202
|
*/
|
|
@@ -384,60 +268,4 @@ export function serializeProfileKeyCredentialPresentation(presentation) {
|
|
|
384
268
|
buf.set(profileKeyEncCiphertext.E_A2.toBytes(), offset);
|
|
385
269
|
return buf;
|
|
386
270
|
}
|
|
387
|
-
/**
|
|
388
|
-
* Deserialize a ProfileKeyCredentialPresentation from bytes.
|
|
389
|
-
*/
|
|
390
|
-
export function deserializeProfileKeyCredentialPresentation(bytes) {
|
|
391
|
-
// Minimum: 8 (time) + 96 (C_x0,C_x1,C_V) + 4 (cyCount) + 4 (proofLen) + 128 (4 ciphertext points)
|
|
392
|
-
const MIN_LEN = 240;
|
|
393
|
-
if (bytes.length < MIN_LEN) {
|
|
394
|
-
throw new Error('deserializeProfileKeyCredentialPresentation: too short');
|
|
395
|
-
}
|
|
396
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
397
|
-
let offset = 0;
|
|
398
|
-
const redemptionTime = Number(view.getBigUint64(offset, false));
|
|
399
|
-
offset += 8;
|
|
400
|
-
const C_x0 = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
401
|
-
offset += 32;
|
|
402
|
-
const C_x1 = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
403
|
-
offset += 32;
|
|
404
|
-
const C_V = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
405
|
-
offset += 32;
|
|
406
|
-
const cyCount = view.getUint32(offset, true);
|
|
407
|
-
offset += 4;
|
|
408
|
-
// Bounds: cyCount * 32 + proofLen(4) + proof + ciphertexts(128) must fit in remaining bytes
|
|
409
|
-
if (cyCount > 16 || offset + cyCount * 32 + 4 + 128 > bytes.length) {
|
|
410
|
-
throw new Error('deserializeProfileKeyCredentialPresentation: cyCount out of bounds');
|
|
411
|
-
}
|
|
412
|
-
const C_y = [];
|
|
413
|
-
for (let i = 0; i < cyCount; i++) {
|
|
414
|
-
C_y.push(Point.fromBytes(bytes.subarray(offset, offset + 32)));
|
|
415
|
-
offset += 32;
|
|
416
|
-
}
|
|
417
|
-
const proofLen = view.getUint32(offset, true);
|
|
418
|
-
offset += 4;
|
|
419
|
-
if (offset + proofLen + 128 > bytes.length) {
|
|
420
|
-
throw new Error('deserializeProfileKeyCredentialPresentation: proofLen out of bounds');
|
|
421
|
-
}
|
|
422
|
-
const pokshoProof = bytes.slice(offset, offset + proofLen);
|
|
423
|
-
offset += proofLen;
|
|
424
|
-
const aciE_A1 = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
425
|
-
offset += 32;
|
|
426
|
-
const aciE_A2 = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
427
|
-
offset += 32;
|
|
428
|
-
const pkE_A1 = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
429
|
-
offset += 32;
|
|
430
|
-
const pkE_A2 = Point.fromBytes(bytes.subarray(offset, offset + 32));
|
|
431
|
-
offset += 32;
|
|
432
|
-
// Reject trailing bytes
|
|
433
|
-
if (offset !== bytes.length) {
|
|
434
|
-
throw new Error('deserializeProfileKeyCredentialPresentation: trailing bytes');
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
proof: { C_x0, C_x1, C_V, C_y, pokshoProof },
|
|
438
|
-
uidEncCiphertext: new Ciphertext(aciE_A1, aciE_A2, UidEncryptionDomain),
|
|
439
|
-
profileKeyEncCiphertext: new Ciphertext(pkE_A1, pkE_A2, ProfileKeyEncryptionDomain),
|
|
440
|
-
redemptionTime,
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
271
|
//# sourceMappingURL=profile-key-credential.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-key-credential.js","sourceRoot":"","sources":["../../../../../internal/protocol/zk/groups/profile-key-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,eAAe,EAIf,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAkC,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAyB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAyB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAgC,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAE9B,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,qGAAqG;AACrG,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,sDAAsD,CAAC,CAAC;AAE5F,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,6BAA6B,CAAC,IAAY;IACjD,OAAO;QACL,QAAQ,CAAC,GAAkB;YACzB,MAAM,GAAG,GAAG,IA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,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC;QACvE,uBAAuB,EAAE,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,0BAA0B,CAAC;QACnF,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"profile-key-credential.js","sourceRoot":"","sources":["../../../../../internal/protocol/zk/groups/profile-key-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,eAAe,EAIf,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAA0B,MAAM,6BAA6B,CAAC;AAK/F,OAAO,EAAkC,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAyB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAOlF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAIvD,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAE9B,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,qGAAqG;AACrG,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,sDAAsD,CAAC,CAAC;AAE5F,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,6BAA6B,CAAC,IAAY;IACjD,OAAO;QACL,QAAQ,CAAC,GAAkB;YACzB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YAC9D,GAAG,CAAC,gBAAgB,CA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CAAC,CAAC;IACrC,MAAM,IAAI,EAAE,CAAC;IAEb,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,IAAI,CAAC,CAAC;IACZ,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;QAC3B,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;QAC9B,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,CAAC,CAAC;IACZ,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACnC,MAAM,IAAI,QAAQ,CAAC;IAEnB,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,IAAI,EAAE,CAAC;IACb,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,IAAI,EAAE,CAAC;IACb,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IACxD,MAAM,IAAI,EAAE,CAAC;IACb,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IAExD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,70 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Group authority parameters
|
|
3
3
|
*
|
|
4
4
|
*
|
|
5
|
-
* The server holds
|
|
6
|
-
*
|
|
7
|
-
* verifying server responses.
|
|
5
|
+
* The server holds the secret keys for credential issuance and response signatures.
|
|
6
|
+
* Clients use the corresponding `ServerPublicParams` to verify server responses.
|
|
8
7
|
*
|
|
9
8
|
* Key material:
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
9
|
+
* - The credential key authenticates credentials.
|
|
10
|
+
* - The endorsement key authenticates group-send endorsements.
|
|
11
|
+
* - The Schnorr signing key authenticates server responses.
|
|
13
12
|
*
|
|
14
13
|
* All keys are derived deterministically from 32 bytes of randomness via
|
|
15
14
|
* domain-separated SHO instances.
|
|
16
15
|
*
|
|
17
16
|
* @see https://eprint.iacr.org/2019/1416.pdf -- Signal Private Group System
|
|
18
17
|
*/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { ServerRootKeyPair, ServerRootPublicKey } from '../credentials/endorsements.js';
|
|
18
|
+
import { type CredentialPublicKey } from '../credentials/credentials.js';
|
|
19
|
+
import { ServerRootPublicKey } from '../credentials/endorsements.js';
|
|
22
20
|
export {};
|
|
23
21
|
/** Minimum randomness length in bytes. */
|
|
24
22
|
export declare const RANDOMNESS_LEN = 32;
|
|
25
23
|
/** Signature length in bytes (Schnorr proof: 32 challenge + 32 response). */
|
|
26
24
|
export declare const SIGNATURE_LEN = 64;
|
|
27
|
-
/**
|
|
28
|
-
* A Schnorr signing key pair: private scalar + public point.
|
|
29
|
-
*
|
|
30
|
-
* Equivalent to `crypto::signature::KeyPair` in the profile.
|
|
31
|
-
*/
|
|
32
|
-
interface SigningKeyPair {
|
|
33
|
-
/** Private signing scalar. */
|
|
34
|
-
readonly signingKey: bigint;
|
|
35
|
-
/** Public verification point (signingKey * G). */
|
|
36
|
-
readonly publicKey: RistrettoPoint;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* All credential-issuing key material held by the server.
|
|
40
|
-
*
|
|
41
|
-
* Carries only the server-side key pairs used by this package:
|
|
42
|
-
* - Generic credential issuance (auth credentials)
|
|
43
|
-
* - Group-send endorsement issuance
|
|
44
|
-
* - Response signing / verification
|
|
45
|
-
*/
|
|
46
|
-
export interface ServerSecretParams {
|
|
47
|
-
/** Key pair for issuing generic (auth) credentials. */
|
|
48
|
-
readonly credentialKeyPair: CredentialKeyPair;
|
|
49
|
-
/** Key pair for issuing profile key credentials. */
|
|
50
|
-
readonly profileKeyCredentialKeyPair: CredentialKeyPair;
|
|
51
|
-
/** Root key pair for issuing group-send endorsements. */
|
|
52
|
-
readonly endorsementKeyPair: ServerRootKeyPair;
|
|
53
|
-
/** Schnorr signing key pair for server response signatures. */
|
|
54
|
-
readonly signingKeyPair: SigningKeyPair;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Derive all server key material deterministically from randomness.
|
|
58
|
-
*
|
|
59
|
-
* Each key pair is derived from its own domain-separated SHO instance,
|
|
60
|
-
* absorbing the provided randomness. That keeps independence between
|
|
61
|
-
* the credential, endorsement, and signing keys.
|
|
62
|
-
*
|
|
63
|
-
* @param randomness - At least 32 bytes of cryptographically secure randomness
|
|
64
|
-
* @returns A fully populated ServerSecretParams
|
|
65
|
-
* @throws If randomness is too short
|
|
66
|
-
*/
|
|
67
|
-
export declare function generateServerSecretParams(randomness: Uint8Array): ServerSecretParams;
|
|
68
25
|
/**
|
|
69
26
|
* Public keys for client-side verification of server responses.
|
|
70
27
|
*
|
|
@@ -81,27 +38,6 @@ export interface ServerPublicParams {
|
|
|
81
38
|
/** Public key for verifying server response signatures (32 bytes compressed). */
|
|
82
39
|
readonly signingPublicKey: Uint8Array;
|
|
83
40
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Extract the public parameters from server secret parameters.
|
|
86
|
-
*
|
|
87
|
-
* @param secretParams - The server's secret parameters
|
|
88
|
-
* @returns The corresponding public parameters safe for distribution
|
|
89
|
-
*/
|
|
90
|
-
export declare function getServerPublicParams(secretParams: ServerSecretParams): ServerPublicParams;
|
|
91
|
-
/**
|
|
92
|
-
* Sign a message using the server's signing key.
|
|
93
|
-
*
|
|
94
|
-
* Uses a Schnorr signature (ZK proof of knowledge of discrete log) via
|
|
95
|
-
* the poksho proof system. The randomness is first passed through a
|
|
96
|
-
* domain-separated SHO to derive the proof nonce.
|
|
97
|
-
*
|
|
98
|
-
* @param secretParams - The server's secret parameters
|
|
99
|
-
* @param randomness - At least 32 bytes of cryptographically secure randomness
|
|
100
|
-
* @param message - The message bytes to sign
|
|
101
|
-
* @returns Signature bytes (64 bytes: 32 challenge + 32 response)
|
|
102
|
-
* @throws If randomness is too short
|
|
103
|
-
*/
|
|
104
|
-
export declare function serverSign(secretParams: ServerSecretParams, randomness: Uint8Array, message: Uint8Array): Uint8Array;
|
|
105
41
|
/**
|
|
106
42
|
* Verify a server signature against the server's public parameters.
|
|
107
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-params.d.ts","sourceRoot":"","sources":["../../../../../internal/protocol/zk/groups/server-params.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server-params.d.ts","sourceRoot":"","sources":["../../../../../internal/protocol/zk/groups/server-params.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,CAAC;AAOV,0CAA0C;AAC1C,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,6EAA6E;AAC7E,eAAO,MAAM,aAAa,KAAK,CAAC;AAMhC;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAClD,wDAAwD;IACxD,QAAQ,CAAC,6BAA6B,EAAE,mBAAmB,CAAC;IAC5D,wDAAwD;IACxD,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;IACnD,iFAAiF;IACjF,QAAQ,CAAC,gBAAgB,EAAE,UAAU,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,EAC1D,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,GACpB,OAAO,CAQT"}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Group authority parameters
|
|
3
3
|
*
|
|
4
4
|
*
|
|
5
|
-
* The server holds
|
|
6
|
-
*
|
|
7
|
-
* verifying server responses.
|
|
5
|
+
* The server holds the secret keys for credential issuance and response signatures.
|
|
6
|
+
* Clients use the corresponding `ServerPublicParams` to verify server responses.
|
|
8
7
|
*
|
|
9
8
|
* Key material:
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
9
|
+
* - The credential key authenticates credentials.
|
|
10
|
+
* - The endorsement key authenticates group-send endorsements.
|
|
11
|
+
* - The Schnorr signing key authenticates server responses.
|
|
13
12
|
*
|
|
14
13
|
* All keys are derived deterministically from 32 bytes of randomness via
|
|
15
14
|
* domain-separated SHO instances.
|
|
16
15
|
*
|
|
17
16
|
* @see https://eprint.iacr.org/2019/1416.pdf -- Signal Private Group System
|
|
18
17
|
*/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { generateKeyPair as generateCredentialKeyPair, } from '../credentials/credentials.js';
|
|
22
|
-
import { ServerRootKeyPair } from '../credentials/endorsements.js';
|
|
18
|
+
import { RistrettoPoint } from '../proofs/sho.js';
|
|
19
|
+
import { schnorrVerifySignature } from '../proofs/sign.js';
|
|
23
20
|
const Point = RistrettoPoint;
|
|
24
|
-
const enc = new TextEncoder();
|
|
25
21
|
// ---------------------------------------------------------------------------
|
|
26
22
|
// Constants
|
|
27
23
|
// ---------------------------------------------------------------------------
|
|
@@ -29,102 +25,6 @@ const enc = new TextEncoder();
|
|
|
29
25
|
export const RANDOMNESS_LEN = 32;
|
|
30
26
|
/** Signature length in bytes (Schnorr proof: 32 challenge + 32 response). */
|
|
31
27
|
export const SIGNATURE_LEN = 64;
|
|
32
|
-
// SHO labels -- must match profile for interoperability
|
|
33
|
-
const LABEL_CREDENTIAL_KEY = enc.encode('Signal_ZKGroup_20221011_ServerSecretParams_Generate_GenericCredentialKeyPair');
|
|
34
|
-
const LABEL_PROFILE_KEY_CREDENTIAL_KEY = enc.encode('Signal_ZKGroup_20221011_ServerSecretParams_Generate_ProfileKeyCredentialKeyPair');
|
|
35
|
-
const LABEL_ENDORSEMENT_KEY = enc.encode('Signal_ZKGroup_20240215_ServerSecretParams_Generate_EndorsementRootKeyPair');
|
|
36
|
-
const LABEL_SIGNING_KEY = enc.encode('Signal_ZKGroup_20221011_ServerSecretParams_Generate_SigningKey');
|
|
37
|
-
const LABEL_SIGN = enc.encode('Signal_ZKGroup_20200424_Random_ServerSecretParams_Sign');
|
|
38
|
-
/**
|
|
39
|
-
* Derive all server key material deterministically from randomness.
|
|
40
|
-
*
|
|
41
|
-
* Each key pair is derived from its own domain-separated SHO instance,
|
|
42
|
-
* absorbing the provided randomness. That keeps independence between
|
|
43
|
-
* the credential, endorsement, and signing keys.
|
|
44
|
-
*
|
|
45
|
-
* @param randomness - At least 32 bytes of cryptographically secure randomness
|
|
46
|
-
* @returns A fully populated ServerSecretParams
|
|
47
|
-
* @throws If randomness is too short
|
|
48
|
-
*/
|
|
49
|
-
export function generateServerSecretParams(randomness) {
|
|
50
|
-
if (randomness.length < RANDOMNESS_LEN) {
|
|
51
|
-
throw new Error(`generateServerSecretParams: need at least ${RANDOMNESS_LEN} bytes of randomness, got ${randomness.length}`);
|
|
52
|
-
}
|
|
53
|
-
// --- Credential key pair (auth) ---
|
|
54
|
-
// Derive randomness for the credential key pair through a domain-separated SHO
|
|
55
|
-
const credSho = new ShoHmacSha256(LABEL_CREDENTIAL_KEY);
|
|
56
|
-
credSho.absorbAndRatchet(randomness);
|
|
57
|
-
const credentialRandomness = credSho.squeezeAndRatchet(RANDOMNESS_LEN);
|
|
58
|
-
const credentialKeyPair = generateCredentialKeyPair(credentialRandomness);
|
|
59
|
-
// --- Profile key credential key pair ---
|
|
60
|
-
// Separate key pair for profile key credentials (distinct from auth credentials)
|
|
61
|
-
const pkCredSho = new ShoHmacSha256(LABEL_PROFILE_KEY_CREDENTIAL_KEY);
|
|
62
|
-
pkCredSho.absorbAndRatchet(randomness);
|
|
63
|
-
const pkCredentialRandomness = pkCredSho.squeezeAndRatchet(RANDOMNESS_LEN);
|
|
64
|
-
const profileKeyCredentialKeyPair = generateCredentialKeyPair(pkCredentialRandomness);
|
|
65
|
-
// --- Endorsement key pair ---
|
|
66
|
-
// Derive randomness for the endorsement key pair through a domain-separated SHO
|
|
67
|
-
const endSho = new ShoHmacSha256(LABEL_ENDORSEMENT_KEY);
|
|
68
|
-
endSho.absorbAndRatchet(randomness);
|
|
69
|
-
const endorsementRandomness = endSho.squeezeAndRatchet(RANDOMNESS_LEN);
|
|
70
|
-
const endorsementKeyPair = ServerRootKeyPair.generate(endorsementRandomness);
|
|
71
|
-
// --- Signing key pair ---
|
|
72
|
-
// Derive the signing scalar directly from the SHO
|
|
73
|
-
const sigSho = new ShoHmacSha256(LABEL_SIGNING_KEY);
|
|
74
|
-
sigSho.absorbAndRatchet(randomness);
|
|
75
|
-
const signingKey = sigSho.getScalar();
|
|
76
|
-
const signingPublicKey = Point.BASE.multiply(signingKey);
|
|
77
|
-
const signingKeyPair = {
|
|
78
|
-
signingKey,
|
|
79
|
-
publicKey: signingPublicKey,
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
credentialKeyPair,
|
|
83
|
-
profileKeyCredentialKeyPair,
|
|
84
|
-
endorsementKeyPair,
|
|
85
|
-
signingKeyPair,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Extract the public parameters from server secret parameters.
|
|
90
|
-
*
|
|
91
|
-
* @param secretParams - The server's secret parameters
|
|
92
|
-
* @returns The corresponding public parameters safe for distribution
|
|
93
|
-
*/
|
|
94
|
-
export function getServerPublicParams(secretParams) {
|
|
95
|
-
return {
|
|
96
|
-
credentialPublicKey: secretParams.credentialKeyPair.publicKey,
|
|
97
|
-
profileKeyCredentialPublicKey: secretParams.profileKeyCredentialKeyPair.publicKey,
|
|
98
|
-
endorsementPublicKey: secretParams.endorsementKeyPair.publicKey(),
|
|
99
|
-
signingPublicKey: secretParams.signingKeyPair.publicKey.toBytes(),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
// ---------------------------------------------------------------------------
|
|
103
|
-
// Signing / Verification
|
|
104
|
-
// ---------------------------------------------------------------------------
|
|
105
|
-
/**
|
|
106
|
-
* Sign a message using the server's signing key.
|
|
107
|
-
*
|
|
108
|
-
* Uses a Schnorr signature (ZK proof of knowledge of discrete log) via
|
|
109
|
-
* the poksho proof system. The randomness is first passed through a
|
|
110
|
-
* domain-separated SHO to derive the proof nonce.
|
|
111
|
-
*
|
|
112
|
-
* @param secretParams - The server's secret parameters
|
|
113
|
-
* @param randomness - At least 32 bytes of cryptographically secure randomness
|
|
114
|
-
* @param message - The message bytes to sign
|
|
115
|
-
* @returns Signature bytes (64 bytes: 32 challenge + 32 response)
|
|
116
|
-
* @throws If randomness is too short
|
|
117
|
-
*/
|
|
118
|
-
export function serverSign(secretParams, randomness, message) {
|
|
119
|
-
if (randomness.length < RANDOMNESS_LEN) {
|
|
120
|
-
throw new Error(`serverSign: need at least ${RANDOMNESS_LEN} bytes of randomness, got ${randomness.length}`);
|
|
121
|
-
}
|
|
122
|
-
// Derive proof randomness through the signing domain before signing.
|
|
123
|
-
const sho = new ShoHmacSha256(LABEL_SIGN);
|
|
124
|
-
sho.absorbAndRatchet(randomness);
|
|
125
|
-
const proofRandomness = sho.squeezeAndRatchet(RANDOMNESS_LEN);
|
|
126
|
-
return schnorrSign(secretParams.signingKeyPair.signingKey, secretParams.signingKeyPair.publicKey, message, proofRandomness);
|
|
127
|
-
}
|
|
128
28
|
/**
|
|
129
29
|
* Verify a server signature against the server's public parameters.
|
|
130
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-params.js","sourceRoot":"","sources":["../../../../../internal/protocol/zk/groups/server-params.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server-params.js","sourceRoot":"","sources":["../../../../../internal/protocol/zk/groups/server-params.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,MAAM,KAAK,GAAG,cAAc,CAAC;AAE7B,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAuBhC;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAA0D,EAC1D,OAAmB,EACnB,SAAqB;IAErB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACnE,sBAAsB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -16,11 +16,10 @@ import type { RistrettoPoint } from './sho.js';
|
|
|
16
16
|
* @returns Signature bytes (64 bytes: 32 challenge + 32 response)
|
|
17
17
|
*/
|
|
18
18
|
export {};
|
|
19
|
-
export declare function schnorrSign(privateKey: bigint, publicKey: RistrettoPoint, message: Uint8Array, randomness: Uint8Array): Uint8Array;
|
|
20
19
|
/**
|
|
21
20
|
* Verify a Schnorr signature.
|
|
22
21
|
*
|
|
23
|
-
* @param signature
|
|
22
|
+
* @param signature Schnorr signature bytes
|
|
24
23
|
* @param publicKey The signer's public key
|
|
25
24
|
* @param message The signed message
|
|
26
25
|
* @throws PokshoException on verification failure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../../../internal/protocol/zk/proofs/sign.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../../../internal/protocol/zk/proofs/sign.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC;AAEV;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,UAAU,GAClB,IAAI,CAQN"}
|
|
@@ -5,21 +5,12 @@
|
|
|
5
5
|
* Signatures are such a common ZKP that we provide special functions.
|
|
6
6
|
* A signature proves knowledge of private_key such that public_key = private_key * G.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { PointArgs } from './args.js';
|
|
9
9
|
import { Statement } from './statement.js';
|
|
10
|
-
export function schnorrSign(privateKey, publicKey, message, randomness) {
|
|
11
|
-
const st = new Statement();
|
|
12
|
-
st.add('public_key', [['private_key', 'G']]);
|
|
13
|
-
const scalarArgs = new ScalarArgs();
|
|
14
|
-
scalarArgs.add('private_key', privateKey);
|
|
15
|
-
const pointArgs = new PointArgs();
|
|
16
|
-
pointArgs.add('public_key', publicKey);
|
|
17
|
-
return st.prove(scalarArgs, pointArgs, message, randomness);
|
|
18
|
-
}
|
|
19
10
|
/**
|
|
20
11
|
* Verify a Schnorr signature.
|
|
21
12
|
*
|
|
22
|
-
* @param signature
|
|
13
|
+
* @param signature Schnorr signature bytes
|
|
23
14
|
* @param publicKey The signer's public key
|
|
24
15
|
* @param message The signed message
|
|
25
16
|
* @throws PokshoException on verification failure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../../../../internal/protocol/zk/proofs/sign.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../../../../internal/protocol/zk/proofs/sign.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAaxC;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAqB,EACrB,SAAyB,EACzB,OAAmB;IAEnB,MAAM,EAAE,GAAG,IAAI,SAAS,EAAE,CAAC;IAC3B,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAE7C,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IAClC,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEvC,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -54,9 +54,10 @@
|
|
|
54
54
|
*/
|
|
55
55
|
import type { DefaultSignalProtocolClient } from '../../client/index.js';
|
|
56
56
|
import type { Ciphertext } from '../../keys/index.js';
|
|
57
|
-
import type { SignalProtocolRelayServer, DeviceInfo, PreKeyBundle } from '../../remote/relay/types.js';
|
|
57
|
+
import type { SignalProtocolRelayServer, DeviceInfo, GroupMemberDevice, PreKeyBundle } from '../../remote/relay/types.js';
|
|
58
58
|
import { ProtocolAddress } from '../../types/address.js';
|
|
59
59
|
import { type Logger } from '../../logger.js';
|
|
60
|
+
import { type BoundedFanOut } from '../../utils/bounded-fan-out.js';
|
|
60
61
|
/**
|
|
61
62
|
* Device-specific prekey bundle
|
|
62
63
|
*/
|
|
@@ -129,20 +130,38 @@ export interface DeviceSessionEstablishment {
|
|
|
129
130
|
establishSession(remoteAddress: ProtocolAddress, bundle: PreKeyBundle): Promise<void>;
|
|
130
131
|
/** Rethrow an error that ends the whole call, not the attempt for one device. */
|
|
131
132
|
rethrowFatal(error: unknown): void;
|
|
133
|
+
/** The relay request bound of the client. Each relay request takes one slot. */
|
|
134
|
+
fanOut: BoundedFanOut;
|
|
135
|
+
/** After it aborts, no relay request starts and the call rejects. */
|
|
136
|
+
stopSignal?: AbortSignal;
|
|
137
|
+
/**
|
|
138
|
+
* The user's receiving devices, read by the caller in this send. When it is
|
|
139
|
+
* given, the call does not read the list again.
|
|
140
|
+
*/
|
|
141
|
+
listedDevices?: readonly GroupMemberDevice[];
|
|
132
142
|
}
|
|
133
143
|
/**
|
|
134
144
|
* Establish sessions with all active devices for a user
|
|
135
145
|
*
|
|
136
|
-
* Reads the relay's list of receiving devices,
|
|
137
|
-
*
|
|
146
|
+
* Reads the relay's list of receiving devices, or takes the list that the
|
|
147
|
+
* caller read in the same send, then fetches a prekey bundle and establishes
|
|
148
|
+
* a session for each listed device that has no session. A
|
|
138
149
|
* device that already has a session counts as established. The cipher calls
|
|
139
150
|
* this again when its copy of the device list is no longer fresh, so a newly
|
|
140
151
|
* linked device is found by a later send.
|
|
141
152
|
*
|
|
153
|
+
* The prekey bundles of the devices are fetched at the same time, each under
|
|
154
|
+
* one slot of the relay request bound. The sessions are established one at a
|
|
155
|
+
* time, and never while a slot is held: the first session commit with a user
|
|
156
|
+
* pins the user's contact identity, and a concurrent commit that read the
|
|
157
|
+
* store before it fails. A failure for one device does not stop the other
|
|
158
|
+
* devices. The result lists the devices in the relay's order.
|
|
159
|
+
*
|
|
142
160
|
* @param signal - DefaultSignalProtocolClient instance
|
|
143
161
|
* @param relay - Signal Protocol relay server interface
|
|
144
162
|
* @param userId - Target user ID
|
|
145
|
-
* @param establishment - Establishes each session
|
|
163
|
+
* @param establishment - Establishes each session, bounds the relay requests,
|
|
164
|
+
* and names the errors that end the call
|
|
146
165
|
* @returns Result containing successful and failed device IDs
|
|
147
166
|
*
|
|
148
167
|
* @example
|
|
@@ -150,6 +169,7 @@ export interface DeviceSessionEstablishment {
|
|
|
150
169
|
* const result = await establishMultiDeviceSessions(signal, relay, 'user_abc123', {
|
|
151
170
|
* establishSession: (address, bundle) => signal.establishSession(address, bundle),
|
|
152
171
|
* rethrowFatal: () => {},
|
|
172
|
+
* fanOut: new BoundedFanOut({ stopped: () => new Error('Stopped') }),
|
|
153
173
|
* });
|
|
154
174
|
* console.log(`Established ${result.establishedDevices.length}/${result.totalDevices} sessions`);
|
|
155
175
|
* ```
|