python-tuf/examples/client
Lukas Puehringer 1897f9a652 ngclient: change envelope type config to flag
The flag allows adding other envelope types in the future (unlikely),
or parallel support (`METADATA & SIMPLE`) without breaking the API.

Internally, the flag is now just passed on to TrustedMetadataSet as
mandatory parameter. (Optional parameters make less sense when we
control all the invocations.)

This change requires updating all invocations of TrustedMetadataSet,
including the duplication of a test function.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2024-02-21 16:59:55 +01:00
..
client ngclient: change envelope type config to flag 2024-02-21 16:59:55 +01:00
README.md examples: Rename client example directory 2023-02-02 16:25:47 +02:00

TUF Client Example

TUF Client Example, using python-tuf.

This TUF Client Example implements the following actions:

  • Client Initialization
  • Target file download

The client can be used against any TUF repository that serves metadata and targets under the same URL (in /metadata/ and /targets/ directories, respectively). The used TUF repository can be set with --url (default repository is "http://127.0.0.1:8001" which is also the default for the repository example).

Usage with the repository example

In one terminal, run the repository example and leave it running:

examples/repository/repo

In another terminal, run the client:

# initialize the client with Trust-On-First-Use
./client tofu

# Then download example files from the repository:
./client download file1.txt

Note that unlike normal repositories, the example repository only exists in memory and is re-generated from scratch at every startup: This means your client needs to run tofu every time you restart the repository application.

Usage with a repository on the internet

# On first use only, initialize the client with Trust-On-First-Use
./client --url https://jku.github.io/tuf-demo tofu

# Then download example files from the repository:
./client --url https://jku.github.io/tuf-demo download demo/succinctly-delegated-1.txt