Skip to main content

Crate kute_protocol

Crate kute_protocol 

Source
Expand description

Vocabulary exchange between two KUTE peers (development directive v0.2, R9). Before one side sends encoded data, both must hold the same vocabulary, identified by its content digest. The protocol lets them find out, transfer the vocabulary if needed, extend it together, and check that what was sent is what was decoded.

Peer is the state machine: it takes a message and returns replies, and does no I/O. Session drives the initiating side over a Transport. Framed is a transport over any byte stream.

There is no encryption and no authentication here. A peer treats everything it receives as untrusted: vocabularies are validated and their digests recomputed, sizes are bounded before allocation, and decoding is bounded before output is produced.

Modules§

tls
Authenticated, encrypted transport for the exchange protocol: TLS 1.3 with a certificate on both sides (mutual TLS), through rustls.

Structs§

Delivered
A message this peer received and decoded.
Framed
Messages over a byte stream: a four-byte little-endian length, then that many bytes of JSON.
Peer
One side of the protocol.
Policy
What a peer is willing to do for the other side.
Remote
The other side’s answer to CAPABILITIES.
Session
A peer together with its connection.
VocabRef
What identifies a vocabulary to the other side.

Enums§

ErrorCode
Message

Constants§

DEFAULT_MAX_FRAME
Default and largest frame a peer will read.
EVOLUTION_RULE
The rule by which this build derives an evolved vocabulary. Two peers that name different rules would derive different children from the same proposal, so a proposal is only taken under this exact name.
MAX_PROPOSAL_SIGNATURES
Most signatures one proposal may carry: as many as a vocabulary file.
PROTOCOL_VERSION
Version 2 added the evolution rule to CAPABILITIES and to SYMBOL_PROPOSE, the UNSUPPORTED_RULE and BUSY errors, and the delivery contract for repeated message ids. A version 1 peer is refused at HELLO.

Traits§

Transport
Something that carries messages to the other peer and back.

Functions§

sha256_hex

Type Aliases§

VocabularyCheck
A test a vocabulary must pass before it is taken from the other side. It is given the vocabulary after its digest has been recomputed and matched; an Err is the reason it is refused. The protocol does no cryptography of its own: a caller that wants signatures checks them here.