@open-e2ee/signal-protocol-sdk 0.1.0-alpha.1
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 +195 -0
- package/ARCHITECTURE.md +206 -0
- package/CHANGELOG.md +13 -0
- package/LICENSE +661 -0
- package/NOTICE +27 -0
- package/README.md +152 -0
- package/SECURITY.md +125 -0
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/TROUBLESHOOTING.md +203 -0
- package/blocking/README.md +42 -0
- package/client/README.md +169 -0
- package/device/README.md +166 -0
- package/dist/blocking/index.d.ts +4 -0
- package/dist/blocking/index.d.ts.map +1 -0
- package/dist/blocking/index.js +2 -0
- package/dist/blocking/index.js.map +1 -0
- package/dist/blocking/manager.d.ts +27 -0
- package/dist/blocking/manager.d.ts.map +1 -0
- package/dist/blocking/manager.js +61 -0
- package/dist/blocking/manager.js.map +1 -0
- package/dist/blocking/types.d.ts +43 -0
- package/dist/blocking/types.d.ts.map +1 -0
- package/dist/blocking/types.js +9 -0
- package/dist/blocking/types.js.map +1 -0
- package/dist/client/client.d.ts +1281 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +2296 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/compose.d.ts +105 -0
- package/dist/client/compose.d.ts.map +1 -0
- package/dist/client/compose.js +41 -0
- package/dist/client/compose.js.map +1 -0
- package/dist/client/config.d.ts +707 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/config.js +19 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/constants.d.ts +48 -0
- package/dist/client/constants.d.ts.map +1 -0
- package/dist/client/constants.js +40 -0
- package/dist/client/constants.js.map +1 -0
- package/dist/client/content-adapter.d.ts +106 -0
- package/dist/client/content-adapter.d.ts.map +1 -0
- package/dist/client/content-adapter.js +423 -0
- package/dist/client/content-adapter.js.map +1 -0
- package/dist/client/dual-store.d.ts +70 -0
- package/dist/client/dual-store.d.ts.map +1 -0
- package/dist/client/dual-store.js +123 -0
- package/dist/client/dual-store.js.map +1 -0
- package/dist/client/endorsement-manager.d.ts +143 -0
- package/dist/client/endorsement-manager.d.ts.map +1 -0
- package/dist/client/endorsement-manager.js +259 -0
- package/dist/client/endorsement-manager.js.map +1 -0
- package/dist/client/event-hooks.d.ts +330 -0
- package/dist/client/event-hooks.d.ts.map +1 -0
- package/dist/client/event-hooks.js +59 -0
- package/dist/client/event-hooks.js.map +1 -0
- package/dist/client/files.d.ts +73 -0
- package/dist/client/files.d.ts.map +1 -0
- package/dist/client/files.js +192 -0
- package/dist/client/files.js.map +1 -0
- package/dist/client/groups.d.ts +204 -0
- package/dist/client/groups.d.ts.map +1 -0
- package/dist/client/groups.js +340 -0
- package/dist/client/groups.js.map +1 -0
- package/dist/client/headless.d.ts +99 -0
- package/dist/client/headless.d.ts.map +1 -0
- package/dist/client/headless.js +163 -0
- package/dist/client/headless.js.map +1 -0
- package/dist/client/index.d.ts +33 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/key-rotation-core.d.ts +167 -0
- package/dist/client/key-rotation-core.d.ts.map +1 -0
- package/dist/client/key-rotation-core.js +459 -0
- package/dist/client/key-rotation-core.js.map +1 -0
- package/dist/client/key-rotation.d.ts +45 -0
- package/dist/client/key-rotation.d.ts.map +1 -0
- package/dist/client/key-rotation.js +174 -0
- package/dist/client/key-rotation.js.map +1 -0
- package/dist/client/media.d.ts +173 -0
- package/dist/client/media.d.ts.map +1 -0
- package/dist/client/media.js +476 -0
- package/dist/client/media.js.map +1 -0
- package/dist/client/messages.d.ts +131 -0
- package/dist/client/messages.d.ts.map +1 -0
- package/dist/client/messages.js +546 -0
- package/dist/client/messages.js.map +1 -0
- package/dist/client/multi-device.d.ts +73 -0
- package/dist/client/multi-device.d.ts.map +1 -0
- package/dist/client/multi-device.js +104 -0
- package/dist/client/multi-device.js.map +1 -0
- package/dist/client/prekeys.d.ts +133 -0
- package/dist/client/prekeys.d.ts.map +1 -0
- package/dist/client/prekeys.js +608 -0
- package/dist/client/prekeys.js.map +1 -0
- package/dist/client/relay-subscription.d.ts +83 -0
- package/dist/client/relay-subscription.d.ts.map +1 -0
- package/dist/client/relay-subscription.js +353 -0
- package/dist/client/relay-subscription.js.map +1 -0
- package/dist/client/retry-utils.d.ts +42 -0
- package/dist/client/retry-utils.d.ts.map +1 -0
- package/dist/client/retry-utils.js +107 -0
- package/dist/client/retry-utils.js.map +1 -0
- package/dist/client/retry.d.ts +121 -0
- package/dist/client/retry.d.ts.map +1 -0
- package/dist/client/retry.js +499 -0
- package/dist/client/retry.js.map +1 -0
- package/dist/client/sealed-sender-ops.d.ts +61 -0
- package/dist/client/sealed-sender-ops.d.ts.map +1 -0
- package/dist/client/sealed-sender-ops.js +173 -0
- package/dist/client/sealed-sender-ops.js.map +1 -0
- package/dist/client/sessions.d.ts +108 -0
- package/dist/client/sessions.d.ts.map +1 -0
- package/dist/client/sessions.js +367 -0
- package/dist/client/sessions.js.map +1 -0
- package/dist/client/signal-service-cipher.d.ts +331 -0
- package/dist/client/signal-service-cipher.d.ts.map +1 -0
- package/dist/client/signal-service-cipher.js +1506 -0
- package/dist/client/signal-service-cipher.js.map +1 -0
- package/dist/client/state.d.ts +147 -0
- package/dist/client/state.d.ts.map +1 -0
- package/dist/client/state.js +226 -0
- package/dist/client/state.js.map +1 -0
- package/dist/client/types.d.ts +423 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +42 -0
- package/dist/client/types.js.map +1 -0
- package/dist/device/connection.d.ts +46 -0
- package/dist/device/connection.d.ts.map +1 -0
- package/dist/device/connection.js +239 -0
- package/dist/device/connection.js.map +1 -0
- package/dist/device/constants.d.ts +69 -0
- package/dist/device/constants.d.ts.map +1 -0
- package/dist/device/constants.js +64 -0
- package/dist/device/constants.js.map +1 -0
- package/dist/device/device-id.d.ts +45 -0
- package/dist/device/device-id.d.ts.map +1 -0
- package/dist/device/device-id.js +87 -0
- package/dist/device/device-id.js.map +1 -0
- package/dist/device/device-name-crypto.d.ts +39 -0
- package/dist/device/device-name-crypto.d.ts.map +1 -0
- package/dist/device/device-name-crypto.js +165 -0
- package/dist/device/device-name-crypto.js.map +1 -0
- package/dist/device/index.d.ts +31 -0
- package/dist/device/index.d.ts.map +1 -0
- package/dist/device/index.js +35 -0
- package/dist/device/index.js.map +1 -0
- package/dist/device/lifecycle/index.d.ts +25 -0
- package/dist/device/lifecycle/index.d.ts.map +1 -0
- package/dist/device/lifecycle/index.js +3 -0
- package/dist/device/lifecycle/index.js.map +1 -0
- package/dist/device/lifecycle/manager.d.ts +273 -0
- package/dist/device/lifecycle/manager.d.ts.map +1 -0
- package/dist/device/lifecycle/manager.js +1229 -0
- package/dist/device/lifecycle/manager.js.map +1 -0
- package/dist/device/lifecycle/types.d.ts +372 -0
- package/dist/device/lifecycle/types.d.ts.map +1 -0
- package/dist/device/lifecycle/types.js +10 -0
- package/dist/device/lifecycle/types.js.map +1 -0
- package/dist/device/lifecycle/utils.d.ts +37 -0
- package/dist/device/lifecycle/utils.d.ts.map +1 -0
- package/dist/device/lifecycle/utils.js +79 -0
- package/dist/device/lifecycle/utils.js.map +1 -0
- package/dist/device/provisioning.d.ts +249 -0
- package/dist/device/provisioning.d.ts.map +1 -0
- package/dist/device/provisioning.js +439 -0
- package/dist/device/provisioning.js.map +1 -0
- package/dist/device/transfer.d.ts +231 -0
- package/dist/device/transfer.d.ts.map +1 -0
- package/dist/device/transfer.js +628 -0
- package/dist/device/transfer.js.map +1 -0
- package/dist/device/types.d.ts +275 -0
- package/dist/device/types.d.ts.map +1 -0
- package/dist/device/types.js +42 -0
- package/dist/device/types.js.map +1 -0
- package/dist/encoding/base64.d.ts +14 -0
- package/dist/encoding/base64.d.ts.map +1 -0
- package/dist/encoding/base64.js +2 -0
- package/dist/encoding/base64.js.map +1 -0
- package/dist/encoding/hex.d.ts +14 -0
- package/dist/encoding/hex.d.ts.map +1 -0
- package/dist/encoding/hex.js +2 -0
- package/dist/encoding/hex.js.map +1 -0
- package/dist/encoding/index.d.ts +17 -0
- package/dist/encoding/index.d.ts.map +1 -0
- package/dist/encoding/index.js +3 -0
- package/dist/encoding/index.js.map +1 -0
- package/dist/files/index.d.ts +16 -0
- package/dist/files/index.d.ts.map +1 -0
- package/dist/files/index.js +15 -0
- package/dist/files/index.js.map +1 -0
- package/dist/groups/index.d.ts +12 -0
- package/dist/groups/index.d.ts.map +1 -0
- package/dist/groups/index.js +9 -0
- package/dist/groups/index.js.map +1 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-connection-presence.d.ts +68 -0
- package/dist/hooks/use-connection-presence.d.ts.map +1 -0
- package/dist/hooks/use-connection-presence.js +300 -0
- package/dist/hooks/use-connection-presence.js.map +1 -0
- package/dist/hooks/use-group-membership.d.ts +66 -0
- package/dist/hooks/use-group-membership.d.ts.map +1 -0
- package/dist/hooks/use-group-membership.js +156 -0
- package/dist/hooks/use-group-membership.js.map +1 -0
- package/dist/hooks/use-key-rotation.d.ts +119 -0
- package/dist/hooks/use-key-rotation.d.ts.map +1 -0
- package/dist/hooks/use-key-rotation.js +198 -0
- package/dist/hooks/use-key-rotation.js.map +1 -0
- package/dist/hooks/use-session-health.d.ts +51 -0
- package/dist/hooks/use-session-health.d.ts.map +1 -0
- package/dist/hooks/use-session-health.js +59 -0
- package/dist/hooks/use-session-health.js.map +1 -0
- package/dist/hooks/use-single-flight.d.ts +29 -0
- package/dist/hooks/use-single-flight.d.ts.map +1 -0
- package/dist/hooks/use-single-flight.js +59 -0
- package/dist/hooks/use-single-flight.js.map +1 -0
- package/dist/index.d.ts +203 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +169 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/crypto/ec/ed25519.d.ts +78 -0
- package/dist/internal/crypto/ec/ed25519.d.ts.map +1 -0
- package/dist/internal/crypto/ec/ed25519.js +108 -0
- package/dist/internal/crypto/ec/ed25519.js.map +1 -0
- package/dist/internal/crypto/ec/index.d.ts +5 -0
- package/dist/internal/crypto/ec/index.d.ts.map +1 -0
- package/dist/internal/crypto/ec/index.js +4 -0
- package/dist/internal/crypto/ec/index.js.map +1 -0
- package/dist/internal/crypto/ec/x25519-validation.d.ts +70 -0
- package/dist/internal/crypto/ec/x25519-validation.d.ts.map +1 -0
- package/dist/internal/crypto/ec/x25519-validation.js +137 -0
- package/dist/internal/crypto/ec/x25519-validation.js.map +1 -0
- package/dist/internal/crypto/ec/x25519.d.ts +91 -0
- package/dist/internal/crypto/ec/x25519.d.ts.map +1 -0
- package/dist/internal/crypto/ec/x25519.js +124 -0
- package/dist/internal/crypto/ec/x25519.js.map +1 -0
- package/dist/internal/crypto/hash/index.d.ts +4 -0
- package/dist/internal/crypto/hash/index.d.ts.map +1 -0
- package/dist/internal/crypto/hash/index.js +3 -0
- package/dist/internal/crypto/hash/index.js.map +1 -0
- package/dist/internal/crypto/hash/sha256.d.ts +24 -0
- package/dist/internal/crypto/hash/sha256.d.ts.map +1 -0
- package/dist/internal/crypto/hash/sha256.js +23 -0
- package/dist/internal/crypto/hash/sha256.js.map +1 -0
- package/dist/internal/crypto/hash/sha512.d.ts +16 -0
- package/dist/internal/crypto/hash/sha512.d.ts.map +1 -0
- package/dist/internal/crypto/hash/sha512.js +27 -0
- package/dist/internal/crypto/hash/sha512.js.map +1 -0
- package/dist/internal/crypto/index.d.ts +60 -0
- package/dist/internal/crypto/index.d.ts.map +1 -0
- package/dist/internal/crypto/index.js +107 -0
- package/dist/internal/crypto/index.js.map +1 -0
- package/dist/internal/crypto/kdf/hkdf.d.ts +300 -0
- package/dist/internal/crypto/kdf/hkdf.d.ts.map +1 -0
- package/dist/internal/crypto/kdf/hkdf.js +452 -0
- package/dist/internal/crypto/kdf/hkdf.js.map +1 -0
- package/dist/internal/crypto/kdf/index.d.ts +4 -0
- package/dist/internal/crypto/kdf/index.d.ts.map +1 -0
- package/dist/internal/crypto/kdf/index.js +3 -0
- package/dist/internal/crypto/kdf/index.js.map +1 -0
- package/dist/internal/crypto/kdf/pbkdf2.d.ts +42 -0
- package/dist/internal/crypto/kdf/pbkdf2.d.ts.map +1 -0
- package/dist/internal/crypto/kdf/pbkdf2.js +44 -0
- package/dist/internal/crypto/kdf/pbkdf2.js.map +1 -0
- package/dist/internal/crypto/key-prefix.d.ts +82 -0
- package/dist/internal/crypto/key-prefix.d.ts.map +1 -0
- package/dist/internal/crypto/key-prefix.js +116 -0
- package/dist/internal/crypto/key-prefix.js.map +1 -0
- package/dist/internal/crypto/pq/index.d.ts +3 -0
- package/dist/internal/crypto/pq/index.d.ts.map +1 -0
- package/dist/internal/crypto/pq/index.js +2 -0
- package/dist/internal/crypto/pq/index.js.map +1 -0
- package/dist/internal/crypto/pq/kyber.d.ts +232 -0
- package/dist/internal/crypto/pq/kyber.d.ts.map +1 -0
- package/dist/internal/crypto/pq/kyber.js +317 -0
- package/dist/internal/crypto/pq/kyber.js.map +1 -0
- package/dist/internal/crypto/random.d.ts +22 -0
- package/dist/internal/crypto/random.d.ts.map +1 -0
- package/dist/internal/crypto/random.js +45 -0
- package/dist/internal/crypto/random.js.map +1 -0
- package/dist/internal/crypto/symmetric/aes-ctr.d.ts +73 -0
- package/dist/internal/crypto/symmetric/aes-ctr.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/aes-ctr.js +98 -0
- package/dist/internal/crypto/symmetric/aes-ctr.js.map +1 -0
- package/dist/internal/crypto/symmetric/aes-gcm-siv.d.ts +77 -0
- package/dist/internal/crypto/symmetric/aes-gcm-siv.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/aes-gcm-siv.js +111 -0
- package/dist/internal/crypto/symmetric/aes-gcm-siv.js.map +1 -0
- package/dist/internal/crypto/symmetric/aes.d.ts +211 -0
- package/dist/internal/crypto/symmetric/aes.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/aes.js +386 -0
- package/dist/internal/crypto/symmetric/aes.js.map +1 -0
- package/dist/internal/crypto/symmetric/hmac.d.ts +32 -0
- package/dist/internal/crypto/symmetric/hmac.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/hmac.js +20 -0
- package/dist/internal/crypto/symmetric/hmac.js.map +1 -0
- package/dist/internal/crypto/symmetric/index.d.ts +9 -0
- package/dist/internal/crypto/symmetric/index.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/index.js +8 -0
- package/dist/internal/crypto/symmetric/index.js.map +1 -0
- package/dist/internal/crypto/symmetric/mac.d.ts +154 -0
- package/dist/internal/crypto/symmetric/mac.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/mac.js +292 -0
- package/dist/internal/crypto/symmetric/mac.js.map +1 -0
- package/dist/internal/crypto/symmetric/padding.d.ts +55 -0
- package/dist/internal/crypto/symmetric/padding.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/padding.js +90 -0
- package/dist/internal/crypto/symmetric/padding.js.map +1 -0
- package/dist/internal/crypto/symmetric/streaming-aead.d.ts +89 -0
- package/dist/internal/crypto/symmetric/streaming-aead.d.ts.map +1 -0
- package/dist/internal/crypto/symmetric/streaming-aead.js +253 -0
- package/dist/internal/crypto/symmetric/streaming-aead.js.map +1 -0
- package/dist/internal/crypto/utils.d.ts +119 -0
- package/dist/internal/crypto/utils.d.ts.map +1 -0
- package/dist/internal/crypto/utils.js +366 -0
- package/dist/internal/crypto/utils.js.map +1 -0
- package/dist/internal/crypto/validation.d.ts +45 -0
- package/dist/internal/crypto/validation.d.ts.map +1 -0
- package/dist/internal/crypto/validation.js +37 -0
- package/dist/internal/crypto/validation.js.map +1 -0
- package/dist/internal/encoding/index.d.ts +2 -0
- package/dist/internal/encoding/index.d.ts.map +1 -0
- package/dist/internal/encoding/index.js +2 -0
- package/dist/internal/encoding/index.js.map +1 -0
- package/dist/internal/encoding/proto/envelope.d.ts +120 -0
- package/dist/internal/encoding/proto/envelope.d.ts.map +1 -0
- package/dist/internal/encoding/proto/envelope.js +160 -0
- package/dist/internal/encoding/proto/envelope.js.map +1 -0
- package/dist/internal/encoding/proto/index.d.ts +25 -0
- package/dist/internal/encoding/proto/index.d.ts.map +1 -0
- package/dist/internal/encoding/proto/index.js +30 -0
- package/dist/internal/encoding/proto/index.js.map +1 -0
- package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts +118 -0
- package/dist/internal/encoding/proto/pq-ratchet-serialize.d.ts.map +1 -0
- package/dist/internal/encoding/proto/pq-ratchet-serialize.js +383 -0
- package/dist/internal/encoding/proto/pq-ratchet-serialize.js.map +1 -0
- package/dist/internal/encoding/proto/primitives.d.ts +98 -0
- package/dist/internal/encoding/proto/primitives.d.ts.map +1 -0
- package/dist/internal/encoding/proto/primitives.js +179 -0
- package/dist/internal/encoding/proto/primitives.js.map +1 -0
- package/dist/internal/encoding/proto/sender-key-message.d.ts +147 -0
- package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -0
- package/dist/internal/encoding/proto/sender-key-message.js +220 -0
- package/dist/internal/encoding/proto/sender-key-message.js.map +1 -0
- package/dist/internal/encoding/proto/signal-message.d.ts +174 -0
- package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -0
- package/dist/internal/encoding/proto/signal-message.js +372 -0
- package/dist/internal/encoding/proto/signal-message.js.map +1 -0
- package/dist/internal/groups/group-id.d.ts +74 -0
- package/dist/internal/groups/group-id.d.ts.map +1 -0
- package/dist/internal/groups/group-id.js +63 -0
- package/dist/internal/groups/group-id.js.map +1 -0
- package/dist/internal/groups/index.d.ts +15 -0
- package/dist/internal/groups/index.d.ts.map +1 -0
- package/dist/internal/groups/index.js +2 -0
- package/dist/internal/groups/index.js.map +1 -0
- package/dist/internal/groups-v2/access-control.d.ts +101 -0
- package/dist/internal/groups-v2/access-control.d.ts.map +1 -0
- package/dist/internal/groups-v2/access-control.js +184 -0
- package/dist/internal/groups-v2/access-control.js.map +1 -0
- package/dist/internal/groups-v2/change-actions.d.ts +35 -0
- package/dist/internal/groups-v2/change-actions.d.ts.map +1 -0
- package/dist/internal/groups-v2/change-actions.js +358 -0
- package/dist/internal/groups-v2/change-actions.js.map +1 -0
- package/dist/internal/groups-v2/encrypted-state.d.ts +121 -0
- package/dist/internal/groups-v2/encrypted-state.d.ts.map +1 -0
- package/dist/internal/groups-v2/encrypted-state.js +455 -0
- package/dist/internal/groups-v2/encrypted-state.js.map +1 -0
- package/dist/internal/groups-v2/index.d.ts +14 -0
- package/dist/internal/groups-v2/index.d.ts.map +1 -0
- package/dist/internal/groups-v2/index.js +11 -0
- package/dist/internal/groups-v2/index.js.map +1 -0
- package/dist/internal/groups-v2/invite-link.d.ts +55 -0
- package/dist/internal/groups-v2/invite-link.d.ts.map +1 -0
- package/dist/internal/groups-v2/invite-link.js +111 -0
- package/dist/internal/groups-v2/invite-link.js.map +1 -0
- package/dist/internal/groups-v2/manager.d.ts +351 -0
- package/dist/internal/groups-v2/manager.d.ts.map +1 -0
- package/dist/internal/groups-v2/manager.js +1093 -0
- package/dist/internal/groups-v2/manager.js.map +1 -0
- package/dist/internal/groups-v2/types.d.ts +371 -0
- package/dist/internal/groups-v2/types.d.ts.map +1 -0
- package/dist/internal/groups-v2/types.js +61 -0
- package/dist/internal/groups-v2/types.js.map +1 -0
- package/dist/internal/manager/index.d.ts +16 -0
- package/dist/internal/manager/index.d.ts.map +1 -0
- package/dist/internal/manager/index.js +2 -0
- package/dist/internal/manager/index.js.map +1 -0
- package/dist/internal/manager/manager.d.ts +378 -0
- package/dist/internal/manager/manager.d.ts.map +1 -0
- package/dist/internal/manager/manager.js +1079 -0
- package/dist/internal/manager/manager.js.map +1 -0
- package/dist/internal/protocol/double-ratchet/chains.d.ts +135 -0
- package/dist/internal/protocol/double-ratchet/chains.d.ts.map +1 -0
- package/dist/internal/protocol/double-ratchet/chains.js +417 -0
- package/dist/internal/protocol/double-ratchet/chains.js.map +1 -0
- package/dist/internal/protocol/double-ratchet/index.d.ts +20 -0
- package/dist/internal/protocol/double-ratchet/index.d.ts.map +1 -0
- package/dist/internal/protocol/double-ratchet/index.js +21 -0
- package/dist/internal/protocol/double-ratchet/index.js.map +1 -0
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts +231 -0
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -0
- package/dist/internal/protocol/double-ratchet/ratchet.js +198 -0
- package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -0
- package/dist/internal/protocol/index.d.ts +24 -0
- package/dist/internal/protocol/index.d.ts.map +1 -0
- package/dist/internal/protocol/index.js +9 -0
- package/dist/internal/protocol/index.js.map +1 -0
- package/dist/internal/protocol/pqxdh/index.d.ts +19 -0
- package/dist/internal/protocol/pqxdh/index.d.ts.map +1 -0
- package/dist/internal/protocol/pqxdh/index.js +16 -0
- package/dist/internal/protocol/pqxdh/index.js.map +1 -0
- package/dist/internal/protocol/pqxdh/pqxdh.d.ts +141 -0
- package/dist/internal/protocol/pqxdh/pqxdh.d.ts.map +1 -0
- package/dist/internal/protocol/pqxdh/pqxdh.js +399 -0
- package/dist/internal/protocol/pqxdh/pqxdh.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/certificate.d.ts +94 -0
- package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/certificate.js +254 -0
- package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts +46 -0
- package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/decryption-v2.js +184 -0
- package/dist/internal/protocol/sealed-sender/decryption-v2.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/decryption.d.ts +59 -0
- package/dist/internal/protocol/sealed-sender/decryption.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/decryption.js +268 -0
- package/dist/internal/protocol/sealed-sender/decryption.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/delivery-token.d.ts +48 -0
- package/dist/internal/protocol/sealed-sender/delivery-token.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/delivery-token.js +71 -0
- package/dist/internal/protocol/sealed-sender/delivery-token.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts +56 -0
- package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/encryption-v2.js +169 -0
- package/dist/internal/protocol/sealed-sender/encryption-v2.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/encryption.d.ts +66 -0
- package/dist/internal/protocol/sealed-sender/encryption.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/encryption.js +174 -0
- package/dist/internal/protocol/sealed-sender/encryption.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/index.d.ts +23 -0
- package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/index.js +61 -0
- package/dist/internal/protocol/sealed-sender/index.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +129 -0
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/proto/index.js +267 -0
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/types.d.ts +461 -0
- package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/types.js +99 -0
- package/dist/internal/protocol/sealed-sender/types.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/v2-binary.d.ts +124 -0
- package/dist/internal/protocol/sealed-sender/v2-binary.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/v2-binary.js +295 -0
- package/dist/internal/protocol/sealed-sender/v2-binary.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/v2-helpers.d.ts +107 -0
- package/dist/internal/protocol/sealed-sender/v2-helpers.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/v2-helpers.js +185 -0
- package/dist/internal/protocol/sealed-sender/v2-helpers.js.map +1 -0
- package/dist/internal/protocol/sender-keys/index.d.ts +11 -0
- package/dist/internal/protocol/sender-keys/index.d.ts.map +1 -0
- package/dist/internal/protocol/sender-keys/index.js +2 -0
- package/dist/internal/protocol/sender-keys/index.js.map +1 -0
- package/dist/internal/protocol/sender-keys/manager.d.ts +298 -0
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -0
- package/dist/internal/protocol/sender-keys/manager.js +839 -0
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -0
- package/dist/internal/protocol/spqr/braid-serialize.d.ts +128 -0
- package/dist/internal/protocol/spqr/braid-serialize.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/braid-serialize.js +373 -0
- package/dist/internal/protocol/spqr/braid-serialize.js.map +1 -0
- package/dist/internal/protocol/spqr/braid.d.ts +164 -0
- package/dist/internal/protocol/spqr/braid.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/braid.js +305 -0
- package/dist/internal/protocol/spqr/braid.js.map +1 -0
- package/dist/internal/protocol/spqr/index.d.ts +161 -0
- package/dist/internal/protocol/spqr/index.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/index.js +115 -0
- package/dist/internal/protocol/spqr/index.js.map +1 -0
- package/dist/internal/protocol/spqr/message.d.ts +237 -0
- package/dist/internal/protocol/spqr/message.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/message.js +298 -0
- package/dist/internal/protocol/spqr/message.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.d.ts +174 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.js +248 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/authenticator.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.d.ts +29 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.js +43 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/chunk-domain.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/errors.d.ts +170 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/errors.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/errors.js +249 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/errors.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts +84 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js +138 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/index.d.ts +45 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/index.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/index.js +94 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/index.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.d.ts +52 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.js +121 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/kdf.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.d.ts +12 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.js +15 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/arithmetic.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts +136 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js +796 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts +454 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js +790 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/codec.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.d.ts +108 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.js +125 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/field.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.d.ts +12 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.js +5 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/index.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.d.ts +28 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.js +13953 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/galois/tables-16.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.d.ts +40 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.js +52 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/index.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.d.ts +151 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.js +297 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/lagrange.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.d.ts +97 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.js +201 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/rs/polynomial.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts +249 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js +731 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts +127 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +894 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +387 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/types.js +121 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/types.js.map +1 -0
- package/dist/internal/protocol/spqr/serialize.d.ts +149 -0
- package/dist/internal/protocol/spqr/serialize.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/serialize.js +370 -0
- package/dist/internal/protocol/spqr/serialize.js.map +1 -0
- package/dist/internal/protocol/spqr/spqr.d.ts +486 -0
- package/dist/internal/protocol/spqr/spqr.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/spqr.js +1031 -0
- package/dist/internal/protocol/spqr/spqr.js.map +1 -0
- package/dist/internal/protocol/spqr/validate.d.ts +35 -0
- package/dist/internal/protocol/spqr/validate.d.ts.map +1 -0
- package/dist/internal/protocol/spqr/validate.js +62 -0
- package/dist/internal/protocol/spqr/validate.js.map +1 -0
- package/dist/internal/protocol/triple-ratchet/index.d.ts +21 -0
- package/dist/internal/protocol/triple-ratchet/index.d.ts.map +1 -0
- package/dist/internal/protocol/triple-ratchet/index.js +19 -0
- package/dist/internal/protocol/triple-ratchet/index.js.map +1 -0
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +233 -0
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +1 -0
- package/dist/internal/protocol/triple-ratchet/ratchet.js +254 -0
- package/dist/internal/protocol/triple-ratchet/ratchet.js.map +1 -0
- package/dist/internal/protocol/username/generate.d.ts +9 -0
- package/dist/internal/protocol/username/generate.d.ts.map +1 -0
- package/dist/internal/protocol/username/generate.js +16 -0
- package/dist/internal/protocol/username/generate.js.map +1 -0
- package/dist/internal/protocol/username/hash.d.ts +74 -0
- package/dist/internal/protocol/username/hash.d.ts.map +1 -0
- package/dist/internal/protocol/username/hash.js +228 -0
- package/dist/internal/protocol/username/hash.js.map +1 -0
- package/dist/internal/protocol/username/link.d.ts +50 -0
- package/dist/internal/protocol/username/link.d.ts.map +1 -0
- package/dist/internal/protocol/username/link.js +187 -0
- package/dist/internal/protocol/username/link.js.map +1 -0
- package/dist/internal/protocol/username/proof.d.ts +34 -0
- package/dist/internal/protocol/username/proof.d.ts.map +1 -0
- package/dist/internal/protocol/username/proof.js +83 -0
- package/dist/internal/protocol/username/proof.js.map +1 -0
- package/dist/internal/protocol/version.d.ts +184 -0
- package/dist/internal/protocol/version.d.ts.map +1 -0
- package/dist/internal/protocol/version.js +163 -0
- package/dist/internal/protocol/version.js.map +1 -0
- package/dist/internal/protocol/x3dh/index.d.ts +15 -0
- package/dist/internal/protocol/x3dh/index.d.ts.map +1 -0
- package/dist/internal/protocol/x3dh/index.js +13 -0
- package/dist/internal/protocol/x3dh/index.js.map +1 -0
- package/dist/internal/protocol/x3dh/x3dh.d.ts +131 -0
- package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -0
- package/dist/internal/protocol/x3dh/x3dh.js +261 -0
- package/dist/internal/protocol/x3dh/x3dh.js.map +1 -0
- package/dist/internal/protocol/zk/credentials/attributes.d.ts +157 -0
- package/dist/internal/protocol/zk/credentials/attributes.d.ts.map +1 -0
- package/dist/internal/protocol/zk/credentials/attributes.js +177 -0
- package/dist/internal/protocol/zk/credentials/attributes.js.map +1 -0
- package/dist/internal/protocol/zk/credentials/credentials.d.ts +129 -0
- package/dist/internal/protocol/zk/credentials/credentials.d.ts.map +1 -0
- package/dist/internal/protocol/zk/credentials/credentials.js +204 -0
- package/dist/internal/protocol/zk/credentials/credentials.js.map +1 -0
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts +235 -0
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts.map +1 -0
- package/dist/internal/protocol/zk/credentials/endorsements.js +520 -0
- package/dist/internal/protocol/zk/credentials/endorsements.js.map +1 -0
- package/dist/internal/protocol/zk/credentials/index.d.ts +14 -0
- package/dist/internal/protocol/zk/credentials/index.d.ts.map +1 -0
- package/dist/internal/protocol/zk/credentials/index.js +6 -0
- package/dist/internal/protocol/zk/credentials/index.js.map +1 -0
- package/dist/internal/protocol/zk/credentials/issuance.d.ts +135 -0
- package/dist/internal/protocol/zk/credentials/issuance.d.ts.map +1 -0
- package/dist/internal/protocol/zk/credentials/issuance.js +338 -0
- package/dist/internal/protocol/zk/credentials/issuance.js.map +1 -0
- package/dist/internal/protocol/zk/credentials/presentation.d.ts +160 -0
- package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -0
- package/dist/internal/protocol/zk/credentials/presentation.js +447 -0
- package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -0
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts +191 -0
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/auth-credential.js +377 -0
- package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -0
- package/dist/internal/protocol/zk/groups/client-zk-group-cipher.d.ts +73 -0
- package/dist/internal/protocol/zk/groups/client-zk-group-cipher.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/client-zk-group-cipher.js +140 -0
- package/dist/internal/protocol/zk/groups/client-zk-group-cipher.js.map +1 -0
- package/dist/internal/protocol/zk/groups/group-params.d.ts +93 -0
- package/dist/internal/protocol/zk/groups/group-params.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/group-params.js +184 -0
- package/dist/internal/protocol/zk/groups/group-params.js.map +1 -0
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts +245 -0
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js +404 -0
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js.map +1 -0
- package/dist/internal/protocol/zk/groups/index.d.ts +19 -0
- package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/index.js +12 -0
- package/dist/internal/protocol/zk/groups/index.js.map +1 -0
- package/dist/internal/protocol/zk/groups/lizard.d.ts +51 -0
- package/dist/internal/protocol/zk/groups/lizard.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/lizard.js +478 -0
- package/dist/internal/protocol/zk/groups/lizard.js.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-commitment.d.ts +35 -0
- package/dist/internal/protocol/zk/groups/profile-key-commitment.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-commitment.js +99 -0
- package/dist/internal/protocol/zk/groups/profile-key-commitment.js.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +195 -0
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-credential.js +370 -0
- package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-encryption.d.ts +45 -0
- package/dist/internal/protocol/zk/groups/profile-key-encryption.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-encryption.js +125 -0
- package/dist/internal/protocol/zk/groups/profile-key-encryption.js.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-struct.d.ts +33 -0
- package/dist/internal/protocol/zk/groups/profile-key-struct.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-struct.js +62 -0
- package/dist/internal/protocol/zk/groups/profile-key-struct.js.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-version.d.ts +17 -0
- package/dist/internal/protocol/zk/groups/profile-key-version.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/profile-key-version.js +33 -0
- package/dist/internal/protocol/zk/groups/profile-key-version.js.map +1 -0
- package/dist/internal/protocol/zk/groups/server-params.d.ts +114 -0
- package/dist/internal/protocol/zk/groups/server-params.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/server-params.js +146 -0
- package/dist/internal/protocol/zk/groups/server-params.js.map +1 -0
- package/dist/internal/protocol/zk/groups/uid-encryption.d.ts +41 -0
- package/dist/internal/protocol/zk/groups/uid-encryption.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/uid-encryption.js +113 -0
- package/dist/internal/protocol/zk/groups/uid-encryption.js.map +1 -0
- package/dist/internal/protocol/zk/groups/uid-struct.d.ts +48 -0
- package/dist/internal/protocol/zk/groups/uid-struct.d.ts.map +1 -0
- package/dist/internal/protocol/zk/groups/uid-struct.js +77 -0
- package/dist/internal/protocol/zk/groups/uid-struct.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/args.d.ts +33 -0
- package/dist/internal/protocol/zk/proofs/args.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/args.js +43 -0
- package/dist/internal/protocol/zk/proofs/args.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/index.d.ts +13 -0
- package/dist/internal/protocol/zk/proofs/index.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/index.js +7 -0
- package/dist/internal/protocol/zk/proofs/index.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/proof.d.ts +30 -0
- package/dist/internal/protocol/zk/proofs/proof.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/proof.js +48 -0
- package/dist/internal/protocol/zk/proofs/proof.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/sho-sha256.d.ts +34 -0
- package/dist/internal/protocol/zk/proofs/sho-sha256.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/sho-sha256.js +138 -0
- package/dist/internal/protocol/zk/proofs/sho-sha256.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/sho.d.ts +120 -0
- package/dist/internal/protocol/zk/proofs/sho.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/sho.js +221 -0
- package/dist/internal/protocol/zk/proofs/sho.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/sign.d.ts +29 -0
- package/dist/internal/protocol/zk/proofs/sign.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/sign.js +34 -0
- package/dist/internal/protocol/zk/proofs/sign.js.map +1 -0
- package/dist/internal/protocol/zk/proofs/statement.d.ts +103 -0
- package/dist/internal/protocol/zk/proofs/statement.d.ts.map +1 -0
- package/dist/internal/protocol/zk/proofs/statement.js +282 -0
- package/dist/internal/protocol/zk/proofs/statement.js.map +1 -0
- package/dist/internal/sesame/device-registry.d.ts +208 -0
- package/dist/internal/sesame/device-registry.d.ts.map +1 -0
- package/dist/internal/sesame/device-registry.js +431 -0
- package/dist/internal/sesame/device-registry.js.map +1 -0
- package/dist/internal/sesame/index.d.ts +31 -0
- package/dist/internal/sesame/index.d.ts.map +1 -0
- package/dist/internal/sesame/index.js +40 -0
- package/dist/internal/sesame/index.js.map +1 -0
- package/dist/internal/sesame/manager.d.ts +351 -0
- package/dist/internal/sesame/manager.d.ts.map +1 -0
- package/dist/internal/sesame/manager.js +1760 -0
- package/dist/internal/sesame/manager.js.map +1 -0
- package/dist/internal/sesame/types.d.ts +840 -0
- package/dist/internal/sesame/types.d.ts.map +1 -0
- package/dist/internal/sesame/types.js +290 -0
- package/dist/internal/sesame/types.js.map +1 -0
- package/dist/internal/sesame/validation.d.ts +72 -0
- package/dist/internal/sesame/validation.d.ts.map +1 -0
- package/dist/internal/sesame/validation.js +136 -0
- package/dist/internal/sesame/validation.js.map +1 -0
- package/dist/internal/session/builder.d.ts +94 -0
- package/dist/internal/session/builder.d.ts.map +1 -0
- package/dist/internal/session/builder.js +266 -0
- package/dist/internal/session/builder.js.map +1 -0
- package/dist/internal/session/cipher.d.ts +256 -0
- package/dist/internal/session/cipher.d.ts.map +1 -0
- package/dist/internal/session/cipher.js +1222 -0
- package/dist/internal/session/cipher.js.map +1 -0
- package/dist/internal/session/decryption.d.ts +37 -0
- package/dist/internal/session/decryption.d.ts.map +1 -0
- package/dist/internal/session/decryption.js +256 -0
- package/dist/internal/session/decryption.js.map +1 -0
- package/dist/internal/session/factory.d.ts +161 -0
- package/dist/internal/session/factory.d.ts.map +1 -0
- package/dist/internal/session/factory.js +211 -0
- package/dist/internal/session/factory.js.map +1 -0
- package/dist/internal/session/handshake.d.ts +72 -0
- package/dist/internal/session/handshake.d.ts.map +1 -0
- package/dist/internal/session/handshake.js +343 -0
- package/dist/internal/session/handshake.js.map +1 -0
- package/dist/internal/session/identity-binding.d.ts +5 -0
- package/dist/internal/session/identity-binding.d.ts.map +1 -0
- package/dist/internal/session/identity-binding.js +15 -0
- package/dist/internal/session/identity-binding.js.map +1 -0
- package/dist/internal/session/index.d.ts +73 -0
- package/dist/internal/session/index.d.ts.map +1 -0
- package/dist/internal/session/index.js +75 -0
- package/dist/internal/session/index.js.map +1 -0
- package/dist/internal/session/keys.d.ts +220 -0
- package/dist/internal/session/keys.d.ts.map +1 -0
- package/dist/internal/session/keys.js +78 -0
- package/dist/internal/session/keys.js.map +1 -0
- package/dist/internal/session/ratchet.d.ts +97 -0
- package/dist/internal/session/ratchet.d.ts.map +1 -0
- package/dist/internal/session/ratchet.js +187 -0
- package/dist/internal/session/ratchet.js.map +1 -0
- package/dist/internal/session/session-resolver.d.ts +138 -0
- package/dist/internal/session/session-resolver.d.ts.map +1 -0
- package/dist/internal/session/session-resolver.js +190 -0
- package/dist/internal/session/session-resolver.js.map +1 -0
- package/dist/internal/session/state.d.ts +278 -0
- package/dist/internal/session/state.d.ts.map +1 -0
- package/dist/internal/session/state.js +167 -0
- package/dist/internal/session/state.js.map +1 -0
- package/dist/internal/session/types.d.ts +192 -0
- package/dist/internal/session/types.d.ts.map +1 -0
- package/dist/internal/session/types.js +16 -0
- package/dist/internal/session/types.js.map +1 -0
- package/dist/internal/session/validation.d.ts +145 -0
- package/dist/internal/session/validation.d.ts.map +1 -0
- package/dist/internal/session/validation.js +340 -0
- package/dist/internal/session/validation.js.map +1 -0
- package/dist/keys/branded.d.ts +85 -0
- package/dist/keys/branded.d.ts.map +1 -0
- package/dist/keys/branded.js +26 -0
- package/dist/keys/branded.js.map +1 -0
- package/dist/keys/generation.d.ts +101 -0
- package/dist/keys/generation.d.ts.map +1 -0
- package/dist/keys/generation.js +181 -0
- package/dist/keys/generation.js.map +1 -0
- package/dist/keys/identity.d.ts +27 -0
- package/dist/keys/identity.d.ts.map +1 -0
- package/dist/keys/identity.js +200 -0
- package/dist/keys/identity.js.map +1 -0
- package/dist/keys/index.d.ts +24 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +22 -0
- package/dist/keys/index.js.map +1 -0
- package/dist/keys/prekey-signature.d.ts +13 -0
- package/dist/keys/prekey-signature.d.ts.map +1 -0
- package/dist/keys/prekey-signature.js +46 -0
- package/dist/keys/prekey-signature.js.map +1 -0
- package/dist/keys/types.d.ts +255 -0
- package/dist/keys/types.d.ts.map +1 -0
- package/dist/keys/types.js +11 -0
- package/dist/keys/types.js.map +1 -0
- package/dist/layers.d.ts +228 -0
- package/dist/layers.d.ts.map +1 -0
- package/dist/layers.js +328 -0
- package/dist/layers.js.map +1 -0
- package/dist/local/store/expo/adapter.d.ts +243 -0
- package/dist/local/store/expo/adapter.d.ts.map +1 -0
- package/dist/local/store/expo/adapter.js +619 -0
- package/dist/local/store/expo/adapter.js.map +1 -0
- package/dist/local/store/expo/database-key.d.ts +142 -0
- package/dist/local/store/expo/database-key.d.ts.map +1 -0
- package/dist/local/store/expo/database-key.js +312 -0
- package/dist/local/store/expo/database-key.js.map +1 -0
- package/dist/local/store/expo/db.d.ts +92 -0
- package/dist/local/store/expo/db.d.ts.map +1 -0
- package/dist/local/store/expo/db.js +142 -0
- package/dist/local/store/expo/db.js.map +1 -0
- package/dist/local/store/expo/index.d.ts +22 -0
- package/dist/local/store/expo/index.d.ts.map +1 -0
- package/dist/local/store/expo/index.js +10 -0
- package/dist/local/store/expo/index.js.map +1 -0
- package/dist/local/store/expo/key-storage.d.ts +422 -0
- package/dist/local/store/expo/key-storage.d.ts.map +1 -0
- package/dist/local/store/expo/key-storage.js +1292 -0
- package/dist/local/store/expo/key-storage.js.map +1 -0
- package/dist/local/store/expo/maintenance.d.ts +4 -0
- package/dist/local/store/expo/maintenance.d.ts.map +1 -0
- package/dist/local/store/expo/maintenance.js +36 -0
- package/dist/local/store/expo/maintenance.js.map +1 -0
- package/dist/local/store/expo/models/ec-one-time-prekey.d.ts +155 -0
- package/dist/local/store/expo/models/ec-one-time-prekey.d.ts.map +1 -0
- package/dist/local/store/expo/models/ec-one-time-prekey.js +309 -0
- package/dist/local/store/expo/models/ec-one-time-prekey.js.map +1 -0
- package/dist/local/store/expo/models/ec-signed-prekey.d.ts +189 -0
- package/dist/local/store/expo/models/ec-signed-prekey.d.ts.map +1 -0
- package/dist/local/store/expo/models/ec-signed-prekey.js +359 -0
- package/dist/local/store/expo/models/ec-signed-prekey.js.map +1 -0
- package/dist/local/store/expo/models/identity-key-id.d.ts +9 -0
- package/dist/local/store/expo/models/identity-key-id.d.ts.map +1 -0
- package/dist/local/store/expo/models/identity-key-id.js +10 -0
- package/dist/local/store/expo/models/identity-key-id.js.map +1 -0
- package/dist/local/store/expo/models/index.d.ts +20 -0
- package/dist/local/store/expo/models/index.d.ts.map +1 -0
- package/dist/local/store/expo/models/index.js +80 -0
- package/dist/local/store/expo/models/index.js.map +1 -0
- package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts +183 -0
- package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts.map +1 -0
- package/dist/local/store/expo/models/kyber-one-time-prekey.js +353 -0
- package/dist/local/store/expo/models/kyber-one-time-prekey.js.map +1 -0
- package/dist/local/store/expo/models/kyber-prekey-used.d.ts +37 -0
- package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +1 -0
- package/dist/local/store/expo/models/kyber-prekey-used.js +59 -0
- package/dist/local/store/expo/models/kyber-prekey-used.js.map +1 -0
- package/dist/local/store/expo/models/kyber-prekey.d.ts +172 -0
- package/dist/local/store/expo/models/kyber-prekey.d.ts.map +1 -0
- package/dist/local/store/expo/models/kyber-prekey.js +314 -0
- package/dist/local/store/expo/models/kyber-prekey.js.map +1 -0
- package/dist/local/store/expo/models/local-identity.d.ts +52 -0
- package/dist/local/store/expo/models/local-identity.d.ts.map +1 -0
- package/dist/local/store/expo/models/local-identity.js +166 -0
- package/dist/local/store/expo/models/local-identity.js.map +1 -0
- package/dist/local/store/expo/models/message-record.d.ts +198 -0
- package/dist/local/store/expo/models/message-record.d.ts.map +1 -0
- package/dist/local/store/expo/models/message-record.js +298 -0
- package/dist/local/store/expo/models/message-record.js.map +1 -0
- package/dist/local/store/expo/models/recipient-identity.d.ts +21 -0
- package/dist/local/store/expo/models/recipient-identity.d.ts.map +1 -0
- package/dist/local/store/expo/models/recipient-identity.js +66 -0
- package/dist/local/store/expo/models/recipient-identity.js.map +1 -0
- package/dist/local/store/expo/models/replaced-prekey-utils.d.ts +33 -0
- package/dist/local/store/expo/models/replaced-prekey-utils.d.ts.map +1 -0
- package/dist/local/store/expo/models/replaced-prekey-utils.js +54 -0
- package/dist/local/store/expo/models/replaced-prekey-utils.js.map +1 -0
- package/dist/local/store/expo/models/sender-key.d.ts +210 -0
- package/dist/local/store/expo/models/sender-key.d.ts.map +1 -0
- package/dist/local/store/expo/models/sender-key.js +379 -0
- package/dist/local/store/expo/models/sender-key.js.map +1 -0
- package/dist/local/store/expo/models/session.d.ts +175 -0
- package/dist/local/store/expo/models/session.d.ts.map +1 -0
- package/dist/local/store/expo/models/session.js +496 -0
- package/dist/local/store/expo/models/session.js.map +1 -0
- package/dist/local/store/expo/schema.d.ts +1734 -0
- package/dist/local/store/expo/schema.d.ts.map +1 -0
- package/dist/local/store/expo/schema.js +155 -0
- package/dist/local/store/expo/schema.js.map +1 -0
- package/dist/local/store/expo/secure-store-options.d.ts +10 -0
- package/dist/local/store/expo/secure-store-options.d.ts.map +1 -0
- package/dist/local/store/expo/secure-store-options.js +5 -0
- package/dist/local/store/expo/secure-store-options.js.map +1 -0
- package/dist/local/store/index.d.ts +41 -0
- package/dist/local/store/index.d.ts.map +1 -0
- package/dist/local/store/index.js +34 -0
- package/dist/local/store/index.js.map +1 -0
- package/dist/local/store/mock/adapter.d.ts +185 -0
- package/dist/local/store/mock/adapter.d.ts.map +1 -0
- package/dist/local/store/mock/adapter.js +875 -0
- package/dist/local/store/mock/adapter.js.map +1 -0
- package/dist/local/store/mock/index.d.ts +10 -0
- package/dist/local/store/mock/index.d.ts.map +1 -0
- package/dist/local/store/mock/index.js +6 -0
- package/dist/local/store/mock/index.js.map +1 -0
- package/dist/local/store/node/adapter.d.ts +85 -0
- package/dist/local/store/node/adapter.d.ts.map +1 -0
- package/dist/local/store/node/adapter.js +274 -0
- package/dist/local/store/node/adapter.js.map +1 -0
- package/dist/local/store/node/database-encryption.d.ts +109 -0
- package/dist/local/store/node/database-encryption.d.ts.map +1 -0
- package/dist/local/store/node/database-encryption.js +202 -0
- package/dist/local/store/node/database-encryption.js.map +1 -0
- package/dist/local/store/node/database-key.d.ts +124 -0
- package/dist/local/store/node/database-key.d.ts.map +1 -0
- package/dist/local/store/node/database-key.js +264 -0
- package/dist/local/store/node/database-key.js.map +1 -0
- package/dist/local/store/node/database.d.ts +156 -0
- package/dist/local/store/node/database.d.ts.map +1 -0
- package/dist/local/store/node/database.js +630 -0
- package/dist/local/store/node/database.js.map +1 -0
- package/dist/local/store/node/index.d.ts +11 -0
- package/dist/local/store/node/index.d.ts.map +1 -0
- package/dist/local/store/node/index.js +8 -0
- package/dist/local/store/node/index.js.map +1 -0
- package/dist/local/store/react-native/adapter.d.ts +240 -0
- package/dist/local/store/react-native/adapter.d.ts.map +1 -0
- package/dist/local/store/react-native/adapter.js +1108 -0
- package/dist/local/store/react-native/adapter.js.map +1 -0
- package/dist/local/store/react-native/index.d.ts +19 -0
- package/dist/local/store/react-native/index.d.ts.map +1 -0
- package/dist/local/store/react-native/index.js +6 -0
- package/dist/local/store/react-native/index.js.map +1 -0
- package/dist/local/store/react-native/storage.d.ts +39 -0
- package/dist/local/store/react-native/storage.d.ts.map +1 -0
- package/dist/local/store/react-native/storage.js +2 -0
- package/dist/local/store/react-native/storage.js.map +1 -0
- package/dist/local/store/session-codec.d.ts +5 -0
- package/dist/local/store/session-codec.d.ts.map +1 -0
- package/dist/local/store/session-codec.js +42 -0
- package/dist/local/store/session-codec.js.map +1 -0
- package/dist/local/store/web/adapter.d.ts +190 -0
- package/dist/local/store/web/adapter.d.ts.map +1 -0
- package/dist/local/store/web/adapter.js +1188 -0
- package/dist/local/store/web/adapter.js.map +1 -0
- package/dist/local/store/web/index.d.ts +11 -0
- package/dist/local/store/web/index.d.ts.map +1 -0
- package/dist/local/store/web/index.js +8 -0
- package/dist/local/store/web/index.js.map +1 -0
- package/dist/local/vault/expo-secure-store.d.ts +10 -0
- package/dist/local/vault/expo-secure-store.d.ts.map +1 -0
- package/dist/local/vault/expo-secure-store.js +23 -0
- package/dist/local/vault/expo-secure-store.js.map +1 -0
- package/dist/local/vault/index.d.ts +7 -0
- package/dist/local/vault/index.d.ts.map +1 -0
- package/dist/local/vault/index.js +2 -0
- package/dist/local/vault/index.js.map +1 -0
- package/dist/logger.d.ts +18 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +71 -0
- package/dist/logger.js.map +1 -0
- package/dist/media/index.d.ts +524 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +2053 -0
- package/dist/media/index.js.map +1 -0
- package/dist/profile/cipher.d.ts +125 -0
- package/dist/profile/cipher.d.ts.map +1 -0
- package/dist/profile/cipher.js +197 -0
- package/dist/profile/cipher.js.map +1 -0
- package/dist/profile/contact-state.d.ts +33 -0
- package/dist/profile/contact-state.d.ts.map +1 -0
- package/dist/profile/contact-state.js +77 -0
- package/dist/profile/contact-state.js.map +1 -0
- package/dist/profile/crypto.d.ts +65 -0
- package/dist/profile/crypto.d.ts.map +1 -0
- package/dist/profile/crypto.js +93 -0
- package/dist/profile/crypto.js.map +1 -0
- package/dist/profile/index.d.ts +26 -0
- package/dist/profile/index.d.ts.map +1 -0
- package/dist/profile/index.js +30 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/profile-key.d.ts +102 -0
- package/dist/profile/profile-key.d.ts.map +1 -0
- package/dist/profile/profile-key.js +229 -0
- package/dist/profile/profile-key.js.map +1 -0
- package/dist/profile/storage.d.ts +61 -0
- package/dist/profile/storage.d.ts.map +1 -0
- package/dist/profile/storage.js +145 -0
- package/dist/profile/storage.js.map +1 -0
- package/dist/profile/update-service.d.ts +53 -0
- package/dist/profile/update-service.d.ts.map +1 -0
- package/dist/profile/update-service.js +67 -0
- package/dist/profile/update-service.js.map +1 -0
- package/dist/remote/object-store/convex-r2/index.d.ts +11 -0
- package/dist/remote/object-store/convex-r2/index.d.ts.map +1 -0
- package/dist/remote/object-store/convex-r2/index.js +13 -0
- package/dist/remote/object-store/convex-r2/index.js.map +1 -0
- package/dist/remote/object-store/convex-r2/server/index.d.ts +2 -0
- package/dist/remote/object-store/convex-r2/server/index.d.ts.map +1 -0
- package/dist/remote/object-store/convex-r2/server/index.js +2 -0
- package/dist/remote/object-store/convex-r2/server/index.js.map +1 -0
- package/dist/remote/object-store/convex-r2/server.d.ts +126 -0
- package/dist/remote/object-store/convex-r2/server.d.ts.map +1 -0
- package/dist/remote/object-store/convex-r2/server.js +232 -0
- package/dist/remote/object-store/convex-r2/server.js.map +1 -0
- package/dist/remote/object-store/convex-r2/storage.d.ts +47 -0
- package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -0
- package/dist/remote/object-store/convex-r2/storage.js +55 -0
- package/dist/remote/object-store/convex-r2/storage.js.map +1 -0
- package/dist/remote/object-store/index.d.ts +8 -0
- package/dist/remote/object-store/index.d.ts.map +1 -0
- package/dist/remote/object-store/index.js +2 -0
- package/dist/remote/object-store/index.js.map +1 -0
- package/dist/remote/object-store/s3/index.d.ts +8 -0
- package/dist/remote/object-store/s3/index.d.ts.map +1 -0
- package/dist/remote/object-store/s3/index.js +10 -0
- package/dist/remote/object-store/s3/index.js.map +1 -0
- package/dist/remote/object-store/s3/storage.d.ts +44 -0
- package/dist/remote/object-store/s3/storage.d.ts.map +1 -0
- package/dist/remote/object-store/s3/storage.js +41 -0
- package/dist/remote/object-store/s3/storage.js.map +1 -0
- package/dist/remote/object-store/types.d.ts +80 -0
- package/dist/remote/object-store/types.d.ts.map +1 -0
- package/dist/remote/object-store/types.js +2 -0
- package/dist/remote/object-store/types.js.map +1 -0
- package/dist/remote/object-store/validation.d.ts +6 -0
- package/dist/remote/object-store/validation.d.ts.map +1 -0
- package/dist/remote/object-store/validation.js +93 -0
- package/dist/remote/object-store/validation.js.map +1 -0
- package/dist/remote/relay/convex/group-server.d.ts +118 -0
- package/dist/remote/relay/convex/group-server.d.ts.map +1 -0
- package/dist/remote/relay/convex/group-server.js +150 -0
- package/dist/remote/relay/convex/group-server.js.map +1 -0
- package/dist/remote/relay/convex/index.d.ts +39 -0
- package/dist/remote/relay/convex/index.d.ts.map +1 -0
- package/dist/remote/relay/convex/index.js +36 -0
- package/dist/remote/relay/convex/index.js.map +1 -0
- package/dist/remote/relay/convex/relay.d.ts +339 -0
- package/dist/remote/relay/convex/relay.d.ts.map +1 -0
- package/dist/remote/relay/convex/relay.js +1086 -0
- package/dist/remote/relay/convex/relay.js.map +1 -0
- package/dist/remote/relay/convex/types.d.ts +111 -0
- package/dist/remote/relay/convex/types.d.ts.map +1 -0
- package/dist/remote/relay/convex/types.js +19 -0
- package/dist/remote/relay/convex/types.js.map +1 -0
- package/dist/remote/relay/index.d.ts +34 -0
- package/dist/remote/relay/index.d.ts.map +1 -0
- package/dist/remote/relay/index.js +28 -0
- package/dist/remote/relay/index.js.map +1 -0
- package/dist/remote/relay/mock/adapter.d.ts +237 -0
- package/dist/remote/relay/mock/adapter.d.ts.map +1 -0
- package/dist/remote/relay/mock/adapter.js +939 -0
- package/dist/remote/relay/mock/adapter.js.map +1 -0
- package/dist/remote/relay/mock/index.d.ts +10 -0
- package/dist/remote/relay/mock/index.d.ts.map +1 -0
- package/dist/remote/relay/mock/index.js +6 -0
- package/dist/remote/relay/mock/index.js.map +1 -0
- package/dist/remote/relay/types.d.ts +756 -0
- package/dist/remote/relay/types.d.ts.map +1 -0
- package/dist/remote/relay/types.js +11 -0
- package/dist/remote/relay/types.js.map +1 -0
- package/dist/safety/core.d.ts +108 -0
- package/dist/safety/core.d.ts.map +1 -0
- package/dist/safety/core.js +299 -0
- package/dist/safety/core.js.map +1 -0
- package/dist/safety/fingerprint.d.ts +277 -0
- package/dist/safety/fingerprint.d.ts.map +1 -0
- package/dist/safety/fingerprint.js +339 -0
- package/dist/safety/fingerprint.js.map +1 -0
- package/dist/safety/index.d.ts +141 -0
- package/dist/safety/index.d.ts.map +1 -0
- package/dist/safety/index.js +230 -0
- package/dist/safety/index.js.map +1 -0
- package/dist/safety/protobuf.d.ts +34 -0
- package/dist/safety/protobuf.d.ts.map +1 -0
- package/dist/safety/protobuf.js +142 -0
- package/dist/safety/protobuf.js.map +1 -0
- package/dist/safety/url.d.ts +133 -0
- package/dist/safety/url.d.ts.map +1 -0
- package/dist/safety/url.js +242 -0
- package/dist/safety/url.js.map +1 -0
- package/dist/sealed-sender/index.d.ts +7 -0
- package/dist/sealed-sender/index.d.ts.map +1 -0
- package/dist/sealed-sender/index.js +6 -0
- package/dist/sealed-sender/index.js.map +1 -0
- package/dist/server-clock.d.ts +10 -0
- package/dist/server-clock.d.ts.map +1 -0
- package/dist/server-clock.js +27 -0
- package/dist/server-clock.js.map +1 -0
- package/dist/types/address.d.ts +171 -0
- package/dist/types/address.d.ts.map +1 -0
- package/dist/types/address.js +241 -0
- package/dist/types/address.js.map +1 -0
- package/dist/types/api.d.ts +1222 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +5 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/errors.d.ts +772 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +937 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +33 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/messages.d.ts +257 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/messages.js +96 -0
- package/dist/types/messages.js.map +1 -0
- package/dist/types/protocol-config.d.ts +337 -0
- package/dist/types/protocol-config.d.ts.map +1 -0
- package/dist/types/protocol-config.js +178 -0
- package/dist/types/protocol-config.js.map +1 -0
- package/dist/types/protocol-constants.d.ts +122 -0
- package/dist/types/protocol-constants.d.ts.map +1 -0
- package/dist/types/protocol-constants.js +115 -0
- package/dist/types/protocol-constants.js.map +1 -0
- package/dist/types/session.d.ts +721 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +340 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/trust.d.ts +168 -0
- package/dist/types/trust.d.ts.map +1 -0
- package/dist/types/trust.js +84 -0
- package/dist/types/trust.js.map +1 -0
- package/dist/types/utils.d.ts +93 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +89 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/username/index.d.ts +12 -0
- package/dist/username/index.d.ts.map +1 -0
- package/dist/username/index.js +11 -0
- package/dist/username/index.js.map +1 -0
- package/dist/username/link.d.ts +52 -0
- package/dist/username/link.d.ts.map +1 -0
- package/dist/username/link.js +87 -0
- package/dist/username/link.js.map +1 -0
- package/dist/utils/binary-transfer.d.ts +18 -0
- package/dist/utils/binary-transfer.d.ts.map +1 -0
- package/dist/utils/binary-transfer.js +27 -0
- package/dist/utils/binary-transfer.js.map +1 -0
- package/dist/utils/errors.d.ts +9 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +15 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/retry.d.ts +59 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +136 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/versions.d.ts +62 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +78 -0
- package/dist/versions.js.map +1 -0
- package/dist/zk/credentials.d.ts +10 -0
- package/dist/zk/credentials.d.ts.map +1 -0
- package/dist/zk/credentials.js +9 -0
- package/dist/zk/credentials.js.map +1 -0
- package/dist/zk/groups.d.ts +12 -0
- package/dist/zk/groups.d.ts.map +1 -0
- package/dist/zk/groups.js +11 -0
- package/dist/zk/groups.js.map +1 -0
- package/docs/ASSURANCE.md +102 -0
- package/docs/CLIENT_COMPOSITION.md +189 -0
- package/docs/DOCUMENTATION_STANDARDS.md +107 -0
- package/docs/E2EE.md +35 -0
- package/docs/ERROR_HANDLING.md +396 -0
- package/docs/GETTING_STARTED.md +714 -0
- package/docs/INTERFACES.md +187 -0
- package/docs/PACKAGE_SURFACE.md +235 -0
- package/docs/PROTOCOL_POLICY.md +109 -0
- package/docs/RECIPES.md +389 -0
- package/docs/SECURITY.md +199 -0
- package/docs/api/README.md +471 -0
- package/docs/api/classes/EncryptionError.md +112 -0
- package/docs/api/classes/EndorsementManager.md +307 -0
- package/docs/api/classes/SealedSenderAuthError.md +127 -0
- package/docs/api/classes/ServerDerivedKeyPair.md +68 -0
- package/docs/api/classes/ServerDerivedPublicKey.md +33 -0
- package/docs/api/classes/ServerRootKeyPair.md +94 -0
- package/docs/api/classes/ServerRootPublicKey.md +72 -0
- package/docs/api/classes/SignalBlockingManager.md +106 -0
- package/docs/api/classes/SignalProtocolClient.md +2651 -0
- package/docs/api/classes/VerificationFailure.md +25 -0
- package/docs/api/enumerations/ContentHint.md +63 -0
- package/docs/api/enumerations/EncryptionErrorCode.md +488 -0
- package/docs/api/enumerations/IdentityKeyChange.md +65 -0
- package/docs/api/enumerations/MessageType.md +29 -0
- package/docs/api/enumerations/TrustDirection.md +33 -0
- package/docs/api/enumerations/TypingAction.md +31 -0
- package/docs/api/functions/createDefaultSignalContentAdapter.md +13 -0
- package/docs/api/functions/createDefaultSignalLogger.md +36 -0
- package/docs/api/functions/createGroupId.md +32 -0
- package/docs/api/functions/createSignalProtocolClient.md +36 -0
- package/docs/api/functions/createSignalProtocolClientConfig.md +24 -0
- package/docs/api/functions/extractGroupId.md +32 -0
- package/docs/api/functions/formatVersion.md +25 -0
- package/docs/api/functions/isCompatible.md +31 -0
- package/docs/api/functions/isGroupId.md +37 -0
- package/docs/api/functions/isSealedSenderAuthError.md +25 -0
- package/docs/api/functions/parseVersion.md +29 -0
- package/docs/api/functions/resolveSPQRLimits.md +21 -0
- package/docs/api/functions/resolveSignalLogger.md +42 -0
- package/docs/api/interfaces/AccountIdentityProvisioning.md +43 -0
- package/docs/api/interfaces/AccountIdentityRotation.md +69 -0
- package/docs/api/interfaces/AttachmentTransferOptions.md +49 -0
- package/docs/api/interfaces/BlockedRecipientEntry.md +25 -0
- package/docs/api/interfaces/BlockedRecipientsSyncInput.md +27 -0
- package/docs/api/interfaces/ConfigurationSyncInput.md +19 -0
- package/docs/api/interfaces/CredentialPublicKey.md +25 -0
- package/docs/api/interfaces/DataMessageInput.md +21 -0
- package/docs/api/interfaces/DecryptedEnvelope.md +95 -0
- package/docs/api/interfaces/DecryptedGroup.md +86 -0
- package/docs/api/interfaces/DeviceInfo.md +79 -0
- package/docs/api/interfaces/DeviceRecord.md +87 -0
- package/docs/api/interfaces/DeviceRegistration.md +27 -0
- package/docs/api/interfaces/DoubleRatchetConfig.md +36 -0
- package/docs/api/interfaces/EcOneTimePreKey.md +27 -0
- package/docs/api/interfaces/EcSignedPreKey.md +39 -0
- package/docs/api/interfaces/EcSignedPreKeyUpload.md +50 -0
- package/docs/api/interfaces/EncryptionErrorContext.md +51 -0
- package/docs/api/interfaces/Envelope.md +154 -0
- package/docs/api/interfaces/ForceKeyResetResult.md +37 -0
- package/docs/api/interfaces/GroupAuthorization.md +23 -0
- package/docs/api/interfaces/GroupChangeEntry.md +42 -0
- package/docs/api/interfaces/GroupMemberDevice.md +26 -0
- package/docs/api/interfaces/IEcOneTimePreKeyStore.md +86 -0
- package/docs/api/interfaces/IEcSignedPreKeyStore.md +132 -0
- package/docs/api/interfaces/IGroupServer.md +120 -0
- package/docs/api/interfaces/IGroupStateStore.md +128 -0
- package/docs/api/interfaces/IIdentityKeyStore.md +312 -0
- package/docs/api/interfaces/IKemPreKeyStore.md +144 -0
- package/docs/api/interfaces/IKyberLastResortPreKeyStore.md +111 -0
- package/docs/api/interfaces/ILogger.md +117 -0
- package/docs/api/interfaces/IProtocolStore.md +1033 -0
- package/docs/api/interfaces/ISenderKeyStore.md +417 -0
- package/docs/api/interfaces/ISesameStore.md +249 -0
- package/docs/api/interfaces/ISessionStore.md +178 -0
- package/docs/api/interfaces/ISignalLocalSecretVault.md +71 -0
- package/docs/api/interfaces/ISignalLocalStore.md +2053 -0
- package/docs/api/interfaces/ISignalProtocolClient.md +1183 -0
- package/docs/api/interfaces/ISignalProtocolManager.md +272 -0
- package/docs/api/interfaces/ISignalRelayServer.md +1329 -0
- package/docs/api/interfaces/IdentityKeyPair.md +49 -0
- package/docs/api/interfaces/IncomingEnvelope.md +91 -0
- package/docs/api/interfaces/InspectedSignalContent.md +43 -0
- package/docs/api/interfaces/KDFChain.md +31 -0
- package/docs/api/interfaces/KemLastResortPreKeyUpload.md +50 -0
- package/docs/api/interfaces/KeyPair.md +23 -0
- package/docs/api/interfaces/KyberPreKey.md +42 -0
- package/docs/api/interfaces/MLKEMBraidAgentState.md +191 -0
- package/docs/api/interfaces/MLKEMBraidMessage.md +49 -0
- package/docs/api/interfaces/MediaAttachmentDeleteSyncInput.md +31 -0
- package/docs/api/interfaces/MessageHeader.md +49 -0
- package/docs/api/interfaces/MessageRecord.md +86 -0
- package/docs/api/interfaces/ParsedReceiptContent.md +19 -0
- package/docs/api/interfaces/ParsedTypingContent.md +19 -0
- package/docs/api/interfaces/PreKeyMaintenanceStore.md +87 -0
- package/docs/api/interfaces/PreKeyMessage.md +159 -0
- package/docs/api/interfaces/PreKeyStatusResult.md +21 -0
- package/docs/api/interfaces/PreKeyUpload.md +42 -0
- package/docs/api/interfaces/ProcessEnvelopeOptions.md +72 -0
- package/docs/api/interfaces/ProtocolAddress.md +38 -0
- package/docs/api/interfaces/ProtocolStrategyConfig.md +91 -0
- package/docs/api/interfaces/RatchetMessage.md +96 -0
- package/docs/api/interfaces/ReadSyncEntryInput.md +19 -0
- package/docs/api/interfaces/ReceiverChain.md +43 -0
- package/docs/api/interfaces/RecipientUsernameSyncInput.md +31 -0
- package/docs/api/interfaces/RelayPreKeyBundle.md +254 -0
- package/docs/api/interfaces/RemoteObjectDownload.md +33 -0
- package/docs/api/interfaces/RemoteObjectUpload.md +49 -0
- package/docs/api/interfaces/ResolvedSPQRInfoStrings.md +27 -0
- package/docs/api/interfaces/ResolvedSPQRLimits.md +37 -0
- package/docs/api/interfaces/RetryRequest.md +80 -0
- package/docs/api/interfaces/SCKAState.md +65 -0
- package/docs/api/interfaces/SPQRLimits.md +40 -0
- package/docs/api/interfaces/SPQRState.md +191 -0
- package/docs/api/interfaces/SafetyNumber.md +60 -0
- package/docs/api/interfaces/SafetyNumberConfirmation.md +46 -0
- package/docs/api/interfaces/SealedSenderConfig.md +70 -0
- package/docs/api/interfaces/SendOptions.md +191 -0
- package/docs/api/interfaces/SendResult.md +93 -0
- package/docs/api/interfaces/SenderKeyDistributionMessage.md +43 -0
- package/docs/api/interfaces/SenderKeyState.md +76 -0
- package/docs/api/interfaces/SenderKeysConfig.md +65 -0
- package/docs/api/interfaces/SentSyncTranscriptInput.md +31 -0
- package/docs/api/interfaces/ServiceId.md +19 -0
- package/docs/api/interfaces/SesameMessage.md +84 -0
- package/docs/api/interfaces/SesameStats.md +57 -0
- package/docs/api/interfaces/SessionHealthResult.md +120 -0
- package/docs/api/interfaces/SessionRecord.md +80 -0
- package/docs/api/interfaces/SessionRecordMetadata.md +109 -0
- package/docs/api/interfaces/SessionState.md +368 -0
- package/docs/api/interfaces/SessionTrustCommit.md +58 -0
- package/docs/api/interfaces/SignalBlockingHooks.md +44 -0
- package/docs/api/interfaces/SignalBlockingManagerOptions.md +31 -0
- package/docs/api/interfaces/SignalBlockingMirror.md +30 -0
- package/docs/api/interfaces/SignalBlockingStore.md +83 -0
- package/docs/api/interfaces/SignalContentAdapter.md +325 -0
- package/docs/api/interfaces/SignalProtocolClientAdapterConfig.md +44 -0
- package/docs/api/interfaces/SignalProtocolClientCompositionOptions.md +693 -0
- package/docs/api/interfaces/SignalProtocolClientConfig.md +839 -0
- package/docs/api/interfaces/SignalProtocolClientDeleteLocalAttachmentInput.md +25 -0
- package/docs/api/interfaces/SignalProtocolClientHooks.md +506 -0
- package/docs/api/interfaces/SignalProtocolClientIdentityConfig.md +35 -0
- package/docs/api/interfaces/SignalProtocolClientLoadLocalAttachmentInput.md +187 -0
- package/docs/api/interfaces/SignalProtocolClientLoadedLocalAttachment.md +19 -0
- package/docs/api/interfaces/SignalProtocolClientMedia.md +83 -0
- package/docs/api/interfaces/SignalProtocolClientMediaCompletedResult.md +25 -0
- package/docs/api/interfaces/SignalProtocolClientMediaConfig.md +157 -0
- package/docs/api/interfaces/SignalProtocolClientMediaDownloadCompletedResult.md +37 -0
- package/docs/api/interfaces/SignalProtocolClientMediaDownloadNotNeededResult.md +25 -0
- package/docs/api/interfaces/SignalProtocolClientMediaFailedResult.md +19 -0
- package/docs/api/interfaces/SignalProtocolClientMediaOperationOptions.md +53 -0
- package/docs/api/interfaces/SignalProtocolClientMediaPendingResult.md +19 -0
- package/docs/api/interfaces/SignalProtocolClientMediaProcessResult.md +43 -0
- package/docs/api/interfaces/SignalProtocolClientMediaSkippedResult.md +25 -0
- package/docs/api/interfaces/SignalProtocolClientMediaUploadCompletedResult.md +31 -0
- package/docs/api/interfaces/SignalProtocolClientProcessPendingMediaOptions.md +87 -0
- package/docs/api/interfaces/SignalProtocolClientSaveDownloadedAttachmentInput.md +25 -0
- package/docs/api/interfaces/SignalProtocolClientSaveUploadedAttachmentInput.md +25 -0
- package/docs/api/interfaces/SignalProtocolClientSyncDeleteInput.md +19 -0
- package/docs/api/interfaces/SignalProtocolConfig.md +50 -0
- package/docs/api/interfaces/SignalRemoteObjectStore.md +88 -0
- package/docs/api/interfaces/SkippedSenderMessageKey.md +26 -0
- package/docs/api/interfaces/TaskNotificationAckSyncInput.md +31 -0
- package/docs/api/interfaces/TripleRatchetState.md +64 -0
- package/docs/api/interfaces/UserRecord.md +71 -0
- package/docs/api/interfaces/UsernameStateSyncInput.md +19 -0
- package/docs/api/interfaces/VerificationStateSyncInput.md +31 -0
- package/docs/api/interfaces/VersionNegotiationState.md +84 -0
- package/docs/api/interfaces/ViewOnceOpenSyncInput.md +19 -0
- package/docs/api/namespaces/ProtocolAddress/README.md +33 -0
- package/docs/api/namespaces/ProtocolAddress/functions/create.md +41 -0
- package/docs/api/namespaces/ProtocolAddress/functions/equals.md +39 -0
- package/docs/api/namespaces/ProtocolAddress/functions/fromStorageKey.md +36 -0
- package/docs/api/namespaces/ProtocolAddress/functions/isUser.md +39 -0
- package/docs/api/namespaces/ProtocolAddress/functions/isValid.md +34 -0
- package/docs/api/namespaces/ProtocolAddress/functions/parse.md +41 -0
- package/docs/api/namespaces/ProtocolAddress/functions/toStorageKey.md +38 -0
- package/docs/api/namespaces/ProtocolAddress/functions/toString.md +34 -0
- package/docs/api/namespaces/SessionRecord/README.md +30 -0
- package/docs/api/namespaces/SessionRecord/functions/archiveCurrent.md +40 -0
- package/docs/api/namespaces/SessionRecord/functions/archiveCurrentState.md +34 -0
- package/docs/api/namespaces/SessionRecord/functions/create.md +25 -0
- package/docs/api/namespaces/SessionRecord/functions/deserialize.md +29 -0
- package/docs/api/namespaces/SessionRecord/functions/findSession.md +34 -0
- package/docs/api/namespaces/SessionRecord/functions/getAllSessions.md +25 -0
- package/docs/api/namespaces/SessionRecord/functions/getArchivedCount.md +25 -0
- package/docs/api/namespaces/SessionRecord/functions/hasCurrentSession.md +25 -0
- package/docs/api/namespaces/SessionRecord/functions/hasUsableSenderChain.md +36 -0
- package/docs/api/namespaces/SessionRecord/functions/promoteSession.md +34 -0
- package/docs/api/namespaces/SessionRecord/functions/serialize.md +28 -0
- package/docs/api/namespaces/SessionRecord/variables/MAX_ARCHIVED_SESSIONS.md +14 -0
- package/docs/api/namespaces/SessionState/README.md +15 -0
- package/docs/api/namespaces/SessionState/functions/getSessionId.md +32 -0
- package/docs/api/namespaces/blocking/README.md +43 -0
- package/docs/api/namespaces/encoding/README.md +33 -0
- package/docs/api/namespaces/encoding/functions/base64ToUrlSafe.md +28 -0
- package/docs/api/namespaces/encoding/functions/bytesToBase64.md +21 -0
- package/docs/api/namespaces/encoding/functions/bytesToString.md +21 -0
- package/docs/api/namespaces/encoding/functions/bytesToUrlSafeBase64.md +33 -0
- package/docs/api/namespaces/encoding/functions/concatBytes.md +21 -0
- package/docs/api/namespaces/encoding/functions/stringToBytes.md +21 -0
- package/docs/api/namespaces/encoding/functions/urlSafeToBase64.md +27 -0
- package/docs/api/namespaces/keys/README.md +126 -0
- package/docs/api/namespaces/keys/functions/acceptContactIdentityRotation.md +33 -0
- package/docs/api/namespaces/keys/functions/assertIdentityCommitment.md +25 -0
- package/docs/api/namespaces/keys/functions/compositeIdentitiesEqual.md +23 -0
- package/docs/api/namespaces/keys/functions/createCompositeIdentityV1.md +19 -0
- package/docs/api/namespaces/keys/functions/createPreKeySignatureContext.md +31 -0
- package/docs/api/namespaces/keys/functions/createUnverifiedContactIdentityRecord.md +23 -0
- package/docs/api/namespaces/keys/functions/decodeCompositeIdentityV1.md +19 -0
- package/docs/api/namespaces/keys/functions/deriveIdentityCommitment.md +19 -0
- package/docs/api/namespaces/keys/functions/encodeCompositeIdentityV1.md +19 -0
- package/docs/api/namespaces/keys/functions/evaluateContactIdentityCandidate.md +27 -0
- package/docs/api/namespaces/keys/functions/generateEcOneTimePreKeys.md +37 -0
- package/docs/api/namespaces/keys/functions/generateEcSignedPreKey.md +39 -0
- package/docs/api/namespaces/keys/functions/generateEcSignedPreKeyId.md +21 -0
- package/docs/api/namespaces/keys/functions/generateIdentityKeyPair.md +24 -0
- package/docs/api/namespaces/keys/functions/generateKemOneTimePreKeys.md +47 -0
- package/docs/api/namespaces/keys/functions/generateKyberLastResortPreKey.md +37 -0
- package/docs/api/namespaces/keys/functions/generateRegistrationId.md +13 -0
- package/docs/api/namespaces/keys/functions/signMlKem1024PreKey.md +29 -0
- package/docs/api/namespaces/keys/functions/signPreKey.md +31 -0
- package/docs/api/namespaces/keys/functions/validateContactIdentityRecord.md +19 -0
- package/docs/api/namespaces/keys/functions/verifyContactIdentityRecord.md +31 -0
- package/docs/api/namespaces/keys/functions/verifyMlKem1024PreKey.md +33 -0
- package/docs/api/namespaces/keys/functions/verifyPreKeySignature.md +35 -0
- package/docs/api/namespaces/keys/interfaces/CompositeIdentityV1.md +33 -0
- package/docs/api/namespaces/keys/interfaces/ContactIdentityRecord.md +53 -0
- package/docs/api/namespaces/keys/interfaces/KemOneTimePreKey.md +43 -0
- package/docs/api/namespaces/keys/type-aliases/IdentityCandidateStatus.md +9 -0
- package/docs/api/namespaces/keys/type-aliases/IdentityTrustState.md +9 -0
- package/docs/api/namespaces/keys/type-aliases/IdentityType.md +9 -0
- package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_ED25519_TAG.md +9 -0
- package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_LENGTH.md +9 -0
- package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_VERSION.md +9 -0
- package/docs/api/namespaces/keys/variables/COMPOSITE_IDENTITY_V1_X25519_TAG.md +9 -0
- package/docs/api/namespaces/keys/variables/IDENTITY_COMMITMENT_V1_DOMAIN.md +9 -0
- package/docs/api/namespaces/keys/variables/PREKEY_ALGORITHM_ML_KEM_1024.md +9 -0
- package/docs/api/namespaces/keys/variables/PREKEY_ALGORITHM_X25519.md +9 -0
- package/docs/api/namespaces/keys/variables/PREKEY_SIGNATURE_V1_DOMAIN.md +9 -0
- package/docs/api/namespaces/media/README.md +105 -0
- package/docs/api/namespaces/media/classes/MediaAttachmentError.md +57 -0
- package/docs/api/namespaces/media/functions/createByteRangeMediaAttachmentTransfer.md +19 -0
- package/docs/api/namespaces/media/functions/createMediaAttachmentDeliveryId.md +29 -0
- package/docs/api/namespaces/media/functions/createMediaAttachmentId.md +19 -0
- package/docs/api/namespaces/media/functions/createMediaAttachmentMessage.md +25 -0
- package/docs/api/namespaces/media/functions/createMediaAttachmentPointer.md +19 -0
- package/docs/api/namespaces/media/functions/createTusMediaAttachmentTransfer.md +19 -0
- package/docs/api/namespaces/media/functions/deleteMediaAttachment.md +23 -0
- package/docs/api/namespaces/media/functions/executeMediaAttachmentJob.md +23 -0
- package/docs/api/namespaces/media/functions/isMediaAttachmentFlagSet.md +19 -0
- package/docs/api/namespaces/media/functions/parseMediaAttachmentMessage.md +19 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentCleanup.md +23 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentCleanupJobs.md +19 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentDeleteSync.md +19 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentDownloadJob.md +19 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentOpen.md +19 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentProcessing.md +19 -0
- package/docs/api/namespaces/media/functions/planMediaAttachmentUploadJob.md +19 -0
- package/docs/api/namespaces/media/functions/prepareMediaAttachmentUpload.md +30 -0
- package/docs/api/namespaces/media/functions/resolveMediaAttachment.md +30 -0
- package/docs/api/namespaces/media/functions/serializeMediaAttachmentMessage.md +25 -0
- package/docs/api/namespaces/media/functions/validateMediaAttachmentPolicy.md +23 -0
- package/docs/api/namespaces/media/interfaces/ByteRangeMediaAttachmentPartialStore.md +68 -0
- package/docs/api/namespaces/media/interfaces/ByteRangeMediaAttachmentTransferOptions.md +91 -0
- package/docs/api/namespaces/media/interfaces/DeleteMediaAttachmentOptions.md +25 -0
- package/docs/api/namespaces/media/interfaces/DeleteMediaAttachmentResult.md +19 -0
- package/docs/api/namespaces/media/interfaces/ExecuteMediaAttachmentJobOptions.md +157 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentBackgroundJob.md +85 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentCleanupPlan.md +37 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentJobExecutionResult.md +55 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentMessage.md +31 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentOpenDecision.md +31 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentPointer.md +133 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentPolicy.md +67 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentProcessingPlan.md +73 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentProgress.md +69 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentResumeState.md +37 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentRetryOptions.md +31 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentTransfer.md +51 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentTransferCheckpoint.md +69 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentTransferOptions.md +67 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentUploadJobData.md +19 -0
- package/docs/api/namespaces/media/interfaces/MediaAttachmentUploadResponse.md +25 -0
- package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentCleanupJobsInput.md +61 -0
- package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentDeleteSyncInput.md +25 -0
- package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentDownloadJobInput.md +161 -0
- package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentOpenInput.md +25 -0
- package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentProcessingInput.md +83 -0
- package/docs/api/namespaces/media/interfaces/PlanMediaAttachmentUploadJobInput.md +147 -0
- package/docs/api/namespaces/media/interfaces/PrepareMediaAttachmentUploadOptions.md +144 -0
- package/docs/api/namespaces/media/interfaces/ResolveMediaAttachmentOptions.md +55 -0
- package/docs/api/namespaces/media/interfaces/ResolvedMediaAttachment.md +109 -0
- package/docs/api/namespaces/media/interfaces/TusMediaAttachmentTransferOptions.md +85 -0
- package/docs/api/namespaces/media/type-aliases/CreateMediaAttachmentPointerInput.md +15 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentCheckpointCallback.md +19 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentCleanupReason.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentErrorCode.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentFlag.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobExecutionStatus.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobOperation.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobPriority.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobSkipReason.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentJobSource.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentKnownIds.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentMessageType.md +9 -0
- package/docs/api/namespaces/media/type-aliases/MediaAttachmentProgressCallback.md +19 -0
- package/docs/api/namespaces/media/variables/MEDIA_ATTACHMENT_POLICY_DEFAULTS.md +47 -0
- package/docs/api/namespaces/media/variables/MEDIA_ATTACHMENT_POLICY_PRESETS.md +95 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentCleanupReason.md +27 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentErrorCode.md +75 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentFlag.md +23 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentJobExecutionStatus.md +19 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentJobOperation.md +31 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentJobPriority.md +23 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentJobSource.md +51 -0
- package/docs/api/namespaces/media/variables/MediaAttachmentMessageType.md +15 -0
- package/docs/api/namespaces/media/variables/downloadMediaAttachment.md +30 -0
- package/docs/api/namespaces/safety/README.md +61 -0
- package/docs/api/namespaces/safety/classes/DisplayableFingerprint.md +108 -0
- package/docs/api/namespaces/safety/classes/Fingerprint.md +104 -0
- package/docs/api/namespaces/safety/classes/ScannableFingerprint.md +209 -0
- package/docs/api/namespaces/safety/functions/base64ToBytes.md +21 -0
- package/docs/api/namespaces/safety/functions/clearFingerprintCache.md +15 -0
- package/docs/api/namespaces/safety/functions/compareSafetyNumbers.md +25 -0
- package/docs/api/namespaces/safety/functions/createFingerprintData.md +60 -0
- package/docs/api/namespaces/safety/functions/extractQrData.md +34 -0
- package/docs/api/namespaces/safety/functions/generateCompositeSafetyNumber.md +39 -0
- package/docs/api/namespaces/safety/functions/generateEmojiFingerprint.md +24 -0
- package/docs/api/namespaces/safety/functions/generateSingleKeyReferenceSafetyNumber.md +51 -0
- package/docs/api/namespaces/safety/functions/generateVerifySchemeUrl.md +32 -0
- package/docs/api/namespaces/safety/functions/generateVerifyUrl.md +49 -0
- package/docs/api/namespaces/safety/functions/isValidSafetyNumber.md +21 -0
- package/docs/api/namespaces/safety/functions/isVerifyUrl.md +45 -0
- package/docs/api/namespaces/safety/functions/parseVerifyUrl.md +31 -0
- package/docs/api/namespaces/safety/interfaces/FingerprintData.md +52 -0
- package/docs/api/namespaces/safety/interfaces/SafetyNumber.md +49 -0
- package/docs/api/namespaces/safety/interfaces/VerifyLinkConfig.md +28 -0
- package/docs/api/namespaces/safety/interfaces/VerifyUrlParams.md +49 -0
- package/docs/api/namespaces/safety/type-aliases/CompareResult.md +21 -0
- package/docs/api/namespaces/safety/variables/DEFAULT_VERIFY_LINK_CONFIG.md +12 -0
- package/docs/api/namespaces/safety/variables/FINGERPRINT_ITERATIONS.md +12 -0
- package/docs/api/namespaces/safety/variables/FINGERPRINT_VERSION.md +12 -0
- package/docs/api/namespaces/safety/variables/VERIFY_BASE_URL.md +11 -0
- package/docs/api/namespaces/safety/variables/VERIFY_SCHEME_URL.md +11 -0
- package/docs/api/type-aliases/Base64.md +20 -0
- package/docs/api/type-aliases/BraidPolicy.md +11 -0
- package/docs/api/type-aliases/Bytes.md +20 -0
- package/docs/api/type-aliases/Ciphertext.md +21 -0
- package/docs/api/type-aliases/DeviceType.md +11 -0
- package/docs/api/type-aliases/DownloadedAttachment.md +11 -0
- package/docs/api/type-aliases/GroupId.md +27 -0
- package/docs/api/type-aliases/Hex.md +20 -0
- package/docs/api/type-aliases/HookName.md +11 -0
- package/docs/api/type-aliases/PostQuantumPolicy.md +11 -0
- package/docs/api/type-aliases/PreparedAttachmentUpload.md +14 -0
- package/docs/api/type-aliases/PrivateKey.md +22 -0
- package/docs/api/type-aliases/ProgressCallback.md +45 -0
- package/docs/api/type-aliases/PublicKey.md +22 -0
- package/docs/api/type-aliases/RemoteObjectCompleteUploadRequest.md +19 -0
- package/docs/api/type-aliases/RemoteObjectDeleteRequest.md +19 -0
- package/docs/api/type-aliases/RemoteObjectDownloadRequest.md +19 -0
- package/docs/api/type-aliases/RemoteObjectUploadRequest.md +42 -0
- package/docs/api/type-aliases/SCKAMode.md +11 -0
- package/docs/api/type-aliases/SealedSenderAuth.md +15 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaCleanupInput.md +9 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaCleanupResult.md +9 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaDownloadInput.md +9 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaDownloadResult.md +9 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaOperationResult.md +9 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaUploadInput.md +9 -0
- package/docs/api/type-aliases/SignalProtocolClientMediaUploadResult.md +9 -0
- package/docs/api/type-aliases/Signature.md +21 -0
- package/docs/api/type-aliases/Unsubscribe.md +15 -0
- package/docs/api/variables/BraidPolicy.md +21 -0
- package/docs/api/variables/DEFAULT_DEVICE_ID.md +12 -0
- package/docs/api/variables/DOUBLE_RATCHET_SPEC.md +11 -0
- package/docs/api/variables/GROUP_V2_PREFIX.md +11 -0
- package/docs/api/variables/KEY_REFRESH_INTERVAL_MS_DEFAULT.md +11 -0
- package/docs/api/variables/MAX_MESSAGE_KEYS.md +14 -0
- package/docs/api/variables/MAX_PREKEY_AGE_MS_DEFAULT.md +11 -0
- package/docs/api/variables/MAX_RECEIVER_CHAINS.md +14 -0
- package/docs/api/variables/MAX_REGISTRATION_ID.md +16 -0
- package/docs/api/variables/MAX_SKIP.md +11 -0
- package/docs/api/variables/MESSAGE_FORMAT.md +11 -0
- package/docs/api/variables/MIN_REGISTRATION_ID.md +16 -0
- package/docs/api/variables/ML_KEM_BRAID_SPEC.md +11 -0
- package/docs/api/variables/ONE_TIME_PREKEY_BATCH_SIZE.md +21 -0
- package/docs/api/variables/PQXDH_SPEC.md +11 -0
- package/docs/api/variables/PostQuantumPolicy.md +21 -0
- package/docs/api/variables/SENDER_KEY_FORMAT.md +11 -0
- package/docs/api/variables/SENDER_KEY_SPEC.md +11 -0
- package/docs/api/variables/SESAME_SPEC.md +11 -0
- package/docs/api/variables/SESSION_FORMAT.md +11 -0
- package/docs/api/variables/SPQR_LIMITS_DEFAULTS.md +11 -0
- package/docs/api/variables/X3DH_SPEC.md +9 -0
- package/docs/api/variables/defaultSignalLogger.md +32 -0
- package/encoding/README.md +32 -0
- package/files/README.md +37 -0
- package/groups/README.md +42 -0
- package/hooks/README.md +40 -0
- package/keys/README.md +121 -0
- package/local/store/README.md +120 -0
- package/local/store/expo/README.md +73 -0
- package/local/store/mock/README.md +27 -0
- package/local/store/node/README.md +35 -0
- package/local/store/react-native/README.md +39 -0
- package/local/store/web/README.md +65 -0
- package/local/vault/README.md +32 -0
- package/media/README.md +73 -0
- package/package.json +436 -0
- package/profile/README.md +44 -0
- package/remote/README.md +219 -0
- package/remote/object-store/README.md +45 -0
- package/remote/object-store/convex-r2/README.md +85 -0
- package/remote/object-store/s3/README.md +35 -0
- package/remote/relay/README.md +38 -0
- package/remote/relay/convex/README.md +54 -0
- package/remote/relay/mock/README.md +32 -0
- package/safety/README.md +42 -0
- package/sealed-sender/README.md +32 -0
- package/types/README.md +36 -0
- package/username/README.md +37 -0
- package/utils/README.md +37 -0
- package/zk/README.md +36 -0
|
@@ -0,0 +1,1086 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConvexSignalRelayServer
|
|
3
|
+
*
|
|
4
|
+
* Implementation of ISignalRelayServer using the Signal Protocol Convex component.
|
|
5
|
+
* Zero-knowledge server - all content is opaque ciphertext.
|
|
6
|
+
*
|
|
7
|
+
* Uses the signal component's 17-table schema.
|
|
8
|
+
*
|
|
9
|
+
* ## Component API Access Pattern
|
|
10
|
+
*
|
|
11
|
+
* This file consumes typed, app-injected API references for the Signal
|
|
12
|
+
* component's functions. The app-level wrappers are defined in:
|
|
13
|
+
* - convex/signal/keys.ts
|
|
14
|
+
* - convex/signal/devices.ts
|
|
15
|
+
* - convex/signal/messages.ts
|
|
16
|
+
* - convex/signal/provisioning.ts
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
import { ConvexClient as BrowserConvexClient } from 'convex/browser';
|
|
20
|
+
import { decodeCompositeIdentityV1, encodeCompositeIdentityV1 } from '../../../keys/identity.js';
|
|
21
|
+
import { SealedSenderAuthError } from '../../../types/errors.js';
|
|
22
|
+
import { resolveSignalLogger } from '../../../logger.js';
|
|
23
|
+
const RETRY_POLL_INTERVAL_MS = 2000;
|
|
24
|
+
/**
|
|
25
|
+
* Polling interval for message subscription (in milliseconds).
|
|
26
|
+
* Used as fallback when push-based subscription is not available.
|
|
27
|
+
*/
|
|
28
|
+
const MESSAGE_POLL_INTERVAL_MS = 2000;
|
|
29
|
+
/**
|
|
30
|
+
* Idle threshold for message batch detection (milliseconds).
|
|
31
|
+
* When no new messages arrive for this duration, the batch is considered complete.
|
|
32
|
+
*/
|
|
33
|
+
const MESSAGE_IDLE_THRESHOLD_MS = 500;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum batch window before forced flush (milliseconds).
|
|
36
|
+
* Prevents indefinite batching if messages keep arriving.
|
|
37
|
+
*/
|
|
38
|
+
const MAX_BATCH_WINDOW_MS = 5000;
|
|
39
|
+
/**
|
|
40
|
+
* ConvexSignalRelayServer - Implementation of ISignalRelayServer
|
|
41
|
+
*
|
|
42
|
+
* Uses the Convex Signal Protocol component for the 17-table relay schema.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* import { ConvexReactClient } from 'convex/react';
|
|
47
|
+
* import { ConvexSignalRelayServer } from './relay.js';
|
|
48
|
+
*
|
|
49
|
+
* const convex = new ConvexReactClient(process.env.CONVEX_URL!);
|
|
50
|
+
* const relay = new ConvexSignalRelayServer(convex, convexSignalRelayApi, {
|
|
51
|
+
* currentUserId: 'current-user-id',
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* // Subscribe to incoming envelopes
|
|
55
|
+
* const unsubscribe = relay.subscribe(userId, deviceId, (envelope) => {
|
|
56
|
+
* // Decrypt and process
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Send encrypted envelope
|
|
60
|
+
* await relay.send({
|
|
61
|
+
* targetUserId: 'bob',
|
|
62
|
+
* targetDeviceId: 1,
|
|
63
|
+
* senderUserId: 'alice',
|
|
64
|
+
* senderDeviceId: 1,
|
|
65
|
+
* ciphertext: encryptedBytes,
|
|
66
|
+
* messageType: 'ciphertext',
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export class ConvexSignalRelayServer {
|
|
71
|
+
convex;
|
|
72
|
+
api;
|
|
73
|
+
subscriptions = new Map();
|
|
74
|
+
subscriptionClient = null;
|
|
75
|
+
currentUserId;
|
|
76
|
+
getAuthToken;
|
|
77
|
+
logger;
|
|
78
|
+
/**
|
|
79
|
+
* Create a new ConvexSignalRelayServer.
|
|
80
|
+
*
|
|
81
|
+
* @param convex - Convex client (React or HTTP)
|
|
82
|
+
* @param api - Generated Convex Signal API map for queries and mutations
|
|
83
|
+
* @param options.currentUserId - Current user's ID for ownership-scoped relay operations
|
|
84
|
+
* @param options.getAuthToken - Optional auth token getter for push-based subscriptions.
|
|
85
|
+
* When provided, creates an internal ConvexClient with WebSocket push.
|
|
86
|
+
* @param options.logger - Optional logger for relay operations
|
|
87
|
+
*/
|
|
88
|
+
constructor(convex, api, options = {}) {
|
|
89
|
+
this.convex = convex;
|
|
90
|
+
this.api = api;
|
|
91
|
+
this.currentUserId = options.currentUserId;
|
|
92
|
+
this.getAuthToken = options.getAuthToken;
|
|
93
|
+
this.logger = resolveSignalLogger(options.logger);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get or create the internal subscription client for push-based updates.
|
|
97
|
+
* Created lazily on first use to avoid unnecessary connections.
|
|
98
|
+
*/
|
|
99
|
+
async getSubscriptionClient() {
|
|
100
|
+
if (this.subscriptionClient)
|
|
101
|
+
return this.subscriptionClient;
|
|
102
|
+
const url = process.env.EXPO_PUBLIC_CONVEX_URL;
|
|
103
|
+
if (!url || !this.getAuthToken)
|
|
104
|
+
return null;
|
|
105
|
+
try {
|
|
106
|
+
this.subscriptionClient = new BrowserConvexClient(url);
|
|
107
|
+
// Re-fetch token on each auth request (handles token expiry)
|
|
108
|
+
this.subscriptionClient.setAuth(async () => {
|
|
109
|
+
return (await this.getAuthToken?.()) ?? null;
|
|
110
|
+
});
|
|
111
|
+
this.logger.debug('Created internal subscription client for push-based updates', {
|
|
112
|
+
category: 'E2EE',
|
|
113
|
+
});
|
|
114
|
+
return this.subscriptionClient;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
this.logger.warn('Failed to create subscription client, will use polling fallback', {
|
|
118
|
+
category: 'E2EE',
|
|
119
|
+
error: error,
|
|
120
|
+
});
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
125
|
+
// ENVELOPE DELIVERY
|
|
126
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
127
|
+
async send(envelope) {
|
|
128
|
+
const ciphertext = typeof envelope.ciphertext === 'string'
|
|
129
|
+
? envelope.ciphertext
|
|
130
|
+
: this.uint8ArrayToBase64(envelope.ciphertext);
|
|
131
|
+
const result = await this.convex.mutation(this.api.messages.send, {
|
|
132
|
+
targetUserId: envelope.targetUserId,
|
|
133
|
+
targetDeviceId: envelope.targetDeviceId,
|
|
134
|
+
// senderUserId derived server-side from JWT auth
|
|
135
|
+
senderDeviceId: envelope.senderDeviceId,
|
|
136
|
+
ciphertext,
|
|
137
|
+
messageType: envelope.messageType,
|
|
138
|
+
urgent: envelope.urgent,
|
|
139
|
+
ephemeral: envelope.ephemeral,
|
|
140
|
+
groupId: envelope.groupId,
|
|
141
|
+
timestamp: envelope.timestamp,
|
|
142
|
+
clientMessageId: envelope.clientMessageId,
|
|
143
|
+
// Relay-side stale-device detection validates the registration ID only.
|
|
144
|
+
// Signed-prekey staleness is detected client-side during authenticated
|
|
145
|
+
// decryption and recovery.
|
|
146
|
+
recipientRegistrationId: envelope.recipientRegistrationId,
|
|
147
|
+
});
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Subscribe to incoming envelopes for this device.
|
|
152
|
+
*
|
|
153
|
+
* When getAuthToken is provided (via constructor), uses WebSocket push
|
|
154
|
+
* for instant delivery (~50ms). Otherwise, falls back to polling every 2 seconds.
|
|
155
|
+
*
|
|
156
|
+
* Supports optional batching callbacks for notification coalescing.
|
|
157
|
+
* When messages arrive rapidly, onBatchStart is called once at the start,
|
|
158
|
+
* and onBatchEnd is called after an idle period (no new messages for 500ms).
|
|
159
|
+
*
|
|
160
|
+
* @param userId - Current user ID
|
|
161
|
+
* @param deviceId - This device's ID (1-5)
|
|
162
|
+
* @param onEnvelope - Callback for each incoming envelope
|
|
163
|
+
* @param options - Optional batching callbacks
|
|
164
|
+
* @returns Unsubscribe function
|
|
165
|
+
*
|
|
166
|
+
*/
|
|
167
|
+
subscribe(userId, deviceId, onEnvelope, options) {
|
|
168
|
+
// Use push-based subscription if auth token getter is available
|
|
169
|
+
if (this.getAuthToken) {
|
|
170
|
+
return this.subscribeMessagesPush(userId, deviceId, onEnvelope, options);
|
|
171
|
+
}
|
|
172
|
+
// Fallback to polling for ConvexHttpClient or when no auth token getter provided
|
|
173
|
+
return this.subscribeMessagesPolling(userId, deviceId, onEnvelope, options);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Push-based message subscription using internal ConvexClient.
|
|
177
|
+
* Provides instant delivery via WebSocket with idle-detection batching.
|
|
178
|
+
*
|
|
179
|
+
* Batching behavior:
|
|
180
|
+
* - Messages are queued until idle (no new messages for MESSAGE_IDLE_THRESHOLD_MS)
|
|
181
|
+
* - onBatchStart called when first message arrives
|
|
182
|
+
* - onBatchEnd called when batch is flushed
|
|
183
|
+
* - Forced flush after MAX_BATCH_WINDOW_MS to prevent indefinite batching
|
|
184
|
+
*/
|
|
185
|
+
subscribeMessagesPush(userId, deviceId, onEnvelope, options) {
|
|
186
|
+
const key = `messages:${userId}:${deviceId}`;
|
|
187
|
+
const processedIds = new Set();
|
|
188
|
+
let clientUnsubscribe = null;
|
|
189
|
+
let isActive = true;
|
|
190
|
+
// Idle-detection batching state
|
|
191
|
+
let pendingEnvelopes = [];
|
|
192
|
+
let idleTimer = null;
|
|
193
|
+
let batchStartTime = null;
|
|
194
|
+
const flushBatch = () => {
|
|
195
|
+
if (idleTimer)
|
|
196
|
+
clearTimeout(idleTimer);
|
|
197
|
+
idleTimer = null;
|
|
198
|
+
const batch = pendingEnvelopes;
|
|
199
|
+
pendingEnvelopes = [];
|
|
200
|
+
batchStartTime = null;
|
|
201
|
+
// Deliver all pending envelopes
|
|
202
|
+
for (const envelope of batch) {
|
|
203
|
+
onEnvelope(envelope);
|
|
204
|
+
}
|
|
205
|
+
if (batch.length > 0) {
|
|
206
|
+
options?.onBatchEnd?.();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const queueEnvelope = (envelope) => {
|
|
210
|
+
if (pendingEnvelopes.length === 0) {
|
|
211
|
+
options?.onBatchStart?.();
|
|
212
|
+
batchStartTime = Date.now();
|
|
213
|
+
}
|
|
214
|
+
pendingEnvelopes.push(envelope);
|
|
215
|
+
if (idleTimer)
|
|
216
|
+
clearTimeout(idleTimer);
|
|
217
|
+
// Force flush if max batch window exceeded
|
|
218
|
+
if (batchStartTime && Date.now() - batchStartTime >= MAX_BATCH_WINDOW_MS) {
|
|
219
|
+
flushBatch();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
// Set idle timer
|
|
223
|
+
idleTimer = setTimeout(flushBatch, MESSAGE_IDLE_THRESHOLD_MS);
|
|
224
|
+
};
|
|
225
|
+
this.logger.debug('[Relay] Subscription started', {
|
|
226
|
+
category: 'E2EE',
|
|
227
|
+
data: { userId, deviceId },
|
|
228
|
+
});
|
|
229
|
+
// Async initialization - get or create the subscription client
|
|
230
|
+
this.getSubscriptionClient().then((client) => {
|
|
231
|
+
// Check if already unsubscribed before setting up listener
|
|
232
|
+
if (!isActive) {
|
|
233
|
+
return; // Don't set up anything if already cancelled
|
|
234
|
+
}
|
|
235
|
+
if (!client) {
|
|
236
|
+
// Fall back to polling if client creation failed
|
|
237
|
+
this.logger.warn('Subscription client unavailable, falling back to polling', {
|
|
238
|
+
category: 'E2EE',
|
|
239
|
+
});
|
|
240
|
+
const pollingUnsub = this.subscribeMessagesPolling(userId, deviceId, onEnvelope, options);
|
|
241
|
+
this.subscriptions.set(key, pollingUnsub);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
clientUnsubscribe = client.onUpdate(this.api.messages.getPendingMessages, { deviceId }, (messages) => {
|
|
245
|
+
// Guard against callbacks after unsubscribe
|
|
246
|
+
if (!isActive)
|
|
247
|
+
return;
|
|
248
|
+
for (const msg of messages) {
|
|
249
|
+
if (processedIds.has(msg.id))
|
|
250
|
+
continue;
|
|
251
|
+
processedIds.add(msg.id);
|
|
252
|
+
queueEnvelope({
|
|
253
|
+
id: msg.id,
|
|
254
|
+
targetUserId: userId,
|
|
255
|
+
targetDeviceId: deviceId,
|
|
256
|
+
senderUserId: msg.senderUserId,
|
|
257
|
+
senderDeviceId: msg.senderDeviceId,
|
|
258
|
+
ciphertext: msg.ciphertext,
|
|
259
|
+
messageType: msg.messageType,
|
|
260
|
+
groupId: msg.groupId,
|
|
261
|
+
timestamp: msg.timestamp,
|
|
262
|
+
serverTimestamp: msg.serverTimestamp,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// Cleanup processed IDs no longer in pending
|
|
266
|
+
const currentIds = new Set(messages.map((m) => m.id));
|
|
267
|
+
for (const id of processedIds) {
|
|
268
|
+
if (!currentIds.has(id))
|
|
269
|
+
processedIds.delete(id);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
// If unsubscribe was called during init, clean up now
|
|
273
|
+
if (!isActive && clientUnsubscribe) {
|
|
274
|
+
clientUnsubscribe();
|
|
275
|
+
clientUnsubscribe = null;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
// Return unsubscribe function that cleans up
|
|
279
|
+
const wrappedUnsubscribe = () => {
|
|
280
|
+
isActive = false;
|
|
281
|
+
flushBatch(); // Flush any pending on unsubscribe
|
|
282
|
+
clientUnsubscribe?.();
|
|
283
|
+
this.subscriptions.delete(key);
|
|
284
|
+
};
|
|
285
|
+
this.subscriptions.set(key, wrappedUnsubscribe);
|
|
286
|
+
return wrappedUnsubscribe;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Polling-based message subscription fallback.
|
|
290
|
+
* Used when no getAuthToken is available or subscription client creation fails.
|
|
291
|
+
*
|
|
292
|
+
* NOTE: This has ~2 second latency. Use push-based subscription for production.
|
|
293
|
+
*/
|
|
294
|
+
subscribeMessagesPolling(userId, deviceId, onEnvelope, options) {
|
|
295
|
+
const key = `messages:${userId}:${deviceId}`;
|
|
296
|
+
let isActive = true;
|
|
297
|
+
let lastMessageIds = new Set();
|
|
298
|
+
this.logger.debug('Starting polling-based message subscription (fallback)', {
|
|
299
|
+
category: 'E2EE',
|
|
300
|
+
data: { userId, deviceId, pollIntervalMs: MESSAGE_POLL_INTERVAL_MS },
|
|
301
|
+
});
|
|
302
|
+
// Polling fallback for non-React contexts
|
|
303
|
+
const poll = async () => {
|
|
304
|
+
if (!isActive)
|
|
305
|
+
return;
|
|
306
|
+
try {
|
|
307
|
+
const messages = await this.convex.query(this.api.messages.getPendingMessages, {
|
|
308
|
+
deviceId,
|
|
309
|
+
});
|
|
310
|
+
// Track if we have new messages for batching
|
|
311
|
+
const newMessages = [];
|
|
312
|
+
for (const msg of messages) {
|
|
313
|
+
// Only process new messages
|
|
314
|
+
if (!lastMessageIds.has(msg.id)) {
|
|
315
|
+
lastMessageIds.add(msg.id);
|
|
316
|
+
newMessages.push({
|
|
317
|
+
id: msg.id,
|
|
318
|
+
targetUserId: userId,
|
|
319
|
+
targetDeviceId: deviceId,
|
|
320
|
+
senderUserId: msg.senderUserId,
|
|
321
|
+
senderDeviceId: msg.senderDeviceId,
|
|
322
|
+
ciphertext: msg.ciphertext,
|
|
323
|
+
messageType: msg.messageType,
|
|
324
|
+
groupId: msg.groupId,
|
|
325
|
+
timestamp: msg.timestamp,
|
|
326
|
+
serverTimestamp: msg.serverTimestamp,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// Deliver with batch callbacks (polling knows batch boundaries upfront)
|
|
331
|
+
if (newMessages.length > 0) {
|
|
332
|
+
options?.onBatchStart?.();
|
|
333
|
+
for (const envelope of newMessages) {
|
|
334
|
+
onEnvelope(envelope);
|
|
335
|
+
}
|
|
336
|
+
options?.onBatchEnd?.();
|
|
337
|
+
}
|
|
338
|
+
// Update tracked IDs (remove ones no longer in pending)
|
|
339
|
+
const currentIds = new Set(messages.map((m) => m.id));
|
|
340
|
+
lastMessageIds = currentIds;
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
this.logger.error('Error polling messages', {
|
|
344
|
+
category: 'E2EE',
|
|
345
|
+
error: error,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// Poll every 2 seconds
|
|
349
|
+
if (isActive) {
|
|
350
|
+
setTimeout(poll, MESSAGE_POLL_INTERVAL_MS);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
// Start polling
|
|
354
|
+
poll();
|
|
355
|
+
const unsubscribe = () => {
|
|
356
|
+
isActive = false;
|
|
357
|
+
this.subscriptions.delete(key);
|
|
358
|
+
};
|
|
359
|
+
this.subscriptions.set(key, unsubscribe);
|
|
360
|
+
return unsubscribe;
|
|
361
|
+
}
|
|
362
|
+
async markDelivered(messageId) {
|
|
363
|
+
await this.convex.mutation(this.api.messages.markDelivered, {
|
|
364
|
+
messageId,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
368
|
+
// DEVICE REGISTRY
|
|
369
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
370
|
+
async getDevices(userId) {
|
|
371
|
+
const devices = await this.convex.query(this.api.devices.getDevices, {
|
|
372
|
+
userId,
|
|
373
|
+
});
|
|
374
|
+
return devices;
|
|
375
|
+
}
|
|
376
|
+
async registerDevice(_userId, device) {
|
|
377
|
+
const result = await this.convex.mutation(this.api.devices.registerDevice, {
|
|
378
|
+
// userId derived server-side from JWT auth
|
|
379
|
+
deviceId: device.deviceId,
|
|
380
|
+
encryptedDeviceName: device.encryptedDeviceName,
|
|
381
|
+
deviceType: device.deviceType,
|
|
382
|
+
// Note: Push tokens are managed separately via convex/signal/push.ts
|
|
383
|
+
});
|
|
384
|
+
return result.deviceId;
|
|
385
|
+
}
|
|
386
|
+
async removeDevice(_userId, deviceId) {
|
|
387
|
+
await this.convex.mutation(this.api.devices.removeDevice, {
|
|
388
|
+
// userId derived server-side from JWT auth
|
|
389
|
+
deviceId,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
// Note: updatePushToken removed - push tokens are managed by convex/signal/push.ts
|
|
393
|
+
// using @convex-dev/expo-push-notifications with device-aware composite keys.
|
|
394
|
+
async markDeviceConnected(deviceId) {
|
|
395
|
+
await this.convex.mutation(this.api.devices.markDeviceConnected, {
|
|
396
|
+
deviceId,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
async markDeviceDisconnected(deviceId) {
|
|
400
|
+
await this.convex.mutation(this.api.devices.markDeviceDisconnected, {
|
|
401
|
+
deviceId,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
async heartbeat(deviceId) {
|
|
405
|
+
await this.convex.mutation(this.api.devices.presenceHeartbeat, {
|
|
406
|
+
deviceId,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
410
|
+
// IDENTITY KEYS
|
|
411
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
412
|
+
async provisionIdentityKey(request) {
|
|
413
|
+
const { userId, deviceId, identity, registrationId, identityType = 'aci' } = request;
|
|
414
|
+
await this.convex.mutation(this.api.keys.uploadIdentityKey, {
|
|
415
|
+
mode: 'provision',
|
|
416
|
+
userId,
|
|
417
|
+
deviceId,
|
|
418
|
+
compositeIdentity: this.uint8ArrayToBase64(encodeCompositeIdentityV1(identity)),
|
|
419
|
+
registrationId,
|
|
420
|
+
identityType,
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
async rotateIdentityKey(request) {
|
|
424
|
+
const { userId, deviceId, identity, registrationId, identityType = 'aci', expectedCurrentCommitment, } = request;
|
|
425
|
+
await this.convex.mutation(this.api.keys.uploadIdentityKey, {
|
|
426
|
+
mode: 'rotate',
|
|
427
|
+
userId,
|
|
428
|
+
deviceId,
|
|
429
|
+
compositeIdentity: this.uint8ArrayToBase64(encodeCompositeIdentityV1(identity)),
|
|
430
|
+
registrationId,
|
|
431
|
+
identityType,
|
|
432
|
+
expectedCurrentCommitment: this.uint8ArrayToBase64(expectedCurrentCommitment),
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
async getIdentityKey(userId, identityType) {
|
|
436
|
+
const encodedIdentity = await this.convex.query(this.api.keys.getIdentityKey, {
|
|
437
|
+
userId,
|
|
438
|
+
identityType: identityType ?? 'aci',
|
|
439
|
+
});
|
|
440
|
+
if (!encodedIdentity) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
return decodeCompositeIdentityV1(this.base64ToUint8Array(encodedIdentity));
|
|
444
|
+
}
|
|
445
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
446
|
+
// PREKEY MANAGEMENT
|
|
447
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
448
|
+
async uploadPreKeys(userId, deviceId, keys, identityType) {
|
|
449
|
+
await this.convex.mutation(this.api.keys.uploadPreKeys, {
|
|
450
|
+
userId,
|
|
451
|
+
deviceId,
|
|
452
|
+
identityType: identityType ?? 'aci',
|
|
453
|
+
keys: keys.map((key) => ({
|
|
454
|
+
type: key.type,
|
|
455
|
+
keyId: key.keyId,
|
|
456
|
+
publicKey: key.publicKey,
|
|
457
|
+
signature: key.signature,
|
|
458
|
+
})),
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Fetch prekey bundle for session establishment.
|
|
463
|
+
*
|
|
464
|
+
* Rate limited to 10 fetches per minute per fetcher-target pair.
|
|
465
|
+
* Fetcher identity is always derived from auth on the server side
|
|
466
|
+
* (matches the relay application format).
|
|
467
|
+
*
|
|
468
|
+
* @param userId - Target user ID
|
|
469
|
+
* @param deviceId - Target device ID
|
|
470
|
+
* @param _fetcherUserId - Deprecated, ignored. Fetcher derived from auth server-side.
|
|
471
|
+
*/
|
|
472
|
+
async fetchPreKeyBundle(userId, deviceId, _fetcherUserId, identityType) {
|
|
473
|
+
const bundle = await this.convex.mutation(this.api.keys.fetchPreKeyBundle, {
|
|
474
|
+
userId,
|
|
475
|
+
deviceId,
|
|
476
|
+
identityType: identityType ?? 'aci',
|
|
477
|
+
});
|
|
478
|
+
if (!bundle) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
// Cast to branded types - data crosses wire boundary as plain strings
|
|
482
|
+
// Adapters handle the casting internally so callers don't need to
|
|
483
|
+
return {
|
|
484
|
+
registrationId: bundle.registrationId,
|
|
485
|
+
deviceId: bundle.deviceId,
|
|
486
|
+
identity: decodeCompositeIdentityV1(this.base64ToUint8Array(bundle.compositeIdentity)),
|
|
487
|
+
ecSignedPreKey: {
|
|
488
|
+
keyId: bundle.ecSignedPreKey.keyId,
|
|
489
|
+
publicKey: bundle.ecSignedPreKey.publicKey,
|
|
490
|
+
signature: bundle.ecSignedPreKey.signature,
|
|
491
|
+
},
|
|
492
|
+
ecOneTimePreKey: bundle.ecOneTimePreKey
|
|
493
|
+
? {
|
|
494
|
+
keyId: bundle.ecOneTimePreKey.keyId,
|
|
495
|
+
publicKey: bundle.ecOneTimePreKey.publicKey,
|
|
496
|
+
}
|
|
497
|
+
: null,
|
|
498
|
+
kemLastResortPreKey: bundle.kemLastResortPreKey
|
|
499
|
+
? {
|
|
500
|
+
keyId: bundle.kemLastResortPreKey.keyId,
|
|
501
|
+
publicKey: bundle.kemLastResortPreKey.publicKey,
|
|
502
|
+
signature: bundle.kemLastResortPreKey.signature,
|
|
503
|
+
}
|
|
504
|
+
: null,
|
|
505
|
+
kemOneTimePreKey: bundle.kemOneTimePreKey
|
|
506
|
+
? {
|
|
507
|
+
keyId: bundle.kemOneTimePreKey.keyId,
|
|
508
|
+
publicKey: bundle.kemOneTimePreKey.publicKey,
|
|
509
|
+
signature: bundle.kemOneTimePreKey.signature,
|
|
510
|
+
}
|
|
511
|
+
: null,
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
async getPreKeyCount(userId, deviceId, type, identityType) {
|
|
515
|
+
return await this.convex.query(this.api.keys.getPreKeyCount, {
|
|
516
|
+
userId,
|
|
517
|
+
deviceId,
|
|
518
|
+
type,
|
|
519
|
+
identityType: identityType ?? 'aci',
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
async clearStaleKemPreKeys(userId, deviceId, identityType) {
|
|
523
|
+
return await this.convex.mutation(this.api.keys.clearStaleKemPreKeys, {
|
|
524
|
+
userId,
|
|
525
|
+
deviceId,
|
|
526
|
+
identityType: identityType ?? 'aci',
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
530
|
+
// CONVENIENCE METHODS (Key Rotation)
|
|
531
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
532
|
+
async uploadEcSignedPreKey(userId, ecSignedPreKey, identityType) {
|
|
533
|
+
await this.convex.mutation(this.api.keys.uploadEcSignedPreKey, {
|
|
534
|
+
userId,
|
|
535
|
+
identityType: identityType ?? 'aci',
|
|
536
|
+
ecSignedPreKey: {
|
|
537
|
+
id: ecSignedPreKey.keyId,
|
|
538
|
+
deviceId: ecSignedPreKey.deviceId,
|
|
539
|
+
publicKey: ecSignedPreKey.publicKey,
|
|
540
|
+
signature: ecSignedPreKey.signature,
|
|
541
|
+
timestamp: ecSignedPreKey.timestamp,
|
|
542
|
+
},
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
async uploadKemLastResortPreKey(userId, kemLastResortPreKey, identityType) {
|
|
546
|
+
await this.convex.mutation(this.api.keys.uploadKemLastResortPreKey, {
|
|
547
|
+
userId,
|
|
548
|
+
identityType: identityType ?? 'aci',
|
|
549
|
+
kemLastResortPreKey: {
|
|
550
|
+
id: kemLastResortPreKey.keyId,
|
|
551
|
+
deviceId: kemLastResortPreKey.deviceId,
|
|
552
|
+
publicKey: kemLastResortPreKey.publicKey,
|
|
553
|
+
signature: kemLastResortPreKey.signature,
|
|
554
|
+
timestamp: kemLastResortPreKey.timestamp,
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
559
|
+
// GROUP MEMBERS (Sender Keys)
|
|
560
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
561
|
+
async getGroupMembers(groupId) {
|
|
562
|
+
const members = await this.convex.query(this.api.messages.getGroupMembers, {
|
|
563
|
+
groupId,
|
|
564
|
+
});
|
|
565
|
+
return members;
|
|
566
|
+
}
|
|
567
|
+
async getActiveDevices(userId) {
|
|
568
|
+
const devices = await this.convex.query(this.api.messages.getActiveDevices, {
|
|
569
|
+
userId,
|
|
570
|
+
});
|
|
571
|
+
return devices;
|
|
572
|
+
}
|
|
573
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
574
|
+
// SEALED SENDER (Anonymous Delivery)
|
|
575
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
576
|
+
async fetchSenderCertificate(deviceId) {
|
|
577
|
+
return await this.convex.mutation(this.api.certificates.issueSenderCertificate, {
|
|
578
|
+
deviceId,
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
async sendUnidentified(envelope, auth) {
|
|
582
|
+
const ciphertext = typeof envelope.ciphertext === 'string'
|
|
583
|
+
? envelope.ciphertext
|
|
584
|
+
: this.uint8ArrayToBase64(envelope.ciphertext);
|
|
585
|
+
try {
|
|
586
|
+
if (auth.type === 'groupSendToken') {
|
|
587
|
+
// The server validates the ZK endorsement token before delivery.
|
|
588
|
+
return await this.convex.mutation(this.api.messages.sendUnidentified, {
|
|
589
|
+
targetUserId: envelope.targetUserId,
|
|
590
|
+
targetDeviceId: envelope.targetDeviceId,
|
|
591
|
+
ciphertext,
|
|
592
|
+
timestamp: envelope.timestamp,
|
|
593
|
+
clientMessageId: envelope.clientMessageId,
|
|
594
|
+
groupId: envelope.groupId,
|
|
595
|
+
groupSendToken: auth.groupSendToken.buffer.slice(auth.groupSendToken.byteOffset, auth.groupSendToken.byteOffset + auth.groupSendToken.byteLength),
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
// Access key path (profile-key-derived UAK)
|
|
599
|
+
return await this.convex.mutation(this.api.messages.sendUnidentified, {
|
|
600
|
+
targetUserId: envelope.targetUserId,
|
|
601
|
+
targetDeviceId: envelope.targetDeviceId,
|
|
602
|
+
ciphertext,
|
|
603
|
+
timestamp: envelope.timestamp,
|
|
604
|
+
clientMessageId: envelope.clientMessageId,
|
|
605
|
+
groupId: envelope.groupId,
|
|
606
|
+
unidentifiedAccessKey: auth.unidentifiedAccessKey,
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
// Convex mutations that throw Error('Unauthorized') propagate as Error
|
|
611
|
+
// with the message intact. Convert to typed error for the cipher's
|
|
612
|
+
// sealed sender fallback detection.
|
|
613
|
+
if (error instanceof Error && error.message.includes('Unauthorized')) {
|
|
614
|
+
throw new SealedSenderAuthError(error);
|
|
615
|
+
}
|
|
616
|
+
throw error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Send a V2 multi-recipient sealed sender message.
|
|
621
|
+
*
|
|
622
|
+
* Parses the V2 binary blob client-side, then sends structured
|
|
623
|
+
* per-recipient data to the Convex mutation for server-side fan-out.
|
|
624
|
+
*
|
|
625
|
+
* @param sentMessageBase64 - Base64-encoded V2 multi-recipient binary blob
|
|
626
|
+
* @param auth - Sealed sender authentication (access key or group send token)
|
|
627
|
+
* @param timestamp - Client timestamp for message identification
|
|
628
|
+
* @param groupId - Optional group ID for group messages
|
|
629
|
+
* @param recipientUserIds - Original user IDs in same order as binary recipients
|
|
630
|
+
*/
|
|
631
|
+
async sendMultiRecipientUnidentified(sentMessageBase64, auth, timestamp, groupId, recipientUserIds, clientMessageId) {
|
|
632
|
+
const { base64ToBytes, bytesToBase64 } = await import('../../../internal/crypto/index.js');
|
|
633
|
+
const { asBase64 } = await import('../../../types/utils.js');
|
|
634
|
+
const { deserializeSentMessage } = await import('../../../internal/protocol/sealed-sender/v2-binary.js');
|
|
635
|
+
const binaryBlob = base64ToBytes(asBase64(sentMessageBase64));
|
|
636
|
+
const parsed = deserializeSentMessage(binaryBlob);
|
|
637
|
+
// Flatten: each recipient can have MULTIPLE devices
|
|
638
|
+
const flatRecipients = parsed.recipients.flatMap((r, i) => r.devices.map((d) => ({
|
|
639
|
+
userId: recipientUserIds?.[i] ?? r.serviceId,
|
|
640
|
+
deviceId: d.deviceId,
|
|
641
|
+
registrationId: d.registrationId,
|
|
642
|
+
encryptedMessageKeyBase64: bytesToBase64(r.encryptedMessageKey),
|
|
643
|
+
authenticationTagBase64: bytesToBase64(r.authenticationTag),
|
|
644
|
+
})));
|
|
645
|
+
try {
|
|
646
|
+
if (auth.type === 'groupSendToken') {
|
|
647
|
+
return await this.convex.mutation(this.api.messages.sendMultiRecipientUnidentified, {
|
|
648
|
+
recipients: flatRecipients,
|
|
649
|
+
ephemeralPublicBase64: bytesToBase64(parsed.ephemeralPublic),
|
|
650
|
+
messageCiphertextBase64: bytesToBase64(parsed.messageCiphertext),
|
|
651
|
+
timestamp,
|
|
652
|
+
clientMessageId,
|
|
653
|
+
groupId,
|
|
654
|
+
groupSendToken: auth.groupSendToken.buffer.slice(auth.groupSendToken.byteOffset, auth.groupSendToken.byteOffset + auth.groupSendToken.byteLength),
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
return await this.convex.mutation(this.api.messages.sendMultiRecipientUnidentified, {
|
|
658
|
+
recipients: flatRecipients,
|
|
659
|
+
ephemeralPublicBase64: bytesToBase64(parsed.ephemeralPublic),
|
|
660
|
+
messageCiphertextBase64: bytesToBase64(parsed.messageCiphertext),
|
|
661
|
+
timestamp,
|
|
662
|
+
clientMessageId,
|
|
663
|
+
groupId,
|
|
664
|
+
unidentifiedAccessKey: auth.unidentifiedAccessKey,
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
catch (error) {
|
|
668
|
+
if (error instanceof Error && error.message.includes('Unauthorized')) {
|
|
669
|
+
throw new SealedSenderAuthError(error);
|
|
670
|
+
}
|
|
671
|
+
throw error;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
675
|
+
// RETRY REQUESTS (SESAME Spec §6.2)
|
|
676
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
677
|
+
/**
|
|
678
|
+
* Send retry request to the original sender.
|
|
679
|
+
*
|
|
680
|
+
* Called by recipient when decryption fails. The request is stored
|
|
681
|
+
* in the sender's retry request queue for them to process.
|
|
682
|
+
*/
|
|
683
|
+
async sendRetryRequest(request) {
|
|
684
|
+
await this.convex.mutation(this.api.messages.sendRetryRequest, {
|
|
685
|
+
// requesterUserId derived server-side from JWT auth
|
|
686
|
+
requesterDeviceId: request.requesterDeviceId,
|
|
687
|
+
originalSenderUserId: request.originalSenderUserId,
|
|
688
|
+
originalSenderDeviceId: request.originalSenderDeviceId,
|
|
689
|
+
failedTimestamp: request.failedTimestamp,
|
|
690
|
+
timestamp: request.timestamp,
|
|
691
|
+
reason: request.reason,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Subscribe to incoming retry requests for this device.
|
|
696
|
+
*
|
|
697
|
+
* When getAuthToken is provided (via constructor), uses WebSocket push
|
|
698
|
+
* for instant delivery (<100ms). Otherwise, falls back to polling every 2 seconds.
|
|
699
|
+
*
|
|
700
|
+
* @param userId - User ID (original sender)
|
|
701
|
+
* @param deviceId - Device ID
|
|
702
|
+
* @param handler - Callback for each retry request
|
|
703
|
+
* @returns Unsubscribe function
|
|
704
|
+
*/
|
|
705
|
+
subscribeRetryRequests(userId, deviceId, handler) {
|
|
706
|
+
// Use push-based subscription if auth token getter is available
|
|
707
|
+
if (this.getAuthToken) {
|
|
708
|
+
return this.subscribeRetryRequestsPush(userId, deviceId, handler);
|
|
709
|
+
}
|
|
710
|
+
// Fallback to polling for ConvexHttpClient or when no auth token getter provided
|
|
711
|
+
return this.subscribeRetryRequestsPolling(userId, deviceId, handler);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Push-based subscription using internal ConvexClient.
|
|
715
|
+
* Provides instant delivery via WebSocket.
|
|
716
|
+
*/
|
|
717
|
+
subscribeRetryRequestsPush(userId, deviceId, handler) {
|
|
718
|
+
const key = `retry:${userId}:${deviceId}`;
|
|
719
|
+
const processedIds = new Set();
|
|
720
|
+
let clientUnsubscribe = null;
|
|
721
|
+
let isActive = true;
|
|
722
|
+
this.logger.debug('Starting push-based retry request subscription', {
|
|
723
|
+
category: 'E2EE',
|
|
724
|
+
data: { userId, deviceId },
|
|
725
|
+
});
|
|
726
|
+
// Async initialization - get or create the subscription client
|
|
727
|
+
this.getSubscriptionClient().then((client) => {
|
|
728
|
+
if (!client || !isActive) {
|
|
729
|
+
// Fall back to polling if client creation failed
|
|
730
|
+
if (isActive) {
|
|
731
|
+
this.logger.warn('Subscription client unavailable, falling back to polling', {
|
|
732
|
+
category: 'E2EE',
|
|
733
|
+
});
|
|
734
|
+
const pollingUnsub = this.subscribeRetryRequestsPolling(userId, deviceId, handler);
|
|
735
|
+
this.subscriptions.set(key, pollingUnsub);
|
|
736
|
+
}
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
clientUnsubscribe = client.onUpdate(this.api.messages.getPendingRetryRequests, { deviceId }, async (requests) => {
|
|
740
|
+
for (const req of requests) {
|
|
741
|
+
// Skip already processed requests
|
|
742
|
+
if (processedIds.has(req.id)) {
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
// Mark as processing to prevent duplicate handling
|
|
746
|
+
processedIds.add(req.id);
|
|
747
|
+
try {
|
|
748
|
+
await handler({
|
|
749
|
+
requesterUserId: req.requesterUserId,
|
|
750
|
+
requesterDeviceId: req.requesterDeviceId,
|
|
751
|
+
originalSenderUserId: req.originalSenderUserId,
|
|
752
|
+
originalSenderDeviceId: req.originalSenderDeviceId,
|
|
753
|
+
failedTimestamp: req.failedTimestamp,
|
|
754
|
+
timestamp: req.timestamp,
|
|
755
|
+
reason: req.reason,
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
catch (handlerError) {
|
|
759
|
+
// Handler failed — safe to retry on next update
|
|
760
|
+
processedIds.delete(req.id);
|
|
761
|
+
this.logger.error('Error in retry request handler', {
|
|
762
|
+
category: 'E2EE',
|
|
763
|
+
error: handlerError,
|
|
764
|
+
data: { requestId: req.id },
|
|
765
|
+
});
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
// Handler succeeded — mark as handled on server (best-effort)
|
|
769
|
+
try {
|
|
770
|
+
await this.convex.mutation(this.api.messages.markRetryRequestHandled, {
|
|
771
|
+
requestId: req.id,
|
|
772
|
+
});
|
|
773
|
+
this.logger.debug('Retry request handled successfully', {
|
|
774
|
+
category: 'E2EE',
|
|
775
|
+
data: { requestId: req.id, failedTimestamp: req.failedTimestamp },
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
catch (markError) {
|
|
779
|
+
// Mark failed but handler already ran — keep in processedIds to prevent duplicate
|
|
780
|
+
this.logger.warn('Failed to mark retry request as handled (handler already ran)', {
|
|
781
|
+
category: 'E2EE',
|
|
782
|
+
data: { requestId: req.id },
|
|
783
|
+
error: markError,
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
// Cleanup: remove IDs no longer in pending results (already deleted from server)
|
|
788
|
+
const currentIds = new Set(requests.map((r) => r.id));
|
|
789
|
+
for (const id of processedIds) {
|
|
790
|
+
if (!currentIds.has(id)) {
|
|
791
|
+
processedIds.delete(id);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
});
|
|
796
|
+
// Return unsubscribe function that cleans up
|
|
797
|
+
const wrappedUnsubscribe = () => {
|
|
798
|
+
isActive = false;
|
|
799
|
+
clientUnsubscribe?.();
|
|
800
|
+
this.subscriptions.delete(key);
|
|
801
|
+
};
|
|
802
|
+
this.subscriptions.set(key, wrappedUnsubscribe);
|
|
803
|
+
return wrappedUnsubscribe;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Polling-based subscription fallback.
|
|
807
|
+
* Used when no getAuthToken is available or subscription client creation fails.
|
|
808
|
+
*
|
|
809
|
+
* NOTE: This has ~2 second latency. Use push-based subscription for production.
|
|
810
|
+
*/
|
|
811
|
+
subscribeRetryRequestsPolling(userId, deviceId, handler) {
|
|
812
|
+
const key = `retry:${userId}:${deviceId}`;
|
|
813
|
+
let isActive = true;
|
|
814
|
+
// Use stable set that accumulates processed IDs (don't replace on each poll)
|
|
815
|
+
// This prevents both duplicate processing and lost requests
|
|
816
|
+
const processedIds = new Set();
|
|
817
|
+
this.logger.debug('Starting polling-based retry request subscription (fallback)', {
|
|
818
|
+
category: 'E2EE',
|
|
819
|
+
data: { userId, deviceId, pollIntervalMs: RETRY_POLL_INTERVAL_MS },
|
|
820
|
+
});
|
|
821
|
+
const poll = async () => {
|
|
822
|
+
if (!isActive)
|
|
823
|
+
return;
|
|
824
|
+
try {
|
|
825
|
+
const requests = await this.convex.query(this.api.messages.getPendingRetryRequests, {
|
|
826
|
+
deviceId,
|
|
827
|
+
});
|
|
828
|
+
for (const req of requests) {
|
|
829
|
+
// Skip already processed requests
|
|
830
|
+
if (processedIds.has(req.id)) {
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
// Mark as processing to prevent duplicate handling
|
|
834
|
+
processedIds.add(req.id);
|
|
835
|
+
try {
|
|
836
|
+
await handler({
|
|
837
|
+
requesterUserId: req.requesterUserId,
|
|
838
|
+
requesterDeviceId: req.requesterDeviceId,
|
|
839
|
+
originalSenderUserId: req.originalSenderUserId,
|
|
840
|
+
originalSenderDeviceId: req.originalSenderDeviceId,
|
|
841
|
+
failedTimestamp: req.failedTimestamp,
|
|
842
|
+
timestamp: req.timestamp,
|
|
843
|
+
reason: req.reason,
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
catch (handlerError) {
|
|
847
|
+
// Handler failed — safe to retry on next poll
|
|
848
|
+
processedIds.delete(req.id);
|
|
849
|
+
this.logger.error('Error in retry request handler', {
|
|
850
|
+
category: 'E2EE',
|
|
851
|
+
error: handlerError,
|
|
852
|
+
});
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
// Handler succeeded — mark as handled on server (best-effort)
|
|
856
|
+
try {
|
|
857
|
+
await this.convex.mutation(this.api.messages.markRetryRequestHandled, {
|
|
858
|
+
requestId: req.id,
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
catch (markError) {
|
|
862
|
+
// Mark failed but handler already ran — keep in processedIds to prevent duplicate
|
|
863
|
+
this.logger.warn('Failed to mark retry request as handled (handler already ran)', {
|
|
864
|
+
category: 'E2EE',
|
|
865
|
+
error: markError,
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
// Cleanup: remove IDs no longer in pending results (already deleted from server)
|
|
870
|
+
// This prevents memory leak from accumulating old IDs
|
|
871
|
+
const currentIds = new Set(requests.map((r) => r.id));
|
|
872
|
+
for (const id of processedIds) {
|
|
873
|
+
if (!currentIds.has(id)) {
|
|
874
|
+
processedIds.delete(id);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
catch (error) {
|
|
879
|
+
this.logger.error('Error polling retry requests', {
|
|
880
|
+
category: 'E2EE',
|
|
881
|
+
error: error,
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
// Continue polling
|
|
885
|
+
if (isActive) {
|
|
886
|
+
setTimeout(poll, RETRY_POLL_INTERVAL_MS);
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
// Start polling
|
|
890
|
+
poll();
|
|
891
|
+
const unsubscribe = () => {
|
|
892
|
+
isActive = false;
|
|
893
|
+
this.subscriptions.delete(key);
|
|
894
|
+
};
|
|
895
|
+
this.subscriptions.set(key, unsubscribe);
|
|
896
|
+
return unsubscribe;
|
|
897
|
+
}
|
|
898
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
899
|
+
// PROVISIONING SERVICE (IProvisioningService)
|
|
900
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
901
|
+
async createProvisioningSession(userId, ephemeralPublicKey) {
|
|
902
|
+
return await this.convex.mutation(this.api.provisioning.createProvisioningSession, {
|
|
903
|
+
userId,
|
|
904
|
+
ephemeralPublicKey,
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
async connectNewDevice(sessionId, ephemeralPublicKey, deviceMetadata) {
|
|
908
|
+
await this.convex.mutation(this.api.provisioning.connectNewDevice, {
|
|
909
|
+
sessionId,
|
|
910
|
+
ephemeralPublicKey,
|
|
911
|
+
deviceMetadata,
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
async sendProvisioningMessage(sessionId, encryptedMessage, userId) {
|
|
915
|
+
if (!userId && !this.currentUserId) {
|
|
916
|
+
throw new Error('userId required for sendProvisioningMessage');
|
|
917
|
+
}
|
|
918
|
+
await this.convex.mutation(this.api.provisioning.sendProvisioningMessage, {
|
|
919
|
+
userId: userId ?? this.currentUserId,
|
|
920
|
+
sessionId,
|
|
921
|
+
encryptedMessage,
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
async getProvisioningMessage(sessionId) {
|
|
925
|
+
const result = await this.convex.query(this.api.provisioning.getProvisioningMessage, {
|
|
926
|
+
sessionId,
|
|
927
|
+
});
|
|
928
|
+
return result;
|
|
929
|
+
}
|
|
930
|
+
async completeProvisioning(sessionId, deviceMetadata) {
|
|
931
|
+
return await this.convex.mutation(this.api.provisioning.completeProvisioning, {
|
|
932
|
+
sessionId,
|
|
933
|
+
deviceMetadata,
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
async acknowledgeProvisioning(sessionId) {
|
|
937
|
+
await this.convex.mutation(this.api.provisioning.acknowledgeProvisioning, {
|
|
938
|
+
sessionId,
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
async rollbackProvisioning(sessionId) {
|
|
942
|
+
await this.convex.mutation(this.api.provisioning.rollbackProvisioning, {
|
|
943
|
+
sessionId,
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
async deleteProvisioningSession(sessionId, userId) {
|
|
947
|
+
if (!userId && !this.currentUserId) {
|
|
948
|
+
throw new Error('userId required for deleteProvisioningSession');
|
|
949
|
+
}
|
|
950
|
+
await this.convex.mutation(this.api.provisioning.deleteProvisioningSession, {
|
|
951
|
+
userId: userId ?? this.currentUserId,
|
|
952
|
+
sessionId,
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
956
|
+
// KEY ROTATION SERVICE (IKeyRotationService)
|
|
957
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
958
|
+
async getEcSignedPreKeyMetadata(userId, deviceId, identityType) {
|
|
959
|
+
const metadata = await this.convex.query(this.api.keys.getEcSignedPreKeyMetadata, {
|
|
960
|
+
userId,
|
|
961
|
+
deviceId,
|
|
962
|
+
identityType: identityType ?? 'aci',
|
|
963
|
+
});
|
|
964
|
+
return metadata;
|
|
965
|
+
}
|
|
966
|
+
async getKemLastResortPreKeyMetadata(userId, deviceId, identityType) {
|
|
967
|
+
const metadata = await this.convex.query(this.api.keys.getKemLastResortPreKeyMetadata, {
|
|
968
|
+
userId,
|
|
969
|
+
deviceId,
|
|
970
|
+
identityType: identityType ?? 'aci',
|
|
971
|
+
});
|
|
972
|
+
return metadata;
|
|
973
|
+
}
|
|
974
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
975
|
+
// GROUP STATE (GroupsV2 — encrypted, server-opaque)
|
|
976
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
977
|
+
async createGroupState(groupId, encryptedState, authorization) {
|
|
978
|
+
await this.convex.mutation(this.api.groups.createGroup, {
|
|
979
|
+
groupId: this.toBytes(groupId),
|
|
980
|
+
encryptedState: this.toBytes(encryptedState),
|
|
981
|
+
presentation: this.toBytes(authorization.presentation),
|
|
982
|
+
groupPublicParams: this.toBytes(authorization.groupPublicParams),
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
async getGroupState(groupId, authorization) {
|
|
986
|
+
const result = await this.convex.query(this.api.groups.getGroup, {
|
|
987
|
+
groupId: this.toBytes(groupId),
|
|
988
|
+
presentation: this.toBytes(authorization.presentation),
|
|
989
|
+
groupPublicParams: this.toBytes(authorization.groupPublicParams),
|
|
990
|
+
});
|
|
991
|
+
if (!result)
|
|
992
|
+
return null;
|
|
993
|
+
return {
|
|
994
|
+
encryptedState: new Uint8Array(result.encryptedState),
|
|
995
|
+
version: result.version,
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
async getGroupChanges(groupId, fromVersion, authorization) {
|
|
999
|
+
const result = await this.convex.query(this.api.groups.getGroupChanges, {
|
|
1000
|
+
groupId: this.toBytes(groupId),
|
|
1001
|
+
fromVersion,
|
|
1002
|
+
presentation: this.toBytes(authorization.presentation),
|
|
1003
|
+
groupPublicParams: this.toBytes(authorization.groupPublicParams),
|
|
1004
|
+
});
|
|
1005
|
+
return result.map((entry) => ({
|
|
1006
|
+
version: entry.version,
|
|
1007
|
+
encryptedChange: new Uint8Array(entry.encryptedChange),
|
|
1008
|
+
serverSignature: new Uint8Array(entry.serverSignature),
|
|
1009
|
+
timestamp: entry.timestamp,
|
|
1010
|
+
}));
|
|
1011
|
+
}
|
|
1012
|
+
async submitGroupChange(groupId, expectedVersion, encryptedChange, updatedEncryptedState, authorization) {
|
|
1013
|
+
const result = await this.convex.mutation(this.api.groups.submitGroupChange, {
|
|
1014
|
+
groupId: this.toBytes(groupId),
|
|
1015
|
+
expectedVersion,
|
|
1016
|
+
encryptedChange: this.toBytes(encryptedChange),
|
|
1017
|
+
updatedEncryptedState: this.toBytes(updatedEncryptedState),
|
|
1018
|
+
presentation: this.toBytes(authorization.presentation),
|
|
1019
|
+
groupPublicParams: this.toBytes(authorization.groupPublicParams),
|
|
1020
|
+
});
|
|
1021
|
+
return { serverSignature: new Uint8Array(result.serverSignature) };
|
|
1022
|
+
}
|
|
1023
|
+
async issueAuthCredential(_userId) {
|
|
1024
|
+
// userId kept for ISignalRelayServer interface compat; server uses auth session
|
|
1025
|
+
const result = await this.convex.mutation(this.api.zkAuth.issueAuthCredentialMutation, {});
|
|
1026
|
+
return new Uint8Array(result);
|
|
1027
|
+
}
|
|
1028
|
+
async refreshGroupSendEndorsements(groupId, authorization) {
|
|
1029
|
+
const result = await this.convex.mutation(this.api.groups.refreshGroupSendEndorsements, {
|
|
1030
|
+
groupId: this.toBytes(groupId),
|
|
1031
|
+
presentation: this.toBytes(authorization.presentation),
|
|
1032
|
+
groupPublicParams: this.toBytes(authorization.groupPublicParams),
|
|
1033
|
+
});
|
|
1034
|
+
return {
|
|
1035
|
+
endorsements: new Uint8Array(result.endorsements),
|
|
1036
|
+
expiration: result.expiration,
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
1040
|
+
// UTILITY METHODS
|
|
1041
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
1042
|
+
/** Convert Uint8Array to ArrayBuffer for Convex v.bytes() args. */
|
|
1043
|
+
toBytes(data) {
|
|
1044
|
+
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
1045
|
+
}
|
|
1046
|
+
uint8ArrayToBase64(data) {
|
|
1047
|
+
// Use Buffer in Node.js or btoa in browser
|
|
1048
|
+
if (typeof Buffer !== 'undefined') {
|
|
1049
|
+
return Buffer.from(data).toString('base64');
|
|
1050
|
+
}
|
|
1051
|
+
let binary = '';
|
|
1052
|
+
const len = data.byteLength;
|
|
1053
|
+
for (let i = 0; i < len; i++) {
|
|
1054
|
+
binary += String.fromCharCode(data[i]);
|
|
1055
|
+
}
|
|
1056
|
+
return btoa(binary);
|
|
1057
|
+
}
|
|
1058
|
+
base64ToUint8Array(base64) {
|
|
1059
|
+
if (typeof Buffer !== 'undefined') {
|
|
1060
|
+
return new Uint8Array(Buffer.from(base64, 'base64'));
|
|
1061
|
+
}
|
|
1062
|
+
const binary = atob(base64);
|
|
1063
|
+
const len = binary.length;
|
|
1064
|
+
const bytes = new Uint8Array(len);
|
|
1065
|
+
for (let i = 0; i < len; i++) {
|
|
1066
|
+
bytes[i] = binary.charCodeAt(i);
|
|
1067
|
+
}
|
|
1068
|
+
return bytes;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Clean up all subscriptions and close the internal subscription client.
|
|
1072
|
+
*/
|
|
1073
|
+
async destroy() {
|
|
1074
|
+
// Unsubscribe all active subscriptions
|
|
1075
|
+
for (const unsubscribe of this.subscriptions.values()) {
|
|
1076
|
+
unsubscribe();
|
|
1077
|
+
}
|
|
1078
|
+
this.subscriptions.clear();
|
|
1079
|
+
// Close the internal subscription client if it exists
|
|
1080
|
+
if (this.subscriptionClient) {
|
|
1081
|
+
await this.subscriptionClient.close();
|
|
1082
|
+
this.subscriptionClient = null;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
//# sourceMappingURL=relay.js.map
|