@open-e2ee/signal-protocol-sdk 0.2.2 → 0.3.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 +4 -4
- package/ARCHITECTURE.md +17 -16
- package/CHANGELOG.md +49 -0
- package/COMMERCIAL.md +6 -6
- package/NOTICE +1 -1
- package/README.md +44 -34
- package/SECURITY.md +16 -13
- package/TROUBLESHOOTING.md +5 -5
- package/blocking/README.md +6 -5
- package/client/README.md +5 -5
- package/device/README.md +8 -8
- package/dist/blocking/types.d.ts +2 -2
- package/dist/blocking/types.js +2 -2
- package/dist/client/client.d.ts +46 -45
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +61 -60
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +32 -32
- package/dist/client/constants.d.ts +7 -6
- package/dist/client/constants.d.ts.map +1 -1
- package/dist/client/constants.js +5 -4
- package/dist/client/constants.js.map +1 -1
- package/dist/client/dual-store.d.ts +2 -2
- package/dist/client/dual-store.js +2 -2
- package/dist/client/endorsement-manager.d.ts +14 -14
- package/dist/client/endorsement-manager.d.ts.map +1 -1
- package/dist/client/endorsement-manager.js +15 -15
- package/dist/client/endorsement-manager.js.map +1 -1
- package/dist/client/event-hooks.d.ts +16 -16
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +1 -1
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/files.js +4 -4
- package/dist/client/files.js.map +1 -1
- package/dist/client/headless.d.ts +7 -7
- package/dist/client/headless.d.ts.map +1 -1
- package/dist/client/headless.js +4 -4
- package/dist/client/key-rotation-core.d.ts +19 -17
- package/dist/client/key-rotation-core.d.ts.map +1 -1
- package/dist/client/key-rotation-core.js +35 -31
- package/dist/client/key-rotation-core.js.map +1 -1
- package/dist/client/key-rotation.d.ts +8 -8
- package/dist/client/key-rotation.js +8 -8
- package/dist/client/media.d.ts +1 -1
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +13 -11
- package/dist/client/messages.js.map +1 -1
- package/dist/client/multi-device.d.ts +5 -4
- package/dist/client/multi-device.d.ts.map +1 -1
- package/dist/client/multi-device.js.map +1 -1
- package/dist/client/prekeys.d.ts +7 -7
- package/dist/client/prekeys.js +10 -10
- package/dist/client/prekeys.js.map +1 -1
- package/dist/client/relay-subscription.d.ts +3 -0
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +7 -4
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/retry-utils.d.ts +5 -6
- package/dist/client/retry-utils.d.ts.map +1 -1
- package/dist/client/retry-utils.js +5 -12
- package/dist/client/retry-utils.js.map +1 -1
- package/dist/client/retry.js +7 -7
- package/dist/client/retry.js.map +1 -1
- package/dist/client/sealed-sender-ops.d.ts +3 -3
- package/dist/client/sealed-sender-ops.js +5 -5
- package/dist/client/sealed-sender-ops.js.map +1 -1
- package/dist/client/sessions.d.ts +2 -2
- package/dist/client/sessions.js +2 -2
- package/dist/client/signal-service-cipher.d.ts +9 -9
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +41 -40
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/state.d.ts +1 -1
- package/dist/client/state.js +1 -1
- package/dist/client/types.d.ts +19 -19
- package/dist/client/types.d.ts.map +1 -1
- package/dist/device/connection.d.ts +1 -1
- package/dist/device/connection.js +2 -2
- package/dist/device/connection.js.map +1 -1
- package/dist/device/constants.d.ts +4 -4
- package/dist/device/constants.js +3 -3
- package/dist/device/device-id.d.ts +4 -4
- package/dist/device/device-id.js +4 -4
- package/dist/device/expo-metadata.d.ts +13 -11
- package/dist/device/expo-metadata.d.ts.map +1 -1
- package/dist/device/expo-metadata.js +13 -11
- package/dist/device/expo-metadata.js.map +1 -1
- package/dist/device/lifecycle/manager.d.ts +6 -6
- package/dist/device/lifecycle/manager.js +7 -7
- package/dist/device/lifecycle/types.d.ts +13 -13
- package/dist/device/lifecycle/types.d.ts.map +1 -1
- package/dist/device/lifecycle/utils.d.ts +2 -2
- package/dist/device/lifecycle/utils.js +5 -5
- package/dist/device/lifecycle/utils.js.map +1 -1
- package/dist/device/provisioning.d.ts +5 -4
- package/dist/device/provisioning.d.ts.map +1 -1
- package/dist/device/provisioning.js +5 -4
- package/dist/device/provisioning.js.map +1 -1
- package/dist/device/transfer.d.ts +2 -2
- package/dist/device/transfer.js +3 -3
- package/dist/device/transfer.js.map +1 -1
- package/dist/encoding/index.d.ts +3 -4
- package/dist/encoding/index.d.ts.map +1 -1
- package/dist/encoding/index.js.map +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/files/index.js +1 -1
- package/dist/hooks/use-connection-presence.d.ts +1 -1
- package/dist/hooks/use-connection-presence.js +7 -7
- package/dist/hooks/use-connection-presence.js.map +1 -1
- package/dist/hooks/use-group-membership.d.ts +2 -2
- package/dist/hooks/use-group-membership.d.ts.map +1 -1
- package/dist/hooks/use-group-membership.js +6 -6
- package/dist/hooks/use-group-membership.js.map +1 -1
- package/dist/hooks/use-key-rotation.js +3 -3
- package/dist/hooks/use-key-rotation.js.map +1 -1
- package/dist/hooks/use-single-flight.d.ts +2 -2
- package/dist/hooks/use-single-flight.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/crypto/ec/ed25519.d.ts +6 -6
- package/dist/internal/crypto/ec/ed25519.js +6 -6
- package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -1
- package/dist/internal/crypto/ec/x25519-validation.js +4 -2
- package/dist/internal/crypto/ec/x25519-validation.js.map +1 -1
- package/dist/internal/crypto/index.d.ts +2 -0
- package/dist/internal/crypto/index.d.ts.map +1 -1
- package/dist/internal/crypto/index.js +2 -0
- package/dist/internal/crypto/index.js.map +1 -1
- package/dist/internal/crypto/kdf/hkdf.d.ts +9 -8
- package/dist/internal/crypto/kdf/hkdf.d.ts.map +1 -1
- package/dist/internal/crypto/kdf/hkdf.js +11 -10
- package/dist/internal/crypto/kdf/hkdf.js.map +1 -1
- package/dist/internal/crypto/key-prefix.d.ts +3 -3
- package/dist/internal/crypto/key-prefix.js +3 -3
- package/dist/internal/crypto/pq/kyber.d.ts +7 -7
- package/dist/internal/crypto/pq/kyber.js +10 -10
- package/dist/internal/crypto/pq/kyber.js.map +1 -1
- package/dist/internal/crypto/random.d.ts +1 -1
- package/dist/internal/crypto/random.js +1 -1
- package/dist/internal/crypto/symmetric/aes-gcm-siv.js +1 -1
- package/dist/internal/crypto/symmetric/aes.js +4 -4
- package/dist/internal/crypto/symmetric/aes.js.map +1 -1
- package/dist/internal/crypto/symmetric/mac.d.ts +1 -1
- package/dist/internal/crypto/symmetric/mac.js +3 -3
- package/dist/internal/crypto/symmetric/padding.js +1 -1
- package/dist/internal/crypto/symmetric/padding.js.map +1 -1
- package/dist/internal/crypto/symmetric/streaming-aead.d.ts +7 -1
- package/dist/internal/crypto/symmetric/streaming-aead.d.ts.map +1 -1
- package/dist/internal/crypto/symmetric/streaming-aead.js +10 -4
- package/dist/internal/crypto/symmetric/streaming-aead.js.map +1 -1
- package/dist/internal/crypto/utils.d.ts +2 -2
- package/dist/internal/crypto/utils.d.ts.map +1 -1
- package/dist/internal/crypto/utils.js +16 -14
- package/dist/internal/crypto/utils.js.map +1 -1
- package/dist/internal/crypto/validation.d.ts +4 -4
- package/dist/internal/crypto/validation.js +2 -2
- package/dist/internal/encoding/proto/envelope.d.ts +1 -1
- package/dist/internal/encoding/proto/envelope.js +1 -1
- package/dist/internal/encoding/proto/index.d.ts +4 -4
- package/dist/internal/encoding/proto/index.js +4 -4
- package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts +28 -16
- package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts.map +1 -1
- package/dist/internal/encoding/proto/pq-ratchet-serialize.js +30 -18
- package/dist/internal/encoding/proto/pq-ratchet-serialize.js.map +1 -1
- package/dist/internal/encoding/proto/primitives.d.ts +45 -35
- package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
- package/dist/internal/encoding/proto/primitives.js +54 -43
- package/dist/internal/encoding/proto/primitives.js.map +1 -1
- package/dist/internal/encoding/proto/sender-key-message.d.ts +2 -2
- package/dist/internal/encoding/proto/sender-key-message.js +2 -2
- package/dist/internal/encoding/proto/signal-message.d.ts +13 -13
- package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
- package/dist/internal/encoding/proto/signal-message.js +13 -13
- package/dist/internal/encoding/proto/signal-message.js.map +1 -1
- package/dist/internal/groups/access-control.d.ts +5 -5
- package/dist/internal/groups/access-control.js +6 -6
- package/dist/internal/groups/access-control.js.map +1 -1
- package/dist/internal/groups/change-actions.d.ts +4 -4
- package/dist/internal/groups/change-actions.js +3 -3
- package/dist/internal/groups/encrypted-state.js +1 -1
- package/dist/internal/groups/encrypted-state.js.map +1 -1
- package/dist/internal/groups/group-id.d.ts +1 -1
- package/dist/internal/groups/manager.d.ts +24 -23
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +40 -36
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/server-engine.d.ts +29 -21
- package/dist/internal/groups/server-engine.d.ts.map +1 -1
- package/dist/internal/groups/server-engine.js +55 -50
- package/dist/internal/groups/server-engine.js.map +1 -1
- package/dist/internal/groups/trust-root.d.ts +2 -2
- package/dist/internal/groups/trust-root.js +2 -2
- package/dist/internal/groups/types.d.ts +4 -4
- package/dist/internal/groups/types.d.ts.map +1 -1
- package/dist/internal/groups/wire.d.ts +6 -7
- package/dist/internal/groups/wire.d.ts.map +1 -1
- package/dist/internal/groups/wire.js +6 -7
- package/dist/internal/groups/wire.js.map +1 -1
- package/dist/internal/manager/manager.d.ts +14 -12
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +47 -41
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/chains.d.ts +8 -6
- package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -1
- package/dist/internal/protocol/double-ratchet/chains.js +10 -8
- package/dist/internal/protocol/double-ratchet/chains.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/index.d.ts +2 -2
- package/dist/internal/protocol/double-ratchet/index.js +2 -2
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts +4 -4
- package/dist/internal/protocol/double-ratchet/ratchet.js +6 -6
- package/dist/internal/protocol/pqxdh/pqxdh.d.ts +21 -18
- package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -1
- package/dist/internal/protocol/pqxdh/pqxdh.js +48 -42
- package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/decryption-v2.js +5 -5
- package/dist/internal/protocol/sealed-sender/decryption-v2.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/decryption.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/decryption.js +11 -8
- package/dist/internal/protocol/sealed-sender/decryption.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/delivery-token.d.ts +2 -2
- package/dist/internal/protocol/sealed-sender/delivery-token.js +2 -2
- package/dist/internal/protocol/sealed-sender/encryption-v2.js +1 -1
- package/dist/internal/protocol/sealed-sender/encryption-v2.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/encryption.d.ts +2 -2
- package/dist/internal/protocol/sealed-sender/encryption.js +2 -2
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +25 -23
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +32 -30
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts +10 -9
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/trust-root.js +10 -9
- package/dist/internal/protocol/sealed-sender/trust-root.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.d.ts +13 -14
- package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.js +7 -8
- package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/v2-binary.d.ts +1 -1
- package/dist/internal/protocol/sealed-sender/v2-binary.js +2 -2
- package/dist/internal/protocol/sealed-sender/v2-binary.js.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts +16 -14
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +37 -34
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/protocol/spqr/braid-serialize.d.ts +6 -6
- package/dist/internal/protocol/spqr/braid-serialize.js +5 -5
- package/dist/internal/protocol/spqr/braid-serialize.js.map +1 -1
- package/dist/internal/protocol/spqr/braid.d.ts +3 -3
- package/dist/internal/protocol/spqr/braid.js +7 -7
- package/dist/internal/protocol/spqr/braid.js.map +1 -1
- package/dist/internal/protocol/spqr/index.js +1 -1
- package/dist/internal/protocol/spqr/index.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.d.ts +3 -3
- package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.js +3 -3
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.d.ts +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.js +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.d.ts +4 -3
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.js +4 -3
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js +2 -2
- package/dist/internal/protocol/spqr/ml-kem-braid/progress.d.ts +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/progress.js +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts +15 -7
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js +15 -7
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.js +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.d.ts +3 -3
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.js +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts +7 -7
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js +11 -11
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +6 -6
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +2 -2
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/types.js.map +1 -1
- package/dist/internal/protocol/spqr/serialize.d.ts +12 -12
- package/dist/internal/protocol/spqr/serialize.js +5 -5
- package/dist/internal/protocol/spqr/spqr.d.ts +6 -6
- package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/spqr.js +47 -42
- package/dist/internal/protocol/spqr/spqr.js.map +1 -1
- package/dist/internal/protocol/spqr/validate.d.ts +1 -1
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +12 -12
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +1 -1
- package/dist/internal/protocol/triple-ratchet/ratchet.js +11 -11
- package/dist/internal/protocol/triple-ratchet/ratchet.js.map +1 -1
- package/dist/internal/protocol/username/hash.d.ts.map +1 -1
- package/dist/internal/protocol/username/hash.js +6 -4
- package/dist/internal/protocol/username/hash.js.map +1 -1
- package/dist/internal/protocol/version.d.ts +3 -3
- package/dist/internal/protocol/version.js +1 -1
- package/dist/internal/protocol/x3dh/x3dh.d.ts +16 -16
- package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -1
- package/dist/internal/protocol/x3dh/x3dh.js +15 -15
- package/dist/internal/protocol/x3dh/x3dh.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/attributes.d.ts +7 -7
- package/dist/internal/protocol/zk/credentials/attributes.js +7 -7
- package/dist/internal/protocol/zk/credentials/credentials.d.ts +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.js +1 -1
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts +11 -11
- package/dist/internal/protocol/zk/credentials/endorsements.js +14 -14
- package/dist/internal/protocol/zk/credentials/issuance.d.ts +5 -1
- package/dist/internal/protocol/zk/credentials/issuance.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/issuance.js +5 -1
- package/dist/internal/protocol/zk/credentials/issuance.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.d.ts +16 -16
- package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.js +18 -18
- package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -1
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts +22 -16
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/auth-credential.js +19 -14
- package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -1
- package/dist/internal/protocol/zk/groups/client-zk-group-cipher.d.ts +4 -4
- package/dist/internal/protocol/zk/groups/client-zk-group-cipher.js +4 -4
- package/dist/internal/protocol/zk/groups/group-params.d.ts +2 -2
- package/dist/internal/protocol/zk/groups/group-params.js +2 -2
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts +10 -9
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js +9 -8
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js.map +1 -1
- package/dist/internal/protocol/zk/groups/lizard.d.ts +1 -1
- package/dist/internal/protocol/zk/groups/lizard.js +4 -4
- package/dist/internal/protocol/zk/groups/lizard.js.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-commitment.d.ts +3 -3
- package/dist/internal/protocol/zk/groups/profile-key-commitment.js +3 -3
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +11 -11
- package/dist/internal/protocol/zk/groups/profile-key-credential.js +7 -7
- package/dist/internal/protocol/zk/groups/profile-key-encryption.d.ts +2 -2
- package/dist/internal/protocol/zk/groups/profile-key-encryption.js +2 -2
- package/dist/internal/protocol/zk/groups/profile-key-struct.d.ts +2 -2
- package/dist/internal/protocol/zk/groups/profile-key-struct.js +2 -2
- package/dist/internal/protocol/zk/groups/profile-key-version.d.ts +2 -2
- package/dist/internal/protocol/zk/groups/profile-key-version.js +2 -2
- package/dist/internal/protocol/zk/groups/server-params.d.ts +1 -1
- package/dist/internal/protocol/zk/groups/server-params.js +1 -1
- package/dist/internal/protocol/zk/groups/uid-encryption.d.ts +4 -4
- package/dist/internal/protocol/zk/groups/uid-encryption.js +4 -4
- package/dist/internal/protocol/zk/groups/uid-struct.d.ts +2 -2
- package/dist/internal/protocol/zk/groups/uid-struct.js +3 -3
- package/dist/internal/protocol/zk/groups/uid-struct.js.map +1 -1
- package/dist/internal/protocol/zk/proofs/args.d.ts +3 -3
- package/dist/internal/protocol/zk/proofs/args.js +3 -3
- package/dist/internal/protocol/zk/proofs/sho-sha256.d.ts +3 -3
- package/dist/internal/protocol/zk/proofs/sho-sha256.js +3 -3
- package/dist/internal/protocol/zk/proofs/sho.d.ts +8 -7
- package/dist/internal/protocol/zk/proofs/sho.d.ts.map +1 -1
- package/dist/internal/protocol/zk/proofs/sho.js +8 -7
- package/dist/internal/protocol/zk/proofs/sho.js.map +1 -1
- package/dist/internal/protocol/zk/proofs/statement.d.ts +8 -6
- package/dist/internal/protocol/zk/proofs/statement.d.ts.map +1 -1
- package/dist/internal/protocol/zk/proofs/statement.js +8 -6
- package/dist/internal/protocol/zk/proofs/statement.js.map +1 -1
- package/dist/internal/sesame/manager.d.ts +23 -19
- package/dist/internal/sesame/manager.d.ts.map +1 -1
- package/dist/internal/sesame/manager.js +64 -54
- package/dist/internal/sesame/manager.js.map +1 -1
- package/dist/internal/sesame/types.d.ts +28 -25
- package/dist/internal/sesame/types.d.ts.map +1 -1
- package/dist/internal/sesame/types.js +2 -2
- package/dist/internal/sesame/types.js.map +1 -1
- package/dist/internal/sesame/validation.d.ts +2 -2
- package/dist/internal/sesame/validation.js +3 -3
- package/dist/internal/sesame/validation.js.map +1 -1
- package/dist/internal/session/builder.d.ts +8 -8
- package/dist/internal/session/builder.js +22 -22
- package/dist/internal/session/builder.js.map +1 -1
- package/dist/internal/session/cipher.d.ts +3 -3
- package/dist/internal/session/cipher.d.ts.map +1 -1
- package/dist/internal/session/cipher.js +51 -40
- package/dist/internal/session/cipher.js.map +1 -1
- package/dist/internal/session/decryption.js +11 -9
- package/dist/internal/session/decryption.js.map +1 -1
- package/dist/internal/session/factory.js +1 -1
- package/dist/internal/session/factory.js.map +1 -1
- package/dist/internal/session/handshake.d.ts +4 -4
- package/dist/internal/session/handshake.js +4 -4
- package/dist/internal/session/keys.d.ts +3 -4
- package/dist/internal/session/keys.d.ts.map +1 -1
- package/dist/internal/session/keys.js.map +1 -1
- package/dist/internal/session/ratchet.d.ts +8 -8
- package/dist/internal/session/ratchet.js +10 -10
- package/dist/internal/session/ratchet.js.map +1 -1
- package/dist/internal/session/session-resolver.d.ts +6 -6
- package/dist/internal/session/session-resolver.js +6 -6
- package/dist/internal/session/state.d.ts +12 -12
- package/dist/internal/session/state.d.ts.map +1 -1
- package/dist/internal/session/state.js +7 -7
- package/dist/internal/session/types.d.ts +20 -20
- package/dist/internal/session/types.d.ts.map +1 -1
- package/dist/internal/session/types.js +3 -3
- package/dist/internal/session/validation.d.ts +1 -1
- package/dist/internal/session/validation.js +4 -4
- package/dist/internal/session/validation.js.map +1 -1
- package/dist/keys/branded.d.ts +12 -12
- package/dist/keys/branded.js +3 -3
- package/dist/keys/generation.d.ts +4 -4
- package/dist/keys/generation.js +4 -4
- package/dist/keys/identity.d.ts +7 -7
- package/dist/keys/identity.d.ts.map +1 -1
- package/dist/keys/identity.js +7 -7
- package/dist/keys/identity.js.map +1 -1
- package/dist/keys/types.d.ts +16 -16
- package/dist/keys/types.d.ts.map +1 -1
- package/dist/layers.d.ts +1 -1
- package/dist/layers.js +1 -1
- package/dist/local/store/expo/adapter.d.ts +8 -8
- package/dist/local/store/expo/adapter.js +10 -10
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/expo/database-key.d.ts +7 -7
- package/dist/local/store/expo/database-key.js +7 -7
- package/dist/local/store/expo/key-storage.d.ts +1 -1
- package/dist/local/store/expo/key-storage.js +4 -4
- package/dist/local/store/expo/key-storage.js.map +1 -1
- package/dist/local/store/expo/models/kyber-prekey-used.d.ts +6 -6
- package/dist/local/store/expo/models/kyber-prekey-used.js +3 -3
- package/dist/local/store/expo/models/kyber-prekey.d.ts +1 -1
- package/dist/local/store/expo/models/kyber-prekey.js +1 -1
- package/dist/local/store/expo/models/message-record.d.ts +2 -2
- package/dist/local/store/expo/models/message-record.d.ts.map +1 -1
- package/dist/local/store/expo/models/message-record.js +1 -1
- package/dist/local/store/expo/models/message-record.js.map +1 -1
- package/dist/local/store/expo/models/sender-key.d.ts +11 -10
- package/dist/local/store/expo/models/sender-key.d.ts.map +1 -1
- package/dist/local/store/expo/models/sender-key.js +11 -10
- package/dist/local/store/expo/models/sender-key.js.map +1 -1
- package/dist/local/store/expo/schema.d.ts +2 -2
- package/dist/local/store/expo/schema.js +2 -2
- package/dist/local/store/expo/secure-store-options.d.ts +1 -1
- package/dist/local/store/memory/adapter.d.ts +2 -2
- package/dist/local/store/memory/adapter.js +12 -12
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/node/adapter.d.ts.map +1 -1
- package/dist/local/store/node/adapter.js +5 -4
- package/dist/local/store/node/adapter.js.map +1 -1
- package/dist/local/store/node/database-key.d.ts +8 -8
- package/dist/local/store/node/database-key.js +10 -10
- package/dist/local/store/node/database-key.js.map +1 -1
- package/dist/local/store/node/database.d.ts +5 -5
- package/dist/local/store/node/database.js +11 -11
- package/dist/local/store/node/database.js.map +1 -1
- package/dist/local/store/react-native/adapter.d.ts +6 -6
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +35 -32
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/react-native/backend-conformance.d.ts +11 -10
- package/dist/local/store/react-native/backend-conformance.d.ts.map +1 -1
- package/dist/local/store/react-native/backend-conformance.js +13 -12
- package/dist/local/store/react-native/backend-conformance.js.map +1 -1
- package/dist/local/store/react-native/index.d.ts +1 -1
- package/dist/local/store/react-native/reference-backend.d.ts +14 -13
- package/dist/local/store/react-native/reference-backend.d.ts.map +1 -1
- package/dist/local/store/react-native/reference-backend.js +15 -14
- package/dist/local/store/react-native/reference-backend.js.map +1 -1
- package/dist/local/store/react-native/storage.d.ts +3 -3
- package/dist/local/store/web/adapter.d.ts +3 -3
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +30 -31
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/local/store/web/index.d.ts +1 -1
- package/dist/local/vault/index.d.ts +2 -2
- package/dist/media/index.d.ts +11 -11
- package/dist/media/index.js +9 -9
- package/dist/profile/contact-state.d.ts +1 -1
- package/dist/profile/contact-state.js +1 -1
- package/dist/profile/profile-key.d.ts +2 -2
- package/dist/profile/profile-key.js +7 -6
- package/dist/profile/profile-key.js.map +1 -1
- package/dist/remote/object-store/index.d.ts +1 -1
- package/dist/remote/object-store/s3/storage.d.ts +1 -1
- package/dist/remote/object-store/types.d.ts +4 -4
- package/dist/remote/object-store/types.d.ts.map +1 -1
- package/dist/remote/relay/convex/backend.d.ts +4 -4
- package/dist/remote/relay/convex/backend.js +3 -3
- package/dist/remote/relay/convex/backend.js.map +1 -1
- package/dist/remote/relay/convex/component/accounts.d.ts +15 -13
- package/dist/remote/relay/convex/component/accounts.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/accounts.js +31 -28
- package/dist/remote/relay/convex/component/accounts.js.map +1 -1
- package/dist/remote/relay/convex/component/certificates.js +1 -1
- package/dist/remote/relay/convex/component/cleanup.js +7 -7
- package/dist/remote/relay/convex/component/cleanup.js.map +1 -1
- package/dist/remote/relay/convex/component/convex.config.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/convex.config.js +10 -8
- package/dist/remote/relay/convex/component/convex.config.js.map +1 -1
- package/dist/remote/relay/convex/component/devices.d.ts +21 -20
- package/dist/remote/relay/convex/component/devices.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/devices.js +24 -23
- package/dist/remote/relay/convex/component/devices.js.map +1 -1
- package/dist/remote/relay/convex/component/groups.js +6 -6
- package/dist/remote/relay/convex/component/groups.js.map +1 -1
- package/dist/remote/relay/convex/component/messages.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/messages.js +89 -82
- package/dist/remote/relay/convex/component/messages.js.map +1 -1
- package/dist/remote/relay/convex/component/provisioning.d.ts +3 -3
- package/dist/remote/relay/convex/component/provisioning.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/provisioning.js +17 -16
- package/dist/remote/relay/convex/component/provisioning.js.map +1 -1
- package/dist/remote/relay/convex/component/runtime.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/runtime.js +4 -2
- package/dist/remote/relay/convex/component/runtime.js.map +1 -1
- package/dist/remote/relay/convex/component/schema.js +25 -24
- package/dist/remote/relay/convex/component/schema.js.map +1 -1
- package/dist/remote/relay/convex/group-server.d.ts +3 -3
- package/dist/remote/relay/convex/group-server.js +3 -3
- package/dist/remote/relay/convex/relay.d.ts +3 -3
- package/dist/remote/relay/convex/relay.d.ts.map +1 -1
- package/dist/remote/relay/convex/relay.js +18 -17
- package/dist/remote/relay/convex/relay.js.map +1 -1
- package/dist/remote/relay/convex/types.d.ts +7 -7
- package/dist/remote/relay/convex/types.js +4 -4
- package/dist/remote/relay/memory/adapter.js +9 -9
- package/dist/remote/relay/memory/adapter.js.map +1 -1
- package/dist/remote/relay/types.d.ts +27 -27
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/safety/fingerprint.d.ts +7 -6
- package/dist/safety/fingerprint.d.ts.map +1 -1
- package/dist/safety/fingerprint.js +5 -4
- package/dist/safety/fingerprint.js.map +1 -1
- package/dist/safety/index.d.ts +6 -5
- package/dist/safety/index.d.ts.map +1 -1
- package/dist/safety/index.js +7 -6
- package/dist/safety/index.js.map +1 -1
- package/dist/safety/protobuf.js +2 -2
- package/dist/safety/protobuf.js.map +1 -1
- package/dist/safety/url.d.ts +5 -5
- package/dist/safety/url.js +6 -6
- package/dist/types/address.d.ts +2 -2
- package/dist/types/address.js +2 -2
- package/dist/types/api.d.ts +78 -73
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +63 -403
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +62 -537
- package/dist/types/errors.js.map +1 -1
- package/dist/types/messages.d.ts +16 -16
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/messages.js +7 -7
- package/dist/types/messages.js.map +1 -1
- package/dist/types/protocol-config.d.ts +52 -49
- package/dist/types/protocol-config.d.ts.map +1 -1
- package/dist/types/protocol-config.js +36 -34
- package/dist/types/protocol-config.js.map +1 -1
- package/dist/types/protocol-constants.d.ts +2 -2
- package/dist/types/protocol-constants.js +2 -2
- package/dist/types/session.d.ts +62 -61
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js +13 -14
- package/dist/types/session.js.map +1 -1
- package/dist/types/trust.d.ts +8 -8
- package/dist/types/trust.js +3 -3
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +2 -4
- package/dist/utils/retry.js.map +1 -1
- package/docs/ASSURANCE.md +82 -74
- package/docs/CLIENT_COMPOSITION.md +19 -15
- package/docs/DEVIATIONS.md +507 -425
- package/docs/DOCUMENTATION_STANDARDS.md +24 -24
- package/docs/E2EE.md +45 -42
- package/docs/ERROR_HANDLING.md +29 -105
- package/docs/GETTING_STARTED.md +24 -25
- package/docs/INTERFACES.md +27 -18
- package/docs/PACKAGE_SURFACE.md +23 -21
- package/docs/PROTOCOL_POLICY.md +19 -13
- package/docs/RECIPES.md +4 -4
- package/docs/SECURITY.md +72 -60
- package/encoding/README.md +2 -2
- package/files/README.md +1 -1
- package/groups/README.md +4 -3
- package/hooks/README.md +2 -2
- package/keys/README.md +15 -14
- package/local/store/README.md +82 -67
- package/local/store/expo/README.md +17 -12
- package/local/store/memory/README.md +4 -3
- package/local/store/node/README.md +8 -6
- package/local/store/react-native/README.md +14 -12
- package/local/store/web/README.md +31 -26
- package/local/vault/README.md +4 -4
- package/media/README.md +6 -5
- package/package.json +2 -2
- package/profile/README.md +7 -7
- package/remote/README.md +20 -18
- package/remote/object-store/README.md +8 -4
- package/remote/object-store/convex-r2/README.md +3 -3
- package/remote/object-store/s3/README.md +10 -5
- package/remote/relay/convex/README.md +5 -5
- package/remote/relay/convex/component/README.md +145 -124
- package/remote/relay/memory/README.md +6 -5
- package/safety/README.md +1 -1
- package/sealed-sender/README.md +3 -2
- package/types/README.md +1 -1
- package/utils/README.md +4 -4
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Error type definitions for Signal Protocol
|
|
2
|
+
* Error type definitions for Signal Protocol.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Every error the SDK throws is an `EncryptionError` carrying an
|
|
5
|
+
* `EncryptionErrorCode`. A subclass exists only where the caller needs typed
|
|
6
|
+
* data off the error to recover. Examples are the peer's address and identity
|
|
7
|
+
* to verify a safety number, and the counter and epoch of a duplicate. Each
|
|
8
|
+
* subclass fixes its own code in its constructor.
|
|
5
9
|
*
|
|
6
10
|
* ```
|
|
7
|
-
* Layer Error Class Use Case
|
|
8
|
-
* ──────────────────────────────────────────────────────
|
|
9
|
-
* Layer 1 CryptoError Low-level crypto failures
|
|
10
|
-
* Layer 5 SessionError Session operations
|
|
11
|
-
* Layer 6 ProtocolError Protocol-level errors
|
|
12
|
-
* Client ClientError User-facing errors
|
|
13
|
-
* Base EncryptionError Generic encryption errors
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Error Hierarchy:
|
|
17
|
-
* ```
|
|
18
11
|
* Error
|
|
19
|
-
* └── EncryptionError
|
|
20
|
-
* ├──
|
|
21
|
-
* ├──
|
|
22
|
-
* ├──
|
|
23
|
-
* ├──
|
|
24
|
-
* └──
|
|
12
|
+
* └── EncryptionError code + context, thrown directly for most failures
|
|
13
|
+
* ├── UntrustedIdentityError address + identity, for safety-number verification
|
|
14
|
+
* ├── DuplicatedMessageError counter + epoch of the replayed message
|
|
15
|
+
* ├── SealedSenderAuthError the rejected sealed-sender credential
|
|
16
|
+
* ├── PQXDHRequiredError which post-quantum key the peer is missing
|
|
17
|
+
* └── StorageQuotaExceededError the store that ran out of room
|
|
25
18
|
* ```
|
|
26
19
|
*
|
|
20
|
+
* A code or a subclass belongs here only if production code can produce it. An
|
|
21
|
+
* error-surface check in the engineering repository parses for the construction
|
|
22
|
+
* sites that decide that. It fails the build when this module declares
|
|
23
|
+
* something nothing throws. A `switch` arm or a non-retryable set only reads a
|
|
24
|
+
* code. It does not produce one, so it does not keep a code alive.
|
|
27
25
|
*/
|
|
28
26
|
import type { ProtocolAddress } from './address.js';
|
|
29
27
|
import type { CompositeIdentityV1, PublicKey } from '../keys/index.js';
|
|
@@ -37,7 +35,7 @@ export {};
|
|
|
37
35
|
export interface EncryptionErrorContext {
|
|
38
36
|
/** The protocol address involved in the error (if applicable) */
|
|
39
37
|
address?: ProtocolAddress;
|
|
40
|
-
/** The operation
|
|
38
|
+
/** The operation in progress when the error occurred */
|
|
41
39
|
operation?: string;
|
|
42
40
|
/** The identity key involved (for trust/verification errors) */
|
|
43
41
|
identityKey?: PublicKey;
|
|
@@ -83,20 +81,13 @@ export declare class EncryptionError extends Error {
|
|
|
83
81
|
export declare enum EncryptionErrorCode {
|
|
84
82
|
/** Session not found for the given address */
|
|
85
83
|
SESSION_NOT_FOUND = "SESSION_NOT_FOUND",
|
|
86
|
-
/**
|
|
84
|
+
/** Damaged or invalid session data */
|
|
87
85
|
SESSION_CORRUPTED = "SESSION_CORRUPTED",
|
|
88
|
-
/**
|
|
89
|
-
* Multiple active sessions detected (race condition).
|
|
90
|
-
*
|
|
91
|
-
* Occurs when both parties try to establish sessions simultaneously.
|
|
92
|
-
* Requires session archiving and convergence.
|
|
93
|
-
*/
|
|
94
|
-
SESSION_CONFLICT = "SESSION_CONFLICT",
|
|
95
86
|
/**
|
|
96
87
|
* Recipient has not registered encryption keys.
|
|
97
88
|
*
|
|
98
89
|
* The target user has no prekey bundle available on the server.
|
|
99
|
-
*
|
|
90
|
+
* Their encryption setup may be incomplete.
|
|
100
91
|
*/
|
|
101
92
|
RECIPIENT_NOT_REGISTERED = "RECIPIENT_NOT_REGISTERED",
|
|
102
93
|
/**
|
|
@@ -121,15 +112,9 @@ export declare enum EncryptionErrorCode {
|
|
|
121
112
|
/**
|
|
122
113
|
* Duplicate message detected (replay attack).
|
|
123
114
|
*
|
|
124
|
-
*
|
|
115
|
+
* The session already processed this message number.
|
|
125
116
|
*/
|
|
126
117
|
MESSAGE_DUPLICATE = "MESSAGE_DUPLICATE",
|
|
127
|
-
/**
|
|
128
|
-
* Message arrived too old to decrypt.
|
|
129
|
-
*
|
|
130
|
-
* Message keys have been deleted due to age or count limits.
|
|
131
|
-
*/
|
|
132
|
-
MESSAGE_TOO_OLD = "MESSAGE_TOO_OLD",
|
|
133
118
|
/**
|
|
134
119
|
* Too many messages skipped (DoS protection).
|
|
135
120
|
*
|
|
@@ -138,7 +123,7 @@ export declare enum EncryptionErrorCode {
|
|
|
138
123
|
*/
|
|
139
124
|
TOO_MANY_SKIPPED_MESSAGES = "TOO_MANY_SKIPPED_MESSAGES",
|
|
140
125
|
/**
|
|
141
|
-
* Replay attack detected: envelope.timestamp
|
|
126
|
+
* Replay attack detected: envelope.timestamp does not match dataMessage.timestamp.
|
|
142
127
|
*
|
|
143
128
|
* After decryption, the envelope timestamp must match the timestamp inside the encrypted
|
|
144
129
|
* content. A mismatch indicates an attacker may have re-sent old encrypted content
|
|
@@ -147,13 +132,7 @@ export declare enum EncryptionErrorCode {
|
|
|
147
132
|
*/
|
|
148
133
|
REPLAY_DETECTED = "REPLAY_DETECTED",
|
|
149
134
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* Message was encrypted with an incompatible protocol version.
|
|
153
|
-
*/
|
|
154
|
-
INVALID_MESSAGE_VERSION = "INVALID_MESSAGE_VERSION",
|
|
155
|
-
/**
|
|
156
|
-
* Sender key has expired based on time-based rotation policy.
|
|
135
|
+
* The sender key expired under the time-based rotation policy.
|
|
157
136
|
*
|
|
158
137
|
* The default policy rotates sender keys every two weeks.
|
|
159
138
|
* The caller should auto-rotate the sender key and redistribute to group members.
|
|
@@ -162,20 +141,14 @@ export declare enum EncryptionErrorCode {
|
|
|
162
141
|
/**
|
|
163
142
|
* Identity key is not trusted.
|
|
164
143
|
*
|
|
165
|
-
*
|
|
144
|
+
* The user did not verify the identity, or the identity changed without
|
|
145
|
+
* confirmation.
|
|
166
146
|
*/
|
|
167
147
|
UNTRUSTED_IDENTITY = "UNTRUSTED_IDENTITY",
|
|
168
|
-
/**
|
|
169
|
-
* Identity key changed (possible MITM attack).
|
|
170
|
-
*
|
|
171
|
-
* Remote party's identity key differs from previously saved value.
|
|
172
|
-
* Could be legitimate (reinstall) or an attack.
|
|
173
|
-
*/
|
|
174
|
-
IDENTITY_KEY_CHANGED = "IDENTITY_KEY_CHANGED",
|
|
175
148
|
/**
|
|
176
149
|
* Sender identity mismatch.
|
|
177
150
|
*
|
|
178
|
-
* The sender address in the message
|
|
151
|
+
* The sender address in the message does not match the expected address.
|
|
179
152
|
* This indicates a session hijacking attempt where an attacker tries to
|
|
180
153
|
* inject their messages under a different identity.
|
|
181
154
|
*/
|
|
@@ -189,60 +162,33 @@ export declare enum EncryptionErrorCode {
|
|
|
189
162
|
/**
|
|
190
163
|
* PreKey rotation required before sending.
|
|
191
164
|
*
|
|
192
|
-
* Signed prekeys or Kyber prekeys
|
|
193
|
-
* (14 days by default).
|
|
194
|
-
*
|
|
165
|
+
* Signed prekeys or Kyber prekeys are past the maximum allowed age
|
|
166
|
+
* (14 days by default). The client blocks message sending until rotation
|
|
167
|
+
* succeeds, which maintains the forward-secrecy guarantees.
|
|
195
168
|
*
|
|
196
169
|
* @see https://signal.org/docs/specifications/pqxdh/#publishing-keys
|
|
197
170
|
*/
|
|
198
171
|
PREKEY_ROTATION_REQUIRED = "PREKEY_ROTATION_REQUIRED",
|
|
199
|
-
/**
|
|
200
|
-
* Invalid registration ID.
|
|
201
|
-
*
|
|
202
|
-
* Registration ID is 0 or doesn't match expected format.
|
|
203
|
-
*/
|
|
204
|
-
INVALID_REGISTRATION_ID = "INVALID_REGISTRATION_ID",
|
|
205
|
-
/**
|
|
206
|
-
* Registration ID changed (session reset detected).
|
|
207
|
-
*
|
|
208
|
-
* Remote party's registration ID changed, indicating app reinstall.
|
|
209
|
-
* Old sessions should be archived.
|
|
210
|
-
*/
|
|
211
|
-
REGISTRATION_ID_CHANGED = "REGISTRATION_ID_CHANGED",
|
|
212
|
-
/**
|
|
213
|
-
* DH ratchet error.
|
|
214
|
-
*
|
|
215
|
-
* Diffie-Hellman key exchange failed or produced invalid output.
|
|
216
|
-
*/
|
|
217
|
-
RATCHET_ERROR = "RATCHET_ERROR",
|
|
218
172
|
/**
|
|
219
173
|
* Message counter overflow.
|
|
220
174
|
*
|
|
221
|
-
*
|
|
175
|
+
* The counter reached MAX_SAFE_INTEGER, so the caller must rotate the session.
|
|
222
176
|
* This is a safety check to prevent cryptographic issues from counter wrap-around.
|
|
223
177
|
*/
|
|
224
178
|
COUNTER_OVERFLOW = "COUNTER_OVERFLOW",
|
|
225
179
|
/**
|
|
226
180
|
* Invalid DH public key.
|
|
227
181
|
*
|
|
228
|
-
* DH public key
|
|
182
|
+
* A malformed DH public key, or one that fails validation.
|
|
229
183
|
*/
|
|
230
184
|
INVALID_DH_KEY = "INVALID_DH_KEY",
|
|
231
185
|
/** Key storage operation failed */
|
|
232
186
|
KEY_STORAGE_ERROR = "KEY_STORAGE_ERROR",
|
|
233
|
-
/** Database operation failed */
|
|
234
|
-
DATABASE_ERROR = "DATABASE_ERROR",
|
|
235
|
-
/**
|
|
236
|
-
* Database is locked or unavailable.
|
|
237
|
-
*
|
|
238
|
-
* Encrypted database cannot be accessed (wrong password, corruption, etc.)
|
|
239
|
-
*/
|
|
240
|
-
DATABASE_LOCKED = "DATABASE_LOCKED",
|
|
241
187
|
/**
|
|
242
|
-
* The storage backend rejected a write because the origin
|
|
243
|
-
* quota
|
|
188
|
+
* The storage backend rejected a write because the origin ran out of
|
|
189
|
+
* storage quota.
|
|
244
190
|
*
|
|
245
|
-
* The rejected write did not persist
|
|
191
|
+
* The rejected write did not persist. Storage adapters commit each
|
|
246
192
|
* write in an atomic transaction, so quota exhaustion rolls the whole
|
|
247
193
|
* transaction back instead of leaving a subset. The application should
|
|
248
194
|
* free space or request more from the platform, then retry.
|
|
@@ -250,24 +196,22 @@ export declare enum EncryptionErrorCode {
|
|
|
250
196
|
STORAGE_QUOTA_EXCEEDED = "STORAGE_QUOTA_EXCEEDED",
|
|
251
197
|
/** Signal Protocol initialization failed */
|
|
252
198
|
INITIALIZATION_FAILED = "INITIALIZATION_FAILED",
|
|
253
|
-
/** Identity key pair generation or loading failed */
|
|
254
|
-
IDENTITY_KEY_ERROR = "IDENTITY_KEY_ERROR",
|
|
255
199
|
/**
|
|
256
|
-
* PQXDH (post-quantum key exchange)
|
|
200
|
+
* PQXDH (post-quantum key exchange) applies, but the partner lacks Kyber keys.
|
|
257
201
|
*
|
|
258
|
-
* Thrown when partner
|
|
202
|
+
* Thrown when partner does not support the required PQXDH handshake.
|
|
259
203
|
* Application can catch this to notify user or queue message for retry.
|
|
260
204
|
*/
|
|
261
205
|
PQXDH_REQUIRED = "PQXDH_REQUIRED",
|
|
262
206
|
/**
|
|
263
207
|
* PQXDH key exchange failed during handshake.
|
|
264
208
|
*
|
|
265
|
-
* The post-quantum key exchange encountered an error. The
|
|
266
|
-
*
|
|
209
|
+
* The post-quantum key exchange encountered an error. The SDK aborts the
|
|
210
|
+
* session instead of a downgrade to classical X3DH.
|
|
267
211
|
*/
|
|
268
212
|
PQXDH_FAILED = "PQXDH_FAILED",
|
|
269
213
|
/**
|
|
270
|
-
* Triple Ratchet
|
|
214
|
+
* Triple Ratchet applies, but the session did not use PQXDH.
|
|
271
215
|
*
|
|
272
216
|
* Triple Ratchet requires post-quantum material from PQXDH.
|
|
273
217
|
* Cannot enable Triple Ratchet with classical X3DH handshake.
|
|
@@ -287,18 +231,10 @@ export declare enum EncryptionErrorCode {
|
|
|
287
231
|
* `SPQR`'s the profile uses `max_jump` of 25,000.
|
|
288
232
|
*/
|
|
289
233
|
SPQR_MESSAGE_JUMP_TOO_LARGE = "SPQR_MESSAGE_JUMP_TOO_LARGE",
|
|
290
|
-
/**
|
|
291
|
-
* Attempted to use a message key that was already consumed.
|
|
292
|
-
*
|
|
293
|
-
* Indicates replay attack or duplicate message.
|
|
294
|
-
*
|
|
295
|
-
* Reserved: Reserved for future use when replay detection is implemented.
|
|
296
|
-
*/
|
|
297
|
-
SPQR_KEY_ALREADY_USED = "SPQR_KEY_ALREADY_USED",
|
|
298
234
|
/**
|
|
299
235
|
* SPQR message counter overflow.
|
|
300
236
|
*
|
|
301
|
-
*
|
|
237
|
+
* The counter reached its maximum value, so the caller must rotate the epoch.
|
|
302
238
|
*/
|
|
303
239
|
SPQR_COUNTER_OVERFLOW = "SPQR_COUNTER_OVERFLOW",
|
|
304
240
|
/**
|
|
@@ -307,15 +243,6 @@ export declare enum EncryptionErrorCode {
|
|
|
307
243
|
* Ciphertext has wrong size or format for ML-KEM-1024.
|
|
308
244
|
*/
|
|
309
245
|
SPQR_INVALID_CIPHERTEXT = "SPQR_INVALID_CIPHERTEXT",
|
|
310
|
-
/**
|
|
311
|
-
* SPQR epoch regression detected.
|
|
312
|
-
*
|
|
313
|
-
* Received message claims an epoch earlier than current - possible replay.
|
|
314
|
-
*
|
|
315
|
-
* Reserved: Reserved for future use. Currently epoch regression is handled
|
|
316
|
-
* via SPQR_EPOCH_OUT_OF_RANGE with oldestEpoch context.
|
|
317
|
-
*/
|
|
318
|
-
SPQR_EPOCH_REGRESSION = "SPQR_EPOCH_REGRESSION",
|
|
319
246
|
/**
|
|
320
247
|
* SPQR version negotiation failed.
|
|
321
248
|
*
|
|
@@ -323,23 +250,15 @@ export declare enum EncryptionErrorCode {
|
|
|
323
250
|
* For example, peer only supports V0 but we require V1.
|
|
324
251
|
*/
|
|
325
252
|
SPQR_VERSION_MISMATCH = "SPQR_VERSION_MISMATCH",
|
|
326
|
-
/** Post-quantum (Kyber) operation failed */
|
|
327
|
-
KYBER_ERROR = "KYBER_ERROR",
|
|
328
|
-
/** Key derivation function failed */
|
|
329
|
-
KDF_ERROR = "KDF_ERROR",
|
|
330
|
-
/** HMAC verification failed (message tampering detected) */
|
|
331
|
-
HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED",
|
|
332
253
|
/**
|
|
333
254
|
* Sealed sender authentication failed.
|
|
334
255
|
*
|
|
335
|
-
* The unidentified access key
|
|
256
|
+
* The server rejected the unidentified access key. This may trigger
|
|
336
257
|
* fallback to identified sender delivery.
|
|
337
258
|
*/
|
|
338
259
|
SEALED_SENDER_AUTH_FAILED = "SEALED_SENDER_AUTH_FAILED",
|
|
339
260
|
/** Invalid operation or state */
|
|
340
|
-
INVALID_STATE = "INVALID_STATE"
|
|
341
|
-
/** Unknown or unexpected error */
|
|
342
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
261
|
+
INVALID_STATE = "INVALID_STATE"
|
|
343
262
|
}
|
|
344
263
|
/**
|
|
345
264
|
* Error thrown when an identity key is not trusted.
|
|
@@ -358,47 +277,12 @@ export declare class UntrustedIdentityError extends EncryptionError {
|
|
|
358
277
|
constructor(address: ProtocolAddress, identity: CompositeIdentityV1);
|
|
359
278
|
}
|
|
360
279
|
/**
|
|
361
|
-
* Error thrown when
|
|
362
|
-
*
|
|
363
|
-
* This could indicate:
|
|
364
|
-
* - Legitimate: Device reinstall, new device, backup restoration
|
|
365
|
-
* - Attack: Man-in-the-middle attack
|
|
366
|
-
*
|
|
367
|
-
* Requires prominent user warning and safety number verification.
|
|
368
|
-
*
|
|
369
|
-
* @example
|
|
370
|
-
* ```typescript
|
|
371
|
-
* throw new IdentityKeyChangedError(address, oldKey, newKey);
|
|
372
|
-
* ```
|
|
373
|
-
*/
|
|
374
|
-
export declare class IdentityKeyChangedError extends EncryptionError {
|
|
375
|
-
readonly changedAddress: ProtocolAddress;
|
|
376
|
-
readonly oldIdentityKey: PublicKey;
|
|
377
|
-
readonly newIdentityKey: PublicKey;
|
|
378
|
-
constructor(address: ProtocolAddress, oldIdentityKey: PublicKey, newIdentityKey: PublicKey);
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Error thrown when multiple active sessions are detected (race condition).
|
|
382
|
-
*
|
|
383
|
-
* Occurs when both parties try to establish sessions simultaneously.
|
|
384
|
-
* Requires session archiving and convergence using Sesame algorithm.
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```typescript
|
|
388
|
-
* throw new SessionConflictError(address);
|
|
389
|
-
* ```
|
|
390
|
-
*/
|
|
391
|
-
export declare class SessionConflictError extends EncryptionError {
|
|
392
|
-
readonly conflictAddress: ProtocolAddress;
|
|
393
|
-
constructor(address: ProtocolAddress);
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Error thrown when a duplicate message is detected (replay attack).
|
|
280
|
+
* Error thrown when the session detects a duplicate message (replay attack).
|
|
397
281
|
*
|
|
398
282
|
* This is a security-critical error indicating:
|
|
399
283
|
* - Network replay (attacker re-sent a captured message)
|
|
400
284
|
* - Client bug (accidentally decrypting same message twice)
|
|
401
|
-
* - Storage corruption (message key index
|
|
285
|
+
* - Storage corruption (a damaged message key index)
|
|
402
286
|
*
|
|
403
287
|
* Metadata should support diagnostics without exposing secret material.
|
|
404
288
|
*
|
|
@@ -409,9 +293,9 @@ export declare class SessionConflictError extends EncryptionError {
|
|
|
409
293
|
*/
|
|
410
294
|
export declare class DuplicatedMessageError extends EncryptionError {
|
|
411
295
|
readonly duplicatedAddress: ProtocolAddress;
|
|
412
|
-
/**
|
|
296
|
+
/** The duplicate message counter (if known) - matches the reference implementation's proto field name */
|
|
413
297
|
readonly counter?: number;
|
|
414
|
-
/** Epoch (for Triple Ratchet)
|
|
298
|
+
/** Epoch (for Triple Ratchet) of the duplicate */
|
|
415
299
|
readonly epoch?: number;
|
|
416
300
|
/** Fingerprint of the duplicate ciphertext (truncated for logging) */
|
|
417
301
|
readonly fingerprintPreview?: string;
|
|
@@ -428,28 +312,11 @@ export declare class DuplicatedMessageError extends EncryptionError {
|
|
|
428
312
|
* @returns true if error is DuplicatedMessageError
|
|
429
313
|
*/
|
|
430
314
|
export declare function isDuplicatedMessageError(error: unknown): error is DuplicatedMessageError;
|
|
431
|
-
/**
|
|
432
|
-
* Error thrown when registration ID has changed (session reset).
|
|
433
|
-
*
|
|
434
|
-
* Indicates the remote party has reinstalled their app.
|
|
435
|
-
* Old sessions should be archived and new session established.
|
|
436
|
-
*
|
|
437
|
-
* @example
|
|
438
|
-
* ```typescript
|
|
439
|
-
* throw new RegistrationIdChangedError(address, oldId, newId);
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
export declare class RegistrationIdChangedError extends EncryptionError {
|
|
443
|
-
readonly resetAddress: ProtocolAddress;
|
|
444
|
-
readonly oldRegistrationId: number;
|
|
445
|
-
readonly newRegistrationId: number;
|
|
446
|
-
constructor(address: ProtocolAddress, oldRegistrationId: number, newRegistrationId: number);
|
|
447
|
-
}
|
|
448
315
|
/**
|
|
449
316
|
* Error thrown when sealed sender (anonymous delivery) authentication fails.
|
|
450
317
|
*
|
|
451
|
-
* The unidentified access key
|
|
452
|
-
* - The access key
|
|
318
|
+
* The server rejected the unidentified access key, for one of these reasons:
|
|
319
|
+
* - The access key does not match the recipient's stored key
|
|
453
320
|
* - The recipient's account was not found
|
|
454
321
|
* - The recipient disabled unrestricted unidentified access
|
|
455
322
|
*
|
|
@@ -481,7 +348,7 @@ export declare function isSealedSenderAuthError(error: unknown): error is Sealed
|
|
|
481
348
|
* Fallback type categories for PQXDH errors.
|
|
482
349
|
*
|
|
483
350
|
* Distinguishes between different types of fallback scenarios:
|
|
484
|
-
* - `missing_keys`: Partner
|
|
351
|
+
* - `missing_keys`: Partner does not have Kyber prekeys (expected compatibility issue)
|
|
485
352
|
* - `crypto_failure`: Kyber operation failed (decapsulation, signature, etc.)
|
|
486
353
|
* - `protocol_mismatch`: Version or format incompatibility
|
|
487
354
|
*/
|
|
@@ -490,7 +357,7 @@ export type PQXDHFallbackType = 'missing_keys' | 'crypto_failure' | 'protocol_mi
|
|
|
490
357
|
* Options for PQXDHRequiredError constructor.
|
|
491
358
|
*/
|
|
492
359
|
export interface PQXDHRequiredErrorOptions {
|
|
493
|
-
/** Whether the
|
|
360
|
+
/** Whether the caller can retry the operation (e.g., after partner updates keys) */
|
|
494
361
|
retryable?: boolean;
|
|
495
362
|
/** Suggested delay before retry in milliseconds */
|
|
496
363
|
suggestedRetryDelay?: number;
|
|
@@ -500,7 +367,7 @@ export interface PQXDHRequiredErrorOptions {
|
|
|
500
367
|
originalError?: Error;
|
|
501
368
|
}
|
|
502
369
|
/**
|
|
503
|
-
* Error thrown when PQXDH
|
|
370
|
+
* Error thrown when PQXDH applies, but the partner lacks Kyber keys.
|
|
504
371
|
*
|
|
505
372
|
* This is a recoverable error - applications can:
|
|
506
373
|
* - Notify user that partner needs to update their app
|
|
@@ -508,7 +375,7 @@ export interface PQXDHRequiredErrorOptions {
|
|
|
508
375
|
* - Fall back to classical encryption with user consent
|
|
509
376
|
*
|
|
510
377
|
* Recovery metadata:
|
|
511
|
-
* - `retryable`: Whether the
|
|
378
|
+
* - `retryable`: Whether the caller can retry the operation
|
|
512
379
|
* - `suggestedRetryDelay`: Recommended delay before retry (ms)
|
|
513
380
|
* - `fallbackType`: Category of fallback for analytics
|
|
514
381
|
*
|
|
@@ -539,7 +406,7 @@ export interface PQXDHRequiredErrorOptions {
|
|
|
539
406
|
export declare class PQXDHRequiredError extends EncryptionError {
|
|
540
407
|
readonly remoteAddress: string;
|
|
541
408
|
readonly reason: 'no_kyber_prekey' | 'pqxdh_failed';
|
|
542
|
-
/** Whether the
|
|
409
|
+
/** Whether the caller can retry the operation */
|
|
543
410
|
readonly retryable: boolean;
|
|
544
411
|
/** Suggested delay before retry in milliseconds */
|
|
545
412
|
readonly suggestedRetryDelay?: number;
|
|
@@ -548,10 +415,10 @@ export declare class PQXDHRequiredError extends EncryptionError {
|
|
|
548
415
|
constructor(remoteAddress: string, reason: 'no_kyber_prekey' | 'pqxdh_failed', options?: PQXDHRequiredErrorOptions);
|
|
549
416
|
}
|
|
550
417
|
/**
|
|
551
|
-
* Error thrown when the storage backend rejects a write because the
|
|
552
|
-
*
|
|
418
|
+
* Error thrown when the storage backend rejects a write because the origin
|
|
419
|
+
* ran out of storage quota.
|
|
553
420
|
*
|
|
554
|
-
* The rejected write did not persist
|
|
421
|
+
* The rejected write did not persist. Storage adapters commit each write
|
|
555
422
|
* in an atomic transaction, so quota exhaustion rolls the whole
|
|
556
423
|
* transaction back instead of leaving a subset. The application should
|
|
557
424
|
* free space or request more from the platform, then retry the write.
|
|
@@ -570,6 +437,13 @@ export declare class PQXDHRequiredError extends EncryptionError {
|
|
|
570
437
|
export declare class StorageQuotaExceededError extends EncryptionError {
|
|
571
438
|
constructor(operation: string, originalError?: Error);
|
|
572
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Type guard to check if an error is a StorageQuotaExceededError.
|
|
442
|
+
*
|
|
443
|
+
* @param error - Error to check
|
|
444
|
+
* @returns true if error is StorageQuotaExceededError
|
|
445
|
+
*/
|
|
446
|
+
export declare function isStorageQuotaExceededError(error: unknown): error is StorageQuotaExceededError;
|
|
573
447
|
/**
|
|
574
448
|
* Type guard to check if an error is a PQXDHRequiredError.
|
|
575
449
|
*
|
|
@@ -584,220 +458,6 @@ export declare function isPQXDHRequiredError(error: unknown): error is PQXDHRequ
|
|
|
584
458
|
* @returns true if error is UntrustedIdentityError
|
|
585
459
|
*/
|
|
586
460
|
export declare function isUntrustedIdentityError(error: unknown): error is UntrustedIdentityError;
|
|
587
|
-
/**
|
|
588
|
-
* Type guard to check if an error is an IdentityKeyChangedError.
|
|
589
|
-
*
|
|
590
|
-
* @param error - Error to check
|
|
591
|
-
* @returns true if error is IdentityKeyChangedError
|
|
592
|
-
*/
|
|
593
|
-
export declare function isIdentityKeyChangedError(error: unknown): error is IdentityKeyChangedError;
|
|
594
|
-
/**
|
|
595
|
-
* Type guard to check if an error is a SessionConflictError.
|
|
596
|
-
*
|
|
597
|
-
* @param error - Error to check
|
|
598
|
-
* @returns true if error is SessionConflictError
|
|
599
|
-
*/
|
|
600
|
-
export declare function isSessionConflictError(error: unknown): error is SessionConflictError;
|
|
601
|
-
/**
|
|
602
|
-
* Type guard to check if an error is a RegistrationIdChangedError.
|
|
603
|
-
*
|
|
604
|
-
* @param error - Error to check
|
|
605
|
-
* @returns true if error is RegistrationIdChangedError
|
|
606
|
-
*/
|
|
607
|
-
export declare function isRegistrationIdChangedError(error: unknown): error is RegistrationIdChangedError;
|
|
608
|
-
/**
|
|
609
|
-
* Error codes for cryptographic layer (Layer 1) errors.
|
|
610
|
-
*
|
|
611
|
-
* These errors occur in low-level cryptographic operations.
|
|
612
|
-
*/
|
|
613
|
-
export declare enum CryptoErrorCode {
|
|
614
|
-
/** Random number generation failed */
|
|
615
|
-
RNG_FAILURE = "CRYPTO_RNG_FAILURE",
|
|
616
|
-
/** ECDH key agreement failed */
|
|
617
|
-
ECDH_FAILURE = "CRYPTO_ECDH_FAILURE",
|
|
618
|
-
/** Kyber (ML-KEM) operation failed */
|
|
619
|
-
KYBER_FAILURE = "CRYPTO_KYBER_FAILURE",
|
|
620
|
-
/** Key derivation function failed */
|
|
621
|
-
KDF_FAILURE = "CRYPTO_KDF_FAILURE",
|
|
622
|
-
/** AES encryption/decryption failed */
|
|
623
|
-
AES_FAILURE = "CRYPTO_AES_FAILURE",
|
|
624
|
-
/** HMAC computation or verification failed */
|
|
625
|
-
HMAC_FAILURE = "CRYPTO_HMAC_FAILURE",
|
|
626
|
-
/** Digital signature failed */
|
|
627
|
-
SIGNATURE_FAILURE = "CRYPTO_SIGNATURE_FAILURE",
|
|
628
|
-
/** Hash computation failed */
|
|
629
|
-
HASH_FAILURE = "CRYPTO_HASH_FAILURE",
|
|
630
|
-
/** Invalid key format or length */
|
|
631
|
-
INVALID_KEY = "CRYPTO_INVALID_KEY",
|
|
632
|
-
/** Invalid ciphertext format */
|
|
633
|
-
INVALID_CIPHERTEXT = "CRYPTO_INVALID_CIPHERTEXT"
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Cryptographic layer error (Layer 1).
|
|
637
|
-
*
|
|
638
|
-
* Thrown when low-level cryptographic operations fail.
|
|
639
|
-
* These errors are typically unrecoverable and indicate
|
|
640
|
-
* fundamental issues with crypto primitives.
|
|
641
|
-
*
|
|
642
|
-
* @example
|
|
643
|
-
* ```typescript
|
|
644
|
-
* throw new CryptoError(
|
|
645
|
-
* 'ECDH key agreement produced invalid output',
|
|
646
|
-
* CryptoErrorCode.ECDH_FAILURE,
|
|
647
|
-
* { operation: 'computeSharedSecret' }
|
|
648
|
-
* );
|
|
649
|
-
* ```
|
|
650
|
-
*/
|
|
651
|
-
export declare class CryptoError extends EncryptionError {
|
|
652
|
-
readonly cryptoCode: CryptoErrorCode;
|
|
653
|
-
constructor(message: string, code: CryptoErrorCode, context?: EncryptionErrorContext);
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Error codes for session layer (Layer 5) errors.
|
|
657
|
-
*
|
|
658
|
-
* These errors occur during session operations.
|
|
659
|
-
*/
|
|
660
|
-
export declare enum SessionErrorCode {
|
|
661
|
-
/** Session not found */
|
|
662
|
-
NOT_FOUND = "SESSION_NOT_FOUND",
|
|
663
|
-
/** Session is corrupted or invalid */
|
|
664
|
-
CORRUPTED = "SESSION_CORRUPTED",
|
|
665
|
-
/** Session has expired */
|
|
666
|
-
EXPIRED = "SESSION_EXPIRED",
|
|
667
|
-
/** Session conflict (race condition) */
|
|
668
|
-
CONFLICT = "SESSION_CONFLICT",
|
|
669
|
-
/** Invalid session state for operation */
|
|
670
|
-
INVALID_STATE = "SESSION_INVALID_STATE",
|
|
671
|
-
/** Session ratchet step failed */
|
|
672
|
-
RATCHET_FAILED = "SESSION_RATCHET_FAILED",
|
|
673
|
-
/** Too many skipped messages */
|
|
674
|
-
TOO_MANY_SKIPPED = "SESSION_TOO_MANY_SKIPPED",
|
|
675
|
-
/** Message key not found (message too old) */
|
|
676
|
-
MESSAGE_KEY_NOT_FOUND = "SESSION_MESSAGE_KEY_NOT_FOUND",
|
|
677
|
-
/** Session establishment failed */
|
|
678
|
-
ESTABLISHMENT_FAILED = "SESSION_ESTABLISHMENT_FAILED"
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Session layer error (Layer 5).
|
|
682
|
-
*
|
|
683
|
-
* Thrown when session operations fail. Includes session ID
|
|
684
|
-
* for debugging and potentially recovery.
|
|
685
|
-
*
|
|
686
|
-
* @example
|
|
687
|
-
* ```typescript
|
|
688
|
-
* throw new SessionError(
|
|
689
|
-
* 'Session not found for decryption',
|
|
690
|
-
* SessionErrorCode.NOT_FOUND,
|
|
691
|
-
* 'session-123',
|
|
692
|
-
* { operation: 'decrypt' }
|
|
693
|
-
* );
|
|
694
|
-
* ```
|
|
695
|
-
*/
|
|
696
|
-
export declare class SessionError extends EncryptionError {
|
|
697
|
-
readonly sessionCode: SessionErrorCode;
|
|
698
|
-
readonly sessionId?: string;
|
|
699
|
-
constructor(message: string, code: SessionErrorCode, sessionId?: string, context?: EncryptionErrorContext);
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Error codes for protocol layer (Layer 6) errors.
|
|
703
|
-
*
|
|
704
|
-
* These errors occur at the protocol level (Sesame, message routing).
|
|
705
|
-
*/
|
|
706
|
-
export declare enum ProtocolErrorCode {
|
|
707
|
-
/** Invalid message format */
|
|
708
|
-
INVALID_MESSAGE = "PROTOCOL_INVALID_MESSAGE",
|
|
709
|
-
/** Invalid prekey bundle */
|
|
710
|
-
INVALID_BUNDLE = "PROTOCOL_INVALID_BUNDLE",
|
|
711
|
-
/** Protocol version mismatch */
|
|
712
|
-
VERSION_MISMATCH = "PROTOCOL_VERSION_MISMATCH",
|
|
713
|
-
/** Device not found in device list */
|
|
714
|
-
DEVICE_NOT_FOUND = "PROTOCOL_DEVICE_NOT_FOUND",
|
|
715
|
-
/** Stale device list */
|
|
716
|
-
STALE_DEVICE_LIST = "PROTOCOL_STALE_DEVICE_LIST",
|
|
717
|
-
/** Retry request required */
|
|
718
|
-
RETRY_REQUIRED = "PROTOCOL_RETRY_REQUIRED",
|
|
719
|
-
/** Sender key distribution failed */
|
|
720
|
-
SENDER_KEY_FAILED = "PROTOCOL_SENDER_KEY_FAILED"
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* Protocol layer error (Layer 6).
|
|
724
|
-
*
|
|
725
|
-
* Thrown for protocol-level issues like message format errors,
|
|
726
|
-
* version mismatches, or multi-device coordination failures.
|
|
727
|
-
*
|
|
728
|
-
* @example
|
|
729
|
-
* ```typescript
|
|
730
|
-
* throw new ProtocolError(
|
|
731
|
-
* 'Device list is stale, retry required',
|
|
732
|
-
* ProtocolErrorCode.STALE_DEVICE_LIST,
|
|
733
|
-
* { operation: 'sendGroupMessage', context: { groupId } }
|
|
734
|
-
* );
|
|
735
|
-
* ```
|
|
736
|
-
*/
|
|
737
|
-
export declare class ProtocolError extends EncryptionError {
|
|
738
|
-
readonly protocolCode: ProtocolErrorCode;
|
|
739
|
-
readonly protocolContext?: object;
|
|
740
|
-
constructor(message: string, code: ProtocolErrorCode, context?: EncryptionErrorContext & {
|
|
741
|
-
protocolContext?: object;
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* Error codes for client-facing errors.
|
|
746
|
-
*
|
|
747
|
-
* These errors should be displayed to users (with appropriate messaging).
|
|
748
|
-
*/
|
|
749
|
-
export declare enum ClientErrorCode {
|
|
750
|
-
/** Network error during key exchange */
|
|
751
|
-
NETWORK_ERROR = "CLIENT_NETWORK_ERROR",
|
|
752
|
-
/** User identity verification required */
|
|
753
|
-
VERIFICATION_REQUIRED = "CLIENT_VERIFICATION_REQUIRED",
|
|
754
|
-
/** Recipient not found */
|
|
755
|
-
RECIPIENT_NOT_FOUND = "CLIENT_RECIPIENT_NOT_FOUND",
|
|
756
|
-
/** Message delivery failed */
|
|
757
|
-
DELIVERY_FAILED = "CLIENT_DELIVERY_FAILED",
|
|
758
|
-
/** Encryption unavailable (keys not initialized) */
|
|
759
|
-
ENCRYPTION_UNAVAILABLE = "CLIENT_ENCRYPTION_UNAVAILABLE",
|
|
760
|
-
/** Session needs reset */
|
|
761
|
-
SESSION_RESET_NEEDED = "CLIENT_SESSION_RESET_NEEDED"
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Client-facing error.
|
|
765
|
-
*
|
|
766
|
-
* These errors are intended to be shown to users with
|
|
767
|
-
* appropriate messaging. Includes optional user-facing
|
|
768
|
-
* message that can be displayed directly in UI.
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* ```typescript
|
|
772
|
-
* throw new ClientError(
|
|
773
|
-
* 'Failed to send encrypted message',
|
|
774
|
-
* ClientErrorCode.DELIVERY_FAILED,
|
|
775
|
-
* 'Message could not be delivered. Please try again.',
|
|
776
|
-
* { operation: 'sendMessage' }
|
|
777
|
-
* );
|
|
778
|
-
* ```
|
|
779
|
-
*/
|
|
780
|
-
export declare class ClientError extends EncryptionError {
|
|
781
|
-
readonly clientCode: ClientErrorCode;
|
|
782
|
-
readonly userFacingMessage?: string;
|
|
783
|
-
constructor(message: string, code: ClientErrorCode, userFacingMessage?: string, context?: EncryptionErrorContext);
|
|
784
|
-
}
|
|
785
|
-
/**
|
|
786
|
-
* Type guard to check if an error is a CryptoError.
|
|
787
|
-
*/
|
|
788
|
-
export declare function isCryptoError(error: unknown): error is CryptoError;
|
|
789
|
-
/**
|
|
790
|
-
* Type guard to check if an error is a SessionError.
|
|
791
|
-
*/
|
|
792
|
-
export declare function isSessionError(error: unknown): error is SessionError;
|
|
793
|
-
/**
|
|
794
|
-
* Type guard to check if an error is a ProtocolError.
|
|
795
|
-
*/
|
|
796
|
-
export declare function isProtocolError(error: unknown): error is ProtocolError;
|
|
797
|
-
/**
|
|
798
|
-
* Type guard to check if an error is a ClientError.
|
|
799
|
-
*/
|
|
800
|
-
export declare function isClientError(error: unknown): error is ClientError;
|
|
801
461
|
/**
|
|
802
462
|
* Type guard to check if an error is any Signal Protocol error.
|
|
803
463
|
*/
|