Developer docs

2. Authentication

On this page
SendCode(identifier)              -> code_hash          identifier = E.164 phone or email
SignIn(identifier, code_hash, code)
   ├─ user + token                                      done
   ├─ signup_required + signup_token -> SignUp(signup_token, first_name, last_name)
   └─ password_required + password_token -> CheckPassword(password_token, password)
ImportBotAuthorization(bot_token)  -> token             bots
  • The token is the only credential of a session (“device”). Store it in the OS key store (Keychain, Android Keystore, DPAPI, libsecret). Send it in ClientHello.token (WS) or Authorization: Bearer (HTTP).
  • AuthService/GetSessions lists devices; TerminateSession revokes one. A revoked session receives Update.session_revoked and every subsequent call fails with 401 SESSION_REVOKED.
  • QR login: the new device calls ExportLoginToken, renders televo://login?token=<token> as a QR code and polls PollLoginToken every 2 s; an already logged-in device scans it and calls AcceptLoginToken.
  • Development servers (TELEVO_DEV=1) accept identifiers +999XXXXXX with code 12345.

2.3 Phone-free login

AuthService/GetLoginOptions (public) tells a client what the server offers, so it never shows a path that can’t work:

namemeaning
phone_code, email_codeSendCode can deliver codes of that kind (a provider is configured)
passwordin signup_methods: password sign-up without a verified identifier; in login_methods: password accounts can log in
qrQR login (ExportLoginToken)

Unknown names are ignored. Servers without the RPC (METHOD_NOT_FOUND) offer codes only.

Password accounts (server flag TELEVO_SIGNUP_UNVERIFIED, SECURITY.md §10.8):

SignUpWithPassword(identifier, password, first_name, last_name) -> AuthResult (token)
SignInWithPassword(identifier, password)                        -> AuthResult (token)
  • identifier: an email, or @username (a bare name without @ is a username too; 4..32 of [A-Za-z0-9_], starting with a letter). Emails are case-insensitive.
  • Errors: SIGNUP_METHOD_UNAVAILABLE (403, flag off), PASSWORD_TOO_SHORT, PASSWORD_TOO_LONG, PASSWORD_TOO_COMMON, EMAIL_INVALID, EMAIL_DOMAIN_BLOCKED, USERNAME_INVALID (400), EMAIL_OCCUPIED, USERNAME_OCCUPIED (409), SIGNUP_DAILY_LIMIT (420, retry_after = until the next UTC day), CAPTCHA_REQUIRED (§21.1). Login: PASSWORD_HASH_INVALID for a wrong identifier or password, FLOOD_WAIT while locked out after repeated failures.
  • The email of a password account is unverified: it never receives or accepts login codes, is not used for recovery or contact discovery, and is detached if its real owner proves it. GetLoginMethods lists it with verified = false.
  • Password login keeps working when the flag is turned off; only sign-up stops.

AuthService/GetLoginMethods (authenticated) lists the account’s login methods (LoginMethod: phone, email, password, …; verified, display), has_password and has_recovery_code.

Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.