Update library

Co-authored-by: zero <108243503+0xzer@users.noreply.github.com>
This commit is contained in:
Tulir Asokan 2023-07-09 14:16:52 +03:00
parent 922ffdcf6b
commit 1615e146b6
83 changed files with 10474 additions and 4434 deletions

View file

@ -26,7 +26,7 @@ import (
"maunium.net/go/mautrix/id" "maunium.net/go/mautrix/id"
"maunium.net/go/mautrix/util/dbutil" "maunium.net/go/mautrix/util/dbutil"
"go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm"
) )
type UserQuery struct { type UserQuery struct {
@ -63,22 +63,13 @@ func (uq *UserQuery) GetByPhone(ctx context.Context, phone string) (*User, error
return get[*User](uq, ctx, `SELECT rowid, mxid, phone, session, management_room, space_room, access_token FROM "user" WHERE phone=$1`, phone) return get[*User](uq, ctx, `SELECT rowid, mxid, phone, session, management_room, space_room, access_token FROM "user" WHERE phone=$1`, phone)
} }
type Session struct {
WebAuthKey []byte `json:"web_auth_key"`
AESKey []byte `json:"aes_key"`
HMACKey []byte `json:"hmac_key"`
PhoneInfo *binary.Device `json:"phone_info"`
BrowserInfo *binary.Device `json:"browser_info"`
}
type User struct { type User struct {
db *Database db *Database
RowID int RowID int
MXID id.UserID MXID id.UserID
Phone string Phone string
Session *Session Session *libgm.AuthData
ManagementRoom id.RoomID ManagementRoom id.RoomID
SpaceRoom id.RoomID SpaceRoom id.RoomID
@ -95,7 +86,7 @@ func (user *User) Scan(row dbutil.Scannable) (*User, error) {
return nil, err return nil, err
} }
if session.String != "" { if session.String != "" {
var sess Session var sess libgm.AuthData
err = json.Unmarshal([]byte(session.String), &sess) err = json.Unmarshal([]byte(session.String), &sess)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse session: %w", err) return nil, fmt.Errorf("failed to parse session: %w", err)

View file

@ -2,10 +2,8 @@ package main
import ( import (
"bufio" "bufio"
"encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"net/http"
"os" "os"
"os/signal" "os/signal"
"strings" "strings"
@ -21,13 +19,6 @@ import (
"go.mau.fi/mautrix-gmessages/libgm/events" "go.mau.fi/mautrix-gmessages/libgm/events"
) )
type Session struct {
*libgm.DevicePair
*crypto.Cryptor
*binary.WebAuthKey
Cookies []*http.Cookie
}
func must(err error) { func must(err error) {
if err != nil { if err != nil {
panic(err) panic(err)
@ -41,7 +32,7 @@ func mustReturn[T any](val T, err error) T {
var cli *libgm.Client var cli *libgm.Client
var log zerolog.Logger var log zerolog.Logger
var sess Session var sess libgm.AuthData
func main() { func main() {
log = zerolog.New(zerolog.NewConsoleWriter(func(w *zerolog.ConsoleWriter) { log = zerolog.New(zerolog.NewConsoleWriter(func(w *zerolog.ConsoleWriter) {
@ -61,22 +52,9 @@ func main() {
if sess.Cryptor == nil { if sess.Cryptor == nil {
sess.Cryptor = crypto.NewCryptor(nil, nil) sess.Cryptor = crypto.NewCryptor(nil, nil)
} }
cli = libgm.NewClient(sess.DevicePair, sess.Cryptor, log, nil) cli = libgm.NewClient(&sess, log)
if sess.Cookies != nil {
cli.SetCookies(sess.Cookies)
}
cli.SetEventHandler(evtHandler) cli.SetEventHandler(evtHandler)
log.Debug().Msg(base64.StdEncoding.EncodeToString(sess.GetWebAuthKey())) must(cli.Connect())
if sess.DevicePair == nil {
pairer := mustReturn(cli.NewPairer(nil, 20))
registered := mustReturn(pairer.RegisterPhoneRelay())
must(cli.Connect(registered.Field5.RpcKey))
} else {
//pairer := mustReturn(cli.NewPairer(nil, 20))
//newKey := pairer.GetWebEncryptionKey(sess.GetWebAuthKey())
//log.Debug().Msg(base64.StdEncoding.EncodeToString(newKey))
must(cli.Connect(sess.GetWebAuthKey()))
}
c := make(chan os.Signal) c := make(chan os.Signal)
input := make(chan string) input := make(chan string)
@ -111,7 +89,6 @@ func main() {
} }
func saveSession() { func saveSession() {
sess.Cookies = cli.GetCookies()
file := mustReturn(os.OpenFile("session.json", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600)) file := mustReturn(os.OpenFile("session.json", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600))
must(json.NewEncoder(file).Encode(sess)) must(json.NewEncoder(file).Encode(sess))
_ = file.Close() _ = file.Close()
@ -123,25 +100,22 @@ func evtHandler(rawEvt any) {
log.Debug().Any("data", evt).Msg("Client is ready!") log.Debug().Any("data", evt).Msg("Client is ready!")
case *events.PairSuccessful: case *events.PairSuccessful:
log.Debug().Any("data", evt).Msg("Pair successful") log.Debug().Any("data", evt).Msg("Pair successful")
sess.DevicePair = &libgm.DevicePair{ //kd := evt.Data.(*binary.AuthenticationContainer_KeyData)
Mobile: evt.PairDeviceData.Mobile, //sess.DevicePair = &pblite.DevicePair{
Browser: evt.PairDeviceData.Browser, // Mobile: kd.KeyData.Mobile,
} // Browser: kd.KeyData.Browser,
sess.WebAuthKey = evt.PairDeviceData.WebAuthKeyData //}
//sess.TachyonAuthToken = evt.AuthMessage.TachyonAuthToken
saveSession() saveSession()
log.Debug().Msg("Wrote session") log.Debug().Msg("Wrote session")
case *binary.Event_MessageEvent: case *binary.Message:
log.Debug().Any("data", evt).Msg("Message event") log.Debug().Any("data", evt).Msg("Message event")
case *binary.Event_ConversationEvent: case *binary.Conversation:
log.Debug().Any("data", evt).Msg("Conversation event") log.Debug().Any("data", evt).Msg("Conversation event")
case *events.QR: case *events.QR:
qrterminal.GenerateHalfBlock(evt.URL, qrterminal.L, os.Stdout) qrterminal.GenerateHalfBlock(evt.URL, qrterminal.L, os.Stdout)
case *events.BrowserActive: case *events.BrowserActive:
log.Debug().Any("data", evt).Msg("Browser active") log.Debug().Any("data", evt).Msg("Browser active")
case *events.Battery:
log.Debug().Any("data", evt).Msg("Battery")
case *events.DataConnection:
log.Debug().Any("data", evt).Msg("Data connection")
default: default:
log.Debug().Any("data", evt).Msg("Unknown event") log.Debug().Any("data", evt).Msg("Unknown event")
} }

File diff suppressed because it is too large Load diff

View file

@ -20,20 +20,165 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type SendMessage struct { type BugleMessageType int32
const (
BugleMessageType_UNKNOWN_BUGLE_MESSAGE_TYPE BugleMessageType = 0
BugleMessageType_SMS BugleMessageType = 1
BugleMessageType_MMS BugleMessageType = 2
BugleMessageType_RCS BugleMessageType = 3
BugleMessageType_CLOUD_SYNC BugleMessageType = 4
BugleMessageType_IMDN_DELIVERED BugleMessageType = 5
BugleMessageType_IMDN_DISPLAYED BugleMessageType = 6
BugleMessageType_IMDN_FALLBACK BugleMessageType = 7
BugleMessageType_RCS_GENERIC BugleMessageType = 8
BugleMessageType_FTD BugleMessageType = 9
BugleMessageType_FT_E2EE_LEGACY BugleMessageType = 10
BugleMessageType_FT_E2EE_XML BugleMessageType = 11
BugleMessageType_LIGHTER_MESSAGE BugleMessageType = 12
BugleMessageType_RBM_SPAM_REPORT BugleMessageType = 13
BugleMessageType_SATELLITE BugleMessageType = 14
)
// Enum value maps for BugleMessageType.
var (
BugleMessageType_name = map[int32]string{
0: "UNKNOWN_BUGLE_MESSAGE_TYPE",
1: "SMS",
2: "MMS",
3: "RCS",
4: "CLOUD_SYNC",
5: "IMDN_DELIVERED",
6: "IMDN_DISPLAYED",
7: "IMDN_FALLBACK",
8: "RCS_GENERIC",
9: "FTD",
10: "FT_E2EE_LEGACY",
11: "FT_E2EE_XML",
12: "LIGHTER_MESSAGE",
13: "RBM_SPAM_REPORT",
14: "SATELLITE",
}
BugleMessageType_value = map[string]int32{
"UNKNOWN_BUGLE_MESSAGE_TYPE": 0,
"SMS": 1,
"MMS": 2,
"RCS": 3,
"CLOUD_SYNC": 4,
"IMDN_DELIVERED": 5,
"IMDN_DISPLAYED": 6,
"IMDN_FALLBACK": 7,
"RCS_GENERIC": 8,
"FTD": 9,
"FT_E2EE_LEGACY": 10,
"FT_E2EE_XML": 11,
"LIGHTER_MESSAGE": 12,
"RBM_SPAM_REPORT": 13,
"SATELLITE": 14,
}
)
func (x BugleMessageType) Enum() *BugleMessageType {
p := new(BugleMessageType)
*p = x
return p
}
func (x BugleMessageType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (BugleMessageType) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[0].Descriptor()
}
func (BugleMessageType) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[0]
}
func (x BugleMessageType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use BugleMessageType.Descriptor instead.
func (BugleMessageType) EnumDescriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{0}
}
type BrowserTypes int32
const (
BrowserTypes_UNKNOWN_BROWSER_TYPE BrowserTypes = 0
BrowserTypes_OTHER BrowserTypes = 1
BrowserTypes_CHROME BrowserTypes = 2
BrowserTypes_FIREFOX BrowserTypes = 3
BrowserTypes_SAFARI BrowserTypes = 4
BrowserTypes_OPERA BrowserTypes = 5
BrowserTypes_IE BrowserTypes = 6
BrowserTypes_EDGE BrowserTypes = 7
)
// Enum value maps for BrowserTypes.
var (
BrowserTypes_name = map[int32]string{
0: "UNKNOWN_BROWSER_TYPE",
1: "OTHER",
2: "CHROME",
3: "FIREFOX",
4: "SAFARI",
5: "OPERA",
6: "IE",
7: "EDGE",
}
BrowserTypes_value = map[string]int32{
"UNKNOWN_BROWSER_TYPE": 0,
"OTHER": 1,
"CHROME": 2,
"FIREFOX": 3,
"SAFARI": 4,
"OPERA": 5,
"IE": 6,
"EDGE": 7,
}
)
func (x BrowserTypes) Enum() *BrowserTypes {
p := new(BrowserTypes)
*p = x
return p
}
func (x BrowserTypes) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (BrowserTypes) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[1].Descriptor()
}
func (BrowserTypes) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[1]
}
func (x BrowserTypes) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use BrowserTypes.Descriptor instead.
func (BrowserTypes) EnumDescriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{1}
}
type NotifyDittoActivityPayload struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
PairedDevice *Device `protobuf:"bytes,1,opt,name=pairedDevice,proto3" json:"pairedDevice,omitempty"` Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,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() { func (x *NotifyDittoActivityPayload) Reset() {
*x = SendMessage{} *x = NotifyDittoActivityPayload{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[0] mi := &file_client_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -41,13 +186,13 @@ func (x *SendMessage) Reset() {
} }
} }
func (x *SendMessage) String() string { func (x *NotifyDittoActivityPayload) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*SendMessage) ProtoMessage() {} func (*NotifyDittoActivityPayload) ProtoMessage() {}
func (x *SendMessage) ProtoReflect() protoreflect.Message { func (x *NotifyDittoActivityPayload) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[0] mi := &file_client_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -59,46 +204,206 @@ func (x *SendMessage) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use SendMessage.ProtoReflect.Descriptor instead. // Deprecated: Use NotifyDittoActivityPayload.ProtoReflect.Descriptor instead.
func (*SendMessage) Descriptor() ([]byte, []int) { func (*NotifyDittoActivityPayload) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{0} return file_client_proto_rawDescGZIP(), []int{0}
} }
func (x *SendMessage) GetPairedDevice() *Device { func (x *NotifyDittoActivityPayload) GetSuccess() bool {
if x != nil { if x != nil {
return x.PairedDevice return x.Success
}
return false
}
type AckMessageResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Container *AckContainer `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"`
}
func (x *AckMessageResponse) Reset() {
*x = AckMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AckMessageResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AckMessageResponse) ProtoMessage() {}
func (x *AckMessageResponse) 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 AckMessageResponse.ProtoReflect.Descriptor instead.
func (*AckMessageResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{1}
}
func (x *AckMessageResponse) GetContainer() *AckContainer {
if x != nil {
return x.Container
} }
return nil return nil
} }
func (x *SendMessage) GetMessageData() *MessageData { type AckContainer struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *AckData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}
func (x *AckContainer) Reset() {
*x = AckContainer{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AckContainer) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AckContainer) ProtoMessage() {}
func (x *AckContainer) 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 AckContainer.ProtoReflect.Descriptor instead.
func (*AckContainer) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{2}
}
func (x *AckContainer) GetData() *AckData {
if x != nil { if x != nil {
return x.MessageData return x.Data
} }
return nil return nil
} }
func (x *SendMessage) GetAuthData() *AuthMessage { type AckData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
AckAmount *AckAmount `protobuf:"bytes,4,opt,name=ackAmount,proto3" json:"ackAmount,omitempty"`
}
func (x *AckData) Reset() {
*x = AckData{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AckData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AckData) ProtoMessage() {}
func (x *AckData) 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 AckData.ProtoReflect.Descriptor instead.
func (*AckData) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{3}
}
func (x *AckData) GetAckAmount() *AckAmount {
if x != nil { if x != nil {
return x.AuthData return x.AckAmount
} }
return nil return nil
} }
func (x *SendMessage) GetTTL() int64 { type AckAmount struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
}
func (x *AckAmount) Reset() {
*x = AckAmount{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AckAmount) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AckAmount) ProtoMessage() {}
func (x *AckAmount) 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 AckAmount.ProtoReflect.Descriptor instead.
func (*AckAmount) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{4}
}
func (x *AckAmount) GetCount() int32 {
if x != nil { if x != nil {
return x.TTL return x.Count
} }
return 0 return 0
} }
func (x *SendMessage) GetEmptyArr() *EmptyArr {
if x != nil {
return x.EmptyArr
}
return nil
}
type AckMessagePayload struct { type AckMessagePayload struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -112,7 +417,7 @@ type AckMessagePayload struct {
func (x *AckMessagePayload) Reset() { func (x *AckMessagePayload) Reset() {
*x = AckMessagePayload{} *x = AckMessagePayload{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[1] mi := &file_client_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -125,7 +430,7 @@ func (x *AckMessagePayload) String() string {
func (*AckMessagePayload) ProtoMessage() {} func (*AckMessagePayload) ProtoMessage() {}
func (x *AckMessagePayload) ProtoReflect() protoreflect.Message { func (x *AckMessagePayload) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[1] mi := &file_client_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -138,7 +443,7 @@ func (x *AckMessagePayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use AckMessagePayload.ProtoReflect.Descriptor instead. // Deprecated: Use AckMessagePayload.ProtoReflect.Descriptor instead.
func (*AckMessagePayload) Descriptor() ([]byte, []int) { func (*AckMessagePayload) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{1} return file_client_proto_rawDescGZIP(), []int{5}
} }
func (x *AckMessagePayload) GetAuthData() *AuthMessage { func (x *AckMessagePayload) GetAuthData() *AuthMessage {
@ -174,7 +479,7 @@ type AckMessageData struct {
func (x *AckMessageData) Reset() { func (x *AckMessageData) Reset() {
*x = AckMessageData{} *x = AckMessageData{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[2] mi := &file_client_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -187,7 +492,7 @@ func (x *AckMessageData) String() string {
func (*AckMessageData) ProtoMessage() {} func (*AckMessageData) ProtoMessage() {}
func (x *AckMessageData) ProtoReflect() protoreflect.Message { func (x *AckMessageData) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[2] mi := &file_client_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -200,7 +505,7 @@ func (x *AckMessageData) ProtoReflect() protoreflect.Message {
// Deprecated: Use AckMessageData.ProtoReflect.Descriptor instead. // Deprecated: Use AckMessageData.ProtoReflect.Descriptor instead.
func (*AckMessageData) Descriptor() ([]byte, []int) { func (*AckMessageData) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{2} return file_client_proto_rawDescGZIP(), []int{6}
} }
func (x *AckMessageData) GetRequestID() string { func (x *AckMessageData) GetRequestID() string {
@ -229,7 +534,7 @@ type ImageMetaData struct {
func (x *ImageMetaData) Reset() { func (x *ImageMetaData) Reset() {
*x = ImageMetaData{} *x = ImageMetaData{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[3] mi := &file_client_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -242,7 +547,7 @@ func (x *ImageMetaData) String() string {
func (*ImageMetaData) ProtoMessage() {} func (*ImageMetaData) ProtoMessage() {}
func (x *ImageMetaData) ProtoReflect() protoreflect.Message { func (x *ImageMetaData) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[3] mi := &file_client_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -255,7 +560,7 @@ func (x *ImageMetaData) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImageMetaData.ProtoReflect.Descriptor instead. // Deprecated: Use ImageMetaData.ProtoReflect.Descriptor instead.
func (*ImageMetaData) Descriptor() ([]byte, []int) { func (*ImageMetaData) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{3} return file_client_proto_rawDescGZIP(), []int{7}
} }
func (x *ImageMetaData) GetImageID() string { func (x *ImageMetaData) GetImageID() string {
@ -284,7 +589,7 @@ type UploadImagePayload struct {
func (x *UploadImagePayload) Reset() { func (x *UploadImagePayload) Reset() {
*x = UploadImagePayload{} *x = UploadImagePayload{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[4] mi := &file_client_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -297,7 +602,7 @@ func (x *UploadImagePayload) String() string {
func (*UploadImagePayload) ProtoMessage() {} func (*UploadImagePayload) ProtoMessage() {}
func (x *UploadImagePayload) ProtoReflect() protoreflect.Message { func (x *UploadImagePayload) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[4] mi := &file_client_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -310,7 +615,7 @@ func (x *UploadImagePayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use UploadImagePayload.ProtoReflect.Descriptor instead. // Deprecated: Use UploadImagePayload.ProtoReflect.Descriptor instead.
func (*UploadImagePayload) Descriptor() ([]byte, []int) { func (*UploadImagePayload) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{4} return file_client_proto_rawDescGZIP(), []int{8}
} }
func (x *UploadImagePayload) GetMetaData() *ImageMetaData { func (x *UploadImagePayload) GetMetaData() *ImageMetaData {
@ -338,7 +643,7 @@ type BugleBackendService struct {
func (x *BugleBackendService) Reset() { func (x *BugleBackendService) Reset() {
*x = BugleBackendService{} *x = BugleBackendService{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[5] mi := &file_client_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -351,7 +656,7 @@ func (x *BugleBackendService) String() string {
func (*BugleBackendService) ProtoMessage() {} func (*BugleBackendService) ProtoMessage() {}
func (x *BugleBackendService) ProtoReflect() protoreflect.Message { func (x *BugleBackendService) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[5] mi := &file_client_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -364,7 +669,7 @@ func (x *BugleBackendService) ProtoReflect() protoreflect.Message {
// Deprecated: Use BugleBackendService.ProtoReflect.Descriptor instead. // Deprecated: Use BugleBackendService.ProtoReflect.Descriptor instead.
func (*BugleBackendService) Descriptor() ([]byte, []int) { func (*BugleBackendService) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{5} return file_client_proto_rawDescGZIP(), []int{9}
} }
func (x *BugleBackendService) GetData() *BugleCode { func (x *BugleBackendService) GetData() *BugleCode {
@ -385,7 +690,7 @@ type BugleCode struct {
func (x *BugleCode) Reset() { func (x *BugleCode) Reset() {
*x = BugleCode{} *x = BugleCode{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[6] mi := &file_client_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -398,7 +703,7 @@ func (x *BugleCode) String() string {
func (*BugleCode) ProtoMessage() {} func (*BugleCode) ProtoMessage() {}
func (x *BugleCode) ProtoReflect() protoreflect.Message { func (x *BugleCode) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[6] mi := &file_client_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -411,7 +716,7 @@ func (x *BugleCode) ProtoReflect() protoreflect.Message {
// Deprecated: Use BugleCode.ProtoReflect.Descriptor instead. // Deprecated: Use BugleCode.ProtoReflect.Descriptor instead.
func (*BugleCode) Descriptor() ([]byte, []int) { func (*BugleCode) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{6} return file_client_proto_rawDescGZIP(), []int{10}
} }
func (x *BugleCode) GetType() int64 { func (x *BugleCode) GetType() int64 {
@ -426,57 +731,83 @@ var File_client_proto protoreflect.FileDescriptor
var file_client_proto_rawDesc = []byte{ var file_client_proto_rawDesc = []byte{
0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 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, 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, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x1a, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x0c, 0x70, 0x61, 0x69, 0x72, 0x65, 0x64, 0x44, 0x69, 0x74, 0x74, 0x6f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, 0x61, 0x79,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x0c, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x48,
0x70, 0x61, 0x69, 0x72, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x0b, 0x0a, 0x12, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x2e, 0x41, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x09, 0x63,
0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x33, 0x0a, 0x0c, 0x41, 0x63, 0x6b, 0x43,
0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e,
0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x54, 0x4c, 0x18, 0x41, 0x63, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x0a,
0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x54, 0x54, 0x4c, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x07, 0x41, 0x63, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x0a, 0x09, 0x61, 0x63, 0x6b, 0x41,
0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6c,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x63, 0x6b, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x09,
0x52, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x22, 0x8e, 0x01, 0x0a, 0x11, 0x41, 0x61, 0x63, 0x6b, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x21, 0x0a, 0x09, 0x41, 0x63, 0x6b,
0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, 0x01, 0x0a,
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x11, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f,
0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x64, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01,
0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x61, 0x75, 0x74,
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x52, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x08, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72,
0x41, 0x72, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x22, 0x58, 0x0a, 0x0e, 0x41, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x72, 0x52, 0x08, 0x65, 0x6d, 0x70,
0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x74, 0x79, 0x41, 0x72, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x18,
0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x22, 0x58, 0x0a,
0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x28, 0x0a, 0x06, 0x64, 0x0e, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12,
0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01,
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, 0x64, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x28, 0x0a,
0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x47, 0x0a, 0x0d, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e,
0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52,
0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x49, 0x44, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x47, 0x0a, 0x0d, 0x49, 0x6d, 0x61, 0x67, 0x65,
0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6d, 0x61, 0x67,
0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x22, 0x7a, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6d, 0x61, 0x67, 0x65,
0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x61, 0x79, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x18,
0x6c, 0x6f, 0x61, 0x64, 0x12, 0x31, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x22, 0x7a, 0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50,
0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x31, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61,
0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e,
0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x74, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52,
0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x08, 0x61, 0x75, 0x74,
0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x22, 0x3c, 0x0a, 0x13, 0x42, 0x75, 0x68, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65,
0x67, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x65, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x67, 0x65, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x22, 0x3c, 0x0a, 0x13,
0x11, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76,
0x64, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x1f, 0x0a, 0x09, 0x42, 0x75, 0x67, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28,
0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x42, 0x75, 0x67, 0x6c, 0x65,
0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x1f, 0x0a, 0x09, 0x42, 0x75,
0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
0x33, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x90, 0x02, 0x0a, 0x10,
0x42, 0x75, 0x67, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65,
0x12, 0x1e, 0x0a, 0x1a, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x42, 0x55, 0x47, 0x4c,
0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00,
0x12, 0x07, 0x0a, 0x03, 0x53, 0x4d, 0x53, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x4d, 0x53,
0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x43, 0x53, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x43,
0x4c, 0x4f, 0x55, 0x44, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x49,
0x4d, 0x44, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x49, 0x56, 0x45, 0x52, 0x45, 0x44, 0x10, 0x05, 0x12,
0x12, 0x0a, 0x0e, 0x49, 0x4d, 0x44, 0x4e, 0x5f, 0x44, 0x49, 0x53, 0x50, 0x4c, 0x41, 0x59, 0x45,
0x44, 0x10, 0x06, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4d, 0x44, 0x4e, 0x5f, 0x46, 0x41, 0x4c, 0x4c,
0x42, 0x41, 0x43, 0x4b, 0x10, 0x07, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x43, 0x53, 0x5f, 0x47, 0x45,
0x4e, 0x45, 0x52, 0x49, 0x43, 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x54, 0x44, 0x10, 0x09,
0x12, 0x12, 0x0a, 0x0e, 0x46, 0x54, 0x5f, 0x45, 0x32, 0x45, 0x45, 0x5f, 0x4c, 0x45, 0x47, 0x41,
0x43, 0x59, 0x10, 0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x54, 0x5f, 0x45, 0x32, 0x45, 0x45, 0x5f,
0x58, 0x4d, 0x4c, 0x10, 0x0b, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x45, 0x52,
0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0c, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x42,
0x4d, 0x5f, 0x53, 0x50, 0x41, 0x4d, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x10, 0x0d, 0x12,
0x0d, 0x0a, 0x09, 0x53, 0x41, 0x54, 0x45, 0x4c, 0x4c, 0x49, 0x54, 0x45, 0x10, 0x0e, 0x2a, 0x75,
0x0a, 0x0c, 0x42, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x18,
0x0a, 0x14, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x42, 0x52, 0x4f, 0x57, 0x53, 0x45,
0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x54, 0x48, 0x45,
0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x48, 0x52, 0x4f, 0x4d, 0x45, 0x10, 0x02, 0x12,
0x0b, 0x0a, 0x07, 0x46, 0x49, 0x52, 0x45, 0x46, 0x4f, 0x58, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06,
0x53, 0x41, 0x46, 0x41, 0x52, 0x49, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x50, 0x45, 0x52,
0x41, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x49, 0x45, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x45,
0x44, 0x47, 0x45, 0x10, 0x07, 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 ( var (
@ -491,36 +822,41 @@ func file_client_proto_rawDescGZIP() []byte {
return file_client_proto_rawDescData return file_client_proto_rawDescData
} }
var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_client_proto_goTypes = []interface{}{ var file_client_proto_goTypes = []interface{}{
(*SendMessage)(nil), // 0: client.SendMessage (BugleMessageType)(0), // 0: client.BugleMessageType
(*AckMessagePayload)(nil), // 1: client.AckMessagePayload (BrowserTypes)(0), // 1: client.BrowserTypes
(*AckMessageData)(nil), // 2: client.AckMessageData (*NotifyDittoActivityPayload)(nil), // 2: client.NotifyDittoActivityPayload
(*ImageMetaData)(nil), // 3: client.ImageMetaData (*AckMessageResponse)(nil), // 3: client.AckMessageResponse
(*UploadImagePayload)(nil), // 4: client.UploadImagePayload (*AckContainer)(nil), // 4: client.AckContainer
(*BugleBackendService)(nil), // 5: client.BugleBackendService (*AckData)(nil), // 5: client.AckData
(*BugleCode)(nil), // 6: client.BugleCode (*AckAmount)(nil), // 6: client.AckAmount
(*Device)(nil), // 7: messages.Device (*AckMessagePayload)(nil), // 7: client.AckMessagePayload
(*MessageData)(nil), // 8: messages.MessageData (*AckMessageData)(nil), // 8: client.AckMessageData
(*AuthMessage)(nil), // 9: messages.AuthMessage (*ImageMetaData)(nil), // 9: client.ImageMetaData
(*EmptyArr)(nil), // 10: messages.EmptyArr (*UploadImagePayload)(nil), // 10: client.UploadImagePayload
(*BugleBackendService)(nil), // 11: client.BugleBackendService
(*BugleCode)(nil), // 12: client.BugleCode
(*AuthMessage)(nil), // 13: messages.AuthMessage
(*EmptyArr)(nil), // 14: messages.EmptyArr
(*Device)(nil), // 15: messages.Device
} }
var file_client_proto_depIdxs = []int32{ var file_client_proto_depIdxs = []int32{
7, // 0: client.SendMessage.pairedDevice:type_name -> messages.Device 4, // 0: client.AckMessageResponse.container:type_name -> client.AckContainer
8, // 1: client.SendMessage.messageData:type_name -> messages.MessageData 5, // 1: client.AckContainer.data:type_name -> client.AckData
9, // 2: client.SendMessage.authData:type_name -> messages.AuthMessage 6, // 2: client.AckData.ackAmount:type_name -> client.AckAmount
10, // 3: client.SendMessage.emptyArr:type_name -> messages.EmptyArr 13, // 3: client.AckMessagePayload.authData:type_name -> messages.AuthMessage
9, // 4: client.AckMessagePayload.authData:type_name -> messages.AuthMessage 14, // 4: client.AckMessagePayload.emptyArr:type_name -> messages.EmptyArr
10, // 5: client.AckMessagePayload.emptyArr:type_name -> messages.EmptyArr 15, // 5: client.AckMessageData.device:type_name -> messages.Device
7, // 6: client.AckMessageData.device:type_name -> messages.Device 9, // 6: client.UploadImagePayload.metaData:type_name -> client.ImageMetaData
3, // 7: client.UploadImagePayload.metaData:type_name -> client.ImageMetaData 13, // 7: client.UploadImagePayload.authData:type_name -> messages.AuthMessage
9, // 8: client.UploadImagePayload.authData:type_name -> messages.AuthMessage 12, // 8: client.BugleBackendService.data:type_name -> client.BugleCode
6, // 9: client.BugleBackendService.data:type_name -> client.BugleCode 9, // [9:9] is the sub-list for method output_type
10, // [10:10] is the sub-list for method output_type 9, // [9:9] is the sub-list for method input_type
10, // [10:10] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension type_name 9, // [9:9] is the sub-list for extension extendee
10, // [10:10] is the sub-list for extension extendee 0, // [0:9] is the sub-list for field type_name
0, // [0:10] is the sub-list for field type_name
} }
func init() { file_client_proto_init() } func init() { file_client_proto_init() }
@ -531,7 +867,7 @@ func file_client_proto_init() {
file_messages_proto_init() file_messages_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SendMessage); i { switch v := v.(*NotifyDittoActivityPayload); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -543,7 +879,7 @@ func file_client_proto_init() {
} }
} }
file_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AckMessagePayload); i { switch v := v.(*AckMessageResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -555,7 +891,7 @@ func file_client_proto_init() {
} }
} }
file_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AckMessageData); i { switch v := v.(*AckContainer); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -567,7 +903,7 @@ func file_client_proto_init() {
} }
} }
file_client_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImageMetaData); i { switch v := v.(*AckData); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -579,7 +915,7 @@ func file_client_proto_init() {
} }
} }
file_client_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UploadImagePayload); i { switch v := v.(*AckAmount); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -591,7 +927,7 @@ func file_client_proto_init() {
} }
} }
file_client_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BugleBackendService); i { switch v := v.(*AckMessagePayload); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -603,6 +939,54 @@ func file_client_proto_init() {
} }
} }
file_client_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_client_proto_msgTypes[6].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[7].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[8].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[9].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[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BugleCode); i { switch v := v.(*BugleCode); i {
case 0: case 0:
return &v.state return &v.state
@ -620,13 +1004,14 @@ func file_client_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_client_proto_rawDesc, RawDescriptor: file_client_proto_rawDesc,
NumEnums: 0, NumEnums: 2,
NumMessages: 7, NumMessages: 11,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_client_proto_goTypes, GoTypes: file_client_proto_goTypes,
DependencyIndexes: file_client_proto_depIdxs, DependencyIndexes: file_client_proto_depIdxs,
EnumInfos: file_client_proto_enumTypes,
MessageInfos: file_client_proto_msgTypes, MessageInfos: file_client_proto_msgTypes,
}.Build() }.Build()
File_client_proto = out.File File_client_proto = out.File

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,767 +0,0 @@
// 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=userAgent,proto3" json:"userAgent,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 UnpairDeviceData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Browser *Device `protobuf:"bytes,1,opt,name=browser,proto3" json:"browser,omitempty"`
}
func (x *UnpairDeviceData) Reset() {
*x = UnpairDeviceData{}
if protoimpl.UnsafeEnabled {
mi := &file_pairing_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UnpairDeviceData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UnpairDeviceData) ProtoMessage() {}
func (x *UnpairDeviceData) 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 UnpairDeviceData.ProtoReflect.Descriptor instead.
func (*UnpairDeviceData) Descriptor() ([]byte, []int) {
return file_pairing_proto_rawDescGZIP(), []int{4}
}
func (x *UnpairDeviceData) 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[5]
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[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 WebAuthKey.ProtoReflect.Descriptor instead.
func (*WebAuthKey) Descriptor() ([]byte, []int) {
return file_pairing_proto_rawDescGZIP(), []int{5}
}
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"`
UnpairDeviceData *UnpairDeviceData `protobuf:"bytes,5,opt,name=unpairDeviceData,proto3" json:"unpairDeviceData,omitempty"`
}
func (x *Container) Reset() {
*x = Container{}
if protoimpl.UnsafeEnabled {
mi := &file_pairing_proto_msgTypes[6]
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[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 Container.ProtoReflect.Descriptor instead.
func (*Container) Descriptor() ([]byte, []int) {
return file_pairing_proto_rawDescGZIP(), []int{6}
}
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
}
func (x *Container) GetUnpairDeviceData() *UnpairDeviceData {
if x != nil {
return x.UnpairDeviceData
}
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"`
AESCTR256Key []byte `protobuf:"bytes,2,opt,name=AESCTR256Key,proto3" json:"AESCTR256Key,omitempty"`
SHA256Key []byte `protobuf:"bytes,3,opt,name=SHA256Key,proto3" json:"SHA256Key,omitempty"`
}
func (x *UrlData) Reset() {
*x = UrlData{}
if protoimpl.UnsafeEnabled {
mi := &file_pairing_proto_msgTypes[7]
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[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 UrlData.ProtoReflect.Descriptor instead.
func (*UrlData) Descriptor() ([]byte, []int) {
return file_pairing_proto_rawDescGZIP(), []int{7}
}
func (x *UrlData) GetPairingKey() []byte {
if x != nil {
return x.PairingKey
}
return nil
}
func (x *UrlData) GetAESCTR256Key() []byte {
if x != nil {
return x.AESCTR256Key
}
return nil
}
func (x *UrlData) GetSHA256Key() []byte {
if x != nil {
return x.SHA256Key
}
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, 0x74, 0x0a, 0x0e, 0x42, 0x72, 0x6f, 0x77,
0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73,
0x65, 0x72, 0x41, 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, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44,
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, 0x3e, 0x0a, 0x10, 0x55, 0x6e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72,
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, 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, 0x8d, 0x02, 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, 0x12, 0x45, 0x0a, 0x10, 0x75, 0x6e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
0x2e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x55, 0x6e, 0x70, 0x61, 0x69, 0x72, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x10, 0x75, 0x6e, 0x70, 0x61, 0x69,
0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x22, 0x6b, 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, 0x22, 0x0a, 0x0c, 0x41, 0x45, 0x53, 0x43, 0x54, 0x52,
0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x41, 0x45,
0x53, 0x43, 0x54, 0x52, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x48,
0x41, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53,
0x48, 0x41, 0x32, 0x35, 0x36, 0x4b, 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_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, 8)
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
(*UnpairDeviceData)(nil), // 4: pairing.UnpairDeviceData
(*WebAuthKey)(nil), // 5: pairing.WebAuthKey
(*Container)(nil), // 6: pairing.Container
(*UrlData)(nil), // 7: pairing.UrlData
(*Date)(nil), // 8: messages.Date
(*Device)(nil), // 9: messages.Device
}
var file_pairing_proto_depIdxs = []int32{
8, // 0: pairing.PhoneRelayBody.date:type_name -> messages.Date
9, // 1: pairing.PairDeviceData.mobile:type_name -> messages.Device
2, // 2: pairing.PairDeviceData.ecdsaKeys:type_name -> pairing.ECDSAKeys
5, // 3: pairing.PairDeviceData.webAuthKeyData:type_name -> pairing.WebAuthKey
9, // 4: pairing.PairDeviceData.browser:type_name -> messages.Device
9, // 5: pairing.UnpairDeviceData.browser:type_name -> messages.Device
1, // 6: pairing.Container.PhoneRelay:type_name -> pairing.PhoneRelayBody
0, // 7: pairing.Container.browserDetails:type_name -> pairing.BrowserDetails
3, // 8: pairing.Container.pairDeviceData:type_name -> pairing.PairDeviceData
4, // 9: pairing.Container.unpairDeviceData:type_name -> pairing.UnpairDeviceData
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_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.(*UnpairDeviceData); 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.(*WebAuthKey); 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.(*Container); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pairing_proto_msgTypes[7].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: 8,
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
}

View file

@ -0,0 +1,73 @@
syntax = "proto3";
package authentication;
option go_package = "../../binary";
import "messages.proto";
import "client.proto";
message BrowserDetails {
string userAgent = 1;
client.BrowserTypes browserType = 2;
string os = 3;
bool someBool = 6;
}
message AuthenticationContainer {
AuthenticationMessage authMessage = 1;
BrowserDetails browserDetails = 3;
oneof data {
KeyData keyData = 4;
CurrentDeviceData deviceData = 5;
}
}
message AuthenticationMessage {
string requestID = 1;
string network = 3;
bytes tachyonAuthToken = 6;
messages.ConfigVersion configVersion = 7;
}
message ECDSAKeys {
int64 field1 = 1; // idk?
bytes encryptedKeys = 2;
}
message KeyData {
messages.Device mobile = 1;
ECDSAKeys ecdsaKeys = 6;
WebAuthKey webAuthKeyData = 2;
messages.Device browser = 3;
}
message WebAuthKey {
bytes webAuthKey = 1;
int64 validFor = 2;
}
message CurrentDeviceData {
messages.Device browser = 1;
}
message UrlData {
bytes pairingKey = 1;
bytes AESKey = 2;
bytes HMACKey = 3;
}
message TokenData {
bytes tachyonAuthToken = 1;
int64 TTL = 2;
}
message PairedData {
messages.Device mobile = 1;
TokenData tokenData = 2;
messages.Device browser = 3;
}
message RevokePairData {
messages.Device revokedDevice = 1;
}

View file

@ -5,12 +5,21 @@ option go_package = "../../binary";
import "messages.proto"; import "messages.proto";
message SendMessage { message NotifyDittoActivityPayload {
messages.Device pairedDevice = 1; bool success = 2;
messages.MessageData messageData = 2; }
messages.AuthMessage authData = 3;
int64 TTL = 5; message AckMessageResponse {
messages.EmptyArr emptyArr = 9; AckContainer container = 1;
}
message AckContainer {
AckData data = 1;
}
message AckData {
AckAmount ackAmount = 4;
}
message AckAmount {
int32 count = 1;
} }
message AckMessagePayload { message AckMessagePayload {
@ -41,3 +50,32 @@ message BugleBackendService {
message BugleCode { message BugleCode {
int64 type = 2; int64 type = 2;
} }
enum BugleMessageType {
UNKNOWN_BUGLE_MESSAGE_TYPE = 0;
SMS = 1;
MMS = 2;
RCS = 3;
CLOUD_SYNC = 4;
IMDN_DELIVERED = 5;
IMDN_DISPLAYED = 6;
IMDN_FALLBACK = 7;
RCS_GENERIC = 8;
FTD = 9;
FT_E2EE_LEGACY = 10;
FT_E2EE_XML = 11;
LIGHTER_MESSAGE = 12;
RBM_SPAM_REPORT = 13;
SATELLITE = 14;
}
enum BrowserTypes {
UNKNOWN_BROWSER_TYPE = 0;
OTHER = 1;
CHROME = 2;
FIREFOX = 3;
SAFARI = 4;
OPERA = 5;
IE = 6;
EDGE = 7;
}

View file

@ -3,17 +3,56 @@ package conversations;
option go_package = "../../binary"; option go_package = "../../binary";
import "reactions.proto";
message ResendMessagePayload {
string messageID = 2;
}
message ConversationTypePayload {
string conversationID = 2;
}
message UpdateConversationPayload {
UpdateConversationData data = 1;
ConversationActionStatus action = 2;
string conversationID = 3;
ConversationAction5 action5 = 5;
}
message ConversationAction5 {
bool field2 = 2;
}
message UpdateConversationData {
string conversationID = 1;
oneof data {
ConversationStatus status = 12;
ConversationMuteStatus mute = 7;
}
}
message DeleteMessagePayload {
string messageID = 2;
}
message SendMessagePayload { message SendMessagePayload {
string conversationID = 2; string conversationID = 2;
MessagePayload messagePayload = 3; MessagePayload messagePayload = 3;
string tmpID = 5; string tmpID = 5;
bool isReply = 6; // not sure
ReplyPayload reply = 8;
}
message ReplyPayload {
string messageID = 1;
} }
message MessagePayload { message MessagePayload {
string tmpID = 1; string tmpID = 1;
MessagePayloadContent messagePayloadContent = 6; MessagePayloadContent messagePayloadContent = 6;
string conversationID = 7; string conversationID = 7;
string selfParticipantID = 9; // might be participantId string selfParticipantID = 9; // might be participantID
repeated MessageInfo messageInfo = 10; repeated MessageInfo messageInfo = 10;
string tmpID2 = 12; string tmpID2 = 12;
} }
@ -42,65 +81,57 @@ message ListCoversationsPayload {
int64 field4 = 4; // no idea what this is , but only value ive seen is 1 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 { message Cursor {
string someStr = 1; string someStr = 1;
int64 nextCursor = 2; 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 { message Message {
string messageID = 1; string messageID = 1;
IsFromMe from = 3; MsgType msgType = 3;
MessageStatus messageStatus = 4; MessageStatus messageStatus = 4;
int64 timestamp = 5; int64 timestamp = 5; // check this
string conversationID = 7; string conversationID = 7;
string participantID = 9; string participantID = 9;
repeated MessageInfo messageInfo = 10; repeated MessageInfo messageInfo = 10;
MessageType type = 11; int64 type = 11;
string tmpId = 12; string tmpID = 12;
int64 someInt = 16;
repeated reactions.ReactionResponse reactions = 19;
}
message ReplyMessage {
string messageID = 1;
string conversationID = 2; // might be participantID
ReplyMessageData replyMessageData = 3;
}
message ReplyMessageData {
} }
message MessageInfo { message MessageInfo {
string orderInternal = 1; string actionMessageID = 1;
oneof data { oneof data {
MessageContent messageContent = 2; MessageContent messageContent = 2;
ImageContent imageContent = 3; MediaContent mediaContent = 3;
} }
} }
message ImageContent { message MediaContent {
int64 someNumber = 1; MediaFormats format = 1;
string imageID = 2; string mediaID = 2;
string imageName = 4; string mediaName = 4;
int64 size = 5; int64 size = 5;
ImagePixels pixels = 6; Pixels pixels = 6;
bytes imageData = 7; bytes mediaData = 7;
string imageID2 = 9; string mediaID2 = 9;
bytes decryptionKey = 11; bytes decryptionKey = 11;
bytes decryptionKey2 = 12; // same value as decryptionkey? bytes decryptionKey2 = 12; // same value as decryptionkey?
} }
message ImagePixels { message Pixels {
int64 width = 1; int64 width = 1;
int64 height = 2; int64 height = 2;
} }
@ -109,30 +140,16 @@ message MessageContent {
string content = 1; string content = 1;
} }
message IsFromMe { message MsgType {
bool fromMe = 1; int64 type = 1;
}
enum MsgStatusCode {
UNKNOWN_STATUS = 0;
SENT = 1;
SENDING = 5;
READ = 11;
} }
message MessageStatus { message MessageStatus {
/* MessageStatusType status = 2;
// MMS / SMS int64 subCode = 3;
UNKNOWN_STATUS = 0;
SENDING = 5;
SENT = 1;
// RCS
READ|SEEN = 11;
*/
MsgStatusCode code = 2;
string errMsg = 4; string errMsg = 4;
string msgStatus = 5; string statusText = 5;
int64 thirdCode = 6;
} }
message Conversations { message Conversations {
@ -143,57 +160,201 @@ message Conversation {
string conversationID = 1; string conversationID = 1;
string name = 2; string name = 2;
LatestMessage latestMessage = 4; LatestMessage latestMessage = 4;
int64 timestampMS = 5; int64 timestampMs = 5;
bool isGroupChat = 10; // not certain bool isGroupChat = 10; // not certain
string selfParticipantID = 11; string selfParticipantID = 11;
/*
1 = unarchived
2 = archived
3 = deleted
*/
//bool bool1 = 13; //bool bool1 = 13;
int64 status = 12; ConvUpdateTypes status = 12;
string hashHex = 15; string avatarHexColor = 15;
string messageID = 17; string latestMessageID = 17;
repeated Participant participants = 20; repeated Participant participants = 20;
repeated string otherParticipants = 21; // participant ids excluding me repeated string otherParticipants = 21; // participant ids excluding me
int64 type = 22; int64 type = 22;
bool subType = 24;
bool thirdType = 29;
} }
message Participant { message Participant {
UserIdentifier id = 1; SmallInfo ID = 1;
string firstName = 2; string firstName = 2;
string fullName = 3; string fullName = 3;
string color = 5; string avatarHexColor = 5;
bool isMe = 6; bool isMe = 6;
Muted muted = 7; Muted muted = 7;
//bool bool2 = 8; int64 someInt = 8;
string avatarID = 10; string avatarID = 10;
// bool bool3 = 11;
int64 bs = 14; int64 bs = 14;
string formattedNumber = 15; string formattedNumber = 15;
int64 someInt1 = 19;
int64 someInt2 = 20;
} }
message UserIdentifier { message SmallInfo {
int64 type = 1; int64 type = 1;
string number = 2; string number = 2;
string participantID = 3; string participantID = 3;
} }
message LatestMessage { message LatestMessage {
string content = 1; string displayContent = 1;
bool fromMe = 2; // isMe? int64 fromMe = 2; // isMe?
string displayName = 4; string displayName = 4;
//Unknown unknown = 5; LatestMessageStatus latestMessageStatus = 5;
} }
message Unknown { message LatestMessageStatus {
int64 field1 = 1; int64 status2 = 1;
int64 field2 = 2; MessageStatusType status = 2;
} }
message Muted { message Muted {
bool isMuted = 1; bool isMuted = 1;
} }
enum MessageStatusType {
STATUS_UNKNOWN = 0;
OUTGOING_COMPLETE = 1;
OUTGOING_DELIVERED = 2;
OUTGOING_DISPLAYED = 11;
OUTGOING_DRAFT = 3;
OUTGOING_SEND_AFTER_PROCESSING = 10;
OUTGOING_YET_TO_SEND = 4;
OUTGOING_SENDING = 5;
OUTGOING_RESENDING = 6;
OUTGOING_AWAITING_RETRY = 7;
OUTGOING_FAILED_GENERIC = 8;
OUTGOING_FAILED_EMERGENCY_NUMBER = 9;
OUTGOING_CANCELED = 12;
OUTGOING_FAILED_TOO_LARGE = 13;
OUTGOING_NOT_DELIVERED_YET = 14;
OUTGOING_REVOCATION_PENDING = 15;
OUTGOING_SCHEDULED = 16;
OUTGOING_FAILED_RECIPIENT_LOST_RCS = 17;
OUTGOING_FAILED_NO_RETRY_NO_FALLBACK = 18;
OUTGOING_FAILED_RECIPIENT_DID_NOT_DECRYPT = 19;
OUTGOING_VALIDATING = 20;
OUTGOING_FAILED_RECIPIENT_LOST_ENCRYPTION = 21;
OUTGOING_FAILED_RECIPIENT_DID_NOT_DECRYPT_NO_MORE_RETRY = 22;
INCOMING_COMPLETE = 100;
INCOMING_YET_TO_MANUAL_DOWNLOAD = 101;
INCOMING_RETRYING_MANUAL_DOWNLOAD = 102;
INCOMING_MANUAL_DOWNLOADING = 103;
INCOMING_RETRYING_AUTO_DOWNLOAD = 104;
INCOMING_AUTO_DOWNLOADING = 105;
INCOMING_DOWNLOAD_FAILED = 106;
INCOMING_EXPIRED_OR_NOT_AVAILABLE = 107;
INCOMING_DELIVERED = 108;
INCOMING_DISPLAYED = 109;
INCOMING_DOWNLOAD_CANCELED = 110;
INCOMING_DOWNLOAD_FAILED_TOO_LARGE = 111;
INCOMING_DOWNLOAD_FAILED_SIM_HAS_NO_DATA = 112;
INCOMING_FAILED_TO_DECRYPT = 113;
INCOMING_DECRYPTION_ABORTED = 114;
/*
TOMBSTONE_PARTICIPANT_JOINED = BasePaymentResult.ERROR_REQUEST_FAILED;
TOMBSTONE_PARTICIPANT_LEFT = BasePaymentResult.ERROR_REQUEST_TIMEOUT;
TOMBSTONE_SELF_LEFT = BasePaymentResult.ERROR_REQUEST_CONNECTION_FAILED;
TOMBSTONE_RCS_GROUP_CREATED = BasePaymentResult.ERROR_BOT_DOMAIN_NOT_WHITELISTED;
*/
TOMBSTONE_MMS_GROUP_CREATED = 204;
TOMBSTONE_SMS_BROADCAST_CREATED = 205;
TOMBSTONE_ONE_ON_ONE_SMS_CREATED = 206;
TOMBSTONE_ONE_ON_ONE_RCS_CREATED = 207;
TOMBSTONE_SWITCH_TO_GROUP_MMS = 208;
TOMBSTONE_SWITCH_TO_BROADCAST_SMS = 209;
TOMBSTONE_SHOW_LINK_PREVIEWS = 210;
TOMBSTONE_GROUP_RENAMED_LOCAL = 211;
TOMBSTONE_VERIFIED_SMS_APPLICABLE = 212;
TOMBSTONE_ENCRYPTED_ONE_ON_ONE_RCS_CREATED = 213;
TOMBSTONE_PROTOCOL_SWITCH_TO_TEXT = 214;
TOMBSTONE_PROTOCOL_SWITCH_TO_RCS = 215;
TOMBSTONE_PROTOCOL_SWITCH_TO_ENCRYPTED_RCS = 216;
TOMBSTONE_GROUP_RENAMED_GLOBAL = 217;
TOMBSTONE_GROUP_NAME_CLEARED_GLOBAL = 218;
TOMBSTONE_PROTOCOL_SWITCH_TO_ENCRYPTED_RCS_INFO = 219;
TOMBSTONE_SELF_REMOVED_FROM_GROUP = 220;
MESSAGE_STATUS_TOMBSTONE_PARTICIPANT_REMOVED_FROM_GROUP = 221;
MESSAGE_STATUS_TOMBSTONE_SMS_NORM_PARTICIPANT_UPGRADED = 222;
MESSAGE_STATUS_TOMBSTONE_RCS_NORM_PARTICIPANT_UPGRADED = 223;
MESSAGE_STATUS_TOMBSTONE_ENCRYPTED_RCS_NORM_PARTICIPANT_UPGRADED = 224;
MESSAGE_STATUS_TOMBSTONE_ENCRYPTED_GROUP_PARTICIPANT_JOINED = 225;
MESSAGE_STATUS_TOMBSTONE_ENCRYPTED_GROUP_PARTICIPANT_JOINED_INFO = 226;
MESSAGE_STATUS_TOMBSTONE_ENCRYPTED_GROUP_PARTICIPANT_LEFT = 227;
MESSAGE_STATUS_TOMBSTONE_ENCRYPTED_GROUP_SELF_LEFT = 228;
MESSAGE_STATUS_TOMBSTONE_ENCRYPTED_GROUP_CREATED = 229;
MESSAGE_STATUS_TOMBSTONE_SELF_REMOVED_FROM_ENCRYPTED_GROUP = 230;
MESSAGE_STATUS_TOMBSTONE_PARTICIPANT_REMOVED_FROM_ENCRYPTED_GROUP = 231;
MESSAGE_STATUS_TOMBSTONE_SUGGESTION_SHORTCUT_STAR_TOOLSTONE = 232;
MESSAGE_STATUS_TOMBSTONE_GROUP_PROTOCOL_SWITCH_RCS_TO_E2EE = 233;
MESSAGE_STATUS_TOMBSTONE_GROUP_PROTOCOL_SWITCH_E2EE_TO_RCS = 234;
MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_TEXT_TO_E2EE = 235;
MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_E2EE_TO_TEXT = 236;
MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_RCS_TO_E2EE = 237;
MESSAGE_STATUS_TOMBSTONE_PROTOCOL_SWITCH_E2EE_TO_RCS = 238;
MESSAGE_STATUS_TOMBSTONE_SATELLITE_EDUCATION = 239;
MESSAGE_DELETED = 300;
}
enum ConversationStatus {
UNKNOWN_STATUS = 0;
UNARCHIVE = 1;
ARCHIVE = 2;
DELETE = 3;
}
enum ConversationActionStatus {
UNKNOWN_ACTION_STATUS = 0;
UNBLOCK = 2;
BLOCK = 7;
BLOCK_AND_REPORT = 8;
}
enum ConversationMuteStatus {
UNMUTE = 0;
MUTE = 1;
}
enum ConvUpdateTypes {
UNKNOWN_CONVTYPE = 0;
UNARCHIVED = 1;
ARCHIVED = 2;
DELETED = 3;
BLOCKED_AND_REPORTED = 5;
BLOCKED = 6;
}
enum MediaFormats {
UNSPECIFIED_TYPE = 0;
IMAGE_JPEG = 1;
IMAGE_JPG = 2;
IMAGE_PNG = 3;
IMAGE_GIF = 4;
IMAGE_WBMP = 5;
IMAGE_X_MS_BMP = 6;
IMAGE_UNSPECIFIED = 7;
VIDEO_MP4 = 8;
VIDEO_3G2 = 9;
VIDEO_3GPP = 10;
VIDEO_WEBM = 11;
VIDEO_MKV = 12;
VIDEO_UNSPECIFIED = 13;
AUDIO_AAC = 14;
AUDIO_AMR = 15;
AUDIO_MP3 = 16;
AUDIO_MPEG = 17;
AUDIO_MPG = 18;
AUDIO_MP4 = 19;
AUDIO_MP4_LATM = 20;
AUDIO_3GPP = 21;
AUDIO_OGG = 22;
AUDIO_UNSPECIFIED = 23;
TEXT_VCARD = 24;
APP_PDF = 28;
APP_TXT = 29;
APP_HTML = 30;
AUDIO_OGG2 = 31;
APP_SMIL = 32;
}

View file

@ -4,26 +4,32 @@ package events;
option go_package = "../../binary"; option go_package = "../../binary";
import "conversations.proto"; import "conversations.proto";
import "authentication.proto";
import "settings.proto";
/* /*
Cases
2 = CONVERSATION
3 = MESSAGE
5 = PHONE SETTINGS
6 = Cases ConversationEvent = 2
2 = updated session MessageEvent = 3
8 = INACTIVE_LACK_OF_ACTIVITY TypingEvent = 4
7 = BROWSER_INACTIVE_FROM_TIMEOUT SettingsEvent = 5
6|5 = user_alert:battery UserAlertEvent = 6
3|4 = user_alert:data_connection BrowserPresenceCheckEvent = 7
10 = OBSERVER_REGISTERED ParticipantsEvent = 8
ConversationTypeEvent = 9
FavoriteStickersEvent = 10
RecentStickerEvent = 11
CloudStoreInfoEvent = 12
BlobForAttachmentProgressUpdate = 13
*/ */
message Event { message UpdateEvents {
oneof event { oneof event {
ConversationEvent conversationEvent = 2; ConversationEvent conversationEvent = 2;
MessageEvent messageEvent = 3; MessageEvent messageEvent = 3;
TypingEvent typingEvent = 4;
settings.Settings settingsEvent = 5;
UserAlertEvent userAlertEvent = 6; UserAlertEvent userAlertEvent = 6;
} }
} }
@ -32,25 +38,78 @@ message ConversationEvent {
conversations.Conversation data = 2; conversations.Conversation data = 2;
} }
message TypingEvent {
TypingData data = 2;
}
message MessageEvent { message MessageEvent {
conversations.Message data = 2; conversations.Message data = 2;
} }
message UserAlertEvent { message UserAlertEvent {
/* AlertType alertType = 2;
2 = BROWSER_ACTIVE (new session created in other browser) }
1 = ? message TypingData {
string conversationID = 1;
8 = INACTIVE_LACK_OF_ACTIVITY User user = 2;
TypingTypes type = 3;
7 = INACTIVE_TIMEOUT }
5|6 = BATTERY (tf?) message User {
int64 field1 = 1;
3|4 = DATA_CONNECTION (tf?) string number = 2;
}
10 = OBSERVER_REGISTERED (tf?)
*/ message PairEvents {
int64 alertType = 2; oneof event {
authentication.PairedData paired = 4;
authentication.RevokePairData revoked = 5;
}
}
enum AlertType {
ALERT_TYPE_UNKNOWN = 0;
BROWSER_INACTIVE = 1; // Emitted whenever browser connection becomes inactive
BROWSER_ACTIVE = 2; // Emitted whenever a new browser session is created
MOBILE_DATA_CONNECTION = 3; // Emitted when the paired device connects to data
MOBILE_WIFI_CONNECTION = 4; // Emitted when the paired device connects to wifi
MOBILE_BATTERY_LOW = 5; // Emitted if the paired device reaches low battery
MOBILE_BATTERY_RESTORED = 6; // Emitted if the paired device has restored battery enough to not be considered low
BROWSER_INACTIVE_FROM_TIMEOUT = 7; // Emitted whenever browser connection becomes inactive due to timeout
BROWSER_INACTIVE_FROM_INACTIVITY = 8; // Emitted whenever browser connection becomes inactive due to inactivity
RCS_CONNECTION = 9; // Emitted whenever RCS connection has been established successfully
OBSERVER_REGISTERED = 10; // Unknown
MOBILE_DATABASE_SYNCING = 11; // Emitted whenever the paired device is attempting to sync db
MOBILE_DATABASE_SYNC_COMPLETE = 12; // Emitted whenever the paired device has completed the db sync
MOBILE_DATABASE_SYNC_STARTED = 13; // Emitted whenever the paired device has begun syncing the db
MOBILE_DATABASE_PARTIAL_SYNC_COMPLETED = 14; // Emitted whenever the paired device has successfully synced a chunk of the db
MOBILE_DATABASE_PARTIAL_SYNC_STARTED = 15; // Emitted whenever the paired device has begun syncing a chunk of the db
CONTACTS_REFRESH_STARTED = 16; // Emitted whenever the paired device has begun refreshing contacts
CONTACTS_REFRESH_COMPLETED = 17; // Emitted whenever the paired device has successfully refreshed contacts
}
enum GRPCStatus {
OK = 0;
CANCELLED = 1;
UNKNOWN = 2;
INVALID_ARGUMENT = 3;
DEADLINE_EXCEEDED = 4;
NOT_FOUND = 5;
ALREADY_EXISTS = 6;
PERMISSION_DENIED = 7;
RESOURCE_EXHAUSTED = 8;
FAILED_PRECONDITION = 9;
ABORTED = 10;
OUT_OF_RANGE = 11;
UNIMPLEMENTED = 12;
INTERNAL = 13;
UNAVAILABLE = 14;
DATA_LOSS = 15;
UNAUTHENTICATED = 16;
}
enum TypingTypes {
STOPPED_TYPING = 0;
STARTED_TYPING = 1;
} }

View file

@ -3,42 +3,128 @@ package messages;
option go_package = "../../binary"; option go_package = "../../binary";
message EncodedPayload { message RegisterRefreshPayload {
string requestID = 1; AuthMessage messageAuth = 1;
int64 opcode = 2; Device currBrowserDevice = 2;
bytes encryptedData = 5; int64 unixTimestamp = 3;
string sessionID = 6; string signature = 4;
EmptyRefreshArr emptyRefreshArr = 13;
int32 messageType = 16;
} }
message EncodedResponse { message EmptyRefreshArr {
string requestID = 1; EmptyEmptyArr emptyArr = 9;
//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 { message EmptyEmptyArr {
string requestID = 1;
int64 routingOpCode = 2; }
string ts1 = 3;
int64 field5 = 5; message InternalMessage {
string ts2 = 6; bytes unknown1 = 1;
string someString = 7; InternalMessageData data = 2;
}
message InternalMessageData {
string responseID = 1;
BugleRoute bugleRoute = 2;
string startExecute = 3;
//bytes unknown4 = 4;
MessageType messageType = 5;
string finishExecute = 6;
string millisecondsTaken = 7;
Device mobile = 8; Device mobile = 8;
Device browser = 9; Device browser = 9;
string encodedData = 12; //bytes unknown5 = 10;
string encodedRequestID = 17; //bytes unknown6 = 11;
MsgTypeArr msgTypeArr = 23; bytes protobufData = 12;
//bytes unknown7 = 13;
//bytes unknown8 = 14;
//bytes unknown9 = 15;
//bytes unknown10 = 16;
string signatureID = 17;
//bytes unknown11 = 18;
//bytes unknown12 = 19;
//bytes unknown13 = 20;
string timestamp = 21;
} }
message MsgTypeArr { message InternalRequestData {
string sessionID = 1;
int64 timestamp = 3;
ActionType action = 4;
bool bool1 = 6;
bool bool2 = 7;
bytes encryptedData = 8;
bool bool3 = 9;
}
message SendMessage {
Device mobile = 1;
SendMessageData messageData = 2;
SendMessageAuth messageAuth = 3;
//bytes unknown1 = 4;
int64 TTL = 5; // might be something related to config
//bytes unknown2 = 6;
//bytes unknown3 = 7;
//bytes unknown4 = 8;
EmptyArr emptyArr = 9;
}
message SendMessageAuth {
string requestID = 1;
//bytes unknown1 = 2;
//bytes unknown2 = 3;
//bytes unknown3 = 4;
//bytes unknown4 = 5;
bytes tachyonAuthToken = 6;
ConfigVersion configVersion = 7;
}
message SendMessageInternal {
string requestID = 1;
ActionType action = 2;
bytes encryptedProtoData = 5;
string sessionID = 6;
}
/*
requestID = 1
encodedData = {
requestID = 1 ^same
sessionID = 6
}
*/
message SendMessageData {
string requestID = 1;
BugleRoute bugleRoute = 2;
//bytes unknown1 = 3;
//bytes unknown2 = 4;
//bytes unknown3 = 5;
//bytes unknown4 = 6;
//bytes unknown5 = 7;
//bytes unknown6 = 8;
//bytes unknown7 = 9;
//bytes unknown8 = 10;
//bytes unknown9 = 11;
bytes protobufData = 12;
//bytes unknown10 = 13;
//bytes unknown11 = 14;
//bytes unknown12 = 15;
//bytes unknown13 = 16;
//bytes unknown14 = 17;
//bytes unknown15 = 18;
//bytes unknown16 = 19;
//bytes unknown17 = 20;
//bytes unknown18 = 21;
//bytes unknown19 = 22;
MessageTypeData messageTypeData = 23;
}
message MessageTypeData {
EmptyArr emptyArr = 1; EmptyArr emptyArr = 1;
int64 msgType = 2; MessageType messageType = 2;
} }
message EmptyArr { message EmptyArr {
@ -47,8 +133,8 @@ message EmptyArr {
message AuthMessage { message AuthMessage {
string requestID = 1; string requestID = 1;
bytes rpcKey = 6; bytes tachyonAuthToken = 6;
Date date = 7; ConfigVersion configVersion = 7;
} }
message ReceiveMessagesRequest { message ReceiveMessagesRequest {
@ -66,21 +152,54 @@ message BaseData {
EmptyArr emptyArr = 6; EmptyArr emptyArr = 6;
} }
message RPCResponse {
bytes unknown = 1;
MessageData data = 2;
}
message Device { message Device {
int64 userID = 1; int64 userID = 1;
string registrationID = 2; string sourceID = 2;
string network = 3; string network = 3;
} }
message Date { enum BugleRoute {
int64 year = 3; UNKNOWN_BUGLE_ROUTE = 0;
int64 seq1 = 4; DataEvent = 19;
int64 seq2 = 5; PairEvent = 14;
int64 seq3 = 7; }
int64 seq4 = 9; /*
enum EventType {
UNKNOWN_EVENT_TYPE = 0;
ONE = 1;
TWO = 2;
THREE = 3;
FOUR = 4;
FIVE = 5;
SIXTEEN = 16;
}
*/
message ConfigVersion {
int32 V1 = 3;
int32 V2 = 4;
int32 V3 = 5;
int32 V4 = 7;
int32 V5 = 9;
}
enum ActionType {
UNKNOWN_ACTION_TYPE = 0;
LIST_CONVERSATIONS = 1;
LIST_MESSAGES = 2;
SEND_MESSAGE = 3;
LIST_CONVERSATIONS_SYNC = 1111;
GET_UPDATES = 16;
GET_CONVERSATION_TYPE = 21;
NOTIFY_DITTO_ACTIVITY = 22;
DELETE_MESSAGE = 23;
RESEND_MESSAGE = 25;
IS_BUGLE_DEFAULT = 31;
SEND_REACTION = 38;
}
enum MessageType {
UNKNOWN_MESSAGE_TYPE = 0;
BUGLE_MESSAGE = 2;
BUGLE_ANNOTATION = 16;
} }

View file

@ -1,54 +0,0 @@
syntax = "proto3";
package pairing;
option go_package = "../../binary";
import "messages.proto";
message BrowserDetails {
string userAgent = 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 UnpairDeviceData {
messages.Device browser = 1;
}
message WebAuthKey {
bytes webAuthKey = 1;
int64 validFor = 2;
}
message Container {
PhoneRelayBody PhoneRelay = 1;
BrowserDetails browserDetails = 3;
PairDeviceData pairDeviceData = 4;
UnpairDeviceData unpairDeviceData = 5;
}
message UrlData {
bytes pairingKey = 1;
bytes AESCTR256Key = 2;
bytes SHA256Key = 3;
}

View file

@ -0,0 +1,56 @@
syntax = "proto3";
package reactions;
option go_package = "../../binary";
enum Reaction {
UNSPECIFIED = 0;
ADD = 1;
REMOVE = 2;
SWITCH = 3;
}
message SendReactionPayload {
string messageID = 1;
ReactionData reactionData = 2;
Reaction action = 3;
}
message SendReactionResponse {
bool success = 1;
}
message ReactionData {
bytes emojiUnicode = 1;
int64 emojiType = 2;
}
message ReactionResponse {
ReactionData data = 1;
repeated string reactorParticipantsID = 2; // participants reacted with this emoji
}
message EmojiMeta {
repeated EmojiMetaData emojiMetaData = 1;
}
message EmojiMetaData {
bytes emojiUnicode = 1;
repeated string names = 2;
}
enum Emojis {
REACTION_TYPE_UNSPECIFIED = 0;
LIKE = 1;
LOVE = 2;
LAUGH = 3;
SURPRISED = 4;
SAD = 5;
ANGRY = 6;
DISLIKE = 7;
CUSTOM = 8;
QUESTIONING = 9;
CRYING_FACE = 10;
POUTING_FACE = 11;
RED_HEART = 12;
}

View file

@ -1,39 +0,0 @@
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;
}

View file

@ -3,17 +3,95 @@ package responses;
option go_package = "../../binary"; option go_package = "../../binary";
import "settings.proto"; import "events.proto";
import "messages.proto";
import "conversations.proto"; import "conversations.proto";
message PrepareNewSession { message RegisterRefreshResponse {
RefreshAuthData tokenData = 2;
}
message RefreshAuthData {
bytes tachyonAuthToken = 1;
string validFor = 2;
}
message FetchMessagesResponse {
repeated conversations.Message messages = 2;
bytes someBytes = 3;
int64 totalMessages = 4;
conversations.Cursor cursor = 5;
}
message DeleteMessageResponse {
bool success = 2;
}
message UpdateConversationResponse {
bool success = 1;
/*
3 {
1 {
1 {
3: "11"
}
13: 2
}
3: 1
}
*/
}
message GetConversationTypeResponse {
string conversationID = 2;
int32 type = 3;
bool bool1 = 5;
int32 number2 = 6;
}
message NotifyDittoActivityResponse {}
message IsBugleDefaultResponse {
bool success = 1; bool success = 1;
} }
message NewSession { message GetUpdatesResponse {
settings.Settings settings = 5; events.UserAlertEvent data = 6;
} }
message SendMessageResponse { message SendMessageResponse {
conversations.MessageType type = 3; int64 type = 3;
}
message RefreshPhoneRelayResponse {
CoordinateMessage coordinates = 1;
bytes pairKey = 2;
int64 validFor = 3;
}
message WebEncryptionKeyResponse {
CoordinateMessage coordinates = 1;
bytes key = 2;
}
message RegisterPhoneRelayResponse {
CoordinateMessage coordinates = 1;
messages.Device browser = 2;
bytes pairingKey = 3;
int64 validFor = 4;
AuthKeyData authKeyData = 5;
string responseID = 6;
}
message CoordinateMessage {
int64 coord1 = 2;
}
message AuthKeyData {
bytes tachyonAuthToken = 1;
int64 validFor = 2;
}
enum ConversationType {
UNKNOWN_CONVERSATION_TYPE = 0;
} }

View file

@ -6,9 +6,9 @@ option go_package = "../../binary";
message Settings { message Settings {
Data data = 2; Data data = 2;
OpCodeData opCodeData = 3; SomeData opCodeData = 3;
BooleanFields boolFields = 4; RCSSettings rcsSettings = 4;
string version = 5; string bugleVersion = 5;
bool bool1 = 7; bool bool1 = 7;
BooleanFields2 boolFields2 = 8; BooleanFields2 boolFields2 = 8;
string emptyString = 9; string emptyString = 9;
@ -16,12 +16,16 @@ message Settings {
} }
message Data { // i think its simdata? no clue message Data { // i think its simdata? no clue
BoolMsg boolMsg = 3; RCSChats rcsChats = 3;
SimData simData = 5; SimData simData = 5;
bool bool1 = 6; bool bool1 = 6;
NoClue noClue = 7; NoClue noClue = 7;
} }
message RCSChats {
bool enabled = 1;
}
message BoolMsg { message BoolMsg {
bool bool1 = 1; bool bool1 = 1;
} }
@ -43,15 +47,18 @@ message NoClue { // just a guess lol
string count = 1; string count = 1;
} }
message OpCodeData { message SomeData {
bool field7 = 7; bool field7 = 7;
bool field12 = 12;
repeated bytes someEmojis = 15;
string jsonData = 16; string jsonData = 16;
string someString = 17;
} }
message BooleanFields { message RCSSettings {
bool bool1 = 1; bool isEnabled = 1;
bool bool2 = 2; bool sendReadReceipts = 2;
bool bool3 = 3; bool showTypingIndicators = 3;
bool bool4 = 4; bool bool4 = 4;
} }

View file

@ -0,0 +1,670 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.30.0
// protoc v3.21.12
// source: reactions.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 Reaction int32
const (
Reaction_UNSPECIFIED Reaction = 0
Reaction_ADD Reaction = 1
Reaction_REMOVE Reaction = 2
Reaction_SWITCH Reaction = 3
)
// Enum value maps for Reaction.
var (
Reaction_name = map[int32]string{
0: "UNSPECIFIED",
1: "ADD",
2: "REMOVE",
3: "SWITCH",
}
Reaction_value = map[string]int32{
"UNSPECIFIED": 0,
"ADD": 1,
"REMOVE": 2,
"SWITCH": 3,
}
)
func (x Reaction) Enum() *Reaction {
p := new(Reaction)
*p = x
return p
}
func (x Reaction) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Reaction) Descriptor() protoreflect.EnumDescriptor {
return file_reactions_proto_enumTypes[0].Descriptor()
}
func (Reaction) Type() protoreflect.EnumType {
return &file_reactions_proto_enumTypes[0]
}
func (x Reaction) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Reaction.Descriptor instead.
func (Reaction) EnumDescriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{0}
}
type Emojis int32
const (
Emojis_REACTION_TYPE_UNSPECIFIED Emojis = 0
Emojis_LIKE Emojis = 1
Emojis_LOVE Emojis = 2
Emojis_LAUGH Emojis = 3
Emojis_SURPRISED Emojis = 4
Emojis_SAD Emojis = 5
Emojis_ANGRY Emojis = 6
Emojis_DISLIKE Emojis = 7
Emojis_CUSTOM Emojis = 8
Emojis_QUESTIONING Emojis = 9
Emojis_CRYING_FACE Emojis = 10
Emojis_POUTING_FACE Emojis = 11
Emojis_RED_HEART Emojis = 12
)
// Enum value maps for Emojis.
var (
Emojis_name = map[int32]string{
0: "REACTION_TYPE_UNSPECIFIED",
1: "LIKE",
2: "LOVE",
3: "LAUGH",
4: "SURPRISED",
5: "SAD",
6: "ANGRY",
7: "DISLIKE",
8: "CUSTOM",
9: "QUESTIONING",
10: "CRYING_FACE",
11: "POUTING_FACE",
12: "RED_HEART",
}
Emojis_value = map[string]int32{
"REACTION_TYPE_UNSPECIFIED": 0,
"LIKE": 1,
"LOVE": 2,
"LAUGH": 3,
"SURPRISED": 4,
"SAD": 5,
"ANGRY": 6,
"DISLIKE": 7,
"CUSTOM": 8,
"QUESTIONING": 9,
"CRYING_FACE": 10,
"POUTING_FACE": 11,
"RED_HEART": 12,
}
)
func (x Emojis) Enum() *Emojis {
p := new(Emojis)
*p = x
return p
}
func (x Emojis) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Emojis) Descriptor() protoreflect.EnumDescriptor {
return file_reactions_proto_enumTypes[1].Descriptor()
}
func (Emojis) Type() protoreflect.EnumType {
return &file_reactions_proto_enumTypes[1]
}
func (x Emojis) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Emojis.Descriptor instead.
func (Emojis) EnumDescriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{1}
}
type SendReactionPayload struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MessageID string `protobuf:"bytes,1,opt,name=messageID,proto3" json:"messageID,omitempty"`
ReactionData *ReactionData `protobuf:"bytes,2,opt,name=reactionData,proto3" json:"reactionData,omitempty"`
Action Reaction `protobuf:"varint,3,opt,name=action,proto3,enum=reactions.Reaction" json:"action,omitempty"`
}
func (x *SendReactionPayload) Reset() {
*x = SendReactionPayload{}
if protoimpl.UnsafeEnabled {
mi := &file_reactions_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SendReactionPayload) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendReactionPayload) ProtoMessage() {}
func (x *SendReactionPayload) ProtoReflect() protoreflect.Message {
mi := &file_reactions_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 SendReactionPayload.ProtoReflect.Descriptor instead.
func (*SendReactionPayload) Descriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{0}
}
func (x *SendReactionPayload) GetMessageID() string {
if x != nil {
return x.MessageID
}
return ""
}
func (x *SendReactionPayload) GetReactionData() *ReactionData {
if x != nil {
return x.ReactionData
}
return nil
}
func (x *SendReactionPayload) GetAction() Reaction {
if x != nil {
return x.Action
}
return Reaction_UNSPECIFIED
}
type SendReactionResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
}
func (x *SendReactionResponse) Reset() {
*x = SendReactionResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_reactions_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SendReactionResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendReactionResponse) ProtoMessage() {}
func (x *SendReactionResponse) ProtoReflect() protoreflect.Message {
mi := &file_reactions_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 SendReactionResponse.ProtoReflect.Descriptor instead.
func (*SendReactionResponse) Descriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{1}
}
func (x *SendReactionResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
type ReactionData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
EmojiUnicode []byte `protobuf:"bytes,1,opt,name=emojiUnicode,proto3" json:"emojiUnicode,omitempty"`
EmojiType int64 `protobuf:"varint,2,opt,name=emojiType,proto3" json:"emojiType,omitempty"`
}
func (x *ReactionData) Reset() {
*x = ReactionData{}
if protoimpl.UnsafeEnabled {
mi := &file_reactions_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReactionData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReactionData) ProtoMessage() {}
func (x *ReactionData) ProtoReflect() protoreflect.Message {
mi := &file_reactions_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 ReactionData.ProtoReflect.Descriptor instead.
func (*ReactionData) Descriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{2}
}
func (x *ReactionData) GetEmojiUnicode() []byte {
if x != nil {
return x.EmojiUnicode
}
return nil
}
func (x *ReactionData) GetEmojiType() int64 {
if x != nil {
return x.EmojiType
}
return 0
}
type ReactionResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *ReactionData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
ReactorParticipantsID []string `protobuf:"bytes,2,rep,name=reactorParticipantsID,proto3" json:"reactorParticipantsID,omitempty"` // participants reacted with this emoji
}
func (x *ReactionResponse) Reset() {
*x = ReactionResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_reactions_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReactionResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReactionResponse) ProtoMessage() {}
func (x *ReactionResponse) ProtoReflect() protoreflect.Message {
mi := &file_reactions_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 ReactionResponse.ProtoReflect.Descriptor instead.
func (*ReactionResponse) Descriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{3}
}
func (x *ReactionResponse) GetData() *ReactionData {
if x != nil {
return x.Data
}
return nil
}
func (x *ReactionResponse) GetReactorParticipantsID() []string {
if x != nil {
return x.ReactorParticipantsID
}
return nil
}
type EmojiMeta struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
EmojiMetaData []*EmojiMetaData `protobuf:"bytes,1,rep,name=emojiMetaData,proto3" json:"emojiMetaData,omitempty"`
}
func (x *EmojiMeta) Reset() {
*x = EmojiMeta{}
if protoimpl.UnsafeEnabled {
mi := &file_reactions_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EmojiMeta) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EmojiMeta) ProtoMessage() {}
func (x *EmojiMeta) ProtoReflect() protoreflect.Message {
mi := &file_reactions_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 EmojiMeta.ProtoReflect.Descriptor instead.
func (*EmojiMeta) Descriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{4}
}
func (x *EmojiMeta) GetEmojiMetaData() []*EmojiMetaData {
if x != nil {
return x.EmojiMetaData
}
return nil
}
type EmojiMetaData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
EmojiUnicode []byte `protobuf:"bytes,1,opt,name=emojiUnicode,proto3" json:"emojiUnicode,omitempty"`
Names []string `protobuf:"bytes,2,rep,name=names,proto3" json:"names,omitempty"`
}
func (x *EmojiMetaData) Reset() {
*x = EmojiMetaData{}
if protoimpl.UnsafeEnabled {
mi := &file_reactions_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EmojiMetaData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EmojiMetaData) ProtoMessage() {}
func (x *EmojiMetaData) ProtoReflect() protoreflect.Message {
mi := &file_reactions_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 EmojiMetaData.ProtoReflect.Descriptor instead.
func (*EmojiMetaData) Descriptor() ([]byte, []int) {
return file_reactions_proto_rawDescGZIP(), []int{5}
}
func (x *EmojiMetaData) GetEmojiUnicode() []byte {
if x != nil {
return x.EmojiUnicode
}
return nil
}
func (x *EmojiMetaData) GetNames() []string {
if x != nil {
return x.Names
}
return nil
}
var File_reactions_proto protoreflect.FileDescriptor
var file_reactions_proto_rawDesc = []byte{
0x0a, 0x0f, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x9d, 0x01, 0x0a,
0x13, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79,
0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49,
0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x49, 0x44, 0x12, 0x3b, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61,
0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x61, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74,
0x61, 0x52, 0x0c, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12,
0x2b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x13, 0x2e, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x30, 0x0a, 0x14,
0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 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, 0x50,
0x0a, 0x0c, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12, 0x22,
0x0a, 0x0c, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x55, 0x6e, 0x69, 0x63, 0x6f,
0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x54, 0x79, 0x70, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x54, 0x79, 0x70, 0x65,
0x22, 0x75, 0x0a, 0x10, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52,
0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74,
0x61, 0x12, 0x34, 0x0a, 0x15, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x50, 0x61, 0x72, 0x74,
0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x49, 0x44, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
0x52, 0x15, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69,
0x70, 0x61, 0x6e, 0x74, 0x73, 0x49, 0x44, 0x22, 0x4b, 0x0a, 0x09, 0x45, 0x6d, 0x6f, 0x6a, 0x69,
0x4d, 0x65, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x4d, 0x65, 0x74,
0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x65,
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x6d, 0x6f, 0x6a, 0x69, 0x4d, 0x65, 0x74,
0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0d, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x4d, 0x65, 0x74, 0x61,
0x44, 0x61, 0x74, 0x61, 0x22, 0x49, 0x0a, 0x0d, 0x45, 0x6d, 0x6f, 0x6a, 0x69, 0x4d, 0x65, 0x74,
0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6d, 0x6f, 0x6a, 0x69, 0x55, 0x6e,
0x69, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6d, 0x6f,
0x6a, 0x69, 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6d,
0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2a,
0x3c, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55,
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03,
0x41, 0x44, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x10,
0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x10, 0x03, 0x2a, 0xc5, 0x01,
0x0a, 0x06, 0x45, 0x6d, 0x6f, 0x6a, 0x69, 0x73, 0x12, 0x1d, 0x0a, 0x19, 0x52, 0x45, 0x41, 0x43,
0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43,
0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x49, 0x4b, 0x45, 0x10,
0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x56, 0x45, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x4c,
0x41, 0x55, 0x47, 0x48, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x52, 0x50, 0x52, 0x49,
0x53, 0x45, 0x44, 0x10, 0x04, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x41, 0x44, 0x10, 0x05, 0x12, 0x09,
0x0a, 0x05, 0x41, 0x4e, 0x47, 0x52, 0x59, 0x10, 0x06, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x49, 0x53,
0x4c, 0x49, 0x4b, 0x45, 0x10, 0x07, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x55, 0x53, 0x54, 0x4f, 0x4d,
0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x51, 0x55, 0x45, 0x53, 0x54, 0x49, 0x4f, 0x4e, 0x49, 0x4e,
0x47, 0x10, 0x09, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x52, 0x59, 0x49, 0x4e, 0x47, 0x5f, 0x46, 0x41,
0x43, 0x45, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x4f, 0x55, 0x54, 0x49, 0x4e, 0x47, 0x5f,
0x46, 0x41, 0x43, 0x45, 0x10, 0x0b, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x45, 0x44, 0x5f, 0x48, 0x45,
0x41, 0x52, 0x54, 0x10, 0x0c, 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_reactions_proto_rawDescOnce sync.Once
file_reactions_proto_rawDescData = file_reactions_proto_rawDesc
)
func file_reactions_proto_rawDescGZIP() []byte {
file_reactions_proto_rawDescOnce.Do(func() {
file_reactions_proto_rawDescData = protoimpl.X.CompressGZIP(file_reactions_proto_rawDescData)
})
return file_reactions_proto_rawDescData
}
var file_reactions_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_reactions_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_reactions_proto_goTypes = []interface{}{
(Reaction)(0), // 0: reactions.Reaction
(Emojis)(0), // 1: reactions.Emojis
(*SendReactionPayload)(nil), // 2: reactions.SendReactionPayload
(*SendReactionResponse)(nil), // 3: reactions.SendReactionResponse
(*ReactionData)(nil), // 4: reactions.ReactionData
(*ReactionResponse)(nil), // 5: reactions.ReactionResponse
(*EmojiMeta)(nil), // 6: reactions.EmojiMeta
(*EmojiMetaData)(nil), // 7: reactions.EmojiMetaData
}
var file_reactions_proto_depIdxs = []int32{
4, // 0: reactions.SendReactionPayload.reactionData:type_name -> reactions.ReactionData
0, // 1: reactions.SendReactionPayload.action:type_name -> reactions.Reaction
4, // 2: reactions.ReactionResponse.data:type_name -> reactions.ReactionData
7, // 3: reactions.EmojiMeta.emojiMetaData:type_name -> reactions.EmojiMetaData
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_reactions_proto_init() }
func file_reactions_proto_init() {
if File_reactions_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_reactions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SendReactionPayload); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_reactions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SendReactionResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_reactions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReactionData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_reactions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReactionResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_reactions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EmojiMeta); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_reactions_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EmojiMetaData); 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_reactions_proto_rawDesc,
NumEnums: 2,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_reactions_proto_goTypes,
DependencyIndexes: file_reactions_proto_depIdxs,
EnumInfos: file_reactions_proto_enumTypes,
MessageInfos: file_reactions_proto_msgTypes,
}.Build()
File_reactions_proto = out.File
file_reactions_proto_rawDesc = nil
file_reactions_proto_goTypes = nil
file_reactions_proto_depIdxs = nil
}

View file

@ -1,576 +0,0 @@
// 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,
0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x0a, 0x70, 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
}

File diff suppressed because it is too large Load diff

View file

@ -26,9 +26,9 @@ type Settings struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
OpCodeData *OpCodeData `protobuf:"bytes,3,opt,name=opCodeData,proto3" json:"opCodeData,omitempty"` OpCodeData *SomeData `protobuf:"bytes,3,opt,name=opCodeData,proto3" json:"opCodeData,omitempty"`
BoolFields *BooleanFields `protobuf:"bytes,4,opt,name=boolFields,proto3" json:"boolFields,omitempty"` RcsSettings *RCSSettings `protobuf:"bytes,4,opt,name=rcsSettings,proto3" json:"rcsSettings,omitempty"`
Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` BugleVersion string `protobuf:"bytes,5,opt,name=bugleVersion,proto3" json:"bugleVersion,omitempty"`
Bool1 bool `protobuf:"varint,7,opt,name=bool1,proto3" json:"bool1,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"` BoolFields2 *BooleanFields2 `protobuf:"bytes,8,opt,name=boolFields2,proto3" json:"boolFields2,omitempty"`
EmptyString string `protobuf:"bytes,9,opt,name=emptyString,proto3" json:"emptyString,omitempty"` EmptyString string `protobuf:"bytes,9,opt,name=emptyString,proto3" json:"emptyString,omitempty"`
@ -74,23 +74,23 @@ func (x *Settings) GetData() *Data {
return nil return nil
} }
func (x *Settings) GetOpCodeData() *OpCodeData { func (x *Settings) GetOpCodeData() *SomeData {
if x != nil { if x != nil {
return x.OpCodeData return x.OpCodeData
} }
return nil return nil
} }
func (x *Settings) GetBoolFields() *BooleanFields { func (x *Settings) GetRcsSettings() *RCSSettings {
if x != nil { if x != nil {
return x.BoolFields return x.RcsSettings
} }
return nil return nil
} }
func (x *Settings) GetVersion() string { func (x *Settings) GetBugleVersion() string {
if x != nil { if x != nil {
return x.Version return x.BugleVersion
} }
return "" return ""
} }
@ -128,7 +128,7 @@ type Data struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
BoolMsg *BoolMsg `protobuf:"bytes,3,opt,name=boolMsg,proto3" json:"boolMsg,omitempty"` RcsChats *RCSChats `protobuf:"bytes,3,opt,name=rcsChats,proto3" json:"rcsChats,omitempty"`
SimData *SimData `protobuf:"bytes,5,opt,name=simData,proto3" json:"simData,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"` Bool1 bool `protobuf:"varint,6,opt,name=bool1,proto3" json:"bool1,omitempty"`
NoClue *NoClue `protobuf:"bytes,7,opt,name=noClue,proto3" json:"noClue,omitempty"` NoClue *NoClue `protobuf:"bytes,7,opt,name=noClue,proto3" json:"noClue,omitempty"`
@ -166,9 +166,9 @@ func (*Data) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{1} return file_settings_proto_rawDescGZIP(), []int{1}
} }
func (x *Data) GetBoolMsg() *BoolMsg { func (x *Data) GetRcsChats() *RCSChats {
if x != nil { if x != nil {
return x.BoolMsg return x.RcsChats
} }
return nil return nil
} }
@ -194,6 +194,53 @@ func (x *Data) GetNoClue() *NoClue {
return nil return nil
} }
type RCSChats struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
}
func (x *RCSChats) Reset() {
*x = RCSChats{}
if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RCSChats) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RCSChats) ProtoMessage() {}
func (x *RCSChats) 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 RCSChats.ProtoReflect.Descriptor instead.
func (*RCSChats) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{2}
}
func (x *RCSChats) GetEnabled() bool {
if x != nil {
return x.Enabled
}
return false
}
type BoolMsg struct { type BoolMsg struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -205,7 +252,7 @@ type BoolMsg struct {
func (x *BoolMsg) Reset() { func (x *BoolMsg) Reset() {
*x = BoolMsg{} *x = BoolMsg{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[2] mi := &file_settings_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -218,7 +265,7 @@ func (x *BoolMsg) String() string {
func (*BoolMsg) ProtoMessage() {} func (*BoolMsg) ProtoMessage() {}
func (x *BoolMsg) ProtoReflect() protoreflect.Message { func (x *BoolMsg) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[2] mi := &file_settings_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -231,7 +278,7 @@ func (x *BoolMsg) ProtoReflect() protoreflect.Message {
// Deprecated: Use BoolMsg.ProtoReflect.Descriptor instead. // Deprecated: Use BoolMsg.ProtoReflect.Descriptor instead.
func (*BoolMsg) Descriptor() ([]byte, []int) { func (*BoolMsg) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{2} return file_settings_proto_rawDescGZIP(), []int{3}
} }
func (x *BoolMsg) GetBool1() bool { func (x *BoolMsg) GetBool1() bool {
@ -256,7 +303,7 @@ type SimData struct {
func (x *SimData) Reset() { func (x *SimData) Reset() {
*x = SimData{} *x = SimData{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[3] mi := &file_settings_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -269,7 +316,7 @@ func (x *SimData) String() string {
func (*SimData) ProtoMessage() {} func (*SimData) ProtoMessage() {}
func (x *SimData) ProtoReflect() protoreflect.Message { func (x *SimData) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[3] mi := &file_settings_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -282,7 +329,7 @@ func (x *SimData) ProtoReflect() protoreflect.Message {
// Deprecated: Use SimData.ProtoReflect.Descriptor instead. // Deprecated: Use SimData.ProtoReflect.Descriptor instead.
func (*SimData) Descriptor() ([]byte, []int) { func (*SimData) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{3} return file_settings_proto_rawDescGZIP(), []int{4}
} }
func (x *SimData) GetUnknownMessage() *UnknownMessage { func (x *SimData) GetUnknownMessage() *UnknownMessage {
@ -332,7 +379,7 @@ type UnknownMessage struct {
func (x *UnknownMessage) Reset() { func (x *UnknownMessage) Reset() {
*x = UnknownMessage{} *x = UnknownMessage{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[4] mi := &file_settings_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -345,7 +392,7 @@ func (x *UnknownMessage) String() string {
func (*UnknownMessage) ProtoMessage() {} func (*UnknownMessage) ProtoMessage() {}
func (x *UnknownMessage) ProtoReflect() protoreflect.Message { func (x *UnknownMessage) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[4] mi := &file_settings_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -358,7 +405,7 @@ func (x *UnknownMessage) ProtoReflect() protoreflect.Message {
// Deprecated: Use UnknownMessage.ProtoReflect.Descriptor instead. // Deprecated: Use UnknownMessage.ProtoReflect.Descriptor instead.
func (*UnknownMessage) Descriptor() ([]byte, []int) { func (*UnknownMessage) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{4} return file_settings_proto_rawDescGZIP(), []int{5}
} }
func (x *UnknownMessage) GetInt1() int64 { func (x *UnknownMessage) GetInt1() int64 {
@ -386,7 +433,7 @@ type NoClue struct {
func (x *NoClue) Reset() { func (x *NoClue) Reset() {
*x = NoClue{} *x = NoClue{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[5] mi := &file_settings_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -399,7 +446,7 @@ func (x *NoClue) String() string {
func (*NoClue) ProtoMessage() {} func (*NoClue) ProtoMessage() {}
func (x *NoClue) ProtoReflect() protoreflect.Message { func (x *NoClue) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[5] mi := &file_settings_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -412,7 +459,7 @@ func (x *NoClue) ProtoReflect() protoreflect.Message {
// Deprecated: Use NoClue.ProtoReflect.Descriptor instead. // Deprecated: Use NoClue.ProtoReflect.Descriptor instead.
func (*NoClue) Descriptor() ([]byte, []int) { func (*NoClue) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{5} return file_settings_proto_rawDescGZIP(), []int{6}
} }
func (x *NoClue) GetCount() string { func (x *NoClue) GetCount() string {
@ -422,32 +469,35 @@ func (x *NoClue) GetCount() string {
return "" return ""
} }
type OpCodeData struct { type SomeData struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Field7 bool `protobuf:"varint,7,opt,name=field7,proto3" json:"field7,omitempty"` Field7 bool `protobuf:"varint,7,opt,name=field7,proto3" json:"field7,omitempty"`
Field12 bool `protobuf:"varint,12,opt,name=field12,proto3" json:"field12,omitempty"`
SomeEmojis [][]byte `protobuf:"bytes,15,rep,name=someEmojis,proto3" json:"someEmojis,omitempty"`
JsonData string `protobuf:"bytes,16,opt,name=jsonData,proto3" json:"jsonData,omitempty"` JsonData string `protobuf:"bytes,16,opt,name=jsonData,proto3" json:"jsonData,omitempty"`
SomeString string `protobuf:"bytes,17,opt,name=someString,proto3" json:"someString,omitempty"`
} }
func (x *OpCodeData) Reset() { func (x *SomeData) Reset() {
*x = OpCodeData{} *x = SomeData{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[6] mi := &file_settings_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
} }
func (x *OpCodeData) String() string { func (x *SomeData) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*OpCodeData) ProtoMessage() {} func (*SomeData) ProtoMessage() {}
func (x *OpCodeData) ProtoReflect() protoreflect.Message { func (x *SomeData) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[6] mi := &file_settings_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -458,53 +508,74 @@ func (x *OpCodeData) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use OpCodeData.ProtoReflect.Descriptor instead. // Deprecated: Use SomeData.ProtoReflect.Descriptor instead.
func (*OpCodeData) Descriptor() ([]byte, []int) { func (*SomeData) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{6} return file_settings_proto_rawDescGZIP(), []int{7}
} }
func (x *OpCodeData) GetField7() bool { func (x *SomeData) GetField7() bool {
if x != nil { if x != nil {
return x.Field7 return x.Field7
} }
return false return false
} }
func (x *OpCodeData) GetJsonData() string { func (x *SomeData) GetField12() bool {
if x != nil {
return x.Field12
}
return false
}
func (x *SomeData) GetSomeEmojis() [][]byte {
if x != nil {
return x.SomeEmojis
}
return nil
}
func (x *SomeData) GetJsonData() string {
if x != nil { if x != nil {
return x.JsonData return x.JsonData
} }
return "" return ""
} }
type BooleanFields struct { func (x *SomeData) GetSomeString() string {
if x != nil {
return x.SomeString
}
return ""
}
type RCSSettings struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Bool1 bool `protobuf:"varint,1,opt,name=bool1,proto3" json:"bool1,omitempty"` IsEnabled bool `protobuf:"varint,1,opt,name=isEnabled,proto3" json:"isEnabled,omitempty"`
Bool2 bool `protobuf:"varint,2,opt,name=bool2,proto3" json:"bool2,omitempty"` SendReadReceipts bool `protobuf:"varint,2,opt,name=sendReadReceipts,proto3" json:"sendReadReceipts,omitempty"`
Bool3 bool `protobuf:"varint,3,opt,name=bool3,proto3" json:"bool3,omitempty"` ShowTypingIndicators bool `protobuf:"varint,3,opt,name=showTypingIndicators,proto3" json:"showTypingIndicators,omitempty"`
Bool4 bool `protobuf:"varint,4,opt,name=bool4,proto3" json:"bool4,omitempty"` Bool4 bool `protobuf:"varint,4,opt,name=bool4,proto3" json:"bool4,omitempty"`
} }
func (x *BooleanFields) Reset() { func (x *RCSSettings) Reset() {
*x = BooleanFields{} *x = RCSSettings{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[7] mi := &file_settings_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
} }
func (x *BooleanFields) String() string { func (x *RCSSettings) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*BooleanFields) ProtoMessage() {} func (*RCSSettings) ProtoMessage() {}
func (x *BooleanFields) ProtoReflect() protoreflect.Message { func (x *RCSSettings) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[7] mi := &file_settings_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -515,33 +586,33 @@ func (x *BooleanFields) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use BooleanFields.ProtoReflect.Descriptor instead. // Deprecated: Use RCSSettings.ProtoReflect.Descriptor instead.
func (*BooleanFields) Descriptor() ([]byte, []int) { func (*RCSSettings) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{7} return file_settings_proto_rawDescGZIP(), []int{8}
} }
func (x *BooleanFields) GetBool1() bool { func (x *RCSSettings) GetIsEnabled() bool {
if x != nil { if x != nil {
return x.Bool1 return x.IsEnabled
} }
return false return false
} }
func (x *BooleanFields) GetBool2() bool { func (x *RCSSettings) GetSendReadReceipts() bool {
if x != nil { if x != nil {
return x.Bool2 return x.SendReadReceipts
} }
return false return false
} }
func (x *BooleanFields) GetBool3() bool { func (x *RCSSettings) GetShowTypingIndicators() bool {
if x != nil { if x != nil {
return x.Bool3 return x.ShowTypingIndicators
} }
return false return false
} }
func (x *BooleanFields) GetBool4() bool { func (x *RCSSettings) GetBool4() bool {
if x != nil { if x != nil {
return x.Bool4 return x.Bool4
} }
@ -563,7 +634,7 @@ type BooleanFields2 struct {
func (x *BooleanFields2) Reset() { func (x *BooleanFields2) Reset() {
*x = BooleanFields2{} *x = BooleanFields2{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[8] mi := &file_settings_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -576,7 +647,7 @@ func (x *BooleanFields2) String() string {
func (*BooleanFields2) ProtoMessage() {} func (*BooleanFields2) ProtoMessage() {}
func (x *BooleanFields2) ProtoReflect() protoreflect.Message { func (x *BooleanFields2) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[8] mi := &file_settings_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -589,7 +660,7 @@ func (x *BooleanFields2) ProtoReflect() protoreflect.Message {
// Deprecated: Use BooleanFields2.ProtoReflect.Descriptor instead. // Deprecated: Use BooleanFields2.ProtoReflect.Descriptor instead.
func (*BooleanFields2) Descriptor() ([]byte, []int) { func (*BooleanFields2) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{8} return file_settings_proto_rawDescGZIP(), []int{9}
} }
func (x *BooleanFields2) GetBool1() bool { func (x *BooleanFields2) GetBool1() bool {
@ -645,7 +716,7 @@ type BooleanFields3 struct {
func (x *BooleanFields3) Reset() { func (x *BooleanFields3) Reset() {
*x = BooleanFields3{} *x = BooleanFields3{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_settings_proto_msgTypes[9] mi := &file_settings_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -658,7 +729,7 @@ func (x *BooleanFields3) String() string {
func (*BooleanFields3) ProtoMessage() {} func (*BooleanFields3) ProtoMessage() {}
func (x *BooleanFields3) ProtoReflect() protoreflect.Message { func (x *BooleanFields3) ProtoReflect() protoreflect.Message {
mi := &file_settings_proto_msgTypes[9] mi := &file_settings_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -671,7 +742,7 @@ func (x *BooleanFields3) ProtoReflect() protoreflect.Message {
// Deprecated: Use BooleanFields3.ProtoReflect.Descriptor instead. // Deprecated: Use BooleanFields3.ProtoReflect.Descriptor instead.
func (*BooleanFields3) Descriptor() ([]byte, []int) { func (*BooleanFields3) Descriptor() ([]byte, []int) {
return file_settings_proto_rawDescGZIP(), []int{9} return file_settings_proto_rawDescGZIP(), []int{10}
} }
func (x *BooleanFields3) GetBool1() bool { func (x *BooleanFields3) GetBool1() bool {
@ -734,94 +805,107 @@ var File_settings_proto protoreflect.FileDescriptor
var file_settings_proto_rawDesc = []byte{ var file_settings_proto_rawDesc = []byte{
0x0a, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x12, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0xef, 0x02, 0x0a, 0x08, 0x53,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 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, 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, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x0a, 0x6f,
0x70, 0x43, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 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, 0x12, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, 0x44,
0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x6f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x6f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12,
0x61, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x37, 0x0a, 0x0b, 0x72, 0x63, 0x73, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04,
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e,
0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x52, 0x0a, 0x52, 0x43, 0x53, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0b, 0x72, 0x63, 0x73,
0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x75, 0x67, 0x6c,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x07, 0x20, 0x62, 0x75, 0x67, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05,
0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x3a, 0x0a, 0x0b, 0x62, 0x6f, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f,
0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x6c, 0x31, 0x12, 0x3a, 0x0a, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73,
0x18, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73,
0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x32, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x32, 0x12, 0x20,
0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6d, 0x70, 0x0a, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20,
0x74, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x3a, 0x0a, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x12, 0x3a, 0x0a, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x18,
0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x52, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x52,
0x6c, 0x64, 0x73, 0x33, 0x22, 0xa0, 0x01, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x0b, 0x62, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x22, 0xa3, 0x01, 0x0a,
0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x08, 0x72, 0x63, 0x73, 0x43, 0x68, 0x61, 0x74,
0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x2b, 0x0a, 0x07, 0x73, 0x69, 0x67, 0x73, 0x2e, 0x52, 0x43, 0x53, 0x43, 0x68, 0x61, 0x74, 0x73, 0x52, 0x08, 0x72, 0x63, 0x73,
0x6d, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x43, 0x68, 0x61, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x07, 0x73, 0x69, 0x6d, 0x44, 0x61, 0x74, 0x61,
0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x53, 0x69, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x73, 0x69, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x73, 0x2e, 0x53, 0x69, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x73, 0x69, 0x6d, 0x44, 0x61,
0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x28, 0x0a, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x06, 0x20, 0x01, 0x28,
0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x28, 0x0a, 0x06, 0x6e, 0x6f, 0x43, 0x6c,
0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x4e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69,
0x06, 0x6e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, 0x6e, 0x67, 0x73, 0x2e, 0x4e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x6e, 0x6f, 0x43, 0x6c,
0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x75, 0x65, 0x22, 0x24, 0x0a, 0x08, 0x52, 0x43, 0x53, 0x43, 0x68, 0x61, 0x74, 0x73, 0x12, 0x18,
0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x22, 0xb1, 0x01, 0x0a, 0x07, 0x53, 0x69, 0x6d, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x0e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x1f, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6c,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x01, 0x20, 0x01,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x22, 0xb1, 0x01, 0x0a, 0x07, 0x53, 0x69,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x0e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e,
0x63, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e,
0x09, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31,
0x0a, 0x07, 0x68, 0x65, 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x20, 0x0a,
0x07, 0x68, 0x65, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x0b, 0x63, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x22, 0x38, 0x0a, 0x0e, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x0a, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x69, 0x6e, 0x52, 0x07, 0x68, 0x65, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74,
0x74, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x31, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x22, 0x38, 0x0a,
0x52, 0x04, 0x69, 0x6e, 0x74, 0x32, 0x22, 0x1e, 0x0a, 0x06, 0x4e, 0x6f, 0x43, 0x6c, 0x75, 0x65, 0x0e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x74, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x69,
0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x40, 0x0a, 0x0a, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 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, 0x98, 0x01, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65,
0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x37, 0x18, 0x07, 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, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x37, 0x12, 0x18, 0x0a, 0x07,
0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x32, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x66,
0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x0d, 0x42, 0x6f, 0x6f, 0x6c, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x32, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6f, 0x6d, 0x65, 0x45, 0x6d,
0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6f, 0x6a, 0x69, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x6f, 0x6d, 0x65,
0x45, 0x6d, 0x6f, 0x6a, 0x69, 0x73, 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, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x72, 0x69,
0x6e, 0x67, 0x22, 0xa1, 0x01, 0x0a, 0x0b, 0x52, 0x43, 0x53, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x67, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x12, 0x2a, 0x0a, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x63, 0x65,
0x69, 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x73, 0x65, 0x6e, 0x64,
0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x14,
0x73, 0x68, 0x6f, 0x77, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61,
0x74, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x73, 0x68, 0x6f, 0x77,
0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73,
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, 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, 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, 0x62, 0x6f, 0x6f, 0x6c, 0x32, 0x12, 0x2d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x6f, 0x6f, 0x6c, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6c,
0x34, 0x22, 0xb0, 0x01, 0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x4d, 0x73, 0x67, 0x31, 0x12, 0x2d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x32,
0x6c, 0x64, 0x73, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x01, 0x20, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d,
0x6f, 0x6c, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x32, 0x73, 0x67, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x06, 0x20, 0x01,
0x12, 0x2d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x22, 0xc0, 0x01, 0x0a, 0x0e, 0x42, 0x6f,
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x12, 0x14, 0x0a, 0x05,
0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x31, 0x12, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f,
0x2d, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x6c, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x42, 0x6f, 0x6f, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c,
0x6c, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x32, 0x12, 0x14, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x34, 0x12, 0x14,
0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x35, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62,
0x6f, 0x6f, 0x6c, 0x33, 0x22, 0xc0, 0x01, 0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x6f, 0x6f, 0x6c, 0x35, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x36, 0x18, 0x06, 0x20,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x36, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x14, 0x0a, 0x6f, 0x6c, 0x37, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x37,
0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x38, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52,
0x6f, 0x6c, 0x33, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x34, 0x18, 0x04, 0x20, 0x01, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x38, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x39, 0x18,
0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x34, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x39, 0x42, 0x0e, 0x5a, 0x0c,
0x6c, 0x35, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x35, 0x12, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72,
0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x36, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6f, 0x74, 0x6f, 0x33,
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 ( var (
@ -836,31 +920,32 @@ func file_settings_proto_rawDescGZIP() []byte {
return file_settings_proto_rawDescData return file_settings_proto_rawDescData
} }
var file_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_settings_proto_goTypes = []interface{}{ var file_settings_proto_goTypes = []interface{}{
(*Settings)(nil), // 0: settings.Settings (*Settings)(nil), // 0: settings.Settings
(*Data)(nil), // 1: settings.Data (*Data)(nil), // 1: settings.Data
(*BoolMsg)(nil), // 2: settings.BoolMsg (*RCSChats)(nil), // 2: settings.RCSChats
(*SimData)(nil), // 3: settings.SimData (*BoolMsg)(nil), // 3: settings.BoolMsg
(*UnknownMessage)(nil), // 4: settings.UnknownMessage (*SimData)(nil), // 4: settings.SimData
(*NoClue)(nil), // 5: settings.NoClue (*UnknownMessage)(nil), // 5: settings.UnknownMessage
(*OpCodeData)(nil), // 6: settings.OpCodeData (*NoClue)(nil), // 6: settings.NoClue
(*BooleanFields)(nil), // 7: settings.BooleanFields (*SomeData)(nil), // 7: settings.SomeData
(*BooleanFields2)(nil), // 8: settings.BooleanFields2 (*RCSSettings)(nil), // 8: settings.RCSSettings
(*BooleanFields3)(nil), // 9: settings.BooleanFields3 (*BooleanFields2)(nil), // 9: settings.BooleanFields2
(*BooleanFields3)(nil), // 10: settings.BooleanFields3
} }
var file_settings_proto_depIdxs = []int32{ var file_settings_proto_depIdxs = []int32{
1, // 0: settings.Settings.data:type_name -> settings.Data 1, // 0: settings.Settings.data:type_name -> settings.Data
6, // 1: settings.Settings.opCodeData:type_name -> settings.OpCodeData 7, // 1: settings.Settings.opCodeData:type_name -> settings.SomeData
7, // 2: settings.Settings.boolFields:type_name -> settings.BooleanFields 8, // 2: settings.Settings.rcsSettings:type_name -> settings.RCSSettings
8, // 3: settings.Settings.boolFields2:type_name -> settings.BooleanFields2 9, // 3: settings.Settings.boolFields2:type_name -> settings.BooleanFields2
9, // 4: settings.Settings.boolFields3:type_name -> settings.BooleanFields3 10, // 4: settings.Settings.boolFields3:type_name -> settings.BooleanFields3
2, // 5: settings.Data.boolMsg:type_name -> settings.BoolMsg 2, // 5: settings.Data.rcsChats:type_name -> settings.RCSChats
3, // 6: settings.Data.simData:type_name -> settings.SimData 4, // 6: settings.Data.simData:type_name -> settings.SimData
5, // 7: settings.Data.noClue:type_name -> settings.NoClue 6, // 7: settings.Data.noClue:type_name -> settings.NoClue
4, // 8: settings.SimData.unknownMessage:type_name -> settings.UnknownMessage 5, // 8: settings.SimData.unknownMessage:type_name -> settings.UnknownMessage
2, // 9: settings.BooleanFields2.boolMsg1:type_name -> settings.BoolMsg 3, // 9: settings.BooleanFields2.boolMsg1:type_name -> settings.BoolMsg
2, // 10: settings.BooleanFields2.boolMsg2:type_name -> settings.BoolMsg 3, // 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 output_type
11, // [11:11] is the sub-list for method input_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 type_name
@ -899,7 +984,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BoolMsg); i { switch v := v.(*RCSChats); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -911,7 +996,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SimData); i { switch v := v.(*BoolMsg); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -923,7 +1008,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UnknownMessage); i { switch v := v.(*SimData); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -935,7 +1020,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NoClue); i { switch v := v.(*UnknownMessage); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -947,7 +1032,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OpCodeData); i { switch v := v.(*NoClue); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -959,7 +1044,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BooleanFields); i { switch v := v.(*SomeData); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -971,7 +1056,7 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BooleanFields2); i { switch v := v.(*RCSSettings); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -983,6 +1068,18 @@ func file_settings_proto_init() {
} }
} }
file_settings_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_settings_proto_msgTypes[9].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[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BooleanFields3); i { switch v := v.(*BooleanFields3); i {
case 0: case 0:
return &v.state return &v.state
@ -1001,7 +1098,7 @@ func file_settings_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_settings_proto_rawDesc, RawDescriptor: file_settings_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 10, NumMessages: 11,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View file

@ -1,12 +0,0 @@
package libgm
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 ?
}
}

View file

@ -2,23 +2,33 @@ package libgm
import ( import (
"encoding/base64" "encoding/base64"
"encoding/json"
"fmt"
"io" "io"
"log"
"net/http" "net/http"
"net/http/cookiejar"
"net/url" "net/url"
"os"
"time" "time"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/crypto" "go.mau.fi/mautrix-gmessages/libgm/crypto"
"go.mau.fi/mautrix-gmessages/libgm/events"
"go.mau.fi/mautrix-gmessages/libgm/payload" "go.mau.fi/mautrix-gmessages/libgm/payload"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
type DevicePair struct { type AuthData struct {
Mobile *binary.Device TachyonAuthToken []byte `json:"tachyon_token,omitempty"`
Browser *binary.Device TTL int64 `json:"ttl,omitempty"`
AuthenticatedAt *time.Time `json:"authenticated_at,omitempty"`
DevicePair *pblite.DevicePair `json:"device_pair,omitempty"`
Cryptor *crypto.Cryptor `json:"crypto,omitempty"`
WebEncryptionKey []byte `json:"web_encryption_key,omitempty"`
JWK *crypto.JWK `json:"jwk,omitempty"`
} }
type Proxy func(*http.Request) (*url.URL, error) type Proxy func(*http.Request) (*url.URL, error)
type EventHandler func(evt interface{}) type EventHandler func(evt interface{})
@ -26,67 +36,47 @@ type Client struct {
Logger zerolog.Logger Logger zerolog.Logger
Conversations *Conversations Conversations *Conversations
Session *Session Session *Session
Messages *Messages
rpc *RPC rpc *RPC
devicePair *DevicePair
pairer *Pairer pairer *Pairer
cryptor *crypto.Cryptor
imageCryptor *crypto.ImageCryptor
evHandler EventHandler evHandler EventHandler
sessionHandler *SessionHandler sessionHandler *SessionHandler
instructions *Instructions
rpcKey []byte imageCryptor *crypto.ImageCryptor
ttl int64 authData *AuthData
proxy Proxy proxy Proxy
http *http.Client http *http.Client
} }
func NewClient(devicePair *DevicePair, cryptor *crypto.Cryptor, logger zerolog.Logger, proxy *string) *Client { func NewClient(authData *AuthData, logger zerolog.Logger) *Client {
sessionHandler := &SessionHandler{ sessionHandler := &SessionHandler{
requests: make(map[string]map[int64]*ResponseChan), requests: make(map[string]map[binary.ActionType]*ResponseChan),
responseTimeout: time.Duration(5000) * time.Millisecond, responseTimeout: time.Duration(5000) * time.Millisecond,
} }
if cryptor == nil { if authData == nil {
cryptor = crypto.NewCryptor(nil, nil) authData = &AuthData{}
}
if authData.Cryptor == nil {
authData.Cryptor = crypto.NewCryptor(nil, nil)
} }
jar, _ := cookiejar.New(nil)
cli := &Client{ cli := &Client{
authData: authData,
Logger: logger, Logger: logger,
devicePair: devicePair,
sessionHandler: sessionHandler,
cryptor: cryptor,
imageCryptor: &crypto.ImageCryptor{}, imageCryptor: &crypto.ImageCryptor{},
http: &http.Client{ sessionHandler: sessionHandler,
Jar: jar, http: &http.Client{},
},
} }
sessionHandler.client = cli 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}}} rpc := &RPC{client: cli, http: &http.Client{Transport: &http.Transport{Proxy: cli.proxy}}}
cli.rpc = rpc cli.rpc = rpc
cli.Logger.Debug().Any("data", cryptor).Msg("Cryptor") cli.Logger.Debug().Any("data", cli.authData.Cryptor).Msg("Cryptor")
cli.setApiMethods() cli.setApiMethods()
cli.FetchConfigVersion()
return cli return cli
} }
var baseURL, _ = url.Parse("https://messages.google.com/")
func (c *Client) GetCookies() []*http.Cookie {
return c.http.Jar.Cookies(baseURL)
}
func (c *Client) SetCookies(cookies []*http.Cookie) {
c.http.Jar.SetCookies(baseURL, cookies)
}
func (c *Client) SetEventHandler(eventHandler EventHandler) { func (c *Client) SetEventHandler(eventHandler EventHandler) {
if eventHandler == nil {
eventHandler = func(_ interface{}) {}
}
c.evHandler = eventHandler c.evHandler = eventHandler
} }
@ -104,41 +94,65 @@ func (c *Client) SetProxy(proxy string) error {
return nil return nil
} }
func (c *Client) Connect(rpcKey []byte) error { func (c *Client) Connect() error {
rpcPayload, receiveMesageSessionID, err := payload.ReceiveMessages(rpcKey) if c.authData.TachyonAuthToken != nil {
if err != nil {
panic(err)
return err
}
c.rpc.rpcSessionID = receiveMesageSessionID
c.rpcKey = rpcKey
go c.rpc.ListenReceiveMessages(rpcPayload)
c.Logger.Debug().Any("rpcKey", rpcKey).Msg("Successfully connected to server")
if c.devicePair != nil {
sendInitialDataErr := c.rpc.sendInitialData()
if sendInitialDataErr != nil {
panic(sendInitialDataErr)
}
}
return nil
}
func (c *Client) Reconnect(rpcKey []byte) error { hasExpired, authenticatedAtSeconds := c.hasTachyonTokenExpired()
c.rpc.CloseConnection() if hasExpired {
for c.rpc.conn != nil { c.Logger.Error().Any("expired", hasExpired).Any("secondsSince", authenticatedAtSeconds).Msg("TachyonToken has expired! attempting to refresh")
time.Sleep(time.Millisecond * 100) refreshErr := c.refreshAuthToken()
if refreshErr != nil {
log.Fatal(refreshErr)
} }
err := c.Connect(rpcKey) }
c.Logger.Info().Any("secondsSince", authenticatedAtSeconds).Any("token", c.authData.TachyonAuthToken).Msg("TachyonToken has not expired, attempting to connect...")
webEncryptionKeyResponse, webEncryptionKeyErr := c.GetWebEncryptionKey()
if webEncryptionKeyErr != nil {
c.Logger.Err(webEncryptionKeyErr).Any("response", webEncryptionKeyResponse).Msg("GetWebEncryptionKey request failed")
return webEncryptionKeyErr
}
c.updateWebEncryptionKey(webEncryptionKeyResponse.GetKey())
rpcPayload, receiveMessageSessionId, err := payload.ReceiveMessages(c.authData.TachyonAuthToken)
if err != nil { if err != nil {
c.Logger.Err(err).Any("rpcKey", rpcKey).Msg("Failed to reconnect") log.Fatal(err)
return err return err
} }
c.Logger.Debug().Any("rpcKey", rpcKey).Msg("Successfully reconnected to server") c.rpc.rpcSessionId = receiveMessageSessionId
sendInitialDataErr := c.rpc.sendInitialData() go c.rpc.ListenReceiveMessages(rpcPayload)
if sendInitialDataErr != nil { c.sessionHandler.startAckInterval()
panic(sendInitialDataErr)
bugleRes, bugleErr := c.Session.IsBugleDefault()
if bugleErr != nil {
log.Fatal(bugleErr)
} }
c.Logger.Info().Any("isBugle", bugleRes.Success).Msg("IsBugleDefault")
sessionErr := c.Session.SetActiveSession()
if sessionErr != nil {
log.Fatal(sessionErr)
}
//c.Logger.Debug().Any("tachyonAuthToken", c.authData.TachyonAuthToken).Msg("Successfully connected to server")
return nil return nil
} else {
pairer, err := c.NewPairer(nil, 20)
if err != nil {
log.Fatal(err)
}
c.pairer = pairer
registered, err2 := c.pairer.RegisterPhoneRelay()
if err2 != nil {
return err2
}
c.authData.TachyonAuthToken = registered.AuthKeyData.TachyonAuthToken
rpcPayload, receiveMessageSessionId, err := payload.ReceiveMessages(c.authData.TachyonAuthToken)
if err != nil {
log.Fatal(err)
return err
}
c.rpc.rpcSessionId = receiveMessageSessionId
go c.rpc.ListenReceiveMessages(rpcPayload)
return nil
}
} }
func (c *Client) Disconnect() { func (c *Client) Disconnect() {
@ -151,7 +165,34 @@ func (c *Client) IsConnected() bool {
} }
func (c *Client) IsLoggedIn() bool { func (c *Client) IsLoggedIn() bool {
return c.devicePair != nil return c.authData != nil && c.authData.DevicePair != nil
}
func (c *Client) hasTachyonTokenExpired() (bool, string) {
if c.authData.TachyonAuthToken == nil || c.authData.AuthenticatedAt == nil {
return true, ""
} else {
duration := time.Since(*c.authData.AuthenticatedAt)
seconds := fmt.Sprintf("%.3f", duration.Seconds())
if duration.Microseconds() > 86400000000 {
return true, seconds
}
return false, seconds
}
}
func (c *Client) Reconnect() error {
c.rpc.CloseConnection()
for c.rpc.conn != nil {
time.Sleep(time.Millisecond * 100)
}
err := c.Connect()
if err != nil {
c.Logger.Err(err).Any("tachyonAuthToken", c.authData.TachyonAuthToken).Msg("Failed to reconnect")
return err
}
c.Logger.Debug().Any("tachyonAuthToken", c.authData.TachyonAuthToken).Msg("Successfully reconnected to server")
return nil
} }
func (c *Client) triggerEvent(evt interface{}) { func (c *Client) triggerEvent(evt interface{}) {
@ -161,63 +202,39 @@ func (c *Client) triggerEvent(evt interface{}) {
} }
func (c *Client) setApiMethods() { func (c *Client) setApiMethods() {
c.Conversations = &Conversations{ c.Conversations = &Conversations{client: c}
client: c, c.Session = &Session{client: c}
openConversation: openConversation{ c.Messages = &Messages{client: c}
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 { func (c *Client) decryptMedias(messages *binary.FetchMessagesResponse) error {
for _, msg := range messages.Messages { for _, msg := range messages.Messages {
switch msg.GetType() {
case *binary.MessageType_IMAGE.Enum():
for _, details := range msg.GetMessageInfo() { for _, details := range msg.GetMessageInfo() {
switch data := details.GetData().(type) { switch data := details.GetData().(type) {
case *binary.MessageInfo_ImageContent: case *binary.MessageInfo_MediaContent:
decryptedImageData, err := c.decryptImageData(data.ImageContent.ImageID, data.ImageContent.DecryptionKey) decryptedMediaData, err := c.decryptMediaData(data.MediaContent.MediaID, data.MediaContent.DecryptionKey)
if err != nil { if err != nil {
panic(err) log.Fatal(err)
return err return err
} }
data.ImageContent.ImageData = decryptedImageData data.MediaContent.MediaData = decryptedMediaData
}
} }
} }
} }
return nil return nil
} }
func (c *Client) decryptImageData(imageId string, key []byte) ([]byte, error) { func (c *Client) decryptMediaData(mediaId string, key []byte) ([]byte, error) {
reqId := util.RandomUUIDv4() reqId := util.RandomUUIDv4()
download_metadata := &binary.UploadImagePayload{ download_metadata := &binary.UploadImagePayload{
MetaData: &binary.ImageMetaData{ MetaData: &binary.ImageMetaData{
ImageID: imageId, ImageID: mediaId,
Encrypted: true, Encrypted: true,
}, },
AuthData: &binary.AuthMessage{ AuthData: &binary.AuthMessage{
RequestID: reqId, RequestID: reqId,
RpcKey: c.rpcKey, TachyonAuthToken: c.authData.TachyonAuthToken,
Date: &binary.Date{ ConfigVersion: payload.ConfigMessage,
Year: 2023,
Seq1: 6,
Seq2: 22,
Seq3: 4,
Seq4: 6,
},
}, },
} }
download_metadata_bytes, err2 := binary.EncodeProtoMessage(download_metadata) download_metadata_bytes, err2 := binary.EncodeProtoMessage(download_metadata)
@ -244,8 +261,154 @@ func (c *Client) decryptImageData(imageId string, key []byte) ([]byte, error) {
c.imageCryptor.UpdateDecryptionKey(key) c.imageCryptor.UpdateDecryptionKey(key)
decryptedImageBytes, decryptionErr := c.imageCryptor.DecryptData(encryptedBuffImg) decryptedImageBytes, decryptionErr := c.imageCryptor.DecryptData(encryptedBuffImg)
if decryptionErr != nil { if decryptionErr != nil {
c.Logger.Err(err).Msg("Image decryption failed") log.Println("Error:", decryptionErr)
return nil, decryptionErr return nil, decryptionErr
} }
return decryptedImageBytes, nil return decryptedImageBytes, nil
} }
func (c *Client) FetchConfigVersion() {
req, bErr := http.NewRequest("GET", util.CONFIG_URL, nil)
if bErr != nil {
log.Fatal(bErr)
}
configRes, requestErr := c.http.Do(req)
if requestErr != nil {
log.Fatal(requestErr)
}
responseBody, readErr := io.ReadAll(configRes.Body)
if readErr != nil {
log.Fatal(readErr)
}
version, parseErr := util.ParseConfigVersion(responseBody)
if parseErr != nil {
log.Fatal(parseErr)
}
currVersion := payload.ConfigMessage
if version.V1 != currVersion.V1 || version.V2 != currVersion.V2 || version.V3 != currVersion.V3 {
toLog := c.diffVersionFormat(currVersion, version)
c.Logger.Info().Any("version", toLog).Msg("There's a new version available!")
} else {
c.Logger.Info().Any("version", currVersion).Msg("You are running on the latest version.")
}
}
func (c *Client) diffVersionFormat(curr *binary.ConfigVersion, latest *binary.ConfigVersion) string {
return fmt.Sprintf("%d.%d.%d -> %d.%d.%d", curr.V1, curr.V2, curr.V3, latest.V1, latest.V2, latest.V3)
}
func (c *Client) updateWebEncryptionKey(key []byte) {
c.Logger.Debug().Any("key", key).Msg("Updated WebEncryptionKey")
c.authData.WebEncryptionKey = key
}
func (c *Client) updateJWK(jwk *crypto.JWK) {
c.Logger.Debug().Any("jwk", jwk).Msg("Updated JWK")
c.authData.JWK = jwk
}
func (c *Client) updateTachyonAuthToken(t []byte) {
authenticatedAt := util.TimestampNow()
c.authData.TachyonAuthToken = t
c.authData.AuthenticatedAt = &authenticatedAt
c.Logger.Debug().Any("authenticatedAt", authenticatedAt).Any("tachyonAuthToken", t).Msg("Updated TachyonAuthToken")
}
func (c *Client) updateTTL(ttl int64) {
c.authData.TTL = ttl
c.Logger.Debug().Any("ttl", ttl).Msg("Updated TTL")
}
func (c *Client) updateDevicePair(devicePair *pblite.DevicePair) {
c.authData.DevicePair = devicePair
c.Logger.Debug().Any("devicePair", devicePair).Msg("Updated DevicePair")
}
func (c *Client) SaveAuthSession(path string) error {
toSaveJson, jsonErr := json.Marshal(c.authData)
if jsonErr != nil {
return jsonErr
}
writeErr := os.WriteFile(path, toSaveJson, os.ModePerm)
return writeErr
}
func LoadAuthSession(path string) (*AuthData, error) {
jsonData, readErr := os.ReadFile(path)
if readErr != nil {
return nil, readErr
}
sessionData := &AuthData{}
marshalErr := json.Unmarshal(jsonData, sessionData)
if marshalErr != nil {
return nil, marshalErr
}
return sessionData, nil
}
func (c *Client) refreshAuthToken() error {
jwk := c.authData.JWK
requestId := util.RandomUUIDv4()
timestamp := time.Now().UnixMilli() * 1000
sig, sigErr := jwk.SignRequest(requestId, int64(timestamp))
if sigErr != nil {
return sigErr
}
payloadMessage, messageErr := payload.RegisterRefresh(sig, requestId, int64(timestamp), c.authData.DevicePair.Browser, c.authData.TachyonAuthToken)
if messageErr != nil {
return messageErr
}
c.Logger.Info().Any("payload", string(payloadMessage)).Msg("Attempting to refresh auth token")
refreshResponse, requestErr := c.rpc.sendMessageRequest(util.REGISTER_REFRESH, payloadMessage)
if requestErr != nil {
return requestErr
}
if refreshResponse.StatusCode == 401 {
return fmt.Errorf("failed to refresh auth token: unauthorized (try reauthenticating through qr code)")
}
if refreshResponse.StatusCode == 400 {
return fmt.Errorf("failed to refresh auth token: signature failed")
}
responseBody, readErr := io.ReadAll(refreshResponse.Body)
if readErr != nil {
return readErr
}
var deserialized []interface{}
marshalErr := json.Unmarshal(responseBody, &deserialized)
if marshalErr != nil {
return marshalErr
}
resp := &binary.RegisterRefreshResponse{}
deserializeErr := pblite.Deserialize(deserialized, resp.ProtoReflect())
if deserializeErr != nil {
return deserializeErr
}
token := resp.GetTokenData().GetTachyonAuthToken()
if token == nil {
return fmt.Errorf("failed to refresh auth token: something happened")
}
c.Logger.Error().Any("expiry", resp.GetTokenData().GetValidFor()).Msg("TACHYON TOKEN VALID FOR")
c.updateTachyonAuthToken(token)
c.triggerEvent(events.NewAuthTokenRefreshed(token))
return nil
}

View file

@ -1,33 +0,0 @@
package libgm
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
}

View file

@ -0,0 +1,95 @@
package libgm
import (
"fmt"
"log"
"google.golang.org/protobuf/proto"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
type ConversationBuilderError struct {
errMsg string
}
func (cbe *ConversationBuilderError) Error() string {
return fmt.Sprintf("Failed to build conversation builder: %s", cbe.errMsg)
}
type ConversationBuilder struct {
conversationId string
actionStatus binary.ConversationActionStatus
status binary.ConversationStatus
muteStatus *binary.ConversationMuteStatus
}
func (cb *ConversationBuilder) SetConversationId(conversationId string) *ConversationBuilder {
cb.conversationId = conversationId
return cb
}
// For block, unblock, block & report
func (cb *ConversationBuilder) SetConversationActionStatus(actionStatus binary.ConversationActionStatus) *ConversationBuilder {
cb.actionStatus = actionStatus
return cb
}
// For archive, unarchive, delete
func (cb *ConversationBuilder) SetConversationStatus(status binary.ConversationStatus) *ConversationBuilder {
cb.status = status
return cb
}
func (cb *ConversationBuilder) SetMuteStatus(muteStatus *binary.ConversationMuteStatus) *ConversationBuilder {
cb.muteStatus = muteStatus
return cb
}
func (cb *ConversationBuilder) Build(protoMessage proto.Message) (proto.Message, error) {
if cb.conversationId == "" {
return nil, &ConversationBuilderError{errMsg: "conversationID can not be empty"}
}
switch protoMessage.(type) {
case *binary.UpdateConversationPayload:
payload, failedBuild := cb.buildUpdateConversationPayload()
if failedBuild != nil {
return nil, failedBuild
}
return payload, nil
default:
log.Fatal("Invalid protoMessage conversation builder type")
}
return nil, &ConversationBuilderError{errMsg: "failed to build for unknown reasons"}
}
func (cb *ConversationBuilder) buildUpdateConversationPayload() (*binary.UpdateConversationPayload, error) {
if cb.actionStatus == 0 && cb.status == 0 && cb.muteStatus == nil {
return nil, &ConversationBuilderError{errMsg: "actionStatus, status & muteStatus can not be empty when updating conversation, set atleast 1"}
}
payload := &binary.UpdateConversationPayload{}
if cb.actionStatus != 0 {
payload.Action = cb.actionStatus
payload.Action5 = &binary.ConversationAction5{
Field2: true,
}
payload.ConversationID = cb.conversationId
} else if cb.status != 0 || cb.muteStatus != nil {
payload.Data = &binary.UpdateConversationData{ConversationID: cb.conversationId}
if cb.muteStatus != nil {
payload.Data.Data = &binary.UpdateConversationData_Mute{Mute: *cb.muteStatus}
} else if cb.status != 0 {
payload.Data.Data = &binary.UpdateConversationData_Status{Status: cb.status}
}
}
return payload, nil
}
func (c *Client) NewConversationBuilder() *ConversationBuilder {
return &ConversationBuilder{}
}

View file

@ -0,0 +1,11 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func (c *Client) handleConversationEvent(res *pblite.Response, data *binary.Conversation) {
c.triggerEvent(data)
}

View file

@ -9,192 +9,116 @@ import (
type Conversations struct { type Conversations struct {
client *Client client *Client
watching string // current open conversation synced bool
openConversation openConversation
fetchConversationMessages fetchConversationMessages
} }
// default is 25 count
func (c *Conversations) List(count int64) (*binary.Conversations, error) { func (c *Conversations) List(count int64) (*binary.Conversations, error) {
encryptedProtoPayload := &binary.ListCoversationsPayload{Count: count, Field4: 1} payload := &binary.ListCoversationsPayload{Count: count, Field4: 1}
instruction, _ := c.client.instructions.GetInstruction(LIST_CONVERSATIONS) var actionType binary.ActionType
sentRequestID, _ := c.client.createAndSendRequest(instruction.Opcode, c.client.ttl, false, encryptedProtoPayload.ProtoReflect())
responses, err := c.client.sessionHandler.WaitForResponse(sentRequestID, instruction.Opcode) if !c.synced {
actionType = binary.ActionType_LIST_CONVERSATIONS_SYNC
c.synced = true
} else {
actionType = binary.ActionType_LIST_CONVERSATIONS
}
sentRequestId, sendErr := c.client.sessionHandler.completeSendMessage(actionType, true, payload)
if sendErr != nil {
return nil, sendErr
}
response, err := c.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if err != nil { if err != nil {
return nil, err return nil, err
} }
decryptedProto, decryptErr := responses[0].decryptData()
res, ok := response.Data.Decrypted.(*binary.Conversations)
if !ok {
return nil, fmt.Errorf("failed to assert response into Conversations")
}
return res, nil
}
func (c *Conversations) GetType(conversationId string) (*binary.GetConversationTypeResponse, error) {
payload := &binary.ConversationTypePayload{ConversationID: conversationId}
actionType := binary.ActionType_GET_CONVERSATION_TYPE
sentRequestId, sendErr := c.client.sessionHandler.completeSendMessage(actionType, true, payload)
if sendErr != nil {
return nil, sendErr
}
response, err := c.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if err != nil {
return nil, err
}
res, ok := response.Data.Decrypted.(*binary.GetConversationTypeResponse)
if !ok {
return nil, fmt.Errorf("failed to assert response into GetConversationTypeResponse")
}
return res, nil
}
func (c *Conversations) FetchMessages(conversationId string, count int64, cursor *binary.Cursor) (*binary.FetchMessagesResponse, error) {
payload := &binary.FetchConversationMessagesPayload{ConversationID: conversationId, Count: count}
if cursor != nil {
payload.Cursor = cursor
}
actionType := binary.ActionType_LIST_MESSAGES
sentRequestId, sendErr := c.client.sessionHandler.completeSendMessage(actionType, true, payload)
if sendErr != nil {
return nil, sendErr
}
response, err := c.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if err != nil {
return nil, err
}
res, ok := response.Data.Decrypted.(*binary.FetchMessagesResponse)
if !ok {
return nil, fmt.Errorf("failed to assert response into FetchMessagesResponse")
}
decryptErr := c.client.decryptMedias(res)
if decryptErr != nil { if decryptErr != nil {
return nil, decryptErr return nil, decryptErr
} }
if decryptedData, ok := decryptedProto.(*binary.Conversations); ok { c.client.Logger.Debug().Any("messageData", res).Msg("fetchmessages")
return decryptedData, nil return res, nil
} else {
return nil, fmt.Errorf("failed to assert decryptedProto into type Conversations")
}
} }
func (c *Conversations) SendMessage(messageBuilder *MessageBuilder, selfParticipantID string) (*binary.SendMessageResponse, error) { func (c *Conversations) SendMessage(messageBuilder *MessageBuilder) (*binary.SendMessageResponse, error) {
hasSelfParticipantId := messageBuilder.GetSelfParticipantID() payload, failedToBuild := messageBuilder.Build()
if hasSelfParticipantId == "" {
messageBuilder.SetSelfParticipantID(selfParticipantID)
}
encryptedProtoPayload, failedToBuild := messageBuilder.Build()
if failedToBuild != nil { if failedToBuild != nil {
panic(failedToBuild) return nil, failedToBuild
} }
instruction, _ := c.client.instructions.GetInstruction(SEND_TEXT_MESSAGE) actionType := binary.ActionType_SEND_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) sentRequestId, sendErr := c.client.sessionHandler.completeSendMessage(actionType, true, payload)
if err != nil { if sendErr != nil {
panic(err) return nil, sendErr
return nil, err
} }
decryptedProto, decryptErr := responses[0].decryptData() response, err := c.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
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
}
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 { if err != nil {
return nil, err return nil, err
} }
return responses, nil res, ok := response.Data.Decrypted.(*binary.SendMessageResponse)
if !ok {
return nil, fmt.Errorf("failed to assert response into SendMessageResponse")
} }
type openConversation struct { c.client.Logger.Debug().Any("res", res).Msg("sent message!")
client *Client return res, nil
} }
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
}
}
*/

View file

@ -18,7 +18,33 @@ type JWK struct {
Y string `json:"y"` Y string `json:"y"`
Ext bool `json:"ext"` Ext bool `json:"ext"`
KeyOps []string `json:"key_ops"` KeyOps []string `json:"key_ops"`
PrivateBytes []byte `json:"privateBytes,omitempty"` PrivateBytes []byte `json:"private_bytes,omitempty"`
}
func (t *JWK) GetPrivateKey() (*ecdsa.PrivateKey, error) {
curve := elliptic.P256()
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
}
dBytes, err := base64.RawURLEncoding.DecodeString(t.D)
if err != nil {
return nil, err
}
priv := &ecdsa.PrivateKey{
PublicKey: ecdsa.PublicKey{
Curve: curve,
X: new(big.Int).SetBytes(xBytes),
Y: new(big.Int).SetBytes(yBytes),
},
D: new(big.Int).SetBytes(dBytes),
}
return priv, nil
} }
// Returns a byte slice containing the JWK and an error if the generation or export failed. // Returns a byte slice containing the JWK and an error if the generation or export failed.

View file

@ -9,27 +9,27 @@ import (
"errors" "errors"
"io" "io"
"google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/proto"
"go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/binary"
) )
type Cryptor struct { type Cryptor struct {
AESCTR256Key []byte AESKey []byte `json:"aes_key"`
SHA256Key []byte HMACKey []byte `json:"hmac_key"`
} }
func NewCryptor(aesKey []byte, shaKey []byte) *Cryptor { func NewCryptor(aesKey []byte, hmacKey []byte) *Cryptor {
if aesKey != nil && shaKey != nil { if aesKey != nil && hmacKey != nil {
return &Cryptor{ return &Cryptor{
AESCTR256Key: aesKey, AESKey: aesKey,
SHA256Key: shaKey, HMACKey: hmacKey,
} }
} }
aesKey, shaKey = GenerateKeys() aesKey, hmacKey = GenerateKeys()
return &Cryptor{ return &Cryptor{
AESCTR256Key: aesKey, AESKey: aesKey,
SHA256Key: shaKey, HMACKey: hmacKey,
} }
} }
@ -39,7 +39,7 @@ func (c *Cryptor) Encrypt(plaintext []byte) ([]byte, error) {
return nil, err return nil, err
} }
block, err := aes.NewCipher(c.AESCTR256Key) block, err := aes.NewCipher(c.AESKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -50,7 +50,7 @@ func (c *Cryptor) Encrypt(plaintext []byte) ([]byte, error) {
ciphertext = append(ciphertext, iv...) ciphertext = append(ciphertext, iv...)
mac := hmac.New(sha256.New, c.SHA256Key) mac := hmac.New(sha256.New, c.HMACKey)
mac.Write(ciphertext) mac.Write(ciphertext)
hmac := mac.Sum(nil) hmac := mac.Sum(nil)
@ -67,7 +67,7 @@ func (c *Cryptor) Decrypt(encryptedData []byte) ([]byte, error) {
hmacSignature := encryptedData[len(encryptedData)-32:] hmacSignature := encryptedData[len(encryptedData)-32:]
encryptedDataWithoutHMAC := encryptedData[:len(encryptedData)-32] encryptedDataWithoutHMAC := encryptedData[:len(encryptedData)-32]
mac := hmac.New(sha256.New, c.SHA256Key) mac := hmac.New(sha256.New, c.HMACKey)
mac.Write(encryptedDataWithoutHMAC) mac.Write(encryptedDataWithoutHMAC)
expectedHMAC := mac.Sum(nil) expectedHMAC := mac.Sum(nil)
@ -78,7 +78,7 @@ func (c *Cryptor) Decrypt(encryptedData []byte) ([]byte, error) {
iv := encryptedDataWithoutHMAC[len(encryptedDataWithoutHMAC)-16:] iv := encryptedDataWithoutHMAC[len(encryptedDataWithoutHMAC)-16:]
encryptedDataWithoutHMAC = encryptedDataWithoutHMAC[:len(encryptedDataWithoutHMAC)-16] encryptedDataWithoutHMAC = encryptedDataWithoutHMAC[:len(encryptedDataWithoutHMAC)-16]
block, err := aes.NewCipher(c.AESCTR256Key) block, err := aes.NewCipher(c.AESKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -88,7 +88,7 @@ func (c *Cryptor) Decrypt(encryptedData []byte) ([]byte, error) {
return encryptedDataWithoutHMAC, nil return encryptedDataWithoutHMAC, nil
} }
func (c *Cryptor) DecryptAndDecodeData(encryptedData []byte, message protoreflect.ProtoMessage) error { func (c *Cryptor) DecryptAndDecodeData(encryptedData []byte, message proto.Message) error {
decryptedData, err := c.Decrypt(encryptedData) decryptedData, err := c.Decrypt(encryptedData)
if err != nil { if err != nil {
return err return err
@ -99,3 +99,17 @@ func (c *Cryptor) DecryptAndDecodeData(encryptedData []byte, message protoreflec
} }
return nil return nil
} }
func (c *Cryptor) EncodeAndEncryptData(message proto.Message) ([]byte, error) {
encodedData, encodeErr := binary.EncodeProtoMessage(message)
if encodeErr != nil {
return nil, encodeErr
}
encryptedData, encryptErr := c.Encrypt(encodedData)
if encryptErr != nil {
return nil, encryptErr
}
return encryptedData, nil
}

View file

@ -19,16 +19,3 @@ func DecodeAndEncodeB64(data string, msg proto.Message) error {
} }
return nil return nil
} }
func DecodeEncodedResponse(data string) (*binary.EncodedResponse, error) {
decodedBytes, err := base64.StdEncoding.DecodeString(data)
if err != nil {
return nil, err
}
decodedData := &binary.EncodedResponse{}
err = binary.DecodeProtoMessage(decodedBytes, decodedData)
if err != nil {
return nil, err
}
return decodedData, nil
}

View file

@ -11,6 +11,22 @@ import (
var SequenceOne = []int{1, 2, 840, 10045, 2, 1} var SequenceOne = []int{1, 2, 840, 10045, 2, 1}
var SequenceTwo = []int{1, 2, 840, 10045, 3, 1, 7} var SequenceTwo = []int{1, 2, 840, 10045, 3, 1, 7}
func EncodeBNA(a []byte) []byte {
b := 0
for b < len(a) && a[b] == 0 {
b++
}
c := 0
if b < len(a) && (a[b]&128) == 128 {
c = 1
}
d := make([]byte, len(a)-b+c)
copy(d[c:], a[b:])
return d
}
func EncodeValues(a *[]byte, b []int) { func EncodeValues(a *[]byte, b []int) {
*a = append(*a, 6) *a = append(*a, 6)
idx := len(*a) idx := len(*a)

52
libgm/crypto/signer.go Normal file
View file

@ -0,0 +1,52 @@
package crypto
import (
"crypto/ecdsa"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
)
func (t *JWK) SignRequest(requestId string, timestamp int64) (string, error) {
signBytes := []byte(fmt.Sprintf("%s:%d", requestId, timestamp))
privKey, privErr := t.GetPrivateKey()
if privErr != nil {
return "", privErr
}
signature, sigErr := t.sign(privKey, signBytes)
if sigErr != nil {
return "", sigErr
}
encodedSignature := base64.StdEncoding.EncodeToString(signature)
return encodedSignature, nil
}
func (t *JWK) sign(key *ecdsa.PrivateKey, msg []byte) ([]byte, error) {
hash := sha256.Sum256(msg)
r, s, err := ecdsa.Sign(rand.Reader, key, hash[:])
if err != nil {
return nil, err
}
rBytes := r.Bytes()
sBytes := s.Bytes()
rBytes = EncodeBNA(rBytes)
sBytes = EncodeBNA(sBytes)
sigLen := len(rBytes) + len(sBytes) + 6 // 2 bytes for each sequence tag and 2 bytes for each length field
sig := make([]byte, sigLen)
sig[0] = 48
sig[1] = byte(sigLen - 2)
sig[2] = 2
sig[3] = byte(len(rBytes))
copy(sig[4:], rBytes)
sig[4+len(rBytes)] = 2
sig[5+len(rBytes)] = byte(len(sBytes))
copy(sig[6+len(rBytes):], sBytes)
return sig, nil
}

View file

@ -1,33 +1,58 @@
package libgm package libgm
import ( import (
"encoding/base64" "encoding/json"
"fmt"
"google.golang.org/protobuf/proto" "go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/binary"
) )
func (c *Client) handleEventOpCode(response *Response) { var skipCount int32
c.Logger.Debug().Any("res", response).Msg("got event response?")
eventData := &binary.Event{} func (r *RPC) HandleRPCMsg(msgArr []interface{}) {
data, decryptedErr := c.cryptor.Decrypt(response.Data.EncryptedData) response, decodeErr := pblite.DecodeAndDecryptInternalMessage(msgArr, r.client.authData.Cryptor)
if decryptedErr != nil { if decodeErr != nil {
panic(decryptedErr) r.client.Logger.Error().Err(fmt.Errorf("failed to deserialize response %s", msgArr)).Msg("rpc deserialize msg err")
return
} }
c.Logger.Debug().Str("protobuf_data", base64.StdEncoding.EncodeToString(data)).Msg("decrypted data") //r.client.Logger.Debug().Any("byteLength", len(data)).Any("unmarshaled", response).Any("raw", string(data)).Msg("RPC Msg")
err := proto.Unmarshal(data, eventData) if response == nil {
if err != nil { r.client.Logger.Error().Err(fmt.Errorf("response data was nil %s", msgArr)).Msg("rpc msg data err")
panic(err) return
} }
switch evt := eventData.Event.(type) { //r.client.Logger.Debug().Any("response", response).Msg("decrypted & decoded response")
case *binary.Event_MessageEvent: _, waitingForResponse := r.client.sessionHandler.requests[response.Data.RequestId]
c.handleMessageEvent(response, evt)
case *binary.Event_ConversationEvent: //r.client.Logger.Info().Any("raw", msgArr).Msg("Got msg")
c.handleConversationEvent(response, evt) //r.client.Logger.Debug().Any("waiting", waitingForResponse).Msg("got request! waiting?")
case *binary.Event_UserAlertEvent: r.client.sessionHandler.addResponseAck(response.ResponseId)
c.handleUserAlertEvent(response, evt) if waitingForResponse {
r.client.sessionHandler.respondToRequestChannel(response)
} else {
switch response.BugleRoute {
case binary.BugleRoute_PairEvent:
r.client.handlePairingEvent(response)
case binary.BugleRoute_DataEvent:
if skipCount > 0 {
skipCount--
r.client.Logger.Info().Any("action", response.Data.Action).Any("toSkip", skipCount).Msg("Skipped DataEvent")
return
}
r.client.handleUpdatesEvent(response)
default: default:
c.Logger.Debug().Any("res", response).Msg("unknown event") r.client.Logger.Debug().Any("res", response).Msg("Got unknown bugleroute")
} }
} }
}
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")
}

View file

@ -9,5 +9,5 @@ type QR struct {
} }
type PairSuccessful struct { type PairSuccessful struct {
*binary.Container *binary.PairedData
} }

View file

@ -3,16 +3,28 @@ package events
import ( import (
"net/http" "net/http"
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/binary"
) )
type ClientReady struct { type ClientReady struct {
Session *util.SessionResponse SessionId string
Conversations []*binary.Conversation
} }
func NewClientReady(session *util.SessionResponse) *ClientReady { func NewClientReady(sessionId string, conversationList *binary.Conversations) *ClientReady {
return &ClientReady{ return &ClientReady{
Session: session, SessionId: sessionId,
Conversations: conversationList.Conversations,
}
}
type AuthTokenRefreshed struct {
Token []byte
}
func NewAuthTokenRefreshed(token []byte) *AuthTokenRefreshed {
return &AuthTokenRefreshed{
Token: token,
} }
} }

21
libgm/events/settings.go Normal file
View file

@ -0,0 +1,21 @@
package events
import "go.mau.fi/mautrix-gmessages/libgm/binary"
type SettingEvent interface {
GetSettings() *binary.Settings
}
type SETTINGS_UPDATED struct {
Settings *binary.Settings
}
func (su *SETTINGS_UPDATED) GetSettings() *binary.Settings {
return su.Settings
}
func NewSettingsUpdated(settings *binary.Settings) SettingEvent {
return &SETTINGS_UPDATED{
Settings: settings,
}
}

50
libgm/events/typing.go Normal file
View file

@ -0,0 +1,50 @@
package events
import "go.mau.fi/mautrix-gmessages/libgm/binary"
type TypingEvent interface {
GetConversation() string
}
type User struct {
Field1 int64
Number string
}
type STARTED_TYPING struct {
ConversationId string
User User
}
func (t *STARTED_TYPING) GetConversation() string {
return t.ConversationId
}
func NewStartedTyping(data *binary.TypingData) TypingEvent {
return &STARTED_TYPING{
ConversationId: data.ConversationID,
User: User{
Field1: data.User.Field1,
Number: data.User.Number,
},
}
}
type STOPPED_TYPING struct {
ConversationId string
User User
}
func (t *STOPPED_TYPING) GetConversation() string {
return t.ConversationId
}
func NewStoppedTyping(data *binary.TypingData) TypingEvent {
return &STOPPED_TYPING{
ConversationId: data.ConversationID,
User: User{
Field1: data.User.Field1,
Number: data.User.Number,
},
}
}

View file

@ -1,23 +1,35 @@
package events package events
type BrowserActive struct { type BrowserActive struct {
SessionID string SessionId string
} }
func NewBrowserActive(sessionID string) *BrowserActive { func NewBrowserActive(sessionId string) *BrowserActive {
return &BrowserActive{ return &BrowserActive{
SessionID: sessionID, SessionId: sessionId,
} }
} }
type Battery struct{} type MOBILE_BATTERY_RESTORED struct{}
func NewBattery() *Battery { func NewMobileBatteryRestored() *MOBILE_BATTERY_RESTORED {
return &Battery{} return &MOBILE_BATTERY_RESTORED{}
} }
type DataConnection struct{} type MOBILE_BATTERY_LOW struct{}
func NewDataConnection() *DataConnection { func NewMobileBatteryLow() *MOBILE_BATTERY_LOW {
return &DataConnection{} return &MOBILE_BATTERY_LOW{}
}
type MOBILE_DATA_CONNECTION struct{}
func NewMobileDataConnection() *MOBILE_DATA_CONNECTION {
return &MOBILE_DATA_CONNECTION{}
}
type MOBILE_WIFI_CONNECTION struct{}
func NewMobileWifiConnection() *MOBILE_WIFI_CONNECTION {
return &MOBILE_WIFI_CONNECTION{}
} }

View file

@ -1,9 +0,0 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func (c *Client) handleConversationEvent(response *Response, evtData *binary.Event_ConversationEvent) {
c.triggerEvent(evtData)
}

View file

@ -1,9 +0,0 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func (c *Client) handleMessageEvent(response *Response, evtData *binary.Event_MessageEvent) {
c.triggerEvent(evtData)
}

View file

@ -1,23 +0,0 @@
package libgm
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
}
}

View file

@ -1,78 +0,0 @@
package libgm
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
}

View file

@ -4,11 +4,13 @@ import (
"bytes" "bytes"
"errors" "errors"
"io" "io"
"log"
"net/http" "net/http"
"strconv" "strconv"
"go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/crypto" "go.mau.fi/mautrix-gmessages/libgm/crypto"
"go.mau.fi/mautrix-gmessages/libgm/payload"
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
@ -38,6 +40,7 @@ func (c *Client) FinalizeUploadMedia(upload *StartGoogleUpload) (*MediaUpload, e
imageType := upload.Image.GetImageType() imageType := upload.Image.GetImageType()
encryptedImageSize := strconv.Itoa(len(upload.EncryptedMediaBytes)) encryptedImageSize := strconv.Itoa(len(upload.EncryptedMediaBytes))
log.Println("EncryptedImageSize:", encryptedImageSize)
finalizeUploadHeaders := util.NewMediaUploadHeaders(encryptedImageSize, "upload, finalize", "0", imageType.Format, "") finalizeUploadHeaders := util.NewMediaUploadHeaders(encryptedImageSize, "upload, finalize", "0", imageType.Format, "")
req, reqErr := http.NewRequest("POST", upload.UploadURL, bytes.NewBuffer(upload.EncryptedMediaBytes)) req, reqErr := http.NewRequest("POST", upload.UploadURL, bytes.NewBuffer(upload.EncryptedMediaBytes))
if reqErr != nil { if reqErr != nil {
@ -48,7 +51,7 @@ func (c *Client) FinalizeUploadMedia(upload *StartGoogleUpload) (*MediaUpload, e
res, resErr := c.http.Do(req) res, resErr := c.http.Do(req)
if resErr != nil { if resErr != nil {
panic(resErr) log.Fatal(resErr)
} }
statusCode := res.StatusCode statusCode := res.StatusCode
@ -65,7 +68,7 @@ func (c *Client) FinalizeUploadMedia(upload *StartGoogleUpload) (*MediaUpload, e
} }
uploadStatus := rHeaders.Get("x-goog-upload-status") uploadStatus := rHeaders.Get("x-goog-upload-status")
c.Logger.Debug().Str("upload_status", uploadStatus).Msg("Upload status") log.Println("Upload Status: ", uploadStatus)
mediaIDs := &binary.UploadMediaResponse{} mediaIDs := &binary.UploadMediaResponse{}
err3 = crypto.DecodeAndEncodeB64(string(googleResponse), mediaIDs) err3 = crypto.DecodeAndEncodeB64(string(googleResponse), mediaIDs)
@ -103,7 +106,7 @@ func (c *Client) StartUploadMedia(image *Image) (*StartGoogleUpload, error) {
res, resErr := c.http.Do(req) res, resErr := c.http.Do(req)
if resErr != nil { if resErr != nil {
panic(resErr) log.Fatal(resErr)
} }
statusCode := res.StatusCode statusCode := res.StatusCode
@ -132,21 +135,15 @@ func (c *Client) StartUploadMedia(image *Image) (*StartGoogleUpload, error) {
} }
func (c *Client) buildStartUploadPayload() (string, error) { func (c *Client) buildStartUploadPayload() (string, error) {
requestId := util.RandomUUIDv4() requestID := util.RandomUUIDv4()
protoData := &binary.StartMediaUploadPayload{ protoData := &binary.StartMediaUploadPayload{
ImageType: 1, ImageType: 1,
AuthData: &binary.AuthMessage{ AuthData: &binary.AuthMessage{
RequestID: requestId, RequestID: requestID,
RpcKey: c.rpcKey, TachyonAuthToken: c.authData.TachyonAuthToken,
Date: &binary.Date{ ConfigVersion: payload.ConfigMessage,
Year: 2023,
Seq1: 6,
Seq2: 22,
Seq3: 4,
Seq4: 6,
}, },
}, Mobile: c.authData.DevicePair.Mobile,
Mobile: c.devicePair.Mobile,
} }
protoDataEncoded, protoEncodeErr := crypto.EncodeProtoB64(protoData) protoDataEncoded, protoEncodeErr := crypto.EncodeProtoB64(protoData)

View file

@ -21,12 +21,13 @@ type MessageBuilder struct {
tmpID string tmpID string
selfParticipantID string selfParticipantID string
replyToMessageID string
images []*MediaUpload images []*MediaUpload
err error err error
} }
// Add this method to retrieve the stored error
func (mb *MessageBuilder) Err() error { func (mb *MessageBuilder) Err() error {
return mb.err return mb.err
} }
@ -39,32 +40,38 @@ func (mb *MessageBuilder) GetContent() string {
return mb.content return mb.content
} }
func (mb *MessageBuilder) GetConversationID() string {
return mb.conversationID
}
func (mb *MessageBuilder) GetSelfParticipantID() string {
return mb.selfParticipantID
}
func (mb *MessageBuilder) GetTmpID() string {
return mb.tmpID
}
func (mb *MessageBuilder) SetContent(content string) *MessageBuilder { func (mb *MessageBuilder) SetContent(content string) *MessageBuilder {
mb.content = content mb.content = content
return mb return mb
} }
func (mb *MessageBuilder) GetConversationID() string {
return mb.conversationID
}
func (mb *MessageBuilder) SetConversationID(conversationId string) *MessageBuilder { func (mb *MessageBuilder) SetConversationID(conversationId string) *MessageBuilder {
mb.conversationID = conversationId mb.conversationID = conversationId
return mb 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 // sendmessage function will set this automatically but if u want to set it yourself feel free
func (mb *MessageBuilder) SetSelfParticipantID(participantId string) *MessageBuilder { func (mb *MessageBuilder) SetSelfParticipantID(participantId string) *MessageBuilder {
mb.selfParticipantID = participantId mb.selfParticipantID = participantId
return mb return mb
} }
func (mb *MessageBuilder) GetTmpID() string { // messageID of the message to reply to
return mb.tmpID func (mb *MessageBuilder) SetReplyMessage(messageId string) *MessageBuilder {
mb.replyToMessageID = messageId
return mb
} }
// sendmessage function will set this automatically but if u want to set it yourself feel free // sendmessage function will set this automatically but if u want to set it yourself feel free
@ -107,10 +114,10 @@ func (c *Client) NewMessageBuilder() *MessageBuilder {
func (mb *MessageBuilder) newSendConversationMessage() *binary.SendMessagePayload { func (mb *MessageBuilder) newSendConversationMessage() *binary.SendMessagePayload {
convID := mb.GetConversationID() convId := mb.GetConversationID()
content := mb.GetContent() content := mb.GetContent()
selfParticipantID := mb.GetSelfParticipantID() selfParticipantId := mb.GetSelfParticipantID()
tmpID := mb.GetTmpID() tmpId := mb.GetTmpID()
messageInfo := make([]*binary.MessageInfo, 0) messageInfo := make([]*binary.MessageInfo, 0)
messageInfo = append(messageInfo, &binary.MessageInfo{Data: &binary.MessageInfo_MessageContent{ messageInfo = append(messageInfo, &binary.MessageInfo{Data: &binary.MessageInfo_MessageContent{
@ -122,16 +129,17 @@ func (mb *MessageBuilder) newSendConversationMessage() *binary.SendMessagePayloa
mb.appendImagesPayload(&messageInfo) mb.appendImagesPayload(&messageInfo)
sendMsgPayload := &binary.SendMessagePayload{ sendMsgPayload := &binary.SendMessagePayload{
ConversationID: convID, ConversationID: convId,
MessagePayload: &binary.MessagePayload{ MessagePayload: &binary.MessagePayload{
TmpID: tmpID, TmpID: tmpId,
ConversationID: convID, ConversationID: convId,
SelfParticipantID: selfParticipantID, SelfParticipantID: selfParticipantId,
MessageInfo: messageInfo, MessageInfo: messageInfo,
TmpID2: tmpID, TmpID2: tmpId,
}, },
TmpID: tmpID, TmpID: tmpId,
} }
if len(content) > 0 { if len(content) > 0 {
sendMsgPayload.MessagePayload.MessagePayloadContent = &binary.MessagePayloadContent{ sendMsgPayload.MessagePayload.MessagePayloadContent = &binary.MessagePayloadContent{
MessageContent: &binary.MessageContent{ MessageContent: &binary.MessageContent{
@ -139,6 +147,12 @@ func (mb *MessageBuilder) newSendConversationMessage() *binary.SendMessagePayloa
}, },
} }
} }
if mb.replyToMessageID != "" {
sendMsgPayload.IsReply = true
sendMsgPayload.Reply = &binary.ReplyPayload{MessageID: mb.replyToMessageID}
}
mb.client.Logger.Debug().Any("sendMsgPayload", sendMsgPayload).Msg("sendMessagePayload") mb.client.Logger.Debug().Any("sendMsgPayload", sendMsgPayload).Msg("sendMessagePayload")
return sendMsgPayload return sendMsgPayload
@ -157,16 +171,16 @@ func (mb *MessageBuilder) appendImagesPayload(messageInfo *[]*binary.MessageInfo
func (mb *MessageBuilder) newImageContent(media *MediaUpload) *binary.MessageInfo { func (mb *MessageBuilder) newImageContent(media *MediaUpload) *binary.MessageInfo {
imageMessage := &binary.MessageInfo{ imageMessage := &binary.MessageInfo{
Data: &binary.MessageInfo_ImageContent{ Data: &binary.MessageInfo_MediaContent{
ImageContent: &binary.ImageContent{ MediaContent: &binary.MediaContent{
SomeNumber: media.Image.GetImageType().Type, Format: binary.MediaFormats(media.Image.GetImageType().Type),
ImageID: media.MediaID, MediaID: media.MediaID,
ImageName: media.Image.GetImageName(), MediaName: media.Image.GetImageName(),
Size: media.Image.GetImageSize(), Size: media.Image.GetImageSize(),
DecryptionKey: media.Image.GetImageCryptor().GetKey(), DecryptionKey: media.Image.GetImageCryptor().GetKey(),
}, },
}, },
} }
mb.client.Logger.Debug().Any("imageMessage", imageMessage).Msg("New Image Content") mb.client.Logger.Debug().Any("imageMessage", imageMessage).Msg("New Media Content")
return imageMessage return imageMessage
} }

10
libgm/message_handler.go Normal file
View file

@ -0,0 +1,10 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
)
func (c *Client) handleMessageEvent(res *pblite.Response, data *binary.Message) {
c.triggerEvent(data)
}

61
libgm/messages.go Normal file
View file

@ -0,0 +1,61 @@
package libgm
import (
"fmt"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
type Messages struct {
client *Client
}
func (m *Messages) React(reactionBuilder *ReactionBuilder) (*binary.SendReactionResponse, error) {
payload, buildErr := reactionBuilder.Build()
if buildErr != nil {
return nil, buildErr
}
actionType := binary.ActionType_SEND_REACTION
sentRequestId, sendErr := m.client.sessionHandler.completeSendMessage(actionType, true, payload)
if sendErr != nil {
return nil, sendErr
}
response, err := m.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if err != nil {
return nil, err
}
res, ok := response.Data.Decrypted.(*binary.SendReactionResponse)
if !ok {
return nil, fmt.Errorf("failed to assert response into SendReactionResponse")
}
m.client.Logger.Debug().Any("res", res).Msg("sent reaction!")
return res, nil
}
func (m *Messages) Delete(messageId string) (*binary.DeleteMessageResponse, error) {
payload := &binary.DeleteMessagePayload{MessageID: messageId}
actionType := binary.ActionType_DELETE_MESSAGE
sentRequestId, sendErr := m.client.sessionHandler.completeSendMessage(actionType, true, payload)
if sendErr != nil {
return nil, sendErr
}
response, err := m.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if err != nil {
return nil, err
}
res, ok := response.Data.Decrypted.(*binary.DeleteMessageResponse)
if !ok {
return nil, fmt.Errorf("failed to assert response into DeleteMessageResponse")
}
m.client.Logger.Debug().Any("res", res).Msg("deleted message!")
return res, nil
}

14
libgm/metadata/emojis.go Normal file
View file

@ -0,0 +1,14 @@
package metadata
var Emojis = map[string]int64{
"\U0001F44D": 1, // 👍
"\U0001F60D": 2, // 😍
"\U0001F602": 3, // 😂
"\U0001F62E": 4, // 😮
"\U0001F625": 5, // 😥
"\U0001F622": 10, // 😢
"\U0001F620": 6, // 😠
"\U0001F621": 11, // 😡
"\U0001F44E": 7, // 👎
"\U00002764": 12, // ❤️
}

View file

@ -1,71 +0,0 @@
package libgm
import (
"encoding/json"
"fmt"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
)
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 := pblite.Deserialize(msgArr, response.ProtoReflect())
if deserializeErr != nil {
r.client.Logger.Error().Err(deserializeErr).Msg("meow")
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 {
panic(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")
}

View file

@ -1,47 +0,0 @@
package libgm
import (
"encoding/base64"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func (c *Client) handleSeperateOpCode(msgData *binary.MessageData) {
decodedBytes, err := base64.StdEncoding.DecodeString(msgData.EncodedData)
if err != nil {
panic(err)
}
switch msgData.RoutingOpCode {
case 14: // paired successful
decodedData := &binary.Container{}
err = binary.DecodeProtoMessage(decodedBytes, decodedData)
if err != nil {
panic(err)
}
if decodedData.UnpairDeviceData != nil {
c.Logger.Warn().Any("data", decodedData).Msg("Unpaired?")
return
}
// TODO unpairing
c.Logger.Debug().Any("data", decodedData).Msg("Paired device decoded data")
if c.pairer != nil {
c.pairer.pairCallback(decodedData)
} else {
c.Logger.Warn().Msg("No pairer to receive callback")
}
default:
decodedData := &binary.EncodedResponse{}
err = binary.DecodeProtoMessage(decodedBytes, decodedData)
if err != nil {
panic(err)
}
if (decodedData.Sub && decodedData.Third != 0) && decodedData.EncryptedData != nil {
bugleData := &binary.BugleBackendService{}
err = c.cryptor.DecryptAndDecodeData(decodedData.EncryptedData, bugleData)
if err != nil {
panic(err)
}
c.handleBugleOpCode(bugleData)
}
}
}

View file

@ -26,6 +26,7 @@ func (c *Client) NewPairer(keyData *crypto.JWK, refreshQrCodeTime int) (*Pairer,
if keyData == nil { if keyData == nil {
var err error var err error
keyData, err = crypto.GenerateECDSA_P256_JWK() keyData, err = crypto.GenerateECDSA_P256_JWK()
c.updateJWK(keyData)
if err != nil { if err != nil {
c.Logger.Error().Any("data", keyData).Msg(err.Error()) c.Logger.Error().Any("data", keyData).Msg(err.Error())
return nil, err return nil, err
@ -46,7 +47,7 @@ func (p *Pairer) RegisterPhoneRelay() (*binary.RegisterPhoneRelayResponse, error
p.client.Logger.Err(err) p.client.Logger.Err(err)
return &binary.RegisterPhoneRelayResponse{}, 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") //p.client.Logger.Debug().Any("keyByteLength", len(jsonPayload.GetPairDeviceData().EcdsaKeys.EncryptedKeys)).Any("json", jsonPayload).Any("base64", body).Msg("RegisterPhoneRelay Payload")
relayResponse, reqErr := p.client.MakeRelayRequest(util.REGISTER_PHONE_RELAY, body) relayResponse, reqErr := p.client.MakeRelayRequest(util.REGISTER_PHONE_RELAY, body)
if reqErr != nil { if reqErr != nil {
p.client.Logger.Err(reqErr) p.client.Logger.Err(reqErr)
@ -63,6 +64,7 @@ func (p *Pairer) RegisterPhoneRelay() (*binary.RegisterPhoneRelayResponse, error
return nil, err3 return nil, err3
} }
p.pairingKey = res.GetPairingKey() p.pairingKey = res.GetPairingKey()
p.client.Logger.Debug().Any("response", res).Msg("Registerphonerelay response")
url, qrErr := p.GenerateQRCodeData() url, qrErr := p.GenerateQRCodeData()
if qrErr != nil { if qrErr != nil {
return nil, qrErr return nil, qrErr
@ -86,12 +88,12 @@ func (p *Pairer) startRefreshRelayTask() {
} }
func (p *Pairer) RefreshPhoneRelay() { func (p *Pairer) RefreshPhoneRelay() {
body, _, err := payload.RefreshPhoneRelay(p.client.rpcKey) body, _, err := payload.RefreshPhoneRelay(p.client.authData.TachyonAuthToken)
if err != nil { if err != nil {
p.client.Logger.Err(err).Msg("refresh phone relay err") p.client.Logger.Err(err).Msg("refresh phone relay err")
return return
} }
//p.client.Logger.Debug().Any("keyByteLength", len(jsonPayload.PhoneRelay.RpcKey)).Any("json", jsonPayload).Any("base64", body).Msg("RefreshPhoneRelay Payload") //p.client.Logger.Debug().Any("keyByteLength", len(jsonPayload.PhoneRelay.tachyonAuthToken)).Any("json", jsonPayload).Any("base64", body).Msg("RefreshPhoneRelay Payload")
relayResponse, reqErr := p.client.MakeRelayRequest(util.REFRESH_PHONE_RELAY, body) relayResponse, reqErr := p.client.MakeRelayRequest(util.REFRESH_PHONE_RELAY, body)
if reqErr != nil { if reqErr != nil {
p.client.Logger.Err(reqErr).Msg("refresh phone relay err") p.client.Logger.Err(reqErr).Msg("refresh phone relay err")
@ -116,46 +118,36 @@ func (p *Pairer) RefreshPhoneRelay() {
p.client.triggerEvent(&events.QR{URL: url}) p.client.triggerEvent(&events.QR{URL: url})
} }
func (p *Pairer) GetWebEncryptionKey(oldKey []byte) []byte { func (c *Client) GetWebEncryptionKey() (*binary.WebEncryptionKeyResponse, error) {
body, _, err2 := payload.GetWebEncryptionKey(oldKey) body, rawData, err1 := payload.GetWebEncryptionKey(c.authData.TachyonAuthToken)
if err2 != nil { if err1 != nil {
p.client.Logger.Err(err2).Msg("web encryption key err") c.Logger.Err(err1).Msg("web encryption key err")
return nil return nil, err1
} }
//p.client.Logger.Debug().Any("keyByteLength", len(rawData.PhoneRelay.RpcKey)).Any("json", rawData).Any("base64", body).Msg("GetWebEncryptionKey Payload") c.Logger.Debug().Any("keyByteLength", len(rawData.AuthMessage.TachyonAuthToken)).Any("json", rawData).Any("base64", body).Msg("GetWebEncryptionKey Payload")
webKeyResponse, reqErr := p.client.MakeRelayRequest(util.GET_WEB_ENCRYPTION_KEY, body) webKeyResponse, reqErr := c.MakeRelayRequest(util.GET_WEB_ENCRYPTION_KEY, body)
if reqErr != nil { if reqErr != nil {
p.client.Logger.Err(reqErr).Msg("Web encryption key request err") c.Logger.Err(reqErr).Msg("Web encryption key request err")
return nil, reqErr
} }
responseBody, err2 := io.ReadAll(webKeyResponse.Body) responseBody, err2 := io.ReadAll(webKeyResponse.Body)
defer webKeyResponse.Body.Close() defer webKeyResponse.Body.Close()
if err2 != nil { if err2 != nil {
p.client.Logger.Err(err2).Msg("Web encryption key read response err") c.Logger.Err(err2).Msg("Web encryption key read response err")
return nil return nil, err2
} }
//p.client.Logger.Debug().Any("responseLength", len(responseBody)).Any("raw", responseBody).Msg("Response Body Length") //p.client.Logger.Debug().Any("responseLength", len(responseBody)).Any("raw", responseBody).Msg("Response Body Length")
parsedResponse := &binary.WebEncryptionKeyResponse{} parsedResponse := &binary.WebEncryptionKeyResponse{}
err2 = binary.DecodeProtoMessage(responseBody, parsedResponse) err2 = binary.DecodeProtoMessage(responseBody, parsedResponse)
if err2 != nil { if err2 != nil {
p.client.Logger.Err(err2).Msg("Parse webkeyresponse into proto struct error") c.Logger.Err(err2).Msg("Parse webkeyresponse into proto struct error")
return nil, err2
} }
p.client.Logger.Debug().Any("parsedResponse", parsedResponse).Msg("WebEncryptionKeyResponse") c.Logger.Debug().Any("webenckeyresponse", parsedResponse).Msg("Web encryption key")
if p.ticker != nil { if c.pairer != nil {
p.client.Logger.Info().Msg("Reconnecting") if c.pairer.ticker != nil {
p.ticker.Stop() c.pairer.ticker.Stop()
reconnectErr := p.client.Reconnect(p.client.rpc.webAuthKey)
if reconnectErr != nil {
panic(reconnectErr)
} }
} }
return parsedResponse.GetKey() return parsedResponse, nil
}
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(p.client.rpc.webAuthKey)
p.client.triggerEvent(&events.PairSuccessful{Container: pairData})
p.client.pairer = nil
} }

62
libgm/pairing_handler.go Normal file
View file

@ -0,0 +1,62 @@
package libgm
import (
"log"
"go.mau.fi/mautrix-gmessages/libgm/events"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func (c *Client) handlePairingEvent(response *pblite.Response) {
pairEventData, ok := response.Data.Decrypted.(*binary.PairEvents)
if !ok {
c.Logger.Error().Any("pairEventData", pairEventData).Msg("failed to assert response into PairEvents")
return
}
switch evt := pairEventData.Event.(type) {
case *binary.PairEvents_Paired:
callbackErr := c.pairCallback(evt.Paired)
if callbackErr != nil {
log.Fatal(callbackErr)
}
case *binary.PairEvents_Revoked:
c.Logger.Debug().Any("data", evt).Msg("Revoked Device")
default:
c.Logger.Debug().Any("response", response).Any("evt", evt).Msg("Invalid PairEvents type")
}
}
func (c *Client) NewDevicePair(mobile, browser *binary.Device) *pblite.DevicePair {
return &pblite.DevicePair{
Mobile: mobile,
Browser: browser,
}
}
func (c *Client) pairCallback(data *binary.PairedData) error {
tokenData := data.GetTokenData()
c.updateTachyonAuthToken(tokenData.GetTachyonAuthToken())
c.updateTTL(tokenData.GetTTL())
devicePair := c.NewDevicePair(data.Mobile, data.Browser)
c.updateDevicePair(devicePair)
webEncryptionKeyResponse, webErr := c.GetWebEncryptionKey()
if webErr != nil {
return webErr
}
c.updateWebEncryptionKey(webEncryptionKeyResponse.GetKey())
c.triggerEvent(&events.PairSuccessful{data})
reconnectErr := c.Reconnect()
if reconnectErr != nil {
return reconnectErr
}
return nil
}

22
libgm/payload/config.go Normal file
View file

@ -0,0 +1,22 @@
package payload
import (
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/util"
)
// 202306220406
var ConfigMessage = &binary.ConfigVersion{
V1: 2023,
V2: 7,
V3: 3,
V4: 4,
V5: 6,
}
var Network = "Bugle"
var BrowserDetailsMessage = &binary.BrowserDetails{
UserAgent: util.USER_AGENT,
BrowserType: util.BROWSER_TYPE,
Os: util.OS,
SomeBool: true,
}

View file

@ -5,19 +5,13 @@ import (
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
func GetWebEncryptionKey(WebPairKey []byte) ([]byte, *binary.Container, error) { func GetWebEncryptionKey(WebPairKey []byte) ([]byte, *binary.AuthenticationContainer, error) {
id := util.RandomUUIDv4() id := util.RandomUUIDv4()
payload := &binary.Container{ payload := &binary.AuthenticationContainer{
PhoneRelay: &binary.PhoneRelayBody{ AuthMessage: &binary.AuthenticationMessage{
ID: id, RequestID: id,
RpcKey: WebPairKey, TachyonAuthToken: WebPairKey,
Date: &binary.Date{ ConfigVersion: ConfigMessage,
Year: 2023,
Seq1: 6,
Seq2: 22,
Seq3: 4,
Seq4: 6,
},
}, },
} }
encodedPayload, err2 := binary.EncodeProtoMessage(payload) encodedPayload, err2 := binary.EncodeProtoMessage(payload)

View file

@ -13,14 +13,8 @@ func ReceiveMessages(rpcKey []byte) ([]byte, string, error) {
payload := &binary.ReceiveMessagesRequest{ payload := &binary.ReceiveMessagesRequest{
Auth: &binary.AuthMessage{ Auth: &binary.AuthMessage{
RequestID: uuid.New().String(), RequestID: uuid.New().String(),
RpcKey: rpcKey, TachyonAuthToken: rpcKey,
Date: &binary.Date{ ConfigVersion: ConfigMessage,
Year: 2023,
Seq1: 6,
Seq2: 22,
Seq3: 4,
Seq4: 6,
},
}, },
Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject2{ Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject2{
Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject1{}, Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject1{},

View file

@ -5,19 +5,13 @@ import (
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
func RefreshPhoneRelay(rpcKey []byte) ([]byte, *binary.Container, error) { func RefreshPhoneRelay(rpcKey []byte) ([]byte, *binary.AuthenticationContainer, error) {
payload := &binary.Container{ payload := &binary.AuthenticationContainer{
PhoneRelay: &binary.PhoneRelayBody{ AuthMessage: &binary.AuthenticationMessage{
ID: util.RandomUUIDv4(), RequestID: util.RandomUUIDv4(),
Bugle: "Bugle", Network: Network,
RpcKey: rpcKey, TachyonAuthToken: rpcKey,
Date: &binary.Date{ ConfigVersion: ConfigMessage,
Year: 2023,
Seq1: 6,
Seq2: 22,
Seq3: 4,
Seq4: 6,
},
}, },
} }
encodedPayload, err2 := binary.EncodeProtoMessage(payload) encodedPayload, err2 := binary.EncodeProtoMessage(payload)

View file

@ -6,16 +6,46 @@ import (
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
func RegisterPhoneRelay(jwk *crypto.JWK) ([]byte, *binary.Container, error) { func RegisterPhoneRelay(jwk *crypto.JWK) ([]byte, *binary.AuthenticationContainer, error) {
id := util.RandomUUIDv4() id := util.RandomUUIDv4()
encryptedKeys, encryptErr := uncompressKey(jwk)
if encryptErr != nil {
return nil, nil, encryptErr
}
payloadData := &binary.AuthenticationContainer{
AuthMessage: &binary.AuthenticationMessage{
RequestID: id,
Network: Network,
ConfigVersion: ConfigMessage,
},
BrowserDetails: BrowserDetailsMessage,
Data: &binary.AuthenticationContainer_KeyData{
KeyData: &binary.KeyData{
EcdsaKeys: &binary.ECDSAKeys{
Field1: 2,
EncryptedKeys: encryptedKeys,
},
},
},
}
encoded, err4 := binary.EncodeProtoMessage(payloadData)
if err4 != nil {
return nil, payloadData, err4
}
return encoded, payloadData, nil
}
func uncompressKey(jwk *crypto.JWK) ([]byte, error) {
decodedPrivateKey, err2 := jwk.PrivKeyB64Bytes() decodedPrivateKey, err2 := jwk.PrivKeyB64Bytes()
if err2 != nil { if err2 != nil {
return nil, nil, err2 return nil, err2
} }
jwk.PrivateBytes = decodedPrivateKey jwk.PrivateBytes = decodedPrivateKey
uncompressedPublicKey, err3 := jwk.UncompressPubKey() uncompressedPublicKey, err3 := jwk.UncompressPubKey()
if err3 != nil { if err3 != nil {
return nil, nil, err3 return nil, err3
} }
var emptyByteArray []byte var emptyByteArray []byte
crypto.EncodeValues(&emptyByteArray, crypto.SequenceOne) crypto.EncodeValues(&emptyByteArray, crypto.SequenceOne)
@ -27,37 +57,7 @@ func RegisterPhoneRelay(jwk *crypto.JWK) ([]byte, *binary.Container, error) {
copiedByteArray = crypto.HelperAppendBytes(copiedByteArray, value) copiedByteArray = crypto.HelperAppendBytes(copiedByteArray, value)
} }
var emptyByteArray2 []byte var encryptedKeys []byte
emptyByteArray2 = crypto.AppendBytes(emptyByteArray2, copiedByteArray[0:]) encryptedKeys = crypto.AppendBytes(encryptedKeys, copiedByteArray[0:])
return encryptedKeys, nil
payloadData := &binary.Container{
PhoneRelay: &binary.PhoneRelayBody{
ID: id,
Bugle: "Bugle",
Date: &binary.Date{
Year: 2023,
Seq1: 6,
Seq2: 22,
Seq3: 4,
Seq4: 6,
},
},
BrowserDetails: &binary.BrowserDetails{
UserAgent: util.UserAgent,
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
} }

View file

@ -0,0 +1,35 @@
package payload
import (
"encoding/json"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
)
func RegisterRefresh(sig string, requestId string, timestamp int64, browser *binary.Device, tachyonAuthToken []byte) ([]byte, error) {
payload := &binary.RegisterRefreshPayload{
MessageAuth: &binary.AuthMessage{
RequestID: requestId,
TachyonAuthToken: tachyonAuthToken,
ConfigVersion: ConfigMessage,
},
CurrBrowserDevice: browser,
UnixTimestamp: timestamp,
Signature: sig,
EmptyRefreshArr: &binary.EmptyRefreshArr{EmptyArr: &binary.EmptyEmptyArr{}},
MessageType: 2, // hmm
}
serialized, serializeErr := pblite.Serialize(payload.ProtoReflect())
if serializeErr != nil {
return nil, serializeErr
}
jsonMessage, marshalErr := json.Marshal(serialized)
if marshalErr != nil {
return nil, marshalErr
}
return jsonMessage, nil
}

View file

@ -1,42 +1,128 @@
package payload package payload
import "go.mau.fi/mautrix-gmessages/libgm/binary" import (
"encoding/json"
"fmt"
"log"
func NewMessageData(requestID string, encodedStr string, routingOpCode int64, msgType int64) *binary.MessageData { "google.golang.org/protobuf/proto"
return &binary.MessageData{
RequestID: requestID, "go.mau.fi/mautrix-gmessages/libgm/binary"
RoutingOpCode: routingOpCode, "go.mau.fi/mautrix-gmessages/libgm/crypto"
EncodedData: encodedStr, "go.mau.fi/mautrix-gmessages/libgm/pblite"
MsgTypeArr: &binary.MsgTypeArr{ "go.mau.fi/mautrix-gmessages/libgm/routes"
)
type SendMessageBuilder struct {
message *binary.SendMessage
b64Message *binary.SendMessageInternal
err error
}
func (sm *SendMessageBuilder) Err() error {
return sm.err
}
func NewSendMessageBuilder(tachyonAuthToken []byte, pairedDevice *binary.Device, requestId string, sessionId string) *SendMessageBuilder {
return &SendMessageBuilder{
message: &binary.SendMessage{
Mobile: pairedDevice,
MessageData: &binary.SendMessageData{
RequestID: requestId,
},
MessageAuth: &binary.SendMessageAuth{
RequestID: requestId,
TachyonAuthToken: tachyonAuthToken,
ConfigVersion: ConfigMessage,
},
EmptyArr: &binary.EmptyArr{}, EmptyArr: &binary.EmptyArr{},
MsgType: msgType, },
b64Message: &binary.SendMessageInternal{
RequestID: requestId,
SessionID: sessionId,
}, },
} }
} }
func NewEncodedPayload(requestId string, opCode int64, encryptedData []byte, sessionID string) *binary.EncodedPayload { func (sm *SendMessageBuilder) SetPairedDevice(device *binary.Device) *SendMessageBuilder {
return &binary.EncodedPayload{ sm.message.Mobile = device
RequestID: requestId, return sm
Opcode: opCode,
EncryptedData: encryptedData,
SessionID: sessionID,
}
} }
func NewAuthData(requestId string, rpcKey []byte, date *binary.Date) *binary.AuthMessage { func (sm *SendMessageBuilder) setBugleRoute(bugleRoute binary.BugleRoute) *SendMessageBuilder {
return &binary.AuthMessage{ sm.message.MessageData.BugleRoute = bugleRoute
RequestID: requestId, return sm
RpcKey: rpcKey,
Date: date,
}
} }
func NewSendMessage(pairedDevice *binary.Device, messageData *binary.MessageData, authData *binary.AuthMessage, ttl int64) *binary.SendMessage { func (sm *SendMessageBuilder) SetRequestId(requestId string) *SendMessageBuilder {
return &binary.SendMessage{ sm.message.MessageAuth.RequestID = requestId
PairedDevice: pairedDevice, sm.message.MessageData.RequestID = requestId
MessageData: messageData, sm.b64Message.RequestID = requestId
AuthData: authData, return sm
TTL: ttl, }
func (sm *SendMessageBuilder) SetSessionId(sessionId string) *SendMessageBuilder {
sm.b64Message.SessionID = sessionId
return sm
}
func (sm *SendMessageBuilder) SetRoute(actionType binary.ActionType) *SendMessageBuilder {
action, ok := routes.Routes[actionType]
if !ok {
sm.err = fmt.Errorf("invalid action type")
return sm
}
sm.setBugleRoute(action.BugleRoute)
sm.setMessageType(action.MessageType)
sm.b64Message.Action = action.Action
return sm
}
func (sm *SendMessageBuilder) setMessageType(eventType binary.MessageType) *SendMessageBuilder {
sm.message.MessageData.MessageTypeData = &binary.MessageTypeData{
EmptyArr: &binary.EmptyArr{}, EmptyArr: &binary.EmptyArr{},
MessageType: eventType,
} }
return sm
}
func (sm *SendMessageBuilder) SetTTL(ttl int64) *SendMessageBuilder {
sm.message.TTL = ttl
return sm
}
func (sm *SendMessageBuilder) SetEncryptedProtoMessage(message proto.Message, cryptor *crypto.Cryptor) *SendMessageBuilder {
encryptedBytes, encryptErr := cryptor.EncodeAndEncryptData(message)
if encryptErr != nil {
sm.err = encryptErr
return sm
}
sm.b64Message.EncryptedProtoData = encryptedBytes
return sm
}
func (sm *SendMessageBuilder) Build() ([]byte, error) {
if sm.err != nil {
return nil, sm.err
}
encodedMessage, err := proto.Marshal(sm.b64Message)
if err != nil {
return nil, err
}
sm.message.MessageData.ProtobufData = encodedMessage
messageProtoJSON, serializeErr := pblite.Serialize(sm.message.ProtoReflect())
if serializeErr != nil {
log.Fatal(serializeErr)
return nil, serializeErr
}
protoJSONBytes, marshalErr := json.Marshal(messageProtoJSON)
if marshalErr != nil {
return nil, marshalErr
}
return protoJSONBytes, nil
} }

View file

@ -44,6 +44,10 @@ func Deserialize(data []any, m protoreflect.Message) error {
} }
m.Set(fieldDescriptor, protoreflect.ValueOfBytes(bytes)) m.Set(fieldDescriptor, protoreflect.ValueOfBytes(bytes))
case protoreflect.EnumKind:
num, ok = val.(float64)
expectedKind = "float64"
m.Set(fieldDescriptor, protoreflect.ValueOfEnum(protoreflect.EnumNumber(int32(num))))
case protoreflect.Int32Kind: case protoreflect.Int32Kind:
num, ok = val.(float64) num, ok = val.(float64)
expectedKind = "float64" expectedKind = "float64"

124
libgm/pblite/internal.go Normal file
View file

@ -0,0 +1,124 @@
package pblite
import (
"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/routes"
)
type DevicePair struct {
Mobile *binary.Device `json:"mobile,omitempty"`
Browser *binary.Device `json:"browser,omitempty"`
}
type RequestData struct {
RequestId string `json:"requestId,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Action binary.ActionType `json:"action,omitempty"`
Bool1 bool `json:"bool1,omitempty"`
Bool2 bool `json:"bool2,omitempty"`
EncryptedData []byte `json:"requestData,omitempty"`
Decrypted interface{} `json:"decrypted,omitempty"`
Bool3 bool `json:"bool3,omitempty"`
}
type Response struct {
ResponseId string `json:"responseId,omitempty"`
BugleRoute binary.BugleRoute `json:"bugleRoute,omitempty"`
StartExecute string `json:"startExecute,omitempty"`
MessageType binary.MessageType `json:"eventType,omitempty"`
FinishExecute string `json:"finishExecute,omitempty"`
MillisecondsTaken string `json:"millisecondsTaken,omitempty"`
Devices *DevicePair `json:"devices,omitempty"`
Data RequestData `json:"data,omitempty"`
SignatureId string `json:"signatureId,omitempty"`
Timestamp string `json:"timestamp"`
}
func DecodeAndDecryptInternalMessage(data []interface{}, cryptor *crypto.Cryptor) (*Response, error) {
internalMessage := &binary.InternalMessage{}
deserializeErr := Deserialize(data, internalMessage.ProtoReflect())
if deserializeErr != nil {
return nil, deserializeErr
}
var resp *Response
switch internalMessage.Data.BugleRoute {
case binary.BugleRoute_PairEvent:
decodedData := &binary.PairEvents{}
decodeErr := binary.DecodeProtoMessage(internalMessage.Data.ProtobufData, decodedData)
if decodeErr != nil {
return nil, decodeErr
}
resp = newResponseFromPairEvent(internalMessage.GetData(), decodedData)
case binary.BugleRoute_DataEvent:
internalRequestData := &binary.InternalRequestData{}
decodeErr := binary.DecodeProtoMessage(internalMessage.Data.ProtobufData, internalRequestData)
if decodeErr != nil {
return nil, decodeErr
}
if internalRequestData.EncryptedData != nil {
var decryptedData = routes.Routes[internalRequestData.GetAction()].ResponseStruct.ProtoReflect().New().Interface()
decryptErr := cryptor.DecryptAndDecodeData(internalRequestData.EncryptedData, decryptedData)
if decryptErr != nil {
return nil, decryptErr
}
resp = newResponseFromDataEvent(internalMessage.GetData(), internalRequestData, decryptedData)
} else {
resp = newResponseFromDataEvent(internalMessage.GetData(), internalRequestData, nil)
}
}
return resp, nil
}
func newResponseFromPairEvent(internalMsg *binary.InternalMessageData, data *binary.PairEvents) *Response {
resp := &Response{
ResponseId: internalMsg.GetResponseID(),
BugleRoute: internalMsg.GetBugleRoute(),
StartExecute: internalMsg.GetStartExecute(),
MessageType: internalMsg.GetMessageType(),
FinishExecute: internalMsg.GetFinishExecute(),
MillisecondsTaken: internalMsg.GetMillisecondsTaken(),
Devices: &DevicePair{
Mobile: internalMsg.GetMobile(),
Browser: internalMsg.GetBrowser(),
},
Data: RequestData{
Decrypted: data,
},
Timestamp: internalMsg.GetTimestamp(),
SignatureId: internalMsg.GetSignatureID(),
}
return resp
}
func newResponseFromDataEvent(internalMsg *binary.InternalMessageData, internalRequestData *binary.InternalRequestData, decrypted protoreflect.ProtoMessage) *Response {
resp := &Response{
ResponseId: internalMsg.GetResponseID(),
BugleRoute: internalMsg.GetBugleRoute(),
StartExecute: internalMsg.GetStartExecute(),
MessageType: internalMsg.GetMessageType(),
FinishExecute: internalMsg.GetFinishExecute(),
MillisecondsTaken: internalMsg.GetMillisecondsTaken(),
Devices: &DevicePair{
Mobile: internalMsg.GetMobile(),
Browser: internalMsg.GetBrowser(),
},
Data: RequestData{
RequestId: internalRequestData.GetSessionID(),
Timestamp: internalRequestData.GetTimestamp(),
Action: internalRequestData.GetAction(),
Bool1: internalRequestData.GetBool1(),
Bool2: internalRequestData.GetBool2(),
EncryptedData: internalRequestData.GetEncryptedData(),
Decrypted: decrypted,
Bool3: internalRequestData.GetBool3(),
},
SignatureId: internalMsg.GetSignatureID(),
Timestamp: internalMsg.GetTimestamp(),
}
return resp
}

View file

@ -10,8 +10,8 @@ import (
func (p *Pairer) GenerateQRCodeData() (string, error) { func (p *Pairer) GenerateQRCodeData() (string, error) {
urlData := &binary.UrlData{ urlData := &binary.UrlData{
PairingKey: p.pairingKey, PairingKey: p.pairingKey,
AESCTR256Key: p.client.cryptor.AESCTR256Key, AESKey: p.client.authData.Cryptor.AESKey,
SHA256Key: p.client.cryptor.SHA256Key, HMACKey: p.client.authData.Cryptor.HMACKey,
} }
encodedUrlData, err := binary.EncodeProtoMessage(urlData) encodedUrlData, err := binary.EncodeProtoMessage(urlData)
if err != nil { if err != nil {

88
libgm/reaction_builder.go Normal file
View file

@ -0,0 +1,88 @@
package libgm
import (
"fmt"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/metadata"
)
type ReactionBuilderError struct {
errMsg string
}
func (rbe *ReactionBuilderError) Error() string {
return fmt.Sprintf("Failed to build reaction builder: %s", rbe.errMsg)
}
type ReactionBuilder struct {
messageID string
emoji []byte
action binary.Reaction
emojiType int64
}
func (rb *ReactionBuilder) SetAction(action binary.Reaction) *ReactionBuilder {
rb.action = action
return rb
}
/*
Emoji is a unicode string like "\U0001F44D" or a string like "👍"
*/
func (rb *ReactionBuilder) SetEmoji(emoji string) *ReactionBuilder {
emojiType, exists := metadata.Emojis[emoji]
if exists {
rb.emojiType = emojiType
} else {
rb.emojiType = 8
}
rb.emoji = []byte(emoji)
return rb
}
func (rb *ReactionBuilder) SetMessageID(messageId string) *ReactionBuilder {
rb.messageID = messageId
return rb
}
func (rb *ReactionBuilder) Build() (*binary.SendReactionPayload, error) {
if rb.messageID == "" {
return nil, &ReactionBuilderError{
errMsg: "messageID can not be empty",
}
}
if rb.action == 0 {
return nil, &ReactionBuilderError{
errMsg: "action can not be empty",
}
}
if rb.emojiType == 0 {
return nil, &ReactionBuilderError{
errMsg: "failed to set emojiType",
}
}
if rb.emoji == nil {
return nil, &ReactionBuilderError{
errMsg: "failed to set emoji",
}
}
return &binary.SendReactionPayload{
MessageID: rb.messageID,
ReactionData: &binary.ReactionData{
EmojiUnicode: rb.emoji,
EmojiType: rb.emojiType,
},
Action: rb.action,
}, nil
}
func (c *Client) NewReactionBuilder() *ReactionBuilder {
return &ReactionBuilder{}
}

View file

@ -1,16 +0,0 @@
package libgm
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
}

View file

@ -2,99 +2,99 @@ package libgm
import ( import (
"fmt" "fmt"
"log"
"sync" "sync"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/routes"
) )
type ResponseChan struct { type ResponseChan struct {
responses []*Response response *pblite.Response
receivedResponses int64
wg sync.WaitGroup wg sync.WaitGroup
mu sync.Mutex mu sync.Mutex
} }
func (s *SessionHandler) addRequestToChannel(requestId string, opCode int64) { func (s *SessionHandler) addRequestToChannel(requestId string, actionType binary.ActionType) {
instruction, notOk := s.client.instructions.GetInstruction(opCode) _, notOk := routes.Routes[actionType]
if !notOk { if !notOk {
panic(notOk) log.Println("Missing action type: ", actionType)
log.Fatal(notOk)
} }
if msgMap, ok := s.requests[requestId]; ok { if msgMap, ok := s.requests[requestId]; ok {
responseChan := &ResponseChan{ responseChan := &ResponseChan{
responses: make([]*Response, 0, instruction.ExpectedResponses), response: &pblite.Response{},
receivedResponses: 0,
wg: sync.WaitGroup{}, wg: sync.WaitGroup{},
mu: sync.Mutex{}, mu: sync.Mutex{},
} }
msgMap[opCode] = responseChan responseChan.wg.Add(1)
responseChan.wg.Add(int(instruction.ExpectedResponses))
responseChan.mu.Lock() responseChan.mu.Lock()
msgMap[actionType] = responseChan
} else { } else {
s.requests[requestId] = make(map[int64]*ResponseChan) s.requests[requestId] = make(map[binary.ActionType]*ResponseChan)
responseChan := &ResponseChan{ responseChan := &ResponseChan{
responses: make([]*Response, 0, instruction.ExpectedResponses), response: &pblite.Response{},
receivedResponses: 0,
wg: sync.WaitGroup{}, wg: sync.WaitGroup{},
mu: sync.Mutex{}, mu: sync.Mutex{},
} }
s.requests[requestId][opCode] = responseChan responseChan.wg.Add(1)
responseChan.wg.Add(int(instruction.ExpectedResponses))
responseChan.mu.Lock() responseChan.mu.Lock()
s.requests[requestId][actionType] = responseChan
} }
} }
func (s *SessionHandler) respondToRequestChannel(res *Response) { func (s *SessionHandler) respondToRequestChannel(res *pblite.Response) {
requestId := res.Data.RequestID requestId := res.Data.RequestId
reqChannel, ok := s.requests[requestId] reqChannel, ok := s.requests[requestId]
actionType := res.Data.Action
if !ok { if !ok {
s.client.Logger.Debug().Any("actionType", actionType).Any("requestId", requestId).Msg("Did not expect response for this requestId")
return return
} }
opCodeResponseChan, ok2 := reqChannel[res.Data.Opcode] actionResponseChan, ok2 := reqChannel[actionType]
if !ok2 { if !ok2 {
s.client.Logger.Debug().Any("actionType", actionType).Any("requestId", requestId).Msg("Did not expect response for this actionType")
return return
} }
actionResponseChan.mu.Lock()
opCodeResponseChan.mu.Lock() actionResponseChan, ok2 = reqChannel[actionType]
if !ok2 {
opCodeResponseChan.responses = append(opCodeResponseChan.responses, res) s.client.Logger.Debug().Any("actionType", actionType).Any("requestId", requestId).Msg("Ignoring request for action...")
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 return
} }
opCodeResponseChan.receivedResponses++ s.client.Logger.Debug().Any("actionType", actionType).Any("requestId", requestId).Msg("responding to request")
opCodeResponseChan.wg.Done() actionResponseChan.response = res
if !ok3 { actionResponseChan.wg.Done()
panic(ok3)
opCodeResponseChan.mu.Unlock() delete(reqChannel, actionType)
return
}
if opCodeResponseChan.receivedResponses >= instruction.ExpectedResponses {
delete(reqChannel, res.Data.Opcode)
if len(reqChannel) == 0 { if len(reqChannel) == 0 {
delete(s.requests, requestId) delete(s.requests, requestId)
} }
actionResponseChan.mu.Unlock()
} }
opCodeResponseChan.mu.Unlock() func (s *SessionHandler) WaitForResponse(requestId string, actionType binary.ActionType) (*pblite.Response, error) {
}
func (s *SessionHandler) WaitForResponse(requestId string, opCode int64) ([]*Response, error) {
requestResponses, ok := s.requests[requestId] requestResponses, ok := s.requests[requestId]
if !ok { if !ok {
return nil, fmt.Errorf("no response channel found for request ID: %s (opcode: %v)", requestId, opCode) return nil, fmt.Errorf("no response channel found for request ID: %s (actionType: %v)", requestId, actionType)
} }
responseChan, ok2 := requestResponses[opCode]
if !ok2 { routeInfo, notFound := routes.Routes[actionType]
return nil, fmt.Errorf("no response channel found for opCode: %v (requestId: %s)", opCode, requestId) if !notFound {
return nil, fmt.Errorf("no action exists for actionType: %v (requestId: %s)", actionType, requestId)
}
responseChan, ok2 := requestResponses[routeInfo.Action]
if !ok2 {
return nil, fmt.Errorf("no response channel found for actionType: %v (requestId: %s)", routeInfo.Action, requestId)
} }
// Unlock so responses can be received
responseChan.mu.Unlock() responseChan.mu.Unlock()
// Wait for all responses to be received
responseChan.wg.Wait() responseChan.wg.Wait()
return responseChan.responses, nil return responseChan.response, nil
} }

View file

@ -0,0 +1,30 @@
package routes
import "go.mau.fi/mautrix-gmessages/libgm/binary"
var LIST_CONVERSATIONS_WITH_UPDATES = Route{
Action: binary.ActionType_LIST_CONVERSATIONS,
MessageType: binary.MessageType_BUGLE_ANNOTATION,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.Conversations{},
UseSessionID: false,
UseTTL: true,
}
var LIST_CONVERSATIONS = Route{
Action: binary.ActionType_LIST_CONVERSATIONS,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.Conversations{},
UseSessionID: false,
UseTTL: true,
}
var GET_CONVERSATION_TYPE = Route{
Action: binary.ActionType_GET_CONVERSATION_TYPE,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.GetConversationTypeResponse{},
UseSessionID: false,
UseTTL: true,
}

29
libgm/routes/mapped.go Normal file
View file

@ -0,0 +1,29 @@
package routes
import (
"google.golang.org/protobuf/proto"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
type Route struct {
Action binary.ActionType
MessageType binary.MessageType
BugleRoute binary.BugleRoute
ResponseStruct proto.Message
UseSessionID bool
UseTTL bool
}
var Routes = map[binary.ActionType]Route{
binary.ActionType_IS_BUGLE_DEFAULT: IS_BUGLE_DEFAULT,
binary.ActionType_GET_UPDATES: GET_UPDATES,
binary.ActionType_LIST_CONVERSATIONS: LIST_CONVERSATIONS,
binary.ActionType_LIST_CONVERSATIONS_SYNC: LIST_CONVERSATIONS_WITH_UPDATES,
binary.ActionType_NOTIFY_DITTO_ACTIVITY: NOTIFY_DITTO_ACTIVITY,
binary.ActionType_GET_CONVERSATION_TYPE: GET_CONVERSATION_TYPE,
binary.ActionType_LIST_MESSAGES: LIST_MESSAGES,
binary.ActionType_SEND_MESSAGE: SEND_MESSAGE,
binary.ActionType_SEND_REACTION: SEND_REACTION,
binary.ActionType_DELETE_MESSAGE: DELETE_MESSAGE,
}

39
libgm/routes/messages.go Normal file
View file

@ -0,0 +1,39 @@
package routes
import "go.mau.fi/mautrix-gmessages/libgm/binary"
var LIST_MESSAGES = Route{
Action: binary.ActionType_LIST_MESSAGES,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.FetchMessagesResponse{},
UseSessionID: false,
UseTTL: true,
}
var SEND_MESSAGE = Route{
Action: binary.ActionType_SEND_MESSAGE,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.SendMessageResponse{},
UseSessionID: false,
UseTTL: true,
}
var SEND_REACTION = Route{
Action: binary.ActionType_SEND_REACTION,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.SendReactionResponse{},
UseSessionID: false,
UseTTL: true,
}
var DELETE_MESSAGE = Route{
Action: binary.ActionType_DELETE_MESSAGE,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.DeleteMessageResponse{},
UseSessionID: false,
UseTTL: true,
}

30
libgm/routes/session.go Normal file
View file

@ -0,0 +1,30 @@
package routes
import "go.mau.fi/mautrix-gmessages/libgm/binary"
var IS_BUGLE_DEFAULT = Route{
Action: binary.ActionType_IS_BUGLE_DEFAULT,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.IsBugleDefaultResponse{},
UseSessionID: false,
UseTTL: true,
}
var GET_UPDATES = Route{
Action: binary.ActionType_GET_UPDATES,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: &binary.UpdateEvents{},
UseSessionID: true,
UseTTL: false,
}
var NOTIFY_DITTO_ACTIVITY = Route{
Action: binary.ActionType_NOTIFY_DITTO_ACTIVITY,
MessageType: binary.MessageType_BUGLE_MESSAGE,
BugleRoute: binary.BugleRoute_DataEvent,
ResponseStruct: nil,
UseSessionID: false,
UseTTL: true,
}

View file

@ -3,14 +3,19 @@ package libgm
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log"
"net/http" "net/http"
"os" "os"
"time" "time"
"go.mau.fi/mautrix-gmessages/libgm/events" "go.mau.fi/mautrix-gmessages/libgm/events"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
@ -18,8 +23,7 @@ type RPC struct {
client *Client client *Client
http *http.Client http *http.Client
conn io.ReadCloser conn io.ReadCloser
rpcSessionID string rpcSessionId string
webAuthKey []byte
listenID int listenID int
} }
@ -92,7 +96,11 @@ func (r *RPC) startReadingData(rc io.ReadCloser) {
return return
} }
chunk := buf[:n] chunk := buf[:n]
if n <= 25 { if n <= 25 { // this will catch the acknowledgement message unless you are required to ack 1000 messages for some reason
isAck := r.isAcknowledgeMessage(chunk)
if isAck {
r.client.Logger.Info().Any("isAck", isAck).Msg("Got Ack Message")
}
isHeartBeat := r.isHeartBeat(chunk) isHeartBeat := r.isHeartBeat(chunk)
if isHeartBeat { if isHeartBeat {
r.client.Logger.Info().Any("heartBeat", isHeartBeat).Msg("Got heartbeat message") r.client.Logger.Info().Any("heartBeat", isHeartBeat).Msg("Got heartbeat message")
@ -117,11 +125,46 @@ func (r *RPC) startReadingData(rc io.ReadCloser) {
} }
accumulatedData = []byte{} accumulatedData = []byte{}
r.client.Logger.Info().Any("val", msgArr).Msg("MsgArr") //r.client.Logger.Info().Any("val", msgArr).Msg("MsgArr")
go r.HandleRPCMsg(msgArr) go r.HandleRPCMsg(msgArr)
} }
} }
func (r *RPC) isAcknowledgeMessage(data []byte) bool {
if data[0] == 44 {
return false
}
if len(data) >= 3 && data[0] == 91 && data[1] == 91 && data[2] == 91 {
parsed, parseErr := r.parseAckMessage(data)
if parseErr != nil {
log.Fatal(parseErr)
}
skipCount = parsed.Container.Data.GetAckAmount().Count
r.client.Logger.Info().Any("count", skipCount).Msg("Messages To Skip")
} else {
return false
}
return true
}
func (r *RPC) parseAckMessage(data []byte) (*binary.AckMessageResponse, error) {
data = append(data, 93)
data = append(data, 93)
var msgArr []interface{}
marshalErr := json.Unmarshal(data, &msgArr)
if marshalErr != nil {
return nil, marshalErr
}
msg := &binary.AckMessageResponse{}
deserializeErr := pblite.Deserialize(msgArr, msg.ProtoReflect())
if deserializeErr != nil {
return nil, deserializeErr
}
return msg, nil
}
func (r *RPC) isStartRead(data []byte) bool { func (r *RPC) isStartRead(data []byte) bool {
return string(data) == "[[[null,null,null,[]]" return string(data) == "[[[null,null,null,[]]"
} }
@ -130,34 +173,8 @@ func (r *RPC) isHeartBeat(data []byte) bool {
return string(data) == ",[null,null,[]]" 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() { func (r *RPC) CloseConnection() {
if r.conn != nil { if r.conn != nil {
r.listenID++
r.client.Logger.Debug().Msg("Attempting to connection...") r.client.Logger.Debug().Msg("Attempting to connection...")
r.conn.Close() r.conn.Close()
r.conn = nil r.conn = nil
@ -167,30 +184,13 @@ func (r *RPC) CloseConnection() {
func (r *RPC) sendMessageRequest(url string, payload []byte) (*http.Response, error) { func (r *RPC) sendMessageRequest(url string, payload []byte) (*http.Response, error) {
req, err := http.NewRequest("POST", url, bytes.NewReader(payload)) req, err := http.NewRequest("POST", url, bytes.NewReader(payload))
if err != nil { if err != nil {
panic(fmt.Errorf("Error creating request: %v", err)) log.Fatalf("Error creating request: %v", err)
} }
util.BuildRelayHeaders(req, "application/json+protobuf", "*/*") util.BuildRelayHeaders(req, "application/json+protobuf", "*/*")
resp, reqErr := r.client.http.Do(req) 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") //r.client.Logger.Info().Any("bodyLength", len(payload)).Any("url", url).Any("headers", resp.Request.Header).Msg("RPC Request Headers")
if reqErr != nil { if reqErr != nil {
panic(fmt.Errorf("Error making request: %v", err)) log.Fatalf("Error making request: %v", err)
} }
return resp, reqErr return resp, reqErr
} }
func (r *RPC) sendInitialData() error {
sessionResponse, err := r.client.Session.SetActiveSession()
if err != nil {
return err
}
_, convErr := r.client.Conversations.List(25)
if convErr != nil {
return convErr
}
evtData := events.NewClientReady(sessionResponse)
r.client.triggerEvent(evtData)
r.client.sessionHandler.startAckInterval()
return nil
}

View file

@ -1,65 +1,62 @@
package libgm package libgm
import "go.mau.fi/mautrix-gmessages/libgm/util" import (
"fmt"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
type Session struct { type Session struct {
client *Client client *Client
prepareNewSession prepareNewSession
newSession newSession
} }
func (s *Session) SetActiveSession() (*util.SessionResponse, error) { // start receiving updates from mobile on this session
s.client.sessionHandler.ResetSessionID() func (s *Session) SetActiveSession() error {
s.client.sessionHandler.ResetSessionId()
prepareResponses, prepareSessionErr := s.prepareNewSession.Execute() actionType := binary.ActionType_GET_UPDATES
if prepareSessionErr != nil { _, sendErr := s.client.sessionHandler.completeSendMessage(actionType, false, nil)
return nil, prepareSessionErr if sendErr != nil {
return sendErr
}
return nil
} }
newSessionResponses, newSessionErr := s.newSession.Execute() func (s *Session) IsBugleDefault() (*binary.IsBugleDefaultResponse, error) {
if newSessionErr != nil { s.client.sessionHandler.ResetSessionId()
return nil, newSessionErr
actionType := binary.ActionType_IS_BUGLE_DEFAULT
sentRequestId, sendErr := s.client.sessionHandler.completeSendMessage(actionType, true, nil)
if sendErr != nil {
return nil, sendErr
} }
sessionResponse, processFail := s.client.processSessionResponse(prepareResponses, newSessionResponses) response, err := s.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if processFail != nil {
return nil, processFail
}
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 { if err != nil {
return nil, err return nil, err
} }
return responses, nil res, ok := response.Data.Decrypted.(*binary.IsBugleDefaultResponse)
if !ok {
return nil, fmt.Errorf("failed to assert response into IsBugleDefaultResponse")
} }
type newSession struct { return res, nil
client *Client
} }
func (n *newSession) Execute() ([]*Response, error) { func (s *Session) NotifyDittoActivity() error {
instruction, _ := n.client.instructions.GetInstruction(NEW_SESSION_OPCODE) payload := &binary.NotifyDittoActivityPayload{Success: true}
sentRequestID, _ := n.client.createAndSendRequest(instruction.Opcode, 0, true, nil) actionType := binary.ActionType_NOTIFY_DITTO_ACTIVITY
responses, err := n.client.sessionHandler.WaitForResponse(sentRequestID, instruction.Opcode) sentRequestId, sendErr := s.client.sessionHandler.completeSendMessage(actionType, true, payload)
if sendErr != nil {
return sendErr
}
_, err := s.client.sessionHandler.WaitForResponse(sentRequestId, actionType)
if err != nil { if err != nil {
return nil, err return err
} }
// Rest of the processing... return nil
return responses, nil
} }

View file

@ -3,38 +3,41 @@ package libgm
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"time" "time"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary" "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/payload"
"go.mau.fi/mautrix-gmessages/libgm/pblite" "go.mau.fi/mautrix-gmessages/libgm/routes"
"go.mau.fi/mautrix-gmessages/libgm/util" "go.mau.fi/mautrix-gmessages/libgm/util"
) )
/*
type Response struct { type Response struct {
client *Client client *Client
ResponseID string ResponseId string
RoutingOpCode int64 RoutingOpCode int64
Data *binary.EncodedResponse // base64 encoded (decode -> protomessage) Data *binary.EncodedResponse // base64 encoded (decode -> protomessage)
StartExecute string StartExecute string
FinishExecute string FinishExecute string
DevicePair *DevicePair DevicePair *pblite.DevicePair
} }
*/
type SessionHandler struct { type SessionHandler struct {
client *Client client *Client
requests map[string]map[int64]*ResponseChan requests map[string]map[binary.ActionType]*ResponseChan
ackMap []string ackMap []string
ackTicker *time.Ticker ackTicker *time.Ticker
sessionID string sessionId string
responseTimeout time.Duration responseTimeout time.Duration
} }
@ -43,74 +46,63 @@ func (s *SessionHandler) SetResponseTimeout(milliSeconds int) {
s.responseTimeout = time.Duration(milliSeconds) * time.Millisecond s.responseTimeout = time.Duration(milliSeconds) * time.Millisecond
} }
func (s *SessionHandler) ResetSessionID() { func (s *SessionHandler) ResetSessionId() {
s.sessionID = util.RandomUUIDv4() s.sessionId = util.RandomUUIDv4()
} }
func (c *Client) createAndSendRequest(instructionId int64, ttl int64, newSession bool, encryptedProtoMessage protoreflect.Message) (string, error) { func (s *SessionHandler) completeSendMessage(actionType binary.ActionType, addToChannel bool, encryptedData proto.Message) (string, error) {
requestId := util.RandomUUIDv4() requestId, payload, action, buildErr := s.buildMessage(actionType, encryptedData)
instruction, ok := c.instructions.GetInstruction(instructionId) if buildErr != nil {
if !ok { return "", buildErr
return "", fmt.Errorf("failed to get instruction: %v does not exist", instructionId)
} }
if newSession { if addToChannel {
requestId = c.sessionHandler.sessionID s.addRequestToChannel(requestId, action)
} }
_, reqErr := s.client.rpc.sendMessageRequest(util.SEND_MESSAGE, payload)
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 {
panic(fmt.Errorf("Failed to encode data: %w", encodeErr))
}
messageData := payload.NewMessageData(requestId, encodedStr, instruction.RoutingOpCode, instruction.MsgType)
authMessage := payload.NewAuthData(requestId, c.rpcKey, &binary.Date{Year: 2023, Seq1: 6, Seq2: 22, 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 { if reqErr != nil {
return "", reqErr return "", reqErr
} }
return requestId, nil return requestId, nil
} }
func (s *SessionHandler) toJSON(message protoreflect.Message) ([]byte, error) { func (s *SessionHandler) buildMessage(actionType binary.ActionType, encryptedData proto.Message) (string, []byte, binary.ActionType, error) {
interfaceArr, err := pblite.Serialize(message) var requestId string
if err != nil { pairedDevice := s.client.authData.DevicePair.Mobile
return nil, err sessionId := s.client.sessionHandler.sessionId
token := s.client.authData.TachyonAuthToken
routeInfo, ok := routes.Routes[actionType]
if !ok {
return "", nil, 0, fmt.Errorf("failed to build message: could not find route %d", actionType)
} }
jsonData, jsonErr := json.Marshal(interfaceArr)
if jsonErr != nil { if routeInfo.UseSessionID {
return nil, jsonErr requestId = s.sessionId
} else {
requestId = util.RandomUUIDv4()
} }
return jsonData, nil
tmpMessage := payload.NewSendMessageBuilder(token, pairedDevice, requestId, sessionId).SetRoute(routeInfo.Action).SetSessionId(s.sessionId)
if encryptedData != nil {
tmpMessage.SetEncryptedProtoMessage(encryptedData, s.client.authData.Cryptor)
}
if routeInfo.UseTTL {
tmpMessage.SetTTL(s.client.authData.TTL)
}
message, buildErr := tmpMessage.Build()
if buildErr != nil {
return "", nil, 0, buildErr
}
return requestId, message, routeInfo.Action, nil
} }
func (s *SessionHandler) addResponseAck(responseId string) { func (s *SessionHandler) addResponseAck(responseId string) {
s.client.Logger.Debug().Any("responseId", responseId).Msg("Added to ack map")
hasResponseId := slices.Contains(s.ackMap, responseId) hasResponseId := slices.Contains(s.ackMap, responseId)
if !hasResponseId { if !hasResponseId {
s.ackMap = append(s.ackMap, responseId) s.ackMap = append(s.ackMap, responseId)
@ -138,22 +130,22 @@ func (s *SessionHandler) sendAckRequest() {
ackMessagePayload := &binary.AckMessagePayload{ ackMessagePayload := &binary.AckMessagePayload{
AuthData: &binary.AuthMessage{ AuthData: &binary.AuthMessage{
RequestID: reqId, RequestID: reqId,
RpcKey: s.client.rpcKey, TachyonAuthToken: s.client.authData.TachyonAuthToken,
Date: &binary.Date{Year: 2023, Seq1: 6, Seq2: 22, Seq3: 4, Seq4: 6}, ConfigVersion: payload.ConfigMessage,
}, },
EmptyArr: &binary.EmptyArr{}, EmptyArr: &binary.EmptyArr{},
NoClue: nil, NoClue: nil,
} }
dataArray, err := pblite.Serialize(ackMessagePayload.ProtoReflect()) dataArray, err := pblite.Serialize(ackMessagePayload.ProtoReflect())
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
ackMessages := make([][]interface{}, 0) ackMessages := make([][]interface{}, 0)
for _, reqId := range s.ackMap { for _, reqId := range s.ackMap {
ackMessageData := &binary.AckMessageData{RequestID: reqId, Device: s.client.devicePair.Browser} ackMessageData := &binary.AckMessageData{RequestID: reqId, Device: s.client.authData.DevicePair.Browser}
ackMessageDataArr, err := pblite.Serialize(ackMessageData.ProtoReflect()) ackMessageDataArr, err := pblite.Serialize(ackMessageData.ProtoReflect())
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
ackMessages = append(ackMessages, ackMessageDataArr) ackMessages = append(ackMessages, ackMessageDataArr)
s.ackMap = util.RemoveFromSlice(s.ackMap, reqId) s.ackMap = util.RemoveFromSlice(s.ackMap, reqId)
@ -161,55 +153,11 @@ func (s *SessionHandler) sendAckRequest() {
dataArray = append(dataArray, ackMessages) dataArray = append(dataArray, ackMessages)
jsonData, jsonErr := json.Marshal(dataArray) jsonData, jsonErr := json.Marshal(dataArray)
if jsonErr != nil { if jsonErr != nil {
panic(err) log.Fatal(err)
} }
_, err = s.client.rpc.sendMessageRequest(util.ACK_MESSAGES, jsonData) _, err = s.client.rpc.sendMessageRequest(util.ACK_MESSAGES, jsonData)
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
s.client.Logger.Debug().Msg("[ACK] Sent Request") s.client.Logger.Debug().Any("payload", jsonData).Msg("[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 {
panic(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)
} }

13
libgm/settings_handler.go Normal file
View file

@ -0,0 +1,13 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/events"
)
func (c *Client) handleSettingsEvent(res *pblite.Response, data *binary.Settings) {
evt := events.NewSettingsUpdated(data)
c.triggerEvent(evt)
}

26
libgm/typing_handler.go Normal file
View file

@ -0,0 +1,26 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/events"
)
func (c *Client) handleTypingEvent(res *pblite.Response, data *binary.TypingData) {
typingType := data.Type
var evt events.TypingEvent
switch typingType {
case binary.TypingTypes_STARTED_TYPING:
evt = events.NewStartedTyping(data)
case binary.TypingTypes_STOPPED_TYPING:
evt = events.NewStoppedTyping(data)
default:
c.Logger.Debug().Any("data", data).Msg("got unknown TypingData evt")
}
if evt != nil {
c.triggerEvent(evt)
}
}

40
libgm/updates_handler.go Normal file
View file

@ -0,0 +1,40 @@
package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
func (c *Client) handleUpdatesEvent(res *pblite.Response) {
switch res.Data.Action {
case binary.ActionType_GET_UPDATES:
data, ok := res.Data.Decrypted.(*binary.UpdateEvents)
if !ok {
c.Logger.Error().Any("res", res).Msg("failed to assert ActionType_GET_UPDATES event into UpdateEvents")
return
}
switch evt := data.Event.(type) {
case *binary.UpdateEvents_UserAlertEvent:
c.handleUserAlertEvent(res, evt.UserAlertEvent)
case *binary.UpdateEvents_SettingsEvent:
c.handleSettingsEvent(res, evt.SettingsEvent)
case *binary.UpdateEvents_ConversationEvent:
c.handleConversationEvent(res, evt.ConversationEvent.GetData())
case *binary.UpdateEvents_MessageEvent:
c.handleMessageEvent(res, evt.MessageEvent.GetData())
case *binary.UpdateEvents_TypingEvent:
c.handleTypingEvent(res, evt.TypingEvent.GetData())
default:
c.Logger.Debug().Any("evt", evt).Any("res", res).Msg("Got unknown event type")
}
default:
c.Logger.Error().Any("response", res).Msg("ignoring response.")
}
}

View file

@ -0,0 +1,59 @@
package libgm
import (
"log"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/events"
)
func (c *Client) handleUserAlertEvent(res *pblite.Response, data *binary.UserAlertEvent) {
alertType := data.AlertType
switch alertType {
case binary.AlertType_BROWSER_ACTIVE:
newSessionId := res.Data.RequestId
c.Logger.Info().Any("sessionId", newSessionId).Msg("[NEW_BROWSER_ACTIVE] Opened new browser connection")
if newSessionId != c.sessionHandler.sessionId {
evt := events.NewBrowserActive(newSessionId)
c.triggerEvent(evt)
} else {
c.Logger.Info().Any("sessionId", newSessionId).Msg("Client is ready!")
conversations, convErr := c.Conversations.List(25)
if convErr != nil {
log.Fatal(convErr)
}
c.Logger.Debug().Any("conversations", conversations).Msg("got conversations")
notifyErr := c.Session.NotifyDittoActivity()
if notifyErr != nil {
log.Fatal(notifyErr)
}
readyEvt := events.NewClientReady(newSessionId, conversations)
c.triggerEvent(readyEvt)
}
case binary.AlertType_MOBILE_BATTERY_LOW:
c.Logger.Info().Msg("[MOBILE_BATTERY_LOW] Mobile device is on low battery")
evt := events.NewMobileBatteryLow()
c.triggerEvent(evt)
case binary.AlertType_MOBILE_BATTERY_RESTORED:
c.Logger.Info().Msg("[MOBILE_BATTERY_RESTORED] Mobile device has restored enough battery!")
evt := events.NewMobileBatteryRestored()
c.triggerEvent(evt)
case binary.AlertType_MOBILE_DATA_CONNECTION:
c.Logger.Info().Msg("[MOBILE_DATA_CONNECTION] Mobile device is now using data connection")
evt := events.NewMobileDataConnection()
c.triggerEvent(evt)
case binary.AlertType_MOBILE_WIFI_CONNECTION:
c.Logger.Info().Msg("[MOBILE_WIFI_CONNECTION] Mobile device is now using wifi connection")
evt := events.NewMobileWifiConnection()
c.triggerEvent(evt)
default:
c.Logger.Info().Any("data", data).Any("res", res).Msg("Got unknown alert type")
}
}

View file

@ -1,7 +1,22 @@
package util package util
import (
"go.mau.fi/mautrix-gmessages/libgm/binary"
)
var BrowserType = binary.BrowserTypes_CHROME
const GoogleAPIKey = "AIzaSyCA4RsOZUFrm9whhtGosPlJLmVPnfSHKz8" const GoogleAPIKey = "AIzaSyCA4RsOZUFrm9whhtGosPlJLmVPnfSHKz8"
const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36" const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
const OS = "Linux" const OS = "Linux"
const XUserAgent = "grpc-web-javascript/0.1" const XUserAgent = "grpc-web-javascript/0.1"
const QRCodeURLBase = "https://support.google.com/messages/?p=web_computer#?c=" const QRCodeURLBase = "https://support.google.com/messages/?p=web_computer#?c="
// Deprecated
var (
BROWSER_TYPE = BrowserType
GOOG_API_KEY = GoogleAPIKey
USER_AGENT = UserAgent
X_USER_AGENT = XUserAgent
QR_CODE_URL = QRCodeURLBase
)

View file

@ -1,11 +0,0 @@
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)
}

View file

@ -3,16 +3,24 @@ package util
import ( import (
crand "crypto/rand" crand "crypto/rand"
"encoding/hex" "encoding/hex"
"encoding/json"
"fmt" "fmt"
"math/rand" "math/rand"
"net/http" "net/http"
"strconv"
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
"go.mau.fi/mautrix-gmessages/libgm/binary"
) )
var Charset = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890") var Charset = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
func TimestampNow() time.Time {
return time.Now().UTC()
}
func RandStr(length int) string { func RandStr(length int) string {
b := make([]rune, length) b := make([]rune, length)
for i := range b { for i := range b {
@ -132,3 +140,48 @@ func NewMediaUploadHeaders(imageSize string, command string, uploadOffset string
headers.Add("accept-language", "en-US,en;q=0.9") headers.Add("accept-language", "en-US,en;q=0.9")
return headers return headers
} }
func ParseConfigVersion(res []byte) (*binary.ConfigVersion, error) {
var data []interface{}
marshalErr := json.Unmarshal(res, &data)
if marshalErr != nil {
return nil, marshalErr
}
version := data[0].(string)
v1 := version[0:4]
v2 := version[4:6]
v3 := version[6:8]
if v2[0] == 48 {
v2 = string(v2[1])
}
if v3[0] == 48 {
v3 = string(v3[1])
}
first, e := strconv.Atoi(v1)
if e != nil {
return nil, e
}
second, e1 := strconv.Atoi(v2)
if e1 != nil {
return nil, e1
}
third, e2 := strconv.Atoi(v3)
if e2 != nil {
return nil, e2
}
configMessage := &binary.ConfigVersion{
V1: int32(first),
V2: int32(second),
V3: int32(third),
V4: 4,
V5: 6,
}
return configMessage, nil
}

View file

@ -18,3 +18,8 @@ var MESSAGING = INSTANT_MESSAGING + "/$rpc/google.internal.communications.instan
var RECEIVE_MESSAGES = MESSAGING + "/ReceiveMessages" var RECEIVE_MESSAGES = MESSAGING + "/ReceiveMessages"
var SEND_MESSAGE = MESSAGING + "/SendMessage" var SEND_MESSAGE = MESSAGING + "/SendMessage"
var ACK_MESSAGES = MESSAGING + "/AckMessages" var ACK_MESSAGES = MESSAGING + "/AckMessages"
var REGISTRATION = INSTANT_MESSAGING + "/$rpc/google.internal.communications.instantmessaging.v1.Registration"
var REGISTER_REFRESH = REGISTRATION + "/RegisterRefresh"
var CONFIG_URL = "https://messages.google.com/web/config"

View file

@ -303,9 +303,9 @@ func (portal *Portal) handleMessageLoop() {
func (portal *Portal) isOutgoingMessage(evt *binary.Message) id.EventID { func (portal *Portal) isOutgoingMessage(evt *binary.Message) id.EventID {
portal.outgoingMessagesLock.Lock() portal.outgoingMessagesLock.Lock()
defer portal.outgoingMessagesLock.Unlock() defer portal.outgoingMessagesLock.Unlock()
evtID, ok := portal.outgoingMessages[evt.TmpId] evtID, ok := portal.outgoingMessages[evt.TmpID]
if ok { if ok {
delete(portal.outgoingMessages, evt.TmpId) delete(portal.outgoingMessages, evt.TmpID)
portal.markHandled(evt, map[string]id.EventID{"": evtID}, true) portal.markHandled(evt, map[string]id.EventID{"": evtID}, true)
return evtID return evtID
} }
@ -338,7 +338,8 @@ func (portal *Portal) handleMessage(source *User, evt *binary.Message) {
} }
var intent *appservice.IntentAPI var intent *appservice.IntentAPI
if evt.GetFrom().GetFromMe() { // TODO is there a fromMe flag?
if evt.GetParticipantID() == portal.SelfUserID {
intent = source.DoublePuppetIntent intent = source.DoublePuppetIntent
if intent == nil { if intent == nil {
log.Debug().Msg("Dropping message from self as double puppeting is not enabled") log.Debug().Msg("Dropping message from self as double puppeting is not enabled")
@ -364,17 +365,17 @@ func (portal *Portal) handleMessage(source *User, evt *binary.Message) {
MsgType: event.MsgText, MsgType: event.MsgText,
Body: data.MessageContent.GetContent(), Body: data.MessageContent.GetContent(),
} }
case *binary.MessageInfo_ImageContent: case *binary.MessageInfo_MediaContent:
content = event.MessageEventContent{ content = event.MessageEventContent{
MsgType: event.MsgNotice, MsgType: event.MsgNotice,
Body: fmt.Sprintf("Attachment %s", data.ImageContent.GetImageName()), Body: fmt.Sprintf("Attachment %s", data.MediaContent.GetMediaName()),
} }
} }
resp, err := portal.sendMessage(intent, event.EventMessage, &content, nil, ts) resp, err := portal.sendMessage(intent, event.EventMessage, &content, nil, ts)
if err != nil { if err != nil {
log.Err(err).Msg("Failed to send message") log.Err(err).Msg("Failed to send message")
} else { } else {
eventIDs[part.OrderInternal] = resp.EventID eventIDs[part.GetActionMessageID()] = resp.EventID
lastEventID = resp.EventID lastEventID = resp.EventID
} }
} }
@ -423,7 +424,7 @@ func (portal *Portal) SyncParticipants(source *User, metadata *binary.Conversati
for _, participant := range metadata.Participants { for _, participant := range metadata.Participants {
if participant.IsMe { if participant.IsMe {
continue continue
} else if participant.Id.Number == "" { } else if participant.ID.Number == "" {
portal.zlog.Warn().Interface("participant", participant).Msg("No number found in non-self participant entry") portal.zlog.Warn().Interface("participant", participant).Msg("No number found in non-self participant entry")
continue continue
} }
@ -433,7 +434,7 @@ func (portal *Portal) SyncParticipants(source *User, metadata *binary.Conversati
manyParticipants = true manyParticipants = true
} }
portal.zlog.Debug().Interface("participant", participant).Msg("Syncing participant") portal.zlog.Debug().Interface("participant", participant).Msg("Syncing participant")
puppet := source.GetPuppetByID(participant.Id.ParticipantID, participant.Id.Number) puppet := source.GetPuppetByID(participant.ID.ParticipantID, participant.ID.Number)
userIDs = append(userIDs, puppet.MXID) userIDs = append(userIDs, puppet.MXID)
puppet.Sync(source, participant) puppet.Sync(source, participant)
if portal.MXID != "" { if portal.MXID != "" {
@ -445,12 +446,12 @@ func (portal *Portal) SyncParticipants(source *User, metadata *binary.Conversati
} }
} }
} }
if !metadata.IsGroupChat && !manyParticipants && portal.OtherUserID != firstParticipant.Id.ParticipantID { if !metadata.IsGroupChat && !manyParticipants && portal.OtherUserID != firstParticipant.ID.ParticipantID {
portal.zlog.Info(). portal.zlog.Info().
Str("old_other_user_id", portal.OtherUserID). Str("old_other_user_id", portal.OtherUserID).
Str("new_other_user_id", firstParticipant.Id.ParticipantID). Str("new_other_user_id", firstParticipant.ID.ParticipantID).
Msg("Found other user ID in DM") Msg("Found other user ID in DM")
portal.OtherUserID = firstParticipant.Id.ParticipantID portal.OtherUserID = firstParticipant.ID.ParticipantID
changed = true changed = true
} }
return userIDs, changed return userIDs, changed
@ -906,7 +907,7 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event, timing
SetConversationID(portal.ID). SetConversationID(portal.ID).
SetSelfParticipantID(portal.SelfUserID). SetSelfParticipantID(portal.SelfUserID).
SetContent(text). SetContent(text).
SetTmpID(txnID), "", SetTmpID(txnID),
) )
if err != nil { if err != nil {
go ms.sendMessageMetrics(evt, err, "Error sending", true) go ms.sendMessageMetrics(evt, err, "Error sending", true)

View file

@ -263,8 +263,8 @@ func (puppet *Puppet) Sync(source *User, contact *binary.Participant) {
update := false update := false
if contact != nil { if contact != nil {
if contact.Id.Number != "" && puppet.Phone != contact.Id.Number { if contact.ID.Number != "" && puppet.Phone != contact.ID.Number {
puppet.Phone = contact.Id.Number puppet.Phone = contact.ID.Number
update = true update = true
} }
update = puppet.UpdateName(contact.GetFormattedNumber(), contact.GetFullName(), contact.GetFirstName()) || update update = puppet.UpdateName(contact.GetFormattedNumber(), contact.GetFullName(), contact.GetFirstName()) || update

61
user.go
View file

@ -386,25 +386,12 @@ func (user *User) SetManagementRoom(roomID id.RoomID) {
var ErrAlreadyLoggedIn = errors.New("already logged in") var ErrAlreadyLoggedIn = errors.New("already logged in")
func (user *User) createClient() { func (user *User) createClient() {
var devicePair *libgm.DevicePair if user.Session == nil {
var cryptor *crypto.Cryptor user.Session = &libgm.AuthData{
if user.Session != nil && user.Session.WebAuthKey != nil { Cryptor: crypto.NewCryptor(nil, nil),
devicePair = &libgm.DevicePair{
Mobile: user.Session.PhoneInfo,
Browser: user.Session.BrowserInfo,
}
cryptor = &crypto.Cryptor{
AESCTR256Key: user.Session.AESKey,
SHA256Key: user.Session.HMACKey,
}
} else {
cryptor = crypto.NewCryptor(nil, nil)
user.Session = &database.Session{
AESKey: cryptor.AESCTR256Key,
HMACKey: cryptor.SHA256Key,
} }
} }
user.Client = libgm.NewClient(devicePair, cryptor, user.zlog.With().Str("component", "libgm").Logger(), nil) user.Client = libgm.NewClient(user.Session, user.zlog.With().Str("component", "libgm").Logger())
user.Client.SetEventHandler(user.HandleEvent) user.Client.SetEventHandler(user.HandleEvent)
} }
@ -417,15 +404,7 @@ func (user *User) Login(ctx context.Context) (<-chan string, error) {
user.unlockedDeleteConnection() user.unlockedDeleteConnection()
} }
user.createClient() user.createClient()
pairer, err := user.Client.NewPairer(nil, 20) err := user.Client.Connect()
if err != nil {
return nil, fmt.Errorf("failed to initialize pairer: %w", err)
}
resp, err := pairer.RegisterPhoneRelay()
if err != nil {
return nil, fmt.Errorf("failed to register phone relay: %w", err)
}
err = user.Client.Connect(resp.Field5.RpcKey)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to connect to Google Messages: %w", err) return nil, fmt.Errorf("failed to connect to Google Messages: %w", err)
} }
@ -446,7 +425,7 @@ func (user *User) Connect() bool {
user.zlog.Debug().Msg("Connecting to Google Messages") user.zlog.Debug().Msg("Connecting to Google Messages")
user.BridgeState.Send(status.BridgeState{StateEvent: status.StateConnecting, Error: GMConnecting}) user.BridgeState.Send(status.BridgeState{StateEvent: status.StateConnecting, Error: GMConnecting})
user.createClient() user.createClient()
err := user.Client.Connect(user.Session.WebAuthKey) err := user.Client.Connect()
if err != nil { if err != nil {
user.zlog.Err(err).Msg("Error connecting to Google Messages") user.zlog.Err(err).Msg("Error connecting to Google Messages")
user.BridgeState.Send(status.BridgeState{ user.BridgeState.Send(status.BridgeState{
@ -550,36 +529,34 @@ func (user *User) HandleEvent(event interface{}) {
user.hackyLoginCommand = nil user.hackyLoginCommand = nil
user.hackyLoginCommandPrevEvent = "" user.hackyLoginCommandPrevEvent = ""
user.tryAutomaticDoublePuppeting() user.tryAutomaticDoublePuppeting()
user.Phone = v.PairDeviceData.Mobile.RegistrationID user.Phone = v.GetMobile().GetSourceID()
user.Session.PhoneInfo = v.PairDeviceData.Mobile
user.Session.BrowserInfo = v.PairDeviceData.Browser
user.Session.WebAuthKey = v.PairDeviceData.WebAuthKeyData.GetWebAuthKey()
user.addToPhoneMap() user.addToPhoneMap()
err := user.Update(context.TODO()) err := user.Update(context.TODO())
if err != nil { if err != nil {
user.zlog.Err(err).Msg("Failed to update session in database") user.zlog.Err(err).Msg("Failed to update session in database")
} }
case *binary.Event_ConversationEvent: case *events.AuthTokenRefreshed:
portal := user.GetPortalByID(v.ConversationEvent.GetData().GetConversationID()) err := user.Update(context.TODO())
if err != nil {
user.zlog.Err(err).Msg("Failed to update session in database")
}
case *binary.Conversation:
portal := user.GetPortalByID(v.GetConversationID())
if portal.MXID != "" { if portal.MXID != "" {
portal.UpdateMetadata(user, v.ConversationEvent.GetData()) portal.UpdateMetadata(user, v)
} else { } else {
err := portal.CreateMatrixRoom(user, v.ConversationEvent.GetData()) err := portal.CreateMatrixRoom(user, v)
if err != nil { if err != nil {
user.zlog.Err(err).Msg("Error creating Matrix room from conversation event") user.zlog.Err(err).Msg("Error creating Matrix room from conversation event")
} }
} }
case *binary.Event_MessageEvent: case *binary.Message:
portal := user.GetPortalByID(v.MessageEvent.GetData().GetConversationID()) portal := user.GetPortalByID(v.GetConversationID())
portal.messages <- PortalMessage{evt: v.MessageEvent.GetData(), source: user} portal.messages <- PortalMessage{evt: v, source: user}
case *events.ClientReady: case *events.ClientReady:
user.zlog.Trace().Any("data", v).Msg("Client is ready!") user.zlog.Trace().Any("data", v).Msg("Client is ready!")
case *events.BrowserActive: case *events.BrowserActive:
user.zlog.Trace().Any("data", v).Msg("Browser active") user.zlog.Trace().Any("data", v).Msg("Browser active")
case *events.Battery:
user.zlog.Trace().Any("data", v).Msg("Battery")
case *events.DataConnection:
user.zlog.Trace().Any("data", v).Msg("Data connection")
default: default:
user.zlog.Trace().Any("data", v).Msg("Unknown event") user.zlog.Trace().Any("data", v).Msg("Unknown event")
} }