mirror of
https://github.com/revanced/revanced-releases-api.git
synced 2025-05-02 15:14:27 +02:00

* refactor: import routers from old branch * refactor: import InternalCache removal * refactor: move routes into dedicated routers * fix: fixes entrypoint * refactor: add documentation and bump libs
30 lines
657 B
Python
30 lines
657 B
Python
import time
|
|
import uuid
|
|
import secrets
|
|
|
|
class Generators:
|
|
"""Generates UUIDs and secrets"""
|
|
|
|
async def generate_secret(self) -> str:
|
|
"""Generate a random secret
|
|
|
|
Returns:
|
|
str: A random secret
|
|
"""
|
|
return secrets.token_urlsafe(32)
|
|
|
|
async def generate_id(self) -> str:
|
|
"""Generate a random UUID
|
|
|
|
Returns:
|
|
str: A random UUID (str instead of UUID object)
|
|
"""
|
|
return str(uuid.uuid4())
|
|
|
|
async def generate_timestamp(self) -> int:
|
|
"""Generate a timestamp
|
|
|
|
Returns:
|
|
int: A timestamp
|
|
"""
|
|
return int(time.time()) |