Download the PHP package k2gl/tuf without Composer

On this page you can find all versions of the php package k2gl/tuf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tuf

k2gl/tuf

CI Latest Stable Version Total Downloads PHPStan Level License

A fail-closed TUF (The Update Framework) client for PHP. Starting from an embedded root.json trust anchor, it refreshes signed metadata in the order the spec mandates and downloads targets, every byte verified against threshold-signed metadata or it throws.

The motivating use case is fetching Sigstore's trusted_root.json securely, but the client is a complete, general TUF implementation with no Sigstore specifics baked in.

What it guarantees

Refreshing and downloading enforce, in order and fail-closed, the TUF client workflow:

  1. Root — each new root is signed by the threshold of keys of both the currently trusted root and the new one, and its version increases by exactly one (key-compromise and rollback protection).
  2. Timestamp — signed by the root's timestamp role; neither its version nor the snapshot version it points at may roll back.
  3. Snapshot — matches the length and hashes the timestamp recorded, is signed by the root's snapshot role, matches the version the timestamp points at, and never rolls back or drops any targets metadata.
  4. Targets — match the length and hashes the snapshot recorded, signed by the delegating role, version matching the snapshot.
  5. Target files — verified against the length and hashes in the trusted targets metadata before the bytes are handed back.

Anything missing, expired, mis-versioned, or insufficiently signed throws. There is no "best effort" path.

Install

Requires PHP 8.1+ and ext-json. For signature verification, enable the extension matching the repository's key schemes:

Any other scheme, an unloadable key, or a malformed signature simply does not count toward a threshold (fail-closed).

Usage

You supply the initial root.json (the trust anchor — ship it with your application) and the repository URLs. The updater does the rest.

getTargetInfo() walks delegations depth-first (honouring terminating delegations), fetching delegated targets metadata as needed, and returns null when no trusted role vouches for the path. downloadTarget() re-verifies the content's length and hashes before returning it.

Keeping it offline (bring your own fetcher)

The network is reached only through the Fetcher interface, so the trust logic itself is pure. Point the client at a local mirror, an HTTP client you already use, or a fully in-memory source by implementing one method:

The trust anchor

The security of the whole chain rests on the initial root.json you embed: it is the one piece that is trusted a priori. Ship it with your application and update it deliberately. Its own expiry is intentionally not enforced on load — the refresh immediately walks the root version chain to the latest — but every other piece of metadata must be current.

Persisting a rotated root

If the repository has rotated its root since the copy you embedded, refresh() walks the version chain and trusts the newer one for that process — but the next process still starts from the old embedded root.json and has to walk the same chain again. Persist the latest trusted root after a successful refresh and load it next time instead of the embedded one:

Lower-level API

For advanced or fully offline use, TrustedMetadataSet is the verification core without any I/O: construct it with a trusted root and feed it metadata bytes (updateRoot(), updateTimestamp(), updateSnapshot(), updateTargets(), updateDelegatedTargets()) in workflow order. It applies exactly the checks listed above and exposes the verified Root, Timestamp, Snapshot and Targets value objects from K2gl\Tuf\Metadata.

Exceptions

Everything thrown implements K2gl\Tuf\Exception\TufException:

License

MIT — see LICENSE. An independent, clean-room implementation of the TUF specification.


All versions of tuf with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package k2gl/tuf contains the following files

Loading the files please wait ...