CX · Reference guidecx-platform-xsp
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-platform-xsp

the XAP Stream Protocol: the XSP-AUTH handshake, the protocol pages

Why reach for it

One frame, any transport, and a handshake whose every verb is pure. cx-platform-xsp is the XAP Stream Protocol: a self-describing, self-delimiting frame — version, type, stream, principal, flags, length, payload — that carries the platform's traffic over whatever socket is underneath, and XSP-AUTH, the mutual proof-of-control handshake the store, identity and the fabric open their connections with.

The codec is two pure verbs. encode turns a [frame] element into bytes and decode reads one back, reporting how many bytes it consumed so a reader can step to the next frame; decode-all walks a buffer and hands back the trailing partial frame as a value rather than losing it. A binary payload carries a CX element losslessly — attributes, children, text, an empty element — because a transport whose users have to know which values survive the trip is not a transport. Every way a frame can be wrong has its own refusal: a reserved flag, a foreign version, a truncated header, a length past the declared ceiling.

XSP-AUTH is four messages on stream 0, signed ephemeral X25519 in the SIGMA shape, with a per-request possession proof and a rotation continuity proof beside it. Its verbs take their randomness as an argument and answer values, so the whole handshake is graded in the corpus without a socket, and credit frames carry the flow control a stream negotiates. The protocol pages themselves live in this repository's spec directory below.

What it gives you

Two modules: the frame codec, a Ring 1 module under the cx-stdlib namespace because it is pure and reaches nothing, and the handshake calculus in the platform group. Each links to the reference page projected from its own documentation.

module import it as where it lives reference
xsp-auth [?lib 'cx-platform/xsp-auth'] Ring 1 · the platform group xsp-auth reference

Try it

Every frame type the protocol defines, encoded and decoded in turn, the type read back from the frame — eight round trips, no grant, no socket.

prog.cx

        [?lib 'cx-stdlib/xsp' as=xsp]
[?for [in $t ("request", "event", "reply", "cancel", "ping", "pong", "error", "credit")]
  [yield [?let [= $d [$xsp:decode [$xsp:encode [frame type=$t [payload 1]]]]]
    [$text $d/@type]]]]
      
        $ cx prog.cx
request
event
reply
cancel
ping
pong
error
credit
      

Fixture xsp-002-roundtrip-all-eight-types in deps/cx-core-code/conformance/stdlib/xsp.cxd — replayed against this cx when the page was built.

Status

The stream protocol builds on the language alone and is built on by the store, identity, the fabric and the application host, which reach the handshake calculus through the pin; the front door compiles its V module from the same pin.

fact as the registry records it
ships as binary
status extracted
pinned at 1b57cf307
builds on cx-core-code
built on by cx-platform-identity, cx-platform-store, cx-platform-fabric, cx-platform-xap
bundled modules 1
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY cx-core-code cx-platform-xsp xsp-auth cx-platform-identity cx-platform-store cx-platform-fabric cx-platform-xap DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-platform-xsp plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built