secrets/generate-private-key: just create parent opportunistically
All checks were successful
checks-impure / test (pull_request) Successful in 1m30s
checks / test (pull_request) Successful in 2m2s

This commit is contained in:
Jörg Thalheim 2023-11-16 13:19:12 +01:00
parent 2f870d2c83
commit 978d9efd7e

View File

@ -10,8 +10,7 @@ def generate_key() -> str:
if path.exists():
raise ClanError(f"Key already exists at {path}")
priv_key, pub_key = generate_private_key()
if not (parent := path.parent).exists():
parent.mkdir(parents=True, exist_ok=True)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(priv_key)
return pub_key