Test vectors
crates/im-protocol/vectors/v1.json is the protocol's conformance fixture. It is built independently by generate.py (Python struct, hashlib, rfc8785 and cryptography, transcribing the contract's tables) and checked by the TypeScript and Rust test suites. An implementation is conformant when it reproduces every value.
Reproduce
From the repository root:
# TypeScript: @im/protocol against the fixture
bun test packages/protocol/test/vectors.test.ts
# Rust: im-protocol against the fixture
cargo test -p im-protocol --test vectors
# Python: rebuild the fixture independently and compare byte for byte
python -m pip install cryptography==50.0.1 rfc8785==0.1.4
python crates/im-protocol/vectors/generate.py --check
# This reference: fail if any generated table differs from the code
bun test docs/site/protocol/_gen
generate.py --check prints the fixture's SHA-256 on success. To regenerate after a deliberate change, run python crates/im-protocol/vectors/generate.py > crates/im-protocol/vectors/v1.json, then the three suites above.
Contents
| Fixture | Size |
|---|---|
keys |
2 members |
context |
5 members |
documents |
3 members |
digests |
4 members |
hold |
3 members |
voucher |
3 members |
receipts |
5 entries |
charge_cases |
12 entries |
json_cases |
12 entries |
commitments |
6 entries |
negatives |
13 entries |
commitment_order |
5 entries |
invalid_json_numbers |
11 entries |
json_rejections |
73 entries |
json_limits |
2 members |
request_json |
3 members |
boundaries |
5 entries |
binding_negatives |
4 entries |
strict_signatures |
104 entries |
layout |
3 members |
marketplace_route |
3 members |
a3_ordering |
3 members |
<sub>Generated from crates/im-protocol/vectors/v1.json.</sub>
layoutholds each message's field names, offsets and widths, which both libraries and this reference check against their own tables.negatives,binding_negatives,boundariesandstrict_signaturesare inputs that must be rejected, or accepted at the edges of each integer range.json_cases,json_rejections,invalid_json_numbers,json_limitsandrequest_jsonpin canonical JSON and its signatures.charge_casesare on Price schedule;commitments,commitment_orderanda3_orderingon Receipts commitment chain.
Keys
PUBLIC TEST-ONLY PRIVATE SEEDS — never fund or use outside fixtures.
| Key | Ed25519 seed (hex) | Public key (hex) |
|---|---|---|
| session | 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f |
03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8 |
| seller | 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f |
29acbae141bccaf0b22e1a94d34d0bc7361e526d0bfe12c89794bc9322966dd7 |
<sub>Generated from crates/im-protocol/vectors/v1.json.</sub>
Inputs and digests
| Input | Value |
|---|---|
| domain | 0000000000000000000000000000000000000000000000000000000000000000a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf |
| channel | e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff |
| channel_epoch | 81985529216486895 |
| request salt | 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f |
| request body | {"messages":[{"content":"hello","role":"user"}],"model":"fixture"} |
| Digest | SHA-256 (hex) |
|---|---|
schedule_digest = SHA256(jcs(schedule)) |
aad28e30b14004cd01f3c9bc3ffa3b439e3cca202f19aa0c0ca8d7c10921063e |
model_identity_id = SHA256(jcs(model_identity)) |
f51249528a6caaf271bc96486c92645d39e7becc8da71f649303b6add1408e5d |
route_id = SHA256(jcs({seller_id, endpoint, model_identity_id, nonce})) |
58c879a70c6a894ec14775d75346c42f94d2776d38c6f05a7b661a970d634db4 |
request_commitment = SHA256(salt ‖ body) |
a9c54e4b9ff76e8b1fc9010e63861ba89f3b468fb72681f0a4e612effb0cdf38 |
<sub>Generated from crates/im-protocol/vectors/v1.json.</sub>
Signed messages
Bytes are hex, 32 bytes per line. Signatures are Ed25519 over exactly these bytes.
Hold (275 bytes, signed by the session key)
494d2f484f4c442f310000000000000000000000000000000000000000000000
00000000000000000000000000000000a0a1a2a3a4a5a6a7a8a9aaabacadaeaf
b0b1b2b3b4b5b6b7b8b9babbbcbdbebfe0e1e2e3e4e5e6e7e8e9eaebecedeeef
f0f1f2f3f4f5f6f7f8f9fafbfcfdfeffefcdab8967452301cdab1032547698ba
dcfedd3a6b7dfa302bdf855e605624324b5318ac6c0ee66022c62cfd7a19115d
7d1fa9c54e4b9ff76e8b1fc9010e63861ba89f3b468fb72681f0a4e612effb0c
df3858c879a70c6a894ec14775d75346c42f94d2776d38c6f05a7b661a970d63
4db4aad28e30b14004cd01f3c9bc3ffa3b439e3cca202f19aa0c0ca8d7c10921
063e12000000000000000af153650000000000
Signature: 7a71e189a7ae6cd71c225e55423413060c13102e9762138d2d4f076c3c401216c061b3b37fbd7d5717ec74a48fc75b9570ffe330879382247e110a2c8476fa04
Voucher (168 bytes, signed by the session key)
494d2f564f55434845522f310000000000000000000000000000000000000000
00000000000000000000000000000000a0a1a2a3a4a5a6a7a8a9aaabacadaeaf
b0b1b2b3b4b5b6b7b8b9babbbcbdbebfe0e1e2e3e4e5e6e7e8e9eaebecedeeef
f0f1f2f3f4f5f6f7f8f9fafbfcfdfeffefcdab8967452301feffffffffffffff
220000000000000042557ce286a204b5e46cca73cc13e9ddf2065a1a40ffead5
665d083a236133e5
Signature: 0cde581b4d4f5aa68aab4c8ea341e3434e0b06ca49e9ae6e5c84f1770cc1008696e3cd65ccffb7042d0109b0a2a7d46e77b8982ad23ead60c38f9756bc56f30b
First receipt (382 bytes, signed by the seller key)
494d2f524543454950542f310000000000000000000000000000000000000000
00000000000000000000000000000000a0a1a2a3a4a5a6a7a8a9aaabacadaeaf
b0b1b2b3b4b5b6b7b8b9babbbcbdbebf29acbae141bccaf0b22e1a94d34d0bc7
361e526d0bfe12c89794bc9322966dd7efcdab8958c879a70c6a894ec14775d7
5346c42f94d2776d38c6f05a7b661a970d634db4f51249528a6caaf271bc9648
6c92645d39e7becc8da71f649303b6add1408e5ddd3a6b7dfa302bdf855e6056
24324b5318ac6c0ee66022c62cfd7a19115d7d1fa9c54e4b9ff76e8b1fc9010e
63861ba89f3b468fb72681f0a4e612effb0cdf38e0e1e2e3e4e5e6e7e8e9eaeb
ecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeffefcdab8967452301000b0000
000000000005000000000000000c000000000000000300000000000000001200
0000000000001200000000000000aad28e30b14004cd01f3c9bc3ffa3b439e3c
ca202f19aa0c0ca8d7c10921063e674523f112debcfa05f1536500000000
Signature: 5f5462b52e1fecab863e3c6303fd064798ebf85a7f6c0503ddd28f07592bfc6a65b701ed1b93b469c158196562ac10f7fb2486b69b5d544bfced6aa71ec4930e
<sub>Generated from crates/im-protocol/vectors/v1.json.</sub>
Other fixtures in the same directory: settlement-release-v1.json (a signed settlement release recommendation), reviewer-ed25519.json and speccheck.json (Ed25519 edge cases).