server-tx part : web UI, PDF generator & transfer to RX server

This commit is contained in:
2025-05-15 14:34:08 +03:00
parent d969addd18
commit e1780fad99
32 changed files with 1272 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import bcrypt
from secrets import token_hex
_ENCODING = "utf-8"
def hashPassword(
pswd : str,
salt : str
) -> str:
return bcrypt.hashpw(
pswd.encode(encoding=_ENCODING),
salt.encode(encoding=_ENCODING)
).decode(encoding=_ENCODING)
def getSalt() -> str:
return bcrypt.gensalt().decode(encoding=_ENCODING)
def isValid(
pswd : str,
salt : str,
hash : str
) -> bool:
hashed = hashPassword(pswd, salt)
return (hash.__eq__(hashed))
def genToken():
return token_hex(32)