diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..672abc9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +doc/protocol.aux +doc/protocol.fdb_latexmk +doc/protocol.fls +doc/protocol.log +doc/protocol.pdf +doc/protocol.synctex.gz +out/doc/general_deployment/general_deployment.png +out/doc/server_deployment/server_deployment.png diff --git a/doc/general_deployment.puml b/doc/general_deployment.puml new file mode 100644 index 0000000..418771c --- /dev/null +++ b/doc/general_deployment.puml @@ -0,0 +1,21 @@ +@startuml + +cloud net as "Network" + +component mapp as "Mobile Application" +component capp as "CLI Application" +component dapp as "Desktop Application" +component proxy1 as "Http Web Service Proxy" +component proxy2 as "Http Web Service Proxy" +component ws1 as "Company 1 Web Services" #LightGray +component ws2 as "Company 2 Web Client" #LightGray +component srv1 as "Server" +net -- srv1 +net -- mapp +net -- capp +net -- dapp +net -- proxy1 +net -- proxy2 +ws1 -- proxy1 +ws2 -- proxy2 +ws2 ..> ws1 diff --git a/doc/protocol.tex b/doc/protocol.tex index deef7fa..f7ea59b 100644 --- a/doc/protocol.tex +++ b/doc/protocol.tex @@ -120,7 +120,7 @@ The Ekp is used to cypher your conversation. \subsection{Conversation lookup} A contact conversation Lookup Key Pair(Lkp) is also associated with your conversation. The Lkp public key is used to identify your conversation on a server. -the private key allows you to sign your tequest and prove the server that you are the legitimate recipient for a message. +the private key allows you to sign your request and prove the server that you are the legitimate recipient for a message. This Lkp can be changed anytime by it's owner and the new public key will be sent along the last message. The Lkp and the Ekp are only changed, once the change has beeen acknowledged by your contact. diff --git a/doc/server_deployment.puml b/doc/server_deployment.puml new file mode 100644 index 0000000..5a3c8f0 --- /dev/null +++ b/doc/server_deployment.puml @@ -0,0 +1,36 @@ +@startuml + +cloud Network +component lb as "Load Balancer" +component http1 as "HTTP Server" +component http2 as "HTTP Server" +component ws1 as "Websocket Server" +component ws2 as "Websocket Server" +component ws3 as "Websocket Server" +component ws4 as "..." +database q as "Message Queue" +component d1 as "Message Dispatcher" +component d2 as "Message Dispatcher" +component d3 as "Message Dispatcher" +component d4 as "Message Dispatcher" +component d5 as "..." + +lb -- http1 +lb -- http2 +lb -- ws1 +lb -- ws2 +lb -- ws3 +lb -- ws4 +http1 -- q +http2 -- q +ws1 -- q +ws2 -- q +ws3 -- q +q -- d1 +q -- d2 +q -- d3 +q -- d4 +q -- d5 +Network -- lb + +@enduml \ No newline at end of file diff --git a/doc/archi01.puml b/doc/usecase01.puml similarity index 100% rename from doc/archi01.puml rename to doc/usecase01.puml diff --git a/doc/archi02.puml b/doc/usecase02.puml similarity index 100% rename from doc/archi02.puml rename to doc/usecase02.puml diff --git a/doc/archi03.puml b/doc/usecase03.puml similarity index 100% rename from doc/archi03.puml rename to doc/usecase03.puml diff --git a/endtoend_test.go b/endtoend_test.go index 2e0f9e3..30ca649 100644 --- a/endtoend_test.go +++ b/endtoend_test.go @@ -35,7 +35,7 @@ func TestEndToEnd(t *testing.T) { // // Simulate peer invitation response : generate the friend's keypair fmt.Println("Simulating first friend answer...") - var receivedContact Contact + var receivedContact ContactCard firstFriendContactKp := NewKeyPair() firstFriendEncryptionKp := NewKeyPair() firstFriendLookupKp := NewKeyPair() @@ -48,7 +48,7 @@ func TestEndToEnd(t *testing.T) { for _, srv := range friendsMessageServers.Servers { receivedContact.PullServers = append(receivedContact.PullServers, srv.ServerData) } - // End simulating concact invitation response + // End simulating contact invitation response // // diff --git a/https.go b/https.go index f9222a1..c3aabff 100644 --- a/https.go +++ b/https.go @@ -25,13 +25,9 @@ func (https *Https) Send(msg []byte) ([]byte, error) { } func (https *Https) Start(callback *func() []InternalMessage) { - for { - } } func (https *Https) Stop() { - for { - } } diff --git a/identity.go b/identity.go index 7461475..3a098b0 100644 --- a/identity.go +++ b/identity.go @@ -28,9 +28,9 @@ func CreateIdentity(nickname string) *Identity { return &id } -func (id *Identity) InvitePeer(myName string, contactName string, messageServerIdxs []int) (*Peer, *Contact) { +func (id *Identity) InvitePeer(myName string, contactName string, messageServerIdxs []int) (*Peer, *ContactCard) { var peer Peer - var myContactCard Contact + var myContactCard ContactCard peer.Me = NewKeyPair() peer.EncryptionKp = NewKeyPair() peer.LookupKp = NewKeyPair() @@ -48,7 +48,7 @@ func (id *Identity) InvitePeer(myName string, contactName string, messageServerI return &id.Peers[len(id.Peers)-1], &myContactCard } -func (*Identity) FinalizeInvitation(peer *Peer, receivedContact *Contact) { +func (*Identity) FinalizeInvitation(peer *Peer, receivedContact *ContactCard) { peer.Contact = *receivedContact } diff --git a/invitation.png b/invitation.png deleted file mode 100644 index d9bde59..0000000 Binary files a/invitation.png and /dev/null differ diff --git a/messages.json b/messages.json new file mode 100644 index 0000000..e69de29 diff --git a/messages.pb.go b/messages.pb.go new file mode 100644 index 0000000..f534e5d --- /dev/null +++ b/messages.pb.go @@ -0,0 +1,1191 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.6.1 +// source: messages.proto + +package meowlib + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PackedServerMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` + Payload []byte `protobuf:"bytes,2,opt,name=Payload,proto3" json:"Payload,omitempty"` + Signature string `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` +} + +func (x *PackedServerMessage) Reset() { + *x = PackedServerMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PackedServerMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PackedServerMessage) ProtoMessage() {} + +func (x *PackedServerMessage) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PackedServerMessage.ProtoReflect.Descriptor instead. +func (*PackedServerMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{0} +} + +func (x *PackedServerMessage) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *PackedServerMessage) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *PackedServerMessage) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +type PackedUserMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` + Destination string `protobuf:"bytes,2,opt,name=Destination,proto3" json:"Destination,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` +} + +func (x *PackedUserMessage) Reset() { + *x = PackedUserMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PackedUserMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PackedUserMessage) ProtoMessage() {} + +func (x *PackedUserMessage) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PackedUserMessage.ProtoReflect.Descriptor instead. +func (*PackedUserMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{1} +} + +func (x *PackedUserMessage) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *PackedUserMessage) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *PackedUserMessage) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *PackedUserMessage) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +type ServerMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` + ServerPubKey string `protobuf:"bytes,2,opt,name=ServerPubKey,proto3" json:"ServerPubKey,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` + ServerReceived uint64 `protobuf:"varint,4,opt,name=ServerReceived,proto3" json:"ServerReceived,omitempty"` + ServerUuid string `protobuf:"bytes,5,opt,name=ServerUuid,proto3" json:"ServerUuid,omitempty"` + PollRequest []*ServerMessage_ConversationRequest `protobuf:"bytes,7,rep,name=PollRequest,proto3" json:"PollRequest,omitempty"` + PollResponse map[string]*ServerMessage_ConversationResponse `protobuf:"bytes,8,rep,name=PollResponse,proto3" json:"PollResponse,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Messages []*ServerMessage_PostedMessage `protobuf:"bytes,9,rep,name=Messages,proto3" json:"Messages,omitempty"` + NextServerKey string `protobuf:"bytes,10,opt,name=NextServerKey,proto3" json:"NextServerKey,omitempty"` + Url string `protobuf:"bytes,11,opt,name=Url,proto3" json:"Url,omitempty"` +} + +func (x *ServerMessage) Reset() { + *x = ServerMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerMessage) ProtoMessage() {} + +func (x *ServerMessage) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerMessage.ProtoReflect.Descriptor instead. +func (*ServerMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{2} +} + +func (x *ServerMessage) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ServerMessage) GetServerPubKey() string { + if x != nil { + return x.ServerPubKey + } + return "" +} + +func (x *ServerMessage) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *ServerMessage) GetServerReceived() uint64 { + if x != nil { + return x.ServerReceived + } + return 0 +} + +func (x *ServerMessage) GetServerUuid() string { + if x != nil { + return x.ServerUuid + } + return "" +} + +func (x *ServerMessage) GetPollRequest() []*ServerMessage_ConversationRequest { + if x != nil { + return x.PollRequest + } + return nil +} + +func (x *ServerMessage) GetPollResponse() map[string]*ServerMessage_ConversationResponse { + if x != nil { + return x.PollResponse + } + return nil +} + +func (x *ServerMessage) GetMessages() []*ServerMessage_PostedMessage { + if x != nil { + return x.Messages + } + return nil +} + +func (x *ServerMessage) GetNextServerKey() string { + if x != nil { + return x.NextServerKey + } + return "" +} + +func (x *ServerMessage) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type Server struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` + PublicKey string `protobuf:"bytes,3,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` + Url string `protobuf:"bytes,4,opt,name=Url,proto3" json:"Url,omitempty"` + ConfidenceLevel int32 `protobuf:"varint,5,opt,name=ConfidenceLevel,proto3" json:"ConfidenceLevel,omitempty"` +} + +func (x *Server) Reset() { + *x = Server{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Server) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Server) ProtoMessage() {} + +func (x *Server) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Server.ProtoReflect.Descriptor instead. +func (*Server) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{3} +} + +func (x *Server) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Server) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Server) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +func (x *Server) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Server) GetConfidenceLevel() int32 { + if x != nil { + return x.ConfidenceLevel + } + return 0 +} + +type MinimalContact struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + PublicKey string `protobuf:"bytes,2,opt,name=publicKey,proto3" json:"publicKey,omitempty"` + TrustedServers []*Server `protobuf:"bytes,3,rep,name=TrustedServers,proto3" json:"TrustedServers,omitempty"` +} + +func (x *MinimalContact) Reset() { + *x = MinimalContact{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MinimalContact) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MinimalContact) ProtoMessage() {} + +func (x *MinimalContact) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MinimalContact.ProtoReflect.Descriptor instead. +func (*MinimalContact) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{4} +} + +func (x *MinimalContact) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MinimalContact) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +func (x *MinimalContact) GetTrustedServers() []*Server { + if x != nil { + return x.TrustedServers + } + return nil +} + +type UserMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=Destination,proto3" json:"Destination,omitempty"` + From string `protobuf:"bytes,2,opt,name=From,proto3" json:"From,omitempty"` + Type string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` + Status *UserMessage_ConversationStatus `protobuf:"bytes,5,opt,name=Status,proto3" json:"Status,omitempty"` + Contact *MinimalContact `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Group *UserMessage_Group `protobuf:"bytes,7,opt,name=group,proto3" json:"group,omitempty"` +} + +func (x *UserMessage) Reset() { + *x = UserMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserMessage) ProtoMessage() {} + +func (x *UserMessage) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserMessage.ProtoReflect.Descriptor instead. +func (*UserMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{5} +} + +func (x *UserMessage) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *UserMessage) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *UserMessage) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *UserMessage) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *UserMessage) GetStatus() *UserMessage_ConversationStatus { + if x != nil { + return x.Status + } + return nil +} + +func (x *UserMessage) GetContact() *MinimalContact { + if x != nil { + return x.Contact + } + return nil +} + +func (x *UserMessage) GetGroup() *UserMessage_Group { + if x != nil { + return x.Group + } + return nil +} + +type ServerMessage_ConversationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ccid string `protobuf:"bytes,1,opt,name=ccid,proto3" json:"ccid,omitempty"` + LastUuidOK string `protobuf:"bytes,2,opt,name=LastUuidOK,proto3" json:"LastUuidOK,omitempty"` + PublishOnline bool `protobuf:"varint,3,opt,name=PublishOnline,proto3" json:"PublishOnline,omitempty"` +} + +func (x *ServerMessage_ConversationRequest) Reset() { + *x = ServerMessage_ConversationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerMessage_ConversationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerMessage_ConversationRequest) ProtoMessage() {} + +func (x *ServerMessage_ConversationRequest) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerMessage_ConversationRequest.ProtoReflect.Descriptor instead. +func (*ServerMessage_ConversationRequest) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *ServerMessage_ConversationRequest) GetCcid() string { + if x != nil { + return x.Ccid + } + return "" +} + +func (x *ServerMessage_ConversationRequest) GetLastUuidOK() string { + if x != nil { + return x.LastUuidOK + } + return "" +} + +func (x *ServerMessage_ConversationRequest) GetPublishOnline() bool { + if x != nil { + return x.PublishOnline + } + return false +} + +type ServerMessage_ConversationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageUuids []string `protobuf:"bytes,1,rep,name=MessageUuids,proto3" json:"MessageUuids,omitempty"` + SourceIpAddress string `protobuf:"bytes,2,opt,name=SourceIpAddress,proto3" json:"SourceIpAddress,omitempty"` +} + +func (x *ServerMessage_ConversationResponse) Reset() { + *x = ServerMessage_ConversationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerMessage_ConversationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerMessage_ConversationResponse) ProtoMessage() {} + +func (x *ServerMessage_ConversationResponse) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerMessage_ConversationResponse.ProtoReflect.Descriptor instead. +func (*ServerMessage_ConversationResponse) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *ServerMessage_ConversationResponse) GetMessageUuids() []string { + if x != nil { + return x.MessageUuids + } + return nil +} + +func (x *ServerMessage_ConversationResponse) GetSourceIpAddress() string { + if x != nil { + return x.SourceIpAddress + } + return "" +} + +type ServerMessage_PostedMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ccid string `protobuf:"bytes,1,opt,name=ccid,proto3" json:"ccid,omitempty"` + Messages []*PackedUserMessage `protobuf:"bytes,2,rep,name=Messages,proto3" json:"Messages,omitempty"` +} + +func (x *ServerMessage_PostedMessage) Reset() { + *x = ServerMessage_PostedMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerMessage_PostedMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerMessage_PostedMessage) ProtoMessage() {} + +func (x *ServerMessage_PostedMessage) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerMessage_PostedMessage.ProtoReflect.Descriptor instead. +func (*ServerMessage_PostedMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{2, 3} +} + +func (x *ServerMessage_PostedMessage) GetCcid() string { + if x != nil { + return x.Ccid + } + return "" +} + +func (x *ServerMessage_PostedMessage) GetMessages() []*PackedUserMessage { + if x != nil { + return x.Messages + } + return nil +} + +type UserMessage_ConversationStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocalUuid string `protobuf:"bytes,1,opt,name=LocalUuid,proto3" json:"LocalUuid,omitempty"` + LocalSequence uint64 `protobuf:"varint,2,opt,name=LocalSequence,proto3" json:"LocalSequence,omitempty"` + Sent uint64 `protobuf:"varint,3,opt,name=Sent,proto3" json:"Sent,omitempty"` + Received uint64 `protobuf:"varint,4,opt,name=Received,proto3" json:"Received,omitempty"` + Processed uint64 `protobuf:"varint,5,opt,name=Processed,proto3" json:"Processed,omitempty"` + NextCcid string `protobuf:"bytes,6,opt,name=NextCcid,proto3" json:"NextCcid,omitempty"` + NextCcidAck bool `protobuf:"varint,7,opt,name=NextCcidAck,proto3" json:"NextCcidAck,omitempty"` // false when proposing a new id, true for accepting it + NextCcpkey string `protobuf:"bytes,8,opt,name=NextCcpkey,proto3" json:"NextCcpkey,omitempty"` + NextKeyCcpkeyAck bool `protobuf:"varint,9,opt,name=NextKeyCcpkeyAck,proto3" json:"NextKeyCcpkeyAck,omitempty"` // false when proposing a new key, true for accpeting it +} + +func (x *UserMessage_ConversationStatus) Reset() { + *x = UserMessage_ConversationStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserMessage_ConversationStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserMessage_ConversationStatus) ProtoMessage() {} + +func (x *UserMessage_ConversationStatus) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserMessage_ConversationStatus.ProtoReflect.Descriptor instead. +func (*UserMessage_ConversationStatus) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *UserMessage_ConversationStatus) GetLocalUuid() string { + if x != nil { + return x.LocalUuid + } + return "" +} + +func (x *UserMessage_ConversationStatus) GetLocalSequence() uint64 { + if x != nil { + return x.LocalSequence + } + return 0 +} + +func (x *UserMessage_ConversationStatus) GetSent() uint64 { + if x != nil { + return x.Sent + } + return 0 +} + +func (x *UserMessage_ConversationStatus) GetReceived() uint64 { + if x != nil { + return x.Received + } + return 0 +} + +func (x *UserMessage_ConversationStatus) GetProcessed() uint64 { + if x != nil { + return x.Processed + } + return 0 +} + +func (x *UserMessage_ConversationStatus) GetNextCcid() string { + if x != nil { + return x.NextCcid + } + return "" +} + +func (x *UserMessage_ConversationStatus) GetNextCcidAck() bool { + if x != nil { + return x.NextCcidAck + } + return false +} + +func (x *UserMessage_ConversationStatus) GetNextCcpkey() string { + if x != nil { + return x.NextCcpkey + } + return "" +} + +func (x *UserMessage_ConversationStatus) GetNextKeyCcpkeyAck() bool { + if x != nil { + return x.NextKeyCcpkeyAck + } + return false +} + +type UserMessage_Group struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Members []*MinimalContact `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` +} + +func (x *UserMessage_Group) Reset() { + *x = UserMessage_Group{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserMessage_Group) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserMessage_Group) ProtoMessage() {} + +func (x *UserMessage_Group) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserMessage_Group.ProtoReflect.Descriptor instead. +func (*UserMessage_Group) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{5, 1} +} + +func (x *UserMessage_Group) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserMessage_Group) GetMembers() []*MinimalContact { + if x != nil { + return x.Members + } + return nil +} + +var File_messages_proto protoreflect.FileDescriptor + +var file_messages_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x07, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x22, 0x61, 0x0a, 0x13, 0x50, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x81, 0x01, 0x0a, + 0x11, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0xe1, 0x06, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x75, 0x69, 0x64, 0x12, 0x4c, 0x0a, 0x0b, + 0x50, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2a, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x50, + 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x50, 0x6f, + 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x50, 0x6f, 0x6c, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6d, 0x65, 0x6f, + 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x4e, 0x65, + 0x78, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x4e, 0x65, 0x78, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, + 0x72, 0x6c, 0x1a, 0x6f, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x63, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x63, 0x69, 0x64, 0x12, 0x1e, 0x0a, + 0x0a, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x75, 0x69, 0x64, 0x4f, 0x4b, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x75, 0x69, 0x64, 0x4f, 0x4b, 0x12, 0x24, 0x0a, + 0x0d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4f, 0x6e, 0x6c, + 0x69, 0x6e, 0x65, 0x1a, 0x64, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x55, 0x75, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x55, 0x75, 0x69, 0x64, 0x73, 0x12, + 0x28, 0x0a, 0x0f, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x6c, 0x0a, 0x11, 0x50, 0x6f, 0x6c, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x41, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2b, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5b, 0x0a, 0x0d, 0x50, 0x6f, 0x73, 0x74, 0x65, + 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x63, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x63, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x08, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x55, + 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x22, 0x98, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x55, 0x72, 0x6c, 0x12, 0x28, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, + 0x6e, 0x63, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, + 0x7b, 0x0a, 0x0e, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x12, 0x37, 0x0a, 0x0e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x65, + 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0e, 0x54, 0x72, + 0x75, 0x73, 0x74, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x94, 0x05, 0x0a, + 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x46, 0x72, + 0x6f, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x06, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6d, 0x65, 0x6f, + 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, + 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x30, + 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x1a, 0xb0, 0x02, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x4c, 0x6f, 0x63, 0x61, 0x6c, + 0x55, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x55, 0x75, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x53, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, + 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x53, 0x65, 0x6e, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x50, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, + 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x65, 0x78, + 0x74, 0x43, 0x63, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x65, 0x78, + 0x74, 0x43, 0x63, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x43, 0x63, 0x69, + 0x64, 0x41, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4e, 0x65, 0x78, 0x74, + 0x43, 0x63, 0x69, 0x64, 0x41, 0x63, 0x6b, 0x12, 0x1e, 0x0a, 0x0a, 0x4e, 0x65, 0x78, 0x74, 0x43, + 0x63, 0x70, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4e, 0x65, 0x78, + 0x74, 0x43, 0x63, 0x70, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x4e, 0x65, 0x78, 0x74, 0x4b, + 0x65, 0x79, 0x43, 0x63, 0x70, 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x10, 0x4e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x43, 0x63, 0x70, 0x6b, 0x65, 0x79, + 0x41, 0x63, 0x6b, 0x1a, 0x4e, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x31, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x4d, 0x69, 0x6e, 0x69, + 0x6d, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x42, 0x21, 0x5a, 0x1f, 0x66, 0x6f, 0x72, 0x67, 0x65, 0x2e, 0x72, 0x65, 0x64, + 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x79, 0x76, 0x65, 0x73, 0x2f, 0x6d, + 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_messages_proto_rawDescOnce sync.Once + file_messages_proto_rawDescData = file_messages_proto_rawDesc +) + +func file_messages_proto_rawDescGZIP() []byte { + file_messages_proto_rawDescOnce.Do(func() { + file_messages_proto_rawDescData = protoimpl.X.CompressGZIP(file_messages_proto_rawDescData) + }) + return file_messages_proto_rawDescData +} + +var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_messages_proto_goTypes = []interface{}{ + (*PackedServerMessage)(nil), // 0: meowlib.PackedServerMessage + (*PackedUserMessage)(nil), // 1: meowlib.PackedUserMessage + (*ServerMessage)(nil), // 2: meowlib.ServerMessage + (*Server)(nil), // 3: meowlib.Server + (*MinimalContact)(nil), // 4: meowlib.MinimalContact + (*UserMessage)(nil), // 5: meowlib.UserMessage + (*ServerMessage_ConversationRequest)(nil), // 6: meowlib.ServerMessage.ConversationRequest + (*ServerMessage_ConversationResponse)(nil), // 7: meowlib.ServerMessage.ConversationResponse + nil, // 8: meowlib.ServerMessage.PollResponseEntry + (*ServerMessage_PostedMessage)(nil), // 9: meowlib.ServerMessage.PostedMessage + (*UserMessage_ConversationStatus)(nil), // 10: meowlib.UserMessage.ConversationStatus + (*UserMessage_Group)(nil), // 11: meowlib.UserMessage.Group +} +var file_messages_proto_depIdxs = []int32{ + 6, // 0: meowlib.ServerMessage.PollRequest:type_name -> meowlib.ServerMessage.ConversationRequest + 8, // 1: meowlib.ServerMessage.PollResponse:type_name -> meowlib.ServerMessage.PollResponseEntry + 9, // 2: meowlib.ServerMessage.Messages:type_name -> meowlib.ServerMessage.PostedMessage + 3, // 3: meowlib.MinimalContact.TrustedServers:type_name -> meowlib.Server + 10, // 4: meowlib.UserMessage.Status:type_name -> meowlib.UserMessage.ConversationStatus + 4, // 5: meowlib.UserMessage.contact:type_name -> meowlib.MinimalContact + 11, // 6: meowlib.UserMessage.group:type_name -> meowlib.UserMessage.Group + 7, // 7: meowlib.ServerMessage.PollResponseEntry.value:type_name -> meowlib.ServerMessage.ConversationResponse + 1, // 8: meowlib.ServerMessage.PostedMessage.Messages:type_name -> meowlib.PackedUserMessage + 4, // 9: meowlib.UserMessage.Group.members:type_name -> meowlib.MinimalContact + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_messages_proto_init() } +func file_messages_proto_init() { + if File_messages_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_messages_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PackedServerMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PackedUserMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Server); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MinimalContact); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerMessage_ConversationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerMessage_ConversationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerMessage_PostedMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserMessage_ConversationStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserMessage_Group); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_messages_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_messages_proto_goTypes, + DependencyIndexes: file_messages_proto_depIdxs, + MessageInfos: file_messages_proto_msgTypes, + }.Build() + File_messages_proto = out.File + file_messages_proto_rawDesc = nil + file_messages_proto_goTypes = nil + file_messages_proto_depIdxs = nil +} diff --git a/pb/messages.py b/pb/messages.py new file mode 100644 index 0000000..70377cc --- /dev/null +++ b/pb/messages.py @@ -0,0 +1,17 @@ +from socket import MsgFlag +import protoparser +import json + +def parseMessage(pb, parent): + if hasattr(pb, 'messages'): + for msg in pb.messages: + print(pb.messages) + + + +pb = protoparser.parse_from_file("pb/messages.proto") +#print(json.dumps(pb)) +print(json.dumps(pb.messages)) + +with open('messages.json', 'w') as f: + f.write(pb) \ No newline at end of file diff --git a/peer.go b/peer.go index 3e97d31..7869b31 100644 --- a/peer.go +++ b/peer.go @@ -16,7 +16,7 @@ import ( "github.com/makiuchi-d/gozxing/qrcode" ) -type Contact struct { +type ContactCard struct { Name string `json:"name,omitempty"` ContactPublicKey string `json:"contact_public_key,omitempty"` EncryptionPublicKey string `json:"encryption_public_key,omitempty"` @@ -27,7 +27,7 @@ type Contact struct { type Peer struct { Name string `json:"name,omitempty"` Me KeyPair `json:"me,omitempty"` - Contact Contact `json:"contact,omitempty"` + Contact ContactCard `json:"contact,omitempty"` Visible bool `json:"visible,omitempty"` VisiblePassword string `json:"visible_password,omitempty"` PasswordType string `json:"password_type,omitempty"` @@ -45,8 +45,8 @@ type Peer struct { type PeerList []Peer type Group struct { - Name string `json:"name,omitempty"` - Members []Contact `json:"members,omitempty"` + Name string `json:"name,omitempty"` + Members []ContactCard `json:"members,omitempty"` } func (pl *PeerList) GetFromPublicKey(publickey string) *Peer { @@ -81,7 +81,7 @@ func (peer *Peer) SendText(text string) { fmt.Println(im.MessageData.Destination) } -func (contact *Contact) WritePng(filename string) { +func (contact *ContactCard) WritePng(filename string) { jsonContact, _ := json.Marshal(contact) //imgdata := base64.StdEncoding.EncodeToString(jsonContact) size := int(math.Sqrt(float64(len(jsonContact))/3)) + 1 @@ -120,7 +120,7 @@ func (contact *Contact) WritePng(filename string) { } -func (contact *Contact) WriteQr(filename string) { +func (contact *ContactCard) WriteQr(filename string) { jsonContact, _ := json.Marshal(contact) qwriter := qrcode.NewQRCodeWriter() code, err := qwriter.Encode(string(jsonContact), gozxing.BarcodeFormat_QR_CODE, 512, 512, nil) @@ -136,8 +136,8 @@ func (contact *Contact) WriteQr(filename string) { } -func ReadQr(fielname string) Contact { - var contact Contact +func ReadQr(fielname string) ContactCard { + var contact ContactCard // open and decode image file file, _ := os.Open("qrcode.jpg") img, _, _ := image.Decode(file)