age: generate private and public key in one go

This commit is contained in:
Jörg Thalheim
2023-09-19 19:19:18 +02:00
committed by lassulus
parent 521f4ee5bc
commit 486ff4e7f4
2 changed files with 21 additions and 6 deletions

View File

@@ -9,8 +9,8 @@ def generate_key() -> str:
path = default_sops_key_path()
if path.exists():
raise ClanError(f"Key already exists at {path}")
generate_private_key(path)
pub_key = get_public_key(path.read_text())
priv_key, pub_key = generate_private_key()
path.write_text(priv_key)
return pub_key