Skip to main content

trooth (Python)

Read a company's Semanto signed copy and check it: the file, a page proof, a signed response or the public log, offline. Standard library plus cryptography (for Ed25519). Python 3.11 or newer.

pip install trooth                    # the checks, SemantoClient and the semanto-verify command
pip install "trooth[langchain]"       # plus trooth.integrations.langchain.SemantoLoader
pip install "trooth[llama-index]"     # plus trooth.integrations.llama_index.SemantoReader
pip install "trooth[openai-agents]"   # plus trooth.integrations.openai_agents.semanto_read_tool

Every release is built and published by GitHub Actions through PyPI Trusted Publishing, with no stored token, and carries PEP 740 attestations that tie each file to the workflow run that built it.

Without installing: PYTHONPATH=verifier/python python3 -m trooth_semanto_verify file verifier/test-vectors/v1/semanto.json --pages verifier/test-vectors/v1/pages

Commands

semanto-verify file <semanto.json> [--pages <dir>] [--keys <keys.json>] [--now <iso>] [--revocations <file>]
semanto-verify page <url> [--trooth <base>] [--now <iso>]
semanto-verify response <url> [--keys <keys.json>]
semanto-verify log --from <n> --to <m> [--log <url>] [--keys <keys.json>]

file needs no network when --keys is given or a keys.json sits beside the file. Pages are read from <dir>/<page id>.md. Exit code 0 means every check passed; 1 means at least one failed.

Library

import json, trooth_semanto_verify as V

file = json.load(open("semanto.json"))
keys = [json.load(open("acme-keys.json")), json.load(open("trooth-keys.json"))]
result = V.verify_semanto(file, {"https://acme.com/security": open("security.md", "rb").read()}, keys)
for check in result["checks"]:
    print("ok  " if check["ok"] else "FAIL", check["name"], check["detail"])

The functions and the reason codes are the same as the JavaScript and Go kits: verify_semanto, verify_page_proof, verify_response, verify_web_bot_auth_request, verify_tree_head, verify_inclusion_in_log, verify_consistency, verify_checkpoint, verify_offer, verify_revocation_list, state_of, plus canonicalize (RFC 8785), the RFC 6962 primitives and verify_jws.

Canonical JSON here supports integers exactly. A non-integer float raises CanonicalizeError with a message saying to use minor units or a string, because Semanto never signs one.

Tests

python3 -m pytest runs every shared vector in verifier/test-vectors/v1 (positive and negative), the RFC 6962 known roots, the RFC 8785 cases, the state rules and the command line.

SemantoClient

from trooth_semanto_verify.client import SemantoClient
r = SemantoClient().read("https://acme.com/pricing")
print(r["ok"], r["dns"], r["reason"])

It fetches with the standard library (pass fetch= to use your own), checks the response signature and the domain's _trooth-keys TXT record over DNS over HTTPS, and keeps key sets and DNS answers five minutes.

Metadata

Release files for trooth 0.1.0

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

Source distribution (sdist)

Source distribution for trooth 0.1.0
File Size Uploaded Provenance Actions
trooth-0.1.0.tar.gz 29.5 kB With provenance Details for trooth-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trooth 0.1.0
File Interpreter ABI Platform Actions
trooth-0.1.0-py3-none-any.whl Python 3 none any Details for trooth-0.1.0-py3-none-any.whl

Total release size: 65.6 kB

Release files / trooth-0.1.0.tar.gz

Download URL trooth-0.1.0.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
58a71a7c74135f67704b0c37922e04aef3700bb863c918206bc57ae60d8885b5
BLAKE2b-256 checksum
How to use checksums
314f4c468e71efdba76e93bfd6b7e19a5df36bd5ba42d022908da30f73c28c81
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 Oct 30, 2026.

Transparency log

Release files / trooth-0.1.0-py3-none-any.whl

Download URL trooth-0.1.0-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba5d2de2ea3490d84e4bd27ccc977785abe8e14a552b81584f830461ceb03f3e
BLAKE2b-256 checksum
How to use checksums
3184ec794b37f8025367fe255e8d50f010faa851360abc5fd2395b19cea47314
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 Oct 30, 2026.

Transparency log

Security for trooth 0.1.0

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 trooth-0.1.0.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 Oct 30, 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.0 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