| 
									
										
										
										
											2023-08-01 22:47:18 +02: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. 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | syntax = "proto3";
 | 
					
						
							|  |  |  | package meowlib;
 | 
					
						
							|  |  |  | option go_package = "forge.redroom.link/yves/meowlib";
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | // structure definnig a message as received by a server in protobuf format
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | message PackedServerMessage {
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | 	string from = 1; // The client public key for that server to get an answer 
 | 
					
						
							| 
									
										
										
										
											2022-10-22 14:41:48 +02:00
										 |  |  | 	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
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +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 {
 | 
					
						
							| 
									
										
										
										
											2022-09-25 10:16:39 +02:00
										 |  |  | 	string type = 1; // Type 1 : final destination / 2 : forward 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | 	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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |     // structure for requesting incoming messages
 | 
					
						
							|  |  |  |     message ConversationRequest {  
 | 
					
						
							| 
									
										
										
										
											2022-09-05 14:09:39 +02:00
										 |  |  |         string lookupKey = 1; // lookup key for a conversation
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |         string lastServerUuidOK = 2; // Last Server message UUID received (send me all after that one)
 | 
					
						
							|  |  |  |         bool publishOnline = 3; // ?? Publish my online status for that contact ?
 | 
					
						
							| 
									
										
										
										
											2022-09-05 14:09:39 +02:00
										 |  |  |         string lookupSignature = 4; // prove that I own the private key by signing that block
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  |     } 
 | 
					
						
							|  |  |  |  
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |     repeated ConversationRequest pullRequest = 4; 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	repeated PackedUserMessage messages = 5; 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     repeated Server knownServers = 6; 
 | 
					
						
							| 
									
										
										
										
											2022-12-27 16:59:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Matriochka matriochkaMessage = 7;
 | 
					
						
							| 
									
										
										
										
											2022-09-25 10:16:39 +02:00
										 |  |  |     
 | 
					
						
							| 
									
										
										
										
											2022-12-27 16:59:52 +01:00
										 |  |  |     string uuid = 8;
 | 
					
						
							| 
									
										
										
										
											2022-09-05 14:09:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | // structure defining a from server receiver message decrypted from a "packedmessage" payload
 | 
					
						
							| 
									
										
										
										
											2022-09-05 14:09:39 +02:00
										 |  |  | message FromServerMessage {
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | 	string type = 1; // Type 
 | 
					
						
							| 
									
										
										
										
											2022-09-19 20:16:57 +02:00
										 |  |  | 	string serverPublicKey = 2 ; // Pub key from the server
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | 	bytes payload = 3 ; // 
 | 
					
						
							| 
									
										
										
										
											2022-09-19 20:16:57 +02:00
										 |  |  | 	string uuidAck = 4 ; // Ack for the last received ToServerMessage Uuid
 | 
					
						
							|  |  |  | 	string serverUuid = 5 ; // Provides the server uuid that replaced the client uuid 
 | 
					
						
							| 
									
										
										
										
											2022-09-05 14:09:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  |     message ConversationResponse {
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |         repeated string messageUuids = 1;
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  |     }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-22 22:40:03 +02:00
										 |  |  | 	repeated PackedUserMessage chat = 6; 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     repeated Server knownServers = 7; 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-27 16:59:52 +01:00
										 |  |  | message MatriochkaServer {
 | 
					
						
							|  |  |  |     string url = 1; // Server Url
 | 
					
						
							|  |  |  |     string publicKey = 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 {
 | 
					
						
							|  |  |  |     string lookupKey = 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
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | // structure describing required server attributes
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | message Server {
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |     string	name = 1; 
 | 
					
						
							|  |  |  |     string description=2; 
 | 
					
						
							|  |  |  |     string publicKey = 3; 
 | 
					
						
							|  |  |  |     string url = 4; 
 | 
					
						
							| 
									
										
										
										
											2022-11-27 21:08:34 +01:00
										 |  |  |     bool publish = 5; // publish this server when asked for a list by server
 | 
					
						
							| 
									
										
										
										
											2022-12-27 16:59:52 +01:00
										 |  |  |     bytes signature = 6; // signature of all previous fields by the server itself
 | 
					
						
							| 
									
										
										
										
											2022-11-27 21:08:34 +01:00
										 |  |  |     int32 confidenceLevel = 7; // additional info from the user
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02: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 {
 | 
					
						
							|  |  |  |     string name=1;
 | 
					
						
							|  |  |  | 	string contactPublicKey =2;
 | 
					
						
							| 
									
										
										
										
											2022-09-19 20:16:57 +02:00
										 |  |  | 	string encryptionPublicKey= 3;
 | 
					
						
							|  |  |  | 	string lookupPublicKey  =4;
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | 	repeated Server pullServers =5; 
 | 
					
						
							| 
									
										
										
										
											2022-11-27 21:08:34 +01:00
										 |  |  |     uint32 version = 6;
 | 
					
						
							|  |  |  |     string invitationId=7;
 | 
					
						
							| 
									
										
										
										
											2022-09-06 09:30:45 +02:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | // structure for sending a message to be forwarded to another user in protobuf format
 | 
					
						
							|  |  |  | message PackedUserMessage {
 | 
					
						
							| 
									
										
										
										
											2022-10-22 22:40:03 +02: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 serverTimestamp=4; // server time stamp, might be several in matriochka mode
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-27 16:59:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  | // structure defining information that might be exchanged between two peers.
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | message UserMessage {
 | 
					
						
							| 
									
										
										
										
											2022-12-17 20:17:05 +01:00
										 |  |  | 	string destination = 1; // Lookupkey
 | 
					
						
							|  |  |  | 	string from = 2; // My public key for that contact
 | 
					
						
							| 
									
										
										
										
											2022-09-25 10:16:39 +02:00
										 |  |  | 	string type = 3; 
 | 
					
						
							|  |  |  | 	bytes data = 4; 
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  |     message ConversationStatus {
 | 
					
						
							| 
									
										
										
										
											2022-09-25 10:16:39 +02:00
										 |  |  |         string localUuid = 1; 
 | 
					
						
							|  |  |  |         uint64 localSequence = 2 ;
 | 
					
						
							|  |  |  |         uint64 sent = 3 ; 
 | 
					
						
							|  |  |  |         uint64 received = 4; 
 | 
					
						
							|  |  |  |         uint64 processed = 5; 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |         ContactCard myNextIdentity = 6;
 | 
					
						
							| 
									
										
										
										
											2022-12-27 16:59:52 +01:00
										 |  |  |         int32  peerNextIdentityAck = 7; // version of the new peer accepted id
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |         }
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  |     ConversationStatus Status = 5;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |     ContactCard contact = 6;
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |     Server knownServers = 7;
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     message Group{
 | 
					
						
							|  |  |  |         string name=1;
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |         repeated ContactCard members = 2;
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  |     }
 | 
					
						
							| 
									
										
										
										
											2022-09-18 18:09:27 +02:00
										 |  |  |     Group group = 8;
 | 
					
						
							| 
									
										
										
										
											2022-11-27 21:08:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-18 19:47:44 +01:00
										 |  |  |     repeated File files = 9;
 | 
					
						
							| 
									
										
										
										
											2023-08-01 22:47:18 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Location currentLocation = 10;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bytes appdata = 11; 
 | 
					
						
							| 
									
										
										
										
											2022-11-27 21:08:34 +01:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message File {
 | 
					
						
							|  |  |  |     string filename=1;
 | 
					
						
							|  |  |  |     uint64 size=2;
 | 
					
						
							|  |  |  |     uint32 chunk=3;
 | 
					
						
							|  |  |  |     bytes data=4;
 | 
					
						
							| 
									
										
										
										
											2023-08-01 22:47:18 +02:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message Location {
 | 
					
						
							|  |  |  |     uint64 time=1;
 | 
					
						
							|  |  |  |     float latitude=2;
 | 
					
						
							|  |  |  |     float longitude=3;
 | 
					
						
							|  |  |  |     int32 altitude=4;
 | 
					
						
							| 
									
										
										
										
											2022-01-15 22:19:29 +01:00
										 |  |  | }
 |