gmessages/libgm/payload/receiveMessages.go
2023-07-15 15:56:55 +03:00

26 lines
660 B
Go

package payload
import (
"github.com/google/uuid"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/pblite"
)
func ReceiveMessages(rpcKey []byte) ([]byte, string, error) {
payload := &binary.ReceiveMessagesRequest{
Auth: &binary.AuthMessage{
RequestID: uuid.New().String(),
TachyonAuthToken: rpcKey,
ConfigVersion: ConfigMessage,
},
Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject2{
Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject1{},
},
}
jsonData, err := pblite.Marshal(payload)
if err != nil {
return nil, "", err
}
return jsonData, payload.Auth.RequestID, nil
}