From 02ef5ab82c85f49b596fa516c3b92d01fa039161 Mon Sep 17 00:00:00 2001 From: zero <108243503+0xzer@users.noreply.github.com> Date: Fri, 30 Jun 2023 12:54:08 +0300 Subject: [PATCH] Add initial Google Messages library --- libgm/binary/client.pb.go | 637 +++++++ libgm/binary/conversations.pb.go | 2314 ++++++++++++++++++++++++++ libgm/binary/events.pb.go | 424 +++++ libgm/binary/media.pb.go | 318 ++++ libgm/binary/messages.pb.go | 1086 ++++++++++++ libgm/binary/pairing.pb.go | 689 ++++++++ libgm/binary/protoUtil.go | 22 + libgm/binary/raw/client.proto | 43 + libgm/binary/raw/conversations.proto | 194 +++ libgm/binary/raw/events.proto | 58 + libgm/binary/raw/media.proto | 22 + libgm/binary/raw/messages.proto | 82 + libgm/binary/raw/pairing.proto | 49 + libgm/binary/raw/relay.proto | 39 + libgm/binary/raw/responses.proto | 19 + libgm/binary/raw/settings.proto | 75 + libgm/binary/relay.pb.go | 576 +++++++ libgm/binary/responses.pb.go | 279 ++++ libgm/binary/settings.pb.go | 1016 +++++++++++ libgm/bugle_service.go | 12 + libgm/builders/tenor.go | 71 + libgm/cache/cache.go | 66 + libgm/cache/conversation.go | 290 ++++ libgm/cache/settings.go | 8 + libgm/client.go | 242 +++ libgm/command_handler.go | 33 + libgm/conversations.go | 208 +++ libgm/crypto/B64.go | 41 + libgm/crypto/ECDSA.go | 113 ++ libgm/crypto/cryptor.go | 115 ++ libgm/crypto/decode.go | 32 + libgm/crypto/encode.go | 60 + libgm/crypto/generate.go | 27 + libgm/crypto/imageCryptor.go | 194 +++ libgm/debug/logger.go | 43 + libgm/event_handler.go | 26 + libgm/events/conversations.go | 67 + libgm/events/messages.go | 65 + libgm/events/qr.go | 22 + libgm/events/ready.go | 18 + libgm/events/useralerts.go | 24 + libgm/handler_conversation.go | 44 + libgm/handler_message.go | 57 + libgm/handler_useralert.go | 23 + libgm/image_builder.go | 171 ++ libgm/instructions.go | 78 + libgm/json_proto/deseralize.go | 53 + libgm/json_proto/serialize.go | 100 ++ libgm/media_processor.go | 166 ++ libgm/message_builder.go | 174 ++ libgm/misc.go | 25 + libgm/msg_handler.go | 71 + libgm/opcode_handler.go | 39 + libgm/pair.go | 161 ++ libgm/payload/conversations.go | 1 + libgm/payload/getWebEncryptionKey.go | 31 + libgm/payload/receiveMessages.go | 44 + libgm/payload/refreshPhoneRelay.go | 33 + libgm/payload/registerPhoneRelay.go | 63 + libgm/payload/sendMessage.go | 42 + libgm/qr.go | 36 + libgm/request.go | 70 + libgm/response.go | 16 + libgm/response_handler.go | 102 ++ libgm/rpc.go | 168 ++ libgm/session.go | 66 + libgm/session_handler.go | 216 +++ libgm/util/constants.go | 9 + libgm/util/errors.go | 12 + libgm/util/func.go | 135 ++ libgm/util/paths.go | 23 + libgm/util/structs.go | 111 ++ 72 files changed, 12059 insertions(+) create mode 100644 libgm/binary/client.pb.go create mode 100644 libgm/binary/conversations.pb.go create mode 100644 libgm/binary/events.pb.go create mode 100644 libgm/binary/media.pb.go create mode 100644 libgm/binary/messages.pb.go create mode 100644 libgm/binary/pairing.pb.go create mode 100644 libgm/binary/protoUtil.go create mode 100644 libgm/binary/raw/client.proto create mode 100644 libgm/binary/raw/conversations.proto create mode 100644 libgm/binary/raw/events.proto create mode 100644 libgm/binary/raw/media.proto create mode 100644 libgm/binary/raw/messages.proto create mode 100644 libgm/binary/raw/pairing.proto create mode 100644 libgm/binary/raw/relay.proto create mode 100644 libgm/binary/raw/responses.proto create mode 100644 libgm/binary/raw/settings.proto create mode 100644 libgm/binary/relay.pb.go create mode 100644 libgm/binary/responses.pb.go create mode 100644 libgm/binary/settings.pb.go create mode 100644 libgm/bugle_service.go create mode 100644 libgm/builders/tenor.go create mode 100644 libgm/cache/cache.go create mode 100644 libgm/cache/conversation.go create mode 100644 libgm/cache/settings.go create mode 100644 libgm/client.go create mode 100644 libgm/command_handler.go create mode 100644 libgm/conversations.go create mode 100644 libgm/crypto/B64.go create mode 100644 libgm/crypto/ECDSA.go create mode 100644 libgm/crypto/cryptor.go create mode 100644 libgm/crypto/decode.go create mode 100644 libgm/crypto/encode.go create mode 100644 libgm/crypto/generate.go create mode 100644 libgm/crypto/imageCryptor.go create mode 100644 libgm/debug/logger.go create mode 100644 libgm/event_handler.go create mode 100644 libgm/events/conversations.go create mode 100644 libgm/events/messages.go create mode 100644 libgm/events/qr.go create mode 100644 libgm/events/ready.go create mode 100644 libgm/events/useralerts.go create mode 100644 libgm/handler_conversation.go create mode 100644 libgm/handler_message.go create mode 100644 libgm/handler_useralert.go create mode 100644 libgm/image_builder.go create mode 100644 libgm/instructions.go create mode 100644 libgm/json_proto/deseralize.go create mode 100644 libgm/json_proto/serialize.go create mode 100644 libgm/media_processor.go create mode 100644 libgm/message_builder.go create mode 100644 libgm/misc.go create mode 100644 libgm/msg_handler.go create mode 100644 libgm/opcode_handler.go create mode 100644 libgm/pair.go create mode 100644 libgm/payload/conversations.go create mode 100644 libgm/payload/getWebEncryptionKey.go create mode 100644 libgm/payload/receiveMessages.go create mode 100644 libgm/payload/refreshPhoneRelay.go create mode 100644 libgm/payload/registerPhoneRelay.go create mode 100644 libgm/payload/sendMessage.go create mode 100644 libgm/qr.go create mode 100644 libgm/request.go create mode 100644 libgm/response.go create mode 100644 libgm/response_handler.go create mode 100644 libgm/rpc.go create mode 100644 libgm/session.go create mode 100644 libgm/session_handler.go create mode 100644 libgm/util/constants.go create mode 100644 libgm/util/errors.go create mode 100644 libgm/util/func.go create mode 100644 libgm/util/paths.go create mode 100644 libgm/util/structs.go diff --git a/libgm/binary/client.pb.go b/libgm/binary/client.pb.go new file mode 100644 index 0000000..9159670 --- /dev/null +++ b/libgm/binary/client.pb.go @@ -0,0 +1,637 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: client.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SendMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PairedDevice *Device `protobuf:"bytes,1,opt,name=pairedDevice,proto3" json:"pairedDevice,omitempty"` + MessageData *MessageData `protobuf:"bytes,2,opt,name=messageData,proto3" json:"messageData,omitempty"` + AuthData *AuthMessage `protobuf:"bytes,3,opt,name=authData,proto3" json:"authData,omitempty"` + Ttl int64 `protobuf:"varint,5,opt,name=ttl,proto3" json:"ttl,omitempty"` + EmptyArr *EmptyArr `protobuf:"bytes,9,opt,name=emptyArr,proto3" json:"emptyArr,omitempty"` +} + +func (x *SendMessage) Reset() { + *x = SendMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendMessage) ProtoMessage() {} + +func (x *SendMessage) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendMessage.ProtoReflect.Descriptor instead. +func (*SendMessage) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{0} +} + +func (x *SendMessage) GetPairedDevice() *Device { + if x != nil { + return x.PairedDevice + } + return nil +} + +func (x *SendMessage) GetMessageData() *MessageData { + if x != nil { + return x.MessageData + } + return nil +} + +func (x *SendMessage) GetAuthData() *AuthMessage { + if x != nil { + return x.AuthData + } + return nil +} + +func (x *SendMessage) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +func (x *SendMessage) GetEmptyArr() *EmptyArr { + if x != nil { + return x.EmptyArr + } + return nil +} + +type AckMessagePayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AuthData *AuthMessage `protobuf:"bytes,1,opt,name=authData,proto3" json:"authData,omitempty"` + EmptyArr *EmptyArr `protobuf:"bytes,2,opt,name=emptyArr,proto3" json:"emptyArr,omitempty"` + NoClue []byte `protobuf:"bytes,3,opt,name=noClue,proto3" json:"noClue,omitempty"` +} + +func (x *AckMessagePayload) Reset() { + *x = AckMessagePayload{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AckMessagePayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckMessagePayload) ProtoMessage() {} + +func (x *AckMessagePayload) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckMessagePayload.ProtoReflect.Descriptor instead. +func (*AckMessagePayload) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{1} +} + +func (x *AckMessagePayload) GetAuthData() *AuthMessage { + if x != nil { + return x.AuthData + } + return nil +} + +func (x *AckMessagePayload) GetEmptyArr() *EmptyArr { + if x != nil { + return x.EmptyArr + } + return nil +} + +func (x *AckMessagePayload) GetNoClue() []byte { + if x != nil { + return x.NoClue + } + return nil +} + +type AckMessageData 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"` + Device *Device `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` +} + +func (x *AckMessageData) Reset() { + *x = AckMessageData{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AckMessageData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckMessageData) ProtoMessage() {} + +func (x *AckMessageData) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckMessageData.ProtoReflect.Descriptor instead. +func (*AckMessageData) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{2} +} + +func (x *AckMessageData) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *AckMessageData) GetDevice() *Device { + if x != nil { + return x.Device + } + return nil +} + +type ImageMetaData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ImageId string `protobuf:"bytes,1,opt,name=imageId,proto3" json:"imageId,omitempty"` + Encrypted bool `protobuf:"varint,2,opt,name=encrypted,proto3" json:"encrypted,omitempty"` +} + +func (x *ImageMetaData) Reset() { + *x = ImageMetaData{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageMetaData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageMetaData) ProtoMessage() {} + +func (x *ImageMetaData) ProtoReflect() protoreflect.Message { + mi := &file_client_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 ImageMetaData.ProtoReflect.Descriptor instead. +func (*ImageMetaData) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{3} +} + +func (x *ImageMetaData) GetImageId() string { + if x != nil { + return x.ImageId + } + return "" +} + +func (x *ImageMetaData) GetEncrypted() bool { + if x != nil { + return x.Encrypted + } + return false +} + +type UploadImagePayload struct { + state protoimpl.MessageState + 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"` +} + +func (x *UploadImagePayload) Reset() { + *x = UploadImagePayload{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadImagePayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadImagePayload) ProtoMessage() {} + +func (x *UploadImagePayload) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadImagePayload.ProtoReflect.Descriptor instead. +func (*UploadImagePayload) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{4} +} + +func (x *UploadImagePayload) GetMetaData() *ImageMetaData { + if x != nil { + return x.MetaData + } + return nil +} + +func (x *UploadImagePayload) GetAuthData() *AuthMessageBytes { + if x != nil { + return x.AuthData + } + return nil +} + +type BugleBackendService struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *BugleCode `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *BugleBackendService) Reset() { + *x = BugleBackendService{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BugleBackendService) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BugleBackendService) ProtoMessage() {} + +func (x *BugleBackendService) ProtoReflect() protoreflect.Message { + mi := &file_client_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 BugleBackendService.ProtoReflect.Descriptor instead. +func (*BugleBackendService) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{5} +} + +func (x *BugleBackendService) GetData() *BugleCode { + if x != nil { + return x.Data + } + return nil +} + +type BugleCode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type int64 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` +} + +func (x *BugleCode) Reset() { + *x = BugleCode{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BugleCode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BugleCode) ProtoMessage() {} + +func (x *BugleCode) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BugleCode.ProtoReflect.Descriptor instead. +func (*BugleCode) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{6} +} + +func (x *BugleCode) GetType() int64 { + if x != nil { + return x.Type + } + return 0 +} + +var File_client_proto protoreflect.FileDescriptor + +var file_client_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf1, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x0c, 0x70, 0x61, 0x69, 0x72, 0x65, 0x64, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x0c, + 0x70, 0x61, 0x69, 0x72, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x0b, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 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, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, + 0x61, 0x18, 0x03, 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, 0x08, + 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x18, 0x09, 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, 0x8e, 0x01, 0x0a, 0x11, 0x41, + 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 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, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, + 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x18, + 0x02, 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, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x22, 0x59, 0x0a, 0x0e, 0x41, + 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 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, 0x28, 0x0a, 0x06, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x47, 0x0a, 0x0d, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, + 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, + 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, + 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, + 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, +} + +var ( + file_client_proto_rawDescOnce sync.Once + file_client_proto_rawDescData = file_client_proto_rawDesc +) + +func file_client_proto_rawDescGZIP() []byte { + file_client_proto_rawDescOnce.Do(func() { + file_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_proto_rawDescData) + }) + return file_client_proto_rawDescData +} + +var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_client_proto_goTypes = []interface{}{ + (*SendMessage)(nil), // 0: client.SendMessage + (*AckMessagePayload)(nil), // 1: client.AckMessagePayload + (*AckMessageData)(nil), // 2: client.AckMessageData + (*ImageMetaData)(nil), // 3: client.ImageMetaData + (*UploadImagePayload)(nil), // 4: client.UploadImagePayload + (*BugleBackendService)(nil), // 5: client.BugleBackendService + (*BugleCode)(nil), // 6: client.BugleCode + (*Device)(nil), // 7: messages.Device + (*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 + 8, // 1: client.SendMessage.messageData:type_name -> messages.MessageData + 9, // 2: client.SendMessage.authData:type_name -> messages.AuthMessage + 10, // 3: client.SendMessage.emptyArr:type_name -> messages.EmptyArr + 9, // 4: client.AckMessagePayload.authData:type_name -> messages.AuthMessage + 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 + 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 + 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_client_proto_init() } +func file_client_proto_init() { + if File_client_proto != nil { + return + } + file_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AckMessagePayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AckMessageData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageMetaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadImagePayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BugleBackendService); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BugleCode); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_client_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_client_proto_goTypes, + DependencyIndexes: file_client_proto_depIdxs, + MessageInfos: file_client_proto_msgTypes, + }.Build() + File_client_proto = out.File + file_client_proto_rawDesc = nil + file_client_proto_goTypes = nil + file_client_proto_depIdxs = nil +} diff --git a/libgm/binary/conversations.pb.go b/libgm/binary/conversations.pb.go new file mode 100644 index 0000000..83cc052 --- /dev/null +++ b/libgm/binary/conversations.pb.go @@ -0,0 +1,2314 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: conversations.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MessageType int32 + +const ( + MessageType_UNKNOWN MessageType = 0 + MessageType_TEXT MessageType = 1 + MessageType_IMAGE MessageType = 2 + MessageType_VIDEO MessageType = 3 + MessageType_AUDIO MessageType = 4 + MessageType_ATTACHMENT MessageType = 5 + MessageType_LOCATION MessageType = 6 + MessageType_RICH_CARD MessageType = 7 + MessageType_VCARD MessageType = 8 + MessageType_MMS_NEEDS_DOWNLOAD MessageType = 9 + MessageType_REPLY MessageType = 10 +) + +// Enum value maps for MessageType. +var ( + MessageType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "TEXT", + 2: "IMAGE", + 3: "VIDEO", + 4: "AUDIO", + 5: "ATTACHMENT", + 6: "LOCATION", + 7: "RICH_CARD", + 8: "VCARD", + 9: "MMS_NEEDS_DOWNLOAD", + 10: "REPLY", + } + MessageType_value = map[string]int32{ + "UNKNOWN": 0, + "TEXT": 1, + "IMAGE": 2, + "VIDEO": 3, + "AUDIO": 4, + "ATTACHMENT": 5, + "LOCATION": 6, + "RICH_CARD": 7, + "VCARD": 8, + "MMS_NEEDS_DOWNLOAD": 9, + "REPLY": 10, + } +) + +func (x MessageType) Enum() *MessageType { + p := new(MessageType) + *p = x + return p +} + +func (x MessageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MessageType) Descriptor() protoreflect.EnumDescriptor { + return file_conversations_proto_enumTypes[0].Descriptor() +} + +func (MessageType) Type() protoreflect.EnumType { + return &file_conversations_proto_enumTypes[0] +} + +func (x MessageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MessageType.Descriptor instead. +func (MessageType) EnumDescriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{0} +} + +type MsgStatusCode int32 + +const ( + MsgStatusCode_UNKNOWN_STATUS MsgStatusCode = 0 + MsgStatusCode_SENDING MsgStatusCode = 5 + MsgStatusCode_SENT MsgStatusCode = 1 +) + +// Enum value maps for MsgStatusCode. +var ( + MsgStatusCode_name = map[int32]string{ + 0: "UNKNOWN_STATUS", + 5: "SENDING", + 1: "SENT", + } + MsgStatusCode_value = map[string]int32{ + "UNKNOWN_STATUS": 0, + "SENDING": 5, + "SENT": 1, + } +) + +func (x MsgStatusCode) Enum() *MsgStatusCode { + p := new(MsgStatusCode) + *p = x + return p +} + +func (x MsgStatusCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MsgStatusCode) Descriptor() protoreflect.EnumDescriptor { + return file_conversations_proto_enumTypes[1].Descriptor() +} + +func (MsgStatusCode) Type() protoreflect.EnumType { + return &file_conversations_proto_enumTypes[1] +} + +func (x MsgStatusCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MsgStatusCode.Descriptor instead. +func (MsgStatusCode) EnumDescriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{1} +} + +type SendMessagePayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConversationId string `protobuf:"bytes,2,opt,name=conversationId,proto3" json:"conversationId,omitempty"` + MessagePayload *MessagePayload `protobuf:"bytes,3,opt,name=messagePayload,proto3" json:"messagePayload,omitempty"` + TmpId string `protobuf:"bytes,5,opt,name=tmpId,proto3" json:"tmpId,omitempty"` +} + +func (x *SendMessagePayload) Reset() { + *x = SendMessagePayload{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendMessagePayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendMessagePayload) ProtoMessage() {} + +func (x *SendMessagePayload) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendMessagePayload.ProtoReflect.Descriptor instead. +func (*SendMessagePayload) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{0} +} + +func (x *SendMessagePayload) GetConversationId() string { + if x != nil { + return x.ConversationId + } + return "" +} + +func (x *SendMessagePayload) GetMessagePayload() *MessagePayload { + if x != nil { + return x.MessagePayload + } + return nil +} + +func (x *SendMessagePayload) GetTmpId() string { + if x != nil { + return x.TmpId + } + return "" +} + +type MessagePayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TmpId string `protobuf:"bytes,1,opt,name=tmpId,proto3" json:"tmpId,omitempty"` + MessagePayloadContent *MessagePayloadContent `protobuf:"bytes,6,opt,name=messagePayloadContent,proto3" json:"messagePayloadContent,omitempty"` + ConversationId string `protobuf:"bytes,7,opt,name=conversationId,proto3" json:"conversationId,omitempty"` + SelfParticipantId string `protobuf:"bytes,9,opt,name=selfParticipantId,proto3" json:"selfParticipantId,omitempty"` // might be participantId + MessageInfo []*MessageInfo `protobuf:"bytes,10,rep,name=messageInfo,proto3" json:"messageInfo,omitempty"` + TmpId2 string `protobuf:"bytes,12,opt,name=tmpId2,proto3" json:"tmpId2,omitempty"` +} + +func (x *MessagePayload) Reset() { + *x = MessagePayload{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessagePayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessagePayload) ProtoMessage() {} + +func (x *MessagePayload) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessagePayload.ProtoReflect.Descriptor instead. +func (*MessagePayload) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{1} +} + +func (x *MessagePayload) GetTmpId() string { + if x != nil { + return x.TmpId + } + return "" +} + +func (x *MessagePayload) GetMessagePayloadContent() *MessagePayloadContent { + if x != nil { + return x.MessagePayloadContent + } + return nil +} + +func (x *MessagePayload) GetConversationId() string { + if x != nil { + return x.ConversationId + } + return "" +} + +func (x *MessagePayload) GetSelfParticipantId() string { + if x != nil { + return x.SelfParticipantId + } + return "" +} + +func (x *MessagePayload) GetMessageInfo() []*MessageInfo { + if x != nil { + return x.MessageInfo + } + return nil +} + +func (x *MessagePayload) GetTmpId2() string { + if x != nil { + return x.TmpId2 + } + return "" +} + +type MessagePayloadContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageContent *MessageContent `protobuf:"bytes,1,opt,name=messageContent,proto3" json:"messageContent,omitempty"` +} + +func (x *MessagePayloadContent) Reset() { + *x = MessagePayloadContent{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessagePayloadContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessagePayloadContent) ProtoMessage() {} + +func (x *MessagePayloadContent) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessagePayloadContent.ProtoReflect.Descriptor instead. +func (*MessagePayloadContent) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{2} +} + +func (x *MessagePayloadContent) GetMessageContent() *MessageContent { + if x != nil { + return x.MessageContent + } + return nil +} + +type OpenConversationPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConversationId string `protobuf:"bytes,2,opt,name=conversationId,proto3" json:"conversationId,omitempty"` +} + +func (x *OpenConversationPayload) Reset() { + *x = OpenConversationPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OpenConversationPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpenConversationPayload) ProtoMessage() {} + +func (x *OpenConversationPayload) ProtoReflect() protoreflect.Message { + mi := &file_conversations_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 OpenConversationPayload.ProtoReflect.Descriptor instead. +func (*OpenConversationPayload) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{3} +} + +func (x *OpenConversationPayload) GetConversationId() string { + if x != nil { + return x.ConversationId + } + return "" +} + +type PrepareOpenConversationPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Field2 int64 `protobuf:"varint,2,opt,name=field2,proto3" json:"field2,omitempty"` // only seen value 1 +} + +func (x *PrepareOpenConversationPayload) Reset() { + *x = PrepareOpenConversationPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrepareOpenConversationPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareOpenConversationPayload) ProtoMessage() {} + +func (x *PrepareOpenConversationPayload) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrepareOpenConversationPayload.ProtoReflect.Descriptor instead. +func (*PrepareOpenConversationPayload) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{4} +} + +func (x *PrepareOpenConversationPayload) GetField2() int64 { + if x != nil { + return x.Field2 + } + return 0 +} + +type FetchConversationMessagesPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConversationId string `protobuf:"bytes,2,opt,name=conversationId,proto3" json:"conversationId,omitempty"` + Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` + Cursor *Cursor `protobuf:"bytes,5,opt,name=cursor,proto3" json:"cursor,omitempty"` +} + +func (x *FetchConversationMessagesPayload) Reset() { + *x = FetchConversationMessagesPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FetchConversationMessagesPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchConversationMessagesPayload) ProtoMessage() {} + +func (x *FetchConversationMessagesPayload) ProtoReflect() protoreflect.Message { + mi := &file_conversations_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 FetchConversationMessagesPayload.ProtoReflect.Descriptor instead. +func (*FetchConversationMessagesPayload) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{5} +} + +func (x *FetchConversationMessagesPayload) GetConversationId() string { + if x != nil { + return x.ConversationId + } + return "" +} + +func (x *FetchConversationMessagesPayload) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *FetchConversationMessagesPayload) GetCursor() *Cursor { + if x != nil { + return x.Cursor + } + return nil +} + +type ListCoversationsPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` // no idea if this is actually amount to list + Field4 int64 `protobuf:"varint,4,opt,name=field4,proto3" json:"field4,omitempty"` // no idea what this is , but only value ive seen is 1 +} + +func (x *ListCoversationsPayload) Reset() { + *x = ListCoversationsPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCoversationsPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCoversationsPayload) ProtoMessage() {} + +func (x *ListCoversationsPayload) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCoversationsPayload.ProtoReflect.Descriptor instead. +func (*ListCoversationsPayload) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{6} +} + +func (x *ListCoversationsPayload) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *ListCoversationsPayload) GetField4() int64 { + if x != nil { + return x.Field4 + } + return 0 +} + +type FetchMessagesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Messages []*Message `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + SomeBytes []byte `protobuf:"bytes,3,opt,name=someBytes,proto3" json:"someBytes,omitempty"` + TotalMessages int64 `protobuf:"varint,4,opt,name=totalMessages,proto3" json:"totalMessages,omitempty"` + Cursor *Cursor `protobuf:"bytes,5,opt,name=cursor,proto3" json:"cursor,omitempty"` +} + +func (x *FetchMessagesResponse) Reset() { + *x = FetchMessagesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FetchMessagesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchMessagesResponse) ProtoMessage() {} + +func (x *FetchMessagesResponse) ProtoReflect() protoreflect.Message { + mi := &file_conversations_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 FetchMessagesResponse.ProtoReflect.Descriptor instead. +func (*FetchMessagesResponse) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{7} +} + +func (x *FetchMessagesResponse) GetMessages() []*Message { + if x != nil { + return x.Messages + } + return nil +} + +func (x *FetchMessagesResponse) GetSomeBytes() []byte { + if x != nil { + return x.SomeBytes + } + return nil +} + +func (x *FetchMessagesResponse) GetTotalMessages() int64 { + if x != nil { + return x.TotalMessages + } + return 0 +} + +func (x *FetchMessagesResponse) GetCursor() *Cursor { + if x != nil { + return x.Cursor + } + return nil +} + +type Cursor struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SomeStr string `protobuf:"bytes,1,opt,name=someStr,proto3" json:"someStr,omitempty"` + NextCursor int64 `protobuf:"varint,2,opt,name=nextCursor,proto3" json:"nextCursor,omitempty"` +} + +func (x *Cursor) Reset() { + *x = Cursor{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Cursor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Cursor) ProtoMessage() {} + +func (x *Cursor) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[8] + 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 Cursor.ProtoReflect.Descriptor instead. +func (*Cursor) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{8} +} + +func (x *Cursor) GetSomeStr() string { + if x != nil { + return x.SomeStr + } + return "" +} + +func (x *Cursor) GetNextCursor() int64 { + if x != nil { + return x.NextCursor + } + return 0 +} + +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageId string `protobuf:"bytes,1,opt,name=messageId,proto3" json:"messageId,omitempty"` + From *IsFromMe `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"` + MessageStatus *MessageStatus `protobuf:"bytes,4,opt,name=messageStatus,proto3" json:"messageStatus,omitempty"` + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + ConversationId string `protobuf:"bytes,7,opt,name=conversationId,proto3" json:"conversationId,omitempty"` + ParticipantId string `protobuf:"bytes,9,opt,name=participantId,proto3" json:"participantId,omitempty"` + MessageInfo []*MessageInfo `protobuf:"bytes,10,rep,name=messageInfo,proto3" json:"messageInfo,omitempty"` + Type MessageType `protobuf:"varint,11,opt,name=type,proto3,enum=conversations.MessageType" json:"type,omitempty"` + TmpId string `protobuf:"bytes,12,opt,name=tmpId,proto3" json:"tmpId,omitempty"` +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{9} +} + +func (x *Message) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +func (x *Message) GetFrom() *IsFromMe { + if x != nil { + return x.From + } + return nil +} + +func (x *Message) GetMessageStatus() *MessageStatus { + if x != nil { + return x.MessageStatus + } + return nil +} + +func (x *Message) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *Message) GetConversationId() string { + if x != nil { + return x.ConversationId + } + return "" +} + +func (x *Message) GetParticipantId() string { + if x != nil { + return x.ParticipantId + } + return "" +} + +func (x *Message) GetMessageInfo() []*MessageInfo { + if x != nil { + return x.MessageInfo + } + return nil +} + +func (x *Message) GetType() MessageType { + if x != nil { + return x.Type + } + return MessageType_UNKNOWN +} + +func (x *Message) GetTmpId() string { + if x != nil { + return x.TmpId + } + return "" +} + +type MessageInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrderInternal string `protobuf:"bytes,1,opt,name=orderInternal,proto3" json:"orderInternal,omitempty"` + // Types that are assignable to Data: + // + // *MessageInfo_MessageContent + // *MessageInfo_ImageContent + Data isMessageInfo_Data `protobuf_oneof:"data"` +} + +func (x *MessageInfo) Reset() { + *x = MessageInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageInfo) ProtoMessage() {} + +func (x *MessageInfo) ProtoReflect() protoreflect.Message { + mi := &file_conversations_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 MessageInfo.ProtoReflect.Descriptor instead. +func (*MessageInfo) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{10} +} + +func (x *MessageInfo) GetOrderInternal() string { + if x != nil { + return x.OrderInternal + } + return "" +} + +func (m *MessageInfo) GetData() isMessageInfo_Data { + if m != nil { + return m.Data + } + return nil +} + +func (x *MessageInfo) GetMessageContent() *MessageContent { + if x, ok := x.GetData().(*MessageInfo_MessageContent); ok { + return x.MessageContent + } + return nil +} + +func (x *MessageInfo) GetImageContent() *ImageContent { + if x, ok := x.GetData().(*MessageInfo_ImageContent); ok { + return x.ImageContent + } + return nil +} + +type isMessageInfo_Data interface { + isMessageInfo_Data() +} + +type MessageInfo_MessageContent struct { + MessageContent *MessageContent `protobuf:"bytes,2,opt,name=messageContent,proto3,oneof"` +} + +type MessageInfo_ImageContent struct { + ImageContent *ImageContent `protobuf:"bytes,3,opt,name=imageContent,proto3,oneof"` +} + +func (*MessageInfo_MessageContent) isMessageInfo_Data() {} + +func (*MessageInfo_ImageContent) isMessageInfo_Data() {} + +type ImageContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SomeNumber int64 `protobuf:"varint,1,opt,name=someNumber,proto3" json:"someNumber,omitempty"` + ImageId string `protobuf:"bytes,2,opt,name=imageId,proto3" json:"imageId,omitempty"` + ImageName string `protobuf:"bytes,4,opt,name=imageName,proto3" json:"imageName,omitempty"` + Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Pixels *ImagePixels `protobuf:"bytes,6,opt,name=pixels,proto3" json:"pixels,omitempty"` + ImageData []byte `protobuf:"bytes,7,opt,name=imageData,proto3" json:"imageData,omitempty"` + ImageId2 string `protobuf:"bytes,9,opt,name=imageId2,proto3" json:"imageId2,omitempty"` + DecryptionKey []byte `protobuf:"bytes,11,opt,name=decryptionKey,proto3" json:"decryptionKey,omitempty"` + DecryptionKey2 []byte `protobuf:"bytes,12,opt,name=decryptionKey2,proto3" json:"decryptionKey2,omitempty"` // same value as decryptionkey? +} + +func (x *ImageContent) Reset() { + *x = ImageContent{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageContent) ProtoMessage() {} + +func (x *ImageContent) ProtoReflect() protoreflect.Message { + mi := &file_conversations_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 ImageContent.ProtoReflect.Descriptor instead. +func (*ImageContent) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{11} +} + +func (x *ImageContent) GetSomeNumber() int64 { + if x != nil { + return x.SomeNumber + } + return 0 +} + +func (x *ImageContent) GetImageId() string { + if x != nil { + return x.ImageId + } + return "" +} + +func (x *ImageContent) GetImageName() string { + if x != nil { + return x.ImageName + } + return "" +} + +func (x *ImageContent) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *ImageContent) GetPixels() *ImagePixels { + if x != nil { + return x.Pixels + } + return nil +} + +func (x *ImageContent) GetImageData() []byte { + if x != nil { + return x.ImageData + } + return nil +} + +func (x *ImageContent) GetImageId2() string { + if x != nil { + return x.ImageId2 + } + return "" +} + +func (x *ImageContent) GetDecryptionKey() []byte { + if x != nil { + return x.DecryptionKey + } + return nil +} + +func (x *ImageContent) GetDecryptionKey2() []byte { + if x != nil { + return x.DecryptionKey2 + } + return nil +} + +type ImagePixels struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Width int64 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (x *ImagePixels) Reset() { + *x = ImagePixels{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImagePixels) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImagePixels) ProtoMessage() {} + +func (x *ImagePixels) ProtoReflect() protoreflect.Message { + mi := &file_conversations_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 ImagePixels.ProtoReflect.Descriptor instead. +func (*ImagePixels) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{12} +} + +func (x *ImagePixels) GetWidth() int64 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *ImagePixels) GetHeight() int64 { + if x != nil { + return x.Height + } + return 0 +} + +type MessageContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *MessageContent) Reset() { + *x = MessageContent{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageContent) ProtoMessage() {} + +func (x *MessageContent) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[13] + 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 MessageContent.ProtoReflect.Descriptor instead. +func (*MessageContent) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{13} +} + +func (x *MessageContent) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type IsFromMe struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FromMe bool `protobuf:"varint,1,opt,name=fromMe,proto3" json:"fromMe,omitempty"` +} + +func (x *IsFromMe) Reset() { + *x = IsFromMe{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IsFromMe) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IsFromMe) ProtoMessage() {} + +func (x *IsFromMe) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[14] + 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 IsFromMe.ProtoReflect.Descriptor instead. +func (*IsFromMe) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{14} +} + +func (x *IsFromMe) GetFromMe() bool { + if x != nil { + return x.FromMe + } + return false +} + +type MessageStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // UNKNOWN_STATUS = 0; + // + // SENDING = 5; + // + // SENT = 1; + 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"` +} + +func (x *MessageStatus) Reset() { + *x = MessageStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageStatus) ProtoMessage() {} + +func (x *MessageStatus) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[15] + 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 MessageStatus.ProtoReflect.Descriptor instead. +func (*MessageStatus) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{15} +} + +func (x *MessageStatus) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *MessageStatus) GetErrMsg() string { + if x != nil { + return x.ErrMsg + } + return "" +} + +func (x *MessageStatus) GetMsgStatus() string { + if x != nil { + return x.MsgStatus + } + return "" +} + +type Conversations struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Conversations []*Conversation `protobuf:"bytes,2,rep,name=conversations,proto3" json:"conversations,omitempty"` +} + +func (x *Conversations) Reset() { + *x = Conversations{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Conversations) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Conversations) ProtoMessage() {} + +func (x *Conversations) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[16] + 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 Conversations.ProtoReflect.Descriptor instead. +func (*Conversations) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{16} +} + +func (x *Conversations) GetConversations() []*Conversation { + if x != nil { + return x.Conversations + } + return nil +} + +type Conversation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConversationId string `protobuf:"bytes,1,opt,name=conversationId,proto3" json:"conversationId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + LatestMessage *LatestMessage `protobuf:"bytes,4,opt,name=latestMessage,proto3" json:"latestMessage,omitempty"` + TimestampMs int64 `protobuf:"varint,5,opt,name=timestampMs,proto3" json:"timestampMs,omitempty"` + IsGroupChat bool `protobuf:"varint,10,opt,name=isGroupChat,proto3" json:"isGroupChat,omitempty"` // not certain + SelfParticipantId string `protobuf:"bytes,11,opt,name=selfParticipantId,proto3" json:"selfParticipantId,omitempty"` + // bool bool1 = 13; + Status int64 `protobuf:"varint,12,opt,name=status,proto3" json:"status,omitempty"` + HashHex string `protobuf:"bytes,15,opt,name=hashHex,proto3" json:"hashHex,omitempty"` + MessageId string `protobuf:"bytes,17,opt,name=messageId,proto3" json:"messageId,omitempty"` + Participants []*Participant `protobuf:"bytes,20,rep,name=participants,proto3" json:"participants,omitempty"` + OtherParticipants []string `protobuf:"bytes,21,rep,name=otherParticipants,proto3" json:"otherParticipants,omitempty"` // participant ids excluding me + Type int64 `protobuf:"varint,22,opt,name=type,proto3" json:"type,omitempty"` +} + +func (x *Conversation) Reset() { + *x = Conversation{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Conversation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Conversation) ProtoMessage() {} + +func (x *Conversation) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[17] + 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 Conversation.ProtoReflect.Descriptor instead. +func (*Conversation) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{17} +} + +func (x *Conversation) GetConversationId() string { + if x != nil { + return x.ConversationId + } + return "" +} + +func (x *Conversation) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Conversation) GetLatestMessage() *LatestMessage { + if x != nil { + return x.LatestMessage + } + return nil +} + +func (x *Conversation) GetTimestampMs() int64 { + if x != nil { + return x.TimestampMs + } + return 0 +} + +func (x *Conversation) GetIsGroupChat() bool { + if x != nil { + return x.IsGroupChat + } + return false +} + +func (x *Conversation) GetSelfParticipantId() string { + if x != nil { + return x.SelfParticipantId + } + return "" +} + +func (x *Conversation) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *Conversation) GetHashHex() string { + if x != nil { + return x.HashHex + } + return "" +} + +func (x *Conversation) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +func (x *Conversation) GetParticipants() []*Participant { + if x != nil { + return x.Participants + } + return nil +} + +func (x *Conversation) GetOtherParticipants() []string { + if x != nil { + return x.OtherParticipants + } + return nil +} + +func (x *Conversation) GetType() int64 { + if x != nil { + return x.Type + } + return 0 +} + +type Participant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SmallInfo *SmallInfo `protobuf:"bytes,1,opt,name=smallInfo,proto3" json:"smallInfo,omitempty"` + HashHex string `protobuf:"bytes,5,opt,name=hashHex,proto3" json:"hashHex,omitempty"` + IsMe bool `protobuf:"varint,6,opt,name=isMe,proto3" json:"isMe,omitempty"` + Muted *Muted `protobuf:"bytes,7,opt,name=muted,proto3" json:"muted,omitempty"` + // bool bool2 = 8; + Bs int64 `protobuf:"varint,14,opt,name=bs,proto3" json:"bs,omitempty"` + DisplayName string `protobuf:"bytes,15,opt,name=displayName,proto3" json:"displayName,omitempty"` +} + +func (x *Participant) Reset() { + *x = Participant{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Participant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Participant) ProtoMessage() {} + +func (x *Participant) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[18] + 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 Participant.ProtoReflect.Descriptor instead. +func (*Participant) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{18} +} + +func (x *Participant) GetSmallInfo() *SmallInfo { + if x != nil { + return x.SmallInfo + } + return nil +} + +func (x *Participant) GetHashHex() string { + if x != nil { + return x.HashHex + } + return "" +} + +func (x *Participant) GetIsMe() bool { + if x != nil { + return x.IsMe + } + return false +} + +func (x *Participant) GetMuted() *Muted { + if x != nil { + return x.Muted + } + return nil +} + +func (x *Participant) GetBs() int64 { + if x != nil { + return x.Bs + } + return 0 +} + +func (x *Participant) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +type SmallInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type int64 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` + Number string `protobuf:"bytes,2,opt,name=number,proto3" json:"number,omitempty"` + ParticipantId string `protobuf:"bytes,3,opt,name=participantId,proto3" json:"participantId,omitempty"` +} + +func (x *SmallInfo) Reset() { + *x = SmallInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SmallInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SmallInfo) ProtoMessage() {} + +func (x *SmallInfo) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[19] + 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 SmallInfo.ProtoReflect.Descriptor instead. +func (*SmallInfo) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{19} +} + +func (x *SmallInfo) GetType() int64 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *SmallInfo) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +func (x *SmallInfo) GetParticipantId() string { + if x != nil { + return x.ParticipantId + } + return "" +} + +type LatestMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + FromMe bool `protobuf:"varint,2,opt,name=fromMe,proto3" json:"fromMe,omitempty"` // isMe? + DisplayName string `protobuf:"bytes,4,opt,name=displayName,proto3" json:"displayName,omitempty"` //Unknown unknown = 5; +} + +func (x *LatestMessage) Reset() { + *x = LatestMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LatestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LatestMessage) ProtoMessage() {} + +func (x *LatestMessage) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[20] + 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 LatestMessage.ProtoReflect.Descriptor instead. +func (*LatestMessage) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{20} +} + +func (x *LatestMessage) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *LatestMessage) GetFromMe() bool { + if x != nil { + return x.FromMe + } + return false +} + +func (x *LatestMessage) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +type Unknown struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Field1 int64 `protobuf:"varint,1,opt,name=field1,proto3" json:"field1,omitempty"` + Field2 int64 `protobuf:"varint,2,opt,name=field2,proto3" json:"field2,omitempty"` +} + +func (x *Unknown) Reset() { + *x = Unknown{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Unknown) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Unknown) ProtoMessage() {} + +func (x *Unknown) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[21] + 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 Unknown.ProtoReflect.Descriptor instead. +func (*Unknown) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{21} +} + +func (x *Unknown) GetField1() int64 { + if x != nil { + return x.Field1 + } + return 0 +} + +func (x *Unknown) GetField2() int64 { + if x != nil { + return x.Field2 + } + return 0 +} + +type Muted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsMuted bool `protobuf:"varint,1,opt,name=isMuted,proto3" json:"isMuted,omitempty"` +} + +func (x *Muted) Reset() { + *x = Muted{} + if protoimpl.UnsafeEnabled { + mi := &file_conversations_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Muted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Muted) ProtoMessage() {} + +func (x *Muted) ProtoReflect() protoreflect.Message { + mi := &file_conversations_proto_msgTypes[22] + 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 Muted.ProtoReflect.Descriptor instead. +func (*Muted) Descriptor() ([]byte, []int) { + return file_conversations_proto_rawDescGZIP(), []int{22} +} + +func (x *Muted) GetIsMuted() bool { + if x != nil { + return x.IsMuted + } + return false +} + +var File_conversations_proto protoreflect.FileDescriptor + +var file_conversations_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6d, + 0x70, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6d, 0x70, 0x49, 0x64, + 0x22, 0xae, 0x02, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6d, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6d, 0x70, 0x49, 0x64, 0x12, 0x5a, 0x0a, 0x15, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x15, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, + 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, + 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x0b, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6d, 0x70, + 0x49, 0x64, 0x32, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6d, 0x70, 0x49, 0x64, + 0x32, 0x22, 0x5e, 0x0a, 0x15, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0e, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x22, 0x41, 0x0a, 0x17, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x26, 0x0a, 0x0e, + 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x1e, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x4f, + 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, 0x22, 0x8f, + 0x01, 0x0a, 0x20, 0x46, 0x65, 0x74, 0x63, 0x68, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, + 0x22, 0x47, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x34, 0x22, 0xbe, 0x01, 0x0a, 0x15, 0x46, 0x65, + 0x74, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x6f, 0x6d, 0x65, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x63, + 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x75, 0x72, 0x73, + 0x6f, 0x72, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x42, 0x0a, 0x06, 0x43, 0x75, + 0x72, 0x73, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x72, 0x12, 0x1e, + 0x0a, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x88, + 0x03, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x52, + 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x42, 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x24, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6d, 0x70, 0x49, 0x64, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6d, 0x70, 0x49, 0x64, 0x22, 0xc7, 0x01, 0x0a, 0x0b, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, + 0x47, 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0c, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, + 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x22, 0xb6, 0x02, 0x0a, 0x0c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6f, 0x6d, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x6f, 0x6d, 0x65, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x12, 0x32, 0x0a, 0x06, 0x70, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x52, 0x06, 0x70, 0x69, + 0x78, 0x65, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, + 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x32, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x32, 0x12, 0x24, + 0x0a, 0x0d, 0x64, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x64, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x64, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x32, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x64, 0x65, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x32, 0x22, 0x3b, 0x0a, 0x0b, + 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x77, + 0x69, 0x64, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x2a, 0x0a, 0x0e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x22, 0x0a, 0x08, 0x49, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x4d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x22, 0x59, 0x0a, 0x0d, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x73, 0x67, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x52, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xd2, 0x03, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x6c, 0x61, 0x74, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x69, + 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0b, 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x12, 0x2c, 0x0a, + 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, + 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x12, 0x1c, 0x0a, + 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x70, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x70, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6f, + 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, + 0x18, 0x15, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xd1, 0x01, + 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x36, 0x0a, + 0x09, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x6d, 0x61, 0x6c, + 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x12, + 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, + 0x73, 0x4d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x12, + 0x0e, 0x0a, 0x02, 0x62, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x62, 0x73, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x5d, 0x0a, 0x09, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, + 0x22, 0x63, 0x0a, 0x0d, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, + 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x72, 0x6f, + 0x6d, 0x4d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, + 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, + 0x22, 0x21, 0x0a, 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x4d, + 0x75, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x4d, 0x75, + 0x74, 0x65, 0x64, 0x2a, 0xa0, 0x01, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x58, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4d, + 0x41, 0x47, 0x45, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x49, 0x44, 0x45, 0x4f, 0x10, 0x03, + 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x44, 0x49, 0x4f, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x41, + 0x54, 0x54, 0x41, 0x43, 0x48, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x4c, + 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x49, 0x43, + 0x48, 0x5f, 0x43, 0x41, 0x52, 0x44, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x43, 0x41, 0x52, + 0x44, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x4d, 0x53, 0x5f, 0x4e, 0x45, 0x45, 0x44, 0x53, + 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x10, 0x09, 0x12, 0x09, 0x0a, 0x05, 0x52, + 0x45, 0x50, 0x4c, 0x59, 0x10, 0x0a, 0x2a, 0x3a, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, + 0x57, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, + 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x45, 0x4e, 0x54, + 0x10, 0x01, 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 ( + file_conversations_proto_rawDescOnce sync.Once + file_conversations_proto_rawDescData = file_conversations_proto_rawDesc +) + +func file_conversations_proto_rawDescGZIP() []byte { + file_conversations_proto_rawDescOnce.Do(func() { + file_conversations_proto_rawDescData = protoimpl.X.CompressGZIP(file_conversations_proto_rawDescData) + }) + return file_conversations_proto_rawDescData +} + +var file_conversations_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_conversations_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_conversations_proto_goTypes = []interface{}{ + (MessageType)(0), // 0: conversations.MessageType + (MsgStatusCode)(0), // 1: conversations.MsgStatusCode + (*SendMessagePayload)(nil), // 2: conversations.SendMessagePayload + (*MessagePayload)(nil), // 3: conversations.MessagePayload + (*MessagePayloadContent)(nil), // 4: conversations.MessagePayloadContent + (*OpenConversationPayload)(nil), // 5: conversations.OpenConversationPayload + (*PrepareOpenConversationPayload)(nil), // 6: conversations.PrepareOpenConversationPayload + (*FetchConversationMessagesPayload)(nil), // 7: conversations.FetchConversationMessagesPayload + (*ListCoversationsPayload)(nil), // 8: conversations.ListCoversationsPayload + (*FetchMessagesResponse)(nil), // 9: conversations.FetchMessagesResponse + (*Cursor)(nil), // 10: conversations.Cursor + (*Message)(nil), // 11: conversations.Message + (*MessageInfo)(nil), // 12: conversations.MessageInfo + (*ImageContent)(nil), // 13: conversations.ImageContent + (*ImagePixels)(nil), // 14: conversations.ImagePixels + (*MessageContent)(nil), // 15: conversations.MessageContent + (*IsFromMe)(nil), // 16: conversations.IsFromMe + (*MessageStatus)(nil), // 17: conversations.MessageStatus + (*Conversations)(nil), // 18: conversations.Conversations + (*Conversation)(nil), // 19: conversations.Conversation + (*Participant)(nil), // 20: conversations.Participant + (*SmallInfo)(nil), // 21: conversations.SmallInfo + (*LatestMessage)(nil), // 22: conversations.LatestMessage + (*Unknown)(nil), // 23: conversations.Unknown + (*Muted)(nil), // 24: conversations.Muted +} +var file_conversations_proto_depIdxs = []int32{ + 3, // 0: conversations.SendMessagePayload.messagePayload:type_name -> conversations.MessagePayload + 4, // 1: conversations.MessagePayload.messagePayloadContent:type_name -> conversations.MessagePayloadContent + 12, // 2: conversations.MessagePayload.messageInfo:type_name -> conversations.MessageInfo + 15, // 3: conversations.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent + 10, // 4: conversations.FetchConversationMessagesPayload.cursor:type_name -> conversations.Cursor + 11, // 5: conversations.FetchMessagesResponse.messages:type_name -> conversations.Message + 10, // 6: conversations.FetchMessagesResponse.cursor:type_name -> conversations.Cursor + 16, // 7: conversations.Message.from:type_name -> conversations.IsFromMe + 17, // 8: conversations.Message.messageStatus:type_name -> conversations.MessageStatus + 12, // 9: conversations.Message.messageInfo:type_name -> conversations.MessageInfo + 0, // 10: conversations.Message.type:type_name -> conversations.MessageType + 15, // 11: conversations.MessageInfo.messageContent:type_name -> conversations.MessageContent + 13, // 12: conversations.MessageInfo.imageContent:type_name -> conversations.ImageContent + 14, // 13: conversations.ImageContent.pixels:type_name -> conversations.ImagePixels + 19, // 14: conversations.Conversations.conversations:type_name -> conversations.Conversation + 22, // 15: conversations.Conversation.latestMessage:type_name -> conversations.LatestMessage + 20, // 16: conversations.Conversation.participants:type_name -> conversations.Participant + 21, // 17: conversations.Participant.smallInfo:type_name -> conversations.SmallInfo + 24, // 18: conversations.Participant.muted:type_name -> conversations.Muted + 19, // [19:19] is the sub-list for method output_type + 19, // [19:19] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name +} + +func init() { file_conversations_proto_init() } +func file_conversations_proto_init() { + if File_conversations_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_conversations_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendMessagePayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessagePayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessagePayloadContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OpenConversationPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrepareOpenConversationPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FetchConversationMessagesPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListCoversationsPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FetchMessagesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Cursor); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImagePixels); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IsFromMe); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Conversations); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Conversation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Participant); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SmallInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LatestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Unknown); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conversations_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Muted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_conversations_proto_msgTypes[10].OneofWrappers = []interface{}{ + (*MessageInfo_MessageContent)(nil), + (*MessageInfo_ImageContent)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_conversations_proto_rawDesc, + NumEnums: 2, + NumMessages: 23, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_conversations_proto_goTypes, + DependencyIndexes: file_conversations_proto_depIdxs, + EnumInfos: file_conversations_proto_enumTypes, + MessageInfos: file_conversations_proto_msgTypes, + }.Build() + File_conversations_proto = out.File + file_conversations_proto_rawDesc = nil + file_conversations_proto_goTypes = nil + file_conversations_proto_depIdxs = nil +} diff --git a/libgm/binary/events.pb.go b/libgm/binary/events.pb.go new file mode 100644 index 0000000..e7c6bac --- /dev/null +++ b/libgm/binary/events.pb.go @@ -0,0 +1,424 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: events.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Event struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Event: + // + // *Event_ConversationEvent + // *Event_MessageEvent + // *Event_UserAlertEvent + Event isEvent_Event `protobuf_oneof:"event"` +} + +func (x *Event) Reset() { + *x = Event{} + if protoimpl.UnsafeEnabled { + mi := &file_events_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_events_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_events_proto_rawDescGZIP(), []int{0} +} + +func (m *Event) GetEvent() isEvent_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *Event) GetConversationEvent() *ConversationEvent { + if x, ok := x.GetEvent().(*Event_ConversationEvent); ok { + return x.ConversationEvent + } + return nil +} + +func (x *Event) GetMessageEvent() *MessageEvent { + if x, ok := x.GetEvent().(*Event_MessageEvent); ok { + return x.MessageEvent + } + return nil +} + +func (x *Event) GetUserAlertEvent() *UserAlertEvent { + if x, ok := x.GetEvent().(*Event_UserAlertEvent); ok { + return x.UserAlertEvent + } + return nil +} + +type isEvent_Event interface { + isEvent_Event() +} + +type Event_ConversationEvent struct { + ConversationEvent *ConversationEvent `protobuf:"bytes,2,opt,name=conversationEvent,proto3,oneof"` +} + +type Event_MessageEvent struct { + MessageEvent *MessageEvent `protobuf:"bytes,3,opt,name=messageEvent,proto3,oneof"` +} + +type Event_UserAlertEvent struct { + UserAlertEvent *UserAlertEvent `protobuf:"bytes,6,opt,name=userAlertEvent,proto3,oneof"` +} + +func (*Event_ConversationEvent) isEvent_Event() {} + +func (*Event_MessageEvent) isEvent_Event() {} + +func (*Event_UserAlertEvent) isEvent_Event() {} + +type ConversationEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *Conversation `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *ConversationEvent) Reset() { + *x = ConversationEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_events_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConversationEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConversationEvent) ProtoMessage() {} + +func (x *ConversationEvent) ProtoReflect() protoreflect.Message { + mi := &file_events_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConversationEvent.ProtoReflect.Descriptor instead. +func (*ConversationEvent) Descriptor() ([]byte, []int) { + return file_events_proto_rawDescGZIP(), []int{1} +} + +func (x *ConversationEvent) GetData() *Conversation { + if x != nil { + return x.Data + } + return nil +} + +type MessageEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *Message `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *MessageEvent) Reset() { + *x = MessageEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_events_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageEvent) ProtoMessage() {} + +func (x *MessageEvent) ProtoReflect() protoreflect.Message { + mi := &file_events_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageEvent.ProtoReflect.Descriptor instead. +func (*MessageEvent) Descriptor() ([]byte, []int) { + return file_events_proto_rawDescGZIP(), []int{2} +} + +func (x *MessageEvent) GetData() *Message { + if x != nil { + return x.Data + } + return nil +} + +type UserAlertEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 2 = BROWSER_ACTIVE (new session created in other browser) + // + // 1 = ? + // + // 8 = INACTIVE_LACK_OF_ACTIVITY + // + // 7 = INACTIVE_TIMEOUT + // + // 5|6 = BATTERY (tf?) + // + // 3|4 = DATA_CONNECTION (tf?) + // + // 10 = OBSERVER_REGISTERED (tf?) + AlertType int64 `protobuf:"varint,2,opt,name=alert_type,json=alertType,proto3" json:"alert_type,omitempty"` +} + +func (x *UserAlertEvent) Reset() { + *x = UserAlertEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_events_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserAlertEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserAlertEvent) ProtoMessage() {} + +func (x *UserAlertEvent) ProtoReflect() protoreflect.Message { + mi := &file_events_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 UserAlertEvent.ProtoReflect.Descriptor instead. +func (*UserAlertEvent) Descriptor() ([]byte, []int) { + return file_events_proto_rawDescGZIP(), []int{3} +} + +func (x *UserAlertEvent) GetAlertType() int64 { + if x != nil { + return x.AlertType + } + return 0 +} + +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, + 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, + 0x32, 0x19, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x11, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x3a, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0c, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0e, + 0x75, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, + 0x75, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x44, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x0a, + 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2f, 0x0a, 0x0e, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, + 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x54, 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 ( + file_events_proto_rawDescOnce sync.Once + file_events_proto_rawDescData = file_events_proto_rawDesc +) + +func file_events_proto_rawDescGZIP() []byte { + file_events_proto_rawDescOnce.Do(func() { + file_events_proto_rawDescData = protoimpl.X.CompressGZIP(file_events_proto_rawDescData) + }) + return file_events_proto_rawDescData +} + +var file_events_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_events_proto_goTypes = []interface{}{ + (*Event)(nil), // 0: events.Event + (*ConversationEvent)(nil), // 1: events.ConversationEvent + (*MessageEvent)(nil), // 2: events.MessageEvent + (*UserAlertEvent)(nil), // 3: events.UserAlertEvent + (*Conversation)(nil), // 4: conversations.Conversation + (*Message)(nil), // 5: conversations.Message +} +var file_events_proto_depIdxs = []int32{ + 1, // 0: events.Event.conversationEvent:type_name -> events.ConversationEvent + 2, // 1: events.Event.messageEvent:type_name -> events.MessageEvent + 3, // 2: events.Event.userAlertEvent:type_name -> events.UserAlertEvent + 4, // 3: events.ConversationEvent.data:type_name -> conversations.Conversation + 5, // 4: events.MessageEvent.data:type_name -> conversations.Message + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_events_proto_init() } +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{} { + switch v := v.(*Event); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConversationEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_events_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserAlertEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_events_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Event_ConversationEvent)(nil), + (*Event_MessageEvent)(nil), + (*Event_UserAlertEvent)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_events_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_events_proto_goTypes, + DependencyIndexes: file_events_proto_depIdxs, + MessageInfos: file_events_proto_msgTypes, + }.Build() + File_events_proto = out.File + file_events_proto_rawDesc = nil + file_events_proto_goTypes = nil + file_events_proto_depIdxs = nil +} diff --git a/libgm/binary/media.pb.go b/libgm/binary/media.pb.go new file mode 100644 index 0000000..8808cff --- /dev/null +++ b/libgm/binary/media.pb.go @@ -0,0 +1,318 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: media.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type StartMediaUploadPayload struct { + state protoimpl.MessageState + 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"` +} + +func (x *StartMediaUploadPayload) Reset() { + *x = StartMediaUploadPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_media_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartMediaUploadPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartMediaUploadPayload) ProtoMessage() {} + +func (x *StartMediaUploadPayload) ProtoReflect() protoreflect.Message { + mi := &file_media_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartMediaUploadPayload.ProtoReflect.Descriptor instead. +func (*StartMediaUploadPayload) Descriptor() ([]byte, []int) { + return file_media_proto_rawDescGZIP(), []int{0} +} + +func (x *StartMediaUploadPayload) GetImageType() int64 { + if x != nil { + return x.ImageType + } + return 0 +} + +func (x *StartMediaUploadPayload) GetAuthData() *AuthMessageBytes { + if x != nil { + return x.AuthData + } + return nil +} + +func (x *StartMediaUploadPayload) GetMobile() *Device { + if x != nil { + return x.Mobile + } + return nil +} + +type UploadMediaResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Media *Media `protobuf:"bytes,1,opt,name=media,proto3" json:"media,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *UploadMediaResponse) Reset() { + *x = UploadMediaResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_media_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadMediaResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadMediaResponse) ProtoMessage() {} + +func (x *UploadMediaResponse) ProtoReflect() protoreflect.Message { + mi := &file_media_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadMediaResponse.ProtoReflect.Descriptor instead. +func (*UploadMediaResponse) Descriptor() ([]byte, []int) { + return file_media_proto_rawDescGZIP(), []int{1} +} + +func (x *UploadMediaResponse) GetMedia() *Media { + if x != nil { + return x.Media + } + return nil +} + +func (x *UploadMediaResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type Media struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MediaId string `protobuf:"bytes,1,opt,name=mediaId,proto3" json:"mediaId,omitempty"` + MediaNumber int64 `protobuf:"varint,2,opt,name=mediaNumber,proto3" json:"mediaNumber,omitempty"` +} + +func (x *Media) Reset() { + *x = Media{} + if protoimpl.UnsafeEnabled { + mi := &file_media_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Media) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Media) ProtoMessage() {} + +func (x *Media) ProtoReflect() protoreflect.Message { + mi := &file_media_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Media.ProtoReflect.Descriptor instead. +func (*Media) Descriptor() ([]byte, []int) { + return file_media_proto_rawDescGZIP(), []int{2} +} + +func (x *Media) GetMediaId() string { + if x != nil { + return x.MediaId + } + return "" +} + +func (x *Media) GetMediaNumber() int64 { + if x != nil { + return x.MediaNumber + } + return 0 +} + +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, + 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, + 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, +} + +var ( + file_media_proto_rawDescOnce sync.Once + file_media_proto_rawDescData = file_media_proto_rawDesc +) + +func file_media_proto_rawDescGZIP() []byte { + file_media_proto_rawDescOnce.Do(func() { + file_media_proto_rawDescData = protoimpl.X.CompressGZIP(file_media_proto_rawDescData) + }) + return file_media_proto_rawDescData +} + +var file_media_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +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 + (*Device)(nil), // 4: messages.Device +} +var file_media_proto_depIdxs = []int32{ + 3, // 0: media.StartMediaUploadPayload.authData:type_name -> messages.AuthMessageBytes + 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 + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_media_proto_init() } +func file_media_proto_init() { + if File_media_proto != nil { + return + } + file_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_media_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartMediaUploadPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_media_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadMediaResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_media_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Media); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_media_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_media_proto_goTypes, + DependencyIndexes: file_media_proto_depIdxs, + MessageInfos: file_media_proto_msgTypes, + }.Build() + File_media_proto = out.File + file_media_proto_rawDesc = nil + file_media_proto_goTypes = nil + file_media_proto_depIdxs = nil +} diff --git a/libgm/binary/messages.pb.go b/libgm/binary/messages.pb.go new file mode 100644 index 0000000..1da3ac8 --- /dev/null +++ b/libgm/binary/messages.pb.go @@ -0,0 +1,1086 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: messages.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type EncodedPayload 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"` + Opcode int64 `protobuf:"varint,2,opt,name=opcode,proto3" json:"opcode,omitempty"` + EncryptedData []byte `protobuf:"bytes,5,opt,name=encryptedData,proto3" json:"encryptedData,omitempty"` + SessionId string `protobuf:"bytes,6,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` +} + +func (x *EncodedPayload) Reset() { + *x = EncodedPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EncodedPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncodedPayload) ProtoMessage() {} + +func (x *EncodedPayload) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EncodedPayload.ProtoReflect.Descriptor instead. +func (*EncodedPayload) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{0} +} + +func (x *EncodedPayload) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *EncodedPayload) GetOpcode() int64 { + if x != nil { + return x.Opcode + } + return 0 +} + +func (x *EncodedPayload) GetEncryptedData() []byte { + if x != nil { + return x.EncryptedData + } + return nil +} + +func (x *EncodedPayload) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +type EncodedResponse 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"` + // int64 msg = 2; + UnixNano int64 `protobuf:"varint,3,opt,name=unixNano,proto3" json:"unixNano,omitempty"` + Opcode int64 `protobuf:"varint,4,opt,name=opcode,proto3" json:"opcode,omitempty"` + // bytes keyData = 5; + Sub bool `protobuf:"varint,6,opt,name=sub,proto3" json:"sub,omitempty"` + Third int64 `protobuf:"varint,7,opt,name=third,proto3" json:"third,omitempty"` + EncryptedData []byte `protobuf:"bytes,8,opt,name=encryptedData,proto3" json:"encryptedData,omitempty"` + Field9 bool `protobuf:"varint,9,opt,name=field9,proto3" json:"field9,omitempty"` +} + +func (x *EncodedResponse) Reset() { + *x = EncodedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EncodedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncodedResponse) ProtoMessage() {} + +func (x *EncodedResponse) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EncodedResponse.ProtoReflect.Descriptor instead. +func (*EncodedResponse) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{1} +} + +func (x *EncodedResponse) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *EncodedResponse) GetUnixNano() int64 { + if x != nil { + return x.UnixNano + } + return 0 +} + +func (x *EncodedResponse) GetOpcode() int64 { + if x != nil { + return x.Opcode + } + return 0 +} + +func (x *EncodedResponse) GetSub() bool { + if x != nil { + return x.Sub + } + return false +} + +func (x *EncodedResponse) GetThird() int64 { + if x != nil { + return x.Third + } + return 0 +} + +func (x *EncodedResponse) GetEncryptedData() []byte { + if x != nil { + return x.EncryptedData + } + return nil +} + +func (x *EncodedResponse) GetField9() bool { + if x != nil { + return x.Field9 + } + return false +} + +type MessageData 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"` + RoutingOpCode int64 `protobuf:"varint,2,opt,name=routing_op_code,json=routingOpCode,proto3" json:"routing_op_code,omitempty"` + Ts1 string `protobuf:"bytes,3,opt,name=ts1,proto3" json:"ts1,omitempty"` + Field5 int64 `protobuf:"varint,5,opt,name=field5,proto3" json:"field5,omitempty"` + Ts2 string `protobuf:"bytes,6,opt,name=ts2,proto3" json:"ts2,omitempty"` + SomeString string `protobuf:"bytes,7,opt,name=someString,proto3" json:"someString,omitempty"` + Mobile *Device `protobuf:"bytes,8,opt,name=mobile,proto3" json:"mobile,omitempty"` + Browser *Device `protobuf:"bytes,9,opt,name=browser,proto3" json:"browser,omitempty"` + EncodedData string `protobuf:"bytes,12,opt,name=encodedData,proto3" json:"encodedData,omitempty"` + EncodedRequestId string `protobuf:"bytes,17,opt,name=encoded_request_id,json=encodedRequestId,proto3" json:"encoded_request_id,omitempty"` + MsgTypeArr *MsgTypeArr `protobuf:"bytes,23,opt,name=msgTypeArr,proto3" json:"msgTypeArr,omitempty"` +} + +func (x *MessageData) Reset() { + *x = MessageData{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageData) ProtoMessage() {} + +func (x *MessageData) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageData.ProtoReflect.Descriptor instead. +func (*MessageData) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{2} +} + +func (x *MessageData) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *MessageData) GetRoutingOpCode() int64 { + if x != nil { + return x.RoutingOpCode + } + return 0 +} + +func (x *MessageData) GetTs1() string { + if x != nil { + return x.Ts1 + } + return "" +} + +func (x *MessageData) GetField5() int64 { + if x != nil { + return x.Field5 + } + return 0 +} + +func (x *MessageData) GetTs2() string { + if x != nil { + return x.Ts2 + } + return "" +} + +func (x *MessageData) GetSomeString() string { + if x != nil { + return x.SomeString + } + return "" +} + +func (x *MessageData) GetMobile() *Device { + if x != nil { + return x.Mobile + } + return nil +} + +func (x *MessageData) GetBrowser() *Device { + if x != nil { + return x.Browser + } + return nil +} + +func (x *MessageData) GetEncodedData() string { + if x != nil { + return x.EncodedData + } + return "" +} + +func (x *MessageData) GetEncodedRequestId() string { + if x != nil { + return x.EncodedRequestId + } + return "" +} + +func (x *MessageData) GetMsgTypeArr() *MsgTypeArr { + if x != nil { + return x.MsgTypeArr + } + return nil +} + +type MsgTypeArr struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EmptyArr *EmptyArr `protobuf:"bytes,1,opt,name=emptyArr,proto3" json:"emptyArr,omitempty"` + MsgType int64 `protobuf:"varint,2,opt,name=msgType,proto3" json:"msgType,omitempty"` +} + +func (x *MsgTypeArr) Reset() { + *x = MsgTypeArr{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgTypeArr) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgTypeArr) ProtoMessage() {} + +func (x *MsgTypeArr) 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 MsgTypeArr.ProtoReflect.Descriptor instead. +func (*MsgTypeArr) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{3} +} + +func (x *MsgTypeArr) GetEmptyArr() *EmptyArr { + if x != nil { + return x.EmptyArr + } + return nil +} + +func (x *MsgTypeArr) GetMsgType() int64 { + if x != nil { + return x.MsgType + } + return 0 +} + +type EmptyArr struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *EmptyArr) Reset() { + *x = EmptyArr{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmptyArr) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmptyArr) ProtoMessage() {} + +func (x *EmptyArr) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmptyArr.ProtoReflect.Descriptor instead. +func (*EmptyArr) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{4} +} + +type AuthMessage 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 string `protobuf:"bytes,6,opt,name=rpcKey,proto3" json:"rpcKey,omitempty"` + Date *Date `protobuf:"bytes,7,opt,name=date,proto3" json:"date,omitempty"` +} + +func (x *AuthMessage) Reset() { + *x = AuthMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthMessage) ProtoMessage() {} + +func (x *AuthMessage) 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 AuthMessage.ProtoReflect.Descriptor instead. +func (*AuthMessage) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{5} +} + +func (x *AuthMessage) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *AuthMessage) GetRpcKey() string { + if x != nil { + return x.RpcKey + } + return "" +} + +func (x *AuthMessage) GetDate() *Date { + if x != nil { + return x.Date + } + return nil +} + +type AuthMessageBytes 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"` +} + +func (x *AuthMessageBytes) Reset() { + *x = AuthMessageBytes{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthMessageBytes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthMessageBytes) ProtoMessage() {} + +func (x *AuthMessageBytes) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthMessageBytes.ProtoReflect.Descriptor instead. +func (*AuthMessageBytes) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{6} +} + +func (x *AuthMessageBytes) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *AuthMessageBytes) GetRpcKey() []byte { + if x != nil { + return x.RpcKey + } + return nil +} + +func (x *AuthMessageBytes) GetDate() *Date { + if x != nil { + return x.Date + } + return nil +} + +type BaseData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ttl int64 `protobuf:"varint,2,opt,name=Ttl,proto3" json:"Ttl,omitempty"` + EmptyArr *EmptyArr `protobuf:"bytes,6,opt,name=emptyArr,proto3" json:"emptyArr,omitempty"` +} + +func (x *BaseData) Reset() { + *x = BaseData{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BaseData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BaseData) ProtoMessage() {} + +func (x *BaseData) 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 BaseData.ProtoReflect.Descriptor instead. +func (*BaseData) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{7} +} + +func (x *BaseData) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +func (x *BaseData) GetEmptyArr() *EmptyArr { + if x != nil { + return x.EmptyArr + } + return nil +} + +type RPCResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Unknown []byte `protobuf:"bytes,1,opt,name=unknown,proto3" json:"unknown,omitempty"` + Data *MessageData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *RPCResponse) Reset() { + *x = RPCResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RPCResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RPCResponse) ProtoMessage() {} + +func (x *RPCResponse) 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 { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RPCResponse.ProtoReflect.Descriptor instead. +func (*RPCResponse) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{8} +} + +func (x *RPCResponse) GetUnknown() []byte { + if x != nil { + return x.Unknown + } + return nil +} + +func (x *RPCResponse) GetData() *MessageData { + if x != nil { + return x.Data + } + return nil +} + +type Device struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + RegistrationId string `protobuf:"bytes,2,opt,name=registrationId,proto3" json:"registrationId,omitempty"` + Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"` +} + +func (x *Device) Reset() { + *x = Device{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Device) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Device) ProtoMessage() {} + +func (x *Device) ProtoReflect() protoreflect.Message { + mi := &file_messages_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Device.ProtoReflect.Descriptor instead. +func (*Device) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{9} +} + +func (x *Device) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Device) GetRegistrationId() string { + if x != nil { + return x.RegistrationId + } + return "" +} + +func (x *Device) GetNetwork() string { + if x != nil { + return x.Network + } + return "" +} + +type Date struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Year int64 `protobuf:"varint,3,opt,name=year,proto3" json:"year,omitempty"` + Seq1 int64 `protobuf:"varint,4,opt,name=seq1,proto3" json:"seq1,omitempty"` + Seq2 int64 `protobuf:"varint,5,opt,name=seq2,proto3" json:"seq2,omitempty"` + Seq3 int64 `protobuf:"varint,7,opt,name=seq3,proto3" json:"seq3,omitempty"` + Seq4 int64 `protobuf:"varint,9,opt,name=seq4,proto3" json:"seq4,omitempty"` +} + +func (x *Date) Reset() { + *x = Date{} + if protoimpl.UnsafeEnabled { + mi := &file_messages_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Date) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Date) ProtoMessage() {} + +func (x *Date) 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 Date.ProtoReflect.Descriptor instead. +func (*Date) Descriptor() ([]byte, []int) { + return file_messages_proto_rawDescGZIP(), []int{10} +} + +func (x *Date) GetYear() int64 { + if x != nil { + return x.Year + } + return 0 +} + +func (x *Date) GetSeq1() int64 { + if x != nil { + return x.Seq1 + } + return 0 +} + +func (x *Date) GetSeq2() int64 { + if x != nil { + return x.Seq2 + } + return 0 +} + +func (x *Date) GetSeq3() int64 { + if x != nil { + return x.Seq3 + } + return 0 +} + +func (x *Date) GetSeq4() int64 { + if x != nil { + return x.Seq4 + } + return 0 +} + +var File_messages_proto protoreflect.FileDescriptor + +var file_messages_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x0e, 0x45, + 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 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, + 0x6f, 0x70, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x70, + 0x63, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, + 0x64, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x65, 0x6e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xca, 0x01, 0x0a, 0x0f, 0x45, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 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, 0x1a, 0x0a, 0x08, + 0x75, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x75, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x70, 0x63, 0x6f, 0x64, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x62, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x73, + 0x75, 0x62, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x68, 0x69, 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x74, 0x68, 0x69, 0x72, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, + 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x39, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x39, 0x22, 0x8c, 0x03, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 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, 0x26, 0x0a, 0x0f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, + 0x5f, 0x6f, 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, + 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x74, 0x73, 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x73, 0x31, 0x12, + 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x35, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x35, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x73, 0x32, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x73, 0x32, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6f, 0x6d, + 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, + 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x06, 0x6d, 0x6f, 0x62, + 0x69, 0x6c, 0x65, 0x18, 0x08, 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, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x12, + 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x2c, 0x0a, 0x12, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x65, + 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, + 0x34, 0x0a, 0x0a, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x41, 0x72, 0x72, 0x18, 0x17, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4d, + 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x41, 0x72, 0x72, 0x52, 0x0a, 0x6d, 0x73, 0x67, 0x54, 0x79, + 0x70, 0x65, 0x41, 0x72, 0x72, 0x22, 0x56, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, + 0x41, 0x72, 0x72, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x18, + 0x01, 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, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x22, 0x0a, 0x0a, + 0x08, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x22, 0x68, 0x0a, 0x0b, 0x41, 0x75, 0x74, + 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, + 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, +} + +var ( + file_messages_proto_rawDescOnce sync.Once + file_messages_proto_rawDescData = file_messages_proto_rawDesc +) + +func file_messages_proto_rawDescGZIP() []byte { + file_messages_proto_rawDescOnce.Do(func() { + file_messages_proto_rawDescData = protoimpl.X.CompressGZIP(file_messages_proto_rawDescData) + }) + return file_messages_proto_rawDescData +} + +var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +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 +} +var file_messages_proto_depIdxs = []int32{ + 9, // 0: messages.MessageData.mobile:type_name -> messages.Device + 9, // 1: messages.MessageData.browser:type_name -> messages.Device + 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 +} + +func init() { file_messages_proto_init() } +func file_messages_proto_init() { + if File_messages_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_messages_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncodedPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncodedResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgTypeArr); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EmptyArr); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthMessageBytes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BaseData); 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.(*RPCResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Device); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_messages_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Date); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_messages_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_messages_proto_goTypes, + DependencyIndexes: file_messages_proto_depIdxs, + MessageInfos: file_messages_proto_msgTypes, + }.Build() + File_messages_proto = out.File + file_messages_proto_rawDesc = nil + file_messages_proto_goTypes = nil + file_messages_proto_depIdxs = nil +} diff --git a/libgm/binary/pairing.pb.go b/libgm/binary/pairing.pb.go new file mode 100644 index 0000000..19c5c6d --- /dev/null +++ b/libgm/binary/pairing.pb.go @@ -0,0 +1,689 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: pairing.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type BrowserDetails struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserAgent string `protobuf:"bytes,1,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` + SomeInt int32 `protobuf:"varint,2,opt,name=someInt,proto3" json:"someInt,omitempty"` + Os string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"` + SomeBool bool `protobuf:"varint,6,opt,name=someBool,proto3" json:"someBool,omitempty"` +} + +func (x *BrowserDetails) Reset() { + *x = BrowserDetails{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BrowserDetails) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BrowserDetails) ProtoMessage() {} + +func (x *BrowserDetails) ProtoReflect() protoreflect.Message { + mi := &file_pairing_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BrowserDetails.ProtoReflect.Descriptor instead. +func (*BrowserDetails) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{0} +} + +func (x *BrowserDetails) GetUserAgent() string { + if x != nil { + return x.UserAgent + } + return "" +} + +func (x *BrowserDetails) GetSomeInt() int32 { + if x != nil { + return x.SomeInt + } + return 0 +} + +func (x *BrowserDetails) GetOs() string { + if x != nil { + return x.Os + } + return "" +} + +func (x *BrowserDetails) GetSomeBool() bool { + if x != nil { + return x.SomeBool + } + return false +} + +type PhoneRelayBody struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Bugle string `protobuf:"bytes,3,opt,name=bugle,proto3" json:"bugle,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"` +} + +func (x *PhoneRelayBody) Reset() { + *x = PhoneRelayBody{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PhoneRelayBody) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PhoneRelayBody) ProtoMessage() {} + +func (x *PhoneRelayBody) ProtoReflect() protoreflect.Message { + mi := &file_pairing_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PhoneRelayBody.ProtoReflect.Descriptor instead. +func (*PhoneRelayBody) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{1} +} + +func (x *PhoneRelayBody) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PhoneRelayBody) GetBugle() string { + if x != nil { + return x.Bugle + } + return "" +} + +func (x *PhoneRelayBody) GetRpcKey() []byte { + if x != nil { + return x.RpcKey + } + return nil +} + +func (x *PhoneRelayBody) GetDate() *Date { + if x != nil { + return x.Date + } + return nil +} + +type ECDSAKeys struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProtoVersion int64 `protobuf:"varint,1,opt,name=protoVersion,proto3" json:"protoVersion,omitempty"` // idk? + EncryptedKeys []byte `protobuf:"bytes,2,opt,name=encryptedKeys,proto3" json:"encryptedKeys,omitempty"` +} + +func (x *ECDSAKeys) Reset() { + *x = ECDSAKeys{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ECDSAKeys) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECDSAKeys) ProtoMessage() {} + +func (x *ECDSAKeys) ProtoReflect() protoreflect.Message { + mi := &file_pairing_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ECDSAKeys.ProtoReflect.Descriptor instead. +func (*ECDSAKeys) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{2} +} + +func (x *ECDSAKeys) GetProtoVersion() int64 { + if x != nil { + return x.ProtoVersion + } + return 0 +} + +func (x *ECDSAKeys) GetEncryptedKeys() []byte { + if x != nil { + return x.EncryptedKeys + } + return nil +} + +type PairDeviceData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Mobile *Device `protobuf:"bytes,1,opt,name=mobile,proto3" json:"mobile,omitempty"` + EcdsaKeys *ECDSAKeys `protobuf:"bytes,6,opt,name=ecdsaKeys,proto3" json:"ecdsaKeys,omitempty"` + WebAuthKeyData *WebAuthKey `protobuf:"bytes,2,opt,name=webAuthKeyData,proto3" json:"webAuthKeyData,omitempty"` + Browser *Device `protobuf:"bytes,3,opt,name=browser,proto3" json:"browser,omitempty"` +} + +func (x *PairDeviceData) Reset() { + *x = PairDeviceData{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PairDeviceData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PairDeviceData) ProtoMessage() {} + +func (x *PairDeviceData) ProtoReflect() protoreflect.Message { + mi := &file_pairing_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 PairDeviceData.ProtoReflect.Descriptor instead. +func (*PairDeviceData) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{3} +} + +func (x *PairDeviceData) GetMobile() *Device { + if x != nil { + return x.Mobile + } + return nil +} + +func (x *PairDeviceData) GetEcdsaKeys() *ECDSAKeys { + if x != nil { + return x.EcdsaKeys + } + return nil +} + +func (x *PairDeviceData) GetWebAuthKeyData() *WebAuthKey { + if x != nil { + return x.WebAuthKeyData + } + return nil +} + +func (x *PairDeviceData) GetBrowser() *Device { + if x != nil { + return x.Browser + } + return nil +} + +type WebAuthKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebAuthKey []byte `protobuf:"bytes,1,opt,name=webAuthKey,proto3" json:"webAuthKey,omitempty"` + ValidFor int64 `protobuf:"varint,2,opt,name=validFor,proto3" json:"validFor,omitempty"` +} + +func (x *WebAuthKey) Reset() { + *x = WebAuthKey{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WebAuthKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WebAuthKey) ProtoMessage() {} + +func (x *WebAuthKey) ProtoReflect() protoreflect.Message { + mi := &file_pairing_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WebAuthKey.ProtoReflect.Descriptor instead. +func (*WebAuthKey) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{4} +} + +func (x *WebAuthKey) GetWebAuthKey() []byte { + if x != nil { + return x.WebAuthKey + } + return nil +} + +func (x *WebAuthKey) GetValidFor() int64 { + if x != nil { + return x.ValidFor + } + return 0 +} + +type Container struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PhoneRelay *PhoneRelayBody `protobuf:"bytes,1,opt,name=PhoneRelay,proto3" json:"PhoneRelay,omitempty"` + BrowserDetails *BrowserDetails `protobuf:"bytes,3,opt,name=browserDetails,proto3" json:"browserDetails,omitempty"` + PairDeviceData *PairDeviceData `protobuf:"bytes,4,opt,name=pairDeviceData,proto3" json:"pairDeviceData,omitempty"` +} + +func (x *Container) Reset() { + *x = Container{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Container) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Container) ProtoMessage() {} + +func (x *Container) ProtoReflect() protoreflect.Message { + mi := &file_pairing_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 Container.ProtoReflect.Descriptor instead. +func (*Container) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{5} +} + +func (x *Container) GetPhoneRelay() *PhoneRelayBody { + if x != nil { + return x.PhoneRelay + } + return nil +} + +func (x *Container) GetBrowserDetails() *BrowserDetails { + if x != nil { + return x.BrowserDetails + } + return nil +} + +func (x *Container) GetPairDeviceData() *PairDeviceData { + if x != nil { + return x.PairDeviceData + } + return nil +} + +type UrlData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PairingKey []byte `protobuf:"bytes,1,opt,name=pairingKey,proto3" json:"pairingKey,omitempty"` + AES_CTR_KEY_256 []byte `protobuf:"bytes,2,opt,name=AES_CTR_KEY_256,json=AESCTRKEY256,proto3" json:"AES_CTR_KEY_256,omitempty"` + SHA_256_KEY []byte `protobuf:"bytes,3,opt,name=SHA_256_KEY,json=SHA256KEY,proto3" json:"SHA_256_KEY,omitempty"` +} + +func (x *UrlData) Reset() { + *x = UrlData{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UrlData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UrlData) ProtoMessage() {} + +func (x *UrlData) ProtoReflect() protoreflect.Message { + mi := &file_pairing_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UrlData.ProtoReflect.Descriptor instead. +func (*UrlData) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{6} +} + +func (x *UrlData) GetPairingKey() []byte { + if x != nil { + return x.PairingKey + } + return nil +} + +func (x *UrlData) GetAES_CTR_KEY_256() []byte { + if x != nil { + return x.AES_CTR_KEY_256 + } + return nil +} + +func (x *UrlData) GetSHA_256_KEY() []byte { + if x != nil { + return x.SHA_256_KEY + } + return nil +} + +var File_pairing_proto protoreflect.FileDescriptor + +var file_pairing_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x0e, 0x42, 0x72, 0x6f, 0x77, + 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x6d, + 0x65, 0x49, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x6d, 0x65, + 0x49, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x6f, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x22, + 0x72, 0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x75, 0x67, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x62, 0x75, 0x67, 0x6c, 0x65, 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, 0x55, 0x0a, 0x09, 0x45, 0x43, 0x44, 0x53, 0x41, 0x4b, 0x65, 0x79, 0x73, + 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, + 0x64, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x65, 0x6e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x22, 0xd5, 0x01, 0x0a, 0x0e, 0x50, + 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, + 0x06, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x18, 0x01, 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, 0x12, 0x30, 0x0a, 0x09, 0x65, 0x63, 0x64, 0x73, 0x61, + 0x4b, 0x65, 0x79, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x61, 0x69, + 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x45, 0x43, 0x44, 0x53, 0x41, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x09, + 0x65, 0x63, 0x64, 0x73, 0x61, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x3b, 0x0a, 0x0e, 0x77, 0x65, 0x62, + 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x57, 0x65, 0x62, 0x41, + 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x0e, 0x77, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, + 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, + 0x72, 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, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, + 0x65, 0x72, 0x22, 0x48, 0x0a, 0x0a, 0x57, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, + 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, + 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x22, 0xc6, 0x01, 0x0a, + 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x50, 0x68, + 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x0a, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x12, 0x3f, 0x0a, 0x0e, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, + 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x52, 0x0e, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, + 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x22, 0x70, 0x0a, 0x07, 0x55, 0x72, 0x6c, 0x44, 0x61, 0x74, 0x61, + 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x12, 0x25, 0x0a, 0x0f, 0x41, 0x45, 0x53, 0x5f, 0x43, 0x54, 0x52, 0x5f, 0x4b, 0x45, 0x59, 0x5f, + 0x32, 0x35, 0x36, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x41, 0x45, 0x53, 0x43, 0x54, + 0x52, 0x4b, 0x45, 0x59, 0x32, 0x35, 0x36, 0x12, 0x1e, 0x0a, 0x0b, 0x53, 0x48, 0x41, 0x5f, 0x32, + 0x35, 0x36, 0x5f, 0x4b, 0x45, 0x59, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x4b, 0x45, 0x59, 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 ( + file_pairing_proto_rawDescOnce sync.Once + file_pairing_proto_rawDescData = file_pairing_proto_rawDesc +) + +func file_pairing_proto_rawDescGZIP() []byte { + file_pairing_proto_rawDescOnce.Do(func() { + file_pairing_proto_rawDescData = protoimpl.X.CompressGZIP(file_pairing_proto_rawDescData) + }) + return file_pairing_proto_rawDescData +} + +var file_pairing_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_pairing_proto_goTypes = []interface{}{ + (*BrowserDetails)(nil), // 0: pairing.BrowserDetails + (*PhoneRelayBody)(nil), // 1: pairing.PhoneRelayBody + (*ECDSAKeys)(nil), // 2: pairing.ECDSAKeys + (*PairDeviceData)(nil), // 3: pairing.PairDeviceData + (*WebAuthKey)(nil), // 4: pairing.WebAuthKey + (*Container)(nil), // 5: pairing.Container + (*UrlData)(nil), // 6: pairing.UrlData + (*Date)(nil), // 7: messages.Date + (*Device)(nil), // 8: messages.Device +} +var file_pairing_proto_depIdxs = []int32{ + 7, // 0: pairing.PhoneRelayBody.date:type_name -> messages.Date + 8, // 1: pairing.PairDeviceData.mobile:type_name -> messages.Device + 2, // 2: pairing.PairDeviceData.ecdsaKeys:type_name -> pairing.ECDSAKeys + 4, // 3: pairing.PairDeviceData.webAuthKeyData:type_name -> pairing.WebAuthKey + 8, // 4: pairing.PairDeviceData.browser:type_name -> messages.Device + 1, // 5: pairing.Container.PhoneRelay:type_name -> pairing.PhoneRelayBody + 0, // 6: pairing.Container.browserDetails:type_name -> pairing.BrowserDetails + 3, // 7: pairing.Container.pairDeviceData:type_name -> pairing.PairDeviceData + 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 +} + +func init() { file_pairing_proto_init() } +func file_pairing_proto_init() { + if File_pairing_proto != nil { + return + } + file_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_pairing_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BrowserDetails); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PhoneRelayBody); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ECDSAKeys); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PairDeviceData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WebAuthKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Container); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UrlData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pairing_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pairing_proto_goTypes, + DependencyIndexes: file_pairing_proto_depIdxs, + MessageInfos: file_pairing_proto_msgTypes, + }.Build() + File_pairing_proto = out.File + file_pairing_proto_rawDesc = nil + file_pairing_proto_goTypes = nil + file_pairing_proto_depIdxs = nil +} diff --git a/libgm/binary/protoUtil.go b/libgm/binary/protoUtil.go new file mode 100644 index 0000000..5bbce76 --- /dev/null +++ b/libgm/binary/protoUtil.go @@ -0,0 +1,22 @@ +package binary + +import ( + "fmt" + "google.golang.org/protobuf/proto" +) + +func EncodeProtoMessage(message proto.Message) ([]byte, error) { + data, err := proto.Marshal(message) + if err != nil { + return nil, fmt.Errorf("failed to encode proto message: %v", err) + } + return data, nil +} + +func DecodeProtoMessage(data []byte, message proto.Message) error { + err := proto.Unmarshal(data, message) + if err != nil { + return fmt.Errorf("failed to decode proto message: %v", err) + } + return nil +} \ No newline at end of file diff --git a/libgm/binary/raw/client.proto b/libgm/binary/raw/client.proto new file mode 100644 index 0000000..427495c --- /dev/null +++ b/libgm/binary/raw/client.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package client; + +option go_package = "../../binary"; + +import "messages.proto"; + +message SendMessage { + messages.Device pairedDevice = 1; + messages.MessageData messageData = 2; + messages.AuthMessage authData = 3; + int64 ttl = 5; + messages.EmptyArr emptyArr = 9; +} + +message AckMessagePayload { + messages.AuthMessage authData = 1; + messages.EmptyArr emptyArr = 2; + bytes noClue = 3; +} + +message AckMessageData { + string request_id = 1; + messages.Device device = 2; +} + +message ImageMetaData { + string imageId = 1; + bool encrypted = 2; +} + +message UploadImagePayload { + ImageMetaData metaData = 1; + messages.AuthMessageBytes authData = 2; +} + +message BugleBackendService { + BugleCode data = 6; +} + +message BugleCode { + int64 type = 2; +} \ No newline at end of file diff --git a/libgm/binary/raw/conversations.proto b/libgm/binary/raw/conversations.proto new file mode 100644 index 0000000..64013c5 --- /dev/null +++ b/libgm/binary/raw/conversations.proto @@ -0,0 +1,194 @@ +syntax = "proto3"; +package conversations; + +option go_package = "../../binary"; + +message SendMessagePayload { + string conversationId = 2; + MessagePayload messagePayload = 3; + string tmpId = 5; +} + +message MessagePayload { + string tmpId = 1; + MessagePayloadContent messagePayloadContent = 6; + string conversationId = 7; + string selfParticipantId = 9; // might be participantId + repeated MessageInfo messageInfo = 10; + string tmpId2 = 12; +} + +message MessagePayloadContent { + MessageContent messageContent = 1; +} + +message OpenConversationPayload { + string conversationId = 2; +} + +message PrepareOpenConversationPayload { + int64 field2 = 2; // only seen value 1 +} + +message FetchConversationMessagesPayload { + string conversationId = 2; + int64 count = 3; + + Cursor cursor = 5; +} + +message ListCoversationsPayload { + int64 count = 2; // no idea if this is actually amount to list + int64 field4 = 4; // no idea what this is , but only value ive seen is 1 +} + +message FetchMessagesResponse { + repeated Message messages = 2; + bytes someBytes = 3; + int64 totalMessages = 4; + Cursor cursor = 5; +} + +message Cursor { + string someStr = 1; + int64 nextCursor = 2; +} + +enum MessageType { + UNKNOWN = 0; + TEXT = 1; + IMAGE = 2; + VIDEO = 3; + AUDIO = 4; + ATTACHMENT = 5; + LOCATION = 6; + RICH_CARD = 7; + VCARD = 8; + MMS_NEEDS_DOWNLOAD = 9; + REPLY = 10; +} + +message Message { + string messageId = 1; + IsFromMe from = 3; + MessageStatus messageStatus = 4; + int64 timestamp = 5; + string conversationId = 7; + string participantId = 9; + repeated MessageInfo messageInfo = 10; + MessageType type = 11; + string tmpId = 12; +} + +message MessageInfo { + string orderInternal = 1; + oneof data { + MessageContent messageContent = 2; + ImageContent imageContent = 3; + } +} + +message ImageContent { + int64 someNumber = 1; + string imageId = 2; + string imageName = 4; + int64 size = 5; + ImagePixels pixels = 6; + bytes imageData = 7; + string imageId2 = 9; + bytes decryptionKey = 11; + bytes decryptionKey2 = 12; // same value as decryptionkey? +} + +message ImagePixels { + int64 width = 1; + int64 height = 2; +} + +message MessageContent { + string content = 1; +} + +message IsFromMe { + bool fromMe = 1; +} + +enum MsgStatusCode { + UNKNOWN_STATUS = 0; + SENDING = 5; + SENT = 1; +} + +message MessageStatus { + /* + // MMS / SMS + UNKNOWN_STATUS = 0; + SENDING = 5; + SENT = 1; + + // RCS + READ|SEEN = 11; + */ + int64 code = 2; + string errMsg = 4; + string msgStatus = 5; +} + +message Conversations { + repeated Conversation conversations = 2; +} + +message Conversation { + string conversationId = 1; + string name = 2; + LatestMessage latestMessage = 4; + int64 timestampMs = 5; + + bool isGroupChat = 10; // not certain + string selfParticipantId = 11; + /* + 1 = unarchived + 2 = archived + 3 = deleted + */ + //bool bool1 = 13; + int64 status = 12; + string hashHex = 15; + string messageId = 17; + repeated Participant participants = 20; + repeated string otherParticipants = 21; // participant ids excluding me + int64 type = 22; +} + +message Participant { + SmallInfo smallInfo = 1; + string hashHex = 5; + bool isMe = 6; + Muted muted = 7; + //bool bool2 = 8; + int64 bs = 14; + string displayName = 15; +} + +message SmallInfo { + int64 type = 1; + string number = 2; + string participantId = 3; +} + +message LatestMessage { + string content = 1; + bool fromMe = 2; // isMe? + + string displayName = 4; + //Unknown unknown = 5; +} + +message Unknown { + int64 field1 = 1; + int64 field2 = 2; +} + +message Muted { + bool isMuted = 1; +} \ No newline at end of file diff --git a/libgm/binary/raw/events.proto b/libgm/binary/raw/events.proto new file mode 100644 index 0000000..38b97d5 --- /dev/null +++ b/libgm/binary/raw/events.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; +package events; + +option go_package = "../../binary"; + +import "settings.proto"; +import "messages.proto"; +import "conversations.proto"; + +/* + Cases + 2 = CONVERSATION + 3 = MESSAGE + 5 = PHONE SETTINGS + + 6 = Cases + 2 = updated session + 8 = INACTIVE_LACK_OF_ACTIVITY + 7 = BROWSER_INACTIVE_FROM_TIMEOUT + 6|5 = user_alert:battery + 3|4 = user_alert:data_connection + 10 = OBSERVER_REGISTERED +*/ + +message Event { + oneof event { + ConversationEvent conversationEvent = 2; + MessageEvent messageEvent = 3; + UserAlertEvent userAlertEvent = 6; + } +} + +message ConversationEvent { + conversations.Conversation data = 2; +} + +message MessageEvent { + conversations.Message data = 2; +} + +message UserAlertEvent { + /* + 2 = BROWSER_ACTIVE (new session created in other browser) + + 1 = ? + + 8 = INACTIVE_LACK_OF_ACTIVITY + + 7 = INACTIVE_TIMEOUT + + 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 new file mode 100644 index 0000000..6f306b2 --- /dev/null +++ b/libgm/binary/raw/media.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package media; + +option go_package = "../../binary"; + +import "messages.proto"; + +message StartMediaUploadPayload { + int64 imageType = 1; + messages.AuthMessageBytes authData = 2; + messages.Device mobile = 3; +} + +message UploadMediaResponse { + Media media = 1; + string message = 2; +} + +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 new file mode 100644 index 0000000..6b5e271 --- /dev/null +++ b/libgm/binary/raw/messages.proto @@ -0,0 +1,82 @@ +syntax = "proto3"; +package messages; + +option go_package = "../../binary"; + +message EncodedPayload { + string request_id = 1; + int64 opcode = 2; + bytes encryptedData = 5; + string session_id = 6; +} + +message EncodedResponse { + string request_id = 1; + //int64 msg = 2; + int64 unixNano = 3; + int64 opcode = 4; + //bytes keyData = 5; + bool sub = 6; + int64 third = 7; + bytes encryptedData = 8; + bool field9 = 9; +} + +message MessageData { + string request_id = 1; + int64 routing_op_code = 2; + string ts1 = 3; + int64 field5 = 5; + string ts2 = 6; + string someString = 7; + Device mobile = 8; + Device browser = 9; + string encodedData = 12; + string encoded_request_id = 17; + MsgTypeArr msgTypeArr = 23; +} + +message MsgTypeArr { + EmptyArr emptyArr = 1; + int64 msgType = 2; +} + +message EmptyArr { + +} + +message AuthMessage { + string request_id = 1; + string rpcKey = 6; + Date date = 7; +} + +message AuthMessageBytes { + string request_id = 1; + bytes rpcKey = 6; + Date date = 7; +} + +message BaseData { + int64 Ttl = 2; + EmptyArr emptyArr = 6; +} + +message RPCResponse { + bytes unknown = 1; + MessageData data = 2; +} + +message Device { + int64 userId = 1; + string registrationId = 2; + string network = 3; +} + +message Date { + int64 year = 3; + int64 seq1 = 4; + int64 seq2 = 5; + int64 seq3 = 7; + int64 seq4 = 9; +} \ No newline at end of file diff --git a/libgm/binary/raw/pairing.proto b/libgm/binary/raw/pairing.proto new file mode 100644 index 0000000..64ab57c --- /dev/null +++ b/libgm/binary/raw/pairing.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +package pairing; + +option go_package = "../../binary"; + +import "messages.proto"; + +message BrowserDetails { + string user_agent = 1; + int32 someInt = 2; + string os = 3; + bool someBool = 6; +} + +message PhoneRelayBody { + string id = 1; + string bugle = 3; + bytes rpcKey = 6; + messages.Date date = 7; +} + +message ECDSAKeys { + int64 protoVersion = 1; // idk? + bytes encryptedKeys = 2; +} + +message PairDeviceData { + messages.Device mobile = 1; + ECDSAKeys ecdsaKeys = 6; + WebAuthKey webAuthKeyData = 2; + messages.Device browser = 3; +} + +message WebAuthKey { + bytes webAuthKey = 1; + int64 validFor = 2; +} + +message Container { + PhoneRelayBody PhoneRelay = 1; + BrowserDetails browserDetails = 3; + PairDeviceData pairDeviceData = 4; +} + +message UrlData { + bytes pairingKey = 1; + bytes AES_CTR_KEY_256 = 2; + bytes SHA_256_KEY = 3; +} \ No newline at end of file diff --git a/libgm/binary/raw/relay.proto b/libgm/binary/raw/relay.proto new file mode 100644 index 0000000..c4966ec --- /dev/null +++ b/libgm/binary/raw/relay.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; +package registerPhoneRelay; + +option go_package = "../../binary"; + +message RegisterPhoneRelayResponse { + Message1 field1 = 1; + Message2 field2 = 2; + bytes PairingKey = 3; + int64 field4 = 4; + Message3 field5 = 5; + bytes field6 = 6; +} + +message Message1 { + int64 pubKey = 2; +} + +message Message2 { + int64 field1 = 1; + bytes field2 = 2; + string field3 = 3; +} + +message Message3 { + bytes rpcKey = 1; + int64 field2 = 2; +} + +message RefreshPhoneRelayResponse { + Message1 field1 = 1; + bytes pairKey = 2; + int64 validFor = 3; +} + +message WebEncryptionKeyResponse { + Message1 curve = 1; + bytes key = 2; +} \ No newline at end of file diff --git a/libgm/binary/raw/responses.proto b/libgm/binary/raw/responses.proto new file mode 100644 index 0000000..8a599ff --- /dev/null +++ b/libgm/binary/raw/responses.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package responses; + +option go_package = "../../binary"; + +import "settings.proto"; +import "conversations.proto"; + +message PrepareNewSession { + bool success = 1; +} + +message NewSession { + settings.Settings settings = 5; +} + +message SendMessageResponse { + conversations.MessageType type = 3; +} \ No newline at end of file diff --git a/libgm/binary/raw/settings.proto b/libgm/binary/raw/settings.proto new file mode 100644 index 0000000..06fced6 --- /dev/null +++ b/libgm/binary/raw/settings.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package settings; + +option go_package = "../../binary"; + + +message Settings { + Data data = 2; + OpCodeData opCodeData = 3; + BooleanFields boolFields = 4; + string version = 5; + bool bool1 = 7; + BooleanFields2 boolFields2 = 8; + string emptyString = 9; + BooleanFields3 boolFields3 = 10; +} + +message Data { // i think its simdata? no clue + BoolMsg boolMsg = 3; + SimData simData = 5; + bool bool1 = 6; + NoClue noClue = 7; +} + +message BoolMsg { + bool bool1 = 1; +} + +message SimData { + UnknownMessage unknownMessage = 1; + bool bool1 = 2; + string carrierName = 3; + string hexHash = 4; + int64 int1 = 5; +} + +message UnknownMessage { + int64 int1 = 1; + int64 int2 = 2; +} + +message NoClue { // just a guess lol + string count = 1; +} + +message OpCodeData { + bool field7 = 7; + string jsonData = 16; +} + +message BooleanFields { + bool bool1 = 1; + bool bool2 = 2; + bool bool3 = 3; + bool bool4 = 4; +} + +message BooleanFields2 { + bool bool1 = 1; + bool bool2 = 2; + BoolMsg boolMsg1 = 3; + BoolMsg boolMsg2 = 5; + bool bool3 = 6; +} + +message BooleanFields3 { + bool bool1 = 1; + bool bool3 = 3; + bool bool4 = 4; + bool bool5 = 5; + bool bool6 = 6; + bool bool7 = 7; + bool bool8 = 8; + bool bool9 = 9; +} \ No newline at end of file diff --git a/libgm/binary/relay.pb.go b/libgm/binary/relay.pb.go new file mode 100644 index 0000000..86850f9 --- /dev/null +++ b/libgm/binary/relay.pb.go @@ -0,0 +1,576 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: relay.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RegisterPhoneRelayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Field1 *Message1 `protobuf:"bytes,1,opt,name=field1,proto3" json:"field1,omitempty"` + Field2 *Message2 `protobuf:"bytes,2,opt,name=field2,proto3" json:"field2,omitempty"` + PairingKey []byte `protobuf:"bytes,3,opt,name=PairingKey,proto3" json:"PairingKey,omitempty"` + Field4 int64 `protobuf:"varint,4,opt,name=field4,proto3" json:"field4,omitempty"` + Field5 *Message3 `protobuf:"bytes,5,opt,name=field5,proto3" json:"field5,omitempty"` + Field6 []byte `protobuf:"bytes,6,opt,name=field6,proto3" json:"field6,omitempty"` +} + +func (x *RegisterPhoneRelayResponse) Reset() { + *x = RegisterPhoneRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_relay_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterPhoneRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterPhoneRelayResponse) ProtoMessage() {} + +func (x *RegisterPhoneRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_relay_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterPhoneRelayResponse.ProtoReflect.Descriptor instead. +func (*RegisterPhoneRelayResponse) Descriptor() ([]byte, []int) { + return file_relay_proto_rawDescGZIP(), []int{0} +} + +func (x *RegisterPhoneRelayResponse) GetField1() *Message1 { + if x != nil { + return x.Field1 + } + return nil +} + +func (x *RegisterPhoneRelayResponse) GetField2() *Message2 { + if x != nil { + return x.Field2 + } + return nil +} + +func (x *RegisterPhoneRelayResponse) GetPairingKey() []byte { + if x != nil { + return x.PairingKey + } + return nil +} + +func (x *RegisterPhoneRelayResponse) GetField4() int64 { + if x != nil { + return x.Field4 + } + return 0 +} + +func (x *RegisterPhoneRelayResponse) GetField5() *Message3 { + if x != nil { + return x.Field5 + } + return nil +} + +func (x *RegisterPhoneRelayResponse) GetField6() []byte { + if x != nil { + return x.Field6 + } + return nil +} + +type Message1 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PubKey int64 `protobuf:"varint,2,opt,name=pubKey,proto3" json:"pubKey,omitempty"` +} + +func (x *Message1) Reset() { + *x = Message1{} + if protoimpl.UnsafeEnabled { + mi := &file_relay_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message1) ProtoMessage() {} + +func (x *Message1) ProtoReflect() protoreflect.Message { + mi := &file_relay_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message1.ProtoReflect.Descriptor instead. +func (*Message1) Descriptor() ([]byte, []int) { + return file_relay_proto_rawDescGZIP(), []int{1} +} + +func (x *Message1) GetPubKey() int64 { + if x != nil { + return x.PubKey + } + return 0 +} + +type Message2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Field1 int64 `protobuf:"varint,1,opt,name=field1,proto3" json:"field1,omitempty"` + Field2 []byte `protobuf:"bytes,2,opt,name=field2,proto3" json:"field2,omitempty"` + Field3 string `protobuf:"bytes,3,opt,name=field3,proto3" json:"field3,omitempty"` +} + +func (x *Message2) Reset() { + *x = Message2{} + if protoimpl.UnsafeEnabled { + mi := &file_relay_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message2) ProtoMessage() {} + +func (x *Message2) ProtoReflect() protoreflect.Message { + mi := &file_relay_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message2.ProtoReflect.Descriptor instead. +func (*Message2) Descriptor() ([]byte, []int) { + return file_relay_proto_rawDescGZIP(), []int{2} +} + +func (x *Message2) GetField1() int64 { + if x != nil { + return x.Field1 + } + return 0 +} + +func (x *Message2) GetField2() []byte { + if x != nil { + return x.Field2 + } + return nil +} + +func (x *Message2) GetField3() string { + if x != nil { + return x.Field3 + } + return "" +} + +type Message3 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RpcKey []byte `protobuf:"bytes,1,opt,name=rpcKey,proto3" json:"rpcKey,omitempty"` + Field2 int64 `protobuf:"varint,2,opt,name=field2,proto3" json:"field2,omitempty"` +} + +func (x *Message3) Reset() { + *x = Message3{} + if protoimpl.UnsafeEnabled { + mi := &file_relay_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message3) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message3) ProtoMessage() {} + +func (x *Message3) ProtoReflect() protoreflect.Message { + mi := &file_relay_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 Message3.ProtoReflect.Descriptor instead. +func (*Message3) Descriptor() ([]byte, []int) { + return file_relay_proto_rawDescGZIP(), []int{3} +} + +func (x *Message3) GetRpcKey() []byte { + if x != nil { + return x.RpcKey + } + return nil +} + +func (x *Message3) GetField2() int64 { + if x != nil { + return x.Field2 + } + return 0 +} + +type RefreshPhoneRelayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Field1 *Message1 `protobuf:"bytes,1,opt,name=field1,proto3" json:"field1,omitempty"` + PairKey []byte `protobuf:"bytes,2,opt,name=pairKey,proto3" json:"pairKey,omitempty"` + ValidFor int64 `protobuf:"varint,3,opt,name=validFor,proto3" json:"validFor,omitempty"` +} + +func (x *RefreshPhoneRelayResponse) Reset() { + *x = RefreshPhoneRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_relay_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RefreshPhoneRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RefreshPhoneRelayResponse) ProtoMessage() {} + +func (x *RefreshPhoneRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_relay_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RefreshPhoneRelayResponse.ProtoReflect.Descriptor instead. +func (*RefreshPhoneRelayResponse) Descriptor() ([]byte, []int) { + return file_relay_proto_rawDescGZIP(), []int{4} +} + +func (x *RefreshPhoneRelayResponse) GetField1() *Message1 { + if x != nil { + return x.Field1 + } + return nil +} + +func (x *RefreshPhoneRelayResponse) GetPairKey() []byte { + if x != nil { + return x.PairKey + } + return nil +} + +func (x *RefreshPhoneRelayResponse) GetValidFor() int64 { + if x != nil { + return x.ValidFor + } + return 0 +} + +type WebEncryptionKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Curve *Message1 `protobuf:"bytes,1,opt,name=curve,proto3" json:"curve,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *WebEncryptionKeyResponse) Reset() { + *x = WebEncryptionKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_relay_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WebEncryptionKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WebEncryptionKeyResponse) ProtoMessage() {} + +func (x *WebEncryptionKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_relay_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 WebEncryptionKeyResponse.ProtoReflect.Descriptor instead. +func (*WebEncryptionKeyResponse) Descriptor() ([]byte, []int) { + return file_relay_proto_rawDescGZIP(), []int{5} +} + +func (x *WebEncryptionKeyResponse) GetCurve() *Message1 { + if x != nil { + return x.Curve + } + return nil +} + +func (x *WebEncryptionKeyResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +var File_relay_proto protoreflect.FileDescriptor + +var file_relay_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x22, 0x8e, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, + 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x34, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x6e, 0x65, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x52, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x34, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x32, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, 0x12, 0x1e, 0x0a, 0x0a, + 0x50, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x50, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x34, 0x12, 0x34, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x35, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, + 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x33, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x35, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x36, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x36, 0x22, 0x22, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x52, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x33, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x33, 0x22, 0x3a, 0x0a, 0x08, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x33, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x70, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x16, + 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, 0x22, 0x87, 0x01, 0x0a, 0x19, 0x52, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, + 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x31, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, + 0x69, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x69, + 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, + 0x22, 0x60, 0x0a, 0x18, 0x57, 0x65, 0x62, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x05, + 0x63, 0x75, 0x72, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x52, 0x05, 0x63, 0x75, 0x72, 0x76, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, + 0x65, 0x79, 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 ( + file_relay_proto_rawDescOnce sync.Once + file_relay_proto_rawDescData = file_relay_proto_rawDesc +) + +func file_relay_proto_rawDescGZIP() []byte { + file_relay_proto_rawDescOnce.Do(func() { + file_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_relay_proto_rawDescData) + }) + return file_relay_proto_rawDescData +} + +var file_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_relay_proto_goTypes = []interface{}{ + (*RegisterPhoneRelayResponse)(nil), // 0: registerPhoneRelay.RegisterPhoneRelayResponse + (*Message1)(nil), // 1: registerPhoneRelay.Message1 + (*Message2)(nil), // 2: registerPhoneRelay.Message2 + (*Message3)(nil), // 3: registerPhoneRelay.Message3 + (*RefreshPhoneRelayResponse)(nil), // 4: registerPhoneRelay.RefreshPhoneRelayResponse + (*WebEncryptionKeyResponse)(nil), // 5: registerPhoneRelay.WebEncryptionKeyResponse +} +var file_relay_proto_depIdxs = []int32{ + 1, // 0: registerPhoneRelay.RegisterPhoneRelayResponse.field1:type_name -> registerPhoneRelay.Message1 + 2, // 1: registerPhoneRelay.RegisterPhoneRelayResponse.field2:type_name -> registerPhoneRelay.Message2 + 3, // 2: registerPhoneRelay.RegisterPhoneRelayResponse.field5:type_name -> registerPhoneRelay.Message3 + 1, // 3: registerPhoneRelay.RefreshPhoneRelayResponse.field1:type_name -> registerPhoneRelay.Message1 + 1, // 4: registerPhoneRelay.WebEncryptionKeyResponse.curve:type_name -> registerPhoneRelay.Message1 + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_relay_proto_init() } +func file_relay_proto_init() { + if File_relay_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterPhoneRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message1); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message3); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RefreshPhoneRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relay_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WebEncryptionKeyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_relay_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_relay_proto_goTypes, + DependencyIndexes: file_relay_proto_depIdxs, + MessageInfos: file_relay_proto_msgTypes, + }.Build() + File_relay_proto = out.File + file_relay_proto_rawDesc = nil + file_relay_proto_goTypes = nil + file_relay_proto_depIdxs = nil +} diff --git a/libgm/binary/responses.pb.go b/libgm/binary/responses.pb.go new file mode 100644 index 0000000..3d5d581 --- /dev/null +++ b/libgm/binary/responses.pb.go @@ -0,0 +1,279 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: responses.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PrepareNewSession struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (x *PrepareNewSession) Reset() { + *x = PrepareNewSession{} + if protoimpl.UnsafeEnabled { + mi := &file_responses_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrepareNewSession) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareNewSession) ProtoMessage() {} + +func (x *PrepareNewSession) ProtoReflect() protoreflect.Message { + mi := &file_responses_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrepareNewSession.ProtoReflect.Descriptor instead. +func (*PrepareNewSession) Descriptor() ([]byte, []int) { + return file_responses_proto_rawDescGZIP(), []int{0} +} + +func (x *PrepareNewSession) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +type NewSession struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Settings *Settings `protobuf:"bytes,5,opt,name=settings,proto3" json:"settings,omitempty"` +} + +func (x *NewSession) Reset() { + *x = NewSession{} + if protoimpl.UnsafeEnabled { + mi := &file_responses_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NewSession) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewSession) ProtoMessage() {} + +func (x *NewSession) ProtoReflect() protoreflect.Message { + mi := &file_responses_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewSession.ProtoReflect.Descriptor instead. +func (*NewSession) Descriptor() ([]byte, []int) { + return file_responses_proto_rawDescGZIP(), []int{1} +} + +func (x *NewSession) GetSettings() *Settings { + if x != nil { + return x.Settings + } + return nil +} + +type SendMessageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type MessageType `protobuf:"varint,3,opt,name=type,proto3,enum=conversations.MessageType" json:"type,omitempty"` +} + +func (x *SendMessageResponse) Reset() { + *x = SendMessageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_responses_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendMessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendMessageResponse) ProtoMessage() {} + +func (x *SendMessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_responses_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendMessageResponse.ProtoReflect.Descriptor instead. +func (*SendMessageResponse) Descriptor() ([]byte, []int) { + return file_responses_proto_rawDescGZIP(), []int{2} +} + +func (x *SendMessageResponse) GetType() MessageType { + if x != nil { + return x.Type + } + return MessageType_UNKNOWN +} + +var File_responses_proto protoreflect.FileDescriptor + +var file_responses_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, 0x0e, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x63, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x2d, 0x0a, 0x11, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x4e, 0x65, 0x77, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x22, 0x3c, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2e, + 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x45, + 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 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 ( + file_responses_proto_rawDescOnce sync.Once + file_responses_proto_rawDescData = file_responses_proto_rawDesc +) + +func file_responses_proto_rawDescGZIP() []byte { + file_responses_proto_rawDescOnce.Do(func() { + file_responses_proto_rawDescData = protoimpl.X.CompressGZIP(file_responses_proto_rawDescData) + }) + return file_responses_proto_rawDescData +} + +var file_responses_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_responses_proto_goTypes = []interface{}{ + (*PrepareNewSession)(nil), // 0: responses.PrepareNewSession + (*NewSession)(nil), // 1: responses.NewSession + (*SendMessageResponse)(nil), // 2: responses.SendMessageResponse + (*Settings)(nil), // 3: settings.Settings + (MessageType)(0), // 4: conversations.MessageType +} +var file_responses_proto_depIdxs = []int32{ + 3, // 0: responses.NewSession.settings:type_name -> settings.Settings + 4, // 1: responses.SendMessageResponse.type:type_name -> conversations.MessageType + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_responses_proto_init() } +func file_responses_proto_init() { + if File_responses_proto != nil { + return + } + file_settings_proto_init() + file_conversations_proto_init() + if !protoimpl.UnsafeEnabled { + file_responses_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrepareNewSession); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_responses_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NewSession); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_responses_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendMessageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_responses_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_responses_proto_goTypes, + DependencyIndexes: file_responses_proto_depIdxs, + MessageInfos: file_responses_proto_msgTypes, + }.Build() + File_responses_proto = out.File + file_responses_proto_rawDesc = nil + file_responses_proto_goTypes = nil + file_responses_proto_depIdxs = nil +} diff --git a/libgm/binary/settings.pb.go b/libgm/binary/settings.pb.go new file mode 100644 index 0000000..bc6804b --- /dev/null +++ b/libgm/binary/settings.pb.go @@ -0,0 +1,1016 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: settings.proto + +package binary + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Settings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + OpCodeData *OpCodeData `protobuf:"bytes,3,opt,name=opCodeData,proto3" json:"opCodeData,omitempty"` + BoolFields *BooleanFields `protobuf:"bytes,4,opt,name=boolFields,proto3" json:"boolFields,omitempty"` + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` + Bool1 bool `protobuf:"varint,7,opt,name=bool1,proto3" json:"bool1,omitempty"` + BoolFields2 *BooleanFields2 `protobuf:"bytes,8,opt,name=boolFields2,proto3" json:"boolFields2,omitempty"` + EmptyString string `protobuf:"bytes,9,opt,name=emptyString,proto3" json:"emptyString,omitempty"` + BoolFields3 *BooleanFields3 `protobuf:"bytes,10,opt,name=boolFields3,proto3" json:"boolFields3,omitempty"` +} + +func (x *Settings) Reset() { + *x = Settings{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Settings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Settings) ProtoMessage() {} + +func (x *Settings) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Settings.ProtoReflect.Descriptor instead. +func (*Settings) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{0} +} + +func (x *Settings) GetData() *Data { + if x != nil { + return x.Data + } + return nil +} + +func (x *Settings) GetOpCodeData() *OpCodeData { + if x != nil { + return x.OpCodeData + } + return nil +} + +func (x *Settings) GetBoolFields() *BooleanFields { + if x != nil { + return x.BoolFields + } + return nil +} + +func (x *Settings) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Settings) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +func (x *Settings) GetBoolFields2() *BooleanFields2 { + if x != nil { + return x.BoolFields2 + } + return nil +} + +func (x *Settings) GetEmptyString() string { + if x != nil { + return x.EmptyString + } + return "" +} + +func (x *Settings) GetBoolFields3() *BooleanFields3 { + if x != nil { + return x.BoolFields3 + } + return nil +} + +type Data struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BoolMsg *BoolMsg `protobuf:"bytes,3,opt,name=boolMsg,proto3" json:"boolMsg,omitempty"` + SimData *SimData `protobuf:"bytes,5,opt,name=simData,proto3" json:"simData,omitempty"` + Bool1 bool `protobuf:"varint,6,opt,name=bool1,proto3" json:"bool1,omitempty"` + NoClue *NoClue `protobuf:"bytes,7,opt,name=noClue,proto3" json:"noClue,omitempty"` +} + +func (x *Data) Reset() { + *x = Data{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Data) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Data) ProtoMessage() {} + +func (x *Data) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Data.ProtoReflect.Descriptor instead. +func (*Data) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{1} +} + +func (x *Data) GetBoolMsg() *BoolMsg { + if x != nil { + return x.BoolMsg + } + return nil +} + +func (x *Data) GetSimData() *SimData { + if x != nil { + return x.SimData + } + return nil +} + +func (x *Data) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +func (x *Data) GetNoClue() *NoClue { + if x != nil { + return x.NoClue + } + return nil +} + +type BoolMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bool1 bool `protobuf:"varint,1,opt,name=bool1,proto3" json:"bool1,omitempty"` +} + +func (x *BoolMsg) Reset() { + *x = BoolMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BoolMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BoolMsg) ProtoMessage() {} + +func (x *BoolMsg) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BoolMsg.ProtoReflect.Descriptor instead. +func (*BoolMsg) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{2} +} + +func (x *BoolMsg) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +type SimData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UnknownMessage *UnknownMessage `protobuf:"bytes,1,opt,name=unknownMessage,proto3" json:"unknownMessage,omitempty"` + Bool1 bool `protobuf:"varint,2,opt,name=bool1,proto3" json:"bool1,omitempty"` + CarrierName string `protobuf:"bytes,3,opt,name=carrierName,proto3" json:"carrierName,omitempty"` + HexHash string `protobuf:"bytes,4,opt,name=hexHash,proto3" json:"hexHash,omitempty"` + Int1 int64 `protobuf:"varint,5,opt,name=int1,proto3" json:"int1,omitempty"` +} + +func (x *SimData) Reset() { + *x = SimData{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SimData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimData) ProtoMessage() {} + +func (x *SimData) ProtoReflect() protoreflect.Message { + mi := &file_settings_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 SimData.ProtoReflect.Descriptor instead. +func (*SimData) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{3} +} + +func (x *SimData) GetUnknownMessage() *UnknownMessage { + if x != nil { + return x.UnknownMessage + } + return nil +} + +func (x *SimData) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +func (x *SimData) GetCarrierName() string { + if x != nil { + return x.CarrierName + } + return "" +} + +func (x *SimData) GetHexHash() string { + if x != nil { + return x.HexHash + } + return "" +} + +func (x *SimData) GetInt1() int64 { + if x != nil { + return x.Int1 + } + return 0 +} + +type UnknownMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Int1 int64 `protobuf:"varint,1,opt,name=int1,proto3" json:"int1,omitempty"` + Int2 int64 `protobuf:"varint,2,opt,name=int2,proto3" json:"int2,omitempty"` +} + +func (x *UnknownMessage) Reset() { + *x = UnknownMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnknownMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnknownMessage) ProtoMessage() {} + +func (x *UnknownMessage) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnknownMessage.ProtoReflect.Descriptor instead. +func (*UnknownMessage) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{4} +} + +func (x *UnknownMessage) GetInt1() int64 { + if x != nil { + return x.Int1 + } + return 0 +} + +func (x *UnknownMessage) GetInt2() int64 { + if x != nil { + return x.Int2 + } + return 0 +} + +type NoClue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count string `protobuf:"bytes,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *NoClue) Reset() { + *x = NoClue{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NoClue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoClue) ProtoMessage() {} + +func (x *NoClue) ProtoReflect() protoreflect.Message { + mi := &file_settings_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 NoClue.ProtoReflect.Descriptor instead. +func (*NoClue) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{5} +} + +func (x *NoClue) GetCount() string { + if x != nil { + return x.Count + } + return "" +} + +type OpCodeData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Field7 bool `protobuf:"varint,7,opt,name=field7,proto3" json:"field7,omitempty"` + JsonData string `protobuf:"bytes,16,opt,name=jsonData,proto3" json:"jsonData,omitempty"` +} + +func (x *OpCodeData) Reset() { + *x = OpCodeData{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OpCodeData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpCodeData) ProtoMessage() {} + +func (x *OpCodeData) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpCodeData.ProtoReflect.Descriptor instead. +func (*OpCodeData) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{6} +} + +func (x *OpCodeData) GetField7() bool { + if x != nil { + return x.Field7 + } + return false +} + +func (x *OpCodeData) GetJsonData() string { + if x != nil { + return x.JsonData + } + return "" +} + +type BooleanFields struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bool1 bool `protobuf:"varint,1,opt,name=bool1,proto3" json:"bool1,omitempty"` + Bool2 bool `protobuf:"varint,2,opt,name=bool2,proto3" json:"bool2,omitempty"` + Bool3 bool `protobuf:"varint,3,opt,name=bool3,proto3" json:"bool3,omitempty"` + Bool4 bool `protobuf:"varint,4,opt,name=bool4,proto3" json:"bool4,omitempty"` +} + +func (x *BooleanFields) Reset() { + *x = BooleanFields{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BooleanFields) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BooleanFields) ProtoMessage() {} + +func (x *BooleanFields) ProtoReflect() protoreflect.Message { + mi := &file_settings_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 BooleanFields.ProtoReflect.Descriptor instead. +func (*BooleanFields) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{7} +} + +func (x *BooleanFields) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +func (x *BooleanFields) GetBool2() bool { + if x != nil { + return x.Bool2 + } + return false +} + +func (x *BooleanFields) GetBool3() bool { + if x != nil { + return x.Bool3 + } + return false +} + +func (x *BooleanFields) GetBool4() bool { + if x != nil { + return x.Bool4 + } + return false +} + +type BooleanFields2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bool1 bool `protobuf:"varint,1,opt,name=bool1,proto3" json:"bool1,omitempty"` + Bool2 bool `protobuf:"varint,2,opt,name=bool2,proto3" json:"bool2,omitempty"` + BoolMsg1 *BoolMsg `protobuf:"bytes,3,opt,name=boolMsg1,proto3" json:"boolMsg1,omitempty"` + BoolMsg2 *BoolMsg `protobuf:"bytes,5,opt,name=boolMsg2,proto3" json:"boolMsg2,omitempty"` + Bool3 bool `protobuf:"varint,6,opt,name=bool3,proto3" json:"bool3,omitempty"` +} + +func (x *BooleanFields2) Reset() { + *x = BooleanFields2{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BooleanFields2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BooleanFields2) ProtoMessage() {} + +func (x *BooleanFields2) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[8] + 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 BooleanFields2.ProtoReflect.Descriptor instead. +func (*BooleanFields2) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{8} +} + +func (x *BooleanFields2) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +func (x *BooleanFields2) GetBool2() bool { + if x != nil { + return x.Bool2 + } + return false +} + +func (x *BooleanFields2) GetBoolMsg1() *BoolMsg { + if x != nil { + return x.BoolMsg1 + } + return nil +} + +func (x *BooleanFields2) GetBoolMsg2() *BoolMsg { + if x != nil { + return x.BoolMsg2 + } + return nil +} + +func (x *BooleanFields2) GetBool3() bool { + if x != nil { + return x.Bool3 + } + return false +} + +type BooleanFields3 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bool1 bool `protobuf:"varint,1,opt,name=bool1,proto3" json:"bool1,omitempty"` + Bool3 bool `protobuf:"varint,3,opt,name=bool3,proto3" json:"bool3,omitempty"` + Bool4 bool `protobuf:"varint,4,opt,name=bool4,proto3" json:"bool4,omitempty"` + Bool5 bool `protobuf:"varint,5,opt,name=bool5,proto3" json:"bool5,omitempty"` + Bool6 bool `protobuf:"varint,6,opt,name=bool6,proto3" json:"bool6,omitempty"` + Bool7 bool `protobuf:"varint,7,opt,name=bool7,proto3" json:"bool7,omitempty"` + Bool8 bool `protobuf:"varint,8,opt,name=bool8,proto3" json:"bool8,omitempty"` + Bool9 bool `protobuf:"varint,9,opt,name=bool9,proto3" json:"bool9,omitempty"` +} + +func (x *BooleanFields3) Reset() { + *x = BooleanFields3{} + if protoimpl.UnsafeEnabled { + mi := &file_settings_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BooleanFields3) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BooleanFields3) ProtoMessage() {} + +func (x *BooleanFields3) ProtoReflect() protoreflect.Message { + mi := &file_settings_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BooleanFields3.ProtoReflect.Descriptor instead. +func (*BooleanFields3) Descriptor() ([]byte, []int) { + return file_settings_proto_rawDescGZIP(), []int{9} +} + +func (x *BooleanFields3) GetBool1() bool { + if x != nil { + return x.Bool1 + } + return false +} + +func (x *BooleanFields3) GetBool3() bool { + if x != nil { + return x.Bool3 + } + return false +} + +func (x *BooleanFields3) GetBool4() bool { + if x != nil { + return x.Bool4 + } + return false +} + +func (x *BooleanFields3) GetBool5() bool { + if x != nil { + return x.Bool5 + } + return false +} + +func (x *BooleanFields3) GetBool6() bool { + if x != nil { + return x.Bool6 + } + return false +} + +func (x *BooleanFields3) GetBool7() bool { + if x != nil { + return x.Bool7 + } + return false +} + +func (x *BooleanFields3) GetBool8() bool { + if x != nil { + return x.Bool8 + } + return false +} + +func (x *BooleanFields3) GetBool9() bool { + if x != nil { + return x.Bool9 + } + return false +} + +var File_settings_proto protoreflect.FileDescriptor + +var file_settings_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0xe7, 0x02, 0x0a, 0x08, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x34, 0x0a, 0x0a, 0x6f, + 0x70, 0x43, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x4f, 0x70, 0x43, 0x6f, 0x64, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x6f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x52, 0x0a, + 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x3a, 0x0a, 0x0b, 0x62, 0x6f, + 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, + 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6d, 0x70, + 0x74, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x3a, 0x0a, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x73, 0x33, 0x22, 0xa0, 0x01, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, + 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, + 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x2b, 0x0a, 0x07, 0x73, 0x69, + 0x6d, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x53, 0x69, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, + 0x73, 0x69, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x28, 0x0a, + 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x4e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x52, + 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, + 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x22, 0xb1, 0x01, 0x0a, 0x07, 0x53, 0x69, 0x6d, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x0e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x20, 0x0a, 0x0b, + 0x63, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x68, 0x65, 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x68, 0x65, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x31, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x22, 0x38, 0x0a, 0x0e, + 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x69, 0x6e, + 0x74, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x69, 0x6e, 0x74, 0x32, 0x22, 0x1e, 0x0a, 0x06, 0x4e, 0x6f, 0x43, 0x6c, 0x75, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x40, 0x0a, 0x0a, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x37, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x37, 0x12, 0x1a, 0x0a, 0x08, + 0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x0d, 0x42, 0x6f, 0x6f, 0x6c, + 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, + 0x6c, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, + 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x62, 0x6f, 0x6f, 0x6c, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, + 0x6f, 0x6f, 0x6c, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, + 0x34, 0x22, 0xb0, 0x01, 0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x73, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, + 0x6f, 0x6c, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x32, + 0x12, 0x2d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x31, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, + 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x31, 0x12, + 0x2d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, + 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x32, 0x12, 0x14, + 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, + 0x6f, 0x6f, 0x6c, 0x33, 0x22, 0xc0, 0x01, 0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x14, 0x0a, + 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, + 0x6f, 0x6c, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x34, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x34, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, + 0x6c, 0x35, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x35, 0x12, + 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x36, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x62, 0x6f, 0x6f, 0x6c, 0x36, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x37, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x37, 0x12, 0x14, 0x0a, 0x05, 0x62, + 0x6f, 0x6f, 0x6c, 0x38, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, + 0x38, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x39, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x39, 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 ( + file_settings_proto_rawDescOnce sync.Once + file_settings_proto_rawDescData = file_settings_proto_rawDesc +) + +func file_settings_proto_rawDescGZIP() []byte { + file_settings_proto_rawDescOnce.Do(func() { + file_settings_proto_rawDescData = protoimpl.X.CompressGZIP(file_settings_proto_rawDescData) + }) + return file_settings_proto_rawDescData +} + +var file_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_settings_proto_goTypes = []interface{}{ + (*Settings)(nil), // 0: settings.Settings + (*Data)(nil), // 1: settings.Data + (*BoolMsg)(nil), // 2: settings.BoolMsg + (*SimData)(nil), // 3: settings.SimData + (*UnknownMessage)(nil), // 4: settings.UnknownMessage + (*NoClue)(nil), // 5: settings.NoClue + (*OpCodeData)(nil), // 6: settings.OpCodeData + (*BooleanFields)(nil), // 7: settings.BooleanFields + (*BooleanFields2)(nil), // 8: settings.BooleanFields2 + (*BooleanFields3)(nil), // 9: settings.BooleanFields3 +} +var file_settings_proto_depIdxs = []int32{ + 1, // 0: settings.Settings.data:type_name -> settings.Data + 6, // 1: settings.Settings.opCodeData:type_name -> settings.OpCodeData + 7, // 2: settings.Settings.boolFields:type_name -> settings.BooleanFields + 8, // 3: settings.Settings.boolFields2:type_name -> settings.BooleanFields2 + 9, // 4: settings.Settings.boolFields3:type_name -> settings.BooleanFields3 + 2, // 5: settings.Data.boolMsg:type_name -> settings.BoolMsg + 3, // 6: settings.Data.simData:type_name -> settings.SimData + 5, // 7: settings.Data.noClue:type_name -> settings.NoClue + 4, // 8: settings.SimData.unknownMessage:type_name -> settings.UnknownMessage + 2, // 9: settings.BooleanFields2.boolMsg1:type_name -> settings.BoolMsg + 2, // 10: settings.BooleanFields2.boolMsg2:type_name -> settings.BoolMsg + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_settings_proto_init() } +func file_settings_proto_init() { + if File_settings_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_settings_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Settings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Data); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BoolMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SimData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnknownMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NoClue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OpCodeData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BooleanFields); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BooleanFields2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_settings_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BooleanFields3); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_settings_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_settings_proto_goTypes, + DependencyIndexes: file_settings_proto_depIdxs, + MessageInfos: file_settings_proto_msgTypes, + }.Build() + File_settings_proto = out.File + file_settings_proto_rawDesc = nil + file_settings_proto_goTypes = nil + file_settings_proto_depIdxs = nil +} diff --git a/libgm/bugle_service.go b/libgm/bugle_service.go new file mode 100644 index 0000000..e6893ee --- /dev/null +++ b/libgm/bugle_service.go @@ -0,0 +1,12 @@ +package textgapi + +import "go.mau.fi/mautrix-gmessages/libgm/binary" + +func (c *Client) handleBugleOpCode(bugleData *binary.BugleBackendService) { + switch bugleData.Data.Type { + case 2: + c.Logger.Info().Any("type", bugleData.Data.Type).Msg("Updated sessionId to " + c.sessionHandler.sessionId + " due to BROWSER_ACTIVE alert") + case 6: + c.Logger.Info().Any("type", bugleData.Data.Type).Msg("USER_ALERT:BATTERY") // tf ? + } +} diff --git a/libgm/builders/tenor.go b/libgm/builders/tenor.go new file mode 100644 index 0000000..befc11f --- /dev/null +++ b/libgm/builders/tenor.go @@ -0,0 +1,71 @@ +package builders + +import ( + "fmt" + "net/url" + + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type TenorSearch struct { + query string + locale string + content_filter string + media_filter string + limit string // limit results +} + +func NewTenorSearchBuilder() *TenorSearch { + return &TenorSearch{} +} + +func (t *TenorSearch) SetQuery(query string) *TenorSearch { + t.query = query + return t +} +func (t *TenorSearch) SetLocale(locale string) *TenorSearch { + t.locale = locale + return t +} +func (t *TenorSearch) SetContentFilter(content_filter string) *TenorSearch { + t.content_filter = content_filter + return t +} +func (t *TenorSearch) SetMediaFilter(media_filter string) *TenorSearch { + t.media_filter = media_filter + return t +} +func (t *TenorSearch) SetLimit(limit string) *TenorSearch { + t.limit = limit + return t +} +func (t *TenorSearch) Build() (string, error) { + if t.query == "" { + return "", fmt.Errorf("failed to build TenorSearch: query is empty") + } + params := url.Values{} + params.Add("key", util.TENOR_API_KEY) + params.Add("q", t.query) + + if t.locale == "" { + t.locale = "en-US" + } + params.Add("locale", t.locale) + + if t.content_filter == "" { + t.content_filter = "medium" + } + params.Add("contentfilter", t.content_filter) + + if t.media_filter == "" { + t.media_filter = "minimal" + } + params.Add("media_filter", t.media_filter) + + if t.limit == "" { + t.limit = "16" + } + params.Add("limit", t.limit) + + return "?" + params.Encode(), nil +} diff --git a/libgm/cache/cache.go b/libgm/cache/cache.go new file mode 100644 index 0000000..cd14017 --- /dev/null +++ b/libgm/cache/cache.go @@ -0,0 +1,66 @@ +package cache + +import ( + "encoding/json" + "fmt" + "log" + "os" + "strconv" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +type Cache struct { + Conversations Conversations `json:"conversations"` + Settings Settings `json:"sim,omitempty"` +} + +func LoadCache(path string) Cache { + data, readErr := os.ReadFile(path) + if readErr != nil { + log.Fatal(readErr) + } + var cache Cache + err := json.Unmarshal(data, &cache) + if err != nil { + log.Fatal(err) + } + return cache +} + +func (c *Cache) OrderMapToInterface() map[string]interface{} { + convIdMapStringInterface := make(map[string]interface{}) + for key, value := range c.Conversations.Order { + convIdMapStringInterface[strconv.Itoa(key)] = value + } + return convIdMapStringInterface +} + +func (c *Cache) SetSettings(settings *binary.Settings) { + c.Settings = Settings{ + CarrierName: settings.Data.SimData.CarrierName, + HexHash: settings.Data.SimData.HexHash, + Version: settings.Version, + } +} + +func (c *Cache) SetMessages(messages *binary.FetchMessagesResponse) { + for _, msg := range messages.Messages { + convo, ok := c.Conversations.Conversations[msg.ConversationId] + if !ok { + // handle error, such as creating a new conversation or returning + fmt.Printf("Could not find conversation with id %s", msg.ConversationId) + return + } else { + convo.UpdateMessage(msg) + } + } +} + +func (c *Cache) SetConversations(conversations *binary.Conversations) { + for order, conv := range conversations.Conversations { + convertedConv := NewConversation(c, conv) + c.Conversations.Order[order] = conv.ConversationId + c.Conversations.Conversations[conv.ConversationId] = convertedConv + } +} diff --git a/libgm/cache/conversation.go b/libgm/cache/conversation.go new file mode 100644 index 0000000..1836339 --- /dev/null +++ b/libgm/cache/conversation.go @@ -0,0 +1,290 @@ +package cache + +import ( + "fmt" + "log" + "sort" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +type SmallInfo struct { + Type int64 `json:"type,omitempty"` + Number string `json:"number,omitempty"` + ParticipantId string `json:"participantId,omitempty"` +} + +type Participant struct { + SmallInfo *SmallInfo `json:"smallInfo,omitempty"` + HexHash string `json:"hexHash,omitempty"` + IsMe bool `json:"isMe,omitempty"` + Bs int64 `json:"bs,omitempty"` + DisplayName string `json:"displayName,omitempty"` +} + +type ImagePixels struct { + Width int64 `json:"width,omitempty"` + Height int64 `json:"height,omitempty"` +} + +type ImageMessage struct { + SomeNumber int64 `json:"someNumber"` + ImageId string `json:"imageId"` + ImageName string `json:"imageName"` + Size int64 `json:"size"` + Pixels ImagePixels `json:"pixels"` + ImageBuffer []byte `json:"imageBuffer"` + DecryptionKey []byte `json:"decryptionKey"` +} + +type TextMessage struct { + Content string `json:"content"` +} + +type IsFromMe struct { + FromMe bool `json:"fromMe"` +} + +type MessageData struct { + OrderInternal string `json:"orderInternal"` + TextData *TextMessage `json:"textData,omitempty"` + ImageData *ImageMessage `json:"imageData,omitempty"` +} + +type MessageStatus struct { + Code int64 `json:"code,omitempty"` + ErrMsg string `json:"errMsg,omitempty"` + MsgType string `json:"msgType,omitempty"` +} + +type Message struct { + cache *Cache + + MessageId string `json:"messageId"` + From IsFromMe `json:"from"` + MessageStatus MessageStatus `json:"details"` + Timestamp int64 `json:"timestamp"` + ConvId string `json:"convId"` + ParticipantId string `json:"participantId"` + MessageData []MessageData `json:"messageData"` + MessageType string `json:"messageType"` +} + +func (m *Message) FromMe() bool { + conv, _ := m.cache.Conversations.GetConversation(m.ConvId) + return m.ParticipantId == conv.SelfParticipantId +} + +type LatestMessage struct { + Content string `json:"content,omitempty"` + FromMe bool `json:"fromMe,omitempty"` + DisplayName string `json:"displayName,omitempty"` + MessageId string `json:"messageId,omitempty"` +} + +type Conversation struct { + cache *Cache + + MessageOrder map[int]string `json:"messageOrder"` + Messages map[string]Message `json:"messages"` + ConversationId string `json:"conversationId"` + DisplayName string `json:"displayName"` + LatestMessage LatestMessage `json:"latestMessage"` + IsGroupChat bool `json:"isGroupChat,omitempty"` + Timestamp int64 `json:"timestamp"` + Status int64 `json:"status"` + HexHash string `json:"hexHash"` + Type int64 `json:"type"` + SelfParticipantId string `json:"selfParticipantId,omitempty"` + Participants []Participant `json:"participants"` + ParticipantIds []string `json:"participantIds,omitempty"` // excluded self id +} + +type Conversations struct { + cache *Cache + /* + {0: "1", 1: "4"} + order -> conversationId + index 0 = first conversation in order + */ + Order map[int]string `json:"order"` + /* + Map conversations by conversationId + */ + Conversations map[string]*Conversation `json:"conversations"` +} + +func (c *Conversations) SetCache(cache *Cache) { + c.cache = cache +} + +func (c *Conversations) DeleteConversation(convId string) { + delete(c.Conversations, convId) +} + +func (c *Conversations) UpdateConversation(conversation *binary.Conversation) *Conversation { + newConversation := NewConversation(c.cache, conversation) + c.Conversations[conversation.ConversationId] = newConversation + return newConversation +} + +func (c *Conversation) GetMessage(msgId string) (Message, error) { + message, foundMsg := c.Messages[msgId] + if !foundMsg { + return Message{}, fmt.Errorf("could not find that message cached") + } + return message, nil +} + +func (c *Conversation) Delete() { + c.cache.Conversations.DeleteConversation(c.ConversationId) +} + +func (c *Conversation) UpdateMessage(msg *binary.Message) Message { + newMsg := NewMessage(c.cache, msg) + + if c.Messages == nil { + log.Println("c.messages was nil so created new map") + c.Messages = make(map[string]Message) + } + + c.Messages[msg.MessageId] = newMsg + return newMsg +} + +func (c *Conversations) GetConversationByOrder(order int) (*Conversation, error) { + convId, ok := c.Order[order] + if !ok { + return &Conversation{}, fmt.Errorf("could not find a conversation that occupies that order") + } + conversation, foundConvo := c.Conversations[convId] + if !foundConvo { + return &Conversation{}, fmt.Errorf("could not find that conversation cached, oddly enough it seems to be cached in the order map though... investigate further") + } + return conversation, nil +} + +func (c *Conversation) GetOrderSlice() []string { + keys := make([]string, 0, len(c.Messages)) + for k := range c.Messages { + keys = append(keys, k) + } + sort.Slice(keys, func(i, j int) bool { + return c.Messages[keys[i]].Timestamp < c.Messages[keys[j]].Timestamp + }) + return keys +} + +func (c *Conversations) GetOrderSlice() []int { + s := make([]int, 0) + for i := range c.Order { + s = append(s, i) + } + return s +} + +func (c *Conversations) GetConversation(convId string) (*Conversation, error) { + convo, ok := c.Conversations[convId] + if !ok { + // handle error, such as creating a new conversation or returning + return &Conversation{}, fmt.Errorf("could not find conversation cached") + } else { + return convo, nil + } +} + +func NewConversation(cache *Cache, conv *binary.Conversation) *Conversation { + currConv, convErr := cache.Conversations.GetConversation(conv.ConversationId) + participants := ParseParticipants(conv.Participants) + newConversation := Conversation{ + cache: cache, + ConversationId: conv.ConversationId, + DisplayName: conv.Name, + Timestamp: conv.TimestampMs, + Status: conv.Status, + HexHash: conv.HashHex, + Type: conv.Type, + Participants: participants, + ParticipantIds: conv.OtherParticipants, + SelfParticipantId: conv.SelfParticipantId, + } + + if conv.LatestMessage != nil { + newConversation.LatestMessage = LatestMessage{ + Content: conv.LatestMessage.Content, + FromMe: conv.LatestMessage.FromMe, + DisplayName: conv.LatestMessage.DisplayName, + MessageId: conv.MessageId, + } + } + + if convErr == nil { + newConversation.MessageOrder = currConv.MessageOrder + newConversation.Messages = currConv.Messages + } else { + newConversation.MessageOrder = make(map[int]string) + newConversation.Messages = make(map[string]Message) + } + return &newConversation +} + +func ParseParticipants(participants []*binary.Participant) []Participant { + partSlice := make([]Participant, 0) + for _, p := range participants { + partSlice = append(partSlice, Participant{ + SmallInfo: &SmallInfo{ + Type: p.SmallInfo.Type, + Number: p.SmallInfo.Number, + ParticipantId: p.SmallInfo.ParticipantId, + }, + HexHash: p.HashHex, + IsMe: p.IsMe, + Bs: p.Bs, + DisplayName: p.DisplayName, + }) + } + return partSlice +} + +func NewMessage(cache *Cache, message *binary.Message) Message { + msg := Message{ + cache: cache, + MessageId: message.MessageId, + ConvId: message.ConversationId, + From: IsFromMe{ + FromMe: message.From.FromMe, + }, + Timestamp: message.Timestamp, + ParticipantId: message.ParticipantId, + MessageType: message.Type.String(), + MessageStatus: MessageStatus{ + Code: message.MessageStatus.Code, + ErrMsg: message.MessageStatus.ErrMsg, + MsgType: message.MessageStatus.MsgStatus, + }, + MessageData: make([]MessageData, 0), + } + for _, data := range message.MessageInfo { + msgData := MessageData{ + OrderInternal: data.OrderInternal, + } + switch d := data.Data.(type) { + case *binary.MessageInfo_ImageContent: + msgData.ImageData = &ImageMessage{ + SomeNumber: d.ImageContent.SomeNumber, + ImageId: d.ImageContent.ImageId, + ImageName: d.ImageContent.ImageName, + Size: d.ImageContent.Size, + Pixels: ImagePixels{Width: d.ImageContent.Pixels.Width, Height: d.ImageContent.Pixels.Height}, + ImageBuffer: d.ImageContent.ImageData, + DecryptionKey: d.ImageContent.DecryptionKey, + } + case *binary.MessageInfo_MessageContent: + msgData.TextData = &TextMessage{ + Content: d.MessageContent.Content, + } + } + msg.MessageData = append(msg.MessageData, msgData) + } + return msg +} diff --git a/libgm/cache/settings.go b/libgm/cache/settings.go new file mode 100644 index 0000000..f1b97d2 --- /dev/null +++ b/libgm/cache/settings.go @@ -0,0 +1,8 @@ +package cache + + +type Settings struct { + CarrierName string `json:"carrierName,omitempty"` + HexHash string `json:"hexHash,omitempty"` + Version string `json:"version,omitempty"` +} \ No newline at end of file diff --git a/libgm/client.go b/libgm/client.go new file mode 100644 index 0000000..e358ed7 --- /dev/null +++ b/libgm/client.go @@ -0,0 +1,242 @@ +package textgapi + +import ( + "encoding/json" + "io" + "log" + "net/http" + "net/url" + "os" + "time" + + "github.com/rs/zerolog" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/cache" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/payload" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type DevicePair struct { + Mobile *binary.Device + Browser *binary.Device +} +type Proxy func(*http.Request) (*url.URL, error) +type EventHandler func(evt interface{}) +type Client struct { + Logger zerolog.Logger + Conversations *Conversations + Session *Session + rpc *RPC + devicePair *DevicePair + pairer *Pairer + cryptor *crypto.Cryptor + imageCryptor *crypto.ImageCryptor + evHandler EventHandler + sessionHandler *SessionHandler + instructions *Instructions + + rpcKey string + ttl int64 + + proxy Proxy + http *http.Client + + cache cache.Cache +} + +func NewClient(devicePair *DevicePair, cryptor *crypto.Cryptor, logger zerolog.Logger, proxy *string) *Client { + sessionHandler := &SessionHandler{ + requests: make(map[string]map[int64]*ResponseChan), + responseTimeout: time.Duration(5000) * time.Millisecond, + } + if cryptor == nil { + cryptor = crypto.NewCryptor(nil, nil) + } + cli := &Client{ + Logger: logger, + devicePair: devicePair, + sessionHandler: sessionHandler, + cryptor: cryptor, + imageCryptor: &crypto.ImageCryptor{}, + http: &http.Client{}, + cache: cache.Cache{}, + } + sessionHandler.client = cli + cli.instructions = NewInstructions(cli.cryptor) + if proxy != nil { + cli.SetProxy(*proxy) + } + rpc := &RPC{client: cli, http: &http.Client{Transport: &http.Transport{Proxy: cli.proxy}}} + cli.rpc = rpc + cli.Logger.Debug().Any("data", cryptor).Msg("Cryptor") + cli.cache.Conversations = cache.Conversations{ + Conversations: make(map[string]*cache.Conversation), + Order: make(map[int]string), + } + cli.cache.Conversations.SetCache(&cli.cache) + cli.setApiMethods() + return cli +} + +func (c *Client) SetEventHandler(eventHandler EventHandler) { + c.evHandler = eventHandler +} + +func (c *Client) SetProxy(proxy string) error { + proxyParsed, err := url.Parse(proxy) + if err != nil { + c.Logger.Fatal().Err(err).Msg("Failed to set proxy") + } + proxyUrl := http.ProxyURL(proxyParsed) + c.http.Transport = &http.Transport{ + Proxy: proxyUrl, + } + c.proxy = proxyUrl + c.Logger.Debug().Any("proxy", proxyParsed.Host).Msg("SetProxy") + return nil +} + +func (c *Client) Connect(rpcKey string) error { + rpcPayload, receiveMesageSessionId, err := payload.ReceiveMessages(rpcKey) + if err != nil { + log.Fatal(err) + return err + } + c.rpc.rpcSessionId = receiveMesageSessionId + c.rpcKey = rpcKey + c.rpc.ListenReceiveMessages(rpcPayload) + c.Logger.Debug().Any("rpcKey", rpcKey).Msg("Successfully connected to server") + return nil +} + +func (c *Client) Reconnect(rpcKey string) error { + c.rpc.CloseConnection() + for c.rpc.conn != nil { + time.Sleep(time.Millisecond * 100) + } + err := c.Connect(rpcKey) + if err != nil { + c.Logger.Err(err).Any("rpcKey", rpcKey).Msg("Failed to reconnect") + return err + } + c.Logger.Debug().Any("rpcKey", rpcKey).Msg("Successfully reconnected to server") + sendInitialDataErr := c.rpc.sendInitialData() + if sendInitialDataErr != nil { + log.Fatal(sendInitialDataErr) + } + return nil +} + +func (c *Client) triggerEvent(evt interface{}) { + if c.evHandler != nil { + c.evHandler(evt) + } +} + +func (c *Client) setApiMethods() { + c.Conversations = &Conversations{ + client: c, + openConversation: openConversation{ + client: c, + }, + fetchConversationMessages: fetchConversationMessages{ + client: c, + }, + } + c.Session = &Session{ + client: c, + prepareNewSession: prepareNewSession{ + client: c, + }, + newSession: newSession{ + client: c, + }, + } +} + +func (c *Client) decryptImages(messages *binary.FetchMessagesResponse) error { + for _, msg := range messages.Messages { + switch msg.GetType() { + case *binary.MessageType_IMAGE.Enum(): + for _, details := range msg.GetMessageInfo() { + switch data := details.GetData().(type) { + case *binary.MessageInfo_ImageContent: + decryptedImageData, err := c.decryptImageData(data.ImageContent.ImageId, data.ImageContent.DecryptionKey) + if err != nil { + log.Fatal(err) + return err + } + data.ImageContent.ImageData = decryptedImageData + } + } + } + } + return nil +} + +func (c *Client) decryptImageData(imageId string, key []byte) ([]byte, error) { + decodedRpcKey, err := crypto.Base64DecodeStandard(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{ + RequestId: reqId, + RpcKey: decodedRpcKey, + Date: &binary.Date{ + Year: 2023, + Seq1: 6, + Seq2: 8, + Seq3: 4, + Seq4: 6, + }, + }, + } + download_metadata_bytes, err2 := binary.EncodeProtoMessage(download_metadata) + if err2 != nil { + return nil, err2 + } + download_metadata_b64 := crypto.EncodeBase64Standard(download_metadata_bytes) + req, err := http.NewRequest("GET", util.UPLOAD_MEDIA, nil) + if err != nil { + return nil, err + } + util.BuildUploadHeaders(req, download_metadata_b64) + res, reqErr := c.http.Do(req) + if reqErr != nil { + return nil, reqErr + } + c.Logger.Info().Any("url", util.UPLOAD_MEDIA).Any("headers", res.Request.Header).Msg("Decrypt Image Headers") + defer res.Body.Close() + encryptedBuffImg, err3 := io.ReadAll(res.Body) + if err3 != nil { + return nil, err3 + } + c.Logger.Debug().Any("key", key).Any("encryptedLength", len(encryptedBuffImg)).Msg("Attempting to decrypt image") + c.imageCryptor.UpdateDecryptionKey(key) + decryptedImageBytes, decryptionErr := c.imageCryptor.DecryptData(encryptedBuffImg) + if decryptionErr != nil { + log.Println("Error:", decryptionErr) + return nil, decryptionErr + } + return decryptedImageBytes, nil +} + +func (c *Client) SaveCache(path string) { + toSaveJson, jsonErr := json.Marshal(c.cache) + if jsonErr != nil { + log.Fatal(jsonErr) + } + os.WriteFile(path, toSaveJson, os.ModePerm) +} + +func (c *Client) GetCache() cache.Cache { + return c.cache +} diff --git a/libgm/command_handler.go b/libgm/command_handler.go new file mode 100644 index 0000000..c471b4a --- /dev/null +++ b/libgm/command_handler.go @@ -0,0 +1,33 @@ +package textgapi + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +func (c *Client) processSessionResponse(prepareSession []*Response, newSession []*Response) (*util.SessionResponse, error) { + prepDecoded, prepDecodeErr := prepareSession[0].decryptData() + if prepDecodeErr != nil { + return nil, prepDecodeErr + } + + sessDecoded, sessDecodeErr := newSession[0].decryptData() + if sessDecodeErr != nil { + return nil, sessDecodeErr + } + + sess := sessDecoded.(*binary.NewSession) + prep := prepDecoded.(*binary.PrepareNewSession) + return &util.SessionResponse{ + Success: prep.Success, + Settings: sess.Settings, + }, nil +} + +func (c *Client) processFetchMessagesResponse(fetchMessagesRes []*Response, openConversationRes []*Response, setActiveConversationRes []*Response) (*binary.FetchMessagesResponse, error) { + messagesDecoded, messagesDecodeErr := fetchMessagesRes[0].decryptData() + if messagesDecodeErr != nil { + return nil, messagesDecodeErr + } + return messagesDecoded.(*binary.FetchMessagesResponse), nil +} diff --git a/libgm/conversations.go b/libgm/conversations.go new file mode 100644 index 0000000..e038a81 --- /dev/null +++ b/libgm/conversations.go @@ -0,0 +1,208 @@ +package textgapi + +import ( + "fmt" + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +type Conversations struct { + client *Client + + watching string // current open conversation + + openConversation openConversation + fetchConversationMessages fetchConversationMessages +} + +func (c *Conversations) List(count int64) (*binary.Conversations, error) { + encryptedProtoPayload := &binary.ListCoversationsPayload{Count: count, Field4: 1} + instruction, _ := c.client.instructions.GetInstruction(LIST_CONVERSATIONS) + sentRequestId, _ := c.client.createAndSendRequest(instruction.Opcode, c.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + + responses, err := c.client.sessionHandler.WaitForResponse(sentRequestId, instruction.Opcode) + if err != nil { + return nil, err + } + decryptedProto, decryptErr := responses[0].decryptData() + if decryptErr != nil { + return nil, decryptErr + } + + if decryptedData, ok := decryptedProto.(*binary.Conversations); ok { + c.client.cache.SetConversations(decryptedData) + return decryptedData, nil + } else { + return nil, fmt.Errorf("failed to assert decryptedProto into type Conversations") + } +} + +func (c *Conversations) SendMessage(messageBuilder *MessageBuilder) (*binary.SendMessageResponse, error) { + conv, notFound := c.client.cache.Conversations.GetConversation(messageBuilder.GetConversationId()) + if notFound != nil { + log.Fatal(notFound) + } + + hasSelfParticipantId := messageBuilder.GetSelfParticipantId() + if hasSelfParticipantId == "" { + messageBuilder.SetSelfParticipantId(conv.SelfParticipantId) + } + + encryptedProtoPayload, failedToBuild := messageBuilder.Build() + if failedToBuild != nil { + log.Fatal(failedToBuild) + } + + instruction, _ := c.client.instructions.GetInstruction(SEND_TEXT_MESSAGE) + c.client.Logger.Debug().Any("payload", encryptedProtoPayload).Msg("SendMessage Payload") + sentRequestId, _ := c.client.createAndSendRequest(instruction.Opcode, c.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + + responses, err := c.client.sessionHandler.WaitForResponse(sentRequestId, instruction.Opcode) + if err != nil { + log.Fatal(err) + return nil, err + } + + decryptedProto, decryptErr := responses[0].decryptData() + if decryptErr != nil { + return nil, decryptErr + } + + if decryptedData, ok := decryptedProto.(*binary.SendMessageResponse); ok { + return decryptedData, nil + } else { + return nil, fmt.Errorf("failed to assert decryptedProto into type SendMessageResponse") + } +} + +func (c *Conversations) FetchMessages(convId string, count int64, cursor *binary.Cursor) (*binary.FetchMessagesResponse, error) { + + var openConversationRes []*Response + var openConversationErr error + if c.watching != convId { + openConversationRes, openConversationErr = c.openConversation.Execute(convId) + if openConversationErr != nil { + return nil, openConversationErr + } + c.watching = convId + } + + fetchMessagesRes, fetchMessagesErr := c.fetchConversationMessages.Execute(convId, count, cursor) + if fetchMessagesErr != nil { + return nil, fetchMessagesErr + } + + fetchedMessagesResponse, processFail := c.client.processFetchMessagesResponse(fetchMessagesRes, openConversationRes, nil) + if processFail != nil { + return nil, processFail + } + + c.client.cache.SetMessages(fetchedMessagesResponse) + return fetchedMessagesResponse, nil +} + +type fetchConversationMessages struct { + client *Client +} + +func (f *fetchConversationMessages) Execute(convId string, count int64, cursor *binary.Cursor) ([]*Response, error) { + encryptedProtoPayload := &binary.FetchConversationMessagesPayload{ConversationId: convId, Count: count, Cursor: cursor} + instruction, _ := f.client.instructions.GetInstruction(FETCH_MESSAGES_CONVERSATION) + sentRequestId, _ := f.client.createAndSendRequest(instruction.Opcode, f.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + + responses, err := f.client.sessionHandler.WaitForResponse(sentRequestId, instruction.Opcode) + if err != nil { + return nil, err + } + + return responses, nil +} + +type openConversation struct { + client *Client +} + +func (o *openConversation) Execute(convId string) ([]*Response, error) { + encryptedProtoPayload := &binary.OpenConversationPayload{ConversationId: convId} + instruction, _ := o.client.instructions.GetInstruction(OPEN_CONVERSATION) + sentRequestId, _ := o.client.createAndSendRequest(instruction.Opcode, o.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + + responses, err := o.client.sessionHandler.WaitForResponse(sentRequestId, instruction.Opcode) + if err != nil { + return nil, err + } + + // Rest of the processing... + + return responses, nil +} + +/* +func (c *Conversations) SendMessage(conversationId string, content string, participantCount string) (*binary.SendMessageResponse, error) { + encryptedProtoPayload := payload.NewSendConversationTextMessage(conversationId, content, participantCount) + sentRequestId, _ := c.client.createAndSendRequest(3, c.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + c.client.Logger.Debug().Any("requestId", sentRequestId).Msg("Sent sendmessage request.") + response, responseErr := c.client.sessionHandler.WaitForResponse(sentRequestId, 3) + if responseErr != nil { + c.client.Logger.Err(responseErr).Msg("SendMessage channel response error") + return nil, responseErr + } else { + decryptedProto, decryptErr := response.decryptData() + if decryptErr != nil { + return nil, decryptErr + } + + if decryptedData, ok := decryptedProto.(*binary.SendMessageResponse); ok { + return decryptedData, nil + } else { + return nil, fmt.Errorf("failed to assert decryptedProto into type SendMessageResponse") + } + } +} + +func (c *Conversations) PrepareOpen() (interface{}, error) { + encryptedProtoPayload := &binary.PrepareOpenConversationPayload{Field2:1} + sentRequestId, _ := c.client.createAndSendRequest(22, c.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + c.client.Logger.Debug().Any("requestId", sentRequestId).Msg("Sent PrepareOpenConversation request.") + response, responseErr := c.client.sessionHandler.WaitForResponse(sentRequestId, 22) + if responseErr != nil { + c.client.Logger.Err(responseErr).Msg("PrepareOpenConversation channel response error") + return nil, responseErr + } else { + c.client.Logger.Info().Any("response", response).Msg("PrepareOpenConversation response data") + } + return nil, nil +} + +func (c *Conversations) Open(conversationId string) (interface{}, error) { + encryptedProtoPayload := &binary.OpenConversationPayload{ConversationId:conversationId} + sentRequestId, _ := c.client.createAndSendRequest(21, c.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + c.client.Logger.Debug().Any("requestId", sentRequestId).Msg("Sent OpenConversation request.") + response, responseErr := c.client.sessionHandler.WaitForResponse(sentRequestId, 21) + if responseErr != nil { + c.client.Logger.Err(responseErr).Msg("OpenConversation channel response error") + return nil, responseErr + } else { + c.client.Logger.Info().Any("response", response).Msg("OpenConversation response data") + } + return nil, nil +} + +func (c *Conversations) FetchMessages(conversationId string, count int64) (*binary.FetchMessagesResponse, error) { + encryptedProtoPayload := &binary.FetchConversationMessagesPayload{ConversationId:conversationId,Count:count} + sentRequestId, _ := c.client.createAndSendRequest(2, c.client.ttl, false, encryptedProtoPayload.ProtoReflect()) + c.client.Logger.Debug().Any("requestId", sentRequestId).Msg("Sent FetchMessages request.") + response, responseErr := c.client.sessionHandler.WaitForResponse(sentRequestId, 2) + if responseErr != nil { + c.client.Logger.Err(responseErr).Msg("FetchMessages channel response error") + return nil, responseErr + } else { + decryptedMessages, decryptedErr := c.client.newMessagesResponse(response) + if decryptedErr != nil { + return nil, decryptedErr + } + return decryptedMessages, nil + } +} +*/ diff --git a/libgm/crypto/B64.go b/libgm/crypto/B64.go new file mode 100644 index 0000000..6dc5913 --- /dev/null +++ b/libgm/crypto/B64.go @@ -0,0 +1,41 @@ +package crypto + +import ( + "encoding/base64" + "fmt" + "strings" +) + +func EncodeBase64Standard(data []byte) string { + return base64.StdEncoding.EncodeToString(data) +} + +func EncodeBase64(data []byte) string { + return base64.RawURLEncoding.EncodeToString(data) +} + +func Base64Decode(input string) ([]byte, error) { + padding := len(input) % 4 + if padding > 0 { + input += strings.Repeat("=", 4-padding) + } + + data, err := base64.URLEncoding.DecodeString(input) + if err != nil { + return nil, err + } + return data, nil +} + +func Base64DecodeStandard(input string) ([]byte, error) { + decoded, err := base64.StdEncoding.DecodeString(input) + if err != nil { + fmt.Println("decode error:", err) + return nil, err + } + return decoded, nil +} + +func Base64Encode(input []byte) string { + return base64.StdEncoding.EncodeToString(input) +} \ No newline at end of file diff --git a/libgm/crypto/ECDSA.go b/libgm/crypto/ECDSA.go new file mode 100644 index 0000000..5d3b11c --- /dev/null +++ b/libgm/crypto/ECDSA.go @@ -0,0 +1,113 @@ +package crypto + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/base64" + "encoding/json" + "fmt" + "math/big" +) + +type JWK struct { + Kty string `json:"kty"` + Crv string `json:"crv"` + D string `json:"d"` + X string `json:"x"` + Y string `json:"y"` + Ext bool `json:"ext"` + KeyOps []string `json:"key_ops"` + PrivateBytes []byte `json:"privateBytes,omitempty"` +} + +// Returns a byte slice containing the JWK and an error if the generation or export failed. +func (t *JWK) Marshal() ([]byte, error) { + JWKJSON, err := json.Marshal(t) + if err != nil { + fmt.Printf("Failed to marshal JWK: %v", err) + return nil,err + } + fmt.Printf("%s\n", JWKJSON) + return JWKJSON,err +} + +func (t *JWK) PrivKeyB64Bytes() ([]byte, error){ + decodedPrivateKey, err2 := Base64Decode(t.D) + return decodedPrivateKey, err2 +} + +func (t *JWK) ExtractPublicKeyDetails(pubKey []byte) *JWK { + x := EncodeBase64(pubKey[1:33]) + y := EncodeBase64(pubKey[33:]) + return &JWK{ + Kty: "EC", + Crv: "P-256", + X: x, + Y: y, + } +} + +func (t *JWK) DecompressPubkey() (*ecdsa.PublicKey, error) { + xBytes, err := base64.RawURLEncoding.DecodeString(t.X) + if err != nil { + return nil, err + } + yBytes, err := base64.RawURLEncoding.DecodeString(t.Y) + if err != nil { + return nil, err + } + + x := new(big.Int).SetBytes(xBytes) + y := new(big.Int).SetBytes(yBytes) + pubKey := &ecdsa.PublicKey{ + Curve: elliptic.P256(), + X: x, + Y: y, + } + return pubKey, nil +} + +func (t *JWK) UncompressPubKey() ([]byte, error) { + xBytes, err := base64.RawURLEncoding.DecodeString(t.X) + if err != nil { + return nil, err + } + yBytes, err := base64.RawURLEncoding.DecodeString(t.Y) + if err != nil { + return nil, err + } + + x := new(big.Int).SetBytes(xBytes) + y := new(big.Int).SetBytes(yBytes) + + pubKey := &ecdsa.PublicKey{ + Curve: elliptic.P256(), + X: x, + Y: y, + } + + uncompressedPubKey := elliptic.Marshal(pubKey.Curve, pubKey.X, pubKey.Y) + + return uncompressedPubKey, nil +} + +// GenerateECDSA_P256_JWK generates a new ECDSA private key with P-256 curve +func GenerateECDSA_P256_JWK() (*JWK, error) { + privKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + fmt.Printf("Failed to generate private key: %v", err) + return nil,err + } + + JWK := &JWK{ + Kty: "EC", + Crv: "P-256", + D: base64.RawURLEncoding.EncodeToString(privKey.D.Bytes()), + X: base64.RawURLEncoding.EncodeToString(privKey.X.Bytes()), + Y: base64.RawURLEncoding.EncodeToString(privKey.Y.Bytes()), + Ext: true, + KeyOps: []string{"sign"}, + } + return JWK,nil +} \ No newline at end of file diff --git a/libgm/crypto/cryptor.go b/libgm/crypto/cryptor.go new file mode 100644 index 0000000..2a9dafe --- /dev/null +++ b/libgm/crypto/cryptor.go @@ -0,0 +1,115 @@ +package crypto + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/hmac" + "crypto/rand" + "crypto/sha256" + "encoding/json" + "errors" + "io" + "os" + + "google.golang.org/protobuf/reflect/protoreflect" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +type Cryptor struct { + AES_CTR_KEY_256, SHA_256_KEY []byte +} + +func NewCryptor(aes_key []byte, sha_key []byte) *Cryptor { + if aes_key != nil && sha_key != nil { + return &Cryptor{ + AES_CTR_KEY_256: aes_key, + SHA_256_KEY: sha_key, + } + } + aes_key, sha_key = GenerateKeys() + return &Cryptor{ + AES_CTR_KEY_256: aes_key, + SHA_256_KEY: sha_key, + } +} + +func (c *Cryptor) SaveAsJson() { + AES_B64, SHA_B64 := EncodeBase64Standard(c.AES_CTR_KEY_256), EncodeBase64Standard(c.SHA_256_KEY) + inter := struct { + AES_CTR_KEY_256 string + SHA_256_KEY string + }{ + AES_CTR_KEY_256: AES_B64, + SHA_256_KEY: SHA_B64, + } + jsonData, _ := json.Marshal(inter) + os.WriteFile("cryptor.json", jsonData, os.ModePerm) +} + +func (c *Cryptor) Encrypt(plaintext []byte) ([]byte, error) { + iv := make([]byte, aes.BlockSize) + if _, err := io.ReadFull(rand.Reader, iv); err != nil { + return nil, err + } + + block, err := aes.NewCipher(c.AES_CTR_KEY_256) + if err != nil { + return nil, err + } + + ciphertext := make([]byte, len(plaintext)) + stream := cipher.NewCTR(block, iv) + stream.XORKeyStream(ciphertext, plaintext) + + ciphertext = append(ciphertext, iv...) + + mac := hmac.New(sha256.New, c.SHA_256_KEY) + mac.Write(ciphertext) + hmac := mac.Sum(nil) + + ciphertext = append(ciphertext, hmac...) + + return ciphertext, nil +} + +func (c *Cryptor) Decrypt(encryptedData []byte) ([]byte, error) { + if len(encryptedData) < 48 { + return nil, errors.New("input data is too short") + } + + hmacSignature := encryptedData[len(encryptedData)-32:] + encryptedDataWithoutHMAC := encryptedData[:len(encryptedData)-32] + + mac := hmac.New(sha256.New, c.SHA_256_KEY) + mac.Write(encryptedDataWithoutHMAC) + expectedHMAC := mac.Sum(nil) + + if !hmac.Equal(hmacSignature, expectedHMAC) { + return nil, errors.New("HMAC mismatch") + } + + iv := encryptedDataWithoutHMAC[len(encryptedDataWithoutHMAC)-16:] + encryptedDataWithoutHMAC = encryptedDataWithoutHMAC[:len(encryptedDataWithoutHMAC)-16] + + block, err := aes.NewCipher(c.AES_CTR_KEY_256) + if err != nil { + return nil, err + } + stream := cipher.NewCTR(block, iv) + stream.XORKeyStream(encryptedDataWithoutHMAC, encryptedDataWithoutHMAC) + + return encryptedDataWithoutHMAC, nil +} + +func (c *Cryptor) DecryptAndDecodeData(encryptedData []byte, message protoreflect.ProtoMessage) error { + decryptedData, err := c.Decrypt(encryptedData) + if err != nil { + return err + } + err = binary.DecodeProtoMessage(decryptedData, message) + if err != nil { + return err + } + return nil +} diff --git a/libgm/crypto/decode.go b/libgm/crypto/decode.go new file mode 100644 index 0000000..ebbcb2d --- /dev/null +++ b/libgm/crypto/decode.go @@ -0,0 +1,32 @@ +package crypto + +import ( + "google.golang.org/protobuf/proto" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +func DecodeAndEncodeB64(data string, msg proto.Message) error { + decodedBytes, err := Base64DecodeStandard(data) + if err != nil { + return err + } + err = binary.DecodeProtoMessage(decodedBytes, msg) + if err != nil { + return err + } + return nil +} + +func DecodeEncodedResponse(data string) (*binary.EncodedResponse, error) { + decodedBytes, err := Base64DecodeStandard(data) + if err != nil { + return nil, err + } + decodedData := &binary.EncodedResponse{} + err = binary.DecodeProtoMessage(decodedBytes, decodedData) + if err != nil { + return nil, err + } + return decodedData, nil +} diff --git a/libgm/crypto/encode.go b/libgm/crypto/encode.go new file mode 100644 index 0000000..36be9ee --- /dev/null +++ b/libgm/crypto/encode.go @@ -0,0 +1,60 @@ +package crypto + +import ( + "google.golang.org/protobuf/proto" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +var SequenceOne = []int{1, 2, 840, 10045, 2, 1} +var SequenceTwo = []int{1, 2, 840, 10045, 3, 1, 7} + +func EncodeValues(a *[]byte, b []int) { + *a = append(*a, 6) + idx := len(*a) + *a = append(*a, 0) + *a = append(*a, byte(40*b[0]+b[1])) + for i := 2; i < len(b); i++ { + d := b[i] + e := make([]byte, 0) + if d > 128 { + e = append(e, byte(d/128)+128) + } + e = append(e, byte(d%128)) + *a = append(*a, e...) + } + (*a)[idx] = byte(len(*a) - idx - 1) +} + +func AppendBytes(a []byte, b []byte) []byte { + newA := make([]byte, len(a)) + copy(newA, a) + + newA = HelperAppendBytes(newA, 48) + newA = HelperAppendBytes(newA, byte(len(b))) + for _, value := range b { + newA = HelperAppendBytes(newA, value) + } + return newA +} + +func HelperAppendBytes(a []byte, b byte) []byte { + return append(a, b) +} + +func AppendByteSequence(byteArr1 []byte, byteArr2 []byte, uncompressedPublicKey []byte) []byte { + copiedByteArray := AppendBytes(byteArr1, byteArr2) + copiedByteArray = HelperAppendBytes(copiedByteArray, 3) + copiedByteArray = HelperAppendBytes(copiedByteArray, uint8(len(uncompressedPublicKey)+1)) + copiedByteArray = HelperAppendBytes(copiedByteArray, 0) + return copiedByteArray +} + +func EncodeProtoB64(message proto.Message) (string, error) { + protoBytes, protoErr := binary.EncodeProtoMessage(message) + if protoErr != nil { + return "", protoErr + } + encodedStr := EncodeBase64Standard(protoBytes) + return encodedStr, nil +} diff --git a/libgm/crypto/generate.go b/libgm/crypto/generate.go new file mode 100644 index 0000000..3c47de8 --- /dev/null +++ b/libgm/crypto/generate.go @@ -0,0 +1,27 @@ +package crypto + +import ( + "crypto/rand" + "log" +) + +func GenerateKey(length int) ([]byte, error) { + key := make([]byte, length) + _, err := rand.Read(key) + if err != nil { + return nil, err + } + return key, nil +} + +func GenerateKeys() ([]byte, []byte) { + key, err := GenerateKey(32) + if err != nil { + log.Fatal(err) + } + key2, err2 := GenerateKey(32) + if err2 != nil { + log.Fatal(err2) + } + return key, key2 +} \ No newline at end of file diff --git a/libgm/crypto/imageCryptor.go b/libgm/crypto/imageCryptor.go new file mode 100644 index 0000000..de48c37 --- /dev/null +++ b/libgm/crypto/imageCryptor.go @@ -0,0 +1,194 @@ +package crypto + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "fmt" + "math" +) + +type ImageCryptor struct { + key []byte +} + +func NewImageCryptor(key []byte) (*ImageCryptor, error) { + if len(key) != 32 { + return nil, fmt.Errorf("unsupported AES key length (got=%d expected=32)", len(key)) + } + return &ImageCryptor{key: key}, nil +} + +func (ic *ImageCryptor) GetKey() []byte { + return ic.key +} + +func (ic *ImageCryptor) UpdateDecryptionKey(key []byte) { + ic.key = key +} + +func (ic *ImageCryptor) Encrypt(imageBytes []byte, aad []byte) ([]byte, error) { + block, err := aes.NewCipher(ic.key) + if err != nil { + return nil, err + } + + gcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + + nonce := make([]byte, gcm.NonceSize()) + _, err = rand.Read(nonce) + if err != nil { + return nil, err + } + + ciphertext := gcm.Seal(nonce, nonce, imageBytes, aad) + return ciphertext, nil +} + +func (ic *ImageCryptor) Decrypt(iv []byte, data []byte, aad []byte) ([]byte, error) { + block, err := aes.NewCipher(ic.key) + if err != nil { + return nil, err + } + + gcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + + if len(data) < gcm.NonceSize() { + return nil, fmt.Errorf("invalid encrypted data length (got=%d)", len(data)) + } + + ciphertext := data[gcm.NonceSize():] + + decrypted, err := gcm.Open(nil, iv, ciphertext, aad) + if err != nil { + return nil, err + } + + return decrypted, nil +} + +func (ic *ImageCryptor) EncryptData(data []byte) ([]byte, error) { + rawChunkSize := 1 << 15 + chunkSize := rawChunkSize-28 + var tasks []chan []byte + chunkIndex := 0 + + for i := 0; i < len(data); i += chunkSize { + if i+chunkSize > len(data) { + chunkSize = len(data) - i + } + + chunk := make([]byte, chunkSize) + copy(chunk, data[i:i+chunkSize]) + + aad := ic.calculateAAD(chunkIndex, i+chunkSize, len(data)) + tasks = append(tasks, make(chan []byte)) + go func(chunk, aad []byte, task chan []byte) { + encrypted, err := ic.Encrypt(chunk, aad) + if err != nil { + fmt.Println(err) + task <- nil + } else { + task <- encrypted + } + }(chunk, aad, tasks[chunkIndex]) + + chunkIndex++ + } + + var result [][]byte + for _, task := range tasks { + encrypted := <-task + if encrypted == nil { + continue + } + result = append(result, encrypted) + } + + var concatted []byte + for _, r := range result { + concatted = append(concatted, r...) + } + + encryptedHeader := []byte{0, byte(math.Log2(float64(rawChunkSize)))} + + return append(encryptedHeader, concatted...), nil +} + +func (ic *ImageCryptor) DecryptData(encryptedData []byte) ([]byte, error) { + if len(encryptedData) == 0 || len(ic.key) != 32 { + return encryptedData, nil + } + if encryptedData[0] != 0 { + return nil, fmt.Errorf("invalid first-byte header signature (got=%o , expected=%o)", encryptedData[0], 0) + } + + chunkSize := 1 << encryptedData[1] + encryptedData = encryptedData[2:] + + var tasks []chan []byte + chunkIndex := 0 + + for i := 0; i < len(encryptedData); i += chunkSize { + if i+chunkSize > len(encryptedData) { + chunkSize = len(encryptedData) - i + } + + chunk := make([]byte, chunkSize) + copy(chunk, encryptedData[i:i+chunkSize]) + + iv := chunk[:12] + aad := ic.calculateAAD(chunkIndex, i+chunkSize, len(encryptedData)) + tasks = append(tasks, make(chan []byte)) + go func(iv, chunk, aad []byte, task chan []byte) { + decrypted, err := ic.Decrypt(iv, chunk, aad) + if err != nil { + fmt.Println(err) + task <- nil + } else { + task <- decrypted + } + }(iv, chunk, aad, tasks[chunkIndex]) + + chunkIndex++ + } + + var result [][]byte + for _, task := range tasks { + decrypted := <-task + if decrypted == nil { + continue + } + result = append(result, decrypted) + } + + var concatted []byte + for _, r := range result { + concatted = append(concatted, r...) + } + + return concatted, nil +} + +func (ic *ImageCryptor) calculateAAD(index, end, total int) []byte { + aad := make([]byte, 5) + + i := 4 + for index > 0 { + aad[i] = byte(index % 256) + index = index / 256 + i-- + } + + if end >= total { + aad[0] = 1 + } + + return aad +} \ No newline at end of file diff --git a/libgm/debug/logger.go b/libgm/debug/logger.go new file mode 100644 index 0000000..c45ce9a --- /dev/null +++ b/libgm/debug/logger.go @@ -0,0 +1,43 @@ +package debug + +import ( + "fmt" + "time" + "github.com/mattn/go-colorable" + zerolog "github.com/rs/zerolog" +) + +var colors = map[string]string{ + "text": "\x1b[38;5;6m%s\x1b[0m", + "debug": "\x1b[32mDEBUG\x1b[0m", + "gray": "\x1b[38;5;8m%s\x1b[0m", + "info": "\x1b[38;5;111mINFO\x1b[0m", + "error": "\x1b[38;5;204mERROR\x1b[0m", + "fatal": "\x1b[38;5;52mFATAL\x1b[0m", +} + +var output = zerolog.ConsoleWriter{ + Out: colorable.NewColorableStdout(), + TimeFormat: time.ANSIC, + FormatLevel: func(i interface{}) string { + name := fmt.Sprintf("%s", i) + coloredName := colors[name] + return coloredName + }, + FormatMessage: func(i interface{}) string { + coloredMsg := fmt.Sprintf(colors["text"], i) + return coloredMsg + }, + FormatFieldName: func(i interface{}) string { + name := fmt.Sprintf("%s", i) + return fmt.Sprintf(colors["gray"], name+"=") + }, + FormatFieldValue: func(i interface{}) string { + return fmt.Sprintf("%s", i) + }, + NoColor: false, +} + +func NewLogger() zerolog.Logger { + return zerolog.New(output).With().Timestamp().Logger() +} \ No newline at end of file diff --git a/libgm/event_handler.go b/libgm/event_handler.go new file mode 100644 index 0000000..6bd7301 --- /dev/null +++ b/libgm/event_handler.go @@ -0,0 +1,26 @@ +package textgapi + +import ( + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" +) + +func (c *Client) handleEventOpCode(response *Response) { + //c.Logger.Debug().Any("res", response).Msg("got event response") + eventData := &binary.Event{} + decryptedErr := c.cryptor.DecryptAndDecodeData(response.Data.EncryptedData, eventData) + if decryptedErr != nil { + log.Fatal(decryptedErr) + } + switch evt := eventData.Event.(type) { + case *binary.Event_MessageEvent: + c.handleMessageEvent(response, evt) + case *binary.Event_ConversationEvent: + c.handleConversationEvent(response, evt) + case *binary.Event_UserAlertEvent: + c.handleUserAlertEvent(response, evt) + default: + c.Logger.Debug().Any("res", response).Msg("unknown event") + } +} diff --git a/libgm/events/conversations.go b/libgm/events/conversations.go new file mode 100644 index 0000000..861f506 --- /dev/null +++ b/libgm/events/conversations.go @@ -0,0 +1,67 @@ +package events + +import "go.mau.fi/mautrix-gmessages/libgm/cache" + +type ConversationEvent interface { + GetConversation() *cache.Conversation +} + +// Triggered when tabbing out of a conversation +type CONVERSATION_EXIT struct { + Conversation *cache.Conversation +} + +func (c *CONVERSATION_EXIT) GetConversation() *cache.Conversation { + return c.Conversation +} + +// Triggered when a conversation is archived +type CONVERSATION_ARCHIVED struct { + Conversation *cache.Conversation +} + +func (c *CONVERSATION_ARCHIVED) GetConversation() *cache.Conversation { + return c.Conversation +} + +// Triggered when a conversation is unarchived +type CONVERSATION_UNARCHIVED struct { + Conversation *cache.Conversation +} + +func (c *CONVERSATION_UNARCHIVED) GetConversation() *cache.Conversation { + return c.Conversation +} + +// Triggered when a conversation is deleted +type CONVERSATION_DELETED struct { + Conversation *cache.Conversation +} + +func (c *CONVERSATION_DELETED) GetConversation() *cache.Conversation { + return c.Conversation +} + +func NewConversationExit(conversation *cache.Conversation) ConversationEvent { + return &CONVERSATION_EXIT{ + Conversation: conversation, + } +} + +func NewConversationArchived(conversation *cache.Conversation) ConversationEvent { + return &CONVERSATION_ARCHIVED{ + Conversation: conversation, + } +} + +func NewConversationUnarchived(conversation *cache.Conversation) ConversationEvent { + return &CONVERSATION_UNARCHIVED{ + Conversation: conversation, + } +} + +func NewConversationDeleted(conversation *cache.Conversation) ConversationEvent { + return &CONVERSATION_DELETED{ + Conversation: conversation, + } +} diff --git a/libgm/events/messages.go b/libgm/events/messages.go new file mode 100644 index 0000000..d80c2fa --- /dev/null +++ b/libgm/events/messages.go @@ -0,0 +1,65 @@ +package events + +import ( + "go.mau.fi/mautrix-gmessages/libgm/cache" +) + +type MessageEvent interface { + GetMessage() cache.Message +} + +type MESSAGE_SENDING struct { + Message cache.Message +} + +func (m *MESSAGE_SENDING) GetMessage() cache.Message { + return m.Message +} + +func NewMessageSending(message cache.Message) MessageEvent { + return &MESSAGE_SENDING{ + Message: message, + } +} + +type MESSAGE_SENT struct { + Message cache.Message +} + +func (m *MESSAGE_SENT) GetMessage() cache.Message { + return m.Message +} + +func NewMessageSent(message cache.Message) MessageEvent { + return &MESSAGE_SENT{ + Message: message, + } +} + +type MESSAGE_RECEIVING struct { + Message cache.Message +} + +func (m *MESSAGE_RECEIVING) GetMessage() cache.Message { + return m.Message +} + +func NewMessageReceiving(message cache.Message) MessageEvent { + return &MESSAGE_RECEIVING{ + Message: message, + } +} + +type MESSAGE_RECEIVED struct { + Message cache.Message +} + +func (m *MESSAGE_RECEIVED) GetMessage() cache.Message { + return m.Message +} + +func NewMessageReceived(message cache.Message) MessageEvent { + return &MESSAGE_RECEIVED{ + Message: message, + } +} diff --git a/libgm/events/qr.go b/libgm/events/qr.go new file mode 100644 index 0000000..066cb53 --- /dev/null +++ b/libgm/events/qr.go @@ -0,0 +1,22 @@ +package events + +type QRCODE_UPDATED struct { + Image []byte + Height int + Width int + + googleUrl string +} + +func NewQrCodeUpdated(image []byte, height int, width int, googleUrl string) *QRCODE_UPDATED { + return &QRCODE_UPDATED{ + Image: image, + Height: height, + Width: width, + googleUrl: googleUrl, + } +} + +func (q *QRCODE_UPDATED) GetGoogleUrl() string { + return q.googleUrl +} \ No newline at end of file diff --git a/libgm/events/ready.go b/libgm/events/ready.go new file mode 100644 index 0000000..44c6197 --- /dev/null +++ b/libgm/events/ready.go @@ -0,0 +1,18 @@ +package events + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type CLIENT_READY struct { + Session *util.SessionResponse + Conversations []*binary.Conversation +} + +func NewClientReady(session *util.SessionResponse, conversationList *binary.Conversations) *CLIENT_READY { + return &CLIENT_READY{ + Session: session, + Conversations: conversationList.Conversations, + } +} diff --git a/libgm/events/useralerts.go b/libgm/events/useralerts.go new file mode 100644 index 0000000..14a24c3 --- /dev/null +++ b/libgm/events/useralerts.go @@ -0,0 +1,24 @@ +package events + + +type BROWSER_ACTIVE struct { + SessionId string +} + +func NewBrowserActive(sessionId string) *BROWSER_ACTIVE { + return &BROWSER_ACTIVE{ + SessionId: sessionId, + } +} + +type BATTERY struct {} + +func NewBattery() *BATTERY { + return &BATTERY{} +} + +type DATA_CONNECTION struct {} + +func NewDataConnection() *DATA_CONNECTION { + return &DATA_CONNECTION{} +} \ No newline at end of file diff --git a/libgm/handler_conversation.go b/libgm/handler_conversation.go new file mode 100644 index 0000000..924e517 --- /dev/null +++ b/libgm/handler_conversation.go @@ -0,0 +1,44 @@ +package textgapi + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/cache" + "go.mau.fi/mautrix-gmessages/libgm/events" +) + +func (c *Client) handleConversationEvent(response *Response, evtData *binary.Event_ConversationEvent) { + lastCacheConv, notExists := c.cache.Conversations.GetConversation(evtData.ConversationEvent.Data.ConversationId) + evtConv := evtData.ConversationEvent.Data + + //c.Logger.Debug().Any("convData", evtConv).Msg("Got conversation event!") + var eventData events.ConversationEvent + if evtConv.Status == 3 { + lastCacheConv.Delete() + eventData = events.NewConversationDeleted(lastCacheConv) + c.triggerEvent(eventData) + return + } + updatedCacheConv := c.cache.Conversations.UpdateConversation(evtConv) + eventData = c.getConversationEventInterface(lastCacheConv, updatedCacheConv, notExists) + if eventData == nil { + return + } + c.triggerEvent(eventData) +} + +func (c *Client) getConversationEventInterface(lastCacheConv *cache.Conversation, updatedCacheConv *cache.Conversation, notExists error) events.ConversationEvent { + var evt events.ConversationEvent + convStatus := updatedCacheConv.Status + + switch convStatus { + case 1: // unarchived + if lastCacheConv.Status != 1 { + evt = events.NewConversationUnarchived(updatedCacheConv) + } + case 2: // archived + evt = events.NewConversationArchived(updatedCacheConv) + case 3: // deleted + evt = events.NewConversationDeleted(updatedCacheConv) + } + return evt +} diff --git a/libgm/handler_message.go b/libgm/handler_message.go new file mode 100644 index 0000000..b4e7cd3 --- /dev/null +++ b/libgm/handler_message.go @@ -0,0 +1,57 @@ +package textgapi + +import ( + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/cache" + + //"github.com/0xzer/textgapi/cache" + "go.mau.fi/mautrix-gmessages/libgm/events" +) + +func (c *Client) handleMessageEvent(response *Response, evtData *binary.Event_MessageEvent) { + msgData := evtData.MessageEvent.Data + currConv, convNotFound := c.cache.Conversations.GetConversation(msgData.ConversationId) + if convNotFound != nil { + log.Fatal(convNotFound) + } + lastCacheMsg, errGetMsg := currConv.GetMessage(msgData.MessageId) + + updatedCacheMsg := currConv.UpdateMessage(msgData) + eventData := c.getMessageEventInterface(currConv, lastCacheMsg, errGetMsg, updatedCacheMsg) + if eventData == nil { + return + } + c.triggerEvent(eventData) +} + +func (c *Client) getMessageEventInterface(currConv *cache.Conversation, lastCacheMsg cache.Message, lastCacheErr error, evtMsg cache.Message) events.MessageEvent { + var evt events.MessageEvent + + msgStatusCode := evtMsg.MessageStatus.Code + fromMe := evtMsg.FromMe() + + switch msgStatusCode { + case 5: // sending + if lastCacheErr != nil { + if fromMe { + evt = events.NewMessageSending(evtMsg) + } else { + evt = events.NewMessageReceiving(evtMsg) + } + } + case 1: // sent + if lastCacheMsg.MessageStatus.Code != 1 { + if fromMe { + evt = events.NewMessageSent(evtMsg) + } else { + evt = events.NewMessageReceived(evtMsg) + } + } + default: + c.Logger.Debug().Any("data", evtMsg).Msg("Unknown msgstatus code") + } + + return evt +} diff --git a/libgm/handler_useralert.go b/libgm/handler_useralert.go new file mode 100644 index 0000000..c5eef2a --- /dev/null +++ b/libgm/handler_useralert.go @@ -0,0 +1,23 @@ +package textgapi + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/events" +) + +func (c *Client) handleUserAlertEvent(response *Response, evtData *binary.Event_UserAlertEvent) { + switch evtData.UserAlertEvent.AlertType { + case 2: + browserActive := events.NewBrowserActive(response.Data.RequestId) + c.triggerEvent(browserActive) + return + case 5, 6: + batteryEvt := events.NewBattery() + c.triggerEvent(batteryEvt) + return + case 3, 4: + dataConnectionEvt := events.NewDataConnection() + c.triggerEvent(dataConnectionEvt) + return + } +} diff --git a/libgm/image_builder.go b/libgm/image_builder.go new file mode 100644 index 0000000..2833490 --- /dev/null +++ b/libgm/image_builder.go @@ -0,0 +1,171 @@ +package textgapi + +import ( + "fmt" + "os" + + validator "github.com/gabriel-vasile/mimetype" + + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type ImageType struct { + Extension string + Format string + Type int64 +} + +var ImageTypes = map[string]ImageType{ + "image/jpeg": {Extension: "jpeg", Format: "image/jpeg", Type: 1}, + "image/jpg": {Extension: "jpg", Format: "image/jpg", Type: 2}, + "image/png": {Extension: "png", Format: "image/png", Type: 3}, + "image/gif": {Extension: "gif", Format: "image/gif", Type: 4}, + "image/wbmp": {Extension: "wbmp", Format: "image/wbmp", Type: 5}, + "image/bmp": {Extension: "bmp", Format: "image/bmp", Type: 6}, + "image/x-ms-bmp": {Extension: "bmp", Format: "image/x-ms-bmp", Type: 6}, + "audio/aac": {Extension: "aac", Format: "audio/aac", Type: 14}, + "audio/amr": {Extension: "amr", Format: "audio/amr", Type: 15}, + "audio/mp3": {Extension: "mp3", Format: "audio/mp3", Type: 16}, + "audio/mpeg": {Extension: "mpeg", Format: "audio/mpeg", Type: 17}, + "audio/mpg": {Extension: "mpg", Format: "audio/mpg", Type: 18}, + "audio/mp4": {Extension: "mp4", Format: "audio/mp4", Type: 19}, + "audio/mp4-latm": {Extension: "latm", Format: "audio/mp4-latm", Type: 20}, + "audio/3gpp": {Extension: "3gpp", Format: "audio/3gpp", Type: 21}, + "audio/ogg": {Extension: "ogg", Format: "audio/ogg", Type: 22}, + "video/mp4": {Extension: "mp4", Format: "video/mp4", Type: 8}, + "video/3gpp2": {Extension: "3gpp2", Format: "video/3gpp2", Type: 9}, + "video/3gpp": {Extension: "3gpp", Format: "video/3gpp", Type: 10}, + "video/webm": {Extension: "webm", Format: "video/webm", Type: 11}, + "video/x-matroska": {Extension: "mkv", Format: "video/x-matroska", Type: 12}, + "application/pdf": {Extension: "pdf", Format: "application/pdf", Type: 25}, + "application/txt": {Extension: "txt", Format: "application/txt", Type: 26}, + "application/html": {Extension: "html", Format: "application/html", Type: 27}, + "application/msword": {Extension: "doc", Format: "application/msword", Type: 28}, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {Extension: "docx", Format: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", Type: 29}, + "application/vnd.openxmlformats-officedocument.presentationml.presentation": {Extension: "pptx", Format: "application/vnd.openxmlformats-officedocument.presentationml.presentation", Type: 30}, + "application/vnd.ms-powerpoint": {Extension: "ppt", Format: "application/vnd.ms-powerpoint", Type: 31}, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {Extension: "xlsx", Format: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", Type: 32}, + "application/vnd.ms-excel": {Extension: "xls", Format: "application/vnd.ms-excel", Type: 33}, + "application/vnd.android.package-archive": {Extension: "apk", Format: "application/vnd.android.package-archive", Type: 34}, + "application/zip": {Extension: "zip", Format: "application/zip", Type: 35}, + "application/java-archive": {Extension: "jar", Format: "application/java-archive", Type: 36}, + "text/x-vCalendar": {Extension: "vcs", Format: "text/x-vCalendar", Type: 38}, + "text/x-vcalendar": {Extension: "ics", Format: "text/x-vcalendar", Type: 39}, + "text/calendar": {Extension: "ics", Format: "text/calendar", Type: 40}, + "application/vcs": {Extension: "vcs", Format: "application/vcs", Type: 41}, + "application/ics": {Extension: "ics", Format: "application/ics", Type: 42}, + "application/hbs-vcs": {Extension: "vcs", Format: "application/hbs-vcs", Type: 43}, + "text/vcard": {Extension: "vcard", Format: "text/vcard", Type: 24}, + "text/x-vcard": {Extension: "vcard", Format: "text/x-vcard", Type: 24}, +} + +type Image struct { + imageCryptor *crypto.ImageCryptor + + imageName string + imageId string + imageType ImageType + imageBytes []byte + imageSize int64 +} + +func (i *Image) GetEncryptedBytes() ([]byte, error) { + encryptedBytes, encryptErr := i.imageCryptor.EncryptData(i.imageBytes) + if encryptErr != nil { + return nil, encryptErr + } + return encryptedBytes, nil +} + +func (i *Image) GetImageCryptor() *crypto.ImageCryptor { + return i.imageCryptor +} + +func (i *Image) GetImageName() string { + return i.imageName +} + +func (i *Image) GetImageBytes() []byte { + return i.imageBytes +} + +func (i *Image) GetImageSize() int64 { + return i.imageSize +} + +func (i *Image) GetImageType() ImageType { + return i.imageType +} + +func (i *Image) GetImageId() string { + return i.imageId +} + +func (mb *MessageBuilder) AddImageFromPath(filePath string) *MessageBuilder { + if mb.err != nil { + return mb + } + file, err := os.ReadFile(filePath) + if err != nil { + mb.err = err + return mb + } + return mb.AddImage(file) +} + +// This is the equivalent of dragging an image into the window on messages web +// +// Keep in mind that adding an image to a MessageBuilder will also upload the image to googles server +func (mb *MessageBuilder) AddImage(imgBytes []byte) *MessageBuilder { + if mb.err != nil { + return mb + } + + newImage, newImageErr := mb.newImageData(imgBytes) + if newImageErr != nil { + mb.err = newImageErr + return mb + } + + startUploadImage, failedUpload := mb.client.StartUploadMedia(newImage) + if failedUpload != nil { + mb.err = failedUpload + return mb + } + + finalizedImage, failedFinalize := mb.client.FinalizeUploadMedia(startUploadImage) + if failedFinalize != nil { + mb.err = failedFinalize + return mb + } + + mb.images = append(mb.images, finalizedImage) + return mb +} + +func (mb *MessageBuilder) newImageData(imgBytes []byte) (*Image, error) { + imgFormat := validator.Detect(imgBytes) + if imgFormat.String() == "text/plain" { + return nil, fmt.Errorf("could not validate media content-type: received %s", imgFormat.String()) + } + imgType := ImageTypes[imgFormat.String()] + imageId := util.GenerateImageId() + imageName := util.RandStr(8) + "." + imgType.Extension + decryptionKey, err := crypto.GenerateKey(32) + if err != nil { + return nil, err + } + imageCryptor, cryptorErr := crypto.NewImageCryptor(decryptionKey) + if cryptorErr != nil { + return nil, cryptorErr + } + return &Image{ + imageCryptor: imageCryptor, + imageId: imageId, + imageBytes: imgBytes, + imageType: imgType, + imageSize: int64(len(imgBytes)), + imageName: imageName, + }, nil +} diff --git a/libgm/instructions.go b/libgm/instructions.go new file mode 100644 index 0000000..4057abc --- /dev/null +++ b/libgm/instructions.go @@ -0,0 +1,78 @@ +package textgapi + +import ( + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" +) + +const ( + ROUTING_OPCODE = 19 + MSG_TYPE_TWO = 2 + MSG_TYPE_SIXTEEN = 16 + + /* + Session + */ + PREPARE_NEW_SESSION_OPCODE = 31 + NEW_SESSION_OPCODE = 16 + + /* + Conversation + */ + LIST_CONVERSATIONS = 1 + SET_ACTIVE_CONVERSATION = 22 + OPEN_CONVERSATION = 21 + FETCH_MESSAGES_CONVERSATION = 2 + SEND_TEXT_MESSAGE = 3 +) + +type Instruction struct { + cryptor *crypto.Cryptor + RoutingOpCode int64 + Opcode int64 + MsgType int64 + EncryptedData []byte + DecryptedProtoMessage proto.Message + ExpectedResponses int64 // count expected responses + ProcessResponses func(responses []*Response) (interface{}, error) // function that decodes & decrypts the slice into appropriate response +} + +func (c *Client) EncryptPayloadData(message protoreflect.Message) ([]byte, error) { + protoBytes, err1 := binary.EncodeProtoMessage(message.Interface()) + if err1 != nil { + return nil, err1 + } + encryptedBytes, err := c.cryptor.Encrypt(protoBytes) + if err != nil { + return nil, err + } + return encryptedBytes, nil +} + +type Instructions struct { + data map[int64]*Instruction +} + +func NewInstructions(cryptor *crypto.Cryptor) *Instructions { + return &Instructions{ + data: map[int64]*Instruction{ + PREPARE_NEW_SESSION_OPCODE: {cryptor, ROUTING_OPCODE, PREPARE_NEW_SESSION_OPCODE, MSG_TYPE_TWO, nil, &binary.PrepareNewSession{}, 1, nil}, + NEW_SESSION_OPCODE: {cryptor, ROUTING_OPCODE, NEW_SESSION_OPCODE, MSG_TYPE_TWO, nil, &binary.NewSession{}, 2, nil}, // create new session + LIST_CONVERSATIONS: {cryptor, ROUTING_OPCODE, LIST_CONVERSATIONS, MSG_TYPE_SIXTEEN, nil, &binary.Conversations{}, 1, nil}, // list conversations + + //22: {cryptor,19,22,2,nil,nil}, // SET ACTIVE SESSION WINDOW + OPEN_CONVERSATION: {cryptor, ROUTING_OPCODE, OPEN_CONVERSATION, MSG_TYPE_TWO, nil, nil, 2, nil}, // open conversation + FETCH_MESSAGES_CONVERSATION: {cryptor, ROUTING_OPCODE, FETCH_MESSAGES_CONVERSATION, MSG_TYPE_TWO, nil, &binary.FetchMessagesResponse{}, 1, nil}, // fetch messages in convo + SEND_TEXT_MESSAGE: {cryptor, ROUTING_OPCODE, SEND_TEXT_MESSAGE, MSG_TYPE_TWO, nil, &binary.SendMessageResponse{}, 1, nil}, + //3: {cryptor,19,3,2,nil,&binary.SendMessageResponse{}}, // send text message + }, + } +} + +func (i *Instructions) GetInstruction(key int64) (*Instruction, bool) { + instruction, ok := i.data[key] + return instruction, ok +} diff --git a/libgm/json_proto/deseralize.go b/libgm/json_proto/deseralize.go new file mode 100644 index 0000000..61b7368 --- /dev/null +++ b/libgm/json_proto/deseralize.go @@ -0,0 +1,53 @@ +package json_proto + +import ( + "fmt" + + "google.golang.org/protobuf/reflect/protoreflect" +) + +func Deserialize(data []interface{}, m protoreflect.Message) error { + for i := 0; i < m.Descriptor().Fields().Len(); i++ { + fieldDescriptor := m.Descriptor().Fields().Get(i) + index := int(fieldDescriptor.Number()) - 1 + if index < 0 || index >= len(data) || data[index] == nil { + continue + } + + val := data[index] + + switch fieldDescriptor.Kind() { + case protoreflect.MessageKind: + nestedData, ok := val.([]interface{}) + if !ok { + return fmt.Errorf("expected slice, got %T", val) + } + nestedMessage := m.NewField(fieldDescriptor).Message() + if err := Deserialize(nestedData, nestedMessage); err != nil { + return err + } + m.Set(fieldDescriptor, protoreflect.ValueOfMessage(nestedMessage)) + case protoreflect.BytesKind: + bytes, ok := val.([]byte) + if !ok { + return fmt.Errorf("expected bytes, got %T", val) + } + m.Set(fieldDescriptor, protoreflect.ValueOfBytes(bytes)) + case protoreflect.Int32Kind, protoreflect.Int64Kind: + num, ok := val.(float64) + if !ok { + return fmt.Errorf("expected number, got %T", val) + } + m.Set(fieldDescriptor, protoreflect.ValueOf(int64(num))) + case protoreflect.StringKind: + str, ok := val.(string) + if !ok { + return fmt.Errorf("expected string, got %T", val) + } + m.Set(fieldDescriptor, protoreflect.ValueOf(str)) + default: + // ignore fields of other types + } + } + return nil +} diff --git a/libgm/json_proto/serialize.go b/libgm/json_proto/serialize.go new file mode 100644 index 0000000..d39c550 --- /dev/null +++ b/libgm/json_proto/serialize.go @@ -0,0 +1,100 @@ +package json_proto + +/* +in protobuf, a message looks like this: + +message SomeMessage { + string stringField1 = 1; + int64 intField = 6; + bytes byteField = 9; +} + +but when this function is done serializing this protobuf message into a slice, it should look something like this: + +[ + "someString", + nil, + nil, + nil, + nil, + 6, + nil, + nil, + "\x9\x91\x942" +] + +Any integer should be translated into int64, it doesn't matter if it's defined as int32 in the proto schema. +In the finished serialized slice it should be int64. +Let's also take in count where there is a message nested inside a message: +message SomeMessage { + string stringField1 = 1; + NestedMessage1 nestedMessage1 = 2; + int64 intField = 6; + bytes byteField = 9; +} + +message NestedMessage1 { + string msg1 = 1; +} + +Then the serialized output would be: +[ + "someString", + ["msg1FieldValue"], + nil, + nil, + nil, + 6, + nil, + nil, + "\x9\x91\x942" +] +This means that any slice inside of the current slice, indicates another message nested inside of it. +*/ + +import ( + "google.golang.org/protobuf/reflect/protoreflect" +) + +func Serialize(m protoreflect.Message) ([]interface{}, error) { + maxFieldNumber := 0 + for i := 0; i < m.Descriptor().Fields().Len(); i++ { + fieldNumber := int(m.Descriptor().Fields().Get(i).Number()) + if fieldNumber > maxFieldNumber { + maxFieldNumber = fieldNumber + } + } + + serialized := make([]interface{}, maxFieldNumber) + for i := 0; i < m.Descriptor().Fields().Len(); i++ { + fieldDescriptor := m.Descriptor().Fields().Get(i) + fieldValue := m.Get(fieldDescriptor) + fieldNumber := int(fieldDescriptor.Number()) + switch fieldDescriptor.Kind() { + case protoreflect.MessageKind: + if m.Has(fieldDescriptor) { + serializedMsg, err := Serialize(fieldValue.Message().Interface().ProtoReflect()) + if err != nil { + return nil, err + } + serialized[fieldNumber-1] = serializedMsg + } + case protoreflect.BytesKind: + if m.Has(fieldDescriptor) { + serialized[fieldNumber-1] = fieldValue.Bytes() + } + case protoreflect.Int32Kind, protoreflect.Int64Kind: + if m.Has(fieldDescriptor) { + serialized[fieldNumber-1] = fieldValue.Int() + } + case protoreflect.StringKind: + if m.Has(fieldDescriptor) { + serialized[fieldNumber-1] = fieldValue.String() + } + default: + // ignore fields of other types + } + } + + return serialized, nil +} \ No newline at end of file diff --git a/libgm/media_processor.go b/libgm/media_processor.go new file mode 100644 index 0000000..7e4eafc --- /dev/null +++ b/libgm/media_processor.go @@ -0,0 +1,166 @@ +package textgapi + +import ( + "bytes" + "errors" + "io" + "log" + "net/http" + "strconv" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type StartGoogleUpload struct { + UploadId string + UploadUrl string + UploadStatus string + ChunkGranularity int64 + ControlUrl string + + Image *Image + EncryptedMediaBytes []byte +} + +type MediaUpload struct { + MediaId string + MediaNumber int64 + Image *Image +} + +var ( + errStartUploadMedia = errors.New("failed to start uploading media") + errFinalizeUploadMedia = errors.New("failed to finalize uploading media") +) + +func (c *Client) FinalizeUploadMedia(upload *StartGoogleUpload) (*MediaUpload, error) { + imageType := upload.Image.GetImageType() + encryptedImageSize := strconv.Itoa(len(upload.EncryptedMediaBytes)) + + log.Println("EncryptedImageSize:", encryptedImageSize) + finalizeUploadHeaders := util.NewMediaUploadHeaders(encryptedImageSize, "upload, finalize", "0", imageType.Format, "") + req, reqErr := http.NewRequest("POST", upload.UploadUrl, bytes.NewBuffer(upload.EncryptedMediaBytes)) + if reqErr != nil { + return nil, reqErr + } + + req.Header = *finalizeUploadHeaders + + res, resErr := c.http.Do(req) + if resErr != nil { + log.Fatal(resErr) + } + + statusCode := res.StatusCode + if statusCode != 200 { + return nil, errFinalizeUploadMedia + } + + defer res.Body.Close() + + rHeaders := res.Header + googleResponse, err3 := io.ReadAll(res.Body) + if err3 != nil { + return nil, err3 + } + + uploadStatus := rHeaders.Get("x-goog-upload-status") + log.Println("Upload Status: ", uploadStatus) + + mediaIds := &binary.UploadMediaResponse{} + err3 = crypto.DecodeAndEncodeB64(string(googleResponse), mediaIds) + if err3 != nil { + return nil, err3 + } + return &MediaUpload{ + MediaId: mediaIds.Media.MediaId, + MediaNumber: mediaIds.Media.MediaNumber, + Image: upload.Image, + }, nil +} + +func (c *Client) StartUploadMedia(image *Image) (*StartGoogleUpload, error) { + imageType := image.GetImageType() + + encryptedImageBytes, encryptErr := image.GetEncryptedBytes() + if encryptErr != nil { + return nil, encryptErr + } + encryptedImageSize := strconv.Itoa(len(encryptedImageBytes)) + + startUploadHeaders := util.NewMediaUploadHeaders(encryptedImageSize, "start", "", imageType.Format, "resumable") + startUploadPayload, buildPayloadErr := c.buildStartUploadPayload() + if buildPayloadErr != nil { + return nil, buildPayloadErr + } + + req, reqErr := http.NewRequest("POST", util.UPLOAD_MEDIA, bytes.NewBuffer([]byte(startUploadPayload))) + if reqErr != nil { + return nil, reqErr + } + + req.Header = *startUploadHeaders + + res, resErr := c.http.Do(req) + if resErr != nil { + log.Fatal(resErr) + } + + statusCode := res.StatusCode + if statusCode != 200 { + return nil, errStartUploadMedia + } + + rHeaders := res.Header + + chunkGranularity, convertErr := strconv.Atoi(rHeaders.Get("x-goog-upload-chunk-granularity")) + if convertErr != nil { + return nil, convertErr + } + + uploadResponse := &StartGoogleUpload{ + UploadId: rHeaders.Get("x-guploader-uploadid"), + UploadUrl: rHeaders.Get("x-goog-upload-url"), + UploadStatus: rHeaders.Get("x-goog-upload-status"), + ChunkGranularity: int64(chunkGranularity), + ControlUrl: rHeaders.Get("x-goog-upload-control-url"), + + Image: image, + EncryptedMediaBytes: encryptedImageBytes, + } + return uploadResponse, nil +} + +func (c *Client) buildStartUploadPayload() (string, error) { + + decodedRpcKey, err := crypto.Base64DecodeStandard(c.rpcKey) + if err != nil { + return "", err + } + + requestId := util.RandomUUIDv4() + protoData := &binary.StartMediaUploadPayload{ + ImageType: 1, + AuthData: &binary.AuthMessageBytes{ + RequestId: requestId, + RpcKey: decodedRpcKey, + Date: &binary.Date{ + Year: 2023, + Seq1: 6, + Seq2: 8, + Seq3: 4, + Seq4: 6, + }, + }, + Mobile: c.devicePair.Mobile, + } + + protoDataEncoded, protoEncodeErr := crypto.EncodeProtoB64(protoData) + if protoEncodeErr != nil { + return "", protoEncodeErr + } + + return protoDataEncoded, nil +} diff --git a/libgm/message_builder.go b/libgm/message_builder.go new file mode 100644 index 0000000..9adf59f --- /dev/null +++ b/libgm/message_builder.go @@ -0,0 +1,174 @@ +package textgapi + +import ( + "errors" + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +var ( + errContentNotSet = errors.New("failed to build MessageBuilder: content must be larger than length 0") + errConversationIdNotSet = errors.New("failed to build MessageBuilder: conversationId is empty") + errSelfParticipantIdNotSet = errors.New("failed to build MessageBuilder: selfParticipantId is empty") +) + +type MessageBuilder struct { + client *Client + + content string + conversationId string + tmpId string + selfParticipantId string + + images []*MediaUpload + + err error +} + +// Add this method to retrieve the stored error +func (mb *MessageBuilder) Err() error { + return mb.err +} + +func (mb *MessageBuilder) GetImages() []*MediaUpload { + return mb.images +} + +func (mb *MessageBuilder) GetContent() string { + return mb.content +} + +func (mb *MessageBuilder) SetContent(content string) *MessageBuilder { + mb.content = content + return mb +} + +func (mb *MessageBuilder) GetConversationId() string { + return mb.conversationId +} + +func (mb *MessageBuilder) SetConversationId(conversationId string) *MessageBuilder { + mb.conversationId = conversationId + return mb +} + +func (mb *MessageBuilder) GetSelfParticipantId() string { + return mb.selfParticipantId +} + +// sendmessage function will set this automatically but if u want to set it yourself feel free +func (mb *MessageBuilder) SetSelfParticipantId(participantId string) *MessageBuilder { + mb.selfParticipantId = participantId + return mb +} + +func (mb *MessageBuilder) GetTmpId() string { + return mb.tmpId +} + +// sendmessage function will set this automatically but if u want to set it yourself feel free +func (mb *MessageBuilder) SetTmpId(tmpId string) *MessageBuilder { + mb.tmpId = tmpId + return mb +} + +func (mb *MessageBuilder) Build() (*binary.SendMessagePayload, error) { + + if mb.conversationId == "" { + return nil, errConversationIdNotSet + } + + if mb.selfParticipantId == "" { + return nil, errSelfParticipantIdNotSet + } + + if mb.content == "" { + return nil, errContentNotSet + } + + if mb.tmpId == "" { + mb.tmpId = util.GenerateTmpId() + } + + return mb.newSendConversationMessage(), nil +} + +func (c *Client) NewMessageBuilder() *MessageBuilder { + mb := &MessageBuilder{ + client: c, + } + + tmpId := util.GenerateTmpId() + mb.SetTmpId(tmpId) + + return mb +} + +func (mb *MessageBuilder) newSendConversationMessage() *binary.SendMessagePayload { + + convId := mb.GetConversationId() + content := mb.GetContent() + selfParticipantId := mb.GetSelfParticipantId() + tmpId := mb.GetTmpId() + + messageInfo := make([]*binary.MessageInfo, 0) + messageInfo = append(messageInfo, &binary.MessageInfo{Data: &binary.MessageInfo_MessageContent{ + MessageContent: &binary.MessageContent{ + Content: content, + }, + }}) + + mb.appendImagesPayload(&messageInfo) + + sendMsgPayload := &binary.SendMessagePayload{ + ConversationId: convId, + MessagePayload: &binary.MessagePayload{ + TmpId: tmpId, + ConversationId: convId, + SelfParticipantId: selfParticipantId, + MessageInfo: messageInfo, + TmpId2: tmpId, + }, + TmpId: tmpId, + } + if len(content) > 0 { + sendMsgPayload.MessagePayload.MessagePayloadContent = &binary.MessagePayloadContent{ + MessageContent: &binary.MessageContent{ + Content: content, + }, + } + } + mb.client.Logger.Debug().Any("sendMsgPayload", sendMsgPayload).Msg("sendMessagePayload") + + return sendMsgPayload +} + +func (mb *MessageBuilder) appendImagesPayload(messageInfo *[]*binary.MessageInfo) { + if len(mb.images) <= 0 { + log.Println("0 images to append, ignoring") + return + } + + for _, media := range mb.images { + imgData := mb.newImageContent(media) + *messageInfo = append(*messageInfo, imgData) + } +} + +func (mb *MessageBuilder) newImageContent(media *MediaUpload) *binary.MessageInfo { + imageMessage := &binary.MessageInfo{ + Data: &binary.MessageInfo_ImageContent{ + ImageContent: &binary.ImageContent{ + SomeNumber: media.Image.GetImageType().Type, + ImageId: media.MediaId, + ImageName: media.Image.GetImageName(), + Size: media.Image.GetImageSize(), + DecryptionKey: media.Image.GetImageCryptor().GetKey(), + }, + }, + } + mb.client.Logger.Debug().Any("imageMessage", imageMessage).Msg("New Image Content") + return imageMessage +} diff --git a/libgm/misc.go b/libgm/misc.go new file mode 100644 index 0000000..de93f9c --- /dev/null +++ b/libgm/misc.go @@ -0,0 +1,25 @@ +package textgapi + +import ( + "log" + "os" + + "go.mau.fi/mautrix-gmessages/libgm/builders" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type Misc struct { + client *Client +} + +func (m *Misc) TenorSearch(searchOpts *builders.TenorSearch) (interface{}, error) { + searchQuery, buildErr := searchOpts.Build() + if buildErr != nil { + return nil, buildErr + } + + uri := util.TENOR_SEARCH_GIF + searchQuery + log.Println(uri) + os.Exit(1) + return nil, nil +} diff --git a/libgm/msg_handler.go b/libgm/msg_handler.go new file mode 100644 index 0000000..3351a33 --- /dev/null +++ b/libgm/msg_handler.go @@ -0,0 +1,71 @@ +package textgapi + +import ( + "encoding/json" + "fmt" + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/json_proto" +) + +func (r *RPC) HandleRPCMsg(msgArr []interface{}) { + /* + if data[0] == 44 { // ',' + data = data[1:] + } + + var msgArr []interface{} + err := r.tryUnmarshalJSON(data, &msgArr) + if err != nil { + r.client.Logger.Error().Err(fmt.Errorf("got invalid json string %s", string(data))).Msg("rpc msg err") + r.HandleByLength(data) + return + } + */ + response := &binary.RPCResponse{} + deserializeErr := json_proto.Deserialize(msgArr, response.ProtoReflect()) + if deserializeErr != nil { + r.client.Logger.Error().Err(fmt.Errorf("failed to deserialize response %s", msgArr)).Msg("rpc deserialize msg err") + return + } + //r.client.Logger.Debug().Any("byteLength", len(data)).Any("unmarshaled", response).Any("raw", string(data)).Msg("RPC Msg") + if response.Data == nil { + r.client.Logger.Error().Err(fmt.Errorf("Response data was nil %s", msgArr)).Msg("rpc msg data err") + return + } + if response.Data.RoutingOpCode == 19 { + parsedResponse, failedParse := r.client.sessionHandler.NewResponse(response) + if failedParse != nil { + log.Fatal(failedParse) + } + //hasBody := parsedResponse.Data.EncryptedData == nil + //r.client.Logger.Info().Any("msgData", parsedResponse).Msg("Got event!") + r.client.sessionHandler.addResponseAck(parsedResponse.ResponseId) + _, waitingForResponse := r.client.sessionHandler.requests[parsedResponse.Data.RequestId] + //log.Println(fmt.Sprintf("%v %v %v %v %v %v %v", parsedResponse.RoutingOpCode, parsedResponse.Data.Opcode, parsedResponse.Data.Sub, parsedResponse.Data.Third, parsedResponse.Data.Field9, hasBody, waitingForResponse)) + //r.client.Logger.Debug().Any("waitingForResponse?", waitingForResponse).Msg("Got rpc response from server") + if parsedResponse.Data.Opcode == 16 || waitingForResponse { + if waitingForResponse { + r.client.sessionHandler.respondToRequestChannel(parsedResponse) + return + } + if parsedResponse.Data.Opcode == 16 { + r.client.handleEventOpCode(parsedResponse) + } + } else { + + } + } else { + r.client.handleSeperateOpCode(response.Data) + } +} + +func (r *RPC) tryUnmarshalJSON(jsonData []byte, msgArr *[]interface{}) error { + err := json.Unmarshal(jsonData, &msgArr) + return err +} + +func (r *RPC) HandleByLength(data []byte) { + r.client.Logger.Debug().Any("byteLength", len(data)).Any("corrupt raw", string(data)).Msg("RPC Corrupt json") +} diff --git a/libgm/opcode_handler.go b/libgm/opcode_handler.go new file mode 100644 index 0000000..99e94d8 --- /dev/null +++ b/libgm/opcode_handler.go @@ -0,0 +1,39 @@ +package textgapi + +import ( + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" +) + +func (c *Client) handleSeperateOpCode(msgData *binary.MessageData) { + decodedBytes, err := crypto.Base64DecodeStandard(msgData.EncodedData) + if err != nil { + log.Fatal(err) + } + switch msgData.RoutingOpCode { + case 14: // paired successful + decodedData := &binary.Container{} + err = binary.DecodeProtoMessage(decodedBytes, decodedData) + if err != nil { + log.Fatal(err) + } + c.Logger.Debug().Any("data", decodedData).Msg("Paired device decoded data") + c.pairer.pairCallback(decodedData) + default: + decodedData := &binary.EncodedResponse{} + err = binary.DecodeProtoMessage(decodedBytes, decodedData) + if err != nil { + log.Fatal(err) + } + if (decodedData.Sub && decodedData.Third != 0) && decodedData.EncryptedData != nil { + bugleData := &binary.BugleBackendService{} + err = c.cryptor.DecryptAndDecodeData(decodedData.EncryptedData, bugleData) + if err != nil { + log.Fatal(err) + } + c.handleBugleOpCode(bugleData) + } + } +} diff --git a/libgm/pair.go b/libgm/pair.go new file mode 100644 index 0000000..999992b --- /dev/null +++ b/libgm/pair.go @@ -0,0 +1,161 @@ +package textgapi + +import ( + "io" + "log" + "time" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/payload" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type Pairer struct { + client *Client + KeyData *crypto.JWK + ticker *time.Ticker + tickerTime time.Duration + qrCodePx int + pairingKey []byte +} + +/* +refreshQrCodeTime is the interval to refresh the qr code in seconds, this is usually 20 seconds. +*/ +func (c *Client) NewPairer(keyData *crypto.JWK, refreshQrCodeTime int) (*Pairer, error) { + if keyData == nil { + var err error + keyData, err = crypto.GenerateECDSA_P256_JWK() + if err != nil { + c.Logger.Error().Any("data", keyData).Msg(err.Error()) + return nil, err + } + } + p := &Pairer{ + client: c, + KeyData: keyData, + qrCodePx: 214, + tickerTime: time.Duration(refreshQrCodeTime) * time.Second, + } + c.pairer = p + return p, nil +} + +func (p *Pairer) SetQRCodePx(pixels int) { + p.qrCodePx = pixels +} + +func (p *Pairer) RegisterPhoneRelay() (*binary.RegisterPhoneRelayResponse, error) { + body, _, err := payload.RegisterPhoneRelay(p.KeyData) + if err != nil { + p.client.Logger.Err(err) + return &binary.RegisterPhoneRelayResponse{}, err + } + //p.client.Logger.Debug().Any("keyByteLength", len(jsonPayload.EcdsaKeysContainer.EcdsaKeys.EncryptedKeys)).Any("json", jsonPayload).Any("base64", body).Msg("RegisterPhoneRelay Payload") + relayResponse, reqErr := p.client.MakeRelayRequest(util.REGISTER_PHONE_RELAY, body) + if reqErr != nil { + p.client.Logger.Err(reqErr) + return nil, err + } + responseBody, err2 := io.ReadAll(relayResponse.Body) + if err2 != nil { + return nil, err2 + } + relayResponse.Body.Close() + res := &binary.RegisterPhoneRelayResponse{} + err3 := binary.DecodeProtoMessage(responseBody, res) + if err3 != nil { + return nil, err3 + } + p.pairingKey = res.GetPairingKey() + qrCode, qrErr := p.GenerateQRCode(p.qrCodePx) + if qrErr != nil { + return nil, qrErr + } + p.client.triggerEvent(qrCode) + p.startRefreshRelayTask() + return res, err +} + +func (p *Pairer) startRefreshRelayTask() { + if p.ticker != nil { + p.ticker.Stop() + } + ticker := time.NewTicker(30 * time.Second) + p.ticker = ticker + go func() { + for range ticker.C { + p.RefreshPhoneRelay() + } + }() +} + +func (p *Pairer) RefreshPhoneRelay() { + body, _, err := payload.RefreshPhoneRelay(p.client.rpcKey) + if err != nil { + p.client.Logger.Err(err).Msg("refresh phone relay err") + return + } + //p.client.Logger.Debug().Any("keyByteLength", len(jsonPayload.PhoneRelay.RpcKey)).Any("json", jsonPayload).Any("base64", body).Msg("RefreshPhoneRelay Payload") + relayResponse, reqErr := p.client.MakeRelayRequest(util.REFRESH_PHONE_RELAY, body) + if reqErr != nil { + p.client.Logger.Err(reqErr).Msg("refresh phone relay err") + } + responseBody, err2 := io.ReadAll(relayResponse.Body) + defer relayResponse.Body.Close() + if err2 != nil { + p.client.Logger.Err(err2).Msg("refresh phone relay err") + } + p.client.Logger.Debug().Any("responseLength", len(responseBody)).Msg("Response Body Length") + res := &binary.RefreshPhoneRelayResponse{} + err3 := binary.DecodeProtoMessage(responseBody, res) + if err3 != nil { + p.client.Logger.Err(err3) + } + p.pairingKey = res.GetPairKey() + p.client.Logger.Debug().Any("res", res).Msg("RefreshPhoneRelayResponse") + qrCode, qrErr := p.GenerateQRCode(p.qrCodePx) + if qrErr != nil { + log.Fatal(qrErr) + } + p.client.triggerEvent(qrCode) +} + +func (p *Pairer) GetWebEncryptionKey() { + body, _, err2 := payload.GetWebEncryptionKey(p.client.rpc.webAuthKey) + if err2 != nil { + p.client.Logger.Err(err2).Msg("web encryption key err") + return + } + //p.client.Logger.Debug().Any("keyByteLength", len(rawData.PhoneRelay.RpcKey)).Any("json", rawData).Any("base64", body).Msg("GetWebEncryptionKey Payload") + webKeyResponse, reqErr := p.client.MakeRelayRequest(util.GET_WEB_ENCRYPTION_KEY, body) + if reqErr != nil { + p.client.Logger.Err(reqErr).Msg("Web encryption key request err") + } + responseBody, err2 := io.ReadAll(webKeyResponse.Body) + defer webKeyResponse.Body.Close() + if err2 != nil { + p.client.Logger.Err(err2).Msg("Web encryption key read response err") + return + } + //p.client.Logger.Debug().Any("responseLength", len(responseBody)).Any("raw", responseBody).Msg("Response Body Length") + parsedResponse := &binary.WebEncryptionKeyResponse{} + err2 = binary.DecodeProtoMessage(responseBody, parsedResponse) + if err2 != nil { + p.client.Logger.Err(err2).Msg("Parse webkeyresponse into proto struct error") + } + key := crypto.EncodeBase64Standard(p.client.rpc.webAuthKey) + p.ticker.Stop() + reconnectErr := p.client.Reconnect(key) + if reconnectErr != nil { + log.Fatal(reconnectErr) + } +} + +func (p *Pairer) pairCallback(pairData *binary.Container) { + p.client.rpc.webAuthKey = pairData.PairDeviceData.WebAuthKeyData.WebAuthKey + p.client.ttl = pairData.PairDeviceData.WebAuthKeyData.ValidFor + p.client.devicePair = &DevicePair{Mobile: pairData.PairDeviceData.Mobile, Browser: pairData.PairDeviceData.Browser} + p.client.pairer.GetWebEncryptionKey() +} diff --git a/libgm/payload/conversations.go b/libgm/payload/conversations.go new file mode 100644 index 0000000..702bc0d --- /dev/null +++ b/libgm/payload/conversations.go @@ -0,0 +1 @@ +package payload \ No newline at end of file diff --git a/libgm/payload/getWebEncryptionKey.go b/libgm/payload/getWebEncryptionKey.go new file mode 100644 index 0000000..59aed77 --- /dev/null +++ b/libgm/payload/getWebEncryptionKey.go @@ -0,0 +1,31 @@ +package payload + +import ( + "log" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +func GetWebEncryptionKey(WebPairKey []byte) ([]byte, *binary.Container, error) { + log.Println(WebPairKey) + id := util.RandomUUIDv4() + payload := &binary.Container{ + PhoneRelay: &binary.PhoneRelayBody{ + Id: id, + RpcKey: WebPairKey, + Date: &binary.Date{ + Year: 2023, + Seq1: 6, + Seq2: 8, + Seq3: 4, + Seq4: 6, + }, + }, + } + encodedPayload, err2 := binary.EncodeProtoMessage(payload) + if err2 != nil { + return nil, payload, err2 + } + return encodedPayload, payload, nil +} diff --git a/libgm/payload/receiveMessages.go b/libgm/payload/receiveMessages.go new file mode 100644 index 0000000..3eed090 --- /dev/null +++ b/libgm/payload/receiveMessages.go @@ -0,0 +1,44 @@ +package payload + +import ( + "encoding/json" + + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +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, + }, + }, + nil, + nil, + []interface{}{ + nil, + []interface{}{}, + }, + } + + jsonData, err := json.Marshal(data) + if err != nil { + return nil, "", err + } + return jsonData, id, nil +} diff --git a/libgm/payload/refreshPhoneRelay.go b/libgm/payload/refreshPhoneRelay.go new file mode 100644 index 0000000..10e1af8 --- /dev/null +++ b/libgm/payload/refreshPhoneRelay.go @@ -0,0 +1,33 @@ +package payload + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +func RefreshPhoneRelay(rpcKey string) ([]byte, *binary.Container, error) { + decodedRpcKey, err1 := crypto.Base64DecodeStandard(rpcKey) + if err1 != nil { + return nil, nil, err1 + } + payload := &binary.Container{ + PhoneRelay: &binary.PhoneRelayBody{ + Id: util.RandomUUIDv4(), + Bugle: "Bugle", + RpcKey: decodedRpcKey, + Date: &binary.Date{ + Year: 2023, + Seq1: 6, + Seq2: 8, + Seq3: 4, + Seq4: 6, + }, + }, + } + encodedPayload, err2 := binary.EncodeProtoMessage(payload) + if err2 != nil { + return nil, payload, err2 + } + return encodedPayload, payload, nil +} diff --git a/libgm/payload/registerPhoneRelay.go b/libgm/payload/registerPhoneRelay.go new file mode 100644 index 0000000..4316a38 --- /dev/null +++ b/libgm/payload/registerPhoneRelay.go @@ -0,0 +1,63 @@ +package payload + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +func RegisterPhoneRelay(jwk *crypto.JWK) ([]byte, *binary.Container, error) { + id := util.RandomUUIDv4() + decodedPrivateKey, err2 := jwk.PrivKeyB64Bytes() + if err2 != nil { + return nil, nil, err2 + } + jwk.PrivateBytes = decodedPrivateKey + uncompressedPublicKey, err3 := jwk.UncompressPubKey() + if err3 != nil { + return nil, nil, err3 + } + var emptyByteArray []byte + crypto.EncodeValues(&emptyByteArray, crypto.SequenceOne) + crypto.EncodeValues(&emptyByteArray, crypto.SequenceTwo) + + var copiedByteArray []byte + copiedByteArray = crypto.AppendByteSequence(copiedByteArray, emptyByteArray, uncompressedPublicKey) + for _, value := range uncompressedPublicKey { + copiedByteArray = crypto.HelperAppendBytes(copiedByteArray, value) + } + + var emptyByteArray2 []byte + emptyByteArray2 = crypto.AppendBytes(emptyByteArray2, copiedByteArray[0:]) + + payloadData := &binary.Container{ + PhoneRelay: &binary.PhoneRelayBody{ + Id: id, + Bugle: "Bugle", + Date: &binary.Date{ + Year: 2023, + Seq1: 6, + Seq2: 8, + Seq3: 4, + Seq4: 6, + }, + }, + BrowserDetails: &binary.BrowserDetails{ + UserAgent: util.USER_AGENT, + SomeInt: 2, + SomeBool: true, + Os: util.OS, + }, + PairDeviceData: &binary.PairDeviceData{ + EcdsaKeys: &binary.ECDSAKeys{ + ProtoVersion: 2, + EncryptedKeys: emptyByteArray2, + }, + }, + } + encoded, err4 := binary.EncodeProtoMessage(payloadData) + if err4 != nil { + return nil, payloadData, err4 + } + return encoded, payloadData, nil +} diff --git a/libgm/payload/sendMessage.go b/libgm/payload/sendMessage.go new file mode 100644 index 0000000..2f06d0f --- /dev/null +++ b/libgm/payload/sendMessage.go @@ -0,0 +1,42 @@ +package payload + +import "go.mau.fi/mautrix-gmessages/libgm/binary" + +func NewMessageData(requestID string, encodedStr string, routingOpCode int64, msgType int64) *binary.MessageData { + return &binary.MessageData{ + RequestId: requestID, + RoutingOpCode: routingOpCode, + EncodedData: encodedStr, + MsgTypeArr: &binary.MsgTypeArr{ + EmptyArr: &binary.EmptyArr{}, + MsgType: msgType, + }, + } +} + +func NewEncodedPayload(requestId string, opCode int64, encryptedData []byte, sessionId string) *binary.EncodedPayload { + return &binary.EncodedPayload{ + RequestId: requestId, + Opcode: opCode, + EncryptedData: encryptedData, + SessionId: sessionId, + } +} + +func NewAuthData(requestId string, rpcKey string, date *binary.Date) *binary.AuthMessage { + return &binary.AuthMessage{ + RequestId: requestId, + RpcKey: rpcKey, + Date: date, + } +} + +func NewSendMessage(pairedDevice *binary.Device, messageData *binary.MessageData, authData *binary.AuthMessage, ttl int64) *binary.SendMessage { + return &binary.SendMessage{ + PairedDevice: pairedDevice, + MessageData: messageData, + AuthData: authData, + Ttl: ttl, + EmptyArr: &binary.EmptyArr{}, + } +} diff --git a/libgm/qr.go b/libgm/qr.go new file mode 100644 index 0000000..9e6ed4f --- /dev/null +++ b/libgm/qr.go @@ -0,0 +1,36 @@ +package textgapi + +import ( + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/events" + "go.mau.fi/mautrix-gmessages/libgm/util" + + "github.com/skip2/go-qrcode" +) + +func (p *Pairer) GenerateQRCodeData() (string, error) { + urlData := &binary.UrlData{ + PairingKey: p.pairingKey, + AES_CTR_KEY_256: p.client.cryptor.AES_CTR_KEY_256, + SHA_256_KEY: p.client.cryptor.SHA_256_KEY, + } + encodedUrlData, err := binary.EncodeProtoMessage(urlData) + if err != nil { + return "", err + } + cData := crypto.Base64Encode(encodedUrlData) + return util.QR_CODE_URL + cData, nil +} + +func (p *Pairer) GenerateQRCode(size int) (*events.QRCODE_UPDATED, error) { + data, err1 := p.GenerateQRCodeData() + if err1 != nil { + return nil, err1 + } + png, err2 := qrcode.Encode(data, qrcode.Highest, size) + if err2 != nil { + return nil, err2 + } + return events.NewQrCodeUpdated(png, size, size, data), nil +} diff --git a/libgm/request.go b/libgm/request.go new file mode 100644 index 0000000..f86376d --- /dev/null +++ b/libgm/request.go @@ -0,0 +1,70 @@ +package textgapi + +import ( + "bytes" + "net/http" + "reflect" + + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +func (c *Client) PostRequest(url string, payload []byte, headers interface{}) (*http.Response, error) { + req, err := http.NewRequest("POST", url, bytes.NewReader(payload)) + if err != nil { + return nil, err + } + reqHeaders := &http.Header{} + SetHeaders(reqHeaders, headers) + req.Header = *reqHeaders + //c.Logger.Info().Any("headers", req.Header).Msg("POST Request Headers") + res, reqErr := c.http.Do(req) + if reqErr != nil { + return res, reqErr + } + return res, nil +} + +func (c *Client) GetRequest(url string, headers interface{}) (*http.Response, error) { + req, err := http.NewRequest("GET", url, nil) + + if err != nil { + return nil, err + } + reqHeaders := &http.Header{} + SetHeaders(reqHeaders, headers) + req.Header = *reqHeaders + //c.Logger.Info().Any("headers", req.Header).Msg("GET Request Headers") + res, reqErr := c.http.Do(req) + if reqErr != nil { + return res, reqErr + } + return res, nil +} + +func (c *Client) MakeRelayRequest(url string, body []byte) (*http.Response, error) { + req, err := http.NewRequest("POST", url, bytes.NewReader(body)) + if err != nil { + return nil, err + } + util.BuildRelayHeaders(req, "application/x-protobuf", "*/*") + res, reqErr := c.http.Do(req) + //c.Logger.Info().Any("bodyLength", len(body)).Any("url", url).Any("headers", res.Request.Header).Msg("Relay Request Headers") + if reqErr != nil { + return res, reqErr + } + return res, nil +} + +func SetHeaders(h *http.Header, headers interface{}) { + if headers == nil { + return + } + v := reflect.ValueOf(headers) + for i := 0; i < v.NumField(); i++ { + field := v.Type().Field(i) + value := v.Field(i).String() + if !v.Field(i).IsZero() { + h.Set(field.Tag.Get("header"), value) + } + } +} diff --git a/libgm/response.go b/libgm/response.go new file mode 100644 index 0000000..ef3c67a --- /dev/null +++ b/libgm/response.go @@ -0,0 +1,16 @@ +package textgapi + +import "go.mau.fi/mautrix-gmessages/libgm/binary" + +func (c *Client) newMessagesResponse(responseData *Response) (*binary.FetchMessagesResponse, error) { + messages := &binary.FetchMessagesResponse{} + decryptErr := c.cryptor.DecryptAndDecodeData(responseData.Data.EncryptedData, messages) + if decryptErr != nil { + return nil, decryptErr + } + decryptErr = c.decryptImages(messages) + if decryptErr != nil { + return nil, decryptErr + } + return messages, nil +} diff --git a/libgm/response_handler.go b/libgm/response_handler.go new file mode 100644 index 0000000..9eee576 --- /dev/null +++ b/libgm/response_handler.go @@ -0,0 +1,102 @@ +package textgapi + +import ( + "fmt" + "log" + "sync" +) + +type ResponseChan struct { + responses []*Response + receivedResponses int64 + wg sync.WaitGroup + mu sync.Mutex +} + +func (s *SessionHandler) addRequestToChannel(requestId string, opCode int64) { + instruction, notOk := s.client.instructions.GetInstruction(opCode) + if !notOk { + log.Fatal(notOk) + } + if msgMap, ok := s.requests[requestId]; ok { + responseChan := &ResponseChan{ + responses: make([]*Response, 0, instruction.ExpectedResponses), + receivedResponses: 0, + wg: sync.WaitGroup{}, + mu: sync.Mutex{}, + } + msgMap[opCode] = responseChan + responseChan.wg.Add(int(instruction.ExpectedResponses)) + responseChan.mu.Lock() + } else { + s.requests[requestId] = make(map[int64]*ResponseChan) + responseChan := &ResponseChan{ + responses: make([]*Response, 0, instruction.ExpectedResponses), + receivedResponses: 0, + wg: sync.WaitGroup{}, + mu: sync.Mutex{}, + } + s.requests[requestId][opCode] = responseChan + responseChan.wg.Add(int(instruction.ExpectedResponses)) + responseChan.mu.Lock() + } +} + + +func (s *SessionHandler) respondToRequestChannel(res *Response) { + requestId := res.Data.RequestId + reqChannel, ok := s.requests[requestId] + if !ok { + return + } + opCodeResponseChan, ok2 := reqChannel[res.Data.Opcode] + if !ok2 { + return + } + + opCodeResponseChan.mu.Lock() + + opCodeResponseChan.responses = append(opCodeResponseChan.responses, res) + + s.client.Logger.Debug().Any("opcode", res.Data.Opcode).Msg("Got response") + + instruction, ok3 := s.client.instructions.GetInstruction(res.Data.Opcode) + if opCodeResponseChan.receivedResponses >= instruction.ExpectedResponses { + s.client.Logger.Debug().Any("opcode", res.Data.Opcode).Msg("Ignoring opcode") + return + } + opCodeResponseChan.receivedResponses++ + opCodeResponseChan.wg.Done() + if !ok3 { + log.Fatal(ok3) + opCodeResponseChan.mu.Unlock() + return + } + if opCodeResponseChan.receivedResponses >= instruction.ExpectedResponses { + delete(reqChannel, res.Data.Opcode) + if len(reqChannel) == 0 { + delete(s.requests, requestId) + } + } + + opCodeResponseChan.mu.Unlock() +} + +func (s *SessionHandler) WaitForResponse(requestId string, opCode int64) ([]*Response, error) { + requestResponses, ok := s.requests[requestId] + if !ok { + return nil, fmt.Errorf("no response channel found for request ID: %s (opcode: %v)", requestId, opCode) + } + responseChan, ok2 := requestResponses[opCode] + if !ok2 { + return nil, fmt.Errorf("no response channel found for opCode: %v (requestId: %s)", opCode, requestId) + } + + // Unlock so responses can be received + responseChan.mu.Unlock() + + // Wait for all responses to be received + responseChan.wg.Wait() + + return responseChan.responses, nil +} \ No newline at end of file diff --git a/libgm/rpc.go b/libgm/rpc.go new file mode 100644 index 0000000..d23dde7 --- /dev/null +++ b/libgm/rpc.go @@ -0,0 +1,168 @@ +package textgapi + +import ( + "bufio" + "bytes" + "errors" + "io" + "log" + "net/http" + "os" + + "go.mau.fi/mautrix-gmessages/libgm/events" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type RPC struct { + client *Client + http *http.Client + conn io.ReadCloser + rpcSessionId string + webAuthKey []byte +} + +func (r *RPC) ListenReceiveMessages(payload []byte) { + req, err := http.NewRequest("POST", util.RECEIVE_MESSAGES, bytes.NewReader(payload)) + if err != nil { + log.Fatalf("Error creating request: %v", err) + } + util.BuildRelayHeaders(req, "application/json+protobuf", "*/*") + resp, reqErr := r.http.Do(req) + //r.client.Logger.Info().Any("bodyLength", len(payload)).Any("url", util.RECEIVE_MESSAGES).Any("headers", resp.Request.Header).Msg("RPC Request Headers") + if reqErr != nil { + log.Fatalf("Error making request: %v", err) + } + r.conn = resp.Body + go r.startReadingData(resp.Body) +} + +/* + The start of a message always begins with byte 44 (",") + If the message is parsable (after , has been removed) as an array of interfaces: + func (r *RPC) tryUnmarshalJSON(jsonData []byte, msgArr *[]interface{}) error { + err := json.Unmarshal(jsonData, &msgArr) + return err + } + then the message is complete and it should continue to the HandleRPCMsg function and it should also reset the buffer so that the next message can be received properly. + + if it's not parsable, it should just append the received data to the buf and attempt to parse it until it's parsable. Because that would indicate that the full msg has been received +*/ + +func (r *RPC) startReadingData(rc io.ReadCloser) { + defer rc.Close() + reader := bufio.NewReader(rc) + buf := make([]byte, 2621440) + var accumulatedData []byte + for { + n, err := reader.Read(buf) + if err != nil { + if errors.Is(err, os.ErrClosed) { + r.client.Logger.Err(err).Msg("Closed body from server") + r.conn = nil + return + } + r.client.Logger.Err(err).Msg("Stopped reading data from server") + return + } + chunk := buf[:n] + if n <= 25 { + isHeartBeat := r.isHeartBeat(chunk) + if isHeartBeat { + r.client.Logger.Info().Any("heartBeat", isHeartBeat).Msg("Got heartbeat message") + } + isStartData := r.isStartRead(chunk) + if isStartData { + r.client.Logger.Info().Any("startRead", isHeartBeat).Msg("Got startReading message") + } + accumulatedData = []byte{} + continue + } + + if len(accumulatedData) == 0 { + chunk = bytes.TrimPrefix(chunk, []byte{44}) + } + accumulatedData = append(accumulatedData, chunk...) + var msgArr []interface{} + err = r.tryUnmarshalJSON(accumulatedData, &msgArr) + if err != nil { + //r.client.Logger.Err(err).Any("accumulated", string(accumulatedData)).Msg("Unable to unmarshal data, will wait for more data") + continue + } + + accumulatedData = []byte{} + r.client.Logger.Info().Any("val", msgArr).Msg("MsgArr") + go r.HandleRPCMsg(msgArr) + } +} + +func (r *RPC) isStartRead(data []byte) bool { + return string(data) == "[[[null,null,null,[]]" +} + +func (r *RPC) isHeartBeat(data []byte) bool { + return string(data) == ",[null,null,[]]" +} + +/* +func (r *RPC) startReadingData(rc io.ReadCloser) { + defer rc.Close() + reader := bufio.NewReader(rc) + buf := make([]byte, 5242880) + for { + n, err := reader.Read(buf) + if err != nil { + if errors.Is(err, os.ErrClosed) { + r.client.Logger.Err(err).Msg("Closed body from server") + r.conn = nil + return + } + r.client.Logger.Err(err).Msg("Stopped reading data from server") + return + } + chunk := buf[:n] + var msgArr []interface{} + isComplete := r.tryUnmarshalJSON(chunk, &msgArr) + r.client.Logger.Info().Any("val", chunk[0] == 44).Any("isComplete", string(chunk)).Msg("is Start?") + go r.HandleRPCMsg(buf[:n]) + } +} +*/ + +func (r *RPC) CloseConnection() { + if r.conn != nil { + r.client.Logger.Debug().Msg("Attempting to connection...") + r.conn.Close() + r.conn = nil + } +} + +func (r *RPC) sendMessageRequest(url string, payload []byte) (*http.Response, error) { + req, err := http.NewRequest("POST", url, bytes.NewReader(payload)) + if err != nil { + log.Fatalf("Error creating request: %v", err) + } + util.BuildRelayHeaders(req, "application/json+protobuf", "*/*") + resp, reqErr := r.client.http.Do(req) + //r.client.Logger.Info().Any("bodyLength", len(payload)).Any("url", url).Any("headers", resp.Request.Header).Msg("RPC Request Headers") + if reqErr != nil { + log.Fatalf("Error making request: %v", err) + } + return resp, reqErr +} + +func (r *RPC) sendInitialData() error { + sessionResponse, err := r.client.Session.SetActiveSession() + if err != nil { + return err + } + + conversationList, convErr := r.client.Conversations.List(25) + if convErr != nil { + return convErr + } + + evtData := events.NewClientReady(sessionResponse, conversationList) + r.client.triggerEvent(evtData) + r.client.sessionHandler.startAckInterval() + return nil +} diff --git a/libgm/session.go b/libgm/session.go new file mode 100644 index 0000000..58df7c6 --- /dev/null +++ b/libgm/session.go @@ -0,0 +1,66 @@ +package textgapi + +import "go.mau.fi/mautrix-gmessages/libgm/util" + +type Session struct { + client *Client + + prepareNewSession prepareNewSession + newSession newSession +} + +func (s *Session) SetActiveSession() (*util.SessionResponse, error) { + s.client.sessionHandler.ResetSessionId() + + prepareResponses, prepareSessionErr := s.prepareNewSession.Execute() + if prepareSessionErr != nil { + return nil, prepareSessionErr + } + + newSessionResponses, newSessionErr := s.newSession.Execute() + if newSessionErr != nil { + return nil, newSessionErr + } + + sessionResponse, processFail := s.client.processSessionResponse(prepareResponses, newSessionResponses) + if processFail != nil { + return nil, processFail + } + + s.client.cache.SetSettings(sessionResponse.Settings) + return sessionResponse, nil +} + +type prepareNewSession struct { + client *Client +} + +func (p *prepareNewSession) Execute() ([]*Response, error) { + instruction, _ := p.client.instructions.GetInstruction(PREPARE_NEW_SESSION_OPCODE) + sentRequestId, _ := p.client.createAndSendRequest(instruction.Opcode, p.client.ttl, false, nil) + + responses, err := p.client.sessionHandler.WaitForResponse(sentRequestId, instruction.Opcode) + if err != nil { + return nil, err + } + + return responses, nil +} + +type newSession struct { + client *Client +} + +func (n *newSession) Execute() ([]*Response, error) { + instruction, _ := n.client.instructions.GetInstruction(NEW_SESSION_OPCODE) + sentRequestId, _ := n.client.createAndSendRequest(instruction.Opcode, 0, true, nil) + + responses, err := n.client.sessionHandler.WaitForResponse(sentRequestId, instruction.Opcode) + if err != nil { + return nil, err + } + + // Rest of the processing... + + return responses, nil +} diff --git a/libgm/session_handler.go b/libgm/session_handler.go new file mode 100644 index 0000000..c914380 --- /dev/null +++ b/libgm/session_handler.go @@ -0,0 +1,216 @@ +package textgapi + +import ( + "encoding/json" + "fmt" + "log" + "time" + + "golang.org/x/exp/slices" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + "go.mau.fi/mautrix-gmessages/libgm/binary" + "go.mau.fi/mautrix-gmessages/libgm/crypto" + "go.mau.fi/mautrix-gmessages/libgm/json_proto" + "go.mau.fi/mautrix-gmessages/libgm/payload" + "go.mau.fi/mautrix-gmessages/libgm/util" +) + +type Response struct { + client *Client + ResponseId string + RoutingOpCode int64 + Data *binary.EncodedResponse // base64 encoded (decode -> protomessage) + + StartExecute string + FinishExecute string + DevicePair *DevicePair +} + +type SessionHandler struct { + client *Client + requests map[string]map[int64]*ResponseChan + + ackMap []string + ackTicker *time.Ticker + + sessionId string + + responseTimeout time.Duration +} + +func (s *SessionHandler) SetResponseTimeout(milliSeconds int) { + s.responseTimeout = time.Duration(milliSeconds) * time.Millisecond +} + +func (s *SessionHandler) ResetSessionId() { + s.sessionId = util.RandomUUIDv4() +} + +func (c *Client) createAndSendRequest(instructionId int64, ttl int64, newSession bool, encryptedProtoMessage protoreflect.Message) (string, error) { + requestId := util.RandomUUIDv4() + instruction, ok := c.instructions.GetInstruction(instructionId) + if !ok { + return "", fmt.Errorf("failed to get instruction: %v does not exist", instructionId) + } + + if newSession { + requestId = c.sessionHandler.sessionId + } + + var encryptedData []byte + var encryptErr error + if encryptedProtoMessage != nil { + encryptedData, encryptErr = c.EncryptPayloadData(encryptedProtoMessage) + if encryptErr != nil { + return "", fmt.Errorf("failed to encrypt payload data for opcode: %v", instructionId) + } + c.Logger.Info().Any("encryptedData", encryptedData).Msg("Sending request with encrypted data") + } + + encodedData := payload.NewEncodedPayload(requestId, instruction.Opcode, encryptedData, c.sessionHandler.sessionId) + encodedStr, encodeErr := crypto.EncodeProtoB64(encodedData) + if encodeErr != nil { + log.Fatalf("Failed to encode data: %v", encodeErr) + } + messageData := payload.NewMessageData(requestId, encodedStr, instruction.RoutingOpCode, instruction.MsgType) + authMessage := payload.NewAuthData(requestId, c.rpcKey, &binary.Date{Year: 2023, Seq1: 6, Seq2: 8, Seq3: 4, Seq4: 6}) + sendMessage := payload.NewSendMessage(c.devicePair.Mobile, messageData, authMessage, ttl) + + sentRequestId, reqErr := c.sessionHandler.completeSendMessage(encodedData.RequestId, instruction.Opcode, sendMessage) + if reqErr != nil { + return "", fmt.Errorf("failed to send message request for opcode: %v", instructionId) + } + return sentRequestId, nil +} + +func (s *SessionHandler) completeSendMessage(requestId string, opCode int64, msg *binary.SendMessage) (string, error) { + jsonData, err := s.toJSON(msg.ProtoReflect()) + if err != nil { + return "", err + } + //s.client.Logger.Debug().Any("payload", string(jsonData)).Msg("Sending message request") + s.addRequestToChannel(requestId, opCode) + _, reqErr := s.client.rpc.sendMessageRequest(util.SEND_MESSAGE, jsonData) + if reqErr != nil { + return "", reqErr + } + return requestId, nil +} + +func (s *SessionHandler) toJSON(message protoreflect.Message) ([]byte, error) { + interfaceArr, err := json_proto.Serialize(message) + if err != nil { + return nil, err + } + jsonData, jsonErr := json.Marshal(interfaceArr) + if jsonErr != nil { + return nil, jsonErr + } + return jsonData, nil +} + +func (s *SessionHandler) addResponseAck(responseId string) { + hasResponseId := slices.Contains(s.ackMap, responseId) + if !hasResponseId { + s.ackMap = append(s.ackMap, responseId) + } +} + +func (s *SessionHandler) startAckInterval() { + if s.ackTicker != nil { + s.ackTicker.Stop() + } + ticker := time.NewTicker(5 * time.Second) + s.ackTicker = ticker + go func() { + for range ticker.C { + s.sendAckRequest() + } + }() +} + +func (s *SessionHandler) sendAckRequest() { + if len(s.ackMap) <= 0 { + return + } + reqId := util.RandomUUIDv4() + ackMessagePayload := &binary.AckMessagePayload{ + AuthData: &binary.AuthMessage{ + RequestId: reqId, + RpcKey: s.client.rpcKey, + Date: &binary.Date{Year: 2023, Seq1: 6, Seq2: 8, Seq3: 4, Seq4: 6}, + }, + EmptyArr: &binary.EmptyArr{}, + NoClue: nil, + } + dataArray, err := json_proto.Serialize(ackMessagePayload.ProtoReflect()) + if err != nil { + log.Fatal(err) + } + ackMessages := make([][]interface{}, 0) + for _, reqId := range s.ackMap { + ackMessageData := &binary.AckMessageData{RequestId: reqId, Device: s.client.devicePair.Browser} + ackMessageDataArr, err := json_proto.Serialize(ackMessageData.ProtoReflect()) + if err != nil { + log.Fatal(err) + } + ackMessages = append(ackMessages, ackMessageDataArr) + s.ackMap = util.RemoveFromSlice(s.ackMap, reqId) + } + dataArray = append(dataArray, ackMessages) + jsonData, jsonErr := json.Marshal(dataArray) + if jsonErr != nil { + log.Fatal(err) + } + _, err = s.client.rpc.sendMessageRequest(util.ACK_MESSAGES, jsonData) + if err != nil { + log.Fatal(err) + } + log.Println("[ACK] Sent Request") +} + +func (s *SessionHandler) NewResponse(response *binary.RPCResponse) (*Response, error) { + //s.client.Logger.Debug().Any("rpcResponse", response).Msg("Raw rpc response") + decodedData, err := crypto.DecodeEncodedResponse(response.Data.EncodedData) + if err != nil { + log.Fatal(err) + return nil, err + } + return &Response{ + client: s.client, + ResponseId: response.Data.RequestId, + RoutingOpCode: response.Data.RoutingOpCode, + StartExecute: response.Data.Ts1, + FinishExecute: response.Data.Ts2, + DevicePair: &DevicePair{ + Mobile: response.Data.Mobile, + Browser: response.Data.Browser, + }, + Data: decodedData, + }, nil +} + +func (r *Response) decryptData() (proto.Message, error) { + if r.Data.EncryptedData != nil { + instruction, ok := r.client.instructions.GetInstruction(r.Data.Opcode) + if !ok { + return nil, fmt.Errorf("failed to decrypt data for unknown opcode: %v", r.Data.Opcode) + } + decryptedBytes, errDecrypt := instruction.cryptor.Decrypt(r.Data.EncryptedData) + if errDecrypt != nil { + return nil, errDecrypt + } + //os.WriteFile("opcode_"+strconv.Itoa(int(instruction.Opcode))+".bin", decryptedBytes, os.ModePerm) + + protoMessageData := instruction.DecryptedProtoMessage.ProtoReflect().Type().New().Interface() + decodeProtoErr := binary.DecodeProtoMessage(decryptedBytes, protoMessageData) + if decodeProtoErr != nil { + return nil, decodeProtoErr + } + + return protoMessageData, nil + } + return nil, fmt.Errorf("no encrypted data to decrypt for requestId: %s", r.Data.RequestId) +} diff --git a/libgm/util/constants.go b/libgm/util/constants.go new file mode 100644 index 0000000..392e174 --- /dev/null +++ b/libgm/util/constants.go @@ -0,0 +1,9 @@ +package util + + +var GOOG_API_KEY = "AIzaSyCA4RsOZUFrm9whhtGosPlJLmVPnfSHKz8" +var USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36" +var OS = "Linux" +var X_USER_AGENT = "grpc-web-javascript/0.1" +var QR_CODE_URL = "https://support.google.com/messages/?p=web_computer#?c=" +var TENOR_API_KEY = "YR0F99AJ65AV" \ No newline at end of file diff --git a/libgm/util/errors.go b/libgm/util/errors.go new file mode 100644 index 0000000..6f81ff2 --- /dev/null +++ b/libgm/util/errors.go @@ -0,0 +1,12 @@ +package util + +import "fmt" + + +type InstructionNotFound struct { + Opcode int64 +} + +func (e *InstructionNotFound) Error() string { + return fmt.Sprintf("Could not find instruction for opcode %d", e.Opcode) +} \ No newline at end of file diff --git a/libgm/util/func.go b/libgm/util/func.go new file mode 100644 index 0000000..8968d72 --- /dev/null +++ b/libgm/util/func.go @@ -0,0 +1,135 @@ +package util + +import ( + crand "crypto/rand" + "encoding/hex" + "fmt" + "math/rand" + "net/http" + "time" + + "github.com/nu7hatch/gouuid" +) + +var Charset = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890") + +func RandStr(length int) string { + b := make([]rune, length) + for i := range b { + b[i] = Charset[rand.Intn(len(Charset))] + } + return string(b) +} + +func GenerateImageId() string { + part1 := RandomUUIDv4() + part2 := RandStr(25) + return part1 + "/" + part2 +} + +func GenerateTmpId() string { + src := rand.NewSource(time.Now().UnixNano()) + r := rand.New(src) + randNum := r.Int63n(1e12) + return fmt.Sprintf("tmp_%012d", randNum) +} + +func ParseTimestamp(unixTs int64) time.Time { + seconds := unixTs / int64(time.Second / time.Microsecond) + nanoseconds := (unixTs % int64(time.Second / time.Microsecond)) * int64(time.Microsecond / time.Nanosecond) + return time.Unix(seconds, nanoseconds).UTC() +} + +func RandomHex(n int) string { + bytes := make([]byte, n) + crand.Read(bytes) + return hex.EncodeToString(bytes) +} + +func RandomUUIDv4() string { + id, _ := uuid.NewV4() + return id.String() +} + +func RemoveFromSlice(s []string, v string) []string { + newS := []string{} + for _, i := range s { + if i != v { + newS = append(newS, i) + } + } + return newS +} + +func BuildRelayHeaders(req *http.Request, contentType string, accept string) { + req.Header.Add("host", "instantmessaging-pa.googleapis.com") + req.Header.Add("connection", "keep-alive") + req.Header.Add("sec-ch-ua", "\"Google Chrome\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"") + req.Header.Add("x-user-agent", X_USER_AGENT) + req.Header.Add("x-goog-api-key", GOOG_API_KEY) + if len(contentType) > 0 { + req.Header.Add("content-type", contentType) + } + req.Header.Add("sec-ch-ua-mobile", "?0") + req.Header.Add("user-agent", USER_AGENT) + req.Header.Add("sec-ch-ua-platform", "\""+OS+"\"") + req.Header.Add("accept", accept) + req.Header.Add("origin", "https://messages.google.com") + req.Header.Add("sec-fetch-site", "cross-site") + req.Header.Add("sec-fetch-mode", "cors") + req.Header.Add("sec-fetch-dest", "empty") + req.Header.Add("referer", "https://messages.google.com/") + req.Header.Add("accept-language", "en-US,en;q=0.9") +} + +func BuildUploadHeaders(req *http.Request, metadata string) { + req.Header.Add("host", "instantmessaging-pa.googleapis.com") + req.Header.Add("connection", "keep-alive") + req.Header.Add("x-goog-download-metadata", metadata) + req.Header.Add("sec-ch-ua", "\"Google Chrome\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"") + req.Header.Add("sec-ch-ua-mobile", "?0") + req.Header.Add("user-agent", USER_AGENT) + req.Header.Add("sec-ch-ua-platform", "\""+OS+"\"") + req.Header.Add("accept", "*/*") + req.Header.Add("origin", "https://messages.google.com") + req.Header.Add("sec-fetch-site", "cross-site") + req.Header.Add("sec-fetch-mode", "cors") + req.Header.Add("sec-fetch-dest", "empty") + req.Header.Add("referer", "https://messages.google.com/") + req.Header.Add("accept-encoding", "gzip, deflate, br") + req.Header.Add("accept-language", "en-US,en;q=0.9") +} + +func NewMediaUploadHeaders(imageSize string, command string, uploadOffset string, imageContentType string, protocol string) *http.Header { + headers := &http.Header{} + + headers.Add("host", "instantmessaging-pa.googleapis.com") + headers.Add("connection", "keep-alive") + headers.Add("sec-ch-ua", "\"Google Chrome\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"") + if protocol != "" { + headers.Add("x-goog-upload-protocol", protocol) + } + headers.Add("x-goog-upload-header-content-length", imageSize) + headers.Add("sec-ch-ua-mobile", "?0") + headers.Add("user-agent", USER_AGENT) + if imageContentType != "" { + headers.Add("x-goog-upload-header-content-type", imageContentType) + } + headers.Add("content-type", "application/x-www-form-urlencoded;charset=UTF-8") + if command != "" { + headers.Add("x-goog-upload-command", command) + } + if uploadOffset != "" { + headers.Add("x-goog-upload-offset", uploadOffset) + } + headers.Add("sec-ch-ua-platform", "\""+OS+"\"") + headers.Add("accept", "*/*") + headers.Add("origin", "https://messages.google.com") + headers.Add("sec-fetch-site", "cross-site") + headers.Add("sec-fetch-mode", "cors") + headers.Add("sec-fetch-dest", "empty") + headers.Add("referer", "https://messages.google.com/") + headers.Add("accept-encoding", "gzip, deflate, br") + headers.Add("accept-language", "en-US,en;q=0.9") + return headers +} \ No newline at end of file diff --git a/libgm/util/paths.go b/libgm/util/paths.go new file mode 100644 index 0000000..0fb942d --- /dev/null +++ b/libgm/util/paths.go @@ -0,0 +1,23 @@ +package util + +var MESSAGES_GOOGLE_BASE_URL = "https://messages.google.com" + +var MESSAGES_GOOGLE_AUTHENTICATION = MESSAGES_GOOGLE_BASE_URL+"/web/authentication" +var MESSAGES_GOOGLE_TIMESOURCE = MESSAGES_GOOGLE_BASE_URL+"/web/timesource" + +var INSTANT_MESSAGING = "https://instantmessaging-pa.googleapis.com" + +var UPLOAD_MEDIA = INSTANT_MESSAGING+"/upload" + +var PAIRING = INSTANT_MESSAGING+"/$rpc/google.internal.communications.instantmessaging.v1.Pairing" +var REGISTER_PHONE_RELAY = PAIRING+"/RegisterPhoneRelay" +var REFRESH_PHONE_RELAY = PAIRING+"/RefreshPhoneRelay" +var GET_WEB_ENCRYPTION_KEY = PAIRING+"/GetWebEncryptionKey" + +var MESSAGING = INSTANT_MESSAGING+"/$rpc/google.internal.communications.instantmessaging.v1.Messaging" +var RECEIVE_MESSAGES = MESSAGING+"/ReceiveMessages" +var SEND_MESSAGE = MESSAGING+"/SendMessage" +var ACK_MESSAGES = MESSAGING+"/AckMessages" + +var TENOR_BASE_URL = "https://api.tenor.com/v1" +var TENOR_SEARCH_GIF = TENOR_BASE_URL+"/search" \ No newline at end of file diff --git a/libgm/util/structs.go b/libgm/util/structs.go new file mode 100644 index 0000000..f1f5b54 --- /dev/null +++ b/libgm/util/structs.go @@ -0,0 +1,111 @@ +package util + +import "go.mau.fi/mautrix-gmessages/libgm/binary" + +type SessionResponse struct { + Success bool + Settings *binary.Settings +} + +type Headers struct { + Host string `json:"host,omitempty" header:"host"` + Connection string `json:"connection,omitempty" header:"connection"` + SecChUa string `json:"sec-ch-ua,omitempty" header:"sec-ch-ua"` + SecChUaMobile string `json:"sec-ch-ua-mobile,omitempty" header:"sec-ch-ua-mobile"` + SecChUaPlatform string `json:"sec-ch-ua-platform,omitempty" header:"sec-ch-ua-platform"` + UpgradeInsecureRequests string `json:"upgrade-insecure-requests,omitempty" header:"upgrade-insecure-requests"` + UserAgent string `json:"user-agent,omitempty" header:"user-agent"` + Accept string `json:"accept,omitempty" header:"accept"` + Cookie string `json:"cookie,omitempty" header:"cookie"` + Referer string `json:"referer,omitempty" header:"referer"` + SecFetchSite string `json:"sec-fetch-site,omitempty" header:"sec-fetch-site"` + SecFetchMode string `json:"sec-fetch-mode,omitempty" header:"sec-fetch-mode"` + SecFetchUser string `json:"sec-fetch-user,omitempty" header:"sec-fetch-user"` + SecFetchDest string `json:"sec-fetch-dest,omitempty" header:"sec-fetch-dest"` + AcceptEncoding string `json:"accept-encoding,omitempty" header:"accept-encoding"` + AcceptLanguage string `json:"accept-language,omitempty" header:"accept-language"` +} + +func (h *Headers) Build() { + h.Connection = "keep-alive" + h.SecChUa = `"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"` + h.SecChUaMobile = "?0" + h.SecChUaPlatform = `"Linux"` + h.UpgradeInsecureRequests = "1" + h.UserAgent = USER_AGENT + h.Accept = `text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7` + h.SecFetchSite = "none" + h.SecFetchMode = "navigate" + h.SecFetchUser = "?1" + h.SecFetchDest = "document" + h.AcceptEncoding = "gzip, deflate, br" + h.AcceptLanguage = "en-US,en;q=0.9" +} + +func (h *Headers) SetReferer(referer string) { + h.Referer = referer +} + +func (h *Headers) SetSecFetchSite(val string) { + h.SecFetchSite = val +} + +func (h *Headers) SetSecFetchUser(val string) { + h.SecFetchUser = val +} + +func (h *Headers) SetSecFetchDest(val string) { + h.SecFetchDest = val +} + +func (h *Headers) SetUpgradeInsecureRequests(val string) { + h.UpgradeInsecureRequests = val +} + +func (h *Headers) SetAccept(val string) { + h.Accept = val +} + +type RelayHeaders struct { + Host string `json:"host,omitempty"` + Connection string `json:"connection,omitempty"` + SecChUa string `json:"sec-ch-ua,omitempty"` + XUserAgent string `json:"x-user-agent,omitempty"` + XGoogAPIKey string `json:"x-goog-api-key,omitempty"` + ContentType string `json:"content-type,omitempty"` + SecChUaMobile string `json:"sec-ch-ua-mobile,omitempty"` + UserAgent string `json:"user-agent,omitempty"` + SecChUaPlatform string `json:"sec-ch-ua-platform,omitempty"` + Accept string `json:"accept,omitempty"` + Origin string `json:"origin,omitempty"` + XClientData string `json:"x-client-data,omitempty"` + SecFetchSite string `json:"sec-fetch-site,omitempty"` + SecFetchMode string `json:"sec-fetch-mode,omitempty"` + SecFetchDest string `json:"sec-fetch-dest,omitempty"` + Referer string `json:"referer,omitempty"` + AcceptEncoding string `json:"accept-encoding,omitempty"` + AcceptLanguage string `json:"accept-language,omitempty"` +} + +type MediaUploadHeaders struct { + Host string `json:"host"` + Connection string `json:"connection"` + SecChUa string `json:"sec-ch-ua"` + XGoogUploadProtocol string `json:"x-goog-upload-protocol"` + XGoogUploadHeaderContentLength string `json:"x-goog-upload-header-content-length"` + SecChUaMobile string `json:"sec-ch-ua-mobile"` + UserAgent string `json:"user-agent"` + XGoogUploadHeaderContentType string `json:"x-goog-upload-header-content-type"` + ContentType string `json:"content-type"` + XGoogUploadCommand string `json:"x-goog-upload-command"` + SecChUaPlatform string `json:"sec-ch-ua-platform"` + Accept string `json:"accept"` + Origin string `json:"origin"` + XClientData string `json:"x-client-data"` + SecFetchSite string `json:"sec-fetch-site"` + SecFetchMode string `json:"sec-fetch-mode"` + SecFetchDest string `json:"sec-fetch-dest"` + Referer string `json:"referer"` + AcceptEncoding string `json:"accept-encoding"` + AcceptLanguage string `json:"accept-language"` +}