12 lines
279 B
Python
12 lines
279 B
Python
import secrets
|
|
from datetime import timedelta
|
|
|
|
from django.utils import timezone
|
|
|
|
|
|
def generate_pre_auth_token(length: int = 64) -> str:
|
|
return secrets.token_hex(length // 2)
|
|
|
|
|
|
def get_pre_auth_expiry(minutes: int = 5):
|
|
return timezone.now() + timedelta(minutes=minutes)
|