Initial commit: VoIdeaAI - voice-first AI idea assistant

This commit is contained in:
2026-05-13 12:51:42 +03:00
commit 688d043dad
421 changed files with 47915 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
"""Telegram ↔ VoIdea account linking."""
from __future__ import annotations
import secrets
from typing import Any
# In-memory store for link tokens (in production: Redis with TTL)
_link_tokens: dict[str, int] = {} # token → user_id
def create_link_token(user_id: int) -> str:
"""Generate a one-time token for linking Telegram to VoIdea account."""
token = secrets.token_urlsafe(32)
_link_tokens[token] = user_id
return token
def consume_link_token(token: str) -> int | None:
"""Validate and consume a link token. Returns user_id or None."""
user_id = _link_tokens.pop(token, None)
return user_id
def get_bot_link_url(base_url: str, token: str) -> str:
"""Return the URL for the user to confirm account linking."""
return f"{base_url}/bot/link?token={token}"