#threema #client #api #transport #protocols #account #messaging

bin+lib threema-client

WIP inofficial threema client implementation and tools

1 unstable release

0.1.0 Sep 27, 2021

#4 in #threema

AGPL-3.0-only

52KB
1K SLoC

Inofficial Rust Implementation of the Threema Protocols

This will be a library and tools for the Threema Messaging APIs, to make the service compatible with non mobile phone users (e.g. as desktop app, or bridge to Matrix or XMPP). For account registration, the official mobile app or a license purchased in the Threema Store is needed. Please do not abuse this as a replacement for their paid Threema Gateway service.

work in progress.

  • split main to library and example(s)
  • account import
    • threema safe
    • id backup
    • convert standalone binaries to library
  • basic threema transport
    • login
    • receive/send frames
    • decode/encode boxed messages
  • connection agent
    • reconnect when connection dies
    • keep alive echos
    • receive event stream
    • send messages
      • process ack
      • keep message while connection is down
  • directory API
    • lookup public key (identity/<ID>)
    • identity/fetch_bulk
    • registration (POC DONE in python)
    • own account information identity/fetch_priv
    • link email / phone
    • search contacts
    • feature masks
    • revocation
    • ...
  • blob API
  • streaming support to reduce memory and provide progress
  • VOIP signaling: It would be nice to bridge arbitrary webrtc offers/responses, to bridge it to any other network that uses webrtc.
  • publish crate, when usable
  • publish rustoc
  • De-tokio-ize the threema protocol transport (make it usable without massive dependencies and from synchronous code)

Thanks

Usage

When ready, this will be a rust library crate threema_client and API doc will be there. Also the bunch of experimental binaries can be used.

Currentliy, accounts are saved plaintext json and can be generated with the register/load programs.

Examples / Binaries:

  • creating account JSONs:
    • register.py Use a license key to register an identity
    • load_safe: Download and decrypt Threema-Safe Backup
    • load_idbackup: Decrypt ID-Backup
  • blobs:
    • getblob get (and optionally delete) a Blob
    • putblob upload a Blob
  • connect: frequently changing test program: connect to account and print messages
  • planned: chatwith: commandline chat with a single peer / group

License

As I heavily looked into Threema for Android, this protocol port is licensed under the GNU Affero General Public License v3 aswell.

Threema Protocol Library
Copyright (C) 2021 thejonny

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Dependencies

~30–46MB
~495K SLoC