From 6709b91d35c65e3545f4a63ce1036e753c890a94 Mon Sep 17 00:00:00 2001 From: Kierre Date: Tue, 7 Oct 2025 00:23:52 -0400 Subject: [PATCH] List utils, fix makekey --- vona/utils/__main__.py | 10 ++++++++++ vona/utils/makekey.py | 20 ++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 vona/utils/__main__.py diff --git a/vona/utils/__main__.py b/vona/utils/__main__.py new file mode 100644 index 0000000..aa2a3ed --- /dev/null +++ b/vona/utils/__main__.py @@ -0,0 +1,10 @@ +print("Available utils:") + +a = [ + "makekey" +] + +for t in a: + print(f"\t{t}") + +print("") \ No newline at end of file diff --git a/vona/utils/makekey.py b/vona/utils/makekey.py index c66fe69..13a13d0 100644 --- a/vona/utils/makekey.py +++ b/vona/utils/makekey.py @@ -3,7 +3,23 @@ import base64 import os -key = base64.b64encode(os.urandom(32)).decode("utf-8")[:43].replace("/", "_") -key_id = base64.b64encode(os.urandom(32)).decode("utf-8")[:6].replace("/", "_") + +def mkchar() -> str: + return os.urandom(4).hex()[:1] + + +key = ( + base64.b64encode(os.urandom(32)) + .decode("utf-8")[:43] + .replace("/", mkchar()) + .replace("+", mkchar()) +) + +key_id = ( + base64.b64encode(os.urandom(32)) + .decode("utf-8")[:6] + .replace("/", mkchar()) + .replace("+", mkchar()) +) print(f"ed25519 {key_id} {key}")