Eerste commit voor rename-mvp

This commit is contained in:
kodi
2026-03-07 09:59:27 +01:00
commit 27cee7395f
12 changed files with 510 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import base64
import json
from datetime import datetime, timezone
def decode_jwt_payload(token: str) -> dict:
parts = token.split(".")
if len(parts) != 3:
raise ValueError("Invalid JWT format")
payload_b64 = parts[1]
padding = "=" * (-len(payload_b64) % 4)
raw = base64.urlsafe_b64decode(payload_b64 + padding)
return json.loads(raw.decode("utf-8"))
def unix_to_iso_utc(value: int | None) -> str | None:
if value is None:
return None
return datetime.fromtimestamp(value, tz=timezone.utc).isoformat()
def now_utc_ts() -> int:
return int(datetime.now(tz=timezone.utc).timestamp())