Skip to main content

Crate wscall_protocol

Crate wscall_protocol 

Source
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§

EcdhKeypair
A freshly generated X25519 keypair for the ECDH handshake.
ErrorPayload
Standard error payload embedded in API responses and event acknowledgements.
FileAttachment
Binary attachment carried alongside JSON params or event data.
FrameCodec
Encodes and decodes WSCALL binary frames (protocol v2).
PacketEnvelope
Full transport envelope before frame encoding.

Enums§

EncryptionKind
Selects how the payload section of a frame is encoded.
MessageType
Distinguishes API messages from event messages inside a WSCALL frame.
PacketBody
JSON-level message body transported inside a WSCALL frame.
ProtocolError
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 PacketBody variant 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.