diff --git a/doc/messages.puml b/doc/messages.puml new file mode 100644 index 0000000..bcbb55c --- /dev/null +++ b/doc/messages.puml @@ -0,0 +1,14 @@ +@startwbs +* Messages +** To server packed (protobuf) +*** Encrypted server message and signature (binary data) +**** ToServerMessage (protobuf) +***** Encrypted user message and signature +****** UserMessage (protobuf) +** From server packed (protobuf) +*** Encrypted server message and signature (binary data) +**** FromServerMessage (protobuf) +***** Encrypted user message and signature +****** UserMessage (protobuf) +@endwbs + diff --git a/pb/messages.proto b/pb/messages.proto index 7bda074..78745b0 100644 --- a/pb/messages.proto +++ b/pb/messages.proto @@ -17,30 +17,46 @@ message PackedUserMessage { bytes Signature=4; } -// structure defining a message to be forwarded encrypted, then sent in a "packedmessage" -message ServerMessage { - string Type = 1; - string ServerPubKey = 2 ; - bytes Payload = 3 ; +// structure defining a message encrypted, then sent in a "packedmessage" payload +message ToServerMessage { + string Type = 1; // Type + string ServerPubKey = 2 ; // My pub key for the server to send me an encrypter answer + bytes Payload = 3 ; // optional payload for server + + message ConversationRequest { // Structure for requestion incoming messages + 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 = 7; + + message PostedMessage{ + string lookupKey= 1; + repeated PackedUserMessage Messages = 2; + } + repeated PostedMessage Messages = 9; + string NextServerKey = 10; + string Url = 11; +} + +// structure defining a from serve receiver message decrypted from a "packedmessage" payload +message FromServerMessage { + string Type = 1; // Type + string ServerPubKey = 2 ; // My pub key for the server to send me an encrypter answer + bytes Payload = 3 ; // uint64 ServerReceived = 4 ; string ServerUuid = 5 ; - message ConversationRequest { - string ccid = 1; - string LastUuidOK = 2; - bool PublishOnline = 3; - } - message ConversationResponse { repeated string MessageUuids = 1; - string SourceIpAddress = 2; } - repeated ConversationRequest PollRequest = 7; - map PollResponse = 8; + map PullResponse = 8; message PostedMessage{ - string ccid= 1; + string lookupKey= 1; repeated PackedUserMessage Messages = 2; } repeated PostedMessage Messages = 9; @@ -62,7 +78,6 @@ message MinimalContact { repeated Server TrustedServers = 3; } - message UserMessage { string Destination = 1;