meowlib/pb/messages.proto
ycc 420b7d0af0
All checks were successful
continuous-integration/drone/push Build is passing
Refactor and servercard ajustments
2023-11-27 00:31:43 +01:00

180 lines
6.7 KiB
Protocol Buffer

// 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.
/**
* Meow messages
*
* This is the Meow protocol protobuf messages description.
*
*/
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 to hold an invitation through a server
message Invitation {
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 tou set for accessin 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
}
// 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
}
// 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
repeated ConversationRequest pullRequest = 4;
repeated PackedUserMessage messages = 5;
repeated ServerCard knownServers = 6;
Matriochka matriochkaMessage = 7;
string uuid = 8;
Invitation invitation = 9; // invitation for the 2 first steps of a "through server" invitation process
}
message ConversationResponse {
repeated string messageUuids = 1;
}
// 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
repeated PackedUserMessage chat = 6;
repeated ServerCard knownServers = 7;
Invitation invitation = 8; // invitation answer, for the third steps of any invitation
}
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
}
// structure describing required server attributes
message ServerCard {
string name = 1; // friendly server name
string description=2; // description : owner type (company/private/university...),
string publicKey = 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
}
// structure describing a user contact card ie the minimum set of attributes for exchanging identities
message ContactCard {
string name=1; // contact nickname
string contactPublicKey =2; // contact public key, will be used to authenticate her/his messages
string encryptionPublicKey= 3; // public key you must use to to write encrypted messages to that contact
string lookupPublicKey =4; // public key you will use as "destination identifier" for her/him to lookup for your messages on the servers
repeated ServerCard pullServers =5; // list the servers where the contact will look for messages from you
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
}
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 peer accepted id
}
message Group{
string name=1;
repeated ContactCard members = 2;
}
// 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;
ConversationStatus Status = 5;
ContactCard contact = 6;
ServerCard knownServers = 7;
Group group = 8;
repeated File files = 9;
Location currentLocation = 10;
bytes appdata = 11;
Invitation invitation = 12;
}
message File {
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
}
message Location {
uint64 time=1;
float latitude=2;
float longitude=3;
int32 altitude=4;
}