feat: Telegram QR-login via gramjs (per-player MTProto session)

Cerrado
#374 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #375 de @bitcoinbrisbane — cerrado sin fusionar

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
typescript

Línea de trabajo

Start in the player settings flow and review the gramjs integration, including its StoreSession IndexedDB persistence and the QR login sequence. Verify the POST /bindings call to the broker and test the stated outcomes: QR login, reload persistence, tg_user_id binding, and idempotent re-linking.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

idea fairy

FE counterpart for block52/poker-vm#1492. Tracking on this side; the broker-side issue poker-vm#2124 remains open for the cross-repo coordination thread.

Blocks: poker-vm#2125 (Phase 2b seat invite/kick — needs real `tg_user_id`s coming in from gramjs sessions, no manual stopgap by design).

Scope

  • Add gramjs (lazy-loaded — bundle is hefty).
  • New ``Link Telegram'' flow in player settings:
    1. Call `auth.exportLoginToken` → get token
    2. Render `tg://login?token=` as a QR code
    3. User scans on phone Telegram, confirms
    4. Poll / receive `auth.loginToken*` updates, end up with an authorized MTProto session
    5. Persist session in IndexedDB via gramjs `StoreSession`, keyed by the player's wallet address
    6. Handle 2FA password step (gramjs native)
  • After successful login, FE calls `POST /bindings { wallet_address, tg_user_id }` on the broker so seat plumbing can resolve the user later.

Out of scope

  • Chat panel UI (sending/receiving messages in the table view) — separate issue, later
  • Unlink / multi-device polish — Phase 4 of poker-vm#1492

Definition of done

  1. `Link Telegram` button in player settings opens a QR.
  2. Scanning the QR with phone Telegram completes login.
  3. Session persists across page reloads (no re-prompt).
  4. `tg_user_id` is POSTed to the broker and a binding row is created.
  5. Re-linking from a different device works (idempotent on `wallet_address`).

Risks

  • `api_id` / `api_hash` in the bundle. These are user-application creds; they end up shipped. Telegram is OK with this (it's how telegram.org/k works) but the keys belong to us and rate-limit us. Register a dedicated FE app at https://my.telegram.org (separate from the broker's app).
  • Bundle size. gramjs is ~hundreds of KB. Must be lazy-loaded on settings-panel open, not on app boot.
  • 2FA UX. Standard pain — needs a clean re-prompt flow on lost-device.

Refs: poker-vm#1492, poker-vm#2124.

Lenguaje dominante
TypeScript
Estrellas
2
Forks
5
Merge medio
22 h 35 min
PR fusionados (30 d)
91

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de block52/ui

Todos los issues de block52/ui

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.