@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
|
@@ -8,6 +8,11 @@ const STORED_HEX = /^(?:[0-9a-f]{2})+$/;
|
|
|
8
8
|
const STORED_BASE64 = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
9
9
|
/** The ASCII prefix of a Linux ciphertext under a key from the secret service. */
|
|
10
10
|
const SECRET_SERVICE_PREFIX = [0x76, 0x31, 0x31];
|
|
11
|
+
/** The ASCII prefix of a Linux ciphertext under the key of the Secret portal. */
|
|
12
|
+
const SECRET_PORTAL_PREFIX = [0x76, 0x31, 0x32];
|
|
13
|
+
function hasPrefix(ciphertext, prefix) {
|
|
14
|
+
return prefix.every((byte, index) => ciphertext[index] === byte);
|
|
15
|
+
}
|
|
11
16
|
function keyStorageError(message, operation, cause) {
|
|
12
17
|
return new EncryptionError(message, EncryptionErrorCode.KEY_STORAGE_ERROR, {
|
|
13
18
|
operation,
|
|
@@ -144,13 +149,21 @@ export class ElectronSafeStorageSignalProtocolSecretVault {
|
|
|
144
149
|
* On Linux, safeStorage uses its fixed fallback key when no secret service
|
|
145
150
|
* answers, and the backend does not show it. The ciphertext prefix names the
|
|
146
151
|
* key: `v11` is a key from the secret service, and `v10` is the fallback key.
|
|
147
|
-
*
|
|
152
|
+
* `v12` is the key of the Secret portal, which safeStorage uses only with the
|
|
153
|
+
* `SecretPortalKeyProviderUseForEncryption` feature. Outside a Flatpak or
|
|
154
|
+
* Snap sandbox, Chromium asks the portal for that key as the app
|
|
155
|
+
* `org.chromium.Chromium`, so every such Electron app of the user gets the
|
|
156
|
+
* same key. Any other prefix is a key that the vault does not know. The vault
|
|
157
|
+
* fails closed on each key other than `v11`.
|
|
148
158
|
*/
|
|
149
159
|
#assertSecretServiceKey(ciphertext, operation) {
|
|
150
160
|
if (process.platform !== 'linux')
|
|
151
161
|
return;
|
|
152
|
-
if (
|
|
162
|
+
if (hasPrefix(ciphertext, SECRET_SERVICE_PREFIX))
|
|
153
163
|
return;
|
|
164
|
+
if (hasPrefix(ciphertext, SECRET_PORTAL_PREFIX)) {
|
|
165
|
+
throw keyStorageError('Electron safeStorage encrypted with the key of the Secret portal. Outside a Flatpak or Snap sandbox, the portal gives that key to Electron as the Chromium app, so other Electron apps of the user get the same key. Run the app without the SecretPortalKeyProviderUseForEncryption feature.', operation);
|
|
166
|
+
}
|
|
154
167
|
throw keyStorageError('Electron safeStorage did not encrypt with a key from a secret service. When no secret service answers, safeStorage uses its fixed fallback key. Run the app with a secret service such as gnome-keyring or kwallet.', operation);
|
|
155
168
|
}
|
|
156
169
|
async #encrypt(hex, operation) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-safe-storage.js","sourceRoot":"","sources":["../../../local/vault/electron-safe-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,UAAU,GA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AAC;YAC5E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACrB,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACrC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;YAAE,OAAO;QACzC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;QACvD,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;gBAAS,CAAC;YACT,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
export {};
|
|
17
17
|
export { generateProfileKey } from './profile-key.js';
|
|
18
18
|
export { encryptProfileData, decryptProfileData } from './profile-key.js';
|
|
19
|
-
export { getOwnProfileKey, setOwnProfileKey, getOrCreateOwnProfileKey, getOwnProfileKeyBase64,
|
|
19
|
+
export { getOwnProfileKey, setOwnProfileKey, getOrCreateOwnProfileKey, getOwnProfileKeyBase64, } from './own-profile-key.js';
|
|
20
|
+
export { rotateOwnProfileKey } from './profile-key.js';
|
|
20
21
|
export { UnidentifiedAccessMode, type UnidentifiedAccessModeType, type ContactProfileStateStore, type MutableContactProfileStateStore, verifyUnidentifiedAccessMode, storeReceivedProfileKey, } from './contact-state.js';
|
|
21
22
|
export { encryptProfileName, decryptProfileName, encryptProfileString, decryptProfileString, encryptProfileField, decryptProfileField, padProfileField, unpadProfileField, encryptProfileAppData, decryptProfileAppData, PROFILE_NAME_PADDED_LENGTHS, PROFILE_ABOUT_PADDED_LENGTHS, PROFILE_EMOJI_PADDED_LENGTHS, PROFILE_APP_DATA_PADDED_LENGTHS, type ApplicationProfileData, } from './cipher.js';
|
|
22
23
|
export { updateEncryptedProfile, type UpdateEncryptedProfileApi, type UpdateEncryptedProfileParams, } from './update-service.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../profile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,CAAC;AACV,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../profile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,CAAC;AACV,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EACL,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,+BAA+B,EAC/B,KAAK,sBAAsB,GAC5B,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,aAAa,EACb,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/profile/index.js
CHANGED
|
@@ -17,7 +17,8 @@ export { generateProfileKey } from './profile-key.js';
|
|
|
17
17
|
// Profile data encryption/decryption
|
|
18
18
|
export { encryptProfileData, decryptProfileData } from './profile-key.js';
|
|
19
19
|
// Own profile-key management
|
|
20
|
-
export { getOwnProfileKey, setOwnProfileKey, getOrCreateOwnProfileKey, getOwnProfileKeyBase64,
|
|
20
|
+
export { getOwnProfileKey, setOwnProfileKey, getOrCreateOwnProfileKey, getOwnProfileKeyBase64, } from './own-profile-key.js';
|
|
21
|
+
export { rotateOwnProfileKey } from './profile-key.js';
|
|
21
22
|
// SDK-managed contact profile state contracts
|
|
22
23
|
export { UnidentifiedAccessMode, verifyUnidentifiedAccessMode, storeReceivedProfileKey, } from './contact-state.js';
|
|
23
24
|
// Profile cipher (padded field encryption/decryption)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../profile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,qCAAqC;AACrC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEvE,6BAA6B;AAC7B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../profile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,qCAAqC;AACrC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEvE,6BAA6B;AAC7B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,8CAA8C;AAC9C,OAAO,EACL,sBAAsB,EAItB,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,sDAAsD;AACtD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,+BAA+B,GAEhC,MAAM,UAAU,CAAC;AAElB,+BAA+B;AAC/B,OAAO,EACL,sBAAsB,GAGvB,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Own Profile Key
|
|
3
|
+
*
|
|
4
|
+
* The current user's profile key in the application's local secret vault.
|
|
5
|
+
*/
|
|
6
|
+
import type { SignalProtocolLocalSecretVault } from '../types/api.js';
|
|
7
|
+
/** Vault secret name for the own profile key (the raw 32 bytes) */
|
|
8
|
+
export declare const OWN_PROFILE_KEY_ID = "signal_profile_key_v1";
|
|
9
|
+
/**
|
|
10
|
+
* Get the current user's profile key from the application's local secret vault.
|
|
11
|
+
*
|
|
12
|
+
* The profile key lives only in the vault that the application passes. With no
|
|
13
|
+
* vault, this throws `SECRET_VAULT_REQUIRED`.
|
|
14
|
+
*
|
|
15
|
+
* @param vault - Local secret vault that holds the profile key
|
|
16
|
+
* @returns Profile key as Uint8Array, or null if not set
|
|
17
|
+
*/
|
|
18
|
+
export declare function getOwnProfileKey(vault: SignalProtocolLocalSecretVault): Promise<Uint8Array | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Set own profile key in the application's local secret vault
|
|
21
|
+
*
|
|
22
|
+
* @param vault - Local secret vault that holds the profile key
|
|
23
|
+
* @param key - 32-byte profile key
|
|
24
|
+
*/
|
|
25
|
+
export declare function setOwnProfileKey(vault: SignalProtocolLocalSecretVault, key: Uint8Array): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Get or create own profile key
|
|
28
|
+
*
|
|
29
|
+
* If no profile key exists, generates a new one and stores it.
|
|
30
|
+
*
|
|
31
|
+
* @param vault - Local secret vault that holds the profile key
|
|
32
|
+
* @returns Profile key as Uint8Array
|
|
33
|
+
*/
|
|
34
|
+
export declare function getOrCreateOwnProfileKey(vault: SignalProtocolLocalSecretVault): Promise<Uint8Array>;
|
|
35
|
+
/**
|
|
36
|
+
* Get own profile key as base64 string (for DataMessage.profileKey)
|
|
37
|
+
*
|
|
38
|
+
* @param vault - Local secret vault that holds the profile key
|
|
39
|
+
* @returns Profile key as base64 string
|
|
40
|
+
*/
|
|
41
|
+
export declare function getOwnProfileKeyBase64(vault: SignalProtocolLocalSecretVault): Promise<string>;
|
|
42
|
+
//# sourceMappingURL=own-profile-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own-profile-key.d.ts","sourceRoot":"","sources":["../../profile/own-profile-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAInE,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAE5B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,8BAA8B,EACrC,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,UAAU,CAAC,CAUrB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,MAAM,CAAC,CAKjB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Own Profile Key
|
|
3
|
+
*
|
|
4
|
+
* The current user's profile key in the application's local secret vault.
|
|
5
|
+
*/
|
|
6
|
+
import { bytesToBase64 } from '../internal/crypto/index.js';
|
|
7
|
+
import { requireSecretVault } from '../local/vault/require.js';
|
|
8
|
+
import { generateProfileKey, PROFILE_KEY_SIZE } from './crypto.js';
|
|
9
|
+
/** Vault secret name for the own profile key (the raw 32 bytes) */
|
|
10
|
+
export const OWN_PROFILE_KEY_ID = 'signal_profile_key_v1';
|
|
11
|
+
/**
|
|
12
|
+
* Get the current user's profile key from the application's local secret vault.
|
|
13
|
+
*
|
|
14
|
+
* The profile key lives only in the vault that the application passes. With no
|
|
15
|
+
* vault, this throws `SECRET_VAULT_REQUIRED`.
|
|
16
|
+
*
|
|
17
|
+
* @param vault - Local secret vault that holds the profile key
|
|
18
|
+
* @returns Profile key as Uint8Array, or null if not set
|
|
19
|
+
*/
|
|
20
|
+
export async function getOwnProfileKey(vault) {
|
|
21
|
+
return requireSecretVault(vault, 'getOwnProfileKey').getSecret(OWN_PROFILE_KEY_ID);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set own profile key in the application's local secret vault
|
|
25
|
+
*
|
|
26
|
+
* @param vault - Local secret vault that holds the profile key
|
|
27
|
+
* @param key - 32-byte profile key
|
|
28
|
+
*/
|
|
29
|
+
export async function setOwnProfileKey(vault, key) {
|
|
30
|
+
const secretVault = requireSecretVault(vault, 'setOwnProfileKey');
|
|
31
|
+
if (key.length !== PROFILE_KEY_SIZE) {
|
|
32
|
+
throw new Error(`Profile key must be ${PROFILE_KEY_SIZE} bytes, got ${key.length}`);
|
|
33
|
+
}
|
|
34
|
+
await secretVault.setSecret(OWN_PROFILE_KEY_ID, key);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get or create own profile key
|
|
38
|
+
*
|
|
39
|
+
* If no profile key exists, generates a new one and stores it.
|
|
40
|
+
*
|
|
41
|
+
* @param vault - Local secret vault that holds the profile key
|
|
42
|
+
* @returns Profile key as Uint8Array
|
|
43
|
+
*/
|
|
44
|
+
export async function getOrCreateOwnProfileKey(vault) {
|
|
45
|
+
const secretVault = requireSecretVault(vault, 'getOrCreateOwnProfileKey');
|
|
46
|
+
const existing = await getOwnProfileKey(secretVault);
|
|
47
|
+
if (existing) {
|
|
48
|
+
return existing;
|
|
49
|
+
}
|
|
50
|
+
const newKey = await generateProfileKey();
|
|
51
|
+
await setOwnProfileKey(secretVault, newKey);
|
|
52
|
+
return newKey;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get own profile key as base64 string (for DataMessage.profileKey)
|
|
56
|
+
*
|
|
57
|
+
* @param vault - Local secret vault that holds the profile key
|
|
58
|
+
* @returns Profile key as base64 string
|
|
59
|
+
*/
|
|
60
|
+
export async function getOwnProfileKeyBase64(vault) {
|
|
61
|
+
const key = await getOrCreateOwnProfileKey(requireSecretVault(vault, 'getOwnProfileKeyBase64'));
|
|
62
|
+
return bytesToBase64(key);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=own-profile-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own-profile-key.js","sourceRo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,CAAC;IAC5C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAAqC;IAErC,MAAM,GAAG,GAAG,MAAM,wBAAwB,CACxC,kBAAkB,CAAC,KAAK,EAAE,wBAAwB,CAAC,CACpD,CAAC;IACF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import type { ConvexReactClient } from 'convex/react';
|
|
20
20
|
import type { FunctionReference } from 'convex/server';
|
|
21
21
|
import type { SignalProtocolLocalSecretVault } from '../types/api.js';
|
|
22
|
-
import type
|
|
22
|
+
import { type UpdateEncryptedProfileApi } from './update-service.js';
|
|
23
23
|
import { type Logger } from '../logger.js';
|
|
24
24
|
import type { ApplicationProfileData } from './cipher.js';
|
|
25
25
|
export {};
|
|
@@ -52,39 +52,6 @@ export declare class ProfileKeyRotationError extends Error {
|
|
|
52
52
|
readonly retryRequired = true;
|
|
53
53
|
constructor(stage: ProfileKeyRotationStage, cause: unknown);
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Get the current user's profile key from the application's local secret vault.
|
|
57
|
-
*
|
|
58
|
-
* The profile key lives only in the vault that the application passes. With no
|
|
59
|
-
* vault, this throws `SECRET_VAULT_REQUIRED`.
|
|
60
|
-
*
|
|
61
|
-
* @param vault - Local secret vault that holds the profile key
|
|
62
|
-
* @returns Profile key as Uint8Array, or null if not set
|
|
63
|
-
*/
|
|
64
|
-
export declare function getOwnProfileKey(vault: SignalProtocolLocalSecretVault): Promise<Uint8Array | null>;
|
|
65
|
-
/**
|
|
66
|
-
* Set own profile key in the application's local secret vault
|
|
67
|
-
*
|
|
68
|
-
* @param vault - Local secret vault that holds the profile key
|
|
69
|
-
* @param key - 32-byte profile key
|
|
70
|
-
*/
|
|
71
|
-
export declare function setOwnProfileKey(vault: SignalProtocolLocalSecretVault, key: Uint8Array): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Get or create own profile key
|
|
74
|
-
*
|
|
75
|
-
* If no profile key exists, generates a new one and stores it.
|
|
76
|
-
*
|
|
77
|
-
* @param vault - Local secret vault that holds the profile key
|
|
78
|
-
* @returns Profile key as Uint8Array
|
|
79
|
-
*/
|
|
80
|
-
export declare function getOrCreateOwnProfileKey(vault: SignalProtocolLocalSecretVault): Promise<Uint8Array>;
|
|
81
|
-
/**
|
|
82
|
-
* Get own profile key as base64 string (for DataMessage.profileKey)
|
|
83
|
-
*
|
|
84
|
-
* @param vault - Local secret vault that holds the profile key
|
|
85
|
-
* @returns Profile key as base64 string
|
|
86
|
-
*/
|
|
87
|
-
export declare function getOwnProfileKeyBase64(vault: SignalProtocolLocalSecretVault): Promise<string>;
|
|
88
55
|
/**
|
|
89
56
|
* Rotate own profile key (security event)
|
|
90
57
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-key.d.ts","sourceRoot":"","sources":["../../profile/profile-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"profile-key.d.ts","sourceRoot":"","sources":["../../profile/profile-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE1F,OAAO,E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;;;;;;;;;;;GAiBG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,8BAA8B,EACrC,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,aAAa,EAClB,mBAAmB,EAAE,yBAAyB,EAC9C,UAAU,EAAE,6BAA6B,EACzC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC,CAkEjB"}
|
|
@@ -19,16 +19,13 @@
|
|
|
19
19
|
import { uploadBinary, downloadBinary } from '../utils/binary-transfer.js';
|
|
20
20
|
import { bytesToBase64 } from '../internal/crypto/index.js';
|
|
21
21
|
import { requireSecretVault } from '../local/vault/require.js';
|
|
22
|
+
import { updateEncryptedProfile } from './update-service.js';
|
|
23
|
+
import { getOwnProfileKey, OWN_PROFILE_KEY_ID } from './own-profile-key.js';
|
|
22
24
|
import { resolveSignalProtocolLogger } from '../logger.js';
|
|
23
25
|
import { deriveAccessKey } from '../internal/protocol/sealed-sender/delivery-token.js';
|
|
24
26
|
export { generateProfileKey, encryptProfileData, decryptProfileData, PROFILE_KEY_SIZE, NONCE_SIZE, AUTH_TAG_SIZE, } from './crypto.js';
|
|
25
27
|
// Import for local use in this module
|
|
26
|
-
import { generateProfileKey,
|
|
27
|
-
// ============================================================================
|
|
28
|
-
// Constants
|
|
29
|
-
// ============================================================================
|
|
30
|
-
/** Vault secret name for the own profile key (the raw 32 bytes) */
|
|
31
|
-
const OWN_PROFILE_KEY_ID = 'signal_profile_key_v1';
|
|
28
|
+
import { generateProfileKey, encryptProfileData, decryptProfileData } from './crypto.js';
|
|
32
29
|
export class ProfileKeyRotationError extends Error {
|
|
33
30
|
stage;
|
|
34
31
|
retryRequired = true;
|
|
@@ -39,62 +36,6 @@ export class ProfileKeyRotationError extends Error {
|
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
// ============================================================================
|
|
42
|
-
// Own Profile Key (Local Secret Vault)
|
|
43
|
-
// ============================================================================
|
|
44
|
-
/**
|
|
45
|
-
* Get the current user's profile key from the application's local secret vault.
|
|
46
|
-
*
|
|
47
|
-
* The profile key lives only in the vault that the application passes. With no
|
|
48
|
-
* vault, this throws `SECRET_VAULT_REQUIRED`.
|
|
49
|
-
*
|
|
50
|
-
* @param vault - Local secret vault that holds the profile key
|
|
51
|
-
* @returns Profile key as Uint8Array, or null if not set
|
|
52
|
-
*/
|
|
53
|
-
export async function getOwnProfileKey(vault) {
|
|
54
|
-
return requireSecretVault(vault, 'getOwnProfileKey').getSecret(OWN_PROFILE_KEY_ID);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Set own profile key in the application's local secret vault
|
|
58
|
-
*
|
|
59
|
-
* @param vault - Local secret vault that holds the profile key
|
|
60
|
-
* @param key - 32-byte profile key
|
|
61
|
-
*/
|
|
62
|
-
export async function setOwnProfileKey(vault, key) {
|
|
63
|
-
const secretVault = requireSecretVault(vault, 'setOwnProfileKey');
|
|
64
|
-
if (key.length !== PROFILE_KEY_SIZE) {
|
|
65
|
-
throw new Error(`Profile key must be ${PROFILE_KEY_SIZE} bytes, got ${key.length}`);
|
|
66
|
-
}
|
|
67
|
-
await secretVault.setSecret(OWN_PROFILE_KEY_ID, key);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get or create own profile key
|
|
71
|
-
*
|
|
72
|
-
* If no profile key exists, generates a new one and stores it.
|
|
73
|
-
*
|
|
74
|
-
* @param vault - Local secret vault that holds the profile key
|
|
75
|
-
* @returns Profile key as Uint8Array
|
|
76
|
-
*/
|
|
77
|
-
export async function getOrCreateOwnProfileKey(vault) {
|
|
78
|
-
const secretVault = requireSecretVault(vault, 'getOrCreateOwnProfileKey');
|
|
79
|
-
const existing = await getOwnProfileKey(secretVault);
|
|
80
|
-
if (existing) {
|
|
81
|
-
return existing;
|
|
82
|
-
}
|
|
83
|
-
const newKey = await generateProfileKey();
|
|
84
|
-
await setOwnProfileKey(secretVault, newKey);
|
|
85
|
-
return newKey;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get own profile key as base64 string (for DataMessage.profileKey)
|
|
89
|
-
*
|
|
90
|
-
* @param vault - Local secret vault that holds the profile key
|
|
91
|
-
* @returns Profile key as base64 string
|
|
92
|
-
*/
|
|
93
|
-
export async function getOwnProfileKeyBase64(vault) {
|
|
94
|
-
const key = await getOrCreateOwnProfileKey(requireSecretVault(vault, 'getOwnProfileKeyBase64'));
|
|
95
|
-
return bytesToBase64(key);
|
|
96
|
-
}
|
|
97
|
-
// ============================================================================
|
|
98
39
|
// Profile Key Rotation
|
|
99
40
|
// ============================================================================
|
|
100
41
|
/**
|
|
@@ -133,7 +74,6 @@ export async function rotateOwnProfileKey(vault, convex, api, encryptedProfileAp
|
|
|
133
74
|
const localProfile = await localStore.getOwnProfileSnapshot(currentUser._id);
|
|
134
75
|
// Upload every new-key artifact while the old key remains locally active.
|
|
135
76
|
stage = 'encrypted-profile-upload';
|
|
136
|
-
const { updateEncryptedProfile } = await import('./update-service.js');
|
|
137
77
|
await updateEncryptedProfile({
|
|
138
78
|
convex,
|
|
139
79
|
api: encryptedProfileApi,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-key.js","sourceRoot":"","sources":["../../profile/profile-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-key.js","sourceRoot":"","sources":["../../profile/profile-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,E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9
|
*/
|
|
10
|
-
import { getOrCreateOwnProfileKey } from './profile-key.js';
|
|
10
|
+
import { getOrCreateOwnProfileKey } from './own-profile-key.js';
|
|
11
11
|
import { requireSecretVault } from '../local/vault/require.js';
|
|
12
12
|
import { computeProfileKeyVersion } from '../internal/protocol/zk/groups/profile-key-version.js';
|
|
13
13
|
import { computeProfileKeyCommitment } from '../internal/protocol/zk/groups/profile-key-commitment.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-service.js","sourceRoot":"","sources":["../../profile/update-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"update-service.js","sourceRoot":"","sources":["../../profile/update-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,GAE7B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAe,MAAM,WAAW,CAAC;AAsCrE,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAoC;IAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAChG,MAAM,MAAM,GAAG,2BAA2B,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,EAAE,UAAU,CAAC,MAAqB;QAC5C,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAE,gBAAgB,CAAC,MAAsB,CAAC,CAAC,CAAC,SAAS;KACjF,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;QACxC,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE;KAChD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provider-neutral
|
|
2
|
+
* Provider-neutral client contracts for relay operations.
|
|
3
3
|
*
|
|
4
4
|
* `SignalProtocolRelayServer` separates protocol operations from backend transport,
|
|
5
5
|
* persistence, authentication, and authorization. Applications can supply
|
|
6
|
-
* their own
|
|
6
|
+
* their own transport or use `createHostedSignalProtocolClient()`.
|
|
7
7
|
*
|
|
8
8
|
* ## Usage
|
|
9
9
|
*
|
|
10
10
|
* ```typescript
|
|
11
11
|
* import type { SignalProtocolRelayServer } from '@open-e2ee/signal-protocol-sdk/remote/relay';
|
|
12
|
-
* import { inMemoryRelay } from '@open-e2ee/signal-protocol-sdk/remote/relay/memory';
|
|
13
12
|
*
|
|
14
|
-
* //
|
|
15
|
-
*
|
|
16
|
-
* const relay: SignalProtocolRelayServer = inMemoryRelay();
|
|
13
|
+
* // Advanced integration with an application-owned client transport.
|
|
14
|
+
* const relay: SignalProtocolRelayServer = appRelayTransport;
|
|
17
15
|
* ```
|
|
18
16
|
*/
|
|
19
17
|
/**
|
|
@@ -23,5 +21,4 @@
|
|
|
23
21
|
*/
|
|
24
22
|
export {};
|
|
25
23
|
export type { SignalProtocolRelayServer, DeliveryClass, Envelope, DeviceInfo, DeviceType, DeviceRegistration, PreKeyUpload, PreKeyBundle, PreKeyInventory, PreKeyMetadata, RelayConnectionReason, RelayConnectionState, Unsubscribe, AccountIdentityProvisioning, AccountIdentityRotation, RelayGroupServer, } from './types.js';
|
|
26
|
-
export { InMemorySignalProtocolRelayServer } from './memory/index.js';
|
|
27
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../remote/relay/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../remote/relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,OAAO,EAAE,CAAC;AACV,YAAY,EACV,yBAAyB,EACzB,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provider-neutral
|
|
2
|
+
* Provider-neutral client contracts for relay operations.
|
|
3
3
|
*
|
|
4
4
|
* `SignalProtocolRelayServer` separates protocol operations from backend transport,
|
|
5
5
|
* persistence, authentication, and authorization. Applications can supply
|
|
6
|
-
* their own
|
|
6
|
+
* their own transport or use `createHostedSignalProtocolClient()`.
|
|
7
7
|
*
|
|
8
8
|
* ## Usage
|
|
9
9
|
*
|
|
10
10
|
* ```typescript
|
|
11
11
|
* import type { SignalProtocolRelayServer } from '@open-e2ee/signal-protocol-sdk/remote/relay';
|
|
12
|
-
* import { inMemoryRelay } from '@open-e2ee/signal-protocol-sdk/remote/relay/memory';
|
|
13
12
|
*
|
|
14
|
-
* //
|
|
15
|
-
*
|
|
16
|
-
* const relay: SignalProtocolRelayServer = inMemoryRelay();
|
|
13
|
+
* // Advanced integration with an application-owned client transport.
|
|
14
|
+
* const relay: SignalProtocolRelayServer = appRelayTransport;
|
|
17
15
|
* ```
|
|
18
16
|
*/
|
|
17
|
+
export {};
|
|
19
18
|
// The in-memory adapter is exported here for convenient local composition.
|
|
20
|
-
export { InMemorySignalProtocolRelayServer } from './memory/index.js';
|
|
21
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../remote/relay/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../remote/relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;AA2BH,2EAA2E"}
|
|
@@ -180,18 +180,18 @@ export interface KeyRotationService {
|
|
|
180
180
|
} | null>;
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
183
|
+
* Client transport contract for encrypted envelope delivery.
|
|
184
184
|
*
|
|
185
185
|
* Responsibilities:
|
|
186
186
|
* - Envelope delivery (push to devices via real-time subscription)
|
|
187
187
|
* - Device registry (multi-device support, max 5 devices per user)
|
|
188
188
|
* - Prekey management (X3DH/PQXDH key exchange)
|
|
189
189
|
*
|
|
190
|
-
* The
|
|
190
|
+
* The hosted client configures this transport for the OpenE2EE Signal Protocol Relay.
|
|
191
191
|
*
|
|
192
192
|
* @example
|
|
193
193
|
* ```typescript
|
|
194
|
-
* const relay: SignalProtocolRelayServer =
|
|
194
|
+
* const relay: SignalProtocolRelayServer = appRelayTransport;
|
|
195
195
|
*
|
|
196
196
|
* // Subscribe to incoming envelopes
|
|
197
197
|
* const unsubscribe = relay.subscribe(userId, deviceId, (envelope) => {
|
package/dist/types/api.d.ts
CHANGED
|
@@ -66,10 +66,26 @@ export interface ReceivedContent {
|
|
|
66
66
|
receivedAt: number;
|
|
67
67
|
groupId?: string;
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
69
|
+
/** Effects committed atomically with the sender-key record after successful decryption. */
|
|
70
70
|
export interface SenderKeyReceiveCommit {
|
|
71
|
-
content
|
|
72
|
-
|
|
71
|
+
content?: ReceivedContent;
|
|
72
|
+
consumedSkippedKey?: {
|
|
73
|
+
senderKeyId: string;
|
|
74
|
+
chainIndex: number;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Add keys in order. Before each addition, evict the lowest chain indexes for
|
|
78
|
+
* this group/member/device until fewer than maxSkippedKeys remain. Eviction,
|
|
79
|
+
* additions, consumption, content, and the record must all roll back on failure.
|
|
80
|
+
*/
|
|
81
|
+
skippedKeys?: {
|
|
82
|
+
maxSkippedKeys: number;
|
|
83
|
+
keys: Array<{
|
|
84
|
+
senderKeyId: string;
|
|
85
|
+
chainIndex: number;
|
|
86
|
+
messageKey: SkippedSenderMessageKey;
|
|
87
|
+
}>;
|
|
88
|
+
};
|
|
73
89
|
}
|
|
74
90
|
/**
|
|
75
91
|
* High-level encrypted messaging client interface.
|
|
@@ -1048,7 +1064,9 @@ export interface SenderKeyStore {
|
|
|
1048
1064
|
* retained during the rotation window for decrypting in-flight messages.
|
|
1049
1065
|
*
|
|
1050
1066
|
* Per Sender Keys spec Section 5.1: "Implementations MUST store sender key
|
|
1051
|
-
* state persistently." This method persists the full record atomically
|
|
1067
|
+
* state persistently." This method persists the full record atomically with
|
|
1068
|
+
* every receive effect. A rejection preserves the prior record, skipped keys,
|
|
1069
|
+
* and received content. The same guarantee applies without a content receipt.
|
|
1052
1070
|
*
|
|
1053
1071
|
* @param groupId - Group identifier
|
|
1054
1072
|
* @param userId - User identifier
|
|
@@ -1076,20 +1094,22 @@ export interface SenderKeyStore {
|
|
|
1076
1094
|
* @param groupId - Group identifier
|
|
1077
1095
|
* @param senderId - Sender user identifier
|
|
1078
1096
|
* @param senderDeviceId - Sender device identifier
|
|
1097
|
+
* @param senderKeyId - Distribution identifier for this sender-key generation
|
|
1079
1098
|
* @param chainIndex - The message index this key is for
|
|
1080
1099
|
* @param messageKey - Derived IV and cipher key (base64 encoded)
|
|
1081
1100
|
*/
|
|
1082
|
-
storeSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number, messageKey: SkippedSenderMessageKey): Promise<void>;
|
|
1101
|
+
storeSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, senderKeyId: string, chainIndex: number, messageKey: SkippedSenderMessageKey): Promise<void>;
|
|
1083
1102
|
/**
|
|
1084
1103
|
* Retrieve skipped message key for out-of-order decryption.
|
|
1085
1104
|
*
|
|
1086
1105
|
* @param groupId - Group identifier
|
|
1087
1106
|
* @param senderId - Sender user identifier
|
|
1088
1107
|
* @param senderDeviceId - Sender device identifier
|
|
1108
|
+
* @param senderKeyId - Distribution identifier for this sender-key generation
|
|
1089
1109
|
* @param chainIndex - The message index to look up
|
|
1090
1110
|
* @returns Message key or null if not found/expired
|
|
1091
1111
|
*/
|
|
1092
|
-
getSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number): Promise<SkippedSenderMessageKey | null>;
|
|
1112
|
+
getSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, senderKeyId: string, chainIndex: number): Promise<SkippedSenderMessageKey | null>;
|
|
1093
1113
|
/**
|
|
1094
1114
|
* Delete skipped message key after use.
|
|
1095
1115
|
*
|
|
@@ -1098,9 +1118,10 @@ export interface SenderKeyStore {
|
|
|
1098
1118
|
* @param groupId - Group identifier
|
|
1099
1119
|
* @param senderId - Sender user identifier
|
|
1100
1120
|
* @param senderDeviceId - Sender device identifier
|
|
1121
|
+
* @param senderKeyId - Distribution identifier for this sender-key generation
|
|
1101
1122
|
* @param chainIndex - The message index to delete
|
|
1102
1123
|
*/
|
|
1103
|
-
deleteSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number): Promise<void>;
|
|
1124
|
+
deleteSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, senderKeyId: string, chainIndex: number): Promise<void>;
|
|
1104
1125
|
/**
|
|
1105
1126
|
* Count skipped keys for a sender (for enforcing maxSkippedKeys limit).
|
|
1106
1127
|
*
|
|
@@ -1128,7 +1149,7 @@ export interface SenderKeyStore {
|
|
|
1128
1149
|
* Contains pre-derived IV and cipher key in base64 format.
|
|
1129
1150
|
*/
|
|
1130
1151
|
export interface SkippedSenderMessageKey {
|
|
1131
|
-
/** AES-256-
|
|
1152
|
+
/** AES-256-CBC cipher key (base64) */
|
|
1132
1153
|
cipherKey: string;
|
|
1133
1154
|
/** Initialization vector (base64) */
|
|
1134
1155
|
iv: string;
|