Add event formatting

This commit is contained in:
Ceres 2025-11-19 17:18:46 +00:00
parent 47272c85df
commit 3d0d5b2251
No known key found for this signature in database
GPG key ID: 9814758436430045

View file

@ -7,3 +7,19 @@ Each room is then a subdirectory of the root folder, containing a `members` file
### Client Files ### Client Files
The client device should be sent copies of each room folder the user is in, and these should be kept up to date with the server. The client device should be sent copies of each room folder the user is in, and these should be kept up to date with the server.
## Transmission
The communication between server and client should be done through REST API POST requests with JSON bodies in the following format:
``` json
{
"room": "room-name",
"file": "affected-file",
"content": "diff"
}
```
Where `room-name` is the room the message was sent in, `affected file` is either `"members"` if the event is a member joining or `"messages"` if the event is a message update (either sending, editing or deleting), and `diff` is the difference between the old file and the updated file, with new line characters being replaced with `\n`. This diff should be in the format of the `diff` unix command.
When a message event is received, either by the server or the client, the releven files should be updated, and if the receiver is the server, the event should then be forwarded to other clients.
## Message format
Messages should exclusively be send and stored through pgp encryption. When being transmitted and stored, the message block should have new lines replaced with `\n`, and it should then be re-formatted for decryption. Messages should be encrypted with `gpg -ea`, with a `-r <fingerprint>` for every fingerprint listed in the members file of the relevant room. This allows the message to the be decrypted using `gpg -d`