| 1 |
# TUF Client Example |
| 2 |
|
| 3 |
|
| 4 |
TUF Client Example, using ``python-tuf``. |
| 5 |
|
| 6 |
This TUF Client Example implements the following actions: |
| 7 |
- Client Initialization |
| 8 |
- Target file download |
| 9 |
|
| 10 |
The client can be used against any TUF repository that serves metadata and |
| 11 |
targets under the same URL (in _/metadata/_ and _/targets/_ directories, respectively). The |
| 12 |
used TUF repository can be set with `--url` (default repository is "http://127.0.0.1:8001" |
| 13 |
which is also the default for the repository example). |
| 14 |
|
| 15 |
|
| 16 |
### Usage with the repository example |
| 17 |
|
| 18 |
In one terminal, run the repository example and leave it running: |
| 19 |
```console |
| 20 |
examples/repository/repo |
| 21 |
``` |
| 22 |
|
| 23 |
In another terminal, run the client: |
| 24 |
|
| 25 |
```console |
| 26 |
# initialize the client with Trust-On-First-Use |
| 27 |
./client tofu |
| 28 |
|
| 29 |
# Then download example files from the repository: |
| 30 |
./client download file1.txt |
| 31 |
``` |
| 32 |
|
| 33 |
Note that unlike normal repositories, the example repository only exists in |
| 34 |
memory and is re-generated from scratch at every startup: This means your |
| 35 |
client needs to run `tofu` every time you restart the repository application. |
| 36 |
|
| 37 |
|
| 38 |
### Usage with a repository on the internet |
| 39 |
|
| 40 |
```console |
| 41 |
# On first use only, initialize the client with Trust-On-First-Use |
| 42 |
./client --url https://jku.github.io/tuf-demo tofu |
| 43 |
|
| 44 |
# Then download example files from the repository: |
| 45 |
./client --url https://jku.github.io/tuf-demo download demo/succinctly-delegated-1.txt |
| 46 |
``` |