@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,1079 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signal Protocol Manager
|
|
3
|
+
*
|
|
4
|
+
* Core implementation of the Signal Protocol for end-to-end encrypted messaging.
|
|
5
|
+
* This module orchestrates the complete encryption lifecycle including key generation,
|
|
6
|
+
* session establishment, message encryption/decryption, and key rotation.
|
|
7
|
+
*
|
|
8
|
+
* @module protocol/manager
|
|
9
|
+
*
|
|
10
|
+
* ## Architecture Overview
|
|
11
|
+
*
|
|
12
|
+
* The manager coordinates three main cryptographic components:
|
|
13
|
+
*
|
|
14
|
+
* 1. **X3DH/PQXDH Key Agreement** - Establishes shared secrets for new sessions
|
|
15
|
+
* - X3DH: Extended Triple Diffie-Hellman (classical security)
|
|
16
|
+
* - PQXDH: Post-Quantum X3DH with ML-KEM-1024 (quantum-resistant)
|
|
17
|
+
*
|
|
18
|
+
* 2. **Double Ratchet Algorithm** - Provides forward secrecy per message
|
|
19
|
+
* - Symmetric-key ratchet for message key derivation
|
|
20
|
+
* - Diffie-Hellman ratchet for recovering from key compromise
|
|
21
|
+
*
|
|
22
|
+
* 3. **Key Management** - Handles identity, prekeys, and rotation
|
|
23
|
+
* - Identity keys: Long-lived, per-user Ed25519 signing + X25519 DH
|
|
24
|
+
* - Signed prekeys: Weekly rotation, signed by identity key
|
|
25
|
+
* - One-time prekeys: Single-use, consumed atomically
|
|
26
|
+
* - Kyber prekeys: Post-quantum ML-KEM-1024 keys
|
|
27
|
+
*
|
|
28
|
+
* ## Thread Safety
|
|
29
|
+
*
|
|
30
|
+
* Uses per-session AsyncLock to prevent race conditions during concurrent
|
|
31
|
+
* encrypt/decrypt operations. Different sessions don't block each other.
|
|
32
|
+
*
|
|
33
|
+
* ## Specification References
|
|
34
|
+
*
|
|
35
|
+
* @see https://signal.org/docs/specifications/x3dh/ - X3DH key agreement
|
|
36
|
+
* @see https://signal.org/docs/specifications/doubleratchet/ - Double Ratchet
|
|
37
|
+
* @see https://signal.org/docs/specifications/pqxdh/ - Post-Quantum X3DH
|
|
38
|
+
*
|
|
39
|
+
* @example Basic usage with SignalProtocolClient (recommended)
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { SignalProtocolClient } from '../../index.js';
|
|
42
|
+
*
|
|
43
|
+
* const client = await SignalProtocolClient.create('user-123', { storage });
|
|
44
|
+
* const encrypted = await client.encryptMessage(sessionId, 'Hello!');
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Direct protocol manager usage (advanced)
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { SignalProtocolManager } from './/index.js';
|
|
50
|
+
*
|
|
51
|
+
* const manager = new SignalProtocolManager(storage);
|
|
52
|
+
* await manager.initialize();
|
|
53
|
+
* await manager.generatePreKeyBundle(userId);
|
|
54
|
+
* await manager.startSession(sessionId, remoteAddress, bundle, localUserId);
|
|
55
|
+
* const ciphertext = await manager.encrypt(sessionId, 'Hello!');
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
import AsyncLock from 'async-lock';
|
|
59
|
+
import { defaultSignalLogger } from '../../logger.js';
|
|
60
|
+
import { CURRENT_SESSION_RECORD_VERSION } from '../../types/session.js';
|
|
61
|
+
import { EncryptionError, EncryptionErrorCode, TrustDirection, UntrustedIdentityError, } from '../../types/index.js';
|
|
62
|
+
import { DEFAULT_RATCHET_CONFIG } from '../protocol/double-ratchet/index.js';
|
|
63
|
+
import { ProtocolAddress } from '../../types/address.js';
|
|
64
|
+
import { resolveSCKAMode } from '../../types/protocol-config.js';
|
|
65
|
+
// DEFAULT_DEVICE_ID removed - device IDs must be explicitly provided
|
|
66
|
+
import * as CryptoUtils from '../crypto/index.js';
|
|
67
|
+
import * as SPQR from '../protocol/spqr/index.js';
|
|
68
|
+
import { cleanupExpiredKeys as moduleCleanupExpiredKeys } from '../protocol/double-ratchet/index.js';
|
|
69
|
+
import { generateIdentityKeyPair, generateEcSignedPreKey, generateEcOneTimePreKeys, generateKyberLastResortPreKey, } from '../../keys/index.js';
|
|
70
|
+
import { SessionBuilder, SessionCipher } from '../session/index.js';
|
|
71
|
+
export class SignalProtocolManager {
|
|
72
|
+
keyStorage;
|
|
73
|
+
initialized = false;
|
|
74
|
+
logger;
|
|
75
|
+
/** Protocol strategy configuration for PQXDH and SPQR. */
|
|
76
|
+
protocolStrategy;
|
|
77
|
+
/**
|
|
78
|
+
* Local user's ID, set during generatePreKeyBundle or initialization.
|
|
79
|
+
* Used to create ProtocolAddress for session establishment as responder.
|
|
80
|
+
*/
|
|
81
|
+
localUserId = null;
|
|
82
|
+
/**
|
|
83
|
+
* Local device ID, set during generatePreKeyBundle.
|
|
84
|
+
* Used to create ProtocolAddress for session establishment as responder.
|
|
85
|
+
*/
|
|
86
|
+
localDeviceId = null;
|
|
87
|
+
/**
|
|
88
|
+
* Async lock for concurrent safety
|
|
89
|
+
*
|
|
90
|
+
* Prevents race conditions when multiple encrypt/decrypt operations
|
|
91
|
+
* happen concurrently on the same session. Uses per-session locks
|
|
92
|
+
* so different conversations don't block each other.
|
|
93
|
+
*/
|
|
94
|
+
lock = new AsyncLock({
|
|
95
|
+
timeout: 5000, // 5 second timeout prevents deadlocks
|
|
96
|
+
maxPending: 1000, // Max 1000 queued operations per session
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* SessionCipher handles encrypt/decrypt operations.
|
|
100
|
+
* Lazily initialized on first use.
|
|
101
|
+
*/
|
|
102
|
+
sessionCipher = null;
|
|
103
|
+
/**
|
|
104
|
+
* Create a new SignalProtocolManager instance
|
|
105
|
+
*
|
|
106
|
+
* @param storage - Local protocol storage implementation.
|
|
107
|
+
* @param protocolStrategy - Optional protocol strategy for PQXDH/SPQR behavior.
|
|
108
|
+
*/
|
|
109
|
+
constructor(storage, protocolStrategy, logger = defaultSignalLogger) {
|
|
110
|
+
this.logger = logger;
|
|
111
|
+
this.keyStorage = storage;
|
|
112
|
+
this.protocolStrategy = protocolStrategy;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get or create the SessionCipher instance.
|
|
116
|
+
* SessionCipher is lazily initialized to allow manager setup first.
|
|
117
|
+
*/
|
|
118
|
+
getSessionCipher() {
|
|
119
|
+
if (!this.sessionCipher) {
|
|
120
|
+
this.sessionCipher = new SessionCipher(this.keyStorage, this.establishSessionFromPreKeyMessage.bind(this), this.lock, {}, this.logger);
|
|
121
|
+
}
|
|
122
|
+
return this.sessionCipher;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Callback for SessionCipher to establish a session from a PreKeyMessage.
|
|
126
|
+
* This method is called when decrypt() receives a PreKeyMessage and no session exists.
|
|
127
|
+
*
|
|
128
|
+
* Note: Updated to use ProtocolAddress per session identification architecture changes.
|
|
129
|
+
*/
|
|
130
|
+
async establishSessionFromPreKeyMessage(remoteAddress, prekeyMessage) {
|
|
131
|
+
return this.performX3DHResponder(remoteAddress, prekeyMessage);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get lock key for a specific session
|
|
135
|
+
* Each session has its own lock to prevent cross-conversation blocking
|
|
136
|
+
*/
|
|
137
|
+
getLockKey(sessionId) {
|
|
138
|
+
return `session:${sessionId}`;
|
|
139
|
+
}
|
|
140
|
+
// ============================================================================
|
|
141
|
+
// Double Ratchet State Adapters (SessionState ↔ DoubleRatchetState)
|
|
142
|
+
// ============================================================================
|
|
143
|
+
/**
|
|
144
|
+
* Extract Double Ratchet state from SessionState for delegation to module.
|
|
145
|
+
*
|
|
146
|
+
* This allows manager.ts to delegate ratchet operations to the double-ratchet
|
|
147
|
+
* module while keeping the full SessionState structure for other purposes.
|
|
148
|
+
*
|
|
149
|
+
* @throws Error if session is not initialized (DHs or DHr is null)
|
|
150
|
+
*/
|
|
151
|
+
extractRatchetState(session) {
|
|
152
|
+
// Validate session has been fully initialized with DH keys and chain keys
|
|
153
|
+
// For lazy initialization (responder), this should only be called AFTER
|
|
154
|
+
// the first DHRatchet step has completed and set all keys.
|
|
155
|
+
if (!session.DHs) {
|
|
156
|
+
throw new Error('Cannot extract ratchet state: DHs is null (session not initialized)');
|
|
157
|
+
}
|
|
158
|
+
if (!session.DHr) {
|
|
159
|
+
throw new Error('Cannot extract ratchet state: DHr is undefined (lazy init not complete)');
|
|
160
|
+
}
|
|
161
|
+
if (!session.CKs || !session.CKr) {
|
|
162
|
+
throw new Error('Cannot extract ratchet state: Chain keys undefined (lazy init not complete)');
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
DHs: session.DHs,
|
|
166
|
+
DHr: session.DHr,
|
|
167
|
+
RK: session.RK,
|
|
168
|
+
CKs: session.CKs,
|
|
169
|
+
CKr: session.CKr,
|
|
170
|
+
Ns: session.Ns,
|
|
171
|
+
Nr: session.Nr,
|
|
172
|
+
PN: session.PN,
|
|
173
|
+
receiverChains: session.receiverChains ?? [],
|
|
174
|
+
processedChains: session.processedChains,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// ============================================================================
|
|
178
|
+
// Initialization
|
|
179
|
+
// ============================================================================
|
|
180
|
+
/**
|
|
181
|
+
* Initialize identity keys on first launch
|
|
182
|
+
*
|
|
183
|
+
* This method should:
|
|
184
|
+
* 1. Check if identity key already exists
|
|
185
|
+
* 2. If not, generate a new identity key pair
|
|
186
|
+
* 3. Store private key in SecureStore
|
|
187
|
+
* 4. Upload public key to Convex
|
|
188
|
+
*
|
|
189
|
+
*/
|
|
190
|
+
async initialize(identityTypes = ['aci', 'pni']) {
|
|
191
|
+
try {
|
|
192
|
+
// Generate identity keys for active identity types (Signal dual-identity architecture)
|
|
193
|
+
for (const type of identityTypes) {
|
|
194
|
+
await this.initializeIdentity(type);
|
|
195
|
+
}
|
|
196
|
+
this.initialized = true;
|
|
197
|
+
this.logger.breadcrumb(`Signal Protocol initialized successfully (${identityTypes.join(' + ').toUpperCase()})`, {
|
|
198
|
+
category: 'E2EE',
|
|
199
|
+
level: 'info',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
throw new EncryptionError('Failed to initialize Signal Protocol', EncryptionErrorCode.INITIALIZATION_FAILED, { originalError: error });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Initialize identity key for a specific identity type (ACI or PNI).
|
|
208
|
+
*
|
|
209
|
+
* Generates and stores an identity key pair if one does not already exist
|
|
210
|
+
* for the given identity type.
|
|
211
|
+
*
|
|
212
|
+
* @param identityType - 'aci' (account) or 'pni' (phone number)
|
|
213
|
+
*/
|
|
214
|
+
async initializeIdentity(identityType) {
|
|
215
|
+
const hasKey = await this.keyStorage.hasIdentityKey(identityType);
|
|
216
|
+
if (hasKey) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
// Generate identity key using Signal Protocol (P-256 ECDH + ECDSA)
|
|
220
|
+
const identityKeyPair = await this.generateIdentityKey();
|
|
221
|
+
// Store identity key for this identity type
|
|
222
|
+
await this.keyStorage.storeIdentityKey(identityKeyPair, identityType);
|
|
223
|
+
this.logger.breadcrumb(`Identity key generated for ${identityType}`, {
|
|
224
|
+
category: 'E2EE',
|
|
225
|
+
level: 'info',
|
|
226
|
+
data: { identityType },
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Set local user and device identity.
|
|
231
|
+
*
|
|
232
|
+
* This must be called before any session operations (encrypt/decrypt).
|
|
233
|
+
* It's normally called by generatePreKeyBundle, but can be called directly
|
|
234
|
+
* when keys already exist and don't need regeneration.
|
|
235
|
+
*
|
|
236
|
+
* @param userId - User ID for this client
|
|
237
|
+
* @param deviceId - Device ID (1 for primary, 2-5 for linked devices)
|
|
238
|
+
*/
|
|
239
|
+
setLocalIdentity(userId, deviceId) {
|
|
240
|
+
this.localUserId = userId;
|
|
241
|
+
this.localDeviceId = deviceId;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Generate and upload prekey bundle
|
|
245
|
+
*
|
|
246
|
+
* This method should:
|
|
247
|
+
* 1. Generate signed prekey (rotates weekly)
|
|
248
|
+
* 2. Generate 100 one-time prekeys
|
|
249
|
+
* 3. Sign the signed prekey with identity key
|
|
250
|
+
* 4. Store private keys in SecureStore
|
|
251
|
+
* 5. Upload public keys to Convex
|
|
252
|
+
*
|
|
253
|
+
*/
|
|
254
|
+
async generatePreKeyBundle(userId, deviceId, identityType = 'aci') {
|
|
255
|
+
try {
|
|
256
|
+
if (!this.initialized) {
|
|
257
|
+
await this.initialize();
|
|
258
|
+
}
|
|
259
|
+
// Set local identity for session establishment
|
|
260
|
+
this.setLocalIdentity(userId, deviceId);
|
|
261
|
+
// Get identity key for signing (for the specified identity type)
|
|
262
|
+
const identityKey = await this.keyStorage.getIdentityKey(identityType);
|
|
263
|
+
if (!identityKey) {
|
|
264
|
+
throw new Error(`Identity key not found for ${identityType}`);
|
|
265
|
+
}
|
|
266
|
+
// Generate EC signed prekey using Signal Protocol
|
|
267
|
+
const signedPreKey = await this.generateEcSignedPreKey(identityType);
|
|
268
|
+
// Store EC signed prekey
|
|
269
|
+
await this.keyStorage.storeEcSignedPreKey(signedPreKey, identityType);
|
|
270
|
+
// Generate Kyber last-resort prekey when missing.
|
|
271
|
+
// Direct local session establishment expects PQXDH material to be
|
|
272
|
+
// available unless the caller explicitly removes it.
|
|
273
|
+
const existingKyberPreKey = await this.keyStorage.getKyberPreKey(identityType);
|
|
274
|
+
if (!existingKyberPreKey) {
|
|
275
|
+
const kyberPreKey = await generateKyberLastResortPreKey(identityKey, 1);
|
|
276
|
+
await this.keyStorage.storeKyberPreKey(kyberPreKey, identityType);
|
|
277
|
+
}
|
|
278
|
+
// One-time prekeys are generated exclusively by the sync/replenishment
|
|
279
|
+
// path; local session setup creates only a signed prekey and last-resort
|
|
280
|
+
// KEM prekey.
|
|
281
|
+
this.logger.breadcrumb('Prekey bundle generated', {
|
|
282
|
+
category: 'E2EE',
|
|
283
|
+
level: 'info',
|
|
284
|
+
data: { userId, identityType },
|
|
285
|
+
});
|
|
286
|
+
// NOTE: Prekey upload is handled at the SignalProtocolClient layer via ConvexBackendAdapter
|
|
287
|
+
// This low-level method only generates keys; upload happens in the higher layer
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
throw new EncryptionError('Failed to generate prekey bundle', EncryptionErrorCode.INITIALIZATION_FAILED, { originalError: error });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Start a new session with a partner using X3DH (with optional PQXDH)
|
|
295
|
+
*
|
|
296
|
+
* X3DH (Extended Triple Diffie-Hellman) provides mutual authentication and forward secrecy.
|
|
297
|
+
* It performs 3-4 ECDH operations and combines them using HKDF.
|
|
298
|
+
*
|
|
299
|
+
* PQXDH Extension: If Kyber prekey is available, adds post-quantum security via
|
|
300
|
+
* CRYSTALS-Kyber-1024, providing AES-256 equivalent security against quantum computers.
|
|
301
|
+
*
|
|
302
|
+
* Steps:
|
|
303
|
+
* 1. Verify signed prekey signature
|
|
304
|
+
* 2. Perform X3DH key agreement (3-4 DH operations)
|
|
305
|
+
* 3. [Optional] Add Kyber KEM for post-quantum security (PQXDH)
|
|
306
|
+
* 4. Derive initial root key and chain keys using HKDF
|
|
307
|
+
* 5. Initialize Double Ratchet state
|
|
308
|
+
* 6. Store session in SecureStore
|
|
309
|
+
*
|
|
310
|
+
* CONCURRENT SAFETY: Protected by per-session lock to prevent race conditions
|
|
311
|
+
* during session initialization.
|
|
312
|
+
*/
|
|
313
|
+
async startSession(remoteAddress, prekeyBundle, recipientIdentityType = 'aci') {
|
|
314
|
+
// Derive sessionId from ProtocolAddress for storage/logging
|
|
315
|
+
const sessionId = ProtocolAddress.toString(remoteAddress);
|
|
316
|
+
// Acquire lock for this session to ensure atomic session creation
|
|
317
|
+
return await this.lock.acquire(this.getLockKey(sessionId), async () => {
|
|
318
|
+
try {
|
|
319
|
+
if (!this.initialized) {
|
|
320
|
+
await this.initialize();
|
|
321
|
+
}
|
|
322
|
+
// Validate local state is initialized (via generatePreKeyBundle)
|
|
323
|
+
if (this.localDeviceId === null || !this.localUserId) {
|
|
324
|
+
throw new EncryptionError('Local identity not set. Call generatePreKeyBundle first.', EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
325
|
+
}
|
|
326
|
+
// Step 1: Verify signed prekey signature using identity signing key
|
|
327
|
+
const { PREKEY_ALGORITHM_X25519, verifyPreKeySignature } = await import('../../keys/prekey-signature.js');
|
|
328
|
+
const isValid = await verifyPreKeySignature(prekeyBundle.identity, PREKEY_ALGORITHM_X25519, prekeyBundle.ecSignedPreKey.keyId, prekeyBundle.ecSignedPreKey.publicKey, prekeyBundle.ecSignedPreKey.signature);
|
|
329
|
+
if (!isValid) {
|
|
330
|
+
throw new EncryptionError('Invalid signed prekey signature', EncryptionErrorCode.SIGNATURE_VERIFICATION_FAILED);
|
|
331
|
+
}
|
|
332
|
+
// Reject a known identity change before doing handshake work. The final
|
|
333
|
+
// atomic commit below repeats this decision against current durable state,
|
|
334
|
+
// closing the race between this pre-check and session persistence.
|
|
335
|
+
const isTrusted = await this.keyStorage.isTrustedIdentity(remoteAddress, prekeyBundle.identity, TrustDirection.SENDING, recipientIdentityType);
|
|
336
|
+
if (!isTrusted) {
|
|
337
|
+
throw new UntrustedIdentityError(remoteAddress, prekeyBundle.identity);
|
|
338
|
+
}
|
|
339
|
+
// Step 2: Get identity key and build session via SessionBuilder
|
|
340
|
+
const myIdentityKey = await this.keyStorage.getIdentityKey();
|
|
341
|
+
if (!myIdentityKey) {
|
|
342
|
+
throw new EncryptionError('Identity key not found', EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
343
|
+
}
|
|
344
|
+
// Create local ProtocolAddress from class fields
|
|
345
|
+
const localProtocolAddress = ProtocolAddress.create(this.localUserId, this.localDeviceId);
|
|
346
|
+
const builderResult = await SessionBuilder.buildInitiatorSession({
|
|
347
|
+
localAddress: localProtocolAddress,
|
|
348
|
+
remoteAddress, // Already a ProtocolAddress
|
|
349
|
+
identityKeyPair: myIdentityKey,
|
|
350
|
+
prekeyBundle,
|
|
351
|
+
recipientIdentityType,
|
|
352
|
+
protocolStrategy: this.protocolStrategy,
|
|
353
|
+
logger: this.logger,
|
|
354
|
+
});
|
|
355
|
+
const { sessionState, initialRootKeyForSPQR, usedPQXDH, usedClassicalFallback } = builderResult;
|
|
356
|
+
// Step 3: Initialize Triple Ratchet (SPQR). PQXDH sessions always require SPQR v1.
|
|
357
|
+
if (usedPQXDH && !initialRootKeyForSPQR) {
|
|
358
|
+
throw new EncryptionError('PQXDH session missing Triple Ratchet root material', EncryptionErrorCode.TRIPLE_RATCHET_REQUIRED, {
|
|
359
|
+
operation: 'establishSession',
|
|
360
|
+
role: 'initiator',
|
|
361
|
+
usedPQXDH,
|
|
362
|
+
usedClassicalFallback: !!usedClassicalFallback,
|
|
363
|
+
hasInitialRootKeyForSPQR: !!initialRootKeyForSPQR,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
if (!usedPQXDH && !usedClassicalFallback) {
|
|
367
|
+
throw new EncryptionError('Non-PQXDH session requires explicit classical compatibility fallback', EncryptionErrorCode.TRIPLE_RATCHET_REQUIRED, {
|
|
368
|
+
operation: 'establishSession',
|
|
369
|
+
role: 'initiator',
|
|
370
|
+
usedPQXDH,
|
|
371
|
+
usedClassicalFallback: !!usedClassicalFallback,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
if (usedPQXDH && initialRootKeyForSPQR) {
|
|
375
|
+
this.logger.breadcrumb('Initializing Triple Ratchet (SPQR) for post-quantum security', {
|
|
376
|
+
category: 'E2EE',
|
|
377
|
+
level: 'info',
|
|
378
|
+
data: { sessionId, operation: 'triple-ratchet-init' },
|
|
379
|
+
});
|
|
380
|
+
try {
|
|
381
|
+
// Resolve SCKA mode from protocol strategy
|
|
382
|
+
const sckaMode = resolveSCKAMode(this.protocolStrategy);
|
|
383
|
+
// SPQR Bootstrap (Section 3.10): Generate initial Kyber-768 key pair for Alice
|
|
384
|
+
// IMPORTANT: SPQR uses ML-KEM-768 (not 1024), separate from PQXDH's Kyber-1024
|
|
385
|
+
// Alice needs to send her public key in the first message so Bob can encapsulate to her
|
|
386
|
+
const { generateKyber768KeyPair, bytesToBase64 } = await import('../crypto/index.js');
|
|
387
|
+
const initialKyberKeyPair = await generateKyber768KeyPair();
|
|
388
|
+
const ourKyberPrivateKey = bytesToBase64(initialKyberKeyPair.privateKey);
|
|
389
|
+
const ourKyberPublicKey = bytesToBase64(initialKyberKeyPair.publicKey);
|
|
390
|
+
this.logger.debug('SPQR bootstrap: Generated initial Kyber-768 key pair (initiator)', {
|
|
391
|
+
category: 'E2EE',
|
|
392
|
+
data: {
|
|
393
|
+
operation: 'triple-ratchet-init',
|
|
394
|
+
publicKeyPreview: ourKyberPublicKey.substring(0, 30) + '...',
|
|
395
|
+
},
|
|
396
|
+
});
|
|
397
|
+
// Initialize SPQR state for Alice (A2B direction) using original SK
|
|
398
|
+
const spqrState = await SPQR.initializeSPQR({
|
|
399
|
+
mode: sckaMode,
|
|
400
|
+
initialRootKey: initialRootKeyForSPQR, // ✅ Original SK (same as Bob will use)
|
|
401
|
+
direction: 'A2B',
|
|
402
|
+
ourKyberPrivateKey, // ✅ Store private key for future decapsulation
|
|
403
|
+
theirKyberPublicKey: null, // Will be received in Bob's first reply
|
|
404
|
+
spqrLimits: this.protocolStrategy?.spqrLimits,
|
|
405
|
+
});
|
|
406
|
+
// SPQR Bootstrap: Signal that first spqrSend() should generate keypair
|
|
407
|
+
// spqrSend() handles lazy KEM — no pending fields needed
|
|
408
|
+
spqrState.needsSendRatchet = true;
|
|
409
|
+
// Add Triple Ratchet to session BEFORE zeroing the key
|
|
410
|
+
// This ensures we only zero after successful initialization
|
|
411
|
+
sessionState.tripleRatchet = {
|
|
412
|
+
spqrState: spqrState,
|
|
413
|
+
enabled: true,
|
|
414
|
+
enabledAt: Date.now(),
|
|
415
|
+
};
|
|
416
|
+
this.logger.breadcrumb('Triple Ratchet initialized with original SK', {
|
|
417
|
+
category: 'E2EE',
|
|
418
|
+
level: 'info',
|
|
419
|
+
data: { sessionId, spqrEpoch: spqrState.epoch, needsSendRatchet: true },
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
catch (spqrError) {
|
|
423
|
+
// SPQR initialization failed - this is a critical error
|
|
424
|
+
// Log and propagate the error rather than silently degrading
|
|
425
|
+
this.logger.error('Triple Ratchet (SPQR) initialization failed', {
|
|
426
|
+
category: 'E2EE',
|
|
427
|
+
data: {
|
|
428
|
+
sessionId,
|
|
429
|
+
error: spqrError instanceof Error ? spqrError.message : String(spqrError),
|
|
430
|
+
},
|
|
431
|
+
});
|
|
432
|
+
throw new EncryptionError('Failed to initialize Triple Ratchet (SPQR)', EncryptionErrorCode.TRIPLE_RATCHET_REQUIRED, { originalError: spqrError });
|
|
433
|
+
}
|
|
434
|
+
finally {
|
|
435
|
+
// Securely zero preserved SK after use (Signal Protocol Section 8.1)
|
|
436
|
+
// Always zero the key whether initialization succeeded or failed
|
|
437
|
+
CryptoUtils.secureZeroBytes(initialRootKeyForSPQR);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// Steps 4-5: Pin/match the remote TOFU identity and persist the new
|
|
441
|
+
// session at one durable commit point. A racing identity rotation must
|
|
442
|
+
// fail closed without leaving either half of the state visible.
|
|
443
|
+
await this.keyStorage.commitSessionTrust({
|
|
444
|
+
address: remoteAddress,
|
|
445
|
+
record: {
|
|
446
|
+
currentSession: sessionState,
|
|
447
|
+
archivedSessions: {},
|
|
448
|
+
version: CURRENT_SESSION_RECORD_VERSION,
|
|
449
|
+
},
|
|
450
|
+
contactIdentity: prekeyBundle.identity,
|
|
451
|
+
contactIdentityType: recipientIdentityType,
|
|
452
|
+
localIdentityType: sessionState.localIdentityType,
|
|
453
|
+
});
|
|
454
|
+
this.logger.breadcrumb('Session established', {
|
|
455
|
+
category: 'E2EE',
|
|
456
|
+
level: 'info',
|
|
457
|
+
data: { sessionId },
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
this.logger.error('Session establishment failed', error, {
|
|
462
|
+
category: 'E2EE',
|
|
463
|
+
data: { sessionId },
|
|
464
|
+
});
|
|
465
|
+
throw new EncryptionError(`Failed to start session for ${ProtocolAddress.toString(remoteAddress)}`, EncryptionErrorCode.INVALID_PREKEY_BUNDLE, { originalError: error });
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Perform X3DH key exchange as responder (with optional PQXDH extension)
|
|
471
|
+
*
|
|
472
|
+
* Implements Signal Protocol Section 3.3 RatchetInitBob (with PQXDH extension).
|
|
473
|
+
* Delegates to SessionBuilder for key agreement and session creation.
|
|
474
|
+
*
|
|
475
|
+
* Session Identification:
|
|
476
|
+
* - Sessions are LOOKED UP by ProtocolAddress (userId:deviceId)
|
|
477
|
+
* - Session STATES are IDENTIFIED by baseKey (initiator's ephemeral public key)
|
|
478
|
+
*
|
|
479
|
+
* @param remoteAddress Partner's ProtocolAddress (Alice)
|
|
480
|
+
* @param prekeyMessage Alice's PreKeyMessage containing her keys
|
|
481
|
+
* @returns Session state compatible with Alice's session
|
|
482
|
+
*
|
|
483
|
+
* @see https://signal.org/docs/specifications/x3dh/#the-x3dh-protocol - X3DH protocol (Bob responder)
|
|
484
|
+
* @see https://signal.org/docs/specifications/pqxdh/#the-pqxdh-protocol - PQXDH extension
|
|
485
|
+
* @see https://signal.org/docs/specifications/doubleratchet/#initialization - RatchetInitBob
|
|
486
|
+
*/
|
|
487
|
+
async performX3DHResponder(remoteAddress, prekeyMessage) {
|
|
488
|
+
this.logger.breadcrumb('X3DH as responder (Bob)', {
|
|
489
|
+
category: 'E2EE',
|
|
490
|
+
level: 'info',
|
|
491
|
+
data: {
|
|
492
|
+
remoteAddress: ProtocolAddress.toString(remoteAddress),
|
|
493
|
+
operation: 'x3dh',
|
|
494
|
+
role: 'responder',
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
// Step 1: Select the explicit recipient identity namespace. The wire value
|
|
498
|
+
// is duplicated inside the MAC-authenticated SignalMessage, so key-ID
|
|
499
|
+
// collisions cannot redirect an ACI message into the PNI store or vice versa.
|
|
500
|
+
const usedSignedPreKeyId = prekeyMessage.usedSignedPreKeyId;
|
|
501
|
+
const identityType = prekeyMessage.recipientIdentityType;
|
|
502
|
+
const mySignedPreKey = await this.keyStorage.getEcSignedPreKey(usedSignedPreKeyId, identityType);
|
|
503
|
+
// Step 2: Get Bob's identity key (using resolved identity type)
|
|
504
|
+
const myIdentityKey = await this.keyStorage.getIdentityKey(identityType);
|
|
505
|
+
if (!myIdentityKey) {
|
|
506
|
+
throw new EncryptionError(`Identity key not found for ${identityType}`, EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
507
|
+
}
|
|
508
|
+
// Validate identity DH key pair integrity before X3DH
|
|
509
|
+
// This catches storage corruption that causes MAC verification failures
|
|
510
|
+
CryptoUtils.validateX25519KeyPair(myIdentityKey.dhKey.publicKey, myIdentityKey.dhKey.privateKey, 'identityKey:dhKey');
|
|
511
|
+
// Step 3: Validate the signed prekey in the selected namespace.
|
|
512
|
+
// Per X3DH Spec Section 4.4 - Bob should keep old signed prekeys for ~30 days
|
|
513
|
+
// to handle in-flight messages that used the old key.
|
|
514
|
+
if (!mySignedPreKey) {
|
|
515
|
+
// CRITICAL: If Alice used a signed prekey we no longer have, the DH3 computation
|
|
516
|
+
// will fail because we can't compute DH(SPK_priv, alice_ephemeral_pub).
|
|
517
|
+
//
|
|
518
|
+
// This can happen when:
|
|
519
|
+
// 1. Bob rotated his signed prekey AND the old one expired past the grace period
|
|
520
|
+
// 2. Alice cached a very old prekey bundle
|
|
521
|
+
//
|
|
522
|
+
// The correct behavior is to FAIL and trigger a retry request, which will:
|
|
523
|
+
// 1. Ask Alice to re-encrypt with a fresh prekey bundle
|
|
524
|
+
// 2. Alice fetches Bob's current signed prekey and re-establishes session
|
|
525
|
+
//
|
|
526
|
+
// @see X3DH Spec Section 4.4 - signed prekey grace period handling
|
|
527
|
+
this.logger.warn('Signed prekey not found in selected identity store', {
|
|
528
|
+
category: 'E2EE',
|
|
529
|
+
data: {
|
|
530
|
+
requestedKeyId: usedSignedPreKeyId,
|
|
531
|
+
identityType,
|
|
532
|
+
operation: 'x3dh-responder',
|
|
533
|
+
},
|
|
534
|
+
});
|
|
535
|
+
throw new EncryptionError(`Signed prekey not found in ${identityType} store (keyId=${usedSignedPreKeyId}) - sender may have stale prekey bundle. ` +
|
|
536
|
+
'This typically happens when signed prekey was rotated and old one expired. ' +
|
|
537
|
+
'A retry with fresh bundle is needed.', EncryptionErrorCode.PREKEY_NOT_FOUND, { signedPreKeyId: usedSignedPreKeyId });
|
|
538
|
+
}
|
|
539
|
+
// Validate signed prekey pair integrity before X3DH
|
|
540
|
+
// This catches storage corruption that causes MAC verification failures
|
|
541
|
+
CryptoUtils.validateX25519KeyPair(mySignedPreKey.publicKey, mySignedPreKey.privateKey, `signedPreKey:${usedSignedPreKeyId}`);
|
|
542
|
+
// Step 4: Get Bob's one-time prekey if Alice used one
|
|
543
|
+
let myOneTimePreKey = null;
|
|
544
|
+
if (prekeyMessage.usedOneTimePreKeyId !== undefined) {
|
|
545
|
+
const oneTimePreKeys = await this.keyStorage.getEcOneTimePreKeys(identityType);
|
|
546
|
+
myOneTimePreKey =
|
|
547
|
+
oneTimePreKeys.find((pk) => pk.keyId === prekeyMessage.usedOneTimePreKeyId) || null;
|
|
548
|
+
if (!myOneTimePreKey) {
|
|
549
|
+
// CRITICAL: If Alice used an EC one-time prekey, Bob MUST have it for X3DH.
|
|
550
|
+
// If Bob doesn't have it, the IKM will be different and decryption will fail.
|
|
551
|
+
//
|
|
552
|
+
// This happens when:
|
|
553
|
+
// 1. Bob reinstalled the app (local SQLite wiped, server had stale prekeys)
|
|
554
|
+
// 2. Alice fetched a stale prekey bundle before Bob's re-registration cleared them
|
|
555
|
+
//
|
|
556
|
+
// The correct behavior is to FAIL and trigger a retry request, which will:
|
|
557
|
+
// 1. Ask Alice to re-encrypt with a fresh prekey bundle
|
|
558
|
+
// 2. After the server-side fix, the fresh bundle won't have stale prekeys
|
|
559
|
+
//
|
|
560
|
+
// Note: While X3DH spec Section 3.3 allows optional one-time prekeys, if Alice
|
|
561
|
+
// explicitly included one, Bob must have it - otherwise the IKM will differ.
|
|
562
|
+
//
|
|
563
|
+
// @see X3DH Spec Section 3.2 - one-time prekeys provide forward secrecy for first message
|
|
564
|
+
throw new EncryptionError('EC one-time prekey not found - sender may have stale prekey bundle. ' +
|
|
565
|
+
'This typically happens after app reinstall. A retry with fresh bundle is needed.', EncryptionErrorCode.PREKEY_NOT_FOUND, { ecPreKeyId: prekeyMessage.usedOneTimePreKeyId });
|
|
566
|
+
}
|
|
567
|
+
// Validate one-time prekey pair integrity before X3DH
|
|
568
|
+
// This catches storage corruption that causes MAC verification failures
|
|
569
|
+
CryptoUtils.validateX25519KeyPair(myOneTimePreKey.publicKey, myOneTimePreKey.privateKey, `oneTimePreKey:${prekeyMessage.usedOneTimePreKeyId}`);
|
|
570
|
+
}
|
|
571
|
+
// Step 5: Get Bob's Kyber prekey if Alice used one (for PQXDH)
|
|
572
|
+
let myKyberPreKey = null;
|
|
573
|
+
if (prekeyMessage.usedKyberPreKeyId !== undefined && prekeyMessage.kyberCiphertext) {
|
|
574
|
+
const retrievedKyberPreKey = await this.keyStorage.getKyberPreKey(identityType);
|
|
575
|
+
if (!retrievedKyberPreKey) {
|
|
576
|
+
this.logger.warn('Kyber prekey not found for PQXDH message; aborting session', {
|
|
577
|
+
category: 'E2EE',
|
|
578
|
+
data: { kyberPreKeyId: prekeyMessage.usedKyberPreKeyId },
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
// BUG #7 FIX: Validate that the Kyber prekey ID matches what Alice used
|
|
583
|
+
// If IDs don't match, Alice encapsulated to a DIFFERENT key than we have locally,
|
|
584
|
+
// which means decapsulation would produce wrong shared secret → MAC failure.
|
|
585
|
+
// Instead of silently proceeding to fail, detect this early and trigger retry.
|
|
586
|
+
const keyIdMatches = prekeyMessage.usedKyberPreKeyId === retrievedKyberPreKey.keyId;
|
|
587
|
+
this.logger.info('Bob X3DH: Kyber prekey lookup (Bug #7 diagnostic)', {
|
|
588
|
+
category: 'E2EE',
|
|
589
|
+
data: {
|
|
590
|
+
usedKyberPreKeyIdFromMessage: prekeyMessage.usedKyberPreKeyId,
|
|
591
|
+
foundKyberKeyId: retrievedKyberPreKey.keyId,
|
|
592
|
+
keyIdMatches,
|
|
593
|
+
myKyberPreKeyPub: retrievedKyberPreKey.publicKey.substring(0, 32),
|
|
594
|
+
},
|
|
595
|
+
});
|
|
596
|
+
if (!keyIdMatches) {
|
|
597
|
+
// BUG #7 FIX: Kyber prekey ID mismatch - sender has stale bundle
|
|
598
|
+
// Per PQXDH §4.13: Identifier collisions cause MAC verification failures.
|
|
599
|
+
// Instead of proceeding and failing at MAC verification, throw early so the
|
|
600
|
+
// retry mechanism (Bug #3/#4) can request sender to fetch fresh bundle.
|
|
601
|
+
this.logger.warn('Kyber prekey ID mismatch - sender has stale bundle', {
|
|
602
|
+
category: 'E2EE',
|
|
603
|
+
data: {
|
|
604
|
+
operation: 'x3dh-responder',
|
|
605
|
+
senderUsedKeyId: prekeyMessage.usedKyberPreKeyId,
|
|
606
|
+
localKeyId: retrievedKyberPreKey.keyId,
|
|
607
|
+
reason: 'Alice encapsulated to old Kyber key, Bob cannot decapsulate correctly',
|
|
608
|
+
},
|
|
609
|
+
});
|
|
610
|
+
throw new EncryptionError(`Kyber prekey ID mismatch: sender used keyId=${prekeyMessage.usedKyberPreKeyId}, ` +
|
|
611
|
+
`but local storage has keyId=${retrievedKyberPreKey.keyId}. ` +
|
|
612
|
+
'Sender may have stale prekey bundle. A retry with fresh bundle is needed.', EncryptionErrorCode.PREKEY_NOT_FOUND, {
|
|
613
|
+
kyberPreKeyId: prekeyMessage.usedKyberPreKeyId,
|
|
614
|
+
localKyberKeyId: retrievedKyberPreKey.keyId,
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
myKyberPreKey = retrievedKyberPreKey;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
// Step 5b: Get Bob's KEM one-time prekey if Alice used one (for per-session post-quantum forward secrecy)
|
|
621
|
+
let myKemOneTimePreKey = null;
|
|
622
|
+
// Diagnostic: Log KEM one-time fields from received PreKeyMessage for debugging IKM mismatch
|
|
623
|
+
this.logger.debug('Received PreKeyMessage KEM one-time fields', {
|
|
624
|
+
category: 'E2EE',
|
|
625
|
+
data: {
|
|
626
|
+
operation: 'x3dh-responder-kem-check',
|
|
627
|
+
usedKemOneTimePreKeyId: prekeyMessage.usedKemOneTimePreKeyId,
|
|
628
|
+
typeofKeyId: typeof prekeyMessage.usedKemOneTimePreKeyId,
|
|
629
|
+
hasKemCiphertext: !!prekeyMessage.kemOneTimePreKeyCiphertext,
|
|
630
|
+
kemCiphertextLen: prekeyMessage.kemOneTimePreKeyCiphertext?.length,
|
|
631
|
+
conditionResult: prekeyMessage.usedKemOneTimePreKeyId !== undefined &&
|
|
632
|
+
!!prekeyMessage.kemOneTimePreKeyCiphertext,
|
|
633
|
+
},
|
|
634
|
+
});
|
|
635
|
+
if (prekeyMessage.usedKemOneTimePreKeyId !== undefined &&
|
|
636
|
+
prekeyMessage.kemOneTimePreKeyCiphertext) {
|
|
637
|
+
myKemOneTimePreKey = await this.keyStorage.getKemOneTimePreKey(prekeyMessage.usedKemOneTimePreKeyId, identityType);
|
|
638
|
+
if (!myKemOneTimePreKey) {
|
|
639
|
+
// CRITICAL: If Alice used a KEM one-time prekey, Bob MUST have it for decapsulation.
|
|
640
|
+
// If Bob doesn't have it, the IKM will be different and decryption will fail.
|
|
641
|
+
//
|
|
642
|
+
// This happens when:
|
|
643
|
+
// 1. Bob reinstalled the app (local SQLite wiped, server had stale prekeys)
|
|
644
|
+
// 2. Alice fetched a stale prekey bundle before Bob's re-registration cleared them
|
|
645
|
+
//
|
|
646
|
+
// The correct behavior is to FAIL and trigger a retry request, which will:
|
|
647
|
+
// 1. Ask Alice to re-encrypt with a fresh prekey bundle
|
|
648
|
+
// 2. After the server-side fix, the fresh bundle won't have stale prekeys
|
|
649
|
+
//
|
|
650
|
+
// @see X3DH Spec Section 3.2 - one-time prekeys provide forward secrecy for first message
|
|
651
|
+
throw new EncryptionError('KEM one-time prekey not found - sender may have stale prekey bundle. ' +
|
|
652
|
+
'This typically happens after app reinstall. A retry with fresh bundle is needed.', EncryptionErrorCode.PREKEY_NOT_FOUND, { kemPreKeyId: prekeyMessage.usedKemOneTimePreKeyId });
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
// Step 6: Create local address for session builder
|
|
656
|
+
if (!this.localUserId || this.localDeviceId === null) {
|
|
657
|
+
throw new EncryptionError('Local user ID or device ID not set. Call generatePreKeyBundle first.', EncryptionErrorCode.INITIALIZATION_FAILED);
|
|
658
|
+
}
|
|
659
|
+
const localAddressUserId = identityType === 'pni' ? `pni-${this.localUserId}` : this.localUserId;
|
|
660
|
+
const localAddress = ProtocolAddress.create(localAddressUserId, this.localDeviceId);
|
|
661
|
+
// Step 7: Build session via SessionBuilder (handles all key agreement)
|
|
662
|
+
const builderResult = await SessionBuilder.buildResponderSession({
|
|
663
|
+
localAddress,
|
|
664
|
+
remoteAddress,
|
|
665
|
+
identityKeyPair: myIdentityKey,
|
|
666
|
+
prekeyMessage,
|
|
667
|
+
ecSignedPreKey: mySignedPreKey,
|
|
668
|
+
ecOneTimePreKey: myOneTimePreKey,
|
|
669
|
+
kemLastResortPreKey: myKyberPreKey,
|
|
670
|
+
kemOneTimePreKey: myKemOneTimePreKey,
|
|
671
|
+
protocolStrategy: this.protocolStrategy,
|
|
672
|
+
logger: this.logger,
|
|
673
|
+
});
|
|
674
|
+
const { sessionState, usedPQXDH, initialRootKeyForSPQR, usedClassicalFallback } = builderResult;
|
|
675
|
+
this.logger.debug('performX3DHResponder: Received builder result', {
|
|
676
|
+
category: 'E2EE',
|
|
677
|
+
data: {
|
|
678
|
+
operation: 'x3dh-responder',
|
|
679
|
+
usedPQXDH,
|
|
680
|
+
usedClassicalFallback: !!usedClassicalFallback,
|
|
681
|
+
hasInitialRootKeyForSPQR: !!initialRootKeyForSPQR,
|
|
682
|
+
initialRootKeyLength: initialRootKeyForSPQR?.length,
|
|
683
|
+
},
|
|
684
|
+
});
|
|
685
|
+
// Defer one-time prekey deletion until the first successful decryption so a
|
|
686
|
+
// corrupted inner message does not make recovery impossible.
|
|
687
|
+
if (myOneTimePreKey || myKemOneTimePreKey) {
|
|
688
|
+
sessionState.pendingPreKeyDeletion = {
|
|
689
|
+
oneTimePreKeyId: myOneTimePreKey?.keyId,
|
|
690
|
+
kemOneTimePreKeyId: myKemOneTimePreKey?.keyId,
|
|
691
|
+
identityType,
|
|
692
|
+
};
|
|
693
|
+
this.logger.debug('Deferred prekey deletion until first successful decryption', {
|
|
694
|
+
category: 'E2EE',
|
|
695
|
+
data: { ecKeyId: myOneTimePreKey?.keyId, kemKeyId: myKemOneTimePreKey?.keyId },
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
// Step 8: Initialize Triple Ratchet (SPQR). PQXDH sessions always require SPQR v1.
|
|
699
|
+
if (usedPQXDH && !initialRootKeyForSPQR) {
|
|
700
|
+
throw new EncryptionError('PQXDH session missing Triple Ratchet root material', EncryptionErrorCode.TRIPLE_RATCHET_REQUIRED, {
|
|
701
|
+
operation: 'performX3DHResponder',
|
|
702
|
+
role: 'responder',
|
|
703
|
+
usedPQXDH,
|
|
704
|
+
usedClassicalFallback: !!usedClassicalFallback,
|
|
705
|
+
hasInitialRootKeyForSPQR: !!initialRootKeyForSPQR,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
if (!usedPQXDH && !usedClassicalFallback) {
|
|
709
|
+
throw new EncryptionError('Non-PQXDH session requires explicit classical compatibility fallback', EncryptionErrorCode.TRIPLE_RATCHET_REQUIRED, {
|
|
710
|
+
operation: 'performX3DHResponder',
|
|
711
|
+
role: 'responder',
|
|
712
|
+
usedPQXDH,
|
|
713
|
+
usedClassicalFallback: !!usedClassicalFallback,
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
if (usedPQXDH && initialRootKeyForSPQR) {
|
|
717
|
+
this.logger.breadcrumb('Initializing Triple Ratchet (SPQR) as responder', {
|
|
718
|
+
category: 'E2EE',
|
|
719
|
+
level: 'info',
|
|
720
|
+
data: {
|
|
721
|
+
baseKey: sessionState.baseKey.substring(0, 20),
|
|
722
|
+
operation: 'triple-ratchet-init',
|
|
723
|
+
role: 'responder',
|
|
724
|
+
},
|
|
725
|
+
});
|
|
726
|
+
try {
|
|
727
|
+
// Resolve SCKA mode from protocol strategy
|
|
728
|
+
const sckaMode = resolveSCKAMode(this.protocolStrategy);
|
|
729
|
+
// SPQR Bootstrap (Section 3.10): Generate initial Kyber-768 key pair for Bob
|
|
730
|
+
// IMPORTANT: SPQR uses ML-KEM-768 (not 1024), separate from PQXDH's Kyber-1024
|
|
731
|
+
// Bob needs to send his public key in his first reply so Alice can encapsulate to him
|
|
732
|
+
const { generateKyber768KeyPair, bytesToBase64 } = await import('../crypto/index.js');
|
|
733
|
+
const initialKyberKeyPair = await generateKyber768KeyPair();
|
|
734
|
+
const ourKyberPrivateKey = bytesToBase64(initialKyberKeyPair.privateKey);
|
|
735
|
+
const ourKyberPublicKey = bytesToBase64(initialKyberKeyPair.publicKey);
|
|
736
|
+
this.logger.debug('SPQR bootstrap: Generated initial Kyber-768 key pair (responder)', {
|
|
737
|
+
category: 'E2EE',
|
|
738
|
+
data: {
|
|
739
|
+
operation: 'triple-ratchet-init',
|
|
740
|
+
publicKeyPreview: ourKyberPublicKey.substring(0, 30) + '...',
|
|
741
|
+
},
|
|
742
|
+
});
|
|
743
|
+
// Initialize SPQR state for Bob (B2A direction)
|
|
744
|
+
// Per Signal Protocol Section 5.4 - Initialize epoch 0 chains only (no ratchet step yet)
|
|
745
|
+
// theirKyberPublicKey starts null — spqrRecv will populate it when decrypting
|
|
746
|
+
// Alice's first message (the pqRatchet field contains her Kyber public key)
|
|
747
|
+
const spqrState = await SPQR.initializeSPQR({
|
|
748
|
+
mode: sckaMode,
|
|
749
|
+
initialRootKey: initialRootKeyForSPQR,
|
|
750
|
+
direction: 'B2A',
|
|
751
|
+
ourKyberPrivateKey, // ✅ Store private key for future decapsulation
|
|
752
|
+
theirKyberPublicKey: null, // Populated by spqrRecv during first decrypt
|
|
753
|
+
spqrLimits: this.protocolStrategy?.spqrLimits,
|
|
754
|
+
});
|
|
755
|
+
// SPQR Bootstrap: Signal that first spqrSend() should generate keypair
|
|
756
|
+
// spqrSend() handles lazy KEM — no pending fields needed
|
|
757
|
+
spqrState.needsSendRatchet = true;
|
|
758
|
+
// Add Triple Ratchet to session BEFORE zeroing the key
|
|
759
|
+
// This ensures we only zero after successful initialization
|
|
760
|
+
sessionState.tripleRatchet = {
|
|
761
|
+
spqrState: spqrState,
|
|
762
|
+
enabled: true,
|
|
763
|
+
enabledAt: Date.now(),
|
|
764
|
+
};
|
|
765
|
+
this.logger.breadcrumb('Triple Ratchet initialized (responder)', {
|
|
766
|
+
category: 'E2EE',
|
|
767
|
+
level: 'info',
|
|
768
|
+
data: {
|
|
769
|
+
baseKey: sessionState.baseKey.substring(0, 20),
|
|
770
|
+
spqrEpoch: spqrState.epoch,
|
|
771
|
+
role: 'responder',
|
|
772
|
+
needsSendRatchet: true,
|
|
773
|
+
hasTheirKyberPublicKey: false, // Populated by spqrRecv during first decrypt
|
|
774
|
+
},
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
catch (spqrError) {
|
|
778
|
+
// SPQR initialization failed - this is a critical error
|
|
779
|
+
// Log and propagate the error rather than silently degrading
|
|
780
|
+
this.logger.error('Triple Ratchet (SPQR) initialization failed (responder)', {
|
|
781
|
+
category: 'E2EE',
|
|
782
|
+
data: {
|
|
783
|
+
baseKey: sessionState.baseKey.substring(0, 20),
|
|
784
|
+
error: spqrError instanceof Error ? spqrError.message : String(spqrError),
|
|
785
|
+
},
|
|
786
|
+
});
|
|
787
|
+
throw new EncryptionError('Failed to initialize Triple Ratchet (SPQR) as responder', EncryptionErrorCode.TRIPLE_RATCHET_REQUIRED, { originalError: spqrError });
|
|
788
|
+
}
|
|
789
|
+
finally {
|
|
790
|
+
// Securely zero preserved SK after use (Signal Protocol Section 8.1)
|
|
791
|
+
// Always zero the key whether initialization succeeded or failed
|
|
792
|
+
CryptoUtils.secureZeroBytes(initialRootKeyForSPQR);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
this.logger.breadcrumb('Responder session established (lazy init)', {
|
|
796
|
+
category: 'E2EE',
|
|
797
|
+
level: 'info',
|
|
798
|
+
data: {
|
|
799
|
+
baseKey: sessionState.baseKey.substring(0, 20),
|
|
800
|
+
operation: 'x3dh',
|
|
801
|
+
role: 'responder',
|
|
802
|
+
usedPQXDH,
|
|
803
|
+
lazyInit: true,
|
|
804
|
+
// Chain keys are undefined until first DHRatchet during decrypt
|
|
805
|
+
CKsSet: sessionState.CKs !== undefined,
|
|
806
|
+
CKrSet: sessionState.CKr !== undefined,
|
|
807
|
+
},
|
|
808
|
+
});
|
|
809
|
+
return sessionState;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Clean up expired message keys from receiverChains
|
|
813
|
+
*
|
|
814
|
+
* Signal Protocol Section 8.4 -
|
|
815
|
+
* "To avoid excessive storage, parties SHOULD delete keys for messages
|
|
816
|
+
* that have been received or that have been skipped for too long.
|
|
817
|
+
* A recommended policy is to delete message keys more than one week old."
|
|
818
|
+
*
|
|
819
|
+
* @param session Session state to clean
|
|
820
|
+
* @param config Double Ratchet configuration with maxMessageKeyAge
|
|
821
|
+
*/
|
|
822
|
+
cleanupExpiredMessageKeys(session, config = DEFAULT_RATCHET_CONFIG) {
|
|
823
|
+
// Can't extract ratchet state if session not fully initialized
|
|
824
|
+
if (!session.DHs || !session.DHr) {
|
|
825
|
+
return; // Skip cleanup for uninitialized sessions
|
|
826
|
+
}
|
|
827
|
+
// Extract ratchet state for delegation
|
|
828
|
+
const ratchetState = this.extractRatchetState(session);
|
|
829
|
+
// Delegate to module (handles secure zeroing and deletion)
|
|
830
|
+
moduleCleanupExpiredKeys(ratchetState, {
|
|
831
|
+
maxSkippedMessages: config.maxSkippedMessages,
|
|
832
|
+
maxMessageKeysStored: config.maxMessageKeysStored,
|
|
833
|
+
maxMessageKeyAge: config.maxMessageKeyAge,
|
|
834
|
+
kyberRefreshInterval: config.kyberRefreshInterval,
|
|
835
|
+
}, this.logger);
|
|
836
|
+
// Apply updated receiverChains and processedChains back to session
|
|
837
|
+
session.receiverChains = ratchetState.receiverChains;
|
|
838
|
+
session.processedChains = ratchetState.processedChains;
|
|
839
|
+
}
|
|
840
|
+
// NOTE: shouldRefreshKyber() and refreshKyberKeys() removed - superseded by Triple Ratchet
|
|
841
|
+
// Triple Ratchet (Section 6) provides complete SPQR with automatic Kyber refresh.
|
|
842
|
+
/**
|
|
843
|
+
* Encrypt a message using Full Double Ratchet
|
|
844
|
+
*
|
|
845
|
+
* Delegates to SessionCipher for the actual encryption.
|
|
846
|
+
*
|
|
847
|
+
* @param remoteAddress - Remote party's protocol address (userId:deviceId)
|
|
848
|
+
* @param plaintext - Message to encrypt
|
|
849
|
+
* @see Signal Protocol Specification Section 3.4 - The Double Ratchet - RatchetEncrypt
|
|
850
|
+
*/
|
|
851
|
+
async encrypt(remoteAddress, plaintext) {
|
|
852
|
+
return this.getSessionCipher().encrypt(remoteAddress, plaintext);
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Decrypt a message using Full Double Ratchet
|
|
856
|
+
*
|
|
857
|
+
* Delegates to SessionCipher for the actual decryption.
|
|
858
|
+
*
|
|
859
|
+
* @param remoteAddress - Remote party's protocol address (userId:deviceId)
|
|
860
|
+
* @param ciphertext - Message to decrypt
|
|
861
|
+
* @see Signal Protocol Specification Section 3.5 - The Double Ratchet - RatchetDecrypt
|
|
862
|
+
*/
|
|
863
|
+
async decrypt(remoteAddress, ciphertext) {
|
|
864
|
+
return this.getSessionCipher().decrypt(remoteAddress, ciphertext);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Check if session exists for session
|
|
868
|
+
*
|
|
869
|
+
* @param remoteAddress - Remote party's protocol address (userId:deviceId)
|
|
870
|
+
* @returns true if session exists, false otherwise
|
|
871
|
+
*/
|
|
872
|
+
async hasSession(remoteAddress) {
|
|
873
|
+
const record = await this.keyStorage.getSessionRecord(remoteAddress);
|
|
874
|
+
return record?.currentSession !== null && record?.currentSession !== undefined;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Get the session record for a remote address.
|
|
878
|
+
*
|
|
879
|
+
* Used by SESAME to sync sessions after PreKeyMessage decryption.
|
|
880
|
+
* Per SESAME specification, after the responder decrypts a PreKeyMessage,
|
|
881
|
+
* the session needs to be synced from KeyStorage to DeviceRecord.
|
|
882
|
+
*
|
|
883
|
+
* @param remoteAddress - Remote party's protocol address (userId:deviceId)
|
|
884
|
+
* @returns The session record, or null if no session exists
|
|
885
|
+
*/
|
|
886
|
+
async getSession(remoteAddress) {
|
|
887
|
+
return this.keyStorage.getSessionRecord(remoteAddress);
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Rotate EC signed prekey (LOCAL STORAGE ONLY)
|
|
891
|
+
*
|
|
892
|
+
* Per Signal Protocol architecture, the protocol layer handles local key
|
|
893
|
+
* generation and storage. Server synchronization is handled at the
|
|
894
|
+
* application layer via SignalProtocolClient.rotateEcSignedPreKey().
|
|
895
|
+
*
|
|
896
|
+
* This method (local only):
|
|
897
|
+
* 1. Generates new EC signed prekey
|
|
898
|
+
* 2. Signs with identity key
|
|
899
|
+
* 3. Stores locally (replaces previous)
|
|
900
|
+
*
|
|
901
|
+
* Full lifecycle (handled by SignalProtocolClient):
|
|
902
|
+
* 4. Upload new prekey to server
|
|
903
|
+
* 5. Mark old prekey as deprecated (grace period for in-flight messages)
|
|
904
|
+
* 6. Delete deprecated prekeys after ~1 week
|
|
905
|
+
*
|
|
906
|
+
* @param userId - User ID for logging purposes
|
|
907
|
+
*
|
|
908
|
+
* @see SignalProtocolClient.rotateEcSignedPreKey() for full rotation with server sync
|
|
909
|
+
* @see https://signal.org/docs/specifications/x3dh/#publishing-keys
|
|
910
|
+
*/
|
|
911
|
+
async rotateEcSignedPreKey(userId, identityType = 'aci') {
|
|
912
|
+
try {
|
|
913
|
+
// Get identity key for signing (for the specified identity type)
|
|
914
|
+
const identityKey = await this.keyStorage.getIdentityKey(identityType);
|
|
915
|
+
if (!identityKey) {
|
|
916
|
+
throw new Error(`Identity key not found (${identityType})`);
|
|
917
|
+
}
|
|
918
|
+
// Generate new EC signed prekey
|
|
919
|
+
const newSignedPreKey = await this.generateEcSignedPreKey(identityType);
|
|
920
|
+
// Store new EC signed prekey locally (server upload handled by SignalProtocolClient)
|
|
921
|
+
await this.keyStorage.storeEcSignedPreKey(newSignedPreKey, identityType);
|
|
922
|
+
this.logger.breadcrumb('EC signed prekey rotated (local)', {
|
|
923
|
+
category: 'E2EE',
|
|
924
|
+
level: 'info',
|
|
925
|
+
data: { userId, identityType, operation: 'key_rotation' },
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
catch (error) {
|
|
929
|
+
throw new EncryptionError('Failed to rotate EC signed prekey', EncryptionErrorCode.KEY_STORAGE_ERROR, { originalError: error });
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Rotate Kyber prekey (LOCAL STORAGE ONLY)
|
|
934
|
+
*
|
|
935
|
+
* Per Signal Protocol architecture, the protocol layer handles local key
|
|
936
|
+
* generation and storage. Server synchronization is handled at the
|
|
937
|
+
* application layer via SignalProtocolClient.rotateKyberPreKey().
|
|
938
|
+
*
|
|
939
|
+
* This method (local only):
|
|
940
|
+
* 1. Generates new Kyber-1024 keypair
|
|
941
|
+
* 2. Signs with identity key
|
|
942
|
+
* 3. Stores locally (replaces previous)
|
|
943
|
+
*
|
|
944
|
+
* Full lifecycle (handled by SignalProtocolClient):
|
|
945
|
+
* 4. Upload new Kyber prekey to server
|
|
946
|
+
* 5. Mark old Kyber prekey as deprecated (grace period for in-flight messages)
|
|
947
|
+
* 6. Delete deprecated Kyber prekeys after ~1 week
|
|
948
|
+
*
|
|
949
|
+
* Uses incrementing key IDs to enable mismatch detection during rotation.
|
|
950
|
+
*
|
|
951
|
+
* @param userId - User ID for logging purposes
|
|
952
|
+
*
|
|
953
|
+
* @see SignalProtocolClient.rotateKyberPreKey() for full rotation with server sync
|
|
954
|
+
* @see https://signal.org/docs/specifications/pqxdh/#key-rotation
|
|
955
|
+
*/
|
|
956
|
+
async rotateKyberPreKey(userId, identityType = 'aci') {
|
|
957
|
+
try {
|
|
958
|
+
// Get identity key for signing (for the specified identity type)
|
|
959
|
+
const identityKey = await this.keyStorage.getIdentityKey(identityType);
|
|
960
|
+
if (!identityKey) {
|
|
961
|
+
throw new Error(`Identity key not found (${identityType})`);
|
|
962
|
+
}
|
|
963
|
+
// Get current Kyber prekey's ID and increment for the new one
|
|
964
|
+
// This ensures unique IDs for mismatch detection during key rotation
|
|
965
|
+
const currentKyber = await this.keyStorage.getKyberPreKey(identityType);
|
|
966
|
+
const nextKeyId = (currentKyber?.keyId ?? 0) + 1;
|
|
967
|
+
const newKyberPreKey = await generateKyberLastResortPreKey(identityKey, nextKeyId);
|
|
968
|
+
// Store new Kyber prekey locally (server upload handled by SignalProtocolClient)
|
|
969
|
+
await this.keyStorage.storeKyberPreKey(newKyberPreKey, identityType);
|
|
970
|
+
this.logger.breadcrumb('Kyber prekey rotated (local)', {
|
|
971
|
+
category: 'E2EE',
|
|
972
|
+
level: 'info',
|
|
973
|
+
data: { userId, identityType, operation: 'pqxdh_rotation' },
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
catch (error) {
|
|
977
|
+
throw new EncryptionError('Failed to rotate Kyber prekey', EncryptionErrorCode.KEY_STORAGE_ERROR, { originalError: error });
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Clean up expired message keys for a session
|
|
982
|
+
*
|
|
983
|
+
* Signal Protocol Section 8.4 - Deletion of Old Skipped Message Keys
|
|
984
|
+
* "To avoid excessive storage, parties SHOULD delete keys for messages that
|
|
985
|
+
* have been received or that have been skipped for too long. A recommended
|
|
986
|
+
* policy is to delete message keys more than one week old."
|
|
987
|
+
*
|
|
988
|
+
* This method explicitly triggers cleanup of expired message keys.
|
|
989
|
+
* Note: Cleanup also happens automatically during encrypt/decrypt operations.
|
|
990
|
+
*
|
|
991
|
+
* @param remoteAddress - Remote party's protocol address (userId:deviceId)
|
|
992
|
+
*/
|
|
993
|
+
async cleanupExpiredKeys(remoteAddress) {
|
|
994
|
+
const sessionId = ProtocolAddress.toString(remoteAddress);
|
|
995
|
+
try {
|
|
996
|
+
const record = await this.keyStorage.getSessionRecord(remoteAddress);
|
|
997
|
+
// Work on a candidate copy so an in-memory adapter cannot observe partial
|
|
998
|
+
// cleanup if validation or durable persistence fails.
|
|
999
|
+
const candidateRecord = record ? CryptoUtils.cloneProtocolState(record) : null;
|
|
1000
|
+
const session = candidateRecord?.currentSession;
|
|
1001
|
+
if (!session) {
|
|
1002
|
+
// Session doesn't exist - nothing to clean up
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
// Run cleanup
|
|
1006
|
+
this.cleanupExpiredMessageKeys(session);
|
|
1007
|
+
// Save the cleaned session, preserving existing record fields
|
|
1008
|
+
await this.keyStorage.storeSessionRecord(remoteAddress, {
|
|
1009
|
+
...candidateRecord,
|
|
1010
|
+
currentSession: session,
|
|
1011
|
+
});
|
|
1012
|
+
this.logger.breadcrumb('Expired message keys cleaned up', {
|
|
1013
|
+
category: 'E2EE',
|
|
1014
|
+
data: {
|
|
1015
|
+
sessionId,
|
|
1016
|
+
operation: 'cleanup_expired_keys',
|
|
1017
|
+
},
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
catch (error) {
|
|
1021
|
+
throw new EncryptionError('Failed to cleanup expired keys', EncryptionErrorCode.KEY_STORAGE_ERROR, { originalError: error });
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Get identity public key
|
|
1026
|
+
*/
|
|
1027
|
+
async getIdentityPublicKey() {
|
|
1028
|
+
const identityKey = await this.keyStorage.getIdentityKey();
|
|
1029
|
+
if (!identityKey) {
|
|
1030
|
+
throw new EncryptionError('Identity key not found', EncryptionErrorCode.KEY_STORAGE_ERROR);
|
|
1031
|
+
}
|
|
1032
|
+
return identityKey.signingKey.publicKey;
|
|
1033
|
+
}
|
|
1034
|
+
// ========================================================================
|
|
1035
|
+
// KEY GENERATION
|
|
1036
|
+
// ========================================================================
|
|
1037
|
+
/**
|
|
1038
|
+
* Generate identity key pair with both DH and signing keys
|
|
1039
|
+
*
|
|
1040
|
+
* Signal Protocol needs:
|
|
1041
|
+
* - DH key (ECDH) for X3DH key exchange (DH1 operation)
|
|
1042
|
+
* - Signing key (Ed25519) for signing prekeys
|
|
1043
|
+
*
|
|
1044
|
+
* @see https://signal.org/docs/specifications/x3dh/#keys - Identity key format (IKA, IKB)
|
|
1045
|
+
* @see https://signal.org/docs/specifications/x3dh/#publishing-keys - Identity key usage
|
|
1046
|
+
*/
|
|
1047
|
+
async generateIdentityKey() {
|
|
1048
|
+
// Delegate to keys module
|
|
1049
|
+
return generateIdentityKeyPair();
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Generate EC signed prekey using ECDH, then sign it with identity signing key
|
|
1053
|
+
*
|
|
1054
|
+
* @see https://signal.org/docs/specifications/x3dh/#keys - Signed prekey format (SPK)
|
|
1055
|
+
* @see https://signal.org/docs/specifications/x3dh/#publishing-keys - Signed prekey generation and rotation
|
|
1056
|
+
*/
|
|
1057
|
+
async generateEcSignedPreKey(identityType = 'aci') {
|
|
1058
|
+
// Get identity key for signing (for the specified identity type)
|
|
1059
|
+
const identityKey = await this.keyStorage.getIdentityKey(identityType);
|
|
1060
|
+
if (!identityKey) {
|
|
1061
|
+
throw new Error(`Identity key not found for signing prekey (${identityType})`);
|
|
1062
|
+
}
|
|
1063
|
+
// Delegate to keys module
|
|
1064
|
+
return generateEcSignedPreKey(identityKey);
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Generate EC one-time prekeys using ECDH
|
|
1068
|
+
*
|
|
1069
|
+
* @see https://signal.org/docs/specifications/x3dh/#keys - One-time prekey format (OPK)
|
|
1070
|
+
* @see https://signal.org/docs/specifications/x3dh/#publishing-keys - One-time prekey bundle
|
|
1071
|
+
*/
|
|
1072
|
+
async generateEcOneTimePreKeys(count) {
|
|
1073
|
+
// Delegate to keys module (startId = 0 matches original behavior)
|
|
1074
|
+
return generateEcOneTimePreKeys(count, 0);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
// Singleton pattern removed - use direct instantiation (new SignalProtocolManager())
|
|
1078
|
+
// or use SignalProtocolClient as the public API wrapper
|
|
1079
|
+
//# sourceMappingURL=manager.js.map
|