From 55e79063d6edbbf4560fd14edc45ce9558afaf7a Mon Sep 17 00:00:00 2001 From: Krzysiek Madejski Date: Thu, 21 Feb 2019 20:28:13 +0100 Subject: Add initial WhatsApp support (#711) --- vendor/github.com/Rhymen/go-whatsapp/.gitignore | 2 + vendor/github.com/Rhymen/go-whatsapp/LICENSE | 21 + vendor/github.com/Rhymen/go-whatsapp/README.md | 104 + .../Rhymen/go-whatsapp/binary/decoder.go | 388 ++ .../Rhymen/go-whatsapp/binary/encoder.go | 351 ++ .../github.com/Rhymen/go-whatsapp/binary/node.go | 103 + .../Rhymen/go-whatsapp/binary/proto/def.pb.go | 3800 ++++++++++++++++++++ .../Rhymen/go-whatsapp/binary/proto/def.proto | 417 +++ .../Rhymen/go-whatsapp/binary/token/token.go | 78 + vendor/github.com/Rhymen/go-whatsapp/conn.go | 389 ++ vendor/github.com/Rhymen/go-whatsapp/contact.go | 267 ++ .../Rhymen/go-whatsapp/crypto/cbc/cbc.go | 101 + .../Rhymen/go-whatsapp/crypto/curve25519/curve.go | 44 + .../Rhymen/go-whatsapp/crypto/hkdf/hkdf.go | 52 + vendor/github.com/Rhymen/go-whatsapp/go.mod | 8 + vendor/github.com/Rhymen/go-whatsapp/go.sum | 4 + vendor/github.com/Rhymen/go-whatsapp/handler.go | 169 + vendor/github.com/Rhymen/go-whatsapp/media.go | 199 + vendor/github.com/Rhymen/go-whatsapp/message.go | 455 +++ vendor/github.com/Rhymen/go-whatsapp/session.go | 389 ++ vendor/github.com/Rhymen/go-whatsapp/store.go | 45 + 21 files changed, 7386 insertions(+) create mode 100644 vendor/github.com/Rhymen/go-whatsapp/.gitignore create mode 100644 vendor/github.com/Rhymen/go-whatsapp/LICENSE create mode 100644 vendor/github.com/Rhymen/go-whatsapp/README.md create mode 100644 vendor/github.com/Rhymen/go-whatsapp/binary/decoder.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/binary/encoder.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/binary/node.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.pb.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.proto create mode 100644 vendor/github.com/Rhymen/go-whatsapp/binary/token/token.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/conn.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/contact.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/crypto/cbc/cbc.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/crypto/hkdf/hkdf.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/go.mod create mode 100644 vendor/github.com/Rhymen/go-whatsapp/go.sum create mode 100644 vendor/github.com/Rhymen/go-whatsapp/handler.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/media.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/message.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/session.go create mode 100644 vendor/github.com/Rhymen/go-whatsapp/store.go (limited to 'vendor/github.com/Rhymen') diff --git a/vendor/github.com/Rhymen/go-whatsapp/.gitignore b/vendor/github.com/Rhymen/go-whatsapp/.gitignore new file mode 100644 index 00000000..5c2e8752 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/.gitignore @@ -0,0 +1,2 @@ +.idea/ +docs/ diff --git a/vendor/github.com/Rhymen/go-whatsapp/LICENSE b/vendor/github.com/Rhymen/go-whatsapp/LICENSE new file mode 100644 index 00000000..b442934b --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/Rhymen/go-whatsapp/README.md b/vendor/github.com/Rhymen/go-whatsapp/README.md new file mode 100644 index 00000000..9a5216e7 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/README.md @@ -0,0 +1,104 @@ +# go-whatsapp +Package rhymen/go-whatsapp implements the WhatsApp Web API to provide a clean interface for developers. Big thanks to all contributors of the [sigalor/whatsapp-web-reveng](https://github.com/sigalor/whatsapp-web-reveng) project. The official WhatsApp Business API was released in August 2018. You can check it out [here](https://www.whatsapp.com/business/api). + +## Installation +```sh +go get github.com/rhymen/go-whatsapp +``` + +## Usage +### Creating a connection +```go +import ( + whatsapp "github.com/Rhymen/go-whatsapp" +) + +wac, err := whatsapp.NewConn(20 * time.Second) +``` +The duration passed to the NewConn function is used to timeout login requests. If you have a bad internet connection use a higher timeout value. This function only creates a websocket connection, it does not handle authentication. + +### Login +```go +qrChan := make(chan string) +go func() { + fmt.Printf("qr code: %v\n", <-qrChan) + //show qr code or save it somewhere to scan +} +sess, err := wac.Login(qrChan) +``` +The authentication process requires you to scan the qr code, that is send through the channel, with the device you are using whatsapp on. The session struct that is returned can be saved and used to restore the login without scanning the qr code again. The qr code has a ttl of 20 seconds and the login function throws a timeout err if the time has passed or any other request fails. + +### Restore +```go +newSess, err := wac.RestoreSession(sess) +``` +The restore function needs a valid session and returns the new session that was created. + +### Add message handlers +```go +type myHandler struct{} + +func (myHandler) HandleError(err error) { + fmt.Fprintf(os.Stderr, "%v", err) +} + +func (myHandler) HandleTextMessage(message whatsapp.TextMessage) { + fmt.Println(message) +} + +func (myHandler) HandleImageMessage(message whatsapp.ImageMessage) { + fmt.Println(message) +} + +func (myHandler) HandleVideoMessage(message whatsapp.VideoMessage) { + fmt.Println(message) +} + +func (myHandler) HandleJsonMessage(message string) { + fmt.Println(message) +} + +wac.AddHandler(myHandler{}) +``` +The message handlers are all optional, you don't need to implement anything but the error handler to implement the interface. The ImageMessage and VideoMessage provide a Download function to get the media data. + +### Sending text messages +```go +text := whatsapp.TextMessage{ + Info: whatsapp.MessageInfo{ + RemoteJid: "0123456789@s.whatsapp.net", + }, + Text: "Hello Whatsapp", +} + +err := wac.Send(text) +``` +The message will be send over the websocket. The attributes seen above are the required ones. All other relevant attributes (id, timestamp, fromMe, status) are set if they are missing in the struct. For the time being we only support text messages, but other types are planned for the near future. + +## Legal +This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its +affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk. + +## License + +The MIT License (MIT) + +Copyright (c) 2018 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/Rhymen/go-whatsapp/binary/decoder.go b/vendor/github.com/Rhymen/go-whatsapp/binary/decoder.go new file mode 100644 index 00000000..95da606c --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/binary/decoder.go @@ -0,0 +1,388 @@ +package binary + +import ( + "fmt" + "github.com/Rhymen/go-whatsapp/binary/token" + "io" + "strconv" +) + +type binaryDecoder struct { + data []byte + index int +} + +func NewDecoder(data []byte) *binaryDecoder { + return &binaryDecoder{data, 0} +} + +func (r *binaryDecoder) checkEOS(length int) error { + if r.index+length > len(r.data) { + return io.EOF + } + + return nil +} + +func (r *binaryDecoder) readByte() (byte, error) { + if err := r.checkEOS(1); err != nil { + return 0, err + } + + b := r.data[r.index] + r.index++ + + return b, nil +} + +func (r *binaryDecoder) readIntN(n int, littleEndian bool) (int, error) { + if err := r.checkEOS(n); err != nil { + return 0, err + } + + var ret int + + for i := 0; i < n; i++ { + var curShift int + if littleEndian { + curShift = i + } else { + curShift = n - i - 1 + } + ret |= int(r.data[r.index+i]) << uint(curShift*8) + } + + r.index += n + return ret, nil +} + +func (r *binaryDecoder) readInt8(littleEndian bool) (int, error) { + return r.readIntN(1, littleEndian) +} + +func (r *binaryDecoder) readInt16(littleEndian bool) (int, error) { + return r.readIntN(2, littleEndian) +} + +func (r *binaryDecoder) readInt20() (int, error) { + if err := r.checkEOS(3); err != nil { + return 0, err + } + + ret := ((int(r.data[r.index]) & 15) << 16) + (int(r.data[r.index+1]) << 8) + int(r.data[r.index+2]) + r.index += 3 + return ret, nil +} + +func (r *binaryDecoder) readInt32(littleEndian bool) (int, error) { + return r.readIntN(4, littleEndian) +} + +func (r *binaryDecoder) readInt64(littleEndian bool) (int, error) { + return r.readIntN(8, littleEndian) +} + +func (r *binaryDecoder) readPacked8(tag int) (string, error) { + startByte, err := r.readByte() + if err != nil { + return "", err + } + + ret := "" + + for i := 0; i < int(startByte&127); i++ { + currByte, err := r.readByte() + if err != nil { + return "", err + } + + lower, err := unpackByte(tag, currByte&0xF0>>4) + if err != nil { + return "", err + } + + upper, err := unpackByte(tag, currByte&0x0F) + if err != nil { + return "", err + } + + ret += lower + upper + } + + if startByte>>7 != 0 { + ret = ret[:len(ret)-1] + } + return ret, nil +} + +func unpackByte(tag int, value byte) (string, error) { + switch tag { + case token.NIBBLE_8: + return unpackNibble(value) + case token.HEX_8: + return unpackHex(value) + default: + return "", fmt.Errorf("unpackByte with unknown tag %d", tag) + } +} + +func unpackNibble(value byte) (string, error) { + switch { + case value < 0 || value > 15: + return "", fmt.Errorf("unpackNibble with value %d", value) + case value == 10: + return "-", nil + case value == 11: + return ".", nil + case value == 15: + return "\x00", nil + default: + return strconv.Itoa(int(value)), nil + } +} + +func unpackHex(value byte) (string, error) { + switch { + case value < 0 || value > 15: + return "", fmt.Errorf("unpackHex with value %d", value) + case value < 10: + return strconv.Itoa(int(value)), nil + default: + return string('A' + value - 10), nil + } +} + +func (r *binaryDecoder) readListSize(tag int) (int, error) { + switch tag { + case token.LIST_EMPTY: + return 0, nil + case token.LIST_8: + return r.readInt8(false) + case token.LIST_16: + return r.readInt16(false) + default: + return 0, fmt.Errorf("readListSize with unknown tag %d at position %d", tag, r.index) + } +} + +func (r *binaryDecoder) readString(tag int) (string, error) { + switch { + case tag >= 3 && tag <= len(token.SingleByteTokens): + tok, err := token.GetSingleToken(tag) + if err != nil { + return "", err + } + + if tok == "s.whatsapp.net" { + tok = "c.us" + } + + return tok, nil + case tag == token.DICTIONARY_0 || tag == token.DICTIONARY_1 || tag == token.DICTIONARY_2 || tag == token.DICTIONARY_3: + i, err := r.readInt8(false) + if err != nil { + return "", err + } + + return token.GetDoubleToken(tag-token.DICTIONARY_0, i) + case tag == token.LIST_EMPTY: + return "", nil + case tag == token.BINARY_8: + length, err := r.readInt8(false) + if err != nil { + return "", err + } + + return r.readStringFromChars(length) + case tag == token.BINARY_20: + length, err := r.readInt20() + if err != nil { + return "", err + } + + return r.readStringFromChars(length) + case tag == token.BINARY_32: + length, err := r.readInt32(false) + if err != nil { + return "", err + } + + return r.readStringFromChars(length) + case tag == token.JID_PAIR: + b, err := r.readByte() + if err != nil { + return "", err + } + i, err := r.readString(int(b)) + if err != nil { + return "", err + } + + b, err = r.readByte() + if err != nil { + return "", err + } + j, err := r.readString(int(b)) + if err != nil { + return "", err + } + + if i == "" || j == "" { + return "", fmt.Errorf("invalid jid pair: %s - %s", i, j) + } + + return i + "@" + j, nil + case tag == token.NIBBLE_8 || tag == token.HEX_8: + return r.readPacked8(tag) + default: + return "", fmt.Errorf("invalid string with tag %d", tag) + } +} + +func (r *binaryDecoder) readStringFromChars(length int) (string, error) { + if err := r.checkEOS(length); err != nil { + return "", err + } + + ret := r.data[r.index : r.index+length] + r.index += length + + return string(ret), nil +} + +func (r *binaryDecoder) readAttributes(n int) (map[string]string, error) { + if n == 0 { + return nil, nil + } + + ret := make(map[string]string) + for i := 0; i < n; i++ { + idx, err := r.readInt8(false) + if err != nil { + return nil, err + } + + index, err := r.readString(idx) + if err != nil { + return nil, err + } + + idx, err = r.readInt8(false) + if err != nil { + return nil, err + } + + ret[index], err = r.readString(idx) + if err != nil { + return nil, err + } + } + + return ret, nil +} + +func (r *binaryDecoder) readList(tag int) ([]Node, error) { + size, err := r.readListSize(tag) + if err != nil { + return nil, err + } + + ret := make([]Node, size) + for i := 0; i < size; i++ { + n, err := r.ReadNode() + + if err != nil { + return nil, err + } + + ret[i] = *n + } + + return ret, nil +} + +func (r *binaryDecoder) ReadNode() (*Node, error) { + ret := &Node{} + + size, err := r.readInt8(false) + if err != nil { + return nil, err + } + listSize, err := r.readListSize(size) + if err != nil { + return nil, err + } + + descrTag, err := r.readInt8(false) + if descrTag == token.STREAM_END { + return nil, fmt.Errorf("unexpected stream end") + } + ret.Description, err = r.readString(descrTag) + if err != nil { + return nil, err + } + if listSize == 0 || ret.Description == "" { + return nil, fmt.Errorf("invalid Node") + } + + ret.Attributes, err = r.readAttributes((listSize - 1) >> 1) + if err != nil { + return nil, err + } + + if listSize%2 == 1 { + return ret, nil + } + + tag, err := r.readInt8(false) + if err != nil { + return nil, err + } + + switch tag { + case token.LIST_EMPTY, token.LIST_8, token.LIST_16: + ret.Content, err = r.readList(tag) + case token.BINARY_8: + size, err = r.readInt8(false) + if err != nil { + return nil, err + } + + ret.Content, err = r.readBytes(size) + case token.BINARY_20: + size, err = r.readInt20() + if err != nil { + return nil, err + } + + ret.Content, err = r.readBytes(size) + case token.BINARY_32: + size, err = r.readInt32(false) + if err != nil { + return nil, err + } + + ret.Content, err = r.readBytes(size) + default: + ret.Content, err = r.readString(tag) + } + + if err != nil { + return nil, err + } + return ret, nil +} + +func (r *binaryDecoder) readBytes(n int) ([]byte, error) { + ret := make([]byte, n) + var err error + + for i := range ret { + ret[i], err = r.readByte() + if err != nil { + return nil, err + } + } + + return ret, nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/binary/encoder.go b/vendor/github.com/Rhymen/go-whatsapp/binary/encoder.go new file mode 100644 index 00000000..59003e7a --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/binary/encoder.go @@ -0,0 +1,351 @@ +package binary + +import ( + "fmt" + "github.com/Rhymen/go-whatsapp/binary/token" + "math" + "strconv" + "strings" +) + +type binaryEncoder struct { + data []byte +} + +func NewEncoder() *binaryEncoder { + return &binaryEncoder{make([]byte, 0)} +} + +func (w *binaryEncoder) GetData() []byte { + return w.data +} + +func (w *binaryEncoder) pushByte(b byte) { + w.data = append(w.data, b) +} + +func (w *binaryEncoder) pushBytes(bytes []byte) { + w.data = append(w.data, bytes...) +} + +func (w *binaryEncoder) pushIntN(value, n int, littleEndian bool) { + for i := 0; i < n; i++ { + var curShift int + if littleEndian { + curShift = i + } else { + curShift = n - i - 1 + } + w.pushByte(byte((value >> uint(curShift*8)) & 0xFF)) + } +} + +func (w *binaryEncoder) pushInt20(value int) { + w.pushBytes([]byte{byte((value >> 16) & 0x0F), byte((value >> 8) & 0xFF), byte(value & 0xFF)}) +} + +func (w *binaryEncoder) pushInt8(value int) { + w.pushIntN(value, 1, false) +} + +func (w *binaryEncoder) pushInt16(value int) { + w.pushIntN(value, 2, false) +} + +func (w *binaryEncoder) pushInt32(value int) { + w.pushIntN(value, 4, false) +} + +func (w *binaryEncoder) pushInt64(value int) { + w.pushIntN(value, 8, false) +} + +func (w *binaryEncoder) pushString(value string) { + w.pushBytes([]byte(value)) +} + +func (w *binaryEncoder) writeByteLength(length int) error { + if length > math.MaxInt32 { + return fmt.Errorf("length is too large: %d", length) + } else if length >= (1 << 20) { + w.pushByte(token.BINARY_32) + w.pushInt32(length) + } else if length >= 256 { + w.pushByte(token.BINARY_20) + w.pushInt20(length) + } else { + w.pushByte(token.BINARY_8) + w.pushInt8(length) + } + + return nil +} + +func (w *binaryEncoder) WriteNode(n Node) error { + numAttributes := 0 + if n.Attributes != nil { + numAttributes = len(n.Attributes) + } + + hasContent := 0 + if n.Content != nil { + hasContent = 1 + } + + w.writeListStart(2*numAttributes + 1 + hasContent) + if err := w.writeString(n.Description, false); err != nil { + return err + } + + if err := w.writeAttributes(n.Attributes); err != nil { + return err + } + + if err := w.writeChildren(n.Content); err != nil { + return err + } + + return nil +} + +func (w *binaryEncoder) writeString(tok string, i bool) error { + if !i && tok == "c.us" { + if err := w.writeToken(token.IndexOfSingleToken("s.whatsapp.net")); err != nil { + return err + } + return nil + } + + tokenIndex := token.IndexOfSingleToken(tok) + if tokenIndex == -1 { + jidSepIndex := strings.Index(tok, "@") + if jidSepIndex < 1 { + w.writeStringRaw(tok) + } else { + w.writeJid(tok[:jidSepIndex], tok[jidSepIndex+1:]) + } + } else { + if tokenIndex < token.SINGLE_BYTE_MAX { + if err := w.writeToken(tokenIndex); err != nil { + return err + } + } else { + singleByteOverflow := tokenIndex - token.SINGLE_BYTE_MAX + dictionaryIndex := singleByteOverflow >> 8 + if dictionaryIndex < 0 || dictionaryIndex > 3 { + return fmt.Errorf("double byte dictionary token out of range: %v", tok) + } + if err := w.writeToken(token.DICTIONARY_0 + dictionaryIndex); err != nil { + return err + } + if err := w.writeToken(singleByteOverflow % 256); err != nil { + return err + } + } + } + + return nil +} + +func (w *binaryEncoder) writeStringRaw(value string) error { + if err := w.writeByteLength(len(value)); err != nil { + return err + } + + w.pushString(value) + + return nil +} + +func (w *binaryEncoder) writeJid(jidLeft, jidRight string) error { + w.pushByte(token.JID_PAIR) + + if jidLeft != "" { + if err := w.writePackedBytes(jidLeft); err != nil { + return err + } + } else { + if err := w.writeToken(token.LIST_EMPTY); err != nil { + return err + } + } + + if err := w.writeString(jidRight, false); err != nil { + return err + } + + return nil +} + +func (w *binaryEncoder) writeToken(tok int) error { + if tok < len(token.SingleByteTokens) { + w.pushByte(byte(tok)) + } else if tok <= 500 { + return fmt.Errorf("invalid token: %d", tok) + } + + return nil +} + +func (w *binaryEncoder) writeAttributes(attributes map[string]string) error { + if attributes == nil { + return nil + } + + for key, val := range attributes { + if val == "" { + continue + } + + if err := w.writeString(key, false); err != nil { + return err + } + + if err := w.writeString(val, false); err != nil { + return err + } + } + + return nil +} + +func (w *binaryEncoder) writeChildren(children interface{}) error { + if children == nil { + return nil + } + + switch childs := children.(type) { + case string: + if err := w.writeString(childs, true); err != nil { + return err + } + case []byte: + if err := w.writeByteLength(len(childs)); err != nil { + return err + } + + w.pushBytes(childs) + case []Node: + w.writeListStart(len(childs)) + for _, n := range childs { + if err := w.WriteNode(n); err != nil { + return err + } + } + default: + return fmt.Errorf("cannot write child of type: %T", children) + } + + return nil +} + +func (w *binaryEncoder) writeListStart(listSize int) { + if listSize == 0 { + w.pushByte(byte(token.LIST_EMPTY)) + } else if listSize < 256 { + w.pushByte(byte(token.LIST_8)) + w.pushInt8(listSize) + } else { + w.pushByte(byte(token.LIST_16)) + w.pushInt16(listSize) + } +} + +func (w *binaryEncoder) writePackedBytes(value string) error { + if err := w.writePackedBytesImpl(value, token.NIBBLE_8); err != nil { + if err := w.writePackedBytesImpl(value, token.HEX_8); err != nil { + return err + } + } + + return nil +} + +func (w *binaryEncoder) writePackedBytesImpl(value string, dataType int) error { + numBytes := len(value) + if numBytes > token.PACKED_MAX { + return fmt.Errorf("too many bytes to pack: %d", numBytes) + } + + w.pushByte(byte(dataType)) + + x := 0 + if numBytes%2 != 0 { + x = 128 + } + w.pushByte(byte(x | int(math.Ceil(float64(numBytes)/2.0)))) + for i, l := 0, numBytes/2; i < l; i++ { + b, err := w.packBytePair(dataType, value[2*i:2*i+1], value[2*i+1:2*i+2]) + if err != nil { + return err + } + + w.pushByte(byte(b)) + } + + if (numBytes % 2) != 0 { + b, err := w.packBytePair(dataType, value[numBytes-1:], "\x00") + if err != nil { + return err + } + + w.pushByte(byte(b)) + } + + return nil +} + +func (w *binaryEncoder) packBytePair(packType int, part1, part2 string) (int, error) { + if packType == token.NIBBLE_8 { + n1, err := packNibble(part1) + if err != nil { + return 0, err + } + + n2, err := packNibble(part2) + if err != nil { + return 0, err + } + + return (n1 << 4) | n2, nil + } else if packType == token.HEX_8 { + n1, err := packHex(part1) + if err != nil { + return 0, err + } + + n2, err := packHex(part2) + if err != nil { + return 0, err + } + + return (n1 << 4) | n2, nil + } else { + return 0, fmt.Errorf("invalid pack type (%d) for byte pair: %s / %s", packType, part1, part2) + } +} + +func packNibble(value string) (int, error) { + if value >= "0" && value <= "9" { + return strconv.Atoi(value) + } else if value == "-" { + return 10, nil + } else if value == "." { + return 11, nil + } else if value == "\x00" { + return 15, nil + } + + return 0, fmt.Errorf("invalid string to pack as nibble: %v", value) +} + +func packHex(value string) (int, error) { + if (value >= "0" && value <= "9") || (value >= "A" && value <= "F") || (value >= "a" && value <= "f") { + d, err := strconv.ParseInt(value, 16, 0) + return int(d), err + } else if value == "\x00" { + return 15, nil + } + + return 0, fmt.Errorf("invalid string to pack as hex: %v", value) +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/binary/node.go b/vendor/github.com/Rhymen/go-whatsapp/binary/node.go new file mode 100644 index 00000000..2139e385 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/binary/node.go @@ -0,0 +1,103 @@ +package binary + +import ( + "fmt" + pb "github.com/Rhymen/go-whatsapp/binary/proto" + "github.com/golang/protobuf/proto" +) + +type Node struct { + Description string + Attributes map[string]string + Content interface{} +} + +func Marshal(n Node) ([]byte, error) { + if n.Attributes != nil && n.Content != nil { + a, err := marshalMessageArray(n.Content.([]interface{})) + if err != nil { + return nil, err + } + n.Content = a + } + + w := NewEncoder() + if err := w.WriteNode(n); err != nil { + return nil, err + } + + return w.GetData(), nil +} + +func marshalMessageArray(messages []interface{}) ([]Node, error) { + ret := make([]Node, len(messages)) + + for i, m := range messages { + if wmi, ok := m.(*pb.WebMessageInfo); ok { + b, err := marshalWebMessageInfo(wmi) + if err != nil { + return nil, nil + } + ret[i] = Node{"message", nil, b} + } else { + ret[i], ok = m.(Node) + if !ok { + return nil, fmt.Errorf("invalid Node") + } + } + } + + return ret, nil +} + +func marshalWebMessageInfo(p *pb.WebMessageInfo) ([]byte, error) { + b, err := proto.Marshal(p) + if err != nil { + return nil, err + } + return b, nil +} + +func Unmarshal(data []byte) (*Node, error) { + r := NewDecoder(data) + n, err := r.ReadNode() + if err != nil { + return nil, err + } + + if n != nil && n.Attributes != nil && n.Content != nil { + n.Content, err = unmarshalMessageArray(n.Content.([]Node)) + if err != nil { + return nil, err + } + } + + return n, nil +} + +func unmarshalMessageArray(messages []Node) ([]interface{}, error) { + ret := make([]interface{}, len(messages)) + + for i, msg := range messages { + if msg.Description == "message" { + info, err := unmarshalWebMessageInfo(msg.Content.([]byte)) + if err != nil { + return nil, err + } + ret[i] = info + } else { + ret[i] = msg + } + } + + return ret, nil +} + +func unmarshalWebMessageInfo(msg []byte) (*pb.WebMessageInfo, error) { + message := &pb.WebMessageInfo{} + err := proto.Unmarshal(msg, message) + if err != nil { + return nil, err + } + return message, nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.pb.go b/vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.pb.go new file mode 100644 index 00000000..71d9923f --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.pb.go @@ -0,0 +1,3800 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: def.proto + +package proto + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ExtendedTextMessage_FONTTYPE int32 + +const ( + ExtendedTextMessage_SANS_SERIF ExtendedTextMessage_FONTTYPE = 0 + ExtendedTextMessage_SERIF ExtendedTextMessage_FONTTYPE = 1 + ExtendedTextMessage_NORICAN_REGULAR ExtendedTextMessage_FONTTYPE = 2 + ExtendedTextMessage_BRYNDAN_WRITE ExtendedTextMessage_FONTTYPE = 3 + ExtendedTextMessage_BEBASNEUE_REGULAR ExtendedTextMessage_FONTTYPE = 4 + ExtendedTextMessage_OSWALD_HEAVY ExtendedTextMessage_FONTTYPE = 5 +) + +var ExtendedTextMessage_FONTTYPE_name = map[int32]string{ + 0: "SANS_SERIF", + 1: "SERIF", + 2: "NORICAN_REGULAR", + 3: "BRYNDAN_WRITE", + 4: "BEBASNEUE_REGULAR", + 5: "OSWALD_HEAVY", +} +var ExtendedTextMessage_FONTTYPE_value = map[string]int32{ + "SANS_SERIF": 0, + "SERIF": 1, + "NORICAN_REGULAR": 2, + "BRYNDAN_WRITE": 3, + "BEBASNEUE_REGULAR": 4, + "OSWALD_HEAVY": 5, +} + +func (x ExtendedTextMessage_FONTTYPE) Enum() *ExtendedTextMessage_FONTTYPE { + p := new(ExtendedTextMessage_FONTTYPE) + *p = x + return p +} +func (x ExtendedTextMessage_FONTTYPE) String() string { + return proto.EnumName(ExtendedTextMessage_FONTTYPE_name, int32(x)) +} +func (x *ExtendedTextMessage_FONTTYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ExtendedTextMessage_FONTTYPE_value, data, "ExtendedTextMessage_FONTTYPE") + if err != nil { + return err + } + *x = ExtendedTextMessage_FONTTYPE(value) + return nil +} +func (ExtendedTextMessage_FONTTYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{7, 0} +} + +type VideoMessage_ATTRIBUTION int32 + +const ( + VideoMessage_NONE VideoMessage_ATTRIBUTION = 0 + VideoMessage_GIPHY VideoMessage_ATTRIBUTION = 1 + VideoMessage_TENOR VideoMessage_ATTRIBUTION = 2 +) + +var VideoMessage_ATTRIBUTION_name = map[int32]string{ + 0: "NONE", + 1: "GIPHY", + 2: "TENOR", +} +var VideoMessage_ATTRIBUTION_value = map[string]int32{ + "NONE": 0, + "GIPHY": 1, + "TENOR": 2, +} + +func (x VideoMessage_ATTRIBUTION) Enum() *VideoMessage_ATTRIBUTION { + p := new(VideoMessage_ATTRIBUTION) + *p = x + return p +} +func (x VideoMessage_ATTRIBUTION) String() string { + return proto.EnumName(VideoMessage_ATTRIBUTION_name, int32(x)) +} +func (x *VideoMessage_ATTRIBUTION) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(VideoMessage_ATTRIBUTION_value, data, "VideoMessage_ATTRIBUTION") + if err != nil { + return err + } + *x = VideoMessage_ATTRIBUTION(value) + return nil +} +func (VideoMessage_ATTRIBUTION) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{10, 0} +} + +type ProtocolMessage_TYPE int32 + +const ( + ProtocolMessage_REVOKE ProtocolMessage_TYPE = 0 +) + +var ProtocolMessage_TYPE_name = map[int32]string{ + 0: "REVOKE", +} +var ProtocolMessage_TYPE_value = map[string]int32{ + "REVOKE": 0, +} + +func (x ProtocolMessage_TYPE) Enum() *ProtocolMessage_TYPE { + p := new(ProtocolMessage_TYPE) + *p = x + return p +} +func (x ProtocolMessage_TYPE) String() string { + return proto.EnumName(ProtocolMessage_TYPE_name, int32(x)) +} +func (x *ProtocolMessage_TYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ProtocolMessage_TYPE_value, data, "ProtocolMessage_TYPE") + if err != nil { + return err + } + *x = ProtocolMessage_TYPE(value) + return nil +} +func (ProtocolMessage_TYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{13, 0} +} + +type HSMDateTimeComponent_DAYOFWEEKTYPE int32 + +const ( + HSMDateTimeComponent_MONDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 1 + HSMDateTimeComponent_TUESDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 2 + HSMDateTimeComponent_WEDNESDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 3 + HSMDateTimeComponent_THURSDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 4 + HSMDateTimeComponent_FRIDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 5 + HSMDateTimeComponent_SATURDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 6 + HSMDateTimeComponent_SUNDAY HSMDateTimeComponent_DAYOFWEEKTYPE = 7 +) + +var HSMDateTimeComponent_DAYOFWEEKTYPE_name = map[int32]string{ + 1: "MONDAY", + 2: "TUESDAY", + 3: "WEDNESDAY", + 4: "THURSDAY", + 5: "FRIDAY", + 6: "SATURDAY", + 7: "SUNDAY", +} +var HSMDateTimeComponent_DAYOFWEEKTYPE_value = map[string]int32{ + "MONDAY": 1, + "TUESDAY": 2, + "WEDNESDAY": 3, + "THURSDAY": 4, + "FRIDAY": 5, + "SATURDAY": 6, + "SUNDAY": 7, +} + +func (x HSMDateTimeComponent_DAYOFWEEKTYPE) Enum() *HSMDateTimeComponent_DAYOFWEEKTYPE { + p := new(HSMDateTimeComponent_DAYOFWEEKTYPE) + *p = x + return p +} +func (x HSMDateTimeComponent_DAYOFWEEKTYPE) String() string { + return proto.EnumName(HSMDateTimeComponent_DAYOFWEEKTYPE_name, int32(x)) +} +func (x *HSMDateTimeComponent_DAYOFWEEKTYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(HSMDateTimeComponent_DAYOFWEEKTYPE_value, data, "HSMDateTimeComponent_DAYOFWEEKTYPE") + if err != nil { + return err + } + *x = HSMDateTimeComponent_DAYOFWEEKTYPE(value) + return nil +} +func (HSMDateTimeComponent_DAYOFWEEKTYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{16, 0} +} + +type HSMDateTimeComponent_CALENDARTYPE int32 + +const ( + HSMDateTimeComponent_GREGORIAN HSMDateTimeComponent_CALENDARTYPE = 1 + HSMDateTimeComponent_SOLAR_HIJRI HSMDateTimeComponent_CALENDARTYPE = 2 +) + +var HSMDateTimeComponent_CALENDARTYPE_name = map[int32]string{ + 1: "GREGORIAN", + 2: "SOLAR_HIJRI", +} +var HSMDateTimeComponent_CALENDARTYPE_value = map[string]int32{ + "GREGORIAN": 1, + "SOLAR_HIJRI": 2, +} + +func (x HSMDateTimeComponent_CALENDARTYPE) Enum() *HSMDateTimeComponent_CALENDARTYPE { + p := new(HSMDateTimeComponent_CALENDARTYPE) + *p = x + return p +} +func (x HSMDateTimeComponent_CALENDARTYPE) String() string { + return proto.EnumName(HSMDateTimeComponent_CALENDARTYPE_name, int32(x)) +} +func (x *HSMDateTimeComponent_CALENDARTYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(HSMDateTimeComponent_CALENDARTYPE_value, data, "HSMDateTimeComponent_CALENDARTYPE") + if err != nil { + return err + } + *x = HSMDateTimeComponent_CALENDARTYPE(value) + return nil +} +func (HSMDateTimeComponent_CALENDARTYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{16, 1} +} + +type WebMessageInfo_STATUS int32 + +const ( + WebMessageInfo_ERROR WebMessageInfo_STATUS = 0 + WebMessageInfo_PENDING WebMessageInfo_STATUS = 1 + WebMessageInfo_SERVER_ACK WebMessageInfo_STATUS = 2 + WebMessageInfo_DELIVERY_ACK WebMessageInfo_STATUS = 3 + WebMessageInfo_READ WebMessageInfo_STATUS = 4 + WebMessageInfo_PLAYED WebMessageInfo_STATUS = 5 +) + +var WebMessageInfo_STATUS_name = map[int32]string{ + 0: "ERROR", + 1: "PENDING", + 2: "SERVER_ACK", + 3: "DELIVERY_ACK", + 4: "READ", + 5: "PLAYED", +} +var WebMessageInfo_STATUS_value = map[string]int32{ + "ERROR": 0, + "PENDING": 1, + "SERVER_ACK": 2, + "DELIVERY_ACK": 3, + "READ": 4, + "PLAYED": 5, +} + +func (x WebMessageInfo_STATUS) Enum() *WebMessageInfo_STATUS { + p := new(WebMessageInfo_STATUS) + *p = x + return p +} +func (x WebMessageInfo_STATUS) String() string { + return proto.EnumName(WebMessageInfo_STATUS_name, int32(x)) +} +func (x *WebMessageInfo_STATUS) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(WebMessageInfo_STATUS_value, data, "WebMessageInfo_STATUS") + if err != nil { + return err + } + *x = WebMessageInfo_STATUS(value) + return nil +} +func (WebMessageInfo_STATUS) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{30, 0} +} + +type WebMessageInfo_STUBTYPE int32 + +const ( + WebMessageInfo_UNKNOWN WebMessageInfo_STUBTYPE = 0 + WebMessageInfo_REVOKE WebMessageInfo_STUBTYPE = 1 + WebMessageInfo_CIPHERTEXT WebMessageInfo_STUBTYPE = 2 + WebMessageInfo_FUTUREPROOF WebMessageInfo_STUBTYPE = 3 + WebMessageInfo_NON_VERIFIED_TRANSITION WebMessageInfo_STUBTYPE = 4 + WebMessageInfo_UNVERIFIED_TRANSITION WebMessageInfo_STUBTYPE = 5 + WebMessageInfo_VERIFIED_TRANSITION WebMessageInfo_STUBTYPE = 6 + WebMessageInfo_VERIFIED_LOW_UNKNOWN WebMessageInfo_STUBTYPE = 7 + WebMessageInfo_VERIFIED_HIGH WebMessageInfo_STUBTYPE = 8 + WebMessageInfo_VERIFIED_INITIAL_UNKNOWN WebMessageInfo_STUBTYPE = 9 + WebMessageInfo_VERIFIED_INITIAL_LOW WebMessageInfo_STUBTYPE = 10 + WebMessageInfo_VERIFIED_INITIAL_HIGH WebMessageInfo_STUBTYPE = 11 + WebMessageInfo_VERIFIED_TRANSITION_ANY_TO_NONE WebMessageInfo_STUBTYPE = 12 + WebMessageInfo_VERIFIED_TRANSITION_ANY_TO_HIGH WebMessageInfo_STUBTYPE = 13 + WebMessageInfo_VERIFIED_TRANSITION_HIGH_TO_LOW WebMessageInfo_STUBTYPE = 14 + WebMessageInfo_VERIFIED_TRANSITION_HIGH_TO_UNKNOWN WebMessageInfo_STUBTYPE = 15 + WebMessageInfo_VERIFIED_TRANSITION_UNKNOWN_TO_LOW WebMessageInfo_STUBTYPE = 16 + WebMessageInfo_VERIFIED_TRANSITION_LOW_TO_UNKNOWN WebMessageInfo_STUBTYPE = 17 + WebMessageInfo_VERIFIED_TRANSITION_NONE_TO_LOW WebMessageInfo_STUBTYPE = 18 + WebMessageInfo_VERIFIED_TRANSITION_NONE_TO_UNKNOWN WebMessageInfo_STUBTYPE = 19 + WebMessageInfo_GROUP_CREATE WebMessageInfo_STUBTYPE = 20 + WebMessageInfo_GROUP_CHANGE_SUBJECT WebMessageInfo_STUBTYPE = 21 + WebMessageInfo_GROUP_CHANGE_ICON WebMessageInfo_STUBTYPE = 22 + WebMessageInfo_GROUP_CHANGE_INVITE_LINK WebMessageInfo_STUBTYPE = 23 + WebMessageInfo_GROUP_CHANGE_DESCRIPTION WebMessageInfo_STUBTYPE = 24 + WebMessageInfo_GROUP_CHANGE_RESTRICT WebMessageInfo_STUBTYPE = 25 + WebMessageInfo_GROUP_CHANGE_ANNOUNCE WebMessageInfo_STUBTYPE = 26 + WebMessageInfo_GROUP_PARTICIPANT_ADD WebMessageInfo_STUBTYPE = 27 + WebMessageInfo_GROUP_PARTICIPANT_REMOVE WebMessageInfo_STUBTYPE = 28 + WebMessageInfo_GROUP_PARTICIPANT_PROMOTE WebMessageInfo_STUBTYPE = 29 + WebMessageInfo_GROUP_PARTICIPANT_DEMOTE WebMessageInfo_STUBTYPE = 30 + WebMessageInfo_GROUP_PARTICIPANT_INVITE WebMessageInfo_STUBTYPE = 31 + WebMessageInfo_GROUP_PARTICIPANT_LEAVE WebMessageInfo_STUBTYPE = 32 + WebMessageInfo_GROUP_PARTICIPANT_CHANGE_NUMBER WebMessageInfo_STUBTYPE = 33 + WebMessageInfo_BROADCAST_CREATE WebMessageInfo_STUBTYPE = 34 + WebMessageInfo_BROADCAST_ADD WebMessageInfo_STUBTYPE = 35 + WebMessageInfo_BROADCAST_REMOVE WebMessageInfo_STUBTYPE = 36 + WebMessageInfo_GENERIC_NOTIFICATION WebMessageInfo_STUBTYPE = 37 + WebMessageInfo_E2E_IDENTITY_CHANGED WebMessageInfo_STUBTYPE = 38 + WebMessageInfo_E2E_ENCRYPTED WebMessageInfo_STUBTYPE = 39 + WebMessageInfo_CALL_MISSED_VOICE WebMessageInfo_STUBTYPE = 40 + WebMessageInfo_CALL_MISSED_VIDEO WebMessageInfo_STUBTYPE = 41 + WebMessageInfo_INDIVIDUAL_CHANGE_NUMBER WebMessageInfo_STUBTYPE = 42 + WebMessageInfo_GROUP_DELETE WebMessageInfo_STUBTYPE = 43 +) + +var WebMessageInfo_STUBTYPE_name = map[int32]string{ + 0: "UNKNOWN", + 1: "REVOKE", + 2: "CIPHERTEXT", + 3: "FUTUREPROOF", + 4: "NON_VERIFIED_TRANSITION", + 5: "UNVERIFIED_TRANSITION", + 6: "VERIFIED_TRANSITION", + 7: "VERIFIED_LOW_UNKNOWN", + 8: "VERIFIED_HIGH", + 9: "VERIFIED_INITIAL_UNKNOWN", + 10: "VERIFIED_INITIAL_LOW", + 11: "VERIFIED_INITIAL_HIGH", + 12: "VERIFIED_TRANSITION_ANY_TO_NONE", + 13: "VERIFIED_TRANSITION_ANY_TO_HIGH", + 14: "VERIFIED_TRANSITION_HIGH_TO_LOW", + 15: "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN", + 16: "VERIFIED_TRANSITION_UNKNOWN_TO_LOW", + 17: "VERIFIED_TRANSITION_LOW_TO_UNKNOWN", + 18: "VERIFIED_TRANSITION_NONE_TO_LOW", + 19: "VERIFIED_TRANSITION_NONE_TO_UNKNOWN", + 20: "GROUP_CREATE", + 21: "GROUP_CHANGE_SUBJECT", + 22: "GROUP_CHANGE_ICON", + 23: "GROUP_CHANGE_INVITE_LINK", + 24: "GROUP_CHANGE_DESCRIPTION", + 25: "GROUP_CHANGE_RESTRICT", + 26: "GROUP_CHANGE_ANNOUNCE", + 27: "GROUP_PARTICIPANT_ADD", + 28: "GROUP_PARTICIPANT_REMOVE", + 29: "GROUP_PARTICIPANT_PROMOTE", + 30: "GROUP_PARTICIPANT_DEMOTE", + 31: "GROUP_PARTICIPANT_INVITE", + 32: "GROUP_PARTICIPANT_LEAVE", + 33: "GROUP_PARTICIPANT_CHANGE_NUMBER", + 34: "BROADCAST_CREATE", + 35: "BROADCAST_ADD", + 36: "BROADCAST_REMOVE", + 37: "GENERIC_NOTIFICATION", + 38: "E2E_IDENTITY_CHANGED", + 39: "E2E_ENCRYPTED", + 40: "CALL_MISSED_VOICE", + 41: "CALL_MISSED_VIDEO", + 42: "INDIVIDUAL_CHANGE_NUMBER", + 43: "GROUP_DELETE", +} +var WebMessageInfo_STUBTYPE_value = map[string]int32{ + "UNKNOWN": 0, + "REVOKE": 1, + "CIPHERTEXT": 2, + "FUTUREPROOF": 3, + "NON_VERIFIED_TRANSITION": 4, + "UNVERIFIED_TRANSITION": 5, + "VERIFIED_TRANSITION": 6, + "VERIFIED_LOW_UNKNOWN": 7, + "VERIFIED_HIGH": 8, + "VERIFIED_INITIAL_UNKNOWN": 9, + "VERIFIED_INITIAL_LOW": 10, + "VERIFIED_INITIAL_HIGH": 11, + "VERIFIED_TRANSITION_ANY_TO_NONE": 12, + "VERIFIED_TRANSITION_ANY_TO_HIGH": 13, + "VERIFIED_TRANSITION_HIGH_TO_LOW": 14, + "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN": 15, + "VERIFIED_TRANSITION_UNKNOWN_TO_LOW": 16, + "VERIFIED_TRANSITION_LOW_TO_UNKNOWN": 17, + "VERIFIED_TRANSITION_NONE_TO_LOW": 18, + "VERIFIED_TRANSITION_NONE_TO_UNKNOWN": 19, + "GROUP_CREATE": 20, + "GROUP_CHANGE_SUBJECT": 21, + "GROUP_CHANGE_ICON": 22, + "GROUP_CHANGE_INVITE_LINK": 23, + "GROUP_CHANGE_DESCRIPTION": 24, + "GROUP_CHANGE_RESTRICT": 25, + "GROUP_CHANGE_ANNOUNCE": 26, + "GROUP_PARTICIPANT_ADD": 27, + "GROUP_PARTICIPANT_REMOVE": 28, + "GROUP_PARTICIPANT_PROMOTE": 29, + "GROUP_PARTICIPANT_DEMOTE": 30, + "GROUP_PARTICIPANT_INVITE": 31, + "GROUP_PARTICIPANT_LEAVE": 32, + "GROUP_PARTICIPANT_CHANGE_NUMBER": 33, + "BROADCAST_CREATE": 34, + "BROADCAST_ADD": 35, + "BROADCAST_REMOVE": 36, + "GENERIC_NOTIFICATION": 37, + "E2E_IDENTITY_CHANGED": 38, + "E2E_ENCRYPTED": 39, + "CALL_MISSED_VOICE": 40, + "CALL_MISSED_VIDEO": 41, + "INDIVIDUAL_CHANGE_NUMBER": 42, + "GROUP_DELETE": 43, +} + +func (x WebMessageInfo_STUBTYPE) Enum() *WebMessageInfo_STUBTYPE { + p := new(WebMessageInfo_STUBTYPE) + *p = x + return p +} +func (x WebMessageInfo_STUBTYPE) String() string { + return proto.EnumName(WebMessageInfo_STUBTYPE_name, int32(x)) +} +func (x *WebMessageInfo_STUBTYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(WebMessageInfo_STUBTYPE_value, data, "WebMessageInfo_STUBTYPE") + if err != nil { + return err + } + *x = WebMessageInfo_STUBTYPE(value) + return nil +} +func (WebMessageInfo_STUBTYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{30, 1} +} + +type WebFeatures_FLAG int32 + +const ( + WebFeatures_NOT_IMPLEMENTED WebFeatures_FLAG = 0 + WebFeatures_IMPLEMENTED WebFeatures_FLAG = 1 + WebFeatures_OPTIONAL WebFeatures_FLAG = 2 +) + +var WebFeatures_FLAG_name = map[int32]string{ + 0: "NOT_IMPLEMENTED", + 1: "IMPLEMENTED", + 2: "OPTIONAL", +} +var WebFeatures_FLAG_value = map[string]int32{ + "NOT_IMPLEMENTED": 0, + "IMPLEMENTED": 1, + "OPTIONAL": 2, +} + +func (x WebFeatures_FLAG) Enum() *WebFeatures_FLAG { + p := new(WebFeatures_FLAG) + *p = x + return p +} +func (x WebFeatures_FLAG) String() string { + return proto.EnumName(WebFeatures_FLAG_name, int32(x)) +} +func (x *WebFeatures_FLAG) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(WebFeatures_FLAG_value, data, "WebFeatures_FLAG") + if err != nil { + return err + } + *x = WebFeatures_FLAG(value) + return nil +} +func (WebFeatures_FLAG) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{34, 0} +} + +type FingerprintData struct { + PublicKey *string `protobuf:"bytes,1,opt,name=publicKey" json:"publicKey,omitempty"` + Identifier *string `protobuf:"bytes,2,opt,name=identifier" json:"identifier,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FingerprintData) Reset() { *m = FingerprintData{} } +func (m *FingerprintData) String() string { return proto.CompactTextString(m) } +func (*FingerprintData) ProtoMessage() {} +func (*FingerprintData) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{0} +} +func (m *FingerprintData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FingerprintData.Unmarshal(m, b) +} +func (m *FingerprintData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FingerprintData.Marshal(b, m, deterministic) +} +func (dst *FingerprintData) XXX_Merge(src proto.Message) { + xxx_messageInfo_FingerprintData.Merge(dst, src) +} +func (m *FingerprintData) XXX_Size() int { + return xxx_messageInfo_FingerprintData.Size(m) +} +func (m *FingerprintData) XXX_DiscardUnknown() { + xxx_messageInfo_FingerprintData.DiscardUnknown(m) +} + +var xxx_messageInfo_FingerprintData proto.InternalMessageInfo + +func (m *FingerprintData) GetPublicKey() string { + if m != nil && m.PublicKey != nil { + return *m.PublicKey + } + return "" +} + +func (m *FingerprintData) GetIdentifier() string { + if m != nil && m.Identifier != nil { + return *m.Identifier + } + return "" +} + +type CombinedFingerprint struct { + Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + LocalFingerprint *FingerprintData `protobuf:"bytes,2,opt,name=localFingerprint" json:"localFingerprint,omitempty"` + RemoteFingerprint *FingerprintData `protobuf:"bytes,3,opt,name=remoteFingerprint" json:"remoteFingerprint,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CombinedFingerprint) Reset() { *m = CombinedFingerprint{} } +func (m *CombinedFingerprint) String() string { return proto.CompactTextString(m) } +func (*CombinedFingerprint) ProtoMessage() {} +func (*CombinedFingerprint) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{1} +} +func (m *CombinedFingerprint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CombinedFingerprint.Unmarshal(m, b) +} +func (m *CombinedFingerprint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CombinedFingerprint.Marshal(b, m, deterministic) +} +func (dst *CombinedFingerprint) XXX_Merge(src proto.Message) { + xxx_messageInfo_CombinedFingerprint.Merge(dst, src) +} +func (m *CombinedFingerprint) XXX_Size() int { + return xxx_messageInfo_CombinedFingerprint.Size(m) +} +func (m *CombinedFingerprint) XXX_DiscardUnknown() { + xxx_messageInfo_CombinedFingerprint.DiscardUnknown(m) +} + +var xxx_messageInfo_CombinedFingerprint proto.InternalMessageInfo + +func (m *CombinedFingerprint) GetVersion() uint32 { + if m != nil && m.Version != nil { + return *m.Version + } + return 0 +} + +func (m *CombinedFingerprint) GetLocalFingerprint() *FingerprintData { + if m != nil { + return m.LocalFingerprint + } + return nil +} + +func (m *CombinedFingerprint) GetRemoteFingerprint() *FingerprintData { + if m != nil { + return m.RemoteFingerprint + } + return nil +} + +type MessageKey struct { + RemoteJid *string `protobuf:"bytes,1,opt,name=remoteJid" json:"remoteJid,omitempty"` + FromMe *bool `protobuf:"varint,2,opt,name=fromMe" json:"fromMe,omitempty"` + Id *string `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"` + Participant *string `protobuf:"bytes,4,opt,name=participant" json:"participant,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageKey) Reset() { *m = MessageKey{} } +func (m *MessageKey) String() string { return proto.CompactTextString(m) } +func (*MessageKey) ProtoMessage() {} +func (*MessageKey) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{2} +} +func (m *MessageKey) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageKey.Unmarshal(m, b) +} +func (m *MessageKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageKey.Marshal(b, m, deterministic) +} +func (dst *MessageKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageKey.Merge(dst, src) +} +func (m *MessageKey) XXX_Size() int { + return xxx_messageInfo_MessageKey.Size(m) +} +func (m *MessageKey) XXX_DiscardUnknown() { + xxx_messageInfo_MessageKey.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageKey proto.InternalMessageInfo + +func (m *MessageKey) GetRemoteJid() string { + if m != nil && m.RemoteJid != nil { + return *m.RemoteJid + } + return "" +} + +func (m *MessageKey) GetFromMe() bool { + if m != nil && m.FromMe != nil { + return *m.FromMe + } + return false +} + +func (m *MessageKey) GetId() string { + if m != nil && m.Id != nil { + return *m.Id + } + return "" +} + +func (m *MessageKey) GetParticipant() string { + if m != nil && m.Participant != nil { + return *m.Participant + } + return "" +} + +type SenderKeyDistributionMessage struct { + GroupId *string `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"` + AxolotlSenderKeyDistributionMessage []byte `protobuf:"bytes,2,opt,name=axolotlSenderKeyDistributionMessage" json:"axolotlSenderKeyDistributionMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SenderKeyDistributionMessage) Reset() { *m = SenderKeyDistributionMessage{} } +func (m *SenderKeyDistributionMessage) String() string { return proto.CompactTextString(m) } +func (*SenderKeyDistributionMessage) ProtoMessage() {} +func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{3} +} +func (m *SenderKeyDistributionMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SenderKeyDistributionMessage.Unmarshal(m, b) +} +func (m *SenderKeyDistributionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SenderKeyDistributionMessage.Marshal(b, m, deterministic) +} +func (dst *SenderKeyDistributionMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_SenderKeyDistributionMessage.Merge(dst, src) +} +func (m *SenderKeyDistributionMessage) XXX_Size() int { + return xxx_messageInfo_SenderKeyDistributionMessage.Size(m) +} +func (m *SenderKeyDistributionMessage) XXX_DiscardUnknown() { + xxx_messageInfo_SenderKeyDistributionMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_SenderKeyDistributionMessage proto.InternalMessageInfo + +func (m *SenderKeyDistributionMessage) GetGroupId() string { + if m != nil && m.GroupId != nil { + return *m.GroupId + } + return "" +} + +func (m *SenderKeyDistributionMessage) GetAxolotlSenderKeyDistributionMessage() []byte { + if m != nil { + return m.AxolotlSenderKeyDistributionMessage + } + return nil +} + +type ImageMessage struct { + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + Mimetype *string `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"` + Caption *string `protobuf:"bytes,3,opt,name=caption" json:"caption,omitempty"` + FileSha256 []byte `protobuf:"bytes,4,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileLength *uint64 `protobuf:"varint,5,opt,name=fileLength" json:"fileLength,omitempty"` + Height *uint32 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` + Width *uint32 `protobuf:"varint,7,opt,name=width" json:"width,omitempty"` + MediaKey []byte `protobuf:"bytes,8,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,9,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + InteractiveAnnotations []*InteractiveAnnotation `protobuf:"bytes,10,rep,name=interactiveAnnotations" json:"interactiveAnnotations,omitempty"` + DirectPath *string `protobuf:"bytes,11,opt,name=directPath" json:"directPath,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + FirstScanSidecar []byte `protobuf:"bytes,18,opt,name=firstScanSidecar" json:"firstScanSidecar,omitempty"` + FirstScanLength *uint32 `protobuf:"varint,19,opt,name=firstScanLength" json:"firstScanLength,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageMessage) Reset() { *m = ImageMessage{} } +func (m *ImageMessage) String() string { return proto.CompactTextString(m) } +func (*ImageMessage) ProtoMessage() {} +func (*ImageMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{4} +} +func (m *ImageMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImageMessage.Unmarshal(m, b) +} +func (m *ImageMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImageMessage.Marshal(b, m, deterministic) +} +func (dst *ImageMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageMessage.Merge(dst, src) +} +func (m *ImageMessage) XXX_Size() int { + return xxx_messageInfo_ImageMessage.Size(m) +} +func (m *ImageMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ImageMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageMessage proto.InternalMessageInfo + +func (m *ImageMessage) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *ImageMessage) GetMimetype() string { + if m != nil && m.Mimetype != nil { + return *m.Mimetype + } + return "" +} + +func (m *ImageMessage) GetCaption() string { + if m != nil && m.Caption != nil { + return *m.Caption + } + return "" +} + +func (m *ImageMessage) GetFileSha256() []byte { + if m != nil { + return m.FileSha256 + } + return nil +} + +func (m *ImageMessage) GetFileLength() uint64 { + if m != nil && m.FileLength != nil { + return *m.FileLength + } + return 0 +} + +func (m *ImageMessage) GetHeight() uint32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +func (m *ImageMessage) GetWidth() uint32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func (m *ImageMessage) GetMediaKey() []byte { + if m != nil { + return m.MediaKey + } + return nil +} + +func (m *ImageMessage) GetFileEncSha256() []byte { + if m != nil { + return m.FileEncSha256 + } + return nil +} + +func (m *ImageMessage) GetInteractiveAnnotations() []*InteractiveAnnotation { + if m != nil { + return m.InteractiveAnnotations + } + return nil +} + +func (m *ImageMessage) GetDirectPath() string { + if m != nil && m.DirectPath != nil { + return *m.DirectPath + } + return "" +} + +func (m *ImageMessage) GetJpegThumbnail() []byte { + if m != nil { + return m.JpegThumbnail + } + return nil +} + +func (m *ImageMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +func (m *ImageMessage) GetFirstScanSidecar() []byte { + if m != nil { + return m.FirstScanSidecar + } + return nil +} + +func (m *ImageMessage) GetFirstScanLength() uint32 { + if m != nil && m.FirstScanLength != nil { + return *m.FirstScanLength + } + return 0 +} + +type ContactMessage struct { + DisplayName *string `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"` + Vcard *string `protobuf:"bytes,16,opt,name=vcard" json:"vcard,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ContactMessage) Reset() { *m = ContactMessage{} } +func (m *ContactMessage) String() string { return proto.CompactTextString(m) } +func (*ContactMessage) ProtoMessage() {} +func (*ContactMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{5} +} +func (m *ContactMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ContactMessage.Unmarshal(m, b) +} +func (m *ContactMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ContactMessage.Marshal(b, m, deterministic) +} +func (dst *ContactMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContactMessage.Merge(dst, src) +} +func (m *ContactMessage) XXX_Size() int { + return xxx_messageInfo_ContactMessage.Size(m) +} +func (m *ContactMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ContactMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ContactMessage proto.InternalMessageInfo + +func (m *ContactMessage) GetDisplayName() string { + if m != nil && m.DisplayName != nil { + return *m.DisplayName + } + return "" +} + +func (m *ContactMessage) GetVcard() string { + if m != nil && m.Vcard != nil { + return *m.Vcard + } + return "" +} + +func (m *ContactMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type LocationMessage struct { + DegreesLatitude *float64 `protobuf:"fixed64,1,opt,name=degreesLatitude" json:"degreesLatitude,omitempty"` + DegreesLongitude *float64 `protobuf:"fixed64,2,opt,name=degreesLongitude" json:"degreesLongitude,omitempty"` + Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + Address *string `protobuf:"bytes,4,opt,name=address" json:"address,omitempty"` + Url *string `protobuf:"bytes,5,opt,name=url" json:"url,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LocationMessage) Reset() { *m = LocationMessage{} } +func (m *LocationMessage) String() string { return proto.CompactTextString(m) } +func (*LocationMessage) ProtoMessage() {} +func (*LocationMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{6} +} +func (m *LocationMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LocationMessage.Unmarshal(m, b) +} +func (m *LocationMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LocationMessage.Marshal(b, m, deterministic) +} +func (dst *LocationMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_LocationMessage.Merge(dst, src) +} +func (m *LocationMessage) XXX_Size() int { + return xxx_messageInfo_LocationMessage.Size(m) +} +func (m *LocationMessage) XXX_DiscardUnknown() { + xxx_messageInfo_LocationMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_LocationMessage proto.InternalMessageInfo + +func (m *LocationMessage) GetDegreesLatitude() float64 { + if m != nil && m.DegreesLatitude != nil { + return *m.DegreesLatitude + } + return 0 +} + +func (m *LocationMessage) GetDegreesLongitude() float64 { + if m != nil && m.DegreesLongitude != nil { + return *m.DegreesLongitude + } + return 0 +} + +func (m *LocationMessage) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *LocationMessage) GetAddress() string { + if m != nil && m.Address != nil { + return *m.Address + } + return "" +} + +func (m *LocationMessage) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *LocationMessage) GetJpegThumbnail() []byte { + if m != nil { + return m.JpegThumbnail + } + return nil +} + +func (m *LocationMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type ExtendedTextMessage struct { + Text *string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` + MatchedText *string `protobuf:"bytes,2,opt,name=matchedText" json:"matchedText,omitempty"` + CanonicalUrl *string `protobuf:"bytes,4,opt,name=canonicalUrl" json:"canonicalUrl,omitempty"` + Description *string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"` + Title *string `protobuf:"bytes,6,opt,name=title" json:"title,omitempty"` + TextArgb *uint32 `protobuf:"fixed32,7,opt,name=textArgb" json:"textArgb,omitempty"` + BackgroundArgb *uint32 `protobuf:"fixed32,8,opt,name=backgroundArgb" json:"backgroundArgb,omitempty"` + Font *ExtendedTextMessage_FONTTYPE `protobuf:"varint,9,opt,name=font,enum=proto.ExtendedTextMessage_FONTTYPE" json:"font,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtendedTextMessage) Reset() { *m = ExtendedTextMessage{} } +func (m *ExtendedTextMessage) String() string { return proto.CompactTextString(m) } +func (*ExtendedTextMessage) ProtoMessage() {} +func (*ExtendedTextMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{7} +} +func (m *ExtendedTextMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtendedTextMessage.Unmarshal(m, b) +} +func (m *ExtendedTextMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtendedTextMessage.Marshal(b, m, deterministic) +} +func (dst *ExtendedTextMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtendedTextMessage.Merge(dst, src) +} +func (m *ExtendedTextMessage) XXX_Size() int { + return xxx_messageInfo_ExtendedTextMessage.Size(m) +} +func (m *ExtendedTextMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ExtendedTextMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtendedTextMessage proto.InternalMessageInfo + +func (m *ExtendedTextMessage) GetText() string { + if m != nil && m.Text != nil { + return *m.Text + } + return "" +} + +func (m *ExtendedTextMessage) GetMatchedText() string { + if m != nil && m.MatchedText != nil { + return *m.MatchedText + } + return "" +} + +func (m *ExtendedTextMessage) GetCanonicalUrl() string { + if m != nil && m.CanonicalUrl != nil { + return *m.CanonicalUrl + } + return "" +} + +func (m *ExtendedTextMessage) GetDescription() string { + if m != nil && m.Description != nil { + return *m.Description + } + return "" +} + +func (m *ExtendedTextMessage) GetTitle() string { + if m != nil && m.Title != nil { + return *m.Title + } + return "" +} + +func (m *ExtendedTextMessage) GetTextArgb() uint32 { + if m != nil && m.TextArgb != nil { + return *m.TextArgb + } + return 0 +} + +func (m *ExtendedTextMessage) GetBackgroundArgb() uint32 { + if m != nil && m.BackgroundArgb != nil { + return *m.BackgroundArgb + } + return 0 +} + +func (m *ExtendedTextMessage) GetFont() ExtendedTextMessage_FONTTYPE { + if m != nil && m.Font != nil { + return *m.Font + } + return ExtendedTextMessage_SANS_SERIF +} + +func (m *ExtendedTextMessage) GetJpegThumbnail() []byte { + if m != nil { + return m.JpegThumbnail + } + return nil +} + +func (m *ExtendedTextMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type DocumentMessage struct { + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + Mimetype *string `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"` + Title *string `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"` + FileSha256 []byte `protobuf:"bytes,4,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileLength *uint64 `protobuf:"varint,5,opt,name=fileLength" json:"fileLength,omitempty"` + PageCount *uint32 `protobuf:"varint,6,opt,name=pageCount" json:"pageCount,omitempty"` + MediaKey []byte `protobuf:"bytes,7,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileName *string `protobuf:"bytes,8,opt,name=fileName" json:"fileName,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,9,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + DirectPath *string `protobuf:"bytes,10,opt,name=directPath" json:"directPath,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DocumentMessage) Reset() { *m = DocumentMessage{} } +func (m *DocumentMessage) String() string { return proto.CompactTextString(m) } +func (*DocumentMessage) ProtoMessage() {} +func (*DocumentMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{8} +} +func (m *DocumentMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DocumentMessage.Unmarshal(m, b) +} +func (m *DocumentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DocumentMessage.Marshal(b, m, deterministic) +} +func (dst *DocumentMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_DocumentMessage.Merge(dst, src) +} +func (m *DocumentMessage) XXX_Size() int { + return xxx_messageInfo_DocumentMessage.Size(m) +} +func (m *DocumentMessage) XXX_DiscardUnknown() { + xxx_messageInfo_DocumentMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_DocumentMessage proto.InternalMessageInfo + +func (m *DocumentMessage) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *DocumentMessage) GetMimetype() string { + if m != nil && m.Mimetype != nil { + return *m.Mimetype + } + return "" +} + +func (m *DocumentMessage) GetTitle() string { + if m != nil && m.Title != nil { + return *m.Title + } + return "" +} + +func (m *DocumentMessage) GetFileSha256() []byte { + if m != nil { + return m.FileSha256 + } + return nil +} + +func (m *DocumentMessage) GetFileLength() uint64 { + if m != nil && m.FileLength != nil { + return *m.FileLength + } + return 0 +} + +func (m *DocumentMessage) GetPageCount() uint32 { + if m != nil && m.PageCount != nil { + return *m.PageCount + } + return 0 +} + +func (m *DocumentMessage) GetMediaKey() []byte { + if m != nil { + return m.MediaKey + } + return nil +} + +func (m *DocumentMessage) GetFileName() string { + if m != nil && m.FileName != nil { + return *m.FileName + } + return "" +} + +func (m *DocumentMessage) GetFileEncSha256() []byte { + if m != nil { + return m.FileEncSha256 + } + return nil +} + +func (m *DocumentMessage) GetDirectPath() string { + if m != nil && m.DirectPath != nil { + return *m.DirectPath + } + return "" +} + +func (m *DocumentMessage) GetJpegThumbnail() []byte { + if m != nil { + return m.JpegThumbnail + } + return nil +} + +func (m *DocumentMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type AudioMessage struct { + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + Mimetype *string `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"` + FileSha256 []byte `protobuf:"bytes,3,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileLength *uint64 `protobuf:"varint,4,opt,name=fileLength" json:"fileLength,omitempty"` + Seconds *uint32 `protobuf:"varint,5,opt,name=seconds" json:"seconds,omitempty"` + Ptt *bool `protobuf:"varint,6,opt,name=ptt" json:"ptt,omitempty"` + MediaKey []byte `protobuf:"bytes,7,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,8,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + DirectPath *string `protobuf:"bytes,9,opt,name=directPath" json:"directPath,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + StreamingSidecar []byte `protobuf:"bytes,18,opt,name=streamingSidecar" json:"streamingSidecar,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AudioMessage) Reset() { *m = AudioMessage{} } +func (m *AudioMessage) String() string { return proto.CompactTextString(m) } +func (*AudioMessage) ProtoMessage() {} +func (*AudioMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{9} +} +func (m *AudioMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AudioMessage.Unmarshal(m, b) +} +func (m *AudioMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AudioMessage.Marshal(b, m, deterministic) +} +func (dst *AudioMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_AudioMessage.Merge(dst, src) +} +func (m *AudioMessage) XXX_Size() int { + return xxx_messageInfo_AudioMessage.Size(m) +} +func (m *AudioMessage) XXX_DiscardUnknown() { + xxx_messageInfo_AudioMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_AudioMessage proto.InternalMessageInfo + +func (m *AudioMessage) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *AudioMessage) GetMimetype() string { + if m != nil && m.Mimetype != nil { + return *m.Mimetype + } + return "" +} + +func (m *AudioMessage) GetFileSha256() []byte { + if m != nil { + return m.FileSha256 + } + return nil +} + +func (m *AudioMessage) GetFileLength() uint64 { + if m != nil && m.FileLength != nil { + return *m.FileLength + } + return 0 +} + +func (m *AudioMessage) GetSeconds() uint32 { + if m != nil && m.Seconds != nil { + return *m.Seconds + } + return 0 +} + +func (m *AudioMessage) GetPtt() bool { + if m != nil && m.Ptt != nil { + return *m.Ptt + } + return false +} + +func (m *AudioMessage) GetMediaKey() []byte { + if m != nil { + return m.MediaKey + } + return nil +} + +func (m *AudioMessage) GetFileEncSha256() []byte { + if m != nil { + return m.FileEncSha256 + } + return nil +} + +func (m *AudioMessage) GetDirectPath() string { + if m != nil && m.DirectPath != nil { + return *m.DirectPath + } + return "" +} + +func (m *AudioMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +func (m *AudioMessage) GetStreamingSidecar() []byte { + if m != nil { + return m.StreamingSidecar + } + return nil +} + +type VideoMessage struct { + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + Mimetype *string `protobuf:"bytes,2,opt,name=mimetype" json:"mimetype,omitempty"` + FileSha256 []byte `protobuf:"bytes,3,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileLength *uint64 `protobuf:"varint,4,opt,name=fileLength" json:"fileLength,omitempty"` + Seconds *uint32 `protobuf:"varint,5,opt,name=seconds" json:"seconds,omitempty"` + MediaKey []byte `protobuf:"bytes,6,opt,name=mediaKey" json:"mediaKey,omitempty"` + Caption *string `protobuf:"bytes,7,opt,name=caption" json:"caption,omitempty"` + GifPlayback *bool `protobuf:"varint,8,opt,name=gifPlayback" json:"gifPlayback,omitempty"` + Height *uint32 `protobuf:"varint,9,opt,name=height" json:"height,omitempty"` + Width *uint32 `protobuf:"varint,10,opt,name=width" json:"width,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,11,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + InteractiveAnnotations []*InteractiveAnnotation `protobuf:"bytes,12,rep,name=interactiveAnnotations" json:"interactiveAnnotations,omitempty"` + DirectPath *string `protobuf:"bytes,13,opt,name=directPath" json:"directPath,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + StreamingSidecar []byte `protobuf:"bytes,18,opt,name=streamingSidecar" json:"streamingSidecar,omitempty"` + GifAttribution *VideoMessage_ATTRIBUTION `protobuf:"varint,19,opt,name=gifAttribution,enum=proto.VideoMessage_ATTRIBUTION" json:"gifAttribution,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VideoMessage) Reset() { *m = VideoMessage{} } +func (m *VideoMessage) String() string { return proto.CompactTextString(m) } +func (*VideoMessage) ProtoMessage() {} +func (*VideoMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{10} +} +func (m *VideoMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VideoMessage.Unmarshal(m, b) +} +func (m *VideoMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VideoMessage.Marshal(b, m, deterministic) +} +func (dst *VideoMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_VideoMessage.Merge(dst, src) +} +func (m *VideoMessage) XXX_Size() int { + return xxx_messageInfo_VideoMessage.Size(m) +} +func (m *VideoMessage) XXX_DiscardUnknown() { + xxx_messageInfo_VideoMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_VideoMessage proto.InternalMessageInfo + +func (m *VideoMessage) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *VideoMessage) GetMimetype() string { + if m != nil && m.Mimetype != nil { + return *m.Mimetype + } + return "" +} + +func (m *VideoMessage) GetFileSha256() []byte { + if m != nil { + return m.FileSha256 + } + return nil +} + +func (m *VideoMessage) GetFileLength() uint64 { + if m != nil && m.FileLength != nil { + return *m.FileLength + } + return 0 +} + +func (m *VideoMessage) GetSeconds() uint32 { + if m != nil && m.Seconds != nil { + return *m.Seconds + } + return 0 +} + +func (m *VideoMessage) GetMediaKey() []byte { + if m != nil { + return m.MediaKey + } + return nil +} + +func (m *VideoMessage) GetCaption() string { + if m != nil && m.Caption != nil { + return *m.Caption + } + return "" +} + +func (m *VideoMessage) GetGifPlayback() bool { + if m != nil && m.GifPlayback != nil { + return *m.GifPlayback + } + return false +} + +func (m *VideoMessage) GetHeight() uint32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +func (m *VideoMessage) GetWidth() uint32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func (m *VideoMessage) GetFileEncSha256() []byte { + if m != nil { + return m.FileEncSha256 + } + return nil +} + +func (m *VideoMessage) GetInteractiveAnnotations() []*InteractiveAnnotation { + if m != nil { + return m.InteractiveAnnotations + } + return nil +} + +func (m *VideoMessage) GetDirectPath() string { + if m != nil && m.DirectPath != nil { + return *m.DirectPath + } + return "" +} + +func (m *VideoMessage) GetJpegThumbnail() []byte { + if m != nil { + return m.JpegThumbnail + } + return nil +} + +func (m *VideoMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +func (m *VideoMessage) GetStreamingSidecar() []byte { + if m != nil { + return m.StreamingSidecar + } + return nil +} + +func (m *VideoMessage) GetGifAttribution() VideoMessage_ATTRIBUTION { + if m != nil && m.GifAttribution != nil { + return *m.GifAttribution + } + return VideoMessage_NONE +} + +type Call struct { + CallKey []byte `protobuf:"bytes,1,opt,name=callKey" json:"callKey,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Call) Reset() { *m = Call{} } +func (m *Call) String() string { return proto.CompactTextString(m) } +func (*Call) ProtoMessage() {} +func (*Call) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{11} +} +func (m *Call) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Call.Unmarshal(m, b) +} +func (m *Call) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Call.Marshal(b, m, deterministic) +} +func (dst *Call) XXX_Merge(src proto.Message) { + xxx_messageInfo_Call.Merge(dst, src) +} +func (m *Call) XXX_Size() int { + return xxx_messageInfo_Call.Size(m) +} +func (m *Call) XXX_DiscardUnknown() { + xxx_messageInfo_Call.DiscardUnknown(m) +} + +var xxx_messageInfo_Call proto.InternalMessageInfo + +func (m *Call) GetCallKey() []byte { + if m != nil { + return m.CallKey + } + return nil +} + +type Chat struct { + DisplayName *string `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"` + Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Chat) Reset() { *m = Chat{} } +func (m *Chat) String() string { return proto.CompactTextString(m) } +func (*Chat) ProtoMessage() {} +func (*Chat) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{12} +} +func (m *Chat) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Chat.Unmarshal(m, b) +} +func (m *Chat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Chat.Marshal(b, m, deterministic) +} +func (dst *Chat) XXX_Merge(src proto.Message) { + xxx_messageInfo_Chat.Merge(dst, src) +} +func (m *Chat) XXX_Size() int { + return xxx_messageInfo_Chat.Size(m) +} +func (m *Chat) XXX_DiscardUnknown() { + xxx_messageInfo_Chat.DiscardUnknown(m) +} + +var xxx_messageInfo_Chat proto.InternalMessageInfo + +func (m *Chat) GetDisplayName() string { + if m != nil && m.DisplayName != nil { + return *m.DisplayName + } + return "" +} + +func (m *Chat) GetId() string { + if m != nil && m.Id != nil { + return *m.Id + } + return "" +} + +type ProtocolMessage struct { + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Type *ProtocolMessage_TYPE `protobuf:"varint,2,opt,name=type,enum=proto.ProtocolMessage_TYPE" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProtocolMessage) Reset() { *m = ProtocolMessage{} } +func (m *ProtocolMessage) String() string { return proto.CompactTextString(m) } +func (*ProtocolMessage) ProtoMessage() {} +func (*ProtocolMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{13} +} +func (m *ProtocolMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProtocolMessage.Unmarshal(m, b) +} +func (m *ProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProtocolMessage.Marshal(b, m, deterministic) +} +func (dst *ProtocolMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtocolMessage.Merge(dst, src) +} +func (m *ProtocolMessage) XXX_Size() int { + return xxx_messageInfo_ProtocolMessage.Size(m) +} +func (m *ProtocolMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ProtocolMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtocolMessage proto.InternalMessageInfo + +func (m *ProtocolMessage) GetKey() *MessageKey { + if m != nil { + return m.Key + } + return nil +} + +func (m *ProtocolMessage) GetType() ProtocolMessage_TYPE { + if m != nil && m.Type != nil { + return *m.Type + } + return ProtocolMessage_REVOKE +} + +type ContactsArrayMessage struct { + DisplayName *string `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"` + Contacts []*ContactMessage `protobuf:"bytes,2,rep,name=contacts" json:"contacts,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ContactsArrayMessage) Reset() { *m = ContactsArrayMessage{} } +func (m *ContactsArrayMessage) String() string { return proto.CompactTextString(m) } +func (*ContactsArrayMessage) ProtoMessage() {} +func (*ContactsArrayMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{14} +} +func (m *ContactsArrayMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ContactsArrayMessage.Unmarshal(m, b) +} +func (m *ContactsArrayMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ContactsArrayMessage.Marshal(b, m, deterministic) +} +func (dst *ContactsArrayMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContactsArrayMessage.Merge(dst, src) +} +func (m *ContactsArrayMessage) XXX_Size() int { + return xxx_messageInfo_ContactsArrayMessage.Size(m) +} +func (m *ContactsArrayMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ContactsArrayMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ContactsArrayMessage proto.InternalMessageInfo + +func (m *ContactsArrayMessage) GetDisplayName() string { + if m != nil && m.DisplayName != nil { + return *m.DisplayName + } + return "" +} + +func (m *ContactsArrayMessage) GetContacts() []*ContactMessage { + if m != nil { + return m.Contacts + } + return nil +} + +func (m *ContactsArrayMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type HSMCurrency struct { + CurrencyCode *string `protobuf:"bytes,1,opt,name=currencyCode" json:"currencyCode,omitempty"` + Amount1000 *int64 `protobuf:"varint,2,opt,name=amount1000" json:"amount1000,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HSMCurrency) Reset() { *m = HSMCurrency{} } +func (m *HSMCurrency) String() string { return proto.CompactTextString(m) } +func (*HSMCurrency) ProtoMessage() {} +func (*HSMCurrency) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{15} +} +func (m *HSMCurrency) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HSMCurrency.Unmarshal(m, b) +} +func (m *HSMCurrency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HSMCurrency.Marshal(b, m, deterministic) +} +func (dst *HSMCurrency) XXX_Merge(src proto.Message) { + xxx_messageInfo_HSMCurrency.Merge(dst, src) +} +func (m *HSMCurrency) XXX_Size() int { + return xxx_messageInfo_HSMCurrency.Size(m) +} +func (m *HSMCurrency) XXX_DiscardUnknown() { + xxx_messageInfo_HSMCurrency.DiscardUnknown(m) +} + +var xxx_messageInfo_HSMCurrency proto.InternalMessageInfo + +func (m *HSMCurrency) GetCurrencyCode() string { + if m != nil && m.CurrencyCode != nil { + return *m.CurrencyCode + } + return "" +} + +func (m *HSMCurrency) GetAmount1000() int64 { + if m != nil && m.Amount1000 != nil { + return *m.Amount1000 + } + return 0 +} + +type HSMDateTimeComponent struct { + DayOfWeek *HSMDateTimeComponent_DAYOFWEEKTYPE `protobuf:"varint,1,opt,name=dayOfWeek,enum=proto.HSMDateTimeComponent_DAYOFWEEKTYPE" json:"dayOfWeek,omitempty"` + Year *uint32 `protobuf:"varint,2,opt,name=year" json:"year,omitempty"` + Month *uint32 `protobuf:"varint,3,opt,name=month" json:"month,omitempty"` + DayOfMonth *uint32 `protobuf:"varint,4,opt,name=dayOfMonth" json:"dayOfMonth,omitempty"` + Hour *uint32 `protobuf:"varint,5,opt,name=hour" json:"hour,omitempty"` + Minute *uint32 `protobuf:"varint,6,opt,name=minute" json:"minute,omitempty"` + Calendar *HSMDateTimeComponent_CALENDARTYPE `protobuf:"varint,7,opt,name=calendar,enum=proto.HSMDateTimeComponent_CALENDARTYPE" json:"calendar,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HSMDateTimeComponent) Reset() { *m = HSMDateTimeComponent{} } +func (m *HSMDateTimeComponent) String() string { return proto.CompactTextString(m) } +func (*HSMDateTimeComponent) ProtoMessage() {} +func (*HSMDateTimeComponent) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{16} +} +func (m *HSMDateTimeComponent) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HSMDateTimeComponent.Unmarshal(m, b) +} +func (m *HSMDateTimeComponent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HSMDateTimeComponent.Marshal(b, m, deterministic) +} +func (dst *HSMDateTimeComponent) XXX_Merge(src proto.Message) { + xxx_messageInfo_HSMDateTimeComponent.Merge(dst, src) +} +func (m *HSMDateTimeComponent) XXX_Size() int { + return xxx_messageInfo_HSMDateTimeComponent.Size(m) +} +func (m *HSMDateTimeComponent) XXX_DiscardUnknown() { + xxx_messageInfo_HSMDateTimeComponent.DiscardUnknown(m) +} + +var xxx_messageInfo_HSMDateTimeComponent proto.InternalMessageInfo + +func (m *HSMDateTimeComponent) GetDayOfWeek() HSMDateTimeComponent_DAYOFWEEKTYPE { + if m != nil && m.DayOfWeek != nil { + return *m.DayOfWeek + } + return HSMDateTimeComponent_MONDAY +} + +func (m *HSMDateTimeComponent) GetYear() uint32 { + if m != nil && m.Year != nil { + return *m.Year + } + return 0 +} + +func (m *HSMDateTimeComponent) GetMonth() uint32 { + if m != nil && m.Month != nil { + return *m.Month + } + return 0 +} + +func (m *HSMDateTimeComponent) GetDayOfMonth() uint32 { + if m != nil && m.DayOfMonth != nil { + return *m.DayOfMonth + } + return 0 +} + +func (m *HSMDateTimeComponent) GetHour() uint32 { + if m != nil && m.Hour != nil { + return *m.Hour + } + return 0 +} + +func (m *HSMDateTimeComponent) GetMinute() uint32 { + if m != nil && m.Minute != nil { + return *m.Minute + } + return 0 +} + +func (m *HSMDateTimeComponent) GetCalendar() HSMDateTimeComponent_CALENDARTYPE { + if m != nil && m.Calendar != nil { + return *m.Calendar + } + return HSMDateTimeComponent_GREGORIAN +} + +type HSMDateTimeUnixEpoch struct { + Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HSMDateTimeUnixEpoch) Reset() { *m = HSMDateTimeUnixEpoch{} } +func (m *HSMDateTimeUnixEpoch) String() string { return proto.CompactTextString(m) } +func (*HSMDateTimeUnixEpoch) ProtoMessage() {} +func (*HSMDateTimeUnixEpoch) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{17} +} +func (m *HSMDateTimeUnixEpoch) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HSMDateTimeUnixEpoch.Unmarshal(m, b) +} +func (m *HSMDateTimeUnixEpoch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HSMDateTimeUnixEpoch.Marshal(b, m, deterministic) +} +func (dst *HSMDateTimeUnixEpoch) XXX_Merge(src proto.Message) { + xxx_messageInfo_HSMDateTimeUnixEpoch.Merge(dst, src) +} +func (m *HSMDateTimeUnixEpoch) XXX_Size() int { + return xxx_messageInfo_HSMDateTimeUnixEpoch.Size(m) +} +func (m *HSMDateTimeUnixEpoch) XXX_DiscardUnknown() { + xxx_messageInfo_HSMDateTimeUnixEpoch.DiscardUnknown(m) +} + +var xxx_messageInfo_HSMDateTimeUnixEpoch proto.InternalMessageInfo + +func (m *HSMDateTimeUnixEpoch) GetTimestamp() int64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +type HSMDateTime struct { + // Types that are valid to be assigned to DatetimeOneof: + // *HSMDateTime_Component + // *HSMDateTime_UnixEpoch + DatetimeOneof isHSMDateTime_DatetimeOneof `protobuf_oneof:"datetimeOneof"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HSMDateTime) Reset() { *m = HSMDateTime{} } +func (m *HSMDateTime) String() string { return proto.CompactTextString(m) } +func (*HSMDateTime) ProtoMessage() {} +func (*HSMDateTime) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{18} +} +func (m *HSMDateTime) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HSMDateTime.Unmarshal(m, b) +} +func (m *HSMDateTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HSMDateTime.Marshal(b, m, deterministic) +} +func (dst *HSMDateTime) XXX_Merge(src proto.Message) { + xxx_messageInfo_HSMDateTime.Merge(dst, src) +} +func (m *HSMDateTime) XXX_Size() int { + return xxx_messageInfo_HSMDateTime.Size(m) +} +func (m *HSMDateTime) XXX_DiscardUnknown() { + xxx_messageInfo_HSMDateTime.DiscardUnknown(m) +} + +var xxx_messageInfo_HSMDateTime proto.InternalMessageInfo + +type isHSMDateTime_DatetimeOneof interface { + isHSMDateTime_DatetimeOneof() +} + +type HSMDateTime_Component struct { + Component *HSMDateTimeComponent `protobuf:"bytes,1,opt,name=component,oneof"` +} +type HSMDateTime_UnixEpoch struct { + UnixEpoch *HSMDateTimeUnixEpoch `protobuf:"bytes,2,opt,name=unixEpoch,oneof"` +} + +func (*HSMDateTime_Component) isHSMDateTime_DatetimeOneof() {} +func (*HSMDateTime_UnixEpoch) isHSMDateTime_DatetimeOneof() {} + +func (m *HSMDateTime) GetDatetimeOneof() isHSMDateTime_DatetimeOneof { + if m != nil { + return m.DatetimeOneof + } + return nil +} + +func (m *HSMDateTime) GetComponent() *HSMDateTimeComponent { + if x, ok := m.GetDatetimeOneof().(*HSMDateTime_Component); ok { + return x.Component + } + return nil +} + +func (m *HSMDateTime) GetUnixEpoch() *HSMDateTimeUnixEpoch { + if x, ok := m.GetDatetimeOneof().(*HSMDateTime_UnixEpoch); ok { + return x.UnixEpoch + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HSMDateTime) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HSMDateTime_OneofMarshaler, _HSMDateTime_OneofUnmarshaler, _HSMDateTime_OneofSizer, []interface{}{ + (*HSMDateTime_Component)(nil), + (*HSMDateTime_UnixEpoch)(nil), + } +} + +func _HSMDateTime_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HSMDateTime) + // datetimeOneof + switch x := m.DatetimeOneof.(type) { + case *HSMDateTime_Component: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Component); err != nil { + return err + } + case *HSMDateTime_UnixEpoch: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UnixEpoch); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("HSMDateTime.DatetimeOneof has unexpected type %T", x) + } + return nil +} + +func _HSMDateTime_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HSMDateTime) + switch tag { + case 1: // datetimeOneof.component + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HSMDateTimeComponent) + err := b.DecodeMessage(msg) + m.DatetimeOneof = &HSMDateTime_Component{msg} + return true, err + case 2: // datetimeOneof.unixEpoch + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HSMDateTimeUnixEpoch) + err := b.DecodeMessage(msg) + m.DatetimeOneof = &HSMDateTime_UnixEpoch{msg} + return true, err + default: + return false, nil + } +} + +func _HSMDateTime_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HSMDateTime) + // datetimeOneof + switch x := m.DatetimeOneof.(type) { + case *HSMDateTime_Component: + s := proto.Size(x.Component) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HSMDateTime_UnixEpoch: + s := proto.Size(x.UnixEpoch) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type HSMLocalizableParameter struct { + Default *string `protobuf:"bytes,1,opt,name=default" json:"default,omitempty"` + // Types that are valid to be assigned to ParamOneof: + // *HSMLocalizableParameter_Currency + // *HSMLocalizableParameter_DateTime + ParamOneof isHSMLocalizableParameter_ParamOneof `protobuf_oneof:"paramOneof"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HSMLocalizableParameter) Reset() { *m = HSMLocalizableParameter{} } +func (m *HSMLocalizableParameter) String() string { return proto.CompactTextString(m) } +func (*HSMLocalizableParameter) ProtoMessage() {} +func (*HSMLocalizableParameter) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{19} +} +func (m *HSMLocalizableParameter) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HSMLocalizableParameter.Unmarshal(m, b) +} +func (m *HSMLocalizableParameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HSMLocalizableParameter.Marshal(b, m, deterministic) +} +func (dst *HSMLocalizableParameter) XXX_Merge(src proto.Message) { + xxx_messageInfo_HSMLocalizableParameter.Merge(dst, src) +} +func (m *HSMLocalizableParameter) XXX_Size() int { + return xxx_messageInfo_HSMLocalizableParameter.Size(m) +} +func (m *HSMLocalizableParameter) XXX_DiscardUnknown() { + xxx_messageInfo_HSMLocalizableParameter.DiscardUnknown(m) +} + +var xxx_messageInfo_HSMLocalizableParameter proto.InternalMessageInfo + +type isHSMLocalizableParameter_ParamOneof interface { + isHSMLocalizableParameter_ParamOneof() +} + +type HSMLocalizableParameter_Currency struct { + Currency *HSMCurrency `protobuf:"bytes,2,opt,name=currency,oneof"` +} +type HSMLocalizableParameter_DateTime struct { + DateTime *HSMDateTime `protobuf:"bytes,3,opt,name=dateTime,oneof"` +} + +func (*HSMLocalizableParameter_Currency) isHSMLocalizableParameter_ParamOneof() {} +func (*HSMLocalizableParameter_DateTime) isHSMLocalizableParameter_ParamOneof() {} + +func (m *HSMLocalizableParameter) GetParamOneof() isHSMLocalizableParameter_ParamOneof { + if m != nil { + return m.ParamOneof + } + return nil +} + +func (m *HSMLocalizableParameter) GetDefault() string { + if m != nil && m.Default != nil { + return *m.Default + } + return "" +} + +func (m *HSMLocalizableParameter) GetCurrency() *HSMCurrency { + if x, ok := m.GetParamOneof().(*HSMLocalizableParameter_Currency); ok { + return x.Currency + } + return nil +} + +func (m *HSMLocalizableParameter) GetDateTime() *HSMDateTime { + if x, ok := m.GetParamOneof().(*HSMLocalizableParameter_DateTime); ok { + return x.DateTime + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*HSMLocalizableParameter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _HSMLocalizableParameter_OneofMarshaler, _HSMLocalizableParameter_OneofUnmarshaler, _HSMLocalizableParameter_OneofSizer, []interface{}{ + (*HSMLocalizableParameter_Currency)(nil), + (*HSMLocalizableParameter_DateTime)(nil), + } +} + +func _HSMLocalizableParameter_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*HSMLocalizableParameter) + // paramOneof + switch x := m.ParamOneof.(type) { + case *HSMLocalizableParameter_Currency: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Currency); err != nil { + return err + } + case *HSMLocalizableParameter_DateTime: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DateTime); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("HSMLocalizableParameter.ParamOneof has unexpected type %T", x) + } + return nil +} + +func _HSMLocalizableParameter_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*HSMLocalizableParameter) + switch tag { + case 2: // paramOneof.currency + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HSMCurrency) + err := b.DecodeMessage(msg) + m.ParamOneof = &HSMLocalizableParameter_Currency{msg} + return true, err + case 3: // paramOneof.dateTime + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(HSMDateTime) + err := b.DecodeMessage(msg) + m.ParamOneof = &HSMLocalizableParameter_DateTime{msg} + return true, err + default: + return false, nil + } +} + +func _HSMLocalizableParameter_OneofSizer(msg proto.Message) (n int) { + m := msg.(*HSMLocalizableParameter) + // paramOneof + switch x := m.ParamOneof.(type) { + case *HSMLocalizableParameter_Currency: + s := proto.Size(x.Currency) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *HSMLocalizableParameter_DateTime: + s := proto.Size(x.DateTime) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type HighlyStructuredMessage struct { + Namespace *string `protobuf:"bytes,1,opt,name=namespace" json:"namespace,omitempty"` + ElementName *string `protobuf:"bytes,2,opt,name=elementName" json:"elementName,omitempty"` + Params []string `protobuf:"bytes,3,rep,name=params" json:"params,omitempty"` + FallbackLg *string `protobuf:"bytes,4,opt,name=fallbackLg" json:"fallbackLg,omitempty"` + FallbackLc *string `protobuf:"bytes,5,opt,name=fallbackLc" json:"fallbackLc,omitempty"` + LocalizableParams []*HSMLocalizableParameter `protobuf:"bytes,6,rep,name=localizableParams" json:"localizableParams,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HighlyStructuredMessage) Reset() { *m = HighlyStructuredMessage{} } +func (m *HighlyStructuredMessage) String() string { return proto.CompactTextString(m) } +func (*HighlyStructuredMessage) ProtoMessage() {} +func (*HighlyStructuredMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{20} +} +func (m *HighlyStructuredMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HighlyStructuredMessage.Unmarshal(m, b) +} +func (m *HighlyStructuredMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HighlyStructuredMessage.Marshal(b, m, deterministic) +} +func (dst *HighlyStructuredMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_HighlyStructuredMessage.Merge(dst, src) +} +func (m *HighlyStructuredMessage) XXX_Size() int { + return xxx_messageInfo_HighlyStructuredMessage.Size(m) +} +func (m *HighlyStructuredMessage) XXX_DiscardUnknown() { + xxx_messageInfo_HighlyStructuredMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_HighlyStructuredMessage proto.InternalMessageInfo + +func (m *HighlyStructuredMessage) GetNamespace() string { + if m != nil && m.Namespace != nil { + return *m.Namespace + } + return "" +} + +func (m *HighlyStructuredMessage) GetElementName() string { + if m != nil && m.ElementName != nil { + return *m.ElementName + } + return "" +} + +func (m *HighlyStructuredMessage) GetParams() []string { + if m != nil { + return m.Params + } + return nil +} + +func (m *HighlyStructuredMessage) GetFallbackLg() string { + if m != nil && m.FallbackLg != nil { + return *m.FallbackLg + } + return "" +} + +func (m *HighlyStructuredMessage) GetFallbackLc() string { + if m != nil && m.FallbackLc != nil { + return *m.FallbackLc + } + return "" +} + +func (m *HighlyStructuredMessage) GetLocalizableParams() []*HSMLocalizableParameter { + if m != nil { + return m.LocalizableParams + } + return nil +} + +type SendPaymentMessage struct { + NoteMessage *Message `protobuf:"bytes,2,opt,name=noteMessage" json:"noteMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SendPaymentMessage) Reset() { *m = SendPaymentMessage{} } +func (m *SendPaymentMessage) String() string { return proto.CompactTextString(m) } +func (*SendPaymentMessage) ProtoMessage() {} +func (*SendPaymentMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{21} +} +func (m *SendPaymentMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendPaymentMessage.Unmarshal(m, b) +} +func (m *SendPaymentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendPaymentMessage.Marshal(b, m, deterministic) +} +func (dst *SendPaymentMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendPaymentMessage.Merge(dst, src) +} +func (m *SendPaymentMessage) XXX_Size() int { + return xxx_messageInfo_SendPaymentMessage.Size(m) +} +func (m *SendPaymentMessage) XXX_DiscardUnknown() { + xxx_messageInfo_SendPaymentMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_SendPaymentMessage proto.InternalMessageInfo + +func (m *SendPaymentMessage) GetNoteMessage() *Message { + if m != nil { + return m.NoteMessage + } + return nil +} + +type RequestPaymentMessage struct { + CurrencyCodeIso4217 *string `protobuf:"bytes,1,opt,name=currencyCodeIso4217" json:"currencyCodeIso4217,omitempty"` + Amount1000 *uint64 `protobuf:"varint,2,opt,name=amount1000" json:"amount1000,omitempty"` + RequestFrom *string `protobuf:"bytes,3,opt,name=requestFrom" json:"requestFrom,omitempty"` + NoteMessage *Message `protobuf:"bytes,4,opt,name=noteMessage" json:"noteMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestPaymentMessage) Reset() { *m = RequestPaymentMessage{} } +func (m *RequestPaymentMessage) String() string { return proto.CompactTextString(m) } +func (*RequestPaymentMessage) ProtoMessage() {} +func (*RequestPaymentMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{22} +} +func (m *RequestPaymentMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RequestPaymentMessage.Unmarshal(m, b) +} +func (m *RequestPaymentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RequestPaymentMessage.Marshal(b, m, deterministic) +} +func (dst *RequestPaymentMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestPaymentMessage.Merge(dst, src) +} +func (m *RequestPaymentMessage) XXX_Size() int { + return xxx_messageInfo_RequestPaymentMessage.Size(m) +} +func (m *RequestPaymentMessage) XXX_DiscardUnknown() { + xxx_messageInfo_RequestPaymentMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestPaymentMessage proto.InternalMessageInfo + +func (m *RequestPaymentMessage) GetCurrencyCodeIso4217() string { + if m != nil && m.CurrencyCodeIso4217 != nil { + return *m.CurrencyCodeIso4217 + } + return "" +} + +func (m *RequestPaymentMessage) GetAmount1000() uint64 { + if m != nil && m.Amount1000 != nil { + return *m.Amount1000 + } + return 0 +} + +func (m *RequestPaymentMessage) GetRequestFrom() string { + if m != nil && m.RequestFrom != nil { + return *m.RequestFrom + } + return "" +} + +func (m *RequestPaymentMessage) GetNoteMessage() *Message { + if m != nil { + return m.NoteMessage + } + return nil +} + +type LiveLocationMessage struct { + DegreesLatitude *float64 `protobuf:"fixed64,1,opt,name=degreesLatitude" json:"degreesLatitude,omitempty"` + DegreesLongitude *float64 `protobuf:"fixed64,2,opt,name=degreesLongitude" json:"degreesLongitude,omitempty"` + AccuracyInMeters *uint32 `protobuf:"varint,3,opt,name=accuracyInMeters" json:"accuracyInMeters,omitempty"` + SpeedInMps *float32 `protobuf:"fixed32,4,opt,name=speedInMps" json:"speedInMps,omitempty"` + DegreesClockwiseFromMagneticNorth *uint32 `protobuf:"varint,5,opt,name=degreesClockwiseFromMagneticNorth" json:"degreesClockwiseFromMagneticNorth,omitempty"` + Caption *string `protobuf:"bytes,6,opt,name=caption" json:"caption,omitempty"` + SequenceNumber *int64 `protobuf:"varint,7,opt,name=sequenceNumber" json:"sequenceNumber,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LiveLocationMessage) Reset() { *m = LiveLocationMessage{} } +func (m *LiveLocationMessage) String() string { return proto.CompactTextString(m) } +func (*LiveLocationMessage) ProtoMessage() {} +func (*LiveLocationMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{23} +} +func (m *LiveLocationMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LiveLocationMessage.Unmarshal(m, b) +} +func (m *LiveLocationMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LiveLocationMessage.Marshal(b, m, deterministic) +} +func (dst *LiveLocationMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_LiveLocationMessage.Merge(dst, src) +} +func (m *LiveLocationMessage) XXX_Size() int { + return xxx_messageInfo_LiveLocationMessage.Size(m) +} +func (m *LiveLocationMessage) XXX_DiscardUnknown() { + xxx_messageInfo_LiveLocationMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_LiveLocationMessage proto.InternalMessageInfo + +func (m *LiveLocationMessage) GetDegreesLatitude() float64 { + if m != nil && m.DegreesLatitude != nil { + return *m.DegreesLatitude + } + return 0 +} + +func (m *LiveLocationMessage) GetDegreesLongitude() float64 { + if m != nil && m.DegreesLongitude != nil { + return *m.DegreesLongitude + } + return 0 +} + +func (m *LiveLocationMessage) GetAccuracyInMeters() uint32 { + if m != nil && m.AccuracyInMeters != nil { + return *m.AccuracyInMeters + } + return 0 +} + +func (m *LiveLocationMessage) GetSpeedInMps() float32 { + if m != nil && m.SpeedInMps != nil { + return *m.SpeedInMps + } + return 0 +} + +func (m *LiveLocationMessage) GetDegreesClockwiseFromMagneticNorth() uint32 { + if m != nil && m.DegreesClockwiseFromMagneticNorth != nil { + return *m.DegreesClockwiseFromMagneticNorth + } + return 0 +} + +func (m *LiveLocationMessage) GetCaption() string { + if m != nil && m.Caption != nil { + return *m.Caption + } + return "" +} + +func (m *LiveLocationMessage) GetSequenceNumber() int64 { + if m != nil && m.SequenceNumber != nil { + return *m.SequenceNumber + } + return 0 +} + +func (m *LiveLocationMessage) GetJpegThumbnail() []byte { + if m != nil { + return m.JpegThumbnail + } + return nil +} + +func (m *LiveLocationMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type StickerMessage struct { + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + FileSha256 []byte `protobuf:"bytes,2,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,3,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + MediaKey []byte `protobuf:"bytes,4,opt,name=mediaKey" json:"mediaKey,omitempty"` + Mimetype *string `protobuf:"bytes,5,opt,name=mimetype" json:"mimetype,omitempty"` + Height *uint32 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` + Width *uint32 `protobuf:"varint,7,opt,name=width" json:"width,omitempty"` + DirectPath *string `protobuf:"bytes,8,opt,name=directPath" json:"directPath,omitempty"` + FileLength *uint64 `protobuf:"varint,9,opt,name=fileLength" json:"fileLength,omitempty"` + PngThumbnail []byte `protobuf:"bytes,16,opt,name=pngThumbnail" json:"pngThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StickerMessage) Reset() { *m = StickerMessage{} } +func (m *StickerMessage) String() string { return proto.CompactTextString(m) } +func (*StickerMessage) ProtoMessage() {} +func (*StickerMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{24} +} +func (m *StickerMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StickerMessage.Unmarshal(m, b) +} +func (m *StickerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StickerMessage.Marshal(b, m, deterministic) +} +func (dst *StickerMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_StickerMessage.Merge(dst, src) +} +func (m *StickerMessage) XXX_Size() int { + return xxx_messageInfo_StickerMessage.Size(m) +} +func (m *StickerMessage) XXX_DiscardUnknown() { + xxx_messageInfo_StickerMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_StickerMessage proto.InternalMessageInfo + +func (m *StickerMessage) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *StickerMessage) GetFileSha256() []byte { + if m != nil { + return m.FileSha256 + } + return nil +} + +func (m *StickerMessage) GetFileEncSha256() []byte { + if m != nil { + return m.FileEncSha256 + } + return nil +} + +func (m *StickerMessage) GetMediaKey() []byte { + if m != nil { + return m.MediaKey + } + return nil +} + +func (m *StickerMessage) GetMimetype() string { + if m != nil && m.Mimetype != nil { + return *m.Mimetype + } + return "" +} + +func (m *StickerMessage) GetHeight() uint32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +func (m *StickerMessage) GetWidth() uint32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func (m *StickerMessage) GetDirectPath() string { + if m != nil && m.DirectPath != nil { + return *m.DirectPath + } + return "" +} + +func (m *StickerMessage) GetFileLength() uint64 { + if m != nil && m.FileLength != nil { + return *m.FileLength + } + return 0 +} + +func (m *StickerMessage) GetPngThumbnail() []byte { + if m != nil { + return m.PngThumbnail + } + return nil +} + +func (m *StickerMessage) GetContextInfo() *ContextInfo { + if m != nil { + return m.ContextInfo + } + return nil +} + +type Message struct { + Conversation *string `protobuf:"bytes,1,opt,name=conversation" json:"conversation,omitempty"` + SenderKeyDistributionMessage *SenderKeyDistributionMessage `protobuf:"bytes,2,opt,name=senderKeyDistributionMessage" json:"senderKeyDistributionMessage,omitempty"` + ImageMessage *ImageMessage `protobuf:"bytes,3,opt,name=imageMessage" json:"imageMessage,omitempty"` + ContactMessage *ContactMessage `protobuf:"bytes,4,opt,name=contactMessage" json:"contactMessage,omitempty"` + LocationMessage *LocationMessage `protobuf:"bytes,5,opt,name=locationMessage" json:"locationMessage,omitempty"` + ExtendedTextMessage *ExtendedTextMessage `protobuf:"bytes,6,opt,name=extendedTextMessage" json:"extendedTextMessage,omitempty"` + DocumentMessage *DocumentMessage `protobuf:"bytes,7,opt,name=documentMessage" json:"documentMessage,omitempty"` + AudioMessage *AudioMessage `protobuf:"bytes,8,opt,name=audioMessage" json:"audioMessage,omitempty"` + VideoMessage *VideoMessage `protobuf:"bytes,9,opt,name=videoMessage" json:"videoMessage,omitempty"` + Call *Call `protobuf:"bytes,10,opt,name=call" json:"call,omitempty"` + Chat *Chat `protobuf:"bytes,11,opt,name=chat" json:"chat,omitempty"` + ProtocolMessage *ProtocolMessage `protobuf:"bytes,12,opt,name=protocolMessage" json:"protocolMessage,omitempty"` + ContactsArrayMessage *ContactsArrayMessage `protobuf:"bytes,13,opt,name=contactsArrayMessage" json:"contactsArrayMessage,omitempty"` + HighlyStructuredMessage *HighlyStructuredMessage `protobuf:"bytes,14,opt,name=highlyStructuredMessage" json:"highlyStructuredMessage,omitempty"` + FastRatchetKeySenderKeyDistributionMessage *SenderKeyDistributionMessage `protobuf:"bytes,15,opt,name=fastRatchetKeySenderKeyDistributionMessage" json:"fastRatchetKeySenderKeyDistributionMessage,omitempty"` + SendPaymentMessage *SendPaymentMessage `protobuf:"bytes,16,opt,name=sendPaymentMessage" json:"sendPaymentMessage,omitempty"` + RequestPaymentMessage *RequestPaymentMessage `protobuf:"bytes,17,opt,name=requestPaymentMessage" json:"requestPaymentMessage,omitempty"` + LiveLocationMessage *LiveLocationMessage `protobuf:"bytes,18,opt,name=liveLocationMessage" json:"liveLocationMessage,omitempty"` + StickerMessage *StickerMessage `protobuf:"bytes,20,opt,name=stickerMessage" json:"stickerMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{25} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Message.Unmarshal(m, b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) +} +func (dst *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(dst, src) +} +func (m *Message) XXX_Size() int { + return xxx_messageInfo_Message.Size(m) +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo + +func (m *Message) GetConversation() string { + if m != nil && m.Conversation != nil { + return *m.Conversation + } + return "" +} + +func (m *Message) GetSenderKeyDistributionMessage() *SenderKeyDistributionMessage { + if m != nil { + return m.SenderKeyDistributionMessage + } + return nil +} + +func (m *Message) GetImageMessage() *ImageMessage { + if m != nil { + return m.ImageMessage + } + return nil +} + +func (m *Message) GetContactMessage() *ContactMessage { + if m != nil { + return m.ContactMessage + } + return nil +} + +func (m *Message) GetLocationMessage() *LocationMessage { + if m != nil { + return m.LocationMessage + } + return nil +} + +func (m *Message) GetExtendedTextMessage() *ExtendedTextMessage { + if m != nil { + return m.ExtendedTextMessage + } + return nil +} + +func (m *Message) GetDocumentMessage() *DocumentMessage { + if m != nil { + return m.DocumentMessage + } + return nil +} + +func (m *Message) GetAudioMessage() *AudioMessage { + if m != nil { + return m.AudioMessage + } + return nil +} + +func (m *Message) GetVideoMessage() *VideoMessage { + if m != nil { + return m.VideoMessage + } + return nil +} + +func (m *Message) GetCall() *Call { + if m != nil { + return m.Call + } + return nil +} + +func (m *Message) GetChat() *Chat { + if m != nil { + return m.Chat + } + return nil +} + +func (m *Message) GetProtocolMessage() *ProtocolMessage { + if m != nil { + return m.ProtocolMessage + } + return nil +} + +func (m *Message) GetContactsArrayMessage() *ContactsArrayMessage { + if m != nil { + return m.ContactsArrayMessage + } + return nil +} + +func (m *Message) GetHighlyStructuredMessage() *HighlyStructuredMessage { + if m != nil { + return m.HighlyStructuredMessage + } + return nil +} + +func (m *Message) GetFastRatchetKeySenderKeyDistributionMessage() *SenderKeyDistributionMessage { + if m != nil { + return m.FastRatchetKeySenderKeyDistributionMessage + } + return nil +} + +func (m *Message) GetSendPaymentMessage() *SendPaymentMessage { + if m != nil { + return m.SendPaymentMessage + } + return nil +} + +func (m *Message) GetRequestPaymentMessage() *RequestPaymentMessage { + if m != nil { + return m.RequestPaymentMessage + } + return nil +} + +func (m *Message) GetLiveLocationMessage() *LiveLocationMessage { + if m != nil { + return m.LiveLocationMessage + } + return nil +} + +func (m *Message) GetStickerMessage() *StickerMessage { + if m != nil { + return m.StickerMessage + } + return nil +} + +type ContextInfo struct { + StanzaId *string `protobuf:"bytes,1,opt,name=stanzaId" json:"stanzaId,omitempty"` + Participant *string `protobuf:"bytes,2,opt,name=participant" json:"participant,omitempty"` + QuotedMessage []*Message `protobuf:"bytes,3,rep,name=quotedMessage" json:"quotedMessage,omitempty"` + RemoteJid *string `protobuf:"bytes,4,opt,name=remoteJid" json:"remoteJid,omitempty"` + MentionedJid []string `protobuf:"bytes,15,rep,name=mentionedJid" json:"mentionedJid,omitempty"` + ConversionSource *string `protobuf:"bytes,18,opt,name=conversionSource" json:"conversionSource,omitempty"` + ConversionData []byte `protobuf:"bytes,19,opt,name=conversionData" json:"conversionData,omitempty"` + ConversionDelaySeconds *uint32 `protobuf:"varint,20,opt,name=conversionDelaySeconds" json:"conversionDelaySeconds,omitempty"` + IsForwarded *bool `protobuf:"varint,22,opt,name=isForwarded" json:"isForwarded,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ContextInfo) Reset() { *m = ContextInfo{} } +func (m *ContextInfo) String() string { return proto.CompactTextString(m) } +func (*ContextInfo) ProtoMessage() {} +func (*ContextInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{26} +} +func (m *ContextInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ContextInfo.Unmarshal(m, b) +} +func (m *ContextInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ContextInfo.Marshal(b, m, deterministic) +} +func (dst *ContextInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContextInfo.Merge(dst, src) +} +func (m *ContextInfo) XXX_Size() int { + return xxx_messageInfo_ContextInfo.Size(m) +} +func (m *ContextInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ContextInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ContextInfo proto.InternalMessageInfo + +func (m *ContextInfo) GetStanzaId() string { + if m != nil && m.StanzaId != nil { + return *m.StanzaId + } + return "" +} + +func (m *ContextInfo) GetParticipant() string { + if m != nil && m.Participant != nil { + return *m.Participant + } + return "" +} + +func (m *ContextInfo) GetQuotedMessage() []*Message { + if m != nil { + return m.QuotedMessage + } + return nil +} + +func (m *ContextInfo) GetRemoteJid() string { + if m != nil && m.RemoteJid != nil { + return *m.RemoteJid + } + return "" +} + +func (m *ContextInfo) GetMentionedJid() []string { + if m != nil { + return m.MentionedJid + } + return nil +} + +func (m *ContextInfo) GetConversionSource() string { + if m != nil && m.ConversionSource != nil { + return *m.ConversionSource + } + return "" +} + +func (m *ContextInfo) GetConversionData() []byte { + if m != nil { + return m.ConversionData + } + return nil +} + +func (m *ContextInfo) GetConversionDelaySeconds() uint32 { + if m != nil && m.ConversionDelaySeconds != nil { + return *m.ConversionDelaySeconds + } + return 0 +} + +func (m *ContextInfo) GetIsForwarded() bool { + if m != nil && m.IsForwarded != nil { + return *m.IsForwarded + } + return false +} + +type InteractiveAnnotation struct { + PolygonVertices []*Point `protobuf:"bytes,1,rep,name=polygonVertices" json:"polygonVertices,omitempty"` + // Types that are valid to be assigned to Action: + // *InteractiveAnnotation_Location + Action isInteractiveAnnotation_Action `protobuf_oneof:"action"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InteractiveAnnotation) Reset() { *m = InteractiveAnnotation{} } +func (m *InteractiveAnnotation) String() string { return proto.CompactTextString(m) } +func (*InteractiveAnnotation) ProtoMessage() {} +func (*InteractiveAnnotation) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{27} +} +func (m *InteractiveAnnotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InteractiveAnnotation.Unmarshal(m, b) +} +func (m *InteractiveAnnotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InteractiveAnnotation.Marshal(b, m, deterministic) +} +func (dst *InteractiveAnnotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_InteractiveAnnotation.Merge(dst, src) +} +func (m *InteractiveAnnotation) XXX_Size() int { + return xxx_messageInfo_InteractiveAnnotation.Size(m) +} +func (m *InteractiveAnnotation) XXX_DiscardUnknown() { + xxx_messageInfo_InteractiveAnnotation.DiscardUnknown(m) +} + +var xxx_messageInfo_InteractiveAnnotation proto.InternalMessageInfo + +type isInteractiveAnnotation_Action interface { + isInteractiveAnnotation_Action() +} + +type InteractiveAnnotation_Location struct { + Location *Location `protobuf:"bytes,2,opt,name=location,oneof"` +} + +func (*InteractiveAnnotation_Location) isInteractiveAnnotation_Action() {} + +func (m *InteractiveAnnotation) GetAction() isInteractiveAnnotation_Action { + if m != nil { + return m.Action + } + return nil +} + +func (m *InteractiveAnnotation) GetPolygonVertices() []*Point { + if m != nil { + return m.PolygonVertices + } + return nil +} + +func (m *InteractiveAnnotation) GetLocation() *Location { + if x, ok := m.GetAction().(*InteractiveAnnotation_Location); ok { + return x.Location + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*InteractiveAnnotation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _InteractiveAnnotation_OneofMarshaler, _InteractiveAnnotation_OneofUnmarshaler, _InteractiveAnnotation_OneofSizer, []interface{}{ + (*InteractiveAnnotation_Location)(nil), + } +} + +func _InteractiveAnnotation_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*InteractiveAnnotation) + // action + switch x := m.Action.(type) { + case *InteractiveAnnotation_Location: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Location); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("InteractiveAnnotation.Action has unexpected type %T", x) + } + return nil +} + +func _InteractiveAnnotation_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*InteractiveAnnotation) + switch tag { + case 2: // action.location + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Location) + err := b.DecodeMessage(msg) + m.Action = &InteractiveAnnotation_Location{msg} + return true, err + default: + return false, nil + } +} + +func _InteractiveAnnotation_OneofSizer(msg proto.Message) (n int) { + m := msg.(*InteractiveAnnotation) + // action + switch x := m.Action.(type) { + case *InteractiveAnnotation_Location: + s := proto.Size(x.Location) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Point struct { + X *float64 `protobuf:"fixed64,3,opt,name=x" json:"x,omitempty"` + Y *float64 `protobuf:"fixed64,4,opt,name=y" json:"y,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Point) Reset() { *m = Point{} } +func (m *Point) String() string { return proto.CompactTextString(m) } +func (*Point) ProtoMessage() {} +func (*Point) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{28} +} +func (m *Point) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Point.Unmarshal(m, b) +} +func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Point.Marshal(b, m, deterministic) +} +func (dst *Point) XXX_Merge(src proto.Message) { + xxx_messageInfo_Point.Merge(dst, src) +} +func (m *Point) XXX_Size() int { + return xxx_messageInfo_Point.Size(m) +} +func (m *Point) XXX_DiscardUnknown() { + xxx_messageInfo_Point.DiscardUnknown(m) +} + +var xxx_messageInfo_Point proto.InternalMessageInfo + +func (m *Point) GetX() float64 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + +func (m *Point) GetY() float64 { + if m != nil && m.Y != nil { + return *m.Y + } + return 0 +} + +type Location struct { + DegreesLatitude *float64 `protobuf:"fixed64,1,opt,name=degreesLatitude" json:"degreesLatitude,omitempty"` + DegreesLongitude *float64 `protobuf:"fixed64,2,opt,name=degreesLongitude" json:"degreesLongitude,omitempty"` + Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Location) Reset() { *m = Location{} } +func (m *Location) String() string { return proto.CompactTextString(m) } +func (*Location) ProtoMessage() {} +func (*Location) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{29} +} +func (m *Location) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Location.Unmarshal(m, b) +} +func (m *Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Location.Marshal(b, m, deterministic) +} +func (dst *Location) XXX_Merge(src proto.Message) { + xxx_messageInfo_Location.Merge(dst, src) +} +func (m *Location) XXX_Size() int { + return xxx_messageInfo_Location.Size(m) +} +func (m *Location) XXX_DiscardUnknown() { + xxx_messageInfo_Location.DiscardUnknown(m) +} + +var xxx_messageInfo_Location proto.InternalMessageInfo + +func (m *Location) GetDegreesLatitude() float64 { + if m != nil && m.DegreesLatitude != nil { + return *m.DegreesLatitude + } + return 0 +} + +func (m *Location) GetDegreesLongitude() float64 { + if m != nil && m.DegreesLongitude != nil { + return *m.DegreesLongitude + } + return 0 +} + +func (m *Location) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +type WebMessageInfo struct { + Key *MessageKey `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Message *Message `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + MessageTimestamp *uint64 `protobuf:"varint,3,opt,name=messageTimestamp" json:"messageTimestamp,omitempty"` + Status *WebMessageInfo_STATUS `protobuf:"varint,4,opt,name=status,enum=proto.WebMessageInfo_STATUS,def=1" json:"status,omitempty"` + Participant *string `protobuf:"bytes,5,opt,name=participant" json:"participant,omitempty"` + Ignore *bool `protobuf:"varint,16,opt,name=ignore" json:"ignore,omitempty"` + Starred *bool `protobuf:"varint,17,opt,name=starred" json:"starred,omitempty"` + Broadcast *bool `protobuf:"varint,18,opt,name=broadcast" json:"broadcast,omitempty"` + PushName *string `protobuf:"bytes,19,opt,name=pushName" json:"pushName,omitempty"` + MediaCiphertextSha256 []byte `protobuf:"bytes,20,opt,name=mediaCiphertextSha256" json:"mediaCiphertextSha256,omitempty"` + Multicast *bool `protobuf:"varint,21,opt,name=multicast" json:"multicast,omitempty"` + UrlText *bool `protobuf:"varint,22,opt,name=urlText" json:"urlText,omitempty"` + UrlNumber *bool `protobuf:"varint,23,opt,name=urlNumber" json:"urlNumber,omitempty"` + MessageStubType *WebMessageInfo_STUBTYPE `protobuf:"varint,24,opt,name=messageStubType,enum=proto.WebMessageInfo_STUBTYPE" json:"messageStubType,omitempty"` + ClearMedia *bool `protobuf:"varint,25,opt,name=clearMedia" json:"clearMedia,omitempty"` + MessageStubParameters []string `protobuf:"bytes,26,rep,name=messageStubParameters" json:"messageStubParameters,omitempty"` + Duration *uint32 `protobuf:"varint,27,opt,name=duration" json:"duration,omitempty"` + Labels []string `protobuf:"bytes,28,rep,name=labels" json:"labels,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WebMessageInfo) Reset() { *m = WebMessageInfo{} } +func (m *WebMessageInfo) String() string { return proto.CompactTextString(m) } +func (*WebMessageInfo) ProtoMessage() {} +func (*WebMessageInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{30} +} +func (m *WebMessageInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_WebMessageInfo.Unmarshal(m, b) +} +func (m *WebMessageInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_WebMessageInfo.Marshal(b, m, deterministic) +} +func (dst *WebMessageInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_WebMessageInfo.Merge(dst, src) +} +func (m *WebMessageInfo) XXX_Size() int { + return xxx_messageInfo_WebMessageInfo.Size(m) +} +func (m *WebMessageInfo) XXX_DiscardUnknown() { + xxx_messageInfo_WebMessageInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_WebMessageInfo proto.InternalMessageInfo + +const Default_WebMessageInfo_Status WebMessageInfo_STATUS = WebMessageInfo_PENDING + +func (m *WebMessageInfo) GetKey() *MessageKey { + if m != nil { + return m.Key + } + return nil +} + +func (m *WebMessageInfo) GetMessage() *Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *WebMessageInfo) GetMessageTimestamp() uint64 { + if m != nil && m.MessageTimestamp != nil { + return *m.MessageTimestamp + } + return 0 +} + +func (m *WebMessageInfo) GetStatus() WebMessageInfo_STATUS { + if m != nil && m.Status != nil { + return *m.Status + } + return Default_WebMessageInfo_Status +} + +func (m *WebMessageInfo) GetParticipant() string { + if m != nil && m.Participant != nil { + return *m.Participant + } + return "" +} + +func (m *WebMessageInfo) GetIgnore() bool { + if m != nil && m.Ignore != nil { + return *m.Ignore + } + return false +} + +func (m *WebMessageInfo) GetStarred() bool { + if m != nil && m.Starred != nil { + return *m.Starred + } + return false +} + +func (m *WebMessageInfo) GetBroadcast() bool { + if m != nil && m.Broadcast != nil { + return *m.Broadcast + } + return false +} + +func (m *WebMessageInfo) GetPushName() string { + if m != nil && m.PushName != nil { + return *m.PushName + } + return "" +} + +func (m *WebMessageInfo) GetMediaCiphertextSha256() []byte { + if m != nil { + return m.MediaCiphertextSha256 + } + return nil +} + +func (m *WebMessageInfo) GetMulticast() bool { + if m != nil && m.Multicast != nil { + return *m.Multicast + } + return false +} + +func (m *WebMessageInfo) GetUrlText() bool { + if m != nil && m.UrlText != nil { + return *m.UrlText + } + return false +} + +func (m *WebMessageInfo) GetUrlNumber() bool { + if m != nil && m.UrlNumber != nil { + return *m.UrlNumber + } + return false +} + +func (m *WebMessageInfo) GetMessageStubType() WebMessageInfo_STUBTYPE { + if m != nil && m.MessageStubType != nil { + return *m.MessageStubType + } + return WebMessageInfo_UNKNOWN +} + +func (m *WebMessageInfo) GetClearMedia() bool { + if m != nil && m.ClearMedia != nil { + return *m.ClearMedia + } + return false +} + +func (m *WebMessageInfo) GetMessageStubParameters() []string { + if m != nil { + return m.MessageStubParameters + } + return nil +} + +func (m *WebMessageInfo) GetDuration() uint32 { + if m != nil && m.Duration != nil { + return *m.Duration + } + return 0 +} + +func (m *WebMessageInfo) GetLabels() []string { + if m != nil { + return m.Labels + } + return nil +} + +type WebNotificationsInfo struct { + Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` + UnreadChats *uint32 `protobuf:"varint,3,opt,name=unreadChats" json:"unreadChats,omitempty"` + NotifyMessageCount *uint32 `protobuf:"varint,4,opt,name=notifyMessageCount" json:"notifyMessageCount,omitempty"` + NotifyMessages []*Message `protobuf:"bytes,5,rep,name=notifyMessages" json:"notifyMessages,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WebNotificationsInfo) Reset() { *m = WebNotificationsInfo{} } +func (m *WebNotificationsInfo) String() string { return proto.CompactTextString(m) } +func (*WebNotificationsInfo) ProtoMessage() {} +func (*WebNotificationsInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{31} +} +func (m *WebNotificationsInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_WebNotificationsInfo.Unmarshal(m, b) +} +func (m *WebNotificationsInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_WebNotificationsInfo.Marshal(b, m, deterministic) +} +func (dst *WebNotificationsInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_WebNotificationsInfo.Merge(dst, src) +} +func (m *WebNotificationsInfo) XXX_Size() int { + return xxx_messageInfo_WebNotificationsInfo.Size(m) +} +func (m *WebNotificationsInfo) XXX_DiscardUnknown() { + xxx_messageInfo_WebNotificationsInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_WebNotificationsInfo proto.InternalMessageInfo + +func (m *WebNotificationsInfo) GetTimestamp() uint64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +func (m *WebNotificationsInfo) GetUnreadChats() uint32 { + if m != nil && m.UnreadChats != nil { + return *m.UnreadChats + } + return 0 +} + +func (m *WebNotificationsInfo) GetNotifyMessageCount() uint32 { + if m != nil && m.NotifyMessageCount != nil { + return *m.NotifyMessageCount + } + return 0 +} + +func (m *WebNotificationsInfo) GetNotifyMessages() []*Message { + if m != nil { + return m.NotifyMessages + } + return nil +} + +type NotificationMessageInfo struct { + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Message *Message `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + MessageTimestamp *uint64 `protobuf:"varint,3,opt,name=messageTimestamp" json:"messageTimestamp,omitempty"` + Participant *string `protobuf:"bytes,4,opt,name=participant" json:"participant,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NotificationMessageInfo) Reset() { *m = NotificationMessageInfo{} } +func (m *NotificationMessageInfo) String() string { return proto.CompactTextString(m) } +func (*NotificationMessageInfo) ProtoMessage() {} +func (*NotificationMessageInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{32} +} +func (m *NotificationMessageInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NotificationMessageInfo.Unmarshal(m, b) +} +func (m *NotificationMessageInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NotificationMessageInfo.Marshal(b, m, deterministic) +} +func (dst *NotificationMessageInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_NotificationMessageInfo.Merge(dst, src) +} +func (m *NotificationMessageInfo) XXX_Size() int { + return xxx_messageInfo_NotificationMessageInfo.Size(m) +} +func (m *NotificationMessageInfo) XXX_DiscardUnknown() { + xxx_messageInfo_NotificationMessageInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_NotificationMessageInfo proto.InternalMessageInfo + +func (m *NotificationMessageInfo) GetKey() *MessageKey { + if m != nil { + return m.Key + } + return nil +} + +func (m *NotificationMessageInfo) GetMessage() *Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *NotificationMessageInfo) GetMessageTimestamp() uint64 { + if m != nil && m.MessageTimestamp != nil { + return *m.MessageTimestamp + } + return 0 +} + +func (m *NotificationMessageInfo) GetParticipant() string { + if m != nil && m.Participant != nil { + return *m.Participant + } + return "" +} + +type TabletNotificationsInfo struct { + Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` + UnreadChats *uint32 `protobuf:"varint,3,opt,name=unreadChats" json:"unreadChats,omitempty"` + NotifyMessageCount *uint32 `protobuf:"varint,4,opt,name=notifyMessageCount" json:"notifyMessageCount,omitempty"` + NotifyMessage []*Message `protobuf:"bytes,5,rep,name=notifyMessage" json:"notifyMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TabletNotificationsInfo) Reset() { *m = TabletNotificationsInfo{} } +func (m *TabletNotificationsInfo) String() string { return proto.CompactTextString(m) } +func (*TabletNotificationsInfo) ProtoMessage() {} +func (*TabletNotificationsInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{33} +} +func (m *TabletNotificationsInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TabletNotificationsInfo.Unmarshal(m, b) +} +func (m *TabletNotificationsInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TabletNotificationsInfo.Marshal(b, m, deterministic) +} +func (dst *TabletNotificationsInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TabletNotificationsInfo.Merge(dst, src) +} +func (m *TabletNotificationsInfo) XXX_Size() int { + return xxx_messageInfo_TabletNotificationsInfo.Size(m) +} +func (m *TabletNotificationsInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TabletNotificationsInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TabletNotificationsInfo proto.InternalMessageInfo + +func (m *TabletNotificationsInfo) GetTimestamp() uint64 { + if m != nil && m.Timestamp != nil { + return *m.Timestamp + } + return 0 +} + +func (m *TabletNotificationsInfo) GetUnreadChats() uint32 { + if m != nil && m.UnreadChats != nil { + return *m.UnreadChats + } + return 0 +} + +func (m *TabletNotificationsInfo) GetNotifyMessageCount() uint32 { + if m != nil && m.NotifyMessageCount != nil { + return *m.NotifyMessageCount + } + return 0 +} + +func (m *TabletNotificationsInfo) GetNotifyMessage() []*Message { + if m != nil { + return m.NotifyMessage + } + return nil +} + +type WebFeatures struct { + LabelsDisplay *WebFeatures_FLAG `protobuf:"varint,1,opt,name=labelsDisplay,enum=proto.WebFeatures_FLAG" json:"labelsDisplay,omitempty"` + VoipIndividualOutgoing *WebFeatures_FLAG `protobuf:"varint,2,opt,name=voipIndividualOutgoing,enum=proto.WebFeatures_FLAG" json:"voipIndividualOutgoing,omitempty"` + GroupsV3 *WebFeatures_FLAG `protobuf:"varint,3,opt,name=groupsV3,enum=proto.WebFeatures_FLAG" json:"groupsV3,omitempty"` + GroupsV3Create *WebFeatures_FLAG `protobuf:"varint,4,opt,name=groupsV3Create,enum=proto.WebFeatures_FLAG" json:"groupsV3Create,omitempty"` + ChangeNumberV2 *WebFeatures_FLAG `protobuf:"varint,5,opt,name=changeNumberV2,enum=proto.WebFeatures_FLAG" json:"changeNumberV2,omitempty"` + QueryStatusV3Thumbnail *WebFeatures_FLAG `protobuf:"varint,6,opt,name=queryStatusV3Thumbnail,enum=proto.WebFeatures_FLAG" json:"queryStatusV3Thumbnail,omitempty"` + LiveLocations *WebFeatures_FLAG `protobuf:"varint,7,opt,name=liveLocations,enum=proto.WebFeatures_FLAG" json:"liveLocations,omitempty"` + QueryVname *WebFeatures_FLAG `protobuf:"varint,8,opt,name=queryVname,enum=proto.WebFeatures_FLAG" json:"queryVname,omitempty"` + VoipIndividualIncoming *WebFeatures_FLAG `protobuf:"varint,9,opt,name=voipIndividualIncoming,enum=proto.WebFeatures_FLAG" json:"voipIndividualIncoming,omitempty"` + QuickRepliesQuery *WebFeatures_FLAG `protobuf:"varint,10,opt,name=quickRepliesQuery,enum=proto.WebFeatures_FLAG" json:"quickRepliesQuery,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WebFeatures) Reset() { *m = WebFeatures{} } +func (m *WebFeatures) String() string { return proto.CompactTextString(m) } +func (*WebFeatures) ProtoMessage() {} +func (*WebFeatures) Descriptor() ([]byte, []int) { + return fileDescriptor_def_131d1935231ace52, []int{34} +} +func (m *WebFeatures) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_WebFeatures.Unmarshal(m, b) +} +func (m *WebFeatures) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_WebFeatures.Marshal(b, m, deterministic) +} +func (dst *WebFeatures) XXX_Merge(src proto.Message) { + xxx_messageInfo_WebFeatures.Merge(dst, src) +} +func (m *WebFeatures) XXX_Size() int { + return xxx_messageInfo_WebFeatures.Size(m) +} +func (m *WebFeatures) XXX_DiscardUnknown() { + xxx_messageInfo_WebFeatures.DiscardUnknown(m) +} + +var xxx_messageInfo_WebFeatures proto.InternalMessageInfo + +func (m *WebFeatures) GetLabelsDisplay() WebFeatures_FLAG { + if m != nil && m.LabelsDisplay != nil { + return *m.LabelsDisplay + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetVoipIndividualOutgoing() WebFeatures_FLAG { + if m != nil && m.VoipIndividualOutgoing != nil { + return *m.VoipIndividualOutgoing + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetGroupsV3() WebFeatures_FLAG { + if m != nil && m.GroupsV3 != nil { + return *m.GroupsV3 + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetGroupsV3Create() WebFeatures_FLAG { + if m != nil && m.GroupsV3Create != nil { + return *m.GroupsV3Create + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetChangeNumberV2() WebFeatures_FLAG { + if m != nil && m.ChangeNumberV2 != nil { + return *m.ChangeNumberV2 + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetQueryStatusV3Thumbnail() WebFeatures_FLAG { + if m != nil && m.QueryStatusV3Thumbnail != nil { + return *m.QueryStatusV3Thumbnail + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetLiveLocations() WebFeatures_FLAG { + if m != nil && m.LiveLocations != nil { + return *m.LiveLocations + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetQueryVname() WebFeatures_FLAG { + if m != nil && m.QueryVname != nil { + return *m.QueryVname + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetVoipIndividualIncoming() WebFeatures_FLAG { + if m != nil && m.VoipIndividualIncoming != nil { + return *m.VoipIndividualIncoming + } + return WebFeatures_NOT_IMPLEMENTED +} + +func (m *WebFeatures) GetQuickRepliesQuery() WebFeatures_FLAG { + if m != nil && m.QuickRepliesQuery != nil { + return *m.QuickRepliesQuery + } + return WebFeatures_NOT_IMPLEMENTED +} + +func init() { + proto.RegisterType((*FingerprintData)(nil), "proto.FingerprintData") + proto.RegisterType((*CombinedFingerprint)(nil), "proto.CombinedFingerprint") + proto.RegisterType((*MessageKey)(nil), "proto.MessageKey") + proto.RegisterType((*SenderKeyDistributionMessage)(nil), "proto.SenderKeyDistributionMessage") + proto.RegisterType((*ImageMessage)(nil), "proto.ImageMessage") + proto.RegisterType((*ContactMessage)(nil), "proto.ContactMessage") + proto.RegisterType((*LocationMessage)(nil), "proto.LocationMessage") + proto.RegisterType((*ExtendedTextMessage)(nil), "proto.ExtendedTextMessage") + proto.RegisterType((*DocumentMessage)(nil), "proto.DocumentMessage") + proto.RegisterType((*AudioMessage)(nil), "proto.AudioMessage") + proto.RegisterType((*VideoMessage)(nil), "proto.VideoMessage") + proto.RegisterType((*Call)(nil), "proto.Call") + proto.RegisterType((*Chat)(nil), "proto.Chat") + proto.RegisterType((*ProtocolMessage)(nil), "proto.ProtocolMessage") + proto.RegisterType((*ContactsArrayMessage)(nil), "proto.ContactsArrayMessage") + proto.RegisterType((*HSMCurrency)(nil), "proto.HSMCurrency") + proto.RegisterType((*HSMDateTimeComponent)(nil), "proto.HSMDateTimeComponent") + proto.RegisterType((*HSMDateTimeUnixEpoch)(nil), "proto.HSMDateTimeUnixEpoch") + proto.RegisterType((*HSMDateTime)(nil), "proto.HSMDateTime") + proto.RegisterType((*HSMLocalizableParameter)(nil), "proto.HSMLocalizableParameter") + proto.RegisterType((*HighlyStructuredMessage)(nil), "proto.HighlyStructuredMessage") + proto.RegisterType((*SendPaymentMessage)(nil), "proto.SendPaymentMessage") + proto.RegisterType((*RequestPaymentMessage)(nil), "proto.RequestPaymentMessage") + proto.RegisterType((*LiveLocationMessage)(nil), "proto.LiveLocationMessage") + proto.RegisterType((*StickerMessage)(nil), "proto.StickerMessage") + proto.RegisterType((*Message)(nil), "proto.Message") + proto.RegisterType((*ContextInfo)(nil), "proto.ContextInfo") + proto.RegisterType((*InteractiveAnnotation)(nil), "proto.InteractiveAnnotation") + proto.RegisterType((*Point)(nil), "proto.Point") + proto.RegisterType((*Location)(nil), "proto.Location") + proto.RegisterType((*WebMessageInfo)(nil), "proto.WebMessageInfo") + proto.RegisterType((*WebNotificationsInfo)(nil), "proto.WebNotificationsInfo") + proto.RegisterType((*NotificationMessageInfo)(nil), "proto.NotificationMessageInfo") + proto.RegisterType((*TabletNotificationsInfo)(nil), "proto.TabletNotificationsInfo") + proto.RegisterType((*WebFeatures)(nil), "proto.WebFeatures") + proto.RegisterEnum("proto.ExtendedTextMessage_FONTTYPE", ExtendedTextMessage_FONTTYPE_name, ExtendedTextMessage_FONTTYPE_value) + proto.RegisterEnum("proto.VideoMessage_ATTRIBUTION", VideoMessage_ATTRIBUTION_name, VideoMessage_ATTRIBUTION_value) + proto.RegisterEnum("proto.ProtocolMessage_TYPE", ProtocolMessage_TYPE_name, ProtocolMessage_TYPE_value) + proto.RegisterEnum("proto.HSMDateTimeComponent_DAYOFWEEKTYPE", HSMDateTimeComponent_DAYOFWEEKTYPE_name, HSMDateTimeComponent_DAYOFWEEKTYPE_value) + proto.RegisterEnum("proto.HSMDateTimeComponent_CALENDARTYPE", HSMDateTimeComponent_CALENDARTYPE_name, HSMDateTimeComponent_CALENDARTYPE_value) + proto.RegisterEnum("proto.WebMessageInfo_STATUS", WebMessageInfo_STATUS_name, WebMessageInfo_STATUS_value) + proto.RegisterEnum("proto.WebMessageInfo_STUBTYPE", WebMessageInfo_STUBTYPE_name, WebMessageInfo_STUBTYPE_value) + proto.RegisterEnum("proto.WebFeatures_FLAG", WebFeatures_FLAG_name, WebFeatures_FLAG_value) +} + +func init() { proto.RegisterFile("def.proto", fileDescriptor_def_131d1935231ace52) } + +var fileDescriptor_def_131d1935231ace52 = []byte{ + // 3724 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x3a, 0x4d, 0x6f, 0xe3, 0x48, + 0x76, 0xad, 0x0f, 0xdb, 0xd2, 0x93, 0x2c, 0xd1, 0x65, 0xbb, 0xad, 0xe9, 0xf6, 0xce, 0x78, 0xd9, + 0x9b, 0x59, 0xef, 0x04, 0xeb, 0xf4, 0x78, 0x3a, 0x33, 0xc1, 0x06, 0x83, 0x84, 0x96, 0x68, 0x9b, + 0xdd, 0x32, 0xa9, 0x2d, 0x51, 0xf6, 0xf8, 0x24, 0x94, 0xc9, 0xb2, 0xc4, 0x34, 0x45, 0x6a, 0xc8, + 0x92, 0xa7, 0xb5, 0x01, 0x72, 0xd9, 0x4b, 0x10, 0x20, 0xf7, 0x5c, 0x83, 0x20, 0xd7, 0x5c, 0x02, + 0x04, 0x9b, 0x00, 0x49, 0x7e, 0x42, 0xfe, 0x46, 0x0e, 0xb9, 0xe4, 0x96, 0x4b, 0x90, 0xa0, 0x8a, + 0xa4, 0x44, 0x4a, 0xb2, 0xbb, 0xa7, 0x93, 0xe9, 0xe4, 0x64, 0xd5, 0xfb, 0xaa, 0x57, 0xef, 0xd5, + 0x7b, 0xf5, 0xde, 0xa3, 0xa1, 0x6c, 0xd3, 0xdb, 0xa3, 0x71, 0xe0, 0x33, 0x1f, 0xad, 0x89, 0x3f, + 0xb2, 0x01, 0xf5, 0x53, 0xc7, 0x1b, 0xd0, 0x60, 0x1c, 0x38, 0x1e, 0x6b, 0x11, 0x46, 0xd0, 0x3e, + 0x94, 0xc7, 0x93, 0x1b, 0xd7, 0xb1, 0x5e, 0xd1, 0x69, 0x23, 0x77, 0x90, 0x3b, 0x2c, 0xe3, 0x39, + 0x00, 0x7d, 0x0c, 0xe0, 0xd8, 0xd4, 0x63, 0xce, 0xad, 0x43, 0x83, 0x46, 0x5e, 0xa0, 0x53, 0x10, + 0xf9, 0xef, 0x73, 0xb0, 0xdd, 0xf4, 0x47, 0x37, 0x8e, 0x47, 0xed, 0x94, 0x64, 0xd4, 0x80, 0x8d, + 0x3b, 0x1a, 0x84, 0x8e, 0xef, 0x09, 0x99, 0x9b, 0x38, 0x59, 0xa2, 0x13, 0x90, 0x5c, 0xdf, 0x22, + 0x6e, 0x8a, 0x5a, 0xc8, 0xad, 0x1c, 0x3f, 0x8e, 0x74, 0x3d, 0x5a, 0xd0, 0x10, 0x2f, 0xd1, 0xa3, + 0x16, 0x6c, 0x05, 0x74, 0xe4, 0x33, 0x9a, 0x16, 0x52, 0x78, 0x50, 0xc8, 0x32, 0x83, 0xcc, 0x00, + 0x2e, 0x68, 0x18, 0x92, 0x01, 0xe5, 0x27, 0xdd, 0x87, 0x72, 0x44, 0xf2, 0xd2, 0xb1, 0x13, 0x3b, + 0xcc, 0x00, 0xe8, 0x31, 0xac, 0xdf, 0x06, 0xfe, 0xe8, 0x82, 0x0a, 0x5d, 0x4b, 0x38, 0x5e, 0xa1, + 0x1a, 0xe4, 0x1d, 0x5b, 0x6c, 0x5d, 0xc6, 0x79, 0xc7, 0x46, 0x07, 0x50, 0x19, 0x93, 0x80, 0x39, + 0x96, 0x33, 0x26, 0x1e, 0x6b, 0x14, 0x05, 0x22, 0x0d, 0x92, 0xff, 0x2c, 0x07, 0xfb, 0x5d, 0xea, + 0xd9, 0x34, 0x78, 0x45, 0xa7, 0x2d, 0x27, 0x64, 0x81, 0x73, 0x33, 0x61, 0x8e, 0xef, 0xc5, 0xba, + 0x70, 0xd3, 0x0d, 0x02, 0x7f, 0x32, 0xd6, 0x12, 0x35, 0x92, 0x25, 0xea, 0xc0, 0x33, 0xf2, 0xc6, + 0x77, 0x7d, 0xe6, 0x3e, 0x24, 0x40, 0x68, 0x58, 0xc5, 0xef, 0x42, 0x2a, 0xff, 0x4d, 0x11, 0xaa, + 0xda, 0x88, 0x0c, 0x68, 0xb2, 0xb9, 0x04, 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, 0x0e, 0xf6, 0xce, + 0xbb, 0x17, 0xbc, 0x33, 0x72, 0x9d, 0x5f, 0x91, 0x1b, 0x97, 0x76, 0x48, 0x40, 0x46, 0x94, 0xd1, + 0x80, 0xe7, 0x1b, 0x9b, 0xde, 0x92, 0x89, 0x9b, 0xf4, 0x05, 0xc9, 0x12, 0x3d, 0x87, 0x52, 0x72, + 0xe3, 0x63, 0x15, 0xd0, 0x5c, 0x85, 0x24, 0x56, 0xce, 0x1f, 0xe1, 0x19, 0x15, 0xe7, 0xb0, 0x63, + 0xd5, 0xe2, 0x79, 0x0b, 0x5a, 0x56, 0x9a, 0x73, 0x24, 0x54, 0x27, 0x55, 0x80, 0x31, 0x57, 0x25, + 0xd2, 0xf3, 0xbf, 0xb8, 0x9e, 0xce, 0x60, 0xe8, 0x4e, 0xbb, 0x2c, 0x98, 0x58, 0x6c, 0x12, 0x50, + 0x3b, 0xc9, 0x16, 0xfb, 0x50, 0xe6, 0x4d, 0x56, 0x38, 0x26, 0x56, 0x12, 0x90, 0x73, 0x00, 0xcf, + 0x25, 0xd4, 0xa5, 0xbc, 0xea, 0x15, 0xb9, 0x24, 0x6e, 0x63, 0x52, 0x20, 0x7e, 0x9f, 0xc5, 0x4e, + 0x61, 0xa3, 0x70, 0x50, 0x38, 0x2c, 0xe3, 0x78, 0x25, 0xde, 0x74, 0xe2, 0xba, 0xfc, 0x35, 0x6d, + 0x0f, 0xe2, 0xe6, 0x26, 0x05, 0xc9, 0xe0, 0xad, 0xb8, 0xb3, 0x49, 0x41, 0x50, 0x1b, 0xb6, 0xdc, + 0x05, 0xbb, 0x86, 0x8d, 0x75, 0x91, 0xac, 0x3e, 0x9e, 0x1f, 0x7e, 0x95, 0xe9, 0xf1, 0x32, 0xa3, + 0x7c, 0x0a, 0xa8, 0x4b, 0x3d, 0xbb, 0x43, 0xa6, 0xe9, 0x0a, 0xfe, 0x39, 0x54, 0x3c, 0x9f, 0xd1, + 0xf4, 0x04, 0xa7, 0x72, 0x5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xfb, + 0x9e, 0xfc, 0x0c, 0xd6, 0x84, 0x48, 0x54, 0x85, 0xdc, 0x1b, 0xf1, 0x4a, 0xe5, 0x70, 0xee, 0x0d, + 0x5f, 0x45, 0x05, 0x45, 0x0e, 0xe7, 0xa6, 0x32, 0x83, 0x52, 0x22, 0xe6, 0xc3, 0x7d, 0x37, 0x92, + 0xff, 0xa5, 0x0e, 0xb5, 0x2b, 0x7a, 0x13, 0x5f, 0x18, 0x71, 0x51, 0x67, 0xe3, 0x99, 0xfc, 0x03, + 0xe3, 0x99, 0x43, 0xd8, 0x18, 0x3d, 0xd8, 0x12, 0x24, 0x68, 0xae, 0x61, 0xfc, 0xd3, 0x9c, 0x35, + 0xb0, 0x05, 0x51, 0xbd, 0x2c, 0xc1, 0xd1, 0xd7, 0xb0, 0x1e, 0x32, 0xc2, 0x26, 0x51, 0x71, 0x5b, + 0x9b, 0x65, 0x81, 0xac, 0x86, 0x47, 0x5d, 0x53, 0x31, 0x7b, 0xdd, 0x5f, 0x6c, 0x74, 0x54, 0xbd, + 0xa5, 0xe9, 0x67, 0x38, 0x66, 0x5a, 0x0c, 0xa3, 0xb5, 0xe5, 0x30, 0x7a, 0x0c, 0xeb, 0xce, 0xc0, + 0xf3, 0x83, 0x28, 0x69, 0x95, 0x70, 0xbc, 0x12, 0xd3, 0x53, 0x46, 0x82, 0x80, 0xda, 0x22, 0xff, + 0x94, 0x70, 0xb2, 0xe4, 0x21, 0x74, 0x13, 0xf8, 0xc4, 0xb6, 0x48, 0xc8, 0xc4, 0xcd, 0x2f, 0xe1, + 0x39, 0x80, 0x07, 0xf5, 0x78, 0x12, 0x0e, 0x45, 0xe3, 0xb7, 0x1d, 0x05, 0x75, 0xb2, 0x46, 0x2f, + 0x60, 0x57, 0x94, 0x89, 0x4d, 0x67, 0x3c, 0xa4, 0x01, 0xcf, 0x03, 0x71, 0x91, 0xb9, 0x23, 0xa2, + 0x62, 0x35, 0x92, 0xef, 0x37, 0x9a, 0xb8, 0xcc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 0xe5, 0x01, 0xde, 0x14, 0xe9, 0xb2, 0x43, 0x35, 0xcf, 0xf2, 0x47, 0xdc, 0xa1, 0xe5, + 0xef, 0xe5, 0xd0, 0x84, 0x0d, 0xa9, 0xb0, 0xf5, 0xed, 0xc4, 0xb1, 0x5e, 0x63, 0x3a, 0x76, 0x1d, + 0x1a, 0xfe, 0x92, 0x6f, 0x25, 0x46, 0x42, 0x0f, 0xc8, 0x5a, 0xe6, 0x90, 0x7f, 0x01, 0x45, 0x8e, + 0x8a, 0xfe, 0xa7, 0xc9, 0xec, 0x6b, 0x17, 0x9d, 0xb6, 0x7a, 0xa1, 0xea, 0x3c, 0xdd, 0x3e, 0xe2, + 0x75, 0x59, 0x1a, 0x90, 0x43, 0x55, 0x28, 0x19, 0xe2, 0x75, 0x54, 0xda, 0x52, 0xfe, 0xbf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x11, 0x17, 0x9b, 0xf6, 0x8b, 0x2c, 0x00, 0x00, +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.proto b/vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.proto new file mode 100644 index 00000000..a885973d --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/binary/proto/def.proto @@ -0,0 +1,417 @@ +syntax = "proto2"; +package proto; + +message FingerprintData { + optional string publicKey = 1; + optional string identifier = 2; +} + +message CombinedFingerprint { + optional uint32 version = 1; + optional FingerprintData localFingerprint = 2; + optional FingerprintData remoteFingerprint = 3; +} + +message MessageKey { + optional string remoteJid = 1; + optional bool fromMe = 2; + optional string id = 3; + optional string participant = 4; +} + +message SenderKeyDistributionMessage { + optional string groupId = 1; + optional bytes axolotlSenderKeyDistributionMessage = 2; +} + +message ImageMessage { + optional string url = 1; + optional string mimetype = 2; + optional string caption = 3; + optional bytes fileSha256 = 4; + optional uint64 fileLength = 5; + optional uint32 height = 6; + optional uint32 width = 7; + optional bytes mediaKey = 8; + optional bytes fileEncSha256 = 9; + repeated InteractiveAnnotation interactiveAnnotations = 10; + optional string directPath = 11; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bytes firstScanSidecar = 18; + optional uint32 firstScanLength = 19; +} + +message ContactMessage { + optional string displayName = 1; + optional string vcard = 16; + optional ContextInfo contextInfo = 17; +} + +message LocationMessage { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional string name = 3; + optional string address = 4; + optional string url = 5; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +message ExtendedTextMessage { + optional string text = 1; + optional string matchedText = 2; + optional string canonicalUrl = 4; + optional string description = 5; + optional string title = 6; + optional fixed32 textArgb = 7; + optional fixed32 backgroundArgb = 8; + enum FONTTYPE { + SANS_SERIF = 0; + SERIF = 1; + NORICAN_REGULAR = 2; + BRYNDAN_WRITE = 3; + BEBASNEUE_REGULAR = 4; + OSWALD_HEAVY = 5; + } + optional FONTTYPE font = 9; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +message DocumentMessage { + optional string url = 1; + optional string mimetype = 2; + optional string title = 3; + optional bytes fileSha256 = 4; + optional uint64 fileLength = 5; + optional uint32 pageCount = 6; + optional bytes mediaKey = 7; + optional string fileName = 8; + optional bytes fileEncSha256 = 9; + optional string directPath = 10; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +message AudioMessage { + optional string url = 1; + optional string mimetype = 2; + optional bytes fileSha256 = 3; + optional uint64 fileLength = 4; + optional uint32 seconds = 5; + optional bool ptt = 6; + optional bytes mediaKey = 7; + optional bytes fileEncSha256 = 8; + optional string directPath = 9; + optional ContextInfo contextInfo = 17; + optional bytes streamingSidecar = 18; +} + +message VideoMessage { + optional string url = 1; + optional string mimetype = 2; + optional bytes fileSha256 = 3; + optional uint64 fileLength = 4; + optional uint32 seconds = 5; + optional bytes mediaKey = 6; + optional string caption = 7; + optional bool gifPlayback = 8; + optional uint32 height = 9; + optional uint32 width = 10; + optional bytes fileEncSha256 = 11; + repeated InteractiveAnnotation interactiveAnnotations = 12; + optional string directPath = 13; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bytes streamingSidecar = 18; + enum ATTRIBUTION { + NONE = 0; + GIPHY = 1; + TENOR = 2; + } + optional ATTRIBUTION gifAttribution = 19; +} + +message Call { + optional bytes callKey = 1; +} + +message Chat { + optional string displayName = 1; + optional string id = 2; +} + +message ProtocolMessage { + optional MessageKey key = 1; + enum TYPE { + REVOKE = 0; + } + optional TYPE type = 2; +} + +message ContactsArrayMessage { + optional string displayName = 1; + repeated ContactMessage contacts = 2; + optional ContextInfo contextInfo = 17; +} + +message HSMCurrency { + optional string currencyCode = 1; + optional int64 amount1000 = 2; +} + +message HSMDateTimeComponent { + enum DAYOFWEEKTYPE { + MONDAY = 1; + TUESDAY = 2; + WEDNESDAY = 3; + THURSDAY = 4; + FRIDAY = 5; + SATURDAY = 6; + SUNDAY = 7; + } + optional DAYOFWEEKTYPE dayOfWeek = 1; + optional uint32 year = 2; + optional uint32 month = 3; + optional uint32 dayOfMonth = 4; + optional uint32 hour = 5; + optional uint32 minute = 6; + enum CALENDARTYPE { + GREGORIAN = 1; + SOLAR_HIJRI = 2; + } + optional CALENDARTYPE calendar = 7; +} + +message HSMDateTimeUnixEpoch { + optional int64 timestamp = 1; +} + +message HSMDateTime { + oneof datetimeOneof { + HSMDateTimeComponent component = 1; + HSMDateTimeUnixEpoch unixEpoch = 2; + } +} + +message HSMLocalizableParameter { + optional string default = 1; + oneof paramOneof { + HSMCurrency currency = 2; + HSMDateTime dateTime = 3; + } +} + +message HighlyStructuredMessage { + optional string namespace = 1; + optional string elementName = 2; + repeated string params = 3; + optional string fallbackLg = 4; + optional string fallbackLc = 5; + repeated HSMLocalizableParameter localizableParams = 6; +} + +message SendPaymentMessage { + optional Message noteMessage = 2; +} + +message RequestPaymentMessage { + optional string currencyCodeIso4217 = 1; + optional uint64 amount1000 = 2; + optional string requestFrom = 3; + optional Message noteMessage = 4; +} + +message LiveLocationMessage { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional uint32 accuracyInMeters = 3; + optional float speedInMps = 4; + optional uint32 degreesClockwiseFromMagneticNorth = 5; + optional string caption = 6; + optional int64 sequenceNumber = 7; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +message StickerMessage { + optional string url = 1; + optional bytes fileSha256 = 2; + optional bytes fileEncSha256 = 3; + optional bytes mediaKey = 4; + optional string mimetype = 5; + optional uint32 height = 6; + optional uint32 width = 7; + optional string directPath = 8; + optional uint64 fileLength = 9; + optional bytes pngThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +message Message { + optional string conversation = 1; + optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2; + optional ImageMessage imageMessage = 3; + optional ContactMessage contactMessage = 4; + optional LocationMessage locationMessage = 5; + optional ExtendedTextMessage extendedTextMessage = 6; + optional DocumentMessage documentMessage = 7; + optional AudioMessage audioMessage = 8; + optional VideoMessage videoMessage = 9; + optional Call call = 10; + optional Chat chat = 11; + optional ProtocolMessage protocolMessage = 12; + optional ContactsArrayMessage contactsArrayMessage = 13; + optional HighlyStructuredMessage highlyStructuredMessage = 14; + optional SenderKeyDistributionMessage fastRatchetKeySenderKeyDistributionMessage = 15; + optional SendPaymentMessage sendPaymentMessage = 16; + optional RequestPaymentMessage requestPaymentMessage = 17; + optional LiveLocationMessage liveLocationMessage = 18; + optional StickerMessage stickerMessage = 20; +} + +message ContextInfo { + optional string stanzaId = 1; + optional string participant = 2; + repeated Message quotedMessage = 3; + optional string remoteJid = 4; + repeated string mentionedJid = 15; + optional string conversionSource = 18; + optional bytes conversionData = 19; + optional uint32 conversionDelaySeconds = 20; + optional bool isForwarded = 22; + reserved 16, 17; +} + +message InteractiveAnnotation { + repeated Point polygonVertices = 1; + oneof action { + Location location = 2; + } +} + +message Point { + optional double x = 3; + optional double y = 4; +} + +message Location { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional string name = 3; +} + +message WebMessageInfo { + required MessageKey key = 1; + optional Message message = 2; + optional uint64 messageTimestamp = 3; + enum STATUS { + ERROR = 0; + PENDING = 1; + SERVER_ACK = 2; + DELIVERY_ACK = 3; + READ = 4; + PLAYED = 5; + } + optional STATUS status = 4 [default=PENDING]; + optional string participant = 5; + optional bool ignore = 16; + optional bool starred = 17; + optional bool broadcast = 18; + optional string pushName = 19; + optional bytes mediaCiphertextSha256 = 20; + optional bool multicast = 21; + optional bool urlText = 22; + optional bool urlNumber = 23; + enum STUBTYPE { + UNKNOWN = 0; + REVOKE = 1; + CIPHERTEXT = 2; + FUTUREPROOF = 3; + NON_VERIFIED_TRANSITION = 4; + UNVERIFIED_TRANSITION = 5; + VERIFIED_TRANSITION = 6; + VERIFIED_LOW_UNKNOWN = 7; + VERIFIED_HIGH = 8; + VERIFIED_INITIAL_UNKNOWN = 9; + VERIFIED_INITIAL_LOW = 10; + VERIFIED_INITIAL_HIGH = 11; + VERIFIED_TRANSITION_ANY_TO_NONE = 12; + VERIFIED_TRANSITION_ANY_TO_HIGH = 13; + VERIFIED_TRANSITION_HIGH_TO_LOW = 14; + VERIFIED_TRANSITION_HIGH_TO_UNKNOWN = 15; + VERIFIED_TRANSITION_UNKNOWN_TO_LOW = 16; + VERIFIED_TRANSITION_LOW_TO_UNKNOWN = 17; + VERIFIED_TRANSITION_NONE_TO_LOW = 18; + VERIFIED_TRANSITION_NONE_TO_UNKNOWN = 19; + GROUP_CREATE = 20; + GROUP_CHANGE_SUBJECT = 21; + GROUP_CHANGE_ICON = 22; + GROUP_CHANGE_INVITE_LINK = 23; + GROUP_CHANGE_DESCRIPTION = 24; + GROUP_CHANGE_RESTRICT = 25; + GROUP_CHANGE_ANNOUNCE = 26; + GROUP_PARTICIPANT_ADD = 27; + GROUP_PARTICIPANT_REMOVE = 28; + GROUP_PARTICIPANT_PROMOTE = 29; + GROUP_PARTICIPANT_DEMOTE = 30; + GROUP_PARTICIPANT_INVITE = 31; + GROUP_PARTICIPANT_LEAVE = 32; + GROUP_PARTICIPANT_CHANGE_NUMBER = 33; + BROADCAST_CREATE = 34; + BROADCAST_ADD = 35; + BROADCAST_REMOVE = 36; + GENERIC_NOTIFICATION = 37; + E2E_IDENTITY_CHANGED = 38; + E2E_ENCRYPTED = 39; + CALL_MISSED_VOICE = 40; + CALL_MISSED_VIDEO = 41; + INDIVIDUAL_CHANGE_NUMBER = 42; + GROUP_DELETE = 43; + } + optional STUBTYPE messageStubType = 24; + optional bool clearMedia = 25; + repeated string messageStubParameters = 26; + optional uint32 duration = 27; + repeated string labels = 28; +} + +message WebNotificationsInfo { + optional uint64 timestamp = 2; + optional uint32 unreadChats = 3; + optional uint32 notifyMessageCount = 4; + repeated Message notifyMessages = 5; +} + +message NotificationMessageInfo { + optional MessageKey key = 1; + optional Message message = 2; + optional uint64 messageTimestamp = 3; + optional string participant = 4; +} + +message TabletNotificationsInfo { + optional uint64 timestamp = 2; + optional uint32 unreadChats = 3; + optional uint32 notifyMessageCount = 4; + repeated Message notifyMessage = 5; +} + +message WebFeatures { + enum FLAG { + NOT_IMPLEMENTED = 0; + IMPLEMENTED = 1; + OPTIONAL = 2; + } + optional FLAG labelsDisplay = 1; + optional FLAG voipIndividualOutgoing = 2; + optional FLAG groupsV3 = 3; + optional FLAG groupsV3Create = 4; + optional FLAG changeNumberV2 = 5; + optional FLAG queryStatusV3Thumbnail = 6; + optional FLAG liveLocations = 7; + optional FLAG queryVname = 8; + optional FLAG voipIndividualIncoming = 9; + optional FLAG quickRepliesQuery = 10; +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/binary/token/token.go b/vendor/github.com/Rhymen/go-whatsapp/binary/token/token.go new file mode 100644 index 00000000..070a6896 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/binary/token/token.go @@ -0,0 +1,78 @@ +package token + +import "fmt" + +var SingleByteTokens = [...]string{"", "", "", "200", "400", "404", "500", "501", "502", "action", "add", + "after", "archive", "author", "available", "battery", "before", "body", + "broadcast", "chat", "clear", "code", "composing", "contacts", "count", + "create", "debug", "delete", "demote", "duplicate", "encoding", "error", + "false", "filehash", "from", "g.us", "group", "groups_v2", "height", "id", + "image", "in", "index", "invis", "item", "jid", "kind", "last", "leave", + "live", "log", "media", "message", "mimetype", "missing", "modify", "name", + "notification", "notify", "out", "owner", "participant", "paused", + "picture", "played", "presence", "preview", "promote", "query", "raw", + "read", "receipt", "received", "recipient", "recording", "relay", + "remove", "response", "resume", "retry", "s.whatsapp.net", "seconds", + "set", "size", "status", "subject", "subscribe", "t", "text", "to", "true", + "type", "unarchive", "unavailable", "url", "user", "value", "web", "width", + "mute", "read_only", "admin", "creator", "short", "update", "powersave", + "checksum", "epoch", "block", "previous", "409", "replaced", "reason", + "spam", "modify_tag", "message_info", "delivery", "emoji", "title", + "description", "canonical-url", "matched-text", "star", "unstar", + "media_key", "filename", "identity", "unread", "page", "page_count", + "search", "media_message", "security", "call_log", "profile", "ciphertext", + "invite", "gif", "vcard", "frequent", "privacy", "blacklist", "whitelist", + "verify", "location", "document", "elapsed", "revoke_invite", "expiration", + "unsubscribe", "disable", "vname", "old_jid", "new_jid", "announcement", + "locked", "prop", "label", "color", "call", "offer", "call-id"} + +var doubleByteTokens = [...]string{} + +func GetSingleToken(i int) (string, error) { + if i < 3 || i >= len(SingleByteTokens) { + return "", fmt.Errorf("index out of single byte token bounds %d", i) + } + + return SingleByteTokens[i], nil +} + +func GetDoubleToken(index1 int, index2 int) (string, error) { + n := 256*index1 + index2 + if n < 0 || n >= len(doubleByteTokens) { + return "", fmt.Errorf("index out of double byte token bounds %d", n) + } + + return doubleByteTokens[n], nil +} + +func IndexOfSingleToken(token string) int { + for i, t := range SingleByteTokens { + if t == token { + return i + } + } + + return -1 +} + +const ( + LIST_EMPTY = 0 + STREAM_END = 2 + DICTIONARY_0 = 236 + DICTIONARY_1 = 237 + DICTIONARY_2 = 238 + DICTIONARY_3 = 239 + LIST_8 = 248 + LIST_16 = 249 + JID_PAIR = 250 + HEX_8 = 251 + BINARY_8 = 252 + BINARY_20 = 253 + BINARY_32 = 254 + NIBBLE_8 = 255 +) + +const ( + PACKED_MAX = 254 + SINGLE_BYTE_MAX = 256 +) diff --git a/vendor/github.com/Rhymen/go-whatsapp/conn.go b/vendor/github.com/Rhymen/go-whatsapp/conn.go new file mode 100644 index 00000000..d53d92c2 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/conn.go @@ -0,0 +1,389 @@ +//Package whatsapp provides a developer API to interact with the WhatsAppWeb-Servers. +package whatsapp + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/json" + "fmt" + "math/rand" + "net/http" + "os" + "strconv" + "strings" + "sync" + "time" + + "github.com/Rhymen/go-whatsapp/binary" + "github.com/Rhymen/go-whatsapp/crypto/cbc" + "github.com/gorilla/websocket" +) + +type metric byte + +const ( + debugLog metric = iota + 1 + queryResume + queryReceipt + queryMedia + queryChat + queryContacts + queryMessages + presence + presenceSubscribe + group + read + chat + received + pic + status + message + queryActions + block + queryGroup + queryPreview + queryEmoji + queryMessageInfo + spam + querySearch + queryIdentity + queryUrl + profile + contact + queryVcard + queryStatus + queryStatusUpdate + privacyStatus + queryLiveLocations + liveLocation + queryVname + queryLabels + call + queryCall + queryQuickReplies +) + +type flag byte + +const ( + ignore flag = 1 << (7 - iota) + ackRequest + available + notAvailable + expires + skipOffline +) + +/* +Conn is created by NewConn. Interacting with the initialized Conn is the main way of interacting with our package. +It holds all necessary information to make the package work internally. +*/ +type Conn struct { + wsConn *websocket.Conn + wsConnOK bool + wsConnMutex sync.RWMutex + session *Session + listener map[string]chan string + listenerMutex sync.RWMutex + writeChan chan wsMsg + handler []Handler + msgCount int + msgTimeout time.Duration + Info *Info + Store *Store + ServerLastSeen time.Time + + longClientName string + shortClientName string +} + +type wsMsg struct { + messageType int + data []byte +} + +/* +Creates a new connection with a given timeout. The websocket connection to the WhatsAppWeb servers get´s established. +The goroutine for handling incoming messages is started +*/ +func NewConn(timeout time.Duration) (*Conn, error) { + wac := &Conn{ + wsConn: nil, // will be set in connect() + wsConnMutex: sync.RWMutex{}, + listener: make(map[string]chan string), + listenerMutex: sync.RWMutex{}, + writeChan: make(chan wsMsg), + handler: make([]Handler, 0), + msgCount: 0, + msgTimeout: timeout, + Store: newStore(), + + longClientName: "github.com/rhymen/go-whatsapp", + shortClientName: "go-whatsapp", + } + + if err := wac.connect(); err != nil { + return nil, err + } + + go wac.readPump() + go wac.writePump() + go wac.keepAlive(20000, 90000) + + return wac, nil +} + +func (wac *Conn) isConnected() bool { + wac.wsConnMutex.RLock() + defer wac.wsConnMutex.RUnlock() + if wac.wsConn == nil { + return false + } + if wac.wsConnOK { + return true + } + + // just send a keepalive to test the connection + wac.sendKeepAlive() + + // this method is expected to be called by loops. So we can just return false + return false +} + +// connect should be guarded with wsConnMutex +func (wac *Conn) connect() error { + dialer := &websocket.Dialer{ + ReadBufferSize: 25 * 1024 * 1024, + WriteBufferSize: 10 * 1024 * 1024, + HandshakeTimeout: wac.msgTimeout, + } + + headers := http.Header{"Origin": []string{"https://web.whatsapp.com"}} + wsConn, _, err := dialer.Dial("wss://web.whatsapp.com/ws", headers) + if err != nil { + return fmt.Errorf("couldn't dial whatsapp web websocket: %v", err) + } + + wsConn.SetCloseHandler(func(code int, text string) error { + fmt.Fprintf(os.Stderr, "websocket connection closed(%d, %s)\n", code, text) + + // from default CloseHandler + message := websocket.FormatCloseMessage(code, "") + wsConn.WriteControl(websocket.CloseMessage, message, time.Now().Add(time.Second)) + + // our close handling + if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway) { + fmt.Println("Trigger reconnect") + go wac.reconnect() + } + return nil + }) + + wac.wsConn = wsConn + wac.wsConnOK = true + return nil +} + +// reconnect should be run as go routine +func (wac *Conn) reconnect() { + wac.wsConnMutex.Lock() + wac.wsConn.Close() + wac.wsConn = nil + wac.wsConnOK = false + wac.wsConnMutex.Unlock() + + // wait up to 60 seconds and then reconnect. As writePump should send immediately, it might + // reconnect as well. So we check its existance before reconnecting + for !wac.isConnected() { + time.Sleep(time.Duration(rand.Intn(60)) * time.Second) + + wac.wsConnMutex.Lock() + if wac.wsConn == nil { + if err := wac.connect(); err != nil { + fmt.Fprintf(os.Stderr, "could not reconnect to websocket: %v\n", err) + } + } + wac.wsConnMutex.Unlock() + } +} + +func (wac *Conn) write(data []interface{}) (<-chan string, error) { + d, err := json.Marshal(data) + if err != nil { + return nil, err + } + + ts := time.Now().Unix() + messageTag := fmt.Sprintf("%d.--%d", ts, wac.msgCount) + msg := fmt.Sprintf("%s,%s", messageTag, d) + + ch := make(chan string, 1) + + wac.listenerMutex.Lock() + wac.listener[messageTag] = ch + wac.listenerMutex.Unlock() + + wac.writeChan <- wsMsg{websocket.TextMessage, []byte(msg)} + + wac.msgCount++ + return ch, nil +} + +func (wac *Conn) writeBinary(node binary.Node, metric metric, flag flag, tag string) (<-chan string, error) { + if len(tag) < 2 { + return nil, fmt.Errorf("no tag specified or to short") + } + b, err := binary.Marshal(node) + if err != nil { + return nil, err + } + + cipher, err := cbc.Encrypt(wac.session.EncKey, nil, b) + if err != nil { + return nil, err + } + + h := hmac.New(sha256.New, wac.session.MacKey) + h.Write(cipher) + hash := h.Sum(nil) + + data := []byte(tag + ",") + data = append(data, byte(metric), byte(flag)) + data = append(data, hash[:32]...) + data = append(data, cipher...) + + ch := make(chan string, 1) + + wac.listenerMutex.Lock() + wac.listener[tag] = ch + wac.listenerMutex.Unlock() + + msg := wsMsg{websocket.BinaryMessage, data} + wac.writeChan <- msg + + wac.msgCount++ + return ch, nil +} + +func (wac *Conn) readPump() { + defer wac.wsConn.Close() + + for { + msgType, msg, err := wac.wsConn.ReadMessage() + if err != nil { + wac.wsConnOK = false + if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) { + wac.handle(fmt.Errorf("unexpected websocket close: %v", err)) + } + // sleep for a second and retry reading the next message + time.Sleep(time.Second) + continue + } + wac.wsConnOK = true + + data := strings.SplitN(string(msg), ",", 2) + + //Kepp-Alive Timestmap + if data[0][0] == '!' { + msecs, err := strconv.ParseInt(data[0][1:], 10, 64) + if err != nil { + fmt.Fprintf(os.Stderr, "Error converting time string to uint: %v\n", err) + continue + } + wac.ServerLastSeen = time.Unix(msecs/1000, (msecs%1000)*int64(time.Millisecond)) + continue + } + + wac.listenerMutex.RLock() + listener, hasListener := wac.listener[data[0]] + wac.listenerMutex.RUnlock() + + if len(data[1]) == 0 { + continue + } else if hasListener { + listener <- data[1] + + wac.listenerMutex.Lock() + delete(wac.listener, data[0]) + wac.listenerMutex.Unlock() + } else if msgType == 2 && wac.session != nil && wac.session.EncKey != nil { + message, err := wac.decryptBinaryMessage([]byte(data[1])) + if err != nil { + wac.handle(fmt.Errorf("error decoding binary: %v", err)) + continue + } + + wac.dispatch(message) + } else { + wac.handle(string(data[1])) + } + + } +} + +func (wac *Conn) writePump() { + for msg := range wac.writeChan { + for !wac.isConnected() { + // reconnect to send the message ASAP + wac.wsConnMutex.Lock() + if wac.wsConn == nil { + if err := wac.connect(); err != nil { + fmt.Fprintf(os.Stderr, "could not reconnect to websocket: %v\n", err) + } + } + wac.wsConnMutex.Unlock() + if !wac.isConnected() { + // reconnecting failed. Sleep for a while and try again afterwards + time.Sleep(time.Duration(rand.Intn(5)) * time.Second) + } + } + if err := wac.wsConn.WriteMessage(msg.messageType, msg.data); err != nil { + fmt.Fprintf(os.Stderr, "error writing to socket: %v\n", err) + wac.wsConnOK = false + // add message to channel again to no loose it + go func() { + wac.writeChan <- msg + }() + } + } +} + +func (wac *Conn) sendKeepAlive() { + // whatever issues might be there allow sending this message + wac.wsConnOK = true + wac.writeChan <- wsMsg{ + messageType: websocket.TextMessage, + data: []byte("?,,"), + } +} + +func (wac *Conn) keepAlive(minIntervalMs int, maxIntervalMs int) { + for { + wac.sendKeepAlive() + interval := rand.Intn(maxIntervalMs-minIntervalMs) + minIntervalMs + <-time.After(time.Duration(interval) * time.Millisecond) + } +} + +func (wac *Conn) decryptBinaryMessage(msg []byte) (*binary.Node, error) { + //message validation + h2 := hmac.New(sha256.New, wac.session.MacKey) + h2.Write([]byte(msg[32:])) + if !hmac.Equal(h2.Sum(nil), msg[:32]) { + return nil, fmt.Errorf("message received with invalid hmac") + } + + // message decrypt + d, err := cbc.Decrypt(wac.session.EncKey, nil, msg[32:]) + if err != nil { + return nil, fmt.Errorf("error decrypting message with AES: %v", err) + } + + // message unmarshal + message, err := binary.Unmarshal(d) + if err != nil { + return nil, fmt.Errorf("error decoding binary: %v", err) + } + + return message, nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/contact.go b/vendor/github.com/Rhymen/go-whatsapp/contact.go new file mode 100644 index 00000000..a025a488 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/contact.go @@ -0,0 +1,267 @@ +package whatsapp + +import ( + "fmt" + "github.com/Rhymen/go-whatsapp/binary" + "strconv" + "time" +) + +type Presence string + +const ( + PresenceAvailable = "available" + PresenceUnavailable = "unavailable" + PresenceComposing = "composing" + PresenceRecording = "recording" + PresencePaused = "paused" +) + +//TODO: filename? WhatsApp uses Store.Contacts for these functions +//TODO: functions probably shouldn't return a string, maybe build a struct / return json +//TODO: check for further queries +func (wac *Conn) GetProfilePicThumb(jid string) (<-chan string, error) { + data := []interface{}{"query", "ProfilePicThumb", jid} + return wac.write(data) +} + +func (wac *Conn) GetStatus(jid string) (<-chan string, error) { + data := []interface{}{"query", "Status", jid} + return wac.write(data) +} + +func (wac *Conn) GetGroupMetaData(jid string) (<-chan string, error) { + data := []interface{}{"query", "GroupMetadata", jid} + return wac.write(data) +} + +func (wac *Conn) SubscribePresence(jid string) (<-chan string, error) { + data := []interface{}{"action", "presence", "subscribe", jid} + return wac.write(data) +} + +func (wac *Conn) CreateGroup(subject string, participants []string) (<-chan string, error) { + return wac.setGroup("create", "", subject, participants) +} + +func (wac *Conn) UpdateGroupSubject(subject string, jid string) (<-chan string, error) { + return wac.setGroup("subject", jid, subject, nil) +} + +func (wac *Conn) SetAdmin(jid string, participants []string) (<-chan string, error) { + return wac.setGroup("promote", jid, "", participants) +} + +func (wac *Conn) RemoveAdmin(jid string, participants []string) (<-chan string, error) { + return wac.setGroup("demote", jid, "", participants) +} + +func (wac *Conn) AddMember(jid string, participants []string) (<-chan string, error) { + return wac.setGroup("add", jid, "", participants) +} + +func (wac *Conn) RemoveMember(jid string, participants []string) (<-chan string, error) { + return wac.setGroup("remove", jid, "", participants) +} + +func (wac *Conn) LeaveGroup(jid string) (<-chan string, error) { + return wac.setGroup("leave", jid, "", nil) +} + +func (wac *Conn) Search(search string, count, page int) (*binary.Node, error) { + return wac.query("search", "", "", "", "", search, count, page) +} + +func (wac *Conn) LoadMessages(jid, messageId string, count int) (*binary.Node, error) { + return wac.query("message", jid, "", "before", "true", "", count, 0) +} + +func (wac *Conn) LoadMessagesBefore(jid, messageId string, count int) (*binary.Node, error) { + return wac.query("message", jid, messageId, "before", "true", "", count, 0) +} + +func (wac *Conn) LoadMessagesAfter(jid, messageId string, count int) (*binary.Node, error) { + return wac.query("message", jid, messageId, "after", "true", "", count, 0) +} + +func (wac *Conn) Presence(jid string, presence Presence) (<-chan string, error) { + ts := time.Now().Unix() + tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount) + + content := binary.Node{ + Description: "presence", + Attributes: map[string]string{ + "type": string(presence), + }, + } + switch presence { + case PresenceComposing: + fallthrough + case PresenceRecording: + fallthrough + case PresencePaused: + content.Attributes["to"] = jid + } + + n := binary.Node{ + Description: "action", + Attributes: map[string]string{ + "type": "set", + "epoch": strconv.Itoa(wac.msgCount), + }, + Content: []interface{}{content}, + } + + return wac.writeBinary(n, group, ignore, tag) +} + +func (wac *Conn) Exist(jid string) (<-chan string, error) { + data := []interface{}{"query", "exist", jid} + return wac.write(data) +} + +func (wac *Conn) Emoji() (*binary.Node, error) { + return wac.query("emoji", "", "", "", "", "", 0, 0) +} + +func (wac *Conn) Contacts() (*binary.Node, error) { + return wac.query("contacts", "", "", "", "", "", 0, 0) +} + +func (wac *Conn) Chats() (*binary.Node, error) { + return wac.query("chat", "", "", "", "", "", 0, 0) +} + +func (wac *Conn) Read(jid, id string) (<-chan string, error) { + ts := time.Now().Unix() + tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount) + + n := binary.Node{ + Description: "action", + Attributes: map[string]string{ + "type": "set", + "epoch": strconv.Itoa(wac.msgCount), + }, + Content: []interface{}{binary.Node{ + Description: "read", + Attributes: map[string]string{ + "count": "1", + "index": id, + "jid": jid, + "owner": "false", + }, + }}, + } + + return wac.writeBinary(n, group, ignore, tag) +} + +func (wac *Conn) query(t, jid, messageId, kind, owner, search string, count, page int) (*binary.Node, error) { + ts := time.Now().Unix() + tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount) + + n := binary.Node{ + Description: "query", + Attributes: map[string]string{ + "type": t, + "epoch": strconv.Itoa(wac.msgCount), + }, + } + + if jid != "" { + n.Attributes["jid"] = jid + } + + if messageId != "" { + n.Attributes["index"] = messageId + } + + if kind != "" { + n.Attributes["kind"] = kind + } + + if owner != "" { + n.Attributes["owner"] = owner + } + + if search != "" { + n.Attributes["search"] = search + } + + if count != 0 { + n.Attributes["count"] = strconv.Itoa(count) + } + + if page != 0 { + n.Attributes["page"] = strconv.Itoa(page) + } + + ch, err := wac.writeBinary(n, group, ignore, tag) + if err != nil { + return nil, err + } + + msg, err := wac.decryptBinaryMessage([]byte(<-ch)) + if err != nil { + return nil, err + } + + //TODO: use parseProtoMessage + return msg, nil +} + +func (wac *Conn) setGroup(t, jid, subject string, participants []string) (<-chan string, error) { + ts := time.Now().Unix() + tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount) + + //TODO: get proto or improve encoder to handle []interface{} + + p := buildParticipantNodes(participants) + + g := binary.Node{ + Description: "group", + Attributes: map[string]string{ + "author": wac.session.Wid, + "id": tag, + "type": t, + }, + Content: p, + } + + if jid != "" { + g.Attributes["jid"] = jid + } + + if subject != "" { + g.Attributes["subject"] = subject + } + + n := binary.Node{ + Description: "action", + Attributes: map[string]string{ + "type": "set", + "epoch": strconv.Itoa(wac.msgCount), + }, + Content: []interface{}{g}, + } + + return wac.writeBinary(n, group, ignore, tag) +} + +func buildParticipantNodes(participants []string) []binary.Node { + l := len(participants) + if participants == nil || l == 0 { + return nil + } + + p := make([]binary.Node, len(participants)) + for i, participant := range participants { + p[i] = binary.Node{ + Description: "participant", + Attributes: map[string]string{ + "jid": participant, + }, + } + } + return p +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/crypto/cbc/cbc.go b/vendor/github.com/Rhymen/go-whatsapp/crypto/cbc/cbc.go new file mode 100644 index 00000000..cc5427c3 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/crypto/cbc/cbc.go @@ -0,0 +1,101 @@ +/* +CBC describes a block cipher mode. In cryptography, a block cipher mode of operation is an algorithm that uses a +block cipher to provide an information service such as confidentiality or authenticity. A block cipher by itself +is only suitable for the secure cryptographic transformation (encryption or decryption) of one fixed-length group of +bits called a block. A mode of operation describes how to repeatedly apply a cipher's single-block operation to +securely transform amounts of data larger than a block. + +This package simplifies the usage of AES-256-CBC. +*/ +package cbc + +/* +Some code is provided by the GitHub user locked (github.com/locked): +https://gist.github.com/locked/b066aa1ddeb2b28e855e +Thanks! +*/ +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "fmt" + "io" +) + +/* +Decrypt is a function that decrypts a given cipher text with a provided key and initialization vector(iv). +*/ +func Decrypt(key, iv, ciphertext []byte) ([]byte, error) { + block, err := aes.NewCipher(key) + + if err != nil { + return nil, err + } + + if len(ciphertext) < aes.BlockSize { + return nil, fmt.Errorf("ciphertext is shorter then block size: %d / %d", len(ciphertext), aes.BlockSize) + } + + if iv == nil { + iv = ciphertext[:aes.BlockSize] + ciphertext = ciphertext[aes.BlockSize:] + } + + cbc := cipher.NewCBCDecrypter(block, iv) + cbc.CryptBlocks(ciphertext, ciphertext) + + return unpad(ciphertext) +} + +/* +Encrypt is a function that encrypts plaintext with a given key and an optional initialization vector(iv). +*/ +func Encrypt(key, iv, plaintext []byte) ([]byte, error) { + plaintext = pad(plaintext, aes.BlockSize) + + if len(plaintext)%aes.BlockSize != 0 { + return nil, fmt.Errorf("plaintext is not a multiple of the block size: %d / %d", len(plaintext), aes.BlockSize) + } + + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + + var ciphertext []byte + if iv == nil { + ciphertext = make([]byte, aes.BlockSize+len(plaintext)) + iv := ciphertext[:aes.BlockSize] + if _, err := io.ReadFull(rand.Reader, iv); err != nil { + return nil, err + } + + cbc := cipher.NewCBCEncrypter(block, iv) + cbc.CryptBlocks(ciphertext[aes.BlockSize:], plaintext) + } else { + ciphertext = make([]byte, len(plaintext)) + + cbc := cipher.NewCBCEncrypter(block, iv) + cbc.CryptBlocks(ciphertext, plaintext) + } + + return ciphertext, nil +} + +func pad(ciphertext []byte, blockSize int) []byte { + padding := blockSize - len(ciphertext)%blockSize + padtext := bytes.Repeat([]byte{byte(padding)}, padding) + return append(ciphertext, padtext...) +} + +func unpad(src []byte) ([]byte, error) { + length := len(src) + padLen := int(src[length-1]) + + if padLen > length { + return nil, fmt.Errorf("padding is greater then the length: %d / %d", padLen, length) + } + + return src[:(length - padLen)], nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go b/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go new file mode 100644 index 00000000..5ddf9c9a --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go @@ -0,0 +1,44 @@ +/* +In cryptography, Curve25519 is an elliptic curve offering 128 bits of security and designed for use with the elliptic +curve Diffie–Hellman (ECDH) key agreement scheme. It is one of the fastest ECC curves and is not covered by any known +patents. The reference implementation is public domain software. The original Curve25519 paper defined it +as a Diffie–Hellman (DH) function. +*/ +package curve25519 + +import ( + "crypto/rand" + "golang.org/x/crypto/curve25519" + "io" +) + +/* +GenerateKey generates a public private key pair using Curve25519. +*/ +func GenerateKey() (privateKey *[32]byte, publicKey *[32]byte, err error) { + var pub, priv [32]byte + + _, err = io.ReadFull(rand.Reader, priv[:]) + if err != nil { + return nil, nil, err + } + + priv[0] &= 248 + priv[31] &= 127 + priv[31] |= 64 + + curve25519.ScalarBaseMult(&pub, &priv) + + return &priv, &pub, nil +} + +/* +GenerateSharedSecret generates the shared secret with a given public private key pair. +*/ +func GenerateSharedSecret(priv, pub [32]byte) []byte { + var secret [32]byte + + curve25519.ScalarMult(&secret, &priv, &pub) + + return secret[:] +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/crypto/hkdf/hkdf.go b/vendor/github.com/Rhymen/go-whatsapp/crypto/hkdf/hkdf.go new file mode 100644 index 00000000..e0be0587 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/crypto/hkdf/hkdf.go @@ -0,0 +1,52 @@ +/* +HKDF is a simple key derivation function (KDF) based on +a hash-based message authentication code (HMAC). It was initially proposed by its authors as a building block in +various protocols and applications, as well as to discourage the proliferation of multiple KDF mechanisms. +The main approach HKDF follows is the "extract-then-expand" paradigm, where the KDF logically consists of two modules: +the first stage takes the input keying material and "extracts" from it a fixed-length pseudorandom key, and then the +second stage "expands" this key into several additional pseudorandom keys (the output of the KDF). +*/ +package hkdf + +import ( + "crypto/hmac" + "crypto/sha256" + "fmt" + "golang.org/x/crypto/hkdf" + "io" +) + +/* +Expand expands a given key with the HKDF algorithm. +*/ +func Expand(key []byte, length int, info string) ([]byte, error) { + if info == "" { + keyBlock := hmac.New(sha256.New, key) + var out, last []byte + + var blockIndex byte = 1 + for i := 0; len(out) < length; i++ { + keyBlock.Reset() + //keyBlock.Write(append(append(last, []byte(info)...), blockIndex)) + keyBlock.Write(last) + keyBlock.Write([]byte(info)) + keyBlock.Write([]byte{blockIndex}) + last = keyBlock.Sum(nil) + blockIndex += 1 + out = append(out, last...) + } + return out[:length], nil + } else { + h := hkdf.New(sha256.New, key, nil, []byte(info)) + out := make([]byte, length) + n, err := io.ReadAtLeast(h, out, length) + if err != nil { + return nil, err + } + if n != length { + return nil, fmt.Errorf("new key to short") + } + + return out[:length], nil + } +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/go.mod b/vendor/github.com/Rhymen/go-whatsapp/go.mod new file mode 100644 index 00000000..e5e3da3a --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/go.mod @@ -0,0 +1,8 @@ +module github.com/Rhymen/go-whatsapp + +require ( + github.com/golang/protobuf v1.2.0 + github.com/gorilla/websocket v1.4.0 + golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613 + golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect +) diff --git a/vendor/github.com/Rhymen/go-whatsapp/go.sum b/vendor/github.com/Rhymen/go-whatsapp/go.sum new file mode 100644 index 00000000..07746286 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/go.sum @@ -0,0 +1,4 @@ +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/github.com/Rhymen/go-whatsapp/handler.go b/vendor/github.com/Rhymen/go-whatsapp/handler.go new file mode 100644 index 00000000..62522bd5 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/handler.go @@ -0,0 +1,169 @@ +package whatsapp + +import ( + "fmt" + "github.com/Rhymen/go-whatsapp/binary" + "github.com/Rhymen/go-whatsapp/binary/proto" + "os" +) + +/* +The Handler interface is the minimal interface that needs to be implemented +to be accepted as a valid handler for our dispatching system. +The minimal handler is used to dispatch error messages. These errors occur on unexpected behavior by the websocket +connection or if we are unable to handle or interpret an incoming message. Error produced by user actions are not +dispatched through this handler. They are returned as an error on the specific function call. +*/ +type Handler interface { + HandleError(err error) +} + +/* +The TextMessageHandler interface needs to be implemented to receive text messages dispatched by the dispatcher. +*/ +type TextMessageHandler interface { + Handler + HandleTextMessage(message TextMessage) +} + +/* +The ImageMessageHandler interface needs to be implemented to receive image messages dispatched by the dispatcher. +*/ +type ImageMessageHandler interface { + Handler + HandleImageMessage(message ImageMessage) +} + +/* +The VideoMessageHandler interface needs to be implemented to receive video messages dispatched by the dispatcher. +*/ +type VideoMessageHandler interface { + Handler + HandleVideoMessage(message VideoMessage) +} + +/* +The AudioMessageHandler interface needs to be implemented to receive audio messages dispatched by the dispatcher. +*/ +type AudioMessageHandler interface { + Handler + HandleAudioMessage(message AudioMessage) +} + +/* +The DocumentMessageHandler interface needs to be implemented to receive document messages dispatched by the dispatcher. +*/ +type DocumentMessageHandler interface { + Handler + HandleDocumentMessage(message DocumentMessage) +} + +/* +The JsonMessageHandler interface needs to be implemented to receive json messages dispatched by the dispatcher. +These json messages contain status updates of every kind sent by WhatsAppWeb servers. WhatsAppWeb uses these messages +to built a Store, which is used to save these "secondary" information. These messages may contain +presence (available, last see) information, or just the battery status of your phone. +*/ +type JsonMessageHandler interface { + Handler + HandleJsonMessage(message string) +} + +/** +The RawMessageHandler interface needs to be implemented to receive raw messages dispatched by the dispatcher. +Raw messages are the raw protobuf structs instead of the easy-to-use structs in TextMessageHandler, ImageMessageHandler, etc.. +*/ +type RawMessageHandler interface { + Handler + HandleRawMessage(message *proto.WebMessageInfo) +} + +/* +AddHandler adds an handler to the list of handler that receive dispatched messages. +The provided handler must at least implement the Handler interface. Additionally implemented +handlers(TextMessageHandler, ImageMessageHandler) are optional. At runtime it is checked if they are implemented +and they are called if so and needed. +*/ +func (wac *Conn) AddHandler(handler Handler) { + wac.handler = append(wac.handler, handler) +} + +func (wac *Conn) handle(message interface{}) { + switch m := message.(type) { + case error: + for _, h := range wac.handler { + go h.HandleError(m) + } + case string: + for _, h := range wac.handler { + if x, ok := h.(JsonMessageHandler); ok { + go x.HandleJsonMessage(m) + } + } + case TextMessage: + for _, h := range wac.handler { + if x, ok := h.(TextMessageHandler); ok { + go x.HandleTextMessage(m) + } + } + case ImageMessage: + for _, h := range wac.handler { + if x, ok := h.(ImageMessageHandler); ok { + go x.HandleImageMessage(m) + } + } + case VideoMessage: + for _, h := range wac.handler { + if x, ok := h.(VideoMessageHandler); ok { + go x.HandleVideoMessage(m) + } + } + case AudioMessage: + for _, h := range wac.handler { + if x, ok := h.(AudioMessageHandler); ok { + go x.HandleAudioMessage(m) + } + } + case DocumentMessage: + for _, h := range wac.handler { + if x, ok := h.(DocumentMessageHandler); ok { + go x.HandleDocumentMessage(m) + } + } + case *proto.WebMessageInfo: + for _, h := range wac.handler { + if x, ok := h.(RawMessageHandler); ok { + go x.HandleRawMessage(m) + } + } + } + +} + +func (wac *Conn) dispatch(msg interface{}) { + if msg == nil { + return + } + + switch message := msg.(type) { + case *binary.Node: + if message.Description == "action" { + if con, ok := message.Content.([]interface{}); ok { + for a := range con { + if v, ok := con[a].(*proto.WebMessageInfo); ok { + wac.handle(v) + wac.handle(parseProtoMessage(v)) + } + } + } + } else if message.Description == "response" && message.Attributes["type"] == "contacts" { + wac.updateContacts(message.Content) + } + case error: + wac.handle(message) + case string: + wac.handle(message) + default: + fmt.Fprintf(os.Stderr, "unknown type in dipatcher chan: %T", msg) + } +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/media.go b/vendor/github.com/Rhymen/go-whatsapp/media.go new file mode 100644 index 00000000..6e2a4371 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/media.go @@ -0,0 +1,199 @@ +package whatsapp + +import ( + "bytes" + "crypto/hmac" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "github.com/Rhymen/go-whatsapp/crypto/cbc" + "github.com/Rhymen/go-whatsapp/crypto/hkdf" + "io" + "io/ioutil" + "mime/multipart" + "net/http" + "os" + "strings" + "time" +) + +func Download(url string, mediaKey []byte, appInfo MediaType, fileLength int) ([]byte, error) { + if url == "" { + return nil, fmt.Errorf("no url present") + } + file, mac, err := downloadMedia(url) + if err != nil { + return nil, err + } + iv, cipherKey, macKey, _, err := getMediaKeys(mediaKey, appInfo) + if err != nil { + return nil, err + } + if err = validateMedia(iv, file, macKey, mac); err != nil { + return nil, err + } + data, err := cbc.Decrypt(cipherKey, iv, file) + if err != nil { + return nil, err + } + if len(data) != fileLength { + return nil, fmt.Errorf("file length does not match") + } + return data, nil +} + +func validateMedia(iv []byte, file []byte, macKey []byte, mac []byte) error { + h := hmac.New(sha256.New, macKey) + n, err := h.Write(append(iv, file...)) + if err != nil { + return err + } + if n < 10 { + return fmt.Errorf("hash to short") + } + if !hmac.Equal(h.Sum(nil)[:10], mac) { + return fmt.Errorf("invalid media hmac") + } + return nil +} + +func getMediaKeys(mediaKey []byte, appInfo MediaType) (iv, cipherKey, macKey, refKey []byte, err error) { + mediaKeyExpanded, err := hkdf.Expand(mediaKey, 112, string(appInfo)) + if err != nil { + return nil, nil, nil, nil, err + } + return mediaKeyExpanded[:16], mediaKeyExpanded[16:48], mediaKeyExpanded[48:80], mediaKeyExpanded[80:], nil +} + +func downloadMedia(url string) (file []byte, mac []byte, err error) { + resp, err := http.Get(url) + if err != nil { + return nil, nil, err + } + if resp.StatusCode != 200 { + return nil, nil, fmt.Errorf("download failed") + } + defer resp.Body.Close() + if resp.ContentLength <= 10 { + return nil, nil, fmt.Errorf("file to short") + } + data, err := ioutil.ReadAll(resp.Body) + n := len(data) + if err != nil { + return nil, nil, err + } + return data[:n-10], data[n-10 : n], nil +} + +func (wac *Conn) Upload(reader io.Reader, appInfo MediaType) (url string, mediaKey []byte, fileEncSha256 []byte, fileSha256 []byte, fileLength uint64, err error) { + data, err := ioutil.ReadAll(reader) + if err != nil { + return "", nil, nil, nil, 0, err + } + + mediaKey = make([]byte, 32) + rand.Read(mediaKey) + + iv, cipherKey, macKey, _, err := getMediaKeys(mediaKey, appInfo) + if err != nil { + return "", nil, nil, nil, 0, err + } + + enc, err := cbc.Encrypt(cipherKey, iv, data) + if err != nil { + return "", nil, nil, nil, 0, err + } + + fileLength = uint64(len(data)) + + h := hmac.New(sha256.New, macKey) + h.Write(append(iv, enc...)) + mac := h.Sum(nil)[:10] + + sha := sha256.New() + sha.Write(data) + fileSha256 = sha.Sum(nil) + + sha.Reset() + sha.Write(append(enc, mac...)) + fileEncSha256 = sha.Sum(nil) + + var filetype string + switch appInfo { + case MediaImage: + filetype = "image" + case MediaAudio: + filetype = "audio" + case MediaDocument: + filetype = "document" + case MediaVideo: + filetype = "video" + } + + uploadReq := []interface{}{"action", "encr_upload", filetype, base64.StdEncoding.EncodeToString(fileEncSha256)} + ch, err := wac.write(uploadReq) + if err != nil { + return "", nil, nil, nil, 0, err + } + + var resp map[string]interface{} + select { + case r := <-ch: + if err = json.Unmarshal([]byte(r), &resp); err != nil { + return "", nil, nil, nil, 0, fmt.Errorf("error decoding upload response: %v\n", err) + } + case <-time.After(wac.msgTimeout): + return "", nil, nil, nil, 0, fmt.Errorf("restore session init timed out") + } + + if int(resp["status"].(float64)) != 200 { + return "", nil, nil, nil, 0, fmt.Errorf("upload responsed with %d", resp["status"]) + } + + var b bytes.Buffer + w := multipart.NewWriter(&b) + hashWriter, err := w.CreateFormField("hash") + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + } + io.Copy(hashWriter, strings.NewReader(base64.StdEncoding.EncodeToString(fileEncSha256))) + + fileWriter, err := w.CreateFormFile("file", "blob") + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + } + io.Copy(fileWriter, bytes.NewReader(append(enc, mac...))) + err = w.Close() + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + } + + req, err := http.NewRequest("POST", resp["url"].(string), &b) + if err != nil { + return "", nil, nil, nil, 0, err + } + + req.Header.Set("Content-Type", w.FormDataContentType()) + req.Header.Set("Origin", "https://web.whatsapp.com") + req.Header.Set("Referer", "https://web.whatsapp.com/") + + req.URL.Query().Set("f", "j") + + client := &http.Client{} + // Submit the request + res, err := client.Do(req) + if err != nil { + return "", nil, nil, nil, 0, err + } + + if res.StatusCode != http.StatusOK { + return "", nil, nil, nil, 0, fmt.Errorf("upload failed with status code %d", res.StatusCode) + } + + var jsonRes map[string]string + json.NewDecoder(res.Body).Decode(&jsonRes) + + return jsonRes["url"], mediaKey, fileEncSha256, fileSha256, fileLength, nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/message.go b/vendor/github.com/Rhymen/go-whatsapp/message.go new file mode 100644 index 00000000..042d600a --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/message.go @@ -0,0 +1,455 @@ +package whatsapp + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "github.com/Rhymen/go-whatsapp/binary" + "github.com/Rhymen/go-whatsapp/binary/proto" + "io" + "math/rand" + "strconv" + "strings" + "time" +) + +type MediaType string + +const ( + MediaImage MediaType = "WhatsApp Image Keys" + MediaVideo MediaType = "WhatsApp Video Keys" + MediaAudio MediaType = "WhatsApp Audio Keys" + MediaDocument MediaType = "WhatsApp Document Keys" +) + +func (wac *Conn) Send(msg interface{}) error { + var err error + var ch <-chan string + + switch m := msg.(type) { + case *proto.WebMessageInfo: + ch, err = wac.sendProto(m) + case TextMessage: + ch, err = wac.sendProto(getTextProto(m)) + case ImageMessage: + m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaImage) + if err != nil { + return fmt.Errorf("image upload failed: %v", err) + } + ch, err = wac.sendProto(getImageProto(m)) + case VideoMessage: + m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaVideo) + if err != nil { + return fmt.Errorf("video upload failed: %v", err) + } + ch, err = wac.sendProto(getVideoProto(m)) + case DocumentMessage: + m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaDocument) + if err != nil { + return fmt.Errorf("document upload failed: %v", err) + } + ch, err = wac.sendProto(getDocumentProto(m)) + case AudioMessage: + m.url, m.mediaKey, m.fileEncSha256, m.fileSha256, m.fileLength, err = wac.Upload(m.Content, MediaAudio) + if err != nil { + return fmt.Errorf("audio upload failed: %v", err) + } + ch, err = wac.sendProto(getAudioProto(m)) + default: + return fmt.Errorf("cannot match type %T, use message types declared in the package", msg) + } + + if err != nil { + return fmt.Errorf("could not send proto: %v", err) + } + + select { + case response := <-ch: + var resp map[string]interface{} + if err = json.Unmarshal([]byte(response), &resp); err != nil { + return fmt.Errorf("error decoding sending response: %v\n", err) + } + if int(resp["status"].(float64)) != 200 { + return fmt.Errorf("message sending responded with %d", resp["status"]) + } + case <-time.After(wac.msgTimeout): + return fmt.Errorf("sending message timed out") + } + + return nil +} + +func (wac *Conn) sendProto(p *proto.WebMessageInfo) (<-chan string, error) { + n := binary.Node{ + Description: "action", + Attributes: map[string]string{ + "type": "relay", + "epoch": strconv.Itoa(wac.msgCount), + }, + Content: []interface{}{p}, + } + return wac.writeBinary(n, message, ignore, p.Key.GetId()) +} + +func init() { + rand.Seed(time.Now().UTC().UnixNano()) +} + +/* +MessageInfo contains general message information. It is part of every of every message type. +*/ +type MessageInfo struct { + Id string + RemoteJid string + SenderJid string + FromMe bool + Timestamp uint64 + PushName string + Status MessageStatus + QuotedMessageID string + + Source *proto.WebMessageInfo +} + +type MessageStatus int + +const ( + Error MessageStatus = 0 + Pending = 1 + ServerAck = 2 + DeliveryAck = 3 + Read = 4 + Played = 5 +) + +func getMessageInfo(msg *proto.WebMessageInfo) MessageInfo { + return MessageInfo{ + Id: msg.GetKey().GetId(), + RemoteJid: msg.GetKey().GetRemoteJid(), + SenderJid: msg.GetKey().GetParticipant(), + FromMe: msg.GetKey().GetFromMe(), + Timestamp: msg.GetMessageTimestamp(), + Status: MessageStatus(msg.GetStatus()), + PushName: msg.GetPushName(), + Source: msg, + } +} + +func getInfoProto(info *MessageInfo) *proto.WebMessageInfo { + if info.Id == "" || len(info.Id) < 2 { + b := make([]byte, 10) + rand.Read(b) + info.Id = strings.ToUpper(hex.EncodeToString(b)) + } + if info.Timestamp == 0 { + info.Timestamp = uint64(time.Now().Unix()) + } + info.FromMe = true + + status := proto.WebMessageInfo_STATUS(info.Status) + + return &proto.WebMessageInfo{ + Key: &proto.MessageKey{ + FromMe: &info.FromMe, + RemoteJid: &info.RemoteJid, + Id: &info.Id, + }, + MessageTimestamp: &info.Timestamp, + Status: &status, + } +} + +/* +TextMessage represents a text message. +*/ +type TextMessage struct { + Info MessageInfo + Text string +} + +func getTextMessage(msg *proto.WebMessageInfo) TextMessage { + text := TextMessage{Info: getMessageInfo(msg)} + if m := msg.GetMessage().GetExtendedTextMessage(); m != nil { + text.Text = m.GetText() + text.Info.QuotedMessageID = m.GetContextInfo().GetStanzaId() + } else { + text.Text = msg.GetMessage().GetConversation() + } + return text +} + +func getTextProto(msg TextMessage) *proto.WebMessageInfo { + p := getInfoProto(&msg.Info) + p.Message = &proto.Message{ + Conversation: &msg.Text, + } + if msg.Info.QuotedMessageID != "" { + previousText := "previous" + p.Message.ExtendedTextMessage = &proto.ExtendedTextMessage{ + ContextInfo: &proto.ContextInfo{ + StanzaId: &msg.Info.QuotedMessageID, + QuotedMessage: []*proto.Message{ + &proto.Message{ + Conversation: &previousText, + }, + }, + }, + } + } + return p +} + +/* +ImageMessage represents a image message. Unexported fields are needed for media up/downloading and media validation. +Provide a io.Reader as Content for message sending. +*/ +type ImageMessage struct { + Info MessageInfo + Caption string + Thumbnail []byte + Type string + Content io.Reader + url string + mediaKey []byte + fileEncSha256 []byte + fileSha256 []byte + fileLength uint64 +} + +func getImageMessage(msg *proto.WebMessageInfo) ImageMessage { + image := msg.GetMessage().GetImageMessage() + return ImageMessage{ + Info: getMessageInfo(msg), + Caption: image.GetCaption(), + Thumbnail: image.GetJpegThumbnail(), + url: image.GetUrl(), + mediaKey: image.GetMediaKey(), + Type: image.GetMimetype(), + fileEncSha256: image.GetFileEncSha256(), + fileSha256: image.GetFileSha256(), + fileLength: image.GetFileLength(), + } +} + +func getImageProto(msg ImageMessage) *proto.WebMessageInfo { + p := getInfoProto(&msg.Info) + p.Message = &proto.Message{ + ImageMessage: &proto.ImageMessage{ + Caption: &msg.Caption, + JpegThumbnail: msg.Thumbnail, + Url: &msg.url, + MediaKey: msg.mediaKey, + Mimetype: &msg.Type, + FileEncSha256: msg.fileEncSha256, + FileSha256: msg.fileSha256, + FileLength: &msg.fileLength, + }, + } + return p +} + +/* +Download is the function to retrieve media data. The media gets downloaded, validated and returned. +*/ +func (m *ImageMessage) Download() ([]byte, error) { + return Download(m.url, m.mediaKey, MediaImage, int(m.fileLength)) +} + +/* +VideoMessage represents a video message. Unexported fields are needed for media up/downloading and media validation. +Provide a io.Reader as Content for message sending. +*/ +type VideoMessage struct { + Info MessageInfo + Caption string + Thumbnail []byte + Length uint32 + Type string + Content io.Reader + url string + mediaKey []byte + fileEncSha256 []byte + fileSha256 []byte + fileLength uint64 +} + +func getVideoMessage(msg *proto.WebMessageInfo) VideoMessage { + vid := msg.GetMessage().GetVideoMessage() + return VideoMessage{ + Info: getMessageInfo(msg), + Caption: vid.GetCaption(), + Thumbnail: vid.GetJpegThumbnail(), + url: vid.GetUrl(), + mediaKey: vid.GetMediaKey(), + Length: vid.GetSeconds(), + Type: vid.GetMimetype(), + fileEncSha256: vid.GetFileEncSha256(), + fileSha256: vid.GetFileSha256(), + fileLength: vid.GetFileLength(), + } +} + +func getVideoProto(msg VideoMessage) *proto.WebMessageInfo { + p := getInfoProto(&msg.Info) + p.Message = &proto.Message{ + VideoMessage: &proto.VideoMessage{ + Caption: &msg.Caption, + JpegThumbnail: msg.Thumbnail, + Url: &msg.url, + MediaKey: msg.mediaKey, + Seconds: &msg.Length, + FileEncSha256: msg.fileEncSha256, + FileSha256: msg.fileSha256, + FileLength: &msg.fileLength, + Mimetype: &msg.Type, + }, + } + return p +} + +/* +Download is the function to retrieve media data. The media gets downloaded, validated and returned. +*/ +func (m *VideoMessage) Download() ([]byte, error) { + return Download(m.url, m.mediaKey, MediaVideo, int(m.fileLength)) +} + +/* +AudioMessage represents a audio message. Unexported fields are needed for media up/downloading and media validation. +Provide a io.Reader as Content for message sending. +*/ +type AudioMessage struct { + Info MessageInfo + Length uint32 + Type string + Content io.Reader + url string + mediaKey []byte + fileEncSha256 []byte + fileSha256 []byte + fileLength uint64 +} + +func getAudioMessage(msg *proto.WebMessageInfo) AudioMessage { + aud := msg.GetMessage().GetAudioMessage() + return AudioMessage{ + Info: getMessageInfo(msg), + url: aud.GetUrl(), + mediaKey: aud.GetMediaKey(), + Length: aud.GetSeconds(), + Type: aud.GetMimetype(), + fileEncSha256: aud.GetFileEncSha256(), + fileSha256: aud.GetFileSha256(), + fileLength: aud.GetFileLength(), + } +} + +func getAudioProto(msg AudioMessage) *proto.WebMessageInfo { + p := getInfoProto(&msg.Info) + p.Message = &proto.Message{ + AudioMessage: &proto.AudioMessage{ + Url: &msg.url, + MediaKey: msg.mediaKey, + Seconds: &msg.Length, + FileEncSha256: msg.fileEncSha256, + FileSha256: msg.fileSha256, + FileLength: &msg.fileLength, + Mimetype: &msg.Type, + }, + } + return p +} + +/* +Download is the function to retrieve media data. The media gets downloaded, validated and returned. +*/ +func (m *AudioMessage) Download() ([]byte, error) { + return Download(m.url, m.mediaKey, MediaAudio, int(m.fileLength)) +} + +/* +DocumentMessage represents a document message. Unexported fields are needed for media up/downloading and media +validation. Provide a io.Reader as Content for message sending. +*/ +type DocumentMessage struct { + Info MessageInfo + Title string + PageCount uint32 + Type string + Thumbnail []byte + Content io.Reader + url string + mediaKey []byte + fileEncSha256 []byte + fileSha256 []byte + fileLength uint64 +} + +func getDocumentMessage(msg *proto.WebMessageInfo) DocumentMessage { + doc := msg.GetMessage().GetDocumentMessage() + return DocumentMessage{ + Info: getMessageInfo(msg), + Thumbnail: doc.GetJpegThumbnail(), + url: doc.GetUrl(), + mediaKey: doc.GetMediaKey(), + fileEncSha256: doc.GetFileEncSha256(), + fileSha256: doc.GetFileSha256(), + fileLength: doc.GetFileLength(), + PageCount: doc.GetPageCount(), + Title: doc.GetTitle(), + Type: doc.GetMimetype(), + } +} + +func getDocumentProto(msg DocumentMessage) *proto.WebMessageInfo { + p := getInfoProto(&msg.Info) + p.Message = &proto.Message{ + DocumentMessage: &proto.DocumentMessage{ + JpegThumbnail: msg.Thumbnail, + Url: &msg.url, + MediaKey: msg.mediaKey, + FileEncSha256: msg.fileEncSha256, + FileSha256: msg.fileSha256, + FileLength: &msg.fileLength, + PageCount: &msg.PageCount, + Title: &msg.Title, + Mimetype: &msg.Type, + }, + } + return p +} + +/* +Download is the function to retrieve media data. The media gets downloaded, validated and returned. +*/ +func (m *DocumentMessage) Download() ([]byte, error) { + return Download(m.url, m.mediaKey, MediaDocument, int(m.fileLength)) +} + +func parseProtoMessage(msg *proto.WebMessageInfo) interface{} { + switch { + + case msg.GetMessage().GetAudioMessage() != nil: + return getAudioMessage(msg) + + case msg.GetMessage().GetImageMessage() != nil: + return getImageMessage(msg) + + case msg.GetMessage().GetVideoMessage() != nil: + return getVideoMessage(msg) + + case msg.GetMessage().GetDocumentMessage() != nil: + return getDocumentMessage(msg) + + case msg.GetMessage().GetConversation() != "": + return getTextMessage(msg) + + case msg.GetMessage().GetExtendedTextMessage() != nil: + return getTextMessage(msg) + + default: + //cannot match message + } + + return nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/session.go b/vendor/github.com/Rhymen/go-whatsapp/session.go new file mode 100644 index 00000000..8b464310 --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/session.go @@ -0,0 +1,389 @@ +package whatsapp + +import ( + "crypto/hmac" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "time" + + "github.com/Rhymen/go-whatsapp/crypto/cbc" + "github.com/Rhymen/go-whatsapp/crypto/curve25519" + "github.com/Rhymen/go-whatsapp/crypto/hkdf" +) + +/* +Session contains session individual information. To be able to resume the connection without scanning the qr code +every time you should save the Session returned by Login and use RestoreSession the next time you want to login. +Every successful created connection returns a new Session. The Session(ClientToken, ServerToken) is altered after +every re-login and should be saved every time. +*/ +type Session struct { + ClientId string + ClientToken string + ServerToken string + EncKey []byte + MacKey []byte + Wid string +} + +type Info struct { + Battery int + Platform string + Connected bool + Pushname string + Wid string + Lc string + Phone *PhoneInfo + Plugged bool + Tos int + Lg string + Is24h bool +} + +type PhoneInfo struct { + Mcc string + Mnc string + OsVersion string + DeviceManufacturer string + DeviceModel string + OsBuildNumber string + WaVersion string +} + +func newInfoFromReq(info map[string]interface{}) *Info { + phoneInfo := info["phone"].(map[string]interface{}) + + ret := &Info{ + Battery: int(info["battery"].(float64)), + Platform: info["platform"].(string), + Connected: info["connected"].(bool), + Pushname: info["pushname"].(string), + Wid: info["wid"].(string), + Lc: info["lc"].(string), + Phone: &PhoneInfo{ + phoneInfo["mcc"].(string), + phoneInfo["mnc"].(string), + phoneInfo["os_version"].(string), + phoneInfo["device_manufacturer"].(string), + phoneInfo["device_model"].(string), + phoneInfo["os_build_number"].(string), + phoneInfo["wa_version"].(string), + }, + Plugged: info["plugged"].(bool), + Lg: info["lg"].(string), + Tos: int(info["tos"].(float64)), + } + + if is24h, ok := info["is24h"]; ok { + ret.Is24h = is24h.(bool) + } + + return ret +} + +/* +SetClientName sets the long and short client names that are sent to WhatsApp when logging in and displayed in the +WhatsApp Web device list. As the values are only sent when logging in, changing them after logging in is not possible. +*/ +func (wac *Conn) SetClientName(long, short string) error { + if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) { + return fmt.Errorf("cannot change client name after logging in") + } + wac.longClientName, wac.shortClientName = long, short + return nil +} + +/* +Login is the function that creates a new whatsapp session and logs you in. If you do not want to scan the qr code +every time, you should save the returned session and use RestoreSession the next time. Login takes a writable channel +as an parameter. This channel is used to push the data represented by the qr code back to the user. The received data +should be displayed as an qr code in a way you prefer. To print a qr code to console you can use: +github.com/Baozisoftware/qrcode-terminal-go Example login procedure: + wac, err := whatsapp.NewConn(5 * time.Second) + if err != nil { + panic(err) + } + + qr := make(chan string) + go func() { + terminal := qrcodeTerminal.New() + terminal.Get(<-qr).Print() + }() + + session, err := wac.Login(qr) + if err != nil { + fmt.Fprintf(os.Stderr, "error during login: %v\n", err) + } + fmt.Printf("login successful, session: %v\n", session) +*/ +func (wac *Conn) Login(qrChan chan<- string) (Session, error) { + session := Session{} + + if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) { + return session, fmt.Errorf("already logged in") + } + + clientId := make([]byte, 16) + _, err := rand.Read(clientId) + if err != nil { + return session, fmt.Errorf("error creating random ClientId: %v", err) + } + + session.ClientId = base64.StdEncoding.EncodeToString(clientId) + //oldVersion=8691 + login := []interface{}{"admin", "init", []int{0, 3, 225}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true} + loginChan, err := wac.write(login) + if err != nil { + return session, fmt.Errorf("error writing login: %v\n", err) + } + + var r string + select { + case r = <-loginChan: + case <-time.After(wac.msgTimeout): + return session, fmt.Errorf("login connection timed out") + } + + var resp map[string]interface{} + if err = json.Unmarshal([]byte(r), &resp); err != nil { + return session, fmt.Errorf("error decoding login resp: %v\n", err) + } + + ref := resp["ref"].(string) + + priv, pub, err := curve25519.GenerateKey() + if err != nil { + return session, fmt.Errorf("error generating keys: %v\n", err) + } + + //listener for Login response + messageTag := "s1" + wac.listener[messageTag] = make(chan string, 1) + + qrChan <- fmt.Sprintf("%v,%v,%v", ref, base64.StdEncoding.EncodeToString(pub[:]), session.ClientId) + + var resp2 []interface{} + select { + case r1 := <-wac.listener[messageTag]: + if err := json.Unmarshal([]byte(r1), &resp2); err != nil { + return session, fmt.Errorf("error decoding qr code resp: %v", err) + } + case <-time.After(time.Duration(resp["ttl"].(float64)) * time.Millisecond): + return session, fmt.Errorf("qr code scan timed out") + } + + info := resp2[1].(map[string]interface{}) + + wac.Info = newInfoFromReq(info) + + session.ClientToken = info["clientToken"].(string) + session.ServerToken = info["serverToken"].(string) + session.Wid = info["wid"].(string) + s := info["secret"].(string) + decodedSecret, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return session, fmt.Errorf("error decoding secret: %v", err) + } + + var pubKey [32]byte + copy(pubKey[:], decodedSecret[:32]) + + sharedSecret := curve25519.GenerateSharedSecret(*priv, pubKey) + + hash := sha256.New + + nullKey := make([]byte, 32) + h := hmac.New(hash, nullKey) + h.Write(sharedSecret) + + sharedSecretExtended, err := hkdf.Expand(h.Sum(nil), 80, "") + if err != nil { + return session, fmt.Errorf("hkdf error: %v", err) + } + + //login validation + checkSecret := make([]byte, 112) + copy(checkSecret[:32], decodedSecret[:32]) + copy(checkSecret[32:], decodedSecret[64:]) + h2 := hmac.New(hash, sharedSecretExtended[32:64]) + h2.Write(checkSecret) + if !hmac.Equal(h2.Sum(nil), decodedSecret[32:64]) { + return session, fmt.Errorf("abort login") + } + + keysEncrypted := make([]byte, 96) + copy(keysEncrypted[:16], sharedSecretExtended[64:]) + copy(keysEncrypted[16:], decodedSecret[64:]) + + keyDecrypted, err := cbc.Decrypt(sharedSecretExtended[:32], nil, keysEncrypted) + if err != nil { + return session, fmt.Errorf("error decryptAes: %v", err) + } + + session.EncKey = keyDecrypted[:32] + session.MacKey = keyDecrypted[32:64] + wac.session = &session + + return session, nil +} + +/* +RestoreSession is the function that restores a given session. It will try to reestablish the connection to the +WhatsAppWeb servers with the provided session. If it succeeds it will return a new session. This new session has to be +saved because the Client and Server-Token will change after every login. Logging in with old tokens is possible, but not +suggested. If so, a challenge has to be resolved which is just another possible point of failure. +*/ +func (wac *Conn) RestoreSession(session Session) (Session, error) { + if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) { + return Session{}, fmt.Errorf("already logged in") + } + + wac.session = &session + + //listener for Conn or challenge; s1 is not allowed to drop + wac.listener["s1"] = make(chan string, 1) + + //admin init + init := []interface{}{"admin", "init", []int{0, 3, 225}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true} + initChan, err := wac.write(init) + if err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error writing admin init: %v\n", err) + } + + //admin login with takeover + login := []interface{}{"admin", "login", session.ClientToken, session.ServerToken, session.ClientId, "takeover"} + loginChan, err := wac.write(login) + if err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error writing admin login: %v\n", err) + } + + select { + case r := <-initChan: + var resp map[string]interface{} + if err = json.Unmarshal([]byte(r), &resp); err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error decoding login connResp: %v\n", err) + } + + if int(resp["status"].(float64)) != 200 { + wac.session = nil + return Session{}, fmt.Errorf("init responded with %d", resp["status"]) + } + case <-time.After(wac.msgTimeout): + wac.session = nil + return Session{}, fmt.Errorf("restore session init timed out") + } + + //wait for s1 + var connResp []interface{} + select { + case r1 := <-wac.listener["s1"]: + if err := json.Unmarshal([]byte(r1), &connResp); err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error decoding s1 message: %v\n", err) + } + case <-time.After(wac.msgTimeout): + wac.session = nil + return Session{}, fmt.Errorf("restore session connection timed out") + } + + //check if challenge is present + if len(connResp) == 2 && connResp[0] == "Cmd" && connResp[1].(map[string]interface{})["type"] == "challenge" { + wac.listener["s2"] = make(chan string, 1) + + if err := wac.resolveChallenge(connResp[1].(map[string]interface{})["challenge"].(string)); err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error resolving challenge: %v\n", err) + } + + select { + case r := <-wac.listener["s2"]: + if err := json.Unmarshal([]byte(r), &connResp); err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error decoding s2 message: %v\n", err) + } + case <-time.After(wac.msgTimeout): + wac.session = nil + return Session{}, fmt.Errorf("restore session challenge timed out") + } + } + + //check for login 200 --> login success + select { + case r := <-loginChan: + var resp map[string]interface{} + if err = json.Unmarshal([]byte(r), &resp); err != nil { + wac.session = nil + return Session{}, fmt.Errorf("error decoding login connResp: %v\n", err) + } + + if int(resp["status"].(float64)) != 200 { + wac.session = nil + return Session{}, fmt.Errorf("admin login responded with %d", resp["status"]) + } + case <-time.After(wac.msgTimeout): + wac.session = nil + return Session{}, fmt.Errorf("restore session login timed out") + } + + info := connResp[1].(map[string]interface{}) + + wac.Info = newInfoFromReq(info) + + //set new tokens + session.ClientToken = info["clientToken"].(string) + session.ServerToken = info["serverToken"].(string) + session.Wid = info["wid"].(string) + + return *wac.session, nil +} + +func (wac *Conn) resolveChallenge(challenge string) error { + decoded, err := base64.StdEncoding.DecodeString(challenge) + if err != nil { + return err + } + + h2 := hmac.New(sha256.New, wac.session.MacKey) + h2.Write([]byte(decoded)) + + ch := []interface{}{"admin", "challenge", base64.StdEncoding.EncodeToString(h2.Sum(nil)), wac.session.ServerToken, wac.session.ClientId} + challengeChan, err := wac.write(ch) + if err != nil { + return fmt.Errorf("error writing challenge: %v\n", err) + } + + select { + case r := <-challengeChan: + var resp map[string]interface{} + if err := json.Unmarshal([]byte(r), &resp); err != nil { + return fmt.Errorf("error decoding login resp: %v\n", err) + } + if int(resp["status"].(float64)) != 200 { + return fmt.Errorf("challenge responded with %d\n", resp["status"]) + } + case <-time.After(wac.msgTimeout): + return fmt.Errorf("connection timed out") + } + + return nil +} + +/* +Logout is the function to logout from a WhatsApp session. Logging out means invalidating the current session. +The session can not be resumed and will disappear on your phone in the WhatsAppWeb client list. +*/ +func (wac *Conn) Logout() error { + login := []interface{}{"admin", "Conn", "disconnect"} + _, err := wac.write(login) + if err != nil { + return fmt.Errorf("error writing logout: %v\n", err) + } + + return nil +} diff --git a/vendor/github.com/Rhymen/go-whatsapp/store.go b/vendor/github.com/Rhymen/go-whatsapp/store.go new file mode 100644 index 00000000..b1c46e4a --- /dev/null +++ b/vendor/github.com/Rhymen/go-whatsapp/store.go @@ -0,0 +1,45 @@ +package whatsapp + +import ( + "github.com/Rhymen/go-whatsapp/binary" + "strings" +) + +type Store struct { + Contacts map[string]Contact +} + +type Contact struct { + Jid string + Notify string + Name string + Short string +} + +func newStore() *Store { + return &Store{ + make(map[string]Contact), + } +} + +func (wac *Conn) updateContacts(contacts interface{}) { + c, ok := contacts.([]interface{}) + if !ok { + return + } + + for _, contact := range c { + contactNode, ok := contact.(binary.Node) + if !ok { + continue + } + + jid := strings.Replace(contactNode.Attributes["jid"], "@c.us", "@s.whatsapp.net", 1) + wac.Store.Contacts[jid] = Contact{ + jid, + contactNode.Attributes["notify"], + contactNode.Attributes["name"], + contactNode.Attributes["short"], + } + } +} -- cgit v1.2.3