distributed protocol for telephony and instant messaging
Source code
Tox is a peer to peer (serverless) instant messenger aimed at making security and privacy easy to obtain for regular users. It uses libsodium (based on NaCl) for its encryption and authentication. The underlying crypto library libsodium provides reliable encryption, but the security model has not yet been fully specified. See issue 210 for a discussion on developing a threat model. See other issues for known weaknesses (e.g. issue 426 describes what can happen if your secret key is stolen). The roadmap and changelog are generated from GitHub issues. You may view them on the website, where they are updated at least once every 24 hours: Changelog: Roadmap: Be advised that due to the addition of cmp as a submodule, you now also need to initialize the git submodules required by toxcore. This can be done by cloning the repo with the following command: git clone --recurse-submodules or by running git submodule update --init in the root directory of the repo. If you have libvpx and opus installed, the above will also build the A/V library for multimedia chats. The simplest "hello world" example could be an echo bot. Here we will walk through the implementation of a simple bot. All toxcore API functions work with error parameters. They are enums with one OK value and several error codes that describe the different situations in which the function might fail. Here, we simply exit the program, but in a real client you will probably want to do some error handling and proper error reporting to the user. The NULL argument given to the first parameter of tox new is the Tox Options . It contains various write-once network settings and allows you to load a previously serialised instance. See toxcore/tox.h for details. Here, we will set up callbacks for receiving friend requests and receiving messages. We will always accept any friend request (because we're a bot), and when we receive a message, we send it back to the sender. These two function calls set up the callbacks. Now we also need to implement these "handle" functions. The tox friend add norequest function adds the friend without sending them a friend request. Since we already got a friend request, this is the right thing to do. If you wanted to send a friend request yourself, you would use tox friend add , which has an extra parameter for the message. That's it for the setup. Now we want to actually run the bot. Toxcore works with a main event loop function tox iterate that you need to call at a certain frequency dictated by tox iteration interval . This is a polling function that receives new network messages and processes them. That's it! Now you have a working echo bot. The only problem is that since Tox works with public keys, and you can't really guess your bot's public key, you can't add it as a friend in your client. For this, we need to call another API function: tox self get address(tox, address) . This will fill the 38 byte friend address into the address buffer. You can then display that binary string as hex and input it into your client. Writing a bin2hex function is left as exercise for the reader. Special thanks to our current sponsors:   is sponsoring server hosting for $400 for one year. DigitalOcean has sponsored us every year since 2015.
Excerpt from the source-code README · 11,303 chars · not written by Vinony
Wikidata facts
- Official website
- tox.chat
- Image
- ΜTox 0.1.3 screenshot (cropped).png
Show 6 more facts
- publication date
- 2014-02-03
- software version identifier
- 0.2.22
- Commons category
- Tox clients
- source code repository URL
- github.com/irungentoo/toxcore
- official blog URL
- blog.tox.chat
- translation contribution URL
- hosted.weblate.org/projects/tox
Sources (10)
via Wikidata · CC0