Skip to main content

tup-verify

An independent verifier of TUP signed messages and hash-chained audit logs. It is one file, tup_verify.py, and needs only the Python standard library.

It shares no code with TUP-MCP or tup-trust: it was written from spec/FORMAT.md. An auditor, a partner or a customer can check a TUP-MCP audit log without installing TUP or trusting its code. The tests check that both implementations give the same verdict on the same files.

Status: version 0.1.1, on PyPI. Licensed under Apache-2.0.

Install

Python 3.11 or later. There are three ways:

python tup_verify.py selftest               # copy the file and run it, nothing to install
pip install tup-verify                      # adds the command tup-verify
pip install "tup-verify[fast]"              # also installs cryptography, for faster Ed25519

Without cryptography it uses its own pure-Python Ed25519 (RFC 8032). On this machine that takes about 2.6 ms per signature, against 0.3 ms with cryptography. Both apply the same strict rules (FORMAT.md 3.4).

Commands

Audit log

tup-verify log audit.jsonl --key <writer's public key> --head <head saved elsewhere> --peers trusted_keys.json
Option What it adds
--key Every record must be signed by the log's writer: 64 hex characters, or a public_key.pem file. Without it, anyone who can edit the file can rebuild a consistent chain
--head A head hash saved outside the writer's reach. Without it, deleting the last records goes unnoticed
--peers TUP-MCP's trusted_keys.json (agent → list of keys). The messages in received records must be signed with the key pinned for their sender
--chain-only Skip the signed messages kept in sent and received records
--json Print the result as JSON
--backend Force cryptography or python

The audit log from spec/vectors.json, with every option:

log: audit.jsonl
chain: OK, 3 records, every hash links to the previous one
signatures: every record is signed with the writer's key
truncation: the saved head is in the chain
head: count 3, hash 196a1d8dc707eb62c63dedb0eb46e259df635b782941bf36c70e7fb5d2d46353
messages: 1 kept in sent/received records, all with a valid signature
          signed with a key you gave (--key for sent, --peers for received): 1 of 1
RESULT: VERIFIED

The same log without options ends in RESULT: VERIFIED IN PART (no --key, no --head, messages with keys you did not give: see above). A log with one changed character ends in chain: BROKEN at line N and RESULT: NOT VERIFIED.

One message

tup-verify message msg.json --key <sender's public key> [--sender alice] [--recipient bob]
tup-verify message msg.json --peers trusted_keys.json

You must say whose key to expect, with --key or --peers. A message that is only signed with the key it carries proves nothing about who sent it.

Self-test

tup-verify selftest

It checks this machine's Ed25519 and JSON against known answers: RFC 8032 tests 1 to 3, an altered message, a signature with S + L, and the canonical form of a record.

Exit codes

Code Meaning
0 Every check that ran passed. The report says which checks did not run
1 Not verified. The report gives the line and the reason
2 Input error: the file cannot be read, a key is invalid, an option is missing

What it does not check

  • Replay and the time window. The receiver checked them when it accepted the message. Offline there is no way to know which nonces it had already seen.
  • Revocation. It does not read revocation lists. If a key was revoked, remove it from the file you give to --peers.
  • Logs in the old format (16-character hashes) are accepted only without --key. That format had no signatures.

Tests

cd tup-verify
python -m pytest

32 passed. The tests cover the RFC 8032 vectors and non-canonical encodings on both backends. They check that the two backends agree on 60 random signatures, and they run the vectors in spec/vectors.json. They also make 18 kinds of edits to a log and check that tup-trust stops at the same line. Some of the tests need cryptography and tup-trust, to create keys and compare. The verifier itself does not need them.

License

Apache-2.0. See LICENSE and NOTICE. Copyright 2026 Zhofri Guaman.

The Ed25519 functions follow the Python illustration in RFC 8032. That code keeps the IETF Trust's Revised BSD License, reproduced in tup_verify.py and at the end of LICENSE.


Resumen en español

tup-verify comprueba registros de auditoría y mensajes firmados de TUP sin instalar TUP. Es un solo archivo y solo usa la biblioteca estándar de Python. Se escribió a partir de spec/FORMAT.md, sin compartir código con TUP-MCP ni con tup-trust.

  • Se instala con pip install tup-verify, o se copia el archivo y se corre con python tup_verify.py.
  • tup-verify log audit.jsonl --key <clave del autor> --head <cabeza guardada aparte> --peers trusted_keys.json comprueba la cadena, las firmas de cada registro, que no falte el final y la firma de cada mensaje guardado.
  • Sin --key o sin --head, el resultado es "VERIFIED IN PART" y el informe dice qué faltó.
  • Código de salida: 0 verificado, 1 no verificado y 2 error de entrada.
  • No comprueba replay ni revocación: eso lo hace quien recibe el mensaje.
  • Licencia Apache-2.0. El código Ed25519 que sigue al RFC 8032 conserva además el aviso BSD del IETF Trust.

Metadata

Release files for tup-verify 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tup-verify 0.1.1
File Size Uploaded Provenance Actions
tup_verify-0.1.1.tar.gz 25.7 kB With provenance Details for tup_verify-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tup-verify 0.1.1
File Interpreter ABI Platform Actions
tup_verify-0.1.1-py3-none-any.whl Python 3 none any Details for tup_verify-0.1.1-py3-none-any.whl

Total release size: 45.2 kB

Release files / tup_verify-0.1.1.tar.gz

Download URL tup_verify-0.1.1.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a04155603220e9f0fc091bfac5246cb32aa27cae96ba65c6920387c2f725d14b
BLAKE2b-256 checksum
How to use checksums
2d2a97e858151872fab27f51f567a01e8091c062d6d4eac6f7a484cf245a6019
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Release files / tup_verify-0.1.1-py3-none-any.whl

Download URL tup_verify-0.1.1-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23121ace9c5ecc985eb866b785be6f5cb0ed16bf78faf8084f43b93e50b0baaf
BLAKE2b-256 checksum
How to use checksums
f549631b7f114b87e1080b08aa0438176d23ed317b6fb6a84986b2b9ecae525b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Security for tup-verify 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tup_verify-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page