libtea-rs: An Independent Rust Client for the Transparency Exchange API

imageCreatedbyGPT

Getting an SBOM for a piece of software is rarely the hard part any more. Finding the right one, from the right place, at the right version, and noticing when it changes: that is still mostly done with bookmarks, naming conventions and shell scripts. The Transparency Exchange API (TEA) is an attempt to turn that into a protocol, and libtea-rs is a set of Rust libraries and a command-line tool that consume it.

This article covers what TEA is, what libtea-rs does and does not do, how the workspace is organised, and how to use it from Rust, from the shell and from GitHub Actions. It also separates what is implemented from what is experimental and what is only planned, because libtea-rs is a 0.1.x project and says so itself.

Scope of this article. Everything below was checked against the libtea-rs repository at release 0.1.8 (the main branch and the crates published on crates.io on 19 November 2026). The Rust examples were compiled against the published libtea-client 0.1.8 crate. They were then run against a small local mock TEA server, not against a live deployment, so the sample output is from that mock. Statements about interoperability with real servers come from the project’s own interoperability notes, and I label them as such.

1. TEA and software supply chain transparency

An SBOM is only useful if consumers can obtain it. Today a vendor might publish one on a download page, attach it to a release, or send it on request. Each of those works for a person and none of them works well for automation: there is no standard way to ask “what is the SBOM for this product release?” or “has anything been added to this release since I last looked?”

The Transparency Exchange API defines that conversation. It is developed in the open by the CycloneDX community, with a related context repository for Ecma TC54. At the time of writing the specification is still labelled beta, even though its OpenAPI document carries version 1.0.0; libtea-rs records that mismatch and follows the OpenAPI document.

The pieces you need to know are these:

  • TEI (Transparency Exchange Identifier). A URI of the form tei://<domain>/<type>/<identifier>, for example tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1. The domain says who to ask. The type and identifier say what you are asking about.
  • Discovery. A client turns a TEI into an API endpoint by fetching https://<domain>/.well-known/tea, choosing a mutually supported API version and endpoint, then calling GET {root}/v{version}/discovery?tei=.... The answer lists the product releases the identifier refers to and the servers that can describe them.
  • A small object model. A product has product releases. A release has collections, which are numbered snapshots of its artifacts. A collection holds artifacts, and each artifact revision is available in one or more formats, each with a media type and optional checksums. Components and component releases follow the same pattern.
  • Optional lifecycle data. Servers may expose Common Lifecycle Enumeration (CLE) events such as end of support.

The collection versioning is what makes change detection practical. If a vendor adds a VEX document or revises an SBOM, the collection version goes up and a consumer can see it.

2. What libtea-rs is, and who it is for

libtea-rs is, in its own words, an independent client for TEA servers. It resolves a TEI, fetches product releases, collections and artifacts, and checks the checksums a server declares. It can also write a lock file so a CI job can tell when what a server publishes has changed.

Two statements in the project README matter more than any feature list:

  • It is an independent consumer, not an official implementation. It is not a CycloneDX or Ecma project, has no affiliation with them or with any TEA server vendor, and is not a conformance certificate.
  • It is a client only. It is not a TEA server, does not sign or publish anything, does not scan for vulnerabilities, and does not verify signatures.

That makes the target audience fairly specific:

  • Rust developers who need to talk to TEA servers from a build tool, an internal service or an SBOM pipeline.
  • Supply chain and security engineers who want a command-line tool and a CI action to fetch artifacts and notice drift.
  • People building or testing TEA servers who want an independent consumer to point at them.

The project is licensed under Apache-2.0, requires Rust 1.89 or later, and is explicitly experimental until 0.9, so expect breaking changes before 1.0.

3. Architecture

The workspace has four crates. Their directories are tea-core, tea-client, tea-cli and tea-conformance, but the package names carry a libtea- prefix:

CratePublished?Role
libtea-corecrates.ioTEI parsing, version negotiation, data models, checksums, destination rules, lock file format. No network I/O.
libtea-clientcrates.ioThe async HTTP client: discovery, authentication, streaming downloads, retries, caching.
libtea-cliGitHub Releases (binary libtea)The command-line tool. Not on crates.io.
libtea-conformanceNoOffline smoke checks behind libtea conformance.

