feat: add authentik jwt verification and me endpoints
This commit is contained in:
29
scripts/generate_api_key_hash.py
Executable file
29
scripts/generate_api_key_hash.py
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import hashlib
|
||||
|
||||
from passlib.context import CryptContext
|
||||
|
||||
pwd_context = CryptContext(schemes=["argon2", "bcrypt"], deprecated="auto")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Generate API key hash for api_clients table")
|
||||
parser.add_argument("api_key", help="Plain API key")
|
||||
parser.add_argument(
|
||||
"--algo",
|
||||
choices=["argon2", "bcrypt", "sha256"],
|
||||
default="argon2",
|
||||
help="Hash algorithm (default: argon2)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.algo == "sha256":
|
||||
print("sha256:" + hashlib.sha256(args.api_key.encode("utf-8")).hexdigest())
|
||||
return
|
||||
|
||||
print(pwd_context.hash(args.api_key, scheme=args.algo))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user