Expand description
Shared protocol definitions for WSCALL.
This crate contains the transport envelope, frame codec, encryption modes, and inline attachment model used by both the server and client crates.
Structs§
- Ecdh
Keypair - A freshly generated X25519 keypair for the ECDH handshake.
- Error
Payload - Standard error payload embedded in API responses and event acknowledgements.
- File
Attachment - Binary attachment carried alongside JSON params or event data.
- Frame
Codec - Encodes and decodes WSCALL binary frames (protocol v3).
- Packet
Envelope - Full transport envelope before frame encoding.
Enums§
- Encryption
Kind - Selects how the payload section of a frame is encoded.
- Message
Type - Distinguishes API messages from event messages inside a WSCALL frame.
- Packet
Body - JSON-level message body transported inside a WSCALL frame.
- Protocol
Error - Errors returned while encoding or decoding WSCALL frames.
Constants§
- DEFAULT_
MAX_ FRAME_ BYTES - Default maximum frame size: 100 MiB.
- ECDH_
DOMAIN_ TAG - Domain-separation tag mixed into the SHA-256 KDF so that wscall session keys cannot collide with keys derived for any other protocol.
- ECDH_
KEY_ LEN - Byte length of an X25519 public key (also the secret key length).
- K_
API_ REQUEST - Compact numeric tag identifying each
PacketBodyvariant in the JSON wire format. Using a single-byte numeric field ("k": 0) instead of a string tag ("kind": "api_request") saves several bytes per frame. - K_
API_ RESPONSE - K_
EVENT_ ACK - K_
EVENT_ EMIT
Functions§
- decode_
frame - Helper for decoding a plaintext frame without constructing a custom codec.
- derive_
session_ key - Derives a 32-byte symmetric key from a raw X25519 shared secret.
- encode_
frame - Helper for encoding a plaintext frame without constructing a custom codec.
- parse_
peer_ public - Parses 32 raw bytes received from the peer into an X25519 public key.