feat(auth): Add python script to create new api keys
This commit is contained in:
20
cmd/api-key.py
Normal file
20
cmd/api-key.py
Normal 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}")
|
||||
@@ -1,6 +1,7 @@
|
||||
gateway:
|
||||
host: "0.0.0.0"
|
||||
port: 8080
|
||||
debug: false
|
||||
features:
|
||||
- host
|
||||
- request_id
|
||||
@@ -40,6 +41,9 @@ routes:
|
||||
path:
|
||||
include: []
|
||||
exclude: []
|
||||
keys:
|
||||
- id: "a6f07c4f-e8d5-42e1-8bf0-9085849d8265"
|
||||
key: "$argon2id$v=19$m=65536,t=3,p=4$zSzQSUc4ZOLmuG+kMEjWSQ$L28wMpBN3SusY+npHwfGOVKv3jkmSIbMMGaxngJ7tD0"
|
||||
waf:
|
||||
enabled: true
|
||||
methods: ["GET", "POST"]
|
||||
|
||||
Reference in New Issue
Block a user