The dependency direction is strict: the CLI depends on the client and the conformance crate, the client depends on core, and core depends on none of them.

libtea-cli
-> libtea-conformance (offline checks and reports)
-> libtea-client (HTTP, auth, streaming, retries)
-> libtea-core (TEI, versions, models, checksums, policy)

libtea-core contains no Tokio, no reqwest and no filesystem access, so you can reuse its parsing and validation with a different HTTP stack. libtea-client uses Tokio, reqwest and rustls. Since 0.1.5 the client re-exports the whole core crate as libtea_client::core, so most applications need only one dependency. The CLI is a thin layer: it calls the public crates and does not reimplement TEI parsing or HTTP.

The conformance crate deserves a careful description. It runs checks derived from the pinned specification examples without touching the network, and writes a JSON report. The report contains "is_certification": false. A passing run means the local checks passed, nothing more.

The specification baseline

libtea-rs does not track the TEA specification as it moves. It is written against one pinned upstream commit (962a0228af1bfcc1232ac3f79239317ff33fdb04, OpenAPI 1.0.0), vendors the OpenAPI document, and has a weekly workflow that diffs the pin against upstream main for information. You can print the pin from the CLI with libtea spec, or read it in code from libtea_core::spec::COMMIT.

4. Key features and security considerations

Features

  • TEI parsing that never rewrites what you give it, as the spec requires for TEI comparison.
  • Discovery through .well-known/tea and /discovery, with version and priority selection and failover rules.
  • Typed access to products, product releases, components, component releases, collections and artifacts, including list and query endpoints with caller-managed pagination.
  • Artifact and detached-signature downloads that stream, enforce size limits, remove one layer of HTTP content coding, and hash the decoded bytes.
  • An API-key authentication baseline (POST /token with client_credentials, then bearer tokens).
  • Package URL discovery (Service::discover_purl), CLE retrieval, and experimental lifecycle evaluation.
  • A lock file format with deterministic output and a diff.
  • An opt-in on-disk response cache with an offline mode.

Security design

The project documents its security model in docs/security.md. The decisions that matter in practice:

  • Destinations are restricted by default. Only HTTPS to public addresses is allowed. Cleartext, loopback, private and cloud-metadata addresses are refused, and resolved DNS addresses are checked too. You can allow one named origin (--allow-origin on the CLI, DestinationPolicy::allow_origin in the library), which is how local test servers work.
  • TLS verification cannot be disabled. The client uses rustls with bundled webpki-roots, not the system certificate store, so trust roots change with a library release.
  • Credentials stay where they belong. The bearer token is attached only under the versioned API path of an authorised origin. Artifact and signature URLs never receive it. API keys are not sent to token endpoints learned from discovery unless you opt in (allow_discovered_credentials).
  • Resource limits. Defaults are 1 MiB for discovery documents, 8 MiB for JSON, 256 MiB for artifacts and 5 redirects, adjustable through Limits. Request, download, idle and connect timeouts are separate.
  • Proxies. HTTP_PROXY, HTTPS_PROXY and ALL_PROXY are honoured. Behind a proxy the proxy resolves names, so the DNS-based address checks do not apply; ClientBuilder::ignore_env_proxies(true) restores them.
  • Weak digests are not quietly accepted. If every declared checksum is SHA-1, the outcome is Weak and the download fails unless you opt in (allow_weak_checksums). The CLI exits with status 4.
  • #![forbid(unsafe_code)] in the library crates, with fuzz targets in the repository.

What “verified” means here

This is the most important sentence in the project. IntegrityOutcome::Verified means that every checksum the server declared for that artifact format matched the decoded bytes. It shows integrity relative to what the server said. It does not show publisher authenticity: a server that serves a wrong artifact together with matching checksums passes. Signatures are not verified by anything in 0.1.8.

5. Installation and prerequisites

You need Rust 1.89 or later to build from source or use the libraries. The CLI is also available as prebuilt binaries.

