@open-e2ee/signal-protocol-sdk 2.0.1 → 3.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 +10 -17
- package/ARCHITECTURE.md +1 -2
- package/CHANGELOG.md +80 -0
- package/LICENSE +11 -655
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +5 -7
- package/README.md +11 -11
- package/SECURITY.md +2 -2
- package/TROUBLESHOOTING.md +2 -6
- package/client/README.md +34 -16
- package/device/README.md +1 -1
- package/dist/client/client.d.ts +13 -2
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +136 -73
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +14 -18
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/content-adapter.d.ts +2 -0
- package/dist/client/content-adapter.d.ts.map +1 -1
- package/dist/client/content-adapter.js +4 -0
- package/dist/client/content-adapter.js.map +1 -1
- package/dist/client/endorsement-manager.d.ts +4 -1
- package/dist/client/endorsement-manager.d.ts.map +1 -1
- package/dist/client/endorsement-manager.js +14 -6
- package/dist/client/endorsement-manager.js.map +1 -1
- package/dist/client/group-authority.d.ts +8 -0
- package/dist/client/group-authority.d.ts.map +1 -0
- package/dist/client/group-authority.js +2 -0
- package/dist/client/group-authority.js.map +1 -0
- package/dist/client/headless.d.ts +3 -8
- package/dist/client/headless.d.ts.map +1 -1
- package/dist/client/headless.js +3 -8
- package/dist/client/headless.js.map +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts +32 -0
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -0
- package/dist/client/hosted-anonymous-delivery.js +239 -0
- package/dist/client/hosted-anonymous-delivery.js.map +1 -0
- package/dist/client/hosted-connection.d.ts +1 -1
- package/dist/client/hosted-connection.d.ts.map +1 -1
- package/dist/client/hosted-connection.js +18 -51
- package/dist/client/hosted-connection.js.map +1 -1
- package/dist/client/hosted-group-authority.d.ts +11 -0
- package/dist/client/hosted-group-authority.d.ts.map +1 -0
- package/dist/client/hosted-group-authority.js +96 -0
- package/dist/client/hosted-group-authority.js.map +1 -0
- package/dist/client/hosted-groups.d.ts +31 -0
- package/dist/client/hosted-groups.d.ts.map +1 -0
- package/dist/client/hosted-groups.js +217 -0
- package/dist/client/hosted-groups.js.map +1 -0
- package/dist/client/hosted-mailbox-subscription.d.ts +34 -0
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -0
- package/dist/client/hosted-mailbox-subscription.js +257 -0
- package/dist/client/hosted-mailbox-subscription.js.map +1 -0
- package/dist/client/hosted-prekey-publication.d.ts +51 -0
- package/dist/client/hosted-prekey-publication.d.ts.map +1 -0
- package/dist/client/hosted-prekey-publication.js +249 -0
- package/dist/client/hosted-prekey-publication.js.map +1 -0
- package/dist/client/hosted-push.d.ts +4 -5
- package/dist/client/hosted-push.d.ts.map +1 -1
- package/dist/client/hosted-push.js +22 -22
- package/dist/client/hosted-push.js.map +1 -1
- package/dist/client/hosted-transport.d.ts +57 -35
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +666 -341
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted-trust.d.ts +29 -0
- package/dist/client/hosted-trust.d.ts.map +1 -0
- package/dist/client/hosted-trust.js +28 -0
- package/dist/client/hosted-trust.js.map +1 -0
- package/dist/client/hosted.d.ts +18 -13
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +78 -34
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +14 -14
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +7 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client/key-rotation-core.d.ts +8 -0
- package/dist/client/key-rotation-core.d.ts.map +1 -1
- package/dist/client/key-rotation-core.js +12 -1
- package/dist/client/key-rotation-core.js.map +1 -1
- package/dist/client/key-rotation.d.ts +2 -1
- package/dist/client/key-rotation.d.ts.map +1 -1
- package/dist/client/key-rotation.js +4 -4
- package/dist/client/key-rotation.js.map +1 -1
- package/dist/client/media-queue-persistence.d.ts +14 -0
- package/dist/client/media-queue-persistence.d.ts.map +1 -0
- package/dist/client/media-queue-persistence.js +123 -0
- package/dist/client/media-queue-persistence.js.map +1 -0
- package/dist/client/media-upload-budget.d.ts +3 -0
- package/dist/client/media-upload-budget.d.ts.map +1 -0
- package/dist/client/media-upload-budget.js +27 -0
- package/dist/client/media-upload-budget.js.map +1 -0
- package/dist/client/media.d.ts +51 -15
- package/dist/client/media.d.ts.map +1 -1
- package/dist/client/media.js +541 -73
- package/dist/client/media.js.map +1 -1
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +13 -14
- package/dist/client/messages.js.map +1 -1
- package/dist/client/prekeys.d.ts.map +1 -1
- package/dist/client/prekeys.js +131 -43
- package/dist/client/prekeys.js.map +1 -1
- package/dist/client/relay-subscription.d.ts +4 -0
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +58 -25
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/sender-key-distribution.d.ts +8 -0
- package/dist/client/sender-key-distribution.d.ts.map +1 -0
- package/dist/client/sender-key-distribution.js +59 -0
- package/dist/client/sender-key-distribution.js.map +1 -0
- package/dist/client/signal-service-cipher.d.ts +7 -3
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +41 -16
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/device/{expo-metadata.d.ts → expo/index.d.ts} +3 -3
- package/dist/device/expo/index.d.ts.map +1 -0
- package/dist/device/{expo-metadata.js → expo/index.js} +2 -2
- package/dist/device/expo/index.js.map +1 -0
- package/dist/device/index.js +1 -1
- package/dist/device/index.js.map +1 -1
- package/dist/device/provisioning.d.ts +1 -1
- package/dist/device/provisioning.js +1 -1
- package/dist/device/types.d.ts +1 -1
- package/dist/groups/server.d.ts +10 -0
- package/dist/groups/server.d.ts.map +1 -0
- package/dist/groups/server.js +6 -0
- package/dist/groups/server.js.map +1 -0
- package/dist/hooks/use-connection-presence.d.ts +2 -4
- package/dist/hooks/use-connection-presence.d.ts.map +1 -1
- package/dist/hooks/use-connection-presence.js +2 -4
- package/dist/hooks/use-connection-presence.js.map +1 -1
- package/dist/index.d.ts +51 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/internal/groups/authority-certificate.d.ts +22 -0
- package/dist/internal/groups/authority-certificate.d.ts.map +1 -0
- package/dist/internal/groups/authority-certificate.js +99 -0
- package/dist/internal/groups/authority-certificate.js.map +1 -0
- package/dist/internal/groups/error-details.d.ts +9 -0
- package/dist/internal/groups/error-details.d.ts.map +1 -0
- package/dist/internal/groups/error-details.js +30 -0
- package/dist/internal/groups/error-details.js.map +1 -0
- package/dist/internal/groups/manager.d.ts +5 -0
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +3 -0
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/server-engine.d.ts +7 -0
- package/dist/internal/groups/server-engine.d.ts.map +1 -1
- package/dist/internal/groups/server-engine.js +51 -19
- package/dist/internal/groups/server-engine.js.map +1 -1
- package/dist/internal/groups/wire.d.ts.map +1 -1
- package/dist/internal/groups/wire.js +10 -9
- package/dist/internal/groups/wire.js.map +1 -1
- package/dist/internal/manager/manager.d.ts +1 -1
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +22 -25
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +27 -14
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/sesame/manager.d.ts +2 -2
- package/dist/internal/sesame/manager.d.ts.map +1 -1
- package/dist/internal/sesame/manager.js +6 -6
- package/dist/internal/sesame/manager.js.map +1 -1
- package/dist/internal/sesame/types.d.ts +1 -1
- package/dist/internal/sesame/types.d.ts.map +1 -1
- package/dist/internal/session/cipher.d.ts +1 -1
- package/dist/internal/session/cipher.d.ts.map +1 -1
- package/dist/internal/session/cipher.js +31 -28
- package/dist/internal/session/cipher.js.map +1 -1
- package/dist/layers.d.ts +1 -1
- package/dist/layers.d.ts.map +1 -1
- package/dist/layers.js +1 -1
- package/dist/layers.js.map +1 -1
- 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 +28 -9
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/expo/key-storage.d.ts +7 -1
- package/dist/local/store/expo/key-storage.d.ts.map +1 -1
- package/dist/local/store/expo/key-storage.js +82 -17
- package/dist/local/store/expo/key-storage.js.map +1 -1
- package/dist/local/store/expo/models/kyber-prekey-used.d.ts +1 -4
- package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +1 -1
- package/dist/local/store/expo/models/kyber-prekey-used.js +23 -9
- package/dist/local/store/expo/models/kyber-prekey-used.js.map +1 -1
- package/dist/local/store/expo/models/kyber-prekey.d.ts +4 -4
- package/dist/local/store/expo/models/kyber-prekey.d.ts.map +1 -1
- package/dist/local/store/expo/models/kyber-prekey.js +67 -26
- package/dist/local/store/expo/models/kyber-prekey.js.map +1 -1
- package/dist/local/store/expo/schema.d.ts +21 -2
- package/dist/local/store/expo/schema.d.ts.map +1 -1
- package/dist/local/store/expo/schema.js +10 -2
- package/dist/local/store/expo/schema.js.map +1 -1
- package/dist/local/store/kyber-prekey-lifecycle.d.ts +46 -0
- package/dist/local/store/kyber-prekey-lifecycle.d.ts.map +1 -0
- package/dist/local/store/kyber-prekey-lifecycle.js +88 -0
- package/dist/local/store/kyber-prekey-lifecycle.js.map +1 -0
- package/dist/local/store/memory/adapter.d.ts +11 -3
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +113 -28
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/node/adapter.d.ts +8 -2
- package/dist/local/store/node/adapter.d.ts.map +1 -1
- package/dist/local/store/node/adapter.js +31 -13
- package/dist/local/store/node/adapter.js.map +1 -1
- package/dist/local/store/node/database-file-commit.d.ts +8 -0
- package/dist/local/store/node/database-file-commit.d.ts.map +1 -0
- package/dist/local/store/node/database-file-commit.js +62 -0
- package/dist/local/store/node/database-file-commit.js.map +1 -0
- package/dist/local/store/node/database-key.d.ts +6 -1
- package/dist/local/store/node/database-key.d.ts.map +1 -1
- package/dist/local/store/node/database-key.js +79 -44
- package/dist/local/store/node/database-key.js.map +1 -1
- package/dist/local/store/node/database-lock.d.ts +8 -0
- package/dist/local/store/node/database-lock.d.ts.map +1 -0
- package/dist/local/store/node/database-lock.js +44 -0
- package/dist/local/store/node/database-lock.js.map +1 -0
- package/dist/local/store/node/database.d.ts +15 -14
- package/dist/local/store/node/database.d.ts.map +1 -1
- package/dist/local/store/node/database.js +197 -202
- package/dist/local/store/node/database.js.map +1 -1
- package/dist/local/store/react-native/adapter.d.ts +8 -2
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +151 -66
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/received-content.d.ts +9 -0
- package/dist/local/store/received-content.d.ts.map +1 -0
- package/dist/local/store/received-content.js +46 -0
- package/dist/local/store/received-content.js.map +1 -0
- package/dist/local/store/reliability.d.ts +2 -2
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +7 -4
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/local/store/web/adapter.d.ts +8 -2
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +206 -73
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/media/index.d.ts +71 -61
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +550 -386
- package/dist/media/index.js.map +1 -1
- package/dist/media/prepared-upload.d.ts +37 -0
- package/dist/media/prepared-upload.d.ts.map +1 -0
- package/dist/media/prepared-upload.js +46 -0
- package/dist/media/prepared-upload.js.map +1 -0
- package/dist/remote/object-store/convex-r2/server.d.ts +2 -1
- package/dist/remote/object-store/convex-r2/server.d.ts.map +1 -1
- package/dist/remote/object-store/convex-r2/server.js +4 -0
- package/dist/remote/object-store/convex-r2/server.js.map +1 -1
- package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -1
- package/dist/remote/object-store/convex-r2/storage.js +1 -0
- package/dist/remote/object-store/convex-r2/storage.js.map +1 -1
- package/dist/remote/object-store/index.d.ts +3 -1
- package/dist/remote/object-store/index.d.ts.map +1 -1
- package/dist/remote/object-store/index.js +1 -1
- package/dist/remote/object-store/index.js.map +1 -1
- package/dist/remote/object-store/s3/storage.d.ts +3 -1
- package/dist/remote/object-store/s3/storage.d.ts.map +1 -1
- package/dist/remote/object-store/s3/storage.js +9 -2
- package/dist/remote/object-store/s3/storage.js.map +1 -1
- package/dist/remote/object-store/types.d.ts +33 -4
- package/dist/remote/object-store/types.d.ts.map +1 -1
- package/dist/remote/object-store/upload-error.d.ts +23 -0
- package/dist/remote/object-store/upload-error.d.ts.map +1 -0
- package/dist/remote/object-store/upload-error.js +33 -0
- package/dist/remote/object-store/upload-error.js.map +1 -0
- package/dist/remote/object-store/validation.d.ts +7 -1
- package/dist/remote/object-store/validation.d.ts.map +1 -1
- package/dist/remote/object-store/validation.js +39 -25
- package/dist/remote/object-store/validation.js.map +1 -1
- package/dist/remote/relay/index.d.ts +5 -12
- package/dist/remote/relay/index.d.ts.map +1 -1
- package/dist/remote/relay/index.js +4 -11
- package/dist/remote/relay/index.js.map +1 -1
- package/dist/remote/relay/memory/adapter.d.ts +2 -1
- package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
- package/dist/remote/relay/memory/adapter.js +10 -0
- package/dist/remote/relay/memory/adapter.js.map +1 -1
- package/dist/remote/relay/types.d.ts +28 -17
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +36 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/session.d.ts +6 -0
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js.map +1 -1
- package/docs/ASSURANCE.md +7 -7
- package/docs/CLIENT_COMPOSITION.md +12 -19
- package/docs/DEVIATIONS.md +1 -1
- package/docs/DOCUMENTATION_STANDARDS.md +4 -0
- package/docs/GETTING_STARTED.md +23 -38
- package/docs/INTERFACES.md +22 -13
- package/docs/PACKAGE_SURFACE.md +5 -12
- package/docs/RECIPES.md +10 -23
- package/examples/browser/index.html +2 -2
- package/local/store/README.md +16 -1
- package/local/store/expo/README.md +23 -19
- package/local/store/node/README.md +29 -0
- package/media/README.md +94 -0
- package/package.json +17 -27
- package/remote/README.md +16 -16
- package/remote/object-store/README.md +8 -0
- package/remote/object-store/s3/README.md +10 -1
- package/remote/relay/README.md +3 -2
- package/COMMERCIAL.md +0 -56
- package/dist/device/expo-metadata.d.ts.map +0 -1
- package/dist/device/expo-metadata.js.map +0 -1
- package/dist/remote/relay/convex/backend.d.ts +0 -394
- package/dist/remote/relay/convex/backend.d.ts.map +0 -1
- package/dist/remote/relay/convex/backend.js +0 -678
- package/dist/remote/relay/convex/backend.js.map +0 -1
- package/dist/remote/relay/convex/component/_generated/api.d.ts +0 -58
- package/dist/remote/relay/convex/component/_generated/api.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/_generated/api.js +0 -31
- package/dist/remote/relay/convex/component/_generated/api.js.map +0 -1
- package/dist/remote/relay/convex/component/_generated/component.d.ts +0 -475
- package/dist/remote/relay/convex/component/_generated/component.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/_generated/component.js +0 -11
- package/dist/remote/relay/convex/component/_generated/component.js.map +0 -1
- package/dist/remote/relay/convex/component/_generated/dataModel.d.ts +0 -46
- package/dist/remote/relay/convex/component/_generated/dataModel.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/_generated/dataModel.js +0 -11
- package/dist/remote/relay/convex/component/_generated/dataModel.js.map +0 -1
- package/dist/remote/relay/convex/component/_generated/server.d.ts +0 -129
- package/dist/remote/relay/convex/component/_generated/server.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/_generated/server.js +0 -79
- package/dist/remote/relay/convex/component/_generated/server.js.map +0 -1
- package/dist/remote/relay/convex/component/accounts.d.ts +0 -45
- package/dist/remote/relay/convex/component/accounts.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/accounts.js +0 -184
- package/dist/remote/relay/convex/component/accounts.js.map +0 -1
- package/dist/remote/relay/convex/component/certificates.d.ts +0 -10
- package/dist/remote/relay/convex/component/certificates.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/certificates.js +0 -126
- package/dist/remote/relay/convex/component/certificates.js.map +0 -1
- package/dist/remote/relay/convex/component/cleanup.d.ts +0 -32
- package/dist/remote/relay/convex/component/cleanup.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/cleanup.js +0 -146
- package/dist/remote/relay/convex/component/cleanup.js.map +0 -1
- package/dist/remote/relay/convex/component/convex.config.d.ts +0 -5
- package/dist/remote/relay/convex/component/convex.config.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/convex.config.js +0 -35
- package/dist/remote/relay/convex/component/convex.config.js.map +0 -1
- package/dist/remote/relay/convex/component/crons.d.ts +0 -3
- package/dist/remote/relay/convex/component/crons.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/crons.js +0 -10
- package/dist/remote/relay/convex/component/crons.js.map +0 -1
- package/dist/remote/relay/convex/component/devices.d.ts +0 -102
- package/dist/remote/relay/convex/component/devices.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/devices.js +0 -300
- package/dist/remote/relay/convex/component/devices.js.map +0 -1
- package/dist/remote/relay/convex/component/errors.d.ts +0 -22
- package/dist/remote/relay/convex/component/errors.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/errors.js +0 -17
- package/dist/remote/relay/convex/component/errors.js.map +0 -1
- package/dist/remote/relay/convex/component/groups.d.ts +0 -63
- package/dist/remote/relay/convex/component/groups.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/groups.js +0 -341
- package/dist/remote/relay/convex/component/groups.js.map +0 -1
- package/dist/remote/relay/convex/component/keys.d.ts +0 -130
- package/dist/remote/relay/convex/component/keys.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/keys.js +0 -578
- package/dist/remote/relay/convex/component/keys.js.map +0 -1
- package/dist/remote/relay/convex/component/messages.d.ts +0 -105
- package/dist/remote/relay/convex/component/messages.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/messages.js +0 -702
- package/dist/remote/relay/convex/component/messages.js.map +0 -1
- package/dist/remote/relay/convex/component/provisioning.d.ts +0 -92
- package/dist/remote/relay/convex/component/provisioning.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/provisioning.js +0 -360
- package/dist/remote/relay/convex/component/provisioning.js.map +0 -1
- package/dist/remote/relay/convex/component/runtime.d.ts +0 -18
- package/dist/remote/relay/convex/component/runtime.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/runtime.js +0 -144
- package/dist/remote/relay/convex/component/runtime.js.map +0 -1
- package/dist/remote/relay/convex/component/schema.d.ts +0 -358
- package/dist/remote/relay/convex/component/schema.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/schema.js +0 -288
- package/dist/remote/relay/convex/component/schema.js.map +0 -1
- package/dist/remote/relay/convex/component/zkAuth.d.ts +0 -18
- package/dist/remote/relay/convex/component/zkAuth.d.ts.map +0 -1
- package/dist/remote/relay/convex/component/zkAuth.js +0 -86
- package/dist/remote/relay/convex/component/zkAuth.js.map +0 -1
- package/dist/remote/relay/convex/constants.d.ts +0 -3
- package/dist/remote/relay/convex/constants.d.ts.map +0 -1
- package/dist/remote/relay/convex/constants.js +0 -3
- package/dist/remote/relay/convex/constants.js.map +0 -1
- package/dist/remote/relay/convex/group-server.d.ts +0 -123
- package/dist/remote/relay/convex/group-server.d.ts.map +0 -1
- package/dist/remote/relay/convex/group-server.js +0 -184
- package/dist/remote/relay/convex/group-server.js.map +0 -1
- package/dist/remote/relay/convex/index.d.ts +0 -42
- package/dist/remote/relay/convex/index.d.ts.map +0 -1
- package/dist/remote/relay/convex/index.js +0 -38
- package/dist/remote/relay/convex/index.js.map +0 -1
- package/dist/remote/relay/convex/relay.d.ts +0 -323
- package/dist/remote/relay/convex/relay.d.ts.map +0 -1
- package/dist/remote/relay/convex/relay.js +0 -1144
- package/dist/remote/relay/convex/relay.js.map +0 -1
- package/dist/remote/relay/convex/types.d.ts +0 -24
- package/dist/remote/relay/convex/types.d.ts.map +0 -1
- package/dist/remote/relay/convex/types.js +0 -14
- package/dist/remote/relay/convex/types.js.map +0 -1
- package/remote/relay/convex/README.md +0 -61
- package/remote/relay/convex/component/README.md +0 -462
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../local/store/expo/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,IAAI,EACJ,WAAW,GACZ,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../local/store/expo/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,IAAI,EACJ,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE;IAC9C,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE;IAC7B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;IAC9B,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE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@
|
|
|
1
|
+
import type { IdentityType, KyberPreKey } from '../../keys/index.js';
|
|
2
|
+
export interface StoredKyberPreKeyInstance {
|
|
3
|
+
instanceId: string;
|
|
4
|
+
key: KyberPreKey;
|
|
5
|
+
replacedAt: number | null;
|
|
6
|
+
uses: Record<string, true>;
|
|
7
|
+
}
|
|
8
|
+
/** One identity's retained reusable-key generations and their replay records. */
|
|
9
|
+
export interface StoredKyberPreKeyState {
|
|
10
|
+
currentKeyId: number | null;
|
|
11
|
+
instances: Record<string, StoredKyberPreKeyInstance>;
|
|
12
|
+
}
|
|
13
|
+
export interface KyberPreKeyUse {
|
|
14
|
+
kyberPreKeyId: number;
|
|
15
|
+
kyberPreKeyInstanceId: string;
|
|
16
|
+
signedPreKeyId: number;
|
|
17
|
+
baseKeyBytes: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
export interface RetainedKyberPreKey {
|
|
20
|
+
preKey: KyberPreKey;
|
|
21
|
+
instanceId: string;
|
|
22
|
+
}
|
|
23
|
+
type UnboundKyberPreKeyUse = Omit<KyberPreKeyUse, 'kyberPreKeyInstanceId'>;
|
|
24
|
+
export declare class ReusedBaseKeyError extends Error {
|
|
25
|
+
constructor(kyberPreKeyId: number, signedPreKeyId: number);
|
|
26
|
+
}
|
|
27
|
+
export declare function sameKyberPreKeyInstance(left: KyberPreKey, right: KyberPreKey): boolean;
|
|
28
|
+
export declare function assertUnambiguousKyberPreKeyStore(existing: KyberPreKey | null | undefined, candidate: KyberPreKey, identityType: IdentityType): void;
|
|
29
|
+
export declare function kyberPreKeyUseKey(identityType: IdentityType, use: KyberPreKeyUse): string;
|
|
30
|
+
export declare function createKyberPreKeyState(): StoredKyberPreKeyState;
|
|
31
|
+
export declare function createKyberPreKeyInstanceId(): Promise<string>;
|
|
32
|
+
export declare function getCurrentKyberPreKey(state: StoredKyberPreKeyState | null | undefined): KyberPreKey | null;
|
|
33
|
+
export declare function getRetainedKyberPreKey(state: StoredKyberPreKeyState | null | undefined, keyId: number): RetainedKyberPreKey | null;
|
|
34
|
+
/**
|
|
35
|
+
* Retain a new immutable instance and make it current.
|
|
36
|
+
*
|
|
37
|
+
* A retry with identical material is idempotent. Reusing a still-retained
|
|
38
|
+
* logical ID for different material is ambiguous and is refused.
|
|
39
|
+
*/
|
|
40
|
+
export declare function retainKyberPreKey(state: StoredKyberPreKeyState, candidate: KyberPreKey, identityType: IdentityType, now: number, instanceId: string): boolean;
|
|
41
|
+
/** Record a successful reusable-key use under its exact retained parent. */
|
|
42
|
+
export declare function recordKyberPreKeyUse(state: StoredKyberPreKeyState | null | undefined, identityType: IdentityType, use: KyberPreKeyUse): void;
|
|
43
|
+
export declare function assertKyberPreKeyUse(state: StoredKyberPreKeyState | null | undefined, identityType: IdentityType, use: KyberPreKeyUse): StoredKyberPreKeyInstance;
|
|
44
|
+
export declare function recordKyberPreKeyUseById(state: StoredKyberPreKeyState | null | undefined, identityType: IdentityType, use: UnboundKyberPreKeyUse): void;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=kyber-prekey-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kyber-prekey-lifecycle.d.ts","sourceRoot":"","sources":["../../../local/store/kyber-prekey-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI5D,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,WAAW,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC5B;AAED,iFAAiF;AACjF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;I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AED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,EAChD,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,cAAc,GAClB,IAAI,CAGN;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,EAChD,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,cAAc,GAClB,yBAAyB,CAS3B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,EAChD,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,qBAAqB,GACzB,IAAI,CAIN"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { bytesToBase64 } from '../../internal/crypto/utils.js';
|
|
2
|
+
import { generateRandomBytes } from '../../internal/crypto/random.js';
|
|
3
|
+
export class ReusedBaseKeyError extends Error {
|
|
4
|
+
constructor(kyberPreKeyId, signedPreKeyId) {
|
|
5
|
+
super(`Reused base key detected for Kyber prekey ${kyberPreKeyId} with signed prekey ${signedPreKeyId}`);
|
|
6
|
+
this.name = 'ReusedBaseKeyError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function sameKyberPreKeyInstance(left, right) {
|
|
10
|
+
return (left.keyId === right.keyId &&
|
|
11
|
+
left.publicKey === right.publicKey &&
|
|
12
|
+
left.privateKey === right.privateKey &&
|
|
13
|
+
left.signature === right.signature);
|
|
14
|
+
}
|
|
15
|
+
export function assertUnambiguousKyberPreKeyStore(existing, candidate, identityType) {
|
|
16
|
+
if (existing && !sameKyberPreKeyInstance(existing, candidate)) {
|
|
17
|
+
throw new Error(`Kyber prekey key ID ${candidate.keyId} already identifies different retained material for ${identityType}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function kyberPreKeyUseKey(identityType, use) {
|
|
21
|
+
const baseKey = bytesToBase64(use.baseKeyBytes);
|
|
22
|
+
return `${identityType}:${use.kyberPreKeyId}:${use.signedPreKeyId}:${baseKey}`;
|
|
23
|
+
}
|
|
24
|
+
export function createKyberPreKeyState() {
|
|
25
|
+
return { currentKeyId: null, instances: Object.create(null) };
|
|
26
|
+
}
|
|
27
|
+
export async function createKyberPreKeyInstanceId() {
|
|
28
|
+
return bytesToBase64(await generateRandomBytes(32));
|
|
29
|
+
}
|
|
30
|
+
export function getCurrentKyberPreKey(state) {
|
|
31
|
+
if (!state || state.currentKeyId === null)
|
|
32
|
+
return null;
|
|
33
|
+
return state.instances[String(state.currentKeyId)]?.key ?? null;
|
|
34
|
+
}
|
|
35
|
+
export function getRetainedKyberPreKey(state, keyId) {
|
|
36
|
+
const instance = state?.instances[String(keyId)];
|
|
37
|
+
return instance ? { preKey: instance.key, instanceId: instance.instanceId } : null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Retain a new immutable instance and make it current.
|
|
41
|
+
*
|
|
42
|
+
* A retry with identical material is idempotent. Reusing a still-retained
|
|
43
|
+
* logical ID for different material is ambiguous and is refused.
|
|
44
|
+
*/
|
|
45
|
+
export function retainKyberPreKey(state, candidate, identityType, now, instanceId) {
|
|
46
|
+
const key = String(candidate.keyId);
|
|
47
|
+
const existing = state.instances[key];
|
|
48
|
+
assertUnambiguousKyberPreKeyStore(existing?.key, candidate, identityType);
|
|
49
|
+
if (existing)
|
|
50
|
+
return false;
|
|
51
|
+
if (state.currentKeyId !== null) {
|
|
52
|
+
const current = state.instances[String(state.currentKeyId)];
|
|
53
|
+
if (current && current.replacedAt === null)
|
|
54
|
+
current.replacedAt = now;
|
|
55
|
+
}
|
|
56
|
+
state.instances[key] = {
|
|
57
|
+
instanceId,
|
|
58
|
+
key: { ...candidate },
|
|
59
|
+
replacedAt: null,
|
|
60
|
+
uses: Object.create(null),
|
|
61
|
+
};
|
|
62
|
+
state.currentKeyId = candidate.keyId;
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
/** Record a successful reusable-key use under its exact retained parent. */
|
|
66
|
+
export function recordKyberPreKeyUse(state, identityType, use) {
|
|
67
|
+
const parent = assertKyberPreKeyUse(state, identityType, use);
|
|
68
|
+
parent.uses[kyberPreKeyUseKey(identityType, use)] = true;
|
|
69
|
+
}
|
|
70
|
+
export function assertKyberPreKeyUse(state, identityType, use) {
|
|
71
|
+
const parent = state?.instances[String(use.kyberPreKeyId)];
|
|
72
|
+
if (!parent)
|
|
73
|
+
throw new Error(`Kyber prekey ${use.kyberPreKeyId} is not retained`);
|
|
74
|
+
if (parent.instanceId !== use.kyberPreKeyInstanceId) {
|
|
75
|
+
throw new Error(`Kyber prekey ${use.kyberPreKeyId} instance mismatch`);
|
|
76
|
+
}
|
|
77
|
+
const key = kyberPreKeyUseKey(identityType, use);
|
|
78
|
+
if (parent.uses[key])
|
|
79
|
+
throw new ReusedBaseKeyError(use.kyberPreKeyId, use.signedPreKeyId);
|
|
80
|
+
return parent;
|
|
81
|
+
}
|
|
82
|
+
export function recordKyberPreKeyUseById(state, identityType, use) {
|
|
83
|
+
const parent = state?.instances[String(use.kyberPreKeyId)];
|
|
84
|
+
if (!parent)
|
|
85
|
+
throw new Error(`Kyber prekey ${use.kyberPreKeyId} is not retained`);
|
|
86
|
+
recordKyberPreKeyUse(state, identityType, { ...use, kyberPreKeyInstanceId: parent.instanceId });
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=kyber-prekey-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kyber-prekey-lifecycle.js","sourceRoot":"","sources":["../../../local/store/kyber-prekey-lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AA6BnE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,aAAqB,EAAE,cAAsB;QACvD,KAAK,CACH,6CAA6C,aAAa,uBAAu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AAI,KAAK,CAAC,gBAAgB,GAAG,CAAC,aAAa,kBAAkB,CAAC,CAAC;IAClF,oBAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,GAAG,GAAG,EAAE,qBAAqB,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* WARNING: All data is lost when the adapter is destroyed.
|
|
8
8
|
* DO NOT use in production.
|
|
9
9
|
*/
|
|
10
|
+
import type { ReceivedContent, SenderKeyReceiveCommit } from '../../../types/index.js';
|
|
10
11
|
import type { ISignalProtocolLocalStore, MessageRecord, SkippedSenderMessageKey, SessionTrustCommit } from '../../../types/index.js';
|
|
11
12
|
import { type SessionRecord } from '../../../types/session.js';
|
|
12
13
|
import type { IdentityKeyPair, EcSignedPreKey, EcOneTimePreKey, KyberPreKey, KemOneTimePreKey } from '../../../keys/index.js';
|
|
@@ -17,6 +18,7 @@ import { IdentityKeyChange, TrustDirection } from '../../../types/trust.js';
|
|
|
17
18
|
import type { UserRecord, DeviceRecord } from '../../../types/index.js';
|
|
18
19
|
import type { SenderKeyState } from '../../../internal/protocol/sender-keys/manager.js';
|
|
19
20
|
import { StoreFailureController, type StoreFailureOptions } from './failures.js';
|
|
21
|
+
import { type RetainedKyberPreKey } from '../kyber-prekey-lifecycle.js';
|
|
20
22
|
export interface InMemorySignalProtocolStoreOptions {
|
|
21
23
|
failures?: StoreFailureOptions;
|
|
22
24
|
}
|
|
@@ -45,11 +47,11 @@ export declare class InMemorySignalProtocolStore implements ISignalProtocolLocal
|
|
|
45
47
|
private ecSignedPreKeys;
|
|
46
48
|
/** Map of "identityType:keyId" -> EcOneTimePreKey */
|
|
47
49
|
private ecOneTimePreKeys;
|
|
48
|
-
/**
|
|
50
|
+
/** Retained reusable Kyber key instances, keyed by identity type and logical ID. */
|
|
49
51
|
private kyberPreKeys;
|
|
52
|
+
private currentKyberPreKeyIds;
|
|
50
53
|
/** Map of "identityType:keyId" -> KemOneTimePreKey */
|
|
51
54
|
private kemOneTimePreKeys;
|
|
52
|
-
private kyberUsage;
|
|
53
55
|
private sessionRecords;
|
|
54
56
|
private databaseKey;
|
|
55
57
|
private sesameUserRecords;
|
|
@@ -58,6 +60,10 @@ export declare class InMemorySignalProtocolStore implements ISignalProtocolLocal
|
|
|
58
60
|
private skippedSenderKeys;
|
|
59
61
|
private messageRecords;
|
|
60
62
|
private readonly _metadata;
|
|
63
|
+
private readonly receivedContent;
|
|
64
|
+
getReceivedContent(id: string): Promise<ReceivedContent | null>;
|
|
65
|
+
deleteReceivedContent(id: string): Promise<void>;
|
|
66
|
+
deleteExpiredReceivedContent(before: number): Promise<number>;
|
|
61
67
|
constructor(options?: InMemorySignalProtocolStoreOptions);
|
|
62
68
|
storeIdentityKey(keyPair: IdentityKeyPair, identityType?: IdentityType): Promise<void>;
|
|
63
69
|
getIdentityKey(identityType?: IdentityType): Promise<IdentityKeyPair | null>;
|
|
@@ -79,6 +85,7 @@ export declare class InMemorySignalProtocolStore implements ISignalProtocolLocal
|
|
|
79
85
|
removeEcOneTimePreKey(preKeyId: number, identityType?: IdentityType): Promise<void>;
|
|
80
86
|
storeKyberPreKey(kyberPreKey: KyberPreKey, identityType?: IdentityType): Promise<void>;
|
|
81
87
|
getKyberPreKey(identityType?: IdentityType): Promise<KyberPreKey | null>;
|
|
88
|
+
getKyberPreKeyById(keyId: number, identityType?: IdentityType): Promise<RetainedKyberPreKey | null>;
|
|
82
89
|
markKyberPreKeyUsed(kyberPreKeyId: number, signedPreKeyId: number, baseKeyBytes: Uint8Array, identityType?: IdentityType): Promise<void>;
|
|
83
90
|
storeKemOneTimePreKeys(prekeys: KemOneTimePreKey[], identityType?: IdentityType): Promise<void>;
|
|
84
91
|
getKemOneTimePreKeys(identityType?: IdentityType): Promise<KemOneTimePreKey[]>;
|
|
@@ -119,7 +126,7 @@ export declare class InMemorySignalProtocolStore implements ISignalProtocolLocal
|
|
|
119
126
|
getAllSenderKeysForGroup(groupId: string): Promise<SenderKeyState[]>;
|
|
120
127
|
deleteAllSenderKeysForGroup(groupId: string): Promise<number>;
|
|
121
128
|
private getSenderKeyRecordKey;
|
|
122
|
-
storeSenderKeyRecord(groupId: string, userId: string, deviceId: number, states: SenderKeyState[]): Promise<void>;
|
|
129
|
+
storeSenderKeyRecord(groupId: string, userId: string, deviceId: number, states: SenderKeyState[], receive?: SenderKeyReceiveCommit): Promise<void>;
|
|
123
130
|
getSenderKeyRecord(groupId: string, userId: string, deviceId: number): Promise<SenderKeyState[] | null>;
|
|
124
131
|
private getSkippedKeyId;
|
|
125
132
|
storeSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number, messageKey: SkippedSenderMessageKey): Promise<void>;
|
|
@@ -145,6 +152,7 @@ export declare class InMemorySignalProtocolStore implements ISignalProtocolLocal
|
|
|
145
152
|
getMetadata(key: string): Promise<string | null>;
|
|
146
153
|
setMetadata(key: string, value: string): Promise<void>;
|
|
147
154
|
deleteMetadata(key: string): Promise<void>;
|
|
155
|
+
compareAndSetMetadata(key: string, expected: string | null, value: string | null): Promise<boolean>;
|
|
148
156
|
/**
|
|
149
157
|
* Get the maximum EC signed prekey ID in storage.
|
|
150
158
|
* Used to generate new keyIds that will not collide with existing ones.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../local/store/memory/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,YAAY,E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Rotation as acceptRotation, createUnverifiedContactIdentityRecord, encodeCompositeIdentityV1, UNPINNED_DEVICE_IDENTITY_KEY, evaluateContactIdentityCandidate, verifyContactIdentityRecord, validateContactIdentityRecord, } from '../../../keys/identity.js';
|
|
12
12
|
import { IdentityKeyChange } from '../../../types/trust.js';
|
|
13
13
|
import { generateRandomBytes } from '../../../internal/crypto/random.js';
|
|
14
|
-
import { StoreFailureController
|
|
14
|
+
import { StoreFailureController } from './failures.js';
|
|
15
|
+
import { assertUnambiguousKyberPreKeyStore, assertKyberPreKeyUse, createKyberPreKeyInstanceId, recordKyberPreKeyUse, recordKyberPreKeyUseById, } from '../kyber-prekey-lifecycle.js';
|
|
15
16
|
/**
|
|
16
17
|
* Cross the same ownership boundary as a durable adapter.
|
|
17
18
|
*
|
|
@@ -32,11 +33,11 @@ export class InMemorySignalProtocolStore {
|
|
|
32
33
|
ecSignedPreKeys = new Map();
|
|
33
34
|
/** Map of "identityType:keyId" -> EcOneTimePreKey */
|
|
34
35
|
ecOneTimePreKeys = new Map();
|
|
35
|
-
/**
|
|
36
|
+
/** Retained reusable Kyber key instances, keyed by identity type and logical ID. */
|
|
36
37
|
kyberPreKeys = new Map();
|
|
38
|
+
currentKyberPreKeyIds = new Map();
|
|
37
39
|
/** Map of "identityType:keyId" -> KemOneTimePreKey */
|
|
38
40
|
kemOneTimePreKeys = new Map();
|
|
39
|
-
kyberUsage = new Map();
|
|
40
41
|
sessionRecords = new Map();
|
|
41
42
|
databaseKey = null;
|
|
42
43
|
// SESAME multi-device session management
|
|
@@ -54,6 +55,26 @@ export class InMemorySignalProtocolStore {
|
|
|
54
55
|
messageRecords = new Map();
|
|
55
56
|
// Metadata storage
|
|
56
57
|
_metadata = new Map();
|
|
58
|
+
receivedContent = new Map();
|
|
59
|
+
async getReceivedContent(id) {
|
|
60
|
+
const value = this.receivedContent.get(id);
|
|
61
|
+
return value ? cloneStored(value) : null;
|
|
62
|
+
}
|
|
63
|
+
async deleteReceivedContent(id) {
|
|
64
|
+
this.failures.beforeWrite('deleteReceivedContent');
|
|
65
|
+
this.receivedContent.delete(id);
|
|
66
|
+
}
|
|
67
|
+
async deleteExpiredReceivedContent(before) {
|
|
68
|
+
this.failures.beforeWrite('deleteExpiredReceivedContent');
|
|
69
|
+
let count = 0;
|
|
70
|
+
for (const [id, value] of this.receivedContent) {
|
|
71
|
+
if (value.receivedAt < before) {
|
|
72
|
+
this.receivedContent.delete(id);
|
|
73
|
+
count++;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return count;
|
|
77
|
+
}
|
|
57
78
|
constructor(options = {}) {
|
|
58
79
|
this.failures = new StoreFailureController(options.failures);
|
|
59
80
|
}
|
|
@@ -142,8 +163,8 @@ export class InMemorySignalProtocolStore {
|
|
|
142
163
|
}
|
|
143
164
|
async isTrustedIdentity(address, identity, _direction, identityType) {
|
|
144
165
|
const saved = this.contactIdentities.get(this.getContactIdentityKey(address, identityType));
|
|
145
|
-
return evaluateContactIdentityCandidate(saved ?? null, identity) !== 'CHANGED' &&
|
|
146
|
-
evaluateContactIdentityCandidate(saved ?? null, identity) !== 'ROLLBACK';
|
|
166
|
+
return (evaluateContactIdentityCandidate(saved ?? null, identity) !== 'CHANGED' &&
|
|
167
|
+
evaluateContactIdentityCandidate(saved ?? null, identity) !== 'ROLLBACK');
|
|
147
168
|
}
|
|
148
169
|
// ============================================================================
|
|
149
170
|
// PreKey Management
|
|
@@ -218,17 +239,47 @@ export class InMemorySignalProtocolStore {
|
|
|
218
239
|
async storeKyberPreKey(kyberPreKey, identityType) {
|
|
219
240
|
this.failures.beforeWrite('storeKyberPreKey');
|
|
220
241
|
const it = identityType ?? 'aci';
|
|
221
|
-
|
|
242
|
+
const storageKey = `${it}:${kyberPreKey.keyId}`;
|
|
243
|
+
const instanceId = await createKyberPreKeyInstanceId();
|
|
244
|
+
const existing = this.kyberPreKeys.get(storageKey);
|
|
245
|
+
assertUnambiguousKyberPreKeyStore(existing?.key, kyberPreKey, it);
|
|
246
|
+
if (existing)
|
|
247
|
+
return;
|
|
248
|
+
const now = Date.now();
|
|
249
|
+
const currentId = this.currentKyberPreKeyIds.get(it);
|
|
250
|
+
if (currentId !== undefined) {
|
|
251
|
+
const current = this.kyberPreKeys.get(`${it}:${currentId}`);
|
|
252
|
+
if (current && current.replacedAt === null)
|
|
253
|
+
current.replacedAt = now;
|
|
254
|
+
}
|
|
255
|
+
this.kyberPreKeys.set(storageKey, {
|
|
256
|
+
instanceId,
|
|
257
|
+
key: cloneStored(kyberPreKey),
|
|
258
|
+
replacedAt: null,
|
|
259
|
+
uses: Object.create(null),
|
|
260
|
+
});
|
|
261
|
+
this.currentKyberPreKeyIds.set(it, kyberPreKey.keyId);
|
|
222
262
|
}
|
|
223
263
|
async getKyberPreKey(identityType) {
|
|
224
264
|
const it = identityType ?? 'aci';
|
|
225
|
-
const
|
|
265
|
+
const currentId = this.currentKyberPreKeyIds.get(it);
|
|
266
|
+
if (currentId === undefined)
|
|
267
|
+
return null;
|
|
268
|
+
const preKey = this.kyberPreKeys.get(`${it}:${currentId}`)?.key;
|
|
226
269
|
return preKey ? cloneStored(preKey) : null;
|
|
227
270
|
}
|
|
271
|
+
async getKyberPreKeyById(keyId, identityType) {
|
|
272
|
+
const it = identityType ?? 'aci';
|
|
273
|
+
const instance = this.kyberPreKeys.get(`${it}:${keyId}`);
|
|
274
|
+
return instance ? { preKey: cloneStored(instance.key), instanceId: instance.instanceId } : null;
|
|
275
|
+
}
|
|
228
276
|
async markKyberPreKeyUsed(kyberPreKeyId, signedPreKeyId, baseKeyBytes, identityType) {
|
|
229
277
|
this.failures.beforeWrite('markKyberPreKeyUsed');
|
|
230
278
|
const it = identityType ?? 'aci';
|
|
231
|
-
this.
|
|
279
|
+
const instance = this.kyberPreKeys.get(`${it}:${kyberPreKeyId}`);
|
|
280
|
+
recordKyberPreKeyUseById(instance
|
|
281
|
+
? { currentKeyId: kyberPreKeyId, instances: { [String(kyberPreKeyId)]: instance } }
|
|
282
|
+
: null, it, { kyberPreKeyId, signedPreKeyId, baseKeyBytes });
|
|
232
283
|
}
|
|
233
284
|
// ============================================================================
|
|
234
285
|
// KEM One-Time PreKey Management (Per-Session Post-Quantum Forward Secrecy)
|
|
@@ -309,6 +360,18 @@ export class InMemorySignalProtocolStore {
|
|
|
309
360
|
if (kemKey && !this.kemOneTimePreKeys.has(kemKey)) {
|
|
310
361
|
throw new Error('Atomic session/trust commit cannot consume a missing KEM one-time prekey');
|
|
311
362
|
}
|
|
363
|
+
const kyberInstance = commit.kyberPreKeyUse
|
|
364
|
+
? this.kyberPreKeys.get(`${commit.localIdentityType}:${commit.kyberPreKeyUse.kyberPreKeyId}`)
|
|
365
|
+
: undefined;
|
|
366
|
+
const kyberState = kyberInstance
|
|
367
|
+
? {
|
|
368
|
+
currentKeyId: commit.kyberPreKeyUse.kyberPreKeyId,
|
|
369
|
+
instances: { [String(commit.kyberPreKeyUse.kyberPreKeyId)]: kyberInstance },
|
|
370
|
+
}
|
|
371
|
+
: null;
|
|
372
|
+
if (commit.kyberPreKeyUse) {
|
|
373
|
+
assertKyberPreKeyUse(kyberState, commit.localIdentityType, commit.kyberPreKeyUse);
|
|
374
|
+
}
|
|
312
375
|
// Map mutations cannot fail after validation. This is one synchronous commit point.
|
|
313
376
|
if (newContact)
|
|
314
377
|
this.contactIdentities.set(contactKey, cloneStored(newContact));
|
|
@@ -317,6 +380,11 @@ export class InMemorySignalProtocolStore {
|
|
|
317
380
|
this.ecOneTimePreKeys.delete(ecKey);
|
|
318
381
|
if (kemKey)
|
|
319
382
|
this.kemOneTimePreKeys.delete(kemKey);
|
|
383
|
+
if (commit.kyberPreKeyUse) {
|
|
384
|
+
recordKyberPreKeyUse(kyberState, commit.localIdentityType, commit.kyberPreKeyUse);
|
|
385
|
+
}
|
|
386
|
+
if (commit.receivedContent)
|
|
387
|
+
this.receivedContent.set(commit.receivedContent.id, cloneStored(commit.receivedContent));
|
|
320
388
|
}
|
|
321
389
|
/**
|
|
322
390
|
* Get session record
|
|
@@ -466,12 +534,7 @@ export class InMemorySignalProtocolStore {
|
|
|
466
534
|
// Also keep sesameUserRecords in sync for getUserRecord()
|
|
467
535
|
let userRecord = this.sesameUserRecords.get(userId);
|
|
468
536
|
if (!userRecord) {
|
|
469
|
-
userRecord = {
|
|
470
|
-
userId,
|
|
471
|
-
devices: new Map(),
|
|
472
|
-
createdAt: Date.now(),
|
|
473
|
-
updatedAt: Date.now(),
|
|
474
|
-
};
|
|
537
|
+
userRecord = { userId, devices: new Map(), createdAt: Date.now(), updatedAt: Date.now() };
|
|
475
538
|
this.sesameUserRecords.set(userId, userRecord);
|
|
476
539
|
}
|
|
477
540
|
userRecord.devices.set(deviceId, storedRecord);
|
|
@@ -686,7 +749,7 @@ export class InMemorySignalProtocolStore {
|
|
|
686
749
|
getSenderKeyRecordKey(groupId, userId, deviceId) {
|
|
687
750
|
return `${groupId}:${userId}:${deviceId}`;
|
|
688
751
|
}
|
|
689
|
-
async storeSenderKeyRecord(groupId, userId, deviceId, states) {
|
|
752
|
+
async storeSenderKeyRecord(groupId, userId, deviceId, states, receive) {
|
|
690
753
|
this.failures.beforeWrite('storeSenderKeyRecord');
|
|
691
754
|
if (states.length === 0)
|
|
692
755
|
return;
|
|
@@ -702,6 +765,12 @@ export class InMemorySignalProtocolStore {
|
|
|
702
765
|
// Store the full record
|
|
703
766
|
const key = this.getSenderKeyRecordKey(groupId, userId, deviceId);
|
|
704
767
|
this.senderKeyRecords.set(key, cloneStored(states));
|
|
768
|
+
if (receive) {
|
|
769
|
+
this.receivedContent.set(receive.content.id, cloneStored(receive.content));
|
|
770
|
+
if (receive.consumedChainIndex !== undefined) {
|
|
771
|
+
this.skippedSenderKeys.delete(this.getSkippedKeyId(groupId, userId, deviceId, receive.consumedChainIndex));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
705
774
|
}
|
|
706
775
|
async getSenderKeyRecord(groupId, userId, deviceId) {
|
|
707
776
|
const key = this.getSenderKeyRecordKey(groupId, userId, deviceId);
|
|
@@ -835,8 +904,8 @@ export class InMemorySignalProtocolStore {
|
|
|
835
904
|
this.ecSignedPreKeys.clear();
|
|
836
905
|
this.ecOneTimePreKeys.clear();
|
|
837
906
|
this.kyberPreKeys.clear();
|
|
907
|
+
this.currentKyberPreKeyIds.clear();
|
|
838
908
|
this.kemOneTimePreKeys.clear();
|
|
839
|
-
this.kyberUsage.clear();
|
|
840
909
|
this.sessionRecords.clear();
|
|
841
910
|
this.databaseKey = null;
|
|
842
911
|
this.sesameUserRecords.clear();
|
|
@@ -845,6 +914,7 @@ export class InMemorySignalProtocolStore {
|
|
|
845
914
|
this.skippedSenderKeys.clear();
|
|
846
915
|
this.messageRecords.clear();
|
|
847
916
|
this._metadata.clear();
|
|
917
|
+
this.receivedContent.clear();
|
|
848
918
|
}
|
|
849
919
|
// ============================================================================
|
|
850
920
|
// Metadata storage
|
|
@@ -860,6 +930,16 @@ export class InMemorySignalProtocolStore {
|
|
|
860
930
|
this.failures.beforeWrite('deleteMetadata');
|
|
861
931
|
this._metadata.delete(key);
|
|
862
932
|
}
|
|
933
|
+
async compareAndSetMetadata(key, expected, value) {
|
|
934
|
+
if ((this._metadata.get(key) ?? null) !== expected)
|
|
935
|
+
return false;
|
|
936
|
+
this.failures.beforeWrite('compareAndSetMetadata');
|
|
937
|
+
if (value === null)
|
|
938
|
+
this._metadata.delete(key);
|
|
939
|
+
else
|
|
940
|
+
this._metadata.set(key, value);
|
|
941
|
+
return true;
|
|
942
|
+
}
|
|
863
943
|
// ============================================================================
|
|
864
944
|
// Key Recovery Methods (Bug #7 - Identifier Collision Recovery)
|
|
865
945
|
// ============================================================================
|
|
@@ -890,11 +970,16 @@ export class InMemorySignalProtocolStore {
|
|
|
890
970
|
*/
|
|
891
971
|
async getKyberPreKeyMaxId(identityType) {
|
|
892
972
|
const it = identityType ?? 'aci';
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
973
|
+
const prefix = `${it}:`;
|
|
974
|
+
let maxId = 0;
|
|
975
|
+
for (const key of this.kyberPreKeys.keys()) {
|
|
976
|
+
if (key.startsWith(prefix)) {
|
|
977
|
+
const id = Number(key.slice(prefix.length));
|
|
978
|
+
if (id > maxId)
|
|
979
|
+
maxId = id;
|
|
980
|
+
}
|
|
896
981
|
}
|
|
897
|
-
return
|
|
982
|
+
return maxId;
|
|
898
983
|
}
|
|
899
984
|
/**
|
|
900
985
|
* Delete all prekeys from storage (preserves identity keys and sessions).
|
|
@@ -920,8 +1005,14 @@ export class InMemorySignalProtocolStore {
|
|
|
920
1005
|
ecOneTimePreKeysCount++;
|
|
921
1006
|
}
|
|
922
1007
|
}
|
|
923
|
-
|
|
924
|
-
this.kyberPreKeys.
|
|
1008
|
+
let kyberPreKeysCount = 0;
|
|
1009
|
+
for (const key of this.kyberPreKeys.keys()) {
|
|
1010
|
+
if (key.startsWith(prefix)) {
|
|
1011
|
+
this.kyberPreKeys.delete(key);
|
|
1012
|
+
kyberPreKeysCount++;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
this.currentKyberPreKeyIds.delete(it);
|
|
925
1016
|
let kemOneTimePreKeysCount = 0;
|
|
926
1017
|
for (const key of this.kemOneTimePreKeys.keys()) {
|
|
927
1018
|
if (key.startsWith(prefix)) {
|
|
@@ -929,12 +1020,6 @@ export class InMemorySignalProtocolStore {
|
|
|
929
1020
|
kemOneTimePreKeysCount++;
|
|
930
1021
|
}
|
|
931
1022
|
}
|
|
932
|
-
// Clean up kyber usage entries for this identity type
|
|
933
|
-
for (const key of this.kyberUsage.keys()) {
|
|
934
|
-
if (key.startsWith(prefix)) {
|
|
935
|
-
this.kyberUsage.delete(key);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
1023
|
return {
|
|
939
1024
|
ecSignedPreKeys: ecSignedPreKeysCount,
|
|
940
1025
|
ecOneTimePreKeys: ecOneTimePreKeysCount,
|