2024-06-23 21:55:28 -07:00
|
|
|
# NOTICE: this document is outdated
|
|
|
|
# todo: update this document
|
|
|
|
|
2023-05-05 19:33:05 -07:00
|
|
|
# vybe websocket protocol - sent by client
|
|
|
|
|
|
|
|
socket.io actions + expected msg format and other info
|
|
|
|
|
|
|
|
all responses have same type as original message
|
|
|
|
|
|
|
|
if a message fails, you get a response with the following format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"success": false,
|
|
|
|
"message": "Something broke"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-05-07 18:43:57 -07:00
|
|
|
## authenticate
|
|
|
|
|
|
|
|
you must generate a random salt, sign a message `vybe_auth [salt]`, and then send
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "username",
|
|
|
|
"message": "that message you signed"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-05-05 19:33:05 -07:00
|
|
|
## create_user
|
|
|
|
|
|
|
|
Message format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "unique_username",
|
|
|
|
"pubkey": "your PGP public key"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Response format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"success": true,
|
|
|
|
"id": 123
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## get_history
|
|
|
|
|
2023-05-05 21:56:59 -07:00
|
|
|
```json
|
|
|
|
{
|
2023-05-08 20:51:17 -07:00
|
|
|
"before": 100, // message ID. if ommitted just starts from end
|
|
|
|
"thread": 1 // thread ID
|
2023-05-05 21:56:59 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Response format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"success": true,
|
|
|
|
"messages": [], // each message has same format as new_message
|
|
|
|
"more": true // false if there are no more
|
|
|
|
}
|
|
|
|
```
|
2023-05-05 19:33:05 -07:00
|
|
|
|
|
|
|
## send_message
|
|
|
|
|
|
|
|
Message format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "unique_username",
|
2023-05-08 20:51:17 -07:00
|
|
|
"message": "message",
|
2023-05-29 18:08:20 -07:00
|
|
|
"encrypted": true, // if so use the AES key for this thread
|
2023-05-08 20:51:17 -07:00
|
|
|
"thread": 1 // thread ID
|
2023-05-05 19:33:05 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Response format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2023-05-05 21:56:59 -07:00
|
|
|
"success": true,
|
|
|
|
"id": 111
|
2023-05-05 19:33:05 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-05-08 20:51:17 -07:00
|
|
|
## create_thread
|
|
|
|
|
|
|
|
Message format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2023-05-28 14:56:08 -07:00
|
|
|
"name": "thread name",
|
|
|
|
"permissions": {
|
|
|
|
"view_limited": true,
|
|
|
|
"post_limited": true
|
|
|
|
},
|
2023-05-29 18:08:20 -07:00
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"name": "username1",
|
|
|
|
"key": "" // PGP encrypted AES key, if channel is view_limited
|
|
|
|
}
|
|
|
|
]
|
2023-05-08 20:51:17 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Response format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"success": true,
|
|
|
|
"id": 111
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## list_threads
|
|
|
|
|
|
|
|
no request message
|
|
|
|
|
|
|
|
Response format:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"success": true,
|
|
|
|
"threads": [
|
|
|
|
{
|
|
|
|
"id": 1,
|
2023-05-29 18:08:20 -07:00
|
|
|
"name": "meow",
|
|
|
|
"permissions": {
|
|
|
|
"is_member": false,
|
|
|
|
"view": true,
|
|
|
|
"post": true
|
|
|
|
},
|
|
|
|
"key": "" // if thread is view limited
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## get_keys
|
|
|
|
|
|
|
|
request message:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"names": ["user1", "user2"]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"keys": [
|
|
|
|
{
|
|
|
|
"name": "user1",
|
|
|
|
"pubkey": ""
|
2023-05-08 20:51:17 -07:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-05-05 19:33:05 -07:00
|
|
|
# sent by server
|
|
|
|
|
|
|
|
## new_message
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2023-05-05 21:56:59 -07:00
|
|
|
"id": 69,
|
2023-05-05 19:33:05 -07:00
|
|
|
"name": "unique_username",
|
2023-05-08 20:51:17 -07:00
|
|
|
"message": "msg text",
|
2023-05-29 18:08:20 -07:00
|
|
|
"encrypted": false,
|
2023-05-08 20:51:17 -07:00
|
|
|
"thread": 1 // thread ID
|
2023-05-05 19:33:05 -07:00
|
|
|
}
|
|
|
|
```
|
2023-05-29 18:08:20 -07:00
|
|
|
|
|
|
|
## new_thread
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": 123,
|
|
|
|
"name": "meow thread",
|
|
|
|
"permissions": {
|
|
|
|
"is_member": true,
|
|
|
|
"view": true,
|
|
|
|
"post": false
|
|
|
|
},
|
|
|
|
"key": "" // pgp encrypted aes key if applicable
|
|
|
|
}
|
|
|
|
```
|