@open-e2ee/signal-protocol-sdk 7.2.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 +54 -7
- package/ARCHITECTURE.md +1 -0
- package/CHANGELOG.md +503 -0
- package/README.md +9 -5
- package/SECURITY.md +2 -2
- package/THIRD_PARTY_NOTICES.md +429 -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-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 +19 -11
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +48 -46
- 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/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/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 +16 -3
- package/dist/internal/sesame/device-registry.d.ts.map +1 -1
- package/dist/internal/sesame/device-registry.js +10 -7
- 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 +6 -6
- package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -0
- package/dist/local/store/{react-native → key-value}/backend-conformance.js +3 -3
- 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 -274
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +80 -1406
- 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 +80 -8
- package/docs/CLIENT_COMPOSITION.md +1 -2
- package/docs/DEVIATIONS.md +1 -1
- 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 -37
- package/local/store/expo/README.md +67 -47
- package/local/store/key-value/README.md +278 -0
- package/local/store/node/README.md +206 -46
- package/local/store/react-native/README.md +120 -61
- 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 +42 -23
- 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
|
@@ -1,66 +1,87 @@
|
|
|
1
1
|
# Expo Store
|
|
2
2
|
|
|
3
|
-
`ExpoSignalProtocolStore` implements `SignalProtocolLocalStore` for Expo and React Native
|
|
4
|
-
an
|
|
5
|
-
|
|
3
|
+
`ExpoSignalProtocolStore` implements `SignalProtocolLocalStore` for Expo and React Native in
|
|
4
|
+
an SDK-owned SQLCipher database. The database key is held through the local
|
|
5
|
+
secret-vault boundary, by default in Expo SecureStore.
|
|
6
6
|
|
|
7
7
|
## Why it exists
|
|
8
8
|
|
|
9
9
|
Signal Protocol state is larger and more transactional than the values
|
|
10
|
-
platform keychains hold. The
|
|
11
|
-
and stores protocol records in
|
|
12
|
-
|
|
13
|
-
schema and transaction lifecycle.
|
|
10
|
+
platform keychains hold. The store keeps a small database key in secure storage
|
|
11
|
+
and stores protocol records in an encrypted SQLite database. The SDK owns that
|
|
12
|
+
database: its file, its key, and its migrations.
|
|
14
13
|
|
|
15
|
-
##
|
|
14
|
+
## Setup
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
makes its first query.
|
|
16
|
+
Install the peers `expo-sqlite` 55.0.17 or later and `expo-secure-store`
|
|
17
|
+
55.0.15 or later. The store keeps its database in `expo-sqlite`, and the
|
|
18
|
+
default vault keeps the database key in `expo-secure-store`. The entry loads
|
|
19
|
+
both, also when the app passes its own vault.
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
```sh
|
|
22
|
+
npx expo install expo-sqlite expo-secure-store
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Enable SQLCipher in the `expo-sqlite` config plugin (`useSQLCipher`). SQLCipher
|
|
26
|
+
requires a development build and is not available in Expo Go.
|
|
27
|
+
|
|
28
|
+
Open the store with one call:
|
|
26
29
|
|
|
27
30
|
<!-- doc-snippet:skip requires-external-context -->
|
|
28
31
|
|
|
29
32
|
```ts
|
|
30
|
-
import {
|
|
31
|
-
import { getDatabaseKeyManager } from '@open-e2ee/signal-protocol-sdk/local/store/expo';
|
|
32
|
-
import * as signalSchema from '@open-e2ee/signal-protocol-sdk/local/store/expo/schema';
|
|
33
|
+
import { expoStore } from '@open-e2ee/signal-protocol-sdk/local/store/expo';
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const sqlCipherPassword = await keyManager.getPassword();
|
|
35
|
+
const storage = await expoStore();
|
|
36
|
+
```
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
On first use, `expoStore` creates a 32-byte database key, writes it to the
|
|
39
|
+
vault, and then creates the database file. Each open applies the SDK migrations
|
|
40
|
+
before it returns the store. A file that a newer SDK wrote does not open
|
|
41
|
+
(`INVALID_STATE`).
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
Options:
|
|
44
|
+
|
|
45
|
+
- `name`: the database file name in the `expo-sqlite` default directory.
|
|
46
|
+
Letters, digits, `.`, `_`, and `-` only. Default:
|
|
47
|
+
`open-e2ee-signal-protocol.db`.
|
|
48
|
+
- `vault`: the `SignalProtocolLocalSecretVault` that holds the database key.
|
|
49
|
+
Default: `ExpoSecureStoreSignalProtocolSecretVault`.
|
|
50
|
+
- `encryptionAtRest`: pass `false` to store the database without encryption,
|
|
51
|
+
for example on the web, where `expo-sqlite` has no SQLCipher. The store then
|
|
52
|
+
does not use the vault, and it logs a warning at each open. A database
|
|
53
|
+
created with one setting does not open with the other. Default: `true`, and
|
|
54
|
+
the open fails when the build has no SQLCipher.
|
|
55
|
+
- `logger`: receives the warning of each open without encryption.
|
|
56
|
+
|
|
57
|
+
A store holds its name until `close()`. In one process, the opens and resets
|
|
58
|
+
of a name run one at a time. An open or a reset of a name that an open store
|
|
59
|
+
holds fails with `INVALID_STATE`, so two parallel first opens write one key
|
|
60
|
+
and the second open fails.
|
|
61
|
+
|
|
62
|
+
Keep application tables in a separate database file. The SDK database holds
|
|
63
|
+
only SDK tables.
|
|
64
|
+
|
|
65
|
+
## Lost key and reset
|
|
66
|
+
|
|
67
|
+
When the database file exists and the vault holds no key for it, `expoStore`
|
|
68
|
+
fails with `LOCAL_STORE_KEY_LOST` and changes nothing. A new key cannot read
|
|
69
|
+
the old file. Restore the vault entry, or call `resetExpoStore()`.
|
|
48
70
|
|
|
49
|
-
`
|
|
50
|
-
|
|
71
|
+
A file created with `encryptionAtRest: false` fails an open without that
|
|
72
|
+
option with `SqliteKeyMismatchError` (`KEY_STORAGE_ERROR`), not
|
|
73
|
+
`LOCAL_STORE_KEY_LOST`. Open it with the setting that created it.
|
|
51
74
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- return the matching raw and Drizzle handles
|
|
75
|
+
`resetExpoStore()` deletes the database file, then writes a new key, then
|
|
76
|
+
returns the open, empty store. It takes the same options as `expoStore`. Close
|
|
77
|
+
the open store of the name first.
|
|
56
78
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
changes.
|
|
79
|
+
`clearAllKeys()` on an open store empties every SDK table and keeps the file
|
|
80
|
+
and its key. `resetExpoStore()` is the full teardown.
|
|
60
81
|
|
|
61
|
-
|
|
82
|
+
## Data protection
|
|
62
83
|
|
|
63
|
-
Every table this store
|
|
84
|
+
Every table in this store holds material that must not leave the device.
|
|
64
85
|
That includes the group `sender_keys` and `skipped_sender_keys` tables. Their
|
|
65
86
|
rows contain the sender chain key, the sender's private signature key, and
|
|
66
87
|
individual message keys. That material is enough to read and to forge a
|
|
@@ -68,7 +89,7 @@ sender's group messages. The store writes those rows unencrypted at the row
|
|
|
68
89
|
level, because SQLCipher encrypts the database file itself. The database key is
|
|
69
90
|
therefore the only thing that protects them.
|
|
70
91
|
|
|
71
|
-
Do not back
|
|
92
|
+
Do not back up the database file to a server or sync it between devices.
|
|
72
93
|
|
|
73
94
|
## Client usage
|
|
74
95
|
|
|
@@ -80,13 +101,12 @@ import { expoStore } from '@open-e2ee/signal-protocol-sdk/local/store/expo';
|
|
|
80
101
|
|
|
81
102
|
const client = await createSignalProtocolClient({
|
|
82
103
|
identity: { userId },
|
|
83
|
-
adapters: { storage: expoStore(), relay },
|
|
104
|
+
adapters: { storage: await expoStore(), relay },
|
|
84
105
|
});
|
|
85
106
|
```
|
|
86
107
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
sentinel, and related secure-storage values as one lifecycle.
|
|
108
|
+
For replaced-prekey maintenance, pass the open store to
|
|
109
|
+
`createPreKeyMaintenanceStore(store)`.
|
|
90
110
|
|
|
91
111
|
See the parent [storage guide](../README.md), [adapter guide](../../../ADAPTERS.md),
|
|
92
112
|
the [Expo SQLite SQLCipher guide](https://docs.expo.dev/versions/latest/sdk/sqlite/#sqlcipher),
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Key-Value Store
|
|
2
|
+
|
|
3
|
+
`KeyValueSignalProtocolStore` implements `SignalProtocolLocalStore` over an
|
|
4
|
+
application-provided persistent key-value backend. It is for applications that
|
|
5
|
+
choose their own storage engine. A bare React Native application that lets the
|
|
6
|
+
SDK own the database uses the [React Native SQLite store](../react-native/README.md).
|
|
7
|
+
|
|
8
|
+
## Why it exists
|
|
9
|
+
|
|
10
|
+
Applications that choose their own storage engine choose different engines. The
|
|
11
|
+
store keeps that choice outside the SDK while requiring the atomic operations
|
|
12
|
+
needed for trust, session, and one-time-prekey transitions. The SDK ships one
|
|
13
|
+
backend, for Realm. For another engine, you give
|
|
14
|
+
`createTransactionalKeyValueBackend` the engine's transaction, and you verify
|
|
15
|
+
the result with the conformance kit.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
The store gets random bytes from the global `crypto.getRandomValues`. Install
|
|
20
|
+
`react-native-get-random-values` 2.x or `react-native-quick-crypto`, and load
|
|
21
|
+
it at app startup before the first SDK call. Without a global source, the SDK
|
|
22
|
+
throws `SecureRandomUnavailableError`. The store needs no `crypto.subtle`
|
|
23
|
+
polyfill. AES-256-GCM uses Web Crypto when `crypto.subtle` exists and the
|
|
24
|
+
bundled Noble implementation otherwise. The [README](../../../README.md#use-your-apps-storage-and-relay)
|
|
25
|
+
lists the supported React Native versions.
|
|
26
|
+
|
|
27
|
+
The store also needs a `SignalProtocolLocalSecretVault` backed by the platform
|
|
28
|
+
keychain or keystore. On bare React Native, use
|
|
29
|
+
`ReactNativeKeychainSignalProtocolSecretVault` from
|
|
30
|
+
`@open-e2ee/signal-protocol-sdk/local/vault/react-native-keychain`. The
|
|
31
|
+
[secret-vault guide](../../vault/README.md) describes the interface and the
|
|
32
|
+
adapters. Without a vault, `create`, `reset`, and `keyValueStore` throw an
|
|
33
|
+
`EncryptionError` with code `SECRET_VAULT_REQUIRED`.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
38
|
+
```ts
|
|
39
|
+
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
40
|
+
import {
|
|
41
|
+
keyValueStore,
|
|
42
|
+
type KeyValueStorage,
|
|
43
|
+
} from "@open-e2ee/signal-protocol-sdk/local/store/key-value";
|
|
44
|
+
|
|
45
|
+
const keyValueStorage: KeyValueStorage = appProtocolStorage;
|
|
46
|
+
const storage = await keyValueStore({ storage: keyValueStorage, vault });
|
|
47
|
+
|
|
48
|
+
const client = await createSignalProtocolClient({
|
|
49
|
+
identity: { userId },
|
|
50
|
+
adapters: { storage, relay },
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The injected backend's `atomicWrite()` is a security boundary. It must evaluate
|
|
55
|
+
compare-and-swap checks and commit all writes, removals, and exact per-user
|
|
56
|
+
session deletion atomically and durably, including across process termination.
|
|
57
|
+
Independent writes committed one after another are not sufficient.
|
|
58
|
+
|
|
59
|
+
## Key custody
|
|
60
|
+
|
|
61
|
+
The store encrypts each record with a 32-byte value key. The store makes the
|
|
62
|
+
key from secure random bytes on the first open and keeps it only in the vault,
|
|
63
|
+
under the name `signal_key_value_encryption_key`. The key never goes into the
|
|
64
|
+
key-value backend.
|
|
65
|
+
|
|
66
|
+
A backend that holds store data while the vault holds no key is a lost key.
|
|
67
|
+
`create` then rejects with an `EncryptionError` whose code is
|
|
68
|
+
`LOCAL_STORE_KEY_LOST`, and it changes nothing. The store does not replace the
|
|
69
|
+
key, because a new key cannot read the old data. Restore the vault entry, or
|
|
70
|
+
reset the store:
|
|
71
|
+
|
|
72
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
73
|
+
```ts
|
|
74
|
+
import { EncryptionError, EncryptionErrorCode } from "@open-e2ee/signal-protocol-sdk";
|
|
75
|
+
import { KeyValueSignalProtocolStore } from "@open-e2ee/signal-protocol-sdk/local/store/key-value";
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
store = await KeyValueSignalProtocolStore.create({ storage: keyValueStorage, vault });
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (!(error instanceof EncryptionError) || error.code !== EncryptionErrorCode.LOCAL_STORE_KEY_LOST) {
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
// Deletes every store record, then makes a new key. The device then needs a new identity.
|
|
84
|
+
store = await KeyValueSignalProtocolStore.reset({ storage: keyValueStorage, vault });
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`reset` deletes the store's records in one `atomicWrite`, and then writes a new
|
|
89
|
+
key to the vault. It leaves backend entries outside the store's `@signal:`
|
|
90
|
+
prefix. `clearAllKeys()` uses the same two steps on an open store. If the
|
|
91
|
+
process stops between the two steps, the backend holds no store data and the
|
|
92
|
+
vault holds the old key or none, so the next `create` opens an empty store.
|
|
93
|
+
|
|
94
|
+
## Realm
|
|
95
|
+
|
|
96
|
+
The subpath `@open-e2ee/signal-protocol-sdk/local/store/key-value/realm`
|
|
97
|
+
contains a backend for [Realm](https://github.com/realm/realm-js). The SDK does
|
|
98
|
+
not import `realm` and does not declare it as a dependency or peer. The
|
|
99
|
+
adapter takes any object shaped like an open Realm. Your application installs
|
|
100
|
+
`realm` and opens the Realm with the store's object schema:
|
|
101
|
+
|
|
102
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
103
|
+
```ts
|
|
104
|
+
import Realm from "realm";
|
|
105
|
+
import { KeyValueSignalProtocolStore } from "@open-e2ee/signal-protocol-sdk/local/store/key-value";
|
|
106
|
+
import {
|
|
107
|
+
createRealmKeyValueBackend,
|
|
108
|
+
realmKeyValueSchema,
|
|
109
|
+
} from "@open-e2ee/signal-protocol-sdk/local/store/key-value/realm";
|
|
110
|
+
|
|
111
|
+
const realm = await Realm.open({
|
|
112
|
+
path: "signal-protocol.realm",
|
|
113
|
+
schema: [realmKeyValueSchema],
|
|
114
|
+
});
|
|
115
|
+
const store = await KeyValueSignalProtocolStore.create({
|
|
116
|
+
storage: createRealmKeyValueBackend(realm),
|
|
117
|
+
vault,
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Each store write runs in one `realm.write` transaction. Realm commits the
|
|
122
|
+
transaction when the callback returns and cancels it when the callback throws,
|
|
123
|
+
so a failed check or a failed write commits nothing. The store runs each call
|
|
124
|
+
after the calls before it. If your application holds a Realm write transaction
|
|
125
|
+
open when a store write runs, for example after `realm.beginTransaction()`, the
|
|
126
|
+
write rejects with `INVALID_STATE`, because the store cannot control a
|
|
127
|
+
transaction that it did not open. A write that Realm rejects, for example on a
|
|
128
|
+
full disk, rejects with Realm's own error.
|
|
129
|
+
|
|
130
|
+
The schema name `SignalProtocolKeyValue` and its fields are stored in your
|
|
131
|
+
Realm file. If you already use a Realm, add `realmKeyValueSchema` to its schema
|
|
132
|
+
list, or open a separate Realm file for the store.
|
|
133
|
+
|
|
134
|
+
The adapter is tested with the conformance kit on realm 20.2.0 in Node,
|
|
135
|
+
including a reopen of the same Realm file. The SDK does not test it on a
|
|
136
|
+
device. Run the conformance kit on your target devices with your Realm build
|
|
137
|
+
before you ship.
|
|
138
|
+
|
|
139
|
+
### Realm maintenance status
|
|
140
|
+
|
|
141
|
+
Realm has no maintainer. Examine these facts before you choose it:
|
|
142
|
+
|
|
143
|
+
- MongoDB ended Realm on 2025-09-30.
|
|
144
|
+
- The last release of `realm` is 20.2.0, from 2025-08-11.
|
|
145
|
+
- The build fails with Xcode 26.4
|
|
146
|
+
([realm-js#7115](https://github.com/realm/realm-js/issues/7115)). The issue
|
|
147
|
+
was closed with no fix.
|
|
148
|
+
- The Android native libraries are not aligned for 16 KB pages
|
|
149
|
+
([realm-js#7129](https://github.com/realm/realm-js/issues/7129)). Google Play
|
|
150
|
+
requires 16 KB page support from 2027-02-01.
|
|
151
|
+
|
|
152
|
+
Realm's native build is part of your application, so these limits apply to your
|
|
153
|
+
build and not to the SDK.
|
|
154
|
+
|
|
155
|
+
### Limits
|
|
156
|
+
|
|
157
|
+
- Key names are plaintext. The store encrypts each value, but the key of a
|
|
158
|
+
record can contain protocol identifiers, for example a user ID and a device
|
|
159
|
+
ID.
|
|
160
|
+
- The backend contract has no prefix query. The store finds records by a
|
|
161
|
+
prefix, for example a user's sessions, and it checks for data on open. Each
|
|
162
|
+
of these operations calls `getAllKeys()`, which reads every key in the
|
|
163
|
+
backend. Their time increases with the total number of records.
|
|
164
|
+
|
|
165
|
+
## Another storage engine
|
|
166
|
+
|
|
167
|
+
For an engine with transactions, do not write the `atomicWrite` rules again.
|
|
168
|
+
`createTransactionalKeyValueBackend` owns them, and the Realm backend uses the
|
|
169
|
+
same function. Give it two calls:
|
|
170
|
+
|
|
171
|
+
- `transaction(body)` opens one write transaction, calls `body` once with a
|
|
172
|
+
`KeyValueTransaction` handle over it, and commits when `body` returns. When
|
|
173
|
+
`body` throws, it rolls back and rethrows. It returns, or resolves, after the
|
|
174
|
+
commit is durable.
|
|
175
|
+
- `read(body)` calls `body` with a handle over committed data and returns the
|
|
176
|
+
result.
|
|
177
|
+
|
|
178
|
+
The handle has four synchronous calls: `get`, `set`, `delete`, and
|
|
179
|
+
`keysWithPrefix`, which compares case-sensitively. The handle is synchronous
|
|
180
|
+
because Realm's `write` commits when its synchronous callback returns, so a
|
|
181
|
+
batch that awaits cannot run inside it. An engine with an asynchronous
|
|
182
|
+
transaction runs the synchronous body inside it. This sketch does that with
|
|
183
|
+
[op-sqlite](https://github.com/OP-Engineering/op-sqlite), whose `executeSync`
|
|
184
|
+
runs on the connection that holds the transaction:
|
|
185
|
+
|
|
186
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
187
|
+
```ts
|
|
188
|
+
import { open } from "@op-engineering/op-sqlite";
|
|
189
|
+
import {
|
|
190
|
+
createTransactionalKeyValueBackend,
|
|
191
|
+
KeyValueSignalProtocolStore,
|
|
192
|
+
type KeyValueTransaction,
|
|
193
|
+
} from "@open-e2ee/signal-protocol-sdk/local/store/key-value";
|
|
194
|
+
|
|
195
|
+
const db = open({ name: "signal-protocol.sqlite" });
|
|
196
|
+
db.executeSync(
|
|
197
|
+
"CREATE TABLE IF NOT EXISTS signal_key_value (key TEXT PRIMARY KEY NOT NULL, value TEXT NOT NULL)"
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
const handle: KeyValueTransaction = {
|
|
201
|
+
get(key) {
|
|
202
|
+
const row = db.executeSync("SELECT value FROM signal_key_value WHERE key = ?", [key]).rows[0];
|
|
203
|
+
return row ? String(row.value) : null;
|
|
204
|
+
},
|
|
205
|
+
set(key, value) {
|
|
206
|
+
db.executeSync(
|
|
207
|
+
"INSERT INTO signal_key_value (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value",
|
|
208
|
+
[key, value]
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
delete(key) {
|
|
212
|
+
db.executeSync("DELETE FROM signal_key_value WHERE key = ?", [key]);
|
|
213
|
+
},
|
|
214
|
+
keysWithPrefix(prefix) {
|
|
215
|
+
return db
|
|
216
|
+
.executeSync("SELECT key FROM signal_key_value WHERE substr(key, 1, ?) = ?", [prefix.length, prefix])
|
|
217
|
+
.rows.map((row) => String(row.key));
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const store = await KeyValueSignalProtocolStore.create({
|
|
222
|
+
storage: createTransactionalKeyValueBackend({
|
|
223
|
+
transaction: (body) => db.transaction(async () => body(handle)),
|
|
224
|
+
read: (body) => body(handle),
|
|
225
|
+
}),
|
|
226
|
+
vault,
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The backend runs each call after the calls before it, so its own reads and
|
|
231
|
+
writes do not overlap. It cannot order your application's statements. Give the
|
|
232
|
+
store a database that only the store uses, so that no other transaction is
|
|
233
|
+
open on the connection when the store reads or writes. The SDK does not run
|
|
234
|
+
this sketch. Run the conformance kit over your backend on your target devices.
|
|
235
|
+
|
|
236
|
+
When the engine returns without calling `body`, or calls it twice, the write
|
|
237
|
+
rejects with `INVALID_STATE`. To signal a full disk, throw an error whose
|
|
238
|
+
`name` is `'QuotaExceededError'` before the commit. The store maps it to
|
|
239
|
+
`StorageQuotaExceededError`.
|
|
240
|
+
|
|
241
|
+
## Verifying your backend
|
|
242
|
+
|
|
243
|
+
The store's guarantees hold only over a backend that honors the
|
|
244
|
+
`KeyValueStorage` contract, and the SDK cannot test the backend
|
|
245
|
+
your application supplies. The package therefore exports a
|
|
246
|
+
backend-conformance kit. Run it against your backend from your application's
|
|
247
|
+
own tests:
|
|
248
|
+
|
|
249
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
250
|
+
```ts
|
|
251
|
+
import { assertBackendConformance } from "@open-e2ee/signal-protocol-sdk/local/store/key-value";
|
|
252
|
+
|
|
253
|
+
await assertBackendConformance({
|
|
254
|
+
createBackend: () => createMyBackend(),
|
|
255
|
+
// Optional: return a new instance over the same persistence medium to
|
|
256
|
+
// verify committed writes survive reopen. Reported as skipped when absent.
|
|
257
|
+
reopen: (previous) => reopenMyBackend(previous),
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The function `assertBackendConformance` throws one error that names every
|
|
262
|
+
failing case. The function `runBackendConformance` returns the structured
|
|
263
|
+
result instead.
|
|
264
|
+
|
|
265
|
+
Continuous integration runs the kit against an in-memory reference backend on
|
|
266
|
+
the Hermes V1 command-line engine that React Native 0.86 uses, with only the
|
|
267
|
+
globals of a bare React Native app. Continuous integration also drives the
|
|
268
|
+
store over that backend through interruption and storage-pressure checks. The
|
|
269
|
+
reference backend is not part of the package. The parent
|
|
270
|
+
[storage guide](../README.md) holds the checklist that graduated this store.
|
|
271
|
+
|
|
272
|
+
Crash durability and backup behavior remain properties of your chosen native
|
|
273
|
+
storage engine, and key custody remains a property of your vault. The kit
|
|
274
|
+
verifies contract semantics, and your deployment review must still cover the
|
|
275
|
+
engine and the vault.
|
|
276
|
+
|
|
277
|
+
See the parent [storage guide](../README.md), [adapter guide](../../../ADAPTERS.md),
|
|
278
|
+
and [security model](../../../docs/SECURITY.md).
|