2021-11-29 13:21:17 +00:00
|
|
|
# TUF Client Example
|
2021-11-16 07:42:21 +00:00
|
|
|
|
|
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
TUF Client Example, using ``python-tuf``.
|
2021-11-16 07:42:21 +00:00
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
This TUF Client Example implements the following actions:
|
2021-11-22 10:27:28 +00:00
|
|
|
- Client Infrastructure Initialization
|
|
|
|
|
- Download target files from TUF Repository
|
2021-11-16 07:42:21 +00:00
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
The example client expects to find a TUF repository running on localhost. We
|
|
|
|
|
can use the static metadata files in ``tests/repository_data/repository``
|
|
|
|
|
to set one up.
|
2021-11-16 07:42:21 +00:00
|
|
|
|
|
|
|
|
Run the repository using the Python3 built-in HTTP module, and keep this
|
|
|
|
|
session running.
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
$ python3 -m http.server -d tests/repository_data/repository
|
|
|
|
|
Serving HTTP on :: port 8000 (http://[::]:8000/) ...
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
How to use the TUF Client Example to download a target file.
|
2021-11-16 07:42:21 +00:00
|
|
|
|
2021-11-29 13:21:17 +00:00
|
|
|
```console
|
|
|
|
|
$ ./client_example.py download file1.txt
|
|
|
|
|
```
|