feat(auth): Add python script to create new api keys

This commit is contained in:
Björn Benouarets
2026-02-09 07:40:11 +01:00
parent 9f3177bf5b
commit 216b7eb1f0
2 changed files with 24 additions and 0 deletions

20
cmd/api-key.py Normal file
View File

@@ -0,0 +1,20 @@
import secrets
import uuid
import base64
from argon2 import PasswordHasher
new_secret = secrets.token_hex(32)
print(new_secret)
ph = PasswordHasher()
hashed_secret = ph.hash(new_secret)
new_id = uuid.uuid4()
plain_secret = f"{new_id}:{new_secret}"
base64_secret = base64.b64encode(plain_secret.encode()).decode()
print(f"Secret: {base64_secret}")
print(f"ID: {new_id}")
print(f"Hashed Secret: {hashed_secret}")
print(f"X-Api-Key: {base64_secret}")