meowlib/pb/messages.proto

120 lines
4.0 KiB
Protocol Buffer

syntax = "proto3";
package meowlib;
option go_package = "forge.redroom.link/yves/meowlib";
// structure definnig a message as received by a server in protobuf format
message PackedServerMessage {
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
}
// structure defining a message for a server, that will be encrypted, then sent in a "packedmessage" payload
message ToServerMessage {
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
// structure for requesting incoming messages
message ConversationRequest {
string lookupKey = 1; // lookup key for a conversation
string lastServerUuidOK = 2; // Last Server message UUID received (send me all after that one)
bool publishOnline = 3; // ?? Publish my online status for that contact ?
string lookupSignature = 4; // prove that I own the private key by signing that block
}
repeated ConversationRequest pullRequest = 4;
repeated PackedUserMessage messages = 5;
repeated Server knownServers = 6;
string uuid = 7;
}
// structure defining a from server receiver message decrypted from a "packedmessage" payload
message FromServerMessage {
string type = 1; // Type
string serverPublicKey = 2 ; // Pub key from the server
bytes payload = 3 ; //
string uuidAck = 4 ; // Ack for the last received ToServerMessage Uuid
string serverUuid = 5 ; // Provides the server uuid that replaced the client uuid
message ConversationResponse {
repeated string messageUuids = 1;
}
repeated PackedUserMessage chat = 6;
repeated Server knownServers = 7;
}
// structure describing required server attributes
message Server {
string name = 1;
string description=2;
string publicKey = 3;
string url = 4;
bool publish = 5; // publish this server when asked for a list by server
bytes signature = 6; // signature of all previous field by the server itself
int32 confidenceLevel = 7; // additional info from the user
}
// structure describing a user contact card ie the minimum set of attributes for exchanging identities
message ContactCard {
string name=1;
string contactPublicKey =2;
string encryptionPublicKey= 3;
string lookupPublicKey =4;
repeated Server pullServers =5;
uint32 version = 6;
string invitationId=7;
}
// structure for sending a message to be forwarded to another user in protobuf format
message PackedUserMessage {
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
}
// structure defining information that might be exchanged between two peers.
message UserMessage {
string destination = 1; // Lookupkey
string from = 2; // My public key for that contact
string type = 3;
bytes data = 4;
message ConversationStatus {
string localUuid = 1;
uint64 localSequence = 2 ;
uint64 sent = 3 ;
uint64 received = 4;
uint64 processed = 5;
ContactCard myNextIdentity = 6;
int32 peerNextIdentityAck = 7; // version of the new peed accepted id
}
ConversationStatus Status = 5;
ContactCard contact = 6;
Server knownServers = 7;
message Group{
string name=1;
repeated ContactCard members = 2;
}
Group group = 8;
File file = 9;
}
message File {
string filename=1;
uint64 size=2;
uint32 chunk=3;
bytes data=4;
}