From 1866cf86ec321dee983e51b21d950de4cfc30f7c Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 30 Jun 2023 15:49:32 +0300 Subject: [PATCH] Unhardcode receive messages request payload format --- libgm/binary/client.pb.go | 33 ++-- libgm/binary/conversations.pb.go | 6 +- libgm/binary/events.pb.go | 6 +- libgm/binary/media.pb.go | 49 +++-- libgm/binary/messages.pb.go | 278 ++++++++++++++++++++--------- libgm/binary/raw/client.proto | 4 +- libgm/binary/raw/events.proto | 8 +- libgm/binary/raw/media.proto | 4 +- libgm/binary/raw/messages.proto | 16 +- libgm/binary/raw/relay.proto | 2 +- libgm/client.go | 14 +- libgm/media_processor.go | 11 +- libgm/pair.go | 5 +- libgm/payload/receiveMessages.go | 50 +++--- libgm/payload/refreshPhoneRelay.go | 10 +- libgm/payload/sendMessage.go | 2 +- 16 files changed, 295 insertions(+), 203 deletions(-) diff --git a/libgm/binary/client.pb.go b/libgm/binary/client.pb.go index 9159670..e9eb1fe 100644 --- a/libgm/binary/client.pb.go +++ b/libgm/binary/client.pb.go @@ -277,8 +277,8 @@ type UploadImagePayload struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MetaData *ImageMetaData `protobuf:"bytes,1,opt,name=metaData,proto3" json:"metaData,omitempty"` - AuthData *AuthMessageBytes `protobuf:"bytes,2,opt,name=authData,proto3" json:"authData,omitempty"` + MetaData *ImageMetaData `protobuf:"bytes,1,opt,name=metaData,proto3" json:"metaData,omitempty"` + AuthData *AuthMessage `protobuf:"bytes,2,opt,name=authData,proto3" json:"authData,omitempty"` } func (x *UploadImagePayload) Reset() { @@ -320,7 +320,7 @@ func (x *UploadImagePayload) GetMetaData() *ImageMetaData { return nil } -func (x *UploadImagePayload) GetAuthData() *AuthMessageBytes { +func (x *UploadImagePayload) GetAuthData() *AuthMessage { if x != nil { return x.AuthData } @@ -461,22 +461,22 @@ var file_client_proto_rawDesc = []byte{ 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x22, - 0x7f, 0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x61, + 0x7a, 0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x31, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x36, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, - 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x73, + 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, + 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, - 0x22, 0x3c, 0x0a, 0x13, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x42, - 0x75, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x1f, - 0x0a, 0x09, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, - 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x22, 0x3c, 0x0a, 0x13, 0x42, + 0x75, 0x67, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x1f, 0x0a, 0x09, 0x42, 0x75, 0x67, + 0x6c, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, + 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -504,7 +504,6 @@ var file_client_proto_goTypes = []interface{}{ (*MessageData)(nil), // 8: messages.MessageData (*AuthMessage)(nil), // 9: messages.AuthMessage (*EmptyArr)(nil), // 10: messages.EmptyArr - (*AuthMessageBytes)(nil), // 11: messages.AuthMessageBytes } var file_client_proto_depIdxs = []int32{ 7, // 0: client.SendMessage.pairedDevice:type_name -> messages.Device @@ -515,7 +514,7 @@ var file_client_proto_depIdxs = []int32{ 10, // 5: client.AckMessagePayload.emptyArr:type_name -> messages.EmptyArr 7, // 6: client.AckMessageData.device:type_name -> messages.Device 3, // 7: client.UploadImagePayload.metaData:type_name -> client.ImageMetaData - 11, // 8: client.UploadImagePayload.authData:type_name -> messages.AuthMessageBytes + 9, // 8: client.UploadImagePayload.authData:type_name -> messages.AuthMessage 6, // 9: client.BugleBackendService.data:type_name -> client.BugleCode 10, // [10:10] is the sub-list for method output_type 10, // [10:10] is the sub-list for method input_type diff --git a/libgm/binary/conversations.pb.go b/libgm/binary/conversations.pb.go index 83cc052..8802909 100644 --- a/libgm/binary/conversations.pb.go +++ b/libgm/binary/conversations.pb.go @@ -1142,11 +1142,13 @@ type MessageStatus struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // // MMS / SMS // UNKNOWN_STATUS = 0; - // // SENDING = 5; - // // SENT = 1; + // + // // RCS + // READ|SEEN = 11; Code int64 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` ErrMsg string `protobuf:"bytes,4,opt,name=errMsg,proto3" json:"errMsg,omitempty"` MsgStatus string `protobuf:"bytes,5,opt,name=msgStatus,proto3" json:"msgStatus,omitempty"` diff --git a/libgm/binary/events.pb.go b/libgm/binary/events.pb.go index e7c6bac..939457e 100644 --- a/libgm/binary/events.pb.go +++ b/libgm/binary/events.pb.go @@ -273,9 +273,7 @@ var File_events_proto protoreflect.FileDescriptor var file_events_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x13, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, @@ -345,8 +343,6 @@ func file_events_proto_init() { if File_events_proto != nil { return } - file_settings_proto_init() - file_messages_proto_init() file_conversations_proto_init() if !protoimpl.UnsafeEnabled { file_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { diff --git a/libgm/binary/media.pb.go b/libgm/binary/media.pb.go index 8808cff..9dc5863 100644 --- a/libgm/binary/media.pb.go +++ b/libgm/binary/media.pb.go @@ -25,9 +25,9 @@ type StartMediaUploadPayload struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ImageType int64 `protobuf:"varint,1,opt,name=imageType,proto3" json:"imageType,omitempty"` - AuthData *AuthMessageBytes `protobuf:"bytes,2,opt,name=authData,proto3" json:"authData,omitempty"` - Mobile *Device `protobuf:"bytes,3,opt,name=mobile,proto3" json:"mobile,omitempty"` + ImageType int64 `protobuf:"varint,1,opt,name=imageType,proto3" json:"imageType,omitempty"` + AuthData *AuthMessage `protobuf:"bytes,2,opt,name=authData,proto3" json:"authData,omitempty"` + Mobile *Device `protobuf:"bytes,3,opt,name=mobile,proto3" json:"mobile,omitempty"` } func (x *StartMediaUploadPayload) Reset() { @@ -69,7 +69,7 @@ func (x *StartMediaUploadPayload) GetImageType() int64 { return 0 } -func (x *StartMediaUploadPayload) GetAuthData() *AuthMessageBytes { +func (x *StartMediaUploadPayload) GetAuthData() *AuthMessage { if x != nil { return x.AuthData } @@ -198,28 +198,27 @@ var File_media_proto protoreflect.FileDescriptor var file_media_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x1a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x17, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4d, 0x65, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x01, 0x0a, 0x17, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x36, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x08, 0x61, 0x75, - 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x06, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, - 0x22, 0x53, 0x0a, 0x13, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x6d, 0x65, 0x64, 0x69, 0x61, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x52, 0x05, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x43, 0x0a, 0x05, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x64, 0x69, - 0x61, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6d, - 0x65, 0x64, 0x69, 0x61, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, - 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x28, 0x0a, 0x06, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x22, 0x53, 0x0a, 0x13, 0x55, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x52, + 0x05, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x22, 0x43, 0x0a, 0x05, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x64, + 0x69, 0x61, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x64, 0x69, + 0x61, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, + 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -239,11 +238,11 @@ var file_media_proto_goTypes = []interface{}{ (*StartMediaUploadPayload)(nil), // 0: media.StartMediaUploadPayload (*UploadMediaResponse)(nil), // 1: media.UploadMediaResponse (*Media)(nil), // 2: media.Media - (*AuthMessageBytes)(nil), // 3: messages.AuthMessageBytes + (*AuthMessage)(nil), // 3: messages.AuthMessage (*Device)(nil), // 4: messages.Device } var file_media_proto_depIdxs = []int32{ - 3, // 0: media.StartMediaUploadPayload.authData:type_name -> messages.AuthMessageBytes + 3, // 0: media.StartMediaUploadPayload.authData:type_name -> messages.AuthMessage 4, // 1: media.StartMediaUploadPayload.mobile:type_name -> messages.Device 2, // 2: media.UploadMediaResponse.media:type_name -> media.Media 3, // [3:3] is the sub-list for method output_type diff --git a/libgm/binary/messages.pb.go b/libgm/binary/messages.pb.go index 1da3ac8..bf6840c 100644 --- a/libgm/binary/messages.pb.go +++ b/libgm/binary/messages.pb.go @@ -414,7 +414,7 @@ type AuthMessage struct { unknownFields protoimpl.UnknownFields RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - RpcKey string `protobuf:"bytes,6,opt,name=rpcKey,proto3" json:"rpcKey,omitempty"` + RpcKey []byte `protobuf:"bytes,6,opt,name=rpcKey,proto3" json:"rpcKey,omitempty"` Date *Date `protobuf:"bytes,7,opt,name=date,proto3" json:"date,omitempty"` } @@ -457,11 +457,11 @@ func (x *AuthMessage) GetRequestId() string { return "" } -func (x *AuthMessage) GetRpcKey() string { +func (x *AuthMessage) GetRpcKey() []byte { if x != nil { return x.RpcKey } - return "" + return nil } func (x *AuthMessage) GetDate() *Date { @@ -471,18 +471,17 @@ func (x *AuthMessage) GetDate() *Date { return nil } -type AuthMessageBytes struct { +type ReceiveMessagesRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - RpcKey []byte `protobuf:"bytes,6,opt,name=rpcKey,proto3" json:"rpcKey,omitempty"` - Date *Date `protobuf:"bytes,7,opt,name=date,proto3" json:"date,omitempty"` + Auth *AuthMessage `protobuf:"bytes,1,opt,name=auth,proto3" json:"auth,omitempty"` + Unknown *ReceiveMessagesRequest_UnknownEmptyObject2 `protobuf:"bytes,4,opt,name=unknown,proto3,oneof" json:"unknown,omitempty"` } -func (x *AuthMessageBytes) Reset() { - *x = AuthMessageBytes{} +func (x *ReceiveMessagesRequest) Reset() { + *x = ReceiveMessagesRequest{} if protoimpl.UnsafeEnabled { mi := &file_messages_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -490,13 +489,13 @@ func (x *AuthMessageBytes) Reset() { } } -func (x *AuthMessageBytes) String() string { +func (x *ReceiveMessagesRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AuthMessageBytes) ProtoMessage() {} +func (*ReceiveMessagesRequest) ProtoMessage() {} -func (x *AuthMessageBytes) ProtoReflect() protoreflect.Message { +func (x *ReceiveMessagesRequest) ProtoReflect() protoreflect.Message { mi := &file_messages_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -508,28 +507,21 @@ func (x *AuthMessageBytes) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AuthMessageBytes.ProtoReflect.Descriptor instead. -func (*AuthMessageBytes) Descriptor() ([]byte, []int) { +// Deprecated: Use ReceiveMessagesRequest.ProtoReflect.Descriptor instead. +func (*ReceiveMessagesRequest) Descriptor() ([]byte, []int) { return file_messages_proto_rawDescGZIP(), []int{6} } -func (x *AuthMessageBytes) GetRequestId() string { +func (x *ReceiveMessagesRequest) GetAuth() *AuthMessage { if x != nil { - return x.RequestId - } - return "" -} - -func (x *AuthMessageBytes) GetRpcKey() []byte { - if x != nil { - return x.RpcKey + return x.Auth } return nil } -func (x *AuthMessageBytes) GetDate() *Date { +func (x *ReceiveMessagesRequest) GetUnknown() *ReceiveMessagesRequest_UnknownEmptyObject2 { if x != nil { - return x.Date + return x.Unknown } return nil } @@ -786,6 +778,91 @@ func (x *Date) GetSeq4() int64 { return 0 } +type ReceiveMessagesRequest_UnknownEmptyObject1 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject1) Reset() { + *x = ReceiveMessagesRequest_UnknownEmptyObject1{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReceiveMessagesRequest_UnknownEmptyObject1) ProtoMessage() {} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject1) 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 ReceiveMessagesRequest_UnknownEmptyObject1.ProtoReflect.Descriptor instead. +func (*ReceiveMessagesRequest_UnknownEmptyObject1) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{6, 0} +} + +type ReceiveMessagesRequest_UnknownEmptyObject2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Unknown *ReceiveMessagesRequest_UnknownEmptyObject1 `protobuf:"bytes,2,opt,name=unknown,proto3" json:"unknown,omitempty"` +} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject2) Reset() { + *x = ReceiveMessagesRequest_UnknownEmptyObject2{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReceiveMessagesRequest_UnknownEmptyObject2) ProtoMessage() {} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject2) 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 ReceiveMessagesRequest_UnknownEmptyObject2.ProtoReflect.Descriptor instead. +func (*ReceiveMessagesRequest_UnknownEmptyObject2) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{6, 1} +} + +func (x *ReceiveMessagesRequest_UnknownEmptyObject2) GetUnknown() *ReceiveMessagesRequest_UnknownEmptyObject1 { + if x != nil { + return x.Unknown + } + return nil +} + var File_messages_proto protoreflect.FileDescriptor var file_messages_proto_rawDesc = []byte{ @@ -847,41 +924,53 @@ var file_messages_proto_rawDesc = []byte{ 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, - 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, 0x79, 0x12, + 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x65, 0x22, 0x6d, 0x0a, 0x10, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, 0x79, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x22, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x65, 0x22, 0x4c, 0x0a, 0x08, 0x42, 0x61, 0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, - 0x0a, 0x03, 0x54, 0x74, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x54, 0x74, 0x6c, - 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x52, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, - 0x22, 0x52, 0x0a, 0x0b, 0x52, 0x50, 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x29, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x62, 0x0a, 0x06, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, - 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, - 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x22, 0x6a, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x79, 0x65, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, - 0x79, 0x65, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x71, 0x31, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, 0x71, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x71, 0x32, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, 0x71, 0x32, 0x12, 0x12, 0x0a, 0x04, - 0x73, 0x65, 0x71, 0x33, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, 0x71, 0x33, - 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x71, 0x34, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, - 0x73, 0x65, 0x71, 0x34, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, - 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x16, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, + 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x53, 0x0a, 0x07, 0x75, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x55, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x32, + 0x48, 0x00, 0x52, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x88, 0x01, 0x01, 0x1a, 0x15, + 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x31, 0x1a, 0x65, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x32, 0x12, 0x4e, 0x0a, 0x07, + 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x31, 0x52, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x42, 0x0a, 0x0a, 0x08, + 0x5f, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x22, 0x4c, 0x0a, 0x08, 0x42, 0x61, 0x73, 0x65, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x74, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x54, 0x74, 0x6c, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, + 0x72, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x52, 0x08, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x22, 0x52, 0x0a, 0x0b, 0x52, 0x50, 0x43, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, + 0x29, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x62, 0x0a, 0x06, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x22, 0x6a, + 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x65, 0x61, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x79, 0x65, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, + 0x71, 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, 0x71, 0x31, 0x12, 0x12, + 0x0a, 0x04, 0x73, 0x65, 0x71, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, + 0x71, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x71, 0x33, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x73, 0x65, 0x71, 0x33, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x71, 0x34, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, 0x71, 0x34, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, + 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -896,19 +985,21 @@ func file_messages_proto_rawDescGZIP() []byte { return file_messages_proto_rawDescData } -var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_messages_proto_goTypes = []interface{}{ - (*EncodedPayload)(nil), // 0: messages.EncodedPayload - (*EncodedResponse)(nil), // 1: messages.EncodedResponse - (*MessageData)(nil), // 2: messages.MessageData - (*MsgTypeArr)(nil), // 3: messages.MsgTypeArr - (*EmptyArr)(nil), // 4: messages.EmptyArr - (*AuthMessage)(nil), // 5: messages.AuthMessage - (*AuthMessageBytes)(nil), // 6: messages.AuthMessageBytes - (*BaseData)(nil), // 7: messages.BaseData - (*RPCResponse)(nil), // 8: messages.RPCResponse - (*Device)(nil), // 9: messages.Device - (*Date)(nil), // 10: messages.Date + (*EncodedPayload)(nil), // 0: messages.EncodedPayload + (*EncodedResponse)(nil), // 1: messages.EncodedResponse + (*MessageData)(nil), // 2: messages.MessageData + (*MsgTypeArr)(nil), // 3: messages.MsgTypeArr + (*EmptyArr)(nil), // 4: messages.EmptyArr + (*AuthMessage)(nil), // 5: messages.AuthMessage + (*ReceiveMessagesRequest)(nil), // 6: messages.ReceiveMessagesRequest + (*BaseData)(nil), // 7: messages.BaseData + (*RPCResponse)(nil), // 8: messages.RPCResponse + (*Device)(nil), // 9: messages.Device + (*Date)(nil), // 10: messages.Date + (*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 11: messages.ReceiveMessagesRequest.UnknownEmptyObject1 + (*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 12: messages.ReceiveMessagesRequest.UnknownEmptyObject2 } var file_messages_proto_depIdxs = []int32{ 9, // 0: messages.MessageData.mobile:type_name -> messages.Device @@ -916,14 +1007,16 @@ var file_messages_proto_depIdxs = []int32{ 3, // 2: messages.MessageData.msgTypeArr:type_name -> messages.MsgTypeArr 4, // 3: messages.MsgTypeArr.emptyArr:type_name -> messages.EmptyArr 10, // 4: messages.AuthMessage.date:type_name -> messages.Date - 10, // 5: messages.AuthMessageBytes.date:type_name -> messages.Date - 4, // 6: messages.BaseData.emptyArr:type_name -> messages.EmptyArr - 2, // 7: messages.RPCResponse.data:type_name -> messages.MessageData - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 5, // 5: messages.ReceiveMessagesRequest.auth:type_name -> messages.AuthMessage + 12, // 6: messages.ReceiveMessagesRequest.unknown:type_name -> messages.ReceiveMessagesRequest.UnknownEmptyObject2 + 4, // 7: messages.BaseData.emptyArr:type_name -> messages.EmptyArr + 2, // 8: messages.RPCResponse.data:type_name -> messages.MessageData + 11, // 9: messages.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> messages.ReceiveMessagesRequest.UnknownEmptyObject1 + 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() } @@ -1005,7 +1098,7 @@ func file_messages_proto_init() { } } file_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthMessageBytes); i { + switch v := v.(*ReceiveMessagesRequest); i { case 0: return &v.state case 1: @@ -1064,14 +1157,39 @@ func file_messages_proto_init() { return nil } } + file_messages_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReceiveMessagesRequest_UnknownEmptyObject1); 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.(*ReceiveMessagesRequest_UnknownEmptyObject2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } + file_messages_proto_msgTypes[6].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_messages_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/libgm/binary/raw/client.proto b/libgm/binary/raw/client.proto index 427495c..be65c15 100644 --- a/libgm/binary/raw/client.proto +++ b/libgm/binary/raw/client.proto @@ -31,7 +31,7 @@ message ImageMetaData { message UploadImagePayload { ImageMetaData metaData = 1; - messages.AuthMessageBytes authData = 2; + messages.AuthMessage authData = 2; } message BugleBackendService { @@ -40,4 +40,4 @@ message BugleBackendService { message BugleCode { int64 type = 2; -} \ No newline at end of file +} diff --git a/libgm/binary/raw/events.proto b/libgm/binary/raw/events.proto index 38b97d5..027c08f 100644 --- a/libgm/binary/raw/events.proto +++ b/libgm/binary/raw/events.proto @@ -3,8 +3,6 @@ package events; option go_package = "../../binary"; -import "settings.proto"; -import "messages.proto"; import "conversations.proto"; /* @@ -12,7 +10,7 @@ import "conversations.proto"; 2 = CONVERSATION 3 = MESSAGE 5 = PHONE SETTINGS - + 6 = Cases 2 = updated session 8 = INACTIVE_LACK_OF_ACTIVITY @@ -51,8 +49,8 @@ message UserAlertEvent { 5|6 = BATTERY (tf?) 3|4 = DATA_CONNECTION (tf?) - + 10 = OBSERVER_REGISTERED (tf?) */ int64 alert_type = 2; -} \ No newline at end of file +} diff --git a/libgm/binary/raw/media.proto b/libgm/binary/raw/media.proto index 6f306b2..c3b78c0 100644 --- a/libgm/binary/raw/media.proto +++ b/libgm/binary/raw/media.proto @@ -7,7 +7,7 @@ import "messages.proto"; message StartMediaUploadPayload { int64 imageType = 1; - messages.AuthMessageBytes authData = 2; + messages.AuthMessage authData = 2; messages.Device mobile = 3; } @@ -19,4 +19,4 @@ message UploadMediaResponse { message Media { string mediaId = 1; int64 mediaNumber = 2; -} \ No newline at end of file +} diff --git a/libgm/binary/raw/messages.proto b/libgm/binary/raw/messages.proto index 6b5e271..bfa394f 100644 --- a/libgm/binary/raw/messages.proto +++ b/libgm/binary/raw/messages.proto @@ -47,14 +47,18 @@ message EmptyArr { message AuthMessage { string request_id = 1; - string rpcKey = 6; + bytes rpcKey = 6; Date date = 7; } -message AuthMessageBytes { - string request_id = 1; - bytes rpcKey = 6; - Date date = 7; +message ReceiveMessagesRequest { + AuthMessage auth = 1; + + message UnknownEmptyObject1 {} + message UnknownEmptyObject2 { + UnknownEmptyObject1 unknown = 2; + } + optional UnknownEmptyObject2 unknown = 4; } message BaseData { @@ -79,4 +83,4 @@ message Date { int64 seq2 = 5; int64 seq3 = 7; int64 seq4 = 9; -} \ No newline at end of file +} diff --git a/libgm/binary/raw/relay.proto b/libgm/binary/raw/relay.proto index c4966ec..36b1826 100644 --- a/libgm/binary/raw/relay.proto +++ b/libgm/binary/raw/relay.proto @@ -36,4 +36,4 @@ message RefreshPhoneRelayResponse { message WebEncryptionKeyResponse { Message1 curve = 1; bytes key = 2; -} \ No newline at end of file +} diff --git a/libgm/client.go b/libgm/client.go index 019c53a..60fc2e7 100644 --- a/libgm/client.go +++ b/libgm/client.go @@ -34,7 +34,7 @@ type Client struct { sessionHandler *SessionHandler instructions *Instructions - rpcKey string + rpcKey []byte ttl int64 proxy Proxy @@ -87,7 +87,7 @@ func (c *Client) SetProxy(proxy string) error { return nil } -func (c *Client) Connect(rpcKey string) error { +func (c *Client) Connect(rpcKey []byte) error { rpcPayload, receiveMesageSessionId, err := payload.ReceiveMessages(rpcKey) if err != nil { panic(err) @@ -100,7 +100,7 @@ func (c *Client) Connect(rpcKey string) error { return nil } -func (c *Client) Reconnect(rpcKey string) error { +func (c *Client) Reconnect(rpcKey []byte) error { c.rpc.CloseConnection() for c.rpc.conn != nil { time.Sleep(time.Millisecond * 100) @@ -166,19 +166,15 @@ func (c *Client) decryptImages(messages *binary.FetchMessagesResponse) error { } func (c *Client) decryptImageData(imageId string, key []byte) ([]byte, error) { - decodedRpcKey, err := base64.StdEncoding.DecodeString(c.rpcKey) - if err != nil { - return nil, err - } reqId := util.RandomUUIDv4() download_metadata := &binary.UploadImagePayload{ MetaData: &binary.ImageMetaData{ ImageId: imageId, Encrypted: true, }, - AuthData: &binary.AuthMessageBytes{ + AuthData: &binary.AuthMessage{ RequestId: reqId, - RpcKey: decodedRpcKey, + RpcKey: c.rpcKey, Date: &binary.Date{ Year: 2023, Seq1: 6, diff --git a/libgm/media_processor.go b/libgm/media_processor.go index 382451a..bdf7bf3 100644 --- a/libgm/media_processor.go +++ b/libgm/media_processor.go @@ -2,7 +2,6 @@ package libgm import ( "bytes" - "encoding/base64" "errors" "io" "net/http" @@ -133,18 +132,12 @@ func (c *Client) StartUploadMedia(image *Image) (*StartGoogleUpload, error) { } func (c *Client) buildStartUploadPayload() (string, error) { - - decodedRpcKey, err := base64.StdEncoding.DecodeString(c.rpcKey) - if err != nil { - return "", err - } - requestId := util.RandomUUIDv4() protoData := &binary.StartMediaUploadPayload{ ImageType: 1, - AuthData: &binary.AuthMessageBytes{ + AuthData: &binary.AuthMessage{ RequestId: requestId, - RpcKey: decodedRpcKey, + RpcKey: c.rpcKey, Date: &binary.Date{ Year: 2023, Seq1: 6, diff --git a/libgm/pair.go b/libgm/pair.go index a7a889e..1701434 100644 --- a/libgm/pair.go +++ b/libgm/pair.go @@ -1,7 +1,6 @@ package libgm import ( - "encoding/base64" "io" "time" @@ -140,9 +139,9 @@ func (p *Pairer) GetWebEncryptionKey() { if err2 != nil { p.client.Logger.Err(err2).Msg("Parse webkeyresponse into proto struct error") } - key := base64.StdEncoding.EncodeToString(p.client.rpc.webAuthKey) + p.client.Logger.Debug().Any("parsedResponse", parsedResponse).Msg("WebEncryptionKeyResponse") p.ticker.Stop() - reconnectErr := p.client.Reconnect(key) + reconnectErr := p.client.Reconnect(p.client.rpc.webAuthKey) if reconnectErr != nil { panic(reconnectErr) } diff --git a/libgm/payload/receiveMessages.go b/libgm/payload/receiveMessages.go index 3eed090..3bfb3d4 100644 --- a/libgm/payload/receiveMessages.go +++ b/libgm/payload/receiveMessages.go @@ -3,42 +3,36 @@ package payload import ( "encoding/json" - "go.mau.fi/mautrix-gmessages/libgm/util" + "github.com/google/uuid" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/pblite" ) -func ReceiveMessages(rpcKey string) ([]byte, string, error) { - id := util.RandomUUIDv4() - data := []interface{}{ - []interface{}{ - id, - nil, - nil, - nil, - nil, - rpcKey, - []interface{}{ - nil, - nil, - 2023, - 6, - 8, - nil, - 4, - nil, - 6, +func ReceiveMessages(rpcKey []byte) ([]byte, string, error) { + payload := &binary.ReceiveMessagesRequest{ + Auth: &binary.AuthMessage{ + RequestId: uuid.New().String(), + RpcKey: rpcKey, + Date: &binary.Date{ + Year: 2023, + Seq1: 6, + Seq2: 8, + Seq3: 4, + Seq4: 6, }, }, - nil, - nil, - []interface{}{ - nil, - []interface{}{}, + Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject2{ + Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject1{}, }, } - + data, err := pblite.Serialize(payload.ProtoReflect()) + if err != nil { + return nil, "", err + } jsonData, err := json.Marshal(data) if err != nil { return nil, "", err } - return jsonData, id, nil + return jsonData, payload.Auth.RequestId, nil } diff --git a/libgm/payload/refreshPhoneRelay.go b/libgm/payload/refreshPhoneRelay.go index 4b528bc..e07caab 100644 --- a/libgm/payload/refreshPhoneRelay.go +++ b/libgm/payload/refreshPhoneRelay.go @@ -1,22 +1,16 @@ package payload import ( - "encoding/base64" - "go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/util" ) -func RefreshPhoneRelay(rpcKey string) ([]byte, *binary.Container, error) { - decodedRpcKey, err1 := base64.StdEncoding.DecodeString(rpcKey) - if err1 != nil { - return nil, nil, err1 - } +func RefreshPhoneRelay(rpcKey []byte) ([]byte, *binary.Container, error) { payload := &binary.Container{ PhoneRelay: &binary.PhoneRelayBody{ Id: util.RandomUUIDv4(), Bugle: "Bugle", - RpcKey: decodedRpcKey, + RpcKey: rpcKey, Date: &binary.Date{ Year: 2023, Seq1: 6, diff --git a/libgm/payload/sendMessage.go b/libgm/payload/sendMessage.go index 2f06d0f..de0b17c 100644 --- a/libgm/payload/sendMessage.go +++ b/libgm/payload/sendMessage.go @@ -23,7 +23,7 @@ func NewEncodedPayload(requestId string, opCode int64, encryptedData []byte, ses } } -func NewAuthData(requestId string, rpcKey string, date *binary.Date) *binary.AuthMessage { +func NewAuthData(requestId string, rpcKey []byte, date *binary.Date) *binary.AuthMessage { return &binary.AuthMessage{ RequestId: requestId, RpcKey: rpcKey,