# Vectors

> The shared test cases that fix the rules byte for byte across languages.

Source: https://lcp.integraledger.com/concepts/vectors

Updated 2026-11-18. Documents @integraledger/lcp 0.6.3 and @integraledger/profile-facilitator 0.5.1. Every page of this site is listed in https://lcp.integraledger.com/llms.txt.

**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](https://lcp.integraledger.com/profiles/read-status.md)), 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](https://lcp.integraledger.com/reference/vectors.md) 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:

```ts
import { readFile } from "node:fs/promises";
import { assemble, isRefusal, type Json } from "@integraledger/lcp";

const url = new URL("../vectors/core-vectors.json", import.meta.resolve("@integraledger/lcp"));
const core = JSON.parse(await readFile(url, "utf8")) as {
  vectors: { name: string; id?: string; binding?: [string, Json]; content?: [string, string][]; expectHash: string }[];
};

for (const v of core.vectors) {
  if (v.id === undefined || v.binding === undefined || v.content === undefined) continue;
  const content = v.content.map(([slot, hex]) => [slot, Uint8Array.from(Buffer.from(hex, "hex"))] as const);
  const atr = await assemble(v.id, v.binding, content);
  console.log(v.name, !isRefusal(atr) && atr.atrHash === v.expectHash);
}
```

```text
V1 true
V2 true
V3 true
```

The 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](https://agenticterms.integraledger.com/reference/vectors) 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.
