diff --git a/identity.go b/client/identity.go similarity index 64% rename from identity.go rename to client/identity.go index 7341aa9..73dbb13 100644 --- a/identity.go +++ b/client/identity.go @@ -1,42 +1,44 @@ -package meowlib +package client import ( "encoding/json" "io/ioutil" + "forge.redroom.link/yves/meowlib" "github.com/ProtonMail/gopenpgp/v2/helper" ) const key = "3pw0c8#6ZG8{75b5;3?fe80$2" type Identity struct { - Nickname string `json:"nickname,omitempty"` - PublicKey string `json:"public_key,omitempty"` - PrivateKey string `json:"private_key,omitempty"` - Status string `json:"status,omitempty"` - Peers PeerList `json:"peers,omitempty"` - KnownServers ServerList `json:"known_servers,omitempty"` - MessageServers ServerList `json:"message_servers,omitempty"` + Nickname string `json:"nickname,omitempty"` + PublicKey string `json:"public_key,omitempty"` + PrivateKey string `json:"private_key,omitempty"` + Status string `json:"status,omitempty"` + Peers PeerList `json:"peers,omitempty"` + KnownServers InternalServerList `json:"known_servers,omitempty"` + MessageServers InternalServerList `json:"message_servers,omitempty"` } func CreateIdentity(nickname string) *Identity { var id Identity id.Nickname = nickname - kp := NewKeyPair() + kp := meowlib.NewKeyPair() id.PublicKey = kp.Public id.PrivateKey = kp.Private return &id } -func (id *Identity) InvitePeer(myName string, contactName string, messageServerIdxs []int) (*Peer, *ContactCard) { +func (id *Identity) InvitePeer(myName string, contactName string, messageServerIdxs []int) (*Peer, *meowlib.ContactCard) { var peer Peer - var myContactCard ContactCard - peer.Me = NewKeyPair() - peer.EncryptionKp = NewKeyPair() - peer.LookupKp = NewKeyPair() + var myContactCard meowlib.ContactCard + peer.Me = meowlib.NewKeyPair() + peer.EncryptionKp = meowlib.NewKeyPair() + peer.LookupKp = meowlib.NewKeyPair() peer.Name = contactName for _, i := range messageServerIdxs { - myContactCard.PullServers = append(myContactCard.PullServers, id.MessageServers.Servers[i].ServerData) + srv := id.MessageServers.Servers[i].ServerData + myContactCard.PullServers = append(myContactCard.PullServers, &srv) } myContactCard.Name = myName myContactCard.ContactPublicKey = peer.Me.Public @@ -48,7 +50,7 @@ func (id *Identity) InvitePeer(myName string, contactName string, messageServerI return &id.Peers[len(id.Peers)-1], &myContactCard } -func (*Identity) FinalizeInvitation(peer *Peer, receivedContact *ContactCard) { +func (*Identity) FinalizeInvitation(peer *Peer, receivedContact *meowlib.ContactCard) { peer.Contact = *receivedContact } diff --git a/identity_test.go b/client/identity_test.go similarity index 95% rename from identity_test.go rename to client/identity_test.go index 10768a8..eae3a5d 100644 --- a/identity_test.go +++ b/client/identity_test.go @@ -1,4 +1,4 @@ -package meowlib +package client import ( "log" diff --git a/client/peer.go b/client/peer.go new file mode 100644 index 0000000..0650ece --- /dev/null +++ b/client/peer.go @@ -0,0 +1,83 @@ +package client + +import ( + "fmt" + "time" + + "forge.redroom.link/yves/meowlib" +) + +/* +type ContactCard struct { + Name string `json:"name,omitempty"` + ContactPublicKey string `json:"contact_public_key,omitempty"` + EncryptionPublicKey string `json:"encryption_public_key,omitempty"` + LookupPublicKey string `json:"lookup_public_key,omitempty"` + PullServers []meowlib.Server `json:"pull_servers,omitempty"` +} +*/ + +type Peer struct { + Name string `json:"name,omitempty"` + // Conversation []InternalMessage `json:"conversation,omitempty"` + // My own keys for that peer + Me meowlib.KeyPair `json:"me,omitempty"` + EncryptionKp meowlib.KeyPair `json:"conversation_kp,omitempty"` + LookupKp meowlib.KeyPair `json:"lookup_kp,omitempty"` + // Peer keys and infos + Contact meowlib.ContactCard `json:"contact,omitempty"` + // Internal management attributes + Visible bool `json:"visible,omitempty"` + VisiblePassword string `json:"visible_password,omitempty"` + PasswordType string `json:"password_type,omitempty"` + Blocked bool `json:"blocked,omitempty"` + MessageNotification string `json:"message_notification,omitempty"` + OnionMode bool `json:"onion_mode,omitempty"` + LastMessage time.Time `json:"last_message,omitempty"` +} + +type PeerList []Peer + +type Group struct { + Name string `json:"name,omitempty"` + Members []Peer `json:"members,omitempty"` +} + +func (pl *PeerList) GetFromPublicKey(publickey string) *Peer { + for _, peer := range *pl { + if peer.Contact.ContactPublicKey == publickey { + return &peer + } + } + return nil +} + +func (pl *PeerList) GetFromName(name string) *Peer { + for _, peer := range *pl { + if peer.Contact.Name == name { + return &peer + } + } + return nil +} + +func (p *Peer) AsymEncryptMessage(Message []byte) (lookupK string, EncryptedMsg []byte, Signature []byte, Servers []*meowlib.Server, err error) { + // prepares a message to send to a specific peer contact + EncryptedMsg, Signature, err = meowlib.EncryptAndSign(p.Contact.EncryptionPublicKey, p.Me.Private, Message) + if err != nil { + fmt.Println(err.Error()) + return "", nil, nil, nil, err + } + + return p.LookupKp.Public, EncryptedMsg, Signature, p.Contact.PullServers, err +} + +func (p *Peer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMsg []byte, err error) { + // reads a message from a specific peer contact + DecryptedMsg, err = meowlib.DecryptAndCheck(p.Me.Private, p.Contact.ContactPublicKey, Message, Signature) + if err != nil { + fmt.Println(err.Error()) + return nil, err + } + return DecryptedMsg, err +} diff --git a/peer_test.go b/client/peer_test.go similarity index 88% rename from peer_test.go rename to client/peer_test.go index 60891a9..41aa8b4 100644 --- a/peer_test.go +++ b/client/peer_test.go @@ -1,4 +1,4 @@ -package meowlib +package client import ( "testing" diff --git a/client/server.go b/client/server.go new file mode 100644 index 0000000..cb2cffb --- /dev/null +++ b/client/server.go @@ -0,0 +1,55 @@ +package client + +import ( + "fmt" + "time" + + "forge.redroom.link/yves/meowlib" +) + +type InternalServer struct { + ServerData meowlib.Server `json:"server_data,omitempty"` + Presence bool `json:"presence,omitempty"` + LastCheck time.Time `json:"last_check,omitempty"` + Uptime time.Duration `json:"uptime,omitempty"` + Login string `json:"login,omitempty"` + Password string `json:"password,omitempty"` + Me meowlib.KeyPair `json:"me,omitempty"` +} + +type InternalServerList struct { + Name string + Servers []InternalServer +} + +func InternalServerFromUrl(url string) *InternalServer { + var is InternalServer + is.ServerData.Url = url + return &is +} + +func (sl *InternalServerList) AddUrls(urls []string) { + for _, url := range urls { + sl.Servers = append(sl.Servers, *InternalServerFromUrl(url)) + } +} + +func (ints *InternalServer) AsymEncryptMessage(Message []byte) (EncryptedMsg []byte, Signature []byte, err error) { + // prepares a message to send to a specific internal server + EncryptedMsg, Signature, err = meowlib.EncryptAndSign(ints.ServerData.PublicKey, ints.Me.Private, Message) + if err != nil { + fmt.Println(err.Error()) + return nil, nil, err + } + return EncryptedMsg, Signature, err +} + +func (ints *InternalServer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMsg []byte, err error) { + // reads a message from a specific internal server + DecryptedMsg, err = meowlib.DecryptAndCheck(ints.Me.Private, ints.ServerData.PublicKey, Message, Signature) + if err != nil { + fmt.Println(err.Error()) + return nil, err + } + return DecryptedMsg, err +} diff --git a/contactcard.go b/contactcard.go new file mode 100644 index 0000000..b6d7001 --- /dev/null +++ b/contactcard.go @@ -0,0 +1,99 @@ +package meowlib + +import ( + "encoding/json" + "fmt" + "image" + "image/color" + "image/png" + "log" + "math" + "os" + + "github.com/makiuchi-d/gozxing" + "github.com/makiuchi-d/gozxing/qrcode" +) + +func ServerFromUrl(url string) *Server { + var s Server + s.Url = url + return &s +} + +func (contact *ContactCard) AddUrls(urls []string) { + for _, url := range urls { + contact.PullServers = append(contact.PullServers, ServerFromUrl(url)) + } +} + +func (contact *ContactCard) WritePng(filename string) { + jsonContact, _ := json.Marshal(contact) + //imgdata := base64.StdEncoding.EncodeToString(jsonContact) + size := int(math.Sqrt(float64(len(jsonContact))/3)) + 1 + println(size) + + // Create a colored i mage of the given width and height. + img := image.NewNRGBA(image.Rect(0, 0, size, size)) + + for y := 0; y < size; y++ { + for x := 0; x < size*3; x = x + 3 { + p1 := uint8(jsonContact[x+y]) + p2 := uint8(jsonContact[x+y+1]) + p3 := uint8(jsonContact[x+y+2]) + img.Set(x/3, y, color.NRGBA{ + R: p1, + G: p2, + B: p3, + A: 255, + }) + } + } + + f, err := os.Create(filename) + if err != nil { + log.Fatal(err) + } + + if err := png.Encode(f, img); err != nil { + f.Close() + log.Fatal(err) + } + + if err := f.Close(); err != nil { + log.Fatal(err) + } + +} + +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) + if err != nil { + println(err.Error()) + } + file, _ := os.Create("barcode.png") + defer file.Close() + + // *BitMatrix implements the image.Image interface, + // so it is able to be passed to png.Encode directly. + _ = png.Encode(file, code) + +} + +func ReadQr(fielname string) ContactCard { + var contact ContactCard + // open and decode image file + file, _ := os.Open("qrcode.jpg") + img, _, _ := image.Decode(file) + + // prepare BinaryBitmap + bmp, _ := gozxing.NewBinaryBitmapFromImage(img) + + // decode image + qrReader := qrcode.NewQRCodeReader() + result, _ := qrReader.Decode(bmp, nil) + + fmt.Println(result) + return contact +} diff --git a/endtoend_test.go b/endtoend_test.go index c554b68..6bc2c1b 100644 --- a/endtoend_test.go +++ b/endtoend_test.go @@ -1,10 +1,13 @@ -package meowlib +package meowlib_test import ( "encoding/json" "fmt" "io/ioutil" "testing" + + "forge.redroom.link/yves/meowlib" + "forge.redroom.link/yves/meowlib/client" ) func TestEndToEnd(t *testing.T) { @@ -12,10 +15,10 @@ func TestEndToEnd(t *testing.T) { // Create my own identity // fmt.Println("Trying to load identity from file.") - me, err := LoadIdentity("id.enc") + me, err := client.LoadIdentity("id.enc") if err != nil { fmt.Println("Failed : creating New identity...") - me = CreateIdentity("myname") + me = client.CreateIdentity("myname") // // define my preferences (servers) @@ -35,24 +38,19 @@ func TestEndToEnd(t *testing.T) { // // Simulate peer invitation response : generate the friend's keypair fmt.Println("Simulating first friend answer...") - var receivedContact ContactCard + var receivedContact meowlib.ContactCard // Friend simulated invitation - firstFriendContactKp := NewKeyPair() - firstFriendEncryptionKp := NewKeyPair() - firstFriendLookupKp := NewKeyPair() + firstFriendContactKp := meowlib.NewKeyPair() + firstFriendEncryptionKp := meowlib.NewKeyPair() + firstFriendLookupKp := meowlib.NewKeyPair() receivedContact.Name = "I'm the friend" receivedContact.ContactPublicKey = firstFriendContactKp.Public receivedContact.EncryptionPublicKey = firstFriendEncryptionKp.Public receivedContact.LookupPublicKey = firstFriendLookupKp.Public - var friendsMessageServers ServerList - friendsMessageServers.AddUrls([]string{"http://myfriend.org/meow/"}) + receivedContact.AddUrls([]string{"http://myfriend.org/meow/"}) // end Friend simulated invitation - for _, srv := range friendsMessageServers.Servers { - receivedContact.PullServers = append(receivedContact.PullServers, srv.ServerData) - } - // End simulating contact invitation response // @@ -83,7 +81,7 @@ func TestEndToEnd(t *testing.T) { // simulates if peer can decrypt my message //Message := "toto" //Signature := "test" - decMess, err2 := DecryptAndCheck(myFirstFriend.EncryptionKp.Private, myFirstFriend.Contact.EncryptionPublicKey, []byte(EncMsg), MsgSignature) + decMess, err2 := meowlib.DecryptAndCheck(myFirstFriend.EncryptionKp.Private, myFirstFriend.Contact.EncryptionPublicKey, []byte(EncMsg), MsgSignature) if err2 != nil { fmt.Println(err2.Error()) } diff --git a/go.mod b/go.mod index cda29ec..39a1026 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,6 @@ go 1.16 require ( github.com/ProtonMail/gopenpgp/v2 v2.2.4 - github.com/go-resty/resty/v2 v2.6.0 - github.com/golang/protobuf v1.5.2 // indirect - github.com/google/uuid v1.3.0 github.com/makiuchi-d/gozxing v0.1.1 github.com/rs/zerolog v1.25.0 github.com/stretchr/testify v1.4.0 diff --git a/go.sum b/go.sum index 57516f1..2c7f363 100644 --- a/go.sum +++ b/go.sum @@ -9,16 +9,10 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-resty/resty/v2 v2.6.0 h1:joIR5PNLM2EFqqESUjCMGXrWmXNHEU9CEiK813oKYS4= -github.com/go-resty/resty/v2 v2.6.0/go.mod h1:PwvJS6hvaPkjtjNg9ph+VrSD92bi5Zq73w/BIH7cC3Q= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/makiuchi-d/gozxing v0.1.1 h1:xxqijhoedi+/lZlhINteGbywIrewVdVv2wl9r5O9S1I= @@ -56,7 +50,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -84,9 +77,6 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/messages.pb.go b/messages.pb.go index d39f800..6910b85 100644 --- a/messages.pb.go +++ b/messages.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.26.0 +// protoc v3.6.1 // source: messages.proto package meowlib @@ -20,6 +20,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// structure for sending a message intended for server use in protobuf format type PackedServerMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -27,7 +28,7 @@ type PackedServerMessage struct { 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"` + Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` } func (x *PackedServerMessage) Reset() { @@ -76,13 +77,14 @@ func (x *PackedServerMessage) GetPayload() []byte { return nil } -func (x *PackedServerMessage) GetSignature() string { +func (x *PackedServerMessage) GetSignature() []byte { if x != nil { return x.Signature } - return "" + return nil } +// structure for sending a message to be forwarded to another user in protobuf format type PackedUserMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -154,25 +156,23 @@ func (x *PackedUserMessage) GetSignature() []byte { return nil } -type ServerMessage struct { +// structure defining a message encrypted, then sent in a "packedmessage" payload +type ToServerMessage 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"` + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` // Type + ServerPubKey string `protobuf:"bytes,2,opt,name=ServerPubKey,proto3" json:"ServerPubKey,omitempty"` // My pub key for the server to send me an encrypter answer + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` // optional payload for server + PullRequest []*ToServerMessage_ConversationRequest `protobuf:"bytes,7,rep,name=PullRequest,proto3" json:"PullRequest,omitempty"` + Messages []*ToServerMessage_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{} +func (x *ToServerMessage) Reset() { + *x = ToServerMessage{} if protoimpl.UnsafeEnabled { mi := &file_messages_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -180,13 +180,13 @@ func (x *ServerMessage) Reset() { } } -func (x *ServerMessage) String() string { +func (x *ToServerMessage) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ServerMessage) ProtoMessage() {} +func (*ToServerMessage) ProtoMessage() {} -func (x *ServerMessage) ProtoReflect() protoreflect.Message { +func (x *ToServerMessage) ProtoReflect() protoreflect.Message { mi := &file_messages_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -198,75 +198,166 @@ func (x *ServerMessage) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ServerMessage.ProtoReflect.Descriptor instead. -func (*ServerMessage) Descriptor() ([]byte, []int) { +// Deprecated: Use ToServerMessage.ProtoReflect.Descriptor instead. +func (*ToServerMessage) Descriptor() ([]byte, []int) { return file_messages_proto_rawDescGZIP(), []int{2} } -func (x *ServerMessage) GetType() string { +func (x *ToServerMessage) GetType() string { if x != nil { return x.Type } return "" } -func (x *ServerMessage) GetServerPubKey() string { +func (x *ToServerMessage) GetServerPubKey() string { if x != nil { return x.ServerPubKey } return "" } -func (x *ServerMessage) GetPayload() []byte { +func (x *ToServerMessage) GetPayload() []byte { if x != nil { return x.Payload } return nil } -func (x *ServerMessage) GetServerReceived() uint64 { +func (x *ToServerMessage) GetPullRequest() []*ToServerMessage_ConversationRequest { 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 x.PullRequest } return nil } -func (x *ServerMessage) GetPollResponse() map[string]*ServerMessage_ConversationResponse { - if x != nil { - return x.PollResponse - } - return nil -} - -func (x *ServerMessage) GetMessages() []*ServerMessage_PostedMessage { +func (x *ToServerMessage) GetMessages() []*ToServerMessage_PostedMessage { if x != nil { return x.Messages } return nil } -func (x *ServerMessage) GetNextServerKey() string { +func (x *ToServerMessage) GetNextServerKey() string { if x != nil { return x.NextServerKey } return "" } -func (x *ServerMessage) GetUrl() string { +func (x *ToServerMessage) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +// structure defining a from serve receiver message decrypted from a "packedmessage" payload +type FromServerMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` // Type + ServerPubKey string `protobuf:"bytes,2,opt,name=ServerPubKey,proto3" json:"ServerPubKey,omitempty"` // My pub key for the server to send me an encrypter answer + 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"` + PullResponse map[string]*FromServerMessage_ConversationResponse `protobuf:"bytes,8,rep,name=PullResponse,proto3" json:"PullResponse,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Messages []*FromServerMessage_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 *FromServerMessage) Reset() { + *x = FromServerMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FromServerMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FromServerMessage) ProtoMessage() {} + +func (x *FromServerMessage) 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 FromServerMessage.ProtoReflect.Descriptor instead. +func (*FromServerMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{3} +} + +func (x *FromServerMessage) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *FromServerMessage) GetServerPubKey() string { + if x != nil { + return x.ServerPubKey + } + return "" +} + +func (x *FromServerMessage) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *FromServerMessage) GetServerReceived() uint64 { + if x != nil { + return x.ServerReceived + } + return 0 +} + +func (x *FromServerMessage) GetServerUuid() string { + if x != nil { + return x.ServerUuid + } + return "" +} + +func (x *FromServerMessage) GetPullResponse() map[string]*FromServerMessage_ConversationResponse { + if x != nil { + return x.PullResponse + } + return nil +} + +func (x *FromServerMessage) GetMessages() []*FromServerMessage_PostedMessage { + if x != nil { + return x.Messages + } + return nil +} + +func (x *FromServerMessage) GetNextServerKey() string { + if x != nil { + return x.NextServerKey + } + return "" +} + +func (x *FromServerMessage) GetUrl() string { if x != nil { return x.Url } @@ -288,7 +379,7 @@ type Server struct { func (x *Server) Reset() { *x = Server{} if protoimpl.UnsafeEnabled { - mi := &file_messages_proto_msgTypes[3] + mi := &file_messages_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -301,7 +392,7 @@ func (x *Server) String() string { func (*Server) ProtoMessage() {} func (x *Server) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[3] + mi := &file_messages_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -314,7 +405,7 @@ func (x *Server) ProtoReflect() protoreflect.Message { // Deprecated: Use Server.ProtoReflect.Descriptor instead. func (*Server) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{3} + return file_messages_proto_rawDescGZIP(), []int{4} } func (x *Server) GetName() string { @@ -352,6 +443,85 @@ func (x *Server) GetConfidenceLevel() int32 { return 0 } +type ContactCard struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ContactPublicKey string `protobuf:"bytes,2,opt,name=contactPublicKey,proto3" json:"contactPublicKey,omitempty"` + EncryptionPublicKey string `protobuf:"bytes,3,opt,name=encryptionPublicKey,proto3" json:"encryptionPublicKey,omitempty"` + LookupPublicKey string `protobuf:"bytes,4,opt,name=lookupPublicKey,proto3" json:"lookupPublicKey,omitempty"` + PullServers []*Server `protobuf:"bytes,5,rep,name=PullServers,proto3" json:"PullServers,omitempty"` +} + +func (x *ContactCard) Reset() { + *x = ContactCard{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContactCard) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContactCard) ProtoMessage() {} + +func (x *ContactCard) 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 ContactCard.ProtoReflect.Descriptor instead. +func (*ContactCard) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{5} +} + +func (x *ContactCard) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ContactCard) GetContactPublicKey() string { + if x != nil { + return x.ContactPublicKey + } + return "" +} + +func (x *ContactCard) GetEncryptionPublicKey() string { + if x != nil { + return x.EncryptionPublicKey + } + return "" +} + +func (x *ContactCard) GetLookupPublicKey() string { + if x != nil { + return x.LookupPublicKey + } + return "" +} + +func (x *ContactCard) GetPullServers() []*Server { + if x != nil { + return x.PullServers + } + return nil +} + type MinimalContact struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -365,7 +535,7 @@ type MinimalContact struct { func (x *MinimalContact) Reset() { *x = MinimalContact{} if protoimpl.UnsafeEnabled { - mi := &file_messages_proto_msgTypes[4] + mi := &file_messages_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -378,7 +548,7 @@ func (x *MinimalContact) String() string { func (*MinimalContact) ProtoMessage() {} func (x *MinimalContact) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[4] + mi := &file_messages_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -391,7 +561,7 @@ func (x *MinimalContact) ProtoReflect() protoreflect.Message { // Deprecated: Use MinimalContact.ProtoReflect.Descriptor instead. func (*MinimalContact) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{4} + return file_messages_proto_rawDescGZIP(), []int{6} } func (x *MinimalContact) GetName() string { @@ -432,7 +602,7 @@ type UserMessage struct { func (x *UserMessage) Reset() { *x = UserMessage{} if protoimpl.UnsafeEnabled { - mi := &file_messages_proto_msgTypes[5] + mi := &file_messages_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -445,7 +615,7 @@ func (x *UserMessage) String() string { func (*UserMessage) ProtoMessage() {} func (x *UserMessage) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[5] + mi := &file_messages_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -458,7 +628,7 @@ func (x *UserMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use UserMessage.ProtoReflect.Descriptor instead. func (*UserMessage) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{5} + return file_messages_proto_rawDescGZIP(), []int{7} } func (x *UserMessage) GetDestination() string { @@ -510,33 +680,34 @@ func (x *UserMessage) GetGroup() *UserMessage_Group { return nil } -type ServerMessage_ConversationRequest struct { +type ToServerMessage_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"` + LookupKey string `protobuf:"bytes,1,opt,name=lookupKey,proto3" json:"lookupKey,omitempty"` // lookup key for a conversation + LastServerUuidOK string `protobuf:"bytes,2,opt,name=LastServerUuidOK,proto3" json:"LastServerUuidOK,omitempty"` // Last Server message UUID received (send me all after that one) + PublishOnline bool `protobuf:"varint,3,opt,name=PublishOnline,proto3" json:"PublishOnline,omitempty"` // ?? Publish my online status for that contact ? + LookupSignature string `protobuf:"bytes,4,opt,name=lookupSignature,proto3" json:"lookupSignature,omitempty"` // prove that I own the private key by signing that block } -func (x *ServerMessage_ConversationRequest) Reset() { - *x = ServerMessage_ConversationRequest{} +func (x *ToServerMessage_ConversationRequest) Reset() { + *x = ToServerMessage_ConversationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_messages_proto_msgTypes[6] + mi := &file_messages_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ServerMessage_ConversationRequest) String() string { +func (x *ToServerMessage_ConversationRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ServerMessage_ConversationRequest) ProtoMessage() {} +func (*ToServerMessage_ConversationRequest) ProtoMessage() {} -func (x *ServerMessage_ConversationRequest) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[6] +func (x *ToServerMessage_ConversationRequest) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -547,98 +718,50 @@ func (x *ServerMessage_ConversationRequest) ProtoReflect() protoreflect.Message return mi.MessageOf(x) } -// Deprecated: Use ServerMessage_ConversationRequest.ProtoReflect.Descriptor instead. -func (*ServerMessage_ConversationRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ToServerMessage_ConversationRequest.ProtoReflect.Descriptor instead. +func (*ToServerMessage_ConversationRequest) Descriptor() ([]byte, []int) { return file_messages_proto_rawDescGZIP(), []int{2, 0} } -func (x *ServerMessage_ConversationRequest) GetCcid() string { +func (x *ToServerMessage_ConversationRequest) GetLookupKey() string { if x != nil { - return x.Ccid + return x.LookupKey } return "" } -func (x *ServerMessage_ConversationRequest) GetLastUuidOK() string { +func (x *ToServerMessage_ConversationRequest) GetLastServerUuidOK() string { if x != nil { - return x.LastUuidOK + return x.LastServerUuidOK } return "" } -func (x *ServerMessage_ConversationRequest) GetPublishOnline() bool { +func (x *ToServerMessage_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 { +func (x *ToServerMessage_ConversationRequest) GetLookupSignature() string { if x != nil { - return x.MessageUuids - } - return nil -} - -func (x *ServerMessage_ConversationResponse) GetSourceIpAddress() string { - if x != nil { - return x.SourceIpAddress + return x.LookupSignature } return "" } -type ServerMessage_PostedMessage struct { +type ToServerMessage_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"` + LookupKey string `protobuf:"bytes,1,opt,name=lookupKey,proto3" json:"lookupKey,omitempty"` + Messages []*PackedUserMessage `protobuf:"bytes,2,rep,name=Messages,proto3" json:"Messages,omitempty"` } -func (x *ServerMessage_PostedMessage) Reset() { - *x = ServerMessage_PostedMessage{} +func (x *ToServerMessage_PostedMessage) Reset() { + *x = ToServerMessage_PostedMessage{} if protoimpl.UnsafeEnabled { mi := &file_messages_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -646,13 +769,13 @@ func (x *ServerMessage_PostedMessage) Reset() { } } -func (x *ServerMessage_PostedMessage) String() string { +func (x *ToServerMessage_PostedMessage) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ServerMessage_PostedMessage) ProtoMessage() {} +func (*ToServerMessage_PostedMessage) ProtoMessage() {} -func (x *ServerMessage_PostedMessage) ProtoReflect() protoreflect.Message { +func (x *ToServerMessage_PostedMessage) ProtoReflect() protoreflect.Message { mi := &file_messages_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -664,19 +787,121 @@ func (x *ServerMessage_PostedMessage) ProtoReflect() protoreflect.Message { 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} +// Deprecated: Use ToServerMessage_PostedMessage.ProtoReflect.Descriptor instead. +func (*ToServerMessage_PostedMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{2, 1} } -func (x *ServerMessage_PostedMessage) GetCcid() string { +func (x *ToServerMessage_PostedMessage) GetLookupKey() string { if x != nil { - return x.Ccid + return x.LookupKey } return "" } -func (x *ServerMessage_PostedMessage) GetMessages() []*PackedUserMessage { +func (x *ToServerMessage_PostedMessage) GetMessages() []*PackedUserMessage { + if x != nil { + return x.Messages + } + return nil +} + +type FromServerMessage_ConversationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageUuids []string `protobuf:"bytes,1,rep,name=MessageUuids,proto3" json:"MessageUuids,omitempty"` +} + +func (x *FromServerMessage_ConversationResponse) Reset() { + *x = FromServerMessage_ConversationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FromServerMessage_ConversationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FromServerMessage_ConversationResponse) ProtoMessage() {} + +func (x *FromServerMessage_ConversationResponse) 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 FromServerMessage_ConversationResponse.ProtoReflect.Descriptor instead. +func (*FromServerMessage_ConversationResponse) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *FromServerMessage_ConversationResponse) GetMessageUuids() []string { + if x != nil { + return x.MessageUuids + } + return nil +} + +type FromServerMessage_PostedMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LookupKey string `protobuf:"bytes,1,opt,name=lookupKey,proto3" json:"lookupKey,omitempty"` + Messages []*PackedUserMessage `protobuf:"bytes,2,rep,name=Messages,proto3" json:"Messages,omitempty"` +} + +func (x *FromServerMessage_PostedMessage) Reset() { + *x = FromServerMessage_PostedMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FromServerMessage_PostedMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FromServerMessage_PostedMessage) ProtoMessage() {} + +func (x *FromServerMessage_PostedMessage) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[12] + 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 FromServerMessage_PostedMessage.ProtoReflect.Descriptor instead. +func (*FromServerMessage_PostedMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{3, 2} +} + +func (x *FromServerMessage_PostedMessage) GetLookupKey() string { + if x != nil { + return x.LookupKey + } + return "" +} + +func (x *FromServerMessage_PostedMessage) GetMessages() []*PackedUserMessage { if x != nil { return x.Messages } @@ -693,9 +918,9 @@ type UserMessage_ConversationStatus struct { 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"` - NextCkey string `protobuf:"bytes,6,opt,name=NextCkey,proto3" json:"NextCkey,omitempty"` // conversation key + NextCkey string `protobuf:"bytes,6,opt,name=NextCkey,proto3" json:"NextCkey,omitempty"` // contact key NextCkeyAck bool `protobuf:"varint,7,opt,name=NextCkeyAck,proto3" json:"NextCkeyAck,omitempty"` // false when proposing a new id, true for accepting it - NextEkey string `protobuf:"bytes,8,opt,name=NextEkey,proto3" json:"NextEkey,omitempty"` // encrypted key + NextEkey string `protobuf:"bytes,8,opt,name=NextEkey,proto3" json:"NextEkey,omitempty"` // encryption key NextKeyEkeyAck bool `protobuf:"varint,9,opt,name=NextKeyEkeyAck,proto3" json:"NextKeyEkeyAck,omitempty"` // false when proposing a new key, true for accpeting it NextLkey string `protobuf:"bytes,10,opt,name=NextLkey,proto3" json:"NextLkey,omitempty"` // lookup key NextLkeyAck bool `protobuf:"varint,11,opt,name=NextLkeyAck,proto3" json:"NextLkeyAck,omitempty"` // false when proposing a new id, true for accepting it @@ -704,7 +929,7 @@ type UserMessage_ConversationStatus struct { func (x *UserMessage_ConversationStatus) Reset() { *x = UserMessage_ConversationStatus{} if protoimpl.UnsafeEnabled { - mi := &file_messages_proto_msgTypes[10] + mi := &file_messages_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -717,7 +942,7 @@ func (x *UserMessage_ConversationStatus) String() string { func (*UserMessage_ConversationStatus) ProtoMessage() {} func (x *UserMessage_ConversationStatus) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[10] + mi := &file_messages_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -730,7 +955,7 @@ func (x *UserMessage_ConversationStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use UserMessage_ConversationStatus.ProtoReflect.Descriptor instead. func (*UserMessage_ConversationStatus) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{5, 0} + return file_messages_proto_rawDescGZIP(), []int{7, 0} } func (x *UserMessage_ConversationStatus) GetLocalUuid() string { @@ -822,7 +1047,7 @@ type UserMessage_Group struct { func (x *UserMessage_Group) Reset() { *x = UserMessage_Group{} if protoimpl.UnsafeEnabled { - mi := &file_messages_proto_msgTypes[11] + mi := &file_messages_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -835,7 +1060,7 @@ func (x *UserMessage_Group) String() string { func (*UserMessage_Group) ProtoMessage() {} func (x *UserMessage_Group) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[11] + mi := &file_messages_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -848,7 +1073,7 @@ func (x *UserMessage_Group) ProtoReflect() protoreflect.Message { // Deprecated: Use UserMessage_Group.ProtoReflect.Descriptor instead. func (*UserMessage_Group) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{5, 1} + return file_messages_proto_rawDescGZIP(), []int{7, 1} } func (x *UserMessage_Group) GetName() string { @@ -875,7 +1100,7 @@ var file_messages_proto_rawDesc = []byte{ 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, + 0x0c, 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, @@ -884,126 +1109,163 @@ var file_messages_proto_rawDesc = []byte{ 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, + 0x22, 0xc8, 0x04, 0x0a, 0x0f, 0x54, 0x6f, 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, 0x4e, 0x0a, 0x0b, 0x50, 0x75, 0x6c, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6d, 0x65, + 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x54, 0x6f, 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, 0x75, 0x6c, 0x6c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, + 0x69, 0x62, 0x2e, 0x54, 0x6f, 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, 0xca, 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, 0xe6, 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, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x65, 0x78, - 0x74, 0x43, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x43, 0x6b, 0x65, - 0x79, 0x41, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4e, 0x65, 0x78, 0x74, - 0x43, 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x45, - 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x45, - 0x6b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x4e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x45, 0x6b, - 0x65, 0x79, 0x41, 0x63, 0x6b, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x4e, 0x65, 0x78, - 0x74, 0x4b, 0x65, 0x79, 0x45, 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x4e, - 0x65, 0x78, 0x74, 0x4c, 0x6b, 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, - 0x65, 0x78, 0x74, 0x4c, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x4c, - 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4e, 0x65, - 0x78, 0x74, 0x4c, 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, + 0x72, 0x6c, 0x1a, 0xaf, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, + 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, + 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x4c, 0x61, 0x73, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x75, 0x69, 0x64, 0x4f, 0x4b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 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, 0x12, 0x28, 0x0a, 0x0f, 0x6c, 0x6f, + 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x1a, 0x65, 0x0a, 0x0d, 0x50, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, + 0x4b, 0x65, 0x79, 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, 0x92, 0x05, 0x0a, 0x11, + 0x46, 0x72, 0x6f, 0x6d, 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, 0x50, 0x0a, 0x0c, 0x50, + 0x75, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2c, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x46, 0x72, 0x6f, 0x6d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x75, + 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0c, 0x50, 0x75, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, + 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x28, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 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, 0x3a, 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, 0x1a, 0x70, 0x0a, 0x11, 0x50, 0x75, 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, 0x45, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, + 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 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, 0x65, 0x0a, 0x0d, 0x50, 0x6f, 0x73, + 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, + 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, + 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 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, 0xdc, 0x01, 0x0a, 0x0b, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x43, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x2a, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x63, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x13, 0x65, + 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x28, 0x0a, + 0x0f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x0b, 0x50, 0x75, 0x6c, 0x6c, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, + 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0b, 0x50, + 0x75, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 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, 0xca, 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, 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, + 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, 0xe6, 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, 0x6b, 0x65, 0x79, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x43, 0x6b, 0x65, 0x79, + 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x43, 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x43, 0x6b, 0x65, 0x79, 0x41, + 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x6b, 0x65, 0x79, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x6b, 0x65, 0x79, 0x12, 0x26, + 0x0a, 0x0e, 0x4e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x45, 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x4e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x45, + 0x6b, 0x65, 0x79, 0x41, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x4c, 0x6b, + 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x65, 0x78, 0x74, 0x4c, 0x6b, + 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x4c, 0x6b, 0x65, 0x79, 0x41, 0x63, + 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4e, 0x65, 0x78, 0x74, 0x4c, 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 ( @@ -1018,37 +1280,43 @@ func file_messages_proto_rawDescGZIP() []byte { return file_messages_proto_rawDescData } -var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 15) 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 + (*PackedServerMessage)(nil), // 0: meowlib.PackedServerMessage + (*PackedUserMessage)(nil), // 1: meowlib.PackedUserMessage + (*ToServerMessage)(nil), // 2: meowlib.ToServerMessage + (*FromServerMessage)(nil), // 3: meowlib.FromServerMessage + (*Server)(nil), // 4: meowlib.Server + (*ContactCard)(nil), // 5: meowlib.ContactCard + (*MinimalContact)(nil), // 6: meowlib.MinimalContact + (*UserMessage)(nil), // 7: meowlib.UserMessage + (*ToServerMessage_ConversationRequest)(nil), // 8: meowlib.ToServerMessage.ConversationRequest + (*ToServerMessage_PostedMessage)(nil), // 9: meowlib.ToServerMessage.PostedMessage + (*FromServerMessage_ConversationResponse)(nil), // 10: meowlib.FromServerMessage.ConversationResponse + nil, // 11: meowlib.FromServerMessage.PullResponseEntry + (*FromServerMessage_PostedMessage)(nil), // 12: meowlib.FromServerMessage.PostedMessage + (*UserMessage_ConversationStatus)(nil), // 13: meowlib.UserMessage.ConversationStatus + (*UserMessage_Group)(nil), // 14: 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 + 8, // 0: meowlib.ToServerMessage.PullRequest:type_name -> meowlib.ToServerMessage.ConversationRequest + 9, // 1: meowlib.ToServerMessage.Messages:type_name -> meowlib.ToServerMessage.PostedMessage + 11, // 2: meowlib.FromServerMessage.PullResponse:type_name -> meowlib.FromServerMessage.PullResponseEntry + 12, // 3: meowlib.FromServerMessage.Messages:type_name -> meowlib.FromServerMessage.PostedMessage + 4, // 4: meowlib.ContactCard.PullServers:type_name -> meowlib.Server + 4, // 5: meowlib.MinimalContact.TrustedServers:type_name -> meowlib.Server + 13, // 6: meowlib.UserMessage.Status:type_name -> meowlib.UserMessage.ConversationStatus + 6, // 7: meowlib.UserMessage.contact:type_name -> meowlib.MinimalContact + 14, // 8: meowlib.UserMessage.group:type_name -> meowlib.UserMessage.Group + 1, // 9: meowlib.ToServerMessage.PostedMessage.Messages:type_name -> meowlib.PackedUserMessage + 10, // 10: meowlib.FromServerMessage.PullResponseEntry.value:type_name -> meowlib.FromServerMessage.ConversationResponse + 1, // 11: meowlib.FromServerMessage.PostedMessage.Messages:type_name -> meowlib.PackedUserMessage + 6, // 12: meowlib.UserMessage.Group.members:type_name -> meowlib.MinimalContact + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_messages_proto_init() } @@ -1082,7 +1350,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerMessage); i { + switch v := v.(*ToServerMessage); i { case 0: return &v.state case 1: @@ -1094,7 +1362,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Server); i { + switch v := v.(*FromServerMessage); i { case 0: return &v.state case 1: @@ -1106,7 +1374,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MinimalContact); i { + switch v := v.(*Server); i { case 0: return &v.state case 1: @@ -1118,7 +1386,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserMessage); i { + switch v := v.(*ContactCard); i { case 0: return &v.state case 1: @@ -1130,7 +1398,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerMessage_ConversationRequest); i { + switch v := v.(*MinimalContact); i { case 0: return &v.state case 1: @@ -1142,7 +1410,19 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerMessage_ConversationResponse); i { + 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[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ToServerMessage_ConversationRequest); i { case 0: return &v.state case 1: @@ -1154,7 +1434,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerMessage_PostedMessage); i { + switch v := v.(*ToServerMessage_PostedMessage); i { case 0: return &v.state case 1: @@ -1166,6 +1446,30 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FromServerMessage_ConversationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FromServerMessage_PostedMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserMessage_ConversationStatus); i { case 0: return &v.state @@ -1177,7 +1481,7 @@ func file_messages_proto_init() { return nil } } - file_messages_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_messages_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserMessage_Group); i { case 0: return &v.state @@ -1196,7 +1500,7 @@ func file_messages_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_messages_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 15, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/messages.proto b/pb/messages.proto index 78745b0..0fce660 100644 --- a/pb/messages.proto +++ b/pb/messages.proto @@ -72,6 +72,15 @@ message Server { int32 ConfidenceLevel = 5; } +message ContactCard { + string name=1; + string contactPublicKey =2; + string encryptionPublicKey= 3; + string lookupPublicKey =4; + repeated Server PullServers =5; +} + + message MinimalContact { string name=1; string publicKey=2; diff --git a/peer.go b/peer.go deleted file mode 100644 index 5edadbb..0000000 --- a/peer.go +++ /dev/null @@ -1,160 +0,0 @@ -package meowlib - -import ( - "encoding/json" - "fmt" - "image" - "image/color" - "image/png" - "log" - "math" - "os" - "time" - - "github.com/makiuchi-d/gozxing" - "github.com/makiuchi-d/gozxing/qrcode" -) - -type ContactCard struct { - Name string `json:"name,omitempty"` - ContactPublicKey string `json:"contact_public_key,omitempty"` - EncryptionPublicKey string `json:"encryption_public_key,omitempty"` - LookupPublicKey string `json:"lookup_public_key,omitempty"` - PullServers []Server `json:"pull_servers,omitempty"` -} - -type Peer struct { - Name string `json:"name,omitempty"` - // Conversation []InternalMessage `json:"conversation,omitempty"` - // My own keys for that peer - Me KeyPair `json:"me,omitempty"` - EncryptionKp KeyPair `json:"conversation_kp,omitempty"` - LookupKp KeyPair `json:"lookup_kp,omitempty"` - // Peer keys and infos - Contact ContactCard `json:"contact,omitempty"` - // Internal management attributes - Visible bool `json:"visible,omitempty"` - VisiblePassword string `json:"visible_password,omitempty"` - PasswordType string `json:"password_type,omitempty"` - Blocked bool `json:"blocked,omitempty"` - MessageNotification string `json:"message_notification,omitempty"` - OnionMode bool `json:"onion_mode,omitempty"` - LastMessage time.Time `json:"last_message,omitempty"` -} - -type PeerList []Peer - -type Group struct { - Name string `json:"name,omitempty"` - Members []Peer `json:"members,omitempty"` -} - -func (pl *PeerList) GetFromPublicKey(publickey string) *Peer { - for _, peer := range *pl { - if peer.Contact.ContactPublicKey == publickey { - return &peer - } - } - return nil -} - -func (pl *PeerList) GetFromName(name string) *Peer { - for _, peer := range *pl { - if peer.Contact.Name == name { - return &peer - } - } - return nil -} - -func (contact *ContactCard) WritePng(filename string) { - jsonContact, _ := json.Marshal(contact) - //imgdata := base64.StdEncoding.EncodeToString(jsonContact) - size := int(math.Sqrt(float64(len(jsonContact))/3)) + 1 - println(size) - - // Create a colored i mage of the given width and height. - img := image.NewNRGBA(image.Rect(0, 0, size, size)) - - for y := 0; y < size; y++ { - for x := 0; x < size*3; x = x + 3 { - p1 := uint8(jsonContact[x+y]) - p2 := uint8(jsonContact[x+y+1]) - p3 := uint8(jsonContact[x+y+2]) - img.Set(x/3, y, color.NRGBA{ - R: p1, - G: p2, - B: p3, - A: 255, - }) - } - } - - f, err := os.Create(filename) - if err != nil { - log.Fatal(err) - } - - if err := png.Encode(f, img); err != nil { - f.Close() - log.Fatal(err) - } - - if err := f.Close(); err != nil { - log.Fatal(err) - } - -} - -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) - if err != nil { - println(err.Error()) - } - file, _ := os.Create("barcode.png") - defer file.Close() - - // *BitMatrix implements the image.Image interface, - // so it is able to be passed to png.Encode directly. - _ = png.Encode(file, code) - -} - -func ReadQr(fielname string) ContactCard { - var contact ContactCard - // open and decode image file - file, _ := os.Open("qrcode.jpg") - img, _, _ := image.Decode(file) - - // prepare BinaryBitmap - bmp, _ := gozxing.NewBinaryBitmapFromImage(img) - - // decode image - qrReader := qrcode.NewQRCodeReader() - result, _ := qrReader.Decode(bmp, nil) - - fmt.Println(result) - return contact -} - -func (p *Peer) AsymEncryptMessage(Message []byte) (lookupK string, EncryptedMsg []byte, Signature []byte, Servers []Server, err error) { - // prepares a message to send to a specific peer contact - EncryptedMsg, Signature, err = EncryptAndSign(p.Contact.EncryptionPublicKey, p.Me.Private, Message) - if err != nil { - fmt.Println(err.Error()) - return "", nil, nil, nil, err - } - return p.LookupKp.Public, EncryptedMsg, Signature, p.Contact.PullServers, err -} - -func (p *Peer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMsg []byte, err error) { - // reads a message from a specific peer contact - DecryptedMsg, err = DecryptAndCheck(p.Me.Private, p.Contact.ContactPublicKey, Message, Signature) - if err != nil { - fmt.Println(err.Error()) - return nil, err - } - return DecryptedMsg, err -} diff --git a/proto_test.go b/proto_test.go index 55c295f..44b4e07 100644 --- a/proto_test.go +++ b/proto_test.go @@ -1,19 +1,20 @@ -package meowlib +package meowlib_test import ( "io/ioutil" "log" "testing" + "forge.redroom.link/yves/meowlib" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/proto" ) func TestServerMessageSerialization(t *testing.T) { - var msg PackedServerMessage + var msg meowlib.PackedServerMessage msg.From = "toto" msg.Payload = []byte("mon texte") - msg.Signature = "moi" + msg.Signature = []byte("moi") out, err := proto.Marshal(&msg) if err != nil { log.Fatalln("Failed to encode address book:", err) @@ -25,7 +26,7 @@ func TestServerMessageSerialization(t *testing.T) { if err != nil { log.Fatalln("Error reading file:", err) } - rmsg := &PackedServerMessage{} + rmsg := &meowlib.PackedServerMessage{} if err := proto.Unmarshal(in, rmsg); err != nil { log.Fatalln("Failed to parse address book:", err) } diff --git a/server.go b/server.go deleted file mode 100644 index 62e9799..0000000 --- a/server.go +++ /dev/null @@ -1,53 +0,0 @@ -package meowlib - -import ( - "fmt" - "time" -) - -type InternalServer struct { - ServerData Server `json:"server_data,omitempty"` - Presence bool `json:"presence,omitempty"` - LastCheck time.Time `json:"last_check,omitempty"` - Uptime time.Duration `json:"uptime,omitempty"` - Login string `json:"login,omitempty"` - Password string `json:"password,omitempty"` - Me KeyPair `json:"me,omitempty"` -} - -type ServerList struct { - Name string - Servers []InternalServer -} - -func ServerFromUrl(url string) *InternalServer { - var is InternalServer - is.ServerData.Url = url - return &is -} - -func (sl *ServerList) AddUrls(urls []string) { - for _, url := range urls { - sl.Servers = append(sl.Servers, *ServerFromUrl(url)) - } -} - -func (ints *InternalServer) AsymEncryptMessage(Message []byte) (EncryptedMsg []byte, Signature []byte, err error) { - // prepares a message to send to a specific internal server - EncryptedMsg, Signature, err = EncryptAndSign(ints.ServerData.PublicKey, ints.Me.Private, Message) - if err != nil { - fmt.Println(err.Error()) - return nil, nil, err - } - return EncryptedMsg, Signature, err -} - -func (ints *InternalServer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMsg []byte, err error) { - // reads a message from a specific internal server - DecryptedMsg, err = DecryptAndCheck(ints.Me.Private, ints.ServerData.PublicKey, Message, Signature) - if err != nil { - fmt.Println(err.Error()) - return nil, err - } - return DecryptedMsg, err -} diff --git a/server/identity.go b/server/identity.go new file mode 100644 index 0000000..864caf8 --- /dev/null +++ b/server/identity.go @@ -0,0 +1,54 @@ +package client + +import ( + "encoding/json" + "io/ioutil" + + "forge.redroom.link/yves/meowlib" + "github.com/ProtonMail/gopenpgp/v2/helper" +) + +const key = "3pw0c8#6ZG8{75b5;3?fe80$2" + +type Identity struct { + ServerName string `json:"servername,omitempty"` + ServerDesc string `json:"servername,omitempty"` + PublicKey string `json:"public_key,omitempty"` + PrivateKey string `json:"private_key,omitempty"` + Status string `json:"status,omitempty"` + // KnownServers ServerList `json:"known_servers,omitempty"` +} + +func CreateIdentity(servername string, serverdesc string) *Identity { + var id Identity + id.ServerName = servername + id.ServerDesc = serverdesc + kp := meowlib.NewKeyPair() + id.PublicKey = kp.Public + id.PrivateKey = kp.Private + return &id +} + +func LoadIdentity(file string) (*Identity, error) { + var id Identity + indata, err := ioutil.ReadFile(file) + if err != nil { + return nil, err + } + pass, err := helper.DecryptMessageWithPassword([]byte(key), string(indata)) + if err != nil { + return nil, err + } + err = json.Unmarshal([]byte(pass), &id) + return &id, err +} + +func (id *Identity) Save(file string) error { + b, _ := json.Marshal(id) + armor, err := helper.EncryptMessageWithPassword([]byte(key), string(b)) + if err != nil { + return err + } + err = ioutil.WriteFile(file, []byte(armor), 0644) + return err +} diff --git a/servermessage.go b/servermessage.go deleted file mode 100644 index 3092927..0000000 --- a/servermessage.go +++ /dev/null @@ -1,54 +0,0 @@ -package meowlib - -import ( - "encoding/json" - - "github.com/rs/zerolog/log" -) - -const MessagesType = 1 -const PollRequestType = 1 -const PollResponseType = 1 -const MtrkType = 1 - -func (msg *ServerMessage) Pack() *PackedServerMessage { - var pck PackedServerMessage - - jsonMsg, _ := json.Marshal(msg) - armor, err := Encrypt(msg.ServerPubKey, jsonMsg) - if err != nil { - log.Error().Msg("Message encryption failed") - } - pck.Payload = []byte(armor) - return &pck -} - -func (pck *PackedServerMessage) Unpack(privateKey string) *ServerMessage { - var msg *ServerMessage - - decrypted, err := Decrypt(privateKey, pck.Payload) - if err != nil { - log.Error().Msg("Message decryption failed") - } - err = json.Unmarshal(decrypted, &msg) - if err != nil { - log.Error().Msg("Message encryption failed") - } - return msg -} - -func CreateMtrkChainServerMessage([]Server, []PackedUserMessage) *PackedServerMessage { - var msg PackedServerMessage - return &msg -} - -func (msg *ServerMessage) Parse() { - var pck PackedServerMessage - - jsonMsg, _ := json.Marshal(msg) - armor, err := Encrypt(msg.ServerPubKey, jsonMsg) - if err != nil { - log.Error().Msg("Message encryption failed") - } - pck.Payload = []byte(armor) -}