Add initial shared code packages

This commit is contained in:
Gabriel20xx committed 2026-08-04 15:17:15 +02:00
commit 838a97d344
54 files changed
+6265

No files matched your search

@@ -0,0 +1,15 @@
"""Opaque session-token generation and storage hashing."""
from __future__ import annotations
import hashlib
import secrets
def new_session_token() -> tuple[str, str]:
token = secrets.token_urlsafe(32)
return token, hash_token(token)
def hash_token(token: str) -> str:
return hashlib.sha256(token.encode("utf-8")).hexdigest()