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 and cryptographic constructions defined in the spec, plus schema/example/index/openapi consistency.

AVP 0.5 constructions

The manifest and commit tests also re-derive each case by a second, hand written assembly of the SPEC layout (raw Buffer concatenation, no CeWriter), since these constructions have no external anchor.

Cryptographic vectors (Node crypto)

These use Node’s built-in crypto (hkdfSync, pbkdf2Sync, 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.

Layout

src/constructions.ts   CE writer, manifest state, commit header, AAD v2, tokens, signed messages
src/bip39.ts           BIP39 mnemonic, seed, and owner keys
src/merge.ts           payload v2 merge, deletion, refresh-token strip, HLC
src/rules.ts           host acceptance rules engine (RepoView)
src/crypto.ts          HKDF / PBKDF2 / SHA / X25519 / Ed25519 / AES-GCM / wrap helpers (node:crypto)
src/vectors.ts         loads vectors/*.json relative to the repo root; wire JSON converters
test/vectors.test.ts   the CE writer items
test/bip39.test.ts     owner identity
test/manifest.test.ts  manifest state, signature, hash, repoId
test/commit.test.ts    commit header, id, signature, AAD v2, payload AEAD
test/crypto.test.ts    the RFC-anchored primitives and the key wrap
test/merge.test.ts     payload merge and HLC
test/acceptance.test.ts host acceptance scenarios
test/federation.test.ts tokens, signatures, fingerprints, linking, avp:// locators
test/negative.test.ts  the MUST-reject bank

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 14). 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.