Skip to content

Commit

Permalink
docs: Run prettier-markdown on markdown files.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Feb 9, 2024
1 parent 969e3a2 commit 8d0811a
Show file tree
Hide file tree
Showing 7 changed files with 372 additions and 280 deletions.
5 changes: 4 additions & 1 deletion .restyled.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
exclude:
# shfmt doesn't support this file
# shfmt doesn't support this file.
- "other/analysis/run-clang-tidy"
# Generated file.
- "CHANGELOG.md"

restylers:
- astyle:
Expand All @@ -17,6 +19,7 @@ restylers:
include:
- "**/*.cc"
- "**/*.hh"
- prettier-markdown
- prettier-yaml
- reorder-python-imports
- shellharden
Expand Down
201 changes: 124 additions & 77 deletions INSTALL.md

Large diffs are not rendered by default.

50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# ![Project Tox](https://raw.github.com/TokTok/c-toxcore/master/other/tox.png "Project Tox")

**Current Coverage:** [![coverage](https://codecov.io/gh/TokTok/c-toxcore/branch/master/graph/badge.svg?token=BRfCKo02De)](https://codecov.io/gh/TokTok/c-toxcore)
**Current Coverage:**
[![coverage](https://codecov.io/gh/TokTok/c-toxcore/branch/master/graph/badge.svg?token=BRfCKo02De)](https://codecov.io/gh/TokTok/c-toxcore)

[**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://tox.chat/download.html) **|** [**Clients**](https://wiki.tox.chat/doku.php?id=clients) **|** [**Compiling**](/INSTALL.md)
[**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://tox.chat/download.html) **|**
[**Clients**](https://wiki.tox.chat/doku.php?id=clients) **|**
[**Compiling**](/INSTALL.md)

## What is Tox

Expand All @@ -16,29 +22,33 @@ and privacy easy to obtain for regular users. It uses
### ![Danger: Experimental](other/tox-warning.png)

This is an **experimental** cryptographic network library. It has not been
formally audited by an independent third party that specializes in
cryptography or cryptanalysis. **Use this library at your own risk.**
formally audited by an independent third party that specializes in cryptography
or cryptanalysis. **Use this library at your own risk.**

The underlying crypto library [libsodium](https://doc.libsodium.org/) provides
reliable encryption, but the security model has not yet been fully specified.
See [issue 210](https://github.com/TokTok/c-toxcore/issues/210) for a
discussion on developing a threat model. See other issues for known weaknesses
(e.g. [issue 426](https://github.com/TokTok/c-toxcore/issues/426) describes
what can happen if your secret key is stolen).
See [issue 210](https://github.com/TokTok/c-toxcore/issues/210) for a discussion
on developing a threat model. See other issues for known weaknesses (e.g.
[issue 426](https://github.com/TokTok/c-toxcore/issues/426) describes what can
happen if your secret key is stolen).

## Toxcore Development Roadmap

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:
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: https://toktok.ltd/changelog/c-toxcore
- Roadmap: https://toktok.ltd/roadmap/c-toxcore
- Changelog: https://toktok.ltd/changelog/c-toxcore
- Roadmap: https://toktok.ltd/roadmap/c-toxcore

## Installing toxcore

Detailed installation instructions can be found in [INSTALL.md](INSTALL.md).

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 https://github.com/Toktok/c-toxcore` or by running `git submodule update --init` in the root directory of the repo.
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 https://github.com/Toktok/c-toxcore` or by
running `git submodule update --init` in the root directory of the repo.

In a nutshell, if you have [libsodium](https://github.com/jedisct1/libsodium)
installed, run:
Expand Down Expand Up @@ -74,17 +84,17 @@ if (err_new != TOX_ERR_NEW_OK) {
}
```

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`
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](tox.h) for details.
contains various write-once network settings and allows you to load a previously
serialised instance. See [toxcore/tox.h](tox.h) for details.

### Setting up callbacks

Toxcore works with callbacks that you can register to listen for certain
events. Examples of such events are "friend request received" or "friend sent
a message". Search the API for `tox_callback_*` to find all of them.
Toxcore works with callbacks that you can register to listen for certain events.
Examples of such events are "friend request received" or "friend sent a
message". Search the API for `tox_callback_*` to find all of them.

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
Expand Down
107 changes: 76 additions & 31 deletions docs/Group-Chats.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,122 @@ Group chats.

Note: we assume everyone in the chat trusts each other.

These group chats work by temporarily adding the 4 "closest" people defined by a distance function
in group.c in order to form a circle of connected peers. These peers then relay messages to each other.

A friend invites another friend to a group chat by sending them an invite packet. The friend either ignores
the invite or responds with a response packet if he wants to join the chat. The friend invite contains the type
of groupchat (text only, A/V) the friend is being invited to.
These group chats work by temporarily adding the 4 "closest" people defined by a
distance function in group.c in order to form a circle of connected peers. These
peers then relay messages to each other.

A friend invites another friend to a group chat by sending them an invite
packet. The friend either ignores the invite or responds with a response packet
if he wants to join the chat. The friend invite contains the type of groupchat
(text only, A/V) the friend is being invited to.

TODO(irungentoo): write more of this.

## Protocol

Invite packets:
Invite packet:

### Invite packet:

```
[uint8_t id 96][uint8_t id 0][uint16_t group chat number][33 bytes group chat identifier[1 byte type][32 bytes id]]
```

Response packet
### Response packet

```
[uint8_t id 96][uint8_t id 1][uint16_t group chat number(local)][uint16_t group chat number to join][33 bytes group chat identifier[1 byte type][32 bytes id]]
```

### Peer online packet:

Peer online packet:
```
[uint8_t id 97][uint16_t group chat number (local)][33 bytes group chat identifier[1 byte type][32 bytes id]]
```

### Peer leave packet:

Peer leave packet:
```
[uint8_t id 98][uint16_t group chat number][uint8_t id 1]
```

Peer query packet:
### Peer query packet:

```
[uint8_t id 98][uint16_t group chat number][uint8_t id 8]
```

### Peer response packet:

```
[uint8_t id 98][uint16_t group chat number][uint8_t id 9][Repeated times number of peers: [uint16_t peer num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key][uint8_t name length][name]]
```

Peer response packet:
[uint8_t id 98][uint16_t group chat number][uint8_t id 9][Repeated times number of peers: [uint16_t peer num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key][uint8_t name length][name]]
### Title response packet:

Title response packet:
```
[uint8_t id 98][uint16_t group chat number][uint8_t id 10][title]
```

Message packets:
### Message packets:

```
[uint8_t id 99][uint16_t group chat number][uint16_t peer number][uint32_t message number][uint8_t with a value representing id of message][data]
```

### Lossy Message packets:

Lossy Message packets:
```
[uint8_t id 199][uint16_t group chat number][uint16_t peer number][uint16_t message number][uint8_t with a value representing id of message][data]
```

Group chat types:
0: text
1: AV
## Group chat types:

- 0: text
- 1: AV

Note: the message number is increased by 1 for each sent message.

message ids:
0 - ping
sent every ~60 seconds by every peer.
No data.
## message ids:

### 0 - ping

sent every ~60 seconds by every peer. No data.

### 16 - new_peer

16 - new_peer
Tell everyone about a new peer in the chat.

```
[uint16_t peer_num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key]
```

### 17 - kill_peer

17 - kill_peer
```
[uint16_t peer_num]
```

48 - name change
### 48 - name change

```
[uint8_t name[namelen]]
```

### 49 - groupchat title change

49 - groupchat title change
```
[uint8_t title[titlelen]]
```

64 - chat message
[uint8_t message[messagelen]]
### 64 - chat message

65 - action (/me)
```
[uint8_t message[messagelen]]
```

### 65 - action (/me)


```
[uint8_t message[messagelen]]
```
51 changes: 0 additions & 51 deletions docs/apidsl.md

This file was deleted.

Loading

0 comments on commit 8d0811a

Please sign in to comment.