@open-e2ee/signal-protocol-sdk 7.1.0 → 8.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 +55 -6
- package/ARCHITECTURE.md +1 -0
- package/CHANGELOG.md +565 -0
- package/README.md +19 -5
- package/SECURITY.md +2 -2
- package/THIRD_PARTY_NOTICES.md +429 -0
- package/TROUBLESHOOTING.md +10 -0
- package/client/README.md +1 -2
- package/device/README.md +50 -19
- package/dist/client/client.d.ts +31 -5
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +149 -90
- package/dist/client/client.js.map +1 -1
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +2 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/files.d.ts.map +1 -1
- package/dist/client/files.js +19 -2
- package/dist/client/files.js.map +1 -1
- package/dist/client/headless.d.ts +1 -1
- package/dist/client/headless.js +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
- package/dist/client/hosted-anonymous-delivery.js +2 -1
- package/dist/client/hosted-anonymous-delivery.js.map +1 -1
- 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 +8 -12
- package/dist/client/hosted-connection.js.map +1 -1
- package/dist/client/hosted-group-authority.d.ts.map +1 -1
- package/dist/client/hosted-group-authority.js +2 -1
- package/dist/client/hosted-group-authority.js.map +1 -1
- package/dist/client/hosted-groups.d.ts.map +1 -1
- package/dist/client/hosted-groups.js +2 -1
- package/dist/client/hosted-groups.js.map +1 -1
- package/dist/client/hosted-push.d.ts.map +1 -1
- package/dist/client/hosted-push.js +2 -1
- package/dist/client/hosted-push.js.map +1 -1
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +10 -11
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted-trust.d.ts +11 -11
- package/dist/client/hosted-trust.d.ts.map +1 -1
- package/dist/client/hosted-trust.js +12 -12
- package/dist/client/hosted-trust.js.map +1 -1
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +6 -1
- package/dist/client/messages.js.map +1 -1
- package/dist/client/multi-device.d.ts.map +1 -1
- package/dist/client/multi-device.js +2 -1
- package/dist/client/multi-device.js.map +1 -1
- package/dist/client/relay-lifecycle.d.ts +6 -2
- package/dist/client/relay-lifecycle.d.ts.map +1 -1
- package/dist/client/relay-lifecycle.js.map +1 -1
- package/dist/client/relay-work.d.ts +30 -0
- package/dist/client/relay-work.d.ts.map +1 -0
- package/dist/client/relay-work.js +189 -0
- package/dist/client/relay-work.js.map +1 -0
- package/dist/client/retry.d.ts.map +1 -1
- package/dist/client/retry.js +2 -0
- package/dist/client/retry.js.map +1 -1
- package/dist/client/sessions.d.ts.map +1 -1
- package/dist/client/sessions.js +3 -0
- package/dist/client/sessions.js.map +1 -1
- package/dist/client/signal-service-cipher.d.ts +39 -16
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +100 -60
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/state.d.ts +8 -0
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/state.js +11 -0
- package/dist/client/state.js.map +1 -1
- package/dist/client/types.d.ts +5 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/device/connection.d.ts +1 -1
- package/dist/device/connection.d.ts.map +1 -1
- package/dist/device/connection.js +4 -11
- package/dist/device/connection.js.map +1 -1
- package/dist/device/device-id.d.ts +10 -4
- package/dist/device/device-id.d.ts.map +1 -1
- package/dist/device/device-id.js +15 -9
- package/dist/device/device-id.js.map +1 -1
- package/dist/device/device-name-crypto.d.ts.map +1 -1
- package/dist/device/device-name-crypto.js +2 -2
- package/dist/device/device-name-crypto.js.map +1 -1
- package/dist/device/expo/index.d.ts +25 -8
- package/dist/device/expo/index.d.ts.map +1 -1
- package/dist/device/expo/index.js +58 -8
- package/dist/device/expo/index.js.map +1 -1
- package/dist/device/index.d.ts +2 -2
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +3 -2
- package/dist/device/index.js.map +1 -1
- package/dist/device/lifecycle/index.d.ts +4 -2
- package/dist/device/lifecycle/index.d.ts.map +1 -1
- package/dist/device/lifecycle/index.js.map +1 -1
- package/dist/device/lifecycle/manager.d.ts +12 -14
- package/dist/device/lifecycle/manager.d.ts.map +1 -1
- package/dist/device/lifecycle/manager.js +52 -97
- package/dist/device/lifecycle/manager.js.map +1 -1
- package/dist/device/lifecycle/types.d.ts +26 -16
- package/dist/device/lifecycle/types.d.ts.map +1 -1
- package/dist/device/lifecycle/utils.d.ts +8 -4
- package/dist/device/lifecycle/utils.d.ts.map +1 -1
- package/dist/device/lifecycle/utils.js +12 -16
- package/dist/device/lifecycle/utils.js.map +1 -1
- package/dist/device/provisioning.d.ts.map +1 -1
- package/dist/device/provisioning.js +6 -8
- package/dist/device/provisioning.js.map +1 -1
- package/dist/device/react-native/index.d.ts +40 -0
- package/dist/device/react-native/index.d.ts.map +1 -0
- package/dist/device/react-native/index.js +74 -0
- package/dist/device/react-native/index.js.map +1 -0
- package/dist/device/transfer.d.ts +15 -7
- package/dist/device/transfer.d.ts.map +1 -1
- package/dist/device/transfer.js +30 -22
- package/dist/device/transfer.js.map +1 -1
- package/dist/device/types.d.ts +15 -7
- package/dist/device/types.d.ts.map +1 -1
- package/dist/device/types.js.map +1 -1
- package/dist/device/vault-text.d.ts +13 -0
- package/dist/device/vault-text.d.ts.map +1 -0
- package/dist/device/vault-text.js +17 -0
- package/dist/device/vault-text.js.map +1 -0
- package/dist/hooks/use-key-rotation.d.ts.map +1 -1
- package/dist/hooks/use-key-rotation.js +2 -1
- package/dist/hooks/use-key-rotation.js.map +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/crypto/index.d.ts +3 -3
- package/dist/internal/crypto/index.d.ts.map +1 -1
- package/dist/internal/crypto/index.js +3 -3
- package/dist/internal/crypto/index.js.map +1 -1
- package/dist/internal/crypto/random-host.d.ts +1 -1
- package/dist/internal/crypto/random-host.d.ts.map +1 -1
- package/dist/internal/crypto/random-host.js +3 -2
- package/dist/internal/crypto/random-host.js.map +1 -1
- package/dist/internal/crypto/random-host.native.d.ts +6 -1
- package/dist/internal/crypto/random-host.native.d.ts.map +1 -1
- package/dist/internal/crypto/random-host.native.js +14 -10
- package/dist/internal/crypto/random-host.native.js.map +1 -1
- package/dist/internal/crypto/random-host.node.d.ts +1 -1
- package/dist/internal/crypto/random-host.node.d.ts.map +1 -1
- package/dist/internal/crypto/random-host.node.js +1 -1
- package/dist/internal/crypto/random-host.node.js.map +1 -1
- package/dist/internal/crypto/random.d.ts +12 -3
- package/dist/internal/crypto/random.d.ts.map +1 -1
- package/dist/internal/crypto/random.js +14 -3
- package/dist/internal/crypto/random.js.map +1 -1
- package/dist/internal/crypto/utils.d.ts.map +1 -1
- package/dist/internal/crypto/utils.js +10 -6
- package/dist/internal/crypto/utils.js.map +1 -1
- package/dist/internal/encoding/proto/primitives.d.ts +2 -0
- package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
- package/dist/internal/encoding/proto/primitives.js +2 -1
- package/dist/internal/encoding/proto/primitives.js.map +1 -1
- package/dist/internal/encoding/proto/signal-message.d.ts +1 -0
- package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
- package/dist/internal/encoding/proto/signal-message.js +2 -1
- package/dist/internal/encoding/proto/signal-message.js.map +1 -1
- package/dist/internal/groups/authority-certificate.d.ts.map +1 -1
- package/dist/internal/groups/authority-certificate.js +2 -1
- package/dist/internal/groups/authority-certificate.js.map +1 -1
- package/dist/internal/groups/encrypted-state.d.ts.map +1 -1
- package/dist/internal/groups/encrypted-state.js +9 -7
- package/dist/internal/groups/encrypted-state.js.map +1 -1
- package/dist/internal/groups/invite-link.d.ts.map +1 -1
- package/dist/internal/groups/invite-link.js +2 -1
- package/dist/internal/groups/invite-link.js.map +1 -1
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +5 -5
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/sdk-store.d.ts.map +1 -1
- package/dist/internal/groups/sdk-store.js +4 -3
- package/dist/internal/groups/sdk-store.js.map +1 -1
- package/dist/internal/groups/server-engine.d.ts +6 -1
- package/dist/internal/groups/server-engine.d.ts.map +1 -1
- package/dist/internal/groups/server-engine.js +11 -15
- 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 +2 -1
- package/dist/internal/groups/wire.js.map +1 -1
- package/dist/internal/platform/blob.d.ts +10 -0
- package/dist/internal/platform/blob.d.ts.map +1 -0
- package/dist/internal/platform/blob.js +30 -0
- package/dist/internal/platform/blob.js.map +1 -0
- package/dist/internal/platform/env.d.ts +13 -0
- package/dist/internal/platform/env.d.ts.map +1 -0
- package/dist/internal/platform/env.js +17 -0
- package/dist/internal/platform/env.js.map +1 -0
- package/dist/internal/platform/index.d.ts +5 -0
- package/dist/internal/platform/index.d.ts.map +1 -0
- package/dist/internal/platform/index.js +5 -0
- package/dist/internal/platform/index.js.map +1 -0
- package/dist/internal/platform/url.d.ts +72 -0
- package/dist/internal/platform/url.d.ts.map +1 -0
- package/dist/internal/platform/url.js +275 -0
- package/dist/internal/platform/url.js.map +1 -0
- package/dist/internal/platform/utf8.d.ts +28 -0
- package/dist/internal/platform/utf8.d.ts.map +1 -0
- package/dist/internal/platform/utf8.js +167 -0
- package/dist/internal/platform/utf8.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/delivery-token.d.ts +1 -1
- package/dist/internal/protocol/sealed-sender/delivery-token.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/delivery-token.js +5 -10
- package/dist/internal/protocol/sealed-sender/delivery-token.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +2 -4
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +4 -3
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts +4 -4
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js +8 -10
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js.map +1 -1
- package/dist/internal/protocol/username/hash.d.ts.map +1 -1
- package/dist/internal/protocol/username/hash.js +18 -3
- package/dist/internal/protocol/username/hash.js.map +1 -1
- package/dist/internal/protocol/username/link.d.ts.map +1 -1
- package/dist/internal/protocol/username/link.js +2 -1
- package/dist/internal/protocol/username/link.js.map +1 -1
- package/dist/internal/protocol/username/proof.d.ts.map +1 -1
- package/dist/internal/protocol/username/proof.js +2 -1
- package/dist/internal/protocol/username/proof.js.map +1 -1
- package/dist/internal/sesame/device-registry.d.ts +22 -6
- package/dist/internal/sesame/device-registry.d.ts.map +1 -1
- package/dist/internal/sesame/device-registry.js +18 -12
- package/dist/internal/sesame/device-registry.js.map +1 -1
- package/dist/internal/sesame/index.d.ts +1 -1
- package/dist/internal/sesame/index.d.ts.map +1 -1
- package/dist/internal/sesame/manager.d.ts.map +1 -1
- package/dist/internal/sesame/manager.js +3 -2
- package/dist/internal/sesame/manager.js.map +1 -1
- package/dist/internal/session/index.d.ts +1 -2
- package/dist/internal/session/index.d.ts.map +1 -1
- package/dist/internal/session/index.js +1 -1
- package/dist/internal/session/index.js.map +1 -1
- package/dist/internal/session/validation.d.ts +0 -80
- package/dist/internal/session/validation.d.ts.map +1 -1
- package/dist/internal/session/validation.js +0 -134
- package/dist/internal/session/validation.js.map +1 -1
- package/dist/local/store/device-record.d.ts +18 -0
- package/dist/local/store/device-record.d.ts.map +1 -0
- package/dist/local/store/device-record.js +34 -0
- package/dist/local/store/device-record.js.map +1 -0
- package/dist/local/store/expo/adapter.d.ts +59 -238
- package/dist/local/store/expo/adapter.d.ts.map +1 -1
- package/dist/local/store/expo/adapter.js +83 -640
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/expo/driver.d.ts +16 -0
- package/dist/local/store/expo/driver.d.ts.map +1 -0
- package/dist/local/store/expo/driver.js +141 -0
- package/dist/local/store/expo/driver.js.map +1 -0
- package/dist/local/store/expo/index.d.ts +3 -12
- package/dist/local/store/expo/index.d.ts.map +1 -1
- package/dist/local/store/expo/index.js +1 -8
- package/dist/local/store/expo/index.js.map +1 -1
- package/dist/local/store/expo/maintenance.d.ts +3 -2
- package/dist/local/store/expo/maintenance.d.ts.map +1 -1
- package/dist/local/store/expo/maintenance.js +5 -34
- package/dist/local/store/expo/maintenance.js.map +1 -1
- package/dist/local/store/index.d.ts +10 -5
- package/dist/local/store/index.d.ts.map +1 -1
- package/dist/local/store/index.js +10 -5
- package/dist/local/store/index.js.map +1 -1
- package/dist/local/store/key-value/adapter.d.ts +326 -0
- package/dist/local/store/key-value/adapter.d.ts.map +1 -0
- package/dist/local/store/key-value/adapter.js +1472 -0
- package/dist/local/store/key-value/adapter.js.map +1 -0
- package/dist/local/store/{react-native → key-value}/backend-conformance.d.ts +7 -8
- package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -0
- package/dist/local/store/{react-native → key-value}/backend-conformance.js +4 -5
- package/dist/local/store/key-value/backend-conformance.js.map +1 -0
- package/dist/local/store/key-value/batch.d.ts +41 -0
- package/dist/local/store/key-value/batch.d.ts.map +1 -0
- package/dist/local/store/key-value/batch.js +77 -0
- package/dist/local/store/key-value/batch.js.map +1 -0
- package/dist/local/store/key-value/device-record.d.ts +23 -0
- package/dist/local/store/key-value/device-record.d.ts.map +1 -0
- package/dist/local/store/key-value/device-record.js +33 -0
- package/dist/local/store/key-value/device-record.js.map +1 -0
- package/dist/local/store/key-value/index.d.ts +24 -0
- package/dist/local/store/key-value/index.d.ts.map +1 -0
- package/dist/local/store/key-value/index.js +8 -0
- package/dist/local/store/key-value/index.js.map +1 -0
- package/dist/local/store/key-value/realm/index.d.ts +83 -0
- package/dist/local/store/key-value/realm/index.d.ts.map +1 -0
- package/dist/local/store/key-value/realm/index.js +102 -0
- package/dist/local/store/key-value/realm/index.js.map +1 -0
- package/dist/local/store/{react-native → key-value}/storage.d.ts +6 -6
- package/dist/local/store/key-value/storage.d.ts.map +1 -0
- package/dist/local/store/key-value/storage.js.map +1 -0
- package/dist/local/store/key-value/transactional-backend.d.ts +50 -0
- package/dist/local/store/key-value/transactional-backend.d.ts.map +1 -0
- package/dist/local/store/key-value/transactional-backend.js +90 -0
- package/dist/local/store/key-value/transactional-backend.js.map +1 -0
- package/dist/local/store/key-value/value-key.d.ts +34 -0
- package/dist/local/store/key-value/value-key.d.ts.map +1 -0
- package/dist/local/store/key-value/value-key.js +83 -0
- package/dist/local/store/key-value/value-key.js.map +1 -0
- package/dist/local/store/memory/adapter.d.ts +8 -0
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +60 -75
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/node/adapter.d.ts +74 -130
- package/dist/local/store/node/adapter.d.ts.map +1 -1
- package/dist/local/store/node/adapter.js +83 -727
- package/dist/local/store/node/adapter.js.map +1 -1
- package/dist/local/store/node/index.d.ts +8 -6
- package/dist/local/store/node/index.d.ts.map +1 -1
- package/dist/local/store/node/index.js +3 -7
- package/dist/local/store/node/index.js.map +1 -1
- package/dist/local/store/node/maintenance.d.ts +5 -0
- package/dist/local/store/node/maintenance.d.ts.map +1 -0
- package/dist/local/store/node/maintenance.js +7 -0
- package/dist/local/store/node/maintenance.js.map +1 -0
- package/dist/local/store/node/owner-lock.d.ts +26 -0
- package/dist/local/store/node/owner-lock.d.ts.map +1 -0
- package/dist/local/store/node/owner-lock.js +88 -0
- package/dist/local/store/node/owner-lock.js.map +1 -0
- package/dist/local/store/react-native/adapter.d.ts +63 -273
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +80 -1405
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/react-native/index.d.ts +7 -19
- package/dist/local/store/react-native/index.d.ts.map +1 -1
- package/dist/local/store/react-native/index.js +2 -7
- package/dist/local/store/react-native/index.js.map +1 -1
- package/dist/local/store/react-native/maintenance.d.ts +5 -0
- package/dist/local/store/react-native/maintenance.d.ts.map +1 -0
- package/dist/local/store/react-native/maintenance.js +7 -0
- package/dist/local/store/react-native/maintenance.js.map +1 -0
- package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.d.ts +38 -0
- package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.d.ts.map +1 -0
- package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.js +196 -0
- package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.js.map +1 -0
- package/dist/local/store/sqlite/database.d.ts +20 -0
- package/dist/local/store/sqlite/database.d.ts.map +1 -0
- package/dist/local/store/sqlite/database.js +41 -0
- package/dist/local/store/sqlite/database.js.map +1 -0
- package/dist/local/store/sqlite/driver.d.ts +138 -0
- package/dist/local/store/sqlite/driver.d.ts.map +1 -0
- package/dist/local/store/sqlite/driver.js +10 -0
- package/dist/local/store/sqlite/driver.js.map +1 -0
- package/dist/local/store/sqlite/encryption.d.ts +61 -0
- package/dist/local/store/sqlite/encryption.d.ts.map +1 -0
- package/dist/local/store/sqlite/encryption.js +98 -0
- package/dist/local/store/sqlite/encryption.js.map +1 -0
- package/dist/local/store/sqlite/errors.d.ts +70 -0
- package/dist/local/store/sqlite/errors.d.ts.map +1 -0
- package/dist/local/store/sqlite/errors.js +101 -0
- package/dist/local/store/sqlite/errors.js.map +1 -0
- package/dist/local/store/sqlite/executor.d.ts +22 -0
- package/dist/local/store/sqlite/executor.d.ts.map +1 -0
- package/dist/local/store/sqlite/executor.js +129 -0
- package/dist/local/store/sqlite/executor.js.map +1 -0
- package/dist/local/store/sqlite/index.d.ts +20 -0
- package/dist/local/store/sqlite/index.d.ts.map +1 -0
- package/dist/local/store/sqlite/index.js +18 -0
- package/dist/local/store/sqlite/index.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/account.d.ts +45 -0
- package/dist/local/store/sqlite/key-storage/account.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/account.js +125 -0
- package/dist/local/store/sqlite/key-storage/account.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/contact-identities.d.ts +19 -0
- package/dist/local/store/sqlite/key-storage/contact-identities.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/contact-identities.js +85 -0
- package/dist/local/store/sqlite/key-storage/contact-identities.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/context.d.ts +19 -0
- package/dist/local/store/sqlite/key-storage/context.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/context.js +18 -0
- package/dist/local/store/sqlite/key-storage/context.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/identity-keys.d.ts +18 -0
- package/dist/local/store/sqlite/key-storage/identity-keys.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/identity-keys.js +88 -0
- package/dist/local/store/sqlite/key-storage/identity-keys.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/index.d.ts +108 -0
- package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/index.js +241 -0
- package/dist/local/store/sqlite/key-storage/index.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/message-records.d.ts +41 -0
- package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/message-records.js +133 -0
- package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/metadata.d.ts +16 -0
- package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/metadata.js +53 -0
- package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/one-time-prekeys.d.ts +36 -0
- package/dist/local/store/sqlite/key-storage/one-time-prekeys.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/one-time-prekeys.js +129 -0
- package/dist/local/store/sqlite/key-storage/one-time-prekeys.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/session-trust.d.ts +10 -0
- package/dist/local/store/sqlite/key-storage/session-trust.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/session-trust.js +88 -0
- package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/sessions.d.ts +50 -0
- package/dist/local/store/sqlite/key-storage/sessions.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/sessions.js +209 -0
- package/dist/local/store/sqlite/key-storage/sessions.js.map +1 -0
- package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts +69 -0
- package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts.map +1 -0
- package/dist/local/store/sqlite/key-storage/signed-prekeys.js +219 -0
- package/dist/local/store/sqlite/key-storage/signed-prekeys.js.map +1 -0
- package/dist/local/store/sqlite/maintenance.d.ts +7 -0
- package/dist/local/store/sqlite/maintenance.d.ts.map +1 -0
- package/dist/local/store/sqlite/maintenance.js +32 -0
- package/dist/local/store/sqlite/maintenance.js.map +1 -0
- package/dist/local/store/sqlite/migrations.d.ts +31 -0
- package/dist/local/store/sqlite/migrations.d.ts.map +1 -0
- package/dist/local/store/sqlite/migrations.js +232 -0
- package/dist/local/store/sqlite/migrations.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/ec-one-time-prekey.d.ts +17 -22
- package/dist/local/store/sqlite/models/ec-one-time-prekey.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/ec-one-time-prekey.js +61 -99
- package/dist/local/store/sqlite/models/ec-one-time-prekey.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/ec-signed-prekey.d.ts +22 -25
- package/dist/local/store/sqlite/models/ec-signed-prekey.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/ec-signed-prekey.js +82 -128
- package/dist/local/store/sqlite/models/ec-signed-prekey.js.map +1 -0
- package/dist/local/store/sqlite/models/identity-key-id.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/identity-key-id.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/index.d.ts +5 -5
- package/dist/local/store/sqlite/models/index.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/index.js +12 -5
- package/dist/local/store/sqlite/models/index.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/kyber-one-time-prekey.d.ts +17 -20
- package/dist/local/store/sqlite/models/kyber-one-time-prekey.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/kyber-one-time-prekey.js +65 -105
- package/dist/local/store/sqlite/models/kyber-one-time-prekey.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/kyber-prekey-used.d.ts +3 -3
- package/dist/local/store/sqlite/models/kyber-prekey-used.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/kyber-prekey-used.js +13 -25
- package/dist/local/store/sqlite/models/kyber-prekey-used.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/kyber-prekey.d.ts +16 -19
- package/dist/local/store/sqlite/models/kyber-prekey.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/kyber-prekey.js +67 -111
- package/dist/local/store/sqlite/models/kyber-prekey.js.map +1 -0
- package/dist/local/store/sqlite/models/local-identity.d.ts +51 -0
- package/dist/local/store/sqlite/models/local-identity.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/local-identity.js +150 -0
- package/dist/local/store/sqlite/models/local-identity.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/message-record.d.ts +15 -44
- package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/message-record.js +43 -109
- package/dist/local/store/sqlite/models/message-record.js.map +1 -0
- package/dist/local/store/sqlite/models/recipient-identity.d.ts +21 -0
- package/dist/local/store/sqlite/models/recipient-identity.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/recipient-identity.js +59 -0
- package/dist/local/store/sqlite/models/recipient-identity.js.map +1 -0
- package/dist/local/store/sqlite/models/replaced-prekeys.d.ts +23 -0
- package/dist/local/store/sqlite/models/replaced-prekeys.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/replaced-prekeys.js +42 -0
- package/dist/local/store/sqlite/models/replaced-prekeys.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/sender-key.d.ts +22 -23
- package/dist/local/store/sqlite/models/sender-key.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/sender-key.js +66 -94
- package/dist/local/store/sqlite/models/sender-key.js.map +1 -0
- package/dist/local/store/sqlite/models/sesame-user-record.d.ts +32 -0
- package/dist/local/store/sqlite/models/sesame-user-record.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/sesame-user-record.js +78 -0
- package/dist/local/store/sqlite/models/sesame-user-record.js.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/session.d.ts +24 -20
- package/dist/local/store/sqlite/models/session.d.ts.map +1 -0
- package/dist/local/store/{expo → sqlite}/models/session.js +54 -72
- package/dist/local/store/sqlite/models/session.js.map +1 -0
- package/dist/local/store/sqlite/models/skipped-sender-key.d.ts +24 -0
- package/dist/local/store/sqlite/models/skipped-sender-key.d.ts.map +1 -0
- package/dist/local/store/sqlite/models/skipped-sender-key.js +62 -0
- package/dist/local/store/sqlite/models/skipped-sender-key.js.map +1 -0
- package/dist/local/store/sqlite/op-sqlite-driver.d.ts +14 -0
- package/dist/local/store/sqlite/op-sqlite-driver.d.ts.map +1 -0
- package/dist/local/store/sqlite/op-sqlite-driver.js +180 -0
- package/dist/local/store/sqlite/op-sqlite-driver.js.map +1 -0
- package/dist/local/store/sqlite/open-store.d.ts +83 -0
- package/dist/local/store/sqlite/open-store.d.ts.map +1 -0
- package/dist/local/store/sqlite/open-store.js +177 -0
- package/dist/local/store/sqlite/open-store.js.map +1 -0
- package/dist/local/store/sqlite/schema.d.ts +102 -0
- package/dist/local/store/sqlite/schema.d.ts.map +1 -0
- package/dist/local/store/sqlite/schema.js +61 -0
- package/dist/local/store/sqlite/schema.js.map +1 -0
- package/dist/local/store/sqlite/store.d.ts +199 -0
- package/dist/local/store/sqlite/store.d.ts.map +1 -0
- package/dist/local/store/sqlite/store.js +494 -0
- package/dist/local/store/sqlite/store.js.map +1 -0
- package/dist/local/store/sqlite/web/driver.d.ts +50 -0
- package/dist/local/store/sqlite/web/driver.d.ts.map +1 -0
- package/dist/local/store/sqlite/web/driver.js +169 -0
- package/dist/local/store/sqlite/web/driver.js.map +1 -0
- package/dist/local/store/sqlite/web/protocol.d.ts +80 -0
- package/dist/local/store/sqlite/web/protocol.d.ts.map +1 -0
- package/dist/local/store/sqlite/web/protocol.js +13 -0
- package/dist/local/store/sqlite/web/protocol.js.map +1 -0
- package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.mjs +14526 -0
- package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.wasm +0 -0
- package/dist/local/store/sqlite/web/worker.d.ts +36 -0
- package/dist/local/store/sqlite/web/worker.d.ts.map +1 -0
- package/dist/local/store/sqlite/web/worker.js +616 -0
- package/dist/local/store/sqlite/web/worker.js.map +1 -0
- package/dist/local/store/web/adapter.d.ts +5 -14
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +119 -106
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/local/store/web/device-record.d.ts +23 -0
- package/dist/local/store/web/device-record.d.ts.map +1 -0
- package/dist/local/store/web/device-record.js +31 -0
- package/dist/local/store/web/device-record.js.map +1 -0
- package/dist/local/store/web-sqlite/adapter.d.ts +98 -0
- package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -0
- package/dist/local/store/web-sqlite/adapter.js +151 -0
- package/dist/local/store/web-sqlite/adapter.js.map +1 -0
- package/dist/local/store/web-sqlite/index.d.ts +14 -0
- package/dist/local/store/web-sqlite/index.d.ts.map +1 -0
- package/dist/local/store/web-sqlite/index.js +3 -0
- package/dist/local/store/web-sqlite/index.js.map +1 -0
- package/dist/local/store/web-sqlite/maintenance.d.ts +5 -0
- package/dist/local/store/web-sqlite/maintenance.d.ts.map +1 -0
- package/dist/local/store/web-sqlite/maintenance.js +7 -0
- package/dist/local/store/web-sqlite/maintenance.js.map +1 -0
- package/dist/local/store/web-sqlite/store-locks.d.ts +33 -0
- package/dist/local/store/web-sqlite/store-locks.d.ts.map +1 -0
- package/dist/local/store/web-sqlite/store-locks.js +60 -0
- package/dist/local/store/web-sqlite/store-locks.js.map +1 -0
- package/dist/local/vault/electron-safe-storage.d.ts +45 -0
- package/dist/local/vault/electron-safe-storage.d.ts.map +1 -0
- package/dist/local/vault/electron-safe-storage.js +212 -0
- package/dist/local/vault/electron-safe-storage.js.map +1 -0
- package/dist/local/vault/index.d.ts +4 -2
- package/dist/local/vault/index.d.ts.map +1 -1
- package/dist/local/vault/indexed-db.d.ts +37 -0
- package/dist/local/vault/indexed-db.d.ts.map +1 -0
- package/dist/local/vault/indexed-db.js +102 -0
- package/dist/local/vault/indexed-db.js.map +1 -0
- package/dist/local/vault/react-native-keychain.d.ts +12 -0
- package/dist/local/vault/react-native-keychain.d.ts.map +1 -0
- package/dist/local/vault/react-native-keychain.js +71 -0
- package/dist/local/vault/react-native-keychain.js.map +1 -0
- package/dist/local/vault/require.d.ts +10 -0
- package/dist/local/vault/require.d.ts.map +1 -0
- package/dist/local/vault/require.js +16 -0
- package/dist/local/vault/require.js.map +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/logger.js.map +1 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +2 -1
- package/dist/media/index.js.map +1 -1
- package/dist/profile/contact-state.d.ts.map +1 -1
- package/dist/profile/contact-state.js +2 -4
- package/dist/profile/contact-state.js.map +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.d.ts.map +1 -1
- package/dist/profile/index.js +0 -2
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/profile-key.d.ts +16 -11
- package/dist/profile/profile-key.d.ts.map +1 -1
- package/dist/profile/profile-key.js +29 -29
- package/dist/profile/profile-key.js.map +1 -1
- package/dist/profile/update-service.d.ts +6 -0
- package/dist/profile/update-service.d.ts.map +1 -1
- package/dist/profile/update-service.js +3 -1
- package/dist/profile/update-service.js.map +1 -1
- package/dist/remote/object-store/validation.d.ts.map +1 -1
- package/dist/remote/object-store/validation.js +2 -1
- package/dist/remote/object-store/validation.js.map +1 -1
- package/dist/remote/relay/memory/adapter.d.ts +2 -3
- package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
- package/dist/remote/relay/memory/adapter.js +22 -30
- package/dist/remote/relay/memory/adapter.js.map +1 -1
- package/dist/remote/relay/memory/failures.d.ts.map +1 -1
- package/dist/remote/relay/memory/failures.js +2 -1
- package/dist/remote/relay/memory/failures.js.map +1 -1
- package/dist/remote/relay/memory/group-server.d.ts +5 -1
- package/dist/remote/relay/memory/group-server.d.ts.map +1 -1
- package/dist/remote/relay/memory/group-server.js +11 -1
- package/dist/remote/relay/memory/group-server.js.map +1 -1
- package/dist/safety/url.d.ts.map +1 -1
- package/dist/safety/url.js +21 -26
- package/dist/safety/url.js.map +1 -1
- package/dist/types/api.d.ts +15 -2
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +97 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +105 -1
- package/dist/types/errors.js.map +1 -1
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js +2 -1
- package/dist/types/session.js.map +1 -1
- package/dist/utils/retry.d.ts +2 -0
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +4 -2
- package/dist/utils/retry.js.map +1 -1
- package/docs/ASSURANCE.md +81 -8
- package/docs/CLIENT_COMPOSITION.md +1 -2
- package/docs/DEVIATIONS.md +27 -3
- package/docs/ERROR_HANDLING.md +6 -0
- package/docs/GETTING_STARTED.md +1 -2
- package/docs/PACKAGE_SURFACE.md +29 -11
- package/docs/RECIPES.md +1 -2
- package/examples/browser/index.html +1 -1
- package/local/store/README.md +117 -34
- package/local/store/expo/README.md +67 -47
- package/local/store/key-value/README.md +278 -0
- package/local/store/node/README.md +206 -45
- package/local/store/react-native/README.md +121 -52
- package/local/store/web/README.md +9 -0
- package/local/store/web-sqlite/README.md +202 -0
- package/local/vault/README.md +115 -2
- package/package.json +61 -42
- package/profile/README.md +9 -11
- package/remote/README.md +1 -2
- package/dist/local/store/expo/database-key.d.ts +0 -142
- package/dist/local/store/expo/database-key.d.ts.map +0 -1
- package/dist/local/store/expo/database-key.js +0 -312
- package/dist/local/store/expo/database-key.js.map +0 -1
- package/dist/local/store/expo/db.d.ts +0 -95
- package/dist/local/store/expo/db.d.ts.map +0 -1
- package/dist/local/store/expo/db.js +0 -147
- package/dist/local/store/expo/db.js.map +0 -1
- package/dist/local/store/expo/key-storage.d.ts +0 -429
- package/dist/local/store/expo/key-storage.d.ts.map +0 -1
- package/dist/local/store/expo/key-storage.js +0 -1361
- package/dist/local/store/expo/key-storage.js.map +0 -1
- package/dist/local/store/expo/models/ec-one-time-prekey.d.ts.map +0 -1
- package/dist/local/store/expo/models/ec-one-time-prekey.js.map +0 -1
- package/dist/local/store/expo/models/ec-signed-prekey.d.ts.map +0 -1
- package/dist/local/store/expo/models/ec-signed-prekey.js.map +0 -1
- package/dist/local/store/expo/models/identity-key-id.d.ts.map +0 -1
- package/dist/local/store/expo/models/identity-key-id.js.map +0 -1
- package/dist/local/store/expo/models/index.d.ts.map +0 -1
- package/dist/local/store/expo/models/index.js.map +0 -1
- package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts.map +0 -1
- package/dist/local/store/expo/models/kyber-one-time-prekey.js.map +0 -1
- package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +0 -1
- package/dist/local/store/expo/models/kyber-prekey-used.js.map +0 -1
- package/dist/local/store/expo/models/kyber-prekey.d.ts.map +0 -1
- package/dist/local/store/expo/models/kyber-prekey.js.map +0 -1
- package/dist/local/store/expo/models/local-identity.d.ts +0 -52
- package/dist/local/store/expo/models/local-identity.d.ts.map +0 -1
- package/dist/local/store/expo/models/local-identity.js +0 -166
- package/dist/local/store/expo/models/local-identity.js.map +0 -1
- package/dist/local/store/expo/models/message-record.d.ts.map +0 -1
- package/dist/local/store/expo/models/message-record.js.map +0 -1
- package/dist/local/store/expo/models/recipient-identity.d.ts +0 -21
- package/dist/local/store/expo/models/recipient-identity.d.ts.map +0 -1
- package/dist/local/store/expo/models/recipient-identity.js +0 -66
- package/dist/local/store/expo/models/recipient-identity.js.map +0 -1
- package/dist/local/store/expo/models/replaced-prekey-utils.d.ts +0 -33
- package/dist/local/store/expo/models/replaced-prekey-utils.d.ts.map +0 -1
- package/dist/local/store/expo/models/replaced-prekey-utils.js +0 -54
- package/dist/local/store/expo/models/replaced-prekey-utils.js.map +0 -1
- package/dist/local/store/expo/models/sender-key.d.ts.map +0 -1
- package/dist/local/store/expo/models/sender-key.js.map +0 -1
- package/dist/local/store/expo/models/session.d.ts.map +0 -1
- package/dist/local/store/expo/models/session.js.map +0 -1
- package/dist/local/store/expo/schema.d.ts +0 -1917
- package/dist/local/store/expo/schema.d.ts.map +0 -1
- package/dist/local/store/expo/schema.js +0 -197
- package/dist/local/store/expo/schema.js.map +0 -1
- package/dist/local/store/node/database-encryption.d.ts +0 -109
- package/dist/local/store/node/database-encryption.d.ts.map +0 -1
- package/dist/local/store/node/database-encryption.js +0 -202
- package/dist/local/store/node/database-encryption.js.map +0 -1
- package/dist/local/store/node/database-file-commit.d.ts +0 -8
- package/dist/local/store/node/database-file-commit.d.ts.map +0 -1
- package/dist/local/store/node/database-file-commit.js +0 -62
- package/dist/local/store/node/database-file-commit.js.map +0 -1
- package/dist/local/store/node/database-key.d.ts +0 -129
- package/dist/local/store/node/database-key.d.ts.map +0 -1
- package/dist/local/store/node/database-key.js +0 -293
- package/dist/local/store/node/database-key.js.map +0 -1
- package/dist/local/store/node/database-lock.d.ts +0 -8
- package/dist/local/store/node/database-lock.d.ts.map +0 -1
- package/dist/local/store/node/database-lock.js +0 -44
- package/dist/local/store/node/database-lock.js.map +0 -1
- package/dist/local/store/node/database.d.ts +0 -226
- package/dist/local/store/node/database.d.ts.map +0 -1
- package/dist/local/store/node/database.js +0 -813
- package/dist/local/store/node/database.js.map +0 -1
- package/dist/local/store/react-native/backend-conformance.d.ts.map +0 -1
- package/dist/local/store/react-native/backend-conformance.js.map +0 -1
- package/dist/local/store/react-native/reference-backend.d.ts +0 -43
- package/dist/local/store/react-native/reference-backend.d.ts.map +0 -1
- package/dist/local/store/react-native/reference-backend.js +0 -178
- package/dist/local/store/react-native/reference-backend.js.map +0 -1
- package/dist/local/store/react-native/storage.d.ts.map +0 -1
- package/dist/local/store/react-native/storage.js.map +0 -1
- package/dist/profile/storage.d.ts +0 -61
- package/dist/profile/storage.d.ts.map +0 -1
- package/dist/profile/storage.js +0 -145
- package/dist/profile/storage.js.map +0 -1
- /package/dist/local/store/{react-native → key-value}/storage.js +0 -0
- /package/dist/local/store/{expo → sqlite}/models/identity-key-id.d.ts +0 -0
- /package/dist/local/store/{expo → sqlite}/models/identity-key-id.js +0 -0
|
@@ -8,39 +8,7 @@
|
|
|
8
8
|
import type { Base64 } from '../../types/utils.js';
|
|
9
9
|
import type { SessionState } from '../../types/index.js';
|
|
10
10
|
import { type Logger } from '../../logger.js';
|
|
11
|
-
/**
|
|
12
|
-
* Decode an identity key while preserving the later MAC-work path.
|
|
13
|
-
*
|
|
14
|
-
* Returns decoded bytes if valid, or random 32-byte dummy if invalid.
|
|
15
|
-
* Invalid keys use a random fixed-size dummy so MAC verification still runs.
|
|
16
|
-
* This is path equalization, not a JavaScript constant-time guarantee.
|
|
17
|
-
*
|
|
18
|
-
* Identity validation happens only after message authentication succeeds.
|
|
19
|
-
*
|
|
20
|
-
* @param key Base64-encoded identity key
|
|
21
|
-
* @returns Decoded 32-byte identity key, or random 32-byte dummy if invalid
|
|
22
|
-
*/
|
|
23
11
|
export {};
|
|
24
|
-
export declare function decodeIdentityKeyOrDummy(key: Base64 | undefined): Uint8Array;
|
|
25
|
-
/**
|
|
26
|
-
* Validate and decode an identity key for MAC computation.
|
|
27
|
-
*
|
|
28
|
-
* Identity keys must be:
|
|
29
|
-
* 1. Present (not undefined or null)
|
|
30
|
-
* 2. Non-empty string
|
|
31
|
-
* 3. Valid base64 encoding
|
|
32
|
-
* 4. Exactly 32 bytes when decoded (256-bit key)
|
|
33
|
-
*
|
|
34
|
-
* NOTE: This throws on invalid keys, creating a timing side-channel.
|
|
35
|
-
* Use only on the SEND path (where we are the sender and timing does not
|
|
36
|
-
* leak secrets). For the RECEIVE path, use decodeIdentityKeyOrDummy().
|
|
37
|
-
*
|
|
38
|
-
* @param key Base64-encoded identity key
|
|
39
|
-
* @param fieldName Name for error messages (e.g., 'localIdentityKey')
|
|
40
|
-
* @returns Decoded 32-byte identity key
|
|
41
|
-
* @throws EncryptionError if key is missing, invalid base64, or wrong length
|
|
42
|
-
*/
|
|
43
|
-
export declare function validateIdentityKey(key: Base64 | undefined, fieldName: string): Uint8Array;
|
|
44
12
|
/**
|
|
45
13
|
* Validate session key ownership to detect corrupted sessions.
|
|
46
14
|
*
|
|
@@ -72,54 +40,6 @@ export declare function validateSessionKeyOwnership(session: SessionState, mySig
|
|
|
72
40
|
* @throws EncryptionError with SESSION_CORRUPTED if state is corrupted
|
|
73
41
|
*/
|
|
74
42
|
export declare function validateSessionStateIntegrity(session: SessionState, logger?: Required<Logger>): void;
|
|
75
|
-
/**
|
|
76
|
-
* Session usability requirements for composable checks.
|
|
77
|
-
*
|
|
78
|
-
* Requirements can be composed according to the caller's context.
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
export interface SessionUsabilityRequirements {
|
|
82
|
-
/** Check session is not stale (per MAX_UNACKNOWLEDGED_SESSION_AGE) */
|
|
83
|
-
checkStaleness?: boolean;
|
|
84
|
-
/** Require PQXDH support (post-quantum prekeys were used) */
|
|
85
|
-
requirePQXDH?: boolean;
|
|
86
|
-
/** Require SPQR/Triple Ratchet support */
|
|
87
|
-
requireSPQR?: boolean;
|
|
88
|
-
/** Maximum allowed session age in milliseconds */
|
|
89
|
-
maxSessionAge?: number;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Default usability requirements (most permissive).
|
|
93
|
-
*/
|
|
94
|
-
export declare const DEFAULT_USABILITY_REQUIREMENTS: SessionUsabilityRequirements;
|
|
95
|
-
/**
|
|
96
|
-
* Strict usability requirements (for high-security contexts).
|
|
97
|
-
*/
|
|
98
|
-
export declare const STRICT_USABILITY_REQUIREMENTS: SessionUsabilityRequirements;
|
|
99
|
-
/**
|
|
100
|
-
* Check if a session meets usability requirements.
|
|
101
|
-
*
|
|
102
|
-
* Supports composable session checks that can be customized by context
|
|
103
|
-
* (for example, stricter checks for
|
|
104
|
-
* high-security operations).
|
|
105
|
-
*
|
|
106
|
-
* @param session Session state to check
|
|
107
|
-
* @param requirements Usability requirements to validate against
|
|
108
|
-
* @returns Object with isUsable boolean and optional reason if not usable
|
|
109
|
-
*/
|
|
110
|
-
export declare function checkSessionUsability(session: SessionState, requirements?: SessionUsabilityRequirements): {
|
|
111
|
-
isUsable: boolean;
|
|
112
|
-
reason?: string;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Assert session meets usability requirements or throw.
|
|
116
|
-
*
|
|
117
|
-
* @param session Session state to check
|
|
118
|
-
* @param requirements Usability requirements to validate against
|
|
119
|
-
* @param operation Description of the operation for error messages
|
|
120
|
-
* @throws EncryptionError if session does not meet requirements
|
|
121
|
-
*/
|
|
122
|
-
export declare function assertSessionUsability(session: SessionState, requirements: SessionUsabilityRequirements, operation: string): void;
|
|
123
43
|
/**
|
|
124
44
|
* Detect if a session is a self-session ("Note to Self").
|
|
125
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../internal/session/validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../internal/session/validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAA+B,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAOxE,OAAO,EAAE,CAAC;AAEV;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,YAAY,EACrB,oBAAoB,EAAE,MAAM,GAAG,SAAS,EACxC,MAAM,GAAE,QAAQ,CAAC,MAAM,CAA+B,GACrD,IAAI,CA4EN;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,YAAY,EACrB,MAAM,GAAE,QAAQ,CAAC,MAAM,CAA+B,GACrD,IAAI,CAuFN;AAMD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAE5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAQ1F"}
|
|
@@ -6,61 +6,8 @@
|
|
|
6
6
|
* @internal This module is INTERNAL. Use SignalProtocolClient for public API.
|
|
7
7
|
*/
|
|
8
8
|
import { EncryptionError, EncryptionErrorCode } from '../../types/errors.js';
|
|
9
|
-
import * as CryptoUtils from '../crypto/index.js';
|
|
10
9
|
import { defaultSignalProtocolLogger } from '../../logger.js';
|
|
11
10
|
import { compositeIdentitiesEqual, createCompositeIdentityV1, encodeCompositeIdentityV1, } from '../../keys/identity.js';
|
|
12
|
-
export function decodeIdentityKeyOrDummy(key) {
|
|
13
|
-
if (!key || key.length === 0) {
|
|
14
|
-
return globalThis.crypto.getRandomValues(new Uint8Array(32));
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
const bytes = CryptoUtils.base64ToBytes(key);
|
|
18
|
-
if (bytes.length !== 32) {
|
|
19
|
-
return globalThis.crypto.getRandomValues(new Uint8Array(32));
|
|
20
|
-
}
|
|
21
|
-
return bytes;
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return globalThis.crypto.getRandomValues(new Uint8Array(32));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Validate and decode an identity key for MAC computation.
|
|
29
|
-
*
|
|
30
|
-
* Identity keys must be:
|
|
31
|
-
* 1. Present (not undefined or null)
|
|
32
|
-
* 2. Non-empty string
|
|
33
|
-
* 3. Valid base64 encoding
|
|
34
|
-
* 4. Exactly 32 bytes when decoded (256-bit key)
|
|
35
|
-
*
|
|
36
|
-
* NOTE: This throws on invalid keys, creating a timing side-channel.
|
|
37
|
-
* Use only on the SEND path (where we are the sender and timing does not
|
|
38
|
-
* leak secrets). For the RECEIVE path, use decodeIdentityKeyOrDummy().
|
|
39
|
-
*
|
|
40
|
-
* @param key Base64-encoded identity key
|
|
41
|
-
* @param fieldName Name for error messages (e.g., 'localIdentityKey')
|
|
42
|
-
* @returns Decoded 32-byte identity key
|
|
43
|
-
* @throws EncryptionError if key is missing, invalid base64, or wrong length
|
|
44
|
-
*/
|
|
45
|
-
export function validateIdentityKey(key, fieldName) {
|
|
46
|
-
// Check for missing or empty key
|
|
47
|
-
if (!key || key.length === 0) {
|
|
48
|
-
throw new EncryptionError(`${fieldName} is missing or empty`, EncryptionErrorCode.ENCRYPTION_FAILED, { field: fieldName });
|
|
49
|
-
}
|
|
50
|
-
// Decode base64 and catch invalid encoding
|
|
51
|
-
let bytes;
|
|
52
|
-
try {
|
|
53
|
-
bytes = CryptoUtils.base64ToBytes(key);
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
throw new EncryptionError(`${fieldName} is not valid base64`, EncryptionErrorCode.ENCRYPTION_FAILED, { field: fieldName });
|
|
57
|
-
}
|
|
58
|
-
// Validate decoded length is exactly 32 bytes (256-bit identity key)
|
|
59
|
-
if (bytes.length !== 32) {
|
|
60
|
-
throw new EncryptionError(`${fieldName} must be 32 bytes, got ${bytes.length}`, EncryptionErrorCode.ENCRYPTION_FAILED, { field: fieldName, actualLength: bytes.length });
|
|
61
|
-
}
|
|
62
|
-
return bytes;
|
|
63
|
-
}
|
|
64
11
|
/**
|
|
65
12
|
* Validate session key ownership to detect corrupted sessions.
|
|
66
13
|
*
|
|
@@ -221,87 +168,6 @@ export function validateSessionStateIntegrity(session, logger = defaultSignalPro
|
|
|
221
168
|
});
|
|
222
169
|
}
|
|
223
170
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Default usability requirements (most permissive).
|
|
226
|
-
*/
|
|
227
|
-
export const DEFAULT_USABILITY_REQUIREMENTS = {
|
|
228
|
-
checkStaleness: false,
|
|
229
|
-
requirePQXDH: false,
|
|
230
|
-
requireSPQR: false,
|
|
231
|
-
};
|
|
232
|
-
/**
|
|
233
|
-
* Strict usability requirements (for high-security contexts).
|
|
234
|
-
*/
|
|
235
|
-
export const STRICT_USABILITY_REQUIREMENTS = {
|
|
236
|
-
checkStaleness: true,
|
|
237
|
-
requirePQXDH: true,
|
|
238
|
-
requireSPQR: true,
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Check if a session meets usability requirements.
|
|
242
|
-
*
|
|
243
|
-
* Supports composable session checks that can be customized by context
|
|
244
|
-
* (for example, stricter checks for
|
|
245
|
-
* high-security operations).
|
|
246
|
-
*
|
|
247
|
-
* @param session Session state to check
|
|
248
|
-
* @param requirements Usability requirements to validate against
|
|
249
|
-
* @returns Object with isUsable boolean and optional reason if not usable
|
|
250
|
-
*/
|
|
251
|
-
export function checkSessionUsability(session, requirements = DEFAULT_USABILITY_REQUIREMENTS) {
|
|
252
|
-
// Check staleness (unacknowledged session timeout)
|
|
253
|
-
if (requirements.checkStaleness && !session.hasReceivedMessage) {
|
|
254
|
-
const age = Date.now() - session.createdAt;
|
|
255
|
-
const maxAge = requirements.maxSessionAge ?? 30 * 24 * 60 * 60 * 1000; // 30 days default
|
|
256
|
-
if (age > maxAge) {
|
|
257
|
-
return {
|
|
258
|
-
isUsable: false,
|
|
259
|
-
reason: `Session is stale (${Math.floor(age / 86400000)} days old, max ${Math.floor(maxAge / 86400000)} days)`,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
// Check PQXDH support
|
|
264
|
-
if (requirements.requirePQXDH) {
|
|
265
|
-
const hasPQXDH = session.usedKyberPreKeyId !== undefined || session.usedKemOneTimePreKeyId !== undefined;
|
|
266
|
-
if (!hasPQXDH) {
|
|
267
|
-
return {
|
|
268
|
-
isUsable: false,
|
|
269
|
-
reason: 'Session does not have PQXDH support (no Kyber prekey used)',
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
// Check SPQR support
|
|
274
|
-
if (requirements.requireSPQR) {
|
|
275
|
-
const hasSPQR = session.tripleRatchet !== undefined;
|
|
276
|
-
if (!hasSPQR) {
|
|
277
|
-
return {
|
|
278
|
-
isUsable: false,
|
|
279
|
-
reason: 'Session does not have SPQR/Triple Ratchet support',
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
return { isUsable: true };
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Assert session meets usability requirements or throw.
|
|
287
|
-
*
|
|
288
|
-
* @param session Session state to check
|
|
289
|
-
* @param requirements Usability requirements to validate against
|
|
290
|
-
* @param operation Description of the operation for error messages
|
|
291
|
-
* @throws EncryptionError if session does not meet requirements
|
|
292
|
-
*/
|
|
293
|
-
export function assertSessionUsability(session, requirements, operation) {
|
|
294
|
-
const result = checkSessionUsability(session, requirements);
|
|
295
|
-
if (!result.isUsable) {
|
|
296
|
-
throw new EncryptionError(`Cannot ${operation}: ${result.reason}`, EncryptionErrorCode.SESSION_NOT_FOUND, {
|
|
297
|
-
reason: result.reason,
|
|
298
|
-
operation,
|
|
299
|
-
checkStaleness: requirements.checkStaleness,
|
|
300
|
-
requirePQXDH: requirements.requirePQXDH,
|
|
301
|
-
requireSPQR: requirements.requireSPQR,
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
171
|
// ============================================================================
|
|
306
172
|
// Self-session detection (Note to Self)
|
|
307
173
|
// ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../internal/session/validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../internal/session/validation.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a store joins a SESAME device record with its session.
|
|
3
|
+
*
|
|
4
|
+
* A store keeps each device's identity pin and lifecycle fields apart from
|
|
5
|
+
* the session that the protocol layer reads and writes under the device
|
|
6
|
+
* address. A read joins the two, so the SESAME layer sees the session that
|
|
7
|
+
* the protocol layer established.
|
|
8
|
+
*/
|
|
9
|
+
import type { DeviceID, DeviceRecord } from '../../types/index.js';
|
|
10
|
+
import type { SessionRecord } from '../../types/session.js';
|
|
11
|
+
/**
|
|
12
|
+
* Join a stored device with the session under its address. The identity pin
|
|
13
|
+
* is a trust decision, so it comes from what was stored, not from the current
|
|
14
|
+
* session. Re-deriving it would unpin a device as soon as its session is
|
|
15
|
+
* archived.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withSession(userId: string, deviceId: DeviceID, stored: DeviceRecord | null, session: SessionRecord | null): DeviceRecord | null;
|
|
18
|
+
//# sourceMappingURL=device-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-record.d.ts","sourceRoot":"","sources":["../../../local/store/device-record.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,OAAO,EAAE,aAAa,GAAG,IAAI,GAC5B,YAAY,GAAG,IAAI,CAgBrB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a store joins a SESAME device record with its session.
|
|
3
|
+
*
|
|
4
|
+
* A store keeps each device's identity pin and lifecycle fields apart from
|
|
5
|
+
* the session that the protocol layer reads and writes under the device
|
|
6
|
+
* address. A read joins the two, so the SESAME layer sees the session that
|
|
7
|
+
* the protocol layer established.
|
|
8
|
+
*/
|
|
9
|
+
import { encodeCompositeIdentityV1, UNPINNED_DEVICE_IDENTITY_KEY } from '../../keys/identity.js';
|
|
10
|
+
/**
|
|
11
|
+
* Join a stored device with the session under its address. The identity pin
|
|
12
|
+
* is a trust decision, so it comes from what was stored, not from the current
|
|
13
|
+
* session. Re-deriving it would unpin a device as soon as its session is
|
|
14
|
+
* archived.
|
|
15
|
+
*/
|
|
16
|
+
export function withSession(userId, deviceId, stored, session) {
|
|
17
|
+
if (!session)
|
|
18
|
+
return stored;
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
return {
|
|
21
|
+
...stored,
|
|
22
|
+
userId,
|
|
23
|
+
deviceId,
|
|
24
|
+
identityKey: stored?.identityKey.length
|
|
25
|
+
? stored.identityKey
|
|
26
|
+
: session.currentSession?.remoteIdentity
|
|
27
|
+
? encodeCompositeIdentityV1(session.currentSession.remoteIdentity)
|
|
28
|
+
: UNPINNED_DEVICE_IDENTITY_KEY,
|
|
29
|
+
session,
|
|
30
|
+
createdAt: session.metadata?.createdAt ?? stored?.createdAt ?? now,
|
|
31
|
+
updatedAt: now,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=device-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-record.js","sourceRoot":"","sources":["../../../local/store/device-record.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAI9F;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,QAAkB,EAClB,MAA2B,EAC3B,OAA6B;IAE7B,IAAI,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,OAAO;QACL,GAAG,MAAM;QACT,MAAM;QACN,QAAQ;QACR,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM;YACrC,CAAC,CAAC,MAAM,CAAC,WAAW;YACpB,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc;gBACtC,CAAC,CAAC,yBAAyB,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC;gBAClE,CAAC,CAAC,4BAA4B;QAClC,OAAO;QACP,SAAS,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,IAAI,MAAM,EAAE,SAAS,IAAI,GAAG;QAClE,SAAS,EAAE,GAAG;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -1,253 +1,74 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Expo Signal Protocol Store
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - an application-configured Expo SQLite/SQLCipher database
|
|
8
|
-
*
|
|
9
|
-
* This class wraps the KeyStorage implementation and provides
|
|
10
|
-
* the SignalProtocolLocalStore interface for dependency injection.
|
|
4
|
+
* The SDK owns the database file. One call opens it in the expo-sqlite default
|
|
5
|
+
* directory, gets or creates its key through the local secret vault, applies
|
|
6
|
+
* the SDK migrations, and returns the store.
|
|
11
7
|
*/
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
import type { SignalProtocolLocalSecretVault } from '../../../types/api.js';
|
|
9
|
+
import type { SqliteOpenOptions } from '../sqlite/encryption.js';
|
|
10
|
+
import type { SqliteRootExecutor } from '../sqlite/executor.js';
|
|
11
|
+
import { SqliteSignalProtocolStore } from '../sqlite/store.js';
|
|
12
|
+
export interface ExpoSignalProtocolStoreOptions extends SqliteOpenOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The database file name in the expo-sqlite default directory. It also
|
|
15
|
+
* names the vault slot of the database key. Letters, digits, `.`, `_`, and
|
|
16
|
+
* `-` only. Default: `open-e2ee-signal-protocol.db`.
|
|
17
|
+
*/
|
|
18
|
+
readonly name?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The vault that holds the database key. Default: an
|
|
21
|
+
* `ExpoSecureStoreSignalProtocolSecretVault`. A store with
|
|
22
|
+
* `encryptionAtRest: false` does not use it.
|
|
23
|
+
*/
|
|
24
|
+
readonly vault?: SignalProtocolLocalSecretVault;
|
|
25
|
+
}
|
|
26
|
+
/** The executor of an open store. Not exported from the entry. */
|
|
27
|
+
export declare function expoStoreDatabase(store: ExpoSignalProtocolStore): SqliteRootExecutor;
|
|
20
28
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Provides secure storage for Signal Protocol keys using Expo's native modules.
|
|
24
|
-
*
|
|
25
|
-
* ## Architecture
|
|
26
|
-
*
|
|
27
|
-
* Two-layer encryption:
|
|
28
|
-
* - **Layer 1 (secret vault)**: Single 32-byte database encryption key
|
|
29
|
-
* - **Layer 2 (SQLCipher)**: Full-database encryption configured by the host
|
|
30
|
-
*
|
|
31
|
-
* ## Security
|
|
32
|
-
*
|
|
33
|
-
* - Key custody follows the configured `SignalProtocolLocalSecretVault`
|
|
34
|
-
* - Protocol records are stored in the encrypted database, not the secret vault
|
|
35
|
-
* - Account reset coordinates logical record and key deletion
|
|
36
|
-
* - TOFU (Trust On First Use) for contact identities
|
|
29
|
+
* Local Signal Protocol state for Expo, in an SDK-owned SQLCipher database.
|
|
37
30
|
*
|
|
38
|
-
* @
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* const store = new ExpoSignalProtocolStore();
|
|
31
|
+
* Open it with {@link expoStore}. The store holds the database file until
|
|
32
|
+
* {@link ExpoSignalProtocolStore.close}. A second open of the same name in
|
|
33
|
+
* the process fails with `INVALID_STATE`.
|
|
42
34
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* // Get identity key
|
|
47
|
-
* const keyPair = await store.getIdentityKey();
|
|
48
|
-
* ```
|
|
35
|
+
* Every table holds material that must not leave the device, including the
|
|
36
|
+
* group sender keys. SQLCipher encrypts the whole file, so the database key
|
|
37
|
+
* in the vault is the only thing that protects it.
|
|
49
38
|
*
|
|
50
39
|
* @category Key Storage
|
|
51
40
|
* @see {@link SignalProtocolLocalStore} for interface documentation
|
|
52
41
|
*/
|
|
53
|
-
export {
|
|
54
|
-
|
|
55
|
-
private storage;
|
|
56
|
-
private logger;
|
|
57
|
-
constructor(providedLogger?: Logger);
|
|
58
|
-
setLogger(providedLogger?: Logger): void;
|
|
59
|
-
storeIdentityKey(keyPair: IdentityKeyPair, identityType?: IdentityType): Promise<void>;
|
|
60
|
-
getIdentityKey(identityType?: IdentityType): Promise<IdentityKeyPair | null>;
|
|
61
|
-
deleteIdentityKey(identityType?: IdentityType): Promise<void>;
|
|
62
|
-
hasIdentityKey(identityType?: IdentityType): Promise<boolean>;
|
|
63
|
-
getLocalRegistrationId(identityType?: IdentityType): Promise<number>;
|
|
64
|
-
setLocalRegistrationId(id: number, identityType?: IdentityType): Promise<void>;
|
|
65
|
-
saveContactIdentity(address: ProtocolAddress, identity: CompositeIdentityV1, identityType?: IdentityType, suppliedCommitment?: Uint8Array): Promise<IdentityKeyChange>;
|
|
66
|
-
getContactIdentity(address: ProtocolAddress, identityType?: IdentityType): Promise<ContactIdentityRecord | null>;
|
|
67
|
-
acceptContactIdentityRotation(address: ProtocolAddress, identity: CompositeIdentityV1, identityType?: IdentityType, suppliedCommitment?: Uint8Array): Promise<ContactIdentityRecord>;
|
|
68
|
-
acceptContactIdentityRotationAndDeleteSessions(address: ProtocolAddress, identity: CompositeIdentityV1, identityType?: IdentityType, suppliedCommitment?: Uint8Array): Promise<ContactIdentityRecord>;
|
|
69
|
-
verifyContactIdentity(address: ProtocolAddress, identity: CompositeIdentityV1, identityType?: IdentityType, suppliedCommitment?: Uint8Array): Promise<ContactIdentityRecord>;
|
|
70
|
-
isTrustedIdentity(address: ProtocolAddress, identity: CompositeIdentityV1, direction: TrustDirection, identityType?: IdentityType): Promise<boolean>;
|
|
71
|
-
storeEcSignedPreKey(signedPreKey: EcSignedPreKey, identityType?: IdentityType): Promise<void>;
|
|
72
|
-
getEcSignedPreKey(keyId?: number, identityType?: IdentityType): Promise<EcSignedPreKey | null>;
|
|
73
|
-
getAllEcSignedPreKeys(identityType?: IdentityType): Promise<EcSignedPreKey[]>;
|
|
74
|
-
removeEcSignedPreKey(keyId: number, identityType?: IdentityType): Promise<void>;
|
|
75
|
-
storeEcOneTimePreKeys(prekeys: EcOneTimePreKey[], identityType?: IdentityType): Promise<void>;
|
|
76
|
-
getEcOneTimePreKeys(identityType?: IdentityType): Promise<EcOneTimePreKey[]>;
|
|
77
|
-
removeEcOneTimePreKey(preKeyId: number, identityType?: IdentityType): Promise<void>;
|
|
78
|
-
storeKyberPreKey(kyberPreKey: KyberPreKey, identityType?: IdentityType): Promise<void>;
|
|
79
|
-
getKyberPreKey(identityType?: IdentityType): Promise<KyberPreKey | null>;
|
|
80
|
-
getKyberPreKeyById(keyId: number, identityType?: IdentityType): Promise<RetainedKyberPreKey | null>;
|
|
81
|
-
markKyberPreKeyUsed(kyberPreKeyId: number, signedPreKeyId: number, baseKeyBytes: Uint8Array, identityType?: IdentityType): Promise<void>;
|
|
82
|
-
storeKemOneTimePreKeys(prekeys: KemOneTimePreKey[], identityType?: IdentityType): Promise<void>;
|
|
83
|
-
getKemOneTimePreKeys(identityType?: IdentityType): Promise<KemOneTimePreKey[]>;
|
|
84
|
-
getKemOneTimePreKey(keyId: number, identityType?: IdentityType): Promise<KemOneTimePreKey | null>;
|
|
85
|
-
removeKemOneTimePreKey(keyId: number, identityType?: IdentityType): Promise<void>;
|
|
86
|
-
getKemOneTimePreKeyCount(identityType?: IdentityType): Promise<number>;
|
|
87
|
-
storeSessionRecord(address: ProtocolAddress, record: SessionRecord): Promise<void>;
|
|
88
|
-
commitSessionTrust(commit: SessionTrustCommit): Promise<void>;
|
|
89
|
-
getSessionRecord(address: ProtocolAddress): Promise<SessionRecord | null>;
|
|
90
|
-
deleteSessionRecord(address: ProtocolAddress): Promise<void>;
|
|
91
|
-
archiveCurrentSession(address: ProtocolAddress, newSession?: SessionState | null): Promise<void>;
|
|
92
|
-
getSessionsForUser(userId: string): Promise<SessionRecord[]>;
|
|
93
|
-
hasSession(address: ProtocolAddress): Promise<boolean>;
|
|
94
|
-
storeSession(sessionId: string, session: SessionState): Promise<void>;
|
|
95
|
-
getSession(sessionId: string): Promise<SessionState | null>;
|
|
96
|
-
deleteSession(sessionId: string): Promise<void>;
|
|
97
|
-
getDatabaseKey(): Promise<Uint8Array>;
|
|
98
|
-
getSessionCount(): Promise<number>;
|
|
99
|
-
clearAllKeys(): Promise<void>;
|
|
100
|
-
getMetadata(key: string): Promise<string | null>;
|
|
101
|
-
setMetadata(key: string, value: string): Promise<void>;
|
|
102
|
-
deleteMetadata(key: string): Promise<void>;
|
|
103
|
-
compareAndSetMetadata(key: string, expected: string | null, value: string | null): Promise<boolean>;
|
|
104
|
-
/**
|
|
105
|
-
* Helper to get a contact's pinned identity as canonical DeviceRecord bytes.
|
|
106
|
-
*
|
|
107
|
-
* Returns the whole composite tuple, not the X25519 half. A device pinned to
|
|
108
|
-
* the DH key alone would accept a peer that swapped its Ed25519 signing key.
|
|
109
|
-
* It would also compare unequal against every other producer of these bytes.
|
|
110
|
-
*/
|
|
111
|
-
private getContactIdentityBytes;
|
|
112
|
-
getUserRecord(userId: string): Promise<UserRecord | null>;
|
|
113
|
-
setUserRecord(_userId: string, _record: UserRecord): Promise<void>;
|
|
114
|
-
getDeviceRecord(userId: string, deviceId: number): Promise<DeviceRecord | null>;
|
|
115
|
-
setDeviceRecord(userId: string, deviceId: number, record: DeviceRecord): Promise<void>;
|
|
116
|
-
deleteDeviceRecord(userId: string, deviceId: number): Promise<void>;
|
|
117
|
-
getDeviceSession(userId: string, deviceId: number): Promise<SessionRecord | null>;
|
|
118
|
-
setDeviceSession(userId: string, deviceId: number, session: SessionRecord): Promise<void>;
|
|
119
|
-
/**
|
|
120
|
-
* Delete stale device records that have no active sessions.
|
|
121
|
-
*
|
|
122
|
-
* A device is considered stale if:
|
|
123
|
-
* 1. It has no active session AND no archived sessions
|
|
124
|
-
* 2. Its age exceeds maxLatency
|
|
125
|
-
*
|
|
126
|
-
* @param maxLatency - Maximum age in milliseconds (default: 30 days)
|
|
127
|
-
* @returns Number of device records deleted
|
|
128
|
-
*/
|
|
129
|
-
deleteStaleRecords(maxLatency: number): Promise<number>;
|
|
130
|
-
/**
|
|
131
|
-
* Delete expired sessions based on age.
|
|
132
|
-
*
|
|
133
|
-
* Sessions are considered expired if their age exceeds maxRecv.
|
|
134
|
-
* Following SESAME spec, default maxRecv is 180 days.
|
|
135
|
-
*
|
|
136
|
-
* @param maxRecv - Maximum session age in milliseconds (default: 180 days)
|
|
137
|
-
* @returns Number of sessions deleted
|
|
138
|
-
*/
|
|
139
|
-
cleanupExpiredSessions(maxRecv: number): Promise<number>;
|
|
140
|
-
/**
|
|
141
|
-
* Get all unique user IDs that have sessions in local storage.
|
|
142
|
-
*
|
|
143
|
-
* Extracts user IDs from session IDs stored in Signal Protocol format (userId:deviceId).
|
|
144
|
-
* Only includes entries where the deviceId portion is a valid non-negative integer.
|
|
145
|
-
*
|
|
146
|
-
* @returns Array of unique user IDs
|
|
147
|
-
*/
|
|
148
|
-
getAllUserIds(): Promise<string[]>;
|
|
149
|
-
/**
|
|
150
|
-
* Get all device IDs for a specific user from local session storage.
|
|
151
|
-
*
|
|
152
|
-
* Queries sessions matching the user ID and extracts unique device IDs.
|
|
153
|
-
* Session IDs follow Signal Protocol format (userId:deviceId).
|
|
154
|
-
*
|
|
155
|
-
* @param userId - User ID to query devices for
|
|
156
|
-
* @returns Array of device IDs (unique, non-negative integers)
|
|
157
|
-
*/
|
|
158
|
-
getSesameDeviceIds(userId: string): Promise<number[]>;
|
|
159
|
-
storeSenderKey(groupId: string, userId: string, deviceId: number, state: SenderKeyState): Promise<void>;
|
|
160
|
-
getSenderKey(groupId: string, userId: string, deviceId: number): Promise<SenderKeyState | null>;
|
|
42
|
+
export declare class ExpoSignalProtocolStore extends SqliteSignalProtocolStore {
|
|
43
|
+
private constructor();
|
|
161
44
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* The whole record is one row, so current and previous states can never be
|
|
166
|
-
* written apart from one another.
|
|
45
|
+
* Wait for the queued work, then close the database. Every later call
|
|
46
|
+
* rejects with `SqliteStoreClosedError`.
|
|
167
47
|
*/
|
|
168
|
-
|
|
169
|
-
getReceivedContent(id: string): Promise<ReceivedContent | null>;
|
|
170
|
-
deleteReceivedContent(id: string): Promise<void>;
|
|
171
|
-
deleteExpiredReceivedContent(before: number): Promise<number>;
|
|
172
|
-
getSenderKeyRecord(groupId: string, userId: string, deviceId: number): Promise<SenderKeyState[] | null>;
|
|
173
|
-
resolveGroupForSenderKeyId(senderKeyId: string, userId: string, deviceId: number): Promise<string | null>;
|
|
174
|
-
deleteSenderKey(groupId: string, userId: string, deviceId: number): Promise<void>;
|
|
175
|
-
getAllSenderKeysForGroup(groupId: string): Promise<SenderKeyState[]>;
|
|
176
|
-
deleteAllSenderKeysForGroup(groupId: string): Promise<number>;
|
|
177
|
-
storeSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number, messageKey: {
|
|
178
|
-
iv: string;
|
|
179
|
-
cipherKey: string;
|
|
180
|
-
}): Promise<void>;
|
|
181
|
-
getSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number): Promise<{
|
|
182
|
-
iv: string;
|
|
183
|
-
cipherKey: string;
|
|
184
|
-
} | null>;
|
|
185
|
-
deleteSkippedSenderKey(groupId: string, senderId: string, senderDeviceId: number, chainIndex: number): Promise<void>;
|
|
186
|
-
countSkippedSenderKeys(groupId: string, senderId: string, senderDeviceId: number): Promise<number>;
|
|
187
|
-
/**
|
|
188
|
-
* Evict the oldest skipped keys for a sender, so a peer cannot grow this
|
|
189
|
-
* table without bound by sending messages that skip ever further ahead.
|
|
190
|
-
*
|
|
191
|
-
* Oldest by chain index, not by insertion time. Index order is the order the
|
|
192
|
-
* sender ratcheted. The lowest index is therefore the key least likely to
|
|
193
|
-
* still have a message in flight behind it.
|
|
194
|
-
*/
|
|
195
|
-
deleteOldestSkippedSenderKeys(groupId: string, senderId: string, senderDeviceId: number, count: number): Promise<number>;
|
|
196
|
-
storeMessageRecord(record: MessageRecord): Promise<void>;
|
|
197
|
-
/**
|
|
198
|
-
* Get a message record by session and timestamp (PRIMARY method).
|
|
199
|
-
* Per Signal Protocol, messages are identified by client timestamp.
|
|
200
|
-
*/
|
|
201
|
-
getMessageRecord(sessionId: string, timestamp: number): Promise<MessageRecord | null>;
|
|
202
|
-
/**
|
|
203
|
-
* Delete a message record by session and timestamp (PRIMARY method).
|
|
204
|
-
* Called when processing delivery receipts to clean up confirmed messages.
|
|
205
|
-
*/
|
|
206
|
-
deleteMessageRecord(sessionId: string, timestamp: number): Promise<void>;
|
|
207
|
-
deleteExpiredMessageRecords(maxAgeMs: number): Promise<number>;
|
|
208
|
-
clearAllMessageRecords(): Promise<number>;
|
|
209
|
-
deleteMessageRecordsForSession(sessionId: string): Promise<number>;
|
|
210
|
-
/**
|
|
211
|
-
* Get the maximum EC signed prekey ID in storage.
|
|
212
|
-
* Used to generate new keyIds that will not collide with existing ones.
|
|
213
|
-
*
|
|
214
|
-
* @returns The highest EC signed prekey ID, or 0 if none exist
|
|
215
|
-
*/
|
|
216
|
-
getEcSignedPreKeyMaxId(identityType?: IdentityType): Promise<number>;
|
|
217
|
-
/**
|
|
218
|
-
* Get the maximum Kyber prekey ID in storage.
|
|
219
|
-
* Used to generate new keyIds that will not collide with existing ones.
|
|
220
|
-
*
|
|
221
|
-
* @returns The highest Kyber prekey ID, or 0 if none exist
|
|
222
|
-
*/
|
|
223
|
-
getKyberPreKeyMaxId(identityType?: IdentityType): Promise<number>;
|
|
224
|
-
/**
|
|
225
|
-
* Delete all prekeys from storage (preserves identity keys and sessions).
|
|
226
|
-
* Used for recovery from identifier collision per PQXDH §4.13.
|
|
227
|
-
*
|
|
228
|
-
* @returns Counts of deleted prekeys by type
|
|
229
|
-
*/
|
|
230
|
-
deleteAllPreKeys(identityType?: IdentityType): Promise<{
|
|
231
|
-
ecSignedPreKeys: number;
|
|
232
|
-
ecOneTimePreKeys: number;
|
|
233
|
-
kyberPreKeys: number;
|
|
234
|
-
kemOneTimePreKeys: number;
|
|
235
|
-
}>;
|
|
236
|
-
/**
|
|
237
|
-
* Clear all sessions from storage.
|
|
238
|
-
* Used during force key reset.
|
|
239
|
-
*/
|
|
240
|
-
clearAllSessions(): Promise<void>;
|
|
241
|
-
/**
|
|
242
|
-
* Get detailed statistics about stored data.
|
|
243
|
-
*/
|
|
244
|
-
getDetailedStats(): Promise<{
|
|
245
|
-
sessions: number;
|
|
246
|
-
ecSignedPreKeys: number;
|
|
247
|
-
ecOneTimePreKeys: number;
|
|
248
|
-
kyberPreKeys: number;
|
|
249
|
-
kemOneTimePreKeys: number;
|
|
250
|
-
users: number;
|
|
251
|
-
}>;
|
|
48
|
+
close(): Promise<void>;
|
|
252
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Open the store. On first use it creates the database key in the vault, then
|
|
52
|
+
* the database file. With `encryptionAtRest: false` it does not use the vault.
|
|
53
|
+
*
|
|
54
|
+
* @throws EncryptionError with `LOCAL_STORE_KEY_LOST` when the database file
|
|
55
|
+
* exists and the vault holds no key for it. Restore the vault entry, or call
|
|
56
|
+
* {@link resetExpoStore}.
|
|
57
|
+
* @throws EncryptionError with `KEY_STORAGE_ERROR` when the vault fails or
|
|
58
|
+
* holds a key of the wrong size, when the key does not open the file, when
|
|
59
|
+
* the file was created with the other `encryptionAtRest` setting, when the
|
|
60
|
+
* binding has no cipher, or when another connection holds the file.
|
|
61
|
+
* @throws EncryptionError with `INVALID_STATE` when the name is not valid,
|
|
62
|
+
* when a store of this process holds the name, or when a newer SDK wrote
|
|
63
|
+
* the file.
|
|
64
|
+
*/
|
|
65
|
+
export declare function expoStore(options?: ExpoSignalProtocolStoreOptions): Promise<ExpoSignalProtocolStore>;
|
|
66
|
+
/**
|
|
67
|
+
* Delete the database file, then create a new key, and return the open, empty
|
|
68
|
+
* store. This is the only way to open a store whose key is lost.
|
|
69
|
+
*
|
|
70
|
+
* @throws EncryptionError with `INVALID_STATE` when the name is not valid, or
|
|
71
|
+
* when a store of this process holds the name. Close that store first.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resetExpoStore(options?: ExpoSignalProtocolStoreOptions): Promise<ExpoSignalProtocolStore>;
|
|
253
74
|
//# sourceMappingURL=adapter.d.ts.map
|