This is the ceema library, which provides a C++ implementation of the Threema communication protocol (and, in the future, a C interface to it). The aim is to provide a somewhat simple interface to hook the Threema protocol in client applications such as multi-protocol IM clients.
If you are looking for a ready-to-use desktop application, consider openMittsu.
Since this is CMake based, building the library consists of the following steps
git submodule init
git submodule sync
git submodule update --init --recursive
mkdir build && cd build
cmake ../
make
This library requires the following dependencies to be installed (both headers and libraries):
curl
jsoncpp
openssl
sodium
Under src
you will find:
client
: Structures for dealing with clients/contact. The primary class is
Client
, and a utility class ContactStore
encoding
: Some utilities for massaging data (hashing, padding, ...)logging
: What it says on the tinprotocol
: Main protocol handling. Goes from packets, to messages, to
payloadssocket
: Low-level network interfacetypes
: Type definitions used throughout the libraryThe protocol is fairly straightforward. First, a client-server handshake is performed to set-up the encryption (using sodium/NaCl). This is handled by the Session class. Next, the client and server will communicate in (encrypted) packets as follows:
The Threema client allows for backup of the private key and client ID using a backup string. Its is a base32 encoded string consisting of a salt and the encrypted data. The salt and password generate a hash which can be used to decrypt the data, which will yield the client ID, private key, and 2 bytes of the SHA-256 hash of both which can be used to validate the decryption.
For importing users and groups from a backup, use menu Accounts->Threema->Import from Backup
Users have to be added manually via the Add Buddy
menu in Pidgin.
When online with Pidgin while the administrator of a group creates or updates a group, this group is automatically created/updated by the plugin. However, this does not work if you are the administrator since it is not possible to be online with the same account on two devices.
A workaraound for this and in case that you want to add a group that already exists and is not updated by the administrator, you can enter the relevant data in Pidgin's configuration file blist.xml
. This file is located at ~/.purple/blist.xml
. The syntax for a group entry in the buddy list is the following:
<chat proto='prpl-threepl' account='MACCOUNT'>
<alias>Alias</alias>
<component name='id'>GROUP-ID-Hex-16digits</component>
<component name='owner'>OACCOUNT</component>
<setting name='name' type='string'>Group Name</setting>
<setting name='members' type='string'>MEMBER01MEMBER02...MEMBERxx</setting>
</chat>