Documentation
¶
Overview ¶
Package callbinding holds the pieces the vMCP uses to bind an access token to the one MCP call its authorization_details entry names.
The argument hash is the shared contract between the client that asks for a call-bound token and the vMCP that checks it: both compute it over params.arguments, so any input on which the two differ makes that call fail. Both sides therefore refuse arguments rather than risk disagreeing on them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotIJSON = errors.New("callbinding: arguments are not I-JSON")
ErrNotIJSON is returned when params.arguments is not exactly one JSON object that is I-JSON (RFC 7493), so it has no argument hash.
Functions ¶
func ArgumentsSHA256 ¶
func ArgumentsSHA256(args json.RawMessage) (string, error)
ArgumentsSHA256 returns the argument hash of params.arguments: the lowercase hex SHA-256 of its RFC 8785 (JCS) serialization. args is the raw value as received, before any routing or rewriting. An absent value (empty, or only JSON whitespace) and JSON null both hash as {}.
It returns an error for which errors.Is(err, ErrNotIJSON) holds for anything that is not exactly one JSON object, or that is not I-JSON: invalid UTF-8, lone or reversed surrogate escapes, duplicate member names (including ones equal only after decoding escapes), non-finite numbers, and numbers with magnitude above 2^53. The error never quotes the arguments.
Arguments that differ only in what RFC 8785 normalizes hash the same: member order, whitespace, string escapes, and number spelling, including -0 against 0 and digits beyond what an IEEE 754 double holds. A caller that forwards the arguments therefore authorizes every such spelling of them.
Types ¶
This section is empty.