@open-e2ee/signal-protocol-sdk 7.2.0 → 8.1.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 -8
- package/ARCHITECTURE.md +1 -0
- package/CHANGELOG.md +538 -0
- package/README.md +10 -6
- 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 +151 -91
- 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 +9 -0
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +59 -24
- 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/protocol/zk/credentials/attributes.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/attributes.js +2 -1
- package/dist/internal/protocol/zk/credentials/attributes.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.js +8 -6
- package/dist/internal/protocol/zk/credentials/credentials.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.js +19 -13
- package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -1
- package/dist/internal/protocol/zk/groups/lizard.d.ts +8 -0
- package/dist/internal/protocol/zk/groups/lizard.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/lizard.js +18 -5
- package/dist/internal/protocol/zk/groups/lizard.js.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-commitment.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-commitment.js +7 -6
- package/dist/internal/protocol/zk/groups/profile-key-commitment.js.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-encryption.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-encryption.js +3 -2
- package/dist/internal/protocol/zk/groups/profile-key-encryption.js.map +1 -1
- package/dist/internal/protocol/zk/groups/uid-encryption.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/uid-encryption.js +3 -2
- package/dist/internal/protocol/zk/groups/uid-encryption.js.map +1 -1
- package/dist/internal/protocol/zk/proofs/point-multiplication.d.ts +53 -0
- package/dist/internal/protocol/zk/proofs/point-multiplication.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/point-multiplication.js +164 -0
- package/dist/internal/protocol/zk/proofs/point-multiplication.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/sho.d.ts +1 -0
- package/dist/internal/protocol/zk/proofs/sho.d.ts.map +1 -1
- package/dist/internal/protocol/zk/proofs/sho.js.map +1 -1
- package/dist/internal/protocol/zk/proofs/statement.d.ts.map +1 -1
- package/dist/internal/protocol/zk/proofs/statement.js +11 -11
- package/dist/internal/protocol/zk/proofs/statement.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 +11 -6
- package/dist/local/store/index.d.ts.map +1 -1
- package/dist/local/store/index.js +11 -6
- 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 +171 -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 +39 -0
- package/dist/local/store/sqlite/web/worker.d.ts.map +1 -0
- package/dist/local/store/sqlite/web/worker.js +646 -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 +101 -0
- package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -0
- package/dist/local/store/web-sqlite/adapter.js +154 -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 +84 -11
- package/docs/CLIENT_COMPOSITION.md +1 -2
- package/docs/DEVIATIONS.md +1 -1
- package/docs/ERROR_HANDLING.md +7 -1
- package/docs/GETTING_STARTED.md +1 -2
- package/docs/PACKAGE_SURFACE.md +32 -12
- package/docs/RECIPES.md +1 -2
- package/examples/browser/index.html +1 -1
- package/local/store/README.md +142 -42
- 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 +14 -0
- package/local/store/web-sqlite/README.md +210 -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,18 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Local device metadata, read from Expo and React Native.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* reason.
|
|
4
|
+
* The shared `./device` entry reads no platform API: provisioning, transfer,
|
|
5
|
+
* and the device lifecycle take the device's description as a parameter. This
|
|
6
|
+
* entry reads it on Expo, through `expo-constants`, `expo-device`, and the
|
|
7
|
+
* React Native `Platform`. Bare React Native apps use `./device/react-native`.
|
|
8
|
+
* Callers on a platform this package cannot see build the metadata themselves.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Expo exposes no device fingerprint without another package, so
|
|
11
|
+
* `getDeviceLifecyclePlatform()` omits `getDeviceFingerprint`. Supply one to
|
|
12
|
+
* enable reclaim detection.
|
|
13
13
|
*/
|
|
14
14
|
import { Platform } from 'react-native';
|
|
15
15
|
import Constants from 'expo-constants';
|
|
16
|
+
import * as Device from 'expo-device';
|
|
16
17
|
/**
|
|
17
18
|
* Describe the device that runs this code, for device linking.
|
|
18
19
|
*
|
|
@@ -32,4 +33,53 @@ export function getDeviceMetadata(deviceName) {
|
|
|
32
33
|
osVersion: Platform.Version.toString(),
|
|
33
34
|
};
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Describe the device that runs this code, for a transfer QR code and a
|
|
38
|
+
* linked-device bundle.
|
|
39
|
+
*
|
|
40
|
+
* @returns Transfer device metadata; an absent app version is omitted
|
|
41
|
+
*/
|
|
42
|
+
export function getTransferDeviceInfo() {
|
|
43
|
+
const appVersion = Constants.expoConfig?.version;
|
|
44
|
+
return {
|
|
45
|
+
...(Platform.OS === 'ios' || Platform.OS === 'android' ? { platform: Platform.OS } : {}),
|
|
46
|
+
osVersion: Platform.Version.toString(),
|
|
47
|
+
...(appVersion ? { appVersion } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Describe the device that runs this code, for `DeviceLifecycleManager`.
|
|
52
|
+
*
|
|
53
|
+
* Spread the result into the manager's dependencies.
|
|
54
|
+
*
|
|
55
|
+
* @returns Device lifecycle facts; each absent fact is omitted
|
|
56
|
+
*/
|
|
57
|
+
export function getDeviceLifecyclePlatform() {
|
|
58
|
+
const appVersion = Constants.expoConfig?.version;
|
|
59
|
+
const osVersion = Device.osVersion;
|
|
60
|
+
return {
|
|
61
|
+
generateDeviceName,
|
|
62
|
+
deviceType: Device.deviceType === Device.DeviceType.TABLET
|
|
63
|
+
? 'tablet'
|
|
64
|
+
: Device.deviceType === Device.DeviceType.DESKTOP
|
|
65
|
+
? 'desktop'
|
|
66
|
+
: 'mobile',
|
|
67
|
+
platform: Platform.OS,
|
|
68
|
+
...(osVersion ? { osVersion } : {}),
|
|
69
|
+
...(appVersion ? { appVersion } : {}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function generateDeviceName() {
|
|
73
|
+
const modelName = Device.modelName || 'Unknown Device';
|
|
74
|
+
switch (Device.deviceType) {
|
|
75
|
+
case Device.DeviceType.PHONE:
|
|
76
|
+
return modelName;
|
|
77
|
+
case Device.DeviceType.TABLET:
|
|
78
|
+
return `${modelName} (Tablet)`;
|
|
79
|
+
case Device.DeviceType.DESKTOP:
|
|
80
|
+
return `${modelName} (Desktop)`;
|
|
81
|
+
default:
|
|
82
|
+
return `${Platform.OS === 'ios' ? 'iPhone' : 'Android'} Device`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
35
85
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../device/expo/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../device/expo/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAOtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,OAAO;QACL,UAAU;QACV,QAAQ,EAAE,QAAQ,CAAC,EAAE;QACrB,UAAU,EAAE,SAAS,CAAC,UAAU,EAAE,OAAO,IAAI,SAAS;QACtD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;KACvC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;IACjD,OAAO;QACL,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxF,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;QACtC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B;IACxC,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;IACjD,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IACnC,OAAO;QACL,kBAAkB;QAClB,UAAU,EACR,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,CAAC,MAAM;YAC5C,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,CAAC,OAAO;gBAC/C,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,QAAQ;QAChB,QAAQ,EAAE,QAAQ,CAAC,EAAE;QACrB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,gBAAgB,CAAC;IACvD,QAAQ,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1B,KAAK,MAAM,CAAC,UAAU,CAAC,KAAK;YAC1B,OAAO,SAAS,CAAC;QACnB,KAAK,MAAM,CAAC,UAAU,CAAC,MAAM;YAC3B,OAAO,GAAG,SAAS,WAAW,CAAC;QACjC,KAAK,MAAM,CAAC,UAAU,CAAC,OAAO;YAC5B,OAAO,GAAG,SAAS,YAAY,CAAC;QAClC;YACE,OAAO,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC;IACpE,CAAC;AACH,CAAC"}
|
package/dist/device/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export {};
|
|
|
19
19
|
export { generateTransferKeyPair, wipeTransferKeys, generateTransferQRCode, verifyTransferQRCode, deriveTransferKeys, encryptBackup, decryptBackup, validateBackup, prepareOldDeviceTransfer, prepareNewDeviceTransfer, estimateBackupSize, formatBackupSize, createEmptyBackup, createDeviceBackup, restoreDeviceBackup, prepareOldDeviceTransferWithBackup, } from './transfer.js';
|
|
20
20
|
export type { BackupStorage, RestoreDeviceBackupResult } from './transfer.js';
|
|
21
21
|
export { RelayConnection, createRelayConnection, generateConnectionId, } from './connection.js';
|
|
22
|
-
export type { TransferKeyPair, TransferQRCode, DeviceBackup, EncryptedBackup, TransferPacket, TransferSession, TransferStatus, BackupIdentityKeyPair, LocalConnection, ConnectionConfig, ConnectionRole, ConnectionStatus, ProgressCallback, DetailedProgressCallback, RetryConfig, RelayConfig, } from './types.js';
|
|
22
|
+
export type { TransferKeyPair, TransferQRCode, DeviceBackup, EncryptedBackup, TransferPacket, TransferSession, TransferStatus, BackupIdentityKeyPair, TransferDeviceInfo, LocalConnection, ConnectionConfig, ConnectionRole, ConnectionStatus, ProgressCallback, DetailedProgressCallback, RetryConfig, RelayConfig, } from './types.js';
|
|
23
23
|
export { DEFAULT_RETRY_CONFIG, QR_CODE_MAX_AGE, TRANSFER_PROTOCOL_VERSION, BACKUP_FORMAT_VERSION, } from './types.js';
|
|
24
24
|
export { generateProvisioningQR, provisionDevice, parseProvisioningQR, connectToProvisioningSession, receiveProvisioningMessage, cancelProvisioning, } from './provisioning.js';
|
|
25
25
|
export { encryptDeviceName, decryptDeviceName } from './device-name-crypto.js';
|
|
@@ -27,5 +27,5 @@ export type { ProvisioningKeyPair, ProvisioningQRData, ProvisioningMessage, Loca
|
|
|
27
27
|
export { getDeviceId, getDeviceIdSync, clearDeviceIdCache, preloadDeviceId } from './device-id.js';
|
|
28
28
|
export { DEVICE_ID_KEY, DEVICE_NAME_KEY, DEVICE_REGISTERED_USER_ID_KEY, DEVICE_OWNER_SENTINEL, DEFAULT_DEVICE_ID, MAX_DEVICES, } from './constants.js';
|
|
29
29
|
export { DeviceLifecycleManager } from './lifecycle/index.js';
|
|
30
|
-
export type {
|
|
30
|
+
export type { DeviceLifecyclePlatform, DeviceLifecycleConvexClient, DeviceLifecycleApi, KeyStorageOps, DeviceLifecycleLogger, DeviceLifecycleDeps, DeviceInfo, DeviceMetadata, InitializationResult, StaleCheckResult, RegistrationResult, RegistrationStage, RegistrationProgress, OnProgress, RegisterDeviceOptions, HandleStaleDeviceOptions, DeviceChoice, DeviceRegistrationState, VerifiedInitializationResult, ActionResult, } from './lifecycle/index.js';
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../device/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC;AACV,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EACnB,kCAAkC,GACnC,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,YAAY,EAEV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../device/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC;AACV,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EACnB,kCAAkC,GACnC,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,YAAY,EAEV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAElB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAQjB,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG5E,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhG,OAAO,EACL,aAAa,EACb,eAAe,EACf,6BAA6B,EAC7B,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAEV,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EAEnB,UAAU,EACV,cAAc,EAEd,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAElB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EAEV,qBAAqB,EACrB,wBAAwB,EAExB,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC5B,YAAY,GACb,MAAM,aAAa,CAAC"}
|
package/dist/device/index.js
CHANGED
|
@@ -25,8 +25,9 @@ export { DEFAULT_RETRY_CONFIG, QR_CODE_MAX_AGE, TRANSFER_PROTOCOL_VERSION, BACKU
|
|
|
25
25
|
// Provisioning functions (device linking via QR code)
|
|
26
26
|
//
|
|
27
27
|
// `getDeviceMetadata` is deliberately absent: it reads the platform, and lives
|
|
28
|
-
// on `./device/expo` so that the provisioning
|
|
29
|
-
//
|
|
28
|
+
// on `./device/expo` and `./device/react-native` so that the provisioning
|
|
29
|
+
// protocol stays importable everywhere. Callers elsewhere build
|
|
30
|
+
// `LocalDeviceMetadata` themselves.
|
|
30
31
|
export { generateProvisioningQR, provisionDevice, parseProvisioningQR, connectToProvisioningSession, receiveProvisioningMessage, cancelProvisioning, } from './provisioning.js';
|
|
31
32
|
// Device name encryption/decryption
|
|
32
33
|
export { encryptDeviceName, decryptDeviceName } from './device-name-crypto.js';
|
package/dist/device/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../device/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB;AACjB,gCAAgC;AAChC,kBAAkB,EAClB,mBAAmB,EACnB,kCAAkC,GACnC,MAAM,YAAY,CAAC;AAKpB,uBAAuB;AACvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../device/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB;AACjB,gCAAgC;AAChC,kBAAkB,EAClB,mBAAmB,EACnB,kCAAkC,GACnC,MAAM,YAAY,CAAC;AAKpB,uBAAuB;AACvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAyBtB,YAAY;AACZ,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,sDAAsD;AACtD,EAAE;AACF,+EAA+E;AAC/E,0EAA0E;AAC1E,gEAAgE;AAChE,oCAAoC;AACpC,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,oCAAoC;AACpC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAe5E,+CAA+C;AAC/C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhG,4CAA4C;AAC5C,OAAO,EACL,aAAa,EACb,eAAe,EACf,6BAA6B,EAC7B,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,8EAA8E;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
* import { DeviceLifecycleManager } from './/index.js';
|
|
10
10
|
*
|
|
11
11
|
* const manager = new DeviceLifecycleManager(userId, {
|
|
12
|
-
*
|
|
12
|
+
* vault,
|
|
13
13
|
* convex,
|
|
14
|
+
* api,
|
|
14
15
|
* keyStorage,
|
|
15
16
|
* logger,
|
|
17
|
+
* ...getDeviceLifecyclePlatform(),
|
|
16
18
|
* });
|
|
17
19
|
*
|
|
18
20
|
* const result = await manager.initialize();
|
|
@@ -21,5 +23,5 @@
|
|
|
21
23
|
export {};
|
|
22
24
|
export { DeviceLifecycleManager } from './manager.js';
|
|
23
25
|
export { getLocalDeviceMetadata, getMissingMetadata } from './utils.js';
|
|
24
|
-
export type {
|
|
26
|
+
export type { DeviceLifecyclePlatform, DeviceLifecycleConvexClient, DeviceLifecycleApi, KeyStorageOps, DeviceLifecycleLogger, DeviceLifecycleDeps, DeviceInfo, DeviceMetadata, InitializationResult, StaleCheckResult, RegistrationResult, RegistrationStage, RegistrationProgress, OnProgress, RegisterDeviceOptions, HandleStaleDeviceOptions, DeviceChoice, DeviceRegistrationState, VerifiedInitializationResult, ActionResult, } from './types.js';
|
|
25
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../device/lifecycle/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../device/lifecycle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC;AACV,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAErE,YAAY,EAEV,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EAEnB,UAAU,EACV,cAAc,EAEd,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAElB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EAEV,qBAAqB,EACrB,wBAAwB,EAExB,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC5B,YAAY,GACb,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../device/lifecycle/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../device/lifecycle/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Extracted from host lifecycle for testability.
|
|
6
6
|
*
|
|
7
7
|
* Key responsibilities:
|
|
8
|
-
* - Load device ID from
|
|
8
|
+
* - Load device ID from the local secret vault
|
|
9
9
|
* - Verify device exists in backend
|
|
10
10
|
* - Detect stale devices (deleted or deactivated)
|
|
11
11
|
* - Register new devices
|
|
@@ -26,10 +26,12 @@ export {};
|
|
|
26
26
|
* Usage:
|
|
27
27
|
* ```typescript
|
|
28
28
|
* const manager = new DeviceLifecycleManager(userId, {
|
|
29
|
-
*
|
|
29
|
+
* vault,
|
|
30
30
|
* convex,
|
|
31
|
+
* api,
|
|
31
32
|
* keyStorage,
|
|
32
33
|
* logger,
|
|
34
|
+
* ...getDeviceLifecyclePlatform(),
|
|
33
35
|
* });
|
|
34
36
|
*
|
|
35
37
|
* const result = await manager.initialize();
|
|
@@ -60,7 +62,7 @@ export declare class DeviceLifecycleManager {
|
|
|
60
62
|
* Initialize device - load from storage or register new.
|
|
61
63
|
*
|
|
62
64
|
* Flow:
|
|
63
|
-
* 1. Try to load device ID from
|
|
65
|
+
* 1. Try to load device ID from the local secret vault
|
|
64
66
|
* 2. If found, verify it exists in backend
|
|
65
67
|
* 3. If stale, clean up and re-register
|
|
66
68
|
* 4. If not found, register new device
|
|
@@ -70,7 +72,7 @@ export declare class DeviceLifecycleManager {
|
|
|
70
72
|
*/
|
|
71
73
|
initialize(onProgress?: OnProgress): Promise<InitializationResult>;
|
|
72
74
|
/**
|
|
73
|
-
* Load device ID from
|
|
75
|
+
* Load device ID from the local secret vault.
|
|
74
76
|
*
|
|
75
77
|
* @returns Device ID and name, or null if not stored
|
|
76
78
|
*/
|
|
@@ -144,11 +146,7 @@ export declare class DeviceLifecycleManager {
|
|
|
144
146
|
*/
|
|
145
147
|
private generateDeviceName;
|
|
146
148
|
/**
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
private getDeviceType;
|
|
150
|
-
/**
|
|
151
|
-
* Save device ID to SecureStore.
|
|
149
|
+
* Save device ID to the local secret vault.
|
|
152
150
|
*/
|
|
153
151
|
private saveDeviceId;
|
|
154
152
|
/**
|
|
@@ -164,11 +162,11 @@ export declare class DeviceLifecycleManager {
|
|
|
164
162
|
/**
|
|
165
163
|
* Create identity keys for every identity type if they are missing.
|
|
166
164
|
* Generates and stores keys if missing (generate at registration).
|
|
167
|
-
* Saves ACI public key to
|
|
165
|
+
* Saves ACI public key to the local secret vault for device verification on subsequent launches.
|
|
168
166
|
*/
|
|
169
167
|
private ensureIdentityKeys;
|
|
170
168
|
/**
|
|
171
|
-
* Get local identity public key from
|
|
169
|
+
* Get local identity public key from the local secret vault.
|
|
172
170
|
* Returns null if not stored (fresh install or cleared).
|
|
173
171
|
*/
|
|
174
172
|
getLocalIdentityKey(): Promise<string | null>;
|
|
@@ -178,12 +176,12 @@ export declare class DeviceLifecycleManager {
|
|
|
178
176
|
*/
|
|
179
177
|
getServerIdentityKey(): Promise<string | null>;
|
|
180
178
|
/**
|
|
181
|
-
* Clear local identity key from
|
|
179
|
+
* Clear local identity key from the local secret vault.
|
|
182
180
|
* Called during reset or key mismatch handling.
|
|
183
181
|
*/
|
|
184
182
|
clearLocalIdentityKey(): Promise<void>;
|
|
185
183
|
/**
|
|
186
|
-
* Save local identity public key to
|
|
184
|
+
* Save local identity public key to the local secret vault.
|
|
187
185
|
* Called after SignalProtocolClient generates identity keys.
|
|
188
186
|
* This is CRITICAL for verifying device on subsequent app launches.
|
|
189
187
|
*
|
|
@@ -203,7 +201,7 @@ export declare class DeviceLifecycleManager {
|
|
|
203
201
|
*
|
|
204
202
|
* This is the new recommended entry point that implements the full state machine:
|
|
205
203
|
* 1. Get IDFV (device fingerprint)
|
|
206
|
-
* 2. Get local identity key from
|
|
204
|
+
* 2. Get local identity key from the local secret vault
|
|
207
205
|
* 3. Query server for device by IDFV
|
|
208
206
|
* 4. Get all devices, check hasPrimary
|
|
209
207
|
* 5. Determine state based on IDFV match, key match, device presence
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../device/lifecycle/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../device/lifecycle/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAElB,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,CAAC;AAEV;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAsB;IAElC,YAAY,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAIpD;IAED;;;OAGG;IACH,SAAS,IAAI,MAAM,CAElB;IAED;;;OAGG;YACW,mBAAmB;YAmBnB,uBAAuB;YAiBvB,yBAAyB;YAIzB,wCAAwC;IAYtD,OAAO,CAAC,uBAAuB;IAS/B;;;;;;;;;;;OAWG;IACG,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgFvE;IAED;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAuB1F;IAED;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyBlE;IAED;;;;;OAKG;IACG,YAAY,CAAC,eAAe,UAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAcjE;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmIrF;IAED;;;;;;;;;OASG;IACG,iBAAiB,CACrB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,kBAAkB,CAAC,CAqB7B;IAED;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAatC;IAED;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrD;IAMD;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;YACW,YAAY;IAc1B;;;OAGG;YACW,mBAAmB;IAkBjC;;;OAGG;YACW,qBAAqB;IAgBnC;;;;OAIG;YACW,kBAAkB;IA6DhC;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUlD;IAED;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcnD;IAED;;;OAGG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C;IAED;;;;;;OAMG;IACG,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAc3D;IAED;;OAEG;YACW,oBAAoB;IAYlC;;OAEG;YACW,eAAe;IAoB7B;;;;;;;;;;;;;;;OAeG;IACG,0BAA0B,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAoR/F;IAMD;;;;;;;;OAQG;IACG,sBAAsB,CAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,YAAY,CAAC,CAgDvB;IAED;;;;;;;;OAQG;IACG,WAAW,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAkChE;IAED;;;;;;;;OAQG;IACG,sBAAsB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAkC3E;IAED;;;;;;;;;;OAUG;IACG,0BAA0B,IAAI,OAAO,CAAC,YAAY,CAAC,CAuBxD;IAED;;OAEG;IACH,uBAAuB,IAAI,YAAY,EAAE,CAgBxC;IAED;;OAEG;IACH,qBAAqB,IAAI,YAAY,EAAE,CAUtC;IAED;;OAEG;IACH,qBAAqB,IAAI,YAAY,EAAE,CAgBtC;CACF"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Extracted from host lifecycle for testability.
|
|
6
6
|
*
|
|
7
7
|
* Key responsibilities:
|
|
8
|
-
* - Load device ID from
|
|
8
|
+
* - Load device ID from the local secret vault
|
|
9
9
|
* - Verify device exists in backend
|
|
10
10
|
* - Detect stale devices (deleted or deactivated)
|
|
11
11
|
* - Register new devices
|
|
@@ -18,11 +18,10 @@
|
|
|
18
18
|
*
|
|
19
19
|
* @see lib/device/host lifecycle - React wrapper
|
|
20
20
|
*/
|
|
21
|
-
import * as Device from 'expo-device';
|
|
22
|
-
import { Platform } from 'react-native';
|
|
23
|
-
import RNDeviceInfo from 'react-native-device-info';
|
|
24
21
|
import { DEVICE_ID_KEY, DEVICE_NAME_KEY, LOCAL_IDENTITY_KEY, MAX_DEVICES } from '../constants.js';
|
|
25
22
|
import { clearDeviceIdCache } from '../device-id.js';
|
|
23
|
+
import { readVaultText, writeVaultText } from '../vault-text.js';
|
|
24
|
+
import { requireSecretVault } from '../../local/vault/require.js';
|
|
26
25
|
import { decryptDeviceName } from '../device-name-crypto.js';
|
|
27
26
|
/**
|
|
28
27
|
* DeviceLifecycleManager handles device registration and stale detection.
|
|
@@ -30,10 +29,12 @@ import { decryptDeviceName } from '../device-name-crypto.js';
|
|
|
30
29
|
* Usage:
|
|
31
30
|
* ```typescript
|
|
32
31
|
* const manager = new DeviceLifecycleManager(userId, {
|
|
33
|
-
*
|
|
32
|
+
* vault,
|
|
34
33
|
* convex,
|
|
34
|
+
* api,
|
|
35
35
|
* keyStorage,
|
|
36
36
|
* logger,
|
|
37
|
+
* ...getDeviceLifecyclePlatform(),
|
|
37
38
|
* });
|
|
38
39
|
*
|
|
39
40
|
* const result = await manager.initialize();
|
|
@@ -46,6 +47,7 @@ export class DeviceLifecycleManager {
|
|
|
46
47
|
userId;
|
|
47
48
|
deps;
|
|
48
49
|
constructor(userId, deps) {
|
|
50
|
+
requireSecretVault(deps.vault, 'DeviceLifecycleManager');
|
|
49
51
|
this.userId = userId;
|
|
50
52
|
this.deps = deps;
|
|
51
53
|
}
|
|
@@ -120,7 +122,7 @@ export class DeviceLifecycleManager {
|
|
|
120
122
|
* Initialize device - load from storage or register new.
|
|
121
123
|
*
|
|
122
124
|
* Flow:
|
|
123
|
-
* 1. Try to load device ID from
|
|
125
|
+
* 1. Try to load device ID from the local secret vault
|
|
124
126
|
* 2. If found, verify it exists in backend
|
|
125
127
|
* 3. If stale, clean up and re-register
|
|
126
128
|
* 4. If not found, register new device
|
|
@@ -129,7 +131,7 @@ export class DeviceLifecycleManager {
|
|
|
129
131
|
* @returns Initialization result indicating how device was resolved
|
|
130
132
|
*/
|
|
131
133
|
async initialize(onProgress) {
|
|
132
|
-
// Step 1: Try to load from
|
|
134
|
+
// Step 1: Try to load from the local secret vault
|
|
133
135
|
const stored = await this.loadStoredDeviceId();
|
|
134
136
|
if (stored) {
|
|
135
137
|
// Step 2: Verify device still exists in backend
|
|
@@ -198,14 +200,14 @@ export class DeviceLifecycleManager {
|
|
|
198
200
|
};
|
|
199
201
|
}
|
|
200
202
|
/**
|
|
201
|
-
* Load device ID from
|
|
203
|
+
* Load device ID from the local secret vault.
|
|
202
204
|
*
|
|
203
205
|
* @returns Device ID and name, or null if not stored
|
|
204
206
|
*/
|
|
205
207
|
async loadStoredDeviceId() {
|
|
206
208
|
try {
|
|
207
|
-
const storedId = await this.deps.
|
|
208
|
-
const storedName = await this.deps.
|
|
209
|
+
const storedId = await readVaultText(this.deps.vault, DEVICE_ID_KEY);
|
|
210
|
+
const storedName = await readVaultText(this.deps.vault, DEVICE_NAME_KEY);
|
|
209
211
|
if (storedId) {
|
|
210
212
|
const id = parseInt(storedId, 10);
|
|
211
213
|
if (id >= 1 && id <= MAX_DEVICES) {
|
|
@@ -219,7 +221,7 @@ export class DeviceLifecycleManager {
|
|
|
219
221
|
return null;
|
|
220
222
|
}
|
|
221
223
|
catch (error) {
|
|
222
|
-
this.deps.logger.error('Failed to load device ID from
|
|
224
|
+
this.deps.logger.error('Failed to load device ID from the local secret vault', {
|
|
223
225
|
category: 'Device',
|
|
224
226
|
error: error,
|
|
225
227
|
});
|
|
@@ -308,16 +310,11 @@ export class DeviceLifecycleManager {
|
|
|
308
310
|
// Their reset and persistence behavior is platform-dependent.
|
|
309
311
|
let idfv;
|
|
310
312
|
try {
|
|
311
|
-
|
|
312
|
-
idfv = await this.deps.getDeviceFingerprint();
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
idfv = await RNDeviceInfo.getUniqueId();
|
|
316
|
-
}
|
|
313
|
+
idfv = await this.deps.getDeviceFingerprint?.();
|
|
317
314
|
this.deps.logger.debug('Got device fingerprint for reclaim detection', {
|
|
318
315
|
category: 'Device',
|
|
319
316
|
data: {
|
|
320
|
-
platform:
|
|
317
|
+
platform: this.deps.platform,
|
|
321
318
|
fingerprint: idfv ? idfv.slice(0, 8) + '...' : 'none',
|
|
322
319
|
},
|
|
323
320
|
});
|
|
@@ -366,32 +363,23 @@ export class DeviceLifecycleManager {
|
|
|
366
363
|
this.deps.logger.breadcrumb('Registering device with server', {
|
|
367
364
|
category: 'Device',
|
|
368
365
|
level: 'info',
|
|
369
|
-
data: { deviceName: name, platform:
|
|
366
|
+
data: { deviceName: name, platform: this.deps.platform, hasIdfv: !!idfv },
|
|
370
367
|
});
|
|
371
|
-
const deviceType = this.getDeviceType();
|
|
372
368
|
const deviceIdToUse = forceDeviceId ?? (isPrimary ? 1 : undefined);
|
|
373
|
-
//
|
|
374
|
-
const platform =
|
|
375
|
-
const osVersion = Device.osVersion ?? undefined;
|
|
376
|
-
let appVersion;
|
|
377
|
-
try {
|
|
378
|
-
appVersion = RNDeviceInfo.getVersion();
|
|
379
|
-
}
|
|
380
|
-
catch {
|
|
381
|
-
// Non-fatal - app version is optional metadata
|
|
382
|
-
}
|
|
369
|
+
// App metadata for the device registry; each absent fact is omitted.
|
|
370
|
+
const { deviceType, platform, appVersion, osVersion } = this.deps;
|
|
383
371
|
const result = await this.deps.convex.mutation(this.deps.api.devices.registerDevice, {
|
|
384
372
|
// userId derived server-side from JWT auth
|
|
385
373
|
deviceId: deviceIdToUse,
|
|
386
|
-
deviceType,
|
|
387
|
-
idfv,
|
|
388
|
-
platform,
|
|
389
|
-
appVersion,
|
|
390
|
-
osVersion,
|
|
374
|
+
...(deviceType ? { deviceType } : {}),
|
|
375
|
+
...(idfv ? { idfv } : {}),
|
|
376
|
+
...(platform ? { platform } : {}),
|
|
377
|
+
...(appVersion ? { appVersion } : {}),
|
|
378
|
+
...(osVersion ? { osVersion } : {}),
|
|
391
379
|
});
|
|
392
|
-
// Step 5: Save to
|
|
380
|
+
// Step 5: Save to the local secret vault
|
|
393
381
|
onProgress?.({ stage: 'saving', message: 'Saving device credentials...' });
|
|
394
|
-
this.deps.logger.breadcrumb('Saving device ID to
|
|
382
|
+
this.deps.logger.breadcrumb('Saving device ID to the local secret vault', {
|
|
395
383
|
category: 'Device',
|
|
396
384
|
level: 'info',
|
|
397
385
|
data: { deviceId: result.deviceId, reclaimed: result.reclaimed },
|
|
@@ -433,7 +421,7 @@ export class DeviceLifecycleManager {
|
|
|
433
421
|
const { onProgress } = options;
|
|
434
422
|
// Step 1: Clean up orphaned keys in backend
|
|
435
423
|
await this.cleanupOrphanedKeys(staleDeviceId);
|
|
436
|
-
// Step 2: Clear local
|
|
424
|
+
// Step 2: Clear local vault state
|
|
437
425
|
await this.clearLocalDevice();
|
|
438
426
|
// Step 3: Clear local crypto state (sessions + message records)
|
|
439
427
|
await this.clearLocalCryptoState();
|
|
@@ -450,8 +438,8 @@ export class DeviceLifecycleManager {
|
|
|
450
438
|
*/
|
|
451
439
|
async clearLocalDevice() {
|
|
452
440
|
try {
|
|
453
|
-
await this.deps.
|
|
454
|
-
await this.deps.
|
|
441
|
+
await this.deps.vault.deleteSecret(DEVICE_ID_KEY);
|
|
442
|
+
await this.deps.vault.deleteSecret(DEVICE_NAME_KEY);
|
|
455
443
|
clearDeviceIdCache();
|
|
456
444
|
this.deps.logger.debug('Cleared local device data', { category: 'Device' });
|
|
457
445
|
}
|
|
@@ -480,48 +468,18 @@ export class DeviceLifecycleManager {
|
|
|
480
468
|
* Generate a human-readable device name.
|
|
481
469
|
*/
|
|
482
470
|
generateDeviceName() {
|
|
483
|
-
|
|
484
|
-
if (this.deps.generateDeviceName) {
|
|
485
|
-
return this.deps.generateDeviceName();
|
|
486
|
-
}
|
|
487
|
-
const deviceType = Device.deviceType;
|
|
488
|
-
const modelName = Device.modelName || 'Unknown Device';
|
|
489
|
-
const osName = Platform.OS === 'ios' ? 'iPhone' : 'Android';
|
|
490
|
-
if (deviceType === Device.DeviceType.PHONE) {
|
|
491
|
-
return modelName;
|
|
492
|
-
}
|
|
493
|
-
else if (deviceType === Device.DeviceType.TABLET) {
|
|
494
|
-
return `${modelName} (Tablet)`;
|
|
495
|
-
}
|
|
496
|
-
else if (deviceType === Device.DeviceType.DESKTOP) {
|
|
497
|
-
return `${modelName} (Desktop)`;
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
return `${osName} Device`;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Get device type for backend registration.
|
|
505
|
-
*/
|
|
506
|
-
getDeviceType() {
|
|
507
|
-
if (Device.deviceType === Device.DeviceType.TABLET) {
|
|
508
|
-
return 'tablet';
|
|
509
|
-
}
|
|
510
|
-
else if (Device.deviceType === Device.DeviceType.DESKTOP) {
|
|
511
|
-
return 'desktop';
|
|
512
|
-
}
|
|
513
|
-
return 'mobile';
|
|
471
|
+
return this.deps.generateDeviceName?.() ?? 'Unknown Device';
|
|
514
472
|
}
|
|
515
473
|
/**
|
|
516
|
-
* Save device ID to
|
|
474
|
+
* Save device ID to the local secret vault.
|
|
517
475
|
*/
|
|
518
476
|
async saveDeviceId(id, name) {
|
|
519
477
|
try {
|
|
520
|
-
await this.deps.
|
|
521
|
-
await this.deps.
|
|
478
|
+
await writeVaultText(this.deps.vault, DEVICE_ID_KEY, id.toString());
|
|
479
|
+
await writeVaultText(this.deps.vault, DEVICE_NAME_KEY, name);
|
|
522
480
|
}
|
|
523
481
|
catch (error) {
|
|
524
|
-
this.deps.logger.error('Failed to save device ID to
|
|
482
|
+
this.deps.logger.error('Failed to save device ID to the local secret vault', {
|
|
525
483
|
category: 'Device',
|
|
526
484
|
error: error,
|
|
527
485
|
data: { deviceId: id, deviceName: name },
|
|
@@ -574,7 +532,7 @@ export class DeviceLifecycleManager {
|
|
|
574
532
|
/**
|
|
575
533
|
* Create identity keys for every identity type if they are missing.
|
|
576
534
|
* Generates and stores keys if missing (generate at registration).
|
|
577
|
-
* Saves ACI public key to
|
|
535
|
+
* Saves ACI public key to the local secret vault for device verification on subsequent launches.
|
|
578
536
|
*/
|
|
579
537
|
async ensureIdentityKeys(deviceId) {
|
|
580
538
|
if (!this.deps.keyStorage.hasIdentityKey || !this.deps.keyStorage.generateAndStoreIdentityKey) {
|
|
@@ -602,14 +560,14 @@ export class DeviceLifecycleManager {
|
|
|
602
560
|
}
|
|
603
561
|
}
|
|
604
562
|
else if (identityType === 'aci') {
|
|
605
|
-
// Key exists in
|
|
606
|
-
// (e.g., after reinstall reclaim clears
|
|
607
|
-
const
|
|
608
|
-
if (!
|
|
563
|
+
// Key exists in the local store but may be missing from the vault
|
|
564
|
+
// (e.g., after reinstall reclaim clears the vault but keeps the local store)
|
|
565
|
+
const vaultKey = await this.getLocalIdentityKey();
|
|
566
|
+
if (!vaultKey && this.deps.keyStorage.getIdentityPublicKey) {
|
|
609
567
|
const publicKey = await this.deps.keyStorage.getIdentityPublicKey();
|
|
610
568
|
if (publicKey) {
|
|
611
569
|
await this.saveLocalIdentityKey(publicKey);
|
|
612
|
-
this.deps.logger.info('Synced existing identity key to
|
|
570
|
+
this.deps.logger.info('Synced existing identity key to the local secret vault', {
|
|
613
571
|
category: 'Device',
|
|
614
572
|
data: { keyPrefix: publicKey.slice(0, 8) + '...' },
|
|
615
573
|
});
|
|
@@ -631,12 +589,12 @@ export class DeviceLifecycleManager {
|
|
|
631
589
|
// Identity Key Verification Methods
|
|
632
590
|
// ==========================================================================
|
|
633
591
|
/**
|
|
634
|
-
* Get local identity public key from
|
|
592
|
+
* Get local identity public key from the local secret vault.
|
|
635
593
|
* Returns null if not stored (fresh install or cleared).
|
|
636
594
|
*/
|
|
637
595
|
async getLocalIdentityKey() {
|
|
638
596
|
try {
|
|
639
|
-
return await this.deps.
|
|
597
|
+
return await readVaultText(this.deps.vault, LOCAL_IDENTITY_KEY);
|
|
640
598
|
}
|
|
641
599
|
catch (error) {
|
|
642
600
|
this.deps.logger.warn('Failed to get local identity key', {
|
|
@@ -667,12 +625,12 @@ export class DeviceLifecycleManager {
|
|
|
667
625
|
}
|
|
668
626
|
}
|
|
669
627
|
/**
|
|
670
|
-
* Clear local identity key from
|
|
628
|
+
* Clear local identity key from the local secret vault.
|
|
671
629
|
* Called during reset or key mismatch handling.
|
|
672
630
|
*/
|
|
673
631
|
async clearLocalIdentityKey() {
|
|
674
632
|
try {
|
|
675
|
-
await this.deps.
|
|
633
|
+
await this.deps.vault.deleteSecret(LOCAL_IDENTITY_KEY);
|
|
676
634
|
this.deps.logger.debug('Cleared local identity key', { category: 'Device' });
|
|
677
635
|
}
|
|
678
636
|
catch (error) {
|
|
@@ -683,7 +641,7 @@ export class DeviceLifecycleManager {
|
|
|
683
641
|
}
|
|
684
642
|
}
|
|
685
643
|
/**
|
|
686
|
-
* Save local identity public key to
|
|
644
|
+
* Save local identity public key to the local secret vault.
|
|
687
645
|
* Called after SignalProtocolClient generates identity keys.
|
|
688
646
|
* This is CRITICAL for verifying device on subsequent app launches.
|
|
689
647
|
*
|
|
@@ -691,7 +649,7 @@ export class DeviceLifecycleManager {
|
|
|
691
649
|
*/
|
|
692
650
|
async saveLocalIdentityKey(publicKey) {
|
|
693
651
|
try {
|
|
694
|
-
await this.deps.
|
|
652
|
+
await writeVaultText(this.deps.vault, LOCAL_IDENTITY_KEY, publicKey);
|
|
695
653
|
this.deps.logger.info('Saved local identity key', {
|
|
696
654
|
category: 'Device',
|
|
697
655
|
data: { keyPrefix: publicKey.slice(0, 8) + '...' },
|
|
@@ -710,10 +668,7 @@ export class DeviceLifecycleManager {
|
|
|
710
668
|
*/
|
|
711
669
|
async getDeviceFingerprint() {
|
|
712
670
|
try {
|
|
713
|
-
|
|
714
|
-
return await this.deps.getDeviceFingerprint();
|
|
715
|
-
}
|
|
716
|
-
return await RNDeviceInfo.getUniqueId();
|
|
671
|
+
return await this.deps.getDeviceFingerprint?.();
|
|
717
672
|
}
|
|
718
673
|
catch (error) {
|
|
719
674
|
this.deps.logger.warn('Failed to get device fingerprint', {
|
|
@@ -747,7 +702,7 @@ export class DeviceLifecycleManager {
|
|
|
747
702
|
*
|
|
748
703
|
* This is the new recommended entry point that implements the full state machine:
|
|
749
704
|
* 1. Get IDFV (device fingerprint)
|
|
750
|
-
* 2. Get local identity key from
|
|
705
|
+
* 2. Get local identity key from the local secret vault
|
|
751
706
|
* 3. Query server for device by IDFV
|
|
752
707
|
* 4. Get all devices, check hasPrimary
|
|
753
708
|
* 5. Determine state based on IDFV match, key match, device presence
|
|
@@ -781,19 +736,19 @@ export class DeviceLifecycleManager {
|
|
|
781
736
|
if (localIdentityPair) {
|
|
782
737
|
const localIdentityPublicKey = localIdentityPair.dhKey.publicKey;
|
|
783
738
|
if (localIdentityKey !== localIdentityPublicKey) {
|
|
784
|
-
const
|
|
739
|
+
const hadVaultKey = !!localIdentityKey;
|
|
785
740
|
localIdentityKey = localIdentityPublicKey;
|
|
786
741
|
try {
|
|
787
742
|
await this.saveLocalIdentityKey(localIdentityPublicKey);
|
|
788
|
-
this.deps.logger.info(
|
|
789
|
-
? 'Repaired stale
|
|
790
|
-
: 'Restored missing
|
|
743
|
+
this.deps.logger.info(hadVaultKey
|
|
744
|
+
? 'Repaired stale vault identity key from local key pair'
|
|
745
|
+
: 'Restored missing vault identity key from local key pair', {
|
|
791
746
|
category: 'Device',
|
|
792
747
|
data: { keyPrefix: localIdentityPublicKey.slice(0, 8) + '...' },
|
|
793
748
|
});
|
|
794
749
|
}
|
|
795
750
|
catch (error) {
|
|
796
|
-
this.deps.logger.warn('Failed to sync
|
|
751
|
+
this.deps.logger.warn('Failed to sync vault identity key from local key pair', {
|
|
797
752
|
category: 'Device',
|
|
798
753
|
error: error,
|
|
799
754
|
});
|