{"id":20786508,"url":"https://github.com/iphydf/toxcore","last_synced_at":"2026-04-18T21:36:37.781Z","repository":{"id":73712380,"uuid":"261144038","full_name":"iphydf/toxcore","owner":"iphydf","description":"Fork of toxcore that's not a github fork","archived":false,"fork":false,"pushed_at":"2020-05-04T10:54:10.000Z","size":13663,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T09:57:50.209Z","etag":null,"topics":["cryptography","encryption","network","p2p","security","toxcore"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iphydf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-04T10:31:04.000Z","updated_at":"2020-05-04T10:58:56.000Z","dependencies_parsed_at":"2023-02-27T01:31:10.393Z","dependency_job_id":null,"html_url":"https://github.com/iphydf/toxcore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iphydf/toxcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iphydf%2Ftoxcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iphydf%2Ftoxcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iphydf%2Ftoxcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iphydf%2Ftoxcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iphydf","download_url":"https://codeload.github.com/iphydf/toxcore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iphydf%2Ftoxcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31986323,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"ssl_error","status_checked_at":"2026-04-18T20:23:29.375Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","encryption","network","p2p","security","toxcore"],"created_at":"2024-11-17T14:52:20.153Z","updated_at":"2026-04-18T21:36:37.706Z","avatar_url":"https://github.com/iphydf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Project Tox](https://raw.github.com/TokTok/c-toxcore/master/other/tox.png \"Project Tox\")\n\n**Current build status:** [![Build Status](https://travis-ci.org/TokTok/c-toxcore.svg?branch=master)](https://travis-ci.org/TokTok/c-toxcore)\n**Current Coverage:** [![Coverage Status](https://coveralls.io/repos/github/TokTok/c-toxcore/badge.svg?branch=master)](https://coveralls.io/github/TokTok/c-toxcore?branch=master)\n\n[**Website**](https://tox.chat) **|** [**Wiki**](https://wiki.tox.chat/) **|** [**Blog**](https://blog.tox.chat/) **|** [**FAQ**](https://wiki.tox.chat/doku.php?id=users:faq) **|** [**Binaries/Downloads**](https://wiki.tox.chat/Binaries) **|** [**Clients**](https://wiki.tox.chat/doku.php?id=clients) **|** [**Compiling**](/INSTALL.md) **|** [**Toxcore's Projects**](https://github.com/TokTok/c-toxcore/projects)\n\n**IRC Channels:** Users: [#tox@freenode](https://webchat.freenode.net/?channels=tox), Developers: [#toktok@freenode](https://webchat.freenode.net/?channels=toktok)\n\n## What is Tox\n\nTox is a peer to peer (serverless) instant messenger aimed at making security\nand privacy easy to obtain for regular users. It uses\n[NaCl](https://nacl.cr.yp.to/) for its encryption and authentication.\n\n## IMPORTANT!\n\n### ![Danger: Experimental](other/tox-warning.png)\n\nThis is an **experimental** cryptographic network library. It has not been\nformally audited by an independent third party that specializes in\ncryptography or cryptanalysis. **Use this library at your own risk.**\n\nThe underlying crypto library [NaCl](https://nacl.cr.yp.to/install.html)\nprovides reliable encryption, but the security model has not yet been fully\nspecified. See [issue 210](https://github.com/TokTok/c-toxcore/issues/210) for\na discussion on developing a threat model. See other issues for known\nweaknesses (e.g. [issue 426](https://github.com/TokTok/c-toxcore/issues/426)\ndescribes what can happen if your secret key is stolen).\n\n## Toxcore Development Roadmap\n\nThe roadmap and changelog are generated from GitHub issues. You may view them\non the website, where they are updated at least once every 24 hours:\n\n-   Changelog: https://toktok.ltd/changelog/c-toxcore\n-   Roadmap: https://toktok.ltd/roadmap/c-toxcore\n\n## Installing toxcore\n\nDetailed installation instructions can be found in [INSTALL.md](INSTALL.md).\n\nIn a nutshell, if you have [libsodium](https://github.com/jedisct1/libsodium)\ninstalled, run:\n\n```sh\nmkdir _build \u0026\u0026 cd _build\ncmake ..\nmake\nsudo make install\n```\n\nIf you have [libvpx](https://github.com/webmproject/libvpx) and\n[opus](https://github.com/xiph/opus) installed, the above will also build the\nA/V library for multimedia chats.\n\n## Using toxcore\n\nThe simplest \"hello world\" example could be an echo bot. Here we will walk\nthrough the implementation of a simple bot.\n\n### Creating the tox instance\n\nAll toxcore API functions work with error parameters. They are enums with one\n`OK` value and several error codes that describe the different situations in\nwhich the function might fail.\n\n```c\nTOX_ERR_NEW err_new;\nTox *tox = tox_new(NULL, \u0026err_new);\nif (err_new != TOX_ERR_NEW_OK) {\n  fprintf(stderr, \"tox_new failed with error code %d\\n\", err_new);\n  exit(1);\n}\n```\n\nHere, we simply exit the program, but in a real client you will probably want\nto do some error handling and proper error reporting to the user. The `NULL`\nargument given to the first parameter of `tox_new` is the `Tox_Options`. It\ncontains various write-once network settings and allows you to load a\npreviously serialised instance. See [toxcore/tox.h](tox.h) for details.\n\n### Setting up callbacks\n\nToxcore works with callbacks that you can register to listen for certain\nevents. Examples of such events are \"friend request received\" or \"friend sent\na message\". Search the API for `tox_callback_*` to find all of them.\n\nHere, we will set up callbacks for receiving friend requests and receiving\nmessages. We will always accept any friend request (because we're a bot), and\nwhen we receive a message, we send it back to the sender.\n\n```c\ntox_callback_friend_request(tox, handle_friend_request);\ntox_callback_friend_message(tox, handle_friend_message);\n```\n\nThese two function calls set up the callbacks. Now we also need to implement\nthese \"handle\" functions.\n\n### Handle friend requests\n\n```c\nstatic void handle_friend_request(\n  Tox *tox, const uint8_t *public_key, const uint8_t *message, size_t length,\n  void *user_data) {\n  // Accept the friend request:\n  TOX_ERR_FRIEND_ADD err_friend_add;\n  tox_friend_add_norequest(tox, public_key, \u0026err_friend_add);\n  if (err_friend_add != TOX_ERR_FRIEND_ADD_OK) {\n    fprintf(stderr, \"unable to add friend: %d\\n\", err_friend_add);\n  }\n}\n```\n\nThe `tox_friend_add_norequest` function adds the friend without sending them a\nfriend request. Since we already got a friend request, this is the right thing\nto do. If you wanted to send a friend request yourself, you would use\n`tox_friend_add`, which has an extra parameter for the message.\n\n### Handle messages\n\nNow, when the friend sends us a message, we want to respond to them by sending\nthem the same message back. This will be our \"echo\".\n\n```c\nstatic void handle_friend_message(\n  Tox *tox, uint32_t friend_number, TOX_MESSAGE_TYPE type,\n  const uint8_t *message, size_t length,\n  void *user_data) {\n  TOX_ERR_FRIEND_SEND_MESSAGE err_send;\n  tox_friend_send_message(tox, friend_number, type, message, length,\n    \u0026err_send);\n  if (err_send != TOX_ERR_FRIEND_SEND_MESSAGE_OK) {\n    fprintf(stderr, \"unable to send message back to friend %d: %d\\n\",\n      friend_number, err_send);\n  }\n}\n```\n\nThat's it for the setup. Now we want to actually run the bot.\n\n### Main event loop\n\nToxcore works with a main event loop function `tox_iterate` that you need to\ncall at a certain frequency dictated by `tox_iteration_interval`. This is a\npolling function that receives new network messages and processes them.\n\n```c\nwhile (true) {\n  usleep(1000 * tox_iteration_interval(tox));\n  tox_iterate(tox, NULL);\n}\n```\n\nThat's it! Now you have a working echo bot. The only problem is that since Tox\nworks with public keys, and you can't really guess your bot's public key, you\ncan't add it as a friend in your client. For this, we need to call another API\nfunction: `tox_self_get_address(tox, address)`. This will fill the 38 byte\nfriend address into the `address` buffer. You can then display that binary\nstring as hex and input it into your client. Writing a `bin2hex` function is\nleft as exercise for the reader.\n\nWe glossed over a lot of details, such as the user data which we passed to\n`tox_iterate` (passing `NULL`), bootstrapping into an actual network (this bot\nwill work in the LAN, but not on an internet server) and the fact that we now\nhave no clean way of stopping the bot (`while (true)`). If you want to write a\nreal bot, you will probably want to read up on all the API functions. Consult\nthe API documentation in [toxcore/tox.h](toxcore/tox.h) for more information.\n\n### Other resources\n\n- [Another echo bot](https://wiki.tox.chat/developers/client_examples/echo_bot)\n- [minitox](https://github.com/hqwrong/minitox) (A minimal tox client)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiphydf%2Ftoxcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiphydf%2Ftoxcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiphydf%2Ftoxcore/lists"}