Files
meowlib/pb/messages.proto

239 lines
11 KiB
Protocol Buffer
Raw Normal View History

2026-03-03 10:46:25 +01:00
// You should use the field numbers 1 through 15
// for the most-frequently-set fields.
// Lower field number values take less space in the wire format.
// For example, field numbers in the range 1 through 15 take one byte to encode.
// Field numbers in the range 16 through 2047 take two bytes.
2023-11-06 22:44:21 +01:00
/**
* Meow messages
*
* This is the Meow protocol protobuf messages description.
2026-03-03 10:46:25 +01:00
*
2023-11-06 22:44:21 +01:00
*/
2022-01-15 22:19:29 +01:00
syntax = "proto3";
package meowlib;
option go_package = "forge.redroom.link/yves/meowlib";
// structure definnig a message as received by a server in protobuf format
2022-01-15 22:19:29 +01:00
message PackedServerMessage {
2026-03-03 10:46:25 +01:00
string from = 1; // The client public key for that server to get an answer
bytes payload = 2; // The ToServerMessage encrypted with the server public key |or| symetrical encryption as agreed earlier
bytes signature = 3; // The message signature with the client public key |eo| the reference to teh symetrical key used
2022-01-15 22:19:29 +01:00
}
// structure to hold an invitation through a server
message Invitation {
2026-03-03 10:46:25 +01:00
bytes payload = 1; // invitation payload, encrypted after step 2
int32 timeout = 2; // how long do I want the invitation to remain available on the server
int32 shortcodeLen = 3; // len of the shortcode you wish for short url transmission
string shortcode = 4; // shortcode that the friend shall request to get the invitation
string password = 5; // password to set for accessing invitation (optional)
string uuid = 6; // id that the friend gave you, that you should include to your reply to get recognized
int64 expiry = 7; // the server allowed expiry date, it may be samller than the requested timeout according to server policy
int32 step = 8; // progress in the inviattion process : 1=invite friend, 2=friend requests invitation, 3=friend's answer
string from = 9; // used in step 3 the answer public key to check the signature in user message
}
2023-11-06 22:44:21 +01:00
// structure for requesting incoming messages
2026-03-03 10:46:25 +01:00
message ConversationRequest {
string lookup_key = 1; // lookup key for a conversation
bool delivery_request = 2; // look for for delivery tracking, key is implicit, "from" field is used
int64 send_timestamp = 3;
string lookup_signature = 4; // prove that I own the private key by signing that block
}
2023-11-06 22:44:21 +01:00
2024-01-12 23:17:34 +01:00
message Meet {
2026-03-03 10:46:25 +01:00
string public_status = 1; // Publish my online status, if the server is a meeting server
ContactCard contact_card = 2; // mine or the requester
string message = 3; // short description
2024-01-12 23:17:34 +01:00
}
2023-11-06 22:44:21 +01:00
2025-05-04 09:56:09 +02:00
message Credentials {
2026-03-03 10:46:25 +01:00
string login = 1; // login
string password = 2; // password
string public_key = 3; // public key
string private_key = 4; // private key
2025-05-04 09:56:09 +02:00
}
// structure defining a message for a server, that will be encrypted, then sent in a "packedmessage" payload
2022-09-05 14:09:39 +02:00
message ToServerMessage {
2026-03-03 10:46:25 +01:00
string type = 1; // Type 1 : final destination / 2 : forward
string from = 2 ; // My pub key for the server to send me an encrypter answer
bytes payload = 3 ; // optional payload for server
2022-01-15 22:19:29 +01:00
2026-03-03 10:46:25 +01:00
repeated ConversationRequest pull_request = 4;
2026-03-03 10:46:25 +01:00
repeated PackedUserMessage messages = 5;
2026-03-03 10:46:25 +01:00
repeated ServerCard known_servers = 6;
2026-03-03 10:46:25 +01:00
Matriochka matriochka_message = 7;
2022-09-05 14:09:39 +02:00
2026-03-03 10:46:25 +01:00
string uuid = 8;
2026-03-03 10:46:25 +01:00
Invitation invitation = 9; // invitation for the 2 first steps of a "through server" invitation process
2024-04-19 09:13:50 +02:00
2026-03-03 10:46:25 +01:00
repeated PackedUserMessage device_messages = 10; // messages to another device belonging to the same user
2024-05-22 10:06:00 +02:00
2026-03-03 10:46:25 +01:00
int64 timeout = 11; // timeout expected by the client for the server to answer (long polling)
2025-05-04 09:56:09 +02:00
2026-03-03 10:46:25 +01:00
VideoData video_data = 12; // video call data
2022-09-05 14:09:39 +02:00
2026-03-03 10:46:25 +01:00
Credentials credentials = 13; // credentials for a new user or mandatory server creds
}
2023-11-06 22:44:21 +01:00
// structure defining a from server receiver message decrypted from a "packedmessage" payload
2022-09-05 14:09:39 +02:00
message FromServerMessage {
2026-03-03 10:46:25 +01:00
string type = 1; // Type
string server_public_key = 2 ; // Pub key from the server
bytes payload = 3 ; //
string uuid_ack = 4 ; // Ack for the last received ToServerMessage Uuid
string server_uuid = 5 ; // Provides the server uuid that replaced the client uuid
2022-09-05 14:09:39 +02:00
2026-03-03 10:46:25 +01:00
repeated PackedUserMessage chat = 6;
2022-10-22 22:40:03 +02:00
2026-03-03 10:46:25 +01:00
repeated ServerCard known_servers = 7;
2026-03-03 10:46:25 +01:00
Invitation invitation = 8; // invitation answer, for the third steps of any invitation
2026-03-03 10:46:25 +01:00
repeated PackedUserMessage device_messages = 9; // messages from other devices belonging to the same user
2026-03-03 10:46:25 +01:00
VideoData video_data = 10; // video call data
2024-05-27 18:38:38 +02:00
2026-03-03 10:46:25 +01:00
repeated ContactCard contact_card = 11; // contact list for a personae
2022-01-15 22:19:29 +01:00
}
message MatriochkaServer {
2026-03-03 10:46:25 +01:00
string url = 1; // Server Url
string public_key = 2; // Server Public Key
string uuid = 3 ; // Optional, uuid for delivery confirmation
int32 delay = 4; // Max delay requested for message forwarding or delivery tracking
}
message Matriochka {
2026-03-03 10:46:25 +01:00
string lookup_key = 1; // Optional, only if you want delivery tracking, less stealth
MatriochkaServer prev = 2; // Optional, like above
MatriochkaServer next = 3; // Next server to deliver the message to
bytes data = 4; // Matriochka data
}
// structure describing required server attributes
2023-11-08 21:52:09 +01:00
message ServerCard {
2026-03-03 10:46:25 +01:00
string name = 1; // friendly server name
string description = 2; // description : owner type (company/private/university...),
string public_key = 3; // public key you must use to send encrypted messages to that server
string url = 4; // meow server url
string login = 5; // required login to access the server
string password = 6; // password associated to the login
string signature = 7; // signature of all previous fields by the server itself
}
2022-01-15 22:19:29 +01:00
// structure describing a user contact card ie the minimum set of attributes for exchanging identities
2022-09-06 09:30:45 +02:00
message ContactCard {
2026-03-03 10:46:25 +01:00
string name = 1; // contact nickname
string contact_public_key = 2; // contact public key, will be used to authenticate her/his messages
string encryption_public_key = 3; // public key you must use to to write encrypted messages to that contact
string lookup_public_key = 4; // public key you will use as "destination identifier" for her/him to lookup for your messages on the servers
string symetric_key = 5; // agreed key for payload symetric encryption
repeated ServerCard pull_servers = 6; // list the servers where the contact will look for messages from you
uint32 version = 7;
string invitation_id = 8;
string invitation_message = 9;
2026-03-04 22:30:22 +01:00
string dr_root_key = 10; // DR pre-shared root key (base64, 32 bytes)
string dr_public_key = 11; // DR DH public key of the initiator (base64)
2022-09-06 09:30:45 +02:00
}
// structure for sending a message to be forwarded to another user in protobuf format
message PackedUserMessage {
2026-03-03 10:46:25 +01:00
string destination = 1; // the peer's current conversation lookup public key
bytes payload = 2; // the message UserMessage encrypted with the destination peer's public key
bytes signature = 3; // the payload signature with the client identity private key
repeated int64 server_timestamp = 4; // server time stamp, might be several in matriochka mode
string server_delivery_uuid = 5; // message uuid, for server delivery tracking, omitted if not delivery tracking desired
2026-03-04 22:30:22 +01:00
bytes dr_header = 6; // serialized doubleratchet MessageHeader; empty = no DR layer
2022-01-15 22:19:29 +01:00
}
2023-11-06 22:44:21 +01:00
message ConversationStatus {
2026-03-03 10:46:25 +01:00
string uuid = 1; // uuid of message, or uuid of related message if uuid_action is not empty
int32 uuid_action = 2; // empty => normal message, 1: receivedack, 2: processedack, 3:reaction
string reply_to_uuid = 3; // this message replies to the specified uuid
uint64 local_sequence = 4 ; // seq number in local conversation for custom reordering
uint64 sent = 5 ; // timestamp of the message sent
uint64 received = 6; // timestamp of the message received
uint64 processed = 7; // timestamp of the message processed
ContactCard my_next_identity = 8;
int32 peer_next_identity_ack = 9; // version of the new peer accepted id
2023-11-06 22:44:21 +01:00
}
2026-03-03 10:46:25 +01:00
message Group{
string name = 1;
repeated ContactCard members = 2;
}
2024-04-19 09:13:50 +02:00
// structure defining information that might be exchanged between two peers.
2022-01-15 22:19:29 +01:00
message UserMessage {
2026-03-03 10:46:25 +01:00
string destination = 1; // Lookupkey
string from = 2; // My public key for that contact
string type = 3; // Message type
bytes data = 4;
ConversationStatus status = 5;
ContactCard contact = 6;
ServerCard known_servers = 7;
Group group = 8;
repeated File files = 9;
Location current_location = 10;
bytes appdata = 11;
Invitation invitation = 12;
VideoData video_data = 13;
}
2024-04-19 09:13:50 +02:00
// UserMessage types :
// 1 : normal message (test, image, video, audio, file, etc)
// 2 : status message (online, offline, busy, etc)
// 3 : send avatar as file[0]
// 4 : location request
// 5 : location response
message File {
2026-03-03 10:46:25 +01:00
string filename = 1; // the proposed filename
uint64 size = 2; // the file size
uint32 chunk = 3; // the chunk counter if file is sent by chunks
bytes data = 4; // the file/chunk content
2023-08-01 22:47:18 +02:00
}
message Location {
2026-03-03 10:46:25 +01:00
uint64 time = 1;
float latitude = 2;
float longitude = 3;
int32 altitude = 4;
2024-02-29 21:03:15 +01:00
}
message DbMessage {
2026-03-03 10:46:25 +01:00
bool outbound = 1; // direction of the message
string type = 2;
bytes data = 3; // text data
ConversationStatus status = 4;
ContactCard contact = 5;
Group group = 6;
repeated string file_paths = 7;
Location current_location = 8;
bytes appdata = 9;
Invitation invitation = 10;
string from = 11; // source peer uid, used when storing group conversations with more than one peer
string server_delivery_uuid = 12; // uuid returned by the server upon delivery
uint64 server_delivery_timestamp = 13; // timestamp of the server delivery
2024-02-29 21:03:15 +01:00
}
2024-05-22 10:06:00 +02:00
message VideoData {
2026-03-03 10:46:25 +01:00
string url = 1;
string room = 2;
uint64 duration = 3;
repeated VideoCredential credentials = 4;
repeated string media_query = 5;
2024-05-22 10:06:00 +02:00
}
message VideoCredential {
2026-03-03 10:46:25 +01:00
string username = 1;
string shared_key = 2;
string token = 3;
2024-05-22 10:06:00 +02:00
}