Vectors
The shared test cases that fix the rules byte for byte across languages.
For AI agents: this page as Markdown, and llms.txt, the index of every page.
Vectors are the shared test cases that fix the rules byte for byte across languages. The package ships them in
vectors/, one JSON file per entry point or pairing. Any implementation of the Legal Context Protocol, in any
language, that passes them assembles the same bytes, computes the same hashes, and places and reads H in the same
fields as this package.
Every expected byte, hash and signature in a vector file comes from outside this package: a specification's published
example, a standard's test value such as SHA-256 of "abc" from FIPS 180-2, a transaction read from a live network, or
an independent tool (Python's json and hashlib, sha256sum, openssl, viem, eth-account, a rail's own SDK).
Refusal codes are this package's own, not a specification's; a file's agreedRefusals rows hold the codes for checks
its specification leaves to the implementation. Each file's about names its sources.
What they fix
| Area | Files | What the rows fix |
|---|---|---|
| The core | core-vectors.json | The ATR's exact bytes and hash for given inputs, the https-link rule, the JSON nesting cap, and the assemble refusals its rows name. |
| The buyer gate | buyer.json | What a buyer does with an advertised challenge: when it signs, and each decline. |
| Each pairing | x402-*.json, mpp-*.json, acp-checkout.json, ucp.json, ucp-checkout-agent-signed.json, ap2-checkout-mandate.json, ap2-checkout-mandate-x402.json, ack-payment-request.json, card.json, spend-permissions-eip155.json | The placed challenge, what the payer signs with H in it, H read back from the payment, and the settlement read. |
| Who broadcasts | broadcaster.json | Each pairing's broadcaster answer: one for every payment it takes, or by the kind of payment, with a credential of each kind; and payments of a type, kind or shape the pairing does not take, each refused with bound's code. |
| Shared readers | sd-jwt.json, decoder-caps.json, discovery.json, a2a-legal-context.json | The SD-JWT reader, the decoders' limits, the discovery document and the A2A extension. |
| Shared reads and encodings | read-status.json, charge-reference.json, legal-context-return.json, base64-platform.json, stellar-position.json, svm-read.json | The cases common to every pairing's read (the read-status profile), the seller's charge reference, the return after an agreement, base64 on every platform, the Stellar position, and the Solana read. |
The vector files reference lists every file with its about.
Running them
The files ship inside the package, beside dist/. This example runs the core rows of core-vectors.json through
assemble and checks each expected hash:
import { } from "node:fs/promises";
import { , , type } from "@integraledger/lcp";
const = new ("../vectors/core-vectors.json", import..("@integraledger/lcp"));
const = .(await (, "utf8")) as {
: { : string; ?: string; ?: [string, ]; ?: [string, string][]; : string }[];
};
for (const of .) {
if (. === || . === || . === ) continue;
const = ..(([, ]) => [, .(.(, "hex"))] as );
const = await (., ., );
.(., !() && . === .);
}V1 true
V2 true
V3 trueThe package's own test suite runs every file. A buyer row, in buyer.json or in another file, describes a buyer gate,
which this package does not contain: the suite runs the parts of those rows the package implements (hashing, read,
bound and the builds the rows name). The
buyer packages run those rows whole, every row of
buyer.json and the buyer rows of every other file, from TypeScript and from Python, at the version of this
package they pin.
Plants
A row marked plant is a deliberate wrong input with a known outcome: bytes one changed byte away from the ATR, a
receipt whose matching log comes from another contract, an agreement resource advertising another ATR's hash. A check
that accepts a plant is broken, whatever else it passes.
Last updated on