RequestStateCodec

The codec the dispatch path installs when an operator enables secureRequestState. encode wraps a handler's plaintext state for the wire; decode verifies an echoed blob and returns the inner state, or null when verification fails (the caller then treats it as no state and re-elicits). All crypto is fail-closed.

Members

Functions

decode
Nullable!string decode(string wire, string subject, string toolName)

Verify an echoed wire blob against the current subject/toolName and return the inner plaintext state, or Nullable!string.init on any failure (bad MAC, GCM auth failure, expired, wrong-subject bind, or unparseable). Fail-closed: the caller re-elicits on null.

encode
string encode(string stateJson, string subject, string toolName)

Wrap stateJson (the handler's plaintext requestState) into a wire blob bound to subject/toolName (per the configured binding) and stamped with an expiry ttl from now. The result is what the client sees and echoes back; decode is its inverse.