Developer docs
21. Automated accounts: CAPTCHA, client registration, attestation (for client developers)
On this page
Telvoro’s protocol is open: anyone may write a client, and the official client is open source too. So nothing here relies on a client keeping a secret. The server decides everything from what it can observe. The rules below are public; the risk-score weights and thresholds are server config (SECURITY.md §10).
What a third-party client must do:
- Handle
403 CAPTCHA_REQUIRED(§21.1). Without that, sign-up and some bulk actions fail from risky networks. - Optionally register an
api_idand send it inClientHello(§21.2). Unregistered clients work, at the lowest budget tier. - Optionally attest the device (§21.3). This only matters for builds that can attest (Play-signed Android, App Store iOS); everyone else just skips it.
21.1 CAPTCHA_REQUIRED
When a request’s risk is high, the server answers 403 CAPTCHA_REQUIRED with
Error.captcha = CaptchaChallenge{id, url, action, expires_at, provider}. Actions that can
be challenged:
action | Request | Binding |
|---|---|---|
send_code | AuthService/SendCode | the identifier (phone / e-mail) |
sign_in | AuthService/SignIn | the identifier |
message_strangers | the first message to a new cold peer (§8.1 PEER_FLOOD peers) | the session |
join_chats | JoinChat, JoinByInvite | the session |
create_chats | CreateGroup, CreateChannel | the session |
create_bots | BotsService/CreateBot | the session |
Flow:
- Open
urlin a browser or an in-app web view. Addredirect_uri(and optionallylang, a BCP-47 tag) as query parameters if you want the token handed back automatically:https://<host>/v1/challenge/<id>?redirect_uri=myclient%3A%2F%2Fcaptcha.redirect_urimust be a custom scheme (myclient://…) or a loopback URL (http://127.0.0.1:<port>/…,http://localhost:<port>/…); web origins are ignored. - The page shows the operator’s CAPTCHA widget (CaptchaLa, Cloudflare Turnstile or hCaptcha). The server verifies the widget’s answer with the provider, server-side.
- On success the page yields a captcha token in every way it can:
- redirect to
<redirect_uri>?challenge_id=<id>&captcha_token=<token>; window.TelevoCaptcha.postMessage(json)if the host injected that JavaScript channel (Flutter webview_flutter, AndroidaddJavascriptInterface, WKWebView message handler);window.opener.postMessage(msg, '*')/window.parent.postMessage(msg, '*')withmsg = {type: "televo-captcha", challenge_id, captcha_token};- the token is shown on the page for copy and paste (CLI and desktop clients).
- redirect to
- Repeat the original request unchanged, with the token in
RpcRequest.captcha_token(WebSocket / QUIC) or theX-Televo-Captcha-Tokenheader (HTTP / Connect).
Token rules: single use; valid for TELEVO_CAPTCHA_TOKEN_TTL (default 5 min) after solving;
only for the challenge’s action and binding (the same identifier, or the same session).
A token that is used, expired, or for another action or binding gets a fresh
CAPTCHA_REQUIRED whose message says the token was invalid. A page has at most 5
verification attempts and expires at expires_at (default 10 min); after that, repeat the
request for a new challenge. Once solved, the same action family (send_code+sign_in,
or one bulk action) is not challenged again for the same binding for
TELEVO_CAPTCHA_CLEARANCE (default 1 h). Budgets still apply.
Page endpoints (for clients that render their own UI around them): GET /v1/challenge/{id}
is the HTML page; POST /v1/challenge/{id} with {"response": "<provider token>"} answers
{"captcha_token", "expires_at", "challenge_id"}, or {"error": "CAPTCHA_INVALID"} (400),
"CHALLENGE_NOT_FOUND" (404, solved / expired / out of attempts) or
"CAPTCHA_UNAVAILABLE" (503, provider outage).
Client behaviour: solve one challenge at a time, give up after a few rounds, and never loop
silently. A user who closes the page gets the error. The Dart SDK does this with
TelevoTransport.captchaSolver (up to 3 rounds per request). Servers without a configured
provider never send CAPTCHA_REQUIRED; risk then only lowers budgets.
21.2 Client registration (api_id)
ClientsService/RegisterApp{title, short_name, url, platform, description} (any account,
5 apps each) returns ClientApp{api_id, …}. Send the id as ClientHello.api_id (HTTP:
X-Televo-Api-Id). ClientsService/GetMyApps lists yours. api_id 1 is the official
Telvoro client.
An api_id is a public label, not a credential: anyone can send anyone’s id, and there is
no api_hash. What it buys:
| Tier | Budget multiplier (§8.1 budgets, PEER_FLOOD cap) | Risk points |
|---|---|---|
unregistered (api_id 0 or unknown) | x0.5 | +15 |
| registered, active | x1 | 0 |
| registered, throttled by the operator | x0.25, plus a shared request cap for the whole app | +25 |
| attested (§21.3, any api_id) | x2 | -10 / -25 / -35 (basic / device / strong) |
Then the risk score halves the result at 50 and quarters it at 75 (minimum x1/8).
An operator can block an api_id: every request that carries it, logged in or not,
fails with 403 API_ID_BLOCKED. The same account keeps working from other clients. The
admin console shows per-api_id daily calls, errors, blocked calls, sessions, sign-ups,
challenges issued and solved, and attestations.
21.3 Optional device attestation
Attestation is the only trust signal an open-source fork cannot copy: a fork can send the
official api_id and client_name, but it cannot produce a Play Integrity verdict for
the official signing certificate or an App Attest key for the official App ID.
IntegrityService/GetAttestChallenge→{challenge, expires_at}(single use, 5 min).IntegrityService/Attest{platform, challenge, …}:- Play Integrity (
ATTEST_PLATFORM_PLAY_INTEGRITY):client_datais a JSON string with"challenge"set; call the standard request withrequestHash = base64(SHA-256(client_data))(standard alphabet, no padding) and send the token asplay_integrity_token. The server decodes it through Google’s API and checks request hash, package name,PLAY_RECOGNIZED, signing certificate, freshness (10 min) and the device verdict (MEETS_STRONG/DEVICE/BASIC_INTEGRITY→ strong / device / basic). - App Attest (
ATTEST_PLATFORM_APP_ATTEST), first time on an install:key_id+attestation_objectfromattestKey(keyId, clientDataHash: SHA-256(challenge)). Later:key_id+assertionfromgenerateAssertion(keyId, SHA-256(client_data))withclient_dataa JSON string with"challenge"set. Production App Attest = device level.
- Play Integrity (
AttestResponse{trust_token, expires_at, level}: the current connection and (if logged in) session are upgraded at once. Sendtrust_tokenasClientHello.attestation_token(HTTP:X-Televo-Attestation) on later connections, e.g. before sign-up. A session created on an attested connection stays attested untilexpires_at(default 24 h); re-attest about twice a day. One trust token vouches for at most 3 new accounts.
Failures: ATTESTATION_INVALID (rejected verdict, wrong package/App ID, replay),
ATTEST_CHALLENGE_INVALID (unknown, used or expired challenge), ATTESTATION_UNSUPPORTED
(the server has no verifier for that platform), ATTESTATION_UNAVAILABLE (Google’s API
is down). None of them restrict anything: the client just stays unattested.
21.4 What the server looks at (summary)
Network (hosting ASN or range, operator-flagged ASNs), phone (operator risky prefixes, an optional VoIP/line-type lookup), sign-up velocity per IP / network / phone prefix / device fingerprint, client tier and attestation, and account behaviour: send cadence regularity, the share of messages to strangers, forward-only sending, join/leave churn, and identical name patterns on one network. The score lowers budgets, triggers §21.1, and only for strong behaviour signals (score ≥ 90 with at least two behaviour signals) limits an account for 7 days, queued for operator review. There are no automatic bans. Accounts registered together (same IP within an hour, same network and device fingerprint, the same attested device key, the same name pattern on one network, or behaviour flags on one network) are flagged as a cluster for operator review with bulk actions. Clusters change nothing by themselves.
Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.