Skip to content

Commit b6fa05b

Browse files
committed
Revert "examples: support dsse in example client"
This reverts commit b279745. ... plus related changes from: "ngclient: change envelope type config to flag". Signed-off-by: Lukas Puehringer <[email protected]>
1 parent f5826c0 commit b6fa05b

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

examples/client/client

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ from pathlib import Path
1414
from urllib import request
1515

1616
from tuf.api.exceptions import DownloadError, RepositoryError
17-
from tuf.ngclient import Updater, UpdaterConfig
18-
from tuf.ngclient.config import EnvelopeType
17+
from tuf.ngclient import Updater
1918

2019
# constants
2120
DOWNLOAD_DIR = "./downloads"
2221
CLIENT_EXAMPLE_DIR = os.path.dirname(os.path.abspath(__file__))
2322

24-
2523
def build_metadata_dir(base_url: str) -> str:
2624
"""build a unique and reproducible directory name for the repository url"""
2725
name = sha256(base_url.encode()).hexdigest()[:8]
@@ -48,7 +46,7 @@ def init_tofu(base_url: str) -> bool:
4846
return True
4947

5048

51-
def download(base_url: str, target: str, use_dsse: bool) -> bool:
49+
def download(base_url: str, target: str) -> bool:
5250
"""
5351
Download the target file using ``ngclient`` Updater.
5452
@@ -74,16 +72,12 @@ def download(base_url: str, target: str, use_dsse: bool) -> bool:
7472
if not os.path.isdir(DOWNLOAD_DIR):
7573
os.mkdir(DOWNLOAD_DIR)
7674

77-
config = UpdaterConfig()
78-
config.envelope_type = EnvelopeType.SIMPLE
79-
8075
try:
8176
updater = Updater(
8277
metadata_dir=metadata_dir,
8378
metadata_base_url=f"{base_url}/metadata/",
8479
target_base_url=f"{base_url}/targets/",
8580
target_dir=DOWNLOAD_DIR,
86-
config=config,
8781
)
8882
updater.refresh()
8983

@@ -152,13 +146,6 @@ def main() -> None:
152146
help="Target file",
153147
)
154148

155-
download_parser.add_argument(
156-
"--use-dsse",
157-
help="Parse TUF metadata as DSSE",
158-
default=False,
159-
action="store_true",
160-
)
161-
162149
command_args = client_args.parse_args()
163150

164151
if command_args.verbose == 0:
@@ -177,9 +164,7 @@ def main() -> None:
177164
if not init_tofu(command_args.url):
178165
return "Failed to initialize local repository"
179166
elif command_args.sub_command == "download":
180-
if not download(
181-
command_args.url, command_args.target, command_args.use_dsse
182-
):
167+
if not download(command_args.url, command_args.target):
183168
return f"Failed to download {command_args.target}"
184169
else:
185170
client_args.print_help()

0 commit comments

Comments
 (0)