avp

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

AVP conformance runner

A tiny test runner that checks the repository’s vectors against the byte/string and cryptographic constructions defined in the spec. It covers both the encoding-only constructions and the full cryptographic envelope.

Deterministic constructions (no key material)

Cryptographic vectors (Node crypto)

These use Node’s built-in crypto (hkdfSync, diffieHellman over X25519 KeyObjects imported from raw keys, aes-256-gcm via createCipheriv/ createDecipheriv with setAAD and the appended auth tag, and Ed25519 sign/verify). The primitive helpers live in src/crypto.ts.

The RFC-anchored cases reproduce published outputs byte-for-byte; the composition cases additionally round-trip. The same vectors were independently cross-checked against the Java reference implementation (lol.trq.alts); see vectors/README.md for the three-way verification.

Layout

src/constructions.ts   the AAD and key-binding-message constructions
src/crypto.ts          HKDF / X25519 / Ed25519 / AES-GCM / wrap helpers (node:crypto)
src/vectors.ts         loads vectors/*.json relative to the repo root
test/vectors.test.ts   node:test suite for the deterministic constructions
test/crypto.test.ts    node:test suite for the cryptographic vectors

Build and run

Requires Node 20+ (uses the built-in node:test runner and node --import tsx).

bun install
bun run typecheck    # tsc --noEmit
bun run test             # node --import tsx --test test/*.test.ts

Caveats

This is illustrative reference tooling, not production code. It checks the vectors shipped in this repository; passing it is necessary but not sufficient for full protocol conformance (see SPEC section 11). It performs no network I/O. The cryptographic checks use Node’s crypto to reproduce and round-trip the committed vectors; they do not constitute a security review of an implementation.