avp

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

AVP reference client, Go

A tiny, runnable reference client for the HTTP/JSON profile. It drives the full lifecycle against a running server so you can watch every operation happen end to end. It is a sibling of the Rust reference client and is wire-compatible with every reference server in this repository.

go run .              # drives the flow against http://localhost:8787
go build              # build the ./client binary

Point it at a different server with the AVP_SERVER_URL environment variable:

AVP_SERVER_URL=http://vault.example:8787 go run .

You need a server running first. The sibling ../server is the obvious one:

cd ../server && go run .   # listens on http://localhost:8787

What it does

In one run, with two locally generated members (alice and bob):

  1. Generate keypairs, each member is a fresh Ed25519 keypair (the member id) plus an X25519 keypair for data-key wrapping.
  2. Authenticate, the challenge -> sign nonce -> token flow. The client signs the raw nonce bytes (base64-decoded), which is exactly what a conformant server verifies.
  3. createRepo, alice mints a per-repo data key, encrypts the initial alt payload, wraps the data key to her own X25519 key, and creates a repo as its sole member.
  4. pull, once at the known version (server reports unchanged, omits the envelope) and once from version 0 (server returns the current envelope).
  5. push, encrypts and writes a new payload version with optimistic concurrency, then deliberately re-pushes at a stale expected version to show the conflict response.
  6. addMember, alice wraps the data key to bob’s X25519 key and records his entry.
  7. fetchMemberKey, looks bob’s entry back up by member id (URL-encoded, because base64 ids contain + / =).
  8. bob pulls and decrypts, bob authenticates with his own keypair, pulls the shared repo, unwraps the data key from his member entry, and decrypts the payload, recovering exactly what alice stored.

Each step prints a one-line transcript entry.

The crypto is real

Unlike the placeholder clients, this one does the real envelope work (SPEC sections 4–5) using the sibling ../avp package:

Those constructions are checked byte-for-byte against the conformance vectors by the avp package’s tests, so this client genuinely interoperates rather than only round-tripping its own placeholders.

What is simplified (do not ship this)

This example is illustrative, not production. Specifically:

License

MIT (SPDX-License-Identifier: MIT).