avp

Alt Vault Protocol, an open zero-knowledge spec for sharing alts across clients.

Conformance vectors

Test vectors an implementation can check itself against. Each file is JSON with a description and one or more cases. The conformance runner in ../examples/conformance loads and checks every file here with Node’s crypto.

index.json is a machine-readable index of these files: each entry gives the file, its kind (deterministic / rfc-primitive / composition), the spec section, and the published RFC anchors, so a harness can enumerate the vectors instead of hardcoding filenames.

Deterministic construction vectors

These depend only on byte/string construction rules, not on key material, so they are fully specified in this repository:

Cryptographic primitive vectors (RFC-anchored)

Each primitive AVP relies on is pinned to a published RFC test vector, so a conformant implementation reproduces a known-good output and cannot drift on the primitive itself:

Composition vectors (generated, three-way cross-verified)

These exercise the full AVP envelope composition (SPEC §4). They embed fixed keys/IVs so they are reproducible, and their correctness is established by three independent sources agreeing byte-for-byte (see “Three-way verification” below):

Three-way verification

The composition vectors are public and must not contain mistakes, so each was confirmed by three independent sources agreeing byte-for-byte before being committed:

  1. Published RFC test vectors, every primitive carries at least one published anchor: HKDF-SHA256 from RFC 5869 (Test Cases 1 and 3), X25519 from RFC 7748 (§5.2 vectors and the §6.1 DH example), and Ed25519 from RFC 8032 (§7.1 TEST 2 and TEST 3). The composition vectors are anchored to RFC 7748 §6.1 via the wrap keypairs. The Node runner reproduces every published output exactly.
  2. The reference implementation (Java), the lol.trq.alts crypto primitives independently agree with every vector: its HKDF and X25519 reproduce the primitive outputs, it verifies (and reproduces) the Ed25519 signatures, its PayloadCipher decrypts the payload-aead vector under the AVP AAD and recovers the plaintext (and rejects a tampered epoch), and its X25519HkdfAesGcmKeyWrap unwraps the key-wrap vector and recovers the data key. This was verified with a throwaway harness against the library’s compiled primitives.
  3. The Node conformance runner, reproduces every primitive output and round-trips every composition vector (decrypt/unwrap and assert recovery) with Node’s crypto; see the runner’s README.md. bun run test must pass.

An implementation proves conformance by reproducing the deterministic and RFC-anchored vectors exactly, and by round-tripping the composition vectors (decrypting/unwrapping what a peer encrypted/wrapped, verifying what a peer signed).

Negative vectors

Regenerating the vectors

generate.ts is the reproducible derivation of these files. It reuses the vector-tested reference crypto so it cannot drift from the runner.