Commit graph

12 commits

Author SHA1 Message Date
Jussi Kukkonen
8071806e04 examples: Use the constructor default arguments
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-03-24 10:37:30 +02:00
Martin Vrachev
06118843ca Use spec version from tuf/api/metadata in examples
Replace the hardcoded specification version with the one defined inside
tuf/api/metadata.py

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-03-17 15:41:05 +02:00
lukpueh
31fd8d4f03
Merge pull request #1790 from lukpueh/rm-all
Rm all legacy
2022-02-04 14:01:53 +01:00
Lukas Puehringer
9816c40d77 doc: update deprecation info in repo_example docs
Rephrase deprecation info in repo_example modules doc headers
to reflect that the deprecation has happened.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-02-03 10:00:22 +01:00
Martin Vrachev
a2f7b4588f Fix new space warning by black
Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-02-01 12:29:50 +02:00
Martin Vrachev
e3b267e2e0 Remove OrderedDict in favor of python3.7+ dict
After we drop support for python3.6 we can relly that dictionaries
preserve the insertion order:
https://docs.python.org/3.7/whatsnew/3.7.html

This means we can replace the usage of OrderedDict with a standard
dictionaries.

Something we have to keep in mind is that even thought the insertion
order is preserved the equality comparison for normal dicts is
insensitive for normal dicts compared to OrderedDict

For example:
>>> OrderedDict([(1,1), (2,2)]) == OrderedDict([(2,2), (1,1)])
False
>>> dict([(1,1), (2,2)]) == dict([(2,2), (1,1)])
True

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-01-19 18:19:56 +02:00
Lukas Puehringer
ef388daa3a doc: clarify math in hash bin delegation example
Tries to clarify the introductory text in the hash bin delegation
example.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-12-10 10:13:42 +01:00
Lukas Puehringer
b8cf1c0e37 doc: annotate types in hash bin delegation example
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-12-03 10:49:57 +01:00
Lukas Puehringer
e90acfe123 doc: basic hash bin delegation repo example + test
As 'repository_tool' and 'repository_lib' are being deprecated,
hash bin delegation interfaces are no longer available in this
implementation. The example code in this file demonstrates how to
easily implement those interfaces, and how to use them together
with the TUF metadata API, to perform hash bin delegation.

Note, the hash bin delegation logic in this example is largely
copied from repository_{lib, tool}, and modernized and simplified
for this purpose.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-12-03 10:33:24 +01:00
Lukas Puehringer
caffc415d1 doc: use sentence case in all repo example titles
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-12-03 10:33:24 +01:00
Martin Vrachev
1ae6a22b8e Start linting the examples folder
The examples folder currently contains a repository example and it's
good if we start linting its content and as a result add type
annotations.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2021-12-02 13:40:14 +02:00
Lukas Puehringer
190c21b65b doc: add repository example based on metadata API
As 'repository_tool' and 'repository_lib' are being deprecated,
repository metadata must to be created and maintained manually
using the low-level Metadata API. The added example code shall
serve as temporary replacement until a new repository tool is
available.

The sample code contains the following repo workflows:
 - creation of top-level metadata
 - target file handling
 - consistent snapshots
 - key management
 - top-level delegation and signing thresholds
 - target delegation
 - in-band and out-of-band metadata signing
 - writing and reading metadata files
 - root key rotation

Co-authored-by: Teodora Sechkova <tsechkova@vmware.com>
Co-authored-by: Joshua Lock <jlock@vmware.com>
Co-authored-by: Jussi Kukkonen <jku@goto.fi>

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-11-29 13:25:10 +01:00