Libraries

[dependencies]
libtea-client = "0.1.8"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Or: cargo add libtea-client && cargo add tokio --features macros,rt-multi-thread. Core types are available as libtea_client::core. Reference documentation is on docs.rs/libtea-client and docs.rs/libtea-core.

CLI from a release. Each GitHub release has archives for seven targets (Linux gnu and musl on x86_64 and aarch64, macOS on x86_64 and aarch64, Windows on x86_64), a SHA256SUMS file, a CycloneDX SBOM and a build-provenance attestation. Download from the releases page and run the checksum and attestation checks in docs/installing.md before installing. Then check with libtea --version.

CLI from source

cargo install --git https://github.com/Mehrn0ush/libtea-rs --tag v0.1.8 --locked libtea-cli

This builds the libtea binary at the tagged release. No checksum or attestation check is involved on this route, and cargo install libtea-cli does not work because the CLI is not published to crates.io.

6. Practical Rust examples

The examples below form one small project. Each file is a separate binary (src/bin/*.rs) in a crate that depends only on libtea-client and tokio. All of them compiled against the published 0.1.8 crates.

A note on the local-testing code: examples that talk to a server accept an optional local origin. In production you would omit it. With it, the client allows that one origin and fetches /.well-known/tea from it rather than from the TEI’s domain. This mirrors the CLI’s --allow-origin and --well-known-url.

6.1 TEI parsing and Package URLs (offline)

Tei::parse validates syntax and preserves spelling. validate_registry adds the extra checks that apply to registry types such as uuid. The legacy urn:tei: form is rejected with its own error.

use libtea_client::core::{same_package_url, Purl, Tei};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// A TEI is kept exactly as written; nothing is normalized.
let tei = Tei::parse("tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1")?;
tei.validate_registry()?; // extra checks for registry types such as `uuid`
println!("domain {}", tei.domain());
println!("type {}", tei.tei_type());
println!("identifier {}", tei.identifier());
println!("well-known {}", tei.well_known_url());
// A trailing dot, a port or a slash in the identifier are rejected.
for bad in [
"tei://example.com:8443/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1",
"tei://example.com./uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1",
] {
println!("rejected {bad}: {}", Tei::parse(bad).is_err());
}
// Package URLs are parsed too (experimental in 0.1.x).
let a = Purl::parse("pkg:npm/left-pad@1.3.0")?;
let b = Purl::parse("pkg:NPM/left-pad@1.3.0")?;
println!("purl {} / {} / {:?}", a.package_type(), a.name(), a.version());
println!("same pkg {}", same_package_url(&a, &b));
Ok(())
}

Output:

domain example.com
type uuid
identifier d4d9f54a-abcf-11ee-ac79-1a52914d44b1
well-known https://example.com/.well-known/tea
rejected tei://example.com:8443/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1: true
rejected tei://example.com./uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1: true
purl npm / left-pad / Some("1.3.0")
same pkg true

Purl parsing and comparison are marked Experimental in the library. The original text is preserved and is what gets sent to a server; canonicalisation is only used when you ask whether two spellings name the same package.

6.2 Discovery, connecting, and browsing products, releases and collections

Client::discover runs the whole TEI walk and returns a list of ResolvedRelease values, each holding a product release UUID, a server root URL and the exact advertised API version. Client::open turns one of them into a Service, which is a handle to one versioned API base. If you already know the base URL, client.service(root, "1.0.0") skips discovery.

One behaviour worth knowing: a TEA-formatted 404 from /discovery ends the search with ClientError::Unresolved. It is not treated as “try the next endpoint”, and it is not evidence that no updates exist. A non-TEA 404 or a 5xx does fail over to the next compatible endpoint; 401 and 403 never do.

use libtea_client::core::enums::CollectionSort;
use libtea_client::core::{DestinationPolicy, ListParams, Tei};
use libtea_client::url::Url;
use libtea_client::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = std::env::args().skip(1);
let tei = Tei::parse(&args.next().ok_or("usage: browse TEI [LOCAL_ORIGIN]")?)?;
let mut builder = Client::builder();
if let Some(origin) = args.next() {
// Local testing only: allow exactly one non-public origin and fetch
// /.well-known/tea from it instead of from the TEI's domain.
let origin = Url::parse(&origin)?;
builder = builder
.destination_policy(DestinationPolicy::allow_origin(&origin)?)
.well_known_fetch_url(origin.join("/.well-known/tea")?);
}
let client = builder.build()?;
// 1. TEI -> .well-known/tea -> /discovery.
let releases = client.discover(&tei).await?;
let selected = releases.first().ok_or("TEI resolved to nothing")?;
println!("server {} (API {})", selected.root_url, selected.api_version);
// 2. A Service is one versioned API base.
let service = client.open(selected)?;
// 3. Product release (with its latest collection embedded) and parent product.
let release = service.get_product_release(selected.product_release).await?;
let product = service.get_product(release.release.product).await?;
println!("product {} / release {}", product.name, release.release.version);
// 4. Collections are versioned snapshots of a release's artifacts.
let page = service
.list_product_release_collections(
selected.product_release,
&ListParams::<CollectionSort>::default().with_page_size(10),
)
.await?;
for c in &page.results {
println!("collection v{} ({} artifacts)", c.version, c.artifacts.len());
}
if page.has_next {
println!("more pages: pass next_page_token back unchanged");
}
// 5. The latest collection lists artifacts and the formats they come in.
let latest = service
.get_latest_product_release_collection(selected.product_release)
.await?;
for artifact in &latest.artifacts {
for f in &artifact.formats {
let declared = f.checksums.as_ref().map_or(0, Vec::len);
println!(
"artifact {} r{} {} ({} checksum(s) declared)",
artifact.uuid, artifact.version, f.media_type, declared
);
}
}
Ok(())
}

Run against the local mock server:

server http://127.0.0.1:18080 (API 1.0.0)
product Demo Product / release 1.4.0
collection v1 (1 artifacts)
artifact 11111111-1111-4111-8111-111111111111 r1 application/vnd.cyclonedx+json (1 checksum(s) declared)

Two library design points show up here. Model types such as Page, Collection and Artifact are #[non_exhaustive], so read their public fields rather than constructing them. And list endpoints take ListParams, which carries page size, an opaque page token, sorting, and identifier filters. Page tokens must be passed back unchanged. If you want pagination handled for you, follow_pages exists as an opt-in helper with limits; it is marked experimental.

To start from a Package URL instead of a TEI, call Service::discover_purl on a known base (new in 0.1.8). A PURL names no server, so there is no .well-known step.

6.3 Downloading an artifact and verifying checksums

There are two ways to download. download_format_to_file streams to disk and commits the file only after the stream ended cleanly and the checksums passed the client’s policy. download_format returns the bytes in memory together with an IntegrityReport you can inspect. Both hash the bytes after HTTP content coding (gzip, deflate) has been removed, because that is what TEA’s checksums cover.

use std::path::Path;
use libtea_client::core::{DestinationPolicy, IntegrityOutcome, Tei};
use libtea_client::url::Url;
use libtea_client::{ArtifactFetch, Client, FileDownloadOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = std::env::args().skip(1);
let tei = Tei::parse(&args.next().ok_or("usage: fetch TEI OUT_FILE [LOCAL_ORIGIN]")?)?;
let out = args.next().ok_or("missing OUT_FILE")?;
let mut builder = Client::builder();
if let Some(origin) = args.next() {
let origin = Url::parse(&origin)?;
builder = builder
.destination_policy(DestinationPolicy::allow_origin(&origin)?)
.well_known_fetch_url(origin.join("/.well-known/tea")?);
}
let client = builder.build()?;
let releases = client.discover(&tei).await?;
let selected = releases.first().ok_or("TEI resolved to nothing")?;
let service = client.open(selected)?;
let collection = service
.get_latest_product_release_collection(selected.product_release)
.await?;
let artifact = collection.artifacts.first().ok_or("collection has no artifacts")?;
let media_type = &artifact.formats.first().ok_or("artifact has no formats")?.media_type;
// Option A: stream to a file. The file appears only after every declared
// checksum has matched; on a mismatch the call fails and nothing is left behind.
let done = service
.download_format_to_file(artifact, media_type, Path::new(&out), &FileDownloadOptions::new())
.await?;
println!(
"wrote {} ({} bytes), integrity {:?}",
done.path.display(),
done.download.bytes_written,
done.download.integrity.outcome
);
// Option B: fetch into memory and inspect the per-checksum report yourself.
match service.download_format(artifact, media_type, None).await? {
ArtifactFetch::Body(body) => {
assert_eq!(body.integrity.outcome, IntegrityOutcome::Verified);
for check in &body.integrity.checks {
println!("{} matched: {:?}, {} bytes in memory", check.algorithm, check.matched, body.bytes.len());
}
}
ArtifactFetch::NotModified { .. } => println!("not modified"),
_ => println!("unexpected fetch result"),
}
Ok(())
}

Output:

wrote /tmp/out.json (74 bytes), integrity Verified
SHA-256 matched: Some(true), 74 bytes in memory

Two edge cases I ran against the mock server:

  • Running the same command again fails, because FileDownloadOptions::new() refuses an existing destination: Io("/tmp/out.json already exists; overwrite was not requested"). Use FileDownloadOptions::new().with_overwrite(true) to replace a regular file. A symbolic link at the destination is refused either way.
  • When the server declared a SHA-256 that did not match the bytes, the call returned ClientError::Integrity with outcome: Failed and the expected and actual digests, and no output file was created.

Two cautions from the API documentation. First, download_format_to_writer hands bytes to your writer before the checksum comparison is possible, so use it only if you can discard them on error. Second, a format with no declared checksums yields IntegrityOutcome::NotDeclared; the file is still committed. If that matters to you, check the outcome (the CLI offers --require-checksums for this).

6.4 Lock files and synchronisation

A lock file records what a TEI resolved to and the integrity outcome of every artifact format at fetch time: server, API version, spec commit, product release, collection version, and per artifact the UUID, revision, type, media type, decoded size, declared checksums and integrity outcome. It holds no credentials. The Rust types live in libtea_core (LockFile, LockedArtifact, LockedChecksum, LockedIntegrity, diff_locks), and the format is documented in docs/lock-file.md with a JSON Schema.

The library does no I/O and reads no clock when building locks: you supply every value, including fetchedAt. This example builds two locks by hand, serialises one, and diffs them:

use libtea_client::core::{
diff_locks, spec, LockFile, LockedArtifact, LockedChecksum, LockedIntegrity,
};
fn lock_with(digest: &str, collection: u64) -> LockFile {
let mut lock = LockFile::new(
"tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1",
"https://tea.example.com/",
"1.0.0",
spec::COMMIT,
"d4d9f54a-abcf-11ee-ac79-1a52914d44b1",
collection,
);
lock.artifacts.push(LockedArtifact::new(
"11111111-1111-4111-8111-111111111111",
1,
"BOM",
"application/vnd.cyclonedx+json",
74,
vec![LockedChecksum::new("SHA-256", digest)],
LockedIntegrity::Verified,
"2026-11-19T10:00:00Z",
));
lock
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let old = lock_with(&"a".repeat(64), 1);
let new = lock_with(&"b".repeat(64), 2);
// Canonical, sorted, deterministic JSON; a lock round-trips through parse().
let text = old.to_json()?;
assert_eq!(LockFile::parse(text.as_bytes())?, old);
print!("{text}");
// fetchedAt is ignored; everything else is compared.
let delta = diff_locks(&old, &new);
println!("changed: {}", !delta.is_empty());
for h in &delta.header {
println!("~ {}: {} -> {}", h.field, h.old, h.new);
}
for m in &delta.modified {
for f in &m.fields {
println!("~ {} {}: {} {} -> {}", m.uuid, m.media_type, f.field, f.old, f.new);
}
}
Ok(())
}

Output (the JSON is the canonical form: sorted, two-space indent, trailing newline):

{
"schemaVersion": 1,
"tei": "tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1",
"server": "https://tea.example.com/",
"apiVersion": "1.0.0",
"specCommit": "962a0228af1bfcc1232ac3f79239317ff33fdb04",
"productRelease": "d4d9f54a-abcf-11ee-ac79-1a52914d44b1",
"collectionVersion": 1,
"artifacts": [
{
"uuid": "11111111-1111-4111-8111-111111111111",
"revision": 1,
"type": "BOM",
"mediaType": "application/vnd.cyclonedx+json",
"size": 74,
"checksums": [
{
"algorithm": "SHA-256",
"value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
],
"integrity": "Verified",
"fetchedAt": "2026-11-19T10:00:00Z"
}
]
}
changed: true
~ collectionVersion: 1 -> 2
~ 11111111-1111-4111-8111-111111111111 application/vnd.cyclonedx+json: checksums SHA-256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -> SHA-256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

In practice you rarely build a lock yourself. libtea sync does the whole job: it resolves the TEI, fetches the latest collection, downloads and checks every artifact format, and writes the lock. It fails closed. If any artifact cannot be fetched and verified, no lock is written and an existing one is left untouched. If nothing changed, it leaves the file’s bytes alone, so re-running it creates no noise in version control.

Two caveats the project states plainly: the lock format is Experimental until 0.9, and a lock is not signed. Whoever can edit the file can change it, so keep it somewhere changes are reviewed.

7. The CLI and GitHub Actions

Commands

libtea --help lists these commands (this is from the 0.1.8 binary):

CommandWhat it does
specPrint the pinned specification identity
parse-teiParse a TEI and print its components (offline)
conformanceRun the offline smoke checks and print a JSON report
discoverResolve a TEI, or a PURL with --purl and --base
product-releaseFetch one product release from a known API base
collectionsList or fetch collections (--latest, --version)
cleFetch lifecycle events; with --version, evaluate a SemVer version
searchQuery products, product releases, components or component releases, with --id-type / --id-value filters
inspectSummarise a TEI’s product, release, collection and artifacts; downloads nothing
downloadDownload one artifact revision to a file or stdout
syncFetch, verify and write a lock; --check compares instead
diffCompare two lock files offline
cachestat or clear the response cache

Typical use, with sample output from the local mock server (--allow-origin and --well-known-url are only needed for local testing, and are omitted from the commands shown):

$ libtea inspect tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1
server http://127.0.0.1:18090/ 1.0.0
product 2ff3ae7c-8eab-4e0b-9b8b-1a0c4c4c1c2d Demo Product
identifier PURL pkg:generic/demo@1.4.0
product_release d4d9f54a-abcf-11ee-ac79-1a52914d44b1 1.4.0 created 2026-01-01T00:00:00Z released -
collection d4d9f54a-abcf-11ee-ac79-1a52914d44b1 version 1 created 2026-01-01T00:00:00Z reason INITIAL_RELEASE artifacts 1
artifact 11111111-1111-4111-8111-111111111111 BOM version 1 Demo SBOM
format application/vnd.cyclonedx+json checksums SHA-256 signature -
$ libtea download --base https://api.example.com --artifact 11111111-1111-4111-8111-111111111111 \
--revision 1 --media-type application/vnd.cyclonedx+json --output sbom.json --require-checksums
integrity verified (decoded-byte checksums only; not publisher authenticity) strong_etag false bytes 74

download writes to a temporary file and renames it into place only after every declared checksum matched. An existing output is refused unless you pass --force. If all declared checksums are SHA-1, it exits 4 and writes nothing unless you pass --allow-weak-checksums. --signature additionally fetches the detached signature and reports which container format it appears to be (OpenPGP, CMS or Sigstore bundle). It does not verify it, and does not save it.

Add --json to most commands for machine-readable output. With --json a failure becomes a single JSON object on stderr, for example:

{"error":{"exit_code":2,"kind":"usage","message":"TEI domain name is not an ASCII DNS name without a port"},"schema_version":1}

Exit codes

The exit codes are documented as stable and are what makes the tool scriptable:

CodeMeaning
0success
1failure (network, TLS, timeout, size limit, server error, refused path)
2usage or bad input
3authentication or authorisation
4only weak (SHA-1) checksums matched
5not found or not resolved
6integrity not established
7changes detected (sync --check, diff)

Credentials go in TEA_API_KEY_ID and TEA_API_KEY_SECRET. The --api-key-secret flag exists but exposes the secret in process lists and shell history.

Detecting drift

The lock workflow in three steps. Create the lock once and commit it:

libtea sync tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1 --lock tea.lock

Later, compare the server with the lock without writing anything:

$ libtea sync tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1 --lock tea.lock --check
~ collectionVersion: 1 -> 2
~ 11111111-1111-4111-8111-111111111111 application/vnd.cyclonedx+json: size 74 -> 92; checksums SHA-256:ccedb71c... -> SHA-256:523a62b4...
Error: the server differs from the lock
$ echo $?
7

(Checksums shortened here; the real output prints them in full.) Exit status 7 is the signal. libtea diff old.lock new.lock gives the same comparison between two files offline and also exits 7 when they differ. fetchedAt is ignored in comparisons because it changes on every run.

Note that --check still downloads and verifies every artifact. It is a check of what the server serves now, not a cheap metadata poll. Offline mode (--offline with --cache-dir) answers from the cache and says so in its output; the cache is opt-in and experimental.

GitHub Actions

The repository root contains a composite action that downloads a libtea release, verifies it, and runs one command. A minimal drift check:

name: tea-lock-check
on:
schedule:
- cron: "17 5 * * *"
pull_request:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@<commit-sha>
- uses: Mehrn0ush/libtea-rs@<commit-sha-of-a-release-tag>
with:
version: "0.1.8"
command: sync
check: "true"
tei: tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1
lock-file: tea.lock

Points from the action’s documentation that are easy to get wrong:

  • Pin the action by commit SHA of a release tag, and pin version; there is no latest. Use 0.1.2 or later, since earlier tags fail the checksum step on Windows.
  • The command input accepts sync, diff, discover, download, product-release, collections, parse-tei, spec and conformance. The newer inspect, search and cle commands are not in that list.
  • Credentials go through the api-key-id and api-key-secret inputs, fed from repository secrets. Do not set TEA_API_KEY_ID or TEA_API_KEY_SECRET in env: at the step, job or workflow level. Composite action steps inherit that environment, and the action refuses to run if it finds them.
  • Do not use it with pull_request_target.
  • Extra CLI arguments go in extra-args, one per line, with no shell involved. Credentials are refused there.
  • The action has attestation (auto, required, skip) and libc (gnu or musl) inputs, and it outputs exit-code and attestation.

The full input reference is in docs/github-action.md.

8. Interoperability testing with Oolong and Vulnetix

A TEA client is only as useful as the servers it can talk to, and a spec that is still in beta leaves room for different readings. libtea-rs treats other TEA implementations as independent test targets, and its interoperability document is careful about what that evidence does and does not show. Its opening statement: a server that answers this SDK is not, by that fact, a conforming TEA server, and the results are evidence for the named deployments only.

Oolong is a TEA server that the project runs locally as a fixture. The live tests (oolong_idtype_live and oolong_surface_live in libtea-client) are #[ignore]d, so a normal cargo test never runs them and CI never calls an external server. You start Oolong yourself, then run:

cargo test -p libtea-client --locked --test oolong_idtype_live -- --ignored --nocapture
cargo test -p libtea-client --locked --test oolong_surface_live -- --ignored --nocapture

The recorded run is dated 2026-11-04 against the pinned TEA commit. It covered identifier filters (type-only and type-plus-value queries, continuation across pages, and the client’s refusal to send a value without a type), discovery, navigation of the fixture graph, artifact download with Verified integrity, and signature download. Two limitations are recorded as Oolong’s: CLE endpoints return NOT_IMPLEMENTED, and so does POST /token. The client reports the first as CleFetch::NotImplemented, which it deliberately distinguishes from a missing parent object.

Vulnetix operates a public TEA 1.0.0 deployment. The project ran its read-only probe script (scripts/interop-probe.sh) against it anonymously on 2026-11-08; the committed result file records discover, product-release and download passing, with every declared checksum matching the decoded bytes. Further manual probes of product, component, collection, pagination and download operations are listed in the document, but the document itself notes that they have no committed result file, so they are reported rather than reproducible. One recorded observation: for the artifact revision probed, the signature download returned SignatureFetch::NotPublished. The project is explicit that this describes that one operation, not Vulnetix’s signature support in general. The GitHub Action was also run against it on Linux, macOS and Windows runners. The project additionally records a single run against the public ReARM demo.

How to read all this:

  • It is evidence for three named deployments (Oolong locally, Vulnetix and the ReARM demo publicly), not for the ecosystem.
  • Checksum results are content integrity, not signature verification. A downloaded Sigstore provenance file that matches its digest proves the bytes are intact, not that the signed subject was verified.
  • Other implementations named by the specification (py-libtea, pypi-tea, sbomify) are listed as “not executed”.

If you run libtea-rs against another server, the project asks for an issue with the server name and version, the date, the repository commit and the commands you ran, without credentials.

9. Limitations, maturity and future development

Implemented (follows SemVer from 0.1.0, checked in CI with cargo semver-checks)

  • TEI parsing, discovery and version negotiation, API-key authentication, and read access to every consumer endpoint in the pinned OpenAPI document.
  • Artifact and signature downloads with decoded-byte checksum checks, destination policy, limits and timeouts.
  • The CLI commands listed above, with a documented JSON output and exit codes.

Experimental (may change in a 0.x minor release)

  • The lock file format and its Rust types.
  • The persistent HTTP cache and offline mode.
  • File and writer streaming downloads.
  • purl, vers and lifecycle modules (Package URLs, version ranges, CLE evaluation for SemVer and npm-style ranges; other vers types are listed as “not evaluated”, never as “not applying”).
  • Signature format detection and the SignatureVerifier extension point. The only bundled verifier, FormatOnlyVerifier, never returns Verified.
  • Page following (follow_pages).

Not implemented

  • Signature verification. There is a design document, and the rule that no built-in verifier will report Verified until trust anchors are caller-supplied or come from an independent root. Verifying with keys fetched from the same host that served the artifact would be misleading.
  • HTTPS SVCB DNS lookup.
  • OAuth profiles other than the API-key client_credentials baseline; the docs say they are not planned until an interoperability need appears.
  • A full ECMA-428 CLE document (CLE is retrieved as the TEA projection).
  • A TEA publisher API, a TEA server, no_std support, and publishing libtea-cli or libtea-conformance to crates.io.
  • Universal server compatibility and any form of certification.

Beyond these, maturity is the main limitation. The project is on 0.1.x, was written against a specification that is itself in beta, and is explicitly experimental until 0.9. The TEA specification can move under it, and the pin is only updated deliberately. The changelog suggests an active release cadence (0.1.8 added discover_purl and the inspect, search and cle commands on the day this article was written), and the design notes for Package URLs, CLE and signatures point to follow-up stages in the issue tracker. Treat that as direction, not a promise.

10. Conclusion and how to contribute

If your SBOM tooling is a pile of curl commands and naming conventions, TEA is a credible direction, and libtea-rs is a careful, security-minded way to consume it from Rust. Its best feature may be its restraint: it states precisely what “verified” means, refuses unsafe destinations by default, fails closed when writing locks, and labels what is experimental. Its limits are equally clear. It is a 0.1.x client for a beta specification, it checks digests rather than signatures, and its interoperability record covers three deployments.

A reasonable first experiment: install the CLI, run libtea inspect against a TEI you care about, then add a sync --check job and see how often the answer changes.

Links

libtea-rs is an independent project. It is not an official CycloneDX or Ecma project and is not affiliated with Oolong, Vulnetix or any other TEA server vendor mentioned here. This article describes the project as of release 0.1.8.

One reply on "libtea-rs: An Independent Rust Client for the Transparency Exchange API"

Leave a Reply