@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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime's `Blob`, when it holds bytes.
|
|
3
|
+
*
|
|
4
|
+
* React Native's `Blob` rejects binary parts and has no `arrayBuffer()` or
|
|
5
|
+
* `text()`. `binaryBlob` returns the runtime's `Blob` constructor only when a
|
|
6
|
+
* probe shows that it holds bytes and reads them back.
|
|
7
|
+
*/
|
|
8
|
+
let checkedConstructor;
|
|
9
|
+
let binaryBlobConstructor;
|
|
10
|
+
/** The runtime's `Blob` constructor, or `undefined` when it cannot hold bytes. */
|
|
11
|
+
export function binaryBlob() {
|
|
12
|
+
const Constructor = globalThis.Blob;
|
|
13
|
+
if (Constructor !== checkedConstructor) {
|
|
14
|
+
checkedConstructor = Constructor;
|
|
15
|
+
binaryBlobConstructor = undefined;
|
|
16
|
+
try {
|
|
17
|
+
const probe = new Constructor([new Uint8Array(1)]);
|
|
18
|
+
if (probe.size === 1 &&
|
|
19
|
+
typeof probe.arrayBuffer === 'function' &&
|
|
20
|
+
typeof probe.text === 'function') {
|
|
21
|
+
binaryBlobConstructor = Constructor;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// A Blob that rejects binary parts, or no Blob.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return binaryBlobConstructor;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=blob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../../../internal/platform/blob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,IAAI,kBAA2B,CAAC;AAChC,IAAI,qBAA8C,CAAC;AAEnD,kFAAkF;AAClF,MAAM,UAAU,UAAU;IACxB,MAAM,WAAW,GAAI,UAAqC,CAAC,IAAI,CAAC;IAChE,IAAI,WAAW,KAAK,kBAAkB,EAAE,CAAC;QACvC,kBAAkB,GAAG,WAAW,CAAC;QACjC,qBAAqB,GAAG,SAAS,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,WAAY,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,IACE,KAAK,CAAC,IAAI,KAAK,CAAC;gBAChB,OAAO,KAAK,CAAC,WAAW,KAAK,UAAU;gBACvC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,EAChC,CAAC;gBACD,qBAAqB,GAAG,WAAW,CAAC;YACtC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gDAAgD;QAClD,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment variables that the SDK reads.
|
|
3
|
+
*
|
|
4
|
+
* Bundlers replace only a literal `process.env.NAME` member expression at
|
|
5
|
+
* build time, so each variable has its own reader with that literal read. A
|
|
6
|
+
* browser that loads the SDK without a bundler `define` has no `process`, and
|
|
7
|
+
* each reader then returns `undefined`.
|
|
8
|
+
*/
|
|
9
|
+
/** `NODE_ENV`, which a test runner sets to "test". */
|
|
10
|
+
export declare function nodeEnv(): string | undefined;
|
|
11
|
+
/** `EXPO_PUBLIC_CONVEX_URL`, which Expo inlines at build time. */
|
|
12
|
+
export declare function expoPublicConvexUrl(): string | undefined;
|
|
13
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../internal/platform/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sDAAsD;AACtD,wBAAgB,OAAO,IAAI,MAAM,GAAG,SAAS,CAE5C;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAExD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment variables that the SDK reads.
|
|
3
|
+
*
|
|
4
|
+
* Bundlers replace only a literal `process.env.NAME` member expression at
|
|
5
|
+
* build time, so each variable has its own reader with that literal read. A
|
|
6
|
+
* browser that loads the SDK without a bundler `define` has no `process`, and
|
|
7
|
+
* each reader then returns `undefined`.
|
|
8
|
+
*/
|
|
9
|
+
/** `NODE_ENV`, which a test runner sets to "test". */
|
|
10
|
+
export function nodeEnv() {
|
|
11
|
+
return typeof process === 'undefined' ? undefined : process.env.NODE_ENV;
|
|
12
|
+
}
|
|
13
|
+
/** `EXPO_PUBLIC_CONVEX_URL`, which Expo inlines at build time. */
|
|
14
|
+
export function expoPublicConvexUrl() {
|
|
15
|
+
return typeof process === 'undefined' ? undefined : process.env.EXPO_PUBLIC_CONVEX_URL;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../internal/platform/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sDAAsD;AACtD,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC3E,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,mBAAmB;IACjC,OAAO,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACzF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { binaryBlob } from './blob.js';
|
|
2
|
+
export { expoPublicConvexUrl, nodeEnv } from './env.js';
|
|
3
|
+
export { encodeQuery, parseUrl, queryValues, resolveUrl, websocketUrl, type ParsedUrl, } from './url.js';
|
|
4
|
+
export { utf8Decode, type Utf8DecodeOptions } from './utf8.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../internal/platform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,WAAW,EACX,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../internal/platform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,WAAW,EACX,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,GAEb,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAA0B,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL parsing and building on every runtime the SDK supports.
|
|
3
|
+
*
|
|
4
|
+
* React Native's global `URL` is not a WHATWG URL. It has no setters, it reads
|
|
5
|
+
* the host and the path only for `http` and `https`, and its `URLSearchParams`
|
|
6
|
+
* splits a value on every `=`. This module never reads the global `URL`.
|
|
7
|
+
*
|
|
8
|
+
* `parseUrl` accepts only the URL forms that the SDK uses. For each input that
|
|
9
|
+
* it accepts, it gives the same fields as a WHATWG `URL`. It rejects every
|
|
10
|
+
* other input with `TypeError('Invalid URL')`, which includes:
|
|
11
|
+
*
|
|
12
|
+
* - credentials, a fragment, an empty query, and a dot segment;
|
|
13
|
+
* - whitespace, control characters, backslashes, and non-ASCII characters;
|
|
14
|
+
* - a malformed percent escape;
|
|
15
|
+
* - a host that a WHATWG parser would rewrite: an IDNA label, an empty label,
|
|
16
|
+
* or an IPv4 or IPv6 address in a non-canonical form;
|
|
17
|
+
* - a port with a leading zero or above 65535;
|
|
18
|
+
* - the `file` and `ftp` schemes, and any URL without `//` after the scheme.
|
|
19
|
+
*/
|
|
20
|
+
/** The fields of an accepted URL. Each has the value that a WHATWG `URL` gives. */
|
|
21
|
+
export interface ParsedUrl {
|
|
22
|
+
readonly href: string;
|
|
23
|
+
/** The scheme in lowercase, with the trailing `:`. */
|
|
24
|
+
readonly protocol: string;
|
|
25
|
+
readonly hostname: string;
|
|
26
|
+
/** Empty when the URL has no port or has the default port of its scheme. */
|
|
27
|
+
readonly port: string;
|
|
28
|
+
readonly host: string;
|
|
29
|
+
/** `'null'` for a scheme that is not `http`, `https`, `ws`, or `wss`. */
|
|
30
|
+
readonly origin: string;
|
|
31
|
+
readonly pathname: string;
|
|
32
|
+
/** Empty, or `?` and a query that is not empty. */
|
|
33
|
+
readonly search: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse an absolute URL of the form `scheme://host[:port][/path][?query]`.
|
|
37
|
+
*
|
|
38
|
+
* @throws TypeError when the input is not a form that the SDK uses.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseUrl(input: string): ParsedUrl;
|
|
41
|
+
/**
|
|
42
|
+
* The values of one query parameter, decoded as WHATWG
|
|
43
|
+
* application/x-www-form-urlencoded. Unlike WHATWG, a name or a value that is
|
|
44
|
+
* not valid UTF-8 or starts with a byte order mark is an error.
|
|
45
|
+
*
|
|
46
|
+
* @throws TypeError when a name or a value does not decode.
|
|
47
|
+
*/
|
|
48
|
+
export declare function queryValues(url: ParsedUrl, name: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Serialize query parameters as WHATWG `URLSearchParams.toString()` does,
|
|
51
|
+
* without the leading `?`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function encodeQuery(entries: ReadonlyArray<readonly [string, string]>): string;
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a URL reference against an `http` or `https` base URL.
|
|
56
|
+
*
|
|
57
|
+
* The reference can be an absolute URL, a path that starts with `/`, or a
|
|
58
|
+
* relative path. A reference that starts with `//`, `?`, or `#` is an error.
|
|
59
|
+
*
|
|
60
|
+
* @throws TypeError when the reference, the base, or the result is not a form
|
|
61
|
+
* that `parseUrl` accepts.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveUrl(reference: string, base: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* The WebSocket URL for an `http` or `https` endpoint: `https` becomes `wss`,
|
|
66
|
+
* `http` becomes `ws`, and the query is replaced.
|
|
67
|
+
*
|
|
68
|
+
* @throws TypeError when the endpoint is not an `http` or `https` URL that
|
|
69
|
+
* `parseUrl` accepts.
|
|
70
|
+
*/
|
|
71
|
+
export declare function websocketUrl(endpoint: string, query: ReadonlyArray<readonly [string, string]>): string;
|
|
72
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../internal/platform/url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA4BD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAsCjD;AAwED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAUlE;AAqBD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAIrF;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASlE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC9C,MAAM,CAMR"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL parsing and building on every runtime the SDK supports.
|
|
3
|
+
*
|
|
4
|
+
* React Native's global `URL` is not a WHATWG URL. It has no setters, it reads
|
|
5
|
+
* the host and the path only for `http` and `https`, and its `URLSearchParams`
|
|
6
|
+
* splits a value on every `=`. This module never reads the global `URL`.
|
|
7
|
+
*
|
|
8
|
+
* `parseUrl` accepts only the URL forms that the SDK uses. For each input that
|
|
9
|
+
* it accepts, it gives the same fields as a WHATWG `URL`. It rejects every
|
|
10
|
+
* other input with `TypeError('Invalid URL')`, which includes:
|
|
11
|
+
*
|
|
12
|
+
* - credentials, a fragment, an empty query, and a dot segment;
|
|
13
|
+
* - whitespace, control characters, backslashes, and non-ASCII characters;
|
|
14
|
+
* - a malformed percent escape;
|
|
15
|
+
* - a host that a WHATWG parser would rewrite: an IDNA label, an empty label,
|
|
16
|
+
* or an IPv4 or IPv6 address in a non-canonical form;
|
|
17
|
+
* - a port with a leading zero or above 65535;
|
|
18
|
+
* - the `file` and `ftp` schemes, and any URL without `//` after the scheme.
|
|
19
|
+
*/
|
|
20
|
+
import { utf8Decode } from './utf8.js';
|
|
21
|
+
/** The special schemes that this module parses, with their default ports. */
|
|
22
|
+
const DEFAULT_PORTS = {
|
|
23
|
+
'http:': '80',
|
|
24
|
+
'https:': '443',
|
|
25
|
+
'ws:': '80',
|
|
26
|
+
'wss:': '443',
|
|
27
|
+
};
|
|
28
|
+
const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):\/\//u;
|
|
29
|
+
const SCHEME_PREFIX = /^[A-Za-z][A-Za-z0-9+.-]*:/u;
|
|
30
|
+
const PRINTABLE_ASCII = /^[\x21-\x7e]*$/u;
|
|
31
|
+
const AUTHORITY = /^(\[[^\]]*\]|[^:[\]]*)(?::(.*))?$/u;
|
|
32
|
+
const PATH = /^(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*$/u;
|
|
33
|
+
const QUERY = /^(?:[A-Za-z0-9\-._~!$&()*+,;=:@/?]|%[0-9A-Fa-f]{2})+$/u;
|
|
34
|
+
const DOMAIN_LABEL = /^[a-z0-9_-]+$/u;
|
|
35
|
+
const NUMERIC_LABEL = /^(?:[0-9]+|0x[0-9a-f]*)$/u;
|
|
36
|
+
const IPV4_PART = /^(?:0|[1-9][0-9]{0,2})$/u;
|
|
37
|
+
const IPV6_PIECE = /^[0-9a-f]{1,4}$/u;
|
|
38
|
+
const OPAQUE_HOST = /^[A-Za-z0-9._~-]+$/u;
|
|
39
|
+
const PORT = /^(?:0|[1-9][0-9]{0,4})$/u;
|
|
40
|
+
const DOT_SEGMENT = /^(?:\.|%2e){1,2}$/iu;
|
|
41
|
+
function invalid() {
|
|
42
|
+
throw new TypeError('Invalid URL');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse an absolute URL of the form `scheme://host[:port][/path][?query]`.
|
|
46
|
+
*
|
|
47
|
+
* @throws TypeError when the input is not a form that the SDK uses.
|
|
48
|
+
*/
|
|
49
|
+
export function parseUrl(input) {
|
|
50
|
+
if (!PRINTABLE_ASCII.test(input) || input.includes('#') || input.includes('\\'))
|
|
51
|
+
invalid();
|
|
52
|
+
const scheme = SCHEME.exec(input);
|
|
53
|
+
if (!scheme)
|
|
54
|
+
invalid();
|
|
55
|
+
const protocol = `${scheme[1].toLowerCase()}:`;
|
|
56
|
+
if (protocol === 'file:' || protocol === 'ftp:')
|
|
57
|
+
invalid();
|
|
58
|
+
const special = protocol in DEFAULT_PORTS;
|
|
59
|
+
const rest = input.slice(scheme[0].length);
|
|
60
|
+
const authorityEnd = rest.search(/[/?]/u);
|
|
61
|
+
const authority = authorityEnd === -1 ? rest : rest.slice(0, authorityEnd);
|
|
62
|
+
const afterAuthority = authorityEnd === -1 ? '' : rest.slice(authorityEnd);
|
|
63
|
+
const queryStart = afterAuthority.indexOf('?');
|
|
64
|
+
const path = queryStart === -1 ? afterAuthority : afterAuthority.slice(0, queryStart);
|
|
65
|
+
const query = queryStart === -1 ? undefined : afterAuthority.slice(queryStart + 1);
|
|
66
|
+
const parts = AUTHORITY.exec(authority);
|
|
67
|
+
if (!parts || parts[1] === '')
|
|
68
|
+
invalid();
|
|
69
|
+
const hostname = special ? specialHost(parts[1]) : opaqueHost(parts[1]);
|
|
70
|
+
const port = parsePort(parts[2], protocol);
|
|
71
|
+
if (!PATH.test(path))
|
|
72
|
+
invalid();
|
|
73
|
+
if (path.split('/').some((segment) => DOT_SEGMENT.test(segment)))
|
|
74
|
+
invalid();
|
|
75
|
+
const pathname = special && path === '' ? '/' : path;
|
|
76
|
+
if (query !== undefined && !QUERY.test(query))
|
|
77
|
+
invalid();
|
|
78
|
+
const search = query === undefined ? '' : `?${query}`;
|
|
79
|
+
const host = port === '' ? hostname : `${hostname}:${port}`;
|
|
80
|
+
return {
|
|
81
|
+
href: `${protocol}//${host}${pathname}${search}`,
|
|
82
|
+
protocol,
|
|
83
|
+
hostname,
|
|
84
|
+
port,
|
|
85
|
+
host,
|
|
86
|
+
origin: special ? `${protocol}//${host}` : 'null',
|
|
87
|
+
pathname,
|
|
88
|
+
search,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function specialHost(raw) {
|
|
92
|
+
if (raw.startsWith('['))
|
|
93
|
+
return ipv6Host(raw);
|
|
94
|
+
const host = raw.toLowerCase();
|
|
95
|
+
const labels = host.split('.');
|
|
96
|
+
if (labels.some((label) => !DOMAIN_LABEL.test(label) || label.startsWith('xn--')))
|
|
97
|
+
invalid();
|
|
98
|
+
// WHATWG reads a host whose last label is a number as an IPv4 address.
|
|
99
|
+
if (NUMERIC_LABEL.test(labels[labels.length - 1])) {
|
|
100
|
+
if (labels.length !== 4 || !labels.every((label) => IPV4_PART.test(label) && Number(label) <= 255)) {
|
|
101
|
+
invalid();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return host;
|
|
105
|
+
}
|
|
106
|
+
/** Accept an IPv6 address only in the form that WHATWG serializes. */
|
|
107
|
+
function ipv6Host(raw) {
|
|
108
|
+
const text = raw.slice(1, -1);
|
|
109
|
+
const halves = text.split('::');
|
|
110
|
+
if (halves.length > 2)
|
|
111
|
+
invalid();
|
|
112
|
+
const pieces = (part) => part === ''
|
|
113
|
+
? []
|
|
114
|
+
: part.split(':').map((piece) => (IPV6_PIECE.test(piece) ? Number.parseInt(piece, 16) : invalid()));
|
|
115
|
+
const head = pieces(halves[0]);
|
|
116
|
+
let address = head;
|
|
117
|
+
if (halves.length === 2) {
|
|
118
|
+
const tail = pieces(halves[1]);
|
|
119
|
+
const zeros = 8 - head.length - tail.length;
|
|
120
|
+
if (zeros < 1)
|
|
121
|
+
invalid();
|
|
122
|
+
address = [...head, ...new Array(zeros).fill(0), ...tail];
|
|
123
|
+
}
|
|
124
|
+
if (address.length !== 8 || serializeIpv6(address) !== text)
|
|
125
|
+
invalid();
|
|
126
|
+
return raw;
|
|
127
|
+
}
|
|
128
|
+
function serializeIpv6(address) {
|
|
129
|
+
let compressStart = -1;
|
|
130
|
+
let compressLength = 1;
|
|
131
|
+
for (let index = 0; index < 8;) {
|
|
132
|
+
let end = index;
|
|
133
|
+
while (end < 8 && address[end] === 0)
|
|
134
|
+
end += 1;
|
|
135
|
+
if (end - index > compressLength) {
|
|
136
|
+
compressStart = index;
|
|
137
|
+
compressLength = end - index;
|
|
138
|
+
}
|
|
139
|
+
index = end === index ? index + 1 : end;
|
|
140
|
+
}
|
|
141
|
+
let output = '';
|
|
142
|
+
for (let index = 0; index < 8; index += 1) {
|
|
143
|
+
if (index === compressStart) {
|
|
144
|
+
output += index === 0 ? '::' : ':';
|
|
145
|
+
index += compressLength - 1;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
output += address[index].toString(16);
|
|
149
|
+
if (index !== 7)
|
|
150
|
+
output += ':';
|
|
151
|
+
}
|
|
152
|
+
return output;
|
|
153
|
+
}
|
|
154
|
+
function opaqueHost(raw) {
|
|
155
|
+
return OPAQUE_HOST.test(raw) ? raw : invalid();
|
|
156
|
+
}
|
|
157
|
+
function parsePort(raw, protocol) {
|
|
158
|
+
if (raw === undefined)
|
|
159
|
+
return '';
|
|
160
|
+
if (!PORT.test(raw) || Number(raw) > 65_535)
|
|
161
|
+
invalid();
|
|
162
|
+
return raw === DEFAULT_PORTS[protocol] ? '' : raw;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The values of one query parameter, decoded as WHATWG
|
|
166
|
+
* application/x-www-form-urlencoded. Unlike WHATWG, a name or a value that is
|
|
167
|
+
* not valid UTF-8 or starts with a byte order mark is an error.
|
|
168
|
+
*
|
|
169
|
+
* @throws TypeError when a name or a value does not decode.
|
|
170
|
+
*/
|
|
171
|
+
export function queryValues(url, name) {
|
|
172
|
+
const values = [];
|
|
173
|
+
for (const pair of url.search.slice(1).split('&')) {
|
|
174
|
+
if (pair === '')
|
|
175
|
+
continue;
|
|
176
|
+
const separator = pair.indexOf('=');
|
|
177
|
+
const key = decodeFormComponent(separator === -1 ? pair : pair.slice(0, separator));
|
|
178
|
+
const value = decodeFormComponent(separator === -1 ? '' : pair.slice(separator + 1));
|
|
179
|
+
if (key === name)
|
|
180
|
+
values.push(value);
|
|
181
|
+
}
|
|
182
|
+
return values;
|
|
183
|
+
}
|
|
184
|
+
function decodeFormComponent(text) {
|
|
185
|
+
const bytes = [];
|
|
186
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
187
|
+
const code = text.charCodeAt(index);
|
|
188
|
+
if (code === 0x25) {
|
|
189
|
+
bytes.push(Number.parseInt(text.slice(index + 1, index + 3), 16));
|
|
190
|
+
index += 2;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
bytes.push(code === 0x2b ? 0x20 : code);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf)
|
|
197
|
+
invalid();
|
|
198
|
+
try {
|
|
199
|
+
return utf8Decode(Uint8Array.from(bytes), { fatal: true });
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return invalid();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Serialize query parameters as WHATWG `URLSearchParams.toString()` does,
|
|
207
|
+
* without the leading `?`.
|
|
208
|
+
*/
|
|
209
|
+
export function encodeQuery(entries) {
|
|
210
|
+
return entries
|
|
211
|
+
.map(([name, value]) => `${encodeFormComponent(name)}=${encodeFormComponent(value)}`)
|
|
212
|
+
.join('&');
|
|
213
|
+
}
|
|
214
|
+
function encodeFormComponent(text) {
|
|
215
|
+
return encodeURIComponent(wellFormed(text))
|
|
216
|
+
.replace(/%20/gu, '+')
|
|
217
|
+
.replace(/[!'()~]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
218
|
+
}
|
|
219
|
+
/** Replace each lone surrogate with U+FFFD, as UTF-8 encoding does. */
|
|
220
|
+
function wellFormed(text) {
|
|
221
|
+
let output = '';
|
|
222
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
223
|
+
const code = text.charCodeAt(index);
|
|
224
|
+
if (code >= 0xd800 && code <= 0xdbff) {
|
|
225
|
+
const next = text.charCodeAt(index + 1);
|
|
226
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
227
|
+
output += text.slice(index, index + 2);
|
|
228
|
+
index += 1;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
output += '�';
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
output += code >= 0xdc00 && code <= 0xdfff ? '�' : text[index];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return output;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Resolve a URL reference against an `http` or `https` base URL.
|
|
241
|
+
*
|
|
242
|
+
* The reference can be an absolute URL, a path that starts with `/`, or a
|
|
243
|
+
* relative path. A reference that starts with `//`, `?`, or `#` is an error.
|
|
244
|
+
*
|
|
245
|
+
* @throws TypeError when the reference, the base, or the result is not a form
|
|
246
|
+
* that `parseUrl` accepts.
|
|
247
|
+
*/
|
|
248
|
+
export function resolveUrl(reference, base) {
|
|
249
|
+
if (SCHEME_PREFIX.test(reference))
|
|
250
|
+
return parseUrl(reference).href;
|
|
251
|
+
const baseUrl = parseUrl(base);
|
|
252
|
+
if (baseUrl.protocol !== 'https:' && baseUrl.protocol !== 'http:')
|
|
253
|
+
invalid();
|
|
254
|
+
if (reference === '' || reference.startsWith('//') || reference.startsWith('?'))
|
|
255
|
+
invalid();
|
|
256
|
+
const directory = reference.startsWith('/')
|
|
257
|
+
? ''
|
|
258
|
+
: baseUrl.pathname.slice(0, baseUrl.pathname.lastIndexOf('/') + 1);
|
|
259
|
+
return parseUrl(`${baseUrl.origin}${directory}${reference}`).href;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The WebSocket URL for an `http` or `https` endpoint: `https` becomes `wss`,
|
|
263
|
+
* `http` becomes `ws`, and the query is replaced.
|
|
264
|
+
*
|
|
265
|
+
* @throws TypeError when the endpoint is not an `http` or `https` URL that
|
|
266
|
+
* `parseUrl` accepts.
|
|
267
|
+
*/
|
|
268
|
+
export function websocketUrl(endpoint, query) {
|
|
269
|
+
const url = parseUrl(endpoint);
|
|
270
|
+
const protocol = url.protocol === 'https:' ? 'wss:' : url.protocol === 'http:' ? 'ws:' : invalid();
|
|
271
|
+
const search = encodeQuery(query);
|
|
272
|
+
// http and ws share the default port 80, and https and wss share 443.
|
|
273
|
+
return `${protocol}//${url.host}${url.pathname}${search === '' ? '' : `?${search}`}`;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","s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AAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACrE,OAAO,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,KAA+C;IAE/C,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACnG,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAClC,sEAAsE;IACtE,OAAO,GAAG,QAAQ,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,EAAE,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UTF-8 decoding on every runtime the SDK supports.
|
|
3
|
+
*
|
|
4
|
+
* Bare React Native on Hermes has no guaranteed `TextDecoder`. `utf8Decode`
|
|
5
|
+
* uses the runtime's `TextDecoder` when that decoder passes a WHATWG
|
|
6
|
+
* conformance probe, and the portable decoder below otherwise. Both follow
|
|
7
|
+
* the WHATWG Encoding Standard UTF-8 decoder, so both give the same result for
|
|
8
|
+
* the same bytes:
|
|
9
|
+
*
|
|
10
|
+
* - Each maximal invalid subsequence becomes one U+FFFD, or a `TypeError`
|
|
11
|
+
* when `fatal` is set.
|
|
12
|
+
* - A leading UTF-8 byte order mark is removed, as `TextDecoder` removes it by
|
|
13
|
+
* default.
|
|
14
|
+
*/
|
|
15
|
+
export interface Utf8DecodeOptions {
|
|
16
|
+
/** Throw a `TypeError` on invalid UTF-8 instead of writing U+FFFD. */
|
|
17
|
+
readonly fatal?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Decode UTF-8 bytes with the runtime's `TextDecoder`, or the portable decoder. */
|
|
20
|
+
export declare function utf8Decode(bytes: Uint8Array, options?: Utf8DecodeOptions): string;
|
|
21
|
+
/**
|
|
22
|
+
* The WHATWG Encoding Standard UTF-8 decoder in plain JavaScript.
|
|
23
|
+
*
|
|
24
|
+
* Exported so that tests can run it beside the runtime's `TextDecoder`.
|
|
25
|
+
* Production code calls `utf8Decode`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function utf8DecodePortable(bytes: Uint8Array, options?: Utf8DecodeOptions): string;
|
|
28
|
+
//# sourceMappingURL=utf8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../../internal/platform/utf8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAuDD,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAUrF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CA2E7F"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UTF-8 decoding on every runtime the SDK supports.
|
|
3
|
+
*
|
|
4
|
+
* Bare React Native on Hermes has no guaranteed `TextDecoder`. `utf8Decode`
|
|
5
|
+
* uses the runtime's `TextDecoder` when that decoder passes a WHATWG
|
|
6
|
+
* conformance probe, and the portable decoder below otherwise. Both follow
|
|
7
|
+
* the WHATWG Encoding Standard UTF-8 decoder, so both give the same result for
|
|
8
|
+
* the same bytes:
|
|
9
|
+
*
|
|
10
|
+
* - Each maximal invalid subsequence becomes one U+FFFD, or a `TypeError`
|
|
11
|
+
* when `fatal` is set.
|
|
12
|
+
* - A leading UTF-8 byte order mark is removed, as `TextDecoder` removes it by
|
|
13
|
+
* default.
|
|
14
|
+
*/
|
|
15
|
+
const INVALID_UTF8 = 'The encoded data is not valid UTF-8';
|
|
16
|
+
const REPLACEMENT = 0xfffd;
|
|
17
|
+
const CHUNK = 0x2000;
|
|
18
|
+
let checkedConstructor;
|
|
19
|
+
let nativeLenient;
|
|
20
|
+
let nativeFatal;
|
|
21
|
+
/**
|
|
22
|
+
* Does the runtime's decoder replace, reject, and strip the BOM as WHATWG
|
|
23
|
+
* says? A polyfill that ignores `fatal` or keeps the BOM would silently change
|
|
24
|
+
* what the SDK accepts, so the portable decoder replaces it.
|
|
25
|
+
*/
|
|
26
|
+
function probeNativeDecoders(Constructor) {
|
|
27
|
+
checkedConstructor = Constructor;
|
|
28
|
+
nativeLenient = undefined;
|
|
29
|
+
nativeFatal = undefined;
|
|
30
|
+
try {
|
|
31
|
+
const lenient = new Constructor('utf-8');
|
|
32
|
+
const fatal = new Constructor('utf-8', { fatal: true });
|
|
33
|
+
const sample = new Uint8Array([0xef, 0xbb, 0xbf, 0x41, 0xf0, 0x9f, 0x98, 0x80, 0xed, 0xa0, 0x80]);
|
|
34
|
+
if (lenient.decode(sample) !== 'A\u{1f600}���')
|
|
35
|
+
return;
|
|
36
|
+
if (fatal.decode(sample.subarray(0, 8)) !== 'A\u{1f600}')
|
|
37
|
+
return;
|
|
38
|
+
try {
|
|
39
|
+
fatal.decode(sample);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// A conforming fatal decoder throws here.
|
|
44
|
+
}
|
|
45
|
+
nativeLenient = lenient;
|
|
46
|
+
nativeFatal = fatal;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
nativeLenient = undefined;
|
|
50
|
+
nativeFatal = undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function nativeDecoder(fatal) {
|
|
54
|
+
const Constructor = globalThis.TextDecoder;
|
|
55
|
+
if (typeof Constructor !== 'function')
|
|
56
|
+
return undefined;
|
|
57
|
+
if (Constructor !== checkedConstructor)
|
|
58
|
+
probeNativeDecoders(Constructor);
|
|
59
|
+
return fatal ? nativeFatal : nativeLenient;
|
|
60
|
+
}
|
|
61
|
+
/** Decode UTF-8 bytes with the runtime's `TextDecoder`, or the portable decoder. */
|
|
62
|
+
export function utf8Decode(bytes, options = {}) {
|
|
63
|
+
const fatal = options.fatal === true;
|
|
64
|
+
const decoder = nativeDecoder(fatal);
|
|
65
|
+
if (!decoder)
|
|
66
|
+
return utf8DecodePortable(bytes, options);
|
|
67
|
+
if (!fatal)
|
|
68
|
+
return decoder.decode(bytes);
|
|
69
|
+
try {
|
|
70
|
+
return decoder.decode(bytes);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
throw new TypeError(INVALID_UTF8);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The WHATWG Encoding Standard UTF-8 decoder in plain JavaScript.
|
|
78
|
+
*
|
|
79
|
+
* Exported so that tests can run it beside the runtime's `TextDecoder`.
|
|
80
|
+
* Production code calls `utf8Decode`.
|
|
81
|
+
*/
|
|
82
|
+
export function utf8DecodePortable(bytes, options = {}) {
|
|
83
|
+
const fatal = options.fatal === true;
|
|
84
|
+
const start = bytes.length >= 3 && bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf ? 3 : 0;
|
|
85
|
+
let output = '';
|
|
86
|
+
const units = [];
|
|
87
|
+
const emit = (codePoint) => {
|
|
88
|
+
if (codePoint > 0xffff) {
|
|
89
|
+
const offset = codePoint - 0x10000;
|
|
90
|
+
units.push(0xd800 | (offset >> 10), 0xdc00 | (offset & 0x3ff));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
units.push(codePoint);
|
|
94
|
+
}
|
|
95
|
+
if (units.length >= CHUNK) {
|
|
96
|
+
output += String.fromCharCode(...units);
|
|
97
|
+
units.length = 0;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const invalid = () => {
|
|
101
|
+
if (fatal)
|
|
102
|
+
throw new TypeError(INVALID_UTF8);
|
|
103
|
+
emit(REPLACEMENT);
|
|
104
|
+
};
|
|
105
|
+
let codePoint = 0;
|
|
106
|
+
let needed = 0;
|
|
107
|
+
let seen = 0;
|
|
108
|
+
let lower = 0x80;
|
|
109
|
+
let upper = 0xbf;
|
|
110
|
+
for (let index = start; index < bytes.length; index += 1) {
|
|
111
|
+
const byte = bytes[index];
|
|
112
|
+
if (needed === 0) {
|
|
113
|
+
if (byte <= 0x7f) {
|
|
114
|
+
emit(byte);
|
|
115
|
+
}
|
|
116
|
+
else if (byte >= 0xc2 && byte <= 0xdf) {
|
|
117
|
+
needed = 1;
|
|
118
|
+
codePoint = byte & 0x1f;
|
|
119
|
+
}
|
|
120
|
+
else if (byte >= 0xe0 && byte <= 0xef) {
|
|
121
|
+
if (byte === 0xe0)
|
|
122
|
+
lower = 0xa0;
|
|
123
|
+
if (byte === 0xed)
|
|
124
|
+
upper = 0x9f;
|
|
125
|
+
needed = 2;
|
|
126
|
+
codePoint = byte & 0x0f;
|
|
127
|
+
}
|
|
128
|
+
else if (byte >= 0xf0 && byte <= 0xf4) {
|
|
129
|
+
if (byte === 0xf0)
|
|
130
|
+
lower = 0x90;
|
|
131
|
+
if (byte === 0xf4)
|
|
132
|
+
upper = 0x8f;
|
|
133
|
+
needed = 3;
|
|
134
|
+
codePoint = byte & 0x07;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
invalid();
|
|
138
|
+
}
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (byte < lower || byte > upper) {
|
|
142
|
+
// The byte ends the invalid sequence and starts the next one.
|
|
143
|
+
codePoint = 0;
|
|
144
|
+
needed = 0;
|
|
145
|
+
seen = 0;
|
|
146
|
+
lower = 0x80;
|
|
147
|
+
upper = 0xbf;
|
|
148
|
+
invalid();
|
|
149
|
+
index -= 1;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
lower = 0x80;
|
|
153
|
+
upper = 0xbf;
|
|
154
|
+
codePoint = (codePoint << 6) | (byte & 0x3f);
|
|
155
|
+
seen += 1;
|
|
156
|
+
if (seen === needed) {
|
|
157
|
+
emit(codePoint);
|
|
158
|
+
codePoint = 0;
|
|
159
|
+
needed = 0;
|
|
160
|
+
seen = 0;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (needed !== 0)
|
|
164
|
+
invalid();
|
|
165
|
+
return units.length > 0 ? output + String.fromCharCode(...units) : output;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=utf8.js.map
|