This commit is contained in:
Sergey Antropoff
2026-07-17 15:57:36 +03:00
commit e4240a7be5
72 changed files with 6227 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
from __future__ import annotations
import secrets
from datetime import datetime, timedelta, timezone
from app.services.client_ip import client_ip, request_meta
def new_wrap_id() -> str:
return secrets.token_urlsafe(18).replace("-", "").replace("_", "")[:24]
def expires_at_from_ttl(ttl_seconds: int) -> datetime:
return datetime.now(timezone.utc) + timedelta(seconds=ttl_seconds)
__all__ = ["client_ip", "request_meta", "new_wrap_id", "expires_at_from_ttl"]