mirror of
https://github.com/michivonah/bbzw-horizon.git
synced 2025-12-22 17:16:27 +01:00
implement token generation endpoint
This commit is contained in:
parent
7f24ba04da
commit
b1d7363e81
6 changed files with 64 additions and 8 deletions
11
webservice/crypto.py
Normal file
11
webservice/crypto.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# crypto.py
|
||||
import hashlib
|
||||
import secrets
|
||||
|
||||
def hash_password(password: str) -> str:
|
||||
"""Generiert einen SHA-256 Hash des gegebenen Passworts."""
|
||||
return hashlib.sha256(password.encode()).hexdigest()
|
||||
|
||||
def generate_new_token(length: int = 32) -> str:
|
||||
"""Generiert einen neuen sicheren Token."""
|
||||
return secrets.token_hex(length) # Erzeugt einen sicheren Token
|
||||
Loading…
Add table
Add a link
Reference in a new issue