Telegram client
Go to file
Emery Hemingway 20b9bb37fd Sorta works 2024-05-21 13:57:01 +02:00
src Sorta works 2024-05-21 13:57:01 +02:00
.envrc Sorta works 2024-05-21 13:57:01 +02:00
.gitignore Sorta works 2024-05-21 13:57:01 +02:00
README.md Sorta works 2024-05-21 13:57:01 +02:00
Tupfile Sorta works 2024-05-21 13:57:01 +02:00
Tuprules.tup Sorta works 2024-05-21 13:57:01 +02:00
config.prs Sorta works 2024-05-21 13:57:01 +02:00
default.nix Sorta works 2024-05-21 13:57:01 +02:00
lock.json Sorta works 2024-05-21 13:57:01 +02:00
telegram_actor.nimble Sorta works 2024-05-21 13:57:01 +02:00

README.md

telegram_actor

A proxy for communicating with TDLib over Syndicate using the JSON-serialized object API.

Do not use Telegram.

It is unsafe as it does not have end-to-end encryption enabled by default for one to one messaging, and it does not have end-to-end-encryption at all for group messaging. It has received a great deal of scrutiny for various design choices including extremely strange cryptographic choices that are suspected of being intentional weaknesses but no smoking gun has been reported.

Of note is that some prominent self-identified members of the Internet Freedom social milieu in the United States of America are extremely hostile to Telegram. Usually these critics are strong proponents of Signal and often their criticism appears technically sound.

Example config

#!/usr/bin/env -S syndicate-server --config

<require-service <daemon telegram_actor>>

<daemon telegram_actor {
  argv: [ "/bin/telegram_actor" ]
  restart: never
  protocol: application/syndicate
}>

let ?ds = dataspace

? <service-object <daemon telegram_actor> ?cap> [
  $cap <telegram-client { dataspace: $ds }>
]

$ds [
  ?? <send ?v> [ $log ! <log "-" { |>>>|: $v }> ]
  ?? <recv ?v> [ $log ! <log "-" { |<<<|: $v }> ]
  ? ?v [ $log ! <log "-" { assertion: $v }> ]
  ? <telegram-ready> [
    ! <send {"@type": "getOption", "name":"version"}>

    ?? <recv {"@type": "updateAuthorizationState", "authorization_state": {"@type": "authorizationStateWaitTdlibParameters"}}> [
      ! <send {
        "@type":"setTdlibParameters"
        "database_directory":"tdlib"
        "use_message_database":true
        "use_secret_chats":true
        "api_id": $api_id
        "api_hash": $api_hash
        "system_language_code":"en"
        "device_model":"Desktop"
        "application_version":"1.0"
      }>
    ]

    ?? <recv {"@type": "updateAuthorizationState", "authorization_state": {"@type": "authorizationStateWaitPhoneNumber"}}> [
      ! <send {
        "@type":"setAuthenticationPhoneNumber"
        "phone_number": $phone_number
      }>
    ]

    ?? <recv {"@type": "updateAuthorizationState", "authorization_state": {"@type": "authorizationStateWaitCode"}}> [
      ! <send {
        "@type":"checkAuthenticationCode"
        "code": $login_code
      }>

    ]

  ]